diff --git a/Frameworks/FFMPEG/English.lproj/InfoPlist.strings b/Frameworks/FFMPEG/English.lproj/InfoPlist.strings deleted file mode 100644 index 2fe6c8f6d..000000000 Binary files a/Frameworks/FFMPEG/English.lproj/InfoPlist.strings and /dev/null differ diff --git a/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.pbxproj b/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.pbxproj deleted file mode 100644 index 0175a31c5..000000000 --- a/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.pbxproj +++ /dev/null @@ -1,2156 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 830C4B5B180C3434007674D6 /* amr.h in Headers */ = {isa = PBXBuildFile; fileRef = 830C4B56180C3434007674D6 /* amr.h */; }; - 830C4B5C180C3434007674D6 /* amrnbdata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830C4B57180C3434007674D6 /* amrnbdata.h */; }; - 830C4B5D180C3434007674D6 /* amrnbdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C4B58180C3434007674D6 /* amrnbdec.c */; }; - 830C4B5E180C3434007674D6 /* amrwbdata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830C4B59180C3434007674D6 /* amrwbdata.h */; }; - 830C4B5F180C3434007674D6 /* amrwbdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C4B5A180C3434007674D6 /* amrwbdec.c */; }; - 830C4B61180C343C007674D6 /* amr.c in Sources */ = {isa = PBXBuildFile; fileRef = 830C4B60180C343C007674D6 /* amr.c */; }; - 830C4B63180C3580007674D6 /* amrwbdec_mips.h in Headers */ = {isa = PBXBuildFile; fileRef = 830C4B62180C3580007674D6 /* amrwbdec_mips.h */; }; - 830F0BD117FC4FB900042E8F /* allcodecs.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B8F17FC4FB900042E8F /* allcodecs.c */; }; - 830F0BD217FC4FB900042E8F /* avcodec.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9017FC4FB900042E8F /* avcodec.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BD517FC4FB900042E8F /* fft.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B9317FC4FB900042E8F /* fft.c */; }; - 830F0BD617FC4FB900042E8F /* fft.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9417FC4FB900042E8F /* fft.h */; }; - 830F0BD717FC4FB900042E8F /* get_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9517FC4FB900042E8F /* get_bits.h */; }; - 830F0BD817FC4FB900042E8F /* internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9617FC4FB900042E8F /* internal.h */; }; - 830F0BD917FC4FB900042E8F /* mathops.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9717FC4FB900042E8F /* mathops.h */; }; - 830F0BDA17FC4FB900042E8F /* mathtables.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B9817FC4FB900042E8F /* mathtables.c */; }; - 830F0BDB17FC4FB900042E8F /* mdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B9917FC4FB900042E8F /* mdct.c */; }; - 830F0BDC17FC4FB900042E8F /* old_codec_ids.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9A17FC4FB900042E8F /* old_codec_ids.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BDD17FC4FB900042E8F /* parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B9B17FC4FB900042E8F /* parser.c */; }; - 830F0BDE17FC4FB900042E8F /* parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9C17FC4FB900042E8F /* parser.h */; }; - 830F0BDF17FC4FB900042E8F /* put_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9D17FC4FB900042E8F /* put_bits.h */; }; - 830F0BE017FC4FB900042E8F /* simple_idct.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0B9E17FC4FB900042E8F /* simple_idct.c */; }; - 830F0BE117FC4FB900042E8F /* simple_idct.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0B9F17FC4FB900042E8F /* simple_idct.h */; }; - 830F0BE217FC4FB900042E8F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA017FC4FB900042E8F /* utils.c */; }; - 830F0BE317FC4FB900042E8F /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BA117FC4FB900042E8F /* version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BE417FC4FB900042E8F /* wma_common.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA217FC4FB900042E8F /* wma_common.c */; }; - 830F0BE517FC4FB900042E8F /* wma_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BA317FC4FB900042E8F /* wma_common.h */; }; - 830F0BE617FC4FB900042E8F /* wmadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BA417FC4FB900042E8F /* wmadata.h */; }; - 830F0BE717FC4FB900042E8F /* wmadec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA517FC4FB900042E8F /* wmadec.c */; }; - 830F0BE817FC4FB900042E8F /* wmalosslessdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA617FC4FB900042E8F /* wmalosslessdec.c */; }; - 830F0BE917FC4FB900042E8F /* wmaprodata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BA717FC4FB900042E8F /* wmaprodata.h */; }; - 830F0BEA17FC4FB900042E8F /* wmaprodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA817FC4FB900042E8F /* wmaprodec.c */; }; - 830F0BEB17FC4FB900042E8F /* wmavoice.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BA917FC4FB900042E8F /* wmavoice.c */; }; - 830F0BEC17FC4FB900042E8F /* wmavoice_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BAA17FC4FB900042E8F /* wmavoice_data.h */; }; - 830F0BEE17FC4FB900042E8F /* allformats.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BAE17FC4FB900042E8F /* allformats.c */; }; - 830F0BEF17FC4FB900042E8F /* asf.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BAF17FC4FB900042E8F /* asf.c */; }; - 830F0BF017FC4FB900042E8F /* avformat.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BB017FC4FB900042E8F /* avformat.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BF117FC4FB900042E8F /* avi.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BB117FC4FB900042E8F /* avi.h */; }; - 830F0BF217FC4FB900042E8F /* avio.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB217FC4FB900042E8F /* avio.c */; }; - 830F0BF317FC4FB900042E8F /* avio.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BB317FC4FB900042E8F /* avio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BF417FC4FB900042E8F /* aviobuf.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB417FC4FB900042E8F /* aviobuf.c */; }; - 830F0BF517FC4FB900042E8F /* cutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB517FC4FB900042E8F /* cutils.c */; }; - 830F0BF617FC4FB900042E8F /* file.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB617FC4FB900042E8F /* file.c */; }; - 830F0BF717FC4FB900042E8F /* format.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB717FC4FB900042E8F /* format.c */; }; - 830F0BF817FC4FB900042E8F /* os_support.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BB817FC4FB900042E8F /* os_support.c */; }; - 830F0BF917FC4FB900042E8F /* os_support.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BB917FC4FB900042E8F /* os_support.h */; }; - 830F0BFA17FC4FB900042E8F /* attributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BBB17FC4FB900042E8F /* attributes.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BFB17FC4FB900042E8F /* avutil.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BBC17FC4FB900042E8F /* avutil.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BFC17FC4FB900042E8F /* bswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BBD17FC4FB900042E8F /* bswap.h */; }; - 830F0BFD17FC4FB900042E8F /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BBE17FC4FB900042E8F /* buffer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BFE17FC4FB900042E8F /* channel_layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BBF17FC4FB900042E8F /* channel_layout.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0BFF17FC4FB900042E8F /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC017FC4FB900042E8F /* common.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0017FC4FB900042E8F /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC117FC4FB900042E8F /* cpu.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0117FC4FB900042E8F /* dict.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC217FC4FB900042E8F /* dict.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0217FC4FB900042E8F /* error.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC317FC4FB900042E8F /* error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0317FC4FB900042E8F /* frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC417FC4FB900042E8F /* frame.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0417FC4FB900042E8F /* intfloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC517FC4FB900042E8F /* intfloat.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0517FC4FB900042E8F /* intfloat_readwrite.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC617FC4FB900042E8F /* intfloat_readwrite.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0617FC4FB900042E8F /* log.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC717FC4FB900042E8F /* log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0717FC4FB900042E8F /* mathematics.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BC817FC4FB900042E8F /* mathematics.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0817FC4FB900042E8F /* mem.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0BC917FC4FB900042E8F /* mem.c */; }; - 830F0C0917FC4FB900042E8F /* mem.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BCA17FC4FB900042E8F /* mem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0A17FC4FB900042E8F /* old_pix_fmts.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BCB17FC4FB900042E8F /* old_pix_fmts.h */; }; - 830F0C0B17FC4FB900042E8F /* pixfmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BCC17FC4FB900042E8F /* pixfmt.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0C17FC4FB900042E8F /* rational.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BCD17FC4FB900042E8F /* rational.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C0D17FC4FB900042E8F /* samplefmt.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0BCE17FC4FB900042E8F /* samplefmt.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C1117FC4FF400042E8F /* avfft.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C0F17FC4FF400042E8F /* avfft.c */; }; - 830F0C1217FC4FF400042E8F /* avfft.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1017FC4FF400042E8F /* avfft.h */; }; - 830F0C1417FC500B00042E8F /* fft-internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1317FC500B00042E8F /* fft-internal.h */; }; - 830F0C1917FC523000042E8F /* rdt.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1517FC523000042E8F /* rdt.h */; }; - 830F0C1A17FC523000042E8F /* rtp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1617FC523000042E8F /* rtp.h */; }; - 830F0C1B17FC523000042E8F /* url.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C1717FC523000042E8F /* url.c */; }; - 830F0C1C17FC523000042E8F /* url.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1817FC523000042E8F /* url.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0C2217FC527400042E8F /* atomic_gcc.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1D17FC527400042E8F /* atomic_gcc.h */; }; - 830F0C2317FC527400042E8F /* atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C1E17FC527400042E8F /* atomic.c */; }; - 830F0C2417FC527400042E8F /* atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C1F17FC527400042E8F /* atomic.h */; }; - 830F0C2517FC527400042E8F /* bswap.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C2117FC527400042E8F /* bswap.h */; }; - 830F0C2917FC54F800042E8F /* asfdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C2617FC54F800042E8F /* asfdec.c */; }; - 830F0C2A17FC54F800042E8F /* rtpdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C2717FC54F800042E8F /* rtpdec.h */; }; - 830F0C2B17FC54F800042E8F /* srtp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C2817FC54F800042E8F /* srtp.h */; }; - 830F0C2E17FC551F00042E8F /* asfcrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C2C17FC551F00042E8F /* asfcrypt.c */; }; - 830F0C2F17FC551F00042E8F /* asfcrypt.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C2D17FC551F00042E8F /* asfcrypt.h */; }; - 830F0C3817FC554D00042E8F /* buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C3017FC554D00042E8F /* buffer.c */; }; - 830F0C3917FC554D00042E8F /* des.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C3117FC554D00042E8F /* des.c */; }; - 830F0C3A17FC554D00042E8F /* des.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C3217FC554D00042E8F /* des.h */; }; - 830F0C3B17FC554D00042E8F /* float_dsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C3317FC554D00042E8F /* float_dsp.c */; }; - 830F0C3C17FC554D00042E8F /* float_dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C3417FC554D00042E8F /* float_dsp.h */; }; - 830F0C3D17FC554D00042E8F /* internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C3517FC554D00042E8F /* internal.h */; }; - 830F0C3E17FC554D00042E8F /* libm.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C3617FC554D00042E8F /* libm.h */; }; - 830F0C3F17FC554D00042E8F /* timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C3717FC554D00042E8F /* timer.h */; }; - 830F0C4917FC7CA300042E8F /* asf.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4017FC7CA300042E8F /* asf.h */; }; - 830F0C4A17FC7CA300042E8F /* avio_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4117FC7CA300042E8F /* avio_internal.h */; }; - 830F0C4B17FC7CA300042E8F /* id3v2.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4217FC7CA300042E8F /* id3v2.h */; }; - 830F0C4C17FC7CA300042E8F /* internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4317FC7CA300042E8F /* internal.h */; }; - 830F0C4D17FC7CA300042E8F /* metadata.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C4417FC7CA300042E8F /* metadata.c */; }; - 830F0C4E17FC7CA300042E8F /* metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4517FC7CA300042E8F /* metadata.h */; }; - 830F0C4F17FC7CA300042E8F /* riff.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C4617FC7CA300042E8F /* riff.c */; }; - 830F0C5017FC7CA300042E8F /* riff.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C4717FC7CA300042E8F /* riff.h */; }; - 830F0C5117FC7CA300042E8F /* riffdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C4817FC7CA300042E8F /* riffdec.c */; }; - 830F0C5617FC7CC300042E8F /* avlanguage.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C5217FC7CC300042E8F /* avlanguage.c */; }; - 830F0C5717FC7CC300042E8F /* avlanguage.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C5317FC7CC300042E8F /* avlanguage.h */; }; - 830F0C5817FC7CC300042E8F /* id3v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C5417FC7CC300042E8F /* id3v2.c */; }; - 830F0C5917FC7CC300042E8F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C5517FC7CC300042E8F /* utils.c */; }; - 830F0C5C17FC7CEA00042E8F /* id3v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C5A17FC7CEA00042E8F /* id3v1.c */; }; - 830F0C5D17FC7CEA00042E8F /* id3v1.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C5B17FC7CEA00042E8F /* id3v1.h */; }; - 830F0C5F17FC7D3100042E8F /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 830F0C5E17FC7D3100042E8F /* libz.dylib */; }; - 830F0C6A17FC7DB100042E8F /* avassert.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6017FC7DB100042E8F /* avassert.h */; }; - 830F0C6B17FC7DB100042E8F /* bprint.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C6117FC7DB100042E8F /* bprint.c */; }; - 830F0C6C17FC7DB100042E8F /* bprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6217FC7DB100042E8F /* bprint.h */; }; - 830F0C6D17FC7DB100042E8F /* buffer_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6317FC7DB100042E8F /* buffer_internal.h */; }; - 830F0C6E17FC7DB100042E8F /* intreadwrite.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6417FC7DB100042E8F /* intreadwrite.h */; }; - 830F0C6F17FC7DB100042E8F /* pixdesc.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C6517FC7DB100042E8F /* pixdesc.c */; }; - 830F0C7017FC7DB100042E8F /* pixdesc.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6617FC7DB100042E8F /* pixdesc.h */; }; - 830F0C7117FC7DB100042E8F /* rc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C6717FC7DB100042E8F /* rc4.c */; }; - 830F0C7217FC7DB100042E8F /* rc4.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6817FC7DB100042E8F /* rc4.h */; }; - 830F0C7317FC7DB100042E8F /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C6917FC7DB100042E8F /* version.h */; }; - 830F0C7617FC7DCB00042E8F /* avstring.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C7417FC7DCB00042E8F /* avstring.c */; }; - 830F0C7717FC7DCB00042E8F /* avstring.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C7517FC7DCB00042E8F /* avstring.h */; }; - 830F0C7B17FC7E4E00042E8F /* crc.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C7817FC7E4E00042E8F /* crc.c */; }; - 830F0C7C17FC7E4E00042E8F /* log.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C7917FC7E4E00042E8F /* log.c */; }; - 830F0C7D17FC7E4E00042E8F /* mathematics.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C7A17FC7E4E00042E8F /* mathematics.c */; }; - 830F0C8117FC7ED100042E8F /* crc.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C7E17FC7ED100042E8F /* crc.h */; }; - 830F0C8217FC7ED100042E8F /* dict.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C7F17FC7ED100042E8F /* dict.c */; }; - 830F0C8317FC7ED100042E8F /* rational.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8017FC7ED100042E8F /* rational.c */; }; - 830F0CC217FC7F1E00042E8F /* acelp_filters.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8417FC7F1E00042E8F /* acelp_filters.c */; }; - 830F0CC317FC7F1E00042E8F /* acelp_filters.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C8517FC7F1E00042E8F /* acelp_filters.h */; }; - 830F0CC417FC7F1E00042E8F /* acelp_pitch_delay.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8617FC7F1E00042E8F /* acelp_pitch_delay.c */; }; - 830F0CC517FC7F1E00042E8F /* acelp_pitch_delay.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C8717FC7F1E00042E8F /* acelp_pitch_delay.h */; }; - 830F0CC617FC7F1E00042E8F /* acelp_vectors.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8817FC7F1E00042E8F /* acelp_vectors.c */; }; - 830F0CC717FC7F1E00042E8F /* acelp_vectors.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C8917FC7F1E00042E8F /* acelp_vectors.h */; }; - 830F0CC817FC7F1E00042E8F /* avpacket.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8A17FC7F1E00042E8F /* avpacket.c */; }; - 830F0CC917FC7F1E00042E8F /* bit_depth_template.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8B17FC7F1E00042E8F /* bit_depth_template.c */; }; - 830F0CCA17FC7F1E00042E8F /* bytestream.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C8C17FC7F1E00042E8F /* bytestream.h */; }; - 830F0CCB17FC7F1E00042E8F /* celp_filters.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8D17FC7F1E00042E8F /* celp_filters.c */; }; - 830F0CCC17FC7F1E00042E8F /* celp_filters.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C8E17FC7F1E00042E8F /* celp_filters.h */; }; - 830F0CCD17FC7F1E00042E8F /* celp_math.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C8F17FC7F1E00042E8F /* celp_math.c */; }; - 830F0CCE17FC7F1E00042E8F /* celp_math.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9017FC7F1E00042E8F /* celp_math.h */; }; - 830F0CCF17FC7F1E00042E8F /* copy_block.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9117FC7F1E00042E8F /* copy_block.h */; }; - 830F0CD017FC7F1E00042E8F /* dct.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9217FC7F1E00042E8F /* dct.c */; }; - 830F0CD117FC7F1E00042E8F /* dct.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9317FC7F1E00042E8F /* dct.h */; }; - 830F0CD217FC7F1E00042E8F /* dct32_float.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9417FC7F1E00042E8F /* dct32_float.c */; }; - 830F0CD317FC7F1E00042E8F /* dct32.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9517FC7F1E00042E8F /* dct32.c */; }; - 830F0CD417FC7F1E00042E8F /* dct32.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9617FC7F1E00042E8F /* dct32.h */; }; - 830F0CD517FC7F1E00042E8F /* dctref.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9717FC7F1E00042E8F /* dctref.c */; }; - 830F0CD617FC7F1E00042E8F /* dctref.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9817FC7F1E00042E8F /* dctref.h */; }; - 830F0CDA17FC7F1E00042E8F /* error_resilience.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9C17FC7F1E00042E8F /* error_resilience.c */; }; - 830F0CDB17FC7F1E00042E8F /* error_resilience.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9D17FC7F1E00042E8F /* error_resilience.h */; }; - 830F0CDC17FC7F1E00042E8F /* faandct.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0C9E17FC7F1E00042E8F /* faandct.c */; }; - 830F0CDD17FC7F1E00042E8F /* faandct.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0C9F17FC7F1E00042E8F /* faandct.h */; }; - 830F0CDE17FC7F1E00042E8F /* faanidct.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA017FC7F1E00042E8F /* faanidct.c */; }; - 830F0CDF17FC7F1E00042E8F /* faanidct.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CA117FC7F1E00042E8F /* faanidct.h */; }; - 830F0CE017FC7F1E00042E8F /* fmtconvert.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA217FC7F1E00042E8F /* fmtconvert.c */; }; - 830F0CE117FC7F1E00042E8F /* fmtconvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CA317FC7F1E00042E8F /* fmtconvert.h */; }; - 830F0CE217FC7F1E00042E8F /* frame_thread_encoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA417FC7F1E00042E8F /* frame_thread_encoder.c */; }; - 830F0CE317FC7F1E00042E8F /* frame_thread_encoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CA517FC7F1E00042E8F /* frame_thread_encoder.h */; }; - 830F0CE417FC7F1E00042E8F /* h264chroma_template.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA617FC7F1E00042E8F /* h264chroma_template.c */; }; - 830F0CE517FC7F1E00042E8F /* h264chroma.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA717FC7F1E00042E8F /* h264chroma.c */; }; - 830F0CE617FC7F1E00042E8F /* h264chroma.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CA817FC7F1E00042E8F /* h264chroma.h */; }; - 830F0CE717FC7F1E00042E8F /* hpeldsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CA917FC7F1E00042E8F /* hpeldsp.c */; }; - 830F0CE817FC7F1E00042E8F /* hpeldsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CAA17FC7F1E00042E8F /* hpeldsp.h */; }; - 830F0CE917FC7F1E00042E8F /* imgconvert.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CAB17FC7F1E00042E8F /* imgconvert.c */; }; - 830F0CEA17FC7F1E00042E8F /* imgconvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CAC17FC7F1E00042E8F /* imgconvert.h */; }; - 830F0CEB17FC7F1E00042E8F /* lsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CAD17FC7F1E00042E8F /* lsp.c */; }; - 830F0CEC17FC7F1E00042E8F /* lsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CAE17FC7F1E00042E8F /* lsp.h */; }; - 830F0CED17FC7F1E00042E8F /* mpeg12data.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CAF17FC7F1E00042E8F /* mpeg12data.c */; }; - 830F0CEE17FC7F1E00042E8F /* mpeg12data.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB017FC7F1E00042E8F /* mpeg12data.h */; }; - 830F0CEF17FC7F1E00042E8F /* mpegvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB117FC7F1E00042E8F /* mpegvideo.h */; }; - 830F0CF017FC7F1E00042E8F /* ratecontrol.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CB217FC7F1E00042E8F /* ratecontrol.c */; }; - 830F0CF117FC7F1E00042E8F /* ratecontrol.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB317FC7F1E00042E8F /* ratecontrol.h */; }; - 830F0CF217FC7F1E00042E8F /* raw.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CB417FC7F1E00042E8F /* raw.c */; }; - 830F0CF317FC7F1E00042E8F /* raw.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB517FC7F1E00042E8F /* raw.h */; }; - 830F0CF417FC7F1E00042E8F /* rdft.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CB617FC7F1E00042E8F /* rdft.c */; }; - 830F0CF517FC7F1E00042E8F /* rdft.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB717FC7F1E00042E8F /* rdft.h */; }; - 830F0CF617FC7F1E00042E8F /* rl.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB817FC7F1E00042E8F /* rl.h */; }; - 830F0CF717FC7F1E00042E8F /* rnd_avg.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CB917FC7F1E00042E8F /* rnd_avg.h */; }; - 830F0CF917FC7F1E00042E8F /* sinewin.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CBB17FC7F1E00042E8F /* sinewin.c */; }; - 830F0CFA17FC7F1E00042E8F /* sinewin.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CBC17FC7F1E00042E8F /* sinewin.h */; }; - 830F0CFB17FC7F1E00042E8F /* thread.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CBD17FC7F1E00042E8F /* thread.h */; }; - 830F0CFC17FC7F1E00042E8F /* videodsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CBE17FC7F1E00042E8F /* videodsp.c */; }; - 830F0CFD17FC7F1E00042E8F /* videodsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CBF17FC7F1E00042E8F /* videodsp.h */; }; - 830F0CFE17FC7F1E00042E8F /* wma.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0CC017FC7F1E00042E8F /* wma.c */; }; - 830F0CFF17FC7F1E00042E8F /* wma.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0CC117FC7F1E00042E8F /* wma.h */; }; - 830F0D0317FC7F4000042E8F /* sinewin_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D0117FC7F4000042E8F /* sinewin_tablegen.h */; }; - 830F0D0B17FC80B400042E8F /* lsp_mips.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D0517FC80B400042E8F /* lsp_mips.h */; }; - 830F0D0C17FC80B400042E8F /* rectangle.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D0617FC80B400042E8F /* rectangle.h */; }; - 830F0D0F17FC80B400042E8F /* mathops.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D0A17FC80B400042E8F /* mathops.h */; }; - 830F0D1317FC815000042E8F /* constants.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D1017FC815000042E8F /* constants.c */; }; - 830F0D1417FC815000042E8F /* constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D1117FC815000042E8F /* constants.h */; }; - 830F0D1E17FC82AB00042E8F /* colorspace.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D1617FC82AB00042E8F /* colorspace.h */; }; - 830F0D1F17FC82AB00042E8F /* cpu_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D1717FC82AB00042E8F /* cpu_internal.h */; }; - 830F0D2017FC82AB00042E8F /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D1817FC82AB00042E8F /* cpu.c */; }; - 830F0D2117FC82AB00042E8F /* eval.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D1917FC82AB00042E8F /* eval.c */; }; - 830F0D2217FC82AB00042E8F /* eval.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D1A17FC82AB00042E8F /* eval.h */; }; - 830F0D2317FC82AB00042E8F /* fifo.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D1B17FC82AB00042E8F /* fifo.c */; }; - 830F0D2417FC82AB00042E8F /* fifo.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D1C17FC82AB00042E8F /* fifo.h */; }; - 830F0D2517FC82AB00042E8F /* frame.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D1D17FC82AB00042E8F /* frame.c */; }; - 830F0D2E17FC841B00042E8F /* channel_layout.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2617FC841B00042E8F /* channel_layout.c */; }; - 830F0D2F17FC841B00042E8F /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2717FC841B00042E8F /* error.c */; }; - 830F0D3017FC841B00042E8F /* imgutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2817FC841B00042E8F /* imgutils.c */; }; - 830F0D3117FC841B00042E8F /* imgutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D2917FC841B00042E8F /* imgutils.h */; }; - 830F0D3217FC841B00042E8F /* intfloat_readwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2A17FC841B00042E8F /* intfloat_readwrite.c */; }; - 830F0D3317FC841B00042E8F /* opt.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2B17FC841B00042E8F /* opt.c */; }; - 830F0D3417FC841B00042E8F /* opt.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D2C17FC841B00042E8F /* opt.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 830F0D3517FC841B00042E8F /* samplefmt.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D2D17FC841B00042E8F /* samplefmt.c */; }; - 830F0D3817FC844E00042E8F /* parseutils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D3617FC844E00042E8F /* parseutils.c */; }; - 830F0D3917FC844E00042E8F /* parseutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D3717FC844E00042E8F /* parseutils.h */; }; - 830F0D3C17FC846C00042E8F /* random_seed.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D3A17FC846C00042E8F /* random_seed.c */; }; - 830F0D3D17FC846C00042E8F /* random_seed.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D3B17FC846C00042E8F /* random_seed.h */; }; - 830F0D4017FC848D00042E8F /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D3E17FC848D00042E8F /* sha.c */; }; - 830F0D4117FC848D00042E8F /* sha.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D3F17FC848D00042E8F /* sha.h */; }; - 830F0D4617FC85ED00042E8F /* integer.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4217FC85ED00042E8F /* integer.c */; }; - 830F0D4717FC85ED00042E8F /* integer.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D4317FC85ED00042E8F /* integer.h */; }; - 830F0D4817FC85ED00042E8F /* intmath.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4417FC85ED00042E8F /* intmath.c */; }; - 830F0D4917FC85ED00042E8F /* intmath.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D4517FC85ED00042E8F /* intmath.h */; }; - 830F0D4D17FC862400042E8F /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4A17FC862300042E8F /* time.c */; }; - 830F0D4F17FC862400042E8F /* utils.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D4C17FC862400042E8F /* utils.c */; }; - 830F0D5317FC891800042E8F /* file_open.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5217FC891800042E8F /* file_open.c */; }; - 830F0D5817FC893E00042E8F /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5417FC893E00042E8F /* bitstream.c */; }; - 830F0D5917FC893E00042E8F /* codec_desc.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5517FC893E00042E8F /* codec_desc.c */; }; - 830F0D5A17FC893E00042E8F /* rawdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5617FC893E00042E8F /* rawdec.c */; }; - 830F0D5B17FC893E00042E8F /* tableprint.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D5717FC893E00042E8F /* tableprint.h */; }; - 830F0D5E17FC89BD00042E8F /* options_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D5C17FC89BD00042E8F /* options_table.h */; }; - 830F0D5F17FC89BD00042E8F /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D5D17FC89BD00042E8F /* options.c */; }; - 830F0D6417FC8A3300042E8F /* audiointerleave.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D6017FC8A3300042E8F /* audiointerleave.c */; }; - 830F0D6517FC8A3300042E8F /* audiointerleave.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D6117FC8A3300042E8F /* audiointerleave.h */; }; - 830F0D6617FC8A3300042E8F /* options_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D6217FC8A3300042E8F /* options_table.h */; }; - 830F0D6717FC8A3300042E8F /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D6317FC8A3300042E8F /* options.c */; }; - 830F0D6917FC8A3D00042E8F /* avpicture.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D6817FC8A3D00042E8F /* avpicture.c */; }; - 830F0D6C17FC8C0700042E8F /* aactab.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D6A17FC8C0700042E8F /* aactab.c */; }; - 830F0D6D17FC8C0700042E8F /* aactab.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D6B17FC8C0700042E8F /* aactab.h */; }; - 830F0D7117FC8C1300042E8F /* ast.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D6E17FC8C1300042E8F /* ast.c */; }; - 830F0D7217FC8C1300042E8F /* ast.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D6F17FC8C1300042E8F /* ast.h */; }; - 830F0D7317FC8C1300042E8F /* astdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D7017FC8C1300042E8F /* astdec.c */; }; - 830F0D7717FC8C7300042E8F /* aac.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D7417FC8C7300042E8F /* aac.h */; }; - 830F0D7817FC8C7300042E8F /* mpeg4audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D7517FC8C7300042E8F /* mpeg4audio.c */; }; - 830F0D7917FC8C7300042E8F /* mpeg4audio.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D7617FC8C7300042E8F /* mpeg4audio.h */; }; - 830F0D7B17FC8E2400042E8F /* avidec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D7A17FC8E2400042E8F /* avidec.c */; }; - 830F0D7E17FC8E4800042E8F /* dv.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D7C17FC8E4800042E8F /* dv.c */; }; - 830F0D7F17FC8E4800042E8F /* dv.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D7D17FC8E4800042E8F /* dv.h */; }; - 830F0D8817FC8E8B00042E8F /* aac_tablegen_decl.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8017FC8E8B00042E8F /* aac_tablegen_decl.h */; }; - 830F0D8917FC8E8B00042E8F /* aac_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8117FC8E8B00042E8F /* aac_tablegen.h */; }; - 830F0D8A17FC8E8B00042E8F /* aacps.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8217FC8E8B00042E8F /* aacps.h */; }; - 830F0D8B17FC8E8B00042E8F /* aacpsdsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8317FC8E8B00042E8F /* aacpsdsp.h */; }; - 830F0D8C17FC8E8B00042E8F /* dv_profile.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D8417FC8E8B00042E8F /* dv_profile.c */; }; - 830F0D8D17FC8E8B00042E8F /* dv_profile.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8517FC8E8B00042E8F /* dv_profile.h */; }; - 830F0D8E17FC8E8B00042E8F /* sbr.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8617FC8E8B00042E8F /* sbr.h */; }; - 830F0D8F17FC8E8B00042E8F /* sbrdsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D8717FC8E8B00042E8F /* sbrdsp.h */; }; - 830F0D9217FC8EAC00042E8F /* dvdata.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0D9017FC8EAC00042E8F /* dvdata.c */; }; - 830F0D9317FC8EAC00042E8F /* dvdata.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0D9117FC8EAC00042E8F /* dvdata.h */; }; - 830F0DAD17FC8FBD00042E8F /* dct_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DA917FC8FBD00042E8F /* dct_init.c */; }; - 830F0DAE17FC8FBD00042E8F /* fft_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DAA17FC8FBD00042E8F /* fft_init.c */; }; - 830F0DAF17FC8FBD00042E8F /* fmtconvert_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DAB17FC8FBD00042E8F /* fmtconvert_init.c */; }; - 830F0DB017FC8FBD00042E8F /* hpeldsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DAC17FC8FBD00042E8F /* hpeldsp_init.c */; }; - 830F0DB217FC8FCE00042E8F /* log2_tab.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DB117FC8FCE00042E8F /* log2_tab.c */; }; - 830F0DB817FC921D00042E8F /* asm.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DB317FC921D00042E8F /* asm.h */; }; - 830F0DB917FC921D00042E8F /* cpu.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DB417FC921D00042E8F /* cpu.c */; }; - 830F0DBA17FC921D00042E8F /* cpu.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DB517FC921D00042E8F /* cpu.h */; }; - 830F0DBB17FC921D00042E8F /* emms.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DB617FC921D00042E8F /* emms.h */; }; - 830F0DBC17FC921D00042E8F /* timer.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DB717FC921D00042E8F /* timer.h */; }; - 830F0DBE17FC922C00042E8F /* h264chroma_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DBD17FC922C00042E8F /* h264chroma_init.c */; }; - 830F0DC017FC927D00042E8F /* float_dsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DBF17FC927D00042E8F /* float_dsp_init.c */; }; - 830F0DC217FC929E00042E8F /* mux.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DC117FC929E00042E8F /* mux.c */; }; - 830F0DC417FC92EE00042E8F /* videodsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DC317FC92EE00042E8F /* videodsp_init.c */; }; - 830F0DC617FC92FA00042E8F /* wavdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DC517FC92FA00042E8F /* wavdec.c */; }; - 830F0DC917FC931700042E8F /* pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DC717FC931700042E8F /* pcm.c */; }; - 830F0DCA17FC931700042E8F /* pcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DC817FC931700042E8F /* pcm.h */; }; - 830F0DCD17FC933100042E8F /* w64.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DCB17FC933100042E8F /* w64.c */; }; - 830F0DCE17FC933100042E8F /* w64.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DCC17FC933100042E8F /* w64.h */; }; - 830F0DD117FC934D00042E8F /* spdif.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DCF17FC934D00042E8F /* spdif.c */; }; - 830F0DD217FC934D00042E8F /* spdif.h in Headers */ = {isa = PBXBuildFile; fileRef = 830F0DD017FC934D00042E8F /* spdif.h */; }; - 830F0DD617FC93E400042E8F /* xwma.c in Sources */ = {isa = PBXBuildFile; fileRef = 830F0DD417FC93E400042E8F /* xwma.c */; }; - 832F4BA618CD4F47003E940E /* lls2.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BA418CD4F47003E940E /* lls2.c */; }; - 832F4BA718CD4F47003E940E /* lls2.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BA518CD4F47003E940E /* lls2.h */; }; - 832F4BAF18CD4F6B003E940E /* atrac3plus_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BA918CD4F6B003E940E /* atrac3plus_data.h */; }; - 832F4BB018CD4F6B003E940E /* atrac3plus.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BAA18CD4F6B003E940E /* atrac3plus.c */; }; - 832F4BB118CD4F6B003E940E /* atrac3plus.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BAB18CD4F6B003E940E /* atrac3plus.h */; }; - 832F4BB218CD4F6B003E940E /* atrac3plusdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BAC18CD4F6B003E940E /* atrac3plusdec.c */; }; - 832F4BB318CD4F6B003E940E /* atrac3plusdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BAD18CD4F6B003E940E /* atrac3plusdsp.c */; }; - 832F4BB618CD4FEA003E940E /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BB418CD4FEA003E940E /* macros.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 832F4BB718CD4FEA003E940E /* timestamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BB518CD4FEA003E940E /* timestamp.h */; }; - 832F4BBA18CD53E9003E940E /* ttadsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BB818CD53E9003E940E /* ttadsp.c */; }; - 832F4BBB18CD53E9003E940E /* ttadsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BB918CD53E9003E940E /* ttadsp.h */; }; - 832F4BC018CD5DD9003E940E /* downmix_info.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BBE18CD5DD9003E940E /* downmix_info.c */; }; - 832F4BC118CD5DD9003E940E /* downmix_info.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BBF18CD5DD9003E940E /* downmix_info.h */; }; - 832F4BC318CD5DE2003E940E /* time_.h in Headers */ = {isa = PBXBuildFile; fileRef = 832F4BC218CD5DE2003E940E /* time_.h */; }; - 832F4BC518CD601B003E940E /* ttadsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BC418CD601B003E940E /* ttadsp_init.c */; }; - 832F4BC718CD6052003E940E /* dcadsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 832F4BC618CD6052003E940E /* dcadsp_init.c */; }; - 833C3795180328A300CBA602 /* takdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3794180328A300CBA602 /* takdec.c */; }; - 833C379A180328B300CBA602 /* tak_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3796180328B300CBA602 /* tak_parser.c */; }; - 833C379B180328B300CBA602 /* tak.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3797180328B300CBA602 /* tak.c */; }; - 833C379C180328B300CBA602 /* tak.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C3798180328B300CBA602 /* tak.h */; }; - 833C379D180328B300CBA602 /* takdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C3799180328B300CBA602 /* takdec.c */; }; - 833C379F18032A2700CBA602 /* unary.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C379E18032A2700CBA602 /* unary.h */; }; - 833C37A218032A2F00CBA602 /* rawdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37A018032A2F00CBA602 /* rawdec.c */; }; - 833C37A318032A2F00CBA602 /* rawdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37A118032A2F00CBA602 /* rawdec.h */; }; - 833C37A618032A5000CBA602 /* apetag.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37A418032A5000CBA602 /* apetag.c */; }; - 833C37A718032A5000CBA602 /* apetag.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37A518032A5000CBA602 /* apetag.h */; }; - 833C37A918032AAD00CBA602 /* img2.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37A818032AAD00CBA602 /* img2.c */; }; - 833C37B118032AEF00CBA602 /* diracdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37AA18032AEF00CBA602 /* diracdsp.c */; }; - 833C37B218032AEF00CBA602 /* diracdsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37AB18032AEF00CBA602 /* diracdsp.h */; }; - 833C37B318032AEF00CBA602 /* dsputil.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37AC18032AEF00CBA602 /* dsputil.c */; }; - 833C37B418032AEF00CBA602 /* dsputil.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37AD18032AEF00CBA602 /* dsputil.h */; }; - 833C37B518032AEF00CBA602 /* diracdsp_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37AE18032AEF00CBA602 /* diracdsp_mmx.c */; }; - 833C37B618032AEF00CBA602 /* diracdsp_mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37AF18032AEF00CBA602 /* diracdsp_mmx.h */; }; - 833C37B718032AEF00CBA602 /* dsputil_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37B018032AEF00CBA602 /* dsputil_x86.h */; }; - 833C37C218032CF600CBA602 /* dirac_arith.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37BA18032CF600CBA602 /* dirac_arith.c */; }; - 833C37C318032CF600CBA602 /* dirac_arith.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37BB18032CF600CBA602 /* dirac_arith.h */; }; - 833C37C418032CF600CBA602 /* dirac_dwt.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37BC18032CF600CBA602 /* dirac_dwt.c */; }; - 833C37C518032CF600CBA602 /* dirac_dwt.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37BD18032CF600CBA602 /* dirac_dwt.h */; }; - 833C37C618032CF600CBA602 /* dirac_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37BE18032CF600CBA602 /* dirac_parser.c */; }; - 833C37C718032CF600CBA602 /* dirac.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37BF18032CF600CBA602 /* dirac.c */; }; - 833C37C818032CF600CBA602 /* dirac.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37C018032CF600CBA602 /* dirac.h */; }; - 833C37C918032CF600CBA602 /* diracdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37C118032CF600CBA602 /* diracdec.c */; }; - 833C37CE18032D4800CBA602 /* golomb.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37CA18032D4800CBA602 /* golomb.c */; }; - 833C37CF18032D4800CBA602 /* golomb.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37CB18032D4800CBA602 /* golomb.h */; }; - 833C37D018032D4800CBA602 /* dirac_dwt.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37CC18032D4800CBA602 /* dirac_dwt.c */; }; - 833C37D118032D4800CBA602 /* dirac_dwt.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37CD18032D4800CBA602 /* dirac_dwt.h */; }; - 833C37D318032E4800CBA602 /* dsputil_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37D218032E4800CBA602 /* dsputil_init.c */; }; - 833C37D518032E7000CBA602 /* jrevdct.c in Sources */ = {isa = PBXBuildFile; fileRef = 833C37D418032E7000CBA602 /* jrevdct.c */; }; - 833C37D718032EA500CBA602 /* idct_xvid.h in Headers */ = {isa = PBXBuildFile; fileRef = 833C37D618032EA500CBA602 /* idct_xvid.h */; }; - 833E5F9C18A31EB7006A85F9 /* vqf.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E5F9B18A31EB7006A85F9 /* vqf.c */; }; - 833E5FA118A31EC4006A85F9 /* twinvq_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E5F9D18A31EC4006A85F9 /* twinvq_data.h */; }; - 833E5FA218A31EC4006A85F9 /* twinvq.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E5F9E18A31EC4006A85F9 /* twinvq.c */; }; - 833E5FA318A31EC4006A85F9 /* twinvq.h in Headers */ = {isa = PBXBuildFile; fileRef = 833E5F9F18A31EC4006A85F9 /* twinvq.h */; }; - 833E5FA418A31EC4006A85F9 /* twinvqdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 833E5FA018A31EC4006A85F9 /* twinvqdec.c */; }; - 8384904D1807898200E7332D /* apedec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384904C1807898200E7332D /* apedec.c */; }; - 8384904F1807898A00E7332D /* ape.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384904E1807898A00E7332D /* ape.c */; }; - 8384905C1807AF0100E7332D /* ac3_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490501807AF0100E7332D /* ac3_parser.c */; }; - 8384905D1807AF0100E7332D /* ac3_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490511807AF0100E7332D /* ac3_parser.h */; }; - 8384905E1807AF0100E7332D /* ac3.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490521807AF0100E7332D /* ac3.c */; }; - 8384905F1807AF0100E7332D /* ac3.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490531807AF0100E7332D /* ac3.h */; }; - 838490601807AF0100E7332D /* ac3dec_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490541807AF0100E7332D /* ac3dec_data.c */; }; - 838490611807AF0100E7332D /* ac3dec_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490551807AF0100E7332D /* ac3dec_data.h */; }; - 838490621807AF0100E7332D /* ac3dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490561807AF0100E7332D /* ac3dec.c */; }; - 838490631807AF0100E7332D /* ac3dec.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490571807AF0100E7332D /* ac3dec.h */; }; - 838490641807AF0100E7332D /* ac3dsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490581807AF0100E7332D /* ac3dsp.c */; }; - 838490651807AF0100E7332D /* ac3dsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490591807AF0100E7332D /* ac3dsp.h */; }; - 838490661807AF0100E7332D /* ac3tab.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384905A1807AF0100E7332D /* ac3tab.c */; }; - 838490671807AF0100E7332D /* ac3tab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384905B1807AF0100E7332D /* ac3tab.h */; }; - 838490691807AF5800E7332D /* ac3dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490681807AF5800E7332D /* ac3dec.c */; }; - 8384906C1807AFB800E7332D /* aac_ac3_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384906A1807AFB800E7332D /* aac_ac3_parser.c */; }; - 8384906D1807AFB800E7332D /* aac_ac3_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384906B1807AFB800E7332D /* aac_ac3_parser.h */; }; - 838490701807B04200E7332D /* lfg.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384906E1807B04200E7332D /* lfg.c */; }; - 838490711807B04200E7332D /* lfg.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384906F1807B04200E7332D /* lfg.h */; }; - 838490741807B07000E7332D /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490721807B07000E7332D /* md5.c */; }; - 838490751807B07000E7332D /* md5.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490731807B07000E7332D /* md5.h */; }; - 838490781807B13000E7332D /* kbdwin.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490761807B13000E7332D /* kbdwin.c */; }; - 838490791807B13000E7332D /* kbdwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490771807B13000E7332D /* kbdwin.h */; }; - 8384907F1807B17500E7332D /* eac3_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384907A1807B17500E7332D /* eac3_data.c */; }; - 838490801807B17500E7332D /* eac3_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384907B1807B17500E7332D /* eac3_data.h */; }; - 838490811807B17500E7332D /* eac3dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384907C1807B17500E7332D /* eac3dec.c */; }; - 838490851807B17C00E7332D /* ac3dsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490841807B17C00E7332D /* ac3dsp_init.c */; }; - 8384908E1807BC9400E7332D /* dca_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490861807BC9400E7332D /* dca_parser.c */; }; - 8384908F1807BC9400E7332D /* dca.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490871807BC9400E7332D /* dca.c */; }; - 838490901807BC9400E7332D /* dca.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490881807BC9400E7332D /* dca.h */; }; - 838490911807BC9400E7332D /* dcadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490891807BC9400E7332D /* dcadata.h */; }; - 838490921807BC9400E7332D /* dcadec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384908A1807BC9400E7332D /* dcadec.c */; }; - 838490931807BC9400E7332D /* dcadsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384908B1807BC9400E7332D /* dcadsp.c */; }; - 838490941807BC9400E7332D /* dcadsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384908C1807BC9400E7332D /* dcadsp.h */; }; - 838490951807BC9400E7332D /* dcahuff.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384908D1807BC9400E7332D /* dcahuff.h */; }; - 838490981807BC9C00E7332D /* dtshddec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490961807BC9C00E7332D /* dtshddec.c */; }; - 838490991807BC9C00E7332D /* dtsdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490971807BC9C00E7332D /* dtsdec.c */; }; - 8384909C1807BE1300E7332D /* synth_filter.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384909A1807BE1300E7332D /* synth_filter.c */; }; - 8384909D1807BE1300E7332D /* synth_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384909B1807BE1300E7332D /* synth_filter.h */; }; - 838490A31807C12300E7332D /* adpcm_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384909E1807C12300E7332D /* adpcm_data.c */; }; - 838490A41807C12300E7332D /* adpcm_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 8384909F1807C12300E7332D /* adpcm_data.h */; }; - 838490A51807C12300E7332D /* adpcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490A01807C12300E7332D /* adpcm.c */; }; - 838490A61807C12300E7332D /* adpcm.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490A11807C12300E7332D /* adpcm.h */; }; - 838490A71807C12300E7332D /* pcm.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490A21807C12300E7332D /* pcm.c */; }; - 838490B11807C1C300E7332D /* gsm_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490A81807C1C300E7332D /* gsm_parser.c */; }; - 838490B21807C1C300E7332D /* gsm.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490A91807C1C300E7332D /* gsm.h */; }; - 838490B31807C1C300E7332D /* gsmdec_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490AA1807C1C300E7332D /* gsmdec_data.c */; }; - 838490B41807C1C300E7332D /* gsmdec_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490AB1807C1C300E7332D /* gsmdec_data.h */; }; - 838490B51807C1C300E7332D /* gsmdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490AC1807C1C300E7332D /* gsmdec.c */; }; - 838490B61807C1C300E7332D /* msgsmdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490AD1807C1C300E7332D /* msgsmdec.c */; }; - 838490B71807C1C300E7332D /* msgsmdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490AE1807C1C300E7332D /* msgsmdec.h */; }; - 838490B81807C1C300E7332D /* truespeech_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490AF1807C1C300E7332D /* truespeech_data.h */; }; - 838490B91807C1C300E7332D /* truespeech.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490B01807C1C300E7332D /* truespeech.c */; }; - 838490BB1807C30900E7332D /* pcm_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490BA1807C30900E7332D /* pcm_tablegen.h */; }; - 838490BE1807C34900E7332D /* atrac3.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490BC1807C34900E7332D /* atrac3.c */; }; - 838490BF1807C34900E7332D /* atrac3data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490BD1807C34900E7332D /* atrac3data.h */; }; - 838490C21807C37300E7332D /* atrac.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490C01807C37300E7332D /* atrac.c */; }; - 838490C31807C37300E7332D /* atrac.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490C11807C37300E7332D /* atrac.h */; }; - 838490D51807C47E00E7332D /* g729.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490CA1807C47E00E7332D /* g729.h */; }; - 838490D61807C47E00E7332D /* g729data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490CB1807C47E00E7332D /* g729data.h */; }; - 838490D71807C47E00E7332D /* g729dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490CC1807C47E00E7332D /* g729dec.c */; }; - 838490D81807C47E00E7332D /* g729postfilter.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490CD1807C47E00E7332D /* g729postfilter.c */; }; - 838490D91807C47E00E7332D /* g729postfilter.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490CE1807C47E00E7332D /* g729postfilter.h */; }; - 838490DA1807C47E00E7332D /* g726.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490CF1807C47E00E7332D /* g726.c */; }; - 838490DB1807C47E00E7332D /* g723_1_data.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490D01807C47E00E7332D /* g723_1_data.h */; }; - 838490DC1807C47E00E7332D /* g723_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490D11807C47E00E7332D /* g723_1.c */; }; - 838490DD1807C47E00E7332D /* g722dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490D21807C47E00E7332D /* g722dec.c */; }; - 838490DE1807C47E00E7332D /* g722.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490D31807C47E00E7332D /* g722.c */; }; - 838490DF1807C47E00E7332D /* g722.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490D41807C47E00E7332D /* g722.h */; }; - 838490EF1807C57B00E7332D /* aac_adtstoasc_bsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490E01807C57B00E7332D /* aac_adtstoasc_bsf.c */; }; - 838490F01807C57B00E7332D /* aac_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490E11807C57B00E7332D /* aac_parser.c */; }; - 838490F11807C57B00E7332D /* aacadtsdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490E21807C57B00E7332D /* aacadtsdec.c */; }; - 838490F21807C57B00E7332D /* aacadtsdec.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490E31807C57B00E7332D /* aacadtsdec.h */; }; - 838490F41807C57B00E7332D /* aacdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490E51807C57B00E7332D /* aacdec.c */; }; - 838490F51807C57B00E7332D /* aacdectab.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490E61807C57B00E7332D /* aacdectab.h */; }; - 838490F61807C57B00E7332D /* aacps_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490E71807C57B00E7332D /* aacps_tablegen.h */; }; - 838490F71807C57B00E7332D /* aacps.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490E81807C57B00E7332D /* aacps.c */; }; - 838490F91807C57B00E7332D /* aacpsdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490EA1807C57B00E7332D /* aacpsdsp.c */; }; - 838490FB1807C57B00E7332D /* aacsbr.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490EC1807C57B00E7332D /* aacsbr.c */; }; - 838490FC1807C57B00E7332D /* aacsbr.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490ED1807C57B00E7332D /* aacsbr.h */; }; - 838490FD1807C57B00E7332D /* aacsbrdata.h in Headers */ = {isa = PBXBuildFile; fileRef = 838490EE1807C57B00E7332D /* aacsbrdata.h */; }; - 838490FF1807C58500E7332D /* aacdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838490FE1807C58500E7332D /* aacdec.c */; }; - 838491021807CDC000E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491001807CDC000E7332D /* lpc.c */; }; - 838491031807CDC000E7332D /* lpc.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491011807CDC000E7332D /* lpc.h */; }; - 838491051807CDEC00E7332D /* cbrt_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491041807CDEC00E7332D /* cbrt_tablegen.h */; }; - 8384910B1807CE2A00E7332D /* lls_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910A1807CE2A00E7332D /* lls_init.c */; }; - 8384910D1807CEB600E7332D /* sbrdsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910C1807CEB600E7332D /* sbrdsp.c */; }; - 8384910F1807CEC400E7332D /* lpc.c in Sources */ = {isa = PBXBuildFile; fileRef = 8384910E1807CEC400E7332D /* lpc.c */; }; - 838491111807CEF400E7332D /* sbrdsp_init.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491101807CEF400E7332D /* sbrdsp_init.c */; }; - 838491131807D06100E7332D /* spdifdec.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491121807D06100E7332D /* spdifdec.c */; }; - 838491151807D1D200E7332D /* tta.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491141807D1D200E7332D /* tta.c */; }; - 838491191807D1D900E7332D /* tta.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491161807D1D900E7332D /* tta.c */; }; - 8384911A1807D1D900E7332D /* ttadata.c in Sources */ = {isa = PBXBuildFile; fileRef = 838491171807D1D900E7332D /* ttadata.c */; }; - 8384911B1807D1D900E7332D /* ttadata.h in Headers */ = {isa = PBXBuildFile; fileRef = 838491181807D1D900E7332D /* ttadata.h */; }; - 8393B7E218052BB000913C76 /* mp3dec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7DF18052BB000913C76 /* mp3dec.c */; }; - 8393B7E318052BB000913C76 /* mpeg.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7E018052BB000913C76 /* mpeg.c */; }; - 8393B7E418052BB000913C76 /* mpeg.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7E118052BB000913C76 /* mpeg.h */; }; - 8393B7F918052BC200913C76 /* mpegaudio_parser.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7E518052BC200913C76 /* mpegaudio_parser.c */; }; - 8393B7FA18052BC200913C76 /* mpegaudio_tablegen.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7E618052BC200913C76 /* mpegaudio_tablegen.c */; }; - 8393B7FB18052BC200913C76 /* mpegaudio_tablegen.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7E718052BC200913C76 /* mpegaudio_tablegen.h */; }; - 8393B7FC18052BC200913C76 /* mpegaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7E818052BC200913C76 /* mpegaudio.c */; }; - 8393B7FD18052BC200913C76 /* mpegaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7E918052BC200913C76 /* mpegaudio.h */; }; - 8393B7FE18052BC200913C76 /* mpegaudiodata.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7EA18052BC200913C76 /* mpegaudiodata.c */; }; - 8393B7FF18052BC200913C76 /* mpegaudiodata.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7EB18052BC200913C76 /* mpegaudiodata.h */; }; - 8393B80018052BC200913C76 /* mpegaudiodec_float.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7EC18052BC200913C76 /* mpegaudiodec_float.c */; }; - 8393B80118052BC200913C76 /* mpegaudiodec.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7ED18052BC200913C76 /* mpegaudiodec.c */; }; - 8393B80218052BC200913C76 /* mpegaudiodecheader.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7EE18052BC200913C76 /* mpegaudiodecheader.c */; }; - 8393B80318052BC200913C76 /* mpegaudiodecheader.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7EF18052BC200913C76 /* mpegaudiodecheader.h */; }; - 8393B80418052BC200913C76 /* mpegaudiodectab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F018052BC200913C76 /* mpegaudiodectab.h */; }; - 8393B80518052BC200913C76 /* mpegaudiodsp_data.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */; }; - 8393B80718052BC200913C76 /* mpegaudiodsp_float.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */; }; - 8393B80A18052BC200913C76 /* mpegaudiodsp.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F618052BC200913C76 /* mpegaudiodsp.h */; }; - 8393B80C18052BC200913C76 /* mpegaudiotab.h in Headers */ = {isa = PBXBuildFile; fileRef = 8393B7F818052BC200913C76 /* mpegaudiotab.h */; }; - 8393B80E18052BD500913C76 /* mpegaudiodsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80D18052BD500913C76 /* mpegaudiodsp.c */; }; - 8393B81118052DB700913C76 /* bitstream_filter.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B80F18052DB700913C76 /* bitstream_filter.c */; }; - 8393B81218052DB700913C76 /* mp3_header_decompress_bsf.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B81018052DB700913C76 /* mp3_header_decompress_bsf.c */; }; - 8393B81418052E7400913C76 /* mpegaudiodsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B81318052E7400913C76 /* mpegaudiodsp.c */; }; - 8393B81618052E9900913C76 /* mpegaudiodsp_fixed.c in Sources */ = {isa = PBXBuildFile; fileRef = 8393B81518052E9900913C76 /* mpegaudiodsp_fixed.c */; }; - 83BCB8E217FCA64400760340 /* avconfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BCB8DF17FCA64400760340 /* avconfig.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 83BCB8E317FCA64400760340 /* timecode.c in Sources */ = {isa = PBXBuildFile; fileRef = 83BCB8E017FCA64400760340 /* timecode.c */; }; - 83BCB8E417FCA64400760340 /* timecode.h in Headers */ = {isa = PBXBuildFile; fileRef = 83BCB8E117FCA64400760340 /* timecode.h */; }; - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - B09E94940D74834B0064F138 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = B09E94730D74834B0064F138 /* config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - B09E94F00D748DEE0064F138 /* libiconv.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = B09E94EF0D748DEE0064F138 /* libiconv.dylib */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; - 32DBCF5E0370ADEE00C91783 /* FFMPEG_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEG_Prefix.pch; sourceTree = ""; }; - 830C4B56180C3434007674D6 /* amr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amr.h; sourceTree = ""; }; - 830C4B57180C3434007674D6 /* amrnbdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amrnbdata.h; sourceTree = ""; }; - 830C4B58180C3434007674D6 /* amrnbdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amrnbdec.c; sourceTree = ""; }; - 830C4B59180C3434007674D6 /* amrwbdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amrwbdata.h; sourceTree = ""; }; - 830C4B5A180C3434007674D6 /* amrwbdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amrwbdec.c; sourceTree = ""; }; - 830C4B60180C343C007674D6 /* amr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amr.c; sourceTree = ""; }; - 830C4B62180C3580007674D6 /* amrwbdec_mips.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = amrwbdec_mips.h; sourceTree = ""; }; - 830F0B8F17FC4FB900042E8F /* allcodecs.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allcodecs.c; sourceTree = ""; }; - 830F0B9017FC4FB900042E8F /* avcodec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avcodec.h; sourceTree = ""; }; - 830F0B9317FC4FB900042E8F /* fft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fft.c; sourceTree = ""; }; - 830F0B9417FC4FB900042E8F /* fft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fft.h; sourceTree = ""; }; - 830F0B9517FC4FB900042E8F /* get_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = get_bits.h; sourceTree = ""; }; - 830F0B9617FC4FB900042E8F /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; - 830F0B9717FC4FB900042E8F /* mathops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathops.h; sourceTree = ""; }; - 830F0B9817FC4FB900042E8F /* mathtables.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mathtables.c; sourceTree = ""; }; - 830F0B9917FC4FB900042E8F /* mdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mdct.c; sourceTree = ""; }; - 830F0B9A17FC4FB900042E8F /* old_codec_ids.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = old_codec_ids.h; sourceTree = ""; }; - 830F0B9B17FC4FB900042E8F /* parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = parser.c; sourceTree = ""; }; - 830F0B9C17FC4FB900042E8F /* parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parser.h; sourceTree = ""; }; - 830F0B9D17FC4FB900042E8F /* put_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = put_bits.h; sourceTree = ""; }; - 830F0B9E17FC4FB900042E8F /* simple_idct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = simple_idct.c; sourceTree = ""; }; - 830F0B9F17FC4FB900042E8F /* simple_idct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_idct.h; sourceTree = ""; }; - 830F0BA017FC4FB900042E8F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = ""; }; - 830F0BA117FC4FB900042E8F /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 830F0BA217FC4FB900042E8F /* wma_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wma_common.c; sourceTree = ""; }; - 830F0BA317FC4FB900042E8F /* wma_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wma_common.h; sourceTree = ""; }; - 830F0BA417FC4FB900042E8F /* wmadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wmadata.h; sourceTree = ""; }; - 830F0BA517FC4FB900042E8F /* wmadec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wmadec.c; sourceTree = ""; }; - 830F0BA617FC4FB900042E8F /* wmalosslessdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wmalosslessdec.c; sourceTree = ""; }; - 830F0BA717FC4FB900042E8F /* wmaprodata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wmaprodata.h; sourceTree = ""; }; - 830F0BA817FC4FB900042E8F /* wmaprodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wmaprodec.c; sourceTree = ""; }; - 830F0BA917FC4FB900042E8F /* wmavoice.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wmavoice.c; sourceTree = ""; }; - 830F0BAA17FC4FB900042E8F /* wmavoice_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wmavoice_data.h; sourceTree = ""; }; - 830F0BAC17FC4FB900042E8F /* mathops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathops.h; sourceTree = ""; }; - 830F0BAE17FC4FB900042E8F /* allformats.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = allformats.c; sourceTree = ""; }; - 830F0BAF17FC4FB900042E8F /* asf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asf.c; sourceTree = ""; }; - 830F0BB017FC4FB900042E8F /* avformat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avformat.h; sourceTree = ""; }; - 830F0BB117FC4FB900042E8F /* avi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avi.h; sourceTree = ""; }; - 830F0BB217FC4FB900042E8F /* avio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avio.c; sourceTree = ""; }; - 830F0BB317FC4FB900042E8F /* avio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avio.h; sourceTree = ""; }; - 830F0BB417FC4FB900042E8F /* aviobuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aviobuf.c; sourceTree = ""; }; - 830F0BB517FC4FB900042E8F /* cutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cutils.c; sourceTree = ""; }; - 830F0BB617FC4FB900042E8F /* file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file.c; sourceTree = ""; }; - 830F0BB717FC4FB900042E8F /* format.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = format.c; sourceTree = ""; }; - 830F0BB817FC4FB900042E8F /* os_support.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = os_support.c; sourceTree = ""; }; - 830F0BB917FC4FB900042E8F /* os_support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = os_support.h; sourceTree = ""; }; - 830F0BBB17FC4FB900042E8F /* attributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = attributes.h; sourceTree = ""; }; - 830F0BBC17FC4FB900042E8F /* avutil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avutil.h; sourceTree = ""; }; - 830F0BBD17FC4FB900042E8F /* bswap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bswap.h; sourceTree = ""; }; - 830F0BBE17FC4FB900042E8F /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer.h; sourceTree = ""; }; - 830F0BBF17FC4FB900042E8F /* channel_layout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = channel_layout.h; sourceTree = ""; }; - 830F0BC017FC4FB900042E8F /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - 830F0BC117FC4FB900042E8F /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; - 830F0BC217FC4FB900042E8F /* dict.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dict.h; sourceTree = ""; }; - 830F0BC317FC4FB900042E8F /* error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error.h; sourceTree = ""; }; - 830F0BC417FC4FB900042E8F /* frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frame.h; sourceTree = ""; }; - 830F0BC517FC4FB900042E8F /* intfloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intfloat.h; sourceTree = ""; }; - 830F0BC617FC4FB900042E8F /* intfloat_readwrite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intfloat_readwrite.h; sourceTree = ""; }; - 830F0BC717FC4FB900042E8F /* log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log.h; sourceTree = ""; }; - 830F0BC817FC4FB900042E8F /* mathematics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathematics.h; sourceTree = ""; }; - 830F0BC917FC4FB900042E8F /* mem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mem.c; sourceTree = ""; }; - 830F0BCA17FC4FB900042E8F /* mem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mem.h; sourceTree = ""; }; - 830F0BCB17FC4FB900042E8F /* old_pix_fmts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = old_pix_fmts.h; sourceTree = ""; }; - 830F0BCC17FC4FB900042E8F /* pixfmt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixfmt.h; sourceTree = ""; }; - 830F0BCD17FC4FB900042E8F /* rational.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rational.h; sourceTree = ""; }; - 830F0BCE17FC4FB900042E8F /* samplefmt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = samplefmt.h; sourceTree = ""; }; - 830F0BD017FC4FB900042E8F /* bswap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bswap.h; sourceTree = ""; }; - 830F0C0F17FC4FF400042E8F /* avfft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avfft.c; sourceTree = ""; }; - 830F0C1017FC4FF400042E8F /* avfft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avfft.h; sourceTree = ""; }; - 830F0C1317FC500B00042E8F /* fft-internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "fft-internal.h"; sourceTree = ""; }; - 830F0C1517FC523000042E8F /* rdt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rdt.h; sourceTree = ""; }; - 830F0C1617FC523000042E8F /* rtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtp.h; sourceTree = ""; }; - 830F0C1717FC523000042E8F /* url.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = url.c; sourceTree = ""; }; - 830F0C1817FC523000042E8F /* url.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = url.h; sourceTree = ""; }; - 830F0C1D17FC527400042E8F /* atomic_gcc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atomic_gcc.h; sourceTree = ""; }; - 830F0C1E17FC527400042E8F /* atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atomic.c; sourceTree = ""; }; - 830F0C1F17FC527400042E8F /* atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atomic.h; sourceTree = ""; }; - 830F0C2117FC527400042E8F /* bswap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bswap.h; sourceTree = ""; }; - 830F0C2617FC54F800042E8F /* asfdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asfdec.c; sourceTree = ""; }; - 830F0C2717FC54F800042E8F /* rtpdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rtpdec.h; sourceTree = ""; }; - 830F0C2817FC54F800042E8F /* srtp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = srtp.h; sourceTree = ""; }; - 830F0C2C17FC551F00042E8F /* asfcrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = asfcrypt.c; sourceTree = ""; }; - 830F0C2D17FC551F00042E8F /* asfcrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asfcrypt.h; sourceTree = ""; }; - 830F0C3017FC554D00042E8F /* buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = buffer.c; sourceTree = ""; }; - 830F0C3117FC554D00042E8F /* des.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = des.c; sourceTree = ""; }; - 830F0C3217FC554D00042E8F /* des.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = des.h; sourceTree = ""; }; - 830F0C3317FC554D00042E8F /* float_dsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = float_dsp.c; sourceTree = ""; }; - 830F0C3417FC554D00042E8F /* float_dsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = float_dsp.h; sourceTree = ""; }; - 830F0C3517FC554D00042E8F /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; - 830F0C3617FC554D00042E8F /* libm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = libm.h; sourceTree = ""; }; - 830F0C3717FC554D00042E8F /* timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timer.h; sourceTree = ""; }; - 830F0C4017FC7CA300042E8F /* asf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asf.h; sourceTree = ""; }; - 830F0C4117FC7CA300042E8F /* avio_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avio_internal.h; sourceTree = ""; }; - 830F0C4217FC7CA300042E8F /* id3v2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = id3v2.h; sourceTree = ""; }; - 830F0C4317FC7CA300042E8F /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; - 830F0C4417FC7CA300042E8F /* metadata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = metadata.c; sourceTree = ""; }; - 830F0C4517FC7CA300042E8F /* metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metadata.h; sourceTree = ""; }; - 830F0C4617FC7CA300042E8F /* riff.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = riff.c; sourceTree = ""; }; - 830F0C4717FC7CA300042E8F /* riff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = riff.h; sourceTree = ""; }; - 830F0C4817FC7CA300042E8F /* riffdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = riffdec.c; sourceTree = ""; }; - 830F0C5217FC7CC300042E8F /* avlanguage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avlanguage.c; sourceTree = ""; }; - 830F0C5317FC7CC300042E8F /* avlanguage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avlanguage.h; sourceTree = ""; }; - 830F0C5417FC7CC300042E8F /* id3v2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = id3v2.c; sourceTree = ""; }; - 830F0C5517FC7CC300042E8F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = ""; }; - 830F0C5A17FC7CEA00042E8F /* id3v1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = id3v1.c; sourceTree = ""; }; - 830F0C5B17FC7CEA00042E8F /* id3v1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = id3v1.h; sourceTree = ""; }; - 830F0C5E17FC7D3100042E8F /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = ../../../../../../../Developer/SDKs/MacOSX10.6.sdk/usr/lib/libz.dylib; sourceTree = ""; }; - 830F0C6017FC7DB100042E8F /* avassert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avassert.h; sourceTree = ""; }; - 830F0C6117FC7DB100042E8F /* bprint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bprint.c; sourceTree = ""; }; - 830F0C6217FC7DB100042E8F /* bprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bprint.h; sourceTree = ""; }; - 830F0C6317FC7DB100042E8F /* buffer_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer_internal.h; sourceTree = ""; }; - 830F0C6417FC7DB100042E8F /* intreadwrite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intreadwrite.h; sourceTree = ""; }; - 830F0C6517FC7DB100042E8F /* pixdesc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pixdesc.c; sourceTree = ""; }; - 830F0C6617FC7DB100042E8F /* pixdesc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pixdesc.h; sourceTree = ""; }; - 830F0C6717FC7DB100042E8F /* rc4.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rc4.c; sourceTree = ""; }; - 830F0C6817FC7DB100042E8F /* rc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rc4.h; sourceTree = ""; }; - 830F0C6917FC7DB100042E8F /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - 830F0C7417FC7DCB00042E8F /* avstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avstring.c; sourceTree = ""; }; - 830F0C7517FC7DCB00042E8F /* avstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avstring.h; sourceTree = ""; }; - 830F0C7817FC7E4E00042E8F /* crc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = crc.c; sourceTree = ""; }; - 830F0C7917FC7E4E00042E8F /* log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log.c; sourceTree = ""; }; - 830F0C7A17FC7E4E00042E8F /* mathematics.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mathematics.c; sourceTree = ""; }; - 830F0C7E17FC7ED100042E8F /* crc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crc.h; sourceTree = ""; }; - 830F0C7F17FC7ED100042E8F /* dict.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dict.c; sourceTree = ""; }; - 830F0C8017FC7ED100042E8F /* rational.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rational.c; sourceTree = ""; }; - 830F0C8417FC7F1E00042E8F /* acelp_filters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acelp_filters.c; sourceTree = ""; }; - 830F0C8517FC7F1E00042E8F /* acelp_filters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acelp_filters.h; sourceTree = ""; }; - 830F0C8617FC7F1E00042E8F /* acelp_pitch_delay.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acelp_pitch_delay.c; sourceTree = ""; }; - 830F0C8717FC7F1E00042E8F /* acelp_pitch_delay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acelp_pitch_delay.h; sourceTree = ""; }; - 830F0C8817FC7F1E00042E8F /* acelp_vectors.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = acelp_vectors.c; sourceTree = ""; }; - 830F0C8917FC7F1E00042E8F /* acelp_vectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acelp_vectors.h; sourceTree = ""; }; - 830F0C8A17FC7F1E00042E8F /* avpacket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avpacket.c; sourceTree = ""; }; - 830F0C8B17FC7F1E00042E8F /* bit_depth_template.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bit_depth_template.c; sourceTree = ""; }; - 830F0C8C17FC7F1E00042E8F /* bytestream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bytestream.h; sourceTree = ""; }; - 830F0C8D17FC7F1E00042E8F /* celp_filters.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = celp_filters.c; sourceTree = ""; }; - 830F0C8E17FC7F1E00042E8F /* celp_filters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = celp_filters.h; sourceTree = ""; }; - 830F0C8F17FC7F1E00042E8F /* celp_math.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = celp_math.c; sourceTree = ""; }; - 830F0C9017FC7F1E00042E8F /* celp_math.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = celp_math.h; sourceTree = ""; }; - 830F0C9117FC7F1E00042E8F /* copy_block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = copy_block.h; sourceTree = ""; }; - 830F0C9217FC7F1E00042E8F /* dct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dct.c; sourceTree = ""; }; - 830F0C9317FC7F1E00042E8F /* dct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dct.h; sourceTree = ""; }; - 830F0C9417FC7F1E00042E8F /* dct32_float.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dct32_float.c; sourceTree = ""; }; - 830F0C9517FC7F1E00042E8F /* dct32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dct32.c; sourceTree = ""; }; - 830F0C9617FC7F1E00042E8F /* dct32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dct32.h; sourceTree = ""; }; - 830F0C9717FC7F1E00042E8F /* dctref.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dctref.c; sourceTree = ""; }; - 830F0C9817FC7F1E00042E8F /* dctref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dctref.h; sourceTree = ""; }; - 830F0C9C17FC7F1E00042E8F /* error_resilience.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error_resilience.c; sourceTree = ""; }; - 830F0C9D17FC7F1E00042E8F /* error_resilience.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error_resilience.h; sourceTree = ""; }; - 830F0C9E17FC7F1E00042E8F /* faandct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = faandct.c; sourceTree = ""; }; - 830F0C9F17FC7F1E00042E8F /* faandct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = faandct.h; sourceTree = ""; }; - 830F0CA017FC7F1E00042E8F /* faanidct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = faanidct.c; sourceTree = ""; }; - 830F0CA117FC7F1E00042E8F /* faanidct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = faanidct.h; sourceTree = ""; }; - 830F0CA217FC7F1E00042E8F /* fmtconvert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fmtconvert.c; sourceTree = ""; }; - 830F0CA317FC7F1E00042E8F /* fmtconvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtconvert.h; sourceTree = ""; }; - 830F0CA417FC7F1E00042E8F /* frame_thread_encoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frame_thread_encoder.c; sourceTree = ""; }; - 830F0CA517FC7F1E00042E8F /* frame_thread_encoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = frame_thread_encoder.h; sourceTree = ""; }; - 830F0CA617FC7F1E00042E8F /* h264chroma_template.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = h264chroma_template.c; sourceTree = ""; }; - 830F0CA717FC7F1E00042E8F /* h264chroma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = h264chroma.c; sourceTree = ""; }; - 830F0CA817FC7F1E00042E8F /* h264chroma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = h264chroma.h; sourceTree = ""; }; - 830F0CA917FC7F1E00042E8F /* hpeldsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hpeldsp.c; sourceTree = ""; }; - 830F0CAA17FC7F1E00042E8F /* hpeldsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hpeldsp.h; sourceTree = ""; }; - 830F0CAB17FC7F1E00042E8F /* imgconvert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imgconvert.c; sourceTree = ""; }; - 830F0CAC17FC7F1E00042E8F /* imgconvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgconvert.h; sourceTree = ""; }; - 830F0CAD17FC7F1E00042E8F /* lsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lsp.c; sourceTree = ""; }; - 830F0CAE17FC7F1E00042E8F /* lsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lsp.h; sourceTree = ""; }; - 830F0CAF17FC7F1E00042E8F /* mpeg12data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg12data.c; sourceTree = ""; }; - 830F0CB017FC7F1E00042E8F /* mpeg12data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg12data.h; sourceTree = ""; }; - 830F0CB117FC7F1E00042E8F /* mpegvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegvideo.h; sourceTree = ""; }; - 830F0CB217FC7F1E00042E8F /* ratecontrol.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ratecontrol.c; sourceTree = ""; }; - 830F0CB317FC7F1E00042E8F /* ratecontrol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ratecontrol.h; sourceTree = ""; }; - 830F0CB417FC7F1E00042E8F /* raw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = raw.c; sourceTree = ""; }; - 830F0CB517FC7F1E00042E8F /* raw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = raw.h; sourceTree = ""; }; - 830F0CB617FC7F1E00042E8F /* rdft.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rdft.c; sourceTree = ""; }; - 830F0CB717FC7F1E00042E8F /* rdft.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rdft.h; sourceTree = ""; }; - 830F0CB817FC7F1E00042E8F /* rl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rl.h; sourceTree = ""; }; - 830F0CB917FC7F1E00042E8F /* rnd_avg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rnd_avg.h; sourceTree = ""; }; - 830F0CBB17FC7F1E00042E8F /* sinewin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sinewin.c; sourceTree = ""; }; - 830F0CBC17FC7F1E00042E8F /* sinewin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sinewin.h; sourceTree = ""; }; - 830F0CBD17FC7F1E00042E8F /* thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = thread.h; sourceTree = ""; }; - 830F0CBE17FC7F1E00042E8F /* videodsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = videodsp.c; sourceTree = ""; }; - 830F0CBF17FC7F1E00042E8F /* videodsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = videodsp.h; sourceTree = ""; }; - 830F0CC017FC7F1E00042E8F /* wma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wma.c; sourceTree = ""; }; - 830F0CC117FC7F1E00042E8F /* wma.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wma.h; sourceTree = ""; }; - 830F0D0117FC7F4000042E8F /* sinewin_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sinewin_tablegen.h; sourceTree = ""; }; - 830F0D0517FC80B400042E8F /* lsp_mips.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lsp_mips.h; sourceTree = ""; }; - 830F0D0617FC80B400042E8F /* rectangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rectangle.h; sourceTree = ""; }; - 830F0D0A17FC80B400042E8F /* mathops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mathops.h; sourceTree = ""; }; - 830F0D1017FC815000042E8F /* constants.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = constants.c; sourceTree = ""; }; - 830F0D1117FC815000042E8F /* constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constants.h; sourceTree = ""; }; - 830F0D1617FC82AB00042E8F /* colorspace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspace.h; sourceTree = ""; }; - 830F0D1717FC82AB00042E8F /* cpu_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_internal.h; sourceTree = ""; }; - 830F0D1817FC82AB00042E8F /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; - 830F0D1917FC82AB00042E8F /* eval.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = eval.c; sourceTree = ""; }; - 830F0D1A17FC82AB00042E8F /* eval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eval.h; sourceTree = ""; }; - 830F0D1B17FC82AB00042E8F /* fifo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fifo.c; sourceTree = ""; }; - 830F0D1C17FC82AB00042E8F /* fifo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fifo.h; sourceTree = ""; }; - 830F0D1D17FC82AB00042E8F /* frame.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frame.c; sourceTree = ""; }; - 830F0D2617FC841B00042E8F /* channel_layout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = channel_layout.c; sourceTree = ""; }; - 830F0D2717FC841B00042E8F /* error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = error.c; sourceTree = ""; }; - 830F0D2817FC841B00042E8F /* imgutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imgutils.c; sourceTree = ""; }; - 830F0D2917FC841B00042E8F /* imgutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imgutils.h; sourceTree = ""; }; - 830F0D2A17FC841B00042E8F /* intfloat_readwrite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = intfloat_readwrite.c; sourceTree = ""; }; - 830F0D2B17FC841B00042E8F /* opt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = opt.c; sourceTree = ""; }; - 830F0D2C17FC841B00042E8F /* opt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opt.h; sourceTree = ""; }; - 830F0D2D17FC841B00042E8F /* samplefmt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = samplefmt.c; sourceTree = ""; }; - 830F0D3617FC844E00042E8F /* parseutils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = parseutils.c; sourceTree = ""; }; - 830F0D3717FC844E00042E8F /* parseutils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = parseutils.h; sourceTree = ""; }; - 830F0D3A17FC846C00042E8F /* random_seed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = random_seed.c; sourceTree = ""; }; - 830F0D3B17FC846C00042E8F /* random_seed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = random_seed.h; sourceTree = ""; }; - 830F0D3E17FC848D00042E8F /* sha.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha.c; sourceTree = ""; }; - 830F0D3F17FC848D00042E8F /* sha.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha.h; sourceTree = ""; }; - 830F0D4217FC85ED00042E8F /* integer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = integer.c; sourceTree = ""; }; - 830F0D4317FC85ED00042E8F /* integer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = integer.h; sourceTree = ""; }; - 830F0D4417FC85ED00042E8F /* intmath.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = intmath.c; sourceTree = ""; }; - 830F0D4517FC85ED00042E8F /* intmath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = intmath.h; sourceTree = ""; }; - 830F0D4A17FC862300042E8F /* time.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = time.c; sourceTree = ""; }; - 830F0D4C17FC862400042E8F /* utils.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utils.c; sourceTree = ""; }; - 830F0D5217FC891800042E8F /* file_open.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = file_open.c; sourceTree = ""; }; - 830F0D5417FC893E00042E8F /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = ""; }; - 830F0D5517FC893E00042E8F /* codec_desc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = codec_desc.c; sourceTree = ""; }; - 830F0D5617FC893E00042E8F /* rawdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rawdec.c; sourceTree = ""; }; - 830F0D5717FC893E00042E8F /* tableprint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tableprint.h; sourceTree = ""; }; - 830F0D5C17FC89BD00042E8F /* options_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options_table.h; sourceTree = ""; }; - 830F0D5D17FC89BD00042E8F /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; - 830F0D6017FC8A3300042E8F /* audiointerleave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = audiointerleave.c; sourceTree = ""; }; - 830F0D6117FC8A3300042E8F /* audiointerleave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audiointerleave.h; sourceTree = ""; }; - 830F0D6217FC8A3300042E8F /* options_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options_table.h; sourceTree = ""; }; - 830F0D6317FC8A3300042E8F /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = ""; }; - 830F0D6817FC8A3D00042E8F /* avpicture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avpicture.c; sourceTree = ""; }; - 830F0D6A17FC8C0700042E8F /* aactab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aactab.c; sourceTree = ""; }; - 830F0D6B17FC8C0700042E8F /* aactab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aactab.h; sourceTree = ""; }; - 830F0D6E17FC8C1300042E8F /* ast.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ast.c; sourceTree = ""; }; - 830F0D6F17FC8C1300042E8F /* ast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ast.h; sourceTree = ""; }; - 830F0D7017FC8C1300042E8F /* astdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = astdec.c; sourceTree = ""; }; - 830F0D7417FC8C7300042E8F /* aac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aac.h; sourceTree = ""; }; - 830F0D7517FC8C7300042E8F /* mpeg4audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg4audio.c; sourceTree = ""; }; - 830F0D7617FC8C7300042E8F /* mpeg4audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg4audio.h; sourceTree = ""; }; - 830F0D7A17FC8E2400042E8F /* avidec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = avidec.c; sourceTree = ""; }; - 830F0D7C17FC8E4800042E8F /* dv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dv.c; sourceTree = ""; }; - 830F0D7D17FC8E4800042E8F /* dv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dv.h; sourceTree = ""; }; - 830F0D8017FC8E8B00042E8F /* aac_tablegen_decl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aac_tablegen_decl.h; sourceTree = ""; }; - 830F0D8117FC8E8B00042E8F /* aac_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aac_tablegen.h; sourceTree = ""; }; - 830F0D8217FC8E8B00042E8F /* aacps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacps.h; sourceTree = ""; }; - 830F0D8317FC8E8B00042E8F /* aacpsdsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacpsdsp.h; sourceTree = ""; }; - 830F0D8417FC8E8B00042E8F /* dv_profile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dv_profile.c; sourceTree = ""; }; - 830F0D8517FC8E8B00042E8F /* dv_profile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dv_profile.h; sourceTree = ""; }; - 830F0D8617FC8E8B00042E8F /* sbr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sbr.h; sourceTree = ""; }; - 830F0D8717FC8E8B00042E8F /* sbrdsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sbrdsp.h; sourceTree = ""; }; - 830F0D9017FC8EAC00042E8F /* dvdata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dvdata.c; sourceTree = ""; }; - 830F0D9117FC8EAC00042E8F /* dvdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dvdata.h; sourceTree = ""; }; - 830F0DA917FC8FBD00042E8F /* dct_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dct_init.c; sourceTree = ""; }; - 830F0DAA17FC8FBD00042E8F /* fft_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fft_init.c; sourceTree = ""; }; - 830F0DAB17FC8FBD00042E8F /* fmtconvert_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fmtconvert_init.c; sourceTree = ""; }; - 830F0DAC17FC8FBD00042E8F /* hpeldsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = hpeldsp_init.c; sourceTree = ""; }; - 830F0DB117FC8FCE00042E8F /* log2_tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = log2_tab.c; sourceTree = ""; }; - 830F0DB317FC921D00042E8F /* asm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asm.h; sourceTree = ""; }; - 830F0DB417FC921D00042E8F /* cpu.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cpu.c; sourceTree = ""; }; - 830F0DB517FC921D00042E8F /* cpu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu.h; sourceTree = ""; }; - 830F0DB617FC921D00042E8F /* emms.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = emms.h; sourceTree = ""; }; - 830F0DB717FC921D00042E8F /* timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timer.h; sourceTree = ""; }; - 830F0DBD17FC922C00042E8F /* h264chroma_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = h264chroma_init.c; sourceTree = ""; }; - 830F0DBF17FC927D00042E8F /* float_dsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = float_dsp_init.c; sourceTree = ""; }; - 830F0DC117FC929E00042E8F /* mux.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mux.c; sourceTree = ""; }; - 830F0DC317FC92EE00042E8F /* videodsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = videodsp_init.c; sourceTree = ""; }; - 830F0DC517FC92FA00042E8F /* wavdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = wavdec.c; sourceTree = ""; }; - 830F0DC717FC931700042E8F /* pcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pcm.c; sourceTree = ""; }; - 830F0DC817FC931700042E8F /* pcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pcm.h; sourceTree = ""; }; - 830F0DCB17FC933100042E8F /* w64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = w64.c; sourceTree = ""; }; - 830F0DCC17FC933100042E8F /* w64.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = w64.h; sourceTree = ""; }; - 830F0DCF17FC934D00042E8F /* spdif.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spdif.c; sourceTree = ""; }; - 830F0DD017FC934D00042E8F /* spdif.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spdif.h; sourceTree = ""; }; - 830F0DD417FC93E400042E8F /* xwma.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = xwma.c; sourceTree = ""; }; - 832F4BA418CD4F47003E940E /* lls2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls2.c; sourceTree = ""; }; - 832F4BA518CD4F47003E940E /* lls2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lls2.h; sourceTree = ""; }; - 832F4BA918CD4F6B003E940E /* atrac3plus_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac3plus_data.h; sourceTree = ""; }; - 832F4BAA18CD4F6B003E940E /* atrac3plus.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plus.c; sourceTree = ""; }; - 832F4BAB18CD4F6B003E940E /* atrac3plus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac3plus.h; sourceTree = ""; }; - 832F4BAC18CD4F6B003E940E /* atrac3plusdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plusdec.c; sourceTree = ""; }; - 832F4BAD18CD4F6B003E940E /* atrac3plusdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3plusdsp.c; sourceTree = ""; }; - 832F4BB418CD4FEA003E940E /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macros.h; sourceTree = ""; }; - 832F4BB518CD4FEA003E940E /* timestamp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timestamp.h; sourceTree = ""; }; - 832F4BB818CD53E9003E940E /* ttadsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttadsp.c; sourceTree = ""; }; - 832F4BB918CD53E9003E940E /* ttadsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttadsp.h; sourceTree = ""; }; - 832F4BBE18CD5DD9003E940E /* downmix_info.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = downmix_info.c; sourceTree = ""; }; - 832F4BBF18CD5DD9003E940E /* downmix_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = downmix_info.h; sourceTree = ""; }; - 832F4BC218CD5DE2003E940E /* time_.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = time_.h; sourceTree = ""; }; - 832F4BC418CD601B003E940E /* ttadsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttadsp_init.c; sourceTree = ""; }; - 832F4BC618CD6052003E940E /* dcadsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dcadsp_init.c; sourceTree = ""; }; - 833C3794180328A300CBA602 /* takdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = takdec.c; sourceTree = ""; }; - 833C3796180328B300CBA602 /* tak_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak_parser.c; sourceTree = ""; }; - 833C3797180328B300CBA602 /* tak.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tak.c; sourceTree = ""; }; - 833C3798180328B300CBA602 /* tak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tak.h; sourceTree = ""; }; - 833C3799180328B300CBA602 /* takdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = takdec.c; sourceTree = ""; }; - 833C379E18032A2700CBA602 /* unary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unary.h; sourceTree = ""; }; - 833C37A018032A2F00CBA602 /* rawdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rawdec.c; sourceTree = ""; }; - 833C37A118032A2F00CBA602 /* rawdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rawdec.h; sourceTree = ""; }; - 833C37A418032A5000CBA602 /* apetag.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = apetag.c; sourceTree = ""; }; - 833C37A518032A5000CBA602 /* apetag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = apetag.h; sourceTree = ""; }; - 833C37A818032AAD00CBA602 /* img2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = img2.c; sourceTree = ""; }; - 833C37AA18032AEF00CBA602 /* diracdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = diracdsp.c; sourceTree = ""; }; - 833C37AB18032AEF00CBA602 /* diracdsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = diracdsp.h; sourceTree = ""; }; - 833C37AC18032AEF00CBA602 /* dsputil.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dsputil.c; sourceTree = ""; }; - 833C37AD18032AEF00CBA602 /* dsputil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dsputil.h; sourceTree = ""; }; - 833C37AE18032AEF00CBA602 /* diracdsp_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = diracdsp_mmx.c; path = x86/diracdsp_mmx.c; sourceTree = ""; }; - 833C37AF18032AEF00CBA602 /* diracdsp_mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = diracdsp_mmx.h; path = x86/diracdsp_mmx.h; sourceTree = ""; }; - 833C37B018032AEF00CBA602 /* dsputil_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dsputil_x86.h; path = x86/dsputil_x86.h; sourceTree = ""; }; - 833C37BA18032CF600CBA602 /* dirac_arith.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirac_arith.c; sourceTree = ""; }; - 833C37BB18032CF600CBA602 /* dirac_arith.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirac_arith.h; sourceTree = ""; }; - 833C37BC18032CF600CBA602 /* dirac_dwt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirac_dwt.c; sourceTree = ""; }; - 833C37BD18032CF600CBA602 /* dirac_dwt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirac_dwt.h; sourceTree = ""; }; - 833C37BE18032CF600CBA602 /* dirac_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirac_parser.c; sourceTree = ""; }; - 833C37BF18032CF600CBA602 /* dirac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirac.c; sourceTree = ""; }; - 833C37C018032CF600CBA602 /* dirac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirac.h; sourceTree = ""; }; - 833C37C118032CF600CBA602 /* diracdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = diracdec.c; sourceTree = ""; }; - 833C37CA18032D4800CBA602 /* golomb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = golomb.c; sourceTree = ""; }; - 833C37CB18032D4800CBA602 /* golomb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = golomb.h; sourceTree = ""; }; - 833C37CC18032D4800CBA602 /* dirac_dwt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirac_dwt.c; sourceTree = ""; }; - 833C37CD18032D4800CBA602 /* dirac_dwt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dirac_dwt.h; sourceTree = ""; }; - 833C37D218032E4800CBA602 /* dsputil_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dsputil_init.c; sourceTree = ""; }; - 833C37D418032E7000CBA602 /* jrevdct.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = jrevdct.c; sourceTree = ""; }; - 833C37D618032EA500CBA602 /* idct_xvid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = idct_xvid.h; sourceTree = ""; }; - 833E5F9B18A31EB7006A85F9 /* vqf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vqf.c; sourceTree = ""; }; - 833E5F9D18A31EC4006A85F9 /* twinvq_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = twinvq_data.h; sourceTree = ""; }; - 833E5F9E18A31EC4006A85F9 /* twinvq.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = twinvq.c; sourceTree = ""; }; - 833E5F9F18A31EC4006A85F9 /* twinvq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = twinvq.h; sourceTree = ""; }; - 833E5FA018A31EC4006A85F9 /* twinvqdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = twinvqdec.c; sourceTree = ""; }; - 833F68321CDBCAB100AFB9F0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = es.lproj/InfoPlist.strings; sourceTree = ""; }; - 8384904C1807898200E7332D /* apedec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = apedec.c; sourceTree = ""; }; - 8384904E1807898A00E7332D /* ape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ape.c; sourceTree = ""; }; - 838490501807AF0100E7332D /* ac3_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3_parser.c; sourceTree = ""; }; - 838490511807AF0100E7332D /* ac3_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3_parser.h; sourceTree = ""; }; - 838490521807AF0100E7332D /* ac3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3.c; sourceTree = ""; }; - 838490531807AF0100E7332D /* ac3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3.h; sourceTree = ""; }; - 838490541807AF0100E7332D /* ac3dec_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3dec_data.c; sourceTree = ""; }; - 838490551807AF0100E7332D /* ac3dec_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3dec_data.h; sourceTree = ""; }; - 838490561807AF0100E7332D /* ac3dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3dec.c; sourceTree = ""; }; - 838490571807AF0100E7332D /* ac3dec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3dec.h; sourceTree = ""; }; - 838490581807AF0100E7332D /* ac3dsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3dsp.c; sourceTree = ""; }; - 838490591807AF0100E7332D /* ac3dsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3dsp.h; sourceTree = ""; }; - 8384905A1807AF0100E7332D /* ac3tab.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3tab.c; sourceTree = ""; }; - 8384905B1807AF0100E7332D /* ac3tab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ac3tab.h; sourceTree = ""; }; - 838490681807AF5800E7332D /* ac3dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3dec.c; sourceTree = ""; }; - 8384906A1807AFB800E7332D /* aac_ac3_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aac_ac3_parser.c; sourceTree = ""; }; - 8384906B1807AFB800E7332D /* aac_ac3_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aac_ac3_parser.h; sourceTree = ""; }; - 8384906E1807B04200E7332D /* lfg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lfg.c; sourceTree = ""; }; - 8384906F1807B04200E7332D /* lfg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lfg.h; sourceTree = ""; }; - 838490721807B07000E7332D /* md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = md5.c; sourceTree = ""; }; - 838490731807B07000E7332D /* md5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = md5.h; sourceTree = ""; }; - 838490761807B13000E7332D /* kbdwin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = kbdwin.c; sourceTree = ""; }; - 838490771807B13000E7332D /* kbdwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kbdwin.h; sourceTree = ""; }; - 8384907A1807B17500E7332D /* eac3_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = eac3_data.c; sourceTree = ""; }; - 8384907B1807B17500E7332D /* eac3_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eac3_data.h; sourceTree = ""; }; - 8384907C1807B17500E7332D /* eac3dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = eac3dec.c; sourceTree = ""; }; - 838490841807B17C00E7332D /* ac3dsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ac3dsp_init.c; sourceTree = ""; }; - 838490861807BC9400E7332D /* dca_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dca_parser.c; sourceTree = ""; }; - 838490871807BC9400E7332D /* dca.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dca.c; sourceTree = ""; }; - 838490881807BC9400E7332D /* dca.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dca.h; sourceTree = ""; }; - 838490891807BC9400E7332D /* dcadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dcadata.h; sourceTree = ""; }; - 8384908A1807BC9400E7332D /* dcadec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dcadec.c; sourceTree = ""; }; - 8384908B1807BC9400E7332D /* dcadsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dcadsp.c; sourceTree = ""; }; - 8384908C1807BC9400E7332D /* dcadsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dcadsp.h; sourceTree = ""; }; - 8384908D1807BC9400E7332D /* dcahuff.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dcahuff.h; sourceTree = ""; }; - 838490961807BC9C00E7332D /* dtshddec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dtshddec.c; sourceTree = ""; }; - 838490971807BC9C00E7332D /* dtsdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dtsdec.c; sourceTree = ""; }; - 8384909A1807BE1300E7332D /* synth_filter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = synth_filter.c; sourceTree = ""; }; - 8384909B1807BE1300E7332D /* synth_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = synth_filter.h; sourceTree = ""; }; - 8384909E1807C12300E7332D /* adpcm_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = adpcm_data.c; sourceTree = ""; }; - 8384909F1807C12300E7332D /* adpcm_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = adpcm_data.h; sourceTree = ""; }; - 838490A01807C12300E7332D /* adpcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = adpcm.c; sourceTree = ""; }; - 838490A11807C12300E7332D /* adpcm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = adpcm.h; sourceTree = ""; }; - 838490A21807C12300E7332D /* pcm.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = pcm.c; sourceTree = ""; }; - 838490A81807C1C300E7332D /* gsm_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gsm_parser.c; sourceTree = ""; }; - 838490A91807C1C300E7332D /* gsm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gsm.h; sourceTree = ""; }; - 838490AA1807C1C300E7332D /* gsmdec_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gsmdec_data.c; sourceTree = ""; }; - 838490AB1807C1C300E7332D /* gsmdec_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gsmdec_data.h; sourceTree = ""; }; - 838490AC1807C1C300E7332D /* gsmdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gsmdec.c; sourceTree = ""; }; - 838490AD1807C1C300E7332D /* msgsmdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msgsmdec.c; sourceTree = ""; }; - 838490AE1807C1C300E7332D /* msgsmdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msgsmdec.h; sourceTree = ""; }; - 838490AF1807C1C300E7332D /* truespeech_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = truespeech_data.h; sourceTree = ""; }; - 838490B01807C1C300E7332D /* truespeech.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = truespeech.c; sourceTree = ""; }; - 838490BA1807C30900E7332D /* pcm_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pcm_tablegen.h; sourceTree = ""; }; - 838490BC1807C34900E7332D /* atrac3.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac3.c; sourceTree = ""; }; - 838490BD1807C34900E7332D /* atrac3data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac3data.h; sourceTree = ""; }; - 838490C01807C37300E7332D /* atrac.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atrac.c; sourceTree = ""; }; - 838490C11807C37300E7332D /* atrac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = atrac.h; sourceTree = ""; }; - 838490CA1807C47E00E7332D /* g729.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g729.h; sourceTree = ""; }; - 838490CB1807C47E00E7332D /* g729data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g729data.h; sourceTree = ""; }; - 838490CC1807C47E00E7332D /* g729dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g729dec.c; sourceTree = ""; }; - 838490CD1807C47E00E7332D /* g729postfilter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g729postfilter.c; sourceTree = ""; }; - 838490CE1807C47E00E7332D /* g729postfilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g729postfilter.h; sourceTree = ""; }; - 838490CF1807C47E00E7332D /* g726.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g726.c; sourceTree = ""; }; - 838490D01807C47E00E7332D /* g723_1_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g723_1_data.h; sourceTree = ""; }; - 838490D11807C47E00E7332D /* g723_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g723_1.c; sourceTree = ""; }; - 838490D21807C47E00E7332D /* g722dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g722dec.c; sourceTree = ""; }; - 838490D31807C47E00E7332D /* g722.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = g722.c; sourceTree = ""; }; - 838490D41807C47E00E7332D /* g722.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = g722.h; sourceTree = ""; }; - 838490E01807C57B00E7332D /* aac_adtstoasc_bsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aac_adtstoasc_bsf.c; sourceTree = ""; }; - 838490E11807C57B00E7332D /* aac_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aac_parser.c; sourceTree = ""; }; - 838490E21807C57B00E7332D /* aacadtsdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacadtsdec.c; sourceTree = ""; }; - 838490E31807C57B00E7332D /* aacadtsdec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacadtsdec.h; sourceTree = ""; }; - 838490E51807C57B00E7332D /* aacdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacdec.c; sourceTree = ""; }; - 838490E61807C57B00E7332D /* aacdectab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacdectab.h; sourceTree = ""; }; - 838490E71807C57B00E7332D /* aacps_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacps_tablegen.h; sourceTree = ""; }; - 838490E81807C57B00E7332D /* aacps.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacps.c; sourceTree = ""; }; - 838490EA1807C57B00E7332D /* aacpsdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacpsdsp.c; sourceTree = ""; }; - 838490EC1807C57B00E7332D /* aacsbr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacsbr.c; sourceTree = ""; }; - 838490ED1807C57B00E7332D /* aacsbr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacsbr.h; sourceTree = ""; }; - 838490EE1807C57B00E7332D /* aacsbrdata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aacsbrdata.h; sourceTree = ""; }; - 838490FE1807C58500E7332D /* aacdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = aacdec.c; sourceTree = ""; }; - 838491001807CDC000E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = ""; }; - 838491011807CDC000E7332D /* lpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lpc.h; sourceTree = ""; }; - 838491041807CDEC00E7332D /* cbrt_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cbrt_tablegen.h; sourceTree = ""; }; - 8384910A1807CE2A00E7332D /* lls_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lls_init.c; sourceTree = ""; }; - 8384910C1807CEB600E7332D /* sbrdsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sbrdsp.c; sourceTree = ""; }; - 8384910E1807CEC400E7332D /* lpc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lpc.c; sourceTree = ""; }; - 838491101807CEF400E7332D /* sbrdsp_init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sbrdsp_init.c; sourceTree = ""; }; - 838491121807D06100E7332D /* spdifdec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = spdifdec.c; sourceTree = ""; }; - 838491141807D1D200E7332D /* tta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tta.c; sourceTree = ""; }; - 838491161807D1D900E7332D /* tta.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tta.c; sourceTree = ""; }; - 838491171807D1D900E7332D /* ttadata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ttadata.c; sourceTree = ""; }; - 838491181807D1D900E7332D /* ttadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ttadata.h; sourceTree = ""; }; - 8393B7DF18052BB000913C76 /* mp3dec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mp3dec.c; sourceTree = ""; }; - 8393B7E018052BB000913C76 /* mpeg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpeg.c; sourceTree = ""; }; - 8393B7E118052BB000913C76 /* mpeg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpeg.h; sourceTree = ""; }; - 8393B7E518052BC200913C76 /* mpegaudio_parser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudio_parser.c; sourceTree = ""; }; - 8393B7E618052BC200913C76 /* mpegaudio_tablegen.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudio_tablegen.c; sourceTree = ""; }; - 8393B7E718052BC200913C76 /* mpegaudio_tablegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudio_tablegen.h; sourceTree = ""; }; - 8393B7E818052BC200913C76 /* mpegaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudio.c; sourceTree = ""; }; - 8393B7E918052BC200913C76 /* mpegaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudio.h; sourceTree = ""; }; - 8393B7EA18052BC200913C76 /* mpegaudiodata.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodata.c; sourceTree = ""; }; - 8393B7EB18052BC200913C76 /* mpegaudiodata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodata.h; sourceTree = ""; }; - 8393B7EC18052BC200913C76 /* mpegaudiodec_float.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodec_float.c; sourceTree = ""; }; - 8393B7ED18052BC200913C76 /* mpegaudiodec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodec.c; sourceTree = ""; }; - 8393B7EE18052BC200913C76 /* mpegaudiodecheader.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodecheader.c; sourceTree = ""; }; - 8393B7EF18052BC200913C76 /* mpegaudiodecheader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodecheader.h; sourceTree = ""; }; - 8393B7F018052BC200913C76 /* mpegaudiodectab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodectab.h; sourceTree = ""; }; - 8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_data.c; sourceTree = ""; }; - 8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_float.c; sourceTree = ""; }; - 8393B7F618052BC200913C76 /* mpegaudiodsp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiodsp.h; sourceTree = ""; }; - 8393B7F818052BC200913C76 /* mpegaudiotab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpegaudiotab.h; sourceTree = ""; }; - 8393B80D18052BD500913C76 /* mpegaudiodsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp.c; sourceTree = ""; }; - 8393B80F18052DB700913C76 /* bitstream_filter.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream_filter.c; sourceTree = ""; }; - 8393B81018052DB700913C76 /* mp3_header_decompress_bsf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mp3_header_decompress_bsf.c; sourceTree = ""; }; - 8393B81318052E7400913C76 /* mpegaudiodsp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp.c; sourceTree = ""; }; - 8393B81518052E9900913C76 /* mpegaudiodsp_fixed.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mpegaudiodsp_fixed.c; sourceTree = ""; }; - 83BCB8DF17FCA64400760340 /* avconfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = avconfig.h; sourceTree = ""; }; - 83BCB8E017FCA64400760340 /* timecode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timecode.c; sourceTree = ""; }; - 83BCB8E117FCA64400760340 /* timecode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timecode.h; sourceTree = ""; }; - 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - 8DC2EF5B0486A6940098B216 /* FFMPEG.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = FFMPEG.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - B09E94730D74834B0064F138 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; - B09E94EF0D748DEE0064F138 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = /usr/lib/libiconv.dylib; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8DC2EF560486A6940098B216 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 830F0C5F17FC7D3100042E8F /* libz.dylib in Frameworks */, - B09E94F00D748DEE0064F138 /* libiconv.dylib in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 8DC2EF5B0486A6940098B216 /* FFMPEG.framework */, - ); - name = Products; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* FFMPEG */ = { - isa = PBXGroup; - children = ( - 830F0C5E17FC7D3100042E8F /* libz.dylib */, - B09E94EF0D748DEE0064F138 /* libiconv.dylib */, - B09E94660D74834B0064F138 /* ffmpeg-minimal */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 089C1665FE841158C02AAC07 /* Resources */, - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = FFMPEG; - sourceTree = ""; - }; - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, - ); - name = "External Frameworks and Libraries"; - sourceTree = ""; - }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 8DC2EF5A0486A6940098B216 /* Info.plist */, - 089C1666FE841158C02AAC07 /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = ""; - }; - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - ); - name = "Other Frameworks"; - sourceTree = ""; - }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF5E0370ADEE00C91783 /* FFMPEG_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 830F0B8E17FC4FB900042E8F /* libavcodec */ = { - isa = PBXGroup; - children = ( - 832F4BB818CD53E9003E940E /* ttadsp.c */, - 832F4BB918CD53E9003E940E /* ttadsp.h */, - 832F4BA918CD4F6B003E940E /* atrac3plus_data.h */, - 832F4BAA18CD4F6B003E940E /* atrac3plus.c */, - 832F4BAB18CD4F6B003E940E /* atrac3plus.h */, - 832F4BAC18CD4F6B003E940E /* atrac3plusdec.c */, - 832F4BAD18CD4F6B003E940E /* atrac3plusdsp.c */, - 833E5F9D18A31EC4006A85F9 /* twinvq_data.h */, - 833E5F9E18A31EC4006A85F9 /* twinvq.c */, - 833E5F9F18A31EC4006A85F9 /* twinvq.h */, - 833E5FA018A31EC4006A85F9 /* twinvqdec.c */, - 830C4B56180C3434007674D6 /* amr.h */, - 830C4B57180C3434007674D6 /* amrnbdata.h */, - 830C4B58180C3434007674D6 /* amrnbdec.c */, - 830C4B59180C3434007674D6 /* amrwbdata.h */, - 830C4B5A180C3434007674D6 /* amrwbdec.c */, - 838491161807D1D900E7332D /* tta.c */, - 838491171807D1D900E7332D /* ttadata.c */, - 838491181807D1D900E7332D /* ttadata.h */, - 8384910C1807CEB600E7332D /* sbrdsp.c */, - 838491041807CDEC00E7332D /* cbrt_tablegen.h */, - 838491001807CDC000E7332D /* lpc.c */, - 838491011807CDC000E7332D /* lpc.h */, - 838490E01807C57B00E7332D /* aac_adtstoasc_bsf.c */, - 838490E11807C57B00E7332D /* aac_parser.c */, - 838490E21807C57B00E7332D /* aacadtsdec.c */, - 838490E31807C57B00E7332D /* aacadtsdec.h */, - 838490E51807C57B00E7332D /* aacdec.c */, - 838490E61807C57B00E7332D /* aacdectab.h */, - 838490E71807C57B00E7332D /* aacps_tablegen.h */, - 838490E81807C57B00E7332D /* aacps.c */, - 838490EA1807C57B00E7332D /* aacpsdsp.c */, - 838490EC1807C57B00E7332D /* aacsbr.c */, - 838490ED1807C57B00E7332D /* aacsbr.h */, - 838490EE1807C57B00E7332D /* aacsbrdata.h */, - 838490CA1807C47E00E7332D /* g729.h */, - 838490CB1807C47E00E7332D /* g729data.h */, - 838490CC1807C47E00E7332D /* g729dec.c */, - 838490CD1807C47E00E7332D /* g729postfilter.c */, - 838490CE1807C47E00E7332D /* g729postfilter.h */, - 838490CF1807C47E00E7332D /* g726.c */, - 838490D01807C47E00E7332D /* g723_1_data.h */, - 838490D11807C47E00E7332D /* g723_1.c */, - 838490D21807C47E00E7332D /* g722dec.c */, - 838490D31807C47E00E7332D /* g722.c */, - 838490D41807C47E00E7332D /* g722.h */, - 838490C01807C37300E7332D /* atrac.c */, - 838490C11807C37300E7332D /* atrac.h */, - 838490BC1807C34900E7332D /* atrac3.c */, - 838490BD1807C34900E7332D /* atrac3data.h */, - 838490BA1807C30900E7332D /* pcm_tablegen.h */, - 838490A81807C1C300E7332D /* gsm_parser.c */, - 838490A91807C1C300E7332D /* gsm.h */, - 838490AA1807C1C300E7332D /* gsmdec_data.c */, - 838490AB1807C1C300E7332D /* gsmdec_data.h */, - 838490AC1807C1C300E7332D /* gsmdec.c */, - 838490AD1807C1C300E7332D /* msgsmdec.c */, - 838490AE1807C1C300E7332D /* msgsmdec.h */, - 838490AF1807C1C300E7332D /* truespeech_data.h */, - 838490B01807C1C300E7332D /* truespeech.c */, - 8384909E1807C12300E7332D /* adpcm_data.c */, - 8384909F1807C12300E7332D /* adpcm_data.h */, - 838490A01807C12300E7332D /* adpcm.c */, - 838490A11807C12300E7332D /* adpcm.h */, - 838490A21807C12300E7332D /* pcm.c */, - 8384909A1807BE1300E7332D /* synth_filter.c */, - 8384909B1807BE1300E7332D /* synth_filter.h */, - 838490861807BC9400E7332D /* dca_parser.c */, - 838490871807BC9400E7332D /* dca.c */, - 838490881807BC9400E7332D /* dca.h */, - 838490891807BC9400E7332D /* dcadata.h */, - 8384908A1807BC9400E7332D /* dcadec.c */, - 8384908B1807BC9400E7332D /* dcadsp.c */, - 8384908C1807BC9400E7332D /* dcadsp.h */, - 8384908D1807BC9400E7332D /* dcahuff.h */, - 8384907A1807B17500E7332D /* eac3_data.c */, - 8384907B1807B17500E7332D /* eac3_data.h */, - 8384907C1807B17500E7332D /* eac3dec.c */, - 838490761807B13000E7332D /* kbdwin.c */, - 838490771807B13000E7332D /* kbdwin.h */, - 8384906A1807AFB800E7332D /* aac_ac3_parser.c */, - 8384906B1807AFB800E7332D /* aac_ac3_parser.h */, - 838490501807AF0100E7332D /* ac3_parser.c */, - 838490511807AF0100E7332D /* ac3_parser.h */, - 838490521807AF0100E7332D /* ac3.c */, - 838490531807AF0100E7332D /* ac3.h */, - 838490541807AF0100E7332D /* ac3dec_data.c */, - 838490551807AF0100E7332D /* ac3dec_data.h */, - 838490561807AF0100E7332D /* ac3dec.c */, - 838490571807AF0100E7332D /* ac3dec.h */, - 838490581807AF0100E7332D /* ac3dsp.c */, - 838490591807AF0100E7332D /* ac3dsp.h */, - 8384905A1807AF0100E7332D /* ac3tab.c */, - 8384905B1807AF0100E7332D /* ac3tab.h */, - 8384904C1807898200E7332D /* apedec.c */, - 8393B81518052E9900913C76 /* mpegaudiodsp_fixed.c */, - 8393B81318052E7400913C76 /* mpegaudiodsp.c */, - 8393B80F18052DB700913C76 /* bitstream_filter.c */, - 8393B81018052DB700913C76 /* mp3_header_decompress_bsf.c */, - 8393B7E518052BC200913C76 /* mpegaudio_parser.c */, - 8393B7E618052BC200913C76 /* mpegaudio_tablegen.c */, - 8393B7E718052BC200913C76 /* mpegaudio_tablegen.h */, - 8393B7E818052BC200913C76 /* mpegaudio.c */, - 8393B7E918052BC200913C76 /* mpegaudio.h */, - 8393B7EA18052BC200913C76 /* mpegaudiodata.c */, - 8393B7EB18052BC200913C76 /* mpegaudiodata.h */, - 8393B7EC18052BC200913C76 /* mpegaudiodec_float.c */, - 8393B7ED18052BC200913C76 /* mpegaudiodec.c */, - 8393B7EE18052BC200913C76 /* mpegaudiodecheader.c */, - 8393B7EF18052BC200913C76 /* mpegaudiodecheader.h */, - 8393B7F018052BC200913C76 /* mpegaudiodectab.h */, - 8393B7F118052BC200913C76 /* mpegaudiodsp_data.c */, - 8393B7F318052BC200913C76 /* mpegaudiodsp_float.c */, - 8393B7F618052BC200913C76 /* mpegaudiodsp.h */, - 8393B7F818052BC200913C76 /* mpegaudiotab.h */, - 833C37D418032E7000CBA602 /* jrevdct.c */, - 833C37CA18032D4800CBA602 /* golomb.c */, - 833C37CB18032D4800CBA602 /* golomb.h */, - 833C37BA18032CF600CBA602 /* dirac_arith.c */, - 833C37BB18032CF600CBA602 /* dirac_arith.h */, - 833C37BC18032CF600CBA602 /* dirac_dwt.c */, - 833C37BD18032CF600CBA602 /* dirac_dwt.h */, - 833C37BE18032CF600CBA602 /* dirac_parser.c */, - 833C37BF18032CF600CBA602 /* dirac.c */, - 833C37C018032CF600CBA602 /* dirac.h */, - 833C37C118032CF600CBA602 /* diracdec.c */, - 833C37AA18032AEF00CBA602 /* diracdsp.c */, - 833C37AB18032AEF00CBA602 /* diracdsp.h */, - 833C37AC18032AEF00CBA602 /* dsputil.c */, - 833C37AD18032AEF00CBA602 /* dsputil.h */, - 833C37AE18032AEF00CBA602 /* diracdsp_mmx.c */, - 833C37AF18032AEF00CBA602 /* diracdsp_mmx.h */, - 833C37B018032AEF00CBA602 /* dsputil_x86.h */, - 833C379E18032A2700CBA602 /* unary.h */, - 833C3796180328B300CBA602 /* tak_parser.c */, - 833C3797180328B300CBA602 /* tak.c */, - 833C3798180328B300CBA602 /* tak.h */, - 833C3799180328B300CBA602 /* takdec.c */, - 830F0D9017FC8EAC00042E8F /* dvdata.c */, - 830F0D9117FC8EAC00042E8F /* dvdata.h */, - 830F0D8017FC8E8B00042E8F /* aac_tablegen_decl.h */, - 830F0D8117FC8E8B00042E8F /* aac_tablegen.h */, - 830F0D8217FC8E8B00042E8F /* aacps.h */, - 830F0D8317FC8E8B00042E8F /* aacpsdsp.h */, - 830F0D8417FC8E8B00042E8F /* dv_profile.c */, - 830F0D8517FC8E8B00042E8F /* dv_profile.h */, - 830F0D8617FC8E8B00042E8F /* sbr.h */, - 830F0D8717FC8E8B00042E8F /* sbrdsp.h */, - 830F0D7417FC8C7300042E8F /* aac.h */, - 830F0D7517FC8C7300042E8F /* mpeg4audio.c */, - 830F0D7617FC8C7300042E8F /* mpeg4audio.h */, - 830F0D6A17FC8C0700042E8F /* aactab.c */, - 830F0D6B17FC8C0700042E8F /* aactab.h */, - 830F0D6817FC8A3D00042E8F /* avpicture.c */, - 830F0D5C17FC89BD00042E8F /* options_table.h */, - 830F0D5D17FC89BD00042E8F /* options.c */, - 830F0D5417FC893E00042E8F /* bitstream.c */, - 830F0D5517FC893E00042E8F /* codec_desc.c */, - 830F0D5617FC893E00042E8F /* rawdec.c */, - 830F0D5717FC893E00042E8F /* tableprint.h */, - 830F0D0417FC80B400042E8F /* mips */, - 830F0D0617FC80B400042E8F /* rectangle.h */, - 830F0D0717FC80B400042E8F /* x86 */, - 830F0D0117FC7F4000042E8F /* sinewin_tablegen.h */, - 830F0C8417FC7F1E00042E8F /* acelp_filters.c */, - 830F0C8517FC7F1E00042E8F /* acelp_filters.h */, - 830F0C8617FC7F1E00042E8F /* acelp_pitch_delay.c */, - 830F0C8717FC7F1E00042E8F /* acelp_pitch_delay.h */, - 830F0C8817FC7F1E00042E8F /* acelp_vectors.c */, - 830F0C8917FC7F1E00042E8F /* acelp_vectors.h */, - 830F0C8A17FC7F1E00042E8F /* avpacket.c */, - 830F0C8B17FC7F1E00042E8F /* bit_depth_template.c */, - 830F0C8C17FC7F1E00042E8F /* bytestream.h */, - 830F0C8D17FC7F1E00042E8F /* celp_filters.c */, - 830F0C8E17FC7F1E00042E8F /* celp_filters.h */, - 830F0C8F17FC7F1E00042E8F /* celp_math.c */, - 830F0C9017FC7F1E00042E8F /* celp_math.h */, - 830F0C9117FC7F1E00042E8F /* copy_block.h */, - 830F0C9217FC7F1E00042E8F /* dct.c */, - 830F0C9317FC7F1E00042E8F /* dct.h */, - 830F0C9417FC7F1E00042E8F /* dct32_float.c */, - 830F0C9517FC7F1E00042E8F /* dct32.c */, - 830F0C9617FC7F1E00042E8F /* dct32.h */, - 830F0C9717FC7F1E00042E8F /* dctref.c */, - 830F0C9817FC7F1E00042E8F /* dctref.h */, - 830F0C9C17FC7F1E00042E8F /* error_resilience.c */, - 830F0C9D17FC7F1E00042E8F /* error_resilience.h */, - 830F0C9E17FC7F1E00042E8F /* faandct.c */, - 830F0C9F17FC7F1E00042E8F /* faandct.h */, - 830F0CA017FC7F1E00042E8F /* faanidct.c */, - 830F0CA117FC7F1E00042E8F /* faanidct.h */, - 830F0CA217FC7F1E00042E8F /* fmtconvert.c */, - 830F0CA317FC7F1E00042E8F /* fmtconvert.h */, - 830F0CA417FC7F1E00042E8F /* frame_thread_encoder.c */, - 830F0CA517FC7F1E00042E8F /* frame_thread_encoder.h */, - 830F0CA617FC7F1E00042E8F /* h264chroma_template.c */, - 830F0CA717FC7F1E00042E8F /* h264chroma.c */, - 830F0CA817FC7F1E00042E8F /* h264chroma.h */, - 830F0CA917FC7F1E00042E8F /* hpeldsp.c */, - 830F0CAA17FC7F1E00042E8F /* hpeldsp.h */, - 830F0CAB17FC7F1E00042E8F /* imgconvert.c */, - 830F0CAC17FC7F1E00042E8F /* imgconvert.h */, - 830F0CAD17FC7F1E00042E8F /* lsp.c */, - 830F0CAE17FC7F1E00042E8F /* lsp.h */, - 830F0CAF17FC7F1E00042E8F /* mpeg12data.c */, - 830F0CB017FC7F1E00042E8F /* mpeg12data.h */, - 830F0CB117FC7F1E00042E8F /* mpegvideo.h */, - 830F0CB217FC7F1E00042E8F /* ratecontrol.c */, - 830F0CB317FC7F1E00042E8F /* ratecontrol.h */, - 830F0CB417FC7F1E00042E8F /* raw.c */, - 830F0CB517FC7F1E00042E8F /* raw.h */, - 830F0CB617FC7F1E00042E8F /* rdft.c */, - 830F0CB717FC7F1E00042E8F /* rdft.h */, - 830F0CB817FC7F1E00042E8F /* rl.h */, - 830F0CB917FC7F1E00042E8F /* rnd_avg.h */, - 830F0CBB17FC7F1E00042E8F /* sinewin.c */, - 830F0CBC17FC7F1E00042E8F /* sinewin.h */, - 830F0CBD17FC7F1E00042E8F /* thread.h */, - 830F0CBE17FC7F1E00042E8F /* videodsp.c */, - 830F0CBF17FC7F1E00042E8F /* videodsp.h */, - 830F0CC017FC7F1E00042E8F /* wma.c */, - 830F0CC117FC7F1E00042E8F /* wma.h */, - 830F0C1317FC500B00042E8F /* fft-internal.h */, - 830F0C0F17FC4FF400042E8F /* avfft.c */, - 830F0C1017FC4FF400042E8F /* avfft.h */, - 830F0B8F17FC4FB900042E8F /* allcodecs.c */, - 830F0B9017FC4FB900042E8F /* avcodec.h */, - 830F0B9317FC4FB900042E8F /* fft.c */, - 830F0B9417FC4FB900042E8F /* fft.h */, - 830F0B9517FC4FB900042E8F /* get_bits.h */, - 830F0B9617FC4FB900042E8F /* internal.h */, - 830F0B9717FC4FB900042E8F /* mathops.h */, - 830F0B9817FC4FB900042E8F /* mathtables.c */, - 830F0B9917FC4FB900042E8F /* mdct.c */, - 830F0B9A17FC4FB900042E8F /* old_codec_ids.h */, - 830F0B9B17FC4FB900042E8F /* parser.c */, - 830F0B9C17FC4FB900042E8F /* parser.h */, - 830F0B9D17FC4FB900042E8F /* put_bits.h */, - 830F0B9E17FC4FB900042E8F /* simple_idct.c */, - 830F0B9F17FC4FB900042E8F /* simple_idct.h */, - 830F0BA017FC4FB900042E8F /* utils.c */, - 830F0BA117FC4FB900042E8F /* version.h */, - 830F0BA217FC4FB900042E8F /* wma_common.c */, - 830F0BA317FC4FB900042E8F /* wma_common.h */, - 830F0BA417FC4FB900042E8F /* wmadata.h */, - 830F0BA517FC4FB900042E8F /* wmadec.c */, - 830F0BA617FC4FB900042E8F /* wmalosslessdec.c */, - 830F0BA717FC4FB900042E8F /* wmaprodata.h */, - 830F0BA817FC4FB900042E8F /* wmaprodec.c */, - 830F0BA917FC4FB900042E8F /* wmavoice.c */, - 830F0BAA17FC4FB900042E8F /* wmavoice_data.h */, - 830F0BAB17FC4FB900042E8F /* x86 */, - ); - path = libavcodec; - sourceTree = ""; - }; - 830F0BAB17FC4FB900042E8F /* x86 */ = { - isa = PBXGroup; - children = ( - 830F0BAC17FC4FB900042E8F /* mathops.h */, - ); - path = x86; - sourceTree = ""; - }; - 830F0BAD17FC4FB900042E8F /* libavformat */ = { - isa = PBXGroup; - children = ( - 833E5F9B18A31EB7006A85F9 /* vqf.c */, - 830C4B60180C343C007674D6 /* amr.c */, - 838491141807D1D200E7332D /* tta.c */, - 838491121807D06100E7332D /* spdifdec.c */, - 838490FE1807C58500E7332D /* aacdec.c */, - 838490961807BC9C00E7332D /* dtshddec.c */, - 838490971807BC9C00E7332D /* dtsdec.c */, - 838490681807AF5800E7332D /* ac3dec.c */, - 8384904E1807898A00E7332D /* ape.c */, - 8393B7DF18052BB000913C76 /* mp3dec.c */, - 8393B7E018052BB000913C76 /* mpeg.c */, - 8393B7E118052BB000913C76 /* mpeg.h */, - 833C37A818032AAD00CBA602 /* img2.c */, - 833C37A418032A5000CBA602 /* apetag.c */, - 833C37A518032A5000CBA602 /* apetag.h */, - 833C37A018032A2F00CBA602 /* rawdec.c */, - 833C37A118032A2F00CBA602 /* rawdec.h */, - 833C3794180328A300CBA602 /* takdec.c */, - 830F0DD417FC93E400042E8F /* xwma.c */, - 830F0DCF17FC934D00042E8F /* spdif.c */, - 830F0DD017FC934D00042E8F /* spdif.h */, - 830F0DCB17FC933100042E8F /* w64.c */, - 830F0DCC17FC933100042E8F /* w64.h */, - 830F0DC717FC931700042E8F /* pcm.c */, - 830F0DC817FC931700042E8F /* pcm.h */, - 830F0DC517FC92FA00042E8F /* wavdec.c */, - 830F0DC117FC929E00042E8F /* mux.c */, - 830F0D7C17FC8E4800042E8F /* dv.c */, - 830F0D7D17FC8E4800042E8F /* dv.h */, - 830F0D7A17FC8E2400042E8F /* avidec.c */, - 830F0D6E17FC8C1300042E8F /* ast.c */, - 830F0D6F17FC8C1300042E8F /* ast.h */, - 830F0D7017FC8C1300042E8F /* astdec.c */, - 830F0D6017FC8A3300042E8F /* audiointerleave.c */, - 830F0D6117FC8A3300042E8F /* audiointerleave.h */, - 830F0D6217FC8A3300042E8F /* options_table.h */, - 830F0D6317FC8A3300042E8F /* options.c */, - 830F0C5A17FC7CEA00042E8F /* id3v1.c */, - 830F0C5B17FC7CEA00042E8F /* id3v1.h */, - 830F0C5217FC7CC300042E8F /* avlanguage.c */, - 830F0C5317FC7CC300042E8F /* avlanguage.h */, - 830F0C5417FC7CC300042E8F /* id3v2.c */, - 830F0C5517FC7CC300042E8F /* utils.c */, - 830F0C4017FC7CA300042E8F /* asf.h */, - 830F0C4117FC7CA300042E8F /* avio_internal.h */, - 830F0C4217FC7CA300042E8F /* id3v2.h */, - 830F0C4317FC7CA300042E8F /* internal.h */, - 830F0C4417FC7CA300042E8F /* metadata.c */, - 830F0C4517FC7CA300042E8F /* metadata.h */, - 830F0C4617FC7CA300042E8F /* riff.c */, - 830F0C4717FC7CA300042E8F /* riff.h */, - 830F0C4817FC7CA300042E8F /* riffdec.c */, - 830F0C2C17FC551F00042E8F /* asfcrypt.c */, - 830F0C2D17FC551F00042E8F /* asfcrypt.h */, - 830F0C2617FC54F800042E8F /* asfdec.c */, - 830F0C2717FC54F800042E8F /* rtpdec.h */, - 830F0C2817FC54F800042E8F /* srtp.h */, - 830F0C1517FC523000042E8F /* rdt.h */, - 830F0C1617FC523000042E8F /* rtp.h */, - 830F0C1717FC523000042E8F /* url.c */, - 830F0C1817FC523000042E8F /* url.h */, - 830F0BAE17FC4FB900042E8F /* allformats.c */, - 830F0BAF17FC4FB900042E8F /* asf.c */, - 830F0BB017FC4FB900042E8F /* avformat.h */, - 830F0BB117FC4FB900042E8F /* avi.h */, - 830F0BB217FC4FB900042E8F /* avio.c */, - 830F0BB317FC4FB900042E8F /* avio.h */, - 830F0BB417FC4FB900042E8F /* aviobuf.c */, - 830F0BB517FC4FB900042E8F /* cutils.c */, - 830F0BB617FC4FB900042E8F /* file.c */, - 830F0BB717FC4FB900042E8F /* format.c */, - 830F0BB817FC4FB900042E8F /* os_support.c */, - 830F0BB917FC4FB900042E8F /* os_support.h */, - ); - path = libavformat; - sourceTree = ""; - }; - 830F0BBA17FC4FB900042E8F /* libavutil */ = { - isa = PBXGroup; - children = ( - 832F4BC218CD5DE2003E940E /* time_.h */, - 832F4BBE18CD5DD9003E940E /* downmix_info.c */, - 832F4BBF18CD5DD9003E940E /* downmix_info.h */, - 832F4BB418CD4FEA003E940E /* macros.h */, - 832F4BB518CD4FEA003E940E /* timestamp.h */, - 832F4BA418CD4F47003E940E /* lls2.c */, - 832F4BA518CD4F47003E940E /* lls2.h */, - 838490721807B07000E7332D /* md5.c */, - 838490731807B07000E7332D /* md5.h */, - 8384906E1807B04200E7332D /* lfg.c */, - 8384906F1807B04200E7332D /* lfg.h */, - 83BCB8DF17FCA64400760340 /* avconfig.h */, - 83BCB8E017FCA64400760340 /* timecode.c */, - 83BCB8E117FCA64400760340 /* timecode.h */, - 830F0DB117FC8FCE00042E8F /* log2_tab.c */, - 830F0D5217FC891800042E8F /* file_open.c */, - 830F0D4A17FC862300042E8F /* time.c */, - 830F0D4C17FC862400042E8F /* utils.c */, - 830F0D4217FC85ED00042E8F /* integer.c */, - 830F0D4317FC85ED00042E8F /* integer.h */, - 830F0D4417FC85ED00042E8F /* intmath.c */, - 830F0D4517FC85ED00042E8F /* intmath.h */, - 830F0D3E17FC848D00042E8F /* sha.c */, - 830F0D3F17FC848D00042E8F /* sha.h */, - 830F0D3A17FC846C00042E8F /* random_seed.c */, - 830F0D3B17FC846C00042E8F /* random_seed.h */, - 830F0D3617FC844E00042E8F /* parseutils.c */, - 830F0D3717FC844E00042E8F /* parseutils.h */, - 830F0D2617FC841B00042E8F /* channel_layout.c */, - 830F0D2717FC841B00042E8F /* error.c */, - 830F0D2817FC841B00042E8F /* imgutils.c */, - 830F0D2917FC841B00042E8F /* imgutils.h */, - 830F0D2A17FC841B00042E8F /* intfloat_readwrite.c */, - 830F0D2B17FC841B00042E8F /* opt.c */, - 830F0D2C17FC841B00042E8F /* opt.h */, - 830F0D2D17FC841B00042E8F /* samplefmt.c */, - 830F0D1617FC82AB00042E8F /* colorspace.h */, - 830F0D1717FC82AB00042E8F /* cpu_internal.h */, - 830F0D1817FC82AB00042E8F /* cpu.c */, - 830F0D1917FC82AB00042E8F /* eval.c */, - 830F0D1A17FC82AB00042E8F /* eval.h */, - 830F0D1B17FC82AB00042E8F /* fifo.c */, - 830F0D1C17FC82AB00042E8F /* fifo.h */, - 830F0D1D17FC82AB00042E8F /* frame.c */, - 830F0C7E17FC7ED100042E8F /* crc.h */, - 830F0C7F17FC7ED100042E8F /* dict.c */, - 830F0C8017FC7ED100042E8F /* rational.c */, - 830F0C7817FC7E4E00042E8F /* crc.c */, - 830F0C7917FC7E4E00042E8F /* log.c */, - 830F0C7A17FC7E4E00042E8F /* mathematics.c */, - 830F0C7417FC7DCB00042E8F /* avstring.c */, - 830F0C7517FC7DCB00042E8F /* avstring.h */, - 830F0C6017FC7DB100042E8F /* avassert.h */, - 830F0C6117FC7DB100042E8F /* bprint.c */, - 830F0C6217FC7DB100042E8F /* bprint.h */, - 830F0C6317FC7DB100042E8F /* buffer_internal.h */, - 830F0C6417FC7DB100042E8F /* intreadwrite.h */, - 830F0C6517FC7DB100042E8F /* pixdesc.c */, - 830F0C6617FC7DB100042E8F /* pixdesc.h */, - 830F0C6717FC7DB100042E8F /* rc4.c */, - 830F0C6817FC7DB100042E8F /* rc4.h */, - 830F0C6917FC7DB100042E8F /* version.h */, - 830F0C3017FC554D00042E8F /* buffer.c */, - 830F0C3117FC554D00042E8F /* des.c */, - 830F0C3217FC554D00042E8F /* des.h */, - 830F0C3317FC554D00042E8F /* float_dsp.c */, - 830F0C3417FC554D00042E8F /* float_dsp.h */, - 830F0C3517FC554D00042E8F /* internal.h */, - 830F0C3617FC554D00042E8F /* libm.h */, - 830F0C3717FC554D00042E8F /* timer.h */, - 830F0C1D17FC527400042E8F /* atomic_gcc.h */, - 830F0C1E17FC527400042E8F /* atomic.c */, - 830F0C1F17FC527400042E8F /* atomic.h */, - 830F0C2017FC527400042E8F /* x86 */, - 830F0BBB17FC4FB900042E8F /* attributes.h */, - 830F0BBC17FC4FB900042E8F /* avutil.h */, - 830F0BBD17FC4FB900042E8F /* bswap.h */, - 830F0BBE17FC4FB900042E8F /* buffer.h */, - 830F0BBF17FC4FB900042E8F /* channel_layout.h */, - 830F0BC017FC4FB900042E8F /* common.h */, - 830F0BC117FC4FB900042E8F /* cpu.h */, - 830F0BC217FC4FB900042E8F /* dict.h */, - 830F0BC317FC4FB900042E8F /* error.h */, - 830F0BC417FC4FB900042E8F /* frame.h */, - 830F0BC517FC4FB900042E8F /* intfloat.h */, - 830F0BC617FC4FB900042E8F /* intfloat_readwrite.h */, - 830F0BC717FC4FB900042E8F /* log.h */, - 830F0BC817FC4FB900042E8F /* mathematics.h */, - 830F0BC917FC4FB900042E8F /* mem.c */, - 830F0BCA17FC4FB900042E8F /* mem.h */, - 830F0BCB17FC4FB900042E8F /* old_pix_fmts.h */, - 830F0BCC17FC4FB900042E8F /* pixfmt.h */, - 830F0BCD17FC4FB900042E8F /* rational.h */, - 830F0BCE17FC4FB900042E8F /* samplefmt.h */, - 830F0BCF17FC4FB900042E8F /* x86 */, - ); - path = libavutil; - sourceTree = ""; - }; - 830F0BCF17FC4FB900042E8F /* x86 */ = { - isa = PBXGroup; - children = ( - 830F0BD017FC4FB900042E8F /* bswap.h */, - ); - path = x86; - sourceTree = ""; - }; - 830F0C2017FC527400042E8F /* x86 */ = { - isa = PBXGroup; - children = ( - 8384910A1807CE2A00E7332D /* lls_init.c */, - 830F0DBF17FC927D00042E8F /* float_dsp_init.c */, - 830F0DB317FC921D00042E8F /* asm.h */, - 830F0DB417FC921D00042E8F /* cpu.c */, - 830F0DB517FC921D00042E8F /* cpu.h */, - 830F0DB617FC921D00042E8F /* emms.h */, - 830F0DB717FC921D00042E8F /* timer.h */, - 830F0C2117FC527400042E8F /* bswap.h */, - ); - path = x86; - sourceTree = ""; - }; - 830F0D0417FC80B400042E8F /* mips */ = { - isa = PBXGroup; - children = ( - 830C4B62180C3580007674D6 /* amrwbdec_mips.h */, - 830F0D0517FC80B400042E8F /* lsp_mips.h */, - ); - path = mips; - sourceTree = ""; - }; - 830F0D0717FC80B400042E8F /* x86 */ = { - isa = PBXGroup; - children = ( - 832F4BC618CD6052003E940E /* dcadsp_init.c */, - 832F4BC418CD601B003E940E /* ttadsp_init.c */, - 838491101807CEF400E7332D /* sbrdsp_init.c */, - 8384910E1807CEC400E7332D /* lpc.c */, - 838490841807B17C00E7332D /* ac3dsp_init.c */, - 8393B80D18052BD500913C76 /* mpegaudiodsp.c */, - 833C37D618032EA500CBA602 /* idct_xvid.h */, - 833C37D218032E4800CBA602 /* dsputil_init.c */, - 833C37CC18032D4800CBA602 /* dirac_dwt.c */, - 833C37CD18032D4800CBA602 /* dirac_dwt.h */, - 830F0DC317FC92EE00042E8F /* videodsp_init.c */, - 830F0DBD17FC922C00042E8F /* h264chroma_init.c */, - 830F0DA917FC8FBD00042E8F /* dct_init.c */, - 830F0DAA17FC8FBD00042E8F /* fft_init.c */, - 830F0DAB17FC8FBD00042E8F /* fmtconvert_init.c */, - 830F0DAC17FC8FBD00042E8F /* hpeldsp_init.c */, - 830F0D1017FC815000042E8F /* constants.c */, - 830F0D1117FC815000042E8F /* constants.h */, - 830F0D0A17FC80B400042E8F /* mathops.h */, - ); - path = x86; - sourceTree = ""; - }; - B09E94660D74834B0064F138 /* ffmpeg-minimal */ = { - isa = PBXGroup; - children = ( - 830F0B8E17FC4FB900042E8F /* libavcodec */, - 830F0BAD17FC4FB900042E8F /* libavformat */, - 830F0BBA17FC4FB900042E8F /* libavutil */, - B09E94730D74834B0064F138 /* config.h */, - ); - path = "ffmpeg-minimal"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8DC2EF500486A6940098B216 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 83BCB8E217FCA64400760340 /* avconfig.h in Headers */, - 830F0D3417FC841B00042E8F /* opt.h in Headers */, - 830F0C1C17FC523000042E8F /* url.h in Headers */, - 830F0BDC17FC4FB900042E8F /* old_codec_ids.h in Headers */, - 830F0C0B17FC4FB900042E8F /* pixfmt.h in Headers */, - 830F0C0517FC4FB900042E8F /* intfloat_readwrite.h in Headers */, - 832F4BBB18CD53E9003E940E /* ttadsp.h in Headers */, - 830F0C0417FC4FB900042E8F /* intfloat.h in Headers */, - 830F0C0717FC4FB900042E8F /* mathematics.h in Headers */, - 838491031807CDC000E7332D /* lpc.h in Headers */, - 830F0BF317FC4FB900042E8F /* avio.h in Headers */, - 830F0C0C17FC4FB900042E8F /* rational.h in Headers */, - 830F0C0617FC4FB900042E8F /* log.h in Headers */, - 838490DB1807C47E00E7332D /* g723_1_data.h in Headers */, - 830F0C0317FC4FB900042E8F /* frame.h in Headers */, - 830F0C0117FC4FB900042E8F /* dict.h in Headers */, - 8393B80418052BC200913C76 /* mpegaudiodectab.h in Headers */, - 8384911B1807D1D900E7332D /* ttadata.h in Headers */, - 830F0BFE17FC4FB900042E8F /* channel_layout.h in Headers */, - 830F0C0017FC4FB900042E8F /* cpu.h in Headers */, - 830F0C0217FC4FB900042E8F /* error.h in Headers */, - 830F0C0917FC4FB900042E8F /* mem.h in Headers */, - 838490BB1807C30900E7332D /* pcm_tablegen.h in Headers */, - 830F0BE317FC4FB900042E8F /* version.h in Headers */, - 830F0BFA17FC4FB900042E8F /* attributes.h in Headers */, - 830F0BFF17FC4FB900042E8F /* common.h in Headers */, - 832F4BB618CD4FEA003E940E /* macros.h in Headers */, - 830F0BFB17FC4FB900042E8F /* avutil.h in Headers */, - 830F0C0D17FC4FB900042E8F /* samplefmt.h in Headers */, - 830F0BFD17FC4FB900042E8F /* buffer.h in Headers */, - 838490911807BC9400E7332D /* dcadata.h in Headers */, - 8393B80A18052BC200913C76 /* mpegaudiodsp.h in Headers */, - 838490B71807C1C300E7332D /* msgsmdec.h in Headers */, - 830F0C1217FC4FF400042E8F /* avfft.h in Headers */, - 830F0BF017FC4FB900042E8F /* avformat.h in Headers */, - B09E94940D74834B0064F138 /* config.h in Headers */, - 830F0BD217FC4FB900042E8F /* avcodec.h in Headers */, - 830F0D7217FC8C1300042E8F /* ast.h in Headers */, - 833C37A718032A5000CBA602 /* apetag.h in Headers */, - 830F0D8917FC8E8B00042E8F /* aac_tablegen.h in Headers */, - 830F0D3117FC841B00042E8F /* imgutils.h in Headers */, - 830F0C6C17FC7DB100042E8F /* bprint.h in Headers */, - 838490D51807C47E00E7332D /* g729.h in Headers */, - 830F0CE117FC7F1E00042E8F /* fmtconvert.h in Headers */, - 830F0D7717FC8C7300042E8F /* aac.h in Headers */, - 8393B7FF18052BC200913C76 /* mpegaudiodata.h in Headers */, - 830F0CD417FC7F1E00042E8F /* dct32.h in Headers */, - 830F0CCF17FC7F1E00042E8F /* copy_block.h in Headers */, - 838490801807B17500E7332D /* eac3_data.h in Headers */, - 830F0D9317FC8EAC00042E8F /* dvdata.h in Headers */, - 830F0CEA17FC7F1E00042E8F /* imgconvert.h in Headers */, - 8393B7FB18052BC200913C76 /* mpegaudio_tablegen.h in Headers */, - 830F0D4717FC85ED00042E8F /* integer.h in Headers */, - 830F0D7F17FC8E4800042E8F /* dv.h in Headers */, - 830F0D0F17FC80B400042E8F /* mathops.h in Headers */, - 830F0D1417FC815000042E8F /* constants.h in Headers */, - 830F0C7717FC7DCB00042E8F /* avstring.h in Headers */, - 830F0BF917FC4FB900042E8F /* os_support.h in Headers */, - 8384906D1807AFB800E7332D /* aac_ac3_parser.h in Headers */, - 838490611807AF0100E7332D /* ac3dec_data.h in Headers */, - 838490FD1807C57B00E7332D /* aacsbrdata.h in Headers */, - 830F0D2217FC82AB00042E8F /* eval.h in Headers */, - 8384909D1807BE1300E7332D /* synth_filter.h in Headers */, - 830F0C2A17FC54F800042E8F /* rtpdec.h in Headers */, - 830F0CFF17FC7F1E00042E8F /* wma.h in Headers */, - 830F0C4E17FC7CA300042E8F /* metadata.h in Headers */, - 830F0C4B17FC7CA300042E8F /* id3v2.h in Headers */, - 838490A41807C12300E7332D /* adpcm_data.h in Headers */, - 838490B81807C1C300E7332D /* truespeech_data.h in Headers */, - 830F0CFB17FC7F1E00042E8F /* thread.h in Headers */, - 830F0D6617FC8A3300042E8F /* options_table.h in Headers */, - 830F0CF317FC7F1E00042E8F /* raw.h in Headers */, - 838490D61807C47E00E7332D /* g729data.h in Headers */, - 833C37B618032AEF00CBA602 /* diracdsp_mmx.h in Headers */, - 833C37B418032AEF00CBA602 /* dsputil.h in Headers */, - 830F0C3F17FC554D00042E8F /* timer.h in Headers */, - 830F0D1E17FC82AB00042E8F /* colorspace.h in Headers */, - 830F0DBA17FC921D00042E8F /* cpu.h in Headers */, - 838491051807CDEC00E7332D /* cbrt_tablegen.h in Headers */, - 830F0C7317FC7DB100042E8F /* version.h in Headers */, - 830F0BDF17FC4FB900042E8F /* put_bits.h in Headers */, - 830F0C7217FC7DB100042E8F /* rc4.h in Headers */, - 830F0C2517FC527400042E8F /* bswap.h in Headers */, - 833C379F18032A2700CBA602 /* unary.h in Headers */, - 8384905F1807AF0100E7332D /* ac3.h in Headers */, - 830F0CDD17FC7F1E00042E8F /* faandct.h in Headers */, - 830F0D0B17FC80B400042E8F /* lsp_mips.h in Headers */, - 830F0C2B17FC54F800042E8F /* srtp.h in Headers */, - 830F0D5E17FC89BD00042E8F /* options_table.h in Headers */, - 830F0CEC17FC7F1E00042E8F /* lsp.h in Headers */, - 830F0D6517FC8A3300042E8F /* audiointerleave.h in Headers */, - 833C37A318032A2F00CBA602 /* rawdec.h in Headers */, - 838490DF1807C47E00E7332D /* g722.h in Headers */, - 833E5FA318A31EC4006A85F9 /* twinvq.h in Headers */, - 830F0D3D17FC846C00042E8F /* random_seed.h in Headers */, - 830F0CCA17FC7F1E00042E8F /* bytestream.h in Headers */, - 830F0D0317FC7F4000042E8F /* sinewin_tablegen.h in Headers */, - 838490651807AF0100E7332D /* ac3dsp.h in Headers */, - 833C37C518032CF600CBA602 /* dirac_dwt.h in Headers */, - 838490751807B07000E7332D /* md5.h in Headers */, - 830F0CDF17FC7F1E00042E8F /* faanidct.h in Headers */, - 830F0DD217FC934D00042E8F /* spdif.h in Headers */, - 830F0BDE17FC4FB900042E8F /* parser.h in Headers */, - 830F0C6E17FC7DB100042E8F /* intreadwrite.h in Headers */, - 830F0CEF17FC7F1E00042E8F /* mpegvideo.h in Headers */, - 830F0C5017FC7CA300042E8F /* riff.h in Headers */, - 830F0D5B17FC893E00042E8F /* tableprint.h in Headers */, - 830F0BE117FC4FB900042E8F /* simple_idct.h in Headers */, - 8393B7FD18052BC200913C76 /* mpegaudio.h in Headers */, - 830F0D0C17FC80B400042E8F /* rectangle.h in Headers */, - 830F0C2F17FC551F00042E8F /* asfcrypt.h in Headers */, - 830F0C0A17FC4FB900042E8F /* old_pix_fmts.h in Headers */, - 830F0CF517FC7F1E00042E8F /* rdft.h in Headers */, - 830F0D1F17FC82AB00042E8F /* cpu_internal.h in Headers */, - 830F0C1A17FC523000042E8F /* rtp.h in Headers */, - 838490711807B04200E7332D /* lfg.h in Headers */, - 830F0D8817FC8E8B00042E8F /* aac_tablegen_decl.h in Headers */, - 838490671807AF0100E7332D /* ac3tab.h in Headers */, - 830F0BE917FC4FB900042E8F /* wmaprodata.h in Headers */, - 830F0C4917FC7CA300042E8F /* asf.h in Headers */, - 830F0DCA17FC931700042E8F /* pcm.h in Headers */, - 830F0CCC17FC7F1E00042E8F /* celp_filters.h in Headers */, - 830C4B5C180C3434007674D6 /* amrnbdata.h in Headers */, - 830F0BD717FC4FB900042E8F /* get_bits.h in Headers */, - 830F0C2417FC527400042E8F /* atomic.h in Headers */, - 832F4BC318CD5DE2003E940E /* time_.h in Headers */, - 833E5FA118A31EC4006A85F9 /* twinvq_data.h in Headers */, - 830F0C5D17FC7CEA00042E8F /* id3v1.h in Headers */, - 832F4BAF18CD4F6B003E940E /* atrac3plus_data.h in Headers */, - 838490631807AF0100E7332D /* ac3dec.h in Headers */, - 838490C31807C37300E7332D /* atrac.h in Headers */, - 830F0C6A17FC7DB100042E8F /* avassert.h in Headers */, - 830F0D6D17FC8C0700042E8F /* aactab.h in Headers */, - 830F0BEC17FC4FB900042E8F /* wmavoice_data.h in Headers */, - 833C37D118032D4800CBA602 /* dirac_dwt.h in Headers */, - 8393B80318052BC200913C76 /* mpegaudiodecheader.h in Headers */, - 838490901807BC9400E7332D /* dca.h in Headers */, - 830C4B5E180C3434007674D6 /* amrwbdata.h in Headers */, - 830F0D7917FC8C7300042E8F /* mpeg4audio.h in Headers */, - 830F0C3A17FC554D00042E8F /* des.h in Headers */, - 830F0BF117FC4FB900042E8F /* avi.h in Headers */, - 830F0CFD17FC7F1E00042E8F /* videodsp.h in Headers */, - 830F0D4917FC85ED00042E8F /* intmath.h in Headers */, - 830F0C6D17FC7DB100042E8F /* buffer_internal.h in Headers */, - 830F0DBB17FC921D00042E8F /* emms.h in Headers */, - 830F0C2217FC527400042E8F /* atomic_gcc.h in Headers */, - 838490F21807C57B00E7332D /* aacadtsdec.h in Headers */, - 830F0CD117FC7F1E00042E8F /* dct.h in Headers */, - 830F0DBC17FC921D00042E8F /* timer.h in Headers */, - 830F0CE617FC7F1E00042E8F /* h264chroma.h in Headers */, - 830F0BD817FC4FB900042E8F /* internal.h in Headers */, - 830F0BE517FC4FB900042E8F /* wma_common.h in Headers */, - 830F0CDB17FC7F1E00042E8F /* error_resilience.h in Headers */, - 832F4BB718CD4FEA003E940E /* timestamp.h in Headers */, - 830F0C4A17FC7CA300042E8F /* avio_internal.h in Headers */, - 830F0C7017FC7DB100042E8F /* pixdesc.h in Headers */, - 833C37C318032CF600CBA602 /* dirac_arith.h in Headers */, - 830C4B63180C3580007674D6 /* amrwbdec_mips.h in Headers */, - 830F0CF717FC7F1E00042E8F /* rnd_avg.h in Headers */, - 830F0D4117FC848D00042E8F /* sha.h in Headers */, - 830F0CEE17FC7F1E00042E8F /* mpeg12data.h in Headers */, - 830F0CE817FC7F1E00042E8F /* hpeldsp.h in Headers */, - 830F0D8B17FC8E8B00042E8F /* aacpsdsp.h in Headers */, - 830F0CD617FC7F1E00042E8F /* dctref.h in Headers */, - 832F4BA718CD4F47003E940E /* lls2.h in Headers */, - 838490F61807C57B00E7332D /* aacps_tablegen.h in Headers */, - 830F0C1917FC523000042E8F /* rdt.h in Headers */, - 838490941807BC9400E7332D /* dcadsp.h in Headers */, - 8393B80C18052BC200913C76 /* mpegaudiotab.h in Headers */, - 838490951807BC9400E7332D /* dcahuff.h in Headers */, - 838490A61807C12300E7332D /* adpcm.h in Headers */, - 830F0CF117FC7F1E00042E8F /* ratecontrol.h in Headers */, - 830F0C1417FC500B00042E8F /* fft-internal.h in Headers */, - 830F0D8E17FC8E8B00042E8F /* sbr.h in Headers */, - 830C4B5B180C3434007674D6 /* amr.h in Headers */, - 833C37B218032AEF00CBA602 /* diracdsp.h in Headers */, - 830F0C3D17FC554D00042E8F /* internal.h in Headers */, - 833C37D718032EA500CBA602 /* idct_xvid.h in Headers */, - 830F0CF617FC7F1E00042E8F /* rl.h in Headers */, - 830F0D8D17FC8E8B00042E8F /* dv_profile.h in Headers */, - 830F0D3917FC844E00042E8F /* parseutils.h in Headers */, - 830F0CC317FC7F1E00042E8F /* acelp_filters.h in Headers */, - 83BCB8E417FCA64400760340 /* timecode.h in Headers */, - 830F0DCE17FC933100042E8F /* w64.h in Headers */, - 830F0C3E17FC554D00042E8F /* libm.h in Headers */, - 838490FC1807C57B00E7332D /* aacsbr.h in Headers */, - 830F0C4C17FC7CA300042E8F /* internal.h in Headers */, - 838490BF1807C34900E7332D /* atrac3data.h in Headers */, - 830F0BFC17FC4FB900042E8F /* bswap.h in Headers */, - 830F0D8A17FC8E8B00042E8F /* aacps.h in Headers */, - 833C37C818032CF600CBA602 /* dirac.h in Headers */, - 830F0BD617FC4FB900042E8F /* fft.h in Headers */, - 838490F51807C57B00E7332D /* aacdectab.h in Headers */, - 838490791807B13000E7332D /* kbdwin.h in Headers */, - 830F0CE317FC7F1E00042E8F /* frame_thread_encoder.h in Headers */, - 830F0BE617FC4FB900042E8F /* wmadata.h in Headers */, - 830F0C5717FC7CC300042E8F /* avlanguage.h in Headers */, - 830F0D2417FC82AB00042E8F /* fifo.h in Headers */, - 838490B21807C1C300E7332D /* gsm.h in Headers */, - 838490B41807C1C300E7332D /* gsmdec_data.h in Headers */, - 830F0BD917FC4FB900042E8F /* mathops.h in Headers */, - 8393B7E418052BB000913C76 /* mpeg.h in Headers */, - 830F0C3C17FC554D00042E8F /* float_dsp.h in Headers */, - 833C37CF18032D4800CBA602 /* golomb.h in Headers */, - 830F0C8117FC7ED100042E8F /* crc.h in Headers */, - 833C379C180328B300CBA602 /* tak.h in Headers */, - 830F0DB817FC921D00042E8F /* asm.h in Headers */, - 832F4BC118CD5DD9003E940E /* downmix_info.h in Headers */, - 830F0CC517FC7F1E00042E8F /* acelp_pitch_delay.h in Headers */, - 838490D91807C47E00E7332D /* g729postfilter.h in Headers */, - 832F4BB118CD4F6B003E940E /* atrac3plus.h in Headers */, - 830F0D8F17FC8E8B00042E8F /* sbrdsp.h in Headers */, - 830F0CCE17FC7F1E00042E8F /* celp_math.h in Headers */, - 8384905D1807AF0100E7332D /* ac3_parser.h in Headers */, - 833C37B718032AEF00CBA602 /* dsputil_x86.h in Headers */, - 830F0CFA17FC7F1E00042E8F /* sinewin.h in Headers */, - 830F0CC717FC7F1E00042E8F /* acelp_vectors.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8DC2EF4F0486A6940098B216 /* FFMPEG Framework */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "FFMPEG Framework" */; - buildPhases = ( - 8DC2EF500486A6940098B216 /* Headers */, - 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "FFMPEG Framework"; - productInstallPath = "$(HOME)/Library/Frameworks"; - productName = FFMPEG; - productReference = 8DC2EF5B0486A6940098B216 /* FFMPEG.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - }; - buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "FFMPEG" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - en, - es, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* FFMPEG */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DC2EF4F0486A6940098B216 /* FFMPEG Framework */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8DC2EF520486A6940098B216 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8DC2EF540486A6940098B216 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 838490DA1807C47E00E7332D /* g726.c in Sources */, - 833C37A918032AAD00CBA602 /* img2.c in Sources */, - 838490701807B04200E7332D /* lfg.c in Sources */, - 838490981807BC9C00E7332D /* dtshddec.c in Sources */, - 830F0D6717FC8A3300042E8F /* options.c in Sources */, - 838490FB1807C57B00E7332D /* aacsbr.c in Sources */, - 830F0DAF17FC8FBD00042E8F /* fmtconvert_init.c in Sources */, - 830F0DD617FC93E400042E8F /* xwma.c in Sources */, - 830F0DAD17FC8FBD00042E8F /* dct_init.c in Sources */, - 830F0CF217FC7F1E00042E8F /* raw.c in Sources */, - 830F0CF417FC7F1E00042E8F /* rdft.c in Sources */, - 830F0DB217FC8FCE00042E8F /* log2_tab.c in Sources */, - 830F0BEE17FC4FB900042E8F /* allformats.c in Sources */, - 832F4BB218CD4F6B003E940E /* atrac3plusdec.c in Sources */, - 830F0D4817FC85ED00042E8F /* intmath.c in Sources */, - 8384904F1807898A00E7332D /* ape.c in Sources */, - 830F0CF017FC7F1E00042E8F /* ratecontrol.c in Sources */, - 830F0D5A17FC893E00042E8F /* rawdec.c in Sources */, - 830F0DAE17FC8FBD00042E8F /* fft_init.c in Sources */, - 830F0D2F17FC841B00042E8F /* error.c in Sources */, - 838490781807B13000E7332D /* kbdwin.c in Sources */, - 830F0BDB17FC4FB900042E8F /* mdct.c in Sources */, - 833C37A618032A5000CBA602 /* apetag.c in Sources */, - 830F0D5817FC893E00042E8F /* bitstream.c in Sources */, - 833C37A218032A2F00CBA602 /* rawdec.c in Sources */, - 830F0C7617FC7DCB00042E8F /* avstring.c in Sources */, - 830F0DCD17FC933100042E8F /* w64.c in Sources */, - 833C37D518032E7000CBA602 /* jrevdct.c in Sources */, - 830F0BE217FC4FB900042E8F /* utils.c in Sources */, - 838491191807D1D900E7332D /* tta.c in Sources */, - 838490741807B07000E7332D /* md5.c in Sources */, - 8393B80E18052BD500913C76 /* mpegaudiodsp.c in Sources */, - 8384909C1807BE1300E7332D /* synth_filter.c in Sources */, - 8384910B1807CE2A00E7332D /* lls_init.c in Sources */, - 8393B81418052E7400913C76 /* mpegaudiodsp.c in Sources */, - 830F0CF917FC7F1E00042E8F /* sinewin.c in Sources */, - 833C37C418032CF600CBA602 /* dirac_dwt.c in Sources */, - 838490851807B17C00E7332D /* ac3dsp_init.c in Sources */, - 830F0CE417FC7F1E00042E8F /* h264chroma_template.c in Sources */, - 830F0BEF17FC4FB900042E8F /* asf.c in Sources */, - 830F0BD517FC4FB900042E8F /* fft.c in Sources */, - 830F0CFE17FC7F1E00042E8F /* wma.c in Sources */, - 8393B7E218052BB000913C76 /* mp3dec.c in Sources */, - 830F0BD117FC4FB900042E8F /* allcodecs.c in Sources */, - 8393B80718052BC200913C76 /* mpegaudiodsp_float.c in Sources */, - 830F0D5917FC893E00042E8F /* codec_desc.c in Sources */, - 830F0DBE17FC922C00042E8F /* h264chroma_init.c in Sources */, - 830F0BF217FC4FB900042E8F /* avio.c in Sources */, - 830C4B5F180C3434007674D6 /* amrwbdec.c in Sources */, - 838490DC1807C47E00E7332D /* g723_1.c in Sources */, - 832F4BC518CD601B003E940E /* ttadsp_init.c in Sources */, - 830F0CE217FC7F1E00042E8F /* frame_thread_encoder.c in Sources */, - 830C4B61180C343C007674D6 /* amr.c in Sources */, - 838491151807D1D200E7332D /* tta.c in Sources */, - 8393B80118052BC200913C76 /* mpegaudiodec.c in Sources */, - 830F0C3817FC554D00042E8F /* buffer.c in Sources */, - 8384905C1807AF0100E7332D /* ac3_parser.c in Sources */, - 830F0C6B17FC7DB100042E8F /* bprint.c in Sources */, - 830F0BE017FC4FB900042E8F /* simple_idct.c in Sources */, - 830C4B5D180C3434007674D6 /* amrnbdec.c in Sources */, - 838490991807BC9C00E7332D /* dtsdec.c in Sources */, - 830F0D6917FC8A3D00042E8F /* avpicture.c in Sources */, - 8393B80518052BC200913C76 /* mpegaudiodsp_data.c in Sources */, - 830F0CDA17FC7F1E00042E8F /* error_resilience.c in Sources */, - 838490A51807C12300E7332D /* adpcm.c in Sources */, - 830F0D3317FC841B00042E8F /* opt.c in Sources */, - 838490BE1807C34900E7332D /* atrac3.c in Sources */, - 838490921807BC9400E7332D /* dcadec.c in Sources */, - 838490F71807C57B00E7332D /* aacps.c in Sources */, - 830F0D7317FC8C1300042E8F /* astdec.c in Sources */, - 8384905E1807AF0100E7332D /* ac3.c in Sources */, - 830F0D5317FC891800042E8F /* file_open.c in Sources */, - 833C379D180328B300CBA602 /* takdec.c in Sources */, - 830F0D7B17FC8E2400042E8F /* avidec.c in Sources */, - 830F0D4F17FC862400042E8F /* utils.c in Sources */, - 8393B81218052DB700913C76 /* mp3_header_decompress_bsf.c in Sources */, - 830F0BEB17FC4FB900042E8F /* wmavoice.c in Sources */, - 838490D71807C47E00E7332D /* g729dec.c in Sources */, - 833C37B318032AEF00CBA602 /* dsputil.c in Sources */, - 830F0CC217FC7F1E00042E8F /* acelp_filters.c in Sources */, - 830F0DB017FC8FBD00042E8F /* hpeldsp_init.c in Sources */, - 830F0C1B17FC523000042E8F /* url.c in Sources */, - 830F0CC417FC7F1E00042E8F /* acelp_pitch_delay.c in Sources */, - 8393B80218052BC200913C76 /* mpegaudiodecheader.c in Sources */, - 838490A31807C12300E7332D /* adpcm_data.c in Sources */, - 8384908E1807BC9400E7332D /* dca_parser.c in Sources */, - 8384908F1807BC9400E7332D /* dca.c in Sources */, - 833C37C218032CF600CBA602 /* dirac_arith.c in Sources */, - 838490F01807C57B00E7332D /* aac_parser.c in Sources */, - 830F0CEB17FC7F1E00042E8F /* lsp.c in Sources */, - 830F0D1317FC815000042E8F /* constants.c in Sources */, - 8384910F1807CEC400E7332D /* lpc.c in Sources */, - 830F0BE417FC4FB900042E8F /* wma_common.c in Sources */, - 8393B7FA18052BC200913C76 /* mpegaudio_tablegen.c in Sources */, - 838490601807AF0100E7332D /* ac3dec_data.c in Sources */, - 8384907F1807B17500E7332D /* eac3_data.c in Sources */, - 838490B11807C1C300E7332D /* gsm_parser.c in Sources */, - 838490DD1807C47E00E7332D /* g722dec.c in Sources */, - 830F0C5617FC7CC300042E8F /* avlanguage.c in Sources */, - 830F0C5117FC7CA300042E8F /* riffdec.c in Sources */, - 830F0D4617FC85ED00042E8F /* integer.c in Sources */, - 830F0C7117FC7DB100042E8F /* rc4.c in Sources */, - 830F0CE917FC7F1E00042E8F /* imgconvert.c in Sources */, - 830F0CE717FC7F1E00042E8F /* hpeldsp.c in Sources */, - 830F0CCB17FC7F1E00042E8F /* celp_filters.c in Sources */, - 838491131807D06100E7332D /* spdifdec.c in Sources */, - 833C37B518032AEF00CBA602 /* diracdsp_mmx.c in Sources */, - 838490B61807C1C300E7332D /* msgsmdec.c in Sources */, - 838490B31807C1C300E7332D /* gsmdec_data.c in Sources */, - 830F0BF717FC4FB900042E8F /* format.c in Sources */, - 830F0CC817FC7F1E00042E8F /* avpacket.c in Sources */, - 833C37CE18032D4800CBA602 /* golomb.c in Sources */, - 830F0C3917FC554D00042E8F /* des.c in Sources */, - 833C37C918032CF600CBA602 /* diracdec.c in Sources */, - 830F0CD217FC7F1E00042E8F /* dct32_float.c in Sources */, - 830F0D3217FC841B00042E8F /* intfloat_readwrite.c in Sources */, - 838490C21807C37300E7332D /* atrac.c in Sources */, - 830F0DC917FC931700042E8F /* pcm.c in Sources */, - 830F0CD317FC7F1E00042E8F /* dct32.c in Sources */, - 830F0D2517FC82AB00042E8F /* frame.c in Sources */, - 830F0D2117FC82AB00042E8F /* eval.c in Sources */, - 830F0C2317FC527400042E8F /* atomic.c in Sources */, - 830F0D4D17FC862400042E8F /* time.c in Sources */, - 838490661807AF0100E7332D /* ac3tab.c in Sources */, - 830F0C0817FC4FB900042E8F /* mem.c in Sources */, - 830F0CDE17FC7F1E00042E8F /* faanidct.c in Sources */, - 833C379B180328B300CBA602 /* tak.c in Sources */, - 830F0CC917FC7F1E00042E8F /* bit_depth_template.c in Sources */, - 832F4BC718CD6052003E940E /* dcadsp_init.c in Sources */, - 8384906C1807AFB800E7332D /* aac_ac3_parser.c in Sources */, - 8393B7E318052BB000913C76 /* mpeg.c in Sources */, - 838491111807CEF400E7332D /* sbrdsp_init.c in Sources */, - 830F0D4017FC848D00042E8F /* sha.c in Sources */, - 833E5FA218A31EC4006A85F9 /* twinvq.c in Sources */, - 838490EF1807C57B00E7332D /* aac_adtstoasc_bsf.c in Sources */, - 830F0BF417FC4FB900042E8F /* aviobuf.c in Sources */, - 830F0C1117FC4FF400042E8F /* avfft.c in Sources */, - 830F0DC617FC92FA00042E8F /* wavdec.c in Sources */, - 838490DE1807C47E00E7332D /* g722.c in Sources */, - 838490F91807C57B00E7332D /* aacpsdsp.c in Sources */, - 830F0BDA17FC4FB900042E8F /* mathtables.c in Sources */, - 830F0C5917FC7CC300042E8F /* utils.c in Sources */, - 838490641807AF0100E7332D /* ac3dsp.c in Sources */, - 830F0CDC17FC7F1E00042E8F /* faandct.c in Sources */, - 830F0CE017FC7F1E00042E8F /* fmtconvert.c in Sources */, - 830F0C6F17FC7DB100042E8F /* pixdesc.c in Sources */, - 833E5F9C18A31EB7006A85F9 /* vqf.c in Sources */, - 830F0C2917FC54F800042E8F /* asfdec.c in Sources */, - 830F0C3B17FC554D00042E8F /* float_dsp.c in Sources */, - 830F0BF817FC4FB900042E8F /* os_support.c in Sources */, - 830F0C5817FC7CC300042E8F /* id3v2.c in Sources */, - 830F0D7117FC8C1300042E8F /* ast.c in Sources */, - 830F0D3017FC841B00042E8F /* imgutils.c in Sources */, - 830F0DD117FC934D00042E8F /* spdif.c in Sources */, - 830F0C8217FC7ED100042E8F /* dict.c in Sources */, - 830F0D7817FC8C7300042E8F /* mpeg4audio.c in Sources */, - 830F0D5F17FC89BD00042E8F /* options.c in Sources */, - 8393B7FE18052BC200913C76 /* mpegaudiodata.c in Sources */, - 833C37D318032E4800CBA602 /* dsputil_init.c in Sources */, - 832F4BA618CD4F47003E940E /* lls2.c in Sources */, - 830F0DB917FC921D00042E8F /* cpu.c in Sources */, - 830F0C7D17FC7E4E00042E8F /* mathematics.c in Sources */, - 830F0BDD17FC4FB900042E8F /* parser.c in Sources */, - 830F0C5C17FC7CEA00042E8F /* id3v1.c in Sources */, - 8393B7F918052BC200913C76 /* mpegaudio_parser.c in Sources */, - 832F4BBA18CD53E9003E940E /* ttadsp.c in Sources */, - 830F0CFC17FC7F1E00042E8F /* videodsp.c in Sources */, - 830F0D8C17FC8E8B00042E8F /* dv_profile.c in Sources */, - 833C37B118032AEF00CBA602 /* diracdsp.c in Sources */, - 838490A71807C12300E7332D /* pcm.c in Sources */, - 838490691807AF5800E7332D /* ac3dec.c in Sources */, - 830F0CD017FC7F1E00042E8F /* dct.c in Sources */, - 833C3795180328A300CBA602 /* takdec.c in Sources */, - 830F0DC217FC929E00042E8F /* mux.c in Sources */, - 830F0BF517FC4FB900042E8F /* cutils.c in Sources */, - 8393B81618052E9900913C76 /* mpegaudiodsp_fixed.c in Sources */, - 8384904D1807898200E7332D /* apedec.c in Sources */, - 830F0D2E17FC841B00042E8F /* channel_layout.c in Sources */, - 830F0CE517FC7F1E00042E8F /* h264chroma.c in Sources */, - 832F4BB318CD4F6B003E940E /* atrac3plusdsp.c in Sources */, - 830F0BE717FC4FB900042E8F /* wmadec.c in Sources */, - 832F4BC018CD5DD9003E940E /* downmix_info.c in Sources */, - 838490931807BC9400E7332D /* dcadsp.c in Sources */, - 838490FF1807C58500E7332D /* aacdec.c in Sources */, - 830F0CC617FC7F1E00042E8F /* acelp_vectors.c in Sources */, - 830F0DC417FC92EE00042E8F /* videodsp_init.c in Sources */, - 833C379A180328B300CBA602 /* tak_parser.c in Sources */, - 830F0C2E17FC551F00042E8F /* asfcrypt.c in Sources */, - 838490B51807C1C300E7332D /* gsmdec.c in Sources */, - 830F0D6C17FC8C0700042E8F /* aactab.c in Sources */, - 830F0D9217FC8EAC00042E8F /* dvdata.c in Sources */, - 833C37D018032D4800CBA602 /* dirac_dwt.c in Sources */, - 830F0BF617FC4FB900042E8F /* file.c in Sources */, - 830F0D3817FC844E00042E8F /* parseutils.c in Sources */, - 830F0D2017FC82AB00042E8F /* cpu.c in Sources */, - 8393B7FC18052BC200913C76 /* mpegaudio.c in Sources */, - 832F4BB018CD4F6B003E940E /* atrac3plus.c in Sources */, - 838490D81807C47E00E7332D /* g729postfilter.c in Sources */, - 833C37C618032CF600CBA602 /* dirac_parser.c in Sources */, - 830F0CED17FC7F1E00042E8F /* mpeg12data.c in Sources */, - 838490811807B17500E7332D /* eac3dec.c in Sources */, - 833C37C718032CF600CBA602 /* dirac.c in Sources */, - 830F0D7E17FC8E4800042E8F /* dv.c in Sources */, - 830F0C7B17FC7E4E00042E8F /* crc.c in Sources */, - 830F0BE817FC4FB900042E8F /* wmalosslessdec.c in Sources */, - 838490621807AF0100E7332D /* ac3dec.c in Sources */, - 83BCB8E317FCA64400760340 /* timecode.c in Sources */, - 8384910D1807CEB600E7332D /* sbrdsp.c in Sources */, - 8384911A1807D1D900E7332D /* ttadata.c in Sources */, - 838490B91807C1C300E7332D /* truespeech.c in Sources */, - 830F0D3517FC841B00042E8F /* samplefmt.c in Sources */, - 830F0BEA17FC4FB900042E8F /* wmaprodec.c in Sources */, - 830F0CCD17FC7F1E00042E8F /* celp_math.c in Sources */, - 830F0DC017FC927D00042E8F /* float_dsp_init.c in Sources */, - 830F0C8317FC7ED100042E8F /* rational.c in Sources */, - 830F0CD517FC7F1E00042E8F /* dctref.c in Sources */, - 8393B81118052DB700913C76 /* bitstream_filter.c in Sources */, - 833E5FA418A31EC4006A85F9 /* twinvqdec.c in Sources */, - 838490F11807C57B00E7332D /* aacadtsdec.c in Sources */, - 830F0D2317FC82AB00042E8F /* fifo.c in Sources */, - 830F0D3C17FC846C00042E8F /* random_seed.c in Sources */, - 830F0C4F17FC7CA300042E8F /* riff.c in Sources */, - 838490F41807C57B00E7332D /* aacdec.c in Sources */, - 830F0C4D17FC7CA300042E8F /* metadata.c in Sources */, - 8393B80018052BC200913C76 /* mpegaudiodec_float.c in Sources */, - 838491021807CDC000E7332D /* lpc.c in Sources */, - 830F0C7C17FC7E4E00042E8F /* log.c in Sources */, - 830F0D6417FC8A3300042E8F /* audiointerleave.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 089C1667FE841158C02AAC07 /* English */, - 833F68321CDBCAB100AFB9F0 /* es */, - ); - name = InfoPlist.strings; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91AE08733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_FIX_AND_CONTINUE = YES; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = FFMPEG_Prefix.pch; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "ffmpeg-minimal", - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = org.cogx.lib.ffmpeg; - PRODUCT_NAME = FFMPEG; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SYMROOT = ../../build; - WRAPPER_EXTENSION = framework; - ZERO_LINK = YES; - }; - name = Debug; - }; - 1DEB91AF08733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = FFMPEG_Prefix.pch; - HEADER_SEARCH_PATHS = ( - "$(inherited)", - "ffmpeg-minimal", - ); - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@loader_path/../Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = org.cogx.lib.ffmpeg; - PRODUCT_NAME = FFMPEG; - SDKROOT = macosx; - SKIP_INSTALL = YES; - SYMROOT = ../../build; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 1DEB91B208733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ENABLE_TESTABILITY = YES; - GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - PREBINDING = NO; - SDKROOT = macosx; - }; - name = Debug; - }; - 1DEB91B308733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CODE_SIGN_IDENTITY = "Developer ID Application"; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; - PREBINDING = NO; - SDKROOT = macosx; - SYMROOT = ../../build; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "FFMPEG Framework" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91AE08733DA50010E9CD /* Debug */, - 1DEB91AF08733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "FFMPEG" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91B208733DA50010E9CD /* Debug */, - 1DEB91B308733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 84052ae12..000000000 --- a/Frameworks/FFMPEG/FFMPEG.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/Frameworks/FFMPEG/FFMPEG_Prefix.pch b/Frameworks/FFMPEG/FFMPEG_Prefix.pch deleted file mode 100644 index 45e581823..000000000 --- a/Frameworks/FFMPEG/FFMPEG_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'FFMPEG' target in the 'FFMPEG' project. -// - -#ifdef __OBJC__ - #import -#endif diff --git a/Frameworks/FFMPEG/Info.plist b/Frameworks/FFMPEG/Info.plist deleted file mode 100644 index 5c18bd9f9..000000000 --- a/Frameworks/FFMPEG/Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleSignature - ???? - CFBundleVersion - 1.0 - NSPrincipalClass - - - diff --git a/Frameworks/FFMPEG/es.lproj/InfoPlist.strings b/Frameworks/FFMPEG/es.lproj/InfoPlist.strings deleted file mode 100644 index 2fe6c8f6d..000000000 Binary files a/Frameworks/FFMPEG/es.lproj/InfoPlist.strings and /dev/null differ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/COPYING b/Frameworks/FFMPEG/ffmpeg-minimal/COPYING deleted file mode 100644 index 223ede7de..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/COPYING +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/CREDITS b/Frameworks/FFMPEG/ffmpeg-minimal/CREDITS deleted file mode 100644 index d5a50df7a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/CREDITS +++ /dev/null @@ -1,24 +0,0 @@ -This file contains the name of the people who have contributed to -ffmpeg. The names are sorted alphabetically. - -Fabrice Bellard -BERO -Mario Brito -Alex Beregszaszi -Tim Ferguson -Brian Foley -Arpad Gereoffy -Philip Gladstone -Vladimir Gneushev -Falk Hueffner -Zdenek Kabelac -Robin Kay -Nick Kurshev -Mike Melanson -Michael Niedermayer -François Revol -Dieter Shirley -Juan J. Sierralta -Ewald Snel -Roberto Togni -Lionel Ulmer diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/compat/va_copy.h b/Frameworks/FFMPEG/ffmpeg-minimal/compat/va_copy.h deleted file mode 100644 index f89477194..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/compat/va_copy.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * MSVC Compatible va_copy macro - * Copyright (c) 2012 Derek Buitenhuis - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#if !defined(va_copy) && defined(_MSC_VER) -#define va_copy(dst, src) ((dst) = (src)) -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/config.h b/Frameworks/FFMPEG/ffmpeg-minimal/config.h deleted file mode 100644 index fc40dfbbc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/config.h +++ /dev/null @@ -1,1113 +0,0 @@ -/* Automatically generated by configure - do not modify */ -#ifndef _FFMPEG_CONFIG_H_ -#define _FFMPEG_CONFIG_H_ - -#define ARCH_X86 1 -#define ARCH_ARM 0 -#define ARCH_PPC 0 -#define ARCH_AARCH64 0 -#define ARCH_ALPHA 0 -#define ARCH_BFIN 0 -#define ARCH_SH4 0 -#define ARCH_MIPS 0 - -#define HAVE_BIGENDIAN 0 -#define HAVE_FAST_UNALIGNED 1 - -#define HAVE_VIS 0 - -#define TUNECPU generic -#define HAVE_MMX 0 -#define HAVE_MMX_INLINE 0 -#define HAVE_SSE 0 -#define HAVE_SSE2 0 -#define HAVE_SSSE3_EXTERNAL 0 -#define HAVE_SSE4_EXTERNAL 0 -#define emms_c() -#define HAVE_MMX_EXTERNAL 0 -#define HAVE_MMX2 0 -#define HAVE_MMXEXT 0 -#define HAVE_MMXEXT_EXTERNAL 0 -#define HAVE_AMD3DNOW_EXTERNAL 0 -#define HAVE_SSE2_EXTERNAL 0 -#define HAVE_SSE_EXTERNAL 0 -#define HAVE_AVX_EXTERNAL 0 -#define HAVE_YASM 0 -#define HAVE_MIPSFPU 0 -#define HAVE_MIPSDSPR1 0 -#define __CPU__ 586 -#define HAVE_BUILTIN_VECTOR 1 -#define HAVE_LOCALTIME_R 1 -#define HAVE_LRINTF 1 -#undef HAVE_VHOOK -#define CONFIG_ENCODERS 0 -#define CONFIG_DECODERS 1 -#define CONFIG_MPEGAUDIO_HP 0 -#undef CONFIG_VIDEO4LINUX -#undef CONFIG_DV1394 -#define CONFIG_HAVE_DLOPEN 1 -#define CONFIG_HAVE_DLFCN 1 -#undef CONFIG_AUDIO_OSS -#undef CONFIG_NETWORK -#define CONFIG_ZLIB 1 -#define HAVE_MALLOC_H 0 -#define HAVE_MEMALIGN 0 -#define HAVE_CBRT 1 -#define HAVE_CBRTF 1 -#define HAVE_ISINF 1 -#define HAVE_ISNAN 1 -#define HAVE_RINT 1 -#define HAVE_LRINT 1 -#define HAVE_ROUND 1 -#define HAVE_ROUNDF 1 -#define HAVE_TRUNC 1 -#define HAVE_TRUNCF 1 -#define HAVE_THREADS 0 -#define HAVE_PTHREADS 1 -#define HAVE_ATOMICS_GCC 1 -#define HAVE_ATOMICS_NATIVE 1 -#define HAVE_PRAGMA_DEPRECATED 1 -#define HAVE_UNISTD_H 1 -#define CONFIG_FRAME_THREAD_ENCODER 0 -#define SIMPLE_IDCT 1 -#define CONFIG_MEMORY_POISONING 0 -#define FF_MEMORY_POISON 0x2a -#define CONFIG_MDCT 1 -#define CONFIG_DSPUTIL 1 -#define FFMPEG_CONFIGURATION "Xcode mess lol" -#define FFMPEG_LICENSE "LGPL" -#undef CONFIG_FFSERVER -#define CONFIG_RISKY 1 -#define CONFIG_FTRAPV 0 -#define CONFIG_SMALL 0 -#define CONFIG_XVMC 0 - -#define NULL_IF_CONFIG_SMALL(a) a - -#define CONFIG_H263_VAAPI_HWACCEL 0 -#define CONFIG_H263_VDPAU_HWACCEL 0 -#define CONFIG_H264_DXVA2_HWACCEL 0 -#define CONFIG_H264_VAAPI_HWACCEL 0 -#define CONFIG_H264_VDA_HWACCEL 0 -#define CONFIG_H264_VDPAU_HWACCEL 0 -#define CONFIG_MPEG1_XVMC_HWACCEL 0 -#define CONFIG_MPEG1_VDPAU_HWACCEL 0 -#define CONFIG_MPEG2_XVMC_HWACCEL 0 -#define CONFIG_MPEG2_DXVA2_HWACCEL 0 -#define CONFIG_MPEG2_VAAPI_HWACCEL 0 -#define CONFIG_MPEG2_VDPAU_HWACCEL 0 -#define CONFIG_MPEG4_VAAPI_HWACCEL 0 -#define CONFIG_MPEG4_VDPAU_HWACCEL 0 -#define CONFIG_VC1_DXVA2_HWACCEL 0 -#define CONFIG_VC1_VAAPI_HWACCEL 0 -#define CONFIG_VC1_VDPAU_HWACCEL 0 -#define CONFIG_WMV3_DXVA2_HWACCEL 0 -#define CONFIG_WMV3_VAAPI_HWACCEL 0 -#define CONFIG_WMV3_VDPAU_HWACCEL 0 - -#define CONFIG_A64MULTI_ENCODER 0 -#define CONFIG_A64MULTI5_ENCODER 0 -#define CONFIG_AASC_DECODER 0 -#define CONFIG_AIC_DECODER 0 -#define CONFIG_AMV_DECODER 0 -#define CONFIG_AMV_ENCODER 0 -#define CONFIG_ANM_DECODER 0 -#define CONFIG_ANSI_DECODER 0 -#define CONFIG_ASV1_ENCODER 0 -#define CONFIG_ASV1_DECODER 0 -#define CONFIG_ASV2_ENCODER 0 -#define CONFIG_ASV2_DECODER 0 -#define CONFIG_AURA_DECODER 0 -#define CONFIG_AURA2_DECODER 0 -#define CONFIG_AVRP_ENCODER 0 -#define CONFIG_AVRP_DECODER 0 -#define CONFIG_AVRN_DECODER 0 -#define CONFIG_AVS_DECODER 0 -#define CONFIG_AVUI_ENCODER 0 -#define CONFIG_AVUI_DECODER 0 -#define CONFIG_AYUV_ENCODER 0 -#define CONFIG_AYUV_DECODER 0 -#define CONFIG_BETHSOFTVID_DECODER 0 -#define CONFIG_BFI_DECODER 0 -#define CONFIG_BINK_DECODER 0 -#define CONFIG_BMP_ENCODER 0 -#define CONFIG_BMP_DECODER 0 -#define CONFIG_BMV_VIDEO_DECODER 0 -#define CONFIG_BRENDER_PIX_DECODER 0 -#define CONFIG_C93_DECODER 0 -#define CONFIG_CAVS_DECODER 0 -#define CONFIG_CDGRAPHICS_DECODER 0 -#define CONFIG_CDXL_DECODER 0 -#define CONFIG_CINEPAK_ENCODER 0 -#define CONFIG_CINEPAK_DECODER 0 -#define CONFIG_CLJR_ENCODER 0 -#define CONFIG_CLJR_DECODER 0 -#define CONFIG_CLLC_DECODER 0 -#define CONFIG_COMFORTNOISE_ENCODER 0 -#define CONFIG_COMFORTNOISE_DECODER 0 -#define CONFIG_CPIA_DECODER 0 -#define CONFIG_CSCD_DECODER 0 -#define CONFIG_CYUV_DECODER 0 -#define CONFIG_DFA_DECODER 0 -#define CONFIG_DIRAC_DECODER 1 -#define CONFIG_DNXHD_ENCODER 0 -#define CONFIG_DNXHD_DECODER 0 -#define CONFIG_DPX_ENCODER 0 -#define CONFIG_DPX_DECODER 0 -#define CONFIG_DSICINVIDEO_DECODER 0 -#define CONFIG_DVVIDEO_ENCODER 0 -#define CONFIG_DVVIDEO_DECODER 0 -#define CONFIG_DXTORY_DECODER 0 -#define CONFIG_EACMV_DECODER 0 -#define CONFIG_EAMAD_DECODER 0 -#define CONFIG_EATGQ_DECODER 0 -#define CONFIG_EATGV_DECODER 0 -#define CONFIG_DXA_DECODER 0 -#define CONFIG_EATQI_DECODER 0 -#define CONFIG_EIGHTBPS_DECODER 0 -#define CONFIG_EIGHTSVX_EXP_DECODER 0 -#define CONFIG_EIGHTSVX_FIB_DECODER 0 -#define CONFIG_ESCAPE124_DECODER 0 -#define CONFIG_ESCAPE130_DECODER 0 -#define CONFIG_EXR_DECODER 0 -#define CONFIG_FFV1_ENCODER 0 -#define CONFIG_FFV1_DECODER 0 -#define CONFIG_FFVHUFF_ENCODER 0 -#define CONFIG_FFVHUFF_DECODER 0 -#define CONFIG_FIC_DECODER 0 -#define CONFIG_FLASHSV_ENCODER 0 -#define CONFIG_FLASHSV_DECODER 0 -#define CONFIG_FLASHSV2_ENCODER 0 -#define CONFIG_FLASHSV2_DECODER 0 -#define CONFIG_FLIC_DECODER 0 -#define CONFIG_FLV_ENCODER 0 -#define CONFIG_FLV_DECODER 0 -#define CONFIG_FOURXM_DECODER 0 -#define CONFIG_FRAPS_DECODER 0 -#define CONFIG_FRWU_DECODER 0 -#define CONFIG_G2M_DECODER 0 -#define CONFIG_GIF_ENCODER 0 -#define CONFIG_GIF_DECODER 0 -#define CONFIG_H261_ENCODER 0 -#define CONFIG_H261_DECODER 0 -#define CONFIG_H263_ENCODER 0 -#define CONFIG_H263_DECODER 0 -#define CONFIG_H263I_DECODER 0 -#define CONFIG_H263P_ENCODER 0 -#define CONFIG_H263P_DECODER 0 -#define CONFIG_H264_DECODER 0 -#define CONFIG_H264_CRYSTALHD_DECODER 0 -#define CONFIG_H264_VDA_DECODER 0 -#define CONFIG_H264_VDPAU_DECODER 0 -#define CONFIG_HEVC_DECODER 0 -#define CONFIG_HNM4_VIDEO_DECODER 0 -#define CONFIG_HUFFYUV_ENCODER 0 -#define CONFIG_HUFFYUV_DECODER 0 -#define CONFIG_IDCIN_DECODER 0 -#define CONFIG_IFF_BYTERUN1_DECODER 0 -#define CONFIG_IFF_ILBM_DECODER 0 -#define CONFIG_INDEO2_DECODER 0 -#define CONFIG_INDEO3_DECODER 0 -#define CONFIG_INDEO4_DECODER 0 -#define CONFIG_INDEO5_DECODER 0 -#define CONFIG_INTERPLAY_VIDEO_DECODER 0 -#define CONFIG_JPEG2000_ENCODER 0 -#define CONFIG_JPEG2000_DECODER 0 -#define CONFIG_JPEGLS_ENCODER 0 -#define CONFIG_JPEGLS_DECODER 0 -#define CONFIG_JV_DECODER 0 -#define CONFIG_KGV1_DECODER 0 -#define CONFIG_KMVC_DECODER 0 -#define CONFIG_LAGARITH_DECODER 0 -#define CONFIG_LJPEG_ENCODER 0 -#define CONFIG_LOCO_DECODER 0 -#define CONFIG_MDEC_DECODER 0 -#define CONFIG_MIMIC_DECODER 0 -#define CONFIG_MJPEG_ENCODER 0 -#define CONFIG_MJPEG_DECODER 0 -#define CONFIG_MJPEGB_DECODER 0 -#define CONFIG_MMVIDEO_DECODER 0 -#define CONFIG_MOTIONPIXELS_DECODER 0 -#define CONFIG_MPEG_XVMC_DECODER 0 -#define CONFIG_MPEG1VIDEO_ENCODER 0 -#define CONFIG_MPEG1VIDEO_DECODER 0 -#define CONFIG_MPEG2VIDEO_ENCODER 0 -#define CONFIG_MPEG2VIDEO_DECODER 0 -#define CONFIG_MPEG4_ENCODER 0 -#define CONFIG_MPEG4_DECODER 0 -#define CONFIG_MPEG4_CRYSTALHD_DECODER 0 -#define CONFIG_MPEG4_VDPAU_DECODER 0 -#define CONFIG_MPEGVIDEO_DECODER 0 -#define CONFIG_MPEG_VDPAU_DECODER 0 -#define CONFIG_MPEG1_VDPAU_DECODER 0 -#define CONFIG_MPEG2_CRYSTALHD_DECODER 0 -#define CONFIG_MSA1_DECODER 0 -#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0 -#define CONFIG_MSMPEG4V1_DECODER 0 -#define CONFIG_MSMPEG4V2_ENCODER 0 -#define CONFIG_MSMPEG4V2_DECODER 0 -#define CONFIG_MSMPEG4V3_ENCODER 0 -#define CONFIG_MSMPEG4V3_DECODER 0 -#define CONFIG_MSRLE_DECODER 0 -#define CONFIG_MSS1_DECODER 0 -#define CONFIG_MSS2_DECODER 0 -#define CONFIG_MSVIDEO1_ENCODER 0 -#define CONFIG_MSVIDEO1_DECODER 0 -#define CONFIG_MSZH_DECODER 0 -#define CONFIG_MTS2_DECODER 0 -#define CONFIG_MVC1_DECODER 0 -#define CONFIG_MVC2_DECODER 0 -#define CONFIG_MXPEG_DECODER 0 -#define CONFIG_NUV_DECODER 0 -#define CONFIG_PAF_VIDEO_DECODER 0 -#define CONFIG_PAM_ENCODER 0 -#define CONFIG_PAM_DECODER 0 -#define CONFIG_PBM_ENCODER 0 -#define CONFIG_PBM_DECODER 0 -#define CONFIG_PCX_ENCODER 0 -#define CONFIG_PCX_DECODER 0 -#define CONFIG_PGM_ENCODER 0 -#define CONFIG_PGM_DECODER 0 -#define CONFIG_PGMYUV_ENCODER 0 -#define CONFIG_PGMYUV_DECODER 0 -#define CONFIG_PICTOR_DECODER 0 -#define CONFIG_PNG_ENCODER 0 -#define CONFIG_PNG_DECODER 0 -#define CONFIG_PPM_ENCODER 0 -#define CONFIG_PPM_DECODER 0 -#define CONFIG_PRORES_ENCODER 0 -#define CONFIG_PRORES_DECODER 0 -#define CONFIG_PRORES_AW_ENCODER 0 -#define CONFIG_PRORES_KS_ENCODER 0 -#define CONFIG_PRORES_LGPL_DECODER 0 -#define CONFIG_PTX_DECODER 0 -#define CONFIG_QDRAW_DECODER 0 -#define CONFIG_QPEG_DECODER 0 -#define CONFIG_QTRLE_ENCODER 0 -#define CONFIG_QTRLE_DECODER 0 -#define CONFIG_R10K_ENCODER 0 -#define CONFIG_R10K_DECODER 0 -#define CONFIG_R210_ENCODER 0 -#define CONFIG_R210_DECODER 0 -#define CONFIG_RAWVIDEO_ENCODER 0 -#define CONFIG_RAWVIDEO_DECODER 0 -#define CONFIG_RL2_DECODER 0 -#define CONFIG_ROQ_ENCODER 0 -#define CONFIG_ROQ_DECODER 0 -#define CONFIG_RPZA_DECODER 0 -#define CONFIG_RV10_ENCODER 0 -#define CONFIG_RV10_DECODER 0 -#define CONFIG_RV20_ENCODER 0 -#define CONFIG_RV20_DECODER 0 -#define CONFIG_RV30_DECODER 0 -#define CONFIG_RV40_DECODER 0 -#define CONFIG_S302M_ENCODER 0 -#define CONFIG_S302M_DECODER 0 -#define CONFIG_SANM_DECODER 0 -#define CONFIG_SGI_ENCODER 0 -#define CONFIG_SGI_DECODER 0 -#define CONFIG_SGIRLE_DECODER 0 -#define CONFIG_SMACKER_DECODER 0 -#define CONFIG_SMC_DECODER 0 -#define CONFIG_SMVJPEG_DECODER 0 -#define CONFIG_SNOW_ENCODER 0 -#define CONFIG_SNOW_DECODER 0 -#define CONFIG_SP5X_DECODER 0 -#define CONFIG_SUNRAST_ENCODER 0 -#define CONFIG_SUNRAST_DECODER 0 -#define CONFIG_SVQ1_ENCODER 0 -#define CONFIG_SVQ1_DECODER 0 -#define CONFIG_SVQ3_DECODER 0 -#define CONFIG_TARGA_ENCODER 0 -#define CONFIG_TARGA_DECODER 0 -#define CONFIG_TARGA_Y216_DECODER 0 -#define CONFIG_THEORA_DECODER 0 -#define CONFIG_THP_DECODER 0 -#define CONFIG_TIERTEXSEQVIDEO_DECODER 0 -#define CONFIG_TIFF_ENCODER 0 -#define CONFIG_TIFF_DECODER 0 -#define CONFIG_TMV_DECODER 0 -#define CONFIG_TRUEMOTION1_DECODER 0 -#define CONFIG_TRUEMOTION2_DECODER 0 -#define CONFIG_TSCC_DECODER 0 -#define CONFIG_TSCC2_DECODER 0 -#define CONFIG_TXD_DECODER 0 -#define CONFIG_ULTI_DECODER 0 -#define CONFIG_UTVIDEO_ENCODER 0 -#define CONFIG_UTVIDEO_DECODER 0 -#define CONFIG_V210_ENCODER 0 -#define CONFIG_V210_DECODER 0 -#define CONFIG_V210X_DECODER 0 -#define CONFIG_V308_ENCODER 0 -#define CONFIG_V308_DECODER 0 -#define CONFIG_V408_ENCODER 0 -#define CONFIG_V408_DECODER 0 -#define CONFIG_V410_ENCODER 0 -#define CONFIG_V410_DECODER 0 -#define CONFIG_VB_DECODER 0 -#define CONFIG_VBLE_DECODER 0 -#define CONFIG_VC1_DECODER 0 -#define CONFIG_VC1_CRYSTALHD_DECODER 0 -#define CONFIG_VC1_VDPAU_DECODER 0 -#define CONFIG_VC1IMAGE_DECODER 0 -#define CONFIG_VCR1_DECODER 0 -#define CONFIG_VMDVIDEO_DECODER 0 -#define CONFIG_VMNC_DECODER 0 -#define CONFIG_VP3_DECODER 0 -#define CONFIG_VP5_DECODER 0 -#define CONFIG_VP6_DECODER 0 -#define CONFIG_VP6A_DECODER 0 -#define CONFIG_VP6F_DECODER 0 -#define CONFIG_VP8_DECODER 0 -#define CONFIG_VQA_DECODER 0 -#define CONFIG_WEBP_DECODER 0 -#define CONFIG_WMV1_ENCODER 0 -#define CONFIG_WMV1_DECODER 0 -#define CONFIG_WMV2_ENCODER 0 -#define CONFIG_WMV2_DECODER 0 -#define CONFIG_WMV3_DECODER 0 -#define CONFIG_WMV3_CRYSTALHD_DECODER 0 -#define CONFIG_WMV3_VDPAU_DECODER 0 -#define CONFIG_WMV3IMAGE_DECODER 0 -#define CONFIG_WNV1_DECODER 0 -#define CONFIG_XAN_WC3_DECODER 0 -#define CONFIG_XAN_WC4_DECODER 0 -#define CONFIG_XBM_ENCODER 0 -#define CONFIG_XBM_DECODER 0 -#define CONFIG_XFACE_ENCODER 0 -#define CONFIG_XFACE_DECODER 0 -#define CONFIG_XL_DECODER 0 -#define CONFIG_XWD_ENCODER 0 -#define CONFIG_XWD_DECODER 0 -#define CONFIG_Y41P_ENCODER 0 -#define CONFIG_Y41P_DECODER 0 -#define CONFIG_YOP_DECODER 0 -#define CONFIG_YUV4_ENCODER 0 -#define CONFIG_YUV4_DECODER 0 -#define CONFIG_ZERO12V_DECODER 0 -#define CONFIG_ZEROCODEC_DECODER 0 -#define CONFIG_ZLIB_ENCODER 0 -#define CONFIG_ZLIB_DECODER 0 -#define CONFIG_ZMBV_ENCODER 0 -#define CONFIG_ZMBV_DECODER 0 - -#define CONFIG_AAC_ENCODER 0 -#define CONFIG_AAC_DECODER 1 -#define CONFIG_AAC_LATM_DECODER 0 -#define CONFIG_AC3_ENCODER 0 -#define CONFIG_AC3_DECODER 1 -#define CONFIG_AC3_FIXED_ENCODER 0 -#define CONFIG_ALAC_ENCODER 0 -#define CONFIG_ALAC_DECODER 0 -#define CONFIG_ALS_DECODER 0 -#define CONFIG_AMRNB_DECODER 1 -#define CONFIG_AMRWB_DECODER 1 -#define CONFIG_APE_DECODER 1 -#define CONFIG_ATRAC1_DECODER 0 -#define CONFIG_ATRAC3_DECODER 1 -#define CONFIG_ATRAC3P_DECODER 1 -#define CONFIG_BINKAUDIO_DCT_DECODER 0 -#define CONFIG_BINKAUDIO_RDFT_DECODER 0 -#define CONFIG_BMV_AUDIO_DECODER 0 -#define CONFIG_COOK_DECODER 0 -#define CONFIG_DCA_ENCODER 0 -#define CONFIG_DCA_DECODER 1 -#define CONFIG_DSICINAUDIO_DECODER 0 -#define CONFIG_EAC3_ENCODER 0 -#define CONFIG_EAC3_DECODER 1 -#define CONFIG_EVRC_DECODER 0 -#define CONFIG_FFWAVESYNTH_DECODER 0 -#define CONFIG_FLAC_ENCODER 0 -#define CONFIG_FLAC_DECODER 0 -#define CONFIG_G723_1_ENCODER 0 -#define CONFIG_G723_1_DECODER 1 -#define CONFIG_G729_DECODER 1 -#define CONFIG_GSM_DECODER 1 -#define CONFIG_GSM_MS_DECODER 1 -#define CONFIG_IAC_DECODER 0 -#define CONFIG_IMC_DECODER 0 -#define CONFIG_MACE3_DECODER 0 -#define CONFIG_MACE6_DECODER 0 -#define CONFIG_METASOUND_DECODER 0 -#define CONFIG_MLP_DECODER 0 -#define CONFIG_MP1_DECODER 0 -#define CONFIG_MP1FLOAT_DECODER 1 -#define CONFIG_MP2_ENCODER 0 -#define CONFIG_MP2_DECODER 0 -#define CONFIG_MP2FLOAT_DECODER 1 -#define CONFIG_MP2FIXED_ENCODER 0 -#define CONFIG_MP3_DECODER 0 -#define CONFIG_MP3FLOAT_DECODER 1 -#define CONFIG_MP3ADU_DECODER 0 -#define CONFIG_MP3ADUFLOAT_DECODER 0 -#define CONFIG_MP3ON4_DECODER 0 -#define CONFIG_MP3ON4FLOAT_DECODER 0 -#define CONFIG_MPC7_DECODER 0 -#define CONFIG_MPC8_DECODER 0 -#define CONFIG_NELLYMOSER_ENCODER 0 -#define CONFIG_NELLYMOSER_DECODER 0 -#define CONFIG_PAF_AUDIO_DECODER 0 -#define CONFIG_QCELP_DECODER 0 -#define CONFIG_QDM2_DECODER 0 -#define CONFIG_RA_144_ENCODER 0 -#define CONFIG_RA_144_DECODER 0 -#define CONFIG_RA_288_DECODER 0 -#define CONFIG_RALF_DECODER 0 -#define CONFIG_SHORTEN_DECODER 0 -#define CONFIG_SIPR_DECODER 0 -#define CONFIG_SMACKAUD_DECODER 0 -#define CONFIG_SONIC_ENCODER 0 -#define CONFIG_SONIC_DECODER 0 -#define CONFIG_SONIC_LS_ENCODER 0 -#define CONFIG_SONIC_LS_DECODER 0 -#define CONFIG_TAK_DECODER 1 -#define CONFIG_TRUEHD_DECODER 0 -#define CONFIG_TRUESPEECH_DECODER 0 -#define CONFIG_TTA_ENCODER 0 -#define CONFIG_TTA_DECODER 1 -#define CONFIG_TWINVQ_DECODER 1 -#define CONFIG_VMDAUDIO_DECODER 0 -#define CONFIG_VORBIS_ENCODER 0 -#define CONFIG_VORBIS_DECODER 0 -#define CONFIG_WAVPACK_ENCODER 0 -#define CONFIG_WAVPACK_DECODER 0 -#define CONFIG_WMALOSSLESS_DECODER 1 -#define CONFIG_WMAPRO_DECODER 1 -#define CONFIG_WMAV1_ENCODER 0 -#define CONFIG_WMAV1_DECODER 1 -#define CONFIG_WMAV2_ENCODER 0 -#define CONFIG_WMAV2_DECODER 1 -#define CONFIG_WMAVOICE_DECODER 1 -#define CONFIG_WS_SND1_DECODER 0 - -#define CONFIG_PCM_ALAW_ENCODER 0 -#define CONFIG_PCM_ALAW_DECODER 1 -#define CONFIG_PCM_BLURAY_DECODER 0 -#define CONFIG_PCM_DVD_DECODER 0 -#define CONFIG_PCM_F32BE_ENCODER 0 -#define CONFIG_PCM_F32BE_DECODER 1 -#define CONFIG_PCM_F32LE_ENCODER 0 -#define CONFIG_PCM_F32LE_DECODER 1 -#define CONFIG_PCM_F64BE_ENCODER 0 -#define CONFIG_PCM_F64BE_DECODER 1 -#define CONFIG_PCM_F64LE_ENCODER 0 -#define CONFIG_PCM_F64LE_DECODER 1 -#define CONFIG_PCM_LXF_DECODER 0 -#define CONFIG_PCM_MULAW_ENCODER 0 -#define CONFIG_PCM_MULAW_DECODER 1 -#define CONFIG_PCM_S8_ENCODER 0 -#define CONFIG_PCM_S8_DECODER 1 -#define CONFIG_PCM_S8_PLANAR_ENCODER 0 -#define CONFIG_PCM_S8_PLANAR_DECODER 1 -#define CONFIG_PCM_S16BE_ENCODER 0 -#define CONFIG_PCM_S16BE_DECODER 1 -#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S16BE_PLANAR_DECODER 1 -#define CONFIG_PCM_S16LE_ENCODER 0 -#define CONFIG_PCM_S16LE_DECODER 1 -#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S16LE_PLANAR_DECODER 1 -#define CONFIG_PCM_S24BE_ENCODER 0 -#define CONFIG_PCM_S24BE_DECODER 1 -#define CONFIG_PCM_S24DAUD_ENCODER 0 -#define CONFIG_PCM_S24DAUD_DECODER 1 -#define CONFIG_PCM_S24LE_ENCODER 0 -#define CONFIG_PCM_S24LE_DECODER 1 -#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S24LE_PLANAR_DECODER 1 -#define CONFIG_PCM_S32BE_ENCODER 0 -#define CONFIG_PCM_S32BE_DECODER 1 -#define CONFIG_PCM_S32LE_ENCODER 0 -#define CONFIG_PCM_S32LE_DECODER 1 -#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0 -#define CONFIG_PCM_S32LE_PLANAR_DECODER 1 -#define CONFIG_PCM_U8_ENCODER 0 -#define CONFIG_PCM_U8_DECODER 1 -#define CONFIG_PCM_U16BE_ENCODER 0 -#define CONFIG_PCM_U16BE_DECODER 1 -#define CONFIG_PCM_U16LE_ENCODER 0 -#define CONFIG_PCM_U16LE_DECODER 1 -#define CONFIG_PCM_U24BE_ENCODER 0 -#define CONFIG_PCM_U24BE_DECODER 1 -#define CONFIG_PCM_U24LE_ENCODER 0 -#define CONFIG_PCM_U24LE_DECODER 1 -#define CONFIG_PCM_U32BE_ENCODER 0 -#define CONFIG_PCM_U32BE_DECODER 1 -#define CONFIG_PCM_U32LE_ENCODER 0 -#define CONFIG_PCM_U32LE_DECODER 1 -#define CONFIG_PCM_ZORK_DECODER 1 - -#define CONFIG_INTERPLAY_DPCM_DECODER 0 -#define CONFIG_ROQ_DPCM_ENCODER 0 -#define CONFIG_ROQ_DPCM_DECODER 0 -#define CONFIG_SOL_DPCM_DECODER 0 -#define CONFIG_XAN_DPCM_DECODER 0 - -#define CONFIG_ADPCM_4XM_DECODER 0 -#define CONFIG_ADPCM_ADX_ENCODER 0 -#define CONFIG_ADPCM_ADX_DECODER 0 -#define CONFIG_ADPCM_AFC_DECODER 0 -#define CONFIG_ADPCM_CT_DECODER 1 -#define CONFIG_ADPCM_DTK_DECODER 0 -#define CONFIG_ADPCM_EA_DECODER 0 -#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0 -#define CONFIG_ADPCM_EA_R1_DECODER 0 -#define CONFIG_ADPCM_EA_R2_DECODER 0 -#define CONFIG_ADPCM_EA_R3_DECODER 0 -#define CONFIG_ADPCM_EA_XAS_DECODER 0 -#define CONFIG_ADPCM_G722_ENCODER 0 -#define CONFIG_ADPCM_G722_DECODER 1 -#define CONFIG_ADPCM_G726_ENCODER 0 -#define CONFIG_ADPCM_G726_DECODER 1 -#define CONFIG_ADPCM_G726LE_DECODER 1 -#define CONFIG_ADPCM_IMA_AMV_DECODER 0 -#define CONFIG_ADPCM_IMA_APC_DECODER 0 -#define CONFIG_ADPCM_IMA_DK3_DECODER 1 -#define CONFIG_ADPCM_IMA_DK4_DECODER 1 -#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0 -#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0 -#define CONFIG_ADPCM_IMA_ISS_DECODER 0 -#define CONFIG_ADPCM_IMA_OKI_DECODER 0 -#define CONFIG_ADPCM_IMA_QT_ENCODER 0 -#define CONFIG_ADPCM_IMA_QT_DECODER 0 -#define CONFIG_ADPCM_IMA_RAD_DECODER 0 -#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0 -#define CONFIG_ADPCM_IMA_WAV_ENCODER 0 -#define CONFIG_ADPCM_IMA_WAV_DECODER 0 -#define CONFIG_ADPCM_IMA_WS_DECODER 0 -#define CONFIG_ADPCM_MS_ENCODER 0 -#define CONFIG_ADPCM_MS_DECODER 0 -#define CONFIG_ADPCM_SBPRO_2_DECODER 0 -#define CONFIG_ADPCM_SBPRO_3_DECODER 0 -#define CONFIG_ADPCM_SBPRO_4_DECODER 0 -#define CONFIG_ADPCM_SWF_ENCODER 0 -#define CONFIG_ADPCM_SWF_DECODER 0 -#define CONFIG_ADPCM_THP_DECODER 0 -#define CONFIG_ADPCM_XA_DECODER 0 -#define CONFIG_ADPCM_YAMAHA_ENCODER 0 -#define CONFIG_ADPCM_YAMAHA_DECODER 0 -#define CONFIG_VIMA_DECODER 0 - -#define CONFIG_SSA_ENCODER 0 -#define CONFIG_SSA_DECODER 0 -#define CONFIG_ASS_ENCODER 0 -#define CONFIG_ASS_DECODER 0 -#define CONFIG_DVBSUB_ENCODER 0 -#define CONFIG_DVBSUB_DECODER 0 -#define CONFIG_DVDSUB_ENCODER 0 -#define CONFIG_DVDSUB_DECODER 0 -#define CONFIG_JACOSUB_DECODER 0 -#define CONFIG_MICRODVD_DECODER 0 -#define CONFIG_MOVTEXT_ENCODER 0 -#define CONFIG_MOVTEXT_DECODER 0 -#define CONFIG_MPL2_DECODER 0 -#define CONFIG_PGSSUB_DECODER 0 -#define CONFIG_PJS_DECODER 0 -#define CONFIG_REALTEXT_DECODER 0 -#define CONFIG_SAMI_DECODER 0 -#define CONFIG_SRT_ENCODER 0 -#define CONFIG_SRT_DECODER 0 -#define CONFIG_SUBRIP_ENCODER 0 -#define CONFIG_SUBRIP_DECODER 0 -#define CONFIG_SUBVIEWER_DECODER 0 -#define CONFIG_SUBVIEWER1_DECODER 0 -#define CONFIG_TEXT_DECODER 0 -#define CONFIG_VPLAYER_DECODER 0 -#define CONFIG_WEBVTT_DECODER 0 -#define CONFIG_XSUB_ENCODER 0 -#define CONFIG_XSUB_DECODER 0 - -#define CONFIG_LIBCELT_DECODER 0 -#define CONFIG_LIBFAAC_ENCODER 0 -#define CONFIG_LIBFDK_AAC_ENCODER 0 -#define CONFIG_LIBFDK_AAC_DECODER 0 -#define CONFIG_LIBGSM_ENCODER 0 -#define CONFIG_LIBGSM_DECODER 0 -#define CONFIG_LIBGSM_MS_ENCODER 0 -#define CONFIG_LIBGSM_MS_DECODER 0 -#define CONFIG_LIBILBC_ENCODER 0 -#define CONFIG_LIBILBC_DECODER 0 -#define CONFIG_LIBMP3LAME_ENCODER 0 -#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0 -#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0 -#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0 -#define CONFIG_LIBOPENJPEG_ENCODER 0 -#define CONFIG_LIBOPENJPEG_DECODER 0 -#define CONFIG_LIBOPUS_ENCODER 0 -#define CONFIG_LIBOPUS_DECODER 0 -#define CONFIG_LIBSCHROEDINGER_ENCODER 0 -#define CONFIG_LIBSCHROEDINGER_DECODER 0 -#define CONFIG_LIBSHINE_ENCODER 0 -#define CONFIG_LIBSPEEX_ENCODER 0 -#define CONFIG_LIBSPEEX_DECODER 0 -#define CONFIG_LIBSTAGEFRIGHT_H264_DECODER 0 -#define CONFIG_LIBTHEORA_ENCODER 0 -#define CONFIG_LIBTWOLAME_ENCODER 0 -#define CONFIG_LIBUTVIDEO_ENCODER 0 -#define CONFIG_LIBUTVIDEO_DECODER 0 -#define CONFIG_LIBVO_AACENC_ENCODER 0 -#define CONFIG_LIBVO_AMRWBENC_ENCODER 0 -#define CONFIG_LIBVORBIS_ENCODER 0 -#define CONFIG_LIBVORBIS_DECODER 0 -#define CONFIG_LIBVPX_VP8_ENCODER 0 -#define CONFIG_LIBVPX_VP8_DECODER 0 -#define CONFIG_LIBVPX_VP9_ENCODER 0 -#define CONFIG_LIBVPX_VP9_DECODER 0 -#define CONFIG_LIBWAVPACK_ENCODER 0 -#define CONFIG_LIBWEBP_ENCODER 0 -#define CONFIG_LIBX264_ENCODER 0 -#define CONFIG_LIBX264RGB_ENCODER 0 -#define CONFIG_LIBX265_ENCODER 0 -#define CONFIG_LIBXAVS_ENCODER 0 -#define CONFIG_LIBXVID_ENCODER 0 -#define CONFIG_LIBZVBI_TELETEXT_DECODER 0 -#define CONFIG_LIBAACPLUS_ENCODER 0 - -#define CONFIG_BINTEXT_DECODER 0 -#define CONFIG_XBIN_DECODER 0 -#define CONFIG_IDF_DECODER 0 - -#define CONFIG_AAC_PARSER 1 -#define CONFIG_AAC_LATM_PARSER 0 -#define CONFIG_AC3_PARSER 1 -#define CONFIG_ADX_PARSER 0 -#define CONFIG_BMP_PARSER 0 -#define CONFIG_CAVSVIDEO_PARSER 0 -#define CONFIG_COOK_PARSER 0 -#define CONFIG_DCA_PARSER 1 -#define CONFIG_DIRAC_PARSER 1 -#define CONFIG_DNXHD_PARSER 0 -#define CONFIG_DVBSUB_PARSER 0 -#define CONFIG_DVDSUB_PARSER 0 -#define CONFIG_DVD_NAV_PARSER 0 -#define CONFIG_FLAC_PARSER 0 -#define CONFIG_GSM_PARSER 0 -#define CONFIG_H261_PARSER 0 -#define CONFIG_H263_PARSER 0 -#define CONFIG_H264_PARSER 0 -#define CONFIG_HEVC_PARSER 0 -#define CONFIG_MJPEG_PARSER 0 -#define CONFIG_MLP_PARSER 0 -#define CONFIG_MPEG4VIDEO_PARSER 0 -#define CONFIG_MPEGAUDIO_PARSER 1 -#define CONFIG_MPEGVIDEO_PARSER 0 -#define CONFIG_PNG_PARSER 0 -#define CONFIG_PNM_PARSER 0 -#define CONFIG_RV30_PARSER 0 -#define CONFIG_RV40_PARSER 0 -#define CONFIG_TAK_PARSER 1 -#define CONFIG_VC1_PARSER 0 -#define CONFIG_VORBIS_PARSER 0 -#define CONFIG_VP3_PARSER 0 -#define CONFIG_VP8_PARSER 0 -#define CONFIG_VP9_PARSER 0 - -#define CONFIG_AAC_ADTSTOASC_BSF 1 -#define CONFIG_CHOMP_BSF 0 -#define CONFIG_DUMP_EXTRADATA_BSF 0 -#define CONFIG_H264_MP4TOANNEXB_BSF 0 -#define CONFIG_IMX_DUMP_HEADER_BSF 0 -#define CONFIG_MJPEG2JPEG_BSF 0 -#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0 -#define CONFIG_MP3_HEADER_COMPRESS_BSF 0 -#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 1 -#define CONFIG_MOV2TEXTSUB_BSF 0 -#define CONFIG_NOISE_BSF 0 -#define CONFIG_REMOVE_EXTRADATA_BSF 0 -#define CONFIG_TEXT2MOVSUB_BSF 0 - - -#define CONFIG_A64_MUXER 0 -#define CONFIG_AAC_DEMUXER 1 -#define CONFIG_AC3_MUXER 0 -#define CONFIG_AC3_DEMUXER 1 -#define CONFIG_ACT_DEMUXER 0 -#define CONFIG_ADF_DEMUXER 0 -#define CONFIG_ADP_DEMUXER 0 -#define CONFIG_ADTS_MUXER 0 -#define CONFIG_ADX_MUXER 0 -#define CONFIG_ADX_DEMUXER 0 -#define CONFIG_AEA_DEMUXER 0 -#define CONFIG_AFC_DEMUXER 0 -#define CONFIG_AIFF_MUXER 0 -#define CONFIG_AIFF_DEMUXER 0 -#define CONFIG_AMR_MUXER 0 -#define CONFIG_AMR_DEMUXER 1 -#define CONFIG_ANM_DEMUXER 0 -#define CONFIG_APC_DEMUXER 0 -#define CONFIG_APE_DEMUXER 1 -#define CONFIG_AQTITLE_DEMUXER 0 -#define CONFIG_ASF_MUXER 0 -#define CONFIG_ASF_DEMUXER 1 -#define CONFIG_ASS_MUXER 0 -#define CONFIG_ASS_DEMUXER 0 -#define CONFIG_AST_MUXER 0 -#define CONFIG_AST_DEMUXER 1 -#define CONFIG_ASF_STREAM_MUXER 0 -#define CONFIG_AU_MUXER 0 -#define CONFIG_AU_DEMUXER 0 -#define CONFIG_AVI_MUXER 0 -#define CONFIG_AVI_DEMUXER 1 -#define CONFIG_AVISYNTH_DEMUXER 0 -#define CONFIG_AVM2_MUXER 0 -#define CONFIG_AVR_DEMUXER 0 -#define CONFIG_AVS_DEMUXER 0 -#define CONFIG_BETHSOFTVID_DEMUXER 0 -#define CONFIG_BFI_DEMUXER 0 -#define CONFIG_BINTEXT_DEMUXER 0 -#define CONFIG_BINK_DEMUXER 0 -#define CONFIG_BIT_MUXER 0 -#define CONFIG_BIT_DEMUXER 0 -#define CONFIG_BMV_DEMUXER 0 -#define CONFIG_BRSTM_DEMUXER 0 -#define CONFIG_BOA_DEMUXER 0 -#define CONFIG_C93_DEMUXER 0 -#define CONFIG_CAF_MUXER 0 -#define CONFIG_CAF_DEMUXER 0 -#define CONFIG_CAVSVIDEO_MUXER 0 -#define CONFIG_CAVSVIDEO_DEMUXER 0 -#define CONFIG_CDG_DEMUXER 0 -#define CONFIG_CDXL_DEMUXER 0 -#define CONFIG_CONCAT_DEMUXER 0 -#define CONFIG_CRC_MUXER 0 -#define CONFIG_DATA_MUXER 0 -#define CONFIG_DATA_DEMUXER 0 -#define CONFIG_DAUD_MUXER 0 -#define CONFIG_DAUD_DEMUXER 0 -#define CONFIG_DFA_DEMUXER 0 -#define CONFIG_DIRAC_MUXER 0 -#define CONFIG_DIRAC_DEMUXER 0 -#define CONFIG_DNXHD_MUXER 0 -#define CONFIG_DNXHD_DEMUXER 0 -#define CONFIG_DSICIN_DEMUXER 0 -#define CONFIG_DTS_MUXER 0 -#define CONFIG_DTS_DEMUXER 1 -#define CONFIG_DTSHD_DEMUXER 1 -#define CONFIG_DV_MUXER 0 -#define CONFIG_DV_DEMUXER 0 -#define CONFIG_DXA_DEMUXER 0 -#define CONFIG_EA_DEMUXER 0 -#define CONFIG_EA_CDATA_DEMUXER 0 -#define CONFIG_EAC3_MUXER 0 -#define CONFIG_EAC3_DEMUXER 1 -#define CONFIG_EPAF_DEMUXER 0 -#define CONFIG_F4V_MUXER 0 -#define CONFIG_FFM_MUXER 0 -#define CONFIG_FFM_DEMUXER 0 -#define CONFIG_FFMETADATA_MUXER 0 -#define CONFIG_FFMETADATA_DEMUXER 0 -#define CONFIG_FILMSTRIP_MUXER 0 -#define CONFIG_FILMSTRIP_DEMUXER 0 -#define CONFIG_FLAC_MUXER 0 -#define CONFIG_FLAC_DEMUXER 0 -#define CONFIG_FLIC_DEMUXER 0 -#define CONFIG_FLV_MUXER 0 -#define CONFIG_FLV_DEMUXER 0 -#define CONFIG_FOURXM_DEMUXER 0 -#define CONFIG_FRAMECRC_MUXER 0 -#define CONFIG_FRAMEMD5_MUXER 0 -#define CONFIG_FRM_DEMUXER 0 -#define CONFIG_G722_MUXER 0 -#define CONFIG_G722_DEMUXER 0 -#define CONFIG_G723_1_MUXER 0 -#define CONFIG_G723_1_DEMUXER 0 -#define CONFIG_GIF_MUXER 0 -#define CONFIG_GIF_DEMUXER 0 -#define CONFIG_GSM_DEMUXER 0 -#define CONFIG_GXF_MUXER 0 -#define CONFIG_H261_MUXER 0 -#define CONFIG_G729_DEMUXER 0 -#define CONFIG_GXF_DEMUXER 0 -#define CONFIG_H261_DEMUXER 0 -#define CONFIG_H263_MUXER 0 -#define CONFIG_H263_DEMUXER 0 -#define CONFIG_H264_MUXER 0 -#define CONFIG_H264_DEMUXER 0 -#define CONFIG_HDS_MUXER 0 -#define CONFIG_HEVC_MUXER 0 -#define CONFIG_HEVC_DEMUXER 0 -#define CONFIG_HLS_MUXER 0 -#define CONFIG_HLS_DEMUXER 0 -#define CONFIG_HNM_DEMUXER 0 -#define CONFIG_ICO_MUXER 0 -#define CONFIG_ICO_DEMUXER 0 -#define CONFIG_IDCIN_DEMUXER 0 -#define CONFIG_IDF_DEMUXER 0 -#define CONFIG_IFF_DEMUXER 0 -#define CONFIG_ILBC_MUXER 0 -#define CONFIG_ILBC_DEMUXER 0 -#define CONFIG_IMAGE2_MUXER 0 -#define CONFIG_IMAGE2_DEMUXER 0 -#define CONFIG_IMAGE2PIPE_MUXER 0 -#define CONFIG_IMAGE2PIPE_DEMUXER 0 -#define CONFIG_INGENIENT_DEMUXER 0 -#define CONFIG_IPMOVIE_DEMUXER 0 -#define CONFIG_IPOD_MUXER 0 -#define CONFIG_IRCAM_MUXER 0 -#define CONFIG_IRCAM_DEMUXER 0 -#define CONFIG_ISMV_MUXER 0 -#define CONFIG_ISS_DEMUXER 0 -#define CONFIG_IV8_DEMUXER 0 -#define CONFIG_IVF_MUXER 0 -#define CONFIG_IVF_DEMUXER 0 -#define CONFIG_JACOSUB_MUXER 0 -#define CONFIG_JACOSUB_DEMUXER 0 -#define CONFIG_JV_DEMUXER 0 -#define CONFIG_LATM_MUXER 0 -#define CONFIG_LATM_DEMUXER 0 -#define CONFIG_LMLM4_DEMUXER 0 -#define CONFIG_LOAS_DEMUXER 0 -#define CONFIG_LVF_DEMUXER 0 -#define CONFIG_LXF_DEMUXER 0 -#define CONFIG_M4V_MUXER 0 -#define CONFIG_M4V_DEMUXER 0 -#define CONFIG_MD5_MUXER 0 -#define CONFIG_MATROSKA_MUXER 0 -#define CONFIG_MATROSKA_DEMUXER 0 -#define CONFIG_MATROSKA_AUDIO_MUXER 0 -#define CONFIG_MGSTS_DEMUXER 0 -#define CONFIG_MICRODVD_MUXER 0 -#define CONFIG_MICRODVD_DEMUXER 0 -#define CONFIG_MJPEG_MUXER 0 -#define CONFIG_MJPEG_DEMUXER 0 -#define CONFIG_MLP_MUXER 0 -#define CONFIG_MLP_DEMUXER 0 -#define CONFIG_MM_DEMUXER 0 -#define CONFIG_MMF_MUXER 0 -#define CONFIG_MMF_DEMUXER 0 -#define CONFIG_MOV_MUXER 0 -#define CONFIG_MOV_DEMUXER 0 -#define CONFIG_MP2_MUXER 0 -#define CONFIG_MP3_MUXER 0 -#define CONFIG_MP3_DEMUXER 1 -#define CONFIG_MP4_MUXER 0 -#define CONFIG_MPC_DEMUXER 0 -#define CONFIG_MPC8_DEMUXER 0 -#define CONFIG_MPEG1SYSTEM_MUXER 0 -#define CONFIG_MPEG1VCD_MUXER 0 -#define CONFIG_MPEG1VIDEO_MUXER 0 -#define CONFIG_MPEG2DVD_MUXER 0 -#define CONFIG_MPEG2SVCD_MUXER 0 -#define CONFIG_MPEG2VIDEO_MUXER 0 -#define CONFIG_MPEG2VOB_MUXER 0 -#define CONFIG_MPEGPS_DEMUXER 0 -#define CONFIG_MPEGTS_MUXER 0 -#define CONFIG_MPEGTS_DEMUXER 0 -#define CONFIG_MPEGTSRAW_DEMUXER 0 -#define CONFIG_MPEGVIDEO_DEMUXER 0 -#define CONFIG_MPJPEG_MUXER 0 -#define CONFIG_MPL2_DEMUXER 0 -#define CONFIG_MPSUB_DEMUXER 0 -#define CONFIG_MSNWC_TCP_DEMUXER 0 -#define CONFIG_MTV_DEMUXER 0 -#define CONFIG_MV_DEMUXER 0 -#define CONFIG_MVI_DEMUXER 0 -#define CONFIG_MXF_MUXER 0 -#define CONFIG_MXF_DEMUXER 0 -#define CONFIG_MXF_D10_MUXER 0 -#define CONFIG_MXG_DEMUXER 0 -#define CONFIG_NC_DEMUXER 0 -#define CONFIG_NISTSPHERE_DEMUXER 0 -#define CONFIG_NSV_DEMUXER 0 -#define CONFIG_NULL_MUXER 0 -#define CONFIG_NUT_MUXER 0 -#define CONFIG_NUT_DEMUXER 0 -#define CONFIG_OGG_MUXER 0 -#define CONFIG_NUV_DEMUXER 0 -#define CONFIG_OGG_DEMUXER 0 -#define CONFIG_OMA_MUXER 0 -#define CONFIG_OMA_DEMUXER 0 -#define CONFIG_OPUS_MUXER 0 -#define CONFIG_PAF_DEMUXER 0 -#define CONFIG_PCM_ALAW_MUXER 0 -#define CONFIG_PCM_ALAW_DEMUXER 0 -#define CONFIG_PCM_MULAW_MUXER 0 -#define CONFIG_PCM_MULAW_DEMUXER 0 -#define CONFIG_PCM_F64BE_MUXER 0 -#define CONFIG_PCM_F64BE_DEMUXER 0 -#define CONFIG_PCM_F64LE_MUXER 0 -#define CONFIG_PCM_F64LE_DEMUXER 0 -#define CONFIG_PCM_F32BE_MUXER 0 -#define CONFIG_PCM_F32BE_DEMUXER 0 -#define CONFIG_PCM_F32LE_MUXER 0 -#define CONFIG_PCM_F32LE_DEMUXER 0 -#define CONFIG_PCM_S32BE_MUXER 0 -#define CONFIG_PCM_S32BE_DEMUXER 0 -#define CONFIG_PCM_S32LE_MUXER 0 -#define CONFIG_PCM_S32LE_DEMUXER 0 -#define CONFIG_PCM_S24BE_MUXER 0 -#define CONFIG_PCM_S24BE_DEMUXER 0 -#define CONFIG_PCM_S24LE_MUXER 0 -#define CONFIG_PCM_S24LE_DEMUXER 0 -#define CONFIG_PCM_S16BE_MUXER 0 -#define CONFIG_PCM_S16BE_DEMUXER 0 -#define CONFIG_PCM_S16LE_MUXER 0 -#define CONFIG_PCM_S16LE_DEMUXER 0 -#define CONFIG_PCM_S8_MUXER 0 -#define CONFIG_PCM_S8_DEMUXER 0 -#define CONFIG_PCM_U32BE_MUXER 0 -#define CONFIG_PCM_U32BE_DEMUXER 0 -#define CONFIG_PCM_U32LE_MUXER 0 -#define CONFIG_PCM_U32LE_DEMUXER 0 -#define CONFIG_PCM_U24BE_MUXER 0 -#define CONFIG_PCM_U24BE_DEMUXER 0 -#define CONFIG_PCM_U24LE_MUXER 0 -#define CONFIG_PCM_U24LE_DEMUXER 0 -#define CONFIG_PCM_U16BE_MUXER 0 -#define CONFIG_PCM_U16BE_DEMUXER 0 -#define CONFIG_PCM_U16LE_MUXER 0 -#define CONFIG_PCM_U16LE_DEMUXER 0 -#define CONFIG_PCM_U8_MUXER 0 -#define CONFIG_PCM_U8_DEMUXER 0 -#define CONFIG_PJS_DEMUXER 0 -#define CONFIG_PMP_DEMUXER 0 -#define CONFIG_PSP_MUXER 0 -#define CONFIG_PVA_DEMUXER 0 -#define CONFIG_PVF_DEMUXER 0 -#define CONFIG_QCP_DEMUXER 0 -#define CONFIG_R3D_DEMUXER 0 -#define CONFIG_RAWVIDEO_MUXER 0 -#define CONFIG_RAWVIDEO_DEMUXER 0 -#define CONFIG_REALTEXT_DEMUXER 0 -#define CONFIG_REDSPARK_DEMUXER 0 -#define CONFIG_RL2_DEMUXER 0 -#define CONFIG_RM_MUXER 0 -#define CONFIG_RM_DEMUXER 0 -#define CONFIG_ROQ_MUXER 0 -#define CONFIG_ROQ_DEMUXER 0 -#define CONFIG_RPL_DEMUXER 0 -#define CONFIG_RSD_DEMUXER 0 -#define CONFIG_RSO_MUXER 0 -#define CONFIG_RSO_DEMUXER 0 -#define CONFIG_RTP_MUXER 0 -#define CONFIG_RTP_DEMUXER 0 -#define CONFIG_RTSP_MUXER 0 -#define CONFIG_RTSP_DEMUXER 0 -#define CONFIG_SAMI_DEMUXER 0 -#define CONFIG_SAP_MUXER 0 -#define CONFIG_SAP_DEMUXER 0 -#define CONFIG_SBG_DEMUXER 0 -#define CONFIG_SDP_DEMUXER 0 -#define CONFIG_SDR2_DEMUXER 0 -#define CONFIG_SEGAFILM_DEMUXER 0 -#define CONFIG_SEGMENT_MUXER 0 -#define CONFIG_SHORTEN_DEMUXER 0 -#define CONFIG_SIFF_DEMUXER 0 -#define CONFIG_SMACKER_DEMUXER 0 -#define CONFIG_SMJPEG_MUXER 0 -#define CONFIG_SMJPEG_DEMUXER 0 -#define CONFIG_SMOOTHSTREAMING_MUXER 0 -#define CONFIG_SMUSH_DEMUXER 0 -#define CONFIG_SOL_DEMUXER 0 -#define CONFIG_SOX_MUXER 0 -#define CONFIG_SOX_DEMUXER 0 -#define CONFIG_SPDIF_MUXER 0 -#define CONFIG_SPDIF_DEMUXER 1 -#define CONFIG_SPEEX_MUXER 0 -#define CONFIG_SRT_MUXER 0 -#define CONFIG_SRT_DEMUXER 0 -#define CONFIG_STR_DEMUXER 0 -#define CONFIG_SUBVIEWER1_DEMUXER 0 -#define CONFIG_SUBVIEWER_DEMUXER 0 -#define CONFIG_SWF_MUXER 0 -#define CONFIG_SWF_DEMUXER 0 -#define CONFIG_TAK_DEMUXER 1 -#define CONFIG_TEE_MUXER 0 -#define CONFIG_TEDCAPTIONS_DEMUXER 0 -#define CONFIG_TG2_MUXER 0 -#define CONFIG_TGP_MUXER 0 -#define CONFIG_THP_DEMUXER 0 -#define CONFIG_TIERTEXSEQ_DEMUXER 0 -#define CONFIG_MKVTIMESTAMP_V2_MUXER 0 -#define CONFIG_TMV_DEMUXER 0 -#define CONFIG_TRUEHD_MUXER 0 -#define CONFIG_TRUEHD_DEMUXER 0 -#define CONFIG_TTA_DEMUXER 1 -#define CONFIG_TXD_DEMUXER 0 -#define CONFIG_TTY_DEMUXER 0 -#define CONFIG_UNCODEDFRAMECRC_MUXER 0 -#define CONFIG_VC1_MUXER 0 -#define CONFIG_VC1_DEMUXER 0 -#define CONFIG_VC1T_MUXER 0 -#define CONFIG_VC1T_DEMUXER 0 -#define CONFIG_VIVO_DEMUXER 0 -#define CONFIG_VMD_DEMUXER 0 -#define CONFIG_VOBSUB_DEMUXER 0 -#define CONFIG_VOC_MUXER 0 -#define CONFIG_VOC_DEMUXER 0 -#define CONFIG_VPLAYER_DEMUXER 0 -#define CONFIG_VQF_DEMUXER 1 -#define CONFIG_W64_MUXER 0 -#define CONFIG_W64_DEMUXER 0 -#define CONFIG_WAV_MUXER 0 -#define CONFIG_WAV_DEMUXER 1 -#define CONFIG_WC3_DEMUXER 0 -#define CONFIG_WEBM_MUXER 0 -#define CONFIG_WEBM_DEMUXER 0 -#define CONFIG_WEBVTT_MUXER 0 -#define CONFIG_WEBVTT_DEMUXER 0 -#define CONFIG_WSAUD_DEMUXER 0 -#define CONFIG_WSVQA_DEMUXER 0 -#define CONFIG_WTV_MUXER 0 -#define CONFIG_WTV_DEMUXER 0 -#define CONFIG_WV_MUXER 0 -#define CONFIG_WV_DEMUXER 0 -#define CONFIG_XA_DEMUXER 0 -#define CONFIG_XBIN_DEMUXER 0 -#define CONFIG_XMV_DEMUXER 0 -#define CONFIG_XWMA_DEMUXER 1 -#define CONFIG_YOP_DEMUXER 0 -#define CONFIG_YUV4MPEGPIPE_MUXER 0 -#define CONFIG_YUV4MPEGPIPE_DEMUXER 0 - -#define CONFIG_BLURAY_PROTOCOL 0 -#define CONFIG_CACHE_PROTOCOL 0 -#define CONFIG_CONCAT_PROTOCOL 0 -#define CONFIG_CRYPTO_PROTOCOL 0 -#define CONFIG_DATA_PROTOCOL 0 -#define CONFIG_FFRTMPCRYPT_PROTOCOL 0 -#define CONFIG_FFRTMPHTTP_PROTOCOL 0 -#define CONFIG_FILE_PROTOCOL 0 -#define CONFIG_FTP_PROTOCOL 0 -#define CONFIG_GOPHER_PROTOCOL 0 -#define CONFIG_HLS_PROTOCOL 0 -#define CONFIG_HTTP_PROTOCOL 0 -#define CONFIG_HTTPPROXY_PROTOCOL 0 -#define CONFIG_HTTPS_PROTOCOL 0 -#define CONFIG_MMSH_PROTOCOL 0 -#define CONFIG_MMST_PROTOCOL 0 -#define CONFIG_MD5_PROTOCOL 0 -#define CONFIG_PIPE_PROTOCOL 0 -#define CONFIG_RTMP_PROTOCOL 0 -#define CONFIG_RTMPE_PROTOCOL 0 -#define CONFIG_RTMPS_PROTOCOL 0 -#define CONFIG_RTMPT_PROTOCOL 0 -#define CONFIG_RTMPTE_PROTOCOL 0 -#define CONFIG_RTMPTS_PROTOCOL 0 -#define CONFIG_RTP_PROTOCOL 0 -#define CONFIG_SCTP_PROTOCOL 0 -#define CONFIG_SRTP_PROTOCOL 0 -#define CONFIG_SUBFILE_PROTOCOL 0 -#define CONFIG_TCP_PROTOCOL 0 -#define CONFIG_TLS_PROTOCOL 0 -#define CONFIG_UDP_PROTOCOL 0 -#define CONFIG_UNIX_PROTOCOL 0 - -#define CONFIG_LIBGME_DEMUXER 0 -#define CONFIG_LIBMODPLUG_DEMUXER 0 -#define CONFIG_LIBNUT_MUXER 0 -#define CONFIG_LIBNUT_DEMUXER 0 -#define CONFIG_LIBQUVI_DEMUXER 0 -#define CONFIG_LIBRTMP_PROTOCOL 0 -#define CONFIG_LIBRTMPE_PROTOCOL 0 -#define CONFIG_LIBRTMPS_PROTOCOL 0 -#define CONFIG_LIBRTMPT_PROTOCOL 0 -#define CONFIG_LIBRTMPTE_PROTOCOL 0 -#define CONFIG_LIBSSH_PROTOCOL 0 - - -#define av_restrict __restrict__ -#define restrict __restrict__ -#define av_export - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac.h deleted file mode 100644 index 89f463e34..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac.h +++ /dev/null @@ -1,334 +0,0 @@ -/* - * AAC definitions and structures - * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) - * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC definitions and structures - * @author Oded Shimon ( ods15 ods15 dyndns org ) - * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) - */ - -#ifndef AVCODEC_AAC_H -#define AVCODEC_AAC_H - -#include "libavutil/float_dsp.h" -#include "avcodec.h" -#include "fft.h" -#include "mpeg4audio.h" -#include "sbr.h" -#include "fmtconvert.h" - -#include - -#define MAX_CHANNELS 64 -#define MAX_ELEM_ID 16 - -#define TNS_MAX_ORDER 20 -#define MAX_LTP_LONG_SFB 40 - -enum RawDataBlockType { - TYPE_SCE, - TYPE_CPE, - TYPE_CCE, - TYPE_LFE, - TYPE_DSE, - TYPE_PCE, - TYPE_FIL, - TYPE_END, -}; - -enum ExtensionPayloadID { - EXT_FILL, - EXT_FILL_DATA, - EXT_DATA_ELEMENT, - EXT_DYNAMIC_RANGE = 0xb, - EXT_SBR_DATA = 0xd, - EXT_SBR_DATA_CRC = 0xe, -}; - -enum WindowSequence { - ONLY_LONG_SEQUENCE, - LONG_START_SEQUENCE, - EIGHT_SHORT_SEQUENCE, - LONG_STOP_SEQUENCE, -}; - -enum BandType { - ZERO_BT = 0, ///< Scalefactors and spectral data are all zero. - FIRST_PAIR_BT = 5, ///< This and later band types encode two values (rather than four) with one code word. - ESC_BT = 11, ///< Spectral data are coded with an escape sequence. - NOISE_BT = 13, ///< Spectral data are scaled white noise not coded in the bitstream. - INTENSITY_BT2 = 14, ///< Scalefactor data are intensity stereo positions. - INTENSITY_BT = 15, ///< Scalefactor data are intensity stereo positions. -}; - -#define IS_CODEBOOK_UNSIGNED(x) ((x - 1) & 10) - -enum ChannelPosition { - AAC_CHANNEL_OFF = 0, - AAC_CHANNEL_FRONT = 1, - AAC_CHANNEL_SIDE = 2, - AAC_CHANNEL_BACK = 3, - AAC_CHANNEL_LFE = 4, - AAC_CHANNEL_CC = 5, -}; - -/** - * The point during decoding at which channel coupling is applied. - */ -enum CouplingPoint { - BEFORE_TNS, - BETWEEN_TNS_AND_IMDCT, - AFTER_IMDCT = 3, -}; - -/** - * Output configuration status - */ -enum OCStatus { - OC_NONE, ///< Output unconfigured - OC_TRIAL_PCE, ///< Output configuration under trial specified by an inband PCE - OC_TRIAL_FRAME, ///< Output configuration under trial specified by a frame header - OC_GLOBAL_HDR, ///< Output configuration set in a global header but not yet locked - OC_LOCKED, ///< Output configuration locked in place -}; - -typedef struct OutputConfiguration { - MPEG4AudioConfig m4ac; - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int layout_map_tags; - int channels; - uint64_t channel_layout; - enum OCStatus status; -} OutputConfiguration; - -/** - * Predictor State - */ -typedef struct PredictorState { - float cor0; - float cor1; - float var0; - float var1; - float r0; - float r1; -} PredictorState; - -#define MAX_PREDICTORS 672 - -#define SCALE_DIV_512 36 ///< scalefactor difference that corresponds to scale difference in 512 times -#define SCALE_ONE_POS 140 ///< scalefactor index that corresponds to scale=1.0 -#define SCALE_MAX_POS 255 ///< scalefactor index maximum value -#define SCALE_MAX_DIFF 60 ///< maximum scalefactor difference allowed by standard -#define SCALE_DIFF_ZERO 60 ///< codebook index corresponding to zero scalefactor indices difference - -/** - * Long Term Prediction - */ -typedef struct LongTermPrediction { - int8_t present; - int16_t lag; - float coef; - int8_t used[MAX_LTP_LONG_SFB]; -} LongTermPrediction; - -/** - * Individual Channel Stream - */ -typedef struct IndividualChannelStream { - uint8_t max_sfb; ///< number of scalefactor bands per group - enum WindowSequence window_sequence[2]; - uint8_t use_kb_window[2]; ///< If set, use Kaiser-Bessel window, otherwise use a sine window. - int num_window_groups; - uint8_t group_len[8]; - LongTermPrediction ltp; - const uint16_t *swb_offset; ///< table of offsets to the lowest spectral coefficient of a scalefactor band, sfb, for a particular window - const uint8_t *swb_sizes; ///< table of scalefactor band sizes for a particular window - int num_swb; ///< number of scalefactor window bands - int num_windows; - int tns_max_bands; - int predictor_present; - int predictor_initialized; - int predictor_reset_group; - uint8_t prediction_used[41]; -} IndividualChannelStream; - -/** - * Temporal Noise Shaping - */ -typedef struct TemporalNoiseShaping { - int present; - int n_filt[8]; - int length[8][4]; - int direction[8][4]; - int order[8][4]; - float coef[8][4][TNS_MAX_ORDER]; -} TemporalNoiseShaping; - -/** - * Dynamic Range Control - decoded from the bitstream but not processed further. - */ -typedef struct DynamicRangeControl { - int pce_instance_tag; ///< Indicates with which program the DRC info is associated. - int dyn_rng_sgn[17]; ///< DRC sign information; 0 - positive, 1 - negative - int dyn_rng_ctl[17]; ///< DRC magnitude information - int exclude_mask[MAX_CHANNELS]; ///< Channels to be excluded from DRC processing. - int band_incr; ///< Number of DRC bands greater than 1 having DRC info. - int interpolation_scheme; ///< Indicates the interpolation scheme used in the SBR QMF domain. - int band_top[17]; ///< Indicates the top of the i-th DRC band in units of 4 spectral lines. - int prog_ref_level; /**< A reference level for the long-term program audio level for all - * channels combined. - */ -} DynamicRangeControl; - -typedef struct Pulse { - int num_pulse; - int start; - int pos[4]; - int amp[4]; -} Pulse; - -/** - * coupling parameters - */ -typedef struct ChannelCoupling { - enum CouplingPoint coupling_point; ///< The point during decoding at which coupling is applied. - int num_coupled; ///< number of target elements - enum RawDataBlockType type[8]; ///< Type of channel element to be coupled - SCE or CPE. - int id_select[8]; ///< element id - int ch_select[8]; /**< [0] shared list of gains; [1] list of gains for right channel; - * [2] list of gains for left channel; [3] lists of gains for both channels - */ - float gain[16][120]; -} ChannelCoupling; - -/** - * Single Channel Element - used for both SCE and LFE elements. - */ -typedef struct SingleChannelElement { - IndividualChannelStream ics; - TemporalNoiseShaping tns; - Pulse pulse; - enum BandType band_type[128]; ///< band types - int band_type_run_end[120]; ///< band type run end points - float sf[120]; ///< scalefactors - int sf_idx[128]; ///< scalefactor indices (used by encoder) - uint8_t zeroes[128]; ///< band is not coded (used by encoder) - DECLARE_ALIGNED(32, float, coeffs)[1024]; ///< coefficients for IMDCT - DECLARE_ALIGNED(32, float, saved)[1536]; ///< overlap - DECLARE_ALIGNED(32, float, ret_buf)[2048]; ///< PCM output buffer - DECLARE_ALIGNED(16, float, ltp_state)[3072]; ///< time signal for LTP - PredictorState predictor_state[MAX_PREDICTORS]; - float *ret; ///< PCM output -} SingleChannelElement; - -/** - * channel element - generic struct for SCE/CPE/CCE/LFE - */ -typedef struct ChannelElement { - // CPE specific - int common_window; ///< Set if channels share a common 'IndividualChannelStream' in bitstream. - int ms_mode; ///< Signals mid/side stereo flags coding mode (used by encoder) - uint8_t ms_mask[128]; ///< Set if mid/side stereo is used for each scalefactor window band - // shared - SingleChannelElement ch[2]; - // CCE specific - ChannelCoupling coup; - SpectralBandReplication sbr; -} ChannelElement; - -/** - * main AAC context - */ -struct AACContext { - AVClass *class; - AVCodecContext *avctx; - AVFrame *frame; - - int is_saved; ///< Set if elements have stored overlap from previous frame. - DynamicRangeControl che_drc; - - /** - * @name Channel element related data - * @{ - */ - ChannelElement *che[4][MAX_ELEM_ID]; - ChannelElement *tag_che_map[4][MAX_ELEM_ID]; - int tags_mapped; - /** @} */ - - /** - * @name temporary aligned temporary buffers - * (We do not want to have these on the stack.) - * @{ - */ - DECLARE_ALIGNED(32, float, buf_mdct)[1024]; - /** @} */ - - /** - * @name Computed / set up during initialization - * @{ - */ - FFTContext mdct; - FFTContext mdct_small; - FFTContext mdct_ld; - FFTContext mdct_ltp; - FmtConvertContext fmt_conv; - AVFloatDSPContext fdsp; - int random_state; - /** @} */ - - /** - * @name Members used for output - * @{ - */ - SingleChannelElement *output_element[MAX_CHANNELS]; ///< Points to each SingleChannelElement - /** @} */ - - - /** - * @name Japanese DTV specific extension - * @{ - */ - int force_dmono_mode;///< 0->not dmono, 1->use first channel, 2->use second channel - int dmono_mode; ///< 0->not dmono, 1->use first channel, 2->use second channel - /** @} */ - - DECLARE_ALIGNED(32, float, temp)[128]; - - OutputConfiguration oc[2]; - int warned_num_aac_frames; - - /* aacdec functions pointers */ - void (*imdct_and_windowing)(AACContext *ac, SingleChannelElement *sce); - void (*apply_ltp)(AACContext *ac, SingleChannelElement *sce); - void (*apply_tns)(float coef[1024], TemporalNoiseShaping *tns, - IndividualChannelStream *ics, int decode); - void (*windowing_and_mdct_ltp)(AACContext *ac, float *out, - float *in, IndividualChannelStream *ics); - void (*update_ltp)(AACContext *ac, SingleChannelElement *sce); - -}; - -void ff_aacdec_init_mips(AACContext *c); - -#endif /* AVCODEC_AAC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.c deleted file mode 100644 index c82a21024..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Common AAC and AC-3 parser - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/channel_layout.h" -#include "libavutil/common.h" -#include "libavutil/internal.h" -#include "parser.h" -#include "aac_ac3_parser.h" - -int ff_aac_ac3_parse(AVCodecParserContext *s1, - AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - AACAC3ParseContext *s = s1->priv_data; - ParseContext *pc = &s->pc; - int len, i; - int new_frame_start; - -get_next: - i=END_NOT_FOUND; - if(s->remaining_size <= buf_size){ - if(s->remaining_size && !s->need_next_header){ - i= s->remaining_size; - s->remaining_size = 0; - }else{ //we need a header first - len=0; - for(i=s->remaining_size; istate = (s->state<<8) + buf[i]; - if((len=s->sync(s->state, s, &s->need_next_header, &new_frame_start))) - break; - } - if(len<=0){ - i=END_NOT_FOUND; - }else{ - s->state=0; - i-= s->header_size -1; - s->remaining_size = len; - if(!new_frame_start || pc->index+i<=0){ - s->remaining_size += i; - goto get_next; - } - } - } - } - - if(ff_combine_frame(pc, i, &buf, &buf_size)<0){ - s->remaining_size -= FFMIN(s->remaining_size, buf_size); - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - - *poutbuf = buf; - *poutbuf_size = buf_size; - - /* update codec info */ - if(s->codec_id) - avctx->codec_id = s->codec_id; - - /* Due to backwards compatible HE-AAC the sample rate, channel count, - and total number of samples found in an AAC ADTS header are not - reliable. Bit rate is still accurate because the total frame duration in - seconds is still correct (as is the number of bits in the frame). */ - if (avctx->codec_id != AV_CODEC_ID_AAC) { - avctx->sample_rate = s->sample_rate; - - /* (E-)AC-3: allow downmixing to stereo or mono */ -#if FF_API_REQUEST_CHANNELS -FF_DISABLE_DEPRECATION_WARNINGS - if (avctx->request_channels == 1) - avctx->request_channel_layout = AV_CH_LAYOUT_MONO; - else if (avctx->request_channels == 2) - avctx->request_channel_layout = AV_CH_LAYOUT_STEREO; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (s->channels > 1 && - avctx->request_channel_layout == AV_CH_LAYOUT_MONO) { - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - } else if (s->channels > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { - avctx->channels = 2; - avctx->channel_layout = AV_CH_LAYOUT_STEREO; - } else { - avctx->channels = s->channels; - avctx->channel_layout = s->channel_layout; - } - s1->duration = s->samples; - avctx->audio_service_type = s->service_type; - } - - avctx->bit_rate = s->bit_rate; - - return i; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.h deleted file mode 100644 index c2506a5bf..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_ac3_parser.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Common AAC and AC-3 parser prototypes - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AAC_AC3_PARSER_H -#define AVCODEC_AAC_AC3_PARSER_H - -#include -#include "avcodec.h" -#include "parser.h" - -typedef enum { - AAC_AC3_PARSE_ERROR_SYNC = -0x1030c0a, - AAC_AC3_PARSE_ERROR_BSID = -0x2030c0a, - AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a, - AAC_AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a, - AAC_AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a, - AAC_AC3_PARSE_ERROR_CRC = -0x6030c0a, - AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -0x7030c0a, -} AACAC3ParseError; - -typedef struct AACAC3ParseContext { - ParseContext pc; - int frame_size; - int header_size; - int (*sync)(uint64_t state, struct AACAC3ParseContext *hdr_info, - int *need_next_header, int *new_frame_start); - - int channels; - int sample_rate; - int bit_rate; - int samples; - uint64_t channel_layout; - int service_type; - - int remaining_size; - uint64_t state; - - int need_next_header; - enum AVCodecID codec_id; -} AACAC3ParseContext; - -int ff_aac_ac3_parse(AVCodecParserContext *s1, - AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size); - -#endif /* AVCODEC_AAC_AC3_PARSER_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_adtstoasc_bsf.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_adtstoasc_bsf.c deleted file mode 100644 index d5ea20f19..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_adtstoasc_bsf.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter - * Copyright (c) 2009 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avcodec.h" -#include "aacadtsdec.h" -#include "put_bits.h" -#include "get_bits.h" -#include "mpeg4audio.h" -#include "internal.h" -#include "libavutil/internal.h" - -typedef struct AACBSFContext { - int first_frame_done; -} AACBSFContext; - -/** - * This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 - * ADTS header and removes the ADTS header. - */ -static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int keyframe) -{ - GetBitContext gb; - PutBitContext pb; - AACADTSHeaderInfo hdr; - - AACBSFContext *ctx = bsfc->priv_data; - - init_get_bits(&gb, buf, AAC_ADTS_HEADER_SIZE*8); - - *poutbuf = (uint8_t*) buf; - *poutbuf_size = buf_size; - - if (avctx->extradata) - if (show_bits(&gb, 12) != 0xfff) - return 0; - - if (avpriv_aac_parse_header(&gb, &hdr) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); - return -1; - } - - if (!hdr.crc_absent && hdr.num_aac_frames > 1) { - avpriv_report_missing_feature(avctx, - "Multiple RDBs per frame with CRC"); - return AVERROR_PATCHWELCOME; - } - - buf += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; - buf_size -= AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent; - - if (!ctx->first_frame_done) { - int pce_size = 0; - uint8_t pce_data[MAX_PCE_SIZE]; - if (!hdr.chan_config) { - init_get_bits(&gb, buf, buf_size * 8); - if (get_bits(&gb, 3) != 5) { - avpriv_report_missing_feature(avctx, - "PCE-based channel configuration " - "without PCE as first syntax " - "element"); - return AVERROR_PATCHWELCOME; - } - init_put_bits(&pb, pce_data, MAX_PCE_SIZE); - pce_size = avpriv_copy_pce_data(&pb, &gb)/8; - flush_put_bits(&pb); - buf_size -= get_bits_count(&gb)/8; - buf += get_bits_count(&gb)/8; - } - av_free(avctx->extradata); - avctx->extradata_size = 2 + pce_size; - avctx->extradata = av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - - init_put_bits(&pb, avctx->extradata, avctx->extradata_size); - put_bits(&pb, 5, hdr.object_type); - put_bits(&pb, 4, hdr.sampling_index); - put_bits(&pb, 4, hdr.chan_config); - put_bits(&pb, 1, 0); //frame length - 1024 samples - put_bits(&pb, 1, 0); //does not depend on core coder - put_bits(&pb, 1, 0); //is not extension - flush_put_bits(&pb); - if (pce_size) { - memcpy(avctx->extradata + 2, pce_data, pce_size); - } - - ctx->first_frame_done = 1; - } - - *poutbuf = (uint8_t*) buf; - *poutbuf_size = buf_size; - - return 0; -} - -AVBitStreamFilter ff_aac_adtstoasc_bsf = { - .name = "aac_adtstoasc", - .priv_data_size = sizeof(AACBSFContext), - .filter = aac_adtstoasc_filter, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_parser.c deleted file mode 100644 index ab6ca4e26..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_parser.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Audio and Video frame extraction - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "parser.h" -#include "aac_ac3_parser.h" -#include "aacadtsdec.h" -#include "get_bits.h" -#include "mpeg4audio.h" - -static int aac_sync(uint64_t state, AACAC3ParseContext *hdr_info, - int *need_next_header, int *new_frame_start) -{ - GetBitContext bits; - AACADTSHeaderInfo hdr; - int size; - union { - uint64_t u64; - uint8_t u8[8]; - } tmp; - - tmp.u64 = av_be2ne64(state); - init_get_bits(&bits, tmp.u8+8-AAC_ADTS_HEADER_SIZE, AAC_ADTS_HEADER_SIZE * 8); - - if ((size = avpriv_aac_parse_header(&bits, &hdr)) < 0) - return 0; - *need_next_header = 0; - *new_frame_start = 1; - hdr_info->sample_rate = hdr.sample_rate; - hdr_info->channels = ff_mpeg4audio_channels[hdr.chan_config]; - hdr_info->samples = hdr.samples; - hdr_info->bit_rate = hdr.bit_rate; - return size; -} - -static av_cold int aac_parse_init(AVCodecParserContext *s1) -{ - AACAC3ParseContext *s = s1->priv_data; - s->header_size = AAC_ADTS_HEADER_SIZE; - s->sync = aac_sync; - return 0; -} - - -AVCodecParser ff_aac_parser = { - .codec_ids = { AV_CODEC_ID_AAC }, - .priv_data_size = sizeof(AACAC3ParseContext), - .parser_init = aac_parse_init, - .parser_parse = ff_aac_ac3_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen.h deleted file mode 100644 index 1c19a1529..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Header file for hardcoded AAC tables - * - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AAC_TABLEGEN_H -#define AVCODEC_AAC_TABLEGEN_H - -#include "aac_tablegen_decl.h" - -#if CONFIG_HARDCODED_TABLES -#include "libavcodec/aac_tables.h" -#else -#include "libavutil/mathematics.h" -float ff_aac_pow2sf_tab[428]; - -void ff_aac_tableinit(void) -{ - int i; - for (i = 0; i < 428; i++) - ff_aac_pow2sf_tab[i] = pow(2, (i - POW_SF2_ZERO) / 4.0); -} -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AVCODEC_AAC_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen_decl.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen_decl.h deleted file mode 100644 index 5105dae48..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aac_tablegen_decl.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Header file for hardcoded AAC tables - * - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AAC_TABLEGEN_DECL_H -#define AVCODEC_AAC_TABLEGEN_DECL_H - -#define POW_SF2_ZERO 200 ///< ff_aac_pow2sf_tab index corresponding to pow(2, 0); - -#if CONFIG_HARDCODED_TABLES -#define ff_aac_tableinit() -extern const float ff_aac_pow2sf_tab[428]; -#else -void ff_aac_tableinit(void); -extern float ff_aac_pow2sf_tab[428]; -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AVCODEC_AAC_TABLEGEN_DECL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.c deleted file mode 100644 index c9718c459..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Audio and Video frame extraction - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * Copyright (c) 2009 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "aac_ac3_parser.h" -#include "aacadtsdec.h" -#include "get_bits.h" -#include "mpeg4audio.h" - -int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr) -{ - int size, rdb, ch, sr; - int aot, crc_abs; - - if(get_bits(gbc, 12) != 0xfff) - return AAC_AC3_PARSE_ERROR_SYNC; - - skip_bits1(gbc); /* id */ - skip_bits(gbc, 2); /* layer */ - crc_abs = get_bits1(gbc); /* protection_absent */ - aot = get_bits(gbc, 2); /* profile_objecttype */ - sr = get_bits(gbc, 4); /* sample_frequency_index */ - if(!avpriv_mpeg4audio_sample_rates[sr]) - return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; - skip_bits1(gbc); /* private_bit */ - ch = get_bits(gbc, 3); /* channel_configuration */ - - skip_bits1(gbc); /* original/copy */ - skip_bits1(gbc); /* home */ - - /* adts_variable_header */ - skip_bits1(gbc); /* copyright_identification_bit */ - skip_bits1(gbc); /* copyright_identification_start */ - size = get_bits(gbc, 13); /* aac_frame_length */ - if(size < AAC_ADTS_HEADER_SIZE) - return AAC_AC3_PARSE_ERROR_FRAME_SIZE; - - skip_bits(gbc, 11); /* adts_buffer_fullness */ - rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */ - - hdr->object_type = aot + 1; - hdr->chan_config = ch; - hdr->crc_absent = crc_abs; - hdr->num_aac_frames = rdb + 1; - hdr->sampling_index = sr; - hdr->sample_rate = avpriv_mpeg4audio_sample_rates[sr]; - hdr->samples = (rdb + 1) * 1024; - hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; - - return size; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.h deleted file mode 100644 index d0584ef36..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacadtsdec.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * AAC ADTS header decoding prototypes and structures - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AACADTSDEC_H -#define AVCODEC_AACADTSDEC_H - -#include -#include "get_bits.h" - -#define AAC_ADTS_HEADER_SIZE 7 - -typedef struct AACADTSHeaderInfo { - uint32_t sample_rate; - uint32_t samples; - uint32_t bit_rate; - uint8_t crc_absent; - uint8_t object_type; - uint8_t sampling_index; - uint8_t chan_config; - uint8_t num_aac_frames; -} AACADTSHeaderInfo; - -/** - * Parse AAC frame header. - * Parse the ADTS frame header to the end of the variable header, which is - * the first 54 bits. - * @param[in] gbc BitContext containing the first 54 bits of the frame. - * @param[out] hdr Pointer to struct where header info is written. - * @return Returns 0 on success, -1 if there is a sync word mismatch, - * -2 if the version element is invalid, -3 if the sample rate - * element is invalid, or -4 if the bit rate element is invalid. - */ -int avpriv_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr); - -#endif /* AVCODEC_AACADTSDEC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdec.c deleted file mode 100644 index 2affceb00..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdec.c +++ /dev/null @@ -1,3482 +0,0 @@ -/* - * AAC decoder - * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) - * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) - * Copyright (c) 2008-2013 Alex Converse - * - * AAC LATM decoder - * Copyright (c) 2008-2010 Paul Kendall - * Copyright (c) 2010 Janne Grunau - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC decoder - * @author Oded Shimon ( ods15 ods15 dyndns org ) - * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) - */ - -/* - * supported tools - * - * Support? Name - * N (code in SoC repo) gain control - * Y block switching - * Y window shapes - standard - * N window shapes - Low Delay - * Y filterbank - standard - * N (code in SoC repo) filterbank - Scalable Sample Rate - * Y Temporal Noise Shaping - * Y Long Term Prediction - * Y intensity stereo - * Y channel coupling - * Y frequency domain prediction - * Y Perceptual Noise Substitution - * Y Mid/Side stereo - * N Scalable Inverse AAC Quantization - * N Frequency Selective Switch - * N upsampling filter - * Y quantization & coding - AAC - * N quantization & coding - TwinVQ - * N quantization & coding - BSAC - * N AAC Error Resilience tools - * N Error Resilience payload syntax - * N Error Protection tool - * N CELP - * N Silence Compression - * N HVXC - * N HVXC 4kbits/s VR - * N Structured Audio tools - * N Structured Audio Sample Bank Format - * N MIDI - * N Harmonic and Individual Lines plus Noise - * N Text-To-Speech Interface - * Y Spectral Band Replication - * Y (not in this code) Layer-1 - * Y (not in this code) Layer-2 - * Y (not in this code) Layer-3 - * N SinuSoidal Coding (Transient, Sinusoid, Noise) - * Y Parametric Stereo - * N Direct Stream Transfer - * Y Enhanced AAC Low Delay (ER AAC ELD) - * - * Note: - HE AAC v1 comprises LC AAC with Spectral Band Replication. - * - HE AAC v2 comprises LC AAC with Spectral Band Replication and - Parametric Stereo. - */ - -#include "libavutil/float_dsp.h" -#include "libavutil/opt.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "fft.h" -#include "fmtconvert.h" -#include "lpc.h" -#include "kbdwin.h" -#include "sinewin.h" - -#include "aac.h" -#include "aactab.h" -#include "aacdectab.h" -#include "cbrt_tablegen.h" -#include "sbr.h" -#include "aacsbr.h" -#include "mpeg4audio.h" -#include "aacadtsdec.h" -#include "libavutil/intfloat.h" - -#include -#include -#include -#include -#include - -#if ARCH_ARM -# include "arm/aac.h" -#elif ARCH_MIPS -# include "mips/aacdec_mips.h" -#endif - -static VLC vlc_scalefactors; -static VLC vlc_spectral[11]; - -static int output_configure(AACContext *ac, - uint8_t layout_map[MAX_ELEM_ID*4][3], int tags, - enum OCStatus oc_type, int get_new_frame); - -#define overread_err "Input buffer exhausted before END element found\n" - -static int count_channels(uint8_t (*layout)[3], int tags) -{ - int i, sum = 0; - for (i = 0; i < tags; i++) { - int syn_ele = layout[i][0]; - int pos = layout[i][2]; - sum += (1 + (syn_ele == TYPE_CPE)) * - (pos != AAC_CHANNEL_OFF && pos != AAC_CHANNEL_CC); - } - return sum; -} - -/** - * Check for the channel element in the current channel position configuration. - * If it exists, make sure the appropriate element is allocated and map the - * channel order to match the internal FFmpeg channel layout. - * - * @param che_pos current channel position configuration - * @param type channel element type - * @param id channel element id - * @param channels count of the number of channels in the configuration - * - * @return Returns error status. 0 - OK, !0 - error - */ -static av_cold int che_configure(AACContext *ac, - enum ChannelPosition che_pos, - int type, int id, int *channels) -{ - if (*channels >= MAX_CHANNELS) - return AVERROR_INVALIDDATA; - if (che_pos) { - if (!ac->che[type][id]) { - if (!(ac->che[type][id] = av_mallocz(sizeof(ChannelElement)))) - return AVERROR(ENOMEM); - ff_aac_sbr_ctx_init(ac, &ac->che[type][id]->sbr); - } - if (type != TYPE_CCE) { - if (*channels >= MAX_CHANNELS - (type == TYPE_CPE || (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1))) { - av_log(ac->avctx, AV_LOG_ERROR, "Too many channels\n"); - return AVERROR_INVALIDDATA; - } - ac->output_element[(*channels)++] = &ac->che[type][id]->ch[0]; - if (type == TYPE_CPE || - (type == TYPE_SCE && ac->oc[1].m4ac.ps == 1)) { - ac->output_element[(*channels)++] = &ac->che[type][id]->ch[1]; - } - } - } else { - if (ac->che[type][id]) - ff_aac_sbr_ctx_close(&ac->che[type][id]->sbr); - av_freep(&ac->che[type][id]); - } - return 0; -} - -static int frame_configure_elements(AVCodecContext *avctx) -{ - AACContext *ac = avctx->priv_data; - int type, id, ch, ret; - - /* set channel pointers to internal buffers by default */ - for (type = 0; type < 4; type++) { - for (id = 0; id < MAX_ELEM_ID; id++) { - ChannelElement *che = ac->che[type][id]; - if (che) { - che->ch[0].ret = che->ch[0].ret_buf; - che->ch[1].ret = che->ch[1].ret_buf; - } - } - } - - /* get output buffer */ - av_frame_unref(ac->frame); - if (!avctx->channels) - return 1; - - ac->frame->nb_samples = 2048; - if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0) - return ret; - - /* map output channel pointers to AVFrame data */ - for (ch = 0; ch < avctx->channels; ch++) { - if (ac->output_element[ch]) - ac->output_element[ch]->ret = (float *)ac->frame->extended_data[ch]; - } - - return 0; -} - -struct elem_to_channel { - uint64_t av_position; - uint8_t syn_ele; - uint8_t elem_id; - uint8_t aac_position; -}; - -static int assign_pair(struct elem_to_channel e2c_vec[MAX_ELEM_ID], - uint8_t (*layout_map)[3], int offset, uint64_t left, - uint64_t right, int pos) -{ - if (layout_map[offset][0] == TYPE_CPE) { - e2c_vec[offset] = (struct elem_to_channel) { - .av_position = left | right, - .syn_ele = TYPE_CPE, - .elem_id = layout_map[offset][1], - .aac_position = pos - }; - return 1; - } else { - e2c_vec[offset] = (struct elem_to_channel) { - .av_position = left, - .syn_ele = TYPE_SCE, - .elem_id = layout_map[offset][1], - .aac_position = pos - }; - e2c_vec[offset + 1] = (struct elem_to_channel) { - .av_position = right, - .syn_ele = TYPE_SCE, - .elem_id = layout_map[offset + 1][1], - .aac_position = pos - }; - return 2; - } -} - -static int count_paired_channels(uint8_t (*layout_map)[3], int tags, int pos, - int *current) -{ - int num_pos_channels = 0; - int first_cpe = 0; - int sce_parity = 0; - int i; - for (i = *current; i < tags; i++) { - if (layout_map[i][2] != pos) - break; - if (layout_map[i][0] == TYPE_CPE) { - if (sce_parity) { - if (pos == AAC_CHANNEL_FRONT && !first_cpe) { - sce_parity = 0; - } else { - return -1; - } - } - num_pos_channels += 2; - first_cpe = 1; - } else { - num_pos_channels++; - sce_parity ^= 1; - } - } - if (sce_parity && - ((pos == AAC_CHANNEL_FRONT && first_cpe) || pos == AAC_CHANNEL_SIDE)) - return -1; - *current = i; - return num_pos_channels; -} - -static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags) -{ - int i, n, total_non_cc_elements; - struct elem_to_channel e2c_vec[4 * MAX_ELEM_ID] = { { 0 } }; - int num_front_channels, num_side_channels, num_back_channels; - uint64_t layout; - - if (FF_ARRAY_ELEMS(e2c_vec) < tags) - return 0; - - i = 0; - num_front_channels = - count_paired_channels(layout_map, tags, AAC_CHANNEL_FRONT, &i); - if (num_front_channels < 0) - return 0; - num_side_channels = - count_paired_channels(layout_map, tags, AAC_CHANNEL_SIDE, &i); - if (num_side_channels < 0) - return 0; - num_back_channels = - count_paired_channels(layout_map, tags, AAC_CHANNEL_BACK, &i); - if (num_back_channels < 0) - return 0; - - i = 0; - if (num_front_channels & 1) { - e2c_vec[i] = (struct elem_to_channel) { - .av_position = AV_CH_FRONT_CENTER, - .syn_ele = TYPE_SCE, - .elem_id = layout_map[i][1], - .aac_position = AAC_CHANNEL_FRONT - }; - i++; - num_front_channels--; - } - if (num_front_channels >= 4) { - i += assign_pair(e2c_vec, layout_map, i, - AV_CH_FRONT_LEFT_OF_CENTER, - AV_CH_FRONT_RIGHT_OF_CENTER, - AAC_CHANNEL_FRONT); - num_front_channels -= 2; - } - if (num_front_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - AV_CH_FRONT_LEFT, - AV_CH_FRONT_RIGHT, - AAC_CHANNEL_FRONT); - num_front_channels -= 2; - } - while (num_front_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, - AAC_CHANNEL_FRONT); - num_front_channels -= 2; - } - - if (num_side_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - AV_CH_SIDE_LEFT, - AV_CH_SIDE_RIGHT, - AAC_CHANNEL_FRONT); - num_side_channels -= 2; - } - while (num_side_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, - AAC_CHANNEL_SIDE); - num_side_channels -= 2; - } - - while (num_back_channels >= 4) { - i += assign_pair(e2c_vec, layout_map, i, - UINT64_MAX, - UINT64_MAX, - AAC_CHANNEL_BACK); - num_back_channels -= 2; - } - if (num_back_channels >= 2) { - i += assign_pair(e2c_vec, layout_map, i, - AV_CH_BACK_LEFT, - AV_CH_BACK_RIGHT, - AAC_CHANNEL_BACK); - num_back_channels -= 2; - } - if (num_back_channels) { - e2c_vec[i] = (struct elem_to_channel) { - .av_position = AV_CH_BACK_CENTER, - .syn_ele = TYPE_SCE, - .elem_id = layout_map[i][1], - .aac_position = AAC_CHANNEL_BACK - }; - i++; - num_back_channels--; - } - - if (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { - e2c_vec[i] = (struct elem_to_channel) { - .av_position = AV_CH_LOW_FREQUENCY, - .syn_ele = TYPE_LFE, - .elem_id = layout_map[i][1], - .aac_position = AAC_CHANNEL_LFE - }; - i++; - } - while (i < tags && layout_map[i][2] == AAC_CHANNEL_LFE) { - e2c_vec[i] = (struct elem_to_channel) { - .av_position = UINT64_MAX, - .syn_ele = TYPE_LFE, - .elem_id = layout_map[i][1], - .aac_position = AAC_CHANNEL_LFE - }; - i++; - } - - // Must choose a stable sort - total_non_cc_elements = n = i; - do { - int next_n = 0; - for (i = 1; i < n; i++) - if (e2c_vec[i - 1].av_position > e2c_vec[i].av_position) { - FFSWAP(struct elem_to_channel, e2c_vec[i - 1], e2c_vec[i]); - next_n = i; - } - n = next_n; - } while (n > 0); - - layout = 0; - for (i = 0; i < total_non_cc_elements; i++) { - layout_map[i][0] = e2c_vec[i].syn_ele; - layout_map[i][1] = e2c_vec[i].elem_id; - layout_map[i][2] = e2c_vec[i].aac_position; - if (e2c_vec[i].av_position != UINT64_MAX) { - layout |= e2c_vec[i].av_position; - } - } - - return layout; -} - -/** - * Save current output configuration if and only if it has been locked. - */ -static void push_output_configuration(AACContext *ac) { - if (ac->oc[1].status == OC_LOCKED) { - ac->oc[0] = ac->oc[1]; - } - ac->oc[1].status = OC_NONE; -} - -/** - * Restore the previous output configuration if and only if the current - * configuration is unlocked. - */ -static void pop_output_configuration(AACContext *ac) { - if (ac->oc[1].status != OC_LOCKED && ac->oc[0].status != OC_NONE) { - ac->oc[1] = ac->oc[0]; - ac->avctx->channels = ac->oc[1].channels; - ac->avctx->channel_layout = ac->oc[1].channel_layout; - output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags, - ac->oc[1].status, 0); - } -} - -/** - * Configure output channel order based on the current program - * configuration element. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int output_configure(AACContext *ac, - uint8_t layout_map[MAX_ELEM_ID * 4][3], int tags, - enum OCStatus oc_type, int get_new_frame) -{ - AVCodecContext *avctx = ac->avctx; - int i, channels = 0, ret; - uint64_t layout = 0; - - if (ac->oc[1].layout_map != layout_map) { - memcpy(ac->oc[1].layout_map, layout_map, tags * sizeof(layout_map[0])); - ac->oc[1].layout_map_tags = tags; - } - - // Try to sniff a reasonable channel order, otherwise output the - // channels in the order the PCE declared them. - if (avctx->request_channel_layout != AV_CH_LAYOUT_NATIVE) - layout = sniff_channel_order(layout_map, tags); - for (i = 0; i < tags; i++) { - int type = layout_map[i][0]; - int id = layout_map[i][1]; - int position = layout_map[i][2]; - // Allocate or free elements depending on if they are in the - // current program configuration. - ret = che_configure(ac, position, type, id, &channels); - if (ret < 0) - return ret; - } - if (ac->oc[1].m4ac.ps == 1 && channels == 2) { - if (layout == AV_CH_FRONT_CENTER) { - layout = AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT; - } else { - layout = 0; - } - } - - memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); - if (layout) avctx->channel_layout = layout; - ac->oc[1].channel_layout = layout; - avctx->channels = ac->oc[1].channels = channels; - ac->oc[1].status = oc_type; - - if (get_new_frame) { - if ((ret = frame_configure_elements(ac->avctx)) < 0) - return ret; - } - - return 0; -} - -static void flush(AVCodecContext *avctx) -{ - AACContext *ac= avctx->priv_data; - int type, i, j; - - for (type = 3; type >= 0; type--) { - for (i = 0; i < MAX_ELEM_ID; i++) { - ChannelElement *che = ac->che[type][i]; - if (che) { - for (j = 0; j <= 1; j++) { - memset(che->ch[j].saved, 0, sizeof(che->ch[j].saved)); - } - } - } - } -} - -/** - * Set up channel positions based on a default channel configuration - * as specified in table 1.17. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int set_default_channel_config(AVCodecContext *avctx, - uint8_t (*layout_map)[3], - int *tags, - int channel_config) -{ - if (channel_config < 1 || channel_config > 7) { - av_log(avctx, AV_LOG_ERROR, - "invalid default channel configuration (%d)\n", - channel_config); - return AVERROR_INVALIDDATA; - } - *tags = tags_per_config[channel_config]; - memcpy(layout_map, aac_channel_layout_map[channel_config - 1], - *tags * sizeof(*layout_map)); - - /* - * AAC specification has 7.1(wide) as a default layout for 8-channel streams. - * However, at least Nero AAC encoder encodes 7.1 streams using the default - * channel config 7, mapping the side channels of the original audio stream - * to the second AAC_CHANNEL_FRONT pair in the AAC stream. Similarly, e.g. FAAD - * decodes the second AAC_CHANNEL_FRONT pair as side channels, therefore decoding - * the incorrect streams as if they were correct (and as the encoder intended). - * - * As actual intended 7.1(wide) streams are very rare, default to assuming a - * 7.1 layout was intended. - */ - if (channel_config == 7 && avctx->strict_std_compliance < FF_COMPLIANCE_STRICT) { - av_log(avctx, AV_LOG_INFO, "Assuming an incorrectly encoded 7.1 channel layout" - " instead of a spec-compliant 7.1(wide) layout, use -strict %d to decode" - " according to the specification instead.\n", FF_COMPLIANCE_STRICT); - layout_map[2][2] = AAC_CHANNEL_SIDE; - } - - return 0; -} - -static ChannelElement *get_che(AACContext *ac, int type, int elem_id) -{ - /* For PCE based channel configurations map the channels solely based - * on tags. */ - if (!ac->oc[1].m4ac.chan_config) { - return ac->tag_che_map[type][elem_id]; - } - // Allow single CPE stereo files to be signalled with mono configuration. - if (!ac->tags_mapped && type == TYPE_CPE && - ac->oc[1].m4ac.chan_config == 1) { - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int layout_map_tags; - push_output_configuration(ac); - - av_log(ac->avctx, AV_LOG_DEBUG, "mono with CPE\n"); - - if (set_default_channel_config(ac->avctx, layout_map, - &layout_map_tags, 2) < 0) - return NULL; - if (output_configure(ac, layout_map, layout_map_tags, - OC_TRIAL_FRAME, 1) < 0) - return NULL; - - ac->oc[1].m4ac.chan_config = 2; - ac->oc[1].m4ac.ps = 0; - } - // And vice-versa - if (!ac->tags_mapped && type == TYPE_SCE && - ac->oc[1].m4ac.chan_config == 2) { - uint8_t layout_map[MAX_ELEM_ID * 4][3]; - int layout_map_tags; - push_output_configuration(ac); - - av_log(ac->avctx, AV_LOG_DEBUG, "stereo with SCE\n"); - - if (set_default_channel_config(ac->avctx, layout_map, - &layout_map_tags, 1) < 0) - return NULL; - if (output_configure(ac, layout_map, layout_map_tags, - OC_TRIAL_FRAME, 1) < 0) - return NULL; - - ac->oc[1].m4ac.chan_config = 1; - if (ac->oc[1].m4ac.sbr) - ac->oc[1].m4ac.ps = -1; - } - /* For indexed channel configurations map the channels solely based - * on position. */ - switch (ac->oc[1].m4ac.chan_config) { - case 7: - if (ac->tags_mapped == 3 && type == TYPE_CPE) { - ac->tags_mapped++; - return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; - } - case 6: - /* Some streams incorrectly code 5.1 audio as - * SCE[0] CPE[0] CPE[1] SCE[1] - * instead of - * SCE[0] CPE[0] CPE[1] LFE[0]. - * If we seem to have encountered such a stream, transfer - * the LFE[0] element to the SCE[1]'s mapping */ - if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) { - ac->tags_mapped++; - return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0]; - } - case 5: - if (ac->tags_mapped == 2 && type == TYPE_CPE) { - ac->tags_mapped++; - return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1]; - } - case 4: - if (ac->tags_mapped == 2 && - ac->oc[1].m4ac.chan_config == 4 && - type == TYPE_SCE) { - ac->tags_mapped++; - return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1]; - } - case 3: - case 2: - if (ac->tags_mapped == (ac->oc[1].m4ac.chan_config != 2) && - type == TYPE_CPE) { - ac->tags_mapped++; - return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0]; - } else if (ac->oc[1].m4ac.chan_config == 2) { - return NULL; - } - case 1: - if (!ac->tags_mapped && type == TYPE_SCE) { - ac->tags_mapped++; - return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0]; - } - default: - return NULL; - } -} - -/** - * Decode an array of 4 bit element IDs, optionally interleaved with a - * stereo/mono switching bit. - * - * @param type speaker type/position for these channels - */ -static void decode_channel_map(uint8_t layout_map[][3], - enum ChannelPosition type, - GetBitContext *gb, int n) -{ - while (n--) { - enum RawDataBlockType syn_ele; - switch (type) { - case AAC_CHANNEL_FRONT: - case AAC_CHANNEL_BACK: - case AAC_CHANNEL_SIDE: - syn_ele = get_bits1(gb); - break; - case AAC_CHANNEL_CC: - skip_bits1(gb); - syn_ele = TYPE_CCE; - break; - case AAC_CHANNEL_LFE: - syn_ele = TYPE_LFE; - break; - default: - av_assert0(0); - } - layout_map[0][0] = syn_ele; - layout_map[0][1] = get_bits(gb, 4); - layout_map[0][2] = type; - layout_map++; - } -} - -/** - * Decode program configuration element; reference: table 4.2. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_pce(AVCodecContext *avctx, MPEG4AudioConfig *m4ac, - uint8_t (*layout_map)[3], - GetBitContext *gb) -{ - int num_front, num_side, num_back, num_lfe, num_assoc_data, num_cc; - int sampling_index; - int comment_len; - int tags; - - skip_bits(gb, 2); // object_type - - sampling_index = get_bits(gb, 4); - if (m4ac->sampling_index != sampling_index) - av_log(avctx, AV_LOG_WARNING, - "Sample rate index in program config element does not " - "match the sample rate index configured by the container.\n"); - - num_front = get_bits(gb, 4); - num_side = get_bits(gb, 4); - num_back = get_bits(gb, 4); - num_lfe = get_bits(gb, 2); - num_assoc_data = get_bits(gb, 3); - num_cc = get_bits(gb, 4); - - if (get_bits1(gb)) - skip_bits(gb, 4); // mono_mixdown_tag - if (get_bits1(gb)) - skip_bits(gb, 4); // stereo_mixdown_tag - - if (get_bits1(gb)) - skip_bits(gb, 3); // mixdown_coeff_index and pseudo_surround - - if (get_bits_left(gb) < 4 * (num_front + num_side + num_back + num_lfe + num_assoc_data + num_cc)) { - av_log(avctx, AV_LOG_ERROR, "decode_pce: " overread_err); - return -1; - } - decode_channel_map(layout_map , AAC_CHANNEL_FRONT, gb, num_front); - tags = num_front; - decode_channel_map(layout_map + tags, AAC_CHANNEL_SIDE, gb, num_side); - tags += num_side; - decode_channel_map(layout_map + tags, AAC_CHANNEL_BACK, gb, num_back); - tags += num_back; - decode_channel_map(layout_map + tags, AAC_CHANNEL_LFE, gb, num_lfe); - tags += num_lfe; - - skip_bits_long(gb, 4 * num_assoc_data); - - decode_channel_map(layout_map + tags, AAC_CHANNEL_CC, gb, num_cc); - tags += num_cc; - - align_get_bits(gb); - - /* comment field, first byte is length */ - comment_len = get_bits(gb, 8) * 8; - if (get_bits_left(gb) < comment_len) { - av_log(avctx, AV_LOG_ERROR, "decode_pce: " overread_err); - return AVERROR_INVALIDDATA; - } - skip_bits_long(gb, comment_len); - return tags; -} - -/** - * Decode GA "General Audio" specific configuration; reference: table 4.1. - * - * @param ac pointer to AACContext, may be null - * @param avctx pointer to AVCCodecContext, used for logging - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx, - GetBitContext *gb, - MPEG4AudioConfig *m4ac, - int channel_config) -{ - int extension_flag, ret, ep_config, res_flags; - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int tags = 0; - - if (get_bits1(gb)) { // frameLengthFlag - avpriv_request_sample(avctx, "960/120 MDCT window"); - return AVERROR_PATCHWELCOME; - } - - if (get_bits1(gb)) // dependsOnCoreCoder - skip_bits(gb, 14); // coreCoderDelay - extension_flag = get_bits1(gb); - - if (m4ac->object_type == AOT_AAC_SCALABLE || - m4ac->object_type == AOT_ER_AAC_SCALABLE) - skip_bits(gb, 3); // layerNr - - if (channel_config == 0) { - skip_bits(gb, 4); // element_instance_tag - tags = decode_pce(avctx, m4ac, layout_map, gb); - if (tags < 0) - return tags; - } else { - if ((ret = set_default_channel_config(avctx, layout_map, - &tags, channel_config))) - return ret; - } - - if (count_channels(layout_map, tags) > 1) { - m4ac->ps = 0; - } else if (m4ac->sbr == 1 && m4ac->ps == -1) - m4ac->ps = 1; - - if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR, 0))) - return ret; - - if (extension_flag) { - switch (m4ac->object_type) { - case AOT_ER_BSAC: - skip_bits(gb, 5); // numOfSubFrame - skip_bits(gb, 11); // layer_length - break; - case AOT_ER_AAC_LC: - case AOT_ER_AAC_LTP: - case AOT_ER_AAC_SCALABLE: - case AOT_ER_AAC_LD: - res_flags = get_bits(gb, 3); - if (res_flags) { - avpriv_report_missing_feature(avctx, - "AAC data resilience (flags %x)", - res_flags); - return AVERROR_PATCHWELCOME; - } - break; - } - skip_bits1(gb); // extensionFlag3 (TBD in version 3) - } - switch (m4ac->object_type) { - case AOT_ER_AAC_LC: - case AOT_ER_AAC_LTP: - case AOT_ER_AAC_SCALABLE: - case AOT_ER_AAC_LD: - ep_config = get_bits(gb, 2); - if (ep_config) { - avpriv_report_missing_feature(avctx, - "epConfig %d", ep_config); - return AVERROR_PATCHWELCOME; - } - } - return 0; -} - -static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx, - GetBitContext *gb, - MPEG4AudioConfig *m4ac, - int channel_config) -{ - int ret, ep_config, res_flags; - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int tags = 0; - const int ELDEXT_TERM = 0; - - m4ac->ps = 0; - m4ac->sbr = 0; - - if (get_bits1(gb)) { // frameLengthFlag - avpriv_request_sample(avctx, "960/120 MDCT window"); - return AVERROR_PATCHWELCOME; - } - - res_flags = get_bits(gb, 3); - if (res_flags) { - avpriv_report_missing_feature(avctx, - "AAC data resilience (flags %x)", - res_flags); - return AVERROR_PATCHWELCOME; - } - - if (get_bits1(gb)) { // ldSbrPresentFlag - avpriv_report_missing_feature(avctx, - "Low Delay SBR"); - return AVERROR_PATCHWELCOME; - } - - while (get_bits(gb, 4) != ELDEXT_TERM) { - int len = get_bits(gb, 4); - if (len == 15) - len += get_bits(gb, 8); - if (len == 15 + 255) - len += get_bits(gb, 16); - if (get_bits_left(gb) < len * 8 + 4) { - av_log(ac->avctx, AV_LOG_ERROR, overread_err); - return AVERROR_INVALIDDATA; - } - skip_bits_long(gb, 8 * len); - } - - if ((ret = set_default_channel_config(avctx, layout_map, - &tags, channel_config))) - return ret; - - if (ac && (ret = output_configure(ac, layout_map, tags, OC_GLOBAL_HDR, 0))) - return ret; - - ep_config = get_bits(gb, 2); - if (ep_config) { - avpriv_report_missing_feature(avctx, - "epConfig %d", ep_config); - return AVERROR_PATCHWELCOME; - } - return 0; -} - -/** - * Decode audio specific configuration; reference: table 1.13. - * - * @param ac pointer to AACContext, may be null - * @param avctx pointer to AVCCodecContext, used for logging - * @param m4ac pointer to MPEG4AudioConfig, used for parsing - * @param data pointer to buffer holding an audio specific config - * @param bit_size size of audio specific config or data in bits - * @param sync_extension look for an appended sync extension - * - * @return Returns error status or number of consumed bits. <0 - error - */ -static int decode_audio_specific_config(AACContext *ac, - AVCodecContext *avctx, - MPEG4AudioConfig *m4ac, - const uint8_t *data, int bit_size, - int sync_extension) -{ - GetBitContext gb; - int i, ret; - - av_dlog(avctx, "audio specific config size %d\n", bit_size >> 3); - for (i = 0; i < bit_size >> 3; i++) - av_dlog(avctx, "%02x ", data[i]); - av_dlog(avctx, "\n"); - - if ((ret = init_get_bits(&gb, data, bit_size)) < 0) - return ret; - - if ((i = avpriv_mpeg4audio_get_config(m4ac, data, bit_size, - sync_extension)) < 0) - return AVERROR_INVALIDDATA; - if (m4ac->sampling_index > 12) { - av_log(avctx, AV_LOG_ERROR, - "invalid sampling rate index %d\n", - m4ac->sampling_index); - return AVERROR_INVALIDDATA; - } - if (m4ac->object_type == AOT_ER_AAC_LD && - (m4ac->sampling_index < 3 || m4ac->sampling_index > 7)) { - av_log(avctx, AV_LOG_ERROR, - "invalid low delay sampling rate index %d\n", - m4ac->sampling_index); - return AVERROR_INVALIDDATA; - } - - skip_bits_long(&gb, i); - - switch (m4ac->object_type) { - case AOT_AAC_MAIN: - case AOT_AAC_LC: - case AOT_AAC_LTP: - case AOT_ER_AAC_LC: - case AOT_ER_AAC_LD: - if ((ret = decode_ga_specific_config(ac, avctx, &gb, - m4ac, m4ac->chan_config)) < 0) - return ret; - break; - case AOT_ER_AAC_ELD: - if ((ret = decode_eld_specific_config(ac, avctx, &gb, - m4ac, m4ac->chan_config)) < 0) - return ret; - break; - default: - avpriv_report_missing_feature(avctx, - "Audio object type %s%d", - m4ac->sbr == 1 ? "SBR+" : "", - m4ac->object_type); - return AVERROR(ENOSYS); - } - - av_dlog(avctx, - "AOT %d chan config %d sampling index %d (%d) SBR %d PS %d\n", - m4ac->object_type, m4ac->chan_config, m4ac->sampling_index, - m4ac->sample_rate, m4ac->sbr, - m4ac->ps); - - return get_bits_count(&gb); -} - -/** - * linear congruential pseudorandom number generator - * - * @param previous_val pointer to the current state of the generator - * - * @return Returns a 32-bit pseudorandom integer - */ -static av_always_inline int lcg_random(unsigned previous_val) -{ - union { unsigned u; int s; } v = { previous_val * 1664525u + 1013904223 }; - return v.s; -} - -static av_always_inline void reset_predict_state(PredictorState *ps) -{ - ps->r0 = 0.0f; - ps->r1 = 0.0f; - ps->cor0 = 0.0f; - ps->cor1 = 0.0f; - ps->var0 = 1.0f; - ps->var1 = 1.0f; -} - -static void reset_all_predictors(PredictorState *ps) -{ - int i; - for (i = 0; i < MAX_PREDICTORS; i++) - reset_predict_state(&ps[i]); -} - -static int sample_rate_idx (int rate) -{ - if (92017 <= rate) return 0; - else if (75132 <= rate) return 1; - else if (55426 <= rate) return 2; - else if (46009 <= rate) return 3; - else if (37566 <= rate) return 4; - else if (27713 <= rate) return 5; - else if (23004 <= rate) return 6; - else if (18783 <= rate) return 7; - else if (13856 <= rate) return 8; - else if (11502 <= rate) return 9; - else if (9391 <= rate) return 10; - else return 11; -} - -static void reset_predictor_group(PredictorState *ps, int group_num) -{ - int i; - for (i = group_num - 1; i < MAX_PREDICTORS; i += 30) - reset_predict_state(&ps[i]); -} - -#define AAC_INIT_VLC_STATIC(num, size) \ - INIT_VLC_STATIC(&vlc_spectral[num], 8, ff_aac_spectral_sizes[num], \ - ff_aac_spectral_bits[num], sizeof(ff_aac_spectral_bits[num][0]), \ - sizeof(ff_aac_spectral_bits[num][0]), \ - ff_aac_spectral_codes[num], sizeof(ff_aac_spectral_codes[num][0]), \ - sizeof(ff_aac_spectral_codes[num][0]), \ - size); - -static void aacdec_init(AACContext *ac); - -static av_cold int aac_decode_init(AVCodecContext *avctx) -{ - AACContext *ac = avctx->priv_data; - int ret; - - ac->avctx = avctx; - ac->oc[1].m4ac.sample_rate = avctx->sample_rate; - - aacdec_init(ac); - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - if (avctx->extradata_size > 0) { - if ((ret = decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, - avctx->extradata, - avctx->extradata_size * 8, - 1)) < 0) - return ret; - } else { - int sr, i; - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int layout_map_tags; - - sr = sample_rate_idx(avctx->sample_rate); - ac->oc[1].m4ac.sampling_index = sr; - ac->oc[1].m4ac.channels = avctx->channels; - ac->oc[1].m4ac.sbr = -1; - ac->oc[1].m4ac.ps = -1; - - for (i = 0; i < FF_ARRAY_ELEMS(ff_mpeg4audio_channels); i++) - if (ff_mpeg4audio_channels[i] == avctx->channels) - break; - if (i == FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) { - i = 0; - } - ac->oc[1].m4ac.chan_config = i; - - if (ac->oc[1].m4ac.chan_config) { - int ret = set_default_channel_config(avctx, layout_map, - &layout_map_tags, ac->oc[1].m4ac.chan_config); - if (!ret) - output_configure(ac, layout_map, layout_map_tags, - OC_GLOBAL_HDR, 0); - else if (avctx->err_recognition & AV_EF_EXPLODE) - return AVERROR_INVALIDDATA; - } - } - - if (avctx->channels > MAX_CHANNELS) { - av_log(avctx, AV_LOG_ERROR, "Too many channels\n"); - return AVERROR_INVALIDDATA; - } - - AAC_INIT_VLC_STATIC( 0, 304); - AAC_INIT_VLC_STATIC( 1, 270); - AAC_INIT_VLC_STATIC( 2, 550); - AAC_INIT_VLC_STATIC( 3, 300); - AAC_INIT_VLC_STATIC( 4, 328); - AAC_INIT_VLC_STATIC( 5, 294); - AAC_INIT_VLC_STATIC( 6, 306); - AAC_INIT_VLC_STATIC( 7, 268); - AAC_INIT_VLC_STATIC( 8, 510); - AAC_INIT_VLC_STATIC( 9, 366); - AAC_INIT_VLC_STATIC(10, 462); - - ff_aac_sbr_init(); - - ff_fmt_convert_init(&ac->fmt_conv, avctx); - avpriv_float_dsp_init(&ac->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - - ac->random_state = 0x1f2e3d4c; - - ff_aac_tableinit(); - - INIT_VLC_STATIC(&vlc_scalefactors, 7, - FF_ARRAY_ELEMS(ff_aac_scalefactor_code), - ff_aac_scalefactor_bits, - sizeof(ff_aac_scalefactor_bits[0]), - sizeof(ff_aac_scalefactor_bits[0]), - ff_aac_scalefactor_code, - sizeof(ff_aac_scalefactor_code[0]), - sizeof(ff_aac_scalefactor_code[0]), - 352); - - ff_mdct_init(&ac->mdct, 11, 1, 1.0 / (32768.0 * 1024.0)); - ff_mdct_init(&ac->mdct_ld, 10, 1, 1.0 / (32768.0 * 512.0)); - ff_mdct_init(&ac->mdct_small, 8, 1, 1.0 / (32768.0 * 128.0)); - ff_mdct_init(&ac->mdct_ltp, 11, 0, -2.0 * 32768.0); - // window initialization - ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); - ff_kbd_window_init(ff_aac_kbd_short_128, 6.0, 128); - ff_init_ff_sine_windows(10); - ff_init_ff_sine_windows( 9); - ff_init_ff_sine_windows( 7); - - cbrt_tableinit(); - - return 0; -} - -/** - * Skip data_stream_element; reference: table 4.10. - */ -static int skip_data_stream_element(AACContext *ac, GetBitContext *gb) -{ - int byte_align = get_bits1(gb); - int count = get_bits(gb, 8); - if (count == 255) - count += get_bits(gb, 8); - if (byte_align) - align_get_bits(gb); - - if (get_bits_left(gb) < 8 * count) { - av_log(ac->avctx, AV_LOG_ERROR, "skip_data_stream_element: "overread_err); - return AVERROR_INVALIDDATA; - } - skip_bits_long(gb, 8 * count); - return 0; -} - -static int decode_prediction(AACContext *ac, IndividualChannelStream *ics, - GetBitContext *gb) -{ - int sfb; - if (get_bits1(gb)) { - ics->predictor_reset_group = get_bits(gb, 5); - if (ics->predictor_reset_group == 0 || - ics->predictor_reset_group > 30) { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid Predictor Reset Group.\n"); - return AVERROR_INVALIDDATA; - } - } - for (sfb = 0; sfb < FFMIN(ics->max_sfb, ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]); sfb++) { - ics->prediction_used[sfb] = get_bits1(gb); - } - return 0; -} - -/** - * Decode Long Term Prediction data; reference: table 4.xx. - */ -static void decode_ltp(LongTermPrediction *ltp, - GetBitContext *gb, uint8_t max_sfb) -{ - int sfb; - - ltp->lag = get_bits(gb, 11); - ltp->coef = ltp_coef[get_bits(gb, 3)]; - for (sfb = 0; sfb < FFMIN(max_sfb, MAX_LTP_LONG_SFB); sfb++) - ltp->used[sfb] = get_bits1(gb); -} - -/** - * Decode Individual Channel Stream info; reference: table 4.6. - */ -static int decode_ics_info(AACContext *ac, IndividualChannelStream *ics, - GetBitContext *gb) -{ - int aot = ac->oc[1].m4ac.object_type; - if (aot != AOT_ER_AAC_ELD) { - if (get_bits1(gb)) { - av_log(ac->avctx, AV_LOG_ERROR, "Reserved bit set.\n"); - return AVERROR_INVALIDDATA; - } - ics->window_sequence[1] = ics->window_sequence[0]; - ics->window_sequence[0] = get_bits(gb, 2); - if (aot == AOT_ER_AAC_LD && - ics->window_sequence[0] != ONLY_LONG_SEQUENCE) { - av_log(ac->avctx, AV_LOG_ERROR, - "AAC LD is only defined for ONLY_LONG_SEQUENCE but " - "window sequence %d found.\n", ics->window_sequence[0]); - ics->window_sequence[0] = ONLY_LONG_SEQUENCE; - return AVERROR_INVALIDDATA; - } - ics->use_kb_window[1] = ics->use_kb_window[0]; - ics->use_kb_window[0] = get_bits1(gb); - } - ics->num_window_groups = 1; - ics->group_len[0] = 1; - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - int i; - ics->max_sfb = get_bits(gb, 4); - for (i = 0; i < 7; i++) { - if (get_bits1(gb)) { - ics->group_len[ics->num_window_groups - 1]++; - } else { - ics->num_window_groups++; - ics->group_len[ics->num_window_groups - 1] = 1; - } - } - ics->num_windows = 8; - ics->swb_offset = ff_swb_offset_128[ac->oc[1].m4ac.sampling_index]; - ics->num_swb = ff_aac_num_swb_128[ac->oc[1].m4ac.sampling_index]; - ics->tns_max_bands = ff_tns_max_bands_128[ac->oc[1].m4ac.sampling_index]; - ics->predictor_present = 0; - } else { - ics->max_sfb = get_bits(gb, 6); - ics->num_windows = 1; - if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD) { - ics->swb_offset = ff_swb_offset_512[ac->oc[1].m4ac.sampling_index]; - ics->num_swb = ff_aac_num_swb_512[ac->oc[1].m4ac.sampling_index]; - ics->tns_max_bands = ff_tns_max_bands_512[ac->oc[1].m4ac.sampling_index]; - if (!ics->num_swb || !ics->swb_offset) - return AVERROR_BUG; - } else { - ics->swb_offset = ff_swb_offset_1024[ac->oc[1].m4ac.sampling_index]; - ics->num_swb = ff_aac_num_swb_1024[ac->oc[1].m4ac.sampling_index]; - ics->tns_max_bands = ff_tns_max_bands_1024[ac->oc[1].m4ac.sampling_index]; - } - if (aot != AOT_ER_AAC_ELD) { - ics->predictor_present = get_bits1(gb); - ics->predictor_reset_group = 0; - } - if (ics->predictor_present) { - if (aot == AOT_AAC_MAIN) { - if (decode_prediction(ac, ics, gb)) { - goto fail; - } - } else if (aot == AOT_AAC_LC || - aot == AOT_ER_AAC_LC) { - av_log(ac->avctx, AV_LOG_ERROR, - "Prediction is not allowed in AAC-LC.\n"); - goto fail; - } else { - if (aot == AOT_ER_AAC_LD) { - av_log(ac->avctx, AV_LOG_ERROR, - "LTP in ER AAC LD not yet implemented.\n"); - return AVERROR_PATCHWELCOME; - } - if ((ics->ltp.present = get_bits(gb, 1))) - decode_ltp(&ics->ltp, gb, ics->max_sfb); - } - } - } - - if (ics->max_sfb > ics->num_swb) { - av_log(ac->avctx, AV_LOG_ERROR, - "Number of scalefactor bands in group (%d) " - "exceeds limit (%d).\n", - ics->max_sfb, ics->num_swb); - goto fail; - } - - return 0; -fail: - ics->max_sfb = 0; - return AVERROR_INVALIDDATA; -} - -/** - * Decode band types (section_data payload); reference: table 4.46. - * - * @param band_type array of the used band type - * @param band_type_run_end array of the last scalefactor band of a band type run - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_band_types(AACContext *ac, enum BandType band_type[120], - int band_type_run_end[120], GetBitContext *gb, - IndividualChannelStream *ics) -{ - int g, idx = 0; - const int bits = (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) ? 3 : 5; - for (g = 0; g < ics->num_window_groups; g++) { - int k = 0; - while (k < ics->max_sfb) { - uint8_t sect_end = k; - int sect_len_incr; - int sect_band_type = get_bits(gb, 4); - if (sect_band_type == 12) { - av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n"); - return AVERROR_INVALIDDATA; - } - do { - sect_len_incr = get_bits(gb, bits); - sect_end += sect_len_incr; - if (get_bits_left(gb) < 0) { - av_log(ac->avctx, AV_LOG_ERROR, "decode_band_types: "overread_err); - return AVERROR_INVALIDDATA; - } - if (sect_end > ics->max_sfb) { - av_log(ac->avctx, AV_LOG_ERROR, - "Number of bands (%d) exceeds limit (%d).\n", - sect_end, ics->max_sfb); - return AVERROR_INVALIDDATA; - } - } while (sect_len_incr == (1 << bits) - 1); - for (; k < sect_end; k++) { - band_type [idx] = sect_band_type; - band_type_run_end[idx++] = sect_end; - } - } - } - return 0; -} - -/** - * Decode scalefactors; reference: table 4.47. - * - * @param global_gain first scalefactor value as scalefactors are differentially coded - * @param band_type array of the used band type - * @param band_type_run_end array of the last scalefactor band of a band type run - * @param sf array of scalefactors or intensity stereo positions - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb, - unsigned int global_gain, - IndividualChannelStream *ics, - enum BandType band_type[120], - int band_type_run_end[120]) -{ - int g, i, idx = 0; - int offset[3] = { global_gain, global_gain - 90, 0 }; - int clipped_offset; - int noise_flag = 1; - for (g = 0; g < ics->num_window_groups; g++) { - for (i = 0; i < ics->max_sfb;) { - int run_end = band_type_run_end[idx]; - if (band_type[idx] == ZERO_BT) { - for (; i < run_end; i++, idx++) - sf[idx] = 0.0; - } else if ((band_type[idx] == INTENSITY_BT) || - (band_type[idx] == INTENSITY_BT2)) { - for (; i < run_end; i++, idx++) { - offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; - clipped_offset = av_clip(offset[2], -155, 100); - if (offset[2] != clipped_offset) { - avpriv_request_sample(ac->avctx, - "If you heard an audible artifact, there may be a bug in the decoder. " - "Clipped intensity stereo position (%d -> %d)", - offset[2], clipped_offset); - } - sf[idx] = ff_aac_pow2sf_tab[-clipped_offset + POW_SF2_ZERO]; - } - } else if (band_type[idx] == NOISE_BT) { - for (; i < run_end; i++, idx++) { - if (noise_flag-- > 0) - offset[1] += get_bits(gb, 9) - 256; - else - offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; - clipped_offset = av_clip(offset[1], -100, 155); - if (offset[1] != clipped_offset) { - avpriv_request_sample(ac->avctx, - "If you heard an audible artifact, there may be a bug in the decoder. " - "Clipped noise gain (%d -> %d)", - offset[1], clipped_offset); - } - sf[idx] = -ff_aac_pow2sf_tab[clipped_offset + POW_SF2_ZERO]; - } - } else { - for (; i < run_end; i++, idx++) { - offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; - if (offset[0] > 255U) { - av_log(ac->avctx, AV_LOG_ERROR, - "Scalefactor (%d) out of range.\n", offset[0]); - return AVERROR_INVALIDDATA; - } - sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO]; - } - } - } - } - return 0; -} - -/** - * Decode pulse data; reference: table 4.7. - */ -static int decode_pulses(Pulse *pulse, GetBitContext *gb, - const uint16_t *swb_offset, int num_swb) -{ - int i, pulse_swb; - pulse->num_pulse = get_bits(gb, 2) + 1; - pulse_swb = get_bits(gb, 6); - if (pulse_swb >= num_swb) - return -1; - pulse->pos[0] = swb_offset[pulse_swb]; - pulse->pos[0] += get_bits(gb, 5); - if (pulse->pos[0] >= swb_offset[num_swb]) - return -1; - pulse->amp[0] = get_bits(gb, 4); - for (i = 1; i < pulse->num_pulse; i++) { - pulse->pos[i] = get_bits(gb, 5) + pulse->pos[i - 1]; - if (pulse->pos[i] >= swb_offset[num_swb]) - return -1; - pulse->amp[i] = get_bits(gb, 4); - } - return 0; -} - -/** - * Decode Temporal Noise Shaping data; reference: table 4.48. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_tns(AACContext *ac, TemporalNoiseShaping *tns, - GetBitContext *gb, const IndividualChannelStream *ics) -{ - int w, filt, i, coef_len, coef_res, coef_compress; - const int is8 = ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE; - const int tns_max_order = is8 ? 7 : ac->oc[1].m4ac.object_type == AOT_AAC_MAIN ? 20 : 12; - for (w = 0; w < ics->num_windows; w++) { - if ((tns->n_filt[w] = get_bits(gb, 2 - is8))) { - coef_res = get_bits1(gb); - - for (filt = 0; filt < tns->n_filt[w]; filt++) { - int tmp2_idx; - tns->length[w][filt] = get_bits(gb, 6 - 2 * is8); - - if ((tns->order[w][filt] = get_bits(gb, 5 - 2 * is8)) > tns_max_order) { - av_log(ac->avctx, AV_LOG_ERROR, - "TNS filter order %d is greater than maximum %d.\n", - tns->order[w][filt], tns_max_order); - tns->order[w][filt] = 0; - return AVERROR_INVALIDDATA; - } - if (tns->order[w][filt]) { - tns->direction[w][filt] = get_bits1(gb); - coef_compress = get_bits1(gb); - coef_len = coef_res + 3 - coef_compress; - tmp2_idx = 2 * coef_compress + coef_res; - - for (i = 0; i < tns->order[w][filt]; i++) - tns->coef[w][filt][i] = tns_tmp2_map[tmp2_idx][get_bits(gb, coef_len)]; - } - } - } - } - return 0; -} - -/** - * Decode Mid/Side data; reference: table 4.54. - * - * @param ms_present Indicates mid/side stereo presence. [0] mask is all 0s; - * [1] mask is decoded from bitstream; [2] mask is all 1s; - * [3] reserved for scalable AAC - */ -static void decode_mid_side_stereo(ChannelElement *cpe, GetBitContext *gb, - int ms_present) -{ - int idx; - if (ms_present == 1) { - for (idx = 0; - idx < cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb; - idx++) - cpe->ms_mask[idx] = get_bits1(gb); - } else if (ms_present == 2) { - memset(cpe->ms_mask, 1, sizeof(cpe->ms_mask[0]) * cpe->ch[0].ics.num_window_groups * cpe->ch[0].ics.max_sfb); - } -} - -#ifndef VMUL2 -static inline float *VMUL2(float *dst, const float *v, unsigned idx, - const float *scale) -{ - float s = *scale; - *dst++ = v[idx & 15] * s; - *dst++ = v[idx>>4 & 15] * s; - return dst; -} -#endif - -#ifndef VMUL4 -static inline float *VMUL4(float *dst, const float *v, unsigned idx, - const float *scale) -{ - float s = *scale; - *dst++ = v[idx & 3] * s; - *dst++ = v[idx>>2 & 3] * s; - *dst++ = v[idx>>4 & 3] * s; - *dst++ = v[idx>>6 & 3] * s; - return dst; -} -#endif - -#ifndef VMUL2S -static inline float *VMUL2S(float *dst, const float *v, unsigned idx, - unsigned sign, const float *scale) -{ - union av_intfloat32 s0, s1; - - s0.f = s1.f = *scale; - s0.i ^= sign >> 1 << 31; - s1.i ^= sign << 31; - - *dst++ = v[idx & 15] * s0.f; - *dst++ = v[idx>>4 & 15] * s1.f; - - return dst; -} -#endif - -#ifndef VMUL4S -static inline float *VMUL4S(float *dst, const float *v, unsigned idx, - unsigned sign, const float *scale) -{ - unsigned nz = idx >> 12; - union av_intfloat32 s = { .f = *scale }; - union av_intfloat32 t; - - t.i = s.i ^ (sign & 1U<<31); - *dst++ = v[idx & 3] * t.f; - - sign <<= nz & 1; nz >>= 1; - t.i = s.i ^ (sign & 1U<<31); - *dst++ = v[idx>>2 & 3] * t.f; - - sign <<= nz & 1; nz >>= 1; - t.i = s.i ^ (sign & 1U<<31); - *dst++ = v[idx>>4 & 3] * t.f; - - sign <<= nz & 1; - t.i = s.i ^ (sign & 1U<<31); - *dst++ = v[idx>>6 & 3] * t.f; - - return dst; -} -#endif - -/** - * Decode spectral data; reference: table 4.50. - * Dequantize and scale spectral data; reference: 4.6.3.3. - * - * @param coef array of dequantized, scaled spectral data - * @param sf array of scalefactors or intensity stereo positions - * @param pulse_present set if pulses are present - * @param pulse pointer to pulse data struct - * @param band_type array of the used band type - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024], - GetBitContext *gb, const float sf[120], - int pulse_present, const Pulse *pulse, - const IndividualChannelStream *ics, - enum BandType band_type[120]) -{ - int i, k, g, idx = 0; - const int c = 1024 / ics->num_windows; - const uint16_t *offsets = ics->swb_offset; - float *coef_base = coef; - - for (g = 0; g < ics->num_windows; g++) - memset(coef + g * 128 + offsets[ics->max_sfb], 0, - sizeof(float) * (c - offsets[ics->max_sfb])); - - for (g = 0; g < ics->num_window_groups; g++) { - unsigned g_len = ics->group_len[g]; - - for (i = 0; i < ics->max_sfb; i++, idx++) { - const unsigned cbt_m1 = band_type[idx] - 1; - float *cfo = coef + offsets[i]; - int off_len = offsets[i + 1] - offsets[i]; - int group; - - if (cbt_m1 >= INTENSITY_BT2 - 1) { - for (group = 0; group < g_len; group++, cfo+=128) { - memset(cfo, 0, off_len * sizeof(float)); - } - } else if (cbt_m1 == NOISE_BT - 1) { - for (group = 0; group < g_len; group++, cfo+=128) { - float scale; - float band_energy; - - for (k = 0; k < off_len; k++) { - ac->random_state = lcg_random(ac->random_state); - cfo[k] = ac->random_state; - } - - band_energy = ac->fdsp.scalarproduct_float(cfo, cfo, off_len); - scale = sf[idx] / sqrtf(band_energy); - ac->fdsp.vector_fmul_scalar(cfo, cfo, scale, off_len); - } - } else { - const float *vq = ff_aac_codebook_vector_vals[cbt_m1]; - const uint16_t *cb_vector_idx = ff_aac_codebook_vector_idx[cbt_m1]; - VLC_TYPE (*vlc_tab)[2] = vlc_spectral[cbt_m1].table; - OPEN_READER(re, gb); - - switch (cbt_m1 >> 1) { - case 0: - for (group = 0; group < g_len; group++, cfo+=128) { - float *cf = cfo; - int len = off_len; - - do { - int code; - unsigned cb_idx; - - UPDATE_CACHE(re, gb); - GET_VLC(code, re, gb, vlc_tab, 8, 2); - cb_idx = cb_vector_idx[code]; - cf = VMUL4(cf, vq, cb_idx, sf + idx); - } while (len -= 4); - } - break; - - case 1: - for (group = 0; group < g_len; group++, cfo+=128) { - float *cf = cfo; - int len = off_len; - - do { - int code; - unsigned nnz; - unsigned cb_idx; - uint32_t bits; - - UPDATE_CACHE(re, gb); - GET_VLC(code, re, gb, vlc_tab, 8, 2); - cb_idx = cb_vector_idx[code]; - nnz = cb_idx >> 8 & 15; - bits = nnz ? GET_CACHE(re, gb) : 0; - LAST_SKIP_BITS(re, gb, nnz); - cf = VMUL4S(cf, vq, cb_idx, bits, sf + idx); - } while (len -= 4); - } - break; - - case 2: - for (group = 0; group < g_len; group++, cfo+=128) { - float *cf = cfo; - int len = off_len; - - do { - int code; - unsigned cb_idx; - - UPDATE_CACHE(re, gb); - GET_VLC(code, re, gb, vlc_tab, 8, 2); - cb_idx = cb_vector_idx[code]; - cf = VMUL2(cf, vq, cb_idx, sf + idx); - } while (len -= 2); - } - break; - - case 3: - case 4: - for (group = 0; group < g_len; group++, cfo+=128) { - float *cf = cfo; - int len = off_len; - - do { - int code; - unsigned nnz; - unsigned cb_idx; - unsigned sign; - - UPDATE_CACHE(re, gb); - GET_VLC(code, re, gb, vlc_tab, 8, 2); - cb_idx = cb_vector_idx[code]; - nnz = cb_idx >> 8 & 15; - sign = nnz ? SHOW_UBITS(re, gb, nnz) << (cb_idx >> 12) : 0; - LAST_SKIP_BITS(re, gb, nnz); - cf = VMUL2S(cf, vq, cb_idx, sign, sf + idx); - } while (len -= 2); - } - break; - - default: - for (group = 0; group < g_len; group++, cfo+=128) { - float *cf = cfo; - uint32_t *icf = (uint32_t *) cf; - int len = off_len; - - do { - int code; - unsigned nzt, nnz; - unsigned cb_idx; - uint32_t bits; - int j; - - UPDATE_CACHE(re, gb); - GET_VLC(code, re, gb, vlc_tab, 8, 2); - - if (!code) { - *icf++ = 0; - *icf++ = 0; - continue; - } - - cb_idx = cb_vector_idx[code]; - nnz = cb_idx >> 12; - nzt = cb_idx >> 8; - bits = SHOW_UBITS(re, gb, nnz) << (32-nnz); - LAST_SKIP_BITS(re, gb, nnz); - - for (j = 0; j < 2; j++) { - if (nzt & 1< 8) { - av_log(ac->avctx, AV_LOG_ERROR, "error in spectral data, ESC overflow\n"); - return AVERROR_INVALIDDATA; - } - - SKIP_BITS(re, gb, b + 1); - b += 4; - n = (1 << b) + SHOW_UBITS(re, gb, b); - LAST_SKIP_BITS(re, gb, b); - *icf++ = cbrt_tab[n] | (bits & 1U<<31); - bits <<= 1; - } else { - unsigned v = ((const uint32_t*)vq)[cb_idx & 15]; - *icf++ = (bits & 1U<<31) | v; - bits <<= !!v; - } - cb_idx >>= 4; - } - } while (len -= 2); - - ac->fdsp.vector_fmul_scalar(cfo, cfo, sf[idx], off_len); - } - } - - CLOSE_READER(re, gb); - } - } - coef += g_len << 7; - } - - if (pulse_present) { - idx = 0; - for (i = 0; i < pulse->num_pulse; i++) { - float co = coef_base[ pulse->pos[i] ]; - while (offsets[idx + 1] <= pulse->pos[i]) - idx++; - if (band_type[idx] != NOISE_BT && sf[idx]) { - float ico = -pulse->amp[i]; - if (co) { - co /= sf[idx]; - ico = co / sqrtf(sqrtf(fabsf(co))) + (co > 0 ? -ico : ico); - } - coef_base[ pulse->pos[i] ] = cbrtf(fabsf(ico)) * ico * sf[idx]; - } - } - } - return 0; -} - -static av_always_inline float flt16_round(float pf) -{ - union av_intfloat32 tmp; - tmp.f = pf; - tmp.i = (tmp.i + 0x00008000U) & 0xFFFF0000U; - return tmp.f; -} - -static av_always_inline float flt16_even(float pf) -{ - union av_intfloat32 tmp; - tmp.f = pf; - tmp.i = (tmp.i + 0x00007FFFU + (tmp.i & 0x00010000U >> 16)) & 0xFFFF0000U; - return tmp.f; -} - -static av_always_inline float flt16_trunc(float pf) -{ - union av_intfloat32 pun; - pun.f = pf; - pun.i &= 0xFFFF0000U; - return pun.f; -} - -static av_always_inline void predict(PredictorState *ps, float *coef, - int output_enable) -{ - const float a = 0.953125; // 61.0 / 64 - const float alpha = 0.90625; // 29.0 / 32 - float e0, e1; - float pv; - float k1, k2; - float r0 = ps->r0, r1 = ps->r1; - float cor0 = ps->cor0, cor1 = ps->cor1; - float var0 = ps->var0, var1 = ps->var1; - - k1 = var0 > 1 ? cor0 * flt16_even(a / var0) : 0; - k2 = var1 > 1 ? cor1 * flt16_even(a / var1) : 0; - - pv = flt16_round(k1 * r0 + k2 * r1); - if (output_enable) - *coef += pv; - - e0 = *coef; - e1 = e0 - k1 * r0; - - ps->cor1 = flt16_trunc(alpha * cor1 + r1 * e1); - ps->var1 = flt16_trunc(alpha * var1 + 0.5f * (r1 * r1 + e1 * e1)); - ps->cor0 = flt16_trunc(alpha * cor0 + r0 * e0); - ps->var0 = flt16_trunc(alpha * var0 + 0.5f * (r0 * r0 + e0 * e0)); - - ps->r1 = flt16_trunc(a * (r0 - k1 * e0)); - ps->r0 = flt16_trunc(a * e0); -} - -/** - * Apply AAC-Main style frequency domain prediction. - */ -static void apply_prediction(AACContext *ac, SingleChannelElement *sce) -{ - int sfb, k; - - if (!sce->ics.predictor_initialized) { - reset_all_predictors(sce->predictor_state); - sce->ics.predictor_initialized = 1; - } - - if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { - for (sfb = 0; - sfb < ff_aac_pred_sfb_max[ac->oc[1].m4ac.sampling_index]; - sfb++) { - for (k = sce->ics.swb_offset[sfb]; - k < sce->ics.swb_offset[sfb + 1]; - k++) { - predict(&sce->predictor_state[k], &sce->coeffs[k], - sce->ics.predictor_present && - sce->ics.prediction_used[sfb]); - } - } - if (sce->ics.predictor_reset_group) - reset_predictor_group(sce->predictor_state, - sce->ics.predictor_reset_group); - } else - reset_all_predictors(sce->predictor_state); -} - -/** - * Decode an individual_channel_stream payload; reference: table 4.44. - * - * @param common_window Channels have independent [0], or shared [1], Individual Channel Stream information. - * @param scale_flag scalable [1] or non-scalable [0] AAC (Unused until scalable AAC is implemented.) - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_ics(AACContext *ac, SingleChannelElement *sce, - GetBitContext *gb, int common_window, int scale_flag) -{ - Pulse pulse; - TemporalNoiseShaping *tns = &sce->tns; - IndividualChannelStream *ics = &sce->ics; - float *out = sce->coeffs; - int global_gain, eld_syntax, er_syntax, pulse_present = 0; - int ret; - - eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD; - er_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_LC || - ac->oc[1].m4ac.object_type == AOT_ER_AAC_LTP || - ac->oc[1].m4ac.object_type == AOT_ER_AAC_LD || - ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD; - - /* This assignment is to silence a GCC warning about the variable being used - * uninitialized when in fact it always is. - */ - pulse.num_pulse = 0; - - global_gain = get_bits(gb, 8); - - if (!common_window && !scale_flag) { - if (decode_ics_info(ac, ics, gb) < 0) - return AVERROR_INVALIDDATA; - } - - if ((ret = decode_band_types(ac, sce->band_type, - sce->band_type_run_end, gb, ics)) < 0) - return ret; - if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics, - sce->band_type, sce->band_type_run_end)) < 0) - return ret; - - pulse_present = 0; - if (!scale_flag) { - if (!eld_syntax && (pulse_present = get_bits1(gb))) { - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - av_log(ac->avctx, AV_LOG_ERROR, - "Pulse tool not allowed in eight short sequence.\n"); - return AVERROR_INVALIDDATA; - } - if (decode_pulses(&pulse, gb, ics->swb_offset, ics->num_swb)) { - av_log(ac->avctx, AV_LOG_ERROR, - "Pulse data corrupt or invalid.\n"); - return AVERROR_INVALIDDATA; - } - } - tns->present = get_bits1(gb); - if (tns->present && !er_syntax) - if (decode_tns(ac, tns, gb, ics) < 0) - return AVERROR_INVALIDDATA; - if (!eld_syntax && get_bits1(gb)) { - avpriv_request_sample(ac->avctx, "SSR"); - return AVERROR_PATCHWELCOME; - } - // I see no textual basis in the spec for this occuring after SSR gain - // control, but this is what both reference and real implmentations do - if (tns->present && er_syntax) - if (decode_tns(ac, tns, gb, ics) < 0) - return AVERROR_INVALIDDATA; - } - - if (decode_spectrum_and_dequant(ac, out, gb, sce->sf, pulse_present, - &pulse, ics, sce->band_type) < 0) - return AVERROR_INVALIDDATA; - - if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN && !common_window) - apply_prediction(ac, sce); - - return 0; -} - -/** - * Mid/Side stereo decoding; reference: 4.6.8.1.3. - */ -static void apply_mid_side_stereo(AACContext *ac, ChannelElement *cpe) -{ - const IndividualChannelStream *ics = &cpe->ch[0].ics; - float *ch0 = cpe->ch[0].coeffs; - float *ch1 = cpe->ch[1].coeffs; - int g, i, group, idx = 0; - const uint16_t *offsets = ics->swb_offset; - for (g = 0; g < ics->num_window_groups; g++) { - for (i = 0; i < ics->max_sfb; i++, idx++) { - if (cpe->ms_mask[idx] && - cpe->ch[0].band_type[idx] < NOISE_BT && - cpe->ch[1].band_type[idx] < NOISE_BT) { - for (group = 0; group < ics->group_len[g]; group++) { - ac->fdsp.butterflies_float(ch0 + group * 128 + offsets[i], - ch1 + group * 128 + offsets[i], - offsets[i+1] - offsets[i]); - } - } - } - ch0 += ics->group_len[g] * 128; - ch1 += ics->group_len[g] * 128; - } -} - -/** - * intensity stereo decoding; reference: 4.6.8.2.3 - * - * @param ms_present Indicates mid/side stereo presence. [0] mask is all 0s; - * [1] mask is decoded from bitstream; [2] mask is all 1s; - * [3] reserved for scalable AAC - */ -static void apply_intensity_stereo(AACContext *ac, - ChannelElement *cpe, int ms_present) -{ - const IndividualChannelStream *ics = &cpe->ch[1].ics; - SingleChannelElement *sce1 = &cpe->ch[1]; - float *coef0 = cpe->ch[0].coeffs, *coef1 = cpe->ch[1].coeffs; - const uint16_t *offsets = ics->swb_offset; - int g, group, i, idx = 0; - int c; - float scale; - for (g = 0; g < ics->num_window_groups; g++) { - for (i = 0; i < ics->max_sfb;) { - if (sce1->band_type[idx] == INTENSITY_BT || - sce1->band_type[idx] == INTENSITY_BT2) { - const int bt_run_end = sce1->band_type_run_end[idx]; - for (; i < bt_run_end; i++, idx++) { - c = -1 + 2 * (sce1->band_type[idx] - 14); - if (ms_present) - c *= 1 - 2 * cpe->ms_mask[idx]; - scale = c * sce1->sf[idx]; - for (group = 0; group < ics->group_len[g]; group++) - ac->fdsp.vector_fmul_scalar(coef1 + group * 128 + offsets[i], - coef0 + group * 128 + offsets[i], - scale, - offsets[i + 1] - offsets[i]); - } - } else { - int bt_run_end = sce1->band_type_run_end[idx]; - idx += bt_run_end - i; - i = bt_run_end; - } - } - coef0 += ics->group_len[g] * 128; - coef1 += ics->group_len[g] * 128; - } -} - -/** - * Decode a channel_pair_element; reference: table 4.4. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe) -{ - int i, ret, common_window, ms_present = 0; - int eld_syntax = ac->oc[1].m4ac.object_type == AOT_ER_AAC_ELD; - - common_window = eld_syntax || get_bits1(gb); - if (common_window) { - if (decode_ics_info(ac, &cpe->ch[0].ics, gb)) - return AVERROR_INVALIDDATA; - i = cpe->ch[1].ics.use_kb_window[0]; - cpe->ch[1].ics = cpe->ch[0].ics; - cpe->ch[1].ics.use_kb_window[1] = i; - if (cpe->ch[1].ics.predictor_present && - (ac->oc[1].m4ac.object_type != AOT_AAC_MAIN)) - if ((cpe->ch[1].ics.ltp.present = get_bits(gb, 1))) - decode_ltp(&cpe->ch[1].ics.ltp, gb, cpe->ch[1].ics.max_sfb); - ms_present = get_bits(gb, 2); - if (ms_present == 3) { - av_log(ac->avctx, AV_LOG_ERROR, "ms_present = 3 is reserved.\n"); - return AVERROR_INVALIDDATA; - } else if (ms_present) - decode_mid_side_stereo(cpe, gb, ms_present); - } - if ((ret = decode_ics(ac, &cpe->ch[0], gb, common_window, 0))) - return ret; - if ((ret = decode_ics(ac, &cpe->ch[1], gb, common_window, 0))) - return ret; - - if (common_window) { - if (ms_present) - apply_mid_side_stereo(ac, cpe); - if (ac->oc[1].m4ac.object_type == AOT_AAC_MAIN) { - apply_prediction(ac, &cpe->ch[0]); - apply_prediction(ac, &cpe->ch[1]); - } - } - - apply_intensity_stereo(ac, cpe, ms_present); - return 0; -} - -static const float cce_scale[] = { - 1.09050773266525765921, //2^(1/8) - 1.18920711500272106672, //2^(1/4) - M_SQRT2, - 2, -}; - -/** - * Decode coupling_channel_element; reference: table 4.8. - * - * @return Returns error status. 0 - OK, !0 - error - */ -static int decode_cce(AACContext *ac, GetBitContext *gb, ChannelElement *che) -{ - int num_gain = 0; - int c, g, sfb, ret; - int sign; - float scale; - SingleChannelElement *sce = &che->ch[0]; - ChannelCoupling *coup = &che->coup; - - coup->coupling_point = 2 * get_bits1(gb); - coup->num_coupled = get_bits(gb, 3); - for (c = 0; c <= coup->num_coupled; c++) { - num_gain++; - coup->type[c] = get_bits1(gb) ? TYPE_CPE : TYPE_SCE; - coup->id_select[c] = get_bits(gb, 4); - if (coup->type[c] == TYPE_CPE) { - coup->ch_select[c] = get_bits(gb, 2); - if (coup->ch_select[c] == 3) - num_gain++; - } else - coup->ch_select[c] = 2; - } - coup->coupling_point += get_bits1(gb) || (coup->coupling_point >> 1); - - sign = get_bits(gb, 1); - scale = cce_scale[get_bits(gb, 2)]; - - if ((ret = decode_ics(ac, sce, gb, 0, 0))) - return ret; - - for (c = 0; c < num_gain; c++) { - int idx = 0; - int cge = 1; - int gain = 0; - float gain_cache = 1.0; - if (c) { - cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb); - gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0; - gain_cache = powf(scale, -gain); - } - if (coup->coupling_point == AFTER_IMDCT) { - coup->gain[c][0] = gain_cache; - } else { - for (g = 0; g < sce->ics.num_window_groups; g++) { - for (sfb = 0; sfb < sce->ics.max_sfb; sfb++, idx++) { - if (sce->band_type[idx] != ZERO_BT) { - if (!cge) { - int t = get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60; - if (t) { - int s = 1; - t = gain += t; - if (sign) { - s -= 2 * (t & 0x1); - t >>= 1; - } - gain_cache = powf(scale, -t) * s; - } - } - coup->gain[c][idx] = gain_cache; - } - } - } - } - } - return 0; -} - -/** - * Parse whether channels are to be excluded from Dynamic Range Compression; reference: table 4.53. - * - * @return Returns number of bytes consumed. - */ -static int decode_drc_channel_exclusions(DynamicRangeControl *che_drc, - GetBitContext *gb) -{ - int i; - int num_excl_chan = 0; - - do { - for (i = 0; i < 7; i++) - che_drc->exclude_mask[num_excl_chan++] = get_bits1(gb); - } while (num_excl_chan < MAX_CHANNELS - 7 && get_bits1(gb)); - - return num_excl_chan / 7; -} - -/** - * Decode dynamic range information; reference: table 4.52. - * - * @return Returns number of bytes consumed. - */ -static int decode_dynamic_range(DynamicRangeControl *che_drc, - GetBitContext *gb) -{ - int n = 1; - int drc_num_bands = 1; - int i; - - /* pce_tag_present? */ - if (get_bits1(gb)) { - che_drc->pce_instance_tag = get_bits(gb, 4); - skip_bits(gb, 4); // tag_reserved_bits - n++; - } - - /* excluded_chns_present? */ - if (get_bits1(gb)) { - n += decode_drc_channel_exclusions(che_drc, gb); - } - - /* drc_bands_present? */ - if (get_bits1(gb)) { - che_drc->band_incr = get_bits(gb, 4); - che_drc->interpolation_scheme = get_bits(gb, 4); - n++; - drc_num_bands += che_drc->band_incr; - for (i = 0; i < drc_num_bands; i++) { - che_drc->band_top[i] = get_bits(gb, 8); - n++; - } - } - - /* prog_ref_level_present? */ - if (get_bits1(gb)) { - che_drc->prog_ref_level = get_bits(gb, 7); - skip_bits1(gb); // prog_ref_level_reserved_bits - n++; - } - - for (i = 0; i < drc_num_bands; i++) { - che_drc->dyn_rng_sgn[i] = get_bits1(gb); - che_drc->dyn_rng_ctl[i] = get_bits(gb, 7); - n++; - } - - return n; -} - -static int decode_fill(AACContext *ac, GetBitContext *gb, int len) { - uint8_t buf[256]; - int i, major, minor; - - if (len < 13+7*8) - goto unknown; - - get_bits(gb, 13); len -= 13; - - for(i=0; i+1=8; i++, len-=8) - buf[i] = get_bits(gb, 8); - - buf[i] = 0; - if (ac->avctx->debug & FF_DEBUG_PICT_INFO) - av_log(ac->avctx, AV_LOG_DEBUG, "FILL:%s\n", buf); - - if (sscanf((const char *) buf, "libfaac %d.%d", &major, &minor) == 2){ - ac->avctx->internal->skip_samples = 1024; - } - -unknown: - skip_bits_long(gb, len); - - return 0; -} - -/** - * Decode extension data (incomplete); reference: table 4.51. - * - * @param cnt length of TYPE_FIL syntactic element in bytes - * - * @return Returns number of bytes consumed - */ -static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, - ChannelElement *che, enum RawDataBlockType elem_type) -{ - int crc_flag = 0; - int res = cnt; - switch (get_bits(gb, 4)) { // extension type - case EXT_SBR_DATA_CRC: - crc_flag++; - case EXT_SBR_DATA: - if (!che) { - av_log(ac->avctx, AV_LOG_ERROR, "SBR was found before the first channel element.\n"); - return res; - } else if (!ac->oc[1].m4ac.sbr) { - av_log(ac->avctx, AV_LOG_ERROR, "SBR signaled to be not-present but was found in the bitstream.\n"); - skip_bits_long(gb, 8 * cnt - 4); - return res; - } else if (ac->oc[1].m4ac.sbr == -1 && ac->oc[1].status == OC_LOCKED) { - av_log(ac->avctx, AV_LOG_ERROR, "Implicit SBR was found with a first occurrence after the first frame.\n"); - skip_bits_long(gb, 8 * cnt - 4); - return res; - } else if (ac->oc[1].m4ac.ps == -1 && ac->oc[1].status < OC_LOCKED && ac->avctx->channels == 1) { - ac->oc[1].m4ac.sbr = 1; - ac->oc[1].m4ac.ps = 1; - ac->avctx->profile = FF_PROFILE_AAC_HE_V2; - output_configure(ac, ac->oc[1].layout_map, ac->oc[1].layout_map_tags, - ac->oc[1].status, 1); - } else { - ac->oc[1].m4ac.sbr = 1; - ac->avctx->profile = FF_PROFILE_AAC_HE; - } - res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); - break; - case EXT_DYNAMIC_RANGE: - res = decode_dynamic_range(&ac->che_drc, gb); - break; - case EXT_FILL: - decode_fill(ac, gb, 8 * cnt - 4); - break; - case EXT_FILL_DATA: - case EXT_DATA_ELEMENT: - default: - skip_bits_long(gb, 8 * cnt - 4); - break; - }; - return res; -} - -/** - * Decode Temporal Noise Shaping filter coefficients and apply all-pole filters; reference: 4.6.9.3. - * - * @param decode 1 if tool is used normally, 0 if tool is used in LTP. - * @param coef spectral coefficients - */ -static void apply_tns(float coef[1024], TemporalNoiseShaping *tns, - IndividualChannelStream *ics, int decode) -{ - const int mmm = FFMIN(ics->tns_max_bands, ics->max_sfb); - int w, filt, m, i; - int bottom, top, order, start, end, size, inc; - float lpc[TNS_MAX_ORDER]; - float tmp[TNS_MAX_ORDER+1]; - - for (w = 0; w < ics->num_windows; w++) { - bottom = ics->num_swb; - for (filt = 0; filt < tns->n_filt[w]; filt++) { - top = bottom; - bottom = FFMAX(0, top - tns->length[w][filt]); - order = tns->order[w][filt]; - if (order == 0) - continue; - - // tns_decode_coef - compute_lpc_coefs(tns->coef[w][filt], order, lpc, 0, 0, 0); - - start = ics->swb_offset[FFMIN(bottom, mmm)]; - end = ics->swb_offset[FFMIN( top, mmm)]; - if ((size = end - start) <= 0) - continue; - if (tns->direction[w][filt]) { - inc = -1; - start = end - 1; - } else { - inc = 1; - } - start += w * 128; - - if (decode) { - // ar filter - for (m = 0; m < size; m++, start += inc) - for (i = 1; i <= FFMIN(m, order); i++) - coef[start] -= coef[start - i * inc] * lpc[i - 1]; - } else { - // ma filter - for (m = 0; m < size; m++, start += inc) { - tmp[0] = coef[start]; - for (i = 1; i <= FFMIN(m, order); i++) - coef[start] += tmp[i] * lpc[i - 1]; - for (i = order; i > 0; i--) - tmp[i] = tmp[i - 1]; - } - } - } - } -} - -/** - * Apply windowing and MDCT to obtain the spectral - * coefficient from the predicted sample by LTP. - */ -static void windowing_and_mdct_ltp(AACContext *ac, float *out, - float *in, IndividualChannelStream *ics) -{ - const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; - const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; - const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; - const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; - - if (ics->window_sequence[0] != LONG_STOP_SEQUENCE) { - ac->fdsp.vector_fmul(in, in, lwindow_prev, 1024); - } else { - memset(in, 0, 448 * sizeof(float)); - ac->fdsp.vector_fmul(in + 448, in + 448, swindow_prev, 128); - } - if (ics->window_sequence[0] != LONG_START_SEQUENCE) { - ac->fdsp.vector_fmul_reverse(in + 1024, in + 1024, lwindow, 1024); - } else { - ac->fdsp.vector_fmul_reverse(in + 1024 + 448, in + 1024 + 448, swindow, 128); - memset(in + 1024 + 576, 0, 448 * sizeof(float)); - } - ac->mdct_ltp.mdct_calc(&ac->mdct_ltp, out, in); -} - -/** - * Apply the long term prediction - */ -static void apply_ltp(AACContext *ac, SingleChannelElement *sce) -{ - const LongTermPrediction *ltp = &sce->ics.ltp; - const uint16_t *offsets = sce->ics.swb_offset; - int i, sfb; - - if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) { - float *predTime = sce->ret; - float *predFreq = ac->buf_mdct; - int16_t num_samples = 2048; - - if (ltp->lag < 1024) - num_samples = ltp->lag + 1024; - for (i = 0; i < num_samples; i++) - predTime[i] = sce->ltp_state[i + 2048 - ltp->lag] * ltp->coef; - memset(&predTime[i], 0, (2048 - i) * sizeof(float)); - - ac->windowing_and_mdct_ltp(ac, predFreq, predTime, &sce->ics); - - if (sce->tns.present) - ac->apply_tns(predFreq, &sce->tns, &sce->ics, 0); - - for (sfb = 0; sfb < FFMIN(sce->ics.max_sfb, MAX_LTP_LONG_SFB); sfb++) - if (ltp->used[sfb]) - for (i = offsets[sfb]; i < offsets[sfb + 1]; i++) - sce->coeffs[i] += predFreq[i]; - } -} - -/** - * Update the LTP buffer for next frame - */ -static void update_ltp(AACContext *ac, SingleChannelElement *sce) -{ - IndividualChannelStream *ics = &sce->ics; - float *saved = sce->saved; - float *saved_ltp = sce->coeffs; - const float *lwindow = ics->use_kb_window[0] ? ff_aac_kbd_long_1024 : ff_sine_1024; - const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; - int i; - - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - memcpy(saved_ltp, saved, 512 * sizeof(float)); - memset(saved_ltp + 576, 0, 448 * sizeof(float)); - ac->fdsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); - for (i = 0; i < 64; i++) - saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; - } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { - memcpy(saved_ltp, ac->buf_mdct + 512, 448 * sizeof(float)); - memset(saved_ltp + 576, 0, 448 * sizeof(float)); - ac->fdsp.vector_fmul_reverse(saved_ltp + 448, ac->buf_mdct + 960, &swindow[64], 64); - for (i = 0; i < 64; i++) - saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * swindow[63 - i]; - } else { // LONG_STOP or ONLY_LONG - ac->fdsp.vector_fmul_reverse(saved_ltp, ac->buf_mdct + 512, &lwindow[512], 512); - for (i = 0; i < 512; i++) - saved_ltp[i + 512] = ac->buf_mdct[1023 - i] * lwindow[511 - i]; - } - - memcpy(sce->ltp_state, sce->ltp_state+1024, 1024 * sizeof(*sce->ltp_state)); - memcpy(sce->ltp_state+1024, sce->ret, 1024 * sizeof(*sce->ltp_state)); - memcpy(sce->ltp_state+2048, saved_ltp, 1024 * sizeof(*sce->ltp_state)); -} - -/** - * Conduct IMDCT and windowing. - */ -static void imdct_and_windowing(AACContext *ac, SingleChannelElement *sce) -{ - IndividualChannelStream *ics = &sce->ics; - float *in = sce->coeffs; - float *out = sce->ret; - float *saved = sce->saved; - const float *swindow = ics->use_kb_window[0] ? ff_aac_kbd_short_128 : ff_sine_128; - const float *lwindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_long_1024 : ff_sine_1024; - const float *swindow_prev = ics->use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; - float *buf = ac->buf_mdct; - float *temp = ac->temp; - int i; - - // imdct - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - for (i = 0; i < 1024; i += 128) - ac->mdct_small.imdct_half(&ac->mdct_small, buf + i, in + i); - } else - ac->mdct.imdct_half(&ac->mdct, buf, in); - - /* window overlapping - * NOTE: To simplify the overlapping code, all 'meaningless' short to long - * and long to short transitions are considered to be short to short - * transitions. This leaves just two cases (long to long and short to short) - * with a little special sauce for EIGHT_SHORT_SEQUENCE. - */ - if ((ics->window_sequence[1] == ONLY_LONG_SEQUENCE || ics->window_sequence[1] == LONG_STOP_SEQUENCE) && - (ics->window_sequence[0] == ONLY_LONG_SEQUENCE || ics->window_sequence[0] == LONG_START_SEQUENCE)) { - ac->fdsp.vector_fmul_window( out, saved, buf, lwindow_prev, 512); - } else { - memcpy( out, saved, 448 * sizeof(float)); - - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - ac->fdsp.vector_fmul_window(out + 448 + 0*128, saved + 448, buf + 0*128, swindow_prev, 64); - ac->fdsp.vector_fmul_window(out + 448 + 1*128, buf + 0*128 + 64, buf + 1*128, swindow, 64); - ac->fdsp.vector_fmul_window(out + 448 + 2*128, buf + 1*128 + 64, buf + 2*128, swindow, 64); - ac->fdsp.vector_fmul_window(out + 448 + 3*128, buf + 2*128 + 64, buf + 3*128, swindow, 64); - ac->fdsp.vector_fmul_window(temp, buf + 3*128 + 64, buf + 4*128, swindow, 64); - memcpy( out + 448 + 4*128, temp, 64 * sizeof(float)); - } else { - ac->fdsp.vector_fmul_window(out + 448, saved + 448, buf, swindow_prev, 64); - memcpy( out + 576, buf + 64, 448 * sizeof(float)); - } - } - - // buffer update - if (ics->window_sequence[0] == EIGHT_SHORT_SEQUENCE) { - memcpy( saved, temp + 64, 64 * sizeof(float)); - ac->fdsp.vector_fmul_window(saved + 64, buf + 4*128 + 64, buf + 5*128, swindow, 64); - ac->fdsp.vector_fmul_window(saved + 192, buf + 5*128 + 64, buf + 6*128, swindow, 64); - ac->fdsp.vector_fmul_window(saved + 320, buf + 6*128 + 64, buf + 7*128, swindow, 64); - memcpy( saved + 448, buf + 7*128 + 64, 64 * sizeof(float)); - } else if (ics->window_sequence[0] == LONG_START_SEQUENCE) { - memcpy( saved, buf + 512, 448 * sizeof(float)); - memcpy( saved + 448, buf + 7*128 + 64, 64 * sizeof(float)); - } else { // LONG_STOP or ONLY_LONG - memcpy( saved, buf + 512, 512 * sizeof(float)); - } -} - -static void imdct_and_windowing_ld(AACContext *ac, SingleChannelElement *sce) -{ - IndividualChannelStream *ics = &sce->ics; - float *in = sce->coeffs; - float *out = sce->ret; - float *saved = sce->saved; - float *buf = ac->buf_mdct; - - // imdct - ac->mdct.imdct_half(&ac->mdct_ld, buf, in); - - // window overlapping - if (ics->use_kb_window[1]) { - // AAC LD uses a low overlap sine window instead of a KBD window - memcpy(out, saved, 192 * sizeof(float)); - ac->fdsp.vector_fmul_window(out + 192, saved + 192, buf, ff_sine_128, 64); - memcpy( out + 320, buf + 64, 192 * sizeof(float)); - } else { - ac->fdsp.vector_fmul_window(out, saved, buf, ff_sine_512, 256); - } - - // buffer update - memcpy(saved, buf + 256, 256 * sizeof(float)); -} - -static void imdct_and_windowing_eld(AACContext *ac, SingleChannelElement *sce) -{ - float *in = sce->coeffs; - float *out = sce->ret; - float *saved = sce->saved; - const float *const window = ff_aac_eld_window; - float *buf = ac->buf_mdct; - int i; - const int n = 512; - const int n2 = n >> 1; - const int n4 = n >> 2; - - // Inverse transform, mapped to the conventional IMDCT by - // Chivukula, R.K.; Reznik, Y.A.; Devarajan, V., - // "Efficient algorithms for MPEG-4 AAC-ELD, AAC-LD and AAC-LC filterbanks," - // International Conference on Audio, Language and Image Processing, ICALIP 2008. - // URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=4590245&isnumber=4589950 - for (i = 0; i < n2; i+=2) { - float temp; - temp = in[i ]; in[i ] = -in[n - 1 - i]; in[n - 1 - i] = temp; - temp = -in[i + 1]; in[i + 1] = in[n - 2 - i]; in[n - 2 - i] = temp; - } - ac->mdct.imdct_half(&ac->mdct_ld, buf, in); - for (i = 0; i < n; i+=2) { - buf[i] = -buf[i]; - } - // Like with the regular IMDCT at this point we still have the middle half - // of a transform but with even symmetry on the left and odd symmetry on - // the right - - // window overlapping - // The spec says to use samples [0..511] but the reference decoder uses - // samples [128..639]. - for (i = n4; i < n2; i ++) { - out[i - n4] = buf[n2 - 1 - i] * window[i - n4] + - saved[ i + n2] * window[i + n - n4] + - -saved[ n + n2 - 1 - i] * window[i + 2*n - n4] + - -saved[2*n + n2 + i] * window[i + 3*n - n4]; - } - for (i = 0; i < n2; i ++) { - out[n4 + i] = buf[i] * window[i + n2 - n4] + - -saved[ n - 1 - i] * window[i + n2 + n - n4] + - -saved[ n + i] * window[i + n2 + 2*n - n4] + - saved[2*n + n - 1 - i] * window[i + n2 + 3*n - n4]; - } - for (i = 0; i < n4; i ++) { - out[n2 + n4 + i] = buf[ i + n2] * window[i + n - n4] + - -saved[ n2 - 1 - i] * window[i + 2*n - n4] + - -saved[ n + n2 + i] * window[i + 3*n - n4]; - } - - // buffer update - memmove(saved + n, saved, 2 * n * sizeof(float)); - memcpy( saved, buf, n * sizeof(float)); -} - -/** - * Apply dependent channel coupling (applied before IMDCT). - * - * @param index index into coupling gain array - */ -static void apply_dependent_coupling(AACContext *ac, - SingleChannelElement *target, - ChannelElement *cce, int index) -{ - IndividualChannelStream *ics = &cce->ch[0].ics; - const uint16_t *offsets = ics->swb_offset; - float *dest = target->coeffs; - const float *src = cce->ch[0].coeffs; - int g, i, group, k, idx = 0; - if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) { - av_log(ac->avctx, AV_LOG_ERROR, - "Dependent coupling is not supported together with LTP\n"); - return; - } - for (g = 0; g < ics->num_window_groups; g++) { - for (i = 0; i < ics->max_sfb; i++, idx++) { - if (cce->ch[0].band_type[idx] != ZERO_BT) { - const float gain = cce->coup.gain[index][idx]; - for (group = 0; group < ics->group_len[g]; group++) { - for (k = offsets[i]; k < offsets[i + 1]; k++) { - // XXX dsputil-ize - dest[group * 128 + k] += gain * src[group * 128 + k]; - } - } - } - } - dest += ics->group_len[g] * 128; - src += ics->group_len[g] * 128; - } -} - -/** - * Apply independent channel coupling (applied after IMDCT). - * - * @param index index into coupling gain array - */ -static void apply_independent_coupling(AACContext *ac, - SingleChannelElement *target, - ChannelElement *cce, int index) -{ - int i; - const float gain = cce->coup.gain[index][0]; - const float *src = cce->ch[0].ret; - float *dest = target->ret; - const int len = 1024 << (ac->oc[1].m4ac.sbr == 1); - - for (i = 0; i < len; i++) - dest[i] += gain * src[i]; -} - -/** - * channel coupling transformation interface - * - * @param apply_coupling_method pointer to (in)dependent coupling function - */ -static void apply_channel_coupling(AACContext *ac, ChannelElement *cc, - enum RawDataBlockType type, int elem_id, - enum CouplingPoint coupling_point, - void (*apply_coupling_method)(AACContext *ac, SingleChannelElement *target, ChannelElement *cce, int index)) -{ - int i, c; - - for (i = 0; i < MAX_ELEM_ID; i++) { - ChannelElement *cce = ac->che[TYPE_CCE][i]; - int index = 0; - - if (cce && cce->coup.coupling_point == coupling_point) { - ChannelCoupling *coup = &cce->coup; - - for (c = 0; c <= coup->num_coupled; c++) { - if (coup->type[c] == type && coup->id_select[c] == elem_id) { - if (coup->ch_select[c] != 1) { - apply_coupling_method(ac, &cc->ch[0], cce, index); - if (coup->ch_select[c] != 0) - index++; - } - if (coup->ch_select[c] != 2) - apply_coupling_method(ac, &cc->ch[1], cce, index++); - } else - index += 1 + (coup->ch_select[c] == 3); - } - } - } -} - -/** - * Convert spectral data to float samples, applying all supported tools as appropriate. - */ -static void spectral_to_sample(AACContext *ac) -{ - int i, type; - void (*imdct_and_window)(AACContext *ac, SingleChannelElement *sce); - switch (ac->oc[1].m4ac.object_type) { - case AOT_ER_AAC_LD: - imdct_and_window = imdct_and_windowing_ld; - break; - case AOT_ER_AAC_ELD: - imdct_and_window = imdct_and_windowing_eld; - break; - default: - imdct_and_window = ac->imdct_and_windowing; - } - for (type = 3; type >= 0; type--) { - for (i = 0; i < MAX_ELEM_ID; i++) { - ChannelElement *che = ac->che[type][i]; - if (che) { - if (type <= TYPE_CPE) - apply_channel_coupling(ac, che, type, i, BEFORE_TNS, apply_dependent_coupling); - if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) { - if (che->ch[0].ics.predictor_present) { - if (che->ch[0].ics.ltp.present) - ac->apply_ltp(ac, &che->ch[0]); - if (che->ch[1].ics.ltp.present && type == TYPE_CPE) - ac->apply_ltp(ac, &che->ch[1]); - } - } - if (che->ch[0].tns.present) - ac->apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1); - if (che->ch[1].tns.present) - ac->apply_tns(che->ch[1].coeffs, &che->ch[1].tns, &che->ch[1].ics, 1); - if (type <= TYPE_CPE) - apply_channel_coupling(ac, che, type, i, BETWEEN_TNS_AND_IMDCT, apply_dependent_coupling); - if (type != TYPE_CCE || che->coup.coupling_point == AFTER_IMDCT) { - imdct_and_window(ac, &che->ch[0]); - if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) - ac->update_ltp(ac, &che->ch[0]); - if (type == TYPE_CPE) { - imdct_and_window(ac, &che->ch[1]); - if (ac->oc[1].m4ac.object_type == AOT_AAC_LTP) - ac->update_ltp(ac, &che->ch[1]); - } - if (ac->oc[1].m4ac.sbr > 0) { - ff_sbr_apply(ac, &che->sbr, type, che->ch[0].ret, che->ch[1].ret); - } - } - if (type <= TYPE_CCE) - apply_channel_coupling(ac, che, type, i, AFTER_IMDCT, apply_independent_coupling); - } - } - } -} - -static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) -{ - int size; - AACADTSHeaderInfo hdr_info; - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int layout_map_tags, ret; - - size = avpriv_aac_parse_header(gb, &hdr_info); - if (size > 0) { - if (!ac->warned_num_aac_frames && hdr_info.num_aac_frames != 1) { - // This is 2 for "VLB " audio in NSV files. - // See samples/nsv/vlb_audio. - avpriv_report_missing_feature(ac->avctx, - "More than one AAC RDB per ADTS frame"); - ac->warned_num_aac_frames = 1; - } - push_output_configuration(ac); - if (hdr_info.chan_config) { - ac->oc[1].m4ac.chan_config = hdr_info.chan_config; - if ((ret = set_default_channel_config(ac->avctx, - layout_map, - &layout_map_tags, - hdr_info.chan_config)) < 0) - return ret; - if ((ret = output_configure(ac, layout_map, layout_map_tags, - FFMAX(ac->oc[1].status, - OC_TRIAL_FRAME), 0)) < 0) - return ret; - } else { - ac->oc[1].m4ac.chan_config = 0; - /** - * dual mono frames in Japanese DTV can have chan_config 0 - * WITHOUT specifying PCE. - * thus, set dual mono as default. - */ - if (ac->dmono_mode && ac->oc[0].status == OC_NONE) { - layout_map_tags = 2; - layout_map[0][0] = layout_map[1][0] = TYPE_SCE; - layout_map[0][2] = layout_map[1][2] = AAC_CHANNEL_FRONT; - layout_map[0][1] = 0; - layout_map[1][1] = 1; - if (output_configure(ac, layout_map, layout_map_tags, - OC_TRIAL_FRAME, 0)) - return -7; - } - } - ac->oc[1].m4ac.sample_rate = hdr_info.sample_rate; - ac->oc[1].m4ac.sampling_index = hdr_info.sampling_index; - ac->oc[1].m4ac.object_type = hdr_info.object_type; - if (ac->oc[0].status != OC_LOCKED || - ac->oc[0].m4ac.chan_config != hdr_info.chan_config || - ac->oc[0].m4ac.sample_rate != hdr_info.sample_rate) { - ac->oc[1].m4ac.sbr = -1; - ac->oc[1].m4ac.ps = -1; - } - if (!hdr_info.crc_absent) - skip_bits(gb, 16); - } - return size; -} - -static int aac_decode_er_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, GetBitContext *gb) -{ - AACContext *ac = avctx->priv_data; - ChannelElement *che; - int err, i; - int samples = 1024; - int chan_config = ac->oc[1].m4ac.chan_config; - int aot = ac->oc[1].m4ac.object_type; - - if (aot == AOT_ER_AAC_LD || aot == AOT_ER_AAC_ELD) - samples >>= 1; - - ac->frame = data; - - if ((err = frame_configure_elements(avctx)) < 0) - return err; - - // The FF_PROFILE_AAC_* defines are all object_type - 1 - // This may lead to an undefined profile being signaled - ac->avctx->profile = ac->oc[1].m4ac.object_type - 1; - - ac->tags_mapped = 0; - - if (chan_config < 0 || chan_config >= 8) { - avpriv_request_sample(avctx, "Unknown ER channel configuration %d", - ac->oc[1].m4ac.chan_config); - return AVERROR_INVALIDDATA; - } - for (i = 0; i < tags_per_config[chan_config]; i++) { - const int elem_type = aac_channel_layout_map[chan_config-1][i][0]; - const int elem_id = aac_channel_layout_map[chan_config-1][i][1]; - if (!(che=get_che(ac, elem_type, elem_id))) { - av_log(ac->avctx, AV_LOG_ERROR, - "channel element %d.%d is not allocated\n", - elem_type, elem_id); - return AVERROR_INVALIDDATA; - } - if (aot != AOT_ER_AAC_ELD) - skip_bits(gb, 4); - switch (elem_type) { - case TYPE_SCE: - err = decode_ics(ac, &che->ch[0], gb, 0, 0); - break; - case TYPE_CPE: - err = decode_cpe(ac, gb, che); - break; - case TYPE_LFE: - err = decode_ics(ac, &che->ch[0], gb, 0, 0); - break; - } - if (err < 0) - return err; - } - - spectral_to_sample(ac); - - ac->frame->nb_samples = samples; - ac->frame->sample_rate = avctx->sample_rate; - *got_frame_ptr = 1; - - skip_bits_long(gb, get_bits_left(gb)); - return 0; -} - -static int aac_decode_frame_int(AVCodecContext *avctx, void *data, - int *got_frame_ptr, GetBitContext *gb, AVPacket *avpkt) -{ - AACContext *ac = avctx->priv_data; - ChannelElement *che = NULL, *che_prev = NULL; - enum RawDataBlockType elem_type, elem_type_prev = TYPE_END; - int err, elem_id; - int samples = 0, multiplier, audio_found = 0, pce_found = 0; - int is_dmono, sce_count = 0; - - ac->frame = data; - - if (show_bits(gb, 12) == 0xfff) { - if ((err = parse_adts_frame_header(ac, gb)) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); - goto fail; - } - if (ac->oc[1].m4ac.sampling_index > 12) { - av_log(ac->avctx, AV_LOG_ERROR, "invalid sampling rate index %d\n", ac->oc[1].m4ac.sampling_index); - err = AVERROR_INVALIDDATA; - goto fail; - } - } - - if ((err = frame_configure_elements(avctx)) < 0) - goto fail; - - // The FF_PROFILE_AAC_* defines are all object_type - 1 - // This may lead to an undefined profile being signaled - ac->avctx->profile = ac->oc[1].m4ac.object_type - 1; - - ac->tags_mapped = 0; - // parse - while ((elem_type = get_bits(gb, 3)) != TYPE_END) { - elem_id = get_bits(gb, 4); - - if (elem_type < TYPE_DSE) { - if (!(che=get_che(ac, elem_type, elem_id))) { - av_log(ac->avctx, AV_LOG_ERROR, "channel element %d.%d is not allocated\n", - elem_type, elem_id); - err = AVERROR_INVALIDDATA; - goto fail; - } - samples = 1024; - } - - switch (elem_type) { - - case TYPE_SCE: - err = decode_ics(ac, &che->ch[0], gb, 0, 0); - audio_found = 1; - sce_count++; - break; - - case TYPE_CPE: - err = decode_cpe(ac, gb, che); - audio_found = 1; - break; - - case TYPE_CCE: - err = decode_cce(ac, gb, che); - break; - - case TYPE_LFE: - err = decode_ics(ac, &che->ch[0], gb, 0, 0); - audio_found = 1; - break; - - case TYPE_DSE: - err = skip_data_stream_element(ac, gb); - break; - - case TYPE_PCE: { - uint8_t layout_map[MAX_ELEM_ID*4][3]; - int tags; - push_output_configuration(ac); - tags = decode_pce(avctx, &ac->oc[1].m4ac, layout_map, gb); - if (tags < 0) { - err = tags; - break; - } - if (pce_found) { - av_log(avctx, AV_LOG_ERROR, - "Not evaluating a further program_config_element as this construct is dubious at best.\n"); - } else { - err = output_configure(ac, layout_map, tags, OC_TRIAL_PCE, 1); - if (!err) - ac->oc[1].m4ac.chan_config = 0; - pce_found = 1; - } - break; - } - - case TYPE_FIL: - if (elem_id == 15) - elem_id += get_bits(gb, 8) - 1; - if (get_bits_left(gb) < 8 * elem_id) { - av_log(avctx, AV_LOG_ERROR, "TYPE_FIL: "overread_err); - err = AVERROR_INVALIDDATA; - goto fail; - } - while (elem_id > 0) - elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev); - err = 0; /* FIXME */ - break; - - default: - err = AVERROR_BUG; /* should not happen, but keeps compiler happy */ - break; - } - - che_prev = che; - elem_type_prev = elem_type; - - if (err) - goto fail; - - if (get_bits_left(gb) < 3) { - av_log(avctx, AV_LOG_ERROR, overread_err); - err = AVERROR_INVALIDDATA; - goto fail; - } - } - - spectral_to_sample(ac); - - multiplier = (ac->oc[1].m4ac.sbr == 1) ? ac->oc[1].m4ac.ext_sample_rate > ac->oc[1].m4ac.sample_rate : 0; - samples <<= multiplier; - - if (ac->oc[1].status && audio_found) { - avctx->sample_rate = ac->oc[1].m4ac.sample_rate << multiplier; - avctx->frame_size = samples; - ac->oc[1].status = OC_LOCKED; - } - - if (multiplier) { - int side_size; - const uint8_t *side = av_packet_get_side_data(avpkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size); - if (side && side_size>=4) - AV_WL32(side, 2*AV_RL32(side)); - } - - *got_frame_ptr = !!samples; - if (samples) { - ac->frame->nb_samples = samples; - ac->frame->sample_rate = avctx->sample_rate; - } else - av_frame_unref(ac->frame); - *got_frame_ptr = !!samples; - - /* for dual-mono audio (SCE + SCE) */ - is_dmono = ac->dmono_mode && sce_count == 2 && - ac->oc[1].channel_layout == (AV_CH_FRONT_LEFT | AV_CH_FRONT_RIGHT); - if (is_dmono) { - if (ac->dmono_mode == 1) - ((AVFrame *)data)->data[1] =((AVFrame *)data)->data[0]; - else if (ac->dmono_mode == 2) - ((AVFrame *)data)->data[0] =((AVFrame *)data)->data[1]; - } - - return 0; -fail: - pop_output_configuration(ac); - return err; -} - -static int aac_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AACContext *ac = avctx->priv_data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - GetBitContext gb; - int buf_consumed; - int buf_offset; - int err; - int new_extradata_size; - const uint8_t *new_extradata = av_packet_get_side_data(avpkt, - AV_PKT_DATA_NEW_EXTRADATA, - &new_extradata_size); - int jp_dualmono_size; - const uint8_t *jp_dualmono = av_packet_get_side_data(avpkt, - AV_PKT_DATA_JP_DUALMONO, - &jp_dualmono_size); - - if (new_extradata && 0) { - av_free(avctx->extradata); - avctx->extradata = av_mallocz(new_extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if (!avctx->extradata) - return AVERROR(ENOMEM); - avctx->extradata_size = new_extradata_size; - memcpy(avctx->extradata, new_extradata, new_extradata_size); - push_output_configuration(ac); - if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, - avctx->extradata, - avctx->extradata_size*8, 1) < 0) { - pop_output_configuration(ac); - return AVERROR_INVALIDDATA; - } - } - - ac->dmono_mode = 0; - if (jp_dualmono && jp_dualmono_size > 0) - ac->dmono_mode = 1 + *jp_dualmono; - if (ac->force_dmono_mode >= 0) - ac->dmono_mode = ac->force_dmono_mode; - - if (INT_MAX / 8 <= buf_size) - return AVERROR_INVALIDDATA; - - if ((err = init_get_bits(&gb, buf, buf_size * 8)) < 0) - return err; - - switch (ac->oc[1].m4ac.object_type) { - case AOT_ER_AAC_LC: - case AOT_ER_AAC_LTP: - case AOT_ER_AAC_LD: - case AOT_ER_AAC_ELD: - err = aac_decode_er_frame(avctx, data, got_frame_ptr, &gb); - break; - default: - err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb, avpkt); - } - if (err < 0) - return err; - - buf_consumed = (get_bits_count(&gb) + 7) >> 3; - for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) - if (buf[buf_offset]) - break; - - return buf_size > buf_offset ? buf_consumed : buf_size; -} - -static av_cold int aac_decode_close(AVCodecContext *avctx) -{ - AACContext *ac = avctx->priv_data; - int i, type; - - for (i = 0; i < MAX_ELEM_ID; i++) { - for (type = 0; type < 4; type++) { - if (ac->che[type][i]) - ff_aac_sbr_ctx_close(&ac->che[type][i]->sbr); - av_freep(&ac->che[type][i]); - } - } - - ff_mdct_end(&ac->mdct); - ff_mdct_end(&ac->mdct_small); - ff_mdct_end(&ac->mdct_ld); - ff_mdct_end(&ac->mdct_ltp); - return 0; -} - - -#define LOAS_SYNC_WORD 0x2b7 ///< 11 bits LOAS sync word - -struct LATMContext { - AACContext aac_ctx; ///< containing AACContext - int initialized; ///< initialized after a valid extradata was seen - - // parser data - int audio_mux_version_A; ///< LATM syntax version - int frame_length_type; ///< 0/1 variable/fixed frame length - int frame_length; ///< frame length for fixed frame length -}; - -static inline uint32_t latm_get_value(GetBitContext *b) -{ - int length = get_bits(b, 2); - - return get_bits_long(b, (length+1)*8); -} - -static int latm_decode_audio_specific_config(struct LATMContext *latmctx, - GetBitContext *gb, int asclen) -{ - AACContext *ac = &latmctx->aac_ctx; - AVCodecContext *avctx = ac->avctx; - MPEG4AudioConfig m4ac = { 0 }; - int config_start_bit = get_bits_count(gb); - int sync_extension = 0; - int bits_consumed, esize; - - if (asclen) { - sync_extension = 1; - asclen = FFMIN(asclen, get_bits_left(gb)); - } else - asclen = get_bits_left(gb); - - if (config_start_bit % 8) { - avpriv_request_sample(latmctx->aac_ctx.avctx, - "Non-byte-aligned audio-specific config"); - return AVERROR_PATCHWELCOME; - } - if (asclen <= 0) - return AVERROR_INVALIDDATA; - bits_consumed = decode_audio_specific_config(NULL, avctx, &m4ac, - gb->buffer + (config_start_bit / 8), - asclen, sync_extension); - - if (bits_consumed < 0) - return AVERROR_INVALIDDATA; - - if (!latmctx->initialized || - ac->oc[1].m4ac.sample_rate != m4ac.sample_rate || - ac->oc[1].m4ac.chan_config != m4ac.chan_config) { - - if(latmctx->initialized) { - av_log(avctx, AV_LOG_INFO, "audio config changed\n"); - } else { - av_log(avctx, AV_LOG_DEBUG, "initializing latmctx\n"); - } - latmctx->initialized = 0; - - esize = (bits_consumed+7) / 8; - - if (avctx->extradata_size < esize) { - av_free(avctx->extradata); - avctx->extradata = av_malloc(esize + FF_INPUT_BUFFER_PADDING_SIZE); - if (!avctx->extradata) - return AVERROR(ENOMEM); - } - - avctx->extradata_size = esize; - memcpy(avctx->extradata, gb->buffer + (config_start_bit/8), esize); - memset(avctx->extradata+esize, 0, FF_INPUT_BUFFER_PADDING_SIZE); - } - skip_bits_long(gb, bits_consumed); - - return bits_consumed; -} - -static int read_stream_mux_config(struct LATMContext *latmctx, - GetBitContext *gb) -{ - int ret, audio_mux_version = get_bits(gb, 1); - - latmctx->audio_mux_version_A = 0; - if (audio_mux_version) - latmctx->audio_mux_version_A = get_bits(gb, 1); - - if (!latmctx->audio_mux_version_A) { - - if (audio_mux_version) - latm_get_value(gb); // taraFullness - - skip_bits(gb, 1); // allStreamSameTimeFraming - skip_bits(gb, 6); // numSubFrames - // numPrograms - if (get_bits(gb, 4)) { // numPrograms - avpriv_request_sample(latmctx->aac_ctx.avctx, "Multiple programs"); - return AVERROR_PATCHWELCOME; - } - - // for each program (which there is only one in DVB) - - // for each layer (which there is only one in DVB) - if (get_bits(gb, 3)) { // numLayer - avpriv_request_sample(latmctx->aac_ctx.avctx, "Multiple layers"); - return AVERROR_PATCHWELCOME; - } - - // for all but first stream: use_same_config = get_bits(gb, 1); - if (!audio_mux_version) { - if ((ret = latm_decode_audio_specific_config(latmctx, gb, 0)) < 0) - return ret; - } else { - int ascLen = latm_get_value(gb); - if ((ret = latm_decode_audio_specific_config(latmctx, gb, ascLen)) < 0) - return ret; - ascLen -= ret; - skip_bits_long(gb, ascLen); - } - - latmctx->frame_length_type = get_bits(gb, 3); - switch (latmctx->frame_length_type) { - case 0: - skip_bits(gb, 8); // latmBufferFullness - break; - case 1: - latmctx->frame_length = get_bits(gb, 9); - break; - case 3: - case 4: - case 5: - skip_bits(gb, 6); // CELP frame length table index - break; - case 6: - case 7: - skip_bits(gb, 1); // HVXC frame length table index - break; - } - - if (get_bits(gb, 1)) { // other data - if (audio_mux_version) { - latm_get_value(gb); // other_data_bits - } else { - int esc; - do { - esc = get_bits(gb, 1); - skip_bits(gb, 8); - } while (esc); - } - } - - if (get_bits(gb, 1)) // crc present - skip_bits(gb, 8); // config_crc - } - - return 0; -} - -static int read_payload_length_info(struct LATMContext *ctx, GetBitContext *gb) -{ - uint8_t tmp; - - if (ctx->frame_length_type == 0) { - int mux_slot_length = 0; - do { - tmp = get_bits(gb, 8); - mux_slot_length += tmp; - } while (tmp == 255); - return mux_slot_length; - } else if (ctx->frame_length_type == 1) { - return ctx->frame_length; - } else if (ctx->frame_length_type == 3 || - ctx->frame_length_type == 5 || - ctx->frame_length_type == 7) { - skip_bits(gb, 2); // mux_slot_length_coded - } - return 0; -} - -static int read_audio_mux_element(struct LATMContext *latmctx, - GetBitContext *gb) -{ - int err; - uint8_t use_same_mux = get_bits(gb, 1); - if (!use_same_mux) { - if ((err = read_stream_mux_config(latmctx, gb)) < 0) - return err; - } else if (!latmctx->aac_ctx.avctx->extradata) { - av_log(latmctx->aac_ctx.avctx, AV_LOG_DEBUG, - "no decoder config found\n"); - return AVERROR(EAGAIN); - } - if (latmctx->audio_mux_version_A == 0) { - int mux_slot_length_bytes = read_payload_length_info(latmctx, gb); - if (mux_slot_length_bytes * 8 > get_bits_left(gb)) { - av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, "incomplete frame\n"); - return AVERROR_INVALIDDATA; - } else if (mux_slot_length_bytes * 8 + 256 < get_bits_left(gb)) { - av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, - "frame length mismatch %d << %d\n", - mux_slot_length_bytes * 8, get_bits_left(gb)); - return AVERROR_INVALIDDATA; - } - } - return 0; -} - - -static int latm_decode_frame(AVCodecContext *avctx, void *out, - int *got_frame_ptr, AVPacket *avpkt) -{ - struct LATMContext *latmctx = avctx->priv_data; - int muxlength, err; - GetBitContext gb; - - if ((err = init_get_bits8(&gb, avpkt->data, avpkt->size)) < 0) - return err; - - // check for LOAS sync word - if (get_bits(&gb, 11) != LOAS_SYNC_WORD) - return AVERROR_INVALIDDATA; - - muxlength = get_bits(&gb, 13) + 3; - // not enough data, the parser should have sorted this out - if (muxlength > avpkt->size) - return AVERROR_INVALIDDATA; - - if ((err = read_audio_mux_element(latmctx, &gb)) < 0) - return err; - - if (!latmctx->initialized) { - if (!avctx->extradata) { - *got_frame_ptr = 0; - return avpkt->size; - } else { - push_output_configuration(&latmctx->aac_ctx); - if ((err = decode_audio_specific_config( - &latmctx->aac_ctx, avctx, &latmctx->aac_ctx.oc[1].m4ac, - avctx->extradata, avctx->extradata_size*8, 1)) < 0) { - pop_output_configuration(&latmctx->aac_ctx); - return err; - } - latmctx->initialized = 1; - } - } - - if (show_bits(&gb, 12) == 0xfff) { - av_log(latmctx->aac_ctx.avctx, AV_LOG_ERROR, - "ADTS header detected, probably as result of configuration " - "misparsing\n"); - return AVERROR_INVALIDDATA; - } - - if ((err = aac_decode_frame_int(avctx, out, got_frame_ptr, &gb, avpkt)) < 0) - return err; - - return muxlength; -} - -static av_cold int latm_decode_init(AVCodecContext *avctx) -{ - struct LATMContext *latmctx = avctx->priv_data; - int ret = aac_decode_init(avctx); - - if (avctx->extradata_size > 0) - latmctx->initialized = !ret; - - return ret; -} - -static void aacdec_init(AACContext *c) -{ - c->imdct_and_windowing = imdct_and_windowing; - c->apply_ltp = apply_ltp; - c->apply_tns = apply_tns; - c->windowing_and_mdct_ltp = windowing_and_mdct_ltp; - c->update_ltp = update_ltp; - - if(ARCH_MIPS) - ff_aacdec_init_mips(c); -} -/** - * AVOptions for Japanese DTV specific extensions (ADTS only) - */ -#define AACDEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM -static const AVOption options[] = { - {"dual_mono_mode", "Select the channel to decode for dual mono", - offsetof(AACContext, force_dmono_mode), AV_OPT_TYPE_INT, {.i64=-1}, -1, 2, - AACDEC_FLAGS, "dual_mono_mode"}, - - {"auto", "autoselection", 0, AV_OPT_TYPE_CONST, {.i64=-1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"}, - {"main", "Select Main/Left channel", 0, AV_OPT_TYPE_CONST, {.i64= 1}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"}, - {"sub" , "Select Sub/Right channel", 0, AV_OPT_TYPE_CONST, {.i64= 2}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"}, - {"both", "Select both channels", 0, AV_OPT_TYPE_CONST, {.i64= 0}, INT_MIN, INT_MAX, AACDEC_FLAGS, "dual_mono_mode"}, - - {NULL}, -}; - -static const AVClass aac_decoder_class = { - .class_name = "AAC decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_aac_decoder = { - .name = "aac", - .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_AAC, - .priv_data_size = sizeof(AACContext), - .init = aac_decode_init, - .close = aac_decode_close, - .decode = aac_decode_frame, - .sample_fmts = (const enum AVSampleFormat[]) { - AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE - }, - .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1, - .channel_layouts = aac_channel_layout, - .flush = flush, - .priv_class = &aac_decoder_class, -}; - -/* - Note: This decoder filter is intended to decode LATM streams transferred - in MPEG transport streams which only contain one program. - To do a more complex LATM demuxing a separate LATM demuxer should be used. -*/ -AVCodec ff_aac_latm_decoder = { - .name = "aac_latm", - .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_AAC_LATM, - .priv_data_size = sizeof(struct LATMContext), - .init = latm_decode_init, - .close = aac_decode_close, - .decode = latm_decode_frame, - .sample_fmts = (const enum AVSampleFormat[]) { - AV_SAMPLE_FMT_FLTP, AV_SAMPLE_FMT_NONE - }, - .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1, - .channel_layouts = aac_channel_layout, - .flush = flush, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdectab.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdectab.h deleted file mode 100644 index 4a12b4fb3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacdectab.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * AAC decoder data - * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) - * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC decoder data - * @author Oded Shimon ( ods15 ods15 dyndns org ) - * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) - */ - -#ifndef AVCODEC_AACDECTAB_H -#define AVCODEC_AACDECTAB_H - -#include "libavutil/channel_layout.h" -#include "aac.h" - -#include - -/* @name ltp_coef - * Table of the LTP coefficients - */ -static const float ltp_coef[8] = { - 0.570829, 0.696616, 0.813004, 0.911304, - 0.984900, 1.067894, 1.194601, 1.369533, -}; - -/* @name tns_tmp2_map - * Tables of the tmp2[] arrays of LPC coefficients used for TNS. - * The suffix _M_N[] indicate the values of coef_compress and coef_res - * respectively. - * @{ - */ -static const float tns_tmp2_map_1_3[4] = { - 0.00000000, -0.43388373, 0.64278758, 0.34202015, -}; - -static const float tns_tmp2_map_0_3[8] = { - 0.00000000, -0.43388373, -0.78183150, -0.97492790, - 0.98480773, 0.86602539, 0.64278758, 0.34202015, -}; - -static const float tns_tmp2_map_1_4[8] = { - 0.00000000, -0.20791170, -0.40673664, -0.58778524, - 0.67369562, 0.52643216, 0.36124167, 0.18374951, -}; - -static const float tns_tmp2_map_0_4[16] = { - 0.00000000, -0.20791170, -0.40673664, -0.58778524, - -0.74314481, -0.86602539, -0.95105654, -0.99452192, - 0.99573416, 0.96182561, 0.89516330, 0.79801720, - 0.67369562, 0.52643216, 0.36124167, 0.18374951, -}; - -static const float * const tns_tmp2_map[4] = { - tns_tmp2_map_0_3, - tns_tmp2_map_0_4, - tns_tmp2_map_1_3, - tns_tmp2_map_1_4 -}; -// @} - -static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 }; - -static const uint8_t aac_channel_layout_map[7][5][3] = { - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, }, - { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, }, - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, }, - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, - { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, -}; - -static const uint64_t aac_channel_layout[8] = { - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_SURROUND, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT0_BACK, - AV_CH_LAYOUT_5POINT1_BACK, - AV_CH_LAYOUT_7POINT1_WIDE_BACK, - 0, -}; - -#endif /* AVCODEC_AACDECTAB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.c deleted file mode 100644 index d11c4e1b1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.c +++ /dev/null @@ -1,975 +0,0 @@ -/* - * MPEG-4 Parametric Stereo decoding functions - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "libavutil/common.h" -#include "libavutil/internal.h" -#include "libavutil/mathematics.h" -#include "libavutil/intmath.h" -#include "avcodec.h" -#include "get_bits.h" -#include "aacps.h" -#include "aacps_tablegen.h" -#include "aacpsdata.c" - -#define PS_BASELINE 0 ///< Operate in Baseline PS mode - ///< Baseline implies 10 or 20 stereo bands, - ///< mixing mode A, and no ipd/opd - -#define numQMFSlots 32 //numTimeSlots * RATE - -static const int8_t num_env_tab[2][4] = { - { 0, 1, 2, 4, }, - { 1, 2, 3, 4, }, -}; - -static const int8_t nr_iidicc_par_tab[] = { - 10, 20, 34, 10, 20, 34, -}; - -static const int8_t nr_iidopd_par_tab[] = { - 5, 11, 17, 5, 11, 17, -}; - -enum { - huff_iid_df1, - huff_iid_dt1, - huff_iid_df0, - huff_iid_dt0, - huff_icc_df, - huff_icc_dt, - huff_ipd_df, - huff_ipd_dt, - huff_opd_df, - huff_opd_dt, -}; - -static const int huff_iid[] = { - huff_iid_df0, - huff_iid_df1, - huff_iid_dt0, - huff_iid_dt1, -}; - -static VLC vlc_ps[10]; - -#define READ_PAR_DATA(PAR, OFFSET, MASK, ERR_CONDITION) \ -/** \ - * Read Inter-channel Intensity Difference/Inter-Channel Coherence/ \ - * Inter-channel Phase Difference/Overall Phase Difference parameters from the \ - * bitstream. \ - * \ - * @param avctx contains the current codec context \ - * @param gb pointer to the input bitstream \ - * @param ps pointer to the Parametric Stereo context \ - * @param PAR pointer to the parameter to be read \ - * @param e envelope to decode \ - * @param dt 1: time delta-coded, 0: frequency delta-coded \ - */ \ -static int read_ ## PAR ## _data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, \ - int8_t (*PAR)[PS_MAX_NR_IIDICC], int table_idx, int e, int dt) \ -{ \ - int b, num = ps->nr_ ## PAR ## _par; \ - VLC_TYPE (*vlc_table)[2] = vlc_ps[table_idx].table; \ - if (dt) { \ - int e_prev = e ? e - 1 : ps->num_env_old - 1; \ - e_prev = FFMAX(e_prev, 0); \ - for (b = 0; b < num; b++) { \ - int val = PAR[e_prev][b] + get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \ - if (MASK) val &= MASK; \ - PAR[e][b] = val; \ - if (ERR_CONDITION) \ - goto err; \ - } \ - } else { \ - int val = 0; \ - for (b = 0; b < num; b++) { \ - val += get_vlc2(gb, vlc_table, 9, 3) - OFFSET; \ - if (MASK) val &= MASK; \ - PAR[e][b] = val; \ - if (ERR_CONDITION) \ - goto err; \ - } \ - } \ - return 0; \ -err: \ - av_log(avctx, AV_LOG_ERROR, "illegal "#PAR"\n"); \ - return -1; \ -} - -READ_PAR_DATA(iid, huff_offset[table_idx], 0, FFABS(ps->iid_par[e][b]) > 7 + 8 * ps->iid_quant) -READ_PAR_DATA(icc, huff_offset[table_idx], 0, ps->icc_par[e][b] > 7U) -READ_PAR_DATA(ipdopd, 0, 0x07, 0) - -static int ps_read_extension_data(GetBitContext *gb, PSContext *ps, int ps_extension_id) -{ - int e; - int count = get_bits_count(gb); - - if (ps_extension_id) - return 0; - - ps->enable_ipdopd = get_bits1(gb); - if (ps->enable_ipdopd) { - for (e = 0; e < ps->num_env; e++) { - int dt = get_bits1(gb); - read_ipdopd_data(NULL, gb, ps, ps->ipd_par, dt ? huff_ipd_dt : huff_ipd_df, e, dt); - dt = get_bits1(gb); - read_ipdopd_data(NULL, gb, ps, ps->opd_par, dt ? huff_opd_dt : huff_opd_df, e, dt); - } - } - skip_bits1(gb); //reserved_ps - return get_bits_count(gb) - count; -} - -static void ipdopd_reset(int8_t *ipd_hist, int8_t *opd_hist) -{ - int i; - for (i = 0; i < PS_MAX_NR_IPDOPD; i++) { - opd_hist[i] = 0; - ipd_hist[i] = 0; - } -} - -int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb_host, PSContext *ps, int bits_left) -{ - int e; - int bit_count_start = get_bits_count(gb_host); - int header; - int bits_consumed; - GetBitContext gbc = *gb_host, *gb = &gbc; - - header = get_bits1(gb); - if (header) { //enable_ps_header - ps->enable_iid = get_bits1(gb); - if (ps->enable_iid) { - int iid_mode = get_bits(gb, 3); - if (iid_mode > 5) { - av_log(avctx, AV_LOG_ERROR, "iid_mode %d is reserved.\n", - iid_mode); - goto err; - } - ps->nr_iid_par = nr_iidicc_par_tab[iid_mode]; - ps->iid_quant = iid_mode > 2; - ps->nr_ipdopd_par = nr_iidopd_par_tab[iid_mode]; - } - ps->enable_icc = get_bits1(gb); - if (ps->enable_icc) { - ps->icc_mode = get_bits(gb, 3); - if (ps->icc_mode > 5) { - av_log(avctx, AV_LOG_ERROR, "icc_mode %d is reserved.\n", - ps->icc_mode); - goto err; - } - ps->nr_icc_par = nr_iidicc_par_tab[ps->icc_mode]; - } - ps->enable_ext = get_bits1(gb); - } - - ps->frame_class = get_bits1(gb); - ps->num_env_old = ps->num_env; - ps->num_env = num_env_tab[ps->frame_class][get_bits(gb, 2)]; - - ps->border_position[0] = -1; - if (ps->frame_class) { - for (e = 1; e <= ps->num_env; e++) - ps->border_position[e] = get_bits(gb, 5); - } else - for (e = 1; e <= ps->num_env; e++) - ps->border_position[e] = (e * numQMFSlots >> ff_log2_tab[ps->num_env]) - 1; - - if (ps->enable_iid) { - for (e = 0; e < ps->num_env; e++) { - int dt = get_bits1(gb); - if (read_iid_data(avctx, gb, ps, ps->iid_par, huff_iid[2*dt+ps->iid_quant], e, dt)) - goto err; - } - } else - memset(ps->iid_par, 0, sizeof(ps->iid_par)); - - if (ps->enable_icc) - for (e = 0; e < ps->num_env; e++) { - int dt = get_bits1(gb); - if (read_icc_data(avctx, gb, ps, ps->icc_par, dt ? huff_icc_dt : huff_icc_df, e, dt)) - goto err; - } - else - memset(ps->icc_par, 0, sizeof(ps->icc_par)); - - if (ps->enable_ext) { - int cnt = get_bits(gb, 4); - if (cnt == 15) { - cnt += get_bits(gb, 8); - } - cnt *= 8; - while (cnt > 7) { - int ps_extension_id = get_bits(gb, 2); - cnt -= 2 + ps_read_extension_data(gb, ps, ps_extension_id); - } - if (cnt < 0) { - av_log(avctx, AV_LOG_ERROR, "ps extension overflow %d\n", cnt); - goto err; - } - skip_bits(gb, cnt); - } - - ps->enable_ipdopd &= !PS_BASELINE; - - //Fix up envelopes - if (!ps->num_env || ps->border_position[ps->num_env] < numQMFSlots - 1) { - //Create a fake envelope - int source = ps->num_env ? ps->num_env - 1 : ps->num_env_old - 1; - int b; - if (source >= 0 && source != ps->num_env) { - if (ps->enable_iid) { - memcpy(ps->iid_par+ps->num_env, ps->iid_par+source, sizeof(ps->iid_par[0])); - } - if (ps->enable_icc) { - memcpy(ps->icc_par+ps->num_env, ps->icc_par+source, sizeof(ps->icc_par[0])); - } - if (ps->enable_ipdopd) { - memcpy(ps->ipd_par+ps->num_env, ps->ipd_par+source, sizeof(ps->ipd_par[0])); - memcpy(ps->opd_par+ps->num_env, ps->opd_par+source, sizeof(ps->opd_par[0])); - } - } - if (ps->enable_iid){ - for (b = 0; b < ps->nr_iid_par; b++) { - if (FFABS(ps->iid_par[ps->num_env][b]) > 7 + 8 * ps->iid_quant) { - av_log(avctx, AV_LOG_ERROR, "iid_par invalid\n"); - goto err; - } - } - } - if (ps->enable_icc){ - for (b = 0; b < ps->nr_iid_par; b++) { - if (ps->icc_par[ps->num_env][b] > 7U) { - av_log(avctx, AV_LOG_ERROR, "icc_par invalid\n"); - goto err; - } - } - } - ps->num_env++; - ps->border_position[ps->num_env] = numQMFSlots - 1; - } - - - ps->is34bands_old = ps->is34bands; - if (!PS_BASELINE && (ps->enable_iid || ps->enable_icc)) - ps->is34bands = (ps->enable_iid && ps->nr_iid_par == 34) || - (ps->enable_icc && ps->nr_icc_par == 34); - - //Baseline - if (!ps->enable_ipdopd) { - memset(ps->ipd_par, 0, sizeof(ps->ipd_par)); - memset(ps->opd_par, 0, sizeof(ps->opd_par)); - } - - if (header) - ps->start = 1; - - bits_consumed = get_bits_count(gb) - bit_count_start; - if (bits_consumed <= bits_left) { - skip_bits_long(gb_host, bits_consumed); - return bits_consumed; - } - av_log(avctx, AV_LOG_ERROR, "Expected to read %d PS bits actually read %d.\n", bits_left, bits_consumed); -err: - ps->start = 0; - skip_bits_long(gb_host, bits_left); - memset(ps->iid_par, 0, sizeof(ps->iid_par)); - memset(ps->icc_par, 0, sizeof(ps->icc_par)); - memset(ps->ipd_par, 0, sizeof(ps->ipd_par)); - memset(ps->opd_par, 0, sizeof(ps->opd_par)); - return bits_left; -} - -/** Split one subband into 2 subsubbands with a symmetric real filter. - * The filter must have its non-center even coefficients equal to zero. */ -static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[8], int len, int reverse) -{ - int i, j; - for (i = 0; i < len; i++, in++) { - float re_in = filter[6] * in[6][0]; //real inphase - float re_op = 0.0f; //real out of phase - float im_in = filter[6] * in[6][1]; //imag inphase - float im_op = 0.0f; //imag out of phase - for (j = 0; j < 6; j += 2) { - re_op += filter[j+1] * (in[j+1][0] + in[12-j-1][0]); - im_op += filter[j+1] * (in[j+1][1] + in[12-j-1][1]); - } - out[ reverse][i][0] = re_in + re_op; - out[ reverse][i][1] = im_in + im_op; - out[!reverse][i][0] = re_in - re_op; - out[!reverse][i][1] = im_in - im_op; - } -} - -/** Split one subband into 6 subsubbands with a complex filter */ -static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], - TABLE_CONST float (*filter)[8][2], int len) -{ - int i; - int N = 8; - LOCAL_ALIGNED_16(float, temp, [8], [2]); - - for (i = 0; i < len; i++, in++) { - dsp->hybrid_analysis(temp, in, (const float (*)[8][2]) filter, 1, N); - out[0][i][0] = temp[6][0]; - out[0][i][1] = temp[6][1]; - out[1][i][0] = temp[7][0]; - out[1][i][1] = temp[7][1]; - out[2][i][0] = temp[0][0]; - out[2][i][1] = temp[0][1]; - out[3][i][0] = temp[1][0]; - out[3][i][1] = temp[1][1]; - out[4][i][0] = temp[2][0] + temp[5][0]; - out[4][i][1] = temp[2][1] + temp[5][1]; - out[5][i][0] = temp[3][0] + temp[4][0]; - out[5][i][1] = temp[3][1] + temp[4][1]; - } -} - -static void hybrid4_8_12_cx(PSDSPContext *dsp, - float (*in)[2], float (*out)[32][2], - TABLE_CONST float (*filter)[8][2], int N, int len) -{ - int i; - - for (i = 0; i < len; i++, in++) { - dsp->hybrid_analysis(out[0] + i, in, (const float (*)[8][2]) filter, 32, N); - } -} - -static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2], - float in[5][44][2], float L[2][38][64], - int is34, int len) -{ - int i, j; - for (i = 0; i < 5; i++) { - for (j = 0; j < 38; j++) { - in[i][j+6][0] = L[0][j][i]; - in[i][j+6][1] = L[1][j][i]; - } - } - if (is34) { - hybrid4_8_12_cx(dsp, in[0], out, f34_0_12, 12, len); - hybrid4_8_12_cx(dsp, in[1], out+12, f34_1_8, 8, len); - hybrid4_8_12_cx(dsp, in[2], out+20, f34_2_4, 4, len); - hybrid4_8_12_cx(dsp, in[3], out+24, f34_2_4, 4, len); - hybrid4_8_12_cx(dsp, in[4], out+28, f34_2_4, 4, len); - dsp->hybrid_analysis_ileave(out + 27, L, 5, len); - } else { - hybrid6_cx(dsp, in[0], out, f20_0_8, len); - hybrid2_re(in[1], out+6, g1_Q2, len, 1); - hybrid2_re(in[2], out+8, g1_Q2, len, 0); - dsp->hybrid_analysis_ileave(out + 7, L, 3, len); - } - //update in_buf - for (i = 0; i < 5; i++) { - memcpy(in[i], in[i]+32, 6 * sizeof(in[i][0])); - } -} - -static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64], - float in[91][32][2], int is34, int len) -{ - int i, n; - if (is34) { - for (n = 0; n < len; n++) { - memset(out[0][n], 0, 5*sizeof(out[0][n][0])); - memset(out[1][n], 0, 5*sizeof(out[1][n][0])); - for (i = 0; i < 12; i++) { - out[0][n][0] += in[ i][n][0]; - out[1][n][0] += in[ i][n][1]; - } - for (i = 0; i < 8; i++) { - out[0][n][1] += in[12+i][n][0]; - out[1][n][1] += in[12+i][n][1]; - } - for (i = 0; i < 4; i++) { - out[0][n][2] += in[20+i][n][0]; - out[1][n][2] += in[20+i][n][1]; - out[0][n][3] += in[24+i][n][0]; - out[1][n][3] += in[24+i][n][1]; - out[0][n][4] += in[28+i][n][0]; - out[1][n][4] += in[28+i][n][1]; - } - } - dsp->hybrid_synthesis_deint(out, in + 27, 5, len); - } else { - for (n = 0; n < len; n++) { - out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] + - in[3][n][0] + in[4][n][0] + in[5][n][0]; - out[1][n][0] = in[0][n][1] + in[1][n][1] + in[2][n][1] + - in[3][n][1] + in[4][n][1] + in[5][n][1]; - out[0][n][1] = in[6][n][0] + in[7][n][0]; - out[1][n][1] = in[6][n][1] + in[7][n][1]; - out[0][n][2] = in[8][n][0] + in[9][n][0]; - out[1][n][2] = in[8][n][1] + in[9][n][1]; - } - dsp->hybrid_synthesis_deint(out, in + 7, 3, len); - } -} - -/// All-pass filter decay slope -#define DECAY_SLOPE 0.05f -/// Number of frequency bands that can be addressed by the parameter index, b(k) -static const int NR_PAR_BANDS[] = { 20, 34 }; -static const int NR_IPDOPD_BANDS[] = { 11, 17 }; -/// Number of frequency bands that can be addressed by the sub subband index, k -static const int NR_BANDS[] = { 71, 91 }; -/// Start frequency band for the all-pass filter decay slope -static const int DECAY_CUTOFF[] = { 10, 32 }; -/// Number of all-pass filer bands -static const int NR_ALLPASS_BANDS[] = { 30, 50 }; -/// First stereo band using the short one sample delay -static const int SHORT_DELAY_BAND[] = { 42, 62 }; - -/** Table 8.46 */ -static void map_idx_10_to_20(int8_t *par_mapped, const int8_t *par, int full) -{ - int b; - if (full) - b = 9; - else { - b = 4; - par_mapped[10] = 0; - } - for (; b >= 0; b--) { - par_mapped[2*b+1] = par_mapped[2*b] = par[b]; - } -} - -static void map_idx_34_to_20(int8_t *par_mapped, const int8_t *par, int full) -{ - par_mapped[ 0] = (2*par[ 0] + par[ 1]) / 3; - par_mapped[ 1] = ( par[ 1] + 2*par[ 2]) / 3; - par_mapped[ 2] = (2*par[ 3] + par[ 4]) / 3; - par_mapped[ 3] = ( par[ 4] + 2*par[ 5]) / 3; - par_mapped[ 4] = ( par[ 6] + par[ 7]) / 2; - par_mapped[ 5] = ( par[ 8] + par[ 9]) / 2; - par_mapped[ 6] = par[10]; - par_mapped[ 7] = par[11]; - par_mapped[ 8] = ( par[12] + par[13]) / 2; - par_mapped[ 9] = ( par[14] + par[15]) / 2; - par_mapped[10] = par[16]; - if (full) { - par_mapped[11] = par[17]; - par_mapped[12] = par[18]; - par_mapped[13] = par[19]; - par_mapped[14] = ( par[20] + par[21]) / 2; - par_mapped[15] = ( par[22] + par[23]) / 2; - par_mapped[16] = ( par[24] + par[25]) / 2; - par_mapped[17] = ( par[26] + par[27]) / 2; - par_mapped[18] = ( par[28] + par[29] + par[30] + par[31]) / 4; - par_mapped[19] = ( par[32] + par[33]) / 2; - } -} - -static void map_val_34_to_20(float par[PS_MAX_NR_IIDICC]) -{ - par[ 0] = (2*par[ 0] + par[ 1]) * 0.33333333f; - par[ 1] = ( par[ 1] + 2*par[ 2]) * 0.33333333f; - par[ 2] = (2*par[ 3] + par[ 4]) * 0.33333333f; - par[ 3] = ( par[ 4] + 2*par[ 5]) * 0.33333333f; - par[ 4] = ( par[ 6] + par[ 7]) * 0.5f; - par[ 5] = ( par[ 8] + par[ 9]) * 0.5f; - par[ 6] = par[10]; - par[ 7] = par[11]; - par[ 8] = ( par[12] + par[13]) * 0.5f; - par[ 9] = ( par[14] + par[15]) * 0.5f; - par[10] = par[16]; - par[11] = par[17]; - par[12] = par[18]; - par[13] = par[19]; - par[14] = ( par[20] + par[21]) * 0.5f; - par[15] = ( par[22] + par[23]) * 0.5f; - par[16] = ( par[24] + par[25]) * 0.5f; - par[17] = ( par[26] + par[27]) * 0.5f; - par[18] = ( par[28] + par[29] + par[30] + par[31]) * 0.25f; - par[19] = ( par[32] + par[33]) * 0.5f; -} - -static void map_idx_10_to_34(int8_t *par_mapped, const int8_t *par, int full) -{ - if (full) { - par_mapped[33] = par[9]; - par_mapped[32] = par[9]; - par_mapped[31] = par[9]; - par_mapped[30] = par[9]; - par_mapped[29] = par[9]; - par_mapped[28] = par[9]; - par_mapped[27] = par[8]; - par_mapped[26] = par[8]; - par_mapped[25] = par[8]; - par_mapped[24] = par[8]; - par_mapped[23] = par[7]; - par_mapped[22] = par[7]; - par_mapped[21] = par[7]; - par_mapped[20] = par[7]; - par_mapped[19] = par[6]; - par_mapped[18] = par[6]; - par_mapped[17] = par[5]; - par_mapped[16] = par[5]; - } else { - par_mapped[16] = 0; - } - par_mapped[15] = par[4]; - par_mapped[14] = par[4]; - par_mapped[13] = par[4]; - par_mapped[12] = par[4]; - par_mapped[11] = par[3]; - par_mapped[10] = par[3]; - par_mapped[ 9] = par[2]; - par_mapped[ 8] = par[2]; - par_mapped[ 7] = par[2]; - par_mapped[ 6] = par[2]; - par_mapped[ 5] = par[1]; - par_mapped[ 4] = par[1]; - par_mapped[ 3] = par[1]; - par_mapped[ 2] = par[0]; - par_mapped[ 1] = par[0]; - par_mapped[ 0] = par[0]; -} - -static void map_idx_20_to_34(int8_t *par_mapped, const int8_t *par, int full) -{ - if (full) { - par_mapped[33] = par[19]; - par_mapped[32] = par[19]; - par_mapped[31] = par[18]; - par_mapped[30] = par[18]; - par_mapped[29] = par[18]; - par_mapped[28] = par[18]; - par_mapped[27] = par[17]; - par_mapped[26] = par[17]; - par_mapped[25] = par[16]; - par_mapped[24] = par[16]; - par_mapped[23] = par[15]; - par_mapped[22] = par[15]; - par_mapped[21] = par[14]; - par_mapped[20] = par[14]; - par_mapped[19] = par[13]; - par_mapped[18] = par[12]; - par_mapped[17] = par[11]; - } - par_mapped[16] = par[10]; - par_mapped[15] = par[ 9]; - par_mapped[14] = par[ 9]; - par_mapped[13] = par[ 8]; - par_mapped[12] = par[ 8]; - par_mapped[11] = par[ 7]; - par_mapped[10] = par[ 6]; - par_mapped[ 9] = par[ 5]; - par_mapped[ 8] = par[ 5]; - par_mapped[ 7] = par[ 4]; - par_mapped[ 6] = par[ 4]; - par_mapped[ 5] = par[ 3]; - par_mapped[ 4] = (par[ 2] + par[ 3]) / 2; - par_mapped[ 3] = par[ 2]; - par_mapped[ 2] = par[ 1]; - par_mapped[ 1] = (par[ 0] + par[ 1]) / 2; - par_mapped[ 0] = par[ 0]; -} - -static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC]) -{ - par[33] = par[19]; - par[32] = par[19]; - par[31] = par[18]; - par[30] = par[18]; - par[29] = par[18]; - par[28] = par[18]; - par[27] = par[17]; - par[26] = par[17]; - par[25] = par[16]; - par[24] = par[16]; - par[23] = par[15]; - par[22] = par[15]; - par[21] = par[14]; - par[20] = par[14]; - par[19] = par[13]; - par[18] = par[12]; - par[17] = par[11]; - par[16] = par[10]; - par[15] = par[ 9]; - par[14] = par[ 9]; - par[13] = par[ 8]; - par[12] = par[ 8]; - par[11] = par[ 7]; - par[10] = par[ 6]; - par[ 9] = par[ 5]; - par[ 8] = par[ 5]; - par[ 7] = par[ 4]; - par[ 6] = par[ 4]; - par[ 5] = par[ 3]; - par[ 4] = (par[ 2] + par[ 3]) * 0.5f; - par[ 3] = par[ 2]; - par[ 2] = par[ 1]; - par[ 1] = (par[ 0] + par[ 1]) * 0.5f; -} - -static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34) -{ - LOCAL_ALIGNED_16(float, power, [34], [PS_QMF_TIME_SLOTS]); - LOCAL_ALIGNED_16(float, transient_gain, [34], [PS_QMF_TIME_SLOTS]); - float *peak_decay_nrg = ps->peak_decay_nrg; - float *power_smooth = ps->power_smooth; - float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth; - float (*delay)[PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2] = ps->delay; - float (*ap_delay)[PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2] = ps->ap_delay; - const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20; - const float peak_decay_factor = 0.76592833836465f; - const float transient_impact = 1.5f; - const float a_smooth = 0.25f; ///< Smoothing coefficient - int i, k, m, n; - int n0 = 0, nL = 32; - - memset(power, 0, 34 * sizeof(*power)); - - if (is34 != ps->is34bands_old) { - memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg)); - memset(ps->power_smooth, 0, sizeof(ps->power_smooth)); - memset(ps->peak_decay_diff_smooth, 0, sizeof(ps->peak_decay_diff_smooth)); - memset(ps->delay, 0, sizeof(ps->delay)); - memset(ps->ap_delay, 0, sizeof(ps->ap_delay)); - } - - for (k = 0; k < NR_BANDS[is34]; k++) { - int i = k_to_i[k]; - ps->dsp.add_squares(power[i], s[k], nL - n0); - } - - //Transient detection - for (i = 0; i < NR_PAR_BANDS[is34]; i++) { - for (n = n0; n < nL; n++) { - float decayed_peak = peak_decay_factor * peak_decay_nrg[i]; - float denom; - peak_decay_nrg[i] = FFMAX(decayed_peak, power[i][n]); - power_smooth[i] += a_smooth * (power[i][n] - power_smooth[i]); - peak_decay_diff_smooth[i] += a_smooth * (peak_decay_nrg[i] - power[i][n] - peak_decay_diff_smooth[i]); - denom = transient_impact * peak_decay_diff_smooth[i]; - transient_gain[i][n] = (denom > power_smooth[i]) ? - power_smooth[i] / denom : 1.0f; - } - } - - //Decorrelation and transient reduction - // PS_AP_LINKS - 1 - // ----- - // | | Q_fract_allpass[k][m]*z^-link_delay[m] - a[m]*g_decay_slope[k] - //H[k][z] = z^-2 * phi_fract[k] * | | ---------------------------------------------------------------- - // | | 1 - a[m]*g_decay_slope[k]*Q_fract_allpass[k][m]*z^-link_delay[m] - // m = 0 - //d[k][z] (out) = transient_gain_mapped[k][z] * H[k][z] * s[k][z] - for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) { - int b = k_to_i[k]; - float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); - g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f); - memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); - memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); - for (m = 0; m < PS_AP_LINKS; m++) { - memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0])); - } - ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k], - phi_fract[is34][k], - (const float (*)[2]) Q_fract_allpass[is34][k], - transient_gain[b], g_decay_slope, nL - n0); - } - for (; k < SHORT_DELAY_BAND[is34]; k++) { - int i = k_to_i[k]; - memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); - memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); - //H = delay 14 - ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14, - transient_gain[i], nL - n0); - } - for (; k < NR_BANDS[is34]; k++) { - int i = k_to_i[k]; - memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); - memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); - //H = delay 1 - ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1, - transient_gain[i], nL - n0); - } -} - -static void remap34(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC], - int8_t (*par)[PS_MAX_NR_IIDICC], - int num_par, int num_env, int full) -{ - int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped; - int e; - if (num_par == 20 || num_par == 11) { - for (e = 0; e < num_env; e++) { - map_idx_20_to_34(par_mapped[e], par[e], full); - } - } else if (num_par == 10 || num_par == 5) { - for (e = 0; e < num_env; e++) { - map_idx_10_to_34(par_mapped[e], par[e], full); - } - } else { - *p_par_mapped = par; - } -} - -static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC], - int8_t (*par)[PS_MAX_NR_IIDICC], - int num_par, int num_env, int full) -{ - int8_t (*par_mapped)[PS_MAX_NR_IIDICC] = *p_par_mapped; - int e; - if (num_par == 34 || num_par == 17) { - for (e = 0; e < num_env; e++) { - map_idx_34_to_20(par_mapped[e], par[e], full); - } - } else if (num_par == 10 || num_par == 5) { - for (e = 0; e < num_env; e++) { - map_idx_10_to_20(par_mapped[e], par[e], full); - } - } else { - *p_par_mapped = par; - } -} - -static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34) -{ - int e, b, k; - - float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11; - float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12; - float (*H21)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H21; - float (*H22)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H22; - int8_t *opd_hist = ps->opd_hist; - int8_t *ipd_hist = ps->ipd_hist; - int8_t iid_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; - int8_t icc_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; - int8_t ipd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; - int8_t opd_mapped_buf[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; - int8_t (*iid_mapped)[PS_MAX_NR_IIDICC] = iid_mapped_buf; - int8_t (*icc_mapped)[PS_MAX_NR_IIDICC] = icc_mapped_buf; - int8_t (*ipd_mapped)[PS_MAX_NR_IIDICC] = ipd_mapped_buf; - int8_t (*opd_mapped)[PS_MAX_NR_IIDICC] = opd_mapped_buf; - const int8_t *k_to_i = is34 ? k_to_i_34 : k_to_i_20; - TABLE_CONST float (*H_LUT)[8][4] = (PS_BASELINE || ps->icc_mode < 3) ? HA : HB; - - //Remapping - if (ps->num_env_old) { - memcpy(H11[0][0], H11[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[0][0][0])); - memcpy(H11[1][0], H11[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H11[1][0][0])); - memcpy(H12[0][0], H12[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[0][0][0])); - memcpy(H12[1][0], H12[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H12[1][0][0])); - memcpy(H21[0][0], H21[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[0][0][0])); - memcpy(H21[1][0], H21[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H21[1][0][0])); - memcpy(H22[0][0], H22[0][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[0][0][0])); - memcpy(H22[1][0], H22[1][ps->num_env_old], PS_MAX_NR_IIDICC*sizeof(H22[1][0][0])); - } - - if (is34) { - remap34(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1); - remap34(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1); - if (ps->enable_ipdopd) { - remap34(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0); - remap34(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0); - } - if (!ps->is34bands_old) { - map_val_20_to_34(H11[0][0]); - map_val_20_to_34(H11[1][0]); - map_val_20_to_34(H12[0][0]); - map_val_20_to_34(H12[1][0]); - map_val_20_to_34(H21[0][0]); - map_val_20_to_34(H21[1][0]); - map_val_20_to_34(H22[0][0]); - map_val_20_to_34(H22[1][0]); - ipdopd_reset(ipd_hist, opd_hist); - } - } else { - remap20(&iid_mapped, ps->iid_par, ps->nr_iid_par, ps->num_env, 1); - remap20(&icc_mapped, ps->icc_par, ps->nr_icc_par, ps->num_env, 1); - if (ps->enable_ipdopd) { - remap20(&ipd_mapped, ps->ipd_par, ps->nr_ipdopd_par, ps->num_env, 0); - remap20(&opd_mapped, ps->opd_par, ps->nr_ipdopd_par, ps->num_env, 0); - } - if (ps->is34bands_old) { - map_val_34_to_20(H11[0][0]); - map_val_34_to_20(H11[1][0]); - map_val_34_to_20(H12[0][0]); - map_val_34_to_20(H12[1][0]); - map_val_34_to_20(H21[0][0]); - map_val_34_to_20(H21[1][0]); - map_val_34_to_20(H22[0][0]); - map_val_34_to_20(H22[1][0]); - ipdopd_reset(ipd_hist, opd_hist); - } - } - - //Mixing - for (e = 0; e < ps->num_env; e++) { - for (b = 0; b < NR_PAR_BANDS[is34]; b++) { - float h11, h12, h21, h22; - h11 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][0]; - h12 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][1]; - h21 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][2]; - h22 = H_LUT[iid_mapped[e][b] + 7 + 23 * ps->iid_quant][icc_mapped[e][b]][3]; - - if (!PS_BASELINE && ps->enable_ipdopd && b < NR_IPDOPD_BANDS[is34]) { - //The spec say says to only run this smoother when enable_ipdopd - //is set but the reference decoder appears to run it constantly - float h11i, h12i, h21i, h22i; - float ipd_adj_re, ipd_adj_im; - int opd_idx = opd_hist[b] * 8 + opd_mapped[e][b]; - int ipd_idx = ipd_hist[b] * 8 + ipd_mapped[e][b]; - float opd_re = pd_re_smooth[opd_idx]; - float opd_im = pd_im_smooth[opd_idx]; - float ipd_re = pd_re_smooth[ipd_idx]; - float ipd_im = pd_im_smooth[ipd_idx]; - opd_hist[b] = opd_idx & 0x3F; - ipd_hist[b] = ipd_idx & 0x3F; - - ipd_adj_re = opd_re*ipd_re + opd_im*ipd_im; - ipd_adj_im = opd_im*ipd_re - opd_re*ipd_im; - h11i = h11 * opd_im; - h11 = h11 * opd_re; - h12i = h12 * ipd_adj_im; - h12 = h12 * ipd_adj_re; - h21i = h21 * opd_im; - h21 = h21 * opd_re; - h22i = h22 * ipd_adj_im; - h22 = h22 * ipd_adj_re; - H11[1][e+1][b] = h11i; - H12[1][e+1][b] = h12i; - H21[1][e+1][b] = h21i; - H22[1][e+1][b] = h22i; - } - H11[0][e+1][b] = h11; - H12[0][e+1][b] = h12; - H21[0][e+1][b] = h21; - H22[0][e+1][b] = h22; - } - for (k = 0; k < NR_BANDS[is34]; k++) { - float h[2][4]; - float h_step[2][4]; - int start = ps->border_position[e]; - int stop = ps->border_position[e+1]; - float width = 1.f / (stop - start); - b = k_to_i[k]; - h[0][0] = H11[0][e][b]; - h[0][1] = H12[0][e][b]; - h[0][2] = H21[0][e][b]; - h[0][3] = H22[0][e][b]; - if (!PS_BASELINE && ps->enable_ipdopd) { - //Is this necessary? ps_04_new seems unchanged - if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) { - h[1][0] = -H11[1][e][b]; - h[1][1] = -H12[1][e][b]; - h[1][2] = -H21[1][e][b]; - h[1][3] = -H22[1][e][b]; - } else { - h[1][0] = H11[1][e][b]; - h[1][1] = H12[1][e][b]; - h[1][2] = H21[1][e][b]; - h[1][3] = H22[1][e][b]; - } - } - //Interpolation - h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width; - h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width; - h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width; - h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width; - if (!PS_BASELINE && ps->enable_ipdopd) { - h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width; - h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width; - h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width; - h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width; - } - ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd]( - l[k] + start + 1, r[k] + start + 1, - h, h_step, stop - start); - } - } -} - -int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top) -{ - LOCAL_ALIGNED_16(float, Lbuf, [91], [32][2]); - LOCAL_ALIGNED_16(float, Rbuf, [91], [32][2]); - const int len = 32; - int is34 = ps->is34bands; - - top += NR_BANDS[is34] - 64; - memset(ps->delay+top, 0, (NR_BANDS[is34] - top)*sizeof(ps->delay[0])); - if (top < NR_ALLPASS_BANDS[is34]) - memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0])); - - hybrid_analysis(&ps->dsp, Lbuf, ps->in_buf, L, is34, len); - decorrelation(ps, Rbuf, (const float (*)[32][2]) Lbuf, is34); - stereo_processing(ps, Lbuf, Rbuf, is34); - hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len); - hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len); - - return 0; -} - -#define PS_INIT_VLC_STATIC(num, size) \ - INIT_VLC_STATIC(&vlc_ps[num], 9, ps_tmp[num].table_size / ps_tmp[num].elem_size, \ - ps_tmp[num].ps_bits, 1, 1, \ - ps_tmp[num].ps_codes, ps_tmp[num].elem_size, ps_tmp[num].elem_size, \ - size); - -#define PS_VLC_ROW(name) \ - { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) } - -av_cold void ff_ps_init(void) { - // Syntax initialization - static const struct { - const void *ps_codes, *ps_bits; - const unsigned int table_size, elem_size; - } ps_tmp[] = { - PS_VLC_ROW(huff_iid_df1), - PS_VLC_ROW(huff_iid_dt1), - PS_VLC_ROW(huff_iid_df0), - PS_VLC_ROW(huff_iid_dt0), - PS_VLC_ROW(huff_icc_df), - PS_VLC_ROW(huff_icc_dt), - PS_VLC_ROW(huff_ipd_df), - PS_VLC_ROW(huff_ipd_dt), - PS_VLC_ROW(huff_opd_df), - PS_VLC_ROW(huff_opd_dt), - }; - - PS_INIT_VLC_STATIC(0, 1544); - PS_INIT_VLC_STATIC(1, 832); - PS_INIT_VLC_STATIC(2, 1024); - PS_INIT_VLC_STATIC(3, 1036); - PS_INIT_VLC_STATIC(4, 544); - PS_INIT_VLC_STATIC(5, 544); - PS_INIT_VLC_STATIC(6, 512); - PS_INIT_VLC_STATIC(7, 512); - PS_INIT_VLC_STATIC(8, 512); - PS_INIT_VLC_STATIC(9, 512); - - ps_tableinit(); -} - -av_cold void ff_ps_ctx_init(PSContext *ps) -{ - ff_psdsp_init(&ps->dsp); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.h deleted file mode 100644 index 29323ffc0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * MPEG-4 Parametric Stereo definitions and declarations - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_PS_H -#define AVCODEC_PS_H - -#include - -#include "aacpsdsp.h" -#include "avcodec.h" -#include "get_bits.h" - -#define PS_MAX_NUM_ENV 5 -#define PS_MAX_NR_IIDICC 34 -#define PS_MAX_NR_IPDOPD 17 -#define PS_MAX_SSB 91 -#define PS_MAX_AP_BANDS 50 -#define PS_QMF_TIME_SLOTS 32 -#define PS_MAX_DELAY 14 -#define PS_AP_LINKS 3 -#define PS_MAX_AP_DELAY 5 - -typedef struct PSContext { - int start; - int enable_iid; - int iid_quant; - int nr_iid_par; - int nr_ipdopd_par; - int enable_icc; - int icc_mode; - int nr_icc_par; - int enable_ext; - int frame_class; - int num_env_old; - int num_env; - int enable_ipdopd; - int border_position[PS_MAX_NUM_ENV+1]; - int8_t iid_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; ///< Inter-channel Intensity Difference Parameters - int8_t icc_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; ///< Inter-Channel Coherence Parameters - /* ipd/opd is iid/icc sized so that the same functions can handle both */ - int8_t ipd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; ///< Inter-channel Phase Difference Parameters - int8_t opd_par[PS_MAX_NUM_ENV][PS_MAX_NR_IIDICC]; ///< Overall Phase Difference Parameters - int is34bands; - int is34bands_old; - - DECLARE_ALIGNED(16, float, in_buf)[5][44][2]; - DECLARE_ALIGNED(16, float, delay)[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2]; - DECLARE_ALIGNED(16, float, ap_delay)[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2]; - DECLARE_ALIGNED(16, float, peak_decay_nrg)[34]; - DECLARE_ALIGNED(16, float, power_smooth)[34]; - DECLARE_ALIGNED(16, float, peak_decay_diff_smooth)[34]; - DECLARE_ALIGNED(16, float, H11)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; - DECLARE_ALIGNED(16, float, H12)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; - DECLARE_ALIGNED(16, float, H21)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; - DECLARE_ALIGNED(16, float, H22)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; - int8_t opd_hist[PS_MAX_NR_IIDICC]; - int8_t ipd_hist[PS_MAX_NR_IIDICC]; - PSDSPContext dsp; -} PSContext; - -void ff_ps_init(void); -void ff_ps_ctx_init(PSContext *ps); -int ff_ps_read_data(AVCodecContext *avctx, GetBitContext *gb, PSContext *ps, int bits_left); -int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top); - -#endif /* AVCODEC_PS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.c deleted file mode 100644 index 47d4205f4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Generate a header file for hardcoded Parametric Stereo tables - * - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#define CONFIG_HARDCODED_TABLES 0 -#include "aacps_tablegen.h" -#include "tableprint.h" - -void write_float_3d_array (const void *p, int b, int c, int d) -{ - int i; - const float *f = p; - for (i = 0; i < b; i++) { - printf("{\n"); - write_float_2d_array(f, c, d); - printf("},\n"); - f += c * d; - } -} - -void write_float_4d_array (const void *p, int a, int b, int c, int d) -{ - int i; - const float *f = p; - for (i = 0; i < a; i++) { - printf("{\n"); - write_float_3d_array(f, b, c, d); - printf("},\n"); - f += b * c * d; - } -} - -int main(void) -{ - ps_tableinit(); - - write_fileheader(); - - printf("static const float pd_re_smooth[8*8*8] = {\n"); - write_float_array(pd_re_smooth, 8*8*8); - printf("};\n"); - printf("static const float pd_im_smooth[8*8*8] = {\n"); - write_float_array(pd_im_smooth, 8*8*8); - printf("};\n"); - - printf("static const float HA[46][8][4] = {\n"); - write_float_3d_array(HA, 46, 8, 4); - printf("};\n"); - printf("static const float HB[46][8][4] = {\n"); - write_float_3d_array(HB, 46, 8, 4); - printf("};\n"); - - printf("static const DECLARE_ALIGNED(16, float, f20_0_8)[8][8][2] = {\n"); - write_float_3d_array(f20_0_8, 8, 8, 2); - printf("};\n"); - printf("static const DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2] = {\n"); - write_float_3d_array(f34_0_12, 12, 8, 2); - printf("};\n"); - printf("static const DECLARE_ALIGNED(16, float, f34_1_8)[8][8][2] = {\n"); - write_float_3d_array(f34_1_8, 8, 8, 2); - printf("};\n"); - printf("static const DECLARE_ALIGNED(16, float, f34_2_4)[4][8][2] = {\n"); - write_float_3d_array(f34_2_4, 4, 8, 2); - printf("};\n"); - - printf("static TABLE_CONST DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2] = {\n"); - write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2); - printf("};\n"); - printf("static const DECLARE_ALIGNED(16, float, phi_fract)[2][50][2] = {\n"); - write_float_3d_array(phi_fract, 2, 50, 2); - printf("};\n"); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.h deleted file mode 100644 index 9df38ffd8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacps_tablegen.h +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Header file for hardcoded Parametric Stereo tables - * - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AACPS_TABLEGEN_H -#define AACPS_TABLEGEN_H - -#include -#include - -#if CONFIG_HARDCODED_TABLES -#define ps_tableinit() -#define TABLE_CONST const -#include "libavcodec/aacps_tables.h" -#else -#include "libavutil/common.h" -#include "libavutil/libm.h" -#include "libavutil/mathematics.h" -#include "libavutil/mem.h" -#define NR_ALLPASS_BANDS20 30 -#define NR_ALLPASS_BANDS34 50 -#define PS_AP_LINKS 3 -#define TABLE_CONST -static float pd_re_smooth[8*8*8]; -static float pd_im_smooth[8*8*8]; -static float HA[46][8][4]; -static float HB[46][8][4]; -static DECLARE_ALIGNED(16, float, f20_0_8) [ 8][8][2]; -static DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2]; -static DECLARE_ALIGNED(16, float, f34_1_8) [ 8][8][2]; -static DECLARE_ALIGNED(16, float, f34_2_4) [ 4][8][2]; -static TABLE_CONST DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2]; -static DECLARE_ALIGNED(16, float, phi_fract)[2][50][2]; - -static const float g0_Q8[] = { - 0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f, - 0.09885108575264f, 0.11793710567217f, 0.125f -}; - -static const float g0_Q12[] = { - 0.04081179924692f, 0.03812810994926f, 0.05144908135699f, 0.06399831151592f, - 0.07428313801106f, 0.08100347892914f, 0.08333333333333f -}; - -static const float g1_Q8[] = { - 0.01565675600122f, 0.03752716391991f, 0.05417891378782f, 0.08417044116767f, - 0.10307344158036f, 0.12222452249753f, 0.125f -}; - -static const float g2_Q4[] = { - -0.05908211155639f, -0.04871498374946f, 0.0f, 0.07778723915851f, - 0.16486303567403f, 0.23279856662996f, 0.25f -}; - -static void make_filters_from_proto(float (*filter)[8][2], const float *proto, int bands) -{ - int q, n; - for (q = 0; q < bands; q++) { - for (n = 0; n < 7; n++) { - double theta = 2 * M_PI * (q + 0.5) * (n - 6) / bands; - filter[q][n][0] = proto[n] * cos(theta); - filter[q][n][1] = proto[n] * -sin(theta); - } - } -} - -static void ps_tableinit(void) -{ - static const float ipdopd_sin[] = { 0, M_SQRT1_2, 1, M_SQRT1_2, 0, -M_SQRT1_2, -1, -M_SQRT1_2 }; - static const float ipdopd_cos[] = { 1, M_SQRT1_2, 0, -M_SQRT1_2, -1, -M_SQRT1_2, 0, M_SQRT1_2 }; - int pd0, pd1, pd2; - - static const float iid_par_dequant[] = { - //iid_par_dequant_default - 0.05623413251903, 0.12589254117942, 0.19952623149689, 0.31622776601684, - 0.44668359215096, 0.63095734448019, 0.79432823472428, 1, - 1.25892541179417, 1.58489319246111, 2.23872113856834, 3.16227766016838, - 5.01187233627272, 7.94328234724282, 17.7827941003892, - //iid_par_dequant_fine - 0.00316227766017, 0.00562341325190, 0.01, 0.01778279410039, - 0.03162277660168, 0.05623413251903, 0.07943282347243, 0.11220184543020, - 0.15848931924611, 0.22387211385683, 0.31622776601684, 0.39810717055350, - 0.50118723362727, 0.63095734448019, 0.79432823472428, 1, - 1.25892541179417, 1.58489319246111, 1.99526231496888, 2.51188643150958, - 3.16227766016838, 4.46683592150963, 6.30957344480193, 8.91250938133745, - 12.5892541179417, 17.7827941003892, 31.6227766016838, 56.2341325190349, - 100, 177.827941003892, 316.227766016837, - }; - static const float icc_invq[] = { - 1, 0.937, 0.84118, 0.60092, 0.36764, 0, -0.589, -1 - }; - static const float acos_icc_invq[] = { - 0, 0.35685527, 0.57133466, 0.92614472, 1.1943263, M_PI/2, 2.2006171, M_PI - }; - int iid, icc; - - int k, m; - static const int8_t f_center_20[] = { - -3, -1, 1, 3, 5, 7, 10, 14, 18, 22, - }; - static const int8_t f_center_34[] = { - 2, 6, 10, 14, 18, 22, 26, 30, - 34,-10, -6, -2, 51, 57, 15, 21, - 27, 33, 39, 45, 54, 66, 78, 42, - 102, 66, 78, 90,102,114,126, 90, - }; - static const float fractional_delay_links[] = { 0.43f, 0.75f, 0.347f }; - const float fractional_delay_gain = 0.39f; - - for (pd0 = 0; pd0 < 8; pd0++) { - float pd0_re = ipdopd_cos[pd0]; - float pd0_im = ipdopd_sin[pd0]; - for (pd1 = 0; pd1 < 8; pd1++) { - float pd1_re = ipdopd_cos[pd1]; - float pd1_im = ipdopd_sin[pd1]; - for (pd2 = 0; pd2 < 8; pd2++) { - float pd2_re = ipdopd_cos[pd2]; - float pd2_im = ipdopd_sin[pd2]; - float re_smooth = 0.25f * pd0_re + 0.5f * pd1_re + pd2_re; - float im_smooth = 0.25f * pd0_im + 0.5f * pd1_im + pd2_im; - float pd_mag = 1 / sqrt(im_smooth * im_smooth + re_smooth * re_smooth); - pd_re_smooth[pd0*64+pd1*8+pd2] = re_smooth * pd_mag; - pd_im_smooth[pd0*64+pd1*8+pd2] = im_smooth * pd_mag; - } - } - } - - for (iid = 0; iid < 46; iid++) { - float c = iid_par_dequant[iid]; ///< Linear Inter-channel Intensity Difference - float c1 = (float)M_SQRT2 / sqrtf(1.0f + c*c); - float c2 = c * c1; - for (icc = 0; icc < 8; icc++) { - /*if (PS_BASELINE || ps->icc_mode < 3)*/ { - float alpha = 0.5f * acos_icc_invq[icc]; - float beta = alpha * (c1 - c2) * (float)M_SQRT1_2; - HA[iid][icc][0] = c2 * cosf(beta + alpha); - HA[iid][icc][1] = c1 * cosf(beta - alpha); - HA[iid][icc][2] = c2 * sinf(beta + alpha); - HA[iid][icc][3] = c1 * sinf(beta - alpha); - } /* else */ { - float alpha, gamma, mu, rho; - float alpha_c, alpha_s, gamma_c, gamma_s; - rho = FFMAX(icc_invq[icc], 0.05f); - alpha = 0.5f * atan2f(2.0f * c * rho, c*c - 1.0f); - mu = c + 1.0f / c; - mu = sqrtf(1 + (4 * rho * rho - 4)/(mu * mu)); - gamma = atanf(sqrtf((1.0f - mu)/(1.0f + mu))); - if (alpha < 0) alpha += M_PI/2; - alpha_c = cosf(alpha); - alpha_s = sinf(alpha); - gamma_c = cosf(gamma); - gamma_s = sinf(gamma); - HB[iid][icc][0] = M_SQRT2 * alpha_c * gamma_c; - HB[iid][icc][1] = M_SQRT2 * alpha_s * gamma_c; - HB[iid][icc][2] = -M_SQRT2 * alpha_s * gamma_s; - HB[iid][icc][3] = M_SQRT2 * alpha_c * gamma_s; - } - } - } - - for (k = 0; k < NR_ALLPASS_BANDS20; k++) { - double f_center, theta; - if (k < FF_ARRAY_ELEMS(f_center_20)) - f_center = f_center_20[k] * 0.125; - else - f_center = k - 6.5f; - for (m = 0; m < PS_AP_LINKS; m++) { - theta = -M_PI * fractional_delay_links[m] * f_center; - Q_fract_allpass[0][k][m][0] = cos(theta); - Q_fract_allpass[0][k][m][1] = sin(theta); - } - theta = -M_PI*fractional_delay_gain*f_center; - phi_fract[0][k][0] = cos(theta); - phi_fract[0][k][1] = sin(theta); - } - for (k = 0; k < NR_ALLPASS_BANDS34; k++) { - double f_center, theta; - if (k < FF_ARRAY_ELEMS(f_center_34)) - f_center = f_center_34[k] / 24.0; - else - f_center = k - 26.5f; - for (m = 0; m < PS_AP_LINKS; m++) { - theta = -M_PI * fractional_delay_links[m] * f_center; - Q_fract_allpass[1][k][m][0] = cos(theta); - Q_fract_allpass[1][k][m][1] = sin(theta); - } - theta = -M_PI*fractional_delay_gain*f_center; - phi_fract[1][k][0] = cos(theta); - phi_fract[1][k][1] = sin(theta); - } - - make_filters_from_proto(f20_0_8, g0_Q8, 8); - make_filters_from_proto(f34_0_12, g0_Q12, 12); - make_filters_from_proto(f34_1_8, g1_Q8, 8); - make_filters_from_proto(f34_2_4, g2_Q4, 4); -} -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AACPS_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdata.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdata.c deleted file mode 100644 index 7431caebc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdata.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * MPEG-4 Parametric Stereo data tables - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -static const uint8_t huff_iid_df1_bits[] = { - 18, 18, 18, 18, 18, 18, 18, 18, 18, 17, 18, 17, 17, 16, 16, 15, 14, 14, - 13, 12, 12, 11, 10, 10, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7, - 8, 9, 10, 11, 11, 12, 13, 14, 14, 15, 16, 16, 17, 17, 18, 17, 18, 18, - 18, 18, 18, 18, 18, 18, 18, -}; - -static const uint32_t huff_iid_df1_codes[] = { - 0x01FEB4, 0x01FEB5, 0x01FD76, 0x01FD77, 0x01FD74, 0x01FD75, 0x01FE8A, - 0x01FE8B, 0x01FE88, 0x00FE80, 0x01FEB6, 0x00FE82, 0x00FEB8, 0x007F42, - 0x007FAE, 0x003FAF, 0x001FD1, 0x001FE9, 0x000FE9, 0x0007EA, 0x0007FB, - 0x0003FB, 0x0001FB, 0x0001FF, 0x00007C, 0x00003C, 0x00001C, 0x00000C, - 0x000000, 0x000001, 0x000001, 0x000002, 0x000001, 0x00000D, 0x00001D, - 0x00003D, 0x00007D, 0x0000FC, 0x0001FC, 0x0003FC, 0x0003F4, 0x0007EB, - 0x000FEA, 0x001FEA, 0x001FD6, 0x003FD0, 0x007FAF, 0x007F43, 0x00FEB9, - 0x00FE83, 0x01FEB7, 0x00FE81, 0x01FE89, 0x01FE8E, 0x01FE8F, 0x01FE8C, - 0x01FE8D, 0x01FEB2, 0x01FEB3, 0x01FEB0, 0x01FEB1, -}; - -static const uint8_t huff_iid_dt1_bits[] = { - 16, 16, 16, 16, 16, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 13, - 13, 13, 12, 12, 11, 10, 9, 9, 7, 6, 5, 3, 1, 2, 5, 6, 7, 8, - 9, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, -}; - -static const uint16_t huff_iid_dt1_codes[] = { - 0x004ED4, 0x004ED5, 0x004ECE, 0x004ECF, 0x004ECC, 0x004ED6, 0x004ED8, - 0x004F46, 0x004F60, 0x002718, 0x002719, 0x002764, 0x002765, 0x00276D, - 0x0027B1, 0x0013B7, 0x0013D6, 0x0009C7, 0x0009E9, 0x0009ED, 0x0004EE, - 0x0004F7, 0x000278, 0x000139, 0x00009A, 0x00009F, 0x000020, 0x000011, - 0x00000A, 0x000003, 0x000001, 0x000000, 0x00000B, 0x000012, 0x000021, - 0x00004C, 0x00009B, 0x00013A, 0x000279, 0x000270, 0x0004EF, 0x0004E2, - 0x0009EA, 0x0009D8, 0x0013D7, 0x0013D0, 0x0027B2, 0x0027A2, 0x00271A, - 0x00271B, 0x004F66, 0x004F67, 0x004F61, 0x004F47, 0x004ED9, 0x004ED7, - 0x004ECD, 0x004ED2, 0x004ED3, 0x004ED0, 0x004ED1, -}; - -static const uint8_t huff_iid_df0_bits[] = { - 17, 17, 17, 17, 16, 15, 13, 10, 9, 7, 6, 5, 4, 3, 1, 3, 4, 5, - 6, 6, 8, 11, 13, 14, 14, 15, 17, 18, 18, -}; - -static const uint32_t huff_iid_df0_codes[] = { - 0x01FFFB, 0x01FFFC, 0x01FFFD, 0x01FFFA, 0x00FFFC, 0x007FFC, 0x001FFD, - 0x0003FE, 0x0001FE, 0x00007E, 0x00003C, 0x00001D, 0x00000D, 0x000005, - 0x000000, 0x000004, 0x00000C, 0x00001C, 0x00003D, 0x00003E, 0x0000FE, - 0x0007FE, 0x001FFC, 0x003FFC, 0x003FFD, 0x007FFD, 0x01FFFE, 0x03FFFE, - 0x03FFFF, -}; - -static const uint8_t huff_iid_dt0_bits[] = { - 19, 19, 19, 20, 20, 20, 17, 15, 12, 10, 8, 6, 4, 2, 1, 3, 5, 7, - 9, 11, 13, 14, 17, 19, 20, 20, 20, 20, 20, -}; - -static const uint32_t huff_iid_dt0_codes[] = { - 0x07FFF9, 0x07FFFA, 0x07FFFB, 0x0FFFF8, 0x0FFFF9, 0x0FFFFA, 0x01FFFD, - 0x007FFE, 0x000FFE, 0x0003FE, 0x0000FE, 0x00003E, 0x00000E, 0x000002, - 0x000000, 0x000006, 0x00001E, 0x00007E, 0x0001FE, 0x0007FE, 0x001FFE, - 0x003FFE, 0x01FFFC, 0x07FFF8, 0x0FFFFB, 0x0FFFFC, 0x0FFFFD, 0x0FFFFE, - 0x0FFFFF, -}; - -static const uint8_t huff_icc_df_bits[] = { - 14, 14, 12, 10, 7, 5, 3, 1, 2, 4, 6, 8, 9, 11, 13, -}; - -static const uint16_t huff_icc_df_codes[] = { - 0x3FFF, 0x3FFE, 0x0FFE, 0x03FE, 0x007E, 0x001E, 0x0006, 0x0000, - 0x0002, 0x000E, 0x003E, 0x00FE, 0x01FE, 0x07FE, 0x1FFE, -}; - -static const uint8_t huff_icc_dt_bits[] = { - 14, 13, 11, 9, 7, 5, 3, 1, 2, 4, 6, 8, 10, 12, 14, -}; - -static const uint16_t huff_icc_dt_codes[] = { - 0x3FFE, 0x1FFE, 0x07FE, 0x01FE, 0x007E, 0x001E, 0x0006, 0x0000, - 0x0002, 0x000E, 0x003E, 0x00FE, 0x03FE, 0x0FFE, 0x3FFF, -}; - -static const uint8_t huff_ipd_df_bits[] = { - 1, 3, 4, 4, 4, 4, 4, 4, -}; - -static const uint8_t huff_ipd_df_codes[] = { - 0x01, 0x00, 0x06, 0x04, 0x02, 0x03, 0x05, 0x07, -}; - -static const uint8_t huff_ipd_dt_bits[] = { - 1, 3, 4, 5, 5, 4, 4, 3, -}; - -static const uint8_t huff_ipd_dt_codes[] = { - 0x01, 0x02, 0x02, 0x03, 0x02, 0x00, 0x03, 0x03, -}; - -static const uint8_t huff_opd_df_bits[] = { - 1, 3, 4, 4, 5, 5, 4, 3, -}; - -static const uint8_t huff_opd_df_codes[] = { - 0x01, 0x01, 0x06, 0x04, 0x0F, 0x0E, 0x05, 0x00, -}; - -static const uint8_t huff_opd_dt_bits[] = { - 1, 3, 4, 5, 5, 4, 4, 3, -}; - -static const uint8_t huff_opd_dt_codes[] = { - 0x01, 0x02, 0x01, 0x07, 0x06, 0x00, 0x02, 0x03, -}; - -static const int8_t huff_offset[] = { - 30, 30, - 14, 14, - 7, 7, - 0, 0, - 0, 0, -}; - -///Table 8.48 -static const int8_t k_to_i_20[] = { - 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 14, 15, - 15, 15, 16, 16, 16, 16, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19 -}; -///Table 8.49 -static const int8_t k_to_i_34[] = { - 0, 1, 2, 3, 4, 5, 6, 6, 7, 2, 1, 0, 10, 10, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 9, 14, 11, 12, 13, 14, 15, 16, 13, 16, 17, 18, 19, 20, 21, - 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, - 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 32, 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33 -}; - -static const float g1_Q2[] = { - 0.0f, 0.01899487526049f, 0.0f, -0.07293139167538f, - 0.0f, 0.30596630545168f, 0.5f -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.c deleted file mode 100644 index 5dc1a6aba..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "aacpsdsp.h" - -static void ps_add_squares_c(float *dst, const float (*src)[2], int n) -{ - int i; - for (i = 0; i < n; i++) - dst[i] += src[i][0] * src[i][0] + src[i][1] * src[i][1]; -} - -static void ps_mul_pair_single_c(float (*dst)[2], float (*src0)[2], float *src1, - int n) -{ - int i; - for (i = 0; i < n; i++) { - dst[i][0] = src0[i][0] * src1[i]; - dst[i][1] = src0[i][1] * src1[i]; - } -} - -static void ps_hybrid_analysis_c(float (*out)[2], float (*in)[2], - const float (*filter)[8][2], - int stride, int n) -{ - int i, j; - - for (i = 0; i < n; i++) { - float sum_re = filter[i][6][0] * in[6][0]; - float sum_im = filter[i][6][0] * in[6][1]; - - for (j = 0; j < 6; j++) { - float in0_re = in[j][0]; - float in0_im = in[j][1]; - float in1_re = in[12-j][0]; - float in1_im = in[12-j][1]; - sum_re += filter[i][j][0] * (in0_re + in1_re) - - filter[i][j][1] * (in0_im - in1_im); - sum_im += filter[i][j][0] * (in0_im + in1_im) + - filter[i][j][1] * (in0_re - in1_re); - } - out[i * stride][0] = sum_re; - out[i * stride][1] = sum_im; - } -} - -static void ps_hybrid_analysis_ileave_c(float (*out)[32][2], float L[2][38][64], - int i, int len) -{ - int j; - - for (; i < 64; i++) { - for (j = 0; j < len; j++) { - out[i][j][0] = L[0][j][i]; - out[i][j][1] = L[1][j][i]; - } - } -} - -static void ps_hybrid_synthesis_deint_c(float out[2][38][64], - float (*in)[32][2], - int i, int len) -{ - int n; - - for (; i < 64; i++) { - for (n = 0; n < len; n++) { - out[0][n][i] = in[i][n][0]; - out[1][n][i] = in[i][n][1]; - } - } -} - -static void ps_decorrelate_c(float (*out)[2], float (*delay)[2], - float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2], - const float phi_fract[2], const float (*Q_fract)[2], - const float *transient_gain, - float g_decay_slope, - int len) -{ - static const float a[] = { 0.65143905753106f, - 0.56471812200776f, - 0.48954165955695f }; - float ag[PS_AP_LINKS]; - int m, n; - - for (m = 0; m < PS_AP_LINKS; m++) - ag[m] = a[m] * g_decay_slope; - - for (n = 0; n < len; n++) { - float in_re = delay[n][0] * phi_fract[0] - delay[n][1] * phi_fract[1]; - float in_im = delay[n][0] * phi_fract[1] + delay[n][1] * phi_fract[0]; - for (m = 0; m < PS_AP_LINKS; m++) { - float a_re = ag[m] * in_re; - float a_im = ag[m] * in_im; - float link_delay_re = ap_delay[m][n+2-m][0]; - float link_delay_im = ap_delay[m][n+2-m][1]; - float fractional_delay_re = Q_fract[m][0]; - float fractional_delay_im = Q_fract[m][1]; - float apd_re = in_re; - float apd_im = in_im; - in_re = link_delay_re * fractional_delay_re - - link_delay_im * fractional_delay_im - a_re; - in_im = link_delay_re * fractional_delay_im + - link_delay_im * fractional_delay_re - a_im; - ap_delay[m][n+5][0] = apd_re + ag[m] * in_re; - ap_delay[m][n+5][1] = apd_im + ag[m] * in_im; - } - out[n][0] = transient_gain[n] * in_re; - out[n][1] = transient_gain[n] * in_im; - } -} - -static void ps_stereo_interpolate_c(float (*l)[2], float (*r)[2], - float h[2][4], float h_step[2][4], - int len) -{ - float h0 = h[0][0]; - float h1 = h[0][1]; - float h2 = h[0][2]; - float h3 = h[0][3]; - float hs0 = h_step[0][0]; - float hs1 = h_step[0][1]; - float hs2 = h_step[0][2]; - float hs3 = h_step[0][3]; - int n; - - for (n = 0; n < len; n++) { - //l is s, r is d - float l_re = l[n][0]; - float l_im = l[n][1]; - float r_re = r[n][0]; - float r_im = r[n][1]; - h0 += hs0; - h1 += hs1; - h2 += hs2; - h3 += hs3; - l[n][0] = h0 * l_re + h2 * r_re; - l[n][1] = h0 * l_im + h2 * r_im; - r[n][0] = h1 * l_re + h3 * r_re; - r[n][1] = h1 * l_im + h3 * r_im; - } -} - -static void ps_stereo_interpolate_ipdopd_c(float (*l)[2], float (*r)[2], - float h[2][4], float h_step[2][4], - int len) -{ - float h00 = h[0][0], h10 = h[1][0]; - float h01 = h[0][1], h11 = h[1][1]; - float h02 = h[0][2], h12 = h[1][2]; - float h03 = h[0][3], h13 = h[1][3]; - float hs00 = h_step[0][0], hs10 = h_step[1][0]; - float hs01 = h_step[0][1], hs11 = h_step[1][1]; - float hs02 = h_step[0][2], hs12 = h_step[1][2]; - float hs03 = h_step[0][3], hs13 = h_step[1][3]; - int n; - - for (n = 0; n < len; n++) { - //l is s, r is d - float l_re = l[n][0]; - float l_im = l[n][1]; - float r_re = r[n][0]; - float r_im = r[n][1]; - h00 += hs00; - h01 += hs01; - h02 += hs02; - h03 += hs03; - h10 += hs10; - h11 += hs11; - h12 += hs12; - h13 += hs13; - - l[n][0] = h00 * l_re + h02 * r_re - h10 * l_im - h12 * r_im; - l[n][1] = h00 * l_im + h02 * r_im + h10 * l_re + h12 * r_re; - r[n][0] = h01 * l_re + h03 * r_re - h11 * l_im - h13 * r_im; - r[n][1] = h01 * l_im + h03 * r_im + h11 * l_re + h13 * r_re; - } -} - -av_cold void ff_psdsp_init(PSDSPContext *s) -{ - s->add_squares = ps_add_squares_c; - s->mul_pair_single = ps_mul_pair_single_c; - s->hybrid_analysis = ps_hybrid_analysis_c; - s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_c; - s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_c; - s->decorrelate = ps_decorrelate_c; - s->stereo_interpolate[0] = ps_stereo_interpolate_c; - s->stereo_interpolate[1] = ps_stereo_interpolate_ipdopd_c; - - if (ARCH_ARM) - ff_psdsp_init_arm(s); - if (ARCH_MIPS) - ff_psdsp_init_mips(s); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.h deleted file mode 100644 index 0ef30236e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsdsp.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2012 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LIBAVCODEC_AACPSDSP_H -#define LIBAVCODEC_AACPSDSP_H - -#define PS_QMF_TIME_SLOTS 32 -#define PS_AP_LINKS 3 -#define PS_MAX_AP_DELAY 5 - -typedef struct PSDSPContext { - void (*add_squares)(float *dst, const float (*src)[2], int n); - void (*mul_pair_single)(float (*dst)[2], float (*src0)[2], float *src1, - int n); - void (*hybrid_analysis)(float (*out)[2], float (*in)[2], - const float (*filter)[8][2], - int stride, int n); - void (*hybrid_analysis_ileave)(float (*out)[32][2], float L[2][38][64], - int i, int len); - void (*hybrid_synthesis_deint)(float out[2][38][64], float (*in)[32][2], - int i, int len); - void (*decorrelate)(float (*out)[2], float (*delay)[2], - float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2], - const float phi_fract[2], const float (*Q_fract)[2], - const float *transient_gain, - float g_decay_slope, - int len); - void (*stereo_interpolate[2])(float (*l)[2], float (*r)[2], - float h[2][4], float h_step[2][4], - int len); -} PSDSPContext; - -void ff_psdsp_init(PSDSPContext *s); -void ff_psdsp_init_arm(PSDSPContext *s); -void ff_psdsp_init_mips(PSDSPContext *s); - -#endif /* LIBAVCODEC_AACPSDSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsy.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsy.c deleted file mode 100644 index d2a782e8d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacpsy.c +++ /dev/null @@ -1,965 +0,0 @@ -/* - * AAC encoder psychoacoustic model - * Copyright (C) 2008 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC encoder psychoacoustic model - */ - -#include "libavutil/attributes.h" -#include "libavutil/libm.h" - -#include "avcodec.h" -#include "aactab.h" -#include "psymodel.h" - -/*********************************** - * TODOs: - * try other bitrate controlling mechanism (maybe use ratecontrol.c?) - * control quality for quality-based output - **********************************/ - -/** - * constants for 3GPP AAC psychoacoustic model - * @{ - */ -#define PSY_3GPP_THR_SPREAD_HI 1.5f // spreading factor for low-to-hi threshold spreading (15 dB/Bark) -#define PSY_3GPP_THR_SPREAD_LOW 3.0f // spreading factor for hi-to-low threshold spreading (30 dB/Bark) -/* spreading factor for low-to-hi energy spreading, long block, > 22kbps/channel (20dB/Bark) */ -#define PSY_3GPP_EN_SPREAD_HI_L1 2.0f -/* spreading factor for low-to-hi energy spreading, long block, <= 22kbps/channel (15dB/Bark) */ -#define PSY_3GPP_EN_SPREAD_HI_L2 1.5f -/* spreading factor for low-to-hi energy spreading, short block (15 dB/Bark) */ -#define PSY_3GPP_EN_SPREAD_HI_S 1.5f -/* spreading factor for hi-to-low energy spreading, long block (30dB/Bark) */ -#define PSY_3GPP_EN_SPREAD_LOW_L 3.0f -/* spreading factor for hi-to-low energy spreading, short block (20dB/Bark) */ -#define PSY_3GPP_EN_SPREAD_LOW_S 2.0f - -#define PSY_3GPP_RPEMIN 0.01f -#define PSY_3GPP_RPELEV 2.0f - -#define PSY_3GPP_C1 3.0f /* log2(8) */ -#define PSY_3GPP_C2 1.3219281f /* log2(2.5) */ -#define PSY_3GPP_C3 0.55935729f /* 1 - C2 / C1 */ - -#define PSY_SNR_1DB 7.9432821e-1f /* -1dB */ -#define PSY_SNR_25DB 3.1622776e-3f /* -25dB */ - -#define PSY_3GPP_SAVE_SLOPE_L -0.46666667f -#define PSY_3GPP_SAVE_SLOPE_S -0.36363637f -#define PSY_3GPP_SAVE_ADD_L -0.84285712f -#define PSY_3GPP_SAVE_ADD_S -0.75f -#define PSY_3GPP_SPEND_SLOPE_L 0.66666669f -#define PSY_3GPP_SPEND_SLOPE_S 0.81818181f -#define PSY_3GPP_SPEND_ADD_L -0.35f -#define PSY_3GPP_SPEND_ADD_S -0.26111111f -#define PSY_3GPP_CLIP_LO_L 0.2f -#define PSY_3GPP_CLIP_LO_S 0.2f -#define PSY_3GPP_CLIP_HI_L 0.95f -#define PSY_3GPP_CLIP_HI_S 0.75f - -#define PSY_3GPP_AH_THR_LONG 0.5f -#define PSY_3GPP_AH_THR_SHORT 0.63f - -enum { - PSY_3GPP_AH_NONE, - PSY_3GPP_AH_INACTIVE, - PSY_3GPP_AH_ACTIVE -}; - -#define PSY_3GPP_BITS_TO_PE(bits) ((bits) * 1.18f) - -/* LAME psy model constants */ -#define PSY_LAME_FIR_LEN 21 ///< LAME psy model FIR order -#define AAC_BLOCK_SIZE_LONG 1024 ///< long block size -#define AAC_BLOCK_SIZE_SHORT 128 ///< short block size -#define AAC_NUM_BLOCKS_SHORT 8 ///< number of blocks in a short sequence -#define PSY_LAME_NUM_SUBBLOCKS 3 ///< Number of sub-blocks in each short block - -/** - * @} - */ - -/** - * information for single band used by 3GPP TS26.403-inspired psychoacoustic model - */ -typedef struct AacPsyBand{ - float energy; ///< band energy - float thr; ///< energy threshold - float thr_quiet; ///< threshold in quiet - float nz_lines; ///< number of non-zero spectral lines - float active_lines; ///< number of active spectral lines - float pe; ///< perceptual entropy - float pe_const; ///< constant part of the PE calculation - float norm_fac; ///< normalization factor for linearization - int avoid_holes; ///< hole avoidance flag -}AacPsyBand; - -/** - * single/pair channel context for psychoacoustic model - */ -typedef struct AacPsyChannel{ - AacPsyBand band[128]; ///< bands information - AacPsyBand prev_band[128]; ///< bands information from the previous frame - - float win_energy; ///< sliding average of channel energy - float iir_state[2]; ///< hi-pass IIR filter state - uint8_t next_grouping; ///< stored grouping scheme for the next frame (in case of 8 short window sequence) - enum WindowSequence next_window_seq; ///< window sequence to be used in the next frame - /* LAME psy model specific members */ - float attack_threshold; ///< attack threshold for this channel - float prev_energy_subshort[AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS]; - int prev_attack; ///< attack value for the last short block in the previous sequence -}AacPsyChannel; - -/** - * psychoacoustic model frame type-dependent coefficients - */ -typedef struct AacPsyCoeffs{ - float ath; ///< absolute threshold of hearing per bands - float barks; ///< Bark value for each spectral band in long frame - float spread_low[2]; ///< spreading factor for low-to-high threshold spreading in long frame - float spread_hi [2]; ///< spreading factor for high-to-low threshold spreading in long frame - float min_snr; ///< minimal SNR -}AacPsyCoeffs; - -/** - * 3GPP TS26.403-inspired psychoacoustic model specific data - */ -typedef struct AacPsyContext{ - int chan_bitrate; ///< bitrate per channel - int frame_bits; ///< average bits per frame - int fill_level; ///< bit reservoir fill level - struct { - float min; ///< minimum allowed PE for bit factor calculation - float max; ///< maximum allowed PE for bit factor calculation - float previous; ///< allowed PE of the previous frame - float correction; ///< PE correction factor - } pe; - AacPsyCoeffs psy_coef[2][64]; - AacPsyChannel *ch; -}AacPsyContext; - -/** - * LAME psy model preset struct - */ -typedef struct { - int quality; ///< Quality to map the rest of the vaules to. - /* This is overloaded to be both kbps per channel in ABR mode, and - * requested quality in constant quality mode. - */ - float st_lrm; ///< short threshold for L, R, and M channels -} PsyLamePreset; - -/** - * LAME psy model preset table for ABR - */ -static const PsyLamePreset psy_abr_map[] = { -/* TODO: Tuning. These were taken from LAME. */ -/* kbps/ch st_lrm */ - { 8, 6.60}, - { 16, 6.60}, - { 24, 6.60}, - { 32, 6.60}, - { 40, 6.60}, - { 48, 6.60}, - { 56, 6.60}, - { 64, 6.40}, - { 80, 6.00}, - { 96, 5.60}, - {112, 5.20}, - {128, 5.20}, - {160, 5.20} -}; - -/** -* LAME psy model preset table for constant quality -*/ -static const PsyLamePreset psy_vbr_map[] = { -/* vbr_q st_lrm */ - { 0, 4.20}, - { 1, 4.20}, - { 2, 4.20}, - { 3, 4.20}, - { 4, 4.20}, - { 5, 4.20}, - { 6, 4.20}, - { 7, 4.20}, - { 8, 4.20}, - { 9, 4.20}, - {10, 4.20} -}; - -/** - * LAME psy model FIR coefficient table - */ -static const float psy_fir_coeffs[] = { - -8.65163e-18 * 2, -0.00851586 * 2, -6.74764e-18 * 2, 0.0209036 * 2, - -3.36639e-17 * 2, -0.0438162 * 2, -1.54175e-17 * 2, 0.0931738 * 2, - -5.52212e-17 * 2, -0.313819 * 2 -}; - -#if ARCH_MIPS -# include "mips/aacpsy_mips.h" -#endif /* ARCH_MIPS */ - -/** - * Calculate the ABR attack threshold from the above LAME psymodel table. - */ -static float lame_calc_attack_threshold(int bitrate) -{ - /* Assume max bitrate to start with */ - int lower_range = 12, upper_range = 12; - int lower_range_kbps = psy_abr_map[12].quality; - int upper_range_kbps = psy_abr_map[12].quality; - int i; - - /* Determine which bitrates the value specified falls between. - * If the loop ends without breaking our above assumption of 320kbps was correct. - */ - for (i = 1; i < 13; i++) { - if (FFMAX(bitrate, psy_abr_map[i].quality) != bitrate) { - upper_range = i; - upper_range_kbps = psy_abr_map[i ].quality; - lower_range = i - 1; - lower_range_kbps = psy_abr_map[i - 1].quality; - break; /* Upper range found */ - } - } - - /* Determine which range the value specified is closer to */ - if ((upper_range_kbps - bitrate) > (bitrate - lower_range_kbps)) - return psy_abr_map[lower_range].st_lrm; - return psy_abr_map[upper_range].st_lrm; -} - -/** - * LAME psy model specific initialization - */ -static av_cold void lame_window_init(AacPsyContext *ctx, AVCodecContext *avctx) -{ - int i, j; - - for (i = 0; i < avctx->channels; i++) { - AacPsyChannel *pch = &ctx->ch[i]; - - if (avctx->flags & CODEC_FLAG_QSCALE) - pch->attack_threshold = psy_vbr_map[avctx->global_quality / FF_QP2LAMBDA].st_lrm; - else - pch->attack_threshold = lame_calc_attack_threshold(avctx->bit_rate / avctx->channels / 1000); - - for (j = 0; j < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; j++) - pch->prev_energy_subshort[j] = 10.0f; - } -} - -/** - * Calculate Bark value for given line. - */ -static av_cold float calc_bark(float f) -{ - return 13.3f * atanf(0.00076f * f) + 3.5f * atanf((f / 7500.0f) * (f / 7500.0f)); -} - -#define ATH_ADD 4 -/** - * Calculate ATH value for given frequency. - * Borrowed from Lame. - */ -static av_cold float ath(float f, float add) -{ - f /= 1000.0f; - return 3.64 * pow(f, -0.8) - - 6.8 * exp(-0.6 * (f - 3.4) * (f - 3.4)) - + 6.0 * exp(-0.15 * (f - 8.7) * (f - 8.7)) - + (0.6 + 0.04 * add) * 0.001 * f * f * f * f; -} - -static av_cold int psy_3gpp_init(FFPsyContext *ctx) { - AacPsyContext *pctx; - float bark; - int i, j, g, start; - float prev, minscale, minath, minsnr, pe_min; - const int chan_bitrate = ctx->avctx->bit_rate / ctx->avctx->channels; - const int bandwidth = ctx->avctx->cutoff ? ctx->avctx->cutoff : AAC_CUTOFF(ctx->avctx); - const float num_bark = calc_bark((float)bandwidth); - - ctx->model_priv_data = av_mallocz(sizeof(AacPsyContext)); - pctx = (AacPsyContext*) ctx->model_priv_data; - - pctx->chan_bitrate = chan_bitrate; - pctx->frame_bits = chan_bitrate * AAC_BLOCK_SIZE_LONG / ctx->avctx->sample_rate; - pctx->pe.min = 8.0f * AAC_BLOCK_SIZE_LONG * bandwidth / (ctx->avctx->sample_rate * 2.0f); - pctx->pe.max = 12.0f * AAC_BLOCK_SIZE_LONG * bandwidth / (ctx->avctx->sample_rate * 2.0f); - ctx->bitres.size = 6144 - pctx->frame_bits; - ctx->bitres.size -= ctx->bitres.size % 8; - pctx->fill_level = ctx->bitres.size; - minath = ath(3410, ATH_ADD); - for (j = 0; j < 2; j++) { - AacPsyCoeffs *coeffs = pctx->psy_coef[j]; - const uint8_t *band_sizes = ctx->bands[j]; - float line_to_frequency = ctx->avctx->sample_rate / (j ? 256.f : 2048.0f); - float avg_chan_bits = chan_bitrate * (j ? 128.0f : 1024.0f) / ctx->avctx->sample_rate; - /* reference encoder uses 2.4% here instead of 60% like the spec says */ - float bark_pe = 0.024f * PSY_3GPP_BITS_TO_PE(avg_chan_bits) / num_bark; - float en_spread_low = j ? PSY_3GPP_EN_SPREAD_LOW_S : PSY_3GPP_EN_SPREAD_LOW_L; - /* High energy spreading for long blocks <= 22kbps/channel and short blocks are the same. */ - float en_spread_hi = (j || (chan_bitrate <= 22.0f)) ? PSY_3GPP_EN_SPREAD_HI_S : PSY_3GPP_EN_SPREAD_HI_L1; - - i = 0; - prev = 0.0; - for (g = 0; g < ctx->num_bands[j]; g++) { - i += band_sizes[g]; - bark = calc_bark((i-1) * line_to_frequency); - coeffs[g].barks = (bark + prev) / 2.0; - prev = bark; - } - for (g = 0; g < ctx->num_bands[j] - 1; g++) { - AacPsyCoeffs *coeff = &coeffs[g]; - float bark_width = coeffs[g+1].barks - coeffs->barks; - coeff->spread_low[0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_LOW); - coeff->spread_hi [0] = pow(10.0, -bark_width * PSY_3GPP_THR_SPREAD_HI); - coeff->spread_low[1] = pow(10.0, -bark_width * en_spread_low); - coeff->spread_hi [1] = pow(10.0, -bark_width * en_spread_hi); - pe_min = bark_pe * bark_width; - minsnr = exp2(pe_min / band_sizes[g]) - 1.5f; - coeff->min_snr = av_clipf(1.0f / minsnr, PSY_SNR_25DB, PSY_SNR_1DB); - } - start = 0; - for (g = 0; g < ctx->num_bands[j]; g++) { - minscale = ath(start * line_to_frequency, ATH_ADD); - for (i = 1; i < band_sizes[g]; i++) - minscale = FFMIN(minscale, ath((start + i) * line_to_frequency, ATH_ADD)); - coeffs[g].ath = minscale - minath; - start += band_sizes[g]; - } - } - - pctx->ch = av_mallocz(sizeof(AacPsyChannel) * ctx->avctx->channels); - - lame_window_init(pctx, ctx->avctx); - - return 0; -} - -/** - * IIR filter used in block switching decision - */ -static float iir_filter(int in, float state[2]) -{ - float ret; - - ret = 0.7548f * (in - state[0]) + 0.5095f * state[1]; - state[0] = in; - state[1] = ret; - return ret; -} - -/** - * window grouping information stored as bits (0 - new group, 1 - group continues) - */ -static const uint8_t window_grouping[9] = { - 0xB6, 0x6C, 0xD8, 0xB2, 0x66, 0xC6, 0x96, 0x36, 0x36 -}; - -/** - * Tell encoder which window types to use. - * @see 3GPP TS26.403 5.4.1 "Blockswitching" - */ -static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx, - const int16_t *audio, - const int16_t *la, - int channel, int prev_type) -{ - int i, j; - int br = ctx->avctx->bit_rate / ctx->avctx->channels; - int attack_ratio = br <= 16000 ? 18 : 10; - AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; - AacPsyChannel *pch = &pctx->ch[channel]; - uint8_t grouping = 0; - int next_type = pch->next_window_seq; - FFPsyWindowInfo wi = { { 0 } }; - - if (la) { - float s[8], v; - int switch_to_eight = 0; - float sum = 0.0, sum2 = 0.0; - int attack_n = 0; - int stay_short = 0; - for (i = 0; i < 8; i++) { - for (j = 0; j < 128; j++) { - v = iir_filter(la[i*128+j], pch->iir_state); - sum += v*v; - } - s[i] = sum; - sum2 += sum; - } - for (i = 0; i < 8; i++) { - if (s[i] > pch->win_energy * attack_ratio) { - attack_n = i + 1; - switch_to_eight = 1; - break; - } - } - pch->win_energy = pch->win_energy*7/8 + sum2/64; - - wi.window_type[1] = prev_type; - switch (prev_type) { - case ONLY_LONG_SEQUENCE: - wi.window_type[0] = switch_to_eight ? LONG_START_SEQUENCE : ONLY_LONG_SEQUENCE; - next_type = switch_to_eight ? EIGHT_SHORT_SEQUENCE : ONLY_LONG_SEQUENCE; - break; - case LONG_START_SEQUENCE: - wi.window_type[0] = EIGHT_SHORT_SEQUENCE; - grouping = pch->next_grouping; - next_type = switch_to_eight ? EIGHT_SHORT_SEQUENCE : LONG_STOP_SEQUENCE; - break; - case LONG_STOP_SEQUENCE: - wi.window_type[0] = switch_to_eight ? LONG_START_SEQUENCE : ONLY_LONG_SEQUENCE; - next_type = switch_to_eight ? EIGHT_SHORT_SEQUENCE : ONLY_LONG_SEQUENCE; - break; - case EIGHT_SHORT_SEQUENCE: - stay_short = next_type == EIGHT_SHORT_SEQUENCE || switch_to_eight; - wi.window_type[0] = stay_short ? EIGHT_SHORT_SEQUENCE : LONG_STOP_SEQUENCE; - grouping = next_type == EIGHT_SHORT_SEQUENCE ? pch->next_grouping : 0; - next_type = switch_to_eight ? EIGHT_SHORT_SEQUENCE : LONG_STOP_SEQUENCE; - break; - } - - pch->next_grouping = window_grouping[attack_n]; - pch->next_window_seq = next_type; - } else { - for (i = 0; i < 3; i++) - wi.window_type[i] = prev_type; - grouping = (prev_type == EIGHT_SHORT_SEQUENCE) ? window_grouping[0] : 0; - } - - wi.window_shape = 1; - if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) { - wi.num_windows = 1; - wi.grouping[0] = 1; - } else { - int lastgrp = 0; - wi.num_windows = 8; - for (i = 0; i < 8; i++) { - if (!((grouping >> i) & 1)) - lastgrp = i; - wi.grouping[lastgrp]++; - } - } - - return wi; -} - -/* 5.6.1.2 "Calculation of Bit Demand" */ -static int calc_bit_demand(AacPsyContext *ctx, float pe, int bits, int size, - int short_window) -{ - const float bitsave_slope = short_window ? PSY_3GPP_SAVE_SLOPE_S : PSY_3GPP_SAVE_SLOPE_L; - const float bitsave_add = short_window ? PSY_3GPP_SAVE_ADD_S : PSY_3GPP_SAVE_ADD_L; - const float bitspend_slope = short_window ? PSY_3GPP_SPEND_SLOPE_S : PSY_3GPP_SPEND_SLOPE_L; - const float bitspend_add = short_window ? PSY_3GPP_SPEND_ADD_S : PSY_3GPP_SPEND_ADD_L; - const float clip_low = short_window ? PSY_3GPP_CLIP_LO_S : PSY_3GPP_CLIP_LO_L; - const float clip_high = short_window ? PSY_3GPP_CLIP_HI_S : PSY_3GPP_CLIP_HI_L; - float clipped_pe, bit_save, bit_spend, bit_factor, fill_level; - - ctx->fill_level += ctx->frame_bits - bits; - ctx->fill_level = av_clip(ctx->fill_level, 0, size); - fill_level = av_clipf((float)ctx->fill_level / size, clip_low, clip_high); - clipped_pe = av_clipf(pe, ctx->pe.min, ctx->pe.max); - bit_save = (fill_level + bitsave_add) * bitsave_slope; - assert(bit_save <= 0.3f && bit_save >= -0.05000001f); - bit_spend = (fill_level + bitspend_add) * bitspend_slope; - assert(bit_spend <= 0.5f && bit_spend >= -0.1f); - /* The bit factor graph in the spec is obviously incorrect. - * bit_spend + ((bit_spend - bit_spend))... - * The reference encoder subtracts everything from 1, but also seems incorrect. - * 1 - bit_save + ((bit_spend + bit_save))... - * Hopefully below is correct. - */ - bit_factor = 1.0f - bit_save + ((bit_spend - bit_save) / (ctx->pe.max - ctx->pe.min)) * (clipped_pe - ctx->pe.min); - /* NOTE: The reference encoder attempts to center pe max/min around the current pe. */ - ctx->pe.max = FFMAX(pe, ctx->pe.max); - ctx->pe.min = FFMIN(pe, ctx->pe.min); - - return FFMIN(ctx->frame_bits * bit_factor, ctx->frame_bits + size - bits); -} - -static float calc_pe_3gpp(AacPsyBand *band) -{ - float pe, a; - - band->pe = 0.0f; - band->pe_const = 0.0f; - band->active_lines = 0.0f; - if (band->energy > band->thr) { - a = log2f(band->energy); - pe = a - log2f(band->thr); - band->active_lines = band->nz_lines; - if (pe < PSY_3GPP_C1) { - pe = pe * PSY_3GPP_C3 + PSY_3GPP_C2; - a = a * PSY_3GPP_C3 + PSY_3GPP_C2; - band->active_lines *= PSY_3GPP_C3; - } - band->pe = pe * band->nz_lines; - band->pe_const = a * band->nz_lines; - } - - return band->pe; -} - -static float calc_reduction_3gpp(float a, float desired_pe, float pe, - float active_lines) -{ - float thr_avg, reduction; - - if(active_lines == 0.0) - return 0; - - thr_avg = exp2f((a - pe) / (4.0f * active_lines)); - reduction = exp2f((a - desired_pe) / (4.0f * active_lines)) - thr_avg; - - return FFMAX(reduction, 0.0f); -} - -static float calc_reduced_thr_3gpp(AacPsyBand *band, float min_snr, - float reduction) -{ - float thr = band->thr; - - if (band->energy > thr) { - thr = sqrtf(thr); - thr = sqrtf(thr) + reduction; - thr *= thr; - thr *= thr; - - /* This deviates from the 3GPP spec to match the reference encoder. - * It performs min(thr_reduced, max(thr, energy/min_snr)) only for bands - * that have hole avoidance on (active or inactive). It always reduces the - * threshold of bands with hole avoidance off. - */ - if (thr > band->energy * min_snr && band->avoid_holes != PSY_3GPP_AH_NONE) { - thr = FFMAX(band->thr, band->energy * min_snr); - band->avoid_holes = PSY_3GPP_AH_ACTIVE; - } - } - - return thr; -} - -#ifndef calc_thr_3gpp -static void calc_thr_3gpp(const FFPsyWindowInfo *wi, const int num_bands, AacPsyChannel *pch, - const uint8_t *band_sizes, const float *coefs) -{ - int i, w, g; - int start = 0; - for (w = 0; w < wi->num_windows*16; w += 16) { - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - - float form_factor = 0.0f; - float Temp; - band->energy = 0.0f; - for (i = 0; i < band_sizes[g]; i++) { - band->energy += coefs[start+i] * coefs[start+i]; - form_factor += sqrtf(fabs(coefs[start+i])); - } - Temp = band->energy > 0 ? sqrtf((float)band_sizes[g] / band->energy) : 0; - band->thr = band->energy * 0.001258925f; - band->nz_lines = form_factor * sqrtf(Temp); - - start += band_sizes[g]; - } - } -} -#endif /* calc_thr_3gpp */ - -#ifndef psy_hp_filter -static void psy_hp_filter(const float *firbuf, float *hpfsmpl, const float *psy_fir_coeffs) -{ - int i, j; - for (i = 0; i < AAC_BLOCK_SIZE_LONG; i++) { - float sum1, sum2; - sum1 = firbuf[i + (PSY_LAME_FIR_LEN - 1) / 2]; - sum2 = 0.0; - for (j = 0; j < ((PSY_LAME_FIR_LEN - 1) / 2) - 1; j += 2) { - sum1 += psy_fir_coeffs[j] * (firbuf[i + j] + firbuf[i + PSY_LAME_FIR_LEN - j]); - sum2 += psy_fir_coeffs[j + 1] * (firbuf[i + j + 1] + firbuf[i + PSY_LAME_FIR_LEN - j - 1]); - } - /* NOTE: The LAME psymodel expects it's input in the range -32768 to 32768. - * Tuning this for normalized floats would be difficult. */ - hpfsmpl[i] = (sum1 + sum2) * 32768.0f; - } -} -#endif /* psy_hp_filter */ - -/** - * Calculate band thresholds as suggested in 3GPP TS26.403 - */ -static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, - const float *coefs, const FFPsyWindowInfo *wi) -{ - AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; - AacPsyChannel *pch = &pctx->ch[channel]; - int i, w, g; - float desired_bits, desired_pe, delta_pe, reduction= NAN, spread_en[128] = {0}; - float a = 0.0f, active_lines = 0.0f, norm_fac = 0.0f; - float pe = pctx->chan_bitrate > 32000 ? 0.0f : FFMAX(50.0f, 100.0f - pctx->chan_bitrate * 100.0f / 32000.0f); - const int num_bands = ctx->num_bands[wi->num_windows == 8]; - const uint8_t *band_sizes = ctx->bands[wi->num_windows == 8]; - AacPsyCoeffs *coeffs = pctx->psy_coef[wi->num_windows == 8]; - const float avoid_hole_thr = wi->num_windows == 8 ? PSY_3GPP_AH_THR_SHORT : PSY_3GPP_AH_THR_LONG; - - //calculate energies, initial thresholds and related values - 5.4.2 "Threshold Calculation" - calc_thr_3gpp(wi, num_bands, pch, band_sizes, coefs); - - //modify thresholds and energies - spread, threshold in quiet, pre-echo control - for (w = 0; w < wi->num_windows*16; w += 16) { - AacPsyBand *bands = &pch->band[w]; - - /* 5.4.2.3 "Spreading" & 5.4.3 "Spread Energy Calculation" */ - spread_en[0] = bands[0].energy; - for (g = 1; g < num_bands; g++) { - bands[g].thr = FFMAX(bands[g].thr, bands[g-1].thr * coeffs[g].spread_hi[0]); - spread_en[w+g] = FFMAX(bands[g].energy, spread_en[w+g-1] * coeffs[g].spread_hi[1]); - } - for (g = num_bands - 2; g >= 0; g--) { - bands[g].thr = FFMAX(bands[g].thr, bands[g+1].thr * coeffs[g].spread_low[0]); - spread_en[w+g] = FFMAX(spread_en[w+g], spread_en[w+g+1] * coeffs[g].spread_low[1]); - } - //5.4.2.4 "Threshold in quiet" - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &bands[g]; - - band->thr_quiet = band->thr = FFMAX(band->thr, coeffs[g].ath); - //5.4.2.5 "Pre-echo control" - if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) - band->thr = FFMAX(PSY_3GPP_RPEMIN*band->thr, FFMIN(band->thr, - PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); - - /* 5.6.1.3.1 "Preparatory steps of the perceptual entropy calculation" */ - pe += calc_pe_3gpp(band); - a += band->pe_const; - active_lines += band->active_lines; - - /* 5.6.1.3.3 "Selection of the bands for avoidance of holes" */ - if (spread_en[w+g] * avoid_hole_thr > band->energy || coeffs[g].min_snr > 1.0f) - band->avoid_holes = PSY_3GPP_AH_NONE; - else - band->avoid_holes = PSY_3GPP_AH_INACTIVE; - } - } - - /* 5.6.1.3.2 "Calculation of the desired perceptual entropy" */ - ctx->ch[channel].entropy = pe; - desired_bits = calc_bit_demand(pctx, pe, ctx->bitres.bits, ctx->bitres.size, wi->num_windows == 8); - desired_pe = PSY_3GPP_BITS_TO_PE(desired_bits); - /* NOTE: PE correction is kept simple. During initial testing it had very - * little effect on the final bitrate. Probably a good idea to come - * back and do more testing later. - */ - if (ctx->bitres.bits > 0) - desired_pe *= av_clipf(pctx->pe.previous / PSY_3GPP_BITS_TO_PE(ctx->bitres.bits), - 0.85f, 1.15f); - pctx->pe.previous = PSY_3GPP_BITS_TO_PE(desired_bits); - - if (desired_pe < pe) { - /* 5.6.1.3.4 "First Estimation of the reduction value" */ - for (w = 0; w < wi->num_windows*16; w += 16) { - reduction = calc_reduction_3gpp(a, desired_pe, pe, active_lines); - pe = 0.0f; - a = 0.0f; - active_lines = 0.0f; - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - - band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction); - /* recalculate PE */ - pe += calc_pe_3gpp(band); - a += band->pe_const; - active_lines += band->active_lines; - } - } - - /* 5.6.1.3.5 "Second Estimation of the reduction value" */ - for (i = 0; i < 2; i++) { - float pe_no_ah = 0.0f, desired_pe_no_ah; - active_lines = a = 0.0f; - for (w = 0; w < wi->num_windows*16; w += 16) { - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - - if (band->avoid_holes != PSY_3GPP_AH_ACTIVE) { - pe_no_ah += band->pe; - a += band->pe_const; - active_lines += band->active_lines; - } - } - } - desired_pe_no_ah = FFMAX(desired_pe - (pe - pe_no_ah), 0.0f); - if (active_lines > 0.0f) - reduction += calc_reduction_3gpp(a, desired_pe_no_ah, pe_no_ah, active_lines); - - pe = 0.0f; - for (w = 0; w < wi->num_windows*16; w += 16) { - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - - if (active_lines > 0.0f) - band->thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction); - pe += calc_pe_3gpp(band); - band->norm_fac = band->active_lines / band->thr; - norm_fac += band->norm_fac; - } - } - delta_pe = desired_pe - pe; - if (fabs(delta_pe) > 0.05f * desired_pe) - break; - } - - if (pe < 1.15f * desired_pe) { - /* 6.6.1.3.6 "Final threshold modification by linearization" */ - norm_fac = 1.0f / norm_fac; - for (w = 0; w < wi->num_windows*16; w += 16) { - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - - if (band->active_lines > 0.5f) { - float delta_sfb_pe = band->norm_fac * norm_fac * delta_pe; - float thr = band->thr; - - thr *= exp2f(delta_sfb_pe / band->active_lines); - if (thr > coeffs[g].min_snr * band->energy && band->avoid_holes == PSY_3GPP_AH_INACTIVE) - thr = FFMAX(band->thr, coeffs[g].min_snr * band->energy); - band->thr = thr; - } - } - } - } else { - /* 5.6.1.3.7 "Further perceptual entropy reduction" */ - g = num_bands; - while (pe > desired_pe && g--) { - for (w = 0; w < wi->num_windows*16; w+= 16) { - AacPsyBand *band = &pch->band[w+g]; - if (band->avoid_holes != PSY_3GPP_AH_NONE && coeffs[g].min_snr < PSY_SNR_1DB) { - coeffs[g].min_snr = PSY_SNR_1DB; - band->thr = band->energy * PSY_SNR_1DB; - pe += band->active_lines * 1.5f - band->pe; - } - } - } - /* TODO: allow more holes (unused without mid/side) */ - } - } - - for (w = 0; w < wi->num_windows*16; w += 16) { - for (g = 0; g < num_bands; g++) { - AacPsyBand *band = &pch->band[w+g]; - FFPsyBand *psy_band = &ctx->ch[channel].psy_bands[w+g]; - - psy_band->threshold = band->thr; - psy_band->energy = band->energy; - } - } - - memcpy(pch->prev_band, pch->band, sizeof(pch->band)); -} - -static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, - const float **coeffs, const FFPsyWindowInfo *wi) -{ - int ch; - FFPsyChannelGroup *group = ff_psy_find_group(ctx, channel); - - for (ch = 0; ch < group->num_ch; ch++) - psy_3gpp_analyze_channel(ctx, channel + ch, coeffs[ch], &wi[ch]); -} - -static av_cold void psy_3gpp_end(FFPsyContext *apc) -{ - AacPsyContext *pctx = (AacPsyContext*) apc->model_priv_data; - av_freep(&pctx->ch); - av_freep(&apc->model_priv_data); -} - -static void lame_apply_block_type(AacPsyChannel *ctx, FFPsyWindowInfo *wi, int uselongblock) -{ - int blocktype = ONLY_LONG_SEQUENCE; - if (uselongblock) { - if (ctx->next_window_seq == EIGHT_SHORT_SEQUENCE) - blocktype = LONG_STOP_SEQUENCE; - } else { - blocktype = EIGHT_SHORT_SEQUENCE; - if (ctx->next_window_seq == ONLY_LONG_SEQUENCE) - ctx->next_window_seq = LONG_START_SEQUENCE; - if (ctx->next_window_seq == LONG_STOP_SEQUENCE) - ctx->next_window_seq = EIGHT_SHORT_SEQUENCE; - } - - wi->window_type[0] = ctx->next_window_seq; - ctx->next_window_seq = blocktype; -} - -static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio, - const float *la, int channel, int prev_type) -{ - AacPsyContext *pctx = (AacPsyContext*) ctx->model_priv_data; - AacPsyChannel *pch = &pctx->ch[channel]; - int grouping = 0; - int uselongblock = 1; - int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; - int i; - FFPsyWindowInfo wi = { { 0 } }; - - if (la) { - float hpfsmpl[AAC_BLOCK_SIZE_LONG]; - float const *pf = hpfsmpl; - float attack_intensity[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS]; - float energy_subshort[(AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS]; - float energy_short[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; - const float *firbuf = la + (AAC_BLOCK_SIZE_SHORT/4 - PSY_LAME_FIR_LEN); - int att_sum = 0; - - /* LAME comment: apply high pass filter of fs/4 */ - psy_hp_filter(firbuf, hpfsmpl, psy_fir_coeffs); - - /* Calculate the energies of each sub-shortblock */ - for (i = 0; i < PSY_LAME_NUM_SUBBLOCKS; i++) { - energy_subshort[i] = pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 1) * PSY_LAME_NUM_SUBBLOCKS)]; - assert(pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)] > 0); - attack_intensity[i] = energy_subshort[i] / pch->prev_energy_subshort[i + ((AAC_NUM_BLOCKS_SHORT - 2) * PSY_LAME_NUM_SUBBLOCKS + 1)]; - energy_short[0] += energy_subshort[i]; - } - - for (i = 0; i < AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS; i++) { - float const *const pfe = pf + AAC_BLOCK_SIZE_LONG / (AAC_NUM_BLOCKS_SHORT * PSY_LAME_NUM_SUBBLOCKS); - float p = 1.0f; - for (; pf < pfe; pf++) - p = FFMAX(p, fabsf(*pf)); - pch->prev_energy_subshort[i] = energy_subshort[i + PSY_LAME_NUM_SUBBLOCKS] = p; - energy_short[1 + i / PSY_LAME_NUM_SUBBLOCKS] += p; - /* NOTE: The indexes below are [i + 3 - 2] in the LAME source. - * Obviously the 3 and 2 have some significance, or this would be just [i + 1] - * (which is what we use here). What the 3 stands for is ambiguous, as it is both - * number of short blocks, and the number of sub-short blocks. - * It seems that LAME is comparing each sub-block to sub-block + 1 in the - * previous block. - */ - if (p > energy_subshort[i + 1]) - p = p / energy_subshort[i + 1]; - else if (energy_subshort[i + 1] > p * 10.0f) - p = energy_subshort[i + 1] / (p * 10.0f); - else - p = 0.0; - attack_intensity[i + PSY_LAME_NUM_SUBBLOCKS] = p; - } - - /* compare energy between sub-short blocks */ - for (i = 0; i < (AAC_NUM_BLOCKS_SHORT + 1) * PSY_LAME_NUM_SUBBLOCKS; i++) - if (!attacks[i / PSY_LAME_NUM_SUBBLOCKS]) - if (attack_intensity[i] > pch->attack_threshold) - attacks[i / PSY_LAME_NUM_SUBBLOCKS] = (i % PSY_LAME_NUM_SUBBLOCKS) + 1; - - /* should have energy change between short blocks, in order to avoid periodic signals */ - /* Good samples to show the effect are Trumpet test songs */ - /* GB: tuned (1) to avoid too many short blocks for test sample TRUMPET */ - /* RH: tuned (2) to let enough short blocks through for test sample FSOL and SNAPS */ - for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) { - float const u = energy_short[i - 1]; - float const v = energy_short[i]; - float const m = FFMAX(u, v); - if (m < 40000) { /* (2) */ - if (u < 1.7f * v && v < 1.7f * u) { /* (1) */ - if (i == 1 && attacks[0] < attacks[i]) - attacks[0] = 0; - attacks[i] = 0; - } - } - att_sum += attacks[i]; - } - - if (attacks[0] <= pch->prev_attack) - attacks[0] = 0; - - att_sum += attacks[0]; - /* 3 below indicates the previous attack happened in the last sub-block of the previous sequence */ - if (pch->prev_attack == 3 || att_sum) { - uselongblock = 0; - - for (i = 1; i < AAC_NUM_BLOCKS_SHORT + 1; i++) - if (attacks[i] && attacks[i-1]) - attacks[i] = 0; - } - } else { - /* We have no lookahead info, so just use same type as the previous sequence. */ - uselongblock = !(prev_type == EIGHT_SHORT_SEQUENCE); - } - - lame_apply_block_type(pch, &wi, uselongblock); - - wi.window_type[1] = prev_type; - if (wi.window_type[0] != EIGHT_SHORT_SEQUENCE) { - wi.num_windows = 1; - wi.grouping[0] = 1; - if (wi.window_type[0] == LONG_START_SEQUENCE) - wi.window_shape = 0; - else - wi.window_shape = 1; - } else { - int lastgrp = 0; - - wi.num_windows = 8; - wi.window_shape = 0; - for (i = 0; i < 8; i++) { - if (!((pch->next_grouping >> i) & 1)) - lastgrp = i; - wi.grouping[lastgrp]++; - } - } - - /* Determine grouping, based on the location of the first attack, and save for - * the next frame. - * FIXME: Move this to analysis. - * TODO: Tune groupings depending on attack location - * TODO: Handle more than one attack in a group - */ - for (i = 0; i < 9; i++) { - if (attacks[i]) { - grouping = i; - break; - } - } - pch->next_grouping = window_grouping[grouping]; - - pch->prev_attack = attacks[8]; - - return wi; -} - -const FFPsyModel ff_aac_psy_model = -{ - .name = "3GPP TS 26.403-inspired model", - .init = psy_3gpp_init, - .window = psy_lame_window, - .analyze = psy_3gpp_analyze, - .end = psy_3gpp_end, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.c deleted file mode 100644 index 0b6779c29..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.c +++ /dev/null @@ -1,1762 +0,0 @@ -/* - * AAC Spectral Band Replication decoding functions - * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) - * Copyright (c) 2009-2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC Spectral Band Replication decoding functions - * @author Robert Swain ( rob opendot cl ) - */ - -#include "aac.h" -#include "sbr.h" -#include "aacsbr.h" -#include "aacsbrdata.h" -#include "fft.h" -#include "aacps.h" -#include "sbrdsp.h" -#include "libavutil/internal.h" -#include "libavutil/libm.h" -#include "libavutil/avassert.h" - -#include -#include -#include - -#define ENVELOPE_ADJUSTMENT_OFFSET 2 -#define NOISE_FLOOR_OFFSET 6.0f - -#if ARCH_MIPS -#include "mips/aacsbr_mips.h" -#endif /* ARCH_MIPS */ - -/** - * SBR VLC tables - */ -enum { - T_HUFFMAN_ENV_1_5DB, - F_HUFFMAN_ENV_1_5DB, - T_HUFFMAN_ENV_BAL_1_5DB, - F_HUFFMAN_ENV_BAL_1_5DB, - T_HUFFMAN_ENV_3_0DB, - F_HUFFMAN_ENV_3_0DB, - T_HUFFMAN_ENV_BAL_3_0DB, - F_HUFFMAN_ENV_BAL_3_0DB, - T_HUFFMAN_NOISE_3_0DB, - T_HUFFMAN_NOISE_BAL_3_0DB, -}; - -/** - * bs_frame_class - frame class of current SBR frame (14496-3 sp04 p98) - */ -enum { - FIXFIX, - FIXVAR, - VARFIX, - VARVAR, -}; - -enum { - EXTENSION_ID_PS = 2, -}; - -static VLC vlc_sbr[10]; -static const int8_t vlc_sbr_lav[10] = - { 60, 60, 24, 24, 31, 31, 12, 12, 31, 12 }; - -#define SBR_INIT_VLC_STATIC(num, size) \ - INIT_VLC_STATIC(&vlc_sbr[num], 9, sbr_tmp[num].table_size / sbr_tmp[num].elem_size, \ - sbr_tmp[num].sbr_bits , 1, 1, \ - sbr_tmp[num].sbr_codes, sbr_tmp[num].elem_size, sbr_tmp[num].elem_size, \ - size) - -#define SBR_VLC_ROW(name) \ - { name ## _codes, name ## _bits, sizeof(name ## _codes), sizeof(name ## _codes[0]) } - -static void aacsbr_func_ptr_init(AACSBRContext *c); - -av_cold void ff_aac_sbr_init(void) -{ - int n; - static const struct { - const void *sbr_codes, *sbr_bits; - const unsigned int table_size, elem_size; - } sbr_tmp[] = { - SBR_VLC_ROW(t_huffman_env_1_5dB), - SBR_VLC_ROW(f_huffman_env_1_5dB), - SBR_VLC_ROW(t_huffman_env_bal_1_5dB), - SBR_VLC_ROW(f_huffman_env_bal_1_5dB), - SBR_VLC_ROW(t_huffman_env_3_0dB), - SBR_VLC_ROW(f_huffman_env_3_0dB), - SBR_VLC_ROW(t_huffman_env_bal_3_0dB), - SBR_VLC_ROW(f_huffman_env_bal_3_0dB), - SBR_VLC_ROW(t_huffman_noise_3_0dB), - SBR_VLC_ROW(t_huffman_noise_bal_3_0dB), - }; - - // SBR VLC table initialization - SBR_INIT_VLC_STATIC(0, 1098); - SBR_INIT_VLC_STATIC(1, 1092); - SBR_INIT_VLC_STATIC(2, 768); - SBR_INIT_VLC_STATIC(3, 1026); - SBR_INIT_VLC_STATIC(4, 1058); - SBR_INIT_VLC_STATIC(5, 1052); - SBR_INIT_VLC_STATIC(6, 544); - SBR_INIT_VLC_STATIC(7, 544); - SBR_INIT_VLC_STATIC(8, 592); - SBR_INIT_VLC_STATIC(9, 512); - - for (n = 1; n < 320; n++) - sbr_qmf_window_us[320 + n] = sbr_qmf_window_us[320 - n]; - sbr_qmf_window_us[384] = -sbr_qmf_window_us[384]; - sbr_qmf_window_us[512] = -sbr_qmf_window_us[512]; - - for (n = 0; n < 320; n++) - sbr_qmf_window_ds[n] = sbr_qmf_window_us[2*n]; - - ff_ps_init(); -} - -/** Places SBR in pure upsampling mode. */ -static void sbr_turnoff(SpectralBandReplication *sbr) { - sbr->start = 0; - // Init defults used in pure upsampling mode - sbr->kx[1] = 32; //Typo in spec, kx' inits to 32 - sbr->m[1] = 0; - // Reset values for first SBR header - sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1; - memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters)); -} - -av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr) -{ - if(sbr->mdct.mdct_bits) - return; - sbr->kx[0] = sbr->kx[1]; - sbr_turnoff(sbr); - sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128); - sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128); - /* SBR requires samples to be scaled to +/-32768.0 to work correctly. - * mdct scale factors are adjusted to scale up from +/-1.0 at analysis - * and scale back down at synthesis. */ - ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * 32768.0)); - ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * 32768.0); - ff_ps_ctx_init(&sbr->ps); - ff_sbrdsp_init(&sbr->dsp); - aacsbr_func_ptr_init(&sbr->c); -} - -av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr) -{ - ff_mdct_end(&sbr->mdct); - ff_mdct_end(&sbr->mdct_ana); -} - -static int qsort_comparison_function_int16(const void *a, const void *b) -{ - return *(const int16_t *)a - *(const int16_t *)b; -} - -static inline int in_table_int16(const int16_t *table, int last_el, int16_t needle) -{ - int i; - for (i = 0; i <= last_el; i++) - if (table[i] == needle) - return 1; - return 0; -} - -/// Limiter Frequency Band Table (14496-3 sp04 p198) -static void sbr_make_f_tablelim(SpectralBandReplication *sbr) -{ - int k; - if (sbr->bs_limiter_bands > 0) { - static const float bands_warped[3] = { 1.32715174233856803909f, //2^(0.49/1.2) - 1.18509277094158210129f, //2^(0.49/2) - 1.11987160404675912501f }; //2^(0.49/3) - const float lim_bands_per_octave_warped = bands_warped[sbr->bs_limiter_bands - 1]; - int16_t patch_borders[7]; - uint16_t *in = sbr->f_tablelim + 1, *out = sbr->f_tablelim; - - patch_borders[0] = sbr->kx[1]; - for (k = 1; k <= sbr->num_patches; k++) - patch_borders[k] = patch_borders[k-1] + sbr->patch_num_subbands[k-1]; - - memcpy(sbr->f_tablelim, sbr->f_tablelow, - (sbr->n[0] + 1) * sizeof(sbr->f_tablelow[0])); - if (sbr->num_patches > 1) - memcpy(sbr->f_tablelim + sbr->n[0] + 1, patch_borders + 1, - (sbr->num_patches - 1) * sizeof(patch_borders[0])); - - qsort(sbr->f_tablelim, sbr->num_patches + sbr->n[0], - sizeof(sbr->f_tablelim[0]), - qsort_comparison_function_int16); - - sbr->n_lim = sbr->n[0] + sbr->num_patches - 1; - while (out < sbr->f_tablelim + sbr->n_lim) { - if (*in >= *out * lim_bands_per_octave_warped) { - *++out = *in++; - } else if (*in == *out || - !in_table_int16(patch_borders, sbr->num_patches, *in)) { - in++; - sbr->n_lim--; - } else if (!in_table_int16(patch_borders, sbr->num_patches, *out)) { - *out = *in++; - sbr->n_lim--; - } else { - *++out = *in++; - } - } - } else { - sbr->f_tablelim[0] = sbr->f_tablelow[0]; - sbr->f_tablelim[1] = sbr->f_tablelow[sbr->n[0]]; - sbr->n_lim = 1; - } -} - -static unsigned int read_sbr_header(SpectralBandReplication *sbr, GetBitContext *gb) -{ - unsigned int cnt = get_bits_count(gb); - uint8_t bs_header_extra_1; - uint8_t bs_header_extra_2; - int old_bs_limiter_bands = sbr->bs_limiter_bands; - SpectrumParameters old_spectrum_params; - - sbr->start = 1; - - // Save last spectrum parameters variables to compare to new ones - memcpy(&old_spectrum_params, &sbr->spectrum_params, sizeof(SpectrumParameters)); - - sbr->bs_amp_res_header = get_bits1(gb); - sbr->spectrum_params.bs_start_freq = get_bits(gb, 4); - sbr->spectrum_params.bs_stop_freq = get_bits(gb, 4); - sbr->spectrum_params.bs_xover_band = get_bits(gb, 3); - skip_bits(gb, 2); // bs_reserved - - bs_header_extra_1 = get_bits1(gb); - bs_header_extra_2 = get_bits1(gb); - - if (bs_header_extra_1) { - sbr->spectrum_params.bs_freq_scale = get_bits(gb, 2); - sbr->spectrum_params.bs_alter_scale = get_bits1(gb); - sbr->spectrum_params.bs_noise_bands = get_bits(gb, 2); - } else { - sbr->spectrum_params.bs_freq_scale = 2; - sbr->spectrum_params.bs_alter_scale = 1; - sbr->spectrum_params.bs_noise_bands = 2; - } - - // Check if spectrum parameters changed - if (memcmp(&old_spectrum_params, &sbr->spectrum_params, sizeof(SpectrumParameters))) - sbr->reset = 1; - - if (bs_header_extra_2) { - sbr->bs_limiter_bands = get_bits(gb, 2); - sbr->bs_limiter_gains = get_bits(gb, 2); - sbr->bs_interpol_freq = get_bits1(gb); - sbr->bs_smoothing_mode = get_bits1(gb); - } else { - sbr->bs_limiter_bands = 2; - sbr->bs_limiter_gains = 2; - sbr->bs_interpol_freq = 1; - sbr->bs_smoothing_mode = 1; - } - - if (sbr->bs_limiter_bands != old_bs_limiter_bands && !sbr->reset) - sbr_make_f_tablelim(sbr); - - return get_bits_count(gb) - cnt; -} - -static int array_min_int16(const int16_t *array, int nel) -{ - int i, min = array[0]; - for (i = 1; i < nel; i++) - min = FFMIN(array[i], min); - return min; -} - -static void make_bands(int16_t* bands, int start, int stop, int num_bands) -{ - int k, previous, present; - float base, prod; - - base = powf((float)stop / start, 1.0f / num_bands); - prod = start; - previous = start; - - for (k = 0; k < num_bands-1; k++) { - prod *= base; - present = lrintf(prod); - bands[k] = present - previous; - previous = present; - } - bands[num_bands-1] = stop - previous; -} - -static int check_n_master(AVCodecContext *avctx, int n_master, int bs_xover_band) -{ - // Requirements (14496-3 sp04 p205) - if (n_master <= 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid n_master: %d\n", n_master); - return -1; - } - if (bs_xover_band >= n_master) { - av_log(avctx, AV_LOG_ERROR, - "Invalid bitstream, crossover band index beyond array bounds: %d\n", - bs_xover_band); - return -1; - } - return 0; -} - -/// Master Frequency Band Table (14496-3 sp04 p194) -static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, - SpectrumParameters *spectrum) -{ - unsigned int temp, max_qmf_subbands; - unsigned int start_min, stop_min; - int k; - const int8_t *sbr_offset_ptr; - int16_t stop_dk[13]; - - if (sbr->sample_rate < 32000) { - temp = 3000; - } else if (sbr->sample_rate < 64000) { - temp = 4000; - } else - temp = 5000; - - switch (sbr->sample_rate) { - case 16000: - sbr_offset_ptr = sbr_offset[0]; - break; - case 22050: - sbr_offset_ptr = sbr_offset[1]; - break; - case 24000: - sbr_offset_ptr = sbr_offset[2]; - break; - case 32000: - sbr_offset_ptr = sbr_offset[3]; - break; - case 44100: case 48000: case 64000: - sbr_offset_ptr = sbr_offset[4]; - break; - case 88200: case 96000: case 128000: case 176400: case 192000: - sbr_offset_ptr = sbr_offset[5]; - break; - default: - av_log(ac->avctx, AV_LOG_ERROR, - "Unsupported sample rate for SBR: %d\n", sbr->sample_rate); - return -1; - } - - start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; - stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; - - sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; - - if (spectrum->bs_stop_freq < 14) { - sbr->k[2] = stop_min; - make_bands(stop_dk, stop_min, 64, 13); - qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); - for (k = 0; k < spectrum->bs_stop_freq; k++) - sbr->k[2] += stop_dk[k]; - } else if (spectrum->bs_stop_freq == 14) { - sbr->k[2] = 2*sbr->k[0]; - } else if (spectrum->bs_stop_freq == 15) { - sbr->k[2] = 3*sbr->k[0]; - } else { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq); - return -1; - } - sbr->k[2] = FFMIN(64, sbr->k[2]); - - // Requirements (14496-3 sp04 p205) - if (sbr->sample_rate <= 32000) { - max_qmf_subbands = 48; - } else if (sbr->sample_rate == 44100) { - max_qmf_subbands = 35; - } else if (sbr->sample_rate >= 48000) - max_qmf_subbands = 32; - else - av_assert0(0); - - if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]); - return -1; - } - - if (!spectrum->bs_freq_scale) { - int dk, k2diff; - - dk = spectrum->bs_alter_scale + 1; - sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1; - if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) - return -1; - - for (k = 1; k <= sbr->n_master; k++) - sbr->f_master[k] = dk; - - k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; - if (k2diff < 0) { - sbr->f_master[1]--; - sbr->f_master[2]-= (k2diff < -1); - } else if (k2diff) { - sbr->f_master[sbr->n_master]++; - } - - sbr->f_master[0] = sbr->k[0]; - for (k = 1; k <= sbr->n_master; k++) - sbr->f_master[k] += sbr->f_master[k - 1]; - - } else { - int half_bands = 7 - spectrum->bs_freq_scale; // bs_freq_scale = {1,2,3} - int two_regions, num_bands_0; - int vdk0_max, vdk1_min; - int16_t vk0[49]; - - if (49 * sbr->k[2] > 110 * sbr->k[0]) { - two_regions = 1; - sbr->k[1] = 2 * sbr->k[0]; - } else { - two_regions = 0; - sbr->k[1] = sbr->k[2]; - } - - num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2; - - if (num_bands_0 <= 0) { // Requirements (14496-3 sp04 p205) - av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0); - return -1; - } - - vk0[0] = 0; - - make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0); - - qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16); - vdk0_max = vk0[num_bands_0]; - - vk0[0] = sbr->k[0]; - for (k = 1; k <= num_bands_0; k++) { - if (vk0[k] <= 0) { // Requirements (14496-3 sp04 p205) - av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]); - return -1; - } - vk0[k] += vk0[k-1]; - } - - if (two_regions) { - int16_t vk1[49]; - float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f - : 1.0f; // bs_alter_scale = {0,1} - int num_bands_1 = lrintf(half_bands * invwarp * - log2f(sbr->k[2] / (float)sbr->k[1])) * 2; - - make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1); - - vdk1_min = array_min_int16(vk1 + 1, num_bands_1); - - if (vdk1_min < vdk0_max) { - int change; - qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); - change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1); - vk1[1] += change; - vk1[num_bands_1] -= change; - } - - qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); - - vk1[0] = sbr->k[1]; - for (k = 1; k <= num_bands_1; k++) { - if (vk1[k] <= 0) { // Requirements (14496-3 sp04 p205) - av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]); - return -1; - } - vk1[k] += vk1[k-1]; - } - - sbr->n_master = num_bands_0 + num_bands_1; - if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) - return -1; - memcpy(&sbr->f_master[0], vk0, - (num_bands_0 + 1) * sizeof(sbr->f_master[0])); - memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1, - num_bands_1 * sizeof(sbr->f_master[0])); - - } else { - sbr->n_master = num_bands_0; - if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) - return -1; - memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); - } - } - - return 0; -} - -/// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46) -static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) -{ - int i, k, sb = 0; - int msb = sbr->k[0]; - int usb = sbr->kx[1]; - int goal_sb = ((1000 << 11) + (sbr->sample_rate >> 1)) / sbr->sample_rate; - - sbr->num_patches = 0; - - if (goal_sb < sbr->kx[1] + sbr->m[1]) { - for (k = 0; sbr->f_master[k] < goal_sb; k++) ; - } else - k = sbr->n_master; - - do { - int odd = 0; - for (i = k; i == k || sb > (sbr->k[0] - 1 + msb - odd); i--) { - sb = sbr->f_master[i]; - odd = (sb + sbr->k[0]) & 1; - } - - // Requirements (14496-3 sp04 p205) sets the maximum number of patches to 5. - // After this check the final number of patches can still be six which is - // illegal however the Coding Technologies decoder check stream has a final - // count of 6 patches - if (sbr->num_patches > 5) { - av_log(ac->avctx, AV_LOG_ERROR, "Too many patches: %d\n", sbr->num_patches); - return -1; - } - - sbr->patch_num_subbands[sbr->num_patches] = FFMAX(sb - usb, 0); - sbr->patch_start_subband[sbr->num_patches] = sbr->k[0] - odd - sbr->patch_num_subbands[sbr->num_patches]; - - if (sbr->patch_num_subbands[sbr->num_patches] > 0) { - usb = sb; - msb = sb; - sbr->num_patches++; - } else - msb = sbr->kx[1]; - - if (sbr->f_master[k] - sb < 3) - k = sbr->n_master; - } while (sb != sbr->kx[1] + sbr->m[1]); - - if (sbr->num_patches > 1 && sbr->patch_num_subbands[sbr->num_patches-1] < 3) - sbr->num_patches--; - - return 0; -} - -/// Derived Frequency Band Tables (14496-3 sp04 p197) -static int sbr_make_f_derived(AACContext *ac, SpectralBandReplication *sbr) -{ - int k, temp; - - sbr->n[1] = sbr->n_master - sbr->spectrum_params.bs_xover_band; - sbr->n[0] = (sbr->n[1] + 1) >> 1; - - memcpy(sbr->f_tablehigh, &sbr->f_master[sbr->spectrum_params.bs_xover_band], - (sbr->n[1] + 1) * sizeof(sbr->f_master[0])); - sbr->m[1] = sbr->f_tablehigh[sbr->n[1]] - sbr->f_tablehigh[0]; - sbr->kx[1] = sbr->f_tablehigh[0]; - - // Requirements (14496-3 sp04 p205) - if (sbr->kx[1] + sbr->m[1] > 64) { - av_log(ac->avctx, AV_LOG_ERROR, - "Stop frequency border too high: %d\n", sbr->kx[1] + sbr->m[1]); - return -1; - } - if (sbr->kx[1] > 32) { - av_log(ac->avctx, AV_LOG_ERROR, "Start frequency border too high: %d\n", sbr->kx[1]); - return -1; - } - - sbr->f_tablelow[0] = sbr->f_tablehigh[0]; - temp = sbr->n[1] & 1; - for (k = 1; k <= sbr->n[0]; k++) - sbr->f_tablelow[k] = sbr->f_tablehigh[2 * k - temp]; - - sbr->n_q = FFMAX(1, lrintf(sbr->spectrum_params.bs_noise_bands * - log2f(sbr->k[2] / (float)sbr->kx[1]))); // 0 <= bs_noise_bands <= 3 - if (sbr->n_q > 5) { - av_log(ac->avctx, AV_LOG_ERROR, "Too many noise floor scale factors: %d\n", sbr->n_q); - return -1; - } - - sbr->f_tablenoise[0] = sbr->f_tablelow[0]; - temp = 0; - for (k = 1; k <= sbr->n_q; k++) { - temp += (sbr->n[0] - temp) / (sbr->n_q + 1 - k); - sbr->f_tablenoise[k] = sbr->f_tablelow[temp]; - } - - if (sbr_hf_calc_npatches(ac, sbr) < 0) - return -1; - - sbr_make_f_tablelim(sbr); - - sbr->data[0].f_indexnoise = 0; - sbr->data[1].f_indexnoise = 0; - - return 0; -} - -static av_always_inline void get_bits1_vector(GetBitContext *gb, uint8_t *vec, - int elements) -{ - int i; - for (i = 0; i < elements; i++) { - vec[i] = get_bits1(gb); - } -} - -/** ceil(log2(index+1)) */ -static const int8_t ceil_log2[] = { - 0, 1, 2, 2, 3, 3, -}; - -static int read_sbr_grid(AACContext *ac, SpectralBandReplication *sbr, - GetBitContext *gb, SBRData *ch_data) -{ - int i; - unsigned bs_pointer = 0; - // frameLengthFlag ? 15 : 16; 960 sample length frames unsupported; this value is numTimeSlots - int abs_bord_trail = 16; - int num_rel_lead, num_rel_trail; - unsigned bs_num_env_old = ch_data->bs_num_env; - - ch_data->bs_freq_res[0] = ch_data->bs_freq_res[ch_data->bs_num_env]; - ch_data->bs_amp_res = sbr->bs_amp_res_header; - ch_data->t_env_num_env_old = ch_data->t_env[bs_num_env_old]; - - switch (ch_data->bs_frame_class = get_bits(gb, 2)) { - case FIXFIX: - ch_data->bs_num_env = 1 << get_bits(gb, 2); - num_rel_lead = ch_data->bs_num_env - 1; - if (ch_data->bs_num_env == 1) - ch_data->bs_amp_res = 0; - - if (ch_data->bs_num_env > 4) { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bitstream, too many SBR envelopes in FIXFIX type SBR frame: %d\n", - ch_data->bs_num_env); - return -1; - } - - ch_data->t_env[0] = 0; - ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail; - - abs_bord_trail = (abs_bord_trail + (ch_data->bs_num_env >> 1)) / - ch_data->bs_num_env; - for (i = 0; i < num_rel_lead; i++) - ch_data->t_env[i + 1] = ch_data->t_env[i] + abs_bord_trail; - - ch_data->bs_freq_res[1] = get_bits1(gb); - for (i = 1; i < ch_data->bs_num_env; i++) - ch_data->bs_freq_res[i + 1] = ch_data->bs_freq_res[1]; - break; - case FIXVAR: - abs_bord_trail += get_bits(gb, 2); - num_rel_trail = get_bits(gb, 2); - ch_data->bs_num_env = num_rel_trail + 1; - ch_data->t_env[0] = 0; - ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail; - - for (i = 0; i < num_rel_trail; i++) - ch_data->t_env[ch_data->bs_num_env - 1 - i] = - ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2; - - bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]); - - for (i = 0; i < ch_data->bs_num_env; i++) - ch_data->bs_freq_res[ch_data->bs_num_env - i] = get_bits1(gb); - break; - case VARFIX: - ch_data->t_env[0] = get_bits(gb, 2); - num_rel_lead = get_bits(gb, 2); - ch_data->bs_num_env = num_rel_lead + 1; - ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail; - - for (i = 0; i < num_rel_lead; i++) - ch_data->t_env[i + 1] = ch_data->t_env[i] + 2 * get_bits(gb, 2) + 2; - - bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]); - - get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env); - break; - case VARVAR: - ch_data->t_env[0] = get_bits(gb, 2); - abs_bord_trail += get_bits(gb, 2); - num_rel_lead = get_bits(gb, 2); - num_rel_trail = get_bits(gb, 2); - ch_data->bs_num_env = num_rel_lead + num_rel_trail + 1; - - if (ch_data->bs_num_env > 5) { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bitstream, too many SBR envelopes in VARVAR type SBR frame: %d\n", - ch_data->bs_num_env); - return -1; - } - - ch_data->t_env[ch_data->bs_num_env] = abs_bord_trail; - - for (i = 0; i < num_rel_lead; i++) - ch_data->t_env[i + 1] = ch_data->t_env[i] + 2 * get_bits(gb, 2) + 2; - for (i = 0; i < num_rel_trail; i++) - ch_data->t_env[ch_data->bs_num_env - 1 - i] = - ch_data->t_env[ch_data->bs_num_env - i] - 2 * get_bits(gb, 2) - 2; - - bs_pointer = get_bits(gb, ceil_log2[ch_data->bs_num_env]); - - get_bits1_vector(gb, ch_data->bs_freq_res + 1, ch_data->bs_num_env); - break; - } - - if (bs_pointer > ch_data->bs_num_env + 1) { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bitstream, bs_pointer points to a middle noise border outside the time borders table: %d\n", - bs_pointer); - return -1; - } - - for (i = 1; i <= ch_data->bs_num_env; i++) { - if (ch_data->t_env[i-1] > ch_data->t_env[i]) { - av_log(ac->avctx, AV_LOG_ERROR, "Non monotone time borders\n"); - return -1; - } - } - - ch_data->bs_num_noise = (ch_data->bs_num_env > 1) + 1; - - ch_data->t_q[0] = ch_data->t_env[0]; - ch_data->t_q[ch_data->bs_num_noise] = ch_data->t_env[ch_data->bs_num_env]; - if (ch_data->bs_num_noise > 1) { - unsigned int idx; - if (ch_data->bs_frame_class == FIXFIX) { - idx = ch_data->bs_num_env >> 1; - } else if (ch_data->bs_frame_class & 1) { // FIXVAR or VARVAR - idx = ch_data->bs_num_env - FFMAX((int)bs_pointer - 1, 1); - } else { // VARFIX - if (!bs_pointer) - idx = 1; - else if (bs_pointer == 1) - idx = ch_data->bs_num_env - 1; - else // bs_pointer > 1 - idx = bs_pointer - 1; - } - ch_data->t_q[1] = ch_data->t_env[idx]; - } - - ch_data->e_a[0] = -(ch_data->e_a[1] != bs_num_env_old); // l_APrev - ch_data->e_a[1] = -1; - if ((ch_data->bs_frame_class & 1) && bs_pointer) { // FIXVAR or VARVAR and bs_pointer != 0 - ch_data->e_a[1] = ch_data->bs_num_env + 1 - bs_pointer; - } else if ((ch_data->bs_frame_class == 2) && (bs_pointer > 1)) // VARFIX and bs_pointer > 1 - ch_data->e_a[1] = bs_pointer - 1; - - return 0; -} - -static void copy_sbr_grid(SBRData *dst, const SBRData *src) { - //These variables are saved from the previous frame rather than copied - dst->bs_freq_res[0] = dst->bs_freq_res[dst->bs_num_env]; - dst->t_env_num_env_old = dst->t_env[dst->bs_num_env]; - dst->e_a[0] = -(dst->e_a[1] != dst->bs_num_env); - - //These variables are read from the bitstream and therefore copied - memcpy(dst->bs_freq_res+1, src->bs_freq_res+1, sizeof(dst->bs_freq_res)-sizeof(*dst->bs_freq_res)); - memcpy(dst->t_env, src->t_env, sizeof(dst->t_env)); - memcpy(dst->t_q, src->t_q, sizeof(dst->t_q)); - dst->bs_num_env = src->bs_num_env; - dst->bs_amp_res = src->bs_amp_res; - dst->bs_num_noise = src->bs_num_noise; - dst->bs_frame_class = src->bs_frame_class; - dst->e_a[1] = src->e_a[1]; -} - -/// Read how the envelope and noise floor data is delta coded -static void read_sbr_dtdf(SpectralBandReplication *sbr, GetBitContext *gb, - SBRData *ch_data) -{ - get_bits1_vector(gb, ch_data->bs_df_env, ch_data->bs_num_env); - get_bits1_vector(gb, ch_data->bs_df_noise, ch_data->bs_num_noise); -} - -/// Read inverse filtering data -static void read_sbr_invf(SpectralBandReplication *sbr, GetBitContext *gb, - SBRData *ch_data) -{ - int i; - - memcpy(ch_data->bs_invf_mode[1], ch_data->bs_invf_mode[0], 5 * sizeof(uint8_t)); - for (i = 0; i < sbr->n_q; i++) - ch_data->bs_invf_mode[0][i] = get_bits(gb, 2); -} - -static void read_sbr_envelope(SpectralBandReplication *sbr, GetBitContext *gb, - SBRData *ch_data, int ch) -{ - int bits; - int i, j, k; - VLC_TYPE (*t_huff)[2], (*f_huff)[2]; - int t_lav, f_lav; - const int delta = (ch == 1 && sbr->bs_coupling == 1) + 1; - const int odd = sbr->n[1] & 1; - - if (sbr->bs_coupling && ch) { - if (ch_data->bs_amp_res) { - bits = 5; - t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_3_0DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_3_0DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB]; - } else { - bits = 6; - t_huff = vlc_sbr[T_HUFFMAN_ENV_BAL_1_5DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_BAL_1_5DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_1_5DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_1_5DB]; - } - } else { - if (ch_data->bs_amp_res) { - bits = 6; - t_huff = vlc_sbr[T_HUFFMAN_ENV_3_0DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_3_0DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB]; - } else { - bits = 7; - t_huff = vlc_sbr[T_HUFFMAN_ENV_1_5DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_ENV_1_5DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_1_5DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_1_5DB]; - } - } - - for (i = 0; i < ch_data->bs_num_env; i++) { - if (ch_data->bs_df_env[i]) { - // bs_freq_res[0] == bs_freq_res[bs_num_env] from prev frame - if (ch_data->bs_freq_res[i + 1] == ch_data->bs_freq_res[i]) { - for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) - ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); - } else if (ch_data->bs_freq_res[i + 1]) { - for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { - k = (j + odd) >> 1; // find k such that f_tablelow[k] <= f_tablehigh[j] < f_tablelow[k + 1] - ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); - } - } else { - for (j = 0; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) { - k = j ? 2*j - odd : 0; // find k such that f_tablehigh[k] == f_tablelow[j] - ch_data->env_facs[i + 1][j] = ch_data->env_facs[i][k] + delta * (get_vlc2(gb, t_huff, 9, 3) - t_lav); - } - } - } else { - ch_data->env_facs[i + 1][0] = delta * get_bits(gb, bits); // bs_env_start_value_balance - for (j = 1; j < sbr->n[ch_data->bs_freq_res[i + 1]]; j++) - ch_data->env_facs[i + 1][j] = ch_data->env_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav); - } - } - - //assign 0th elements of env_facs from last elements - memcpy(ch_data->env_facs[0], ch_data->env_facs[ch_data->bs_num_env], - sizeof(ch_data->env_facs[0])); -} - -static void read_sbr_noise(SpectralBandReplication *sbr, GetBitContext *gb, - SBRData *ch_data, int ch) -{ - int i, j; - VLC_TYPE (*t_huff)[2], (*f_huff)[2]; - int t_lav, f_lav; - int delta = (ch == 1 && sbr->bs_coupling == 1) + 1; - - if (sbr->bs_coupling && ch) { - t_huff = vlc_sbr[T_HUFFMAN_NOISE_BAL_3_0DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_BAL_3_0DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_BAL_3_0DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_BAL_3_0DB]; - } else { - t_huff = vlc_sbr[T_HUFFMAN_NOISE_3_0DB].table; - t_lav = vlc_sbr_lav[T_HUFFMAN_NOISE_3_0DB]; - f_huff = vlc_sbr[F_HUFFMAN_ENV_3_0DB].table; - f_lav = vlc_sbr_lav[F_HUFFMAN_ENV_3_0DB]; - } - - for (i = 0; i < ch_data->bs_num_noise; i++) { - if (ch_data->bs_df_noise[i]) { - for (j = 0; j < sbr->n_q; j++) - ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i][j] + delta * (get_vlc2(gb, t_huff, 9, 2) - t_lav); - } else { - ch_data->noise_facs[i + 1][0] = delta * get_bits(gb, 5); // bs_noise_start_value_balance or bs_noise_start_value_level - for (j = 1; j < sbr->n_q; j++) - ch_data->noise_facs[i + 1][j] = ch_data->noise_facs[i + 1][j - 1] + delta * (get_vlc2(gb, f_huff, 9, 3) - f_lav); - } - } - - //assign 0th elements of noise_facs from last elements - memcpy(ch_data->noise_facs[0], ch_data->noise_facs[ch_data->bs_num_noise], - sizeof(ch_data->noise_facs[0])); -} - -static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, - GetBitContext *gb, - int bs_extension_id, int *num_bits_left) -{ - switch (bs_extension_id) { - case EXTENSION_ID_PS: - if (!ac->oc[1].m4ac.ps) { - av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n"); - skip_bits_long(gb, *num_bits_left); // bs_fill_bits - *num_bits_left = 0; - } else { -#if 1 - *num_bits_left -= ff_ps_read_data(ac->avctx, gb, &sbr->ps, *num_bits_left); -#else - avpriv_report_missing_feature(ac->avctx, "Parametric Stereo"); - skip_bits_long(gb, *num_bits_left); // bs_fill_bits - *num_bits_left = 0; -#endif - } - break; - default: - // some files contain 0-padding - if (bs_extension_id || *num_bits_left > 16 || show_bits(gb, *num_bits_left)) - avpriv_request_sample(ac->avctx, "Reserved SBR extensions"); - skip_bits_long(gb, *num_bits_left); // bs_fill_bits - *num_bits_left = 0; - break; - } -} - -static int read_sbr_single_channel_element(AACContext *ac, - SpectralBandReplication *sbr, - GetBitContext *gb) -{ - if (get_bits1(gb)) // bs_data_extra - skip_bits(gb, 4); // bs_reserved - - if (read_sbr_grid(ac, sbr, gb, &sbr->data[0])) - return -1; - read_sbr_dtdf(sbr, gb, &sbr->data[0]); - read_sbr_invf(sbr, gb, &sbr->data[0]); - read_sbr_envelope(sbr, gb, &sbr->data[0], 0); - read_sbr_noise(sbr, gb, &sbr->data[0], 0); - - if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb))) - get_bits1_vector(gb, sbr->data[0].bs_add_harmonic, sbr->n[1]); - - return 0; -} - -static int read_sbr_channel_pair_element(AACContext *ac, - SpectralBandReplication *sbr, - GetBitContext *gb) -{ - if (get_bits1(gb)) // bs_data_extra - skip_bits(gb, 8); // bs_reserved - - if ((sbr->bs_coupling = get_bits1(gb))) { - if (read_sbr_grid(ac, sbr, gb, &sbr->data[0])) - return -1; - copy_sbr_grid(&sbr->data[1], &sbr->data[0]); - read_sbr_dtdf(sbr, gb, &sbr->data[0]); - read_sbr_dtdf(sbr, gb, &sbr->data[1]); - read_sbr_invf(sbr, gb, &sbr->data[0]); - memcpy(sbr->data[1].bs_invf_mode[1], sbr->data[1].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0])); - memcpy(sbr->data[1].bs_invf_mode[0], sbr->data[0].bs_invf_mode[0], sizeof(sbr->data[1].bs_invf_mode[0])); - read_sbr_envelope(sbr, gb, &sbr->data[0], 0); - read_sbr_noise(sbr, gb, &sbr->data[0], 0); - read_sbr_envelope(sbr, gb, &sbr->data[1], 1); - read_sbr_noise(sbr, gb, &sbr->data[1], 1); - } else { - if (read_sbr_grid(ac, sbr, gb, &sbr->data[0]) || - read_sbr_grid(ac, sbr, gb, &sbr->data[1])) - return -1; - read_sbr_dtdf(sbr, gb, &sbr->data[0]); - read_sbr_dtdf(sbr, gb, &sbr->data[1]); - read_sbr_invf(sbr, gb, &sbr->data[0]); - read_sbr_invf(sbr, gb, &sbr->data[1]); - read_sbr_envelope(sbr, gb, &sbr->data[0], 0); - read_sbr_envelope(sbr, gb, &sbr->data[1], 1); - read_sbr_noise(sbr, gb, &sbr->data[0], 0); - read_sbr_noise(sbr, gb, &sbr->data[1], 1); - } - - if ((sbr->data[0].bs_add_harmonic_flag = get_bits1(gb))) - get_bits1_vector(gb, sbr->data[0].bs_add_harmonic, sbr->n[1]); - if ((sbr->data[1].bs_add_harmonic_flag = get_bits1(gb))) - get_bits1_vector(gb, sbr->data[1].bs_add_harmonic, sbr->n[1]); - - return 0; -} - -static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr, - GetBitContext *gb, int id_aac) -{ - unsigned int cnt = get_bits_count(gb); - - if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) { - if (read_sbr_single_channel_element(ac, sbr, gb)) { - sbr_turnoff(sbr); - return get_bits_count(gb) - cnt; - } - } else if (id_aac == TYPE_CPE) { - if (read_sbr_channel_pair_element(ac, sbr, gb)) { - sbr_turnoff(sbr); - return get_bits_count(gb) - cnt; - } - } else { - av_log(ac->avctx, AV_LOG_ERROR, - "Invalid bitstream - cannot apply SBR to element type %d\n", id_aac); - sbr_turnoff(sbr); - return get_bits_count(gb) - cnt; - } - if (get_bits1(gb)) { // bs_extended_data - int num_bits_left = get_bits(gb, 4); // bs_extension_size - if (num_bits_left == 15) - num_bits_left += get_bits(gb, 8); // bs_esc_count - - num_bits_left <<= 3; - while (num_bits_left > 7) { - num_bits_left -= 2; - read_sbr_extension(ac, sbr, gb, get_bits(gb, 2), &num_bits_left); // bs_extension_id - } - if (num_bits_left < 0) { - av_log(ac->avctx, AV_LOG_ERROR, "SBR Extension over read.\n"); - } - if (num_bits_left > 0) - skip_bits(gb, num_bits_left); - } - - return get_bits_count(gb) - cnt; -} - -static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr) -{ - int err; - err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params); - if (err >= 0) - err = sbr_make_f_derived(ac, sbr); - if (err < 0) { - av_log(ac->avctx, AV_LOG_ERROR, - "SBR reset failed. Switching SBR to pure upsampling mode.\n"); - sbr_turnoff(sbr); - } -} - -/** - * Decode Spectral Band Replication extension data; reference: table 4.55. - * - * @param crc flag indicating the presence of CRC checksum - * @param cnt length of TYPE_FIL syntactic element in bytes - * - * @return Returns number of bytes consumed from the TYPE_FIL element. - */ -int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, - GetBitContext *gb_host, int crc, int cnt, int id_aac) -{ - unsigned int num_sbr_bits = 0, num_align_bits; - unsigned bytes_read; - GetBitContext gbc = *gb_host, *gb = &gbc; - skip_bits_long(gb_host, cnt*8 - 4); - - sbr->reset = 0; - - if (!sbr->sample_rate) - sbr->sample_rate = 2 * ac->oc[1].m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support - if (!ac->oc[1].m4ac.ext_sample_rate) - ac->oc[1].m4ac.ext_sample_rate = 2 * ac->oc[1].m4ac.sample_rate; - - if (crc) { - skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check - num_sbr_bits += 10; - } - - //Save some state from the previous frame. - sbr->kx[0] = sbr->kx[1]; - sbr->m[0] = sbr->m[1]; - sbr->kx_and_m_pushed = 1; - - num_sbr_bits++; - if (get_bits1(gb)) // bs_header_flag - num_sbr_bits += read_sbr_header(sbr, gb); - - if (sbr->reset) - sbr_reset(ac, sbr); - - if (sbr->start) - num_sbr_bits += read_sbr_data(ac, sbr, gb, id_aac); - - num_align_bits = ((cnt << 3) - 4 - num_sbr_bits) & 7; - bytes_read = ((num_sbr_bits + num_align_bits + 4) >> 3); - - if (bytes_read > cnt) { - av_log(ac->avctx, AV_LOG_ERROR, - "Expected to read %d SBR bytes actually read %d.\n", cnt, bytes_read); - } - return cnt; -} - -/// Dequantization and stereo decoding (14496-3 sp04 p203) -static void sbr_dequant(SpectralBandReplication *sbr, int id_aac) -{ - int k, e; - int ch; - - if (id_aac == TYPE_CPE && sbr->bs_coupling) { - float alpha = sbr->data[0].bs_amp_res ? 1.0f : 0.5f; - float pan_offset = sbr->data[0].bs_amp_res ? 12.0f : 24.0f; - for (e = 1; e <= sbr->data[0].bs_num_env; e++) { - for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { - float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f); - float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha); - float fac; - if (temp1 > 1E20) { - av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); - temp1 = 1; - } - fac = temp1 / (1.0f + temp2); - sbr->data[0].env_facs[e][k] = fac; - sbr->data[1].env_facs[e][k] = fac * temp2; - } - } - for (e = 1; e <= sbr->data[0].bs_num_noise; e++) { - for (k = 0; k < sbr->n_q; k++) { - float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1); - float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]); - float fac; - if (temp1 > 1E20) { - av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); - temp1 = 1; - } - fac = temp1 / (1.0f + temp2); - sbr->data[0].noise_facs[e][k] = fac; - sbr->data[1].noise_facs[e][k] = fac * temp2; - } - } - } else { // SCE or one non-coupled CPE - for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { - float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f; - for (e = 1; e <= sbr->data[ch].bs_num_env; e++) - for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ - sbr->data[ch].env_facs[e][k] = - exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f); - if (sbr->data[ch].env_facs[e][k] > 1E20) { - av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n"); - sbr->data[ch].env_facs[e][k] = 1; - } - } - - for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) - for (k = 0; k < sbr->n_q; k++) - sbr->data[ch].noise_facs[e][k] = - exp2f(NOISE_FLOOR_OFFSET - sbr->data[ch].noise_facs[e][k]); - } - } -} - -/** - * Analysis QMF Bank (14496-3 sp04 p206) - * - * @param x pointer to the beginning of the first sample window - * @param W array of complex-valued samples split into subbands - */ -#ifndef sbr_qmf_analysis -static void sbr_qmf_analysis(AVFloatDSPContext *dsp, FFTContext *mdct, - SBRDSPContext *sbrdsp, const float *in, float *x, - float z[320], float W[2][32][32][2], int buf_idx) -{ - int i; - memcpy(x , x+1024, (320-32)*sizeof(x[0])); - memcpy(x+288, in, 1024*sizeof(x[0])); - for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames - // are not supported - dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); - sbrdsp->sum64x5(z); - sbrdsp->qmf_pre_shuffle(z); - mdct->imdct_half(mdct, z, z+64); - sbrdsp->qmf_post_shuffle(W[buf_idx][i], z); - x += 32; - } -} -#endif - -/** - * Synthesis QMF Bank (14496-3 sp04 p206) and Downsampled Synthesis QMF Bank - * (14496-3 sp04 p206) - */ -#ifndef sbr_qmf_synthesis -static void sbr_qmf_synthesis(FFTContext *mdct, - SBRDSPContext *sbrdsp, AVFloatDSPContext *dsp, - float *out, float X[2][38][64], - float mdct_buf[2][64], - float *v0, int *v_off, const unsigned int div) -{ - int i, n; - const float *sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us; - const int step = 128 >> div; - float *v; - for (i = 0; i < 32; i++) { - if (*v_off < step) { - int saved_samples = (1280 - 128) >> div; - memcpy(&v0[SBR_SYNTHESIS_BUF_SIZE - saved_samples], v0, saved_samples * sizeof(float)); - *v_off = SBR_SYNTHESIS_BUF_SIZE - saved_samples - step; - } else { - *v_off -= step; - } - v = v0 + *v_off; - if (div) { - for (n = 0; n < 32; n++) { - X[0][i][ n] = -X[0][i][n]; - X[0][i][32+n] = X[1][i][31-n]; - } - mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); - sbrdsp->qmf_deint_neg(v, mdct_buf[0]); - } else { - sbrdsp->neg_odd_64(X[1][i]); - mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); - mdct->imdct_half(mdct, mdct_buf[1], X[1][i]); - sbrdsp->qmf_deint_bfly(v, mdct_buf[1], mdct_buf[0]); - } - dsp->vector_fmul (out, v , sbr_qmf_window , 64 >> div); - dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 256 >> div), sbr_qmf_window + (128 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 448 >> div), sbr_qmf_window + (192 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 512 >> div), sbr_qmf_window + (256 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 704 >> div), sbr_qmf_window + (320 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 768 >> div), sbr_qmf_window + (384 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + ( 960 >> div), sbr_qmf_window + (448 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + (1024 >> div), sbr_qmf_window + (512 >> div), out , 64 >> div); - dsp->vector_fmul_add(out, v + (1216 >> div), sbr_qmf_window + (576 >> div), out , 64 >> div); - out += 64 >> div; - } -} -#endif - -/** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering - * (14496-3 sp04 p214) - * Warning: This routine does not seem numerically stable. - */ -static void sbr_hf_inverse_filter(SBRDSPContext *dsp, - float (*alpha0)[2], float (*alpha1)[2], - const float X_low[32][40][2], int k0) -{ - int k; - for (k = 0; k < k0; k++) { - LOCAL_ALIGNED_16(float, phi, [3], [2][2]); - float dk; - - dsp->autocorrelate(X_low[k], phi); - - dk = phi[2][1][0] * phi[1][0][0] - - (phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f; - - if (!dk) { - alpha1[k][0] = 0; - alpha1[k][1] = 0; - } else { - float temp_real, temp_im; - temp_real = phi[0][0][0] * phi[1][1][0] - - phi[0][0][1] * phi[1][1][1] - - phi[0][1][0] * phi[1][0][0]; - temp_im = phi[0][0][0] * phi[1][1][1] + - phi[0][0][1] * phi[1][1][0] - - phi[0][1][1] * phi[1][0][0]; - - alpha1[k][0] = temp_real / dk; - alpha1[k][1] = temp_im / dk; - } - - if (!phi[1][0][0]) { - alpha0[k][0] = 0; - alpha0[k][1] = 0; - } else { - float temp_real, temp_im; - temp_real = phi[0][0][0] + alpha1[k][0] * phi[1][1][0] + - alpha1[k][1] * phi[1][1][1]; - temp_im = phi[0][0][1] + alpha1[k][1] * phi[1][1][0] - - alpha1[k][0] * phi[1][1][1]; - - alpha0[k][0] = -temp_real / phi[1][0][0]; - alpha0[k][1] = -temp_im / phi[1][0][0]; - } - - if (alpha1[k][0] * alpha1[k][0] + alpha1[k][1] * alpha1[k][1] >= 16.0f || - alpha0[k][0] * alpha0[k][0] + alpha0[k][1] * alpha0[k][1] >= 16.0f) { - alpha1[k][0] = 0; - alpha1[k][1] = 0; - alpha0[k][0] = 0; - alpha0[k][1] = 0; - } - } -} - -/// Chirp Factors (14496-3 sp04 p214) -static void sbr_chirp(SpectralBandReplication *sbr, SBRData *ch_data) -{ - int i; - float new_bw; - static const float bw_tab[] = { 0.0f, 0.75f, 0.9f, 0.98f }; - - for (i = 0; i < sbr->n_q; i++) { - if (ch_data->bs_invf_mode[0][i] + ch_data->bs_invf_mode[1][i] == 1) { - new_bw = 0.6f; - } else - new_bw = bw_tab[ch_data->bs_invf_mode[0][i]]; - - if (new_bw < ch_data->bw_array[i]) { - new_bw = 0.75f * new_bw + 0.25f * ch_data->bw_array[i]; - } else - new_bw = 0.90625f * new_bw + 0.09375f * ch_data->bw_array[i]; - ch_data->bw_array[i] = new_bw < 0.015625f ? 0.0f : new_bw; - } -} - -/// Generate the subband filtered lowband -static int sbr_lf_gen(AACContext *ac, SpectralBandReplication *sbr, - float X_low[32][40][2], const float W[2][32][32][2], - int buf_idx) -{ - int i, k; - const int t_HFGen = 8; - const int i_f = 32; - memset(X_low, 0, 32*sizeof(*X_low)); - for (k = 0; k < sbr->kx[1]; k++) { - for (i = t_HFGen; i < i_f + t_HFGen; i++) { - X_low[k][i][0] = W[buf_idx][i - t_HFGen][k][0]; - X_low[k][i][1] = W[buf_idx][i - t_HFGen][k][1]; - } - } - buf_idx = 1-buf_idx; - for (k = 0; k < sbr->kx[0]; k++) { - for (i = 0; i < t_HFGen; i++) { - X_low[k][i][0] = W[buf_idx][i + i_f - t_HFGen][k][0]; - X_low[k][i][1] = W[buf_idx][i + i_f - t_HFGen][k][1]; - } - } - return 0; -} - -/// High Frequency Generator (14496-3 sp04 p215) -static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr, - float X_high[64][40][2], const float X_low[32][40][2], - const float (*alpha0)[2], const float (*alpha1)[2], - const float bw_array[5], const uint8_t *t_env, - int bs_num_env) -{ - int j, x; - int g = 0; - int k = sbr->kx[1]; - for (j = 0; j < sbr->num_patches; j++) { - for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) { - const int p = sbr->patch_start_subband[j] + x; - while (g <= sbr->n_q && k >= sbr->f_tablenoise[g]) - g++; - g--; - - if (g < 0) { - av_log(ac->avctx, AV_LOG_ERROR, - "ERROR : no subband found for frequency %d\n", k); - return -1; - } - - sbr->dsp.hf_gen(X_high[k] + ENVELOPE_ADJUSTMENT_OFFSET, - X_low[p] + ENVELOPE_ADJUSTMENT_OFFSET, - alpha0[p], alpha1[p], bw_array[g], - 2 * t_env[0], 2 * t_env[bs_num_env]); - } - } - if (k < sbr->m[1] + sbr->kx[1]) - memset(X_high + k, 0, (sbr->m[1] + sbr->kx[1] - k) * sizeof(*X_high)); - - return 0; -} - -/// Generate the subband filtered lowband -static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], - const float Y0[38][64][2], const float Y1[38][64][2], - const float X_low[32][40][2], int ch) -{ - int k, i; - const int i_f = 32; - const int i_Temp = FFMAX(2*sbr->data[ch].t_env_num_env_old - i_f, 0); - memset(X, 0, 2*sizeof(*X)); - for (k = 0; k < sbr->kx[0]; k++) { - for (i = 0; i < i_Temp; i++) { - X[0][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][0]; - X[1][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][1]; - } - } - for (; k < sbr->kx[0] + sbr->m[0]; k++) { - for (i = 0; i < i_Temp; i++) { - X[0][i][k] = Y0[i + i_f][k][0]; - X[1][i][k] = Y0[i + i_f][k][1]; - } - } - - for (k = 0; k < sbr->kx[1]; k++) { - for (i = i_Temp; i < 38; i++) { - X[0][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][0]; - X[1][i][k] = X_low[k][i + ENVELOPE_ADJUSTMENT_OFFSET][1]; - } - } - for (; k < sbr->kx[1] + sbr->m[1]; k++) { - for (i = i_Temp; i < i_f; i++) { - X[0][i][k] = Y1[i][k][0]; - X[1][i][k] = Y1[i][k][1]; - } - } - return 0; -} - -/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping - * (14496-3 sp04 p217) - */ -static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, - SBRData *ch_data, int e_a[2]) -{ - int e, i, m; - - memset(ch_data->s_indexmapped[1], 0, 7*sizeof(ch_data->s_indexmapped[1])); - for (e = 0; e < ch_data->bs_num_env; e++) { - const unsigned int ilim = sbr->n[ch_data->bs_freq_res[e + 1]]; - uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; - int k; - - if (sbr->kx[1] != table[0]) { - av_log(ac->avctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. " - "Derived frequency tables were not regenerated.\n"); - sbr_turnoff(sbr); - return AVERROR_BUG; - } - for (i = 0; i < ilim; i++) - for (m = table[i]; m < table[i + 1]; m++) - sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i]; - - // ch_data->bs_num_noise > 1 => 2 noise floors - k = (ch_data->bs_num_noise > 1) && (ch_data->t_env[e] >= ch_data->t_q[1]); - for (i = 0; i < sbr->n_q; i++) - for (m = sbr->f_tablenoise[i]; m < sbr->f_tablenoise[i + 1]; m++) - sbr->q_mapped[e][m - sbr->kx[1]] = ch_data->noise_facs[k+1][i]; - - for (i = 0; i < sbr->n[1]; i++) { - if (ch_data->bs_add_harmonic_flag) { - const unsigned int m_midpoint = - (sbr->f_tablehigh[i] + sbr->f_tablehigh[i + 1]) >> 1; - - ch_data->s_indexmapped[e + 1][m_midpoint - sbr->kx[1]] = ch_data->bs_add_harmonic[i] * - (e >= e_a[1] || (ch_data->s_indexmapped[0][m_midpoint - sbr->kx[1]] == 1)); - } - } - - for (i = 0; i < ilim; i++) { - int additional_sinusoid_present = 0; - for (m = table[i]; m < table[i + 1]; m++) { - if (ch_data->s_indexmapped[e + 1][m - sbr->kx[1]]) { - additional_sinusoid_present = 1; - break; - } - } - memset(&sbr->s_mapped[e][table[i] - sbr->kx[1]], additional_sinusoid_present, - (table[i + 1] - table[i]) * sizeof(sbr->s_mapped[e][0])); - } - } - - memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0])); - return 0; -} - -/// Estimation of current envelope (14496-3 sp04 p218) -static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], - SpectralBandReplication *sbr, SBRData *ch_data) -{ - int e, m; - int kx1 = sbr->kx[1]; - - if (sbr->bs_interpol_freq) { - for (e = 0; e < ch_data->bs_num_env; e++) { - const float recip_env_size = 0.5f / (ch_data->t_env[e + 1] - ch_data->t_env[e]); - int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; - int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; - - for (m = 0; m < sbr->m[1]; m++) { - float sum = sbr->dsp.sum_square(X_high[m+kx1] + ilb, iub - ilb); - e_curr[e][m] = sum * recip_env_size; - } - } - } else { - int k, p; - - for (e = 0; e < ch_data->bs_num_env; e++) { - const int env_size = 2 * (ch_data->t_env[e + 1] - ch_data->t_env[e]); - int ilb = ch_data->t_env[e] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; - int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; - const uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; - - for (p = 0; p < sbr->n[ch_data->bs_freq_res[e + 1]]; p++) { - float sum = 0.0f; - const int den = env_size * (table[p + 1] - table[p]); - - for (k = table[p]; k < table[p + 1]; k++) { - sum += sbr->dsp.sum_square(X_high[k] + ilb, iub - ilb); - } - sum /= den; - for (k = table[p]; k < table[p + 1]; k++) { - e_curr[e][k - kx1] = sum; - } - } - } - } -} - -/** - * Calculation of levels of additional HF signal components (14496-3 sp04 p219) - * and Calculation of gain (14496-3 sp04 p219) - */ -static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr, - SBRData *ch_data, const int e_a[2]) -{ - int e, k, m; - // max gain limits : -3dB, 0dB, 3dB, inf dB (limiter off) - static const float limgain[4] = { 0.70795, 1.0, 1.41254, 10000000000 }; - - for (e = 0; e < ch_data->bs_num_env; e++) { - int delta = !((e == e_a[1]) || (e == e_a[0])); - for (k = 0; k < sbr->n_lim; k++) { - float gain_boost, gain_max; - float sum[2] = { 0.0f, 0.0f }; - for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) { - const float temp = sbr->e_origmapped[e][m] / (1.0f + sbr->q_mapped[e][m]); - sbr->q_m[e][m] = sqrtf(temp * sbr->q_mapped[e][m]); - sbr->s_m[e][m] = sqrtf(temp * ch_data->s_indexmapped[e + 1][m]); - if (!sbr->s_mapped[e][m]) { - sbr->gain[e][m] = sqrtf(sbr->e_origmapped[e][m] / - ((1.0f + sbr->e_curr[e][m]) * - (1.0f + sbr->q_mapped[e][m] * delta))); - } else { - sbr->gain[e][m] = sqrtf(sbr->e_origmapped[e][m] * sbr->q_mapped[e][m] / - ((1.0f + sbr->e_curr[e][m]) * - (1.0f + sbr->q_mapped[e][m]))); - } - } - for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) { - sum[0] += sbr->e_origmapped[e][m]; - sum[1] += sbr->e_curr[e][m]; - } - gain_max = limgain[sbr->bs_limiter_gains] * sqrtf((FLT_EPSILON + sum[0]) / (FLT_EPSILON + sum[1])); - gain_max = FFMIN(100000.f, gain_max); - for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) { - float q_m_max = sbr->q_m[e][m] * gain_max / sbr->gain[e][m]; - sbr->q_m[e][m] = FFMIN(sbr->q_m[e][m], q_m_max); - sbr->gain[e][m] = FFMIN(sbr->gain[e][m], gain_max); - } - sum[0] = sum[1] = 0.0f; - for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) { - sum[0] += sbr->e_origmapped[e][m]; - sum[1] += sbr->e_curr[e][m] * sbr->gain[e][m] * sbr->gain[e][m] - + sbr->s_m[e][m] * sbr->s_m[e][m] - + (delta && !sbr->s_m[e][m]) * sbr->q_m[e][m] * sbr->q_m[e][m]; - } - gain_boost = sqrtf((FLT_EPSILON + sum[0]) / (FLT_EPSILON + sum[1])); - gain_boost = FFMIN(1.584893192f, gain_boost); - for (m = sbr->f_tablelim[k] - sbr->kx[1]; m < sbr->f_tablelim[k + 1] - sbr->kx[1]; m++) { - sbr->gain[e][m] *= gain_boost; - sbr->q_m[e][m] *= gain_boost; - sbr->s_m[e][m] *= gain_boost; - } - } - } -} - -/// Assembling HF Signals (14496-3 sp04 p220) -static void sbr_hf_assemble(float Y1[38][64][2], - const float X_high[64][40][2], - SpectralBandReplication *sbr, SBRData *ch_data, - const int e_a[2]) -{ - int e, i, j, m; - const int h_SL = 4 * !sbr->bs_smoothing_mode; - const int kx = sbr->kx[1]; - const int m_max = sbr->m[1]; - static const float h_smooth[5] = { - 0.33333333333333, - 0.30150283239582, - 0.21816949906249, - 0.11516383427084, - 0.03183050093751, - }; - float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp; - int indexnoise = ch_data->f_indexnoise; - int indexsine = ch_data->f_indexsine; - - if (sbr->reset) { - for (i = 0; i < h_SL; i++) { - memcpy(g_temp[i + 2*ch_data->t_env[0]], sbr->gain[0], m_max * sizeof(sbr->gain[0][0])); - memcpy(q_temp[i + 2*ch_data->t_env[0]], sbr->q_m[0], m_max * sizeof(sbr->q_m[0][0])); - } - } else if (h_SL) { - memcpy(g_temp[2*ch_data->t_env[0]], g_temp[2*ch_data->t_env_num_env_old], 4*sizeof(g_temp[0])); - memcpy(q_temp[2*ch_data->t_env[0]], q_temp[2*ch_data->t_env_num_env_old], 4*sizeof(q_temp[0])); - } - - for (e = 0; e < ch_data->bs_num_env; e++) { - for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { - memcpy(g_temp[h_SL + i], sbr->gain[e], m_max * sizeof(sbr->gain[0][0])); - memcpy(q_temp[h_SL + i], sbr->q_m[e], m_max * sizeof(sbr->q_m[0][0])); - } - } - - for (e = 0; e < ch_data->bs_num_env; e++) { - for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { - LOCAL_ALIGNED_16(float, g_filt_tab, [48]); - LOCAL_ALIGNED_16(float, q_filt_tab, [48]); - float *g_filt, *q_filt; - - if (h_SL && e != e_a[0] && e != e_a[1]) { - g_filt = g_filt_tab; - q_filt = q_filt_tab; - for (m = 0; m < m_max; m++) { - const int idx1 = i + h_SL; - g_filt[m] = 0.0f; - q_filt[m] = 0.0f; - for (j = 0; j <= h_SL; j++) { - g_filt[m] += g_temp[idx1 - j][m] * h_smooth[j]; - q_filt[m] += q_temp[idx1 - j][m] * h_smooth[j]; - } - } - } else { - g_filt = g_temp[i + h_SL]; - q_filt = q_temp[i]; - } - - sbr->dsp.hf_g_filt(Y1[i] + kx, X_high + kx, g_filt, m_max, - i + ENVELOPE_ADJUSTMENT_OFFSET); - - if (e != e_a[0] && e != e_a[1]) { - sbr->dsp.hf_apply_noise[indexsine](Y1[i] + kx, sbr->s_m[e], - q_filt, indexnoise, - kx, m_max); - } else { - int idx = indexsine&1; - int A = (1-((indexsine+(kx & 1))&2)); - int B = (A^(-idx)) + idx; - float *out = &Y1[i][kx][idx]; - float *in = sbr->s_m[e]; - for (m = 0; m+1 < m_max; m+=2) { - out[2*m ] += in[m ] * A; - out[2*m+2] += in[m+1] * B; - } - if(m_max&1) - out[2*m ] += in[m ] * A; - } - indexnoise = (indexnoise + m_max) & 0x1ff; - indexsine = (indexsine + 1) & 3; - } - } - ch_data->f_indexnoise = indexnoise; - ch_data->f_indexsine = indexsine; -} - -void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, - float* L, float* R) -{ - int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate; - int ch; - int nch = (id_aac == TYPE_CPE) ? 2 : 1; - int err; - - if (!sbr->kx_and_m_pushed) { - sbr->kx[0] = sbr->kx[1]; - sbr->m[0] = sbr->m[1]; - } else { - sbr->kx_and_m_pushed = 0; - } - - if (sbr->start) { - sbr_dequant(sbr, id_aac); - } - for (ch = 0; ch < nch; ch++) { - /* decode channel */ - sbr_qmf_analysis(&ac->fdsp, &sbr->mdct_ana, &sbr->dsp, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, - (float*)sbr->qmf_filter_scratch, - sbr->data[ch].W, sbr->data[ch].Ypos); - sbr->c.sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W, sbr->data[ch].Ypos); - sbr->data[ch].Ypos ^= 1; - if (sbr->start) { - sbr->c.sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); - sbr_chirp(sbr, &sbr->data[ch]); - sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1, - sbr->data[ch].bw_array, sbr->data[ch].t_env, - sbr->data[ch].bs_num_env); - - // hf_adj - err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a); - if (!err) { - sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]); - sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a); - sbr->c.sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos], - sbr->X_high, sbr, &sbr->data[ch], - sbr->data[ch].e_a); - } - } - - /* synthesis */ - sbr->c.sbr_x_gen(sbr, sbr->X[ch], - sbr->data[ch].Y[1-sbr->data[ch].Ypos], - sbr->data[ch].Y[ sbr->data[ch].Ypos], - sbr->X_low, ch); - } - - if (ac->oc[1].m4ac.ps == 1) { - if (sbr->ps.start) { - ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]); - } else { - memcpy(sbr->X[1], sbr->X[0], sizeof(sbr->X[0])); - } - nch = 2; - } - - sbr_qmf_synthesis(&sbr->mdct, &sbr->dsp, &ac->fdsp, - L, sbr->X[0], sbr->qmf_filter_scratch, - sbr->data[0].synthesis_filterbank_samples, - &sbr->data[0].synthesis_filterbank_samples_offset, - downsampled); - if (nch == 2) - sbr_qmf_synthesis(&sbr->mdct, &sbr->dsp, &ac->fdsp, - R, sbr->X[1], sbr->qmf_filter_scratch, - sbr->data[1].synthesis_filterbank_samples, - &sbr->data[1].synthesis_filterbank_samples_offset, - downsampled); -} - -static void aacsbr_func_ptr_init(AACSBRContext *c) -{ - c->sbr_lf_gen = sbr_lf_gen; - c->sbr_hf_assemble = sbr_hf_assemble; - c->sbr_x_gen = sbr_x_gen; - c->sbr_hf_inverse_filter = sbr_hf_inverse_filter; - - if(ARCH_MIPS) - ff_aacsbr_func_ptr_init_mips(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.h deleted file mode 100644 index f5e33ab68..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbr.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * AAC Spectral Band Replication function declarations - * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC Spectral Band Replication function declarations - * @author Robert Swain ( rob opendot cl ) - */ - -#ifndef AVCODEC_AACSBR_H -#define AVCODEC_AACSBR_H - -#include "get_bits.h" -#include "aac.h" -#include "sbr.h" - -/** Initialize SBR. */ -void ff_aac_sbr_init(void); -/** Initialize one SBR context. */ -void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr); -/** Close one SBR context. */ -void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr); -/** Decode one SBR element. */ -int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, - GetBitContext *gb, int crc, int cnt, int id_aac); -/** Apply one SBR element to one AAC element. */ -void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, - float* L, float *R); - -void ff_aacsbr_func_ptr_init_mips(AACSBRContext *c); - -#endif /* AVCODEC_AACSBR_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbrdata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbrdata.h deleted file mode 100644 index 12575eeae..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aacsbrdata.h +++ /dev/null @@ -1,620 +0,0 @@ -/* - * AAC Spectral Band Replication decoding data - * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC Spectral Band Replication decoding data - * @author Robert Swain ( rob opendot cl ) - */ - -#ifndef AVCODEC_AACSBRDATA_H -#define AVCODEC_AACSBRDATA_H - -#include -#include "libavutil/mem.h" - -///< Huffman tables for SBR - -static const uint8_t t_huffman_env_1_5dB_bits[121] = { - 18, 18, 18, 18, 18, 18, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 17, 18, 16, 17, 18, 17, - 16, 16, 16, 16, 15, 14, 14, 13, - 13, 12, 11, 10, 9, 8, 7, 6, - 5, 4, 3, 2, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 12, 13, 14, - 14, 15, 16, 17, 16, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, -}; - -static const uint32_t t_huffman_env_1_5dB_codes[121] = { - 0x3ffd6, 0x3ffd7, 0x3ffd8, 0x3ffd9, 0x3ffda, 0x3ffdb, 0x7ffb8, 0x7ffb9, - 0x7ffba, 0x7ffbb, 0x7ffbc, 0x7ffbd, 0x7ffbe, 0x7ffbf, 0x7ffc0, 0x7ffc1, - 0x7ffc2, 0x7ffc3, 0x7ffc4, 0x7ffc5, 0x7ffc6, 0x7ffc7, 0x7ffc8, 0x7ffc9, - 0x7ffca, 0x7ffcb, 0x7ffcc, 0x7ffcd, 0x7ffce, 0x7ffcf, 0x7ffd0, 0x7ffd1, - 0x7ffd2, 0x7ffd3, 0x1ffe6, 0x3ffd4, 0x0fff0, 0x1ffe9, 0x3ffd5, 0x1ffe7, - 0x0fff1, 0x0ffec, 0x0ffed, 0x0ffee, 0x07ff4, 0x03ff9, 0x03ff7, 0x01ffa, - 0x01ff9, 0x00ffb, 0x007fc, 0x003fc, 0x001fd, 0x000fd, 0x0007d, 0x0003d, - 0x0001d, 0x0000d, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000c, 0x0001c, - 0x0003c, 0x0007c, 0x000fc, 0x001fc, 0x003fd, 0x00ffa, 0x01ff8, 0x03ff6, - 0x03ff8, 0x07ff5, 0x0ffef, 0x1ffe8, 0x0fff2, 0x7ffd4, 0x7ffd5, 0x7ffd6, - 0x7ffd7, 0x7ffd8, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, 0x7ffde, - 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffe6, - 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffec, 0x7ffed, 0x7ffee, - 0x7ffef, 0x7fff0, 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, - 0x7fff7, 0x7fff8, 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, - 0x7ffff, -}; - -static const uint8_t f_huffman_env_1_5dB_bits[121] = { - 19, 19, 20, 20, 20, 20, 20, 20, - 20, 19, 20, 20, 20, 20, 19, 20, - 19, 19, 20, 18, 20, 20, 20, 19, - 20, 20, 20, 19, 20, 19, 18, 19, - 18, 18, 17, 18, 17, 17, 17, 16, - 16, 16, 15, 15, 14, 13, 13, 12, - 12, 11, 10, 9, 9, 8, 7, 6, - 5, 4, 3, 2, 2, 3, 4, 5, - 6, 8, 8, 9, 10, 11, 11, 11, - 12, 12, 13, 13, 14, 14, 16, 16, - 17, 17, 18, 18, 18, 18, 18, 18, - 18, 20, 19, 20, 20, 20, 20, 20, - 20, 19, 20, 20, 20, 20, 19, 20, - 18, 20, 20, 19, 19, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, - 20, -}; - -static const uint32_t f_huffman_env_1_5dB_codes[121] = { - 0x7ffe7, 0x7ffe8, 0xfffd2, 0xfffd3, 0xfffd4, 0xfffd5, 0xfffd6, 0xfffd7, - 0xfffd8, 0x7ffda, 0xfffd9, 0xfffda, 0xfffdb, 0xfffdc, 0x7ffdb, 0xfffdd, - 0x7ffdc, 0x7ffdd, 0xfffde, 0x3ffe4, 0xfffdf, 0xfffe0, 0xfffe1, 0x7ffde, - 0xfffe2, 0xfffe3, 0xfffe4, 0x7ffdf, 0xfffe5, 0x7ffe0, 0x3ffe8, 0x7ffe1, - 0x3ffe0, 0x3ffe9, 0x1ffef, 0x3ffe5, 0x1ffec, 0x1ffed, 0x1ffee, 0x0fff4, - 0x0fff3, 0x0fff0, 0x07ff7, 0x07ff6, 0x03ffa, 0x01ffa, 0x01ff9, 0x00ffa, - 0x00ff8, 0x007f9, 0x003fb, 0x001fc, 0x001fa, 0x000fb, 0x0007c, 0x0003c, - 0x0001c, 0x0000c, 0x00005, 0x00001, 0x00000, 0x00004, 0x0000d, 0x0001d, - 0x0003d, 0x000fa, 0x000fc, 0x001fb, 0x003fa, 0x007f8, 0x007fa, 0x007fb, - 0x00ff9, 0x00ffb, 0x01ff8, 0x01ffb, 0x03ff8, 0x03ff9, 0x0fff1, 0x0fff2, - 0x1ffea, 0x1ffeb, 0x3ffe1, 0x3ffe2, 0x3ffea, 0x3ffe3, 0x3ffe6, 0x3ffe7, - 0x3ffeb, 0xfffe6, 0x7ffe2, 0xfffe7, 0xfffe8, 0xfffe9, 0xfffea, 0xfffeb, - 0xfffec, 0x7ffe3, 0xfffed, 0xfffee, 0xfffef, 0xffff0, 0x7ffe4, 0xffff1, - 0x3ffec, 0xffff2, 0xffff3, 0x7ffe5, 0x7ffe6, 0xffff4, 0xffff5, 0xffff6, - 0xffff7, 0xffff8, 0xffff9, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, - 0xfffff, -}; - -static const uint8_t t_huffman_env_bal_1_5dB_bits[49] = { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 12, 11, 9, 7, 5, 3, - 1, 2, 4, 6, 8, 11, 12, 15, - 16, 16, 16, 16, 16, 16, 16, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, -}; - -static const uint32_t t_huffman_env_bal_1_5dB_codes[49] = { - 0x0ffe4, 0x0ffe5, 0x0ffe6, 0x0ffe7, 0x0ffe8, 0x0ffe9, 0x0ffea, 0x0ffeb, - 0x0ffec, 0x0ffed, 0x0ffee, 0x0ffef, 0x0fff0, 0x0fff1, 0x0fff2, 0x0fff3, - 0x0fff4, 0x0ffe2, 0x00ffc, 0x007fc, 0x001fe, 0x0007e, 0x0001e, 0x00006, - 0x00000, 0x00002, 0x0000e, 0x0003e, 0x000fe, 0x007fd, 0x00ffd, 0x07ff0, - 0x0ffe3, 0x0fff5, 0x0fff6, 0x0fff7, 0x0fff8, 0x0fff9, 0x0fffa, 0x1fff6, - 0x1fff7, 0x1fff8, 0x1fff9, 0x1fffa, 0x1fffb, 0x1fffc, 0x1fffd, 0x1fffe, - 0x1ffff, -}; - -static const uint8_t f_huffman_env_bal_1_5dB_bits[49] = { - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 16, - 17, 14, 11, 11, 8, 7, 4, 2, - 1, 3, 5, 6, 9, 11, 12, 15, - 16, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 19, - 19, -}; - -static const uint32_t f_huffman_env_bal_1_5dB_codes[49] = { - 0x3ffe2, 0x3ffe3, 0x3ffe4, 0x3ffe5, 0x3ffe6, 0x3ffe7, 0x3ffe8, 0x3ffe9, - 0x3ffea, 0x3ffeb, 0x3ffec, 0x3ffed, 0x3ffee, 0x3ffef, 0x3fff0, 0x0fff7, - 0x1fff0, 0x03ffc, 0x007fe, 0x007fc, 0x000fe, 0x0007e, 0x0000e, 0x00002, - 0x00000, 0x00006, 0x0001e, 0x0003e, 0x001fe, 0x007fd, 0x00ffe, 0x07ffa, - 0x0fff6, 0x3fff1, 0x3fff2, 0x3fff3, 0x3fff4, 0x3fff5, 0x3fff6, 0x3fff7, - 0x3fff8, 0x3fff9, 0x3fffa, 0x3fffb, 0x3fffc, 0x3fffd, 0x3fffe, 0x7fffe, - 0x7ffff, -}; - -static const uint8_t t_huffman_env_3_0dB_bits[63] = { - 18, 18, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 17, 16, 16, 16, 14, 14, 14, - 13, 12, 11, 8, 6, 4, 2, 1, - 3, 5, 7, 9, 11, 13, 14, 14, - 15, 16, 17, 18, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, -}; - -static const uint32_t t_huffman_env_3_0dB_codes[63] = { - 0x3ffed, 0x3ffee, 0x7ffde, 0x7ffdf, 0x7ffe0, 0x7ffe1, 0x7ffe2, 0x7ffe3, - 0x7ffe4, 0x7ffe5, 0x7ffe6, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, - 0x7ffec, 0x1fff4, 0x0fff7, 0x0fff9, 0x0fff8, 0x03ffb, 0x03ffa, 0x03ff8, - 0x01ffa, 0x00ffc, 0x007fc, 0x000fe, 0x0003e, 0x0000e, 0x00002, 0x00000, - 0x00006, 0x0001e, 0x0007e, 0x001fe, 0x007fd, 0x01ffb, 0x03ff9, 0x03ffc, - 0x07ffa, 0x0fff6, 0x1fff5, 0x3ffec, 0x7ffed, 0x7ffee, 0x7ffef, 0x7fff0, - 0x7fff1, 0x7fff2, 0x7fff3, 0x7fff4, 0x7fff5, 0x7fff6, 0x7fff7, 0x7fff8, - 0x7fff9, 0x7fffa, 0x7fffb, 0x7fffc, 0x7fffd, 0x7fffe, 0x7ffff, -}; - -static const uint8_t f_huffman_env_3_0dB_bits[63] = { - 20, 20, 20, 20, 20, 20, 20, 18, - 19, 19, 19, 19, 18, 18, 20, 19, - 17, 18, 17, 16, 16, 15, 14, 12, - 11, 10, 9, 8, 6, 4, 2, 1, - 3, 5, 8, 9, 10, 11, 12, 13, - 14, 15, 15, 16, 16, 17, 17, 18, - 18, 18, 20, 19, 19, 19, 20, 19, - 19, 20, 20, 20, 20, 20, 20, -}; - -static const uint32_t f_huffman_env_3_0dB_codes[63] = { - 0xffff0, 0xffff1, 0xffff2, 0xffff3, 0xffff4, 0xffff5, 0xffff6, 0x3fff3, - 0x7fff5, 0x7ffee, 0x7ffef, 0x7fff6, 0x3fff4, 0x3fff2, 0xffff7, 0x7fff0, - 0x1fff5, 0x3fff0, 0x1fff4, 0x0fff7, 0x0fff6, 0x07ff8, 0x03ffb, 0x00ffd, - 0x007fd, 0x003fd, 0x001fd, 0x000fd, 0x0003e, 0x0000e, 0x00002, 0x00000, - 0x00006, 0x0001e, 0x000fc, 0x001fc, 0x003fc, 0x007fc, 0x00ffc, 0x01ffc, - 0x03ffa, 0x07ff9, 0x07ffa, 0x0fff8, 0x0fff9, 0x1fff6, 0x1fff7, 0x3fff5, - 0x3fff6, 0x3fff1, 0xffff8, 0x7fff1, 0x7fff2, 0x7fff3, 0xffff9, 0x7fff7, - 0x7fff4, 0xffffa, 0xffffb, 0xffffc, 0xffffd, 0xffffe, 0xfffff, -}; - -static const uint8_t t_huffman_env_bal_3_0dB_bits[25] = { - 13, 13, 13, 13, 13, 13, 13, 12, - 8, 7, 4, 3, 1, 2, 5, 6, - 9, 13, 13, 13, 13, 13, 13, 14, - 14, -}; - -static const uint16_t t_huffman_env_bal_3_0dB_codes[25] = { - 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x0ff8, - 0x00fe, 0x007e, 0x000e, 0x0006, 0x0000, 0x0002, 0x001e, 0x003e, - 0x01fe, 0x1ff9, 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, - 0x3fff, -}; - -static const uint8_t f_huffman_env_bal_3_0dB_bits[25] = { - 13, 13, 13, 13, 13, 14, 14, 11, - 8, 7, 4, 2, 1, 3, 5, 6, - 9, 12, 13, 14, 14, 14, 14, 14, - 14, -}; - -static const uint16_t f_huffman_env_bal_3_0dB_codes[25] = { - 0x1ff7, 0x1ff8, 0x1ff9, 0x1ffa, 0x1ffb, 0x3ff8, 0x3ff9, 0x07fc, - 0x00fe, 0x007e, 0x000e, 0x0002, 0x0000, 0x0006, 0x001e, 0x003e, - 0x01fe, 0x0ffa, 0x1ff6, 0x3ffa, 0x3ffb, 0x3ffc, 0x3ffd, 0x3ffe, - 0x3fff, -}; - -static const uint8_t t_huffman_noise_3_0dB_bits[63] = { - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 11, 8, 6, 4, 3, 1, - 2, 5, 8, 10, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 14, 14, -}; - -static const uint16_t t_huffman_noise_3_0dB_codes[63] = { - 0x1fce, 0x1fcf, 0x1fd0, 0x1fd1, 0x1fd2, 0x1fd3, 0x1fd4, 0x1fd5, - 0x1fd6, 0x1fd7, 0x1fd8, 0x1fd9, 0x1fda, 0x1fdb, 0x1fdc, 0x1fdd, - 0x1fde, 0x1fdf, 0x1fe0, 0x1fe1, 0x1fe2, 0x1fe3, 0x1fe4, 0x1fe5, - 0x1fe6, 0x1fe7, 0x07f2, 0x00fd, 0x003e, 0x000e, 0x0006, 0x0000, - 0x0002, 0x001e, 0x00fc, 0x03f8, 0x1fcc, 0x1fe8, 0x1fe9, 0x1fea, - 0x1feb, 0x1fec, 0x1fcd, 0x1fed, 0x1fee, 0x1fef, 0x1ff0, 0x1ff1, - 0x1ff2, 0x1ff3, 0x1ff4, 0x1ff5, 0x1ff6, 0x1ff7, 0x1ff8, 0x1ff9, - 0x1ffa, 0x1ffb, 0x1ffc, 0x1ffd, 0x1ffe, 0x3ffe, 0x3fff, -}; - -static const uint8_t t_huffman_noise_bal_3_0dB_bits[25] = { - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 5, 2, 1, 3, 6, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, -}; - -static const uint8_t t_huffman_noise_bal_3_0dB_codes[25] = { - 0xec, 0xed, 0xee, 0xef, 0xf0, 0xf1, 0xf2, 0xf3, - 0xf4, 0xf5, 0x1c, 0x02, 0x00, 0x06, 0x3a, 0xf6, - 0xf7, 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, - 0xff, -}; - -static const int8_t sbr_offset[6][16] = { - {-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7}, // fs_sbr = 16000 Hz - {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13}, // fs_sbr = 22050 Hz - {-5, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16}, // fs_sbr = 24000 Hz - {-6, -4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16}, // fs_sbr = 32000 Hz - {-4, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20}, // 44100 Hz <= fs_sbr <= 64000 Hz - {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 13, 16, 20, 24}, // 64000 Hz < fs_sbr -}; - -///< window coefficients for analysis/synthesis QMF banks -static DECLARE_ALIGNED(32, float, sbr_qmf_window_ds)[320]; -static DECLARE_ALIGNED(32, float, sbr_qmf_window_us)[640] = { - 0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518, - -0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564, - -0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747, - -0.0006312493, -0.0006540333, -0.0006777690, -0.0006941614, - -0.0007157736, -0.0007255043, -0.0007440941, -0.0007490598, - -0.0007681371, -0.0007724848, -0.0007834332, -0.0007779869, - -0.0007803664, -0.0007801449, -0.0007757977, -0.0007630793, - -0.0007530001, -0.0007319357, -0.0007215391, -0.0006917937, - -0.0006650415, -0.0006341594, -0.0005946118, -0.0005564576, - -0.0005145572, -0.0004606325, -0.0004095121, -0.0003501175, - -0.0002896981, -0.0002098337, -0.0001446380, -0.0000617334, - 0.0000134949, 0.0001094383, 0.0002043017, 0.0002949531, - 0.0004026540, 0.0005107388, 0.0006239376, 0.0007458025, - 0.0008608443, 0.0009885988, 0.0011250155, 0.0012577884, - 0.0013902494, 0.0015443219, 0.0016868083, 0.0018348265, - 0.0019841140, 0.0021461583, 0.0023017254, 0.0024625616, - 0.0026201758, 0.0027870464, 0.0029469447, 0.0031125420, - 0.0032739613, 0.0034418874, 0.0036008268, 0.0037603922, - 0.0039207432, 0.0040819753, 0.0042264269, 0.0043730719, - 0.0045209852, 0.0046606460, 0.0047932560, 0.0049137603, - 0.0050393022, 0.0051407353, 0.0052461166, 0.0053471681, - 0.0054196775, 0.0054876040, 0.0055475714, 0.0055938023, - 0.0056220643, 0.0056455196, 0.0056389199, 0.0056266114, - 0.0055917128, 0.0055404363, 0.0054753783, 0.0053838975, - 0.0052715758, 0.0051382275, 0.0049839687, 0.0048109469, - 0.0046039530, 0.0043801861, 0.0041251642, 0.0038456408, - 0.0035401246, 0.0032091885, 0.0028446757, 0.0024508540, - 0.0020274176, 0.0015784682, 0.0010902329, 0.0005832264, - 0.0000276045, -0.0005464280, -0.0011568135, -0.0018039472, - -0.0024826723, -0.0031933778, -0.0039401124, -0.0047222596, - -0.0055337211, -0.0063792293, -0.0072615816, -0.0081798233, - -0.0091325329, -0.0101150215, -0.0111315548, -0.0121849995, - 0.0132718220, 0.0143904666, 0.0155405553, 0.0167324712, - 0.0179433381, 0.0191872431, 0.0204531793, 0.0217467550, - 0.0230680169, 0.0244160992, 0.0257875847, 0.0271859429, - 0.0286072173, 0.0300502657, 0.0315017608, 0.0329754081, - 0.0344620948, 0.0359697560, 0.0374812850, 0.0390053679, - 0.0405349170, 0.0420649094, 0.0436097542, 0.0451488405, - 0.0466843027, 0.0482165720, 0.0497385755, 0.0512556155, - 0.0527630746, 0.0542452768, 0.0557173648, 0.0571616450, - 0.0585915683, 0.0599837480, 0.0613455171, 0.0626857808, - 0.0639715898, 0.0652247106, 0.0664367512, 0.0676075985, - 0.0687043828, 0.0697630244, 0.0707628710, 0.0717002673, - 0.0725682583, 0.0733620255, 0.0741003642, 0.0747452558, - 0.0753137336, 0.0758008358, 0.0761992479, 0.0764992170, - 0.0767093490, 0.0768173975, 0.0768230011, 0.0767204924, - 0.0765050718, 0.0761748321, 0.0757305756, 0.0751576255, - 0.0744664394, 0.0736406005, 0.0726774642, 0.0715826364, - 0.0703533073, 0.0689664013, 0.0674525021, 0.0657690668, - 0.0639444805, 0.0619602779, 0.0598166570, 0.0575152691, - 0.0550460034, 0.0524093821, 0.0495978676, 0.0466303305, - 0.0434768782, 0.0401458278, 0.0366418116, 0.0329583930, - 0.0290824006, 0.0250307561, 0.0207997072, 0.0163701258, - 0.0117623832, 0.0069636862, 0.0019765601, -0.0032086896, - -0.0085711749, -0.0141288827, -0.0198834129, -0.0258227288, - -0.0319531274, -0.0382776572, -0.0447806821, -0.0514804176, - -0.0583705326, -0.0654409853, -0.0726943300, -0.0801372934, - -0.0877547536, -0.0955533352, -0.1035329531, -0.1116826931, - -0.1200077984, -0.1285002850, -0.1371551761, -0.1459766491, - -0.1549607071, -0.1640958855, -0.1733808172, -0.1828172548, - -0.1923966745, -0.2021250176, -0.2119735853, -0.2219652696, - -0.2320690870, -0.2423016884, -0.2526480309, -0.2631053299, - -0.2736634040, -0.2843214189, -0.2950716717, -0.3059098575, - -0.3168278913, -0.3278113727, -0.3388722693, -0.3499914122, - 0.3611589903, 0.3723795546, 0.3836350013, 0.3949211761, - 0.4062317676, 0.4175696896, 0.4289119920, 0.4402553754, - 0.4515996535, 0.4629308085, 0.4742453214, 0.4855253091, - 0.4967708254, 0.5079817500, 0.5191234970, 0.5302240895, - 0.5412553448, 0.5522051258, 0.5630789140, 0.5738524131, - 0.5845403235, 0.5951123086, 0.6055783538, 0.6159109932, - 0.6261242695, 0.6361980107, 0.6461269695, 0.6559016302, - 0.6655139880, 0.6749663190, 0.6842353293, 0.6933282376, - 0.7022388719, 0.7109410426, 0.7194462634, 0.7277448900, - 0.7358211758, 0.7436827863, 0.7513137456, 0.7587080760, - 0.7658674865, 0.7727780881, 0.7794287519, 0.7858353120, - 0.7919735841, 0.7978466413, 0.8034485751, 0.8087695004, - 0.8138191270, 0.8185776004, 0.8230419890, 0.8272275347, - 0.8311038457, 0.8346937361, 0.8379717337, 0.8409541392, - 0.8436238281, 0.8459818469, 0.8480315777, 0.8497805198, - 0.8511971524, 0.8523047035, 0.8531020949, 0.8535720573, - 0.8537385600, -}; - -/* First eight entries repeated at end to simplify SIMD implementations. */ -const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = { -{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, -{ 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, -{ 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, -{-0.01053049862020, -0.66959058036166}, {-0.91266367957293, -0.11522938140034}, -{ 0.54840422910309, 0.75221367176302}, { 0.40009252867955, -0.98929400334421}, -{-0.99867974711855, -0.88147068645358}, {-0.95531076805040, 0.90908757154593}, -{-0.45725933317144, -0.56716323646760}, {-0.72929675029275, -0.98008272727324}, -{ 0.75622801399036, 0.20950329995549}, { 0.07069442601050, -0.78247898470706}, -{ 0.74496252926055, -0.91169004445807}, {-0.96440182703856, -0.94739918296622}, -{ 0.30424629369539, -0.49438267012479}, { 0.66565033746925, 0.64652935542491}, -{ 0.91697008020594, 0.17514097332009}, {-0.70774918760427, 0.52548653416543}, -{-0.70051415345560, -0.45340028808763}, {-0.99496513054797, -0.90071908066973}, -{ 0.98164490790123, -0.77463155528697}, {-0.54671580548181, -0.02570928536004}, -{-0.01689629065389, 0.00287506445732}, {-0.86110349531986, 0.42548583726477}, -{-0.98892980586032, -0.87881132267556}, { 0.51756627678691, 0.66926784710139}, -{-0.99635026409640, -0.58107730574765}, {-0.99969370862163, 0.98369989360250}, -{ 0.55266258627194, 0.59449057465591}, { 0.34581177741673, 0.94879421061866}, -{ 0.62664209577999, -0.74402970906471}, {-0.77149701404973, -0.33883658042801}, -{-0.91592244254432, 0.03687901376713}, {-0.76285492357887, -0.91371867919124}, -{ 0.79788337195331, -0.93180971199849}, { 0.54473080610200, -0.11919206037186}, -{-0.85639281671058, 0.42429854760451}, {-0.92882402971423, 0.27871809078609}, -{-0.11708371046774, -0.99800843444966}, { 0.21356749817493, -0.90716295627033}, -{-0.76191692573909, 0.99768118356265}, { 0.98111043100884, -0.95854459734407}, -{-0.85913269895572, 0.95766566168880}, {-0.93307242253692, 0.49431757696466}, -{ 0.30485754879632, -0.70540034357529}, { 0.85289650925190, 0.46766131791044}, -{ 0.91328082618125, -0.99839597361769}, {-0.05890199924154, 0.70741827819497}, -{ 0.28398686150148, 0.34633555702188}, { 0.95258164539612, -0.54893416026939}, -{-0.78566324168507, -0.75568541079691}, {-0.95789495447877, -0.20423194696966}, -{ 0.82411158711197, 0.96654618432562}, {-0.65185446735885, -0.88734990773289}, -{-0.93643603134666, 0.99870790442385}, { 0.91427159529618, -0.98290505544444}, -{-0.70395684036886, 0.58796798221039}, { 0.00563771969365, 0.61768196727244}, -{ 0.89065051931895, 0.52783352697585}, {-0.68683707712762, 0.80806944710339}, -{ 0.72165342518718, -0.69259857349564}, {-0.62928247730667, 0.13627037407335}, -{ 0.29938434065514, -0.46051329682246}, {-0.91781958879280, -0.74012716684186}, -{ 0.99298717043688, 0.40816610075661}, { 0.82368298622748, -0.74036047190173}, -{-0.98512833386833, -0.99972330709594}, {-0.95915368242257, -0.99237800466040}, -{-0.21411126572790, -0.93424819052545}, {-0.68821476106884, -0.26892306315457}, -{ 0.91851997982317, 0.09358228901785}, {-0.96062769559127, 0.36099095133739}, -{ 0.51646184922287, -0.71373332873917}, { 0.61130721139669, 0.46950141175917}, -{ 0.47336129371299, -0.27333178296162}, { 0.90998308703519, 0.96715662938132}, -{ 0.44844799194357, 0.99211574628306}, { 0.66614891079092, 0.96590176169121}, -{ 0.74922239129237, -0.89879858826087}, {-0.99571588506485, 0.52785521494349}, -{ 0.97401082477563, -0.16855870075190}, { 0.72683747733879, -0.48060774432251}, -{ 0.95432193457128, 0.68849603408441}, {-0.72962208425191, -0.76608443420917}, -{-0.85359479233537, 0.88738125901579}, {-0.81412430338535, -0.97480768049637}, -{-0.87930772356786, 0.74748307690436}, {-0.71573331064977, -0.98570608178923}, -{ 0.83524300028228, 0.83702537075163}, {-0.48086065601423, -0.98848504923531}, -{ 0.97139128574778, 0.80093621198236}, { 0.51992825347895, 0.80247631400510}, -{-0.00848591195325, -0.76670128000486}, {-0.70294374303036, 0.55359910445577}, -{-0.95894428168140, -0.43265504344783}, { 0.97079252950321, 0.09325857238682}, -{-0.92404293670797, 0.85507704027855}, {-0.69506469500450, 0.98633412625459}, -{ 0.26559203620024, 0.73314307966524}, { 0.28038443336943, 0.14537913654427}, -{-0.74138124825523, 0.99310339807762}, {-0.01752795995444, -0.82616635284178}, -{-0.55126773094930, -0.98898543862153}, { 0.97960898850996, -0.94021446752851}, -{-0.99196309146936, 0.67019017358456}, {-0.67684928085260, 0.12631491649378}, -{ 0.09140039465500, -0.20537731453108}, {-0.71658965751996, -0.97788200391224}, -{ 0.81014640078925, 0.53722648362443}, { 0.40616991671205, -0.26469008598449}, -{-0.67680188682972, 0.94502052337695}, { 0.86849774348749, -0.18333598647899}, -{-0.99500381284851, -0.02634122068550}, { 0.84329189340667, 0.10406957462213}, -{-0.09215968531446, 0.69540012101253}, { 0.99956173327206, -0.12358542001404}, -{-0.79732779473535, -0.91582524736159}, { 0.96349973642406, 0.96640458041000}, -{-0.79942778496547, 0.64323902822857}, {-0.11566039853896, 0.28587846253726}, -{-0.39922954514662, 0.94129601616966}, { 0.99089197565987, -0.92062625581587}, -{ 0.28631285179909, -0.91035047143603}, {-0.83302725605608, -0.67330410892084}, -{ 0.95404443402072, 0.49162765398743}, {-0.06449863579434, 0.03250560813135}, -{-0.99575054486311, 0.42389784469507}, {-0.65501142790847, 0.82546114655624}, -{-0.81254441908887, -0.51627234660629}, {-0.99646369485481, 0.84490533520752}, -{ 0.00287840603348, 0.64768261158166}, { 0.70176989408455, -0.20453028573322}, -{ 0.96361882270190, 0.40706967140989}, {-0.68883758192426, 0.91338958840772}, -{-0.34875585502238, 0.71472290693300}, { 0.91980081243087, 0.66507455644919}, -{-0.99009048343881, 0.85868021604848}, { 0.68865791458395, 0.55660316809678}, -{-0.99484402129368, -0.20052559254934}, { 0.94214511408023, -0.99696425367461}, -{-0.67414626793544, 0.49548221180078}, {-0.47339353684664, -0.85904328834047}, -{ 0.14323651387360, -0.94145598222488}, {-0.29268293575672, 0.05759224927952}, -{ 0.43793861458754, -0.78904969892724}, {-0.36345126374441, 0.64874435357162}, -{-0.08750604656825, 0.97686944362527}, {-0.96495267812511, -0.53960305946511}, -{ 0.55526940659947, 0.78891523734774}, { 0.73538215752630, 0.96452072373404}, -{-0.30889773919437, -0.80664389776860}, { 0.03574995626194, -0.97325616900959}, -{ 0.98720684660488, 0.48409133691962}, {-0.81689296271203, -0.90827703628298}, -{ 0.67866860118215, 0.81284503870856}, {-0.15808569732583, 0.85279555024382}, -{ 0.80723395114371, -0.24717418514605}, { 0.47788757329038, -0.46333147839295}, -{ 0.96367554763201, 0.38486749303242}, {-0.99143875716818, -0.24945277239809}, -{ 0.83081876925833, -0.94780851414763}, {-0.58753191905341, 0.01290772389163}, -{ 0.95538108220960, -0.85557052096538}, {-0.96490920476211, -0.64020970923102}, -{-0.97327101028521, 0.12378128133110}, { 0.91400366022124, 0.57972471346930}, -{-0.99925837363824, 0.71084847864067}, {-0.86875903507313, -0.20291699203564}, -{-0.26240034795124, -0.68264554369108}, {-0.24664412953388, -0.87642273115183}, -{ 0.02416275806869, 0.27192914288905}, { 0.82068619590515, -0.85087787994476}, -{ 0.88547373760759, -0.89636802901469}, {-0.18173078152226, -0.26152145156800}, -{ 0.09355476558534, 0.54845123045604}, {-0.54668414224090, 0.95980774020221}, -{ 0.37050990604091, -0.59910140383171}, {-0.70373594262891, 0.91227665827081}, -{-0.34600785879594, -0.99441426144200}, {-0.68774481731008, -0.30238837956299}, -{-0.26843291251234, 0.83115668004362}, { 0.49072334613242, -0.45359708737775}, -{ 0.38975993093975, 0.95515358099121}, {-0.97757125224150, 0.05305894580606}, -{-0.17325552859616, -0.92770672250494}, { 0.99948035025744, 0.58285545563426}, -{-0.64946246527458, 0.68645507104960}, {-0.12016920576437, -0.57147322153312}, -{-0.58947456517751, -0.34847132454388}, {-0.41815140454465, 0.16276422358861}, -{ 0.99885650204884, 0.11136095490444}, {-0.56649614128386, -0.90494866361587}, -{ 0.94138021032330, 0.35281916733018}, {-0.75725076534641, 0.53650549640587}, -{ 0.20541973692630, -0.94435144369918}, { 0.99980371023351, 0.79835913565599}, -{ 0.29078277605775, 0.35393777921520}, {-0.62858772103030, 0.38765693387102}, -{ 0.43440904467688, -0.98546330463232}, {-0.98298583762390, 0.21021524625209}, -{ 0.19513029146934, -0.94239832251867}, {-0.95476662400101, 0.98364554179143}, -{ 0.93379635304810, -0.70881994583682}, {-0.85235410573336, -0.08342347966410}, -{-0.86425093011245, -0.45795025029466}, { 0.38879779059045, 0.97274429344593}, -{ 0.92045124735495, -0.62433652524220}, { 0.89162532251878, 0.54950955570563}, -{-0.36834336949252, 0.96458298020975}, { 0.93891760988045, -0.89968353740388}, -{ 0.99267657565094, -0.03757034316958}, {-0.94063471614176, 0.41332338538963}, -{ 0.99740224117019, -0.16830494996370}, {-0.35899413170555, -0.46633226649613}, -{ 0.05237237274947, -0.25640361602661}, { 0.36703583957424, -0.38653265641875}, -{ 0.91653180367913, -0.30587628726597}, { 0.69000803499316, 0.90952171386132}, -{-0.38658751133527, 0.99501571208985}, {-0.29250814029851, 0.37444994344615}, -{-0.60182204677608, 0.86779651036123}, {-0.97418588163217, 0.96468523666475}, -{ 0.88461574003963, 0.57508405276414}, { 0.05198933055162, 0.21269661669964}, -{-0.53499621979720, 0.97241553731237}, {-0.49429560226497, 0.98183865291903}, -{-0.98935142339139, -0.40249159006933}, {-0.98081380091130, -0.72856895534041}, -{-0.27338148835532, 0.99950922447209}, { 0.06310802338302, -0.54539587529618}, -{-0.20461677199539, -0.14209977628489}, { 0.66223843141647, 0.72528579940326}, -{-0.84764345483665, 0.02372316801261}, {-0.89039863483811, 0.88866581484602}, -{ 0.95903308477986, 0.76744927173873}, { 0.73504123909879, -0.03747203173192}, -{-0.31744434966056, -0.36834111883652}, {-0.34110827591623, 0.40211222807691}, -{ 0.47803883714199, -0.39423219786288}, { 0.98299195879514, 0.01989791390047}, -{-0.30963073129751, -0.18076720599336}, { 0.99992588229018, -0.26281872094289}, -{-0.93149731080767, -0.98313162570490}, { 0.99923472302773, -0.80142993767554}, -{-0.26024169633417, -0.75999759855752}, {-0.35712514743563, 0.19298963768574}, -{-0.99899084509530, 0.74645156992493}, { 0.86557171579452, 0.55593866696299}, -{ 0.33408042438752, 0.86185953874709}, { 0.99010736374716, 0.04602397576623}, -{-0.66694269691195, -0.91643611810148}, { 0.64016792079480, 0.15649530836856}, -{ 0.99570534804836, 0.45844586038111}, {-0.63431466947340, 0.21079116459234}, -{-0.07706847005931, -0.89581437101329}, { 0.98590090577724, 0.88241721133981}, -{ 0.80099335254678, -0.36851896710853}, { 0.78368131392666, 0.45506999802597}, -{ 0.08707806671691, 0.80938994918745}, {-0.86811883080712, 0.39347308654705}, -{-0.39466529740375, -0.66809432114456}, { 0.97875325649683, -0.72467840967746}, -{-0.95038560288864, 0.89563219587625}, { 0.17005239424212, 0.54683053962658}, -{-0.76910792026848, -0.96226617549298}, { 0.99743281016846, 0.42697157037567}, -{ 0.95437383549973, 0.97002324109952}, { 0.99578905365569, -0.54106826257356}, -{ 0.28058259829990, -0.85361420634036}, { 0.85256524470573, -0.64567607735589}, -{-0.50608540105128, -0.65846015480300}, {-0.97210735183243, -0.23095213067791}, -{ 0.95424048234441, -0.99240147091219}, {-0.96926570524023, 0.73775654896574}, -{ 0.30872163214726, 0.41514960556126}, {-0.24523839572639, 0.63206633394807}, -{-0.33813265086024, -0.38661779441897}, {-0.05826828420146, -0.06940774188029}, -{-0.22898461455054, 0.97054853316316}, {-0.18509915019881, 0.47565762892084}, -{-0.10488238045009, -0.87769947402394}, {-0.71886586182037, 0.78030982480538}, -{ 0.99793873738654, 0.90041310491497}, { 0.57563307626120, -0.91034337352097}, -{ 0.28909646383717, 0.96307783970534}, { 0.42188998312520, 0.48148651230437}, -{ 0.93335049681047, -0.43537023883588}, {-0.97087374418267, 0.86636445711364}, -{ 0.36722871286923, 0.65291654172961}, {-0.81093025665696, 0.08778370229363}, -{-0.26240603062237, -0.92774095379098}, { 0.83996497984604, 0.55839849139647}, -{-0.99909615720225, -0.96024605713970}, { 0.74649464155061, 0.12144893606462}, -{-0.74774595569805, -0.26898062008959}, { 0.95781667469567, -0.79047927052628}, -{ 0.95472308713099, -0.08588776019550}, { 0.48708332746299, 0.99999041579432}, -{ 0.46332038247497, 0.10964126185063}, {-0.76497004940162, 0.89210929242238}, -{ 0.57397389364339, 0.35289703373760}, { 0.75374316974495, 0.96705214651335}, -{-0.59174397685714, -0.89405370422752}, { 0.75087906691890, -0.29612672982396}, -{-0.98607857336230, 0.25034911730023}, {-0.40761056640505, -0.90045573444695}, -{ 0.66929266740477, 0.98629493401748}, {-0.97463695257310, -0.00190223301301}, -{ 0.90145509409859, 0.99781390365446}, {-0.87259289048043, 0.99233587353666}, -{-0.91529461447692, -0.15698707534206}, {-0.03305738840705, -0.37205262859764}, -{ 0.07223051368337, -0.88805001733626}, { 0.99498012188353, 0.97094358113387}, -{-0.74904939500519, 0.99985483641521}, { 0.04585228574211, 0.99812337444082}, -{-0.89054954257993, -0.31791913188064}, {-0.83782144651251, 0.97637632547466}, -{ 0.33454804933804, -0.86231516800408}, {-0.99707579362824, 0.93237990079441}, -{-0.22827527843994, 0.18874759397997}, { 0.67248046289143, -0.03646211390569}, -{-0.05146538187944, -0.92599700120679}, { 0.99947295749905, 0.93625229707912}, -{ 0.66951124390363, 0.98905825623893}, {-0.99602956559179, -0.44654715757688}, -{ 0.82104905483590, 0.99540741724928}, { 0.99186510988782, 0.72023001312947}, -{-0.65284592392918, 0.52186723253637}, { 0.93885443798188, -0.74895312615259}, -{ 0.96735248738388, 0.90891816978629}, {-0.22225968841114, 0.57124029781228}, -{-0.44132783753414, -0.92688840659280}, {-0.85694974219574, 0.88844532719844}, -{ 0.91783042091762, -0.46356892383970}, { 0.72556974415690, -0.99899555770747}, -{-0.99711581834508, 0.58211560180426}, { 0.77638976371966, 0.94321834873819}, -{ 0.07717324253925, 0.58638399856595}, {-0.56049829194163, 0.82522301569036}, -{ 0.98398893639988, 0.39467440420569}, { 0.47546946844938, 0.68613044836811}, -{ 0.65675089314631, 0.18331637134880}, { 0.03273375457980, -0.74933109564108}, -{-0.38684144784738, 0.51337349030406}, {-0.97346267944545, -0.96549364384098}, -{-0.53282156061942, -0.91423265091354}, { 0.99817310731176, 0.61133572482148}, -{-0.50254500772635, -0.88829338134294}, { 0.01995873238855, 0.85223515096765}, -{ 0.99930381973804, 0.94578896296649}, { 0.82907767600783, -0.06323442598128}, -{-0.58660709669728, 0.96840773806582}, {-0.17573736667267, -0.48166920859485}, -{ 0.83434292401346, -0.13023450646997}, { 0.05946491307025, 0.20511047074866}, -{ 0.81505484574602, -0.94685947861369}, {-0.44976380954860, 0.40894572671545}, -{-0.89746474625671, 0.99846578838537}, { 0.39677256130792, -0.74854668609359}, -{-0.07588948563079, 0.74096214084170}, { 0.76343198951445, 0.41746629422634}, -{-0.74490104699626, 0.94725911744610}, { 0.64880119792759, 0.41336660830571}, -{ 0.62319537462542, -0.93098313552599}, { 0.42215817594807, -0.07712787385208}, -{ 0.02704554141885, -0.05417518053666}, { 0.80001773566818, 0.91542195141039}, -{-0.79351832348816, -0.36208897989136}, { 0.63872359151636, 0.08128252493444}, -{ 0.52890520960295, 0.60048872455592}, { 0.74238552914587, 0.04491915291044}, -{ 0.99096131449250, -0.19451182854402}, {-0.80412329643109, -0.88513818199457}, -{-0.64612616129736, 0.72198674804544}, { 0.11657770663191, -0.83662833815041}, -{-0.95053182488101, -0.96939905138082}, {-0.62228872928622, 0.82767262846661}, -{ 0.03004475787316, -0.99738896333384}, {-0.97987214341034, 0.36526129686425}, -{-0.99986980746200, -0.36021610299715}, { 0.89110648599879, -0.97894250343044}, -{ 0.10407960510582, 0.77357793811619}, { 0.95964737821728, -0.35435818285502}, -{ 0.50843233159162, 0.96107691266205}, { 0.17006334670615, -0.76854025314829}, -{ 0.25872675063360, 0.99893303933816}, {-0.01115998681937, 0.98496019742444}, -{-0.79598702973261, 0.97138411318894}, {-0.99264708948101, -0.99542822402536}, -{-0.99829663752818, 0.01877138824311}, {-0.70801016548184, 0.33680685948117}, -{-0.70467057786826, 0.93272777501857}, { 0.99846021905254, -0.98725746254433}, -{-0.63364968534650, -0.16473594423746}, {-0.16258217500792, -0.95939125400802}, -{-0.43645594360633, -0.94805030113284}, {-0.99848471702976, 0.96245166923809}, -{-0.16796458968998, -0.98987511890470}, {-0.87979225745213, -0.71725725041680}, -{ 0.44183099021786, -0.93568974498761}, { 0.93310180125532, -0.99913308068246}, -{-0.93941931782002, -0.56409379640356}, {-0.88590003188677, 0.47624600491382}, -{ 0.99971463703691, -0.83889954253462}, {-0.75376385639978, 0.00814643438625}, -{ 0.93887685615875, -0.11284528204636}, { 0.85126435782309, 0.52349251543547}, -{ 0.39701421446381, 0.81779634174316}, {-0.37024464187437, -0.87071656222959}, -{-0.36024828242896, 0.34655735648287}, {-0.93388812549209, -0.84476541096429}, -{-0.65298804552119, -0.18439575450921}, { 0.11960319006843, 0.99899346780168}, -{ 0.94292565553160, 0.83163906518293}, { 0.75081145286948, -0.35533223142265}, -{ 0.56721979748394, -0.24076836414499}, { 0.46857766746029, -0.30140233457198}, -{ 0.97312313923635, -0.99548191630031}, {-0.38299976567017, 0.98516909715427}, -{ 0.41025800019463, 0.02116736935734}, { 0.09638062008048, 0.04411984381457}, -{-0.85283249275397, 0.91475563922421}, { 0.88866808958124, -0.99735267083226}, -{-0.48202429536989, -0.96805608884164}, { 0.27572582416567, 0.58634753335832}, -{-0.65889129659168, 0.58835634138583}, { 0.98838086953732, 0.99994349600236}, -{-0.20651349620689, 0.54593044066355}, {-0.62126416356920, -0.59893681700392}, -{ 0.20320105410437, -0.86879180355289}, {-0.97790548600584, 0.96290806999242}, -{ 0.11112534735126, 0.21484763313301}, {-0.41368337314182, 0.28216837680365}, -{ 0.24133038992960, 0.51294362630238}, {-0.66393410674885, -0.08249679629081}, -{-0.53697829178752, -0.97649903936228}, {-0.97224737889348, 0.22081333579837}, -{ 0.87392477144549, -0.12796173740361}, { 0.19050361015753, 0.01602615387195}, -{-0.46353441212724, -0.95249041539006}, {-0.07064096339021, -0.94479803205886}, -{-0.92444085484466, -0.10457590187436}, {-0.83822593578728, -0.01695043208885}, -{ 0.75214681811150, -0.99955681042665}, {-0.42102998829339, 0.99720941999394}, -{-0.72094786237696, -0.35008961934255}, { 0.78843311019251, 0.52851398958271}, -{ 0.97394027897442, -0.26695944086561}, { 0.99206463477946, -0.57010120849429}, -{ 0.76789609461795, -0.76519356730966}, {-0.82002421836409, -0.73530179553767}, -{ 0.81924990025724, 0.99698425250579}, {-0.26719850873357, 0.68903369776193}, -{-0.43311260380975, 0.85321815947490}, { 0.99194979673836, 0.91876249766422}, -{-0.80692001248487, -0.32627540663214}, { 0.43080003649976, -0.21919095636638}, -{ 0.67709491937357, -0.95478075822906}, { 0.56151770568316, -0.70693811747778}, -{ 0.10831862810749, -0.08628837174592}, { 0.91229417540436, -0.65987351408410}, -{-0.48972893932274, 0.56289246362686}, {-0.89033658689697, -0.71656563987082}, -{ 0.65269447475094, 0.65916004833932}, { 0.67439478141121, -0.81684380846796}, -{-0.47770832416973, -0.16789556203025}, {-0.99715979260878, -0.93565784007648}, -{-0.90889593602546, 0.62034397054380}, {-0.06618622548177, -0.23812217221359}, -{ 0.99430266919728, 0.18812555317553}, { 0.97686402381843, -0.28664534366620}, -{ 0.94813650221268, -0.97506640027128}, {-0.95434497492853, -0.79607978501983}, -{-0.49104783137150, 0.32895214359663}, { 0.99881175120751, 0.88993983831354}, -{ 0.50449166760303, -0.85995072408434}, { 0.47162891065108, -0.18680204049569}, -{-0.62081581361840, 0.75000676218956}, {-0.43867015250812, 0.99998069244322}, -{ 0.98630563232075, -0.53578899600662}, {-0.61510362277374, -0.89515019899997}, -{-0.03841517601843, -0.69888815681179}, {-0.30102157304644, -0.07667808922205}, -{ 0.41881284182683, 0.02188098922282}, {-0.86135454941237, 0.98947480909359}, -{ 0.67226861393788, -0.13494389011014}, {-0.70737398842068, -0.76547349325992}, -{ 0.94044946687963, 0.09026201157416}, {-0.82386352534327, 0.08924768823676}, -{-0.32070666698656, 0.50143421908753}, { 0.57593163224487, -0.98966422921509}, -{-0.36326018419965, 0.07440243123228}, { 0.99979044674350, -0.14130287347405}, -{-0.92366023326932, -0.97979298068180}, {-0.44607178518598, -0.54233252016394}, -{ 0.44226800932956, 0.71326756742752}, { 0.03671907158312, 0.63606389366675}, -{ 0.52175424682195, -0.85396826735705}, {-0.94701139690956, -0.01826348194255}, -{-0.98759606946049, 0.82288714303073}, { 0.87434794743625, 0.89399495655433}, -{-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280}, -{ 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512}, -{-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781}, -// Start of duplicated table -{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, -{ 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, -{ 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, -{-0.01053049862020, -0.66959058036166}, {-0.91266367957293, -0.11522938140034}, -}; - -#endif /* AVCODEC_AACSBRDATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.c deleted file mode 100644 index eb882e897..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.c +++ /dev/null @@ -1,1729 +0,0 @@ -/* - * AAC data - * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) - * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC data - * @author Oded Shimon ( ods15 ods15 dyndns org ) - * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) - */ - -#include "libavutil/mem.h" -#include "aac.h" -#include "aac_tablegen.h" - -#include - -DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024]; -DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128]; - -const uint8_t ff_aac_num_swb_1024[] = { - 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 -}; - -const uint8_t ff_aac_num_swb_512[] = { - 0, 0, 0, 36, 36, 37, 31, 31, 0, 0, 0, 0, 0 -}; - -const uint8_t ff_aac_num_swb_128[] = { - 12, 12, 12, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15 -}; - -const uint8_t ff_aac_pred_sfb_max[] = { - 33, 33, 38, 40, 40, 40, 41, 41, 37, 37, 37, 34, 34 -}; - -const uint32_t ff_aac_scalefactor_code[121] = { - 0x3ffe8, 0x3ffe6, 0x3ffe7, 0x3ffe5, 0x7fff5, 0x7fff1, 0x7ffed, 0x7fff6, - 0x7ffee, 0x7ffef, 0x7fff0, 0x7fffc, 0x7fffd, 0x7ffff, 0x7fffe, 0x7fff7, - 0x7fff8, 0x7fffb, 0x7fff9, 0x3ffe4, 0x7fffa, 0x3ffe3, 0x1ffef, 0x1fff0, - 0x0fff5, 0x1ffee, 0x0fff2, 0x0fff3, 0x0fff4, 0x0fff1, 0x07ff6, 0x07ff7, - 0x03ff9, 0x03ff5, 0x03ff7, 0x03ff3, 0x03ff6, 0x03ff2, 0x01ff7, 0x01ff5, - 0x00ff9, 0x00ff7, 0x00ff6, 0x007f9, 0x00ff4, 0x007f8, 0x003f9, 0x003f7, - 0x003f5, 0x001f8, 0x001f7, 0x000fa, 0x000f8, 0x000f6, 0x00079, 0x0003a, - 0x00038, 0x0001a, 0x0000b, 0x00004, 0x00000, 0x0000a, 0x0000c, 0x0001b, - 0x00039, 0x0003b, 0x00078, 0x0007a, 0x000f7, 0x000f9, 0x001f6, 0x001f9, - 0x003f4, 0x003f6, 0x003f8, 0x007f5, 0x007f4, 0x007f6, 0x007f7, 0x00ff5, - 0x00ff8, 0x01ff4, 0x01ff6, 0x01ff8, 0x03ff8, 0x03ff4, 0x0fff0, 0x07ff4, - 0x0fff6, 0x07ff5, 0x3ffe2, 0x7ffd9, 0x7ffda, 0x7ffdb, 0x7ffdc, 0x7ffdd, - 0x7ffde, 0x7ffd8, 0x7ffd2, 0x7ffd3, 0x7ffd4, 0x7ffd5, 0x7ffd6, 0x7fff2, - 0x7ffdf, 0x7ffe7, 0x7ffe8, 0x7ffe9, 0x7ffea, 0x7ffeb, 0x7ffe6, 0x7ffe0, - 0x7ffe1, 0x7ffe2, 0x7ffe3, 0x7ffe4, 0x7ffe5, 0x7ffd7, 0x7ffec, 0x7fff4, - 0x7fff3, -}; - -const uint8_t ff_aac_scalefactor_bits[121] = { - 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 18, 19, 18, 17, 17, 16, 17, 16, 16, 16, 16, 15, 15, - 14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11, 12, 11, 10, 10, - 10, 9, 9, 8, 8, 8, 7, 6, 6, 5, 4, 3, 1, 4, 4, 5, - 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 11, 12, - 12, 13, 13, 13, 14, 14, 16, 15, 16, 15, 18, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, 19, -}; - -static const uint16_t codes1[81] = { - 0x7f8, 0x1f1, 0x7fd, 0x3f5, 0x068, 0x3f0, 0x7f7, 0x1ec, - 0x7f5, 0x3f1, 0x072, 0x3f4, 0x074, 0x011, 0x076, 0x1eb, - 0x06c, 0x3f6, 0x7fc, 0x1e1, 0x7f1, 0x1f0, 0x061, 0x1f6, - 0x7f2, 0x1ea, 0x7fb, 0x1f2, 0x069, 0x1ed, 0x077, 0x017, - 0x06f, 0x1e6, 0x064, 0x1e5, 0x067, 0x015, 0x062, 0x012, - 0x000, 0x014, 0x065, 0x016, 0x06d, 0x1e9, 0x063, 0x1e4, - 0x06b, 0x013, 0x071, 0x1e3, 0x070, 0x1f3, 0x7fe, 0x1e7, - 0x7f3, 0x1ef, 0x060, 0x1ee, 0x7f0, 0x1e2, 0x7fa, 0x3f3, - 0x06a, 0x1e8, 0x075, 0x010, 0x073, 0x1f4, 0x06e, 0x3f7, - 0x7f6, 0x1e0, 0x7f9, 0x3f2, 0x066, 0x1f5, 0x7ff, 0x1f7, - 0x7f4, -}; - -static const uint8_t bits1[81] = { - 11, 9, 11, 10, 7, 10, 11, 9, 11, 10, 7, 10, 7, 5, 7, 9, - 7, 10, 11, 9, 11, 9, 7, 9, 11, 9, 11, 9, 7, 9, 7, 5, - 7, 9, 7, 9, 7, 5, 7, 5, 1, 5, 7, 5, 7, 9, 7, 9, - 7, 5, 7, 9, 7, 9, 11, 9, 11, 9, 7, 9, 11, 9, 11, 10, - 7, 9, 7, 5, 7, 9, 7, 10, 11, 9, 11, 10, 7, 9, 11, 9, - 11, -}; - -static const uint16_t codes2[81] = { - 0x1f3, 0x06f, 0x1fd, 0x0eb, 0x023, 0x0ea, 0x1f7, 0x0e8, - 0x1fa, 0x0f2, 0x02d, 0x070, 0x020, 0x006, 0x02b, 0x06e, - 0x028, 0x0e9, 0x1f9, 0x066, 0x0f8, 0x0e7, 0x01b, 0x0f1, - 0x1f4, 0x06b, 0x1f5, 0x0ec, 0x02a, 0x06c, 0x02c, 0x00a, - 0x027, 0x067, 0x01a, 0x0f5, 0x024, 0x008, 0x01f, 0x009, - 0x000, 0x007, 0x01d, 0x00b, 0x030, 0x0ef, 0x01c, 0x064, - 0x01e, 0x00c, 0x029, 0x0f3, 0x02f, 0x0f0, 0x1fc, 0x071, - 0x1f2, 0x0f4, 0x021, 0x0e6, 0x0f7, 0x068, 0x1f8, 0x0ee, - 0x022, 0x065, 0x031, 0x002, 0x026, 0x0ed, 0x025, 0x06a, - 0x1fb, 0x072, 0x1fe, 0x069, 0x02e, 0x0f6, 0x1ff, 0x06d, - 0x1f6, -}; - -static const uint8_t bits2[81] = { - 9, 7, 9, 8, 6, 8, 9, 8, 9, 8, 6, 7, 6, 5, 6, 7, - 6, 8, 9, 7, 8, 8, 6, 8, 9, 7, 9, 8, 6, 7, 6, 5, - 6, 7, 6, 8, 6, 5, 6, 5, 3, 5, 6, 5, 6, 8, 6, 7, - 6, 5, 6, 8, 6, 8, 9, 7, 9, 8, 6, 8, 8, 7, 9, 8, - 6, 7, 6, 4, 6, 8, 6, 7, 9, 7, 9, 7, 6, 8, 9, 7, - 9, -}; - -static const uint16_t codes3[81] = { - 0x0000, 0x0009, 0x00ef, 0x000b, 0x0019, 0x00f0, 0x01eb, 0x01e6, - 0x03f2, 0x000a, 0x0035, 0x01ef, 0x0034, 0x0037, 0x01e9, 0x01ed, - 0x01e7, 0x03f3, 0x01ee, 0x03ed, 0x1ffa, 0x01ec, 0x01f2, 0x07f9, - 0x07f8, 0x03f8, 0x0ff8, 0x0008, 0x0038, 0x03f6, 0x0036, 0x0075, - 0x03f1, 0x03eb, 0x03ec, 0x0ff4, 0x0018, 0x0076, 0x07f4, 0x0039, - 0x0074, 0x03ef, 0x01f3, 0x01f4, 0x07f6, 0x01e8, 0x03ea, 0x1ffc, - 0x00f2, 0x01f1, 0x0ffb, 0x03f5, 0x07f3, 0x0ffc, 0x00ee, 0x03f7, - 0x7ffe, 0x01f0, 0x07f5, 0x7ffd, 0x1ffb, 0x3ffa, 0xffff, 0x00f1, - 0x03f0, 0x3ffc, 0x01ea, 0x03ee, 0x3ffb, 0x0ff6, 0x0ffa, 0x7ffc, - 0x07f2, 0x0ff5, 0xfffe, 0x03f4, 0x07f7, 0x7ffb, 0x0ff7, 0x0ff9, - 0x7ffa, -}; - -static const uint8_t bits3[81] = { - 1, 4, 8, 4, 5, 8, 9, 9, 10, 4, 6, 9, 6, 6, 9, 9, - 9, 10, 9, 10, 13, 9, 9, 11, 11, 10, 12, 4, 6, 10, 6, 7, - 10, 10, 10, 12, 5, 7, 11, 6, 7, 10, 9, 9, 11, 9, 10, 13, - 8, 9, 12, 10, 11, 12, 8, 10, 15, 9, 11, 15, 13, 14, 16, 8, - 10, 14, 9, 10, 14, 12, 12, 15, 11, 12, 16, 10, 11, 15, 12, 12, - 15, -}; - -static const uint16_t codes4[81] = { - 0x007, 0x016, 0x0f6, 0x018, 0x008, 0x0ef, 0x1ef, 0x0f3, - 0x7f8, 0x019, 0x017, 0x0ed, 0x015, 0x001, 0x0e2, 0x0f0, - 0x070, 0x3f0, 0x1ee, 0x0f1, 0x7fa, 0x0ee, 0x0e4, 0x3f2, - 0x7f6, 0x3ef, 0x7fd, 0x005, 0x014, 0x0f2, 0x009, 0x004, - 0x0e5, 0x0f4, 0x0e8, 0x3f4, 0x006, 0x002, 0x0e7, 0x003, - 0x000, 0x06b, 0x0e3, 0x069, 0x1f3, 0x0eb, 0x0e6, 0x3f6, - 0x06e, 0x06a, 0x1f4, 0x3ec, 0x1f0, 0x3f9, 0x0f5, 0x0ec, - 0x7fb, 0x0ea, 0x06f, 0x3f7, 0x7f9, 0x3f3, 0xfff, 0x0e9, - 0x06d, 0x3f8, 0x06c, 0x068, 0x1f5, 0x3ee, 0x1f2, 0x7f4, - 0x7f7, 0x3f1, 0xffe, 0x3ed, 0x1f1, 0x7f5, 0x7fe, 0x3f5, - 0x7fc, -}; - -static const uint8_t bits4[81] = { - 4, 5, 8, 5, 4, 8, 9, 8, 11, 5, 5, 8, 5, 4, 8, 8, - 7, 10, 9, 8, 11, 8, 8, 10, 11, 10, 11, 4, 5, 8, 4, 4, - 8, 8, 8, 10, 4, 4, 8, 4, 4, 7, 8, 7, 9, 8, 8, 10, - 7, 7, 9, 10, 9, 10, 8, 8, 11, 8, 7, 10, 11, 10, 12, 8, - 7, 10, 7, 7, 9, 10, 9, 11, 11, 10, 12, 10, 9, 11, 11, 10, - 11, -}; - -static const uint16_t codes5[81] = { - 0x1fff, 0x0ff7, 0x07f4, 0x07e8, 0x03f1, 0x07ee, 0x07f9, 0x0ff8, - 0x1ffd, 0x0ffd, 0x07f1, 0x03e8, 0x01e8, 0x00f0, 0x01ec, 0x03ee, - 0x07f2, 0x0ffa, 0x0ff4, 0x03ef, 0x01f2, 0x00e8, 0x0070, 0x00ec, - 0x01f0, 0x03ea, 0x07f3, 0x07eb, 0x01eb, 0x00ea, 0x001a, 0x0008, - 0x0019, 0x00ee, 0x01ef, 0x07ed, 0x03f0, 0x00f2, 0x0073, 0x000b, - 0x0000, 0x000a, 0x0071, 0x00f3, 0x07e9, 0x07ef, 0x01ee, 0x00ef, - 0x0018, 0x0009, 0x001b, 0x00eb, 0x01e9, 0x07ec, 0x07f6, 0x03eb, - 0x01f3, 0x00ed, 0x0072, 0x00e9, 0x01f1, 0x03ed, 0x07f7, 0x0ff6, - 0x07f0, 0x03e9, 0x01ed, 0x00f1, 0x01ea, 0x03ec, 0x07f8, 0x0ff9, - 0x1ffc, 0x0ffc, 0x0ff5, 0x07ea, 0x03f3, 0x03f2, 0x07f5, 0x0ffb, - 0x1ffe, -}; - -static const uint8_t bits5[81] = { - 13, 12, 11, 11, 10, 11, 11, 12, 13, 12, 11, 10, 9, 8, 9, 10, - 11, 12, 12, 10, 9, 8, 7, 8, 9, 10, 11, 11, 9, 8, 5, 4, - 5, 8, 9, 11, 10, 8, 7, 4, 1, 4, 7, 8, 11, 11, 9, 8, - 5, 4, 5, 8, 9, 11, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, - 11, 10, 9, 8, 9, 10, 11, 12, 13, 12, 12, 11, 10, 10, 11, 12, - 13, -}; - -static const uint16_t codes6[81] = { - 0x7fe, 0x3fd, 0x1f1, 0x1eb, 0x1f4, 0x1ea, 0x1f0, 0x3fc, - 0x7fd, 0x3f6, 0x1e5, 0x0ea, 0x06c, 0x071, 0x068, 0x0f0, - 0x1e6, 0x3f7, 0x1f3, 0x0ef, 0x032, 0x027, 0x028, 0x026, - 0x031, 0x0eb, 0x1f7, 0x1e8, 0x06f, 0x02e, 0x008, 0x004, - 0x006, 0x029, 0x06b, 0x1ee, 0x1ef, 0x072, 0x02d, 0x002, - 0x000, 0x003, 0x02f, 0x073, 0x1fa, 0x1e7, 0x06e, 0x02b, - 0x007, 0x001, 0x005, 0x02c, 0x06d, 0x1ec, 0x1f9, 0x0ee, - 0x030, 0x024, 0x02a, 0x025, 0x033, 0x0ec, 0x1f2, 0x3f8, - 0x1e4, 0x0ed, 0x06a, 0x070, 0x069, 0x074, 0x0f1, 0x3fa, - 0x7ff, 0x3f9, 0x1f6, 0x1ed, 0x1f8, 0x1e9, 0x1f5, 0x3fb, - 0x7fc, -}; - -static const uint8_t bits6[81] = { - 11, 10, 9, 9, 9, 9, 9, 10, 11, 10, 9, 8, 7, 7, 7, 8, - 9, 10, 9, 8, 6, 6, 6, 6, 6, 8, 9, 9, 7, 6, 4, 4, - 4, 6, 7, 9, 9, 7, 6, 4, 4, 4, 6, 7, 9, 9, 7, 6, - 4, 4, 4, 6, 7, 9, 9, 8, 6, 6, 6, 6, 6, 8, 9, 10, - 9, 8, 7, 7, 7, 7, 8, 10, 11, 10, 9, 9, 9, 9, 9, 10, - 11, -}; - -static const uint16_t codes7[64] = { - 0x000, 0x005, 0x037, 0x074, 0x0f2, 0x1eb, 0x3ed, 0x7f7, - 0x004, 0x00c, 0x035, 0x071, 0x0ec, 0x0ee, 0x1ee, 0x1f5, - 0x036, 0x034, 0x072, 0x0ea, 0x0f1, 0x1e9, 0x1f3, 0x3f5, - 0x073, 0x070, 0x0eb, 0x0f0, 0x1f1, 0x1f0, 0x3ec, 0x3fa, - 0x0f3, 0x0ed, 0x1e8, 0x1ef, 0x3ef, 0x3f1, 0x3f9, 0x7fb, - 0x1ed, 0x0ef, 0x1ea, 0x1f2, 0x3f3, 0x3f8, 0x7f9, 0x7fc, - 0x3ee, 0x1ec, 0x1f4, 0x3f4, 0x3f7, 0x7f8, 0xffd, 0xffe, - 0x7f6, 0x3f0, 0x3f2, 0x3f6, 0x7fa, 0x7fd, 0xffc, 0xfff, -}; - -static const uint8_t bits7[64] = { - 1, 3, 6, 7, 8, 9, 10, 11, 3, 4, 6, 7, 8, 8, 9, 9, - 6, 6, 7, 8, 8, 9, 9, 10, 7, 7, 8, 8, 9, 9, 10, 10, - 8, 8, 9, 9, 10, 10, 10, 11, 9, 8, 9, 9, 10, 10, 11, 11, - 10, 9, 9, 10, 10, 11, 12, 12, 11, 10, 10, 10, 11, 11, 12, 12, -}; - -static const uint16_t codes8[64] = { - 0x00e, 0x005, 0x010, 0x030, 0x06f, 0x0f1, 0x1fa, 0x3fe, - 0x003, 0x000, 0x004, 0x012, 0x02c, 0x06a, 0x075, 0x0f8, - 0x00f, 0x002, 0x006, 0x014, 0x02e, 0x069, 0x072, 0x0f5, - 0x02f, 0x011, 0x013, 0x02a, 0x032, 0x06c, 0x0ec, 0x0fa, - 0x071, 0x02b, 0x02d, 0x031, 0x06d, 0x070, 0x0f2, 0x1f9, - 0x0ef, 0x068, 0x033, 0x06b, 0x06e, 0x0ee, 0x0f9, 0x3fc, - 0x1f8, 0x074, 0x073, 0x0ed, 0x0f0, 0x0f6, 0x1f6, 0x1fd, - 0x3fd, 0x0f3, 0x0f4, 0x0f7, 0x1f7, 0x1fb, 0x1fc, 0x3ff, -}; - -static const uint8_t bits8[64] = { - 5, 4, 5, 6, 7, 8, 9, 10, 4, 3, 4, 5, 6, 7, 7, 8, - 5, 4, 4, 5, 6, 7, 7, 8, 6, 5, 5, 6, 6, 7, 8, 8, - 7, 6, 6, 6, 7, 7, 8, 9, 8, 7, 6, 7, 7, 8, 8, 10, - 9, 7, 7, 8, 8, 8, 9, 9, 10, 8, 8, 8, 9, 9, 9, 10, -}; - -static const uint16_t codes9[169] = { - 0x0000, 0x0005, 0x0037, 0x00e7, 0x01de, 0x03ce, 0x03d9, 0x07c8, - 0x07cd, 0x0fc8, 0x0fdd, 0x1fe4, 0x1fec, 0x0004, 0x000c, 0x0035, - 0x0072, 0x00ea, 0x00ed, 0x01e2, 0x03d1, 0x03d3, 0x03e0, 0x07d8, - 0x0fcf, 0x0fd5, 0x0036, 0x0034, 0x0071, 0x00e8, 0x00ec, 0x01e1, - 0x03cf, 0x03dd, 0x03db, 0x07d0, 0x0fc7, 0x0fd4, 0x0fe4, 0x00e6, - 0x0070, 0x00e9, 0x01dd, 0x01e3, 0x03d2, 0x03dc, 0x07cc, 0x07ca, - 0x07de, 0x0fd8, 0x0fea, 0x1fdb, 0x01df, 0x00eb, 0x01dc, 0x01e6, - 0x03d5, 0x03de, 0x07cb, 0x07dd, 0x07dc, 0x0fcd, 0x0fe2, 0x0fe7, - 0x1fe1, 0x03d0, 0x01e0, 0x01e4, 0x03d6, 0x07c5, 0x07d1, 0x07db, - 0x0fd2, 0x07e0, 0x0fd9, 0x0feb, 0x1fe3, 0x1fe9, 0x07c4, 0x01e5, - 0x03d7, 0x07c6, 0x07cf, 0x07da, 0x0fcb, 0x0fda, 0x0fe3, 0x0fe9, - 0x1fe6, 0x1ff3, 0x1ff7, 0x07d3, 0x03d8, 0x03e1, 0x07d4, 0x07d9, - 0x0fd3, 0x0fde, 0x1fdd, 0x1fd9, 0x1fe2, 0x1fea, 0x1ff1, 0x1ff6, - 0x07d2, 0x03d4, 0x03da, 0x07c7, 0x07d7, 0x07e2, 0x0fce, 0x0fdb, - 0x1fd8, 0x1fee, 0x3ff0, 0x1ff4, 0x3ff2, 0x07e1, 0x03df, 0x07c9, - 0x07d6, 0x0fca, 0x0fd0, 0x0fe5, 0x0fe6, 0x1feb, 0x1fef, 0x3ff3, - 0x3ff4, 0x3ff5, 0x0fe0, 0x07ce, 0x07d5, 0x0fc6, 0x0fd1, 0x0fe1, - 0x1fe0, 0x1fe8, 0x1ff0, 0x3ff1, 0x3ff8, 0x3ff6, 0x7ffc, 0x0fe8, - 0x07df, 0x0fc9, 0x0fd7, 0x0fdc, 0x1fdc, 0x1fdf, 0x1fed, 0x1ff5, - 0x3ff9, 0x3ffb, 0x7ffd, 0x7ffe, 0x1fe7, 0x0fcc, 0x0fd6, 0x0fdf, - 0x1fde, 0x1fda, 0x1fe5, 0x1ff2, 0x3ffa, 0x3ff7, 0x3ffc, 0x3ffd, - 0x7fff, -}; - -static const uint8_t bits9[169] = { - 1, 3, 6, 8, 9, 10, 10, 11, 11, 12, 12, 13, 13, 3, 4, 6, - 7, 8, 8, 9, 10, 10, 10, 11, 12, 12, 6, 6, 7, 8, 8, 9, - 10, 10, 10, 11, 12, 12, 12, 8, 7, 8, 9, 9, 10, 10, 11, 11, - 11, 12, 12, 13, 9, 8, 9, 9, 10, 10, 11, 11, 11, 12, 12, 12, - 13, 10, 9, 9, 10, 11, 11, 11, 12, 11, 12, 12, 13, 13, 11, 9, - 10, 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, 11, 10, 10, 11, 11, - 12, 12, 13, 13, 13, 13, 13, 13, 11, 10, 10, 11, 11, 11, 12, 12, - 13, 13, 14, 13, 14, 11, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, - 14, 14, 12, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, 15, 12, - 11, 12, 12, 12, 13, 13, 13, 13, 14, 14, 15, 15, 13, 12, 12, 12, - 13, 13, 13, 13, 14, 14, 14, 14, 15, -}; - -static const uint16_t codes10[169] = { - 0x022, 0x008, 0x01d, 0x026, 0x05f, 0x0d3, 0x1cf, 0x3d0, - 0x3d7, 0x3ed, 0x7f0, 0x7f6, 0xffd, 0x007, 0x000, 0x001, - 0x009, 0x020, 0x054, 0x060, 0x0d5, 0x0dc, 0x1d4, 0x3cd, - 0x3de, 0x7e7, 0x01c, 0x002, 0x006, 0x00c, 0x01e, 0x028, - 0x05b, 0x0cd, 0x0d9, 0x1ce, 0x1dc, 0x3d9, 0x3f1, 0x025, - 0x00b, 0x00a, 0x00d, 0x024, 0x057, 0x061, 0x0cc, 0x0dd, - 0x1cc, 0x1de, 0x3d3, 0x3e7, 0x05d, 0x021, 0x01f, 0x023, - 0x027, 0x059, 0x064, 0x0d8, 0x0df, 0x1d2, 0x1e2, 0x3dd, - 0x3ee, 0x0d1, 0x055, 0x029, 0x056, 0x058, 0x062, 0x0ce, - 0x0e0, 0x0e2, 0x1da, 0x3d4, 0x3e3, 0x7eb, 0x1c9, 0x05e, - 0x05a, 0x05c, 0x063, 0x0ca, 0x0da, 0x1c7, 0x1ca, 0x1e0, - 0x3db, 0x3e8, 0x7ec, 0x1e3, 0x0d2, 0x0cb, 0x0d0, 0x0d7, - 0x0db, 0x1c6, 0x1d5, 0x1d8, 0x3ca, 0x3da, 0x7ea, 0x7f1, - 0x1e1, 0x0d4, 0x0cf, 0x0d6, 0x0de, 0x0e1, 0x1d0, 0x1d6, - 0x3d1, 0x3d5, 0x3f2, 0x7ee, 0x7fb, 0x3e9, 0x1cd, 0x1c8, - 0x1cb, 0x1d1, 0x1d7, 0x1df, 0x3cf, 0x3e0, 0x3ef, 0x7e6, - 0x7f8, 0xffa, 0x3eb, 0x1dd, 0x1d3, 0x1d9, 0x1db, 0x3d2, - 0x3cc, 0x3dc, 0x3ea, 0x7ed, 0x7f3, 0x7f9, 0xff9, 0x7f2, - 0x3ce, 0x1e4, 0x3cb, 0x3d8, 0x3d6, 0x3e2, 0x3e5, 0x7e8, - 0x7f4, 0x7f5, 0x7f7, 0xffb, 0x7fa, 0x3ec, 0x3df, 0x3e1, - 0x3e4, 0x3e6, 0x3f0, 0x7e9, 0x7ef, 0xff8, 0xffe, 0xffc, - 0xfff, -}; - -static const uint8_t bits10[169] = { - 6, 5, 6, 6, 7, 8, 9, 10, 10, 10, 11, 11, 12, 5, 4, 4, - 5, 6, 7, 7, 8, 8, 9, 10, 10, 11, 6, 4, 5, 5, 6, 6, - 7, 8, 8, 9, 9, 10, 10, 6, 5, 5, 5, 6, 7, 7, 8, 8, - 9, 9, 10, 10, 7, 6, 6, 6, 6, 7, 7, 8, 8, 9, 9, 10, - 10, 8, 7, 6, 7, 7, 7, 8, 8, 8, 9, 10, 10, 11, 9, 7, - 7, 7, 7, 8, 8, 9, 9, 9, 10, 10, 11, 9, 8, 8, 8, 8, - 8, 9, 9, 9, 10, 10, 11, 11, 9, 8, 8, 8, 8, 8, 9, 9, - 10, 10, 10, 11, 11, 10, 9, 9, 9, 9, 9, 9, 10, 10, 10, 11, - 11, 12, 10, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 12, 11, - 10, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 12, 11, 10, 10, 10, - 10, 10, 10, 11, 11, 12, 12, 12, 12, -}; - -static const uint16_t codes11[289] = { - 0x000, 0x006, 0x019, 0x03d, 0x09c, 0x0c6, 0x1a7, 0x390, - 0x3c2, 0x3df, 0x7e6, 0x7f3, 0xffb, 0x7ec, 0xffa, 0xffe, - 0x38e, 0x005, 0x001, 0x008, 0x014, 0x037, 0x042, 0x092, - 0x0af, 0x191, 0x1a5, 0x1b5, 0x39e, 0x3c0, 0x3a2, 0x3cd, - 0x7d6, 0x0ae, 0x017, 0x007, 0x009, 0x018, 0x039, 0x040, - 0x08e, 0x0a3, 0x0b8, 0x199, 0x1ac, 0x1c1, 0x3b1, 0x396, - 0x3be, 0x3ca, 0x09d, 0x03c, 0x015, 0x016, 0x01a, 0x03b, - 0x044, 0x091, 0x0a5, 0x0be, 0x196, 0x1ae, 0x1b9, 0x3a1, - 0x391, 0x3a5, 0x3d5, 0x094, 0x09a, 0x036, 0x038, 0x03a, - 0x041, 0x08c, 0x09b, 0x0b0, 0x0c3, 0x19e, 0x1ab, 0x1bc, - 0x39f, 0x38f, 0x3a9, 0x3cf, 0x093, 0x0bf, 0x03e, 0x03f, - 0x043, 0x045, 0x09e, 0x0a7, 0x0b9, 0x194, 0x1a2, 0x1ba, - 0x1c3, 0x3a6, 0x3a7, 0x3bb, 0x3d4, 0x09f, 0x1a0, 0x08f, - 0x08d, 0x090, 0x098, 0x0a6, 0x0b6, 0x0c4, 0x19f, 0x1af, - 0x1bf, 0x399, 0x3bf, 0x3b4, 0x3c9, 0x3e7, 0x0a8, 0x1b6, - 0x0ab, 0x0a4, 0x0aa, 0x0b2, 0x0c2, 0x0c5, 0x198, 0x1a4, - 0x1b8, 0x38c, 0x3a4, 0x3c4, 0x3c6, 0x3dd, 0x3e8, 0x0ad, - 0x3af, 0x192, 0x0bd, 0x0bc, 0x18e, 0x197, 0x19a, 0x1a3, - 0x1b1, 0x38d, 0x398, 0x3b7, 0x3d3, 0x3d1, 0x3db, 0x7dd, - 0x0b4, 0x3de, 0x1a9, 0x19b, 0x19c, 0x1a1, 0x1aa, 0x1ad, - 0x1b3, 0x38b, 0x3b2, 0x3b8, 0x3ce, 0x3e1, 0x3e0, 0x7d2, - 0x7e5, 0x0b7, 0x7e3, 0x1bb, 0x1a8, 0x1a6, 0x1b0, 0x1b2, - 0x1b7, 0x39b, 0x39a, 0x3ba, 0x3b5, 0x3d6, 0x7d7, 0x3e4, - 0x7d8, 0x7ea, 0x0ba, 0x7e8, 0x3a0, 0x1bd, 0x1b4, 0x38a, - 0x1c4, 0x392, 0x3aa, 0x3b0, 0x3bc, 0x3d7, 0x7d4, 0x7dc, - 0x7db, 0x7d5, 0x7f0, 0x0c1, 0x7fb, 0x3c8, 0x3a3, 0x395, - 0x39d, 0x3ac, 0x3ae, 0x3c5, 0x3d8, 0x3e2, 0x3e6, 0x7e4, - 0x7e7, 0x7e0, 0x7e9, 0x7f7, 0x190, 0x7f2, 0x393, 0x1be, - 0x1c0, 0x394, 0x397, 0x3ad, 0x3c3, 0x3c1, 0x3d2, 0x7da, - 0x7d9, 0x7df, 0x7eb, 0x7f4, 0x7fa, 0x195, 0x7f8, 0x3bd, - 0x39c, 0x3ab, 0x3a8, 0x3b3, 0x3b9, 0x3d0, 0x3e3, 0x3e5, - 0x7e2, 0x7de, 0x7ed, 0x7f1, 0x7f9, 0x7fc, 0x193, 0xffd, - 0x3dc, 0x3b6, 0x3c7, 0x3cc, 0x3cb, 0x3d9, 0x3da, 0x7d3, - 0x7e1, 0x7ee, 0x7ef, 0x7f5, 0x7f6, 0xffc, 0xfff, 0x19d, - 0x1c2, 0x0b5, 0x0a1, 0x096, 0x097, 0x095, 0x099, 0x0a0, - 0x0a2, 0x0ac, 0x0a9, 0x0b1, 0x0b3, 0x0bb, 0x0c0, 0x18f, - 0x004, -}; - -static const uint8_t bits11[289] = { - 4, 5, 6, 7, 8, 8, 9, 10, 10, 10, 11, 11, 12, 11, 12, 12, - 10, 5, 4, 5, 6, 7, 7, 8, 8, 9, 9, 9, 10, 10, 10, 10, - 11, 8, 6, 5, 5, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10, - 10, 10, 8, 7, 6, 6, 6, 7, 7, 8, 8, 8, 9, 9, 9, 10, - 10, 10, 10, 8, 8, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, - 10, 10, 10, 10, 8, 8, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, - 9, 10, 10, 10, 10, 8, 9, 8, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 10, 10, 10, 10, 10, 8, 9, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 10, 10, 10, 10, 10, 10, 8, 10, 9, 8, 8, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 10, 11, 8, 10, 9, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 10, 11, 11, 8, 11, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 11, 10, 11, 11, 8, 11, 10, 9, 9, 10, - 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 8, 11, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 9, 11, 10, 9, - 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 9, 11, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 9, 12, - 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 9, - 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, - 5, -}; - -const uint16_t * const ff_aac_spectral_codes[11] = { - codes1, codes2, codes3, codes4, codes5, codes6, codes7, codes8, - codes9, codes10, codes11, -}; - -const uint8_t * const ff_aac_spectral_bits[11] = { - bits1, bits2, bits3, bits4, bits5, bits6, bits7, bits8, - bits9, bits10, bits11, -}; - -const uint16_t ff_aac_spectral_sizes[11] = { - 81, 81, 81, 81, 81, 81, 64, 64, 169, 169, 289, -}; - -/* NOTE: - * 64.0f is a special value indicating the existence of an escape code in the - * bitstream. - */ -static const DECLARE_ALIGNED(16, float, codebook_vector0)[324] = { - -1.0000000, -1.0000000, -1.0000000, -1.0000000, - -1.0000000, -1.0000000, -1.0000000, 0.0000000, - -1.0000000, -1.0000000, -1.0000000, 1.0000000, - -1.0000000, -1.0000000, 0.0000000, -1.0000000, - -1.0000000, -1.0000000, 0.0000000, 0.0000000, - -1.0000000, -1.0000000, 0.0000000, 1.0000000, - -1.0000000, -1.0000000, 1.0000000, -1.0000000, - -1.0000000, -1.0000000, 1.0000000, 0.0000000, - -1.0000000, -1.0000000, 1.0000000, 1.0000000, - -1.0000000, 0.0000000, -1.0000000, -1.0000000, - -1.0000000, 0.0000000, -1.0000000, 0.0000000, - -1.0000000, 0.0000000, -1.0000000, 1.0000000, - -1.0000000, 0.0000000, 0.0000000, -1.0000000, - -1.0000000, 0.0000000, 0.0000000, 0.0000000, - -1.0000000, 0.0000000, 0.0000000, 1.0000000, - -1.0000000, 0.0000000, 1.0000000, -1.0000000, - -1.0000000, 0.0000000, 1.0000000, 0.0000000, - -1.0000000, 0.0000000, 1.0000000, 1.0000000, - -1.0000000, 1.0000000, -1.0000000, -1.0000000, - -1.0000000, 1.0000000, -1.0000000, 0.0000000, - -1.0000000, 1.0000000, -1.0000000, 1.0000000, - -1.0000000, 1.0000000, 0.0000000, -1.0000000, - -1.0000000, 1.0000000, 0.0000000, 0.0000000, - -1.0000000, 1.0000000, 0.0000000, 1.0000000, - -1.0000000, 1.0000000, 1.0000000, -1.0000000, - -1.0000000, 1.0000000, 1.0000000, 0.0000000, - -1.0000000, 1.0000000, 1.0000000, 1.0000000, - 0.0000000, -1.0000000, -1.0000000, -1.0000000, - 0.0000000, -1.0000000, -1.0000000, 0.0000000, - 0.0000000, -1.0000000, -1.0000000, 1.0000000, - 0.0000000, -1.0000000, 0.0000000, -1.0000000, - 0.0000000, -1.0000000, 0.0000000, 0.0000000, - 0.0000000, -1.0000000, 0.0000000, 1.0000000, - 0.0000000, -1.0000000, 1.0000000, -1.0000000, - 0.0000000, -1.0000000, 1.0000000, 0.0000000, - 0.0000000, -1.0000000, 1.0000000, 1.0000000, - 0.0000000, 0.0000000, -1.0000000, -1.0000000, - 0.0000000, 0.0000000, -1.0000000, 0.0000000, - 0.0000000, 0.0000000, -1.0000000, 1.0000000, - 0.0000000, 0.0000000, 0.0000000, -1.0000000, - 0.0000000, 0.0000000, 0.0000000, 0.0000000, - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 0.0000000, 1.0000000, -1.0000000, - 0.0000000, 0.0000000, 1.0000000, 0.0000000, - 0.0000000, 0.0000000, 1.0000000, 1.0000000, - 0.0000000, 1.0000000, -1.0000000, -1.0000000, - 0.0000000, 1.0000000, -1.0000000, 0.0000000, - 0.0000000, 1.0000000, -1.0000000, 1.0000000, - 0.0000000, 1.0000000, 0.0000000, -1.0000000, - 0.0000000, 1.0000000, 0.0000000, 0.0000000, - 0.0000000, 1.0000000, 0.0000000, 1.0000000, - 0.0000000, 1.0000000, 1.0000000, -1.0000000, - 0.0000000, 1.0000000, 1.0000000, 0.0000000, - 0.0000000, 1.0000000, 1.0000000, 1.0000000, - 1.0000000, -1.0000000, -1.0000000, -1.0000000, - 1.0000000, -1.0000000, -1.0000000, 0.0000000, - 1.0000000, -1.0000000, -1.0000000, 1.0000000, - 1.0000000, -1.0000000, 0.0000000, -1.0000000, - 1.0000000, -1.0000000, 0.0000000, 0.0000000, - 1.0000000, -1.0000000, 0.0000000, 1.0000000, - 1.0000000, -1.0000000, 1.0000000, -1.0000000, - 1.0000000, -1.0000000, 1.0000000, 0.0000000, - 1.0000000, -1.0000000, 1.0000000, 1.0000000, - 1.0000000, 0.0000000, -1.0000000, -1.0000000, - 1.0000000, 0.0000000, -1.0000000, 0.0000000, - 1.0000000, 0.0000000, -1.0000000, 1.0000000, - 1.0000000, 0.0000000, 0.0000000, -1.0000000, - 1.0000000, 0.0000000, 0.0000000, 0.0000000, - 1.0000000, 0.0000000, 0.0000000, 1.0000000, - 1.0000000, 0.0000000, 1.0000000, -1.0000000, - 1.0000000, 0.0000000, 1.0000000, 0.0000000, - 1.0000000, 0.0000000, 1.0000000, 1.0000000, - 1.0000000, 1.0000000, -1.0000000, -1.0000000, - 1.0000000, 1.0000000, -1.0000000, 0.0000000, - 1.0000000, 1.0000000, -1.0000000, 1.0000000, - 1.0000000, 1.0000000, 0.0000000, -1.0000000, - 1.0000000, 1.0000000, 0.0000000, 0.0000000, - 1.0000000, 1.0000000, 0.0000000, 1.0000000, - 1.0000000, 1.0000000, 1.0000000, -1.0000000, - 1.0000000, 1.0000000, 1.0000000, 0.0000000, - 1.0000000, 1.0000000, 1.0000000, 1.0000000, -}; - -static const DECLARE_ALIGNED(16, float, codebook_vector2)[324] = { - 0.0000000, 0.0000000, 0.0000000, 0.0000000, - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 0.0000000, 0.0000000, 2.5198421, - 0.0000000, 0.0000000, 1.0000000, 0.0000000, - 0.0000000, 0.0000000, 1.0000000, 1.0000000, - 0.0000000, 0.0000000, 1.0000000, 2.5198421, - 0.0000000, 0.0000000, 2.5198421, 0.0000000, - 0.0000000, 0.0000000, 2.5198421, 1.0000000, - 0.0000000, 0.0000000, 2.5198421, 2.5198421, - 0.0000000, 1.0000000, 0.0000000, 0.0000000, - 0.0000000, 1.0000000, 0.0000000, 1.0000000, - 0.0000000, 1.0000000, 0.0000000, 2.5198421, - 0.0000000, 1.0000000, 1.0000000, 0.0000000, - 0.0000000, 1.0000000, 1.0000000, 1.0000000, - 0.0000000, 1.0000000, 1.0000000, 2.5198421, - 0.0000000, 1.0000000, 2.5198421, 0.0000000, - 0.0000000, 1.0000000, 2.5198421, 1.0000000, - 0.0000000, 1.0000000, 2.5198421, 2.5198421, - 0.0000000, 2.5198421, 0.0000000, 0.0000000, - 0.0000000, 2.5198421, 0.0000000, 1.0000000, - 0.0000000, 2.5198421, 0.0000000, 2.5198421, - 0.0000000, 2.5198421, 1.0000000, 0.0000000, - 0.0000000, 2.5198421, 1.0000000, 1.0000000, - 0.0000000, 2.5198421, 1.0000000, 2.5198421, - 0.0000000, 2.5198421, 2.5198421, 0.0000000, - 0.0000000, 2.5198421, 2.5198421, 1.0000000, - 0.0000000, 2.5198421, 2.5198421, 2.5198421, - 1.0000000, 0.0000000, 0.0000000, 0.0000000, - 1.0000000, 0.0000000, 0.0000000, 1.0000000, - 1.0000000, 0.0000000, 0.0000000, 2.5198421, - 1.0000000, 0.0000000, 1.0000000, 0.0000000, - 1.0000000, 0.0000000, 1.0000000, 1.0000000, - 1.0000000, 0.0000000, 1.0000000, 2.5198421, - 1.0000000, 0.0000000, 2.5198421, 0.0000000, - 1.0000000, 0.0000000, 2.5198421, 1.0000000, - 1.0000000, 0.0000000, 2.5198421, 2.5198421, - 1.0000000, 1.0000000, 0.0000000, 0.0000000, - 1.0000000, 1.0000000, 0.0000000, 1.0000000, - 1.0000000, 1.0000000, 0.0000000, 2.5198421, - 1.0000000, 1.0000000, 1.0000000, 0.0000000, - 1.0000000, 1.0000000, 1.0000000, 1.0000000, - 1.0000000, 1.0000000, 1.0000000, 2.5198421, - 1.0000000, 1.0000000, 2.5198421, 0.0000000, - 1.0000000, 1.0000000, 2.5198421, 1.0000000, - 1.0000000, 1.0000000, 2.5198421, 2.5198421, - 1.0000000, 2.5198421, 0.0000000, 0.0000000, - 1.0000000, 2.5198421, 0.0000000, 1.0000000, - 1.0000000, 2.5198421, 0.0000000, 2.5198421, - 1.0000000, 2.5198421, 1.0000000, 0.0000000, - 1.0000000, 2.5198421, 1.0000000, 1.0000000, - 1.0000000, 2.5198421, 1.0000000, 2.5198421, - 1.0000000, 2.5198421, 2.5198421, 0.0000000, - 1.0000000, 2.5198421, 2.5198421, 1.0000000, - 1.0000000, 2.5198421, 2.5198421, 2.5198421, - 2.5198421, 0.0000000, 0.0000000, 0.0000000, - 2.5198421, 0.0000000, 0.0000000, 1.0000000, - 2.5198421, 0.0000000, 0.0000000, 2.5198421, - 2.5198421, 0.0000000, 1.0000000, 0.0000000, - 2.5198421, 0.0000000, 1.0000000, 1.0000000, - 2.5198421, 0.0000000, 1.0000000, 2.5198421, - 2.5198421, 0.0000000, 2.5198421, 0.0000000, - 2.5198421, 0.0000000, 2.5198421, 1.0000000, - 2.5198421, 0.0000000, 2.5198421, 2.5198421, - 2.5198421, 1.0000000, 0.0000000, 0.0000000, - 2.5198421, 1.0000000, 0.0000000, 1.0000000, - 2.5198421, 1.0000000, 0.0000000, 2.5198421, - 2.5198421, 1.0000000, 1.0000000, 0.0000000, - 2.5198421, 1.0000000, 1.0000000, 1.0000000, - 2.5198421, 1.0000000, 1.0000000, 2.5198421, - 2.5198421, 1.0000000, 2.5198421, 0.0000000, - 2.5198421, 1.0000000, 2.5198421, 1.0000000, - 2.5198421, 1.0000000, 2.5198421, 2.5198421, - 2.5198421, 2.5198421, 0.0000000, 0.0000000, - 2.5198421, 2.5198421, 0.0000000, 1.0000000, - 2.5198421, 2.5198421, 0.0000000, 2.5198421, - 2.5198421, 2.5198421, 1.0000000, 0.0000000, - 2.5198421, 2.5198421, 1.0000000, 1.0000000, - 2.5198421, 2.5198421, 1.0000000, 2.5198421, - 2.5198421, 2.5198421, 2.5198421, 0.0000000, - 2.5198421, 2.5198421, 2.5198421, 1.0000000, - 2.5198421, 2.5198421, 2.5198421, 2.5198421, -}; - -static const DECLARE_ALIGNED(16, float, codebook_vector4)[162] = { - -6.3496042, -6.3496042, -6.3496042, -4.3267487, - -6.3496042, -2.5198421, -6.3496042, -1.0000000, - -6.3496042, 0.0000000, -6.3496042, 1.0000000, - -6.3496042, 2.5198421, -6.3496042, 4.3267487, - -6.3496042, 6.3496042, -4.3267487, -6.3496042, - -4.3267487, -4.3267487, -4.3267487, -2.5198421, - -4.3267487, -1.0000000, -4.3267487, 0.0000000, - -4.3267487, 1.0000000, -4.3267487, 2.5198421, - -4.3267487, 4.3267487, -4.3267487, 6.3496042, - -2.5198421, -6.3496042, -2.5198421, -4.3267487, - -2.5198421, -2.5198421, -2.5198421, -1.0000000, - -2.5198421, 0.0000000, -2.5198421, 1.0000000, - -2.5198421, 2.5198421, -2.5198421, 4.3267487, - -2.5198421, 6.3496042, -1.0000000, -6.3496042, - -1.0000000, -4.3267487, -1.0000000, -2.5198421, - -1.0000000, -1.0000000, -1.0000000, 0.0000000, - -1.0000000, 1.0000000, -1.0000000, 2.5198421, - -1.0000000, 4.3267487, -1.0000000, 6.3496042, - 0.0000000, -6.3496042, 0.0000000, -4.3267487, - 0.0000000, -2.5198421, 0.0000000, -1.0000000, - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 2.5198421, 0.0000000, 4.3267487, - 0.0000000, 6.3496042, 1.0000000, -6.3496042, - 1.0000000, -4.3267487, 1.0000000, -2.5198421, - 1.0000000, -1.0000000, 1.0000000, 0.0000000, - 1.0000000, 1.0000000, 1.0000000, 2.5198421, - 1.0000000, 4.3267487, 1.0000000, 6.3496042, - 2.5198421, -6.3496042, 2.5198421, -4.3267487, - 2.5198421, -2.5198421, 2.5198421, -1.0000000, - 2.5198421, 0.0000000, 2.5198421, 1.0000000, - 2.5198421, 2.5198421, 2.5198421, 4.3267487, - 2.5198421, 6.3496042, 4.3267487, -6.3496042, - 4.3267487, -4.3267487, 4.3267487, -2.5198421, - 4.3267487, -1.0000000, 4.3267487, 0.0000000, - 4.3267487, 1.0000000, 4.3267487, 2.5198421, - 4.3267487, 4.3267487, 4.3267487, 6.3496042, - 6.3496042, -6.3496042, 6.3496042, -4.3267487, - 6.3496042, -2.5198421, 6.3496042, -1.0000000, - 6.3496042, 0.0000000, 6.3496042, 1.0000000, - 6.3496042, 2.5198421, 6.3496042, 4.3267487, - 6.3496042, 6.3496042, -}; - -static const DECLARE_ALIGNED(16, float, codebook_vector6)[128] = { - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 2.5198421, 0.0000000, 4.3267487, - 0.0000000, 6.3496042, 0.0000000, 8.5498797, - 0.0000000, 10.9027236, 0.0000000, 13.3905183, - 1.0000000, 0.0000000, 1.0000000, 1.0000000, - 1.0000000, 2.5198421, 1.0000000, 4.3267487, - 1.0000000, 6.3496042, 1.0000000, 8.5498797, - 1.0000000, 10.9027236, 1.0000000, 13.3905183, - 2.5198421, 0.0000000, 2.5198421, 1.0000000, - 2.5198421, 2.5198421, 2.5198421, 4.3267487, - 2.5198421, 6.3496042, 2.5198421, 8.5498797, - 2.5198421, 10.9027236, 2.5198421, 13.3905183, - 4.3267487, 0.0000000, 4.3267487, 1.0000000, - 4.3267487, 2.5198421, 4.3267487, 4.3267487, - 4.3267487, 6.3496042, 4.3267487, 8.5498797, - 4.3267487, 10.9027236, 4.3267487, 13.3905183, - 6.3496042, 0.0000000, 6.3496042, 1.0000000, - 6.3496042, 2.5198421, 6.3496042, 4.3267487, - 6.3496042, 6.3496042, 6.3496042, 8.5498797, - 6.3496042, 10.9027236, 6.3496042, 13.3905183, - 8.5498797, 0.0000000, 8.5498797, 1.0000000, - 8.5498797, 2.5198421, 8.5498797, 4.3267487, - 8.5498797, 6.3496042, 8.5498797, 8.5498797, - 8.5498797, 10.9027236, 8.5498797, 13.3905183, - 10.9027236, 0.0000000, 10.9027236, 1.0000000, - 10.9027236, 2.5198421, 10.9027236, 4.3267487, - 10.9027236, 6.3496042, 10.9027236, 8.5498797, - 10.9027236, 10.9027236, 10.9027236, 13.3905183, - 13.3905183, 0.0000000, 13.3905183, 1.0000000, - 13.3905183, 2.5198421, 13.3905183, 4.3267487, - 13.3905183, 6.3496042, 13.3905183, 8.5498797, - 13.3905183, 10.9027236, 13.3905183, 13.3905183, -}; - -static const DECLARE_ALIGNED(16, float, codebook_vector8)[338] = { - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 2.5198421, 0.0000000, 4.3267487, - 0.0000000, 6.3496042, 0.0000000, 8.5498797, - 0.0000000, 10.9027236, 0.0000000, 13.3905183, - 0.0000000, 16.0000000, 0.0000000, 18.7207544, - 0.0000000, 21.5443469, 0.0000000, 24.4637810, - 0.0000000, 27.4731418, 1.0000000, 0.0000000, - 1.0000000, 1.0000000, 1.0000000, 2.5198421, - 1.0000000, 4.3267487, 1.0000000, 6.3496042, - 1.0000000, 8.5498797, 1.0000000, 10.9027236, - 1.0000000, 13.3905183, 1.0000000, 16.0000000, - 1.0000000, 18.7207544, 1.0000000, 21.5443469, - 1.0000000, 24.4637810, 1.0000000, 27.4731418, - 2.5198421, 0.0000000, 2.5198421, 1.0000000, - 2.5198421, 2.5198421, 2.5198421, 4.3267487, - 2.5198421, 6.3496042, 2.5198421, 8.5498797, - 2.5198421, 10.9027236, 2.5198421, 13.3905183, - 2.5198421, 16.0000000, 2.5198421, 18.7207544, - 2.5198421, 21.5443469, 2.5198421, 24.4637810, - 2.5198421, 27.4731418, 4.3267487, 0.0000000, - 4.3267487, 1.0000000, 4.3267487, 2.5198421, - 4.3267487, 4.3267487, 4.3267487, 6.3496042, - 4.3267487, 8.5498797, 4.3267487, 10.9027236, - 4.3267487, 13.3905183, 4.3267487, 16.0000000, - 4.3267487, 18.7207544, 4.3267487, 21.5443469, - 4.3267487, 24.4637810, 4.3267487, 27.4731418, - 6.3496042, 0.0000000, 6.3496042, 1.0000000, - 6.3496042, 2.5198421, 6.3496042, 4.3267487, - 6.3496042, 6.3496042, 6.3496042, 8.5498797, - 6.3496042, 10.9027236, 6.3496042, 13.3905183, - 6.3496042, 16.0000000, 6.3496042, 18.7207544, - 6.3496042, 21.5443469, 6.3496042, 24.4637810, - 6.3496042, 27.4731418, 8.5498797, 0.0000000, - 8.5498797, 1.0000000, 8.5498797, 2.5198421, - 8.5498797, 4.3267487, 8.5498797, 6.3496042, - 8.5498797, 8.5498797, 8.5498797, 10.9027236, - 8.5498797, 13.3905183, 8.5498797, 16.0000000, - 8.5498797, 18.7207544, 8.5498797, 21.5443469, - 8.5498797, 24.4637810, 8.5498797, 27.4731418, - 10.9027236, 0.0000000, 10.9027236, 1.0000000, - 10.9027236, 2.5198421, 10.9027236, 4.3267487, - 10.9027236, 6.3496042, 10.9027236, 8.5498797, - 10.9027236, 10.9027236, 10.9027236, 13.3905183, - 10.9027236, 16.0000000, 10.9027236, 18.7207544, - 10.9027236, 21.5443469, 10.9027236, 24.4637810, - 10.9027236, 27.4731418, 13.3905183, 0.0000000, - 13.3905183, 1.0000000, 13.3905183, 2.5198421, - 13.3905183, 4.3267487, 13.3905183, 6.3496042, - 13.3905183, 8.5498797, 13.3905183, 10.9027236, - 13.3905183, 13.3905183, 13.3905183, 16.0000000, - 13.3905183, 18.7207544, 13.3905183, 21.5443469, - 13.3905183, 24.4637810, 13.3905183, 27.4731418, - 16.0000000, 0.0000000, 16.0000000, 1.0000000, - 16.0000000, 2.5198421, 16.0000000, 4.3267487, - 16.0000000, 6.3496042, 16.0000000, 8.5498797, - 16.0000000, 10.9027236, 16.0000000, 13.3905183, - 16.0000000, 16.0000000, 16.0000000, 18.7207544, - 16.0000000, 21.5443469, 16.0000000, 24.4637810, - 16.0000000, 27.4731418, 18.7207544, 0.0000000, - 18.7207544, 1.0000000, 18.7207544, 2.5198421, - 18.7207544, 4.3267487, 18.7207544, 6.3496042, - 18.7207544, 8.5498797, 18.7207544, 10.9027236, - 18.7207544, 13.3905183, 18.7207544, 16.0000000, - 18.7207544, 18.7207544, 18.7207544, 21.5443469, - 18.7207544, 24.4637810, 18.7207544, 27.4731418, - 21.5443469, 0.0000000, 21.5443469, 1.0000000, - 21.5443469, 2.5198421, 21.5443469, 4.3267487, - 21.5443469, 6.3496042, 21.5443469, 8.5498797, - 21.5443469, 10.9027236, 21.5443469, 13.3905183, - 21.5443469, 16.0000000, 21.5443469, 18.7207544, - 21.5443469, 21.5443469, 21.5443469, 24.4637810, - 21.5443469, 27.4731418, 24.4637810, 0.0000000, - 24.4637810, 1.0000000, 24.4637810, 2.5198421, - 24.4637810, 4.3267487, 24.4637810, 6.3496042, - 24.4637810, 8.5498797, 24.4637810, 10.9027236, - 24.4637810, 13.3905183, 24.4637810, 16.0000000, - 24.4637810, 18.7207544, 24.4637810, 21.5443469, - 24.4637810, 24.4637810, 24.4637810, 27.4731418, - 27.4731418, 0.0000000, 27.4731418, 1.0000000, - 27.4731418, 2.5198421, 27.4731418, 4.3267487, - 27.4731418, 6.3496042, 27.4731418, 8.5498797, - 27.4731418, 10.9027236, 27.4731418, 13.3905183, - 27.4731418, 16.0000000, 27.4731418, 18.7207544, - 27.4731418, 21.5443469, 27.4731418, 24.4637810, - 27.4731418, 27.4731418, -}; - -static const DECLARE_ALIGNED(16, float, codebook_vector10)[578] = { - 0.0000000, 0.0000000, 0.0000000, 1.0000000, - 0.0000000, 2.5198421, 0.0000000, 4.3267487, - 0.0000000, 6.3496042, 0.0000000, 8.5498797, - 0.0000000, 10.9027236, 0.0000000, 13.3905183, - 0.0000000, 16.0000000, 0.0000000, 18.7207544, - 0.0000000, 21.5443469, 0.0000000, 24.4637810, - 0.0000000, 27.4731418, 0.0000000, 30.5673509, - 0.0000000, 33.7419917, 0.0000000, 36.9931811, - 0.0000000, 64.0f, 1.0000000, 0.0000000, - 1.0000000, 1.0000000, 1.0000000, 2.5198421, - 1.0000000, 4.3267487, 1.0000000, 6.3496042, - 1.0000000, 8.5498797, 1.0000000, 10.9027236, - 1.0000000, 13.3905183, 1.0000000, 16.0000000, - 1.0000000, 18.7207544, 1.0000000, 21.5443469, - 1.0000000, 24.4637810, 1.0000000, 27.4731418, - 1.0000000, 30.5673509, 1.0000000, 33.7419917, - 1.0000000, 36.9931811, 1.0000000, 64.0f, - 2.5198421, 0.0000000, 2.5198421, 1.0000000, - 2.5198421, 2.5198421, 2.5198421, 4.3267487, - 2.5198421, 6.3496042, 2.5198421, 8.5498797, - 2.5198421, 10.9027236, 2.5198421, 13.3905183, - 2.5198421, 16.0000000, 2.5198421, 18.7207544, - 2.5198421, 21.5443469, 2.5198421, 24.4637810, - 2.5198421, 27.4731418, 2.5198421, 30.5673509, - 2.5198421, 33.7419917, 2.5198421, 36.9931811, - 2.5198421, 64.0f, 4.3267487, 0.0000000, - 4.3267487, 1.0000000, 4.3267487, 2.5198421, - 4.3267487, 4.3267487, 4.3267487, 6.3496042, - 4.3267487, 8.5498797, 4.3267487, 10.9027236, - 4.3267487, 13.3905183, 4.3267487, 16.0000000, - 4.3267487, 18.7207544, 4.3267487, 21.5443469, - 4.3267487, 24.4637810, 4.3267487, 27.4731418, - 4.3267487, 30.5673509, 4.3267487, 33.7419917, - 4.3267487, 36.9931811, 4.3267487, 64.0f, - 6.3496042, 0.0000000, 6.3496042, 1.0000000, - 6.3496042, 2.5198421, 6.3496042, 4.3267487, - 6.3496042, 6.3496042, 6.3496042, 8.5498797, - 6.3496042, 10.9027236, 6.3496042, 13.3905183, - 6.3496042, 16.0000000, 6.3496042, 18.7207544, - 6.3496042, 21.5443469, 6.3496042, 24.4637810, - 6.3496042, 27.4731418, 6.3496042, 30.5673509, - 6.3496042, 33.7419917, 6.3496042, 36.9931811, - 6.3496042, 64.0f, 8.5498797, 0.0000000, - 8.5498797, 1.0000000, 8.5498797, 2.5198421, - 8.5498797, 4.3267487, 8.5498797, 6.3496042, - 8.5498797, 8.5498797, 8.5498797, 10.9027236, - 8.5498797, 13.3905183, 8.5498797, 16.0000000, - 8.5498797, 18.7207544, 8.5498797, 21.5443469, - 8.5498797, 24.4637810, 8.5498797, 27.4731418, - 8.5498797, 30.5673509, 8.5498797, 33.7419917, - 8.5498797, 36.9931811, 8.5498797, 64.0f, - 10.9027236, 0.0000000, 10.9027236, 1.0000000, - 10.9027236, 2.5198421, 10.9027236, 4.3267487, - 10.9027236, 6.3496042, 10.9027236, 8.5498797, - 10.9027236, 10.9027236, 10.9027236, 13.3905183, - 10.9027236, 16.0000000, 10.9027236, 18.7207544, - 10.9027236, 21.5443469, 10.9027236, 24.4637810, - 10.9027236, 27.4731418, 10.9027236, 30.5673509, - 10.9027236, 33.7419917, 10.9027236, 36.9931811, - 10.9027236, 64.0f, 13.3905183, 0.0000000, - 13.3905183, 1.0000000, 13.3905183, 2.5198421, - 13.3905183, 4.3267487, 13.3905183, 6.3496042, - 13.3905183, 8.5498797, 13.3905183, 10.9027236, - 13.3905183, 13.3905183, 13.3905183, 16.0000000, - 13.3905183, 18.7207544, 13.3905183, 21.5443469, - 13.3905183, 24.4637810, 13.3905183, 27.4731418, - 13.3905183, 30.5673509, 13.3905183, 33.7419917, - 13.3905183, 36.9931811, 13.3905183, 64.0f, - 16.0000000, 0.0000000, 16.0000000, 1.0000000, - 16.0000000, 2.5198421, 16.0000000, 4.3267487, - 16.0000000, 6.3496042, 16.0000000, 8.5498797, - 16.0000000, 10.9027236, 16.0000000, 13.3905183, - 16.0000000, 16.0000000, 16.0000000, 18.7207544, - 16.0000000, 21.5443469, 16.0000000, 24.4637810, - 16.0000000, 27.4731418, 16.0000000, 30.5673509, - 16.0000000, 33.7419917, 16.0000000, 36.9931811, - 16.0000000, 64.0f, 18.7207544, 0.0000000, - 18.7207544, 1.0000000, 18.7207544, 2.5198421, - 18.7207544, 4.3267487, 18.7207544, 6.3496042, - 18.7207544, 8.5498797, 18.7207544, 10.9027236, - 18.7207544, 13.3905183, 18.7207544, 16.0000000, - 18.7207544, 18.7207544, 18.7207544, 21.5443469, - 18.7207544, 24.4637810, 18.7207544, 27.4731418, - 18.7207544, 30.5673509, 18.7207544, 33.7419917, - 18.7207544, 36.9931811, 18.7207544, 64.0f, - 21.5443469, 0.0000000, 21.5443469, 1.0000000, - 21.5443469, 2.5198421, 21.5443469, 4.3267487, - 21.5443469, 6.3496042, 21.5443469, 8.5498797, - 21.5443469, 10.9027236, 21.5443469, 13.3905183, - 21.5443469, 16.0000000, 21.5443469, 18.7207544, - 21.5443469, 21.5443469, 21.5443469, 24.4637810, - 21.5443469, 27.4731418, 21.5443469, 30.5673509, - 21.5443469, 33.7419917, 21.5443469, 36.9931811, - 21.5443469, 64.0f, 24.4637810, 0.0000000, - 24.4637810, 1.0000000, 24.4637810, 2.5198421, - 24.4637810, 4.3267487, 24.4637810, 6.3496042, - 24.4637810, 8.5498797, 24.4637810, 10.9027236, - 24.4637810, 13.3905183, 24.4637810, 16.0000000, - 24.4637810, 18.7207544, 24.4637810, 21.5443469, - 24.4637810, 24.4637810, 24.4637810, 27.4731418, - 24.4637810, 30.5673509, 24.4637810, 33.7419917, - 24.4637810, 36.9931811, 24.4637810, 64.0f, - 27.4731418, 0.0000000, 27.4731418, 1.0000000, - 27.4731418, 2.5198421, 27.4731418, 4.3267487, - 27.4731418, 6.3496042, 27.4731418, 8.5498797, - 27.4731418, 10.9027236, 27.4731418, 13.3905183, - 27.4731418, 16.0000000, 27.4731418, 18.7207544, - 27.4731418, 21.5443469, 27.4731418, 24.4637810, - 27.4731418, 27.4731418, 27.4731418, 30.5673509, - 27.4731418, 33.7419917, 27.4731418, 36.9931811, - 27.4731418, 64.0f, 30.5673509, 0.0000000, - 30.5673509, 1.0000000, 30.5673509, 2.5198421, - 30.5673509, 4.3267487, 30.5673509, 6.3496042, - 30.5673509, 8.5498797, 30.5673509, 10.9027236, - 30.5673509, 13.3905183, 30.5673509, 16.0000000, - 30.5673509, 18.7207544, 30.5673509, 21.5443469, - 30.5673509, 24.4637810, 30.5673509, 27.4731418, - 30.5673509, 30.5673509, 30.5673509, 33.7419917, - 30.5673509, 36.9931811, 30.5673509, 64.0f, - 33.7419917, 0.0000000, 33.7419917, 1.0000000, - 33.7419917, 2.5198421, 33.7419917, 4.3267487, - 33.7419917, 6.3496042, 33.7419917, 8.5498797, - 33.7419917, 10.9027236, 33.7419917, 13.3905183, - 33.7419917, 16.0000000, 33.7419917, 18.7207544, - 33.7419917, 21.5443469, 33.7419917, 24.4637810, - 33.7419917, 27.4731418, 33.7419917, 30.5673509, - 33.7419917, 33.7419917, 33.7419917, 36.9931811, - 33.7419917, 64.0f, 36.9931811, 0.0000000, - 36.9931811, 1.0000000, 36.9931811, 2.5198421, - 36.9931811, 4.3267487, 36.9931811, 6.3496042, - 36.9931811, 8.5498797, 36.9931811, 10.9027236, - 36.9931811, 13.3905183, 36.9931811, 16.0000000, - 36.9931811, 18.7207544, 36.9931811, 21.5443469, - 36.9931811, 24.4637810, 36.9931811, 27.4731418, - 36.9931811, 30.5673509, 36.9931811, 33.7419917, - 36.9931811, 36.9931811, 36.9931811, 64.0f, - 64.0f, 0.0000000, 64.0f, 1.0000000, - 64.0f, 2.5198421, 64.0f, 4.3267487, - 64.0f, 6.3496042, 64.0f, 8.5498797, - 64.0f, 10.9027236, 64.0f, 13.3905183, - 64.0f, 16.0000000, 64.0f, 18.7207544, - 64.0f, 21.5443469, 64.0f, 24.4637810, - 64.0f, 27.4731418, 64.0f, 30.5673509, - 64.0f, 33.7419917, 64.0f, 36.9931811, - 64.0f, 64.0f, -}; - -const float * const ff_aac_codebook_vectors[] = { - codebook_vector0, codebook_vector0, codebook_vector2, - codebook_vector2, codebook_vector4, codebook_vector4, - codebook_vector6, codebook_vector6, codebook_vector8, - codebook_vector8, codebook_vector10, -}; - -static const float codebook_vector0_vals[] = { - -1.0000000, 0.0000000, 1.0000000 -}; - -/* - * bits 0:1, 2:3, 4:5, 6:7 index into _vals array - * 8:11 number of non-zero values - * 12:15 bit mask of non-zero values - */ -static const uint16_t codebook_vector02_idx[] = { - 0x0000, 0x8140, 0x8180, 0x4110, 0xc250, 0xc290, 0x4120, 0xc260, 0xc2a0, - 0x2104, 0xa244, 0xa284, 0x6214, 0xe354, 0xe394, 0x6224, 0xe364, 0xe3a4, - 0x2108, 0xa248, 0xa288, 0x6218, 0xe358, 0xe398, 0x6228, 0xe368, 0xe3a8, - 0x1101, 0x9241, 0x9281, 0x5211, 0xd351, 0xd391, 0x5221, 0xd361, 0xd3a1, - 0x3205, 0xb345, 0xb385, 0x7315, 0xf455, 0xf495, 0x7325, 0xf465, 0xf4a5, - 0x3209, 0xb349, 0xb389, 0x7319, 0xf459, 0xf499, 0x7329, 0xf469, 0xf4a9, - 0x1102, 0x9242, 0x9282, 0x5212, 0xd352, 0xd392, 0x5222, 0xd362, 0xd3a2, - 0x3206, 0xb346, 0xb386, 0x7316, 0xf456, 0xf496, 0x7326, 0xf466, 0xf4a6, - 0x320a, 0xb34a, 0xb38a, 0x731a, 0xf45a, 0xf49a, 0x732a, 0xf46a, 0xf4aa, -}; - -static const float codebook_vector4_vals[] = { - -6.3496042, -4.3267487, - -2.5198421, -1.0000000, - 0.0000000, 1.0000000, - 2.5198421, 4.3267487, - 6.3496042, -}; - -/* - * bits 0:3, 4:7 index into _vals array - */ -static const uint16_t codebook_vector4_idx[] = { - 0x0000, 0x0010, 0x0020, 0x0030, 0x0040, 0x0050, 0x0060, 0x0070, 0x0080, - 0x0001, 0x0011, 0x0021, 0x0031, 0x0041, 0x0051, 0x0061, 0x0071, 0x0081, - 0x0002, 0x0012, 0x0022, 0x0032, 0x0042, 0x0052, 0x0062, 0x0072, 0x0082, - 0x0003, 0x0013, 0x0023, 0x0033, 0x0043, 0x0053, 0x0063, 0x0073, 0x0083, - 0x0004, 0x0014, 0x0024, 0x0034, 0x0044, 0x0054, 0x0064, 0x0074, 0x0084, - 0x0005, 0x0015, 0x0025, 0x0035, 0x0045, 0x0055, 0x0065, 0x0075, 0x0085, - 0x0006, 0x0016, 0x0026, 0x0036, 0x0046, 0x0056, 0x0066, 0x0076, 0x0086, - 0x0007, 0x0017, 0x0027, 0x0037, 0x0047, 0x0057, 0x0067, 0x0077, 0x0087, - 0x0008, 0x0018, 0x0028, 0x0038, 0x0048, 0x0058, 0x0068, 0x0078, 0x0088, -}; - -/* - * bits 0:3, 4:7 index into _vals array - * 8:11 number of non-zero values - * 12:15 1: only second value non-zero - * 0: other cases - */ -static const uint16_t codebook_vector6_idx[] = { - 0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, 0x0170, - 0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261, 0x0271, - 0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262, 0x0272, - 0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263, 0x0273, - 0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264, 0x0274, - 0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265, 0x0275, - 0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266, 0x0276, - 0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267, 0x0277, -}; - -/* - * bits 0:3, 4:7 index into _vals array - * 8:11 number of non-zero values - * 12:15 1: only second value non-zero - * 0: other cases - */ -static const uint16_t codebook_vector8_idx[] = { - 0x0000, 0x0110, 0x0120, 0x0130, 0x0140, 0x0150, 0x0160, - 0x0170, 0x0180, 0x0190, 0x01a0, 0x01b0, 0x01c0, - 0x1101, 0x0211, 0x0221, 0x0231, 0x0241, 0x0251, 0x0261, - 0x0271, 0x0281, 0x0291, 0x02a1, 0x02b1, 0x02c1, - 0x1102, 0x0212, 0x0222, 0x0232, 0x0242, 0x0252, 0x0262, - 0x0272, 0x0282, 0x0292, 0x02a2, 0x02b2, 0x02c2, - 0x1103, 0x0213, 0x0223, 0x0233, 0x0243, 0x0253, 0x0263, - 0x0273, 0x0283, 0x0293, 0x02a3, 0x02b3, 0x02c3, - 0x1104, 0x0214, 0x0224, 0x0234, 0x0244, 0x0254, 0x0264, - 0x0274, 0x0284, 0x0294, 0x02a4, 0x02b4, 0x02c4, - 0x1105, 0x0215, 0x0225, 0x0235, 0x0245, 0x0255, 0x0265, - 0x0275, 0x0285, 0x0295, 0x02a5, 0x02b5, 0x02c5, - 0x1106, 0x0216, 0x0226, 0x0236, 0x0246, 0x0256, 0x0266, - 0x0276, 0x0286, 0x0296, 0x02a6, 0x02b6, 0x02c6, - 0x1107, 0x0217, 0x0227, 0x0237, 0x0247, 0x0257, 0x0267, - 0x0277, 0x0287, 0x0297, 0x02a7, 0x02b7, 0x02c7, - 0x1108, 0x0218, 0x0228, 0x0238, 0x0248, 0x0258, 0x0268, - 0x0278, 0x0288, 0x0298, 0x02a8, 0x02b8, 0x02c8, - 0x1109, 0x0219, 0x0229, 0x0239, 0x0249, 0x0259, 0x0269, - 0x0279, 0x0289, 0x0299, 0x02a9, 0x02b9, 0x02c9, - 0x110a, 0x021a, 0x022a, 0x023a, 0x024a, 0x025a, 0x026a, - 0x027a, 0x028a, 0x029a, 0x02aa, 0x02ba, 0x02ca, - 0x110b, 0x021b, 0x022b, 0x023b, 0x024b, 0x025b, 0x026b, - 0x027b, 0x028b, 0x029b, 0x02ab, 0x02bb, 0x02cb, - 0x110c, 0x021c, 0x022c, 0x023c, 0x024c, 0x025c, 0x026c, - 0x027c, 0x028c, 0x029c, 0x02ac, 0x02bc, 0x02cc, -}; - -static const float codebook_vector10_vals[] = { - 0.0000000, 1.0000000, - 2.5198421, 4.3267487, - 6.3496042, 8.5498797, - 10.9027236, 13.3905183, - 16.0000000, 18.7207544, - 21.5443469, 24.4637810, - 27.4731418, 30.5673509, - 33.7419917, 36.9931811, -}; - -/* - * bits 0:3, 4:7 index into _vals array - * 8:9 bit mask of escape-coded entries - * 12:15 number of non-zero values - */ -static const uint16_t codebook_vector10_idx[] = { - 0x0000, 0x1010, 0x1020, 0x1030, 0x1040, 0x1050, 0x1060, 0x1070, - 0x1080, 0x1090, 0x10a0, 0x10b0, 0x10c0, 0x10d0, 0x10e0, 0x10f0, 0x1200, - 0x1001, 0x2011, 0x2021, 0x2031, 0x2041, 0x2051, 0x2061, 0x2071, - 0x2081, 0x2091, 0x20a1, 0x20b1, 0x20c1, 0x20d1, 0x20e1, 0x20f1, 0x2201, - 0x1002, 0x2012, 0x2022, 0x2032, 0x2042, 0x2052, 0x2062, 0x2072, - 0x2082, 0x2092, 0x20a2, 0x20b2, 0x20c2, 0x20d2, 0x20e2, 0x20f2, 0x2202, - 0x1003, 0x2013, 0x2023, 0x2033, 0x2043, 0x2053, 0x2063, 0x2073, - 0x2083, 0x2093, 0x20a3, 0x20b3, 0x20c3, 0x20d3, 0x20e3, 0x20f3, 0x2203, - 0x1004, 0x2014, 0x2024, 0x2034, 0x2044, 0x2054, 0x2064, 0x2074, - 0x2084, 0x2094, 0x20a4, 0x20b4, 0x20c4, 0x20d4, 0x20e4, 0x20f4, 0x2204, - 0x1005, 0x2015, 0x2025, 0x2035, 0x2045, 0x2055, 0x2065, 0x2075, - 0x2085, 0x2095, 0x20a5, 0x20b5, 0x20c5, 0x20d5, 0x20e5, 0x20f5, 0x2205, - 0x1006, 0x2016, 0x2026, 0x2036, 0x2046, 0x2056, 0x2066, 0x2076, - 0x2086, 0x2096, 0x20a6, 0x20b6, 0x20c6, 0x20d6, 0x20e6, 0x20f6, 0x2206, - 0x1007, 0x2017, 0x2027, 0x2037, 0x2047, 0x2057, 0x2067, 0x2077, - 0x2087, 0x2097, 0x20a7, 0x20b7, 0x20c7, 0x20d7, 0x20e7, 0x20f7, 0x2207, - 0x1008, 0x2018, 0x2028, 0x2038, 0x2048, 0x2058, 0x2068, 0x2078, - 0x2088, 0x2098, 0x20a8, 0x20b8, 0x20c8, 0x20d8, 0x20e8, 0x20f8, 0x2208, - 0x1009, 0x2019, 0x2029, 0x2039, 0x2049, 0x2059, 0x2069, 0x2079, - 0x2089, 0x2099, 0x20a9, 0x20b9, 0x20c9, 0x20d9, 0x20e9, 0x20f9, 0x2209, - 0x100a, 0x201a, 0x202a, 0x203a, 0x204a, 0x205a, 0x206a, 0x207a, - 0x208a, 0x209a, 0x20aa, 0x20ba, 0x20ca, 0x20da, 0x20ea, 0x20fa, 0x220a, - 0x100b, 0x201b, 0x202b, 0x203b, 0x204b, 0x205b, 0x206b, 0x207b, - 0x208b, 0x209b, 0x20ab, 0x20bb, 0x20cb, 0x20db, 0x20eb, 0x20fb, 0x220b, - 0x100c, 0x201c, 0x202c, 0x203c, 0x204c, 0x205c, 0x206c, 0x207c, - 0x208c, 0x209c, 0x20ac, 0x20bc, 0x20cc, 0x20dc, 0x20ec, 0x20fc, 0x220c, - 0x100d, 0x201d, 0x202d, 0x203d, 0x204d, 0x205d, 0x206d, 0x207d, - 0x208d, 0x209d, 0x20ad, 0x20bd, 0x20cd, 0x20dd, 0x20ed, 0x20fd, 0x220d, - 0x100e, 0x201e, 0x202e, 0x203e, 0x204e, 0x205e, 0x206e, 0x207e, - 0x208e, 0x209e, 0x20ae, 0x20be, 0x20ce, 0x20de, 0x20ee, 0x20fe, 0x220e, - 0x100f, 0x201f, 0x202f, 0x203f, 0x204f, 0x205f, 0x206f, 0x207f, - 0x208f, 0x209f, 0x20af, 0x20bf, 0x20cf, 0x20df, 0x20ef, 0x20ff, 0x220f, - 0x1100, 0x2110, 0x2120, 0x2130, 0x2140, 0x2150, 0x2160, 0x2170, - 0x2180, 0x2190, 0x21a0, 0x21b0, 0x21c0, 0x21d0, 0x21e0, 0x21f0, 0x2300, -}; - -const float *const ff_aac_codebook_vector_vals[] = { - codebook_vector0_vals, codebook_vector0_vals, - codebook_vector10_vals, codebook_vector10_vals, - codebook_vector4_vals, codebook_vector4_vals, - codebook_vector10_vals, codebook_vector10_vals, - codebook_vector10_vals, codebook_vector10_vals, - codebook_vector10_vals, -}; - -const uint16_t *const ff_aac_codebook_vector_idx[] = { - codebook_vector02_idx, codebook_vector02_idx, - codebook_vector02_idx, codebook_vector02_idx, - codebook_vector4_idx, codebook_vector4_idx, - codebook_vector6_idx, codebook_vector6_idx, - codebook_vector8_idx, codebook_vector8_idx, - codebook_vector10_idx, -}; - -/* @name swb_offsets - * Sample offset into the window indicating the beginning of a scalefactor - * window band - * - * scalefactor window band - term for scalefactor bands within a window, - * given in Table 4.110 to Table 4.128. - * - * scalefactor band - a set of spectral coefficients which are scaled by one - * scalefactor. In case of EIGHT_SHORT_SEQUENCE and grouping a scalefactor band - * may contain several scalefactor window bands of corresponding frequency. For - * all other window_sequences scalefactor bands and scalefactor window bands are - * identical. - * @{ - */ - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_128_96[] = { - 0, 4, 8, 12, 16, 20, 24, 32, 40, 48, 64, 92, 128 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_512_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 -}; - -static const uint16_t swb_offset_128_48[] = { - 0, 4, 8, 12, 16, 20, 28, 36, - 44, 56, 68, 80, 96, 112, 128 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_512_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 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_512_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, -}; - -static const uint16_t swb_offset_128_24[] = { - 0, 4, 8, 12, 16, 20, 24, 28, - 36, 44, 52, 64, 76, 92, 108, 128 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_128_16[] = { - 0, 4, 8, 12, 16, 20, 24, 28, - 32, 40, 48, 60, 72, 88, 108, 128 -}; - -static const uint16_t swb_offset_1024_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 -}; - -static const uint16_t swb_offset_128_8[] = { - 0, 4, 8, 12, 16, 20, 24, 28, - 36, 44, 52, 60, 72, 88, 108, 128 -}; - -const uint16_t * const ff_swb_offset_1024[] = { - swb_offset_1024_96, swb_offset_1024_96, swb_offset_1024_64, - swb_offset_1024_48, swb_offset_1024_48, swb_offset_1024_32, - swb_offset_1024_24, swb_offset_1024_24, swb_offset_1024_16, - swb_offset_1024_16, swb_offset_1024_16, swb_offset_1024_8, - swb_offset_1024_8 -}; - -const uint16_t * const ff_swb_offset_512[] = { - NULL, NULL, NULL, - swb_offset_512_48, swb_offset_512_48, swb_offset_512_32, - swb_offset_512_24, swb_offset_512_24, NULL, - NULL, NULL, NULL, - NULL -}; - -const uint16_t * const ff_swb_offset_128[] = { - /* The last entry on the following row is swb_offset_128_64 but is a - duplicate of swb_offset_128_96. */ - swb_offset_128_96, swb_offset_128_96, swb_offset_128_96, - swb_offset_128_48, swb_offset_128_48, swb_offset_128_48, - swb_offset_128_24, swb_offset_128_24, swb_offset_128_16, - swb_offset_128_16, swb_offset_128_16, swb_offset_128_8, - swb_offset_128_8 -}; - -// @} - -/* @name ff_tns_max_bands - * The maximum number of scalefactor bands on which TNS can operate for the long - * and short transforms respectively. The index to these tables is related to - * the sample rate of the audio. - * @{ - */ -const uint8_t ff_tns_max_bands_1024[] = { - 31, 31, 34, 40, 42, 51, 46, 46, 42, 42, 42, 39, 39 -}; - -const uint8_t ff_tns_max_bands_512[] = { - 0, 0, 0, 31, 32, 37, 31, 31, 0, 0, 0, 0, 0 -}; - -const uint8_t ff_tns_max_bands_128[] = { - 9, 9, 10, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14 -}; -// @} - -const DECLARE_ALIGNED(32, float, ff_aac_eld_window)[1920] = { - 0.00338834, 0.00567745, 0.00847677, 0.01172641, - 0.01532555, 0.01917664, 0.02318809, 0.02729259, - 0.03144503, 0.03560261, 0.03972499, 0.04379783, - 0.04783094, 0.05183357, 0.05581342, 0.05977723, - 0.06373173, 0.06768364, 0.07163937, 0.07559976, - 0.07956096, 0.08352024, 0.08747623, 0.09143035, - 0.09538618, 0.09934771, 0.10331917, 0.10730456, - 0.11130697, 0.11532867, 0.11937133, 0.12343922, - 0.12753911, 0.13167705, 0.13585812, 0.14008529, - 0.14435986, 0.14868291, 0.15305531, 0.15747594, - 0.16194193, 0.16645070, 0.17099991, 0.17558633, - 0.18020600, 0.18485548, 0.18953191, 0.19423322, - 0.19895800, 0.20370512, 0.20847374, 0.21326312, - 0.21807244, 0.22290083, 0.22774742, 0.23261210, - 0.23749542, 0.24239767, 0.24731889, 0.25225887, - 0.25721719, 0.26219330, 0.26718648, 0.27219630, - 0.27722262, 0.28226514, 0.28732336, 0.29239628, - 0.29748247, 0.30258055, 0.30768914, 0.31280508, - 0.31792385, 0.32304172, 0.32815579, 0.33326397, - 0.33836470, 0.34345661, 0.34853868, 0.35361188, - 0.35867865, 0.36374072, 0.36879900, 0.37385347, - 0.37890349, 0.38394836, 0.38898730, 0.39401912, - 0.39904236, 0.40405575, 0.40905820, 0.41404819, - 0.41902398, 0.42398423, 0.42892805, 0.43385441, - 0.43876210, 0.44365014, 0.44851786, 0.45336632, - 0.45819759, 0.46301302, 0.46781309, 0.47259722, - 0.47736435, 0.48211365, 0.48684450, 0.49155594, - 0.49624679, 0.50091636, 0.50556440, 0.51019132, - 0.51479771, 0.51938391, 0.52394998, 0.52849587, - 0.53302151, 0.53752680, 0.54201160, 0.54647575, - 0.55091916, 0.55534181, 0.55974376, 0.56412513, - 0.56848615, 0.57282710, 0.57714834, 0.58145030, - 0.58492489, 0.58918511, 0.59342326, 0.59763936, - 0.60183347, 0.60600561, 0.61015581, 0.61428412, - 0.61839056, 0.62247517, 0.62653799, 0.63057912, - 0.63459872, 0.63859697, 0.64257403, 0.64653001, - 0.65046495, 0.65437887, 0.65827181, 0.66214383, - 0.66599499, 0.66982535, 0.67363499, 0.67742394, - 0.68119219, 0.68493972, 0.68866653, 0.69237258, - 0.69605778, 0.69972207, 0.70336537, 0.70698758, - 0.71058862, 0.71416837, 0.71772674, 0.72126361, - 0.72477889, 0.72827246, 0.73174419, 0.73519392, - 0.73862141, 0.74202643, 0.74540874, 0.74876817, - 0.75210458, 0.75541785, 0.75870785, 0.76197437, - 0.76521709, 0.76843570, 0.77162988, 0.77479939, - 0.77794403, 0.78106359, 0.78415789, 0.78722670, - 0.79026979, 0.79328694, 0.79627791, 0.79924244, - 0.80218027, 0.80509112, 0.80797472, 0.81083081, - 0.81365915, 0.81645949, 0.81923160, 0.82197528, - 0.82469037, 0.82737673, 0.83003419, 0.83266262, - 0.83526186, 0.83783176, 0.84037217, 0.84288297, - 0.84536401, 0.84781517, 0.85023632, 0.85262739, - 0.85498836, 0.85731921, 0.85961993, 0.86189052, - 0.86413101, 0.86634140, 0.86852173, 0.87067211, - 0.87279275, 0.87488384, 0.87694559, 0.87897824, - 0.88098206, 0.88295729, 0.88490423, 0.88682332, - 0.88871519, 0.89058048, 0.89241983, 0.89423391, - 0.89602338, 0.89778893, 0.89953126, 0.90125142, - 0.90295086, 0.90463104, 0.90629341, 0.90793946, - 0.90957067, 0.91118856, 0.91279464, 0.91439073, - 0.91597898, 0.91756153, 0.91914049, 0.92071690, - 0.92229070, 0.92386182, 0.92542993, 0.92698946, - 0.92852960, 0.93003929, 0.93150727, 0.93291739, - 0.93424863, 0.93547974, 0.93658982, 0.93756587, - 0.93894072, 0.93922780, 0.93955477, 0.93991290, - 0.94029104, 0.94067794, 0.94106258, 0.94144084, - 0.94181549, 0.94218963, 0.94256628, 0.94294662, - 0.94332998, 0.94371562, 0.94410280, 0.94449122, - 0.94488106, 0.94527249, 0.94566568, 0.94606074, - 0.94645772, 0.94685665, 0.94725759, 0.94766054, - 0.94806547, 0.94847234, 0.94888115, 0.94929190, - 0.94970469, 0.95011960, 0.95053672, 0.95095604, - 0.95137751, 0.95180105, 0.95222658, 0.95265413, - 0.95308380, 0.95351571, 0.95394994, 0.95438653, - 0.95482538, 0.95526643, 0.95570958, 0.95615486, - 0.95660234, 0.95705214, 0.95750433, 0.95795892, - 0.95841582, 0.95887493, 0.95933616, 0.95979949, - 0.96026500, 0.96073277, 0.96120286, 0.96167526, - 0.96214986, 0.96262655, 0.96310522, 0.96358586, - 0.96406853, 0.96455330, 0.96504026, 0.96552936, - 0.96602051, 0.96651360, 0.96700850, 0.96750520, - 0.96800376, 0.96850424, 0.96900670, 0.96951112, - 0.97001738, 0.97052533, 0.97103488, 0.97154597, - 0.97205867, 0.97257304, 0.97308915, 0.97360694, - 0.97412631, 0.97464711, 0.97516923, 0.97569262, - 0.97621735, 0.97674350, 0.97727111, 0.97780016, - 0.97833051, 0.97886205, 0.97939463, 0.97992823, - 0.98046291, 0.98099875, 0.98153580, 0.98207405, - 0.98261337, 0.98315364, 0.98369474, 0.98423664, - 0.98477941, 0.98532311, 0.98586780, 0.98641348, - 0.98696003, 0.98750734, 0.98805530, 0.98860389, - 0.98915320, 0.98970328, 0.99025423, 0.99080602, - 0.99135855, 0.99191171, 0.99246541, 0.99301962, - 0.99357443, 0.99412992, 0.99468617, 0.99524320, - 0.99580092, 0.99635926, 0.99691814, 0.99747748, - 0.99803721, 0.99859725, 0.99915752, 0.99971793, - 1.00028215, 1.00084319, 1.00140472, 1.00196665, - 1.00252889, 1.00309139, 1.00365404, 1.00421679, - 1.00477954, 1.00534221, 1.00590474, 1.00646713, - 1.00702945, 1.00759179, 1.00815424, 1.00871678, - 1.00927930, 1.00984169, 1.01040384, 1.01096575, - 1.01152747, 1.01208910, 1.01265070, 1.01321226, - 1.01377365, 1.01433478, 1.01489551, 1.01545584, - 1.01601582, 1.01657553, 1.01713502, 1.01769427, - 1.01825316, 1.01881154, 1.01936929, 1.01992639, - 1.02048289, 1.02103888, 1.02159441, 1.02214945, - 1.02270387, 1.02325751, 1.02381025, 1.02436204, - 1.02491295, 1.02546304, 1.02601238, 1.02656092, - 1.02710853, 1.02765508, 1.02820041, 1.02874449, - 1.02928737, 1.02982913, 1.03036981, 1.03090937, - 1.03144768, 1.03198460, 1.03252000, 1.03305384, - 1.03358617, 1.03411707, 1.03464659, 1.03517470, - 1.03570128, 1.03622620, 1.03674934, 1.03727066, - 1.03779024, 1.03830815, 1.03882446, 1.03933914, - 1.03985206, 1.04036312, 1.04087217, 1.04137920, - 1.04188428, 1.04238748, 1.04288888, 1.04338845, - 1.04388610, 1.04438170, 1.04487515, 1.04536645, - 1.04585569, 1.04634297, 1.04682838, 1.04731192, - 1.04779350, 1.04827303, 1.04875042, 1.04922568, - 1.04969891, 1.05017022, 1.05063974, 1.05110746, - 1.05157332, 1.05203721, 1.05249907, 1.05295889, - 1.05341676, 1.05387277, 1.05432700, 1.05477948, - 1.05523018, 1.05567906, 1.05612608, 1.05657124, - 1.05701459, 1.05745616, 1.05789601, 1.05833426, - 1.05877109, 1.05920669, 1.05964125, 1.06007444, - 1.06050542, 1.06093335, 1.06135746, 1.06177909, - 1.06220164, 1.06262858, 1.06306309, 1.06350050, - 1.06392837, 1.06433391, 1.06470443, 1.06502996, - 1.06481076, 1.06469765, 1.06445004, 1.06408002, - 1.06361382, 1.06307719, 1.06249453, 1.06188365, - 1.06125612, 1.06062291, 1.05999418, 1.05937132, - 1.05874726, 1.05811486, 1.05746728, 1.05680000, - 1.05611070, 1.05539715, 1.05465735, 1.05389329, - 1.05311083, 1.05231578, 1.05151372, 1.05070811, - 1.04990044, 1.04909210, 1.04828434, 1.04747647, - 1.04666590, 1.04585003, 1.04502628, 1.04419009, - 1.04333499, 1.04245452, 1.04154244, 1.04059452, - 1.03960846, 1.03858207, 1.03751326, 1.03640189, - 1.03524976, 1.03405868, 1.03283047, 1.03156812, - 1.03027574, 1.02895743, 1.02761717, 1.02625804, - 1.02488222, 1.02349184, 1.02208892, 1.02067450, - 1.01924861, 1.01781123, 1.01636229, 1.01490045, - 1.01342315, 1.01192778, 1.01041175, 1.00887284, - 1.00730915, 1.00571882, 1.00409996, 1.00245032, - 1.00076734, 0.99904842, 0.99729101, 0.99549380, - 0.99365664, 0.99177946, 0.98986234, 0.98791024, - 0.98593294, 0.98394037, 0.98194226, 0.97994532, - 0.97795324, 0.97596955, 0.97399748, 0.97203326, - 0.97006624, 0.96808546, 0.96608018, 0.96404416, - 0.96197556, 0.95987276, 0.95773420, 0.95556018, - 0.95335291, 0.95111462, 0.94884764, 0.94655663, - 0.94424858, 0.94193055, 0.93960953, 0.93729154, - 0.93498157, 0.93268456, 0.93040503, 0.92813771, - 0.92586755, 0.92357910, 0.92125731, 0.91889642, - 0.91649998, 0.91407191, 0.91161623, 0.90913975, - 0.90665202, 0.90416271, 0.90168115, 0.89920934, - 0.89674189, 0.89427312, 0.89179743, 0.88931147, - 0.88681415, 0.88430445, 0.88178141, 0.87924528, - 0.87669753, 0.87413966, 0.87157318, 0.86899958, - 0.86642037, 0.86383703, 0.86125106, 0.85866393, - 0.85604236, 0.85344385, 0.85083093, 0.84820550, - 0.84556943, 0.84292458, 0.84027278, 0.83761586, - 0.83495565, 0.83229393, 0.82963243, 0.82697135, - 0.82430933, 0.82164496, 0.81897669, 0.81630017, - 0.81360822, 0.81089355, 0.80814924, 0.80537741, - 0.80258920, 0.79979611, 0.79700954, 0.79423813, - 0.79148780, 0.78876432, 0.78607290, 0.78340590, - 0.78074288, 0.77806279, 0.77534514, 0.77258187, - 0.76977737, 0.76693654, 0.76406441, 0.76116851, - 0.75825892, 0.75534582, 0.75243924, 0.74954634, - 0.74667135, 0.74381840, 0.74099145, 0.73819147, - 0.73541641, 0.73266408, 0.72993193, 0.72720913, - 0.72447661, 0.72171494, 0.71890515, 0.71603932, - 0.71312056, 0.71015250, 0.70713900, 0.70409084, - 0.70102565, 0.69796137, 0.69491556, 0.69189772, - 0.68890931, 0.68595141, 0.68302498, 0.68012852, - 0.67725801, 0.67440936, 0.67157841, 0.66876081, - 0.66595195, 0.66314722, 0.66034194, 0.65753027, - 0.65470525, 0.65185984, 0.64898709, 0.64608214, - 0.64314221, 0.64016460, 0.63714680, 0.63409034, - 0.63100082, 0.62788400, 0.62474577, 0.62159473, - 0.61844225, 0.61529977, 0.61217866, 0.60908811, - 0.60603510, 0.60302654, 0.60006916, 0.59716588, - 0.59431580, 0.59151787, 0.58877068, 0.58606495, - 0.58338353, 0.58070891, 0.57802356, 0.57530864, - 0.57254404, 0.56970958, 0.56678577, 0.56376860, - 0.56066951, 0.55750064, 0.55427451, 0.55101301, - 0.54774732, 0.54450907, 0.54132936, 0.53822744, - 0.53521072, 0.53228613, 0.52945979, 0.52671997, - 0.52403708, 0.52138072, 0.51872085, 0.51603570, - 0.51331170, 0.51053560, 0.50769466, 0.50478931, - 0.50183308, 0.49884001, 0.49582406, 0.49279905, - 0.48985748, 0.48679641, 0.48379429, 0.48085363, - 0.47796576, 0.47512151, 0.47231151, 0.46952402, - 0.46674486, 0.46395978, 0.46115496, 0.45832607, - 0.45547830, 0.45261727, 0.44974866, 0.44688011, - 0.44402125, 0.44118178, 0.43837094, 0.43558772, - 0.43282082, 0.43005847, 0.42728913, 0.42450572, - 0.42170567, 0.41888658, 0.41604633, 0.41318897, - 0.41032472, 0.40746405, 0.40461724, 0.40178943, - 0.39898066, 0.39619073, 0.39341940, 0.39066519, - 0.38792536, 0.38519713, 0.38247773, 0.37976476, - 0.37705620, 0.37435006, 0.37164438, 0.36893869, - 0.36623396, 0.36353124, 0.36083153, 0.35813533, - 0.35544262, 0.35275338, 0.35006755, 0.34738530, - 0.34470699, 0.34203296, 0.33936359, 0.33669922, - 0.33404027, 0.33138711, 0.32874013, 0.32609944, - 0.32346493, 0.32083645, 0.31821388, 0.31559703, - 0.31298573, 0.31037987, 0.30777941, 0.30518446, - 0.30259525, 0.30001202, 0.29743499, 0.29486428, - 0.29229989, 0.28974179, 0.28718997, 0.28464452, - 0.28210562, 0.27957346, 0.27704820, 0.27452992, - 0.27201854, 0.26951399, 0.26701622, 0.26452533, - 0.26204158, 0.25956526, 0.25709662, 0.25463583, - 0.25218294, 0.24973798, 0.24730100, 0.24487207, - 0.24245133, 0.24003893, 0.23763500, 0.23523959, - 0.23285262, 0.23047401, 0.22810369, 0.22574170, - 0.22338818, 0.22104329, 0.21870719, 0.21637986, - 0.21406117, 0.21175095, 0.20944904, 0.20715535, - 0.20486987, 0.20259261, 0.20032356, 0.19806259, - 0.19580944, 0.19356385, 0.19132556, 0.18909442, - 0.18687040, 0.18465350, 0.18244372, 0.18024164, - 0.17804841, 0.17586521, 0.17369322, 0.17153360, - 0.16938755, 0.16725622, 0.16514081, 0.16304247, - 0.16098974, 0.15896561, 0.15696026, 0.15497259, - 0.15300151, 0.15104590, 0.14910466, 0.14717666, - 0.14526081, 0.14335599, 0.14146111, 0.13957570, - 0.13769993, 0.13583399, 0.13397806, 0.13213229, - 0.13029682, 0.12847178, 0.12665729, 0.12485353, - 0.12306074, 0.12127916, 0.11950900, 0.11775043, - 0.11600347, 0.11426820, 0.11254464, 0.11083292, - 0.10913318, 0.10744559, 0.10577028, 0.10410733, - 0.10245672, 0.10081842, 0.09919240, 0.09757872, - 0.09597750, 0.09438884, 0.09281288, 0.09124964, - 0.08969907, 0.08816111, 0.08663570, 0.08512288, - 0.08362274, 0.08213540, 0.08066096, 0.07919944, - 0.07775076, 0.07631484, 0.07489161, 0.07348108, - 0.07208335, 0.07069851, 0.06932666, 0.06796781, - 0.06662187, 0.06528874, 0.06396833, 0.06266065, - 0.06136578, 0.06008380, 0.05881480, 0.05755876, - 0.05631557, 0.05508511, 0.05386728, 0.05266206, - 0.05146951, 0.05028971, 0.04912272, 0.04796855, - 0.04682709, 0.04569825, 0.04458194, 0.04347817, - 0.04238704, 0.04130868, 0.04024318, 0.03919056, - 0.03815071, 0.03712352, 0.03610890, 0.03510679, - 0.03411720, 0.03314013, 0.03217560, 0.03122343, - 0.03028332, 0.02935494, 0.02843799, 0.02753230, - 0.02663788, 0.02575472, 0.02488283, 0.02402232, - 0.02317341, 0.02233631, 0.02151124, 0.02069866, - 0.01989922, 0.01911359, 0.01834241, 0.01758563, - 0.01684248, 0.01611219, 0.01539397, 0.01468726, - 0.01399167, 0.01330687, 0.01263250, 0.01196871, - 0.01131609, 0.01067527, 0.01004684, 0.00943077, - 0.00882641, 0.00823307, 0.00765011, 0.00707735, - 0.00651513, 0.00596377, 0.00542364, 0.00489514, - 0.00437884, 0.00387530, 0.00338509, 0.00290795, - 0.00244282, 0.00198860, 0.00154417, 0.00110825, - 0.00067934, 0.00025589, -0.00016357, -0.00057897, - -0.00098865, -0.00139089, -0.00178397, -0.00216547, - -0.00253230, -0.00288133, -0.00320955, -0.00351626, - -0.00380315, -0.00407198, -0.00432457, -0.00456373, - -0.00479326, -0.00501699, -0.00523871, -0.00546066, - -0.00568360, -0.00590821, -0.00613508, -0.00636311, - -0.00658944, -0.00681117, -0.00702540, -0.00722982, - -0.00742268, -0.00760226, -0.00776687, -0.00791580, - -0.00804933, -0.00816774, -0.00827139, -0.00836122, - -0.00843882, -0.00850583, -0.00856383, -0.00861430, - -0.00865853, -0.00869781, -0.00873344, -0.00876633, - -0.00879707, -0.00882622, -0.00885433, -0.00888132, - -0.00890652, -0.00892925, -0.00894881, -0.00896446, - -0.00897541, -0.00898088, -0.00898010, -0.00897234, - -0.00895696, -0.00893330, -0.00890076, -0.00885914, - -0.00880875, -0.00874987, -0.00868282, -0.00860825, - -0.00852716, -0.00844055, -0.00834941, -0.00825485, - -0.00815807, -0.00806025, -0.00796253, -0.00786519, - -0.00776767, -0.00766937, -0.00756971, -0.00746790, - -0.00736305, -0.00725422, -0.00714055, -0.00702161, - -0.00689746, -0.00676816, -0.00663381, -0.00649489, - -0.00635230, -0.00620694, -0.00605969, -0.00591116, - -0.00576167, -0.00561155, -0.00546110, -0.00531037, - -0.00515917, -0.00500732, -0.00485462, -0.00470075, - -0.00454530, -0.00438786, -0.00422805, -0.00406594, - -0.00390204, -0.00373686, -0.00357091, -0.00340448, - -0.00323770, -0.00307066, -0.00290344, -0.00273610, - -0.00256867, -0.00240117, -0.00223365, -0.00206614, - -0.00189866, -0.00173123, -0.00156390, -0.00139674, - -0.00122989, -0.00106351, -0.00089772, -0.00073267, - -0.00056849, -0.00040530, -0.00024324, -0.00008241, - 0.00008214, 0.00024102, 0.00039922, 0.00055660, - 0.00071299, 0.00086826, 0.00102224, 0.00117480, - 0.00132579, 0.00147507, 0.00162252, 0.00176804, - 0.00191161, 0.00205319, 0.00219277, 0.00233029, - 0.00246567, 0.00259886, 0.00272975, 0.00285832, - 0.00298453, 0.00310839, 0.00322990, 0.00334886, - 0.00346494, 0.00357778, 0.00368706, 0.00379273, - 0.00389501, 0.00399411, 0.00409020, 0.00418350, - 0.00427419, 0.00436249, 0.00444858, 0.00453250, - 0.00461411, 0.00469328, 0.00476988, 0.00484356, - 0.00491375, 0.00497987, 0.00504139, 0.00509806, - 0.00514990, 0.00519693, 0.00523920, 0.00527700, - 0.00531083, 0.00534122, 0.00536864, 0.00539357, - 0.00541649, 0.00543785, 0.00545809, 0.00547713, - 0.00549441, 0.00550936, 0.00552146, 0.00553017, - 0.00553494, 0.00553524, 0.00553058, 0.00552065, - 0.00550536, 0.00548459, 0.00545828, 0.00542662, - 0.00539007, 0.00534910, 0.00530415, 0.00525568, - 0.00520417, 0.00515009, 0.00509387, 0.00503595, - 0.00497674, 0.00491665, 0.00485605, 0.00479503, - 0.00473336, 0.00467082, 0.00460721, 0.00454216, - 0.00447517, 0.00440575, 0.00433344, 0.00425768, - 0.00417786, 0.00409336, 0.00400363, 0.00390837, - 0.00380759, 0.00370130, 0.00358952, 0.00347268, - 0.00335157, 0.00322699, 0.00309975, 0.00297088, - 0.00284164, 0.00271328, 0.00258700, 0.00246328, - 0.00234195, 0.00222281, 0.00210562, 0.00198958, - 0.00187331, 0.00175546, 0.00163474, 0.00151020, - 0.00138130, 0.00124750, 0.00110831, 0.00096411, - 0.00081611, 0.00066554, 0.00051363, 0.00036134, - 0.00020940, 0.00005853, -0.00009058, -0.00023783, - -0.00038368, -0.00052861, -0.00067310, -0.00081757, - -0.00096237, -0.00110786, -0.00125442, -0.00140210, - -0.00155065, -0.00169984, -0.00184940, -0.00199910, - -0.00214872, -0.00229798, -0.00244664, -0.00259462, - -0.00274205, -0.00288912, -0.00303596, -0.00318259, - -0.00332890, -0.00347480, -0.00362024, -0.00376519, - -0.00390962, -0.00405345, -0.00419658, -0.00433902, - -0.00448085, -0.00462219, -0.00476309, -0.00490357, - -0.00504361, -0.00518321, -0.00532243, -0.00546132, - -0.00559988, -0.00573811, -0.00587602, -0.00601363, - -0.00615094, -0.00628795, -0.00642466, -0.00656111, - -0.00669737, -0.00683352, -0.00696963, -0.00710578, - -0.00724208, -0.00737862, -0.00751554, -0.00765295, - -0.00779098, -0.00792976, -0.00806941, -0.00821006, - -0.00835183, -0.00849485, -0.00863926, -0.00878522, - -0.00893293, -0.00908260, -0.00923444, -0.00938864, - -0.00954537, -0.00970482, -0.00986715, -0.01003173, - -0.01019711, -0.01036164, -0.01052357, -0.01068184, - -0.01083622, -0.01098652, -0.01113252, -0.01127409, - -0.01141114, -0.01154358, -0.01167135, -0.01179439, - -0.01191268, -0.01202619, -0.01213493, -0.01223891, - -0.01233817, -0.01243275, -0.01252272, -0.01260815, - -0.01268915, -0.01276583, -0.01283832, -0.01290685, - -0.01297171, -0.01303320, -0.01309168, -0.01314722, - -0.01319969, -0.01324889, -0.01329466, -0.01333693, - -0.01337577, -0.01341125, -0.01344345, -0.01347243, - -0.01349823, -0.01352089, -0.01354045, -0.01355700, - -0.01357068, -0.01358164, -0.01359003, -0.01359587, - -0.01359901, -0.01359931, -0.01359661, -0.01359087, - -0.01358219, -0.01357065, -0.01355637, -0.01353935, - -0.01351949, -0.01349670, -0.01347088, -0.01344214, - -0.01341078, -0.01337715, -0.01334158, -0.01330442, - -0.01326601, -0.01322671, -0.01318689, -0.01314692, - -0.01310123, -0.01306470, -0.01302556, -0.01298381, - -0.01293948, -0.01289255, -0.01284305, -0.01279095, - -0.01273625, -0.01267893, -0.01261897, -0.01255632, - -0.01249096, -0.01242283, -0.01235190, -0.01227827, - -0.01220213, -0.01212366, -0.01204304, -0.01196032, - -0.01187543, -0.01178829, -0.01169884, -0.01160718, - -0.01151352, -0.01141809, -0.01132111, -0.01122272, - -0.01112304, -0.01102217, -0.01092022, -0.01081730, - -0.01071355, -0.01060912, -0.01050411, -0.01039854, - -0.01029227, -0.01018521, -0.01007727, -0.00996859, - -0.00985959, -0.00975063, -0.00964208, -0.00953420, - -0.00942723, -0.00932135, -0.00921677, -0.00911364, - -0.00901208, -0.00891220, -0.00881412, -0.00871792, - -0.00862369, -0.00853153, -0.00844149, -0.00835360, - -0.00826785, -0.00818422, -0.00810267, -0.00802312, - -0.00794547, -0.00786959, -0.00779533, -0.00772165, - -0.00764673, -0.00756886, -0.00748649, -0.00739905, - -0.00730681, -0.00721006, -0.00710910, -0.00700419, - -0.00689559, -0.00678354, -0.00666829, -0.00655007, - -0.00642916, -0.00630579, -0.00618022, -0.00605267, - -0.00592333, -0.00579240, -0.00566006, -0.00552651, - -0.00539194, -0.00525653, -0.00512047, -0.00498390, - -0.00484693, -0.00470969, -0.00457228, -0.00443482, - -0.00429746, -0.00416034, -0.00402359, -0.00388738, - -0.00375185, -0.00361718, -0.00348350, -0.00335100, - -0.00321991, -0.00309043, -0.00296276, -0.00283698, - -0.00271307, -0.00259098, -0.00247066, -0.00235210, - -0.00223531, -0.00212030, -0.00200709, -0.00189576, - -0.00178647, -0.00167936, -0.00157457, -0.00147216, - -0.00137205, -0.00127418, -0.00117849, -0.00108498, - -0.00099375, -0.00090486, -0.00081840, -0.00073444, - -0.00065309, -0.00057445, -0.00049860, -0.00042551, - -0.00035503, -0.00028700, -0.00022125, -0.00015761, - -0.00009588, -0.00003583, 0.00002272, 0.00007975, - 0.00013501, 0.00018828, 0.00023933, 0.00028784, - 0.00033342, 0.00037572, 0.00041438, 0.00044939, - 0.00048103, 0.00050958, 0.00053533, 0.00055869, - 0.00058015, 0.00060022, 0.00061935, 0.00063781, - 0.00065568, 0.00067303, 0.00068991, 0.00070619, - 0.00072155, 0.00073567, 0.00074826, 0.00075912, - 0.00076811, 0.00077509, 0.00077997, 0.00078275, - 0.00078351, 0.00078237, 0.00077943, 0.00077484, - 0.00076884, 0.00076160, 0.00075335, 0.00074423, - 0.00073442, 0.00072404, 0.00071323, 0.00070209, - 0.00069068, 0.00067906, 0.00066728, 0.00065534, - 0.00064321, 0.00063086, 0.00061824, 0.00060534, - 0.00059211, 0.00057855, 0.00056462, 0.00055033, - 0.00053566, 0.00052063, 0.00050522, 0.00048949, - 0.00047349, 0.00045728, 0.00044092, 0.00042447, - 0.00040803, 0.00039166, 0.00037544, 0.00035943, - 0.00034371, 0.00032833, 0.00031333, 0.00029874, - 0.00028452, 0.00027067, 0.00025715, 0.00024395, - 0.00023104, 0.00021842, 0.00020606, 0.00019398, - 0.00018218, 0.00017069, 0.00015953, 0.00014871, - 0.00013827, 0.00012823, 0.00011861, 0.00010942, - 0.00010067, 0.00009236, 0.00008448, 0.00007703, - 0.00006999, 0.00006337, 0.00005714, 0.00005129, - 0.00004583, 0.00004072, 0.00003597, 0.00003157, - 0.00002752, 0.00002380, 0.00002042, 0.00001736, - 0.00001461, 0.00001215, 0.00000998, 0.00000807, - 0.00000641, 0.00000499, 0.00000378, 0.00000278, - 0.00000196, 0.00000132, 0.00000082, 0.00000046, - 0.00000020, 0.00000005, -0.00000003, -0.00000006, - -0.00000004, -0.00000001, 0.00000001, 0.00000001, - 0.00000001, 0.00000001, -0.00000001, -0.00000004, - -0.00000005, -0.00000003, 0.00000005, 0.00000020, - 0.00000043, 0.00000077, 0.00000123, 0.00000183, - 0.00000257, 0.00000348, 0.00000455, 0.00000581, - 0.00000727, 0.00000893, 0.00001080, 0.00001290, - 0.00001522, 0.00001778, 0.00002057, 0.00002362, - 0.00002691, 0.00003044, 0.00003422, 0.00003824, - 0.00004250, 0.00004701, 0.00005176, 0.00005676, - 0.00006200, 0.00006749, 0.00007322, 0.00007920, - 0.00008541, 0.00009186, 0.00009854, 0.00010543, - 0.00011251, 0.00011975, 0.00012714, 0.00013465, - 0.00014227, 0.00014997, 0.00015775, 0.00016558, - 0.00017348, 0.00018144, 0.00018947, 0.00019756, - 0.00020573, 0.00021399, 0.00022233, 0.00023076, - 0.00023924, 0.00024773, 0.00025621, 0.00026462, - 0.00027293, 0.00028108, 0.00028904, 0.00029675, - 0.00030419, 0.00031132, 0.00031810, 0.00032453, - 0.00033061, 0.00033632, 0.00034169, 0.00034672, - 0.00035142, 0.00035580, 0.00035988, 0.00036369, - 0.00036723, 0.00037053, 0.00037361, 0.00037647, - 0.00037909, 0.00038145, 0.00038352, 0.00038527, - 0.00038663, 0.00038757, 0.00038801, 0.00038790, - 0.00038717, 0.00038572, 0.00038350, 0.00038044, - 0.00037651, 0.00037170, 0.00036597, 0.00035936, - 0.00035191, 0.00034370, 0.00033480, 0.00032531, - 0.00031537, 0.00030512, 0.00029470, 0.00028417, - 0.00027354, 0.00026279, 0.00025191, 0.00024081, - 0.00022933, 0.00021731, 0.00020458, 0.00019101, - 0.00017654, 0.00016106, 0.00014452, 0.00012694, - 0.00010848, 0.00008929, 0.00006953, 0.00004935, - 0.00002884, 0.00000813, -0.00001268, -0.00003357, - -0.00005457, -0.00007574, -0.00009714, -0.00011882, - -0.00014082, -0.00016318, -0.00018595, -0.00020912, - -0.00023265, -0.00025650, -0.00028060, -0.00030492, - -0.00032941, -0.00035400, -0.00037865, -0.00040333, - -0.00042804, -0.00045279, -0.00047759, -0.00050243, - -0.00052728, -0.00055209, -0.00057685, -0.00060153, - -0.00062611, -0.00065056, -0.00067485, -0.00069895, - -0.00072287, -0.00074660, -0.00077013, -0.00079345, - -0.00081653, -0.00083936, -0.00086192, -0.00088421, - -0.00090619, -0.00092786, -0.00094919, -0.00097017, - -0.00099077, -0.00101098, -0.00103077, -0.00105012, - -0.00106904, -0.00108750, -0.00110549, -0.00112301, - -0.00114005, -0.00115660, -0.00117265, -0.00118821, - -0.00120325, -0.00121779, -0.00123180, -0.00124528, - -0.00125822, -0.00127061, -0.00128243, -0.00129368, - -0.00130435, -0.00131445, -0.00132395, -0.00133285, - -0.00134113, -0.00134878, -0.00135577, -0.00136215, - -0.00136797, -0.00137333, -0.00137834, -0.00138305, - -0.00138748, -0.00139163, -0.00139551, -0.00139913, - -0.00140249, -0.00140559, -0.00140844, -0.00141102, - -0.00141334, -0.00141538, -0.00141714, -0.00141861, - -0.00141978, -0.00142064, -0.00142117, -0.00142138, - -0.00142125, -0.00142077, -0.00141992, -0.00141870, - -0.00141710, -0.00141510, -0.00141268, -0.00140986, - -0.00140663, -0.00140301, -0.00139900, -0.00139460, - -0.00138981, -0.00138464, -0.00137908, -0.00137313, - -0.00136680, -0.00136010, -0.00135301, -0.00134555, - -0.00133772, -0.00132952, -0.00132095, -0.00131201, - -0.00130272, -0.00129307, -0.00128309, -0.00127277, - -0.00126211, -0.00125113, -0.00123981, -0.00122817, - -0.00121622, -0.00120397, -0.00119141, -0.00117859, - -0.00116552, -0.00115223, -0.00113877, -0.00112517, - -0.00111144, -0.00109764, -0.00108377, -0.00106989, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.h deleted file mode 100644 index 5ed850888..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/aactab.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * AAC data declarations - * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org ) - * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AAC data declarations - * @author Oded Shimon ( ods15 ods15 dyndns org ) - * @author Maxim Gavrilov ( maxim.gavrilov gmail com ) - */ - -#ifndef AVCODEC_AACTAB_H -#define AVCODEC_AACTAB_H - -#include "libavutil/mem.h" -#include "aac.h" -#include "aac_tablegen_decl.h" - -#include - -/* NOTE: - * Tables in this file are used by the AAC decoder and will be used by the AAC - * encoder. - */ - -/* @name window coefficients - * @{ - */ -DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024]; -DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; -const DECLARE_ALIGNED(32, extern float, ff_aac_eld_window)[1920]; -// @} - -/* @name number of scalefactor window bands for long and short transform windows respectively - * @{ - */ -extern const uint8_t ff_aac_num_swb_1024[]; -extern const uint8_t ff_aac_num_swb_512 []; -extern const uint8_t ff_aac_num_swb_128 []; -// @} - -extern const uint8_t ff_aac_pred_sfb_max []; - -extern const uint32_t ff_aac_scalefactor_code[121]; -extern const uint8_t ff_aac_scalefactor_bits[121]; - -extern const uint16_t * const ff_aac_spectral_codes[11]; -extern const uint8_t * const ff_aac_spectral_bits [11]; -extern const uint16_t ff_aac_spectral_sizes[11]; - -extern const float *ff_aac_codebook_vectors[]; -extern const float *ff_aac_codebook_vector_vals[]; -extern const uint16_t *ff_aac_codebook_vector_idx[]; - -extern const uint16_t * const ff_swb_offset_1024[13]; -extern const uint16_t * const ff_swb_offset_512 [13]; -extern const uint16_t * const ff_swb_offset_128 [13]; - -extern const uint8_t ff_tns_max_bands_1024[13]; -extern const uint8_t ff_tns_max_bands_512 [13]; -extern const uint8_t ff_tns_max_bands_128 [13]; - -#endif /* AVCODEC_AACTAB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.c deleted file mode 100644 index 29e132f5d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Common code between the AC-3 encoder and decoder - * Copyright (c) 2000 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Common code between the AC-3 encoder and decoder. - */ - -#include "avcodec.h" -#include "ac3.h" -#include "get_bits.h" - -/** - * Starting frequency coefficient bin for each critical band. - */ -const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 31, - 34, 37, 40, 43, 46, 49, 55, 61, 67, 73, - 79, 85, 97, 109, 121, 133, 157, 181, 205, 229, 253 -}; - -#if CONFIG_HARDCODED_TABLES - -/** - * Map each frequency coefficient bin to the critical band that contains it. - */ -const uint8_t ff_ac3_bin_to_band_tab[253] = { - 0, - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 28, 28, 29, 29, 29, 30, 30, 30, - 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, - 35, 35, 35, 35, 35, 35, 36, 36, 36, 36, 36, 36, - 37, 37, 37, 37, 37, 37, 38, 38, 38, 38, 38, 38, - 39, 39, 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, - 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49 -}; - -#else /* CONFIG_HARDCODED_TABLES */ -uint8_t ff_ac3_bin_to_band_tab[253]; -#endif - -static inline int calc_lowcomp1(int a, int b0, int b1, int c) -{ - if ((b0 + 256) == b1) { - a = c; - } else if (b0 > b1) { - a = FFMAX(a - 64, 0); - } - return a; -} - -static inline int calc_lowcomp(int a, int b0, int b1, int bin) -{ - if (bin < 7) { - return calc_lowcomp1(a, b0, b1, 384); - } else if (bin < 20) { - return calc_lowcomp1(a, b0, b1, 320); - } else { - return FFMAX(a - 128, 0); - } -} - -void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, - int16_t *band_psd) -{ - int bin, band; - - /* exponent mapping to PSD */ - for (bin = start; bin < end; bin++) { - psd[bin]=(3072 - (exp[bin] << 7)); - } - - /* PSD integration */ - bin = start; - band = ff_ac3_bin_to_band_tab[start]; - do { - int v = psd[bin++]; - int band_end = FFMIN(ff_ac3_band_start_tab[band+1], end); - for (; bin < band_end; bin++) { - int max = FFMAX(v, psd[bin]); - /* logadd */ - int adr = FFMIN(max - ((v + psd[bin] + 1) >> 1), 255); - v = max + ff_ac3_log_add_tab[adr]; - } - band_psd[band++] = v; - } while (end > ff_ac3_band_start_tab[band]); -} - -int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, - int start, int end, int fast_gain, int is_lfe, - int dba_mode, int dba_nsegs, uint8_t *dba_offsets, - uint8_t *dba_lengths, uint8_t *dba_values, - int16_t *mask) -{ - int16_t excite[AC3_CRITICAL_BANDS]; /* excitation */ - int band; - int band_start, band_end, begin, end1; - int lowcomp, fastleak, slowleak; - - /* excitation function */ - band_start = ff_ac3_bin_to_band_tab[start]; - band_end = ff_ac3_bin_to_band_tab[end-1] + 1; - - if (band_start == 0) { - lowcomp = 0; - lowcomp = calc_lowcomp1(lowcomp, band_psd[0], band_psd[1], 384); - excite[0] = band_psd[0] - fast_gain - lowcomp; - lowcomp = calc_lowcomp1(lowcomp, band_psd[1], band_psd[2], 384); - excite[1] = band_psd[1] - fast_gain - lowcomp; - begin = 7; - for (band = 2; band < 7; band++) { - if (!(is_lfe && band == 6)) - lowcomp = calc_lowcomp1(lowcomp, band_psd[band], band_psd[band+1], 384); - fastleak = band_psd[band] - fast_gain; - slowleak = band_psd[band] - s->slow_gain; - excite[band] = fastleak - lowcomp; - if (!(is_lfe && band == 6)) { - if (band_psd[band] <= band_psd[band+1]) { - begin = band + 1; - break; - } - } - } - - end1 = FFMIN(band_end, 22); - for (band = begin; band < end1; band++) { - if (!(is_lfe && band == 6)) - lowcomp = calc_lowcomp(lowcomp, band_psd[band], band_psd[band+1], band); - fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); - slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); - excite[band] = FFMAX(fastleak - lowcomp, slowleak); - } - begin = 22; - } else { - /* coupling channel */ - begin = band_start; - fastleak = (s->cpl_fast_leak << 8) + 768; - slowleak = (s->cpl_slow_leak << 8) + 768; - } - - for (band = begin; band < band_end; band++) { - fastleak = FFMAX(fastleak - s->fast_decay, band_psd[band] - fast_gain); - slowleak = FFMAX(slowleak - s->slow_decay, band_psd[band] - s->slow_gain); - excite[band] = FFMAX(fastleak, slowleak); - } - - /* compute masking curve */ - - for (band = band_start; band < band_end; band++) { - int tmp = s->db_per_bit - band_psd[band]; - if (tmp > 0) { - excite[band] += tmp >> 2; - } - mask[band] = FFMAX(ff_ac3_hearing_threshold_tab[band >> s->sr_shift][s->sr_code], excite[band]); - } - - /* delta bit allocation */ - - if (dba_mode == DBA_REUSE || dba_mode == DBA_NEW) { - int i, seg, delta; - if (dba_nsegs > 8) - return -1; - band = band_start; - for (seg = 0; seg < dba_nsegs; seg++) { - band += dba_offsets[seg]; - if (band >= AC3_CRITICAL_BANDS || dba_lengths[seg] > AC3_CRITICAL_BANDS-band) - return -1; - if (dba_values[seg] >= 4) { - delta = (dba_values[seg] - 3) << 7; - } else { - delta = (dba_values[seg] - 4) << 7; - } - for (i = 0; i < dba_lengths[seg]; i++) { - mask[band++] += delta; - } - } - } - return 0; -} - -/** - * Initialize some tables. - * note: This function must remain thread safe because it is called by the - * AVParser init code. - */ -av_cold void ff_ac3_common_init(void) -{ -#if !CONFIG_HARDCODED_TABLES - /* compute ff_ac3_bin_to_band_tab from ff_ac3_band_start_tab */ - int bin = 0, band; - for (band = 0; band < AC3_CRITICAL_BANDS; band++) { - int band_end = ff_ac3_band_start_tab[band+1]; - while (bin < band_end) - ff_ac3_bin_to_band_tab[bin++] = band; - } -#endif /* !CONFIG_HARDCODED_TABLES */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.h deleted file mode 100644 index 0cc9e2c98..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Common code between the AC-3 encoder and decoder - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Common code between the AC-3 encoder and decoder. - */ - -#ifndef AVCODEC_AC3_H -#define AVCODEC_AC3_H - -#define AC3_MAX_CODED_FRAME_SIZE 3840 /* in bytes */ -#define AC3_MAX_CHANNELS 7 /**< maximum number of channels, including coupling channel */ -#define CPL_CH 0 /**< coupling channel index */ - -#define AC3_MAX_COEFS 256 -#define AC3_BLOCK_SIZE 256 -#define AC3_MAX_BLOCKS 6 -#define AC3_FRAME_SIZE (AC3_MAX_BLOCKS * 256) -#define AC3_WINDOW_SIZE (AC3_BLOCK_SIZE * 2) -#define AC3_CRITICAL_BANDS 50 -#define AC3_MAX_CPL_BANDS 18 - -#include "libavutil/opt.h" -#include "avcodec.h" -#include "ac3tab.h" - -/* exponent encoding strategy */ -#define EXP_REUSE 0 -#define EXP_NEW 1 - -#define EXP_D15 1 -#define EXP_D25 2 -#define EXP_D45 3 - -/* pre-defined gain values */ -#define LEVEL_PLUS_3DB 1.4142135623730950 -#define LEVEL_PLUS_1POINT5DB 1.1892071150027209 -#define LEVEL_MINUS_1POINT5DB 0.8408964152537145 -#define LEVEL_MINUS_3DB 0.7071067811865476 -#define LEVEL_MINUS_4POINT5DB 0.5946035575013605 -#define LEVEL_MINUS_6DB 0.5000000000000000 -#define LEVEL_MINUS_9DB 0.3535533905932738 -#define LEVEL_ZERO 0.0000000000000000 -#define LEVEL_ONE 1.0000000000000000 - -/** Delta bit allocation strategy */ -typedef enum { - DBA_REUSE = 0, - DBA_NEW, - DBA_NONE, - DBA_RESERVED -} AC3DeltaStrategy; - -/** Channel mode (audio coding mode) */ -typedef enum { - AC3_CHMODE_DUALMONO = 0, - AC3_CHMODE_MONO, - AC3_CHMODE_STEREO, - AC3_CHMODE_3F, - AC3_CHMODE_2F1R, - AC3_CHMODE_3F1R, - AC3_CHMODE_2F2R, - AC3_CHMODE_3F2R -} AC3ChannelMode; - -/** Dolby Surround mode */ -typedef enum AC3DolbySurroundMode { - AC3_DSURMOD_NOTINDICATED = 0, - AC3_DSURMOD_OFF, - AC3_DSURMOD_ON, - AC3_DSURMOD_RESERVED -} AC3DolbySurroundMode; - -/** Dolby Surround EX mode */ -typedef enum AC3DolbySurroundEXMode { - AC3_DSUREXMOD_NOTINDICATED = 0, - AC3_DSUREXMOD_OFF, - AC3_DSUREXMOD_ON, - AC3_DSUREXMOD_PLIIZ -} AC3DolbySurroundEXMode; - -/** Dolby Headphone mode */ -typedef enum AC3DolbyHeadphoneMode { - AC3_DHEADPHONMOD_NOTINDICATED = 0, - AC3_DHEADPHONMOD_OFF, - AC3_DHEADPHONMOD_ON, - AC3_DHEADPHONMOD_RESERVED -} AC3DolbyHeadphoneMode; - -/** Preferred Stereo Downmix mode */ -typedef enum AC3PreferredStereoDownmixMode { - AC3_DMIXMOD_NOTINDICATED = 0, - AC3_DMIXMOD_LTRT, - AC3_DMIXMOD_LORO, - AC3_DMIXMOD_DPLII // reserved value in A/52, but used by encoders to indicate DPL2 -} AC3PreferredStereoDownmixMode; - -typedef struct AC3BitAllocParameters { - int sr_code; - int sr_shift; - int slow_gain, slow_decay, fast_decay, db_per_bit, floor; - int cpl_fast_leak, cpl_slow_leak; -} AC3BitAllocParameters; - -/** - * @struct AC3HeaderInfo - * Coded AC-3 header values up to the lfeon element, plus derived values. - */ -typedef struct AC3HeaderInfo { - /** @name Coded elements - * @{ - */ - uint16_t sync_word; - uint16_t crc1; - uint8_t sr_code; - uint8_t bitstream_id; - uint8_t bitstream_mode; - uint8_t channel_mode; - uint8_t lfe_on; - uint8_t frame_type; - int substreamid; ///< substream identification - int center_mix_level; ///< Center mix level index - int surround_mix_level; ///< Surround mix level index - uint16_t channel_map; - int num_blocks; ///< number of audio blocks -#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI - int dolby_surround_mode; -#endif - /** @} */ - - /** @name Derived values - * @{ - */ - uint8_t sr_shift; - uint16_t sample_rate; - uint32_t bit_rate; - uint8_t channels; - uint16_t frame_size; - uint64_t channel_layout; - /** @} */ -#if !AV_HAVE_INCOMPATIBLE_LIBAV_ABI - int dolby_surround_mode; -#endif -} AC3HeaderInfo; - -typedef enum { - EAC3_FRAME_TYPE_INDEPENDENT = 0, - EAC3_FRAME_TYPE_DEPENDENT, - EAC3_FRAME_TYPE_AC3_CONVERT, - EAC3_FRAME_TYPE_RESERVED -} EAC3FrameType; - -void ff_ac3_common_init(void); - -/** - * Calculate the log power-spectral density of the input signal. - * This gives a rough estimate of signal power in the frequency domain by using - * the spectral envelope (exponents). The psd is also separately grouped - * into critical bands for use in the calculating the masking curve. - * 128 units in psd = -6 dB. The dbknee parameter in AC3BitAllocParameters - * determines the reference level. - * - * @param[in] exp frequency coefficient exponents - * @param[in] start starting bin location - * @param[in] end ending bin location - * @param[out] psd signal power for each frequency bin - * @param[out] band_psd signal power for each critical band - */ -void ff_ac3_bit_alloc_calc_psd(int8_t *exp, int start, int end, int16_t *psd, - int16_t *band_psd); - -/** - * Calculate the masking curve. - * First, the excitation is calculated using parameters in s and the signal - * power in each critical band. The excitation is compared with a predefined - * hearing threshold table to produce the masking curve. If delta bit - * allocation information is provided, it is used for adjusting the masking - * curve, usually to give a closer match to a better psychoacoustic model. - * - * @param[in] s adjustable bit allocation parameters - * @param[in] band_psd signal power for each critical band - * @param[in] start starting bin location - * @param[in] end ending bin location - * @param[in] fast_gain fast gain (estimated signal-to-mask ratio) - * @param[in] is_lfe whether or not the channel being processed is the LFE - * @param[in] dba_mode delta bit allocation mode (none, reuse, or new) - * @param[in] dba_nsegs number of delta segments - * @param[in] dba_offsets location offsets for each segment - * @param[in] dba_lengths length of each segment - * @param[in] dba_values delta bit allocation for each segment - * @param[out] mask calculated masking curve - * @return returns 0 for success, non-zero for error - */ -int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, - int start, int end, int fast_gain, int is_lfe, - int dba_mode, int dba_nsegs, uint8_t *dba_offsets, - uint8_t *dba_lengths, uint8_t *dba_values, - int16_t *mask); - -#endif /* AVCODEC_AC3_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.c deleted file mode 100644 index dd6d77c9a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * AC-3 parser - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/channel_layout.h" -#include "parser.h" -#include "ac3_parser.h" -#include "aac_ac3_parser.h" -#include "get_bits.h" - - -#define AC3_HEADER_SIZE 7 - - -static const uint8_t eac3_blocks[4] = { - 1, 2, 3, 6 -}; - -/** - * Table for center mix levels - * reference: Section 5.4.2.4 cmixlev - */ -static const uint8_t center_levels[4] = { 4, 5, 6, 5 }; - -/** - * Table for surround mix levels - * reference: Section 5.4.2.5 surmixlev - */ -static const uint8_t surround_levels[4] = { 4, 6, 7, 6 }; - - -int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **phdr) -{ - int frame_size_code; - AC3HeaderInfo *hdr; - - if (!*phdr) - *phdr = av_mallocz(sizeof(AC3HeaderInfo)); - if (!*phdr) - return AVERROR(ENOMEM); - hdr = *phdr; - - memset(hdr, 0, sizeof(*hdr)); - - hdr->sync_word = get_bits(gbc, 16); - if(hdr->sync_word != 0x0B77) - return AAC_AC3_PARSE_ERROR_SYNC; - - /* read ahead to bsid to distinguish between AC-3 and E-AC-3 */ - hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F; - if(hdr->bitstream_id > 16) - return AAC_AC3_PARSE_ERROR_BSID; - - hdr->num_blocks = 6; - - /* set default mix levels */ - hdr->center_mix_level = 5; // -4.5dB - hdr->surround_mix_level = 6; // -6.0dB - - /* set default dolby surround mode */ - hdr->dolby_surround_mode = AC3_DSURMOD_NOTINDICATED; - - if(hdr->bitstream_id <= 10) { - /* Normal AC-3 */ - hdr->crc1 = get_bits(gbc, 16); - hdr->sr_code = get_bits(gbc, 2); - if(hdr->sr_code == 3) - return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; - - frame_size_code = get_bits(gbc, 6); - if(frame_size_code > 37) - return AAC_AC3_PARSE_ERROR_FRAME_SIZE; - - skip_bits(gbc, 5); // skip bsid, already got it - - hdr->bitstream_mode = get_bits(gbc, 3); - hdr->channel_mode = get_bits(gbc, 3); - - if(hdr->channel_mode == AC3_CHMODE_STEREO) { - hdr->dolby_surround_mode = get_bits(gbc, 2); - } else { - if((hdr->channel_mode & 1) && hdr->channel_mode != AC3_CHMODE_MONO) - hdr-> center_mix_level = center_levels[get_bits(gbc, 2)]; - if(hdr->channel_mode & 4) - hdr->surround_mix_level = surround_levels[get_bits(gbc, 2)]; - } - hdr->lfe_on = get_bits1(gbc); - - hdr->sr_shift = FFMAX(hdr->bitstream_id, 8) - 8; - hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code] >> hdr->sr_shift; - hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift; - hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; - hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2; - hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT; - hdr->substreamid = 0; - } else { - /* Enhanced AC-3 */ - hdr->crc1 = 0; - hdr->frame_type = get_bits(gbc, 2); - if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED) - return AAC_AC3_PARSE_ERROR_FRAME_TYPE; - - hdr->substreamid = get_bits(gbc, 3); - - hdr->frame_size = (get_bits(gbc, 11) + 1) << 1; - if(hdr->frame_size < AC3_HEADER_SIZE) - return AAC_AC3_PARSE_ERROR_FRAME_SIZE; - - hdr->sr_code = get_bits(gbc, 2); - if (hdr->sr_code == 3) { - int sr_code2 = get_bits(gbc, 2); - if(sr_code2 == 3) - return AAC_AC3_PARSE_ERROR_SAMPLE_RATE; - hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2; - hdr->sr_shift = 1; - } else { - hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)]; - hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code]; - hdr->sr_shift = 0; - } - - hdr->channel_mode = get_bits(gbc, 3); - hdr->lfe_on = get_bits1(gbc); - - hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate / - (hdr->num_blocks * 256.0)); - hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on; - } - hdr->channel_layout = avpriv_ac3_channel_layout_tab[hdr->channel_mode]; - if (hdr->lfe_on) - hdr->channel_layout |= AV_CH_LOW_FREQUENCY; - - return 0; -} - -int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr) -{ - AC3HeaderInfo tmp, *ptmp = &tmp; - int ret = avpriv_ac3_parse_header2(gbc, &ptmp); - - memcpy(hdr, ptmp, ((intptr_t)&tmp.channel_layout) - ((intptr_t)&tmp) + sizeof(uint64_t)); - return ret; -} - -static int ac3_sync(uint64_t state, AACAC3ParseContext *hdr_info, - int *need_next_header, int *new_frame_start) -{ - int err; - union { - uint64_t u64; - uint8_t u8[8]; - } tmp = { av_be2ne64(state) }; - AC3HeaderInfo hdr, *phdr = &hdr; - GetBitContext gbc; - - init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54); - err = avpriv_ac3_parse_header2(&gbc, &phdr); - - if(err < 0) - return 0; - - hdr_info->sample_rate = hdr.sample_rate; - hdr_info->bit_rate = hdr.bit_rate; - hdr_info->channels = hdr.channels; - hdr_info->channel_layout = hdr.channel_layout; - hdr_info->samples = hdr.num_blocks * 256; - hdr_info->service_type = hdr.bitstream_mode; - if (hdr.bitstream_mode == 0x7 && hdr.channels > 1) - hdr_info->service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; - if(hdr.bitstream_id>10) - hdr_info->codec_id = AV_CODEC_ID_EAC3; - else if (hdr_info->codec_id == AV_CODEC_ID_NONE) - hdr_info->codec_id = AV_CODEC_ID_AC3; - - *need_next_header = (hdr.frame_type != EAC3_FRAME_TYPE_AC3_CONVERT); - *new_frame_start = (hdr.frame_type != EAC3_FRAME_TYPE_DEPENDENT); - return hdr.frame_size; -} - -static av_cold int ac3_parse_init(AVCodecParserContext *s1) -{ - AACAC3ParseContext *s = s1->priv_data; - s->header_size = AC3_HEADER_SIZE; - s->sync = ac3_sync; - return 0; -} - - -AVCodecParser ff_ac3_parser = { - .codec_ids = { AV_CODEC_ID_AC3, AV_CODEC_ID_EAC3 }, - .priv_data_size = sizeof(AACAC3ParseContext), - .parser_init = ac3_parse_init, - .parser_parse = ff_aac_ac3_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.h deleted file mode 100644 index f37387d76..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3_parser.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * AC-3 parser prototypes - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AC3_PARSER_H -#define AVCODEC_AC3_PARSER_H - -#include "ac3.h" -#include "get_bits.h" - -/** - * Parse AC-3 frame header. - * Parse the header up to the lfeon element, which is the first 52 or 54 bits - * depending on the audio coding mode. - * @param[in] gbc BitContext containing the first 54 bits of the frame. - * @param[out] hdr Pointer to Pointer to struct where header info is written. - * will be allocated if NULL - * @return Returns 0 on success, -1 if there is a sync word mismatch, - * -2 if the bsid (version) element is invalid, -3 if the fscod (sample rate) - * element is invalid, or -4 if the frmsizecod (bit rate) element is invalid. - */ -int avpriv_ac3_parse_header2(GetBitContext *gbc, AC3HeaderInfo **hdr); - -int avpriv_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr); - -#endif /* AVCODEC_AC3_PARSER_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.c deleted file mode 100644 index 7d5e4b5db..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.c +++ /dev/null @@ -1,1606 +0,0 @@ -/* - * AC-3 Audio Decoder - * This code was developed as part of Google Summer of Code 2006. - * E-AC-3 support was added as part of Google Summer of Code 2007. - * - * Copyright (c) 2006 Kartikey Mahendra BHATT (bhattkm at gmail dot com) - * Copyright (c) 2007-2008 Bartlomiej Wolowiec - * Copyright (c) 2007 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/crc.h" -#include "libavutil/downmix_info.h" -#include "libavutil/opt.h" -#include "libavutil/internal.h" -#include "internal.h" -#include "aac_ac3_parser.h" -#include "ac3_parser.h" -#include "ac3dec.h" -#include "ac3dec_data.h" -#include "kbdwin.h" - -/** - * table for ungrouping 3 values in 7 bits. - * used for exponents and bap=2 mantissas - */ -static uint8_t ungroup_3_in_7_bits_tab[128][3]; - -/** tables for ungrouping mantissas */ -static int b1_mantissas[32][3]; -static int b2_mantissas[128][3]; -static int b3_mantissas[8]; -static int b4_mantissas[128][2]; -static int b5_mantissas[16]; - -/** - * Quantization table: levels for symmetric. bits for asymmetric. - * reference: Table 7.18 Mapping of bap to Quantizer - */ -static const uint8_t quantization_tab[16] = { - 0, 3, 5, 7, 11, 15, - 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 -}; - -/** dynamic range table. converts codes to scale factors. */ -static float dynamic_range_tab[256]; - -/** Adjustments in dB gain */ -static const float gain_levels[9] = { - LEVEL_PLUS_3DB, - LEVEL_PLUS_1POINT5DB, - LEVEL_ONE, - LEVEL_MINUS_1POINT5DB, - LEVEL_MINUS_3DB, - LEVEL_MINUS_4POINT5DB, - LEVEL_MINUS_6DB, - LEVEL_ZERO, - LEVEL_MINUS_9DB -}; - -/** Adjustments in dB gain (LFE, +10 to -21 dB) */ -static const float gain_levels_lfe[32] = { - 3.162275, 2.818382, 2.511886, 2.238719, 1.995261, 1.778278, 1.584893, - 1.412536, 1.258924, 1.122018, 1.000000, 0.891251, 0.794328, 0.707946, - 0.630957, 0.562341, 0.501187, 0.446683, 0.398107, 0.354813, 0.316227, - 0.281838, 0.251188, 0.223872, 0.199526, 0.177828, 0.158489, 0.141253, - 0.125892, 0.112201, 0.100000, 0.089125 -}; - -/** - * Table for default stereo downmixing coefficients - * reference: Section 7.8.2 Downmixing Into Two Channels - */ -static const uint8_t ac3_default_coeffs[8][5][2] = { - { { 2, 7 }, { 7, 2 }, }, - { { 4, 4 }, }, - { { 2, 7 }, { 7, 2 }, }, - { { 2, 7 }, { 5, 5 }, { 7, 2 }, }, - { { 2, 7 }, { 7, 2 }, { 6, 6 }, }, - { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 8, 8 }, }, - { { 2, 7 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, }, - { { 2, 7 }, { 5, 5 }, { 7, 2 }, { 6, 7 }, { 7, 6 }, }, -}; - -/** - * Symmetrical Dequantization - * reference: Section 7.3.3 Expansion of Mantissas for Symmetrical Quantization - * Tables 7.19 to 7.23 - */ -static inline int -symmetric_dequant(int code, int levels) -{ - return ((code - (levels >> 1)) << 24) / levels; -} - -/* - * Initialize tables at runtime. - */ -static av_cold void ac3_tables_init(void) -{ - int i; - - /* generate table for ungrouping 3 values in 7 bits - reference: Section 7.1.3 Exponent Decoding */ - for (i = 0; i < 128; i++) { - ungroup_3_in_7_bits_tab[i][0] = i / 25; - ungroup_3_in_7_bits_tab[i][1] = (i % 25) / 5; - ungroup_3_in_7_bits_tab[i][2] = (i % 25) % 5; - } - - /* generate grouped mantissa tables - reference: Section 7.3.5 Ungrouping of Mantissas */ - for (i = 0; i < 32; i++) { - /* bap=1 mantissas */ - b1_mantissas[i][0] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][0], 3); - b1_mantissas[i][1] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][1], 3); - b1_mantissas[i][2] = symmetric_dequant(ff_ac3_ungroup_3_in_5_bits_tab[i][2], 3); - } - for (i = 0; i < 128; i++) { - /* bap=2 mantissas */ - b2_mantissas[i][0] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][0], 5); - b2_mantissas[i][1] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][1], 5); - b2_mantissas[i][2] = symmetric_dequant(ungroup_3_in_7_bits_tab[i][2], 5); - - /* bap=4 mantissas */ - b4_mantissas[i][0] = symmetric_dequant(i / 11, 11); - b4_mantissas[i][1] = symmetric_dequant(i % 11, 11); - } - /* generate ungrouped mantissa tables - reference: Tables 7.21 and 7.23 */ - for (i = 0; i < 7; i++) { - /* bap=3 mantissas */ - b3_mantissas[i] = symmetric_dequant(i, 7); - } - for (i = 0; i < 15; i++) { - /* bap=5 mantissas */ - b5_mantissas[i] = symmetric_dequant(i, 15); - } - - /* generate dynamic range table - reference: Section 7.7.1 Dynamic Range Control */ - for (i = 0; i < 256; i++) { - int v = (i >> 5) - ((i >> 7) << 3) - 5; - dynamic_range_tab[i] = powf(2.0f, v) * ((i & 0x1F) | 0x20); - } -} - -/** - * AVCodec initialization - */ -static av_cold int ac3_decode_init(AVCodecContext *avctx) -{ - AC3DecodeContext *s = avctx->priv_data; - int i; - - s->avctx = avctx; - - ff_ac3_common_init(); - ac3_tables_init(); - ff_mdct_init(&s->imdct_256, 8, 1, 1.0); - ff_mdct_init(&s->imdct_512, 9, 1, 1.0); - ff_kbd_window_init(s->window, 5.0, 256); - ff_dsputil_init(&s->dsp, avctx); - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT); - ff_fmt_convert_init(&s->fmt_conv, avctx); - av_lfg_init(&s->dith_state, 0); - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - /* allow downmixing to stereo or mono */ -#if FF_API_REQUEST_CHANNELS -FF_DISABLE_DEPRECATION_WARNINGS - if (avctx->request_channels == 1) - avctx->request_channel_layout = AV_CH_LAYOUT_MONO; - else if (avctx->request_channels == 2) - avctx->request_channel_layout = AV_CH_LAYOUT_STEREO; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (avctx->channels > 1 && - avctx->request_channel_layout == AV_CH_LAYOUT_MONO) - avctx->channels = 1; - else if (avctx->channels > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) - avctx->channels = 2; - s->downmixed = 1; - - for (i = 0; i < AC3_MAX_CHANNELS; i++) { - s->xcfptr[i] = s->transform_coeffs[i]; - s->dlyptr[i] = s->delay[i]; - } - - return 0; -} - -/** - * Parse the 'sync info' and 'bit stream info' from the AC-3 bitstream. - * GetBitContext within AC3DecodeContext must point to - * the start of the synchronized AC-3 bitstream. - */ -static int ac3_parse_header(AC3DecodeContext *s) -{ - GetBitContext *gbc = &s->gbc; - int i; - - /* read the rest of the bsi. read twice for dual mono mode. */ - i = !s->channel_mode; - do { - skip_bits(gbc, 5); // skip dialog normalization - if (get_bits1(gbc)) - skip_bits(gbc, 8); //skip compression - if (get_bits1(gbc)) - skip_bits(gbc, 8); //skip language code - if (get_bits1(gbc)) - skip_bits(gbc, 7); //skip audio production information - } while (i--); - - skip_bits(gbc, 2); //skip copyright bit and original bitstream bit - - /* skip the timecodes or parse the Alternate Bit Stream Syntax */ - if (s->bitstream_id != 6) { - if (get_bits1(gbc)) - skip_bits(gbc, 14); //skip timecode1 - if (get_bits1(gbc)) - skip_bits(gbc, 14); //skip timecode2 - } else { - if (get_bits1(gbc)) { - s->preferred_downmix = get_bits(gbc, 2); - s->center_mix_level_ltrt = get_bits(gbc, 3); - s->surround_mix_level_ltrt = av_clip(get_bits(gbc, 3), 3, 7); - s->center_mix_level = get_bits(gbc, 3); - s->surround_mix_level = av_clip(get_bits(gbc, 3), 3, 7); - } - if (get_bits1(gbc)) { - s->dolby_surround_ex_mode = get_bits(gbc, 2); - s->dolby_headphone_mode = get_bits(gbc, 2); - skip_bits(gbc, 10); // skip adconvtyp (1), xbsi2 (8), encinfo (1) - } - } - - /* skip additional bitstream info */ - if (get_bits1(gbc)) { - i = get_bits(gbc, 6); - do { - skip_bits(gbc, 8); - } while (i--); - } - - return 0; -} - -/** - * Common function to parse AC-3 or E-AC-3 frame header - */ -static int parse_frame_header(AC3DecodeContext *s) -{ - AC3HeaderInfo hdr, *phdr=&hdr; - int err; - - err = avpriv_ac3_parse_header2(&s->gbc, &phdr); - if (err) - return err; - - /* get decoding parameters from header info */ - s->bit_alloc_params.sr_code = hdr.sr_code; - s->bitstream_id = hdr.bitstream_id; - s->bitstream_mode = hdr.bitstream_mode; - s->channel_mode = hdr.channel_mode; - s->lfe_on = hdr.lfe_on; - s->bit_alloc_params.sr_shift = hdr.sr_shift; - s->sample_rate = hdr.sample_rate; - s->bit_rate = hdr.bit_rate; - s->channels = hdr.channels; - s->fbw_channels = s->channels - s->lfe_on; - s->lfe_ch = s->fbw_channels + 1; - s->frame_size = hdr.frame_size; - s->preferred_downmix = AC3_DMIXMOD_NOTINDICATED; - s->center_mix_level = hdr.center_mix_level; - s->center_mix_level_ltrt = 4; // -3.0dB - s->surround_mix_level = hdr.surround_mix_level; - s->surround_mix_level_ltrt = 4; // -3.0dB - s->lfe_mix_level_exists = 0; - s->num_blocks = hdr.num_blocks; - s->frame_type = hdr.frame_type; - s->substreamid = hdr.substreamid; - s->dolby_surround_mode = hdr.dolby_surround_mode; - s->dolby_surround_ex_mode = AC3_DSUREXMOD_NOTINDICATED; - s->dolby_headphone_mode = AC3_DHEADPHONMOD_NOTINDICATED; - - if (s->lfe_on) { - s->start_freq[s->lfe_ch] = 0; - s->end_freq[s->lfe_ch] = 7; - s->num_exp_groups[s->lfe_ch] = 2; - s->channel_in_cpl[s->lfe_ch] = 0; - } - - if (s->bitstream_id <= 10) { - s->eac3 = 0; - s->snr_offset_strategy = 2; - s->block_switch_syntax = 1; - s->dither_flag_syntax = 1; - s->bit_allocation_syntax = 1; - s->fast_gain_syntax = 0; - s->first_cpl_leak = 0; - s->dba_syntax = 1; - s->skip_syntax = 1; - memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht)); - return ac3_parse_header(s); - } else if (CONFIG_EAC3_DECODER) { - s->eac3 = 1; - return ff_eac3_parse_header(s); - } else { - av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n"); - return AVERROR(ENOSYS); - } -} - -/** - * Set stereo downmixing coefficients based on frame header info. - * reference: Section 7.8.2 Downmixing Into Two Channels - */ -static void set_downmix_coeffs(AC3DecodeContext *s) -{ - int i; - float cmix = gain_levels[s-> center_mix_level]; - float smix = gain_levels[s->surround_mix_level]; - float norm0, norm1; - - for (i = 0; i < s->fbw_channels; i++) { - s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]]; - s->downmix_coeffs[i][1] = gain_levels[ac3_default_coeffs[s->channel_mode][i][1]]; - } - if (s->channel_mode > 1 && s->channel_mode & 1) { - s->downmix_coeffs[1][0] = s->downmix_coeffs[1][1] = cmix; - } - if (s->channel_mode == AC3_CHMODE_2F1R || s->channel_mode == AC3_CHMODE_3F1R) { - int nf = s->channel_mode - 2; - s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf][1] = smix * LEVEL_MINUS_3DB; - } - if (s->channel_mode == AC3_CHMODE_2F2R || s->channel_mode == AC3_CHMODE_3F2R) { - int nf = s->channel_mode - 4; - s->downmix_coeffs[nf][0] = s->downmix_coeffs[nf+1][1] = smix; - } - - /* renormalize */ - norm0 = norm1 = 0.0; - for (i = 0; i < s->fbw_channels; i++) { - norm0 += s->downmix_coeffs[i][0]; - norm1 += s->downmix_coeffs[i][1]; - } - norm0 = 1.0f / norm0; - norm1 = 1.0f / norm1; - for (i = 0; i < s->fbw_channels; i++) { - s->downmix_coeffs[i][0] *= norm0; - s->downmix_coeffs[i][1] *= norm1; - } - - if (s->output_mode == AC3_CHMODE_MONO) { - for (i = 0; i < s->fbw_channels; i++) - s->downmix_coeffs[i][0] = (s->downmix_coeffs[i][0] + - s->downmix_coeffs[i][1]) * LEVEL_MINUS_3DB; - } -} - -/** - * Decode the grouped exponents according to exponent strategy. - * reference: Section 7.1.3 Exponent Decoding - */ -static int decode_exponents(GetBitContext *gbc, int exp_strategy, int ngrps, - uint8_t absexp, int8_t *dexps) -{ - int i, j, grp, group_size; - int dexp[256]; - int expacc, prevexp; - - /* unpack groups */ - group_size = exp_strategy + (exp_strategy == EXP_D45); - for (grp = 0, i = 0; grp < ngrps; grp++) { - expacc = get_bits(gbc, 7); - dexp[i++] = ungroup_3_in_7_bits_tab[expacc][0]; - dexp[i++] = ungroup_3_in_7_bits_tab[expacc][1]; - dexp[i++] = ungroup_3_in_7_bits_tab[expacc][2]; - } - - /* convert to absolute exps and expand groups */ - prevexp = absexp; - for (i = 0, j = 0; i < ngrps * 3; i++) { - prevexp += dexp[i] - 2; - if (prevexp > 24U) - return -1; - switch (group_size) { - case 4: dexps[j++] = prevexp; - dexps[j++] = prevexp; - case 2: dexps[j++] = prevexp; - case 1: dexps[j++] = prevexp; - } - } - return 0; -} - -/** - * Generate transform coefficients for each coupled channel in the coupling - * range using the coupling coefficients and coupling coordinates. - * reference: Section 7.4.3 Coupling Coordinate Format - */ -static void calc_transform_coeffs_cpl(AC3DecodeContext *s) -{ - int bin, band, ch; - - bin = s->start_freq[CPL_CH]; - for (band = 0; band < s->num_cpl_bands; band++) { - int band_start = bin; - int band_end = bin + s->cpl_band_sizes[band]; - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (s->channel_in_cpl[ch]) { - int cpl_coord = s->cpl_coords[ch][band] << 5; - for (bin = band_start; bin < band_end; bin++) { - s->fixed_coeffs[ch][bin] = - MULH(s->fixed_coeffs[CPL_CH][bin] << 4, cpl_coord); - } - if (ch == 2 && s->phase_flags[band]) { - for (bin = band_start; bin < band_end; bin++) - s->fixed_coeffs[2][bin] = -s->fixed_coeffs[2][bin]; - } - } - } - bin = band_end; - } -} - -/** - * Grouped mantissas for 3-level 5-level and 11-level quantization - */ -typedef struct { - int b1_mant[2]; - int b2_mant[2]; - int b4_mant; - int b1; - int b2; - int b4; -} mant_groups; - -/** - * Decode the transform coefficients for a particular channel - * reference: Section 7.3 Quantization and Decoding of Mantissas - */ -static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, mant_groups *m) -{ - int start_freq = s->start_freq[ch_index]; - int end_freq = s->end_freq[ch_index]; - uint8_t *baps = s->bap[ch_index]; - int8_t *exps = s->dexps[ch_index]; - int32_t *coeffs = s->fixed_coeffs[ch_index]; - int dither = (ch_index == CPL_CH) || s->dither_flag[ch_index]; - GetBitContext *gbc = &s->gbc; - int freq; - - for (freq = start_freq; freq < end_freq; freq++) { - int bap = baps[freq]; - int mantissa; - switch (bap) { - case 0: - /* random noise with approximate range of -0.707 to 0.707 */ - if (dither) - mantissa = (((av_lfg_get(&s->dith_state)>>8)*181)>>8) - 5931008; - else - mantissa = 0; - break; - case 1: - if (m->b1) { - m->b1--; - mantissa = m->b1_mant[m->b1]; - } else { - int bits = get_bits(gbc, 5); - mantissa = b1_mantissas[bits][0]; - m->b1_mant[1] = b1_mantissas[bits][1]; - m->b1_mant[0] = b1_mantissas[bits][2]; - m->b1 = 2; - } - break; - case 2: - if (m->b2) { - m->b2--; - mantissa = m->b2_mant[m->b2]; - } else { - int bits = get_bits(gbc, 7); - mantissa = b2_mantissas[bits][0]; - m->b2_mant[1] = b2_mantissas[bits][1]; - m->b2_mant[0] = b2_mantissas[bits][2]; - m->b2 = 2; - } - break; - case 3: - mantissa = b3_mantissas[get_bits(gbc, 3)]; - break; - case 4: - if (m->b4) { - m->b4 = 0; - mantissa = m->b4_mant; - } else { - int bits = get_bits(gbc, 7); - mantissa = b4_mantissas[bits][0]; - m->b4_mant = b4_mantissas[bits][1]; - m->b4 = 1; - } - break; - case 5: - mantissa = b5_mantissas[get_bits(gbc, 4)]; - break; - default: /* 6 to 15 */ - /* Shift mantissa and sign-extend it. */ - if (bap > 15) { - av_log(s->avctx, AV_LOG_ERROR, "bap %d is invalid in plain AC-3\n", bap); - bap = 15; - } - mantissa = get_sbits(gbc, quantization_tab[bap]); - mantissa <<= 24 - quantization_tab[bap]; - break; - } - coeffs[freq] = mantissa >> exps[freq]; - } -} - -/** - * Remove random dithering from coupling range coefficients with zero-bit - * mantissas for coupled channels which do not use dithering. - * reference: Section 7.3.4 Dither for Zero Bit Mantissas (bap=0) - */ -static void remove_dithering(AC3DecodeContext *s) { - int ch, i; - - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (!s->dither_flag[ch] && s->channel_in_cpl[ch]) { - for (i = s->start_freq[CPL_CH]; i < s->end_freq[CPL_CH]; i++) { - if (!s->bap[CPL_CH][i]) - s->fixed_coeffs[ch][i] = 0; - } - } - } -} - -static void decode_transform_coeffs_ch(AC3DecodeContext *s, int blk, int ch, - mant_groups *m) -{ - if (!s->channel_uses_aht[ch]) { - ac3_decode_transform_coeffs_ch(s, ch, m); - } else { - /* if AHT is used, mantissas for all blocks are encoded in the first - block of the frame. */ - int bin; - if (!blk && CONFIG_EAC3_DECODER) - ff_eac3_decode_transform_coeffs_aht_ch(s, ch); - for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { - s->fixed_coeffs[ch][bin] = s->pre_mantissa[ch][bin][blk] >> s->dexps[ch][bin]; - } - } -} - -/** - * Decode the transform coefficients. - */ -static void decode_transform_coeffs(AC3DecodeContext *s, int blk) -{ - int ch, end; - int got_cplchan = 0; - mant_groups m; - - m.b1 = m.b2 = m.b4 = 0; - - for (ch = 1; ch <= s->channels; ch++) { - /* transform coefficients for full-bandwidth channel */ - decode_transform_coeffs_ch(s, blk, ch, &m); - /* transform coefficients for coupling channel come right after the - coefficients for the first coupled channel*/ - if (s->channel_in_cpl[ch]) { - if (!got_cplchan) { - decode_transform_coeffs_ch(s, blk, CPL_CH, &m); - calc_transform_coeffs_cpl(s); - got_cplchan = 1; - } - end = s->end_freq[CPL_CH]; - } else { - end = s->end_freq[ch]; - } - do - s->fixed_coeffs[ch][end] = 0; - while (++end < 256); - } - - /* zero the dithered coefficients for appropriate channels */ - remove_dithering(s); -} - -/** - * Stereo rematrixing. - * reference: Section 7.5.4 Rematrixing : Decoding Technique - */ -static void do_rematrixing(AC3DecodeContext *s) -{ - int bnd, i; - int end, bndend; - - end = FFMIN(s->end_freq[1], s->end_freq[2]); - - for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) { - if (s->rematrixing_flags[bnd]) { - bndend = FFMIN(end, ff_ac3_rematrix_band_tab[bnd + 1]); - for (i = ff_ac3_rematrix_band_tab[bnd]; i < bndend; i++) { - int tmp0 = s->fixed_coeffs[1][i]; - s->fixed_coeffs[1][i] += s->fixed_coeffs[2][i]; - s->fixed_coeffs[2][i] = tmp0 - s->fixed_coeffs[2][i]; - } - } - } -} - -/** - * Inverse MDCT Transform. - * Convert frequency domain coefficients to time-domain audio samples. - * reference: Section 7.9.4 Transformation Equations - */ -static inline void do_imdct(AC3DecodeContext *s, int channels) -{ - int ch; - - for (ch = 1; ch <= channels; ch++) { - if (s->block_switch[ch]) { - int i; - float *x = s->tmp_output + 128; - for (i = 0; i < 128; i++) - x[i] = s->transform_coeffs[ch][2 * i]; - s->imdct_256.imdct_half(&s->imdct_256, s->tmp_output, x); - s->fdsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1], - s->tmp_output, s->window, 128); - for (i = 0; i < 128; i++) - x[i] = s->transform_coeffs[ch][2 * i + 1]; - s->imdct_256.imdct_half(&s->imdct_256, s->delay[ch - 1], x); - } else { - s->imdct_512.imdct_half(&s->imdct_512, s->tmp_output, s->transform_coeffs[ch]); - s->fdsp.vector_fmul_window(s->outptr[ch - 1], s->delay[ch - 1], - s->tmp_output, s->window, 128); - memcpy(s->delay[ch - 1], s->tmp_output + 128, 128 * sizeof(float)); - } - } -} - -/** - * Upmix delay samples from stereo to original channel layout. - */ -static void ac3_upmix_delay(AC3DecodeContext *s) -{ - int channel_data_size = sizeof(s->delay[0]); - switch (s->channel_mode) { - case AC3_CHMODE_DUALMONO: - case AC3_CHMODE_STEREO: - /* upmix mono to stereo */ - memcpy(s->delay[1], s->delay[0], channel_data_size); - break; - case AC3_CHMODE_2F2R: - memset(s->delay[3], 0, channel_data_size); - case AC3_CHMODE_2F1R: - memset(s->delay[2], 0, channel_data_size); - break; - case AC3_CHMODE_3F2R: - memset(s->delay[4], 0, channel_data_size); - case AC3_CHMODE_3F1R: - memset(s->delay[3], 0, channel_data_size); - case AC3_CHMODE_3F: - memcpy(s->delay[2], s->delay[1], channel_data_size); - memset(s->delay[1], 0, channel_data_size); - break; - } -} - -/** - * Decode band structure for coupling, spectral extension, or enhanced coupling. - * The band structure defines how many subbands are in each band. For each - * subband in the range, 1 means it is combined with the previous band, and 0 - * means that it starts a new band. - * - * @param[in] gbc bit reader context - * @param[in] blk block number - * @param[in] eac3 flag to indicate E-AC-3 - * @param[in] ecpl flag to indicate enhanced coupling - * @param[in] start_subband subband number for start of range - * @param[in] end_subband subband number for end of range - * @param[in] default_band_struct default band structure table - * @param[out] num_bands number of bands (optionally NULL) - * @param[out] band_sizes array containing the number of bins in each band (optionally NULL) - */ -static void decode_band_structure(GetBitContext *gbc, int blk, int eac3, - int ecpl, int start_subband, int end_subband, - const uint8_t *default_band_struct, - int *num_bands, uint8_t *band_sizes) -{ - int subbnd, bnd, n_subbands, n_bands=0; - uint8_t bnd_sz[22]; - uint8_t coded_band_struct[22]; - const uint8_t *band_struct; - - n_subbands = end_subband - start_subband; - - /* decode band structure from bitstream or use default */ - if (!eac3 || get_bits1(gbc)) { - for (subbnd = 0; subbnd < n_subbands - 1; subbnd++) { - coded_band_struct[subbnd] = get_bits1(gbc); - } - band_struct = coded_band_struct; - } else if (!blk) { - band_struct = &default_band_struct[start_subband+1]; - } else { - /* no change in band structure */ - return; - } - - /* calculate number of bands and band sizes based on band structure. - note that the first 4 subbands in enhanced coupling span only 6 bins - instead of 12. */ - if (num_bands || band_sizes ) { - n_bands = n_subbands; - bnd_sz[0] = ecpl ? 6 : 12; - for (bnd = 0, subbnd = 1; subbnd < n_subbands; subbnd++) { - int subbnd_size = (ecpl && subbnd < 4) ? 6 : 12; - if (band_struct[subbnd - 1]) { - n_bands--; - bnd_sz[bnd] += subbnd_size; - } else { - bnd_sz[++bnd] = subbnd_size; - } - } - } - - /* set optional output params */ - if (num_bands) - *num_bands = n_bands; - if (band_sizes) - memcpy(band_sizes, bnd_sz, n_bands); -} - -/** - * Decode a single audio block from the AC-3 bitstream. - */ -static int decode_audio_block(AC3DecodeContext *s, int blk) -{ - int fbw_channels = s->fbw_channels; - int channel_mode = s->channel_mode; - int i, bnd, seg, ch; - int different_transforms; - int downmix_output; - int cpl_in_use; - GetBitContext *gbc = &s->gbc; - uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 }; - - /* block switch flags */ - different_transforms = 0; - if (s->block_switch_syntax) { - for (ch = 1; ch <= fbw_channels; ch++) { - s->block_switch[ch] = get_bits1(gbc); - if (ch > 1 && s->block_switch[ch] != s->block_switch[1]) - different_transforms = 1; - } - } - - /* dithering flags */ - if (s->dither_flag_syntax) { - for (ch = 1; ch <= fbw_channels; ch++) { - s->dither_flag[ch] = get_bits1(gbc); - } - } - - /* dynamic range */ - i = !s->channel_mode; - do { - if (get_bits1(gbc)) { - /* Allow asymmetric application of DRC when drc_scale > 1. - Amplification of quiet sounds is enhanced */ - float range = dynamic_range_tab[get_bits(gbc, 8)]; - if (range > 1.0 || s->drc_scale <= 1.0) - s->dynamic_range[i] = powf(range, s->drc_scale); - else - s->dynamic_range[i] = range; - } else if (blk == 0) { - s->dynamic_range[i] = 1.0f; - } - } while (i--); - - /* spectral extension strategy */ - if (s->eac3 && (!blk || get_bits1(gbc))) { - s->spx_in_use = get_bits1(gbc); - if (s->spx_in_use) { - int dst_start_freq, dst_end_freq, src_start_freq, - start_subband, end_subband; - - /* determine which channels use spx */ - if (s->channel_mode == AC3_CHMODE_MONO) { - s->channel_uses_spx[1] = 1; - } else { - for (ch = 1; ch <= fbw_channels; ch++) - s->channel_uses_spx[ch] = get_bits1(gbc); - } - - /* get the frequency bins of the spx copy region and the spx start - and end subbands */ - dst_start_freq = get_bits(gbc, 2); - start_subband = get_bits(gbc, 3) + 2; - if (start_subband > 7) - start_subband += start_subband - 7; - end_subband = get_bits(gbc, 3) + 5; - if (end_subband > 7) - end_subband += end_subband - 7; - dst_start_freq = dst_start_freq * 12 + 25; - src_start_freq = start_subband * 12 + 25; - dst_end_freq = end_subband * 12 + 25; - - /* check validity of spx ranges */ - if (start_subband >= end_subband) { - av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension " - "range (%d >= %d)\n", start_subband, end_subband); - return AVERROR_INVALIDDATA; - } - if (dst_start_freq >= src_start_freq) { - av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension " - "copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq); - return AVERROR_INVALIDDATA; - } - - s->spx_dst_start_freq = dst_start_freq; - s->spx_src_start_freq = src_start_freq; - s->spx_dst_end_freq = dst_end_freq; - - decode_band_structure(gbc, blk, s->eac3, 0, - start_subband, end_subband, - ff_eac3_default_spx_band_struct, - &s->num_spx_bands, - s->spx_band_sizes); - } else { - for (ch = 1; ch <= fbw_channels; ch++) { - s->channel_uses_spx[ch] = 0; - s->first_spx_coords[ch] = 1; - } - } - } - - /* spectral extension coordinates */ - if (s->spx_in_use) { - for (ch = 1; ch <= fbw_channels; ch++) { - if (s->channel_uses_spx[ch]) { - if (s->first_spx_coords[ch] || get_bits1(gbc)) { - float spx_blend; - int bin, master_spx_coord; - - s->first_spx_coords[ch] = 0; - spx_blend = get_bits(gbc, 5) * (1.0f/32); - master_spx_coord = get_bits(gbc, 2) * 3; - - bin = s->spx_src_start_freq; - for (bnd = 0; bnd < s->num_spx_bands; bnd++) { - int bandsize; - int spx_coord_exp, spx_coord_mant; - float nratio, sblend, nblend, spx_coord; - - /* calculate blending factors */ - bandsize = s->spx_band_sizes[bnd]; - nratio = ((float)((bin + (bandsize >> 1))) / s->spx_dst_end_freq) - spx_blend; - nratio = av_clipf(nratio, 0.0f, 1.0f); - nblend = sqrtf(3.0f * nratio); // noise is scaled by sqrt(3) - // to give unity variance - sblend = sqrtf(1.0f - nratio); - bin += bandsize; - - /* decode spx coordinates */ - spx_coord_exp = get_bits(gbc, 4); - spx_coord_mant = get_bits(gbc, 2); - if (spx_coord_exp == 15) spx_coord_mant <<= 1; - else spx_coord_mant += 4; - spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord); - spx_coord = spx_coord_mant * (1.0f / (1 << 23)); - - /* multiply noise and signal blending factors by spx coordinate */ - s->spx_noise_blend [ch][bnd] = nblend * spx_coord; - s->spx_signal_blend[ch][bnd] = sblend * spx_coord; - } - } - } else { - s->first_spx_coords[ch] = 1; - } - } - } - - /* coupling strategy */ - if (s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc)) { - memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS); - if (!s->eac3) - s->cpl_in_use[blk] = get_bits1(gbc); - if (s->cpl_in_use[blk]) { - /* coupling in use */ - int cpl_start_subband, cpl_end_subband; - - if (channel_mode < AC3_CHMODE_STEREO) { - av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n"); - return AVERROR_INVALIDDATA; - } - - /* check for enhanced coupling */ - if (s->eac3 && get_bits1(gbc)) { - /* TODO: parse enhanced coupling strategy info */ - avpriv_request_sample(s->avctx, "Enhanced coupling"); - return AVERROR_PATCHWELCOME; - } - - /* determine which channels are coupled */ - if (s->eac3 && s->channel_mode == AC3_CHMODE_STEREO) { - s->channel_in_cpl[1] = 1; - s->channel_in_cpl[2] = 1; - } else { - for (ch = 1; ch <= fbw_channels; ch++) - s->channel_in_cpl[ch] = get_bits1(gbc); - } - - /* phase flags in use */ - if (channel_mode == AC3_CHMODE_STEREO) - s->phase_flags_in_use = get_bits1(gbc); - - /* coupling frequency range */ - cpl_start_subband = get_bits(gbc, 4); - cpl_end_subband = s->spx_in_use ? (s->spx_src_start_freq - 37) / 12 : - get_bits(gbc, 4) + 3; - if (cpl_start_subband >= cpl_end_subband) { - av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n", - cpl_start_subband, cpl_end_subband); - return AVERROR_INVALIDDATA; - } - s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37; - s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37; - - decode_band_structure(gbc, blk, s->eac3, 0, cpl_start_subband, - cpl_end_subband, - ff_eac3_default_cpl_band_struct, - &s->num_cpl_bands, s->cpl_band_sizes); - } else { - /* coupling not in use */ - for (ch = 1; ch <= fbw_channels; ch++) { - s->channel_in_cpl[ch] = 0; - s->first_cpl_coords[ch] = 1; - } - s->first_cpl_leak = s->eac3; - s->phase_flags_in_use = 0; - } - } else if (!s->eac3) { - if (!blk) { - av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must " - "be present in block 0\n"); - return AVERROR_INVALIDDATA; - } else { - s->cpl_in_use[blk] = s->cpl_in_use[blk-1]; - } - } - cpl_in_use = s->cpl_in_use[blk]; - - /* coupling coordinates */ - if (cpl_in_use) { - int cpl_coords_exist = 0; - - for (ch = 1; ch <= fbw_channels; ch++) { - if (s->channel_in_cpl[ch]) { - if ((s->eac3 && s->first_cpl_coords[ch]) || get_bits1(gbc)) { - int master_cpl_coord, cpl_coord_exp, cpl_coord_mant; - s->first_cpl_coords[ch] = 0; - cpl_coords_exist = 1; - master_cpl_coord = 3 * get_bits(gbc, 2); - for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { - cpl_coord_exp = get_bits(gbc, 4); - cpl_coord_mant = get_bits(gbc, 4); - if (cpl_coord_exp == 15) - s->cpl_coords[ch][bnd] = cpl_coord_mant << 22; - else - s->cpl_coords[ch][bnd] = (cpl_coord_mant + 16) << 21; - s->cpl_coords[ch][bnd] >>= (cpl_coord_exp + master_cpl_coord); - } - } else if (!blk) { - av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must " - "be present in block 0\n"); - return AVERROR_INVALIDDATA; - } - } else { - /* channel not in coupling */ - s->first_cpl_coords[ch] = 1; - } - } - /* phase flags */ - if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) { - for (bnd = 0; bnd < s->num_cpl_bands; bnd++) { - s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0; - } - } - } - - /* stereo rematrixing strategy and band structure */ - if (channel_mode == AC3_CHMODE_STEREO) { - if ((s->eac3 && !blk) || get_bits1(gbc)) { - s->num_rematrixing_bands = 4; - if (cpl_in_use && s->start_freq[CPL_CH] <= 61) { - s->num_rematrixing_bands -= 1 + (s->start_freq[CPL_CH] == 37); - } else if (s->spx_in_use && s->spx_src_start_freq <= 61) { - s->num_rematrixing_bands--; - } - for (bnd = 0; bnd < s->num_rematrixing_bands; bnd++) - s->rematrixing_flags[bnd] = get_bits1(gbc); - } else if (!blk) { - av_log(s->avctx, AV_LOG_WARNING, "Warning: " - "new rematrixing strategy not present in block 0\n"); - s->num_rematrixing_bands = 0; - } - } - - /* exponent strategies for each channel */ - for (ch = !cpl_in_use; ch <= s->channels; ch++) { - if (!s->eac3) - s->exp_strategy[blk][ch] = get_bits(gbc, 2 - (ch == s->lfe_ch)); - if (s->exp_strategy[blk][ch] != EXP_REUSE) - bit_alloc_stages[ch] = 3; - } - - /* channel bandwidth */ - for (ch = 1; ch <= fbw_channels; ch++) { - s->start_freq[ch] = 0; - if (s->exp_strategy[blk][ch] != EXP_REUSE) { - int group_size; - int prev = s->end_freq[ch]; - if (s->channel_in_cpl[ch]) - s->end_freq[ch] = s->start_freq[CPL_CH]; - else if (s->channel_uses_spx[ch]) - s->end_freq[ch] = s->spx_src_start_freq; - else { - int bandwidth_code = get_bits(gbc, 6); - if (bandwidth_code > 60) { - av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code); - return AVERROR_INVALIDDATA; - } - s->end_freq[ch] = bandwidth_code * 3 + 73; - } - group_size = 3 << (s->exp_strategy[blk][ch] - 1); - s->num_exp_groups[ch] = (s->end_freq[ch] + group_size-4) / group_size; - if (blk > 0 && s->end_freq[ch] != prev) - memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS); - } - } - if (cpl_in_use && s->exp_strategy[blk][CPL_CH] != EXP_REUSE) { - s->num_exp_groups[CPL_CH] = (s->end_freq[CPL_CH] - s->start_freq[CPL_CH]) / - (3 << (s->exp_strategy[blk][CPL_CH] - 1)); - } - - /* decode exponents for each channel */ - for (ch = !cpl_in_use; ch <= s->channels; ch++) { - if (s->exp_strategy[blk][ch] != EXP_REUSE) { - s->dexps[ch][0] = get_bits(gbc, 4) << !ch; - if (decode_exponents(gbc, s->exp_strategy[blk][ch], - s->num_exp_groups[ch], s->dexps[ch][0], - &s->dexps[ch][s->start_freq[ch]+!!ch])) { - av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n"); - return AVERROR_INVALIDDATA; - } - if (ch != CPL_CH && ch != s->lfe_ch) - skip_bits(gbc, 2); /* skip gainrng */ - } - } - - /* bit allocation information */ - if (s->bit_allocation_syntax) { - if (get_bits1(gbc)) { - s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift; - s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[get_bits(gbc, 2)] >> s->bit_alloc_params.sr_shift; - s->bit_alloc_params.slow_gain = ff_ac3_slow_gain_tab[get_bits(gbc, 2)]; - s->bit_alloc_params.db_per_bit = ff_ac3_db_per_bit_tab[get_bits(gbc, 2)]; - s->bit_alloc_params.floor = ff_ac3_floor_tab[get_bits(gbc, 3)]; - for (ch = !cpl_in_use; ch <= s->channels; ch++) - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); - } else if (!blk) { - av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must " - "be present in block 0\n"); - return AVERROR_INVALIDDATA; - } - } - - /* signal-to-noise ratio offsets and fast gains (signal-to-mask ratios) */ - if (!s->eac3 || !blk) { - if (s->snr_offset_strategy && get_bits1(gbc)) { - int snr = 0; - int csnr; - csnr = (get_bits(gbc, 6) - 15) << 4; - for (i = ch = !cpl_in_use; ch <= s->channels; ch++) { - /* snr offset */ - if (ch == i || s->snr_offset_strategy == 2) - snr = (csnr + get_bits(gbc, 4)) << 2; - /* run at least last bit allocation stage if snr offset changes */ - if (blk && s->snr_offset[ch] != snr) { - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1); - } - s->snr_offset[ch] = snr; - - /* fast gain (normal AC-3 only) */ - if (!s->eac3) { - int prev = s->fast_gain[ch]; - s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)]; - /* run last 2 bit allocation stages if fast gain changes */ - if (blk && prev != s->fast_gain[ch]) - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); - } - } - } else if (!s->eac3 && !blk) { - av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n"); - return AVERROR_INVALIDDATA; - } - } - - /* fast gain (E-AC-3 only) */ - if (s->fast_gain_syntax && get_bits1(gbc)) { - for (ch = !cpl_in_use; ch <= s->channels; ch++) { - int prev = s->fast_gain[ch]; - s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)]; - /* run last 2 bit allocation stages if fast gain changes */ - if (blk && prev != s->fast_gain[ch]) - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); - } - } else if (s->eac3 && !blk) { - for (ch = !cpl_in_use; ch <= s->channels; ch++) - s->fast_gain[ch] = ff_ac3_fast_gain_tab[4]; - } - - /* E-AC-3 to AC-3 converter SNR offset */ - if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && get_bits1(gbc)) { - skip_bits(gbc, 10); // skip converter snr offset - } - - /* coupling leak information */ - if (cpl_in_use) { - if (s->first_cpl_leak || get_bits1(gbc)) { - int fl = get_bits(gbc, 3); - int sl = get_bits(gbc, 3); - /* run last 2 bit allocation stages for coupling channel if - coupling leak changes */ - if (blk && (fl != s->bit_alloc_params.cpl_fast_leak || - sl != s->bit_alloc_params.cpl_slow_leak)) { - bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2); - } - s->bit_alloc_params.cpl_fast_leak = fl; - s->bit_alloc_params.cpl_slow_leak = sl; - } else if (!s->eac3 && !blk) { - av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must " - "be present in block 0\n"); - return AVERROR_INVALIDDATA; - } - s->first_cpl_leak = 0; - } - - /* delta bit allocation information */ - if (s->dba_syntax && get_bits1(gbc)) { - /* delta bit allocation exists (strategy) */ - for (ch = !cpl_in_use; ch <= fbw_channels; ch++) { - s->dba_mode[ch] = get_bits(gbc, 2); - if (s->dba_mode[ch] == DBA_RESERVED) { - av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n"); - return AVERROR_INVALIDDATA; - } - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); - } - /* channel delta offset, len and bit allocation */ - for (ch = !cpl_in_use; ch <= fbw_channels; ch++) { - if (s->dba_mode[ch] == DBA_NEW) { - s->dba_nsegs[ch] = get_bits(gbc, 3) + 1; - for (seg = 0; seg < s->dba_nsegs[ch]; seg++) { - s->dba_offsets[ch][seg] = get_bits(gbc, 5); - s->dba_lengths[ch][seg] = get_bits(gbc, 4); - s->dba_values[ch][seg] = get_bits(gbc, 3); - } - /* run last 2 bit allocation stages if new dba values */ - bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); - } - } - } else if (blk == 0) { - for (ch = 0; ch <= s->channels; ch++) { - s->dba_mode[ch] = DBA_NONE; - } - } - - /* Bit allocation */ - for (ch = !cpl_in_use; ch <= s->channels; ch++) { - if (bit_alloc_stages[ch] > 2) { - /* Exponent mapping into PSD and PSD integration */ - ff_ac3_bit_alloc_calc_psd(s->dexps[ch], - s->start_freq[ch], s->end_freq[ch], - s->psd[ch], s->band_psd[ch]); - } - if (bit_alloc_stages[ch] > 1) { - /* Compute excitation function, Compute masking curve, and - Apply delta bit allocation */ - if (ff_ac3_bit_alloc_calc_mask(&s->bit_alloc_params, s->band_psd[ch], - s->start_freq[ch], s->end_freq[ch], - s->fast_gain[ch], (ch == s->lfe_ch), - s->dba_mode[ch], s->dba_nsegs[ch], - s->dba_offsets[ch], s->dba_lengths[ch], - s->dba_values[ch], s->mask[ch])) { - av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n"); - return AVERROR_INVALIDDATA; - } - } - if (bit_alloc_stages[ch] > 0) { - /* Compute bit allocation */ - const uint8_t *bap_tab = s->channel_uses_aht[ch] ? - ff_eac3_hebap_tab : ff_ac3_bap_tab; - s->ac3dsp.bit_alloc_calc_bap(s->mask[ch], s->psd[ch], - s->start_freq[ch], s->end_freq[ch], - s->snr_offset[ch], - s->bit_alloc_params.floor, - bap_tab, s->bap[ch]); - } - } - - /* unused dummy data */ - if (s->skip_syntax && get_bits1(gbc)) { - int skipl = get_bits(gbc, 9); - while (skipl--) - skip_bits(gbc, 8); - } - - /* unpack the transform coefficients - this also uncouples channels if coupling is in use. */ - decode_transform_coeffs(s, blk); - - /* TODO: generate enhanced coupling coordinates and uncouple */ - - /* recover coefficients if rematrixing is in use */ - if (s->channel_mode == AC3_CHMODE_STEREO) - do_rematrixing(s); - - /* apply scaling to coefficients (headroom, dynrng) */ - for (ch = 1; ch <= s->channels; ch++) { - float gain = 1.0 / 4194304.0f; - if (s->channel_mode == AC3_CHMODE_DUALMONO) { - gain *= s->dynamic_range[2 - ch]; - } else { - gain *= s->dynamic_range[0]; - } - s->fmt_conv.int32_to_float_fmul_scalar(s->transform_coeffs[ch], - s->fixed_coeffs[ch], gain, 256); - } - - /* apply spectral extension to high frequency bins */ - if (s->spx_in_use && CONFIG_EAC3_DECODER) { - ff_eac3_apply_spectral_extension(s); - } - - /* downmix and MDCT. order depends on whether block switching is used for - any channel in this block. this is because coefficients for the long - and short transforms cannot be mixed. */ - downmix_output = s->channels != s->out_channels && - !((s->output_mode & AC3_OUTPUT_LFEON) && - s->fbw_channels == s->out_channels); - if (different_transforms) { - /* the delay samples have already been downmixed, so we upmix the delay - samples in order to reconstruct all channels before downmixing. */ - if (s->downmixed) { - s->downmixed = 0; - ac3_upmix_delay(s); - } - - do_imdct(s, s->channels); - - if (downmix_output) { - s->ac3dsp.downmix(s->outptr, s->downmix_coeffs, - s->out_channels, s->fbw_channels, 256); - } - } else { - if (downmix_output) { - s->ac3dsp.downmix(s->xcfptr + 1, s->downmix_coeffs, - s->out_channels, s->fbw_channels, 256); - } - - if (downmix_output && !s->downmixed) { - s->downmixed = 1; - s->ac3dsp.downmix(s->dlyptr, s->downmix_coeffs, s->out_channels, - s->fbw_channels, 128); - } - - do_imdct(s, s->out_channels); - } - - return 0; -} - -/** - * Decode a single AC-3 frame. - */ -static int ac3_decode_frame(AVCodecContext * avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - AC3DecodeContext *s = avctx->priv_data; - int blk, ch, err, ret; - const uint8_t *channel_map; - const float *output[AC3_MAX_CHANNELS]; - enum AVMatrixEncoding matrix_encoding; - AVDownmixInfo *downmix_info; - - /* copy input buffer to decoder context to avoid reading past the end - of the buffer, which can be caused by a damaged input stream. */ - if (buf_size >= 2 && AV_RB16(buf) == 0x770B) { - // seems to be byte-swapped AC-3 - int cnt = FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE) >> 1; - s->dsp.bswap16_buf((uint16_t *)s->input_buffer, (const uint16_t *)buf, cnt); - } else - memcpy(s->input_buffer, buf, FFMIN(buf_size, AC3_FRAME_BUFFER_SIZE)); - buf = s->input_buffer; - /* initialize the GetBitContext with the start of valid AC-3 Frame */ - init_get_bits(&s->gbc, buf, buf_size * 8); - - /* parse the syncinfo */ - err = parse_frame_header(s); - - if (err) { - switch (err) { - case AAC_AC3_PARSE_ERROR_SYNC: - av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); - return AVERROR_INVALIDDATA; - case AAC_AC3_PARSE_ERROR_BSID: - av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); - break; - case AAC_AC3_PARSE_ERROR_SAMPLE_RATE: - av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); - break; - case AAC_AC3_PARSE_ERROR_FRAME_SIZE: - av_log(avctx, AV_LOG_ERROR, "invalid frame size\n"); - break; - case AAC_AC3_PARSE_ERROR_FRAME_TYPE: - /* skip frame if CRC is ok. otherwise use error concealment. */ - /* TODO: add support for substreams and dependent frames */ - if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { - av_log(avctx, AV_LOG_WARNING, "unsupported frame type : " - "skipping frame\n"); - *got_frame_ptr = 0; - return buf_size; - } else { - av_log(avctx, AV_LOG_ERROR, "invalid frame type\n"); - } - break; - case AAC_AC3_PARSE_ERROR_CRC: - case AAC_AC3_PARSE_ERROR_CHANNEL_CFG: - break; - default: // Normal AVERROR do not try to recover. - *got_frame_ptr = 0; - return err; - } - } else { - /* check that reported frame size fits in input buffer */ - if (s->frame_size > buf_size) { - av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); - err = AAC_AC3_PARSE_ERROR_FRAME_SIZE; - } else if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_CAREFUL)) { - /* check for crc mismatch */ - if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], - s->frame_size - 2)) { - av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n"); - if (avctx->err_recognition & AV_EF_EXPLODE) - return AVERROR_INVALIDDATA; - err = AAC_AC3_PARSE_ERROR_CRC; - } - } - } - - /* if frame is ok, set audio parameters */ - if (!err) { - avctx->sample_rate = s->sample_rate; - avctx->bit_rate = s->bit_rate; - } - - /* channel config */ - if (!err || (s->channels && s->out_channels != s->channels)) { - s->out_channels = s->channels; - s->output_mode = s->channel_mode; - if (s->lfe_on) - s->output_mode |= AC3_OUTPUT_LFEON; - if (s->channels > 1 && - avctx->request_channel_layout == AV_CH_LAYOUT_MONO) { - s->out_channels = 1; - s->output_mode = AC3_CHMODE_MONO; - } else if (s->channels > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { - s->out_channels = 2; - s->output_mode = AC3_CHMODE_STEREO; - } - - s->loro_center_mix_level = gain_levels[s-> center_mix_level]; - s->loro_surround_mix_level = gain_levels[s->surround_mix_level]; - s->ltrt_center_mix_level = LEVEL_MINUS_3DB; - s->ltrt_surround_mix_level = LEVEL_MINUS_3DB; - /* set downmixing coefficients if needed */ - if (s->channels != s->out_channels && !((s->output_mode & AC3_OUTPUT_LFEON) && - s->fbw_channels == s->out_channels)) { - set_downmix_coeffs(s); - } - } else if (!s->channels) { - av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n"); - return AVERROR_INVALIDDATA; - } - avctx->channels = s->out_channels; - avctx->channel_layout = avpriv_ac3_channel_layout_tab[s->output_mode & ~AC3_OUTPUT_LFEON]; - if (s->output_mode & AC3_OUTPUT_LFEON) - avctx->channel_layout |= AV_CH_LOW_FREQUENCY; - - /* set audio service type based on bitstream mode for AC-3 */ - avctx->audio_service_type = s->bitstream_mode; - if (s->bitstream_mode == 0x7 && s->channels > 1) - avctx->audio_service_type = AV_AUDIO_SERVICE_TYPE_KARAOKE; - - /* get output buffer */ - frame->nb_samples = s->num_blocks * AC3_BLOCK_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - - /* decode the audio blocks */ - channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; - for (ch = 0; ch < AC3_MAX_CHANNELS; ch++) { - output[ch] = s->output[ch]; - s->outptr[ch] = s->output[ch]; - } - for (ch = 0; ch < s->channels; ch++) { - if (ch < s->out_channels) - s->outptr[channel_map[ch]] = (float *)frame->data[ch]; - } - for (blk = 0; blk < s->num_blocks; blk++) { - if (!err && decode_audio_block(s, blk)) { - av_log(avctx, AV_LOG_ERROR, "error decoding the audio block\n"); - err = 1; - } - if (err) - for (ch = 0; ch < s->out_channels; ch++) - memcpy(((float*)frame->data[ch]) + AC3_BLOCK_SIZE*blk, output[ch], sizeof(**output) * AC3_BLOCK_SIZE); - for (ch = 0; ch < s->out_channels; ch++) - output[ch] = s->outptr[channel_map[ch]]; - for (ch = 0; ch < s->out_channels; ch++) { - if (!ch || channel_map[ch]) - s->outptr[channel_map[ch]] += AC3_BLOCK_SIZE; - } - } - - av_frame_set_decode_error_flags(frame, err ? FF_DECODE_ERROR_INVALID_BITSTREAM : 0); - - /* keep last block for error concealment in next frame */ - for (ch = 0; ch < s->out_channels; ch++) - memcpy(s->output[ch], output[ch], sizeof(**output) * AC3_BLOCK_SIZE); - - /* - * AVMatrixEncoding - * - * Check whether the input layout is compatible, and make sure we're not - * downmixing (else the matrix encoding is no longer applicable). - */ - matrix_encoding = AV_MATRIX_ENCODING_NONE; - if (s->channel_mode == AC3_CHMODE_STEREO && - s->channel_mode == (s->output_mode & ~AC3_OUTPUT_LFEON)) { - if (s->dolby_surround_mode == AC3_DSURMOD_ON) - matrix_encoding = AV_MATRIX_ENCODING_DOLBY; - else if (s->dolby_headphone_mode == AC3_DHEADPHONMOD_ON) - matrix_encoding = AV_MATRIX_ENCODING_DOLBYHEADPHONE; - } else if (s->channel_mode >= AC3_CHMODE_2F2R && - s->channel_mode == (s->output_mode & ~AC3_OUTPUT_LFEON)) { - switch (s->dolby_surround_ex_mode) { - case AC3_DSUREXMOD_ON: // EX or PLIIx - matrix_encoding = AV_MATRIX_ENCODING_DOLBYEX; - break; - case AC3_DSUREXMOD_PLIIZ: - matrix_encoding = AV_MATRIX_ENCODING_DPLIIZ; - break; - default: // not indicated or off - break; - } - } - if ((ret = ff_side_data_update_matrix_encoding(frame, matrix_encoding)) < 0) - return ret; - - /* AVDownmixInfo */ - if ((downmix_info = av_downmix_info_update_side_data(frame))) { - switch (s->preferred_downmix) { - case AC3_DMIXMOD_LTRT: - downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_LTRT; - break; - case AC3_DMIXMOD_LORO: - downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_LORO; - break; - case AC3_DMIXMOD_DPLII: - downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_DPLII; - break; - default: - downmix_info->preferred_downmix_type = AV_DOWNMIX_TYPE_UNKNOWN; - break; - } - downmix_info->center_mix_level = gain_levels[s-> center_mix_level]; - downmix_info->center_mix_level_ltrt = gain_levels[s-> center_mix_level_ltrt]; - downmix_info->surround_mix_level = gain_levels[s-> surround_mix_level]; - downmix_info->surround_mix_level_ltrt = gain_levels[s->surround_mix_level_ltrt]; - if (s->lfe_mix_level_exists) - downmix_info->lfe_mix_level = gain_levels_lfe[s->lfe_mix_level]; - else - downmix_info->lfe_mix_level = 0.0; // -inf dB - } else - return AVERROR(ENOMEM); - - *got_frame_ptr = 1; - - return FFMIN(buf_size, s->frame_size); -} - -/** - * Uninitialize the AC-3 decoder. - */ -static av_cold int ac3_decode_end(AVCodecContext *avctx) -{ - AC3DecodeContext *s = avctx->priv_data; - ff_mdct_end(&s->imdct_512); - ff_mdct_end(&s->imdct_256); - - return 0; -} - -#define OFFSET(x) offsetof(AC3DecodeContext, x) -#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) -static const AVOption options[] = { - { "drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), AV_OPT_TYPE_FLOAT, {.dbl = 1.0}, 0.0, 6.0, PAR }, - -{"dmix_mode", "Preferred Stereo Downmix Mode", OFFSET(preferred_stereo_downmix), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, 2, 0, "dmix_mode"}, -{"ltrt_cmixlev", "Lt/Rt Center Mix Level", OFFSET(ltrt_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"ltrt_surmixlev", "Lt/Rt Surround Mix Level", OFFSET(ltrt_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"loro_cmixlev", "Lo/Ro Center Mix Level", OFFSET(loro_center_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, -{"loro_surmixlev", "Lo/Ro Surround Mix Level", OFFSET(loro_surround_mix_level), AV_OPT_TYPE_FLOAT, {.dbl = -1.0 }, -1.0, 2.0, 0}, - - { NULL}, -}; - -static const AVClass ac3_decoder_class = { - .class_name = "AC3 decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_ac3_decoder = { - .name = "ac3", - .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_AC3, - .priv_data_size = sizeof (AC3DecodeContext), - .init = ac3_decode_init, - .close = ac3_decode_end, - .decode = ac3_decode_frame, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, - .priv_class = &ac3_decoder_class, -}; - -#if CONFIG_EAC3_DECODER -static const AVClass eac3_decoder_class = { - .class_name = "E-AC3 decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_eac3_decoder = { - .name = "eac3", - .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_EAC3, - .priv_data_size = sizeof (AC3DecodeContext), - .init = ac3_decode_init, - .close = ac3_decode_end, - .decode = ac3_decode_frame, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, - .priv_class = &eac3_decoder_class, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.h deleted file mode 100644 index 58d8ee69b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec.h +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Common code between the AC-3 and E-AC-3 decoders - * Copyright (c) 2007 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Common code between the AC-3 and E-AC-3 decoders. - * - * Summary of MDCT Coefficient Grouping: - * The individual MDCT coefficient indices are often referred to in the - * (E-)AC-3 specification as frequency bins. These bins are grouped together - * into subbands of 12 coefficients each. The subbands are grouped together - * into bands as defined in the bitstream by the band structures, which - * determine the number of bands and the size of each band. The full spectrum - * of 256 frequency bins is divided into 1 DC bin + 21 subbands = 253 bins. - * This system of grouping coefficients is used for channel bandwidth, stereo - * rematrixing, channel coupling, enhanced coupling, and spectral extension. - * - * +-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-+ - * |1| |12| | [12|12|12|12] | | | | | | | | | | | | |3| - * +-+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-+ - * ~~~ ~~~~ ~~~~~~~~~~~~~ ~~~ - * | | | | - * | | | 3 unused frequency bins--+ - * | | | - * | | +--1 band containing 4 subbands - * | | - * | +--1 subband of 12 frequency bins - * | - * +--DC frequency bin - */ - -#ifndef AVCODEC_AC3DEC_H -#define AVCODEC_AC3DEC_H - -#include "libavutil/float_dsp.h" -#include "libavutil/lfg.h" -#include "ac3.h" -#include "ac3dsp.h" -#include "get_bits.h" -#include "dsputil.h" -#include "fft.h" -#include "fmtconvert.h" - -#define AC3_OUTPUT_LFEON 8 - -#define SPX_MAX_BANDS 17 - -/** Large enough for maximum possible frame size when the specification limit is ignored */ -#define AC3_FRAME_BUFFER_SIZE 32768 - -typedef struct AC3DecodeContext { - AVClass *class; ///< class for AVOptions - AVCodecContext *avctx; ///< parent context - GetBitContext gbc; ///< bitstream reader - -///@name Bit stream information -///@{ - int frame_type; ///< frame type (strmtyp) - int substreamid; ///< substream identification - int frame_size; ///< current frame size, in bytes - int bit_rate; ///< stream bit rate, in bits-per-second - int sample_rate; ///< sample frequency, in Hz - int num_blocks; ///< number of audio blocks - int bitstream_id; ///< bitstream id (bsid) - int bitstream_mode; ///< bitstream mode (bsmod) - int channel_mode; ///< channel mode (acmod) - int lfe_on; ///< lfe channel in use - int channel_map; ///< custom channel map - int preferred_downmix; ///< Preferred 2-channel downmix mode (dmixmod) - int center_mix_level; ///< Center mix level index - int center_mix_level_ltrt; ///< Center mix level index for Lt/Rt (ltrtcmixlev) - int surround_mix_level; ///< Surround mix level index - int surround_mix_level_ltrt; ///< Surround mix level index for Lt/Rt (ltrtsurmixlev) - int lfe_mix_level_exists; ///< indicates if lfemixlevcod is specified (lfemixlevcode) - int lfe_mix_level; ///< LFE mix level index (lfemixlevcod) - int eac3; ///< indicates if current frame is E-AC-3 - int dolby_surround_mode; ///< dolby surround mode (dsurmod) - int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod) - int dolby_headphone_mode; ///< dolby headphone mode (dheadphonmod) -///@} - - int preferred_stereo_downmix; - float ltrt_center_mix_level; - float ltrt_surround_mix_level; - float loro_center_mix_level; - float loro_surround_mix_level; - -///@name Frame syntax parameters - int snr_offset_strategy; ///< SNR offset strategy (snroffststr) - int block_switch_syntax; ///< block switch syntax enabled (blkswe) - int dither_flag_syntax; ///< dither flag syntax enabled (dithflage) - int bit_allocation_syntax; ///< bit allocation model syntax enabled (bamode) - int fast_gain_syntax; ///< fast gain codes enabled (frmfgaincode) - int dba_syntax; ///< delta bit allocation syntax enabled (dbaflde) - int skip_syntax; ///< skip field syntax enabled (skipflde) - ///@} - -///@name Standard coupling - int cpl_in_use[AC3_MAX_BLOCKS]; ///< coupling in use (cplinu) - int cpl_strategy_exists[AC3_MAX_BLOCKS];///< coupling strategy exists (cplstre) - int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl) - int phase_flags_in_use; ///< phase flags in use (phsflginu) - int phase_flags[AC3_MAX_CPL_BANDS]; ///< phase flags (phsflg) - int num_cpl_bands; ///< number of coupling bands (ncplbnd) - uint8_t cpl_band_sizes[AC3_MAX_CPL_BANDS]; ///< number of coeffs in each coupling band - int firstchincpl; ///< first channel in coupling - int first_cpl_coords[AC3_MAX_CHANNELS]; ///< first coupling coordinates states (firstcplcos) - int cpl_coords[AC3_MAX_CHANNELS][AC3_MAX_CPL_BANDS]; ///< coupling coordinates (cplco) -///@} - -///@name Spectral extension -///@{ - int spx_in_use; ///< spectral extension in use (spxinu) - uint8_t channel_uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension (chinspx) - int8_t spx_atten_code[AC3_MAX_CHANNELS]; ///< spx attenuation code (spxattencod) - int spx_src_start_freq; ///< spx start frequency bin - int spx_dst_end_freq; ///< spx end frequency bin - int spx_dst_start_freq; ///< spx starting frequency bin for copying (copystartmant) - ///< the copy region ends at the start of the spx region. - int num_spx_bands; ///< number of spx bands (nspxbnds) - uint8_t spx_band_sizes[SPX_MAX_BANDS]; ///< number of bins in each spx band - uint8_t first_spx_coords[AC3_MAX_CHANNELS]; ///< first spx coordinates states (firstspxcos) - float spx_noise_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spx noise blending factor (nblendfact) - float spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS];///< spx signal blending factor (sblendfact) -///@} - -///@name Adaptive hybrid transform - int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu) - int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][AC3_MAX_BLOCKS]; ///< pre-IDCT mantissas -///@} - -///@name Channel - int fbw_channels; ///< number of full-bandwidth channels - int channels; ///< number of total channels - int lfe_ch; ///< index of LFE channel - float downmix_coeffs[AC3_MAX_CHANNELS][2]; ///< stereo downmix coefficients - int downmixed; ///< indicates if coeffs are currently downmixed - int output_mode; ///< output channel configuration - int out_channels; ///< number of output channels -///@} - -///@name Dynamic range - float dynamic_range[2]; ///< dynamic range - float drc_scale; ///< percentage of dynamic range compression to be applied -///@} - -///@name Bandwidth - int start_freq[AC3_MAX_CHANNELS]; ///< start frequency bin (strtmant) - int end_freq[AC3_MAX_CHANNELS]; ///< end frequency bin (endmant) -///@} - -///@name Rematrixing - int num_rematrixing_bands; ///< number of rematrixing bands (nrematbnd) - int rematrixing_flags[4]; ///< rematrixing flags (rematflg) -///@} - -///@name Exponents - int num_exp_groups[AC3_MAX_CHANNELS]; ///< Number of exponent groups (nexpgrp) - int8_t dexps[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< decoded exponents - int exp_strategy[AC3_MAX_BLOCKS][AC3_MAX_CHANNELS]; ///< exponent strategies (expstr) -///@} - -///@name Bit allocation - AC3BitAllocParameters bit_alloc_params; ///< bit allocation parameters - int first_cpl_leak; ///< first coupling leak state (firstcplleak) - int snr_offset[AC3_MAX_CHANNELS]; ///< signal-to-noise ratio offsets (snroffst) - int fast_gain[AC3_MAX_CHANNELS]; ///< fast gain values/SMR's (fgain) - uint8_t bap[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< bit allocation pointers - int16_t psd[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< scaled exponents - int16_t band_psd[AC3_MAX_CHANNELS][AC3_CRITICAL_BANDS]; ///< interpolated exponents - int16_t mask[AC3_MAX_CHANNELS][AC3_CRITICAL_BANDS]; ///< masking curve values - int dba_mode[AC3_MAX_CHANNELS]; ///< delta bit allocation mode - int dba_nsegs[AC3_MAX_CHANNELS]; ///< number of delta segments - uint8_t dba_offsets[AC3_MAX_CHANNELS][8]; ///< delta segment offsets - uint8_t dba_lengths[AC3_MAX_CHANNELS][8]; ///< delta segment lengths - uint8_t dba_values[AC3_MAX_CHANNELS][8]; ///< delta values for each segment -///@} - -///@name Zero-mantissa dithering - int dither_flag[AC3_MAX_CHANNELS]; ///< dither flags (dithflg) - AVLFG dith_state; ///< for dither generation -///@} - -///@name IMDCT - int block_switch[AC3_MAX_CHANNELS]; ///< block switch flags (blksw) - FFTContext imdct_512; ///< for 512 sample IMDCT - FFTContext imdct_256; ///< for 256 sample IMDCT -///@} - -///@name Optimization - DSPContext dsp; ///< for optimization - AVFloatDSPContext fdsp; - AC3DSPContext ac3dsp; - FmtConvertContext fmt_conv; ///< optimized conversion functions -///@} - - float *outptr[AC3_MAX_CHANNELS]; - float *xcfptr[AC3_MAX_CHANNELS]; - float *dlyptr[AC3_MAX_CHANNELS]; - -///@name Aligned arrays - DECLARE_ALIGNED(16, int32_t, fixed_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< fixed-point transform coefficients - DECLARE_ALIGNED(32, float, transform_coeffs)[AC3_MAX_CHANNELS][AC3_MAX_COEFS]; ///< transform coefficients - DECLARE_ALIGNED(32, float, delay)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< delay - added to the next block - DECLARE_ALIGNED(32, float, window)[AC3_BLOCK_SIZE]; ///< window coefficients - DECLARE_ALIGNED(32, float, tmp_output)[AC3_BLOCK_SIZE]; ///< temporary storage for output before windowing - DECLARE_ALIGNED(32, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE]; ///< output after imdct transform and windowing - DECLARE_ALIGNED(32, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread -///@} -} AC3DecodeContext; - -/** - * Parse the E-AC-3 frame header. - * This parses both the bit stream info and audio frame header. - */ -int ff_eac3_parse_header(AC3DecodeContext *s); - -/** - * Decode mantissas in a single channel for the entire frame. - * This is used when AHT mode is enabled. - */ -void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch); - -/** - * Apply spectral extension to each channel by copying lower frequency - * coefficients to higher frequency bins and applying side information to - * approximate the original high frequency signal. - */ -void ff_eac3_apply_spectral_extension(AC3DecodeContext *s); - -#endif /* AVCODEC_AC3DEC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.c deleted file mode 100644 index d0a9b1ec4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * AC-3 and E-AC-3 decoder tables - * Copyright (c) 2007 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Tables taken directly from the AC-3 spec. - */ - -#include "ac3dec_data.h" -#include "ac3.h" - -/** - * Table used to ungroup 3 values stored in 5 bits. - * Used by bap=1 mantissas and GAQ. - * ff_ac3_ungroup_3_in_5_bits_tab[i] = { i/9, (i%9)/3, (i%9)%3 } - */ -const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3] = { - { 0, 0, 0 }, { 0, 0, 1 }, { 0, 0, 2 }, { 0, 1, 0 }, - { 0, 1, 1 }, { 0, 1, 2 }, { 0, 2, 0 }, { 0, 2, 1 }, - { 0, 2, 2 }, { 1, 0, 0 }, { 1, 0, 1 }, { 1, 0, 2 }, - { 1, 1, 0 }, { 1, 1, 1 }, { 1, 1, 2 }, { 1, 2, 0 }, - { 1, 2, 1 }, { 1, 2, 2 }, { 2, 0, 0 }, { 2, 0, 1 }, - { 2, 0, 2 }, { 2, 1, 0 }, { 2, 1, 1 }, { 2, 1, 2 }, - { 2, 2, 0 }, { 2, 2, 1 }, { 2, 2, 2 }, { 3, 0, 0 }, - { 3, 0, 1 }, { 3, 0, 2 }, { 3, 1, 0 }, { 3, 1, 1 } -}; - -const uint8_t ff_eac3_hebap_tab[64] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, - 8, 8, 9, 9, 9, 10, 10, 10, 10, 11, - 11, 11, 11, 12, 12, 12, 12, 13, 13, 13, - 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, - 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, - 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, - 19, 19, 19, 19, -}; - -/** - * Table E2.15 Default Spectral Extension Banding Structure - */ -const uint8_t ff_eac3_default_spx_band_struct[17] = -{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 }; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.h deleted file mode 100644 index 975b52ef2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dec_data.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * AC-3 and E-AC-3 decoder tables - * Copyright (c) 2007 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AC3DEC_DATA_H -#define AVCODEC_AC3DEC_DATA_H - -#include - -extern const uint8_t ff_ac3_ungroup_3_in_5_bits_tab[32][3]; - -extern const uint8_t ff_eac3_hebap_tab[64]; -extern const uint8_t ff_eac3_default_spx_band_struct[17]; - -#endif /* AVCODEC_AC3DEC_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.c deleted file mode 100644 index feda6ddc6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.c +++ /dev/null @@ -1,277 +0,0 @@ -/* - * AC-3 DSP utils - * Copyright (c) 2011 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avassert.h" -#include "avcodec.h" -#include "ac3.h" -#include "ac3dsp.h" -#include "mathops.h" - -static void ac3_exponent_min_c(uint8_t *exp, int num_reuse_blocks, int nb_coefs) -{ - int blk, i; - - if (!num_reuse_blocks) - return; - - for (i = 0; i < nb_coefs; i++) { - uint8_t min_exp = *exp; - uint8_t *exp1 = exp + 256; - for (blk = 0; blk < num_reuse_blocks; blk++) { - uint8_t next_exp = *exp1; - if (next_exp < min_exp) - min_exp = next_exp; - exp1 += 256; - } - *exp++ = min_exp; - } -} - -static int ac3_max_msb_abs_int16_c(const int16_t *src, int len) -{ - int i, v = 0; - for (i = 0; i < len; i++) - v |= abs(src[i]); - return v; -} - -static void ac3_lshift_int16_c(int16_t *src, unsigned int len, - unsigned int shift) -{ - uint32_t *src32 = (uint32_t *)src; - const uint32_t mask = ~(((1 << shift) - 1) << 16); - int i; - len >>= 1; - for (i = 0; i < len; i += 8) { - src32[i ] = (src32[i ] << shift) & mask; - src32[i+1] = (src32[i+1] << shift) & mask; - src32[i+2] = (src32[i+2] << shift) & mask; - src32[i+3] = (src32[i+3] << shift) & mask; - src32[i+4] = (src32[i+4] << shift) & mask; - src32[i+5] = (src32[i+5] << shift) & mask; - src32[i+6] = (src32[i+6] << shift) & mask; - src32[i+7] = (src32[i+7] << shift) & mask; - } -} - -static void ac3_rshift_int32_c(int32_t *src, unsigned int len, - unsigned int shift) -{ - do { - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - *src++ >>= shift; - len -= 8; - } while (len > 0); -} - -static void float_to_fixed24_c(int32_t *dst, const float *src, unsigned int len) -{ - const float scale = 1 << 24; - do { - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - *dst++ = lrintf(*src++ * scale); - len -= 8; - } while (len > 0); -} - -static void ac3_bit_alloc_calc_bap_c(int16_t *mask, int16_t *psd, - int start, int end, - int snr_offset, int floor, - const uint8_t *bap_tab, uint8_t *bap) -{ - int bin, band, band_end; - - /* special case, if snr offset is -960, set all bap's to zero */ - if (snr_offset == -960) { - memset(bap, 0, AC3_MAX_COEFS); - return; - } - - bin = start; - band = ff_ac3_bin_to_band_tab[start]; - do { - int m = (FFMAX(mask[band] - snr_offset - floor, 0) & 0x1FE0) + floor; - band_end = ff_ac3_band_start_tab[++band]; - band_end = FFMIN(band_end, end); - - for (; bin < band_end; bin++) { - int address = av_clip((psd[bin] - m) >> 5, 0, 63); - bap[bin] = bap_tab[address]; - } - } while (end > band_end); -} - -static void ac3_update_bap_counts_c(uint16_t mant_cnt[16], uint8_t *bap, - int len) -{ - while (len-- > 0) - mant_cnt[bap[len]]++; -} - -DECLARE_ALIGNED(16, const uint16_t, ff_ac3_bap_bits)[16] = { - 0, 0, 0, 3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 -}; - -static int ac3_compute_mantissa_size_c(uint16_t mant_cnt[6][16]) -{ - int blk, bap; - int bits = 0; - - for (blk = 0; blk < AC3_MAX_BLOCKS; blk++) { - // bap=1 : 3 mantissas in 5 bits - bits += (mant_cnt[blk][1] / 3) * 5; - // bap=2 : 3 mantissas in 7 bits - // bap=4 : 2 mantissas in 7 bits - bits += ((mant_cnt[blk][2] / 3) + (mant_cnt[blk][4] >> 1)) * 7; - // bap=3 : 1 mantissa in 3 bits - bits += mant_cnt[blk][3] * 3; - // bap=5 to 15 : get bits per mantissa from table - for (bap = 5; bap < 16; bap++) - bits += mant_cnt[blk][bap] * ff_ac3_bap_bits[bap]; - } - return bits; -} - -static void ac3_extract_exponents_c(uint8_t *exp, int32_t *coef, int nb_coefs) -{ - int i; - - for (i = 0; i < nb_coefs; i++) { - int v = abs(coef[i]); - exp[i] = v ? 23 - av_log2(v) : 24; - } -} - -static void ac3_sum_square_butterfly_int32_c(int64_t sum[4], - const int32_t *coef0, - const int32_t *coef1, - int len) -{ - int i; - - sum[0] = sum[1] = sum[2] = sum[3] = 0; - - for (i = 0; i < len; i++) { - int lt = coef0[i]; - int rt = coef1[i]; - int md = lt + rt; - int sd = lt - rt; - MAC64(sum[0], lt, lt); - MAC64(sum[1], rt, rt); - MAC64(sum[2], md, md); - MAC64(sum[3], sd, sd); - } -} - -static void ac3_sum_square_butterfly_float_c(float sum[4], - const float *coef0, - const float *coef1, - int len) -{ - int i; - - sum[0] = sum[1] = sum[2] = sum[3] = 0; - - for (i = 0; i < len; i++) { - float lt = coef0[i]; - float rt = coef1[i]; - float md = lt + rt; - float sd = lt - rt; - sum[0] += lt * lt; - sum[1] += rt * rt; - sum[2] += md * md; - sum[3] += sd * sd; - } -} - -static void ac3_downmix_c(float **samples, float (*matrix)[2], - int out_ch, int in_ch, int len) -{ - int i, j; - float v0, v1; - if (out_ch == 2) { - for (i = 0; i < len; i++) { - v0 = v1 = 0.0f; - for (j = 0; j < in_ch; j++) { - v0 += samples[j][i] * matrix[j][0]; - v1 += samples[j][i] * matrix[j][1]; - } - samples[0][i] = v0; - samples[1][i] = v1; - } - } else if (out_ch == 1) { - for (i = 0; i < len; i++) { - v0 = 0.0f; - for (j = 0; j < in_ch; j++) - v0 += samples[j][i] * matrix[j][0]; - samples[0][i] = v0; - } - } -} - -static void apply_window_int16_c(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len) -{ - int i; - int len2 = len >> 1; - - for (i = 0; i < len2; i++) { - int16_t w = window[i]; - output[i] = (MUL16(input[i], w) + (1 << 14)) >> 15; - output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15; - } -} - -av_cold void ff_ac3dsp_init(AC3DSPContext *c, int bit_exact) -{ - c->ac3_exponent_min = ac3_exponent_min_c; - c->ac3_max_msb_abs_int16 = ac3_max_msb_abs_int16_c; - c->ac3_lshift_int16 = ac3_lshift_int16_c; - c->ac3_rshift_int32 = ac3_rshift_int32_c; - c->float_to_fixed24 = float_to_fixed24_c; - c->bit_alloc_calc_bap = ac3_bit_alloc_calc_bap_c; - c->update_bap_counts = ac3_update_bap_counts_c; - c->compute_mantissa_size = ac3_compute_mantissa_size_c; - c->extract_exponents = ac3_extract_exponents_c; - c->sum_square_butterfly_int32 = ac3_sum_square_butterfly_int32_c; - c->sum_square_butterfly_float = ac3_sum_square_butterfly_float_c; - c->downmix = ac3_downmix_c; - c->apply_window_int16 = apply_window_int16_c; - - if (ARCH_ARM) - ff_ac3dsp_init_arm(c, bit_exact); - if (ARCH_X86) - ff_ac3dsp_init_x86(c, bit_exact); - if (ARCH_MIPS) - ff_ac3dsp_init_mips(c, bit_exact); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.h deleted file mode 100644 index bced5974e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3dsp.h +++ /dev/null @@ -1,158 +0,0 @@ -/* - * AC-3 DSP utils - * Copyright (c) 2011 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AC3DSP_H -#define AVCODEC_AC3DSP_H - -#include - -/** - * Number of mantissa bits written for each bap value. - * bap values with fractional bits are set to 0 and are calculated separately. - */ -extern const uint16_t ff_ac3_bap_bits[16]; - -typedef struct AC3DSPContext { - /** - * Set each encoded exponent in a block to the minimum of itself and the - * exponents in the same frequency bin of up to 5 following blocks. - * @param exp pointer to the start of the current block of exponents. - * constraints: align 16 - * @param num_reuse_blocks number of blocks that will reuse exponents from the current block. - * constraints: range 0 to 5 - * @param nb_coefs number of frequency coefficients. - */ - void (*ac3_exponent_min)(uint8_t *exp, int num_reuse_blocks, int nb_coefs); - - /** - * Calculate the maximum MSB of the absolute value of each element in an - * array of int16_t. - * @param src input array - * constraints: align 16. values must be in range [-32767,32767] - * @param len number of values in the array - * constraints: multiple of 16 greater than 0 - * @return a value with the same MSB as max(abs(src[])) - */ - int (*ac3_max_msb_abs_int16)(const int16_t *src, int len); - - /** - * Left-shift each value in an array of int16_t by a specified amount. - * @param src input array - * constraints: align 16 - * @param len number of values in the array - * constraints: multiple of 32 greater than 0 - * @param shift left shift amount - * constraints: range [0,15] - */ - void (*ac3_lshift_int16)(int16_t *src, unsigned int len, unsigned int shift); - - /** - * Right-shift each value in an array of int32_t by a specified amount. - * @param src input array - * constraints: align 16 - * @param len number of values in the array - * constraints: multiple of 16 greater than 0 - * @param shift right shift amount - * constraints: range [0,31] - */ - void (*ac3_rshift_int32)(int32_t *src, unsigned int len, unsigned int shift); - - /** - * Convert an array of float in range [-1.0,1.0] to int32_t with range - * [-(1<<24),(1<<24)] - * - * @param dst destination array of int32_t. - * constraints: 16-byte aligned - * @param src source array of float. - * constraints: 16-byte aligned - * @param len number of elements to convert. - * constraints: multiple of 32 greater than zero - */ - void (*float_to_fixed24)(int32_t *dst, const float *src, unsigned int len); - - /** - * Calculate bit allocation pointers. - * The SNR is the difference between the masking curve and the signal. AC-3 - * uses this value for each frequency bin to allocate bits. The snroffset - * parameter is a global adjustment to the SNR for all bins. - * - * @param[in] mask masking curve - * @param[in] psd signal power for each frequency bin - * @param[in] start starting bin location - * @param[in] end ending bin location - * @param[in] snr_offset SNR adjustment - * @param[in] floor noise floor - * @param[in] bap_tab look-up table for bit allocation pointers - * @param[out] bap bit allocation pointers - */ - void (*bit_alloc_calc_bap)(int16_t *mask, int16_t *psd, int start, int end, - int snr_offset, int floor, - const uint8_t *bap_tab, uint8_t *bap); - - /** - * Update bap counts using the supplied array of bap. - * - * @param[out] mant_cnt bap counts for 1 block - * @param[in] bap array of bap, pointing to start coef bin - * @param[in] len number of elements to process - */ - void (*update_bap_counts)(uint16_t mant_cnt[16], uint8_t *bap, int len); - - /** - * Calculate the number of bits needed to encode a set of mantissas. - * - * @param[in] mant_cnt bap counts for all blocks - * @return mantissa bit count - */ - int (*compute_mantissa_size)(uint16_t mant_cnt[6][16]); - - void (*extract_exponents)(uint8_t *exp, int32_t *coef, int nb_coefs); - - void (*sum_square_butterfly_int32)(int64_t sum[4], const int32_t *coef0, - const int32_t *coef1, int len); - - void (*sum_square_butterfly_float)(float sum[4], const float *coef0, - const float *coef1, int len); - - void (*downmix)(float **samples, float (*matrix)[2], int out_ch, - int in_ch, int len); - - /** - * Apply symmetric window in 16-bit fixed-point. - * @param output destination array - * constraints: 16-byte aligned - * @param input source array - * constraints: 16-byte aligned - * @param window window array - * constraints: 16-byte aligned, at least len/2 elements - * @param len full window length - * constraints: multiple of ? greater than zero - */ - void (*apply_window_int16)(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -} AC3DSPContext; - -void ff_ac3dsp_init (AC3DSPContext *c, int bit_exact); -void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact); -void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact); -void ff_ac3dsp_init_mips(AC3DSPContext *c, int bit_exact); - -#endif /* AVCODEC_AC3DSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.c deleted file mode 100644 index 1ae7ddf2a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * AC-3 tables - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * tables taken directly from the AC-3 spec. - */ - -#include "libavutil/channel_layout.h" -#include "avcodec.h" -#include "ac3tab.h" - -/** - * Possible frame sizes. - * from ATSC A/52 Table 5.18 Frame Size Code Table. - */ -const uint16_t ff_ac3_frame_size_tab[38][3] = { - { 64, 69, 96 }, - { 64, 70, 96 }, - { 80, 87, 120 }, - { 80, 88, 120 }, - { 96, 104, 144 }, - { 96, 105, 144 }, - { 112, 121, 168 }, - { 112, 122, 168 }, - { 128, 139, 192 }, - { 128, 140, 192 }, - { 160, 174, 240 }, - { 160, 175, 240 }, - { 192, 208, 288 }, - { 192, 209, 288 }, - { 224, 243, 336 }, - { 224, 244, 336 }, - { 256, 278, 384 }, - { 256, 279, 384 }, - { 320, 348, 480 }, - { 320, 349, 480 }, - { 384, 417, 576 }, - { 384, 418, 576 }, - { 448, 487, 672 }, - { 448, 488, 672 }, - { 512, 557, 768 }, - { 512, 558, 768 }, - { 640, 696, 960 }, - { 640, 697, 960 }, - { 768, 835, 1152 }, - { 768, 836, 1152 }, - { 896, 975, 1344 }, - { 896, 976, 1344 }, - { 1024, 1114, 1536 }, - { 1024, 1115, 1536 }, - { 1152, 1253, 1728 }, - { 1152, 1254, 1728 }, - { 1280, 1393, 1920 }, - { 1280, 1394, 1920 }, -}; - -/** - * Map audio coding mode (acmod) to number of full-bandwidth channels. - * from ATSC A/52 Table 5.8 Audio Coding Mode - */ -const uint8_t ff_ac3_channels_tab[8] = { - 2, 1, 2, 3, 3, 4, 4, 5 -}; - -/** - * Map audio coding mode (acmod) to channel layout mask. - */ -const uint16_t avpriv_ac3_channel_layout_tab[8] = { - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_SURROUND, - AV_CH_LAYOUT_2_1, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_2_2, - AV_CH_LAYOUT_5POINT0 -}; - -#define COMMON_CHANNEL_MAP \ - { { 0, 1, }, { 0, 1, 2, } },\ - { { 0, }, { 0, 1, } },\ - { { 0, 1, }, { 0, 1, 2, } },\ - { { 0, 2, 1, }, { 0, 2, 1, 3, } },\ - { { 0, 1, 2, }, { 0, 1, 3, 2, } },\ - { { 0, 2, 1, 3, }, { 0, 2, 1, 4, 3, } }, - -/** - * Table to remap channels from SMPTE order to AC-3 order. - * [channel_mode][lfe][ch] - */ -const uint8_t ff_ac3_enc_channel_map[8][2][6] = { - COMMON_CHANNEL_MAP - { { 0, 1, 2, 3, }, { 0, 1, 3, 4, 2, } }, - { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } }, -}; - -/** - * Table to remap channels from AC-3 order to SMPTE order. - * [channel_mode][lfe][ch] - */ -const uint8_t ff_ac3_dec_channel_map[8][2][6] = { - COMMON_CHANNEL_MAP - { { 0, 1, 2, 3, }, { 0, 1, 4, 2, 3, } }, - { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 5, 3, 4 } }, -}; - -/* possible frequencies */ -const uint16_t ff_ac3_sample_rate_tab[3] = { 48000, 44100, 32000 }; - -/* possible bitrates */ -const uint16_t ff_ac3_bitrate_tab[19] = { - 32, 40, 48, 56, 64, 80, 96, 112, 128, - 160, 192, 224, 256, 320, 384, 448, 512, 576, 640 -}; - -/** - * Table of bin locations for rematrixing bands - * reference: Section 7.5.2 Rematrixing : Frequency Band Definitions - */ -const uint8_t ff_ac3_rematrix_band_tab[5] = { 13, 25, 37, 61, 253 }; - -/** - * Table E2.16 Default Coupling Banding Structure - */ -const uint8_t ff_eac3_default_cpl_band_struct[18] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 -}; - -/* AC-3 MDCT window */ - -/* MDCT window */ -DECLARE_ALIGNED(16, const int16_t, ff_ac3_window)[AC3_WINDOW_SIZE/2] = { - 4, 7, 12, 16, 21, 28, 34, 42, - 51, 61, 72, 84, 97, 111, 127, 145, - 164, 184, 207, 231, 257, 285, 315, 347, - 382, 419, 458, 500, 544, 591, 641, 694, - 750, 810, 872, 937, 1007, 1079, 1155, 1235, - 1318, 1406, 1497, 1593, 1692, 1796, 1903, 2016, - 2132, 2253, 2379, 2509, 2644, 2783, 2927, 3076, - 3230, 3389, 3552, 3721, 3894, 4072, 4255, 4444, - 4637, 4835, 5038, 5246, 5459, 5677, 5899, 6127, - 6359, 6596, 6837, 7083, 7334, 7589, 7848, 8112, - 8380, 8652, 8927, 9207, 9491, 9778,10069,10363, -10660,10960,11264,11570,11879,12190,12504,12820, -13138,13458,13780,14103,14427,14753,15079,15407, -15735,16063,16392,16720,17049,17377,17705,18032, -18358,18683,19007,19330,19651,19970,20287,20602, -20914,21225,21532,21837,22139,22438,22733,23025, -23314,23599,23880,24157,24430,24699,24964,25225, -25481,25732,25979,26221,26459,26691,26919,27142, -27359,27572,27780,27983,28180,28373,28560,28742, -28919,29091,29258,29420,29577,29729,29876,30018, -30155,30288,30415,30538,30657,30771,30880,30985, -31086,31182,31274,31363,31447,31528,31605,31678, -31747,31814,31877,31936,31993,32046,32097,32145, -32190,32232,32272,32310,32345,32378,32409,32438, -32465,32490,32513,32535,32556,32574,32592,32608, -32623,32636,32649,32661,32671,32681,32690,32698, -32705,32712,32718,32724,32729,32733,32737,32741, -32744,32747,32750,32752,32754,32756,32757,32759, -32760,32761,32762,32763,32764,32764,32765,32765, -32766,32766,32766,32766,32767,32767,32767,32767, -32767,32767,32767,32767,32767,32767,32767,32767, -32767,32767,32767,32767,32767,32767,32767,32767, -}; - -const uint8_t ff_ac3_log_add_tab[260]= { -0x40,0x3f,0x3e,0x3d,0x3c,0x3b,0x3a,0x39,0x38,0x37, -0x36,0x35,0x34,0x34,0x33,0x32,0x31,0x30,0x2f,0x2f, -0x2e,0x2d,0x2c,0x2c,0x2b,0x2a,0x29,0x29,0x28,0x27, -0x26,0x26,0x25,0x24,0x24,0x23,0x23,0x22,0x21,0x21, -0x20,0x20,0x1f,0x1e,0x1e,0x1d,0x1d,0x1c,0x1c,0x1b, -0x1b,0x1a,0x1a,0x19,0x19,0x18,0x18,0x17,0x17,0x16, -0x16,0x15,0x15,0x15,0x14,0x14,0x13,0x13,0x13,0x12, -0x12,0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f,0x0f, -0x0f,0x0e,0x0e,0x0e,0x0d,0x0d,0x0d,0x0d,0x0c,0x0c, -0x0c,0x0c,0x0b,0x0b,0x0b,0x0b,0x0a,0x0a,0x0a,0x0a, -0x0a,0x09,0x09,0x09,0x09,0x09,0x08,0x08,0x08,0x08, -0x08,0x08,0x07,0x07,0x07,0x07,0x07,0x07,0x06,0x06, -0x06,0x06,0x06,0x06,0x06,0x06,0x05,0x05,0x05,0x05, -0x05,0x05,0x05,0x05,0x04,0x04,0x04,0x04,0x04,0x04, -0x04,0x04,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03, -0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x02, -0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, -0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x01,0x01, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; - -const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3]= { -{ 0x04d0,0x04f0,0x0580 }, -{ 0x04d0,0x04f0,0x0580 }, -{ 0x0440,0x0460,0x04b0 }, -{ 0x0400,0x0410,0x0450 }, -{ 0x03e0,0x03e0,0x0420 }, -{ 0x03c0,0x03d0,0x03f0 }, -{ 0x03b0,0x03c0,0x03e0 }, -{ 0x03b0,0x03b0,0x03d0 }, -{ 0x03a0,0x03b0,0x03c0 }, -{ 0x03a0,0x03a0,0x03b0 }, -{ 0x03a0,0x03a0,0x03b0 }, -{ 0x03a0,0x03a0,0x03b0 }, -{ 0x03a0,0x03a0,0x03a0 }, -{ 0x0390,0x03a0,0x03a0 }, -{ 0x0390,0x0390,0x03a0 }, -{ 0x0390,0x0390,0x03a0 }, -{ 0x0380,0x0390,0x03a0 }, -{ 0x0380,0x0380,0x03a0 }, -{ 0x0370,0x0380,0x03a0 }, -{ 0x0370,0x0380,0x03a0 }, -{ 0x0360,0x0370,0x0390 }, -{ 0x0360,0x0370,0x0390 }, -{ 0x0350,0x0360,0x0390 }, -{ 0x0350,0x0360,0x0390 }, -{ 0x0340,0x0350,0x0380 }, -{ 0x0340,0x0350,0x0380 }, -{ 0x0330,0x0340,0x0380 }, -{ 0x0320,0x0340,0x0370 }, -{ 0x0310,0x0320,0x0360 }, -{ 0x0300,0x0310,0x0350 }, -{ 0x02f0,0x0300,0x0340 }, -{ 0x02f0,0x02f0,0x0330 }, -{ 0x02f0,0x02f0,0x0320 }, -{ 0x02f0,0x02f0,0x0310 }, -{ 0x0300,0x02f0,0x0300 }, -{ 0x0310,0x0300,0x02f0 }, -{ 0x0340,0x0320,0x02f0 }, -{ 0x0390,0x0350,0x02f0 }, -{ 0x03e0,0x0390,0x0300 }, -{ 0x0420,0x03e0,0x0310 }, -{ 0x0460,0x0420,0x0330 }, -{ 0x0490,0x0450,0x0350 }, -{ 0x04a0,0x04a0,0x03c0 }, -{ 0x0460,0x0490,0x0410 }, -{ 0x0440,0x0460,0x0470 }, -{ 0x0440,0x0440,0x04a0 }, -{ 0x0520,0x0480,0x0460 }, -{ 0x0800,0x0630,0x0440 }, -{ 0x0840,0x0840,0x0450 }, -{ 0x0840,0x0840,0x04e0 }, -}; - -const uint8_t ff_ac3_bap_tab[64]= { - 0, 1, 1, 1, 1, 1, 2, 2, 3, 3, - 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, - 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, - 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, - 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, - 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, - 15, 15, 15, 15, -}; - -const uint8_t ff_ac3_slow_decay_tab[4]={ - 0x0f, 0x11, 0x13, 0x15, -}; - -const uint8_t ff_ac3_fast_decay_tab[4]={ - 0x3f, 0x53, 0x67, 0x7b, -}; - -const uint16_t ff_ac3_slow_gain_tab[4]= { - 0x540, 0x4d8, 0x478, 0x410, -}; - -const uint16_t ff_ac3_db_per_bit_tab[4]= { - 0x000, 0x700, 0x900, 0xb00, -}; - -const int16_t ff_ac3_floor_tab[8]= { - 0x2f0, 0x2b0, 0x270, 0x230, 0x1f0, 0x170, 0x0f0, 0xf800, -}; - -const uint16_t ff_ac3_fast_gain_tab[8]= { - 0x080, 0x100, 0x180, 0x200, 0x280, 0x300, 0x380, 0x400, -}; - -/** - * Default channel map for a dependent substream defined by acmod - */ -const uint16_t ff_eac3_default_chmap[8] = { - AC3_CHMAP_L | AC3_CHMAP_R, // FIXME Ch1+Ch2 - AC3_CHMAP_C, - AC3_CHMAP_L | AC3_CHMAP_R, - AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R, - AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_C_SUR, - AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_C_SUR, - AC3_CHMAP_L | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR, - AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_L_SUR | AC3_CHMAP_R_SUR -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.h deleted file mode 100644 index 74cbd9ed6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ac3tab.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * AC-3 tables - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AC3TAB_H -#define AVCODEC_AC3TAB_H - -#include - -#include "libavutil/internal.h" -#include "ac3.h" - -#if CONFIG_HARDCODED_TABLES -# define HCONST const -#else -# define HCONST -#endif - -extern const uint16_t ff_ac3_frame_size_tab[38][3]; -extern const uint8_t ff_ac3_channels_tab[8]; -extern av_export const uint16_t avpriv_ac3_channel_layout_tab[8]; -extern const uint8_t ff_ac3_enc_channel_map[8][2][6]; -extern const uint8_t ff_ac3_dec_channel_map[8][2][6]; -extern const uint16_t ff_ac3_sample_rate_tab[3]; -extern const uint16_t ff_ac3_bitrate_tab[19]; -extern const uint8_t ff_ac3_rematrix_band_tab[5]; -extern const uint8_t ff_eac3_default_cpl_band_struct[18]; -extern const int16_t ff_ac3_window[AC3_WINDOW_SIZE/2]; -extern const uint8_t ff_ac3_log_add_tab[260]; -extern const uint16_t ff_ac3_hearing_threshold_tab[AC3_CRITICAL_BANDS][3]; -extern const uint8_t ff_ac3_bap_tab[64]; -extern const uint8_t ff_ac3_slow_decay_tab[4]; -extern const uint8_t ff_ac3_fast_decay_tab[4]; -extern const uint16_t ff_ac3_slow_gain_tab[4]; -extern const uint16_t ff_ac3_db_per_bit_tab[4]; -extern const int16_t ff_ac3_floor_tab[8]; -extern const uint16_t ff_ac3_fast_gain_tab[8]; -extern const uint16_t ff_eac3_default_chmap[8]; -extern const uint8_t ff_ac3_band_start_tab[AC3_CRITICAL_BANDS+1]; -extern HCONST uint8_t ff_ac3_bin_to_band_tab[253]; - -/** Custom channel map locations bitmask - * Other channels described in documentation: - * Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair, - * Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2 - */ -enum CustomChannelMapLocation{ - AC3_CHMAP_L= 1<<(15-0), - AC3_CHMAP_C= 1<<(15-1), - AC3_CHMAP_R= 1<<(15-2), - AC3_CHMAP_L_SUR= 1<<(15-3), - AC3_CHMAP_R_SUR = 1<<(15-4), - AC3_CHMAP_C_SUR= 1<<(15-7), - AC3_CHMAP_LFE = 1<<(15-15) -}; - -#endif /* AVCODEC_AC3TAB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.c deleted file mode 100644 index e1b3186f3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * various filters for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "config.h" - -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "avcodec.h" -#include "acelp_filters.h" - -const int16_t ff_acelp_interp_filter[61] = { /* (0.15) */ - 29443, 28346, 25207, 20449, 14701, 8693, - 3143, -1352, -4402, -5865, -5850, -4673, - -2783, -672, 1211, 2536, 3130, 2991, - 2259, 1170, 0, -1001, -1652, -1868, - -1666, -1147, -464, 218, 756, 1060, - 1099, 904, 550, 135, -245, -514, - -634, -602, -451, -231, 0, 191, - 308, 340, 296, 198, 78, -36, - -120, -163, -165, -132, -79, -19, - 34, 73, 91, 89, 70, 38, - 0, -}; - -void ff_acelp_interpolate(int16_t* out, const int16_t* in, - const int16_t* filter_coeffs, int precision, - int frac_pos, int filter_length, int length) -{ - int n, i; - - av_assert1(frac_pos >= 0 && frac_pos < precision); - - for (n = 0; n < length; n++) { - int idx = 0; - int v = 0x4000; - - for (i = 0; i < filter_length;) { - - /* The reference G.729 and AMR fixed point code performs clipping after - each of the two following accumulations. - Since clipping affects only the synthetic OVERFLOW test without - causing an int type overflow, it was moved outside the loop. */ - - /* R(x):=ac_v[-k+x] - v += R(n-i)*ff_acelp_interp_filter(t+6i) - v += R(n+i+1)*ff_acelp_interp_filter(6-t+6i) */ - - v += in[n + i] * filter_coeffs[idx + frac_pos]; - idx += precision; - i++; - v += in[n - i] * filter_coeffs[idx - frac_pos]; - } - if (av_clip_int16(v >> 15) != (v >> 15)) - av_log(NULL, AV_LOG_WARNING, "overflow that would need cliping in ff_acelp_interpolate()\n"); - out[n] = v >> 15; - } -} - -void ff_acelp_interpolatef(float *out, const float *in, - const float *filter_coeffs, int precision, - int frac_pos, int filter_length, int length) -{ - int n, i; - - for (n = 0; n < length; n++) { - int idx = 0; - float v = 0; - - for (i = 0; i < filter_length;) { - v += in[n + i] * filter_coeffs[idx + frac_pos]; - idx += precision; - i++; - v += in[n - i] * filter_coeffs[idx - frac_pos]; - } - out[n] = v; - } -} - - -void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2], - const int16_t* in, int length) -{ - int i; - int tmp; - - for (i = 0; i < length; i++) { - tmp = (hpf_f[0]* 15836LL) >> 13; - tmp += (hpf_f[1]* -7667LL) >> 13; - tmp += 7699 * (in[i] - 2*in[i-1] + in[i-2]); - - /* With "+0x800" rounding, clipping is needed - for ALGTHM and SPEECH tests. */ - out[i] = av_clip_int16((tmp + 0x800) >> 12); - - hpf_f[1] = hpf_f[0]; - hpf_f[0] = tmp; - } -} - -void ff_acelp_apply_order_2_transfer_function(float *out, const float *in, - const float zero_coeffs[2], - const float pole_coeffs[2], - float gain, float mem[2], int n) -{ - int i; - float tmp; - - for (i = 0; i < n; i++) { - tmp = gain * in[i] - pole_coeffs[0] * mem[0] - pole_coeffs[1] * mem[1]; - out[i] = tmp + zero_coeffs[0] * mem[0] + zero_coeffs[1] * mem[1]; - - mem[1] = mem[0]; - mem[0] = tmp; - } -} - -void ff_tilt_compensation(float *mem, float tilt, float *samples, int size) -{ - float new_tilt_mem = samples[size - 1]; - int i; - - for (i = size - 1; i > 0; i--) - samples[i] -= tilt * samples[i - 1]; - - samples[0] -= tilt * *mem; - *mem = new_tilt_mem; -} - -void ff_acelp_filter_init(ACELPFContext *c) -{ - c->acelp_interpolatef = ff_acelp_interpolatef; - c->acelp_apply_order_2_transfer_function = ff_acelp_apply_order_2_transfer_function; - - if(HAVE_MIPSFPU) - ff_acelp_filter_init_mips(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.h deleted file mode 100644 index 7a3061bd1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_filters.h +++ /dev/null @@ -1,153 +0,0 @@ -/* - * various filters for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ACELP_FILTERS_H -#define AVCODEC_ACELP_FILTERS_H - -#include - -typedef struct ACELPFContext { - /** - * Floating point version of ff_acelp_interpolate() - */ - void (*acelp_interpolatef)(float *out, const float *in, - const float *filter_coeffs, int precision, - int frac_pos, int filter_length, int length); - - /** - * Apply an order 2 rational transfer function in-place. - * - * @param out output buffer for filtered speech samples - * @param in input buffer containing speech data (may be the same as out) - * @param zero_coeffs z^-1 and z^-2 coefficients of the numerator - * @param pole_coeffs z^-1 and z^-2 coefficients of the denominator - * @param gain scale factor for final output - * @param mem intermediate values used by filter (should be 0 initially) - * @param n number of samples (should be a multiple of eight) - */ - void (*acelp_apply_order_2_transfer_function)(float *out, const float *in, - const float zero_coeffs[2], - const float pole_coeffs[2], - float gain, - float mem[2], int n); - -}ACELPFContext; - -/** - * Initialize ACELPFContext. - */ -void ff_acelp_filter_init(ACELPFContext *c); -void ff_acelp_filter_init_mips(ACELPFContext *c); - -/** - * low-pass Finite Impulse Response filter coefficients. - * - * Hamming windowed sinc filter with cutoff freq 3/40 of the sampling freq, - * the coefficients are scaled by 2^15. - * This array only contains the right half of the filter. - * This filter is likely identical to the one used in G.729, though this - * could not be determined from the original comments with certainty. - */ -extern const int16_t ff_acelp_interp_filter[61]; - -/** - * Generic FIR interpolation routine. - * @param[out] out buffer for interpolated data - * @param in input data - * @param filter_coeffs interpolation filter coefficients (0.15) - * @param precision sub sample factor, that is the precision of the position - * @param frac_pos fractional part of position [0..precision-1] - * @param filter_length filter length - * @param length length of output - * - * filter_coeffs contains coefficients of the right half of the symmetric - * interpolation filter. filter_coeffs[0] should the central (unpaired) coefficient. - * See ff_acelp_interp_filter for an example. - * - */ -void ff_acelp_interpolate(int16_t* out, const int16_t* in, - const int16_t* filter_coeffs, int precision, - int frac_pos, int filter_length, int length); - -/** - * Floating point version of ff_acelp_interpolate() - */ -void ff_acelp_interpolatef(float *out, const float *in, - const float *filter_coeffs, int precision, - int frac_pos, int filter_length, int length); - - -/** - * high-pass filtering and upscaling (4.2.5 of G.729). - * @param[out] out output buffer for filtered speech data - * @param[in,out] hpf_f past filtered data from previous (2 items long) - * frames (-0x20000000 <= (14.13) < 0x20000000) - * @param in speech data to process - * @param length input data size - * - * out[i] = 0.93980581 * in[i] - 1.8795834 * in[i-1] + 0.93980581 * in[i-2] + - * 1.9330735 * out[i-1] - 0.93589199 * out[i-2] - * - * The filter has a cut-off frequency of 1/80 of the sampling freq - * - * @note Two items before the top of the in buffer must contain two items from the - * tail of the previous subframe. - * - * @remark It is safe to pass the same array in in and out parameters. - * - * @remark AMR uses mostly the same filter (cut-off frequency 60Hz, same formula, - * but constants differs in 5th sign after comma). Fortunately in - * fixed-point all coefficients are the same as in G.729. Thus this - * routine can be used for the fixed-point AMR decoder, too. - */ -void ff_acelp_high_pass_filter(int16_t* out, int hpf_f[2], - const int16_t* in, int length); - -/** - * Apply an order 2 rational transfer function in-place. - * - * @param out output buffer for filtered speech samples - * @param in input buffer containing speech data (may be the same as out) - * @param zero_coeffs z^-1 and z^-2 coefficients of the numerator - * @param pole_coeffs z^-1 and z^-2 coefficients of the denominator - * @param gain scale factor for final output - * @param mem intermediate values used by filter (should be 0 initially) - * @param n number of samples - */ -void ff_acelp_apply_order_2_transfer_function(float *out, const float *in, - const float zero_coeffs[2], - const float pole_coeffs[2], - float gain, - float mem[2], int n); - -/** - * Apply tilt compensation filter, 1 - tilt * z-1. - * - * @param mem pointer to the filter's state (one single float) - * @param tilt tilt factor - * @param samples array where the filter is applied - * @param size the size of the samples array - */ -void ff_tilt_compensation(float *mem, float tilt, float *samples, int size); - - -#endif /* AVCODEC_ACELP_FILTERS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.c deleted file mode 100644 index c005c4b4e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - * gain code, gain pitch and pitch delay decoding - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/common.h" -#include "libavutil/float_dsp.h" -#include "libavutil/libm.h" -#include "libavutil/mathematics.h" -#include "avcodec.h" -#include "acelp_pitch_delay.h" -#include "celp_math.h" - -int ff_acelp_decode_8bit_to_1st_delay3(int ac_index) -{ - ac_index += 58; - if(ac_index > 254) - ac_index = 3 * ac_index - 510; - return ac_index; -} - -int ff_acelp_decode_4bit_to_2nd_delay3( - int ac_index, - int pitch_delay_min) -{ - if(ac_index < 4) - return 3 * (ac_index + pitch_delay_min); - else if(ac_index < 12) - return 3 * pitch_delay_min + ac_index + 6; - else - return 3 * (ac_index + pitch_delay_min) - 18; -} - -int ff_acelp_decode_5_6_bit_to_2nd_delay3( - int ac_index, - int pitch_delay_min) -{ - return 3 * pitch_delay_min + ac_index - 2; -} - -int ff_acelp_decode_9bit_to_1st_delay6(int ac_index) -{ - if(ac_index < 463) - return ac_index + 105; - else - return 6 * (ac_index - 368); -} -int ff_acelp_decode_6bit_to_2nd_delay6( - int ac_index, - int pitch_delay_min) -{ - return 6 * pitch_delay_min + ac_index - 3; -} - -void ff_acelp_update_past_gain( - int16_t* quant_energy, - int gain_corr_factor, - int log2_ma_pred_order, - int erasure) -{ - int i; - int avg_gain=quant_energy[(1 << log2_ma_pred_order) - 1]; // (5.10) - - for(i=(1 << log2_ma_pred_order) - 1; i>0; i--) - { - avg_gain += quant_energy[i-1]; - quant_energy[i] = quant_energy[i-1]; - } - - if(erasure) - quant_energy[0] = FFMAX(avg_gain >> log2_ma_pred_order, -10240) - 4096; // -10 and -4 in (5.10) - else - quant_energy[0] = (6165 * ((ff_log2_q15(gain_corr_factor) >> 2) - (13 << 13))) >> 13; -} - -int16_t ff_acelp_decode_gain_code( - DSPContext *dsp, - int gain_corr_factor, - const int16_t* fc_v, - int mr_energy, - const int16_t* quant_energy, - const int16_t* ma_prediction_coeff, - int subframe_size, - int ma_pred_order) -{ - int i; - - mr_energy <<= 10; - - for(i=0; iscalarproduct_int16(fc_v, fc_v, subframe_size, 0))) >> 3) & ~0x3ff); - - mr_energy = (5439 * (mr_energy >> 15)) >> 8; // (0.15) = (0.15) * (7.23) - - return bidir_sal( - ((ff_exp2(mr_energy & 0x7fff) + 16) >> 5) * (gain_corr_factor >> 1), - (mr_energy >> 15) - 25 - ); -#else - mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) / - sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size)); - return mr_energy >> 12; -#endif -} - -float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy, - float *prediction_error, float energy_mean, - const float *pred_table) -{ - // Equations 66-69: - // ^g_c = ^gamma_gc * 100.05 (predicted dB + mean dB - dB of fixed vector) - // Note 10^(0.05 * -10log(average x2)) = 1/sqrt((average x2)). - float val = fixed_gain_factor * - exp2f(M_LOG2_10 * 0.05 * - (avpriv_scalarproduct_float_c(pred_table, prediction_error, 4) + - energy_mean)) / - sqrtf(fixed_mean_energy); - - // update quantified prediction error energy history - memmove(&prediction_error[0], &prediction_error[1], - 3 * sizeof(prediction_error[0])); - prediction_error[3] = 20.0 * log10f(fixed_gain_factor); - - return val; -} - -void ff_decode_pitch_lag(int *lag_int, int *lag_frac, int pitch_index, - const int prev_lag_int, const int subframe, - int third_as_first, int resolution) -{ - /* Note n * 10923 >> 15 is floor(x/3) for 0 <= n <= 32767 */ - if (subframe == 0 || (subframe == 2 && third_as_first)) { - - if (pitch_index < 197) - pitch_index += 59; - else - pitch_index = 3 * pitch_index - 335; - - } else { - if (resolution == 4) { - int search_range_min = av_clip(prev_lag_int - 5, PITCH_DELAY_MIN, - PITCH_DELAY_MAX - 9); - - // decoding with 4-bit resolution - if (pitch_index < 4) { - // integer only precision for [search_range_min, search_range_min+3] - pitch_index = 3 * (pitch_index + search_range_min) + 1; - } else if (pitch_index < 12) { - // 1/3 fractional precision for [search_range_min+3 1/3, search_range_min+5 2/3] - pitch_index += 3 * search_range_min + 7; - } else { - // integer only precision for [search_range_min+6, search_range_min+9] - pitch_index = 3 * (pitch_index + search_range_min - 6) + 1; - } - } else { - // decoding with 5 or 6 bit resolution, 1/3 fractional precision - pitch_index--; - - if (resolution == 5) { - pitch_index += 3 * av_clip(prev_lag_int - 10, PITCH_DELAY_MIN, - PITCH_DELAY_MAX - 19); - } else - pitch_index += 3 * av_clip(prev_lag_int - 5, PITCH_DELAY_MIN, - PITCH_DELAY_MAX - 9); - } - } - *lag_int = pitch_index * 10923 >> 15; - *lag_frac = pitch_index - 3 * *lag_int - 1; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.h deleted file mode 100644 index 72977f1f4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_pitch_delay.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * gain code, gain pitch and pitch delay decoding - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ACELP_PITCH_DELAY_H -#define AVCODEC_ACELP_PITCH_DELAY_H - -#include -#include "dsputil.h" - -#define PITCH_DELAY_MIN 20 -#define PITCH_DELAY_MAX 143 - -/** - * @brief Decode pitch delay of the first subframe encoded by 8 bits with 1/3 - * resolution. - * @param ac_index adaptive codebook index (8 bits) - * - * @return pitch delay in 1/3 units - * - * Pitch delay is coded: - * with 1/3 resolution, 19 < pitch_delay < 85 - * integers only, 85 <= pitch_delay <= 143 - */ -int ff_acelp_decode_8bit_to_1st_delay3(int ac_index); - -/** - * @brief Decode pitch delay of the second subframe encoded by 5 or 6 bits - * with 1/3 precision. - * @param ac_index adaptive codebook index (5 or 6 bits) - * @param pitch_delay_min lower bound (integer) of pitch delay interval - * for second subframe - * - * @return pitch delay in 1/3 units - * - * Pitch delay is coded: - * with 1/3 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5 - * - * @remark The routine is used in G.729 @@8k, AMR @@10.2k, AMR @@7.95k, - * AMR @@7.4k for the second subframe. - */ -int ff_acelp_decode_5_6_bit_to_2nd_delay3( - int ac_index, - int pitch_delay_min); - -/** - * @brief Decode pitch delay with 1/3 precision. - * @param ac_index adaptive codebook index (4 bits) - * @param pitch_delay_min lower bound (integer) of pitch delay interval for - * second subframe - * - * @return pitch delay in 1/3 units - * - * Pitch delay is coded: - * integers only, -6 < pitch_delay - int(prev_pitch_delay) <= -2 - * with 1/3 resolution, -2 < pitch_delay - int(prev_pitch_delay) < 1 - * integers only, 1 <= pitch_delay - int(prev_pitch_delay) < 5 - * - * @remark The routine is used in G.729 @@6.4k, AMR @@6.7k, AMR @@5.9k, - * AMR @@5.15k, AMR @@4.75k for the second subframe. - */ -int ff_acelp_decode_4bit_to_2nd_delay3( - int ac_index, - int pitch_delay_min); - -/** - * @brief Decode pitch delay of the first subframe encoded by 9 bits - * with 1/6 precision. - * @param ac_index adaptive codebook index (9 bits) - * - * @return pitch delay in 1/6 units - * - * Pitch delay is coded: - * with 1/6 resolution, 17 < pitch_delay < 95 - * integers only, 95 <= pitch_delay <= 143 - * - * @remark The routine is used in AMR @@12.2k for the first and third subframes. - */ -int ff_acelp_decode_9bit_to_1st_delay6(int ac_index); - -/** - * @brief Decode pitch delay of the second subframe encoded by 6 bits - * with 1/6 precision. - * @param ac_index adaptive codebook index (6 bits) - * @param pitch_delay_min lower bound (integer) of pitch delay interval for - * second subframe - * - * @return pitch delay in 1/6 units - * - * Pitch delay is coded: - * with 1/6 resolution, -6 < pitch_delay - int(prev_pitch_delay) < 5 - * - * @remark The routine is used in AMR @@12.2k for the second and fourth subframes. - */ -int ff_acelp_decode_6bit_to_2nd_delay6( - int ac_index, - int pitch_delay_min); - -/** - * @brief Update past quantized energies - * @param[in,out] quant_energy past quantized energies (5.10) - * @param gain_corr_factor gain correction factor - * @param log2_ma_pred_order log2() of MA prediction order - * @param erasure frame erasure flag - * - * If frame erasure flag is not equal to zero, memory is updated with - * averaged energy, attenuated by 4dB: - * max(avg(quant_energy[i])-4, -14), i=0,ma_pred_order - * - * In normal mode memory is updated with - * Er - Ep = 20 * log10(gain_corr_factor) - * - * @remark The routine is used in G.729 and AMR (all modes). - */ -void ff_acelp_update_past_gain( - int16_t* quant_energy, - int gain_corr_factor, - int log2_ma_pred_order, - int erasure); - -/** - * @brief Decode the adaptive codebook gain and add - * correction (4.1.5 and 3.9.1 of G.729). - * @param dsp initialized dsputil context - * @param gain_corr_factor gain correction factor (2.13) - * @param fc_v fixed-codebook vector (2.13) - * @param mr_energy mean innovation energy and fixed-point correction (7.13) - * @param[in,out] quant_energy past quantized energies (5.10) - * @param subframe_size length of subframe - * - * @return quantized fixed-codebook gain (14.1) - * - * The routine implements equations 69, 66 and 71 of the G.729 specification (3.9.1) - * - * Em - mean innovation energy (dB, constant, depends on decoding algorithm) - * Ep - mean-removed predicted energy (dB) - * Er - mean-removed innovation energy (dB) - * Ei - mean energy of the fixed-codebook contribution (dB) - * N - subframe_size - * M - MA (Moving Average) prediction order - * gc - fixed-codebook gain - * gc_p - predicted fixed-codebook gain - * - * Fixed codebook gain is computed using predicted gain gc_p and - * correction factor gain_corr_factor as shown below: - * - * gc = gc_p * gain_corr_factor - * - * The predicted fixed codebook gain gc_p is found by predicting - * the energy of the fixed-codebook contribution from the energy - * of previous fixed-codebook contributions. - * - * mean = 1/N * sum(i,0,N){ fc_v[i] * fc_v[i] } - * - * Ei = 10log(mean) - * - * Er = 10log(1/N * gc^2 * mean) - Em = 20log(gc) + Ei - Em - * - * Replacing Er with Ep and gc with gc_p we will receive: - * - * Ep = 10log(1/N * gc_p^2 * mean) - Em = 20log(gc_p) + Ei - Em - * - * and from above: - * - * gc_p = 10^((Ep - Ei + Em) / 20) - * - * Ep is predicted using past energies and prediction coefficients: - * - * Ep = sum(i,0,M){ ma_prediction_coeff[i] * quant_energy[i] } - * - * gc_p in fixed-point arithmetic is calculated as following: - * - * mean = 1/N * sum(i,0,N){ (fc_v[i] / 2^13) * (fc_v[i] / 2^13) } = - * = 1/N * sum(i,0,N) { fc_v[i] * fc_v[i] } / 2^26 - * - * Ei = 10log(mean) = -10log(N) - 10log(2^26) + - * + 10log(sum(i,0,N) { fc_v[i] * fc_v[i] }) - * - * Ep - Ei + Em = Ep + Em + 10log(N) + 10log(2^26) - - * - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] }) = - * = Ep + mr_energy - 10log(sum(i,0,N) { fc_v[i] * fc_v[i] }) - * - * gc_p = 10 ^ ((Ep - Ei + Em) / 20) = - * = 2 ^ (3.3219 * (Ep - Ei + Em) / 20) = 2 ^ (0.166 * (Ep - Ei + Em)) - * - * where - * - * mr_energy = Em + 10log(N) + 10log(2^26) - * - * @remark The routine is used in G.729 and AMR (all modes). - */ -int16_t ff_acelp_decode_gain_code( - DSPContext *dsp, - int gain_corr_factor, - const int16_t* fc_v, - int mr_energy, - const int16_t* quant_energy, - const int16_t* ma_prediction_coeff, - int subframe_size, - int max_pred_order); - -/** - * Calculate fixed gain (part of section 6.1.3 of AMR spec) - * - * @param fixed_gain_factor gain correction factor - * @param fixed_mean_energy mean decoded algebraic codebook vector energy - * @param prediction_error vector of the quantified predictor errors of - * the four previous subframes. It is updated by this function. - * @param energy_mean desired mean innovation energy - * @param pred_table table of four moving average coefficients - */ -float ff_amr_set_fixed_gain(float fixed_gain_factor, float fixed_mean_energy, - float *prediction_error, float energy_mean, - const float *pred_table); - - -/** - * Decode the adaptive codebook index to the integer and fractional parts - * of the pitch lag for one subframe at 1/3 fractional precision. - * - * The choice of pitch lag is described in 3GPP TS 26.090 section 5.6.1. - * - * @param lag_int integer part of pitch lag of the current subframe - * @param lag_frac fractional part of pitch lag of the current subframe - * @param pitch_index parsed adaptive codebook (pitch) index - * @param prev_lag_int integer part of pitch lag for the previous subframe - * @param subframe current subframe number - * @param third_as_first treat the third frame the same way as the first - */ -void ff_decode_pitch_lag(int *lag_int, int *lag_frac, int pitch_index, - const int prev_lag_int, const int subframe, - int third_as_first, int resolution); - -#endif /* AVCODEC_ACELP_PITCH_DELAY_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.c deleted file mode 100644 index 86851a3a8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * adaptive and fixed codebook vector operations for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/common.h" -#include "libavutil/float_dsp.h" -#include "avcodec.h" -#include "acelp_vectors.h" - -const uint8_t ff_fc_2pulses_9bits_track1[16] = -{ - 1, 3, - 6, 8, - 11, 13, - 16, 18, - 21, 23, - 26, 28, - 31, 33, - 36, 38 -}; -const uint8_t ff_fc_2pulses_9bits_track1_gray[16] = -{ - 1, 3, - 8, 6, - 18, 16, - 11, 13, - 38, 36, - 31, 33, - 21, 23, - 28, 26, -}; - -const uint8_t ff_fc_2pulses_9bits_track2_gray[32] = -{ - 0, 2, - 5, 4, - 12, 10, - 7, 9, - 25, 24, - 20, 22, - 14, 15, - 19, 17, - 36, 31, - 21, 26, - 1, 6, - 16, 11, - 27, 29, - 32, 30, - 39, 37, - 34, 35, -}; - -const uint8_t ff_fc_4pulses_8bits_tracks_13[16] = -{ - 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, -}; - -const uint8_t ff_fc_4pulses_8bits_track_4[32] = -{ - 3, 4, - 8, 9, - 13, 14, - 18, 19, - 23, 24, - 28, 29, - 33, 34, - 38, 39, - 43, 44, - 48, 49, - 53, 54, - 58, 59, - 63, 64, - 68, 69, - 73, 74, - 78, 79, -}; - -const float ff_pow_0_7[10] = { - 0.700000, 0.490000, 0.343000, 0.240100, 0.168070, - 0.117649, 0.082354, 0.057648, 0.040354, 0.028248 -}; - -const float ff_pow_0_75[10] = { - 0.750000, 0.562500, 0.421875, 0.316406, 0.237305, - 0.177979, 0.133484, 0.100113, 0.075085, 0.056314 -}; - -const float ff_pow_0_55[10] = { - 0.550000, 0.302500, 0.166375, 0.091506, 0.050328, - 0.027681, 0.015224, 0.008373, 0.004605, 0.002533 -}; - -const float ff_b60_sinc[61] = { - 0.898529 , 0.865051 , 0.769257 , 0.624054 , 0.448639 , 0.265289 , - 0.0959167 , -0.0412598 , -0.134338 , -0.178986 , -0.178528 , -0.142609 , --0.0849304 , -0.0205078 , 0.0369568 , 0.0773926 , 0.0955200 , 0.0912781 , - 0.0689392 , 0.0357056 , 0.0 , -0.0305481 , -0.0504150 , -0.0570068 , --0.0508423 , -0.0350037 , -0.0141602 , 0.00665283, 0.0230713 , 0.0323486 , - 0.0335388 , 0.0275879 , 0.0167847 , 0.00411987, -0.00747681, -0.0156860 , --0.0193481 , -0.0183716 , -0.0137634 , -0.00704956, 0.0 , 0.00582886 , - 0.00939941, 0.0103760 , 0.00903320, 0.00604248, 0.00238037, -0.00109863 , --0.00366211, -0.00497437, -0.00503540, -0.00402832, -0.00241089, -0.000579834, - 0.00103760, 0.00222778, 0.00277710, 0.00271606, 0.00213623, 0.00115967 , - 0. -}; - -void ff_acelp_fc_pulse_per_track( - int16_t* fc_v, - const uint8_t *tab1, - const uint8_t *tab2, - int pulse_indexes, - int pulse_signs, - int pulse_count, - int bits) -{ - int mask = (1 << bits) - 1; - int i; - - for(i=0; i>= bits; - pulse_signs >>= 1; - } - - fc_v[tab2[pulse_indexes]] += (pulse_signs & 1) ? 8191 : -8192; -} - -void ff_decode_10_pulses_35bits(const int16_t *fixed_index, - AMRFixed *fixed_sparse, - const uint8_t *gray_decode, - int half_pulse_count, int bits) -{ - int i; - int mask = (1 << bits) - 1; - - fixed_sparse->no_repeat_mask = 0; - fixed_sparse->n = 2 * half_pulse_count; - for (i = 0; i < half_pulse_count; i++) { - const int pos1 = gray_decode[fixed_index[2*i+1] & mask] + i; - const int pos2 = gray_decode[fixed_index[2*i ] & mask] + i; - const float sign = (fixed_index[2*i+1] & (1 << bits)) ? -1.0 : 1.0; - fixed_sparse->x[2*i+1] = pos1; - fixed_sparse->x[2*i ] = pos2; - fixed_sparse->y[2*i+1] = sign; - fixed_sparse->y[2*i ] = pos2 < pos1 ? -sign : sign; - } -} - -void ff_acelp_weighted_vector_sum( - int16_t* out, - const int16_t *in_a, - const int16_t *in_b, - int16_t weight_coeff_a, - int16_t weight_coeff_b, - int16_t rounder, - int shift, - int length) -{ - int i; - - // Clipping required here; breaks OVERFLOW test. - for(i=0; i> shift); -} - -void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, - float weight_coeff_a, float weight_coeff_b, int length) -{ - int i; - - for(i=0; in; i++) { - int x = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1); - float y = in->y[i] * scale; - - if (in->pitch_lag > 0) - do { - out[x] += y; - y *= in->pitch_fac; - x += in->pitch_lag; - } while (x < size && repeats); - } -} - -void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size) -{ - int i; - - for (i=0; i < in->n; i++) { - int x = in->x[i], repeats = !((in->no_repeat_mask >> i) & 1); - - if (in->pitch_lag > 0) - do { - out[x] = 0.0; - x += in->pitch_lag; - } while (x < size && repeats); - } -} - -void ff_acelp_vectors_init(ACELPVContext *c) -{ - c->weighted_vector_sumf = ff_weighted_vector_sumf; - - if(HAVE_MIPSFPU) - ff_acelp_vectors_init_mips(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.h deleted file mode 100644 index fae834dac..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/acelp_vectors.h +++ /dev/null @@ -1,288 +0,0 @@ -/* - * adaptive and fixed codebook vector operations for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ACELP_VECTORS_H -#define AVCODEC_ACELP_VECTORS_H - -#include - -typedef struct ACELPVContext { - /** - * float implementation of weighted sum of two vectors. - * @param[out] out result of addition - * @param in_a first vector - * @param in_b second vector - * @param weight_coeff_a first vector weight coefficient - * @param weight_coeff_a second vector weight coefficient - * @param length vectors length (should be a multiple of two) - * - * @note It is safe to pass the same buffer for out and in_a or in_b. - */ - void (*weighted_vector_sumf)(float *out, const float *in_a, const float *in_b, - float weight_coeff_a, float weight_coeff_b, - int length); - -}ACELPVContext; - -/** - * Initialize ACELPVContext. - */ -void ff_acelp_vectors_init(ACELPVContext *c); -void ff_acelp_vectors_init_mips(ACELPVContext *c); - -/** Sparse representation for the algebraic codebook (fixed) vector */ -typedef struct AMRFixed { - int n; - int x[10]; - float y[10]; - int no_repeat_mask; - int pitch_lag; - float pitch_fac; -} AMRFixed; - -/** - * Track|Pulse| Positions - * ------------------------------------------------------------------------- - * 1 | 0 | 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75 - * ------------------------------------------------------------------------- - * 2 | 1 | 1, 6, 11, 16, 21, 26, 31, 36, 41, 46, 51, 56, 61, 66, 71, 76 - * ------------------------------------------------------------------------- - * 3 | 2 | 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, 57, 62, 67, 72, 77 - * ------------------------------------------------------------------------- - * - * Table contains only first the pulse indexes. - * - * Used in G.729 @@8k, G.729 @@4.4k, AMR @@7.95k, AMR @@7.40k - */ -extern const uint8_t ff_fc_4pulses_8bits_tracks_13[16]; - -/** - * Track|Pulse| Positions - * ------------------------------------------------------------------------- - * 4 | 3 | 3, 8, 13, 18, 23, 28, 33, 38, 43, 48, 53, 58, 63, 68, 73, 78 - * | | 4, 9, 14, 19, 24, 29, 34, 39, 44, 49, 54, 59, 64, 69, 74, 79 - * ------------------------------------------------------------------------- - * - * @remark Track in the table should be read top-to-bottom, left-to-right. - * - * Used in G.729 @@8k, G.729 @@4.4k, AMR @@7.95k, AMR @@7.40k - */ -extern const uint8_t ff_fc_4pulses_8bits_track_4[32]; - -/** - * Track|Pulse| Positions - * ----------------------------------------- - * 1 | 0 | 1, 6, 11, 16, 21, 26, 31, 36 - * | | 3, 8, 13, 18, 23, 28, 33, 38 - * ----------------------------------------- - * - * @remark Track in the table should be read top-to-bottom, left-to-right. - * - * @note (EE) Reference G.729D code also uses gray decoding for each - * pulse index before looking up the value in the table. - * - * Used in G.729 @@6.4k (with gray coding), AMR @@5.9k (without gray coding) - */ -extern const uint8_t ff_fc_2pulses_9bits_track1[16]; -extern const uint8_t ff_fc_2pulses_9bits_track1_gray[16]; - -/** - * Track|Pulse| Positions - * ----------------------------------------- - * 2 | 1 | 0, 7, 14, 20, 27, 34, 1, 21 - * | | 2, 9, 15, 22, 29, 35, 6, 26 - * | | 4,10, 17, 24, 30, 37, 11, 31 - * | | 5,12, 19, 25, 32, 39, 16, 36 - * ----------------------------------------- - * - * @remark Track in the table should be read top-to-bottom, left-to-right. - * - * @note (EE.1) This table (from the reference code) does not comply with - * the specification. - * The specification contains the following table: - * - * Track|Pulse| Positions - * ----------------------------------------- - * 2 | 1 | 0, 5, 10, 15, 20, 25, 30, 35 - * | | 1, 6, 11, 16, 21, 26, 31, 36 - * | | 2, 7, 12, 17, 22, 27, 32, 37 - * | | 4, 9, 14, 19, 24, 29, 34, 39 - * - * ----------------------------------------- - * - * @note (EE.2) Reference G.729D code also uses gray decoding for each - * pulse index before looking up the value in the table. - * - * Used in G.729 @@6.4k (with gray coding) - */ -extern const uint8_t ff_fc_2pulses_9bits_track2_gray[32]; - -/** - * b60 hamming windowed sinc function coefficients - */ -extern const float ff_b60_sinc[61]; - -/** - * Table of pow(0.7,n) - */ -extern const float ff_pow_0_7[10]; - -/** - * Table of pow(0.75,n) - */ -extern const float ff_pow_0_75[10]; - -/** - * Table of pow(0.55,n) - */ -extern const float ff_pow_0_55[10]; - -/** - * Decode fixed-codebook vector (3.8 and D.5.8 of G.729, 5.7.1 of AMR). - * @param[out] fc_v decoded fixed codebook vector (2.13) - * @param tab1 table used for first pulse_count pulses - * @param tab2 table used for last pulse - * @param pulse_indexes fixed codebook indexes - * @param pulse_signs signs of the excitation pulses (0 bit value - * means negative sign) - * @param bits number of bits per one pulse index - * @param pulse_count number of pulses decoded using first table - * @param bits length of one pulse index in bits - * - * Used in G.729 @@8k, G.729 @@4.4k, G.729 @@6.4k, AMR @@7.95k, AMR @@7.40k - */ -void ff_acelp_fc_pulse_per_track(int16_t* fc_v, - const uint8_t *tab1, - const uint8_t *tab2, - int pulse_indexes, - int pulse_signs, - int pulse_count, - int bits); - -/** - * Decode the algebraic codebook index to pulse positions and signs and - * construct the algebraic codebook vector for MODE_12k2. - * - * @note: The positions and signs are explicitly coded in MODE_12k2. - * - * @param fixed_index positions of the ten pulses - * @param fixed_sparse pointer to the algebraic codebook vector - * @param gray_decode gray decoding table - * @param half_pulse_count number of couples of pulses - * @param bits length of one pulse index in bits - */ -void ff_decode_10_pulses_35bits(const int16_t *fixed_index, - AMRFixed *fixed_sparse, - const uint8_t *gray_decode, - int half_pulse_count, int bits); - - -/** - * weighted sum of two vectors with rounding. - * @param[out] out result of addition - * @param in_a first vector - * @param in_b second vector - * @param weight_coeff_a first vector weight coefficient - * @param weight_coeff_a second vector weight coefficient - * @param rounder this value will be added to the sum of the two vectors - * @param shift result will be shifted to right by this value - * @param length vectors length - * - * @note It is safe to pass the same buffer for out and in_a or in_b. - * - * out[i] = (in_a[i]*weight_a + in_b[i]*weight_b + rounder) >> shift - */ -void ff_acelp_weighted_vector_sum(int16_t* out, - const int16_t *in_a, - const int16_t *in_b, - int16_t weight_coeff_a, - int16_t weight_coeff_b, - int16_t rounder, - int shift, - int length); - -/** - * float implementation of weighted sum of two vectors. - * @param[out] out result of addition - * @param in_a first vector - * @param in_b second vector - * @param weight_coeff_a first vector weight coefficient - * @param weight_coeff_a second vector weight coefficient - * @param length vectors length - * - * @note It is safe to pass the same buffer for out and in_a or in_b. - */ -void ff_weighted_vector_sumf(float *out, const float *in_a, const float *in_b, - float weight_coeff_a, float weight_coeff_b, - int length); - -/** - * Adaptive gain control (as used in AMR postfiltering) - * - * @param out output buffer for filtered speech data - * @param in the input speech buffer (may be the same as out) - * @param speech_energ input energy - * @param size the input buffer size - * @param alpha exponential filter factor - * @param gain_mem a pointer to the filter memory (single float of size) - */ -void ff_adaptive_gain_control(float *out, const float *in, float speech_energ, - int size, float alpha, float *gain_mem); - -/** - * Set the sum of squares of a signal by scaling - * - * @param out output samples - * @param in input samples - * @param sum_of_squares new sum of squares - * @param n number of samples - * - * @note If the input is zero (or its energy underflows), the output is zero. - * This is the behavior of AGC in the AMR reference decoder. The QCELP - * reference decoder seems to have undefined behavior. - * - * TIA/EIA/IS-733 2.4.8.3-2/3/4/5, 2.4.8.6 - * 3GPP TS 26.090 6.1 (6) - */ -void ff_scale_vector_to_given_sum_of_squares(float *out, const float *in, - float sum_of_squares, const int n); - -/** - * Add fixed vector to an array from a sparse representation - * - * @param out fixed vector with pitch sharpening - * @param in sparse fixed vector - * @param scale number to multiply the fixed vector by - * @param size the output vector size - */ -void ff_set_fixed_vector(float *out, const AMRFixed *in, float scale, int size); - -/** - * Clear array values set by set_fixed_vector - * - * @param out fixed vector to be cleared - * @param in sparse fixed vector - * @param size the output vector size - */ -void ff_clear_fixed_vector(float *out, const AMRFixed *in, int size); - -#endif /* AVCODEC_ACELP_VECTORS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.c deleted file mode 100644 index f8663a7f6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.c +++ /dev/null @@ -1,1583 +0,0 @@ -/* - * Copyright (c) 2001-2003 The ffmpeg Project - * - * first version by Francois Revol (revol@free.fr) - * fringe ADPCM codecs (e.g., DK3, DK4, Westwood) - * by Mike Melanson (melanson@pcisys.net) - * CD-ROM XA ADPCM codec by BERO - * EA ADPCM decoder by Robin Kay (komadori@myrealbox.com) - * EA ADPCM R1/R2/R3 decoder by Peter Ross (pross@xvid.org) - * EA IMA EACS decoder by Peter Ross (pross@xvid.org) - * EA IMA SEAD decoder by Peter Ross (pross@xvid.org) - * EA ADPCM XAS decoder by Peter Ross (pross@xvid.org) - * MAXIS EA ADPCM decoder by Robert Marston (rmarston@gmail.com) - * THP ADPCM decoder by Marco Gerards (mgerards@xs4all.nl) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "avcodec.h" -#include "get_bits.h" -#include "bytestream.h" -#include "adpcm.h" -#include "adpcm_data.h" -#include "internal.h" -#include "libavutil/internal.h" - -/** - * @file - * ADPCM decoders - * Features and limitations: - * - * Reference documents: - * http://wiki.multimedia.cx/index.php?title=Category:ADPCM_Audio_Codecs - * http://www.pcisys.net/~melanson/codecs/simpleaudio.html [dead] - * http://www.geocities.com/SiliconValley/8682/aud3.txt [dead] - * http://openquicktime.sourceforge.net/ - * XAnim sources (xa_codec.c) http://xanim.polter.net/ - * http://www.cs.ucla.edu/~leec/mediabench/applications.html [dead] - * SoX source code http://sox.sourceforge.net/ - * - * CD-ROM XA: - * http://ku-www.ss.titech.ac.jp/~yatsushi/xaadpcm.html [dead] - * vagpack & depack http://homepages.compuserve.de/bITmASTER32/psx-index.html [dead] - * readstr http://www.geocities.co.jp/Playtown/2004/ - */ - -/* These are for CD-ROM XA ADPCM */ -static const int xa_adpcm_table[5][2] = { - { 0, 0 }, - { 60, 0 }, - { 115, -52 }, - { 98, -55 }, - { 122, -60 } -}; - -static const int ea_adpcm_table[] = { - 0, 240, 460, 392, - 0, 0, -208, -220, - 0, 1, 3, 4, - 7, 8, 10, 11, - 0, -1, -3, -4 -}; - -// padded to zero where table size is less then 16 -static const int swf_index_tables[4][16] = { - /*2*/ { -1, 2 }, - /*3*/ { -1, -1, 2, 4 }, - /*4*/ { -1, -1, -1, -1, 2, 4, 6, 8 }, - /*5*/ { -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16 } -}; - -/* end of tables */ - -typedef struct ADPCMDecodeContext { - ADPCMChannelStatus status[6]; - int vqa_version; /**< VQA version. Used for ADPCM_IMA_WS */ -} ADPCMDecodeContext; - -static av_cold int adpcm_decode_init(AVCodecContext * avctx) -{ - ADPCMDecodeContext *c = avctx->priv_data; - unsigned int min_channels = 1; - unsigned int max_channels = 2; - - switch(avctx->codec->id) { - case AV_CODEC_ID_ADPCM_DTK: - case AV_CODEC_ID_ADPCM_EA: - min_channels = 2; - break; - case AV_CODEC_ID_ADPCM_AFC: - case AV_CODEC_ID_ADPCM_EA_R1: - case AV_CODEC_ID_ADPCM_EA_R2: - case AV_CODEC_ID_ADPCM_EA_R3: - case AV_CODEC_ID_ADPCM_EA_XAS: - case AV_CODEC_ID_ADPCM_THP: - max_channels = 6; - break; - default: break; - } - if (avctx->channels < min_channels || avctx->channels > max_channels) { - av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); - return AVERROR(EINVAL); - } - - switch(avctx->codec->id) { - case AV_CODEC_ID_ADPCM_CT: - c->status[0].step = c->status[1].step = 511; - break; - case AV_CODEC_ID_ADPCM_IMA_WAV: - if (avctx->bits_per_coded_sample < 2 || avctx->bits_per_coded_sample > 5) - return AVERROR_INVALIDDATA; - break; - case AV_CODEC_ID_ADPCM_IMA_APC: - if (avctx->extradata && avctx->extradata_size >= 8) { - c->status[0].predictor = AV_RL32(avctx->extradata); - c->status[1].predictor = AV_RL32(avctx->extradata + 4); - } - break; - case AV_CODEC_ID_ADPCM_IMA_WS: - if (avctx->extradata && avctx->extradata_size >= 2) - c->vqa_version = AV_RL16(avctx->extradata); - break; - default: - break; - } - - switch(avctx->codec->id) { - case AV_CODEC_ID_ADPCM_IMA_QT: - case AV_CODEC_ID_ADPCM_IMA_WAV: - case AV_CODEC_ID_ADPCM_4XM: - case AV_CODEC_ID_ADPCM_XA: - case AV_CODEC_ID_ADPCM_EA_R1: - case AV_CODEC_ID_ADPCM_EA_R2: - case AV_CODEC_ID_ADPCM_EA_R3: - case AV_CODEC_ID_ADPCM_EA_XAS: - case AV_CODEC_ID_ADPCM_THP: - case AV_CODEC_ID_ADPCM_AFC: - case AV_CODEC_ID_ADPCM_DTK: - avctx->sample_fmt = AV_SAMPLE_FMT_S16P; - break; - case AV_CODEC_ID_ADPCM_IMA_WS: - avctx->sample_fmt = c->vqa_version == 3 ? AV_SAMPLE_FMT_S16P : - AV_SAMPLE_FMT_S16; - break; - default: - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - } - - return 0; -} - -static inline short adpcm_ima_expand_nibble(ADPCMChannelStatus *c, char nibble, int shift) -{ - int step_index; - int predictor; - int sign, delta, diff, step; - - step = ff_adpcm_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_index_table[(unsigned)nibble]; - step_index = av_clip(step_index, 0, 88); - - sign = nibble & 8; - delta = nibble & 7; - /* perform direct multiplication instead of series of jumps proposed by - * the reference ADPCM implementation since modern CPUs can do the mults - * quickly enough */ - diff = ((2 * delta + 1) * step) >> shift; - predictor = c->predictor; - if (sign) predictor -= diff; - else predictor += diff; - - c->predictor = av_clip_int16(predictor); - c->step_index = step_index; - - return (short)c->predictor; -} - -static inline int16_t adpcm_ima_wav_expand_nibble(ADPCMChannelStatus *c, GetBitContext *gb, int bps) -{ - int nibble, step_index, predictor, sign, delta, diff, step, shift; - - shift = bps - 1; - nibble = get_bits_le(gb, bps), - step = ff_adpcm_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_index_tables[bps - 2][nibble]; - step_index = av_clip(step_index, 0, 88); - - sign = nibble & (1 << shift); - delta = nibble & ((1 << shift) - 1); - diff = ((2 * delta + 1) * step) >> shift; - predictor = c->predictor; - if (sign) predictor -= diff; - else predictor += diff; - - c->predictor = av_clip_int16(predictor); - c->step_index = step_index; - - return (int16_t)c->predictor; -} - -static inline int adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble, int shift) -{ - int step_index; - int predictor; - int diff, step; - - step = ff_adpcm_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_index_table[nibble]; - step_index = av_clip(step_index, 0, 88); - - diff = step >> 3; - if (nibble & 4) diff += step; - if (nibble & 2) diff += step >> 1; - if (nibble & 1) diff += step >> 2; - - if (nibble & 8) - predictor = c->predictor - diff; - else - predictor = c->predictor + diff; - - c->predictor = av_clip_int16(predictor); - c->step_index = step_index; - - return c->predictor; -} - -static inline short adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble) -{ - int predictor; - - predictor = (((c->sample1) * (c->coeff1)) + ((c->sample2) * (c->coeff2))) / 64; - predictor += ((nibble & 0x08)?(nibble - 0x10):(nibble)) * c->idelta; - - c->sample2 = c->sample1; - c->sample1 = av_clip_int16(predictor); - c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8; - if (c->idelta < 16) c->idelta = 16; - - return c->sample1; -} - -static inline short adpcm_ima_oki_expand_nibble(ADPCMChannelStatus *c, int nibble) -{ - int step_index, predictor, sign, delta, diff, step; - - step = ff_adpcm_oki_step_table[c->step_index]; - step_index = c->step_index + ff_adpcm_index_table[(unsigned)nibble]; - step_index = av_clip(step_index, 0, 48); - - sign = nibble & 8; - delta = nibble & 7; - diff = ((2 * delta + 1) * step) >> 3; - predictor = c->predictor; - if (sign) predictor -= diff; - else predictor += diff; - - c->predictor = av_clip(predictor, -2048, 2047); - c->step_index = step_index; - - return c->predictor << 4; -} - -static inline short adpcm_ct_expand_nibble(ADPCMChannelStatus *c, char nibble) -{ - int sign, delta, diff; - int new_step; - - sign = nibble & 8; - delta = nibble & 7; - /* perform direct multiplication instead of series of jumps proposed by - * the reference ADPCM implementation since modern CPUs can do the mults - * quickly enough */ - diff = ((2 * delta + 1) * c->step) >> 3; - /* predictor update is not so trivial: predictor is multiplied on 254/256 before updating */ - c->predictor = ((c->predictor * 254) >> 8) + (sign ? -diff : diff); - c->predictor = av_clip_int16(c->predictor); - /* calculate new step and clamp it to range 511..32767 */ - new_step = (ff_adpcm_AdaptationTable[nibble & 7] * c->step) >> 8; - c->step = av_clip(new_step, 511, 32767); - - return (short)c->predictor; -} - -static inline short adpcm_sbpro_expand_nibble(ADPCMChannelStatus *c, char nibble, int size, int shift) -{ - int sign, delta, diff; - - sign = nibble & (1<<(size-1)); - delta = nibble & ((1<<(size-1))-1); - diff = delta << (7 + c->step + shift); - - /* clamp result */ - c->predictor = av_clip(c->predictor + (sign ? -diff : diff), -16384,16256); - - /* calculate new step */ - if (delta >= (2*size - 3) && c->step < 3) - c->step++; - else if (delta == 0 && c->step > 0) - c->step--; - - return (short) c->predictor; -} - -static inline short adpcm_yamaha_expand_nibble(ADPCMChannelStatus *c, unsigned char nibble) -{ - if(!c->step) { - c->predictor = 0; - c->step = 127; - } - - c->predictor += (c->step * ff_adpcm_yamaha_difflookup[nibble]) / 8; - c->predictor = av_clip_int16(c->predictor); - c->step = (c->step * ff_adpcm_yamaha_indexscale[nibble]) >> 8; - c->step = av_clip(c->step, 127, 24567); - return c->predictor; -} - -static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1, - const uint8_t *in, ADPCMChannelStatus *left, - ADPCMChannelStatus *right, int channels, int sample_offset) -{ - int i, j; - int shift,filter,f0,f1; - int s_1,s_2; - int d,s,t; - - out0 += sample_offset; - if (channels == 1) - out1 = out0 + 28; - else - out1 += sample_offset; - - for(i=0;i<4;i++) { - shift = 12 - (in[4+i*2] & 15); - filter = in[4+i*2] >> 4; - if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) { - avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter); - filter=0; - } - f0 = xa_adpcm_table[filter][0]; - f1 = xa_adpcm_table[filter][1]; - - s_1 = left->sample1; - s_2 = left->sample2; - - for(j=0;j<28;j++) { - d = in[16+i+j*4]; - - t = sign_extend(d, 4); - s = ( t<>6); - s_2 = s_1; - s_1 = av_clip_int16(s); - out0[j] = s_1; - } - - if (channels == 2) { - left->sample1 = s_1; - left->sample2 = s_2; - s_1 = right->sample1; - s_2 = right->sample2; - } - - shift = 12 - (in[5+i*2] & 15); - filter = in[5+i*2] >> 4; - if (filter >= FF_ARRAY_ELEMS(xa_adpcm_table)) { - avpriv_request_sample(avctx, "unknown XA-ADPCM filter %d", filter); - filter=0; - } - - f0 = xa_adpcm_table[filter][0]; - f1 = xa_adpcm_table[filter][1]; - - for(j=0;j<28;j++) { - d = in[16+i+j*4]; - - t = sign_extend(d >> 4, 4); - s = ( t<>6); - s_2 = s_1; - s_1 = av_clip_int16(s); - out1[j] = s_1; - } - - if (channels == 2) { - right->sample1 = s_1; - right->sample2 = s_2; - } else { - left->sample1 = s_1; - left->sample2 = s_2; - } - - out0 += 28 * (3 - channels); - out1 += 28 * (3 - channels); - } - - return 0; -} - -static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples) -{ - ADPCMDecodeContext *c = avctx->priv_data; - GetBitContext gb; - const int *table; - int k0, signmask, nb_bits, count; - int size = buf_size*8; - int i; - - init_get_bits(&gb, buf, size); - - //read bits & initial values - nb_bits = get_bits(&gb, 2)+2; - table = swf_index_tables[nb_bits-2]; - k0 = 1 << (nb_bits-2); - signmask = 1 << (nb_bits-1); - - while (get_bits_count(&gb) <= size - 22*avctx->channels) { - for (i = 0; i < avctx->channels; i++) { - *samples++ = c->status[i].predictor = get_sbits(&gb, 16); - c->status[i].step_index = get_bits(&gb, 6); - } - - for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { - int i; - - for (i = 0; i < avctx->channels; i++) { - // similar to IMA adpcm - int delta = get_bits(&gb, nb_bits); - int step = ff_adpcm_step_table[c->status[i].step_index]; - long vpdiff = 0; // vpdiff = (delta+0.5)*step/4 - int k = k0; - - do { - if (delta & k) - vpdiff += step; - step >>= 1; - k >>= 1; - } while(k); - vpdiff += step; - - if (delta & signmask) - c->status[i].predictor -= vpdiff; - else - c->status[i].predictor += vpdiff; - - c->status[i].step_index += table[delta & (~signmask)]; - - c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); - c->status[i].predictor = av_clip_int16(c->status[i].predictor); - - *samples++ = c->status[i].predictor; - } - } - } -} - -/** - * Get the number of samples that will be decoded from the packet. - * In one case, this is actually the maximum number of samples possible to - * decode with the given buf_size. - * - * @param[out] coded_samples set to the number of samples as coded in the - * packet, or 0 if the codec does not encode the - * number of samples in each frame. - */ -static int get_nb_samples(AVCodecContext *avctx, GetByteContext *gb, - int buf_size, int *coded_samples) -{ - ADPCMDecodeContext *s = avctx->priv_data; - int nb_samples = 0; - int ch = avctx->channels; - int has_coded_samples = 0; - int header_size; - - *coded_samples = 0; - - if(ch <= 0) - return 0; - - switch (avctx->codec->id) { - /* constant, only check buf_size */ - case AV_CODEC_ID_ADPCM_EA_XAS: - if (buf_size < 76 * ch) - return 0; - nb_samples = 128; - break; - case AV_CODEC_ID_ADPCM_IMA_QT: - if (buf_size < 34 * ch) - return 0; - nb_samples = 64; - break; - /* simple 4-bit adpcm */ - case AV_CODEC_ID_ADPCM_CT: - case AV_CODEC_ID_ADPCM_IMA_APC: - case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: - case AV_CODEC_ID_ADPCM_IMA_OKI: - case AV_CODEC_ID_ADPCM_IMA_WS: - case AV_CODEC_ID_ADPCM_YAMAHA: - nb_samples = buf_size * 2 / ch; - break; - default: break; - } - if (nb_samples) - return nb_samples; - - /* simple 4-bit adpcm, with header */ - header_size = 0; - switch (avctx->codec->id) { - case AV_CODEC_ID_ADPCM_4XM: - case AV_CODEC_ID_ADPCM_IMA_ISS: header_size = 4 * ch; break; - case AV_CODEC_ID_ADPCM_IMA_AMV: header_size = 8; break; - case AV_CODEC_ID_ADPCM_IMA_SMJPEG: header_size = 4 * ch; break; - default: break; - } - if (header_size > 0) - return (buf_size - header_size) * 2 / ch; - - /* more complex formats */ - switch (avctx->codec->id) { - case AV_CODEC_ID_ADPCM_EA: - has_coded_samples = 1; - *coded_samples = bytestream2_get_le32(gb); - *coded_samples -= *coded_samples % 28; - nb_samples = (buf_size - 12) / 30 * 28; - break; - case AV_CODEC_ID_ADPCM_IMA_EA_EACS: - has_coded_samples = 1; - *coded_samples = bytestream2_get_le32(gb); - nb_samples = (buf_size - (4 + 8 * ch)) * 2 / ch; - break; - case AV_CODEC_ID_ADPCM_EA_MAXIS_XA: - nb_samples = (buf_size - ch) / ch * 2; - break; - case AV_CODEC_ID_ADPCM_EA_R1: - case AV_CODEC_ID_ADPCM_EA_R2: - case AV_CODEC_ID_ADPCM_EA_R3: - /* maximum number of samples */ - /* has internal offsets and a per-frame switch to signal raw 16-bit */ - has_coded_samples = 1; - switch (avctx->codec->id) { - case AV_CODEC_ID_ADPCM_EA_R1: - header_size = 4 + 9 * ch; - *coded_samples = bytestream2_get_le32(gb); - break; - case AV_CODEC_ID_ADPCM_EA_R2: - header_size = 4 + 5 * ch; - *coded_samples = bytestream2_get_le32(gb); - break; - case AV_CODEC_ID_ADPCM_EA_R3: - header_size = 4 + 5 * ch; - *coded_samples = bytestream2_get_be32(gb); - break; - default: break; - } - *coded_samples -= *coded_samples % 28; - nb_samples = (buf_size - header_size) * 2 / ch; - nb_samples -= nb_samples % 28; - break; - case AV_CODEC_ID_ADPCM_IMA_DK3: - if (avctx->block_align > 0) - buf_size = FFMIN(buf_size, avctx->block_align); - nb_samples = ((buf_size - 16) * 2 / 3 * 4) / ch; - break; - case AV_CODEC_ID_ADPCM_IMA_DK4: - if (avctx->block_align > 0) - buf_size = FFMIN(buf_size, avctx->block_align); - nb_samples = 1 + (buf_size - 4 * ch) * 2 / ch; - break; - case AV_CODEC_ID_ADPCM_IMA_RAD: - if (avctx->block_align > 0) - buf_size = FFMIN(buf_size, avctx->block_align); - nb_samples = (buf_size - 4 * ch) * 2 / ch; - break; - case AV_CODEC_ID_ADPCM_IMA_WAV: - { - int bsize = ff_adpcm_ima_block_sizes[avctx->bits_per_coded_sample - 2]; - int bsamples = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2]; - if (avctx->block_align > 0) - buf_size = FFMIN(buf_size, avctx->block_align); - nb_samples = 1 + (buf_size - 4 * ch) / (bsize * ch) * bsamples; - break; - } - case AV_CODEC_ID_ADPCM_MS: - if (avctx->block_align > 0) - buf_size = FFMIN(buf_size, avctx->block_align); - nb_samples = 2 + (buf_size - 7 * ch) * 2 / ch; - break; - case AV_CODEC_ID_ADPCM_SBPRO_2: - case AV_CODEC_ID_ADPCM_SBPRO_3: - case AV_CODEC_ID_ADPCM_SBPRO_4: - { - int samples_per_byte; - switch (avctx->codec->id) { - case AV_CODEC_ID_ADPCM_SBPRO_2: samples_per_byte = 4; break; - case AV_CODEC_ID_ADPCM_SBPRO_3: samples_per_byte = 3; break; - case AV_CODEC_ID_ADPCM_SBPRO_4: samples_per_byte = 2; break; - default: break; - } - if (!s->status[0].step_index) { - nb_samples++; - buf_size -= ch; - } - nb_samples += buf_size * samples_per_byte / ch; - break; - } - case AV_CODEC_ID_ADPCM_SWF: - { - int buf_bits = buf_size * 8 - 2; - int nbits = (bytestream2_get_byte(gb) >> 6) + 2; - int block_hdr_size = 22 * ch; - int block_size = block_hdr_size + nbits * ch * 4095; - int nblocks = buf_bits / block_size; - int bits_left = buf_bits - nblocks * block_size; - nb_samples = nblocks * 4096; - if (bits_left >= block_hdr_size) - nb_samples += 1 + (bits_left - block_hdr_size) / (nbits * ch); - break; - } - case AV_CODEC_ID_ADPCM_THP: - if (avctx->extradata) { - nb_samples = buf_size / (8 * ch) * 14; - break; - } - has_coded_samples = 1; - bytestream2_skip(gb, 4); // channel size - *coded_samples = bytestream2_get_be32(gb); - *coded_samples -= *coded_samples % 14; - nb_samples = (buf_size - (8 + 36 * ch)) / (8 * ch) * 14; - break; - case AV_CODEC_ID_ADPCM_AFC: - nb_samples = buf_size / (9 * ch) * 16; - break; - case AV_CODEC_ID_ADPCM_XA: - nb_samples = (buf_size / 128) * 224 / ch; - break; - case AV_CODEC_ID_ADPCM_DTK: - nb_samples = buf_size / (16 * ch) * 28; - break; - default: break; - } - - /* validate coded sample count */ - if (has_coded_samples && (*coded_samples <= 0 || *coded_samples > nb_samples)) - return AVERROR_INVALIDDATA; - - return nb_samples; -} - -static int adpcm_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - ADPCMDecodeContext *c = avctx->priv_data; - ADPCMChannelStatus *cs; - int n, m, channel, i; - short *samples; - int16_t **samples_p; - int st; /* stereo */ - int count1, count2; - int nb_samples, coded_samples, ret; - GetByteContext gb; - - bytestream2_init(&gb, buf, buf_size); - nb_samples = get_nb_samples(avctx, &gb, buf_size, &coded_samples); - if (nb_samples <= 0) { - av_log(avctx, AV_LOG_ERROR, "invalid number of samples in packet\n"); - return AVERROR_INVALIDDATA; - } - - /* get output buffer */ - frame->nb_samples = nb_samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = (short *)frame->data[0]; - samples_p = (int16_t **)frame->extended_data; - - /* use coded_samples when applicable */ - /* it is always <= nb_samples, so the output buffer will be large enough */ - if (coded_samples) { - if (coded_samples != nb_samples) - av_log(avctx, AV_LOG_WARNING, "mismatch in coded sample count\n"); - frame->nb_samples = nb_samples = coded_samples; - } - - st = avctx->channels == 2 ? 1 : 0; - - switch(avctx->codec->id) { - case AV_CODEC_ID_ADPCM_IMA_QT: - /* In QuickTime, IMA is encoded by chunks of 34 bytes (=64 samples). - Channel data is interleaved per-chunk. */ - for (channel = 0; channel < avctx->channels; channel++) { - int predictor; - int step_index; - cs = &(c->status[channel]); - /* (pppppp) (piiiiiii) */ - - /* Bits 15-7 are the _top_ 9 bits of the 16-bit initial predictor value */ - predictor = sign_extend(bytestream2_get_be16u(&gb), 16); - step_index = predictor & 0x7F; - predictor &= ~0x7F; - - if (cs->step_index == step_index) { - int diff = predictor - cs->predictor; - if (diff < 0) - diff = - diff; - if (diff > 0x7f) - goto update; - } else { - update: - cs->step_index = step_index; - cs->predictor = predictor; - } - - if (cs->step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - channel, cs->step_index); - return AVERROR_INVALIDDATA; - } - - samples = samples_p[channel]; - - for (m = 0; m < 64; m += 2) { - int byte = bytestream2_get_byteu(&gb); - samples[m ] = adpcm_ima_qt_expand_nibble(cs, byte & 0x0F, 3); - samples[m + 1] = adpcm_ima_qt_expand_nibble(cs, byte >> 4 , 3); - } - } - break; - case AV_CODEC_ID_ADPCM_IMA_WAV: - for(i=0; ichannels; i++){ - cs = &(c->status[i]); - cs->predictor = samples_p[i][0] = sign_extend(bytestream2_get_le16u(&gb), 16); - - cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16); - if (cs->step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - i, cs->step_index); - return AVERROR_INVALIDDATA; - } - } - - if (avctx->bits_per_coded_sample != 4) { - int samples_per_block = ff_adpcm_ima_block_samples[avctx->bits_per_coded_sample - 2]; - GetBitContext g; - - init_get_bits8(&g, gb.buffer, bytestream2_get_bytes_left(&gb)); - for (n = 0; n < (nb_samples - 1) / samples_per_block; n++) { - for (i = 0; i < avctx->channels; i++) { - cs = &c->status[i]; - samples = &samples_p[i][1 + n * samples_per_block]; - for (m = 0; m < samples_per_block; m++) { - samples[m] = adpcm_ima_wav_expand_nibble(cs, &g, - avctx->bits_per_coded_sample); - } - } - } - bytestream2_skip(&gb, avctx->block_align - avctx->channels * 4); - } else { - for (n = 0; n < (nb_samples - 1) / 8; n++) { - for (i = 0; i < avctx->channels; i++) { - cs = &c->status[i]; - samples = &samples_p[i][1 + n * 8]; - for (m = 0; m < 8; m += 2) { - int v = bytestream2_get_byteu(&gb); - samples[m ] = adpcm_ima_expand_nibble(cs, v & 0x0F, 3); - samples[m + 1] = adpcm_ima_expand_nibble(cs, v >> 4 , 3); - } - } - } - } - break; - case AV_CODEC_ID_ADPCM_4XM: - for (i = 0; i < avctx->channels; i++) - c->status[i].predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - - for (i = 0; i < avctx->channels; i++) { - c->status[i].step_index = sign_extend(bytestream2_get_le16u(&gb), 16); - if (c->status[i].step_index > 88u) { - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - i, c->status[i].step_index); - return AVERROR_INVALIDDATA; - } - } - - for (i = 0; i < avctx->channels; i++) { - samples = (int16_t *)frame->data[i]; - cs = &c->status[i]; - for (n = nb_samples >> 1; n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(cs, v & 0x0F, 4); - *samples++ = adpcm_ima_expand_nibble(cs, v >> 4 , 4); - } - } - break; - case AV_CODEC_ID_ADPCM_MS: - { - int block_predictor; - - block_predictor = bytestream2_get_byteu(&gb); - if (block_predictor > 6) { - av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[0] = %d\n", - block_predictor); - return AVERROR_INVALIDDATA; - } - c->status[0].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; - c->status[0].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; - if (st) { - block_predictor = bytestream2_get_byteu(&gb); - if (block_predictor > 6) { - av_log(avctx, AV_LOG_ERROR, "ERROR: block_predictor[1] = %d\n", - block_predictor); - return AVERROR_INVALIDDATA; - } - c->status[1].coeff1 = ff_adpcm_AdaptCoeff1[block_predictor]; - c->status[1].coeff2 = ff_adpcm_AdaptCoeff2[block_predictor]; - } - c->status[0].idelta = sign_extend(bytestream2_get_le16u(&gb), 16); - if (st){ - c->status[1].idelta = sign_extend(bytestream2_get_le16u(&gb), 16); - } - - c->status[0].sample1 = sign_extend(bytestream2_get_le16u(&gb), 16); - if (st) c->status[1].sample1 = sign_extend(bytestream2_get_le16u(&gb), 16); - c->status[0].sample2 = sign_extend(bytestream2_get_le16u(&gb), 16); - if (st) c->status[1].sample2 = sign_extend(bytestream2_get_le16u(&gb), 16); - - *samples++ = c->status[0].sample2; - if (st) *samples++ = c->status[1].sample2; - *samples++ = c->status[0].sample1; - if (st) *samples++ = c->status[1].sample1; - for(n = (nb_samples - 2) >> (1 - st); n > 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ms_expand_nibble(&c->status[0 ], byte >> 4 ); - *samples++ = adpcm_ms_expand_nibble(&c->status[st], byte & 0x0F); - } - break; - } - case AV_CODEC_ID_ADPCM_IMA_DK4: - for (channel = 0; channel < avctx->channels; channel++) { - cs = &c->status[channel]; - cs->predictor = *samples++ = sign_extend(bytestream2_get_le16u(&gb), 16); - cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16); - if (cs->step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - channel, cs->step_index); - return AVERROR_INVALIDDATA; - } - } - for (n = (nb_samples - 1) >> (1 - st); n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v >> 4 , 3); - *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); - } - break; - case AV_CODEC_ID_ADPCM_IMA_DK3: - { - int last_byte = 0; - int nibble; - int decode_top_nibble_next = 0; - int diff_channel; - const int16_t *samples_end = samples + avctx->channels * nb_samples; - - bytestream2_skipu(&gb, 10); - c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - c->status[1].predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - c->status[0].step_index = bytestream2_get_byteu(&gb); - c->status[1].step_index = bytestream2_get_byteu(&gb); - if (c->status[0].step_index > 88u || c->status[1].step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i/%i\n", - c->status[0].step_index, c->status[1].step_index); - return AVERROR_INVALIDDATA; - } - /* sign extend the predictors */ - diff_channel = c->status[1].predictor; - - /* DK3 ADPCM support macro */ -#define DK3_GET_NEXT_NIBBLE() \ - if (decode_top_nibble_next) { \ - nibble = last_byte >> 4; \ - decode_top_nibble_next = 0; \ - } else { \ - last_byte = bytestream2_get_byteu(&gb); \ - nibble = last_byte & 0x0F; \ - decode_top_nibble_next = 1; \ - } - - while (samples < samples_end) { - - /* for this algorithm, c->status[0] is the sum channel and - * c->status[1] is the diff channel */ - - /* process the first predictor of the sum channel */ - DK3_GET_NEXT_NIBBLE(); - adpcm_ima_expand_nibble(&c->status[0], nibble, 3); - - /* process the diff channel predictor */ - DK3_GET_NEXT_NIBBLE(); - adpcm_ima_expand_nibble(&c->status[1], nibble, 3); - - /* process the first pair of stereo PCM samples */ - diff_channel = (diff_channel + c->status[1].predictor) / 2; - *samples++ = c->status[0].predictor + c->status[1].predictor; - *samples++ = c->status[0].predictor - c->status[1].predictor; - - /* process the second predictor of the sum channel */ - DK3_GET_NEXT_NIBBLE(); - adpcm_ima_expand_nibble(&c->status[0], nibble, 3); - - /* process the second pair of stereo PCM samples */ - diff_channel = (diff_channel + c->status[1].predictor) / 2; - *samples++ = c->status[0].predictor + c->status[1].predictor; - *samples++ = c->status[0].predictor - c->status[1].predictor; - } - break; - } - case AV_CODEC_ID_ADPCM_IMA_ISS: - for (channel = 0; channel < avctx->channels; channel++) { - cs = &c->status[channel]; - cs->predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16); - if (cs->step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - channel, cs->step_index); - return AVERROR_INVALIDDATA; - } - } - - for (n = nb_samples >> (1 - st); n > 0; n--) { - int v1, v2; - int v = bytestream2_get_byteu(&gb); - /* nibbles are swapped for mono */ - if (st) { - v1 = v >> 4; - v2 = v & 0x0F; - } else { - v2 = v >> 4; - v1 = v & 0x0F; - } - *samples++ = adpcm_ima_expand_nibble(&c->status[0 ], v1, 3); - *samples++ = adpcm_ima_expand_nibble(&c->status[st], v2, 3); - } - break; - case AV_CODEC_ID_ADPCM_IMA_APC: - while (bytestream2_get_bytes_left(&gb) > 0) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4 , 3); - *samples++ = adpcm_ima_expand_nibble(&c->status[st], v & 0x0F, 3); - } - break; - case AV_CODEC_ID_ADPCM_IMA_OKI: - while (bytestream2_get_bytes_left(&gb) > 0) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_oki_expand_nibble(&c->status[0], v >> 4 ); - *samples++ = adpcm_ima_oki_expand_nibble(&c->status[st], v & 0x0F); - } - break; - case AV_CODEC_ID_ADPCM_IMA_RAD: - for (channel = 0; channel < avctx->channels; channel++) { - cs = &c->status[channel]; - cs->step_index = sign_extend(bytestream2_get_le16u(&gb), 16); - cs->predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - if (cs->step_index > 88u){ - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - channel, cs->step_index); - return AVERROR_INVALIDDATA; - } - } - for (n = 0; n < nb_samples / 2; n++) { - int byte[2]; - - byte[0] = bytestream2_get_byteu(&gb); - if (st) - byte[1] = bytestream2_get_byteu(&gb); - for(channel = 0; channel < avctx->channels; channel++) { - *samples++ = adpcm_ima_expand_nibble(&c->status[channel], byte[channel] & 0x0F, 3); - } - for(channel = 0; channel < avctx->channels; channel++) { - *samples++ = adpcm_ima_expand_nibble(&c->status[channel], byte[channel] >> 4 , 3); - } - } - break; - case AV_CODEC_ID_ADPCM_IMA_WS: - if (c->vqa_version == 3) { - for (channel = 0; channel < avctx->channels; channel++) { - int16_t *smp = samples_p[channel]; - - for (n = nb_samples / 2; n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); - *smp++ = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); - } - } - } else { - for (n = nb_samples / 2; n > 0; n--) { - for (channel = 0; channel < avctx->channels; channel++) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[channel], v >> 4 , 3); - samples[st] = adpcm_ima_expand_nibble(&c->status[channel], v & 0x0F, 3); - } - samples += avctx->channels; - } - } - bytestream2_seek(&gb, 0, SEEK_END); - break; - case AV_CODEC_ID_ADPCM_XA: - { - int16_t *out0 = samples_p[0]; - int16_t *out1 = samples_p[1]; - int samples_per_block = 28 * (3 - avctx->channels) * 4; - int sample_offset = 0; - while (bytestream2_get_bytes_left(&gb) >= 128) { - if ((ret = xa_decode(avctx, out0, out1, buf + bytestream2_tell(&gb), - &c->status[0], &c->status[1], - avctx->channels, sample_offset)) < 0) - return ret; - bytestream2_skipu(&gb, 128); - sample_offset += samples_per_block; - } - break; - } - case AV_CODEC_ID_ADPCM_IMA_EA_EACS: - for (i=0; i<=st; i++) { - c->status[i].step_index = bytestream2_get_le32u(&gb); - if (c->status[i].step_index > 88u) { - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index[%d] = %i\n", - i, c->status[i].step_index); - return AVERROR_INVALIDDATA; - } - } - for (i=0; i<=st; i++) - c->status[i].predictor = bytestream2_get_le32u(&gb); - - for (n = nb_samples >> (1 - st); n > 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[0], byte >> 4, 3); - *samples++ = adpcm_ima_expand_nibble(&c->status[st], byte & 0x0F, 3); - } - break; - case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: - for (n = nb_samples >> (1 - st); n > 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ima_expand_nibble(&c->status[0], byte >> 4, 6); - *samples++ = adpcm_ima_expand_nibble(&c->status[st], byte & 0x0F, 6); - } - break; - case AV_CODEC_ID_ADPCM_EA: - { - int previous_left_sample, previous_right_sample; - int current_left_sample, current_right_sample; - int next_left_sample, next_right_sample; - int coeff1l, coeff2l, coeff1r, coeff2r; - int shift_left, shift_right; - - /* Each EA ADPCM frame has a 12-byte header followed by 30-byte pieces, - each coding 28 stereo samples. */ - - if(avctx->channels != 2) - return AVERROR_INVALIDDATA; - - current_left_sample = sign_extend(bytestream2_get_le16u(&gb), 16); - previous_left_sample = sign_extend(bytestream2_get_le16u(&gb), 16); - current_right_sample = sign_extend(bytestream2_get_le16u(&gb), 16); - previous_right_sample = sign_extend(bytestream2_get_le16u(&gb), 16); - - for (count1 = 0; count1 < nb_samples / 28; count1++) { - int byte = bytestream2_get_byteu(&gb); - coeff1l = ea_adpcm_table[ byte >> 4 ]; - coeff2l = ea_adpcm_table[(byte >> 4 ) + 4]; - coeff1r = ea_adpcm_table[ byte & 0x0F]; - coeff2r = ea_adpcm_table[(byte & 0x0F) + 4]; - - byte = bytestream2_get_byteu(&gb); - shift_left = 20 - (byte >> 4); - shift_right = 20 - (byte & 0x0F); - - for (count2 = 0; count2 < 28; count2++) { - byte = bytestream2_get_byteu(&gb); - next_left_sample = sign_extend(byte >> 4, 4) << shift_left; - next_right_sample = sign_extend(byte, 4) << shift_right; - - next_left_sample = (next_left_sample + - (current_left_sample * coeff1l) + - (previous_left_sample * coeff2l) + 0x80) >> 8; - next_right_sample = (next_right_sample + - (current_right_sample * coeff1r) + - (previous_right_sample * coeff2r) + 0x80) >> 8; - - previous_left_sample = current_left_sample; - current_left_sample = av_clip_int16(next_left_sample); - previous_right_sample = current_right_sample; - current_right_sample = av_clip_int16(next_right_sample); - *samples++ = current_left_sample; - *samples++ = current_right_sample; - } - } - - bytestream2_skip(&gb, 2); // Skip terminating 0x0000 - - break; - } - case AV_CODEC_ID_ADPCM_EA_MAXIS_XA: - { - int coeff[2][2], shift[2]; - - for(channel = 0; channel < avctx->channels; channel++) { - int byte = bytestream2_get_byteu(&gb); - for (i=0; i<2; i++) - coeff[channel][i] = ea_adpcm_table[(byte >> 4) + 4*i]; - shift[channel] = 20 - (byte & 0x0F); - } - for (count1 = 0; count1 < nb_samples / 2; count1++) { - int byte[2]; - - byte[0] = bytestream2_get_byteu(&gb); - if (st) byte[1] = bytestream2_get_byteu(&gb); - for(i = 4; i >= 0; i-=4) { /* Pairwise samples LL RR (st) or LL LL (mono) */ - for(channel = 0; channel < avctx->channels; channel++) { - int sample = sign_extend(byte[channel] >> i, 4) << shift[channel]; - sample = (sample + - c->status[channel].sample1 * coeff[channel][0] + - c->status[channel].sample2 * coeff[channel][1] + 0x80) >> 8; - c->status[channel].sample2 = c->status[channel].sample1; - c->status[channel].sample1 = av_clip_int16(sample); - *samples++ = c->status[channel].sample1; - } - } - } - bytestream2_seek(&gb, 0, SEEK_END); - break; - } - case AV_CODEC_ID_ADPCM_EA_R1: - case AV_CODEC_ID_ADPCM_EA_R2: - case AV_CODEC_ID_ADPCM_EA_R3: { - /* channel numbering - 2chan: 0=fl, 1=fr - 4chan: 0=fl, 1=rl, 2=fr, 3=rr - 6chan: 0=fl, 1=c, 2=fr, 3=rl, 4=rr, 5=sub */ - const int big_endian = avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R3; - int previous_sample, current_sample, next_sample; - int coeff1, coeff2; - int shift; - unsigned int channel; - uint16_t *samplesC; - int count = 0; - int offsets[6]; - - for (channel=0; channelchannels; channel++) - offsets[channel] = (big_endian ? bytestream2_get_be32(&gb) : - bytestream2_get_le32(&gb)) + - (avctx->channels + 1) * 4; - - for (channel=0; channelchannels; channel++) { - bytestream2_seek(&gb, offsets[channel], SEEK_SET); - samplesC = (uint16_t *) samples_p[channel]; - - if (avctx->codec->id == AV_CODEC_ID_ADPCM_EA_R1) { - current_sample = sign_extend(bytestream2_get_le16(&gb), 16); - previous_sample = sign_extend(bytestream2_get_le16(&gb), 16); - } else { - current_sample = c->status[channel].predictor; - previous_sample = c->status[channel].prev_sample; - } - - for (count1 = 0; count1 < nb_samples / 28; count1++) { - int byte = bytestream2_get_byte(&gb); - if (byte == 0xEE) { /* only seen in R2 and R3 */ - current_sample = sign_extend(bytestream2_get_be16(&gb), 16); - previous_sample = sign_extend(bytestream2_get_be16(&gb), 16); - - for (count2=0; count2<28; count2++) - *samplesC++ = sign_extend(bytestream2_get_be16(&gb), 16); - } else { - coeff1 = ea_adpcm_table[ byte >> 4 ]; - coeff2 = ea_adpcm_table[(byte >> 4) + 4]; - shift = 20 - (byte & 0x0F); - - for (count2=0; count2<28; count2++) { - if (count2 & 1) - next_sample = sign_extend(byte, 4) << shift; - else { - byte = bytestream2_get_byte(&gb); - next_sample = sign_extend(byte >> 4, 4) << shift; - } - - next_sample += (current_sample * coeff1) + - (previous_sample * coeff2); - next_sample = av_clip_int16(next_sample >> 8); - - previous_sample = current_sample; - current_sample = next_sample; - *samplesC++ = current_sample; - } - } - } - if (!count) { - count = count1; - } else if (count != count1) { - av_log(avctx, AV_LOG_WARNING, "per-channel sample count mismatch\n"); - count = FFMAX(count, count1); - } - - if (avctx->codec->id != AV_CODEC_ID_ADPCM_EA_R1) { - c->status[channel].predictor = current_sample; - c->status[channel].prev_sample = previous_sample; - } - } - - frame->nb_samples = count * 28; - bytestream2_seek(&gb, 0, SEEK_END); - break; - } - case AV_CODEC_ID_ADPCM_EA_XAS: - for (channel=0; channelchannels; channel++) { - int coeff[2][4], shift[4]; - int16_t *s = samples_p[channel]; - for (n = 0; n < 4; n++, s += 32) { - int val = sign_extend(bytestream2_get_le16u(&gb), 16); - for (i=0; i<2; i++) - coeff[i][n] = ea_adpcm_table[(val&0x0F)+4*i]; - s[0] = val & ~0x0F; - - val = sign_extend(bytestream2_get_le16u(&gb), 16); - shift[n] = 20 - (val & 0x0F); - s[1] = val & ~0x0F; - } - - for (m=2; m<32; m+=2) { - s = &samples_p[channel][m]; - for (n = 0; n < 4; n++, s += 32) { - int level, pred; - int byte = bytestream2_get_byteu(&gb); - - level = sign_extend(byte >> 4, 4) << shift[n]; - pred = s[-1] * coeff[0][n] + s[-2] * coeff[1][n]; - s[0] = av_clip_int16((level + pred + 0x80) >> 8); - - level = sign_extend(byte, 4) << shift[n]; - pred = s[0] * coeff[0][n] + s[-1] * coeff[1][n]; - s[1] = av_clip_int16((level + pred + 0x80) >> 8); - } - } - } - break; - case AV_CODEC_ID_ADPCM_IMA_AMV: - c->status[0].predictor = sign_extend(bytestream2_get_le16u(&gb), 16); - c->status[0].step_index = bytestream2_get_le16u(&gb); - bytestream2_skipu(&gb, 4); - if (c->status[0].step_index > 88u) { - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", - c->status[0].step_index); - return AVERROR_INVALIDDATA; - } - - for (n = nb_samples >> (1 - st); n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - - *samples++ = adpcm_ima_expand_nibble(&c->status[0], v >> 4, 3); - *samples++ = adpcm_ima_expand_nibble(&c->status[0], v & 0xf, 3); - } - break; - case AV_CODEC_ID_ADPCM_IMA_SMJPEG: - for (i = 0; i < avctx->channels; i++) { - c->status[i].predictor = sign_extend(bytestream2_get_be16u(&gb), 16); - c->status[i].step_index = bytestream2_get_byteu(&gb); - bytestream2_skipu(&gb, 1); - if (c->status[i].step_index > 88u) { - av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", - c->status[i].step_index); - return AVERROR_INVALIDDATA; - } - } - - for (n = nb_samples >> (1 - st); n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - - *samples++ = adpcm_ima_qt_expand_nibble(&c->status[0 ], v >> 4, 3); - *samples++ = adpcm_ima_qt_expand_nibble(&c->status[st], v & 0xf, 3); - } - break; - case AV_CODEC_ID_ADPCM_CT: - for (n = nb_samples >> (1 - st); n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_ct_expand_nibble(&c->status[0 ], v >> 4 ); - *samples++ = adpcm_ct_expand_nibble(&c->status[st], v & 0x0F); - } - break; - case AV_CODEC_ID_ADPCM_SBPRO_4: - case AV_CODEC_ID_ADPCM_SBPRO_3: - case AV_CODEC_ID_ADPCM_SBPRO_2: - if (!c->status[0].step_index) { - /* the first byte is a raw sample */ - *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80); - if (st) - *samples++ = 128 * (bytestream2_get_byteu(&gb) - 0x80); - c->status[0].step_index = 1; - nb_samples--; - } - if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_4) { - for (n = nb_samples >> (1 - st); n > 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - byte >> 4, 4, 0); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], - byte & 0x0F, 4, 0); - } - } else if (avctx->codec->id == AV_CODEC_ID_ADPCM_SBPRO_3) { - for (n = (nb_samples< 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - byte >> 5 , 3, 0); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - (byte >> 2) & 0x07, 3, 0); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - byte & 0x03, 2, 0); - } - } else { - for (n = nb_samples >> (2 - st); n > 0; n--) { - int byte = bytestream2_get_byteu(&gb); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - byte >> 6 , 2, 2); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], - (byte >> 4) & 0x03, 2, 2); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], - (byte >> 2) & 0x03, 2, 2); - *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], - byte & 0x03, 2, 2); - } - } - break; - case AV_CODEC_ID_ADPCM_SWF: - adpcm_swf_decode(avctx, buf, buf_size, samples); - bytestream2_seek(&gb, 0, SEEK_END); - break; - case AV_CODEC_ID_ADPCM_YAMAHA: - for (n = nb_samples >> (1 - st); n > 0; n--) { - int v = bytestream2_get_byteu(&gb); - *samples++ = adpcm_yamaha_expand_nibble(&c->status[0 ], v & 0x0F); - *samples++ = adpcm_yamaha_expand_nibble(&c->status[st], v >> 4 ); - } - break; - case AV_CODEC_ID_ADPCM_AFC: - { - int samples_per_block; - int blocks; - - if (avctx->extradata && avctx->extradata_size == 1 && avctx->extradata[0]) { - samples_per_block = avctx->extradata[0] / 16; - blocks = nb_samples / avctx->extradata[0]; - } else { - samples_per_block = nb_samples / 16; - blocks = 1; - } - - for (m = 0; m < blocks; m++) { - for (channel = 0; channel < avctx->channels; channel++) { - int prev1 = c->status[channel].sample1; - int prev2 = c->status[channel].sample2; - - samples = samples_p[channel] + m * 16; - /* Read in every sample for this channel. */ - for (i = 0; i < samples_per_block; i++) { - int byte = bytestream2_get_byteu(&gb); - int scale = 1 << (byte >> 4); - int index = byte & 0xf; - int factor1 = ff_adpcm_afc_coeffs[0][index]; - int factor2 = ff_adpcm_afc_coeffs[1][index]; - - /* Decode 16 samples. */ - for (n = 0; n < 16; n++) { - int32_t sampledat; - - if (n & 1) { - sampledat = sign_extend(byte, 4); - } else { - byte = bytestream2_get_byteu(&gb); - sampledat = sign_extend(byte >> 4, 4); - } - - sampledat = ((prev1 * factor1 + prev2 * factor2) + - ((sampledat * scale) << 11)) >> 11; - *samples = av_clip_int16(sampledat); - prev2 = prev1; - prev1 = *samples++; - } - } - - c->status[channel].sample1 = prev1; - c->status[channel].sample2 = prev2; - } - } - bytestream2_seek(&gb, 0, SEEK_END); - break; - } - case AV_CODEC_ID_ADPCM_THP: - { - int table[6][16]; - int ch; - - if (avctx->extradata) { - GetByteContext tb; - if (avctx->extradata_size < 32 * avctx->channels) { - av_log(avctx, AV_LOG_ERROR, "Missing coeff table\n"); - return AVERROR_INVALIDDATA; - } - - bytestream2_init(&tb, avctx->extradata, avctx->extradata_size); - for (i = 0; i < avctx->channels; i++) - for (n = 0; n < 16; n++) - table[i][n] = sign_extend(bytestream2_get_be16u(&tb), 16); - } else { - for (i = 0; i < avctx->channels; i++) - for (n = 0; n < 16; n++) - table[i][n] = sign_extend(bytestream2_get_be16u(&gb), 16); - - /* Initialize the previous sample. */ - for (i = 0; i < avctx->channels; i++) { - c->status[i].sample1 = sign_extend(bytestream2_get_be16u(&gb), 16); - c->status[i].sample2 = sign_extend(bytestream2_get_be16u(&gb), 16); - } - } - - for (ch = 0; ch < avctx->channels; ch++) { - samples = samples_p[ch]; - - /* Read in every sample for this channel. */ - for (i = 0; i < nb_samples / 14; i++) { - int byte = bytestream2_get_byteu(&gb); - int index = (byte >> 4) & 7; - unsigned int exp = byte & 0x0F; - int factor1 = table[ch][index * 2]; - int factor2 = table[ch][index * 2 + 1]; - - /* Decode 14 samples. */ - for (n = 0; n < 14; n++) { - int32_t sampledat; - - if (n & 1) { - sampledat = sign_extend(byte, 4); - } else { - byte = bytestream2_get_byteu(&gb); - sampledat = sign_extend(byte >> 4, 4); - } - - sampledat = ((c->status[ch].sample1 * factor1 - + c->status[ch].sample2 * factor2) >> 11) + (sampledat << exp); - *samples = av_clip_int16(sampledat); - c->status[ch].sample2 = c->status[ch].sample1; - c->status[ch].sample1 = *samples++; - } - } - } - break; - } - case AV_CODEC_ID_ADPCM_DTK: - for (channel = 0; channel < avctx->channels; channel++) { - samples = samples_p[channel]; - - /* Read in every sample for this channel. */ - for (i = 0; i < nb_samples / 28; i++) { - int byte, header; - if (channel) - bytestream2_skipu(&gb, 1); - header = bytestream2_get_byteu(&gb); - bytestream2_skipu(&gb, 3 - channel); - - /* Decode 28 samples. */ - for (n = 0; n < 28; n++) { - int32_t sampledat, prev; - - switch (header >> 4) { - case 1: - prev = (c->status[channel].sample1 * 0x3c); - break; - case 2: - prev = (c->status[channel].sample1 * 0x73) - (c->status[channel].sample2 * 0x34); - break; - case 3: - prev = (c->status[channel].sample1 * 0x62) - (c->status[channel].sample2 * 0x37); - break; - default: - prev = 0; - } - - prev = av_clip((prev + 0x20) >> 6, -0x200000, 0x1fffff); - - byte = bytestream2_get_byteu(&gb); - if (!channel) - sampledat = sign_extend(byte, 4); - else - sampledat = sign_extend(byte >> 4, 4); - - sampledat = (((sampledat << 12) >> (header & 0xf)) << 6) + prev; - *samples++ = av_clip_int16(sampledat >> 6); - c->status[channel].sample2 = c->status[channel].sample1; - c->status[channel].sample1 = sampledat; - } - } - if (!channel) - bytestream2_seek(&gb, 0, SEEK_SET); - } - break; - - default: - return -1; - } - - if (avpkt->size && bytestream2_tell(&gb) == 0) { - av_log(avctx, AV_LOG_ERROR, "Nothing consumed\n"); - return AVERROR_INVALIDDATA; - } - - *got_frame_ptr = 1; - - return bytestream2_tell(&gb); -} - - -static const enum AVSampleFormat sample_fmts_s16[] = { AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }; -static const enum AVSampleFormat sample_fmts_s16p[] = { AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }; -static const enum AVSampleFormat sample_fmts_both[] = { AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_NONE }; - -#define ADPCM_DECODER(id_, sample_fmts_, name_, long_name_) \ -AVCodec ff_ ## name_ ## _decoder = { \ - .name = #name_, \ - .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ - .type = AVMEDIA_TYPE_AUDIO, \ - .id = id_, \ - .priv_data_size = sizeof(ADPCMDecodeContext), \ - .init = adpcm_decode_init, \ - .decode = adpcm_decode_frame, \ - .capabilities = CODEC_CAP_DR1, \ - .sample_fmts = sample_fmts_, \ -} - -/* Note: Do not forget to add new entries to the Makefile as well. */ -ADPCM_DECODER(AV_CODEC_ID_ADPCM_4XM, sample_fmts_s16p, adpcm_4xm, "ADPCM 4X Movie"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_AFC, sample_fmts_s16p, adpcm_afc, "ADPCM Nintendo Gamecube AFC"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_CT, sample_fmts_s16, adpcm_ct, "ADPCM Creative Technology"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_DTK, sample_fmts_s16p, adpcm_dtk, "ADPCM Nintendo Gamecube DTK"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA, sample_fmts_s16, adpcm_ea, "ADPCM Electronic Arts"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_MAXIS_XA, sample_fmts_s16, adpcm_ea_maxis_xa, "ADPCM Electronic Arts Maxis CDROM XA"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R1, sample_fmts_s16p, adpcm_ea_r1, "ADPCM Electronic Arts R1"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R2, sample_fmts_s16p, adpcm_ea_r2, "ADPCM Electronic Arts R2"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_R3, sample_fmts_s16p, adpcm_ea_r3, "ADPCM Electronic Arts R3"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_EA_XAS, sample_fmts_s16p, adpcm_ea_xas, "ADPCM Electronic Arts XAS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_AMV, sample_fmts_s16, adpcm_ima_amv, "ADPCM IMA AMV"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_APC, sample_fmts_s16, adpcm_ima_apc, "ADPCM IMA CRYO APC"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK3, sample_fmts_s16, adpcm_ima_dk3, "ADPCM IMA Duck DK3"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_DK4, sample_fmts_s16, adpcm_ima_dk4, "ADPCM IMA Duck DK4"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_EACS, sample_fmts_s16, adpcm_ima_ea_eacs, "ADPCM IMA Electronic Arts EACS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_EA_SEAD, sample_fmts_s16, adpcm_ima_ea_sead, "ADPCM IMA Electronic Arts SEAD"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_ISS, sample_fmts_s16, adpcm_ima_iss, "ADPCM IMA Funcom ISS"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_OKI, sample_fmts_s16, adpcm_ima_oki, "ADPCM IMA Dialogic OKI"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_QT, sample_fmts_s16p, adpcm_ima_qt, "ADPCM IMA QuickTime"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_RAD, sample_fmts_s16, adpcm_ima_rad, "ADPCM IMA Radical"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_SMJPEG, sample_fmts_s16, adpcm_ima_smjpeg, "ADPCM IMA Loki SDL MJPEG"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WAV, sample_fmts_s16p, adpcm_ima_wav, "ADPCM IMA WAV"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_IMA_WS, sample_fmts_both, adpcm_ima_ws, "ADPCM IMA Westwood"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_MS, sample_fmts_s16, adpcm_ms, "ADPCM Microsoft"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_2, sample_fmts_s16, adpcm_sbpro_2, "ADPCM Sound Blaster Pro 2-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_3, sample_fmts_s16, adpcm_sbpro_3, "ADPCM Sound Blaster Pro 2.6-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SBPRO_4, sample_fmts_s16, adpcm_sbpro_4, "ADPCM Sound Blaster Pro 4-bit"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_SWF, sample_fmts_s16, adpcm_swf, "ADPCM Shockwave Flash"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_THP, sample_fmts_s16p, adpcm_thp, "ADPCM Nintendo Gamecube THP"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_XA, sample_fmts_s16p, adpcm_xa, "ADPCM CDROM XA"); -ADPCM_DECODER(AV_CODEC_ID_ADPCM_YAMAHA, sample_fmts_s16, adpcm_yamaha, "ADPCM Yamaha"); diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.h deleted file mode 100644 index f43a28caf..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2001-2003 The ffmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * ADPCM encoder/decoder common header. - */ - -#ifndef AVCODEC_ADPCM_H -#define AVCODEC_ADPCM_H - -#include - -#define BLKSIZE 1024 - -typedef struct ADPCMChannelStatus { - int predictor; - int16_t step_index; - int step; - /* for encoding */ - int prev_sample; - - /* MS version */ - int sample1; - int sample2; - int coeff1; - int coeff2; - int idelta; -} ADPCMChannelStatus; - -#endif /* AVCODEC_ADPCM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.c deleted file mode 100644 index 210928553..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2001-2003 The ffmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * ADPCM tables - */ - -#include - -/* ff_adpcm_step_table[] and ff_adpcm_index_table[] are from the ADPCM - reference source */ -static const int8_t adpcm_index_table2[4] = { - -1, 2, - -1, 2, -}; - -static const int8_t adpcm_index_table3[8] = { - -1, -1, 1, 2, - -1, -1, 1, 2, -}; - -const int8_t ff_adpcm_index_table[16] = { - -1, -1, -1, -1, 2, 4, 6, 8, - -1, -1, -1, -1, 2, 4, 6, 8, -}; - -static const int8_t adpcm_index_table5[32] = { - -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, - -1, -1, -1, -1, -1, -1, -1, -1, 1, 2, 4, 6, 8, 10, 13, 16, -}; - -const int8_t * const ff_adpcm_index_tables[4] = { - &adpcm_index_table2[0], - &adpcm_index_table3[0], - &ff_adpcm_index_table[0], - &adpcm_index_table5[0], -}; - -/** - * This is the step table. Note that many programs use slight deviations from - * this table, but such deviations are negligible: - */ -const int16_t ff_adpcm_step_table[89] = { - 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, - 19, 21, 23, 25, 28, 31, 34, 37, 41, 45, - 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, - 130, 143, 157, 173, 190, 209, 230, 253, 279, 307, - 337, 371, 408, 449, 494, 544, 598, 658, 724, 796, - 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, - 2272, 2499, 2749, 3024, 3327, 3660, 4026, 4428, 4871, 5358, - 5894, 6484, 7132, 7845, 8630, 9493, 10442, 11487, 12635, 13899, - 15289, 16818, 18500, 20350, 22385, 24623, 27086, 29794, 32767 -}; - -const int16_t ff_adpcm_oki_step_table[49] = { - 16, 17, 19, 21, 23, 25, 28, 31, 34, 37, - 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, - 107, 118, 130, 143, 157, 173, 190, 209, 230, 253, - 279, 307, 337, 371, 408, 449, 494, 544, 598, 658, - 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552 -}; - -/* These are for MS-ADPCM */ -/* ff_adpcm_AdaptationTable[], ff_adpcm_AdaptCoeff1[], and - ff_adpcm_AdaptCoeff2[] are from libsndfile */ -const int16_t ff_adpcm_AdaptationTable[] = { - 230, 230, 230, 230, 307, 409, 512, 614, - 768, 614, 512, 409, 307, 230, 230, 230 -}; - -/** Divided by 4 to fit in 8-bit integers */ -const uint8_t ff_adpcm_AdaptCoeff1[] = { - 64, 128, 0, 48, 60, 115, 98 -}; - -/** Divided by 4 to fit in 8-bit integers */ -const int8_t ff_adpcm_AdaptCoeff2[] = { - 0, -64, 0, 16, 0, -52, -58 -}; - -const int16_t ff_adpcm_yamaha_indexscale[] = { - 230, 230, 230, 230, 307, 409, 512, 614, - 230, 230, 230, 230, 307, 409, 512, 614 -}; - -const int8_t ff_adpcm_yamaha_difflookup[] = { - 1, 3, 5, 7, 9, 11, 13, 15, - -1, -3, -5, -7, -9, -11, -13, -15 -}; - -const int16_t ff_adpcm_afc_coeffs[2][16] = { - { 0, 2048, 0, 1024, 4096, 3584, 3072, 4608, 4200, 4800, 5120, 2048, 1024, 64512, 64512, 63488 }, - { 0, 0, 2048, 1024, 63488, 64000, 64512, 62976, 63288, 63236, 62464, 63488, 64512, 1024, 0, 0 } -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.h deleted file mode 100644 index 6589bc56c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/adpcm_data.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2001-2003 The ffmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * ADPCM tables - */ - -#ifndef AVCODEC_ADPCM_DATA_H -#define AVCODEC_ADPCM_DATA_H - -#include - -static const uint8_t ff_adpcm_ima_block_sizes[4] = { 4, 12, 4, 20 }; -static const uint8_t ff_adpcm_ima_block_samples[4] = { 16, 32, 8, 32 }; - -extern const int8_t * const ff_adpcm_index_tables[4]; -extern const int8_t ff_adpcm_index_table[16]; -extern const int16_t ff_adpcm_step_table[89]; -extern const int16_t ff_adpcm_oki_step_table[49]; -extern const int16_t ff_adpcm_AdaptationTable[]; -extern const uint8_t ff_adpcm_AdaptCoeff1[]; -extern const int8_t ff_adpcm_AdaptCoeff2[]; -extern const int16_t ff_adpcm_yamaha_indexscale[]; -extern const int8_t ff_adpcm_yamaha_difflookup[]; -extern const int16_t ff_adpcm_afc_coeffs[2][16]; - -#endif /* AVCODEC_ADPCM_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/allcodecs.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/allcodecs.c deleted file mode 100644 index f4a4848a7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/allcodecs.c +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Provide registration of all codecs, parsers and bitstream filters for libavcodec. - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Provide registration of all codecs, parsers and bitstream filters for libavcodec. - */ - -#include "config.h" -#include "avcodec.h" -#include "version.h" - -#define REGISTER_HWACCEL(X, x) \ - { \ - extern AVHWAccel ff_##x##_hwaccel; \ - if (CONFIG_##X##_HWACCEL) \ - av_register_hwaccel(&ff_##x##_hwaccel); \ - } - -#define REGISTER_ENCODER(X, x) \ - { \ - extern AVCodec ff_##x##_encoder; \ - if (CONFIG_##X##_ENCODER) \ - avcodec_register(&ff_##x##_encoder); \ - } - -#define REGISTER_DECODER(X, x) \ - { \ - extern AVCodec ff_##x##_decoder; \ - if (CONFIG_##X##_DECODER) \ - avcodec_register(&ff_##x##_decoder); \ - } - -#define REGISTER_ENCDEC(X, x) REGISTER_ENCODER(X, x); REGISTER_DECODER(X, x) - -#define REGISTER_PARSER(X, x) \ - { \ - extern AVCodecParser ff_##x##_parser; \ - if (CONFIG_##X##_PARSER) \ - av_register_codec_parser(&ff_##x##_parser); \ - } - -#define REGISTER_BSF(X, x) \ - { \ - extern AVBitStreamFilter ff_##x##_bsf; \ - if (CONFIG_##X##_BSF) \ - av_register_bitstream_filter(&ff_##x##_bsf); \ - } - -void avcodec_register_all(void) -{ - static int initialized; - - if (initialized) - return; - initialized = 1; - - /* hardware accelerators */ - REGISTER_HWACCEL(H263_VAAPI, h263_vaapi); - REGISTER_HWACCEL(H263_VDPAU, h263_vdpau); - REGISTER_HWACCEL(H264_DXVA2, h264_dxva2); - REGISTER_HWACCEL(H264_VAAPI, h264_vaapi); - REGISTER_HWACCEL(H264_VDA, h264_vda); - REGISTER_HWACCEL(H264_VDPAU, h264_vdpau); - REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc); - REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); - REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc); - REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2); - REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi); - REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau); - REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi); - REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau); - REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2); - REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi); - REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau); - REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2); - REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi); - REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau); - - /* video codecs */ - REGISTER_ENCODER(A64MULTI, a64multi); - REGISTER_ENCODER(A64MULTI5, a64multi5); - REGISTER_DECODER(AASC, aasc); - REGISTER_DECODER(AIC, aic); - REGISTER_ENCDEC (AMV, amv); - REGISTER_DECODER(ANM, anm); - REGISTER_DECODER(ANSI, ansi); - REGISTER_ENCDEC (ASV1, asv1); - REGISTER_ENCDEC (ASV2, asv2); - REGISTER_DECODER(AURA, aura); - REGISTER_DECODER(AURA2, aura2); - REGISTER_ENCDEC (AVRP, avrp); - REGISTER_DECODER(AVRN, avrn); - REGISTER_DECODER(AVS, avs); - REGISTER_ENCDEC (AVUI, avui); - REGISTER_ENCDEC (AYUV, ayuv); - REGISTER_DECODER(BETHSOFTVID, bethsoftvid); - REGISTER_DECODER(BFI, bfi); - REGISTER_DECODER(BINK, bink); - REGISTER_ENCDEC (BMP, bmp); - REGISTER_DECODER(BMV_VIDEO, bmv_video); - REGISTER_DECODER(BRENDER_PIX, brender_pix); - REGISTER_DECODER(C93, c93); - REGISTER_DECODER(CAVS, cavs); - REGISTER_DECODER(CDGRAPHICS, cdgraphics); - REGISTER_DECODER(CDXL, cdxl); - REGISTER_ENCDEC (CINEPAK, cinepak); - REGISTER_ENCDEC (CLJR, cljr); - REGISTER_DECODER(CLLC, cllc); - REGISTER_ENCDEC (COMFORTNOISE, comfortnoise); - REGISTER_DECODER(CPIA, cpia); - REGISTER_DECODER(CSCD, cscd); - REGISTER_DECODER(CYUV, cyuv); - REGISTER_DECODER(DFA, dfa); - REGISTER_DECODER(DIRAC, dirac); - REGISTER_ENCDEC (DNXHD, dnxhd); - REGISTER_ENCDEC (DPX, dpx); - REGISTER_DECODER(DSICINVIDEO, dsicinvideo); - REGISTER_ENCDEC (DVVIDEO, dvvideo); - REGISTER_DECODER(DXA, dxa); - REGISTER_DECODER(DXTORY, dxtory); - REGISTER_DECODER(EACMV, eacmv); - REGISTER_DECODER(EAMAD, eamad); - REGISTER_DECODER(EATGQ, eatgq); - REGISTER_DECODER(EATGV, eatgv); - REGISTER_DECODER(EATQI, eatqi); - REGISTER_DECODER(EIGHTBPS, eightbps); - REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp); - REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib); - REGISTER_DECODER(ESCAPE124, escape124); - REGISTER_DECODER(ESCAPE130, escape130); - REGISTER_DECODER(EXR, exr); - REGISTER_ENCDEC (FFV1, ffv1); - REGISTER_ENCDEC (FFVHUFF, ffvhuff); - REGISTER_DECODER(FIC, fic); - REGISTER_ENCDEC (FLASHSV, flashsv); - REGISTER_ENCDEC (FLASHSV2, flashsv2); - REGISTER_DECODER(FLIC, flic); - REGISTER_ENCDEC (FLV, flv); - REGISTER_DECODER(FOURXM, fourxm); - REGISTER_DECODER(FRAPS, fraps); - REGISTER_DECODER(FRWU, frwu); - REGISTER_DECODER(G2M, g2m); - REGISTER_ENCDEC (GIF, gif); - REGISTER_ENCDEC (H261, h261); - REGISTER_ENCDEC (H263, h263); - REGISTER_DECODER(H263I, h263i); - REGISTER_ENCDEC (H263P, h263p); - REGISTER_DECODER(H264, h264); - REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd); - REGISTER_DECODER(H264_VDA, h264_vda); - REGISTER_DECODER(H264_VDPAU, h264_vdpau); - REGISTER_DECODER(HEVC, hevc); - REGISTER_DECODER(HNM4_VIDEO, hnm4_video); - REGISTER_ENCDEC (HUFFYUV, huffyuv); - REGISTER_DECODER(IDCIN, idcin); - REGISTER_DECODER(IFF_BYTERUN1, iff_byterun1); - REGISTER_DECODER(IFF_ILBM, iff_ilbm); - REGISTER_DECODER(INDEO2, indeo2); - REGISTER_DECODER(INDEO3, indeo3); - REGISTER_DECODER(INDEO4, indeo4); - REGISTER_DECODER(INDEO5, indeo5); - REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video); - REGISTER_ENCDEC (JPEG2000, jpeg2000); - REGISTER_ENCDEC (JPEGLS, jpegls); - REGISTER_DECODER(JV, jv); - REGISTER_DECODER(KGV1, kgv1); - REGISTER_DECODER(KMVC, kmvc); - REGISTER_DECODER(LAGARITH, lagarith); - REGISTER_ENCODER(LJPEG, ljpeg); - REGISTER_DECODER(LOCO, loco); - REGISTER_DECODER(MDEC, mdec); - REGISTER_DECODER(MIMIC, mimic); - REGISTER_ENCDEC (MJPEG, mjpeg); - REGISTER_DECODER(MJPEGB, mjpegb); - REGISTER_DECODER(MMVIDEO, mmvideo); - REGISTER_DECODER(MOTIONPIXELS, motionpixels); -#if FF_API_XVMC - REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc); -#endif /* FF_API_XVMC */ - REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video); - REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video); - REGISTER_ENCDEC (MPEG4, mpeg4); - REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd); - REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau); - REGISTER_DECODER(MPEGVIDEO, mpegvideo); - REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau); - REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau); - REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd); - REGISTER_DECODER(MSA1, msa1); - REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd); - REGISTER_DECODER(MSMPEG4V1, msmpeg4v1); - REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2); - REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3); - REGISTER_DECODER(MSRLE, msrle); - REGISTER_DECODER(MSS1, mss1); - REGISTER_DECODER(MSS2, mss2); - REGISTER_ENCDEC (MSVIDEO1, msvideo1); - REGISTER_DECODER(MSZH, mszh); - REGISTER_DECODER(MTS2, mts2); - REGISTER_DECODER(MVC1, mvc1); - REGISTER_DECODER(MVC2, mvc2); - REGISTER_DECODER(MXPEG, mxpeg); - REGISTER_DECODER(NUV, nuv); - REGISTER_DECODER(PAF_VIDEO, paf_video); - REGISTER_ENCDEC (PAM, pam); - REGISTER_ENCDEC (PBM, pbm); - REGISTER_ENCDEC (PCX, pcx); - REGISTER_ENCDEC (PGM, pgm); - REGISTER_ENCDEC (PGMYUV, pgmyuv); - REGISTER_DECODER(PICTOR, pictor); - REGISTER_ENCDEC (PNG, png); - REGISTER_ENCDEC (PPM, ppm); - REGISTER_ENCDEC (PRORES, prores); - REGISTER_ENCODER(PRORES_AW, prores_aw); - REGISTER_ENCODER(PRORES_KS, prores_ks); - REGISTER_DECODER(PRORES_LGPL, prores_lgpl); - REGISTER_DECODER(PTX, ptx); - REGISTER_DECODER(QDRAW, qdraw); - REGISTER_DECODER(QPEG, qpeg); - REGISTER_ENCDEC (QTRLE, qtrle); - REGISTER_ENCDEC (R10K, r10k); - REGISTER_ENCDEC (R210, r210); - REGISTER_ENCDEC (RAWVIDEO, rawvideo); - REGISTER_DECODER(RL2, rl2); - REGISTER_ENCDEC (ROQ, roq); - REGISTER_DECODER(RPZA, rpza); - REGISTER_ENCDEC (RV10, rv10); - REGISTER_ENCDEC (RV20, rv20); - REGISTER_DECODER(RV30, rv30); - REGISTER_DECODER(RV40, rv40); - REGISTER_ENCDEC (S302M, s302m); - REGISTER_DECODER(SANM, sanm); - REGISTER_ENCDEC (SGI, sgi); - REGISTER_DECODER(SGIRLE, sgirle); - REGISTER_DECODER(SMACKER, smacker); - REGISTER_DECODER(SMC, smc); - REGISTER_DECODER(SMVJPEG, smvjpeg); - REGISTER_ENCDEC (SNOW, snow); - REGISTER_DECODER(SP5X, sp5x); - REGISTER_ENCDEC (SUNRAST, sunrast); - REGISTER_ENCDEC (SVQ1, svq1); - REGISTER_DECODER(SVQ3, svq3); - REGISTER_ENCDEC (TARGA, targa); - REGISTER_DECODER(TARGA_Y216, targa_y216); - REGISTER_DECODER(THEORA, theora); - REGISTER_DECODER(THP, thp); - REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo); - REGISTER_ENCDEC (TIFF, tiff); - REGISTER_DECODER(TMV, tmv); - REGISTER_DECODER(TRUEMOTION1, truemotion1); - REGISTER_DECODER(TRUEMOTION2, truemotion2); - REGISTER_DECODER(TSCC, tscc); - REGISTER_DECODER(TSCC2, tscc2); - REGISTER_DECODER(TXD, txd); - REGISTER_DECODER(ULTI, ulti); - REGISTER_ENCDEC (UTVIDEO, utvideo); - REGISTER_ENCDEC (V210, v210); - REGISTER_DECODER(V210X, v210x); - REGISTER_ENCDEC (V308, v308); - REGISTER_ENCDEC (V408, v408); - REGISTER_ENCDEC (V410, v410); - REGISTER_DECODER(VB, vb); - REGISTER_DECODER(VBLE, vble); - REGISTER_DECODER(VC1, vc1); - REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd); - REGISTER_DECODER(VC1_VDPAU, vc1_vdpau); - REGISTER_DECODER(VC1IMAGE, vc1image); - REGISTER_DECODER(VCR1, vcr1); - REGISTER_DECODER(VMDVIDEO, vmdvideo); - REGISTER_DECODER(VMNC, vmnc); - REGISTER_DECODER(VP3, vp3); - REGISTER_DECODER(VP5, vp5); - REGISTER_DECODER(VP6, vp6); - REGISTER_DECODER(VP6A, vp6a); - REGISTER_DECODER(VP6F, vp6f); - REGISTER_DECODER(VP8, vp8); - REGISTER_DECODER(VQA, vqa); - REGISTER_DECODER(WEBP, webp); - REGISTER_ENCDEC (WMV1, wmv1); - REGISTER_ENCDEC (WMV2, wmv2); - REGISTER_DECODER(WMV3, wmv3); - REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd); - REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau); - REGISTER_DECODER(WMV3IMAGE, wmv3image); - REGISTER_DECODER(WNV1, wnv1); - REGISTER_DECODER(XAN_WC3, xan_wc3); - REGISTER_DECODER(XAN_WC4, xan_wc4); - REGISTER_ENCDEC (XBM, xbm); - REGISTER_ENCDEC (XFACE, xface); - REGISTER_DECODER(XL, xl); - REGISTER_ENCDEC (XWD, xwd); - REGISTER_ENCDEC (Y41P, y41p); - REGISTER_DECODER(YOP, yop); - REGISTER_ENCDEC (YUV4, yuv4); - REGISTER_DECODER(ZERO12V, zero12v); - REGISTER_DECODER(ZEROCODEC, zerocodec); - REGISTER_ENCDEC (ZLIB, zlib); - REGISTER_ENCDEC (ZMBV, zmbv); - - /* audio codecs */ - REGISTER_ENCDEC (AAC, aac); - REGISTER_DECODER(AAC_LATM, aac_latm); - REGISTER_ENCDEC (AC3, ac3); - REGISTER_ENCODER(AC3_FIXED, ac3_fixed); - REGISTER_ENCDEC (ALAC, alac); - REGISTER_DECODER(ALS, als); - REGISTER_DECODER(AMRNB, amrnb); - REGISTER_DECODER(AMRWB, amrwb); - REGISTER_DECODER(APE, ape); - REGISTER_DECODER(ATRAC1, atrac1); - REGISTER_DECODER(ATRAC3, atrac3); - REGISTER_DECODER(ATRAC3P, atrac3p); - REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct); - REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft); - REGISTER_DECODER(BMV_AUDIO, bmv_audio); - REGISTER_DECODER(COOK, cook); - REGISTER_ENCDEC (DCA, dca); - REGISTER_DECODER(DSICINAUDIO, dsicinaudio); - REGISTER_ENCDEC (EAC3, eac3); - REGISTER_DECODER(EVRC, evrc); - REGISTER_DECODER(FFWAVESYNTH, ffwavesynth); - REGISTER_ENCDEC (FLAC, flac); - REGISTER_ENCDEC (G723_1, g723_1); - REGISTER_DECODER(G729, g729); - REGISTER_DECODER(GSM, gsm); - REGISTER_DECODER(GSM_MS, gsm_ms); - REGISTER_DECODER(IAC, iac); - REGISTER_DECODER(IMC, imc); - REGISTER_DECODER(MACE3, mace3); - REGISTER_DECODER(MACE6, mace6); - REGISTER_DECODER(METASOUND, metasound); - REGISTER_DECODER(MLP, mlp); - REGISTER_DECODER(MP1, mp1); - REGISTER_DECODER(MP1FLOAT, mp1float); - REGISTER_ENCDEC (MP2, mp2); - REGISTER_DECODER(MP2FLOAT, mp2float); - REGISTER_ENCODER(MP2FIXED, mp2fixed); - REGISTER_DECODER(MP3, mp3); - REGISTER_DECODER(MP3FLOAT, mp3float); - REGISTER_DECODER(MP3ADU, mp3adu); - REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat); - REGISTER_DECODER(MP3ON4, mp3on4); - REGISTER_DECODER(MP3ON4FLOAT, mp3on4float); - REGISTER_DECODER(MPC7, mpc7); - REGISTER_DECODER(MPC8, mpc8); - REGISTER_ENCDEC (NELLYMOSER, nellymoser); - REGISTER_DECODER(PAF_AUDIO, paf_audio); - REGISTER_DECODER(QCELP, qcelp); - REGISTER_DECODER(QDM2, qdm2); - REGISTER_ENCDEC (RA_144, ra_144); - REGISTER_DECODER(RA_288, ra_288); - REGISTER_DECODER(RALF, ralf); - REGISTER_DECODER(SHORTEN, shorten); - REGISTER_DECODER(SIPR, sipr); - REGISTER_DECODER(SMACKAUD, smackaud); - REGISTER_ENCDEC (SONIC, sonic); - REGISTER_ENCODER(SONIC_LS, sonic_ls); - REGISTER_DECODER(TAK, tak); - REGISTER_DECODER(TRUEHD, truehd); - REGISTER_DECODER(TRUESPEECH, truespeech); - REGISTER_ENCDEC (TTA, tta); - REGISTER_DECODER(TWINVQ, twinvq); - REGISTER_DECODER(VMDAUDIO, vmdaudio); - REGISTER_ENCDEC (VORBIS, vorbis); - REGISTER_ENCDEC (WAVPACK, wavpack); - REGISTER_DECODER(WMALOSSLESS, wmalossless); - REGISTER_DECODER(WMAPRO, wmapro); - REGISTER_ENCDEC (WMAV1, wmav1); - REGISTER_ENCDEC (WMAV2, wmav2); - REGISTER_DECODER(WMAVOICE, wmavoice); - REGISTER_DECODER(WS_SND1, ws_snd1); - - /* PCM codecs */ - REGISTER_ENCDEC (PCM_ALAW, pcm_alaw); - REGISTER_DECODER(PCM_BLURAY, pcm_bluray); - REGISTER_DECODER(PCM_DVD, pcm_dvd); - REGISTER_ENCDEC (PCM_F32BE, pcm_f32be); - REGISTER_ENCDEC (PCM_F32LE, pcm_f32le); - REGISTER_ENCDEC (PCM_F64BE, pcm_f64be); - REGISTER_ENCDEC (PCM_F64LE, pcm_f64le); - REGISTER_DECODER(PCM_LXF, pcm_lxf); - REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw); - REGISTER_ENCDEC (PCM_S8, pcm_s8); - REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar); - REGISTER_ENCDEC (PCM_S16BE, pcm_s16be); - REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar); - REGISTER_ENCDEC (PCM_S16LE, pcm_s16le); - REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar); - REGISTER_ENCDEC (PCM_S24BE, pcm_s24be); - REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud); - REGISTER_ENCDEC (PCM_S24LE, pcm_s24le); - REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar); - REGISTER_ENCDEC (PCM_S32BE, pcm_s32be); - REGISTER_ENCDEC (PCM_S32LE, pcm_s32le); - REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar); - REGISTER_ENCDEC (PCM_U8, pcm_u8); - REGISTER_ENCDEC (PCM_U16BE, pcm_u16be); - REGISTER_ENCDEC (PCM_U16LE, pcm_u16le); - REGISTER_ENCDEC (PCM_U24BE, pcm_u24be); - REGISTER_ENCDEC (PCM_U24LE, pcm_u24le); - REGISTER_ENCDEC (PCM_U32BE, pcm_u32be); - REGISTER_ENCDEC (PCM_U32LE, pcm_u32le); - REGISTER_DECODER(PCM_ZORK, pcm_zork); - - /* DPCM codecs */ - REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm); - REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm); - REGISTER_DECODER(SOL_DPCM, sol_dpcm); - REGISTER_DECODER(XAN_DPCM, xan_dpcm); - - /* ADPCM codecs */ - REGISTER_DECODER(ADPCM_4XM, adpcm_4xm); - REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx); - REGISTER_DECODER(ADPCM_AFC, adpcm_afc); - REGISTER_DECODER(ADPCM_CT, adpcm_ct); - REGISTER_DECODER(ADPCM_DTK, adpcm_dtk); - REGISTER_DECODER(ADPCM_EA, adpcm_ea); - REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa); - REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1); - REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2); - REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3); - REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas); - REGISTER_ENCDEC (ADPCM_G722, adpcm_g722); - REGISTER_ENCDEC (ADPCM_G726, adpcm_g726); - REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le); - REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv); - REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc); - REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3); - REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4); - REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs); - REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead); - REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss); - REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki); - REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt); - REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad); - REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg); - REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav); - REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws); - REGISTER_ENCDEC (ADPCM_MS, adpcm_ms); - REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2); - REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3); - REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4); - REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf); - REGISTER_DECODER(ADPCM_THP, adpcm_thp); - REGISTER_DECODER(ADPCM_XA, adpcm_xa); - REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha); - REGISTER_DECODER(VIMA, vima); - - /* subtitles */ - REGISTER_ENCDEC (SSA, ssa); - REGISTER_ENCDEC (ASS, ass); - REGISTER_ENCDEC (DVBSUB, dvbsub); - REGISTER_ENCDEC (DVDSUB, dvdsub); - REGISTER_DECODER(JACOSUB, jacosub); - REGISTER_DECODER(MICRODVD, microdvd); - REGISTER_ENCDEC (MOVTEXT, movtext); - REGISTER_DECODER(MPL2, mpl2); - REGISTER_DECODER(PGSSUB, pgssub); - REGISTER_DECODER(PJS, pjs); - REGISTER_DECODER(REALTEXT, realtext); - REGISTER_DECODER(SAMI, sami); - REGISTER_ENCDEC (SRT, srt); - REGISTER_ENCDEC (SUBRIP, subrip); - REGISTER_DECODER(SUBVIEWER, subviewer); - REGISTER_DECODER(SUBVIEWER1, subviewer1); - REGISTER_DECODER(TEXT, text); - REGISTER_DECODER(VPLAYER, vplayer); - REGISTER_DECODER(WEBVTT, webvtt); - REGISTER_ENCDEC (XSUB, xsub); - - /* external libraries */ - REGISTER_DECODER(LIBCELT, libcelt); - REGISTER_ENCODER(LIBFAAC, libfaac); - REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac); - REGISTER_ENCDEC (LIBGSM, libgsm); - REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms); - REGISTER_ENCDEC (LIBILBC, libilbc); - REGISTER_ENCODER(LIBMP3LAME, libmp3lame); - REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb); - REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb); - REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg); - REGISTER_ENCDEC (LIBOPUS, libopus); - REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger); - REGISTER_ENCODER(LIBSHINE, libshine); - REGISTER_ENCDEC (LIBSPEEX, libspeex); - REGISTER_DECODER(LIBSTAGEFRIGHT_H264, libstagefright_h264); - REGISTER_ENCODER(LIBTHEORA, libtheora); - REGISTER_ENCODER(LIBTWOLAME, libtwolame); - REGISTER_ENCDEC (LIBUTVIDEO, libutvideo); - REGISTER_ENCODER(LIBVO_AACENC, libvo_aacenc); - REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc); - REGISTER_ENCDEC (LIBVORBIS, libvorbis); - REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8); - REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9); - REGISTER_ENCODER(LIBWAVPACK, libwavpack); - REGISTER_ENCODER(LIBWEBP, libwebp); - REGISTER_ENCODER(LIBX264, libx264); - REGISTER_ENCODER(LIBX264RGB, libx264rgb); - REGISTER_ENCODER(LIBX265, libx265); - REGISTER_ENCODER(LIBXAVS, libxavs); - REGISTER_ENCODER(LIBXVID, libxvid); - REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext); - REGISTER_ENCODER(LIBAACPLUS, libaacplus); - - /* text */ - REGISTER_DECODER(BINTEXT, bintext); - REGISTER_DECODER(XBIN, xbin); - REGISTER_DECODER(IDF, idf); - - /* parsers */ - REGISTER_PARSER(AAC, aac); - REGISTER_PARSER(AAC_LATM, aac_latm); - REGISTER_PARSER(AC3, ac3); - REGISTER_PARSER(ADX, adx); - REGISTER_PARSER(BMP, bmp); - REGISTER_PARSER(CAVSVIDEO, cavsvideo); - REGISTER_PARSER(COOK, cook); - REGISTER_PARSER(DCA, dca); - REGISTER_PARSER(DIRAC, dirac); - REGISTER_PARSER(DNXHD, dnxhd); - REGISTER_PARSER(DVBSUB, dvbsub); - REGISTER_PARSER(DVDSUB, dvdsub); - REGISTER_PARSER(DVD_NAV, dvd_nav); - REGISTER_PARSER(FLAC, flac); - REGISTER_PARSER(GSM, gsm); - REGISTER_PARSER(H261, h261); - REGISTER_PARSER(H263, h263); - REGISTER_PARSER(H264, h264); - REGISTER_PARSER(HEVC, hevc); - REGISTER_PARSER(MJPEG, mjpeg); - REGISTER_PARSER(MLP, mlp); - REGISTER_PARSER(MPEG4VIDEO, mpeg4video); - REGISTER_PARSER(MPEGAUDIO, mpegaudio); - REGISTER_PARSER(MPEGVIDEO, mpegvideo); - REGISTER_PARSER(PNG, png); - REGISTER_PARSER(PNM, pnm); - REGISTER_PARSER(RV30, rv30); - REGISTER_PARSER(RV40, rv40); - REGISTER_PARSER(TAK, tak); - REGISTER_PARSER(VC1, vc1); - REGISTER_PARSER(VORBIS, vorbis); - REGISTER_PARSER(VP3, vp3); - REGISTER_PARSER(VP8, vp8); - REGISTER_PARSER(VP9, vp9); - - /* bitstream filters */ - REGISTER_BSF(AAC_ADTSTOASC, aac_adtstoasc); - REGISTER_BSF(CHOMP, chomp); - REGISTER_BSF(DUMP_EXTRADATA, dump_extradata); - REGISTER_BSF(H264_MP4TOANNEXB, h264_mp4toannexb); - REGISTER_BSF(IMX_DUMP_HEADER, imx_dump_header); - REGISTER_BSF(MJPEG2JPEG, mjpeg2jpeg); - REGISTER_BSF(MJPEGA_DUMP_HEADER, mjpega_dump_header); - REGISTER_BSF(MP3_HEADER_DECOMPRESS, mp3_header_decompress); - REGISTER_BSF(MOV2TEXTSUB, mov2textsub); - REGISTER_BSF(NOISE, noise); - REGISTER_BSF(REMOVE_EXTRADATA, remove_extradata); - REGISTER_BSF(TEXT2MOVSUB, text2movsub); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amr.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amr.h deleted file mode 100644 index 1ac73abe8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amr.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Shared functions between AMR codecs - * - * Copyright (c) 2010 Marcelo Galvao Povoa - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_AMR_H -#define AVCODEC_AMR_H - -#include - -#include "avcodec.h" - -#ifdef AMR_USE_16BIT_TABLES -#define R_TABLE_TYPE uint16_t -#else -#define R_TABLE_TYPE uint8_t -#endif - -/** - * Fill the frame structure variables from bitstream by parsing the - * given reordering table that uses the following format: - * - * Each field (16 bits) in the AMR Frame is stored as: - * - one byte for the number of bits in the field - * - one byte for the field index - * - then, one byte for each bit of the field (from most-significant to least) - * of the position of that bit in the AMR frame. - * - * @param out pointer to the frame struct - * @param size the size in bytes of the frame struct - * @param data input bitstream after the frame header - * @param ord_table the reordering table as above - */ -static inline void ff_amr_bit_reorder(uint16_t *out, int size, - const uint8_t *data, - const R_TABLE_TYPE *ord_table) -{ - int field_size; - - memset(out, 0, size); - while ((field_size = *ord_table++)) { - int field = 0; - int field_offset = *ord_table++; - while (field_size--) { - int bit = *ord_table++; - field <<= 1; - field |= data[bit >> 3] >> (bit & 7) & 1; - } - out[field_offset >> 1] = field; - } -} - -#endif /* AVCODEC_AMR_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdata.h deleted file mode 100644 index 435fd9924..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdata.h +++ /dev/null @@ -1,1671 +0,0 @@ -/* - * AMR narrowband data and definitions - * Copyright (c) 2006-2007 Robert Swain - * Copyright (c) 2009 Colin McQuillan - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -/** - * @file - * AMR narrowband data and definitions - */ - -#ifndef AVCODEC_AMRNBDATA_H -#define AVCODEC_AMRNBDATA_H - -#include - -#include "libavutil/common.h" /* offsetof */ - -#define AMR_SUBFRAME_SIZE 40 ///< samples per subframe - -/** Frame type (Table 1a in 3GPP TS 26.101) */ -enum Mode { - MODE_4k75 = 0, ///< 4.75 kbit/s - MODE_5k15, ///< 5.15 kbit/s - MODE_5k9, ///< 5.90 kbit/s - MODE_6k7, ///< 6.70 kbit/s - MODE_7k4, ///< 7.40 kbit/s - MODE_7k95, ///< 7.95 kbit/s - MODE_10k2, ///< 10.2 kbit/s - MODE_12k2, ///< 12.2 kbit/s - MODE_DTX, ///< silent frame - N_MODES, ///< number of modes - NO_DATA = 15 ///< no transmission -}; - -#define LP_FILTER_ORDER 10 ///< linear predictive coding filter order - -/** - * AMRNB unpacked data subframe - */ -typedef struct AMRNBSubframe { - uint16_t p_lag; ///< index to decode the pitch lag - uint16_t p_gain; ///< index to decode the pitch gain - uint16_t fixed_gain; ///< index to decode the fixed gain factor, for MODE_12k2 and MODE_7k95 - uint16_t pulses[10]; ///< pulses: 10 for MODE_12k2, 7 for MODE_10k2, and index and sign for others -} AMRNBSubframe; - -/** - * AMRNB unpacked data frame - */ -typedef struct AMRNBFrame { - uint16_t lsf[5]; ///< lsf parameters: 5 parameters for MODE_12k2, only 3 for other modes - AMRNBSubframe subframe[4]; ///< unpacked data for each subframe -} AMRNBFrame; - -/** The index of a frame parameter */ -#define AMR_BIT(field) (offsetof(AMRNBFrame, field)) -/** The index of a subframe-specific parameter */ -#define AMR_OF(frame_num, variable) AMR_BIT(subframe[frame_num].variable) - -// The following order* tables are used to convert AMR frame parameters to and -// from a bitstream. See 3GPP TS 26.101 for more information. -// Each field in AMRNBFrame is stored as: -// * one byte for the number of bits in the field -// * one byte for the field index -// * then, one byte for each bit of the field (from most-significant to least) -// of the position of that bit in the AMR frame. -static const uint8_t order_MODE_4k75[] = { - 8, AMR_BIT(lsf[0]), 7, 6, 5, 4, 3, 2, 1, 0, - 8, AMR_BIT(lsf[1]), 15, 14, 13, 12, 11, 10, 9, 8, - 7, AMR_BIT(lsf[2]), 51, 35, 34, 50, 33, 49, 32, - 8, AMR_OF(0,p_lag), 23, 22, 21, 20, 19, 18, 43, 42, - 8, AMR_OF(0,p_gain), 54, 55, 40, 41, 24, 25, 26, 27, - 7, AMR_OF(0,pulses[0]), 92, 68, 67, 84, 66, 65, 80, - 2, AMR_OF(0,pulses[1]), 53, 52, - 4, AMR_OF(1,p_lag), 17, 16, 48, 63, - 7, AMR_OF(1,pulses[0]), 91, 64, 79, 83, 78, 77, 95, - 2, AMR_OF(1,pulses[1]), 62, 61, - 4, AMR_OF(2,p_lag), 31, 30, 60, 59, - 8, AMR_OF(2,p_gain), 44, 45, 46, 47, 36, 37, 38, 39, - 7, AMR_OF(2,pulses[0]), 90, 76, 75, 82, 74, 73, 94, - 2, AMR_OF(2,pulses[1]), 58, 57, - 4, AMR_OF(3,p_lag), 29, 28, 56, 71, - 7, AMR_OF(3,pulses[0]), 89, 72, 87, 81, 86, 85, 93, - 2, AMR_OF(3,pulses[1]), 70, 69, - 0 -}; - -static const uint8_t order_MODE_5k15[] = { - 8, AMR_BIT(lsf[0]), 0, 1, 2, 3, 4, 5, 6, 7, - 8, AMR_BIT(lsf[1]), 8, 9, 10, 11, 12, 13, 14, 15, - 7, AMR_BIT(lsf[2]), 70, 51, 43, 71, 50, 60, 49, - 8, AMR_OF(0,p_lag), 23, 22, 21, 20, 19, 47, 54, 59, - 6, AMR_OF(0,p_gain), 48, 42, 35, 29, 30, 31, - 7, AMR_OF(0,pulses[0]), 92, 84, 82, 100, 79, 72, 88, - 2, AMR_OF(0,pulses[1]), 67, 68, - 4, AMR_OF(1,p_lag), 18, 46, 53, 58, - 6, AMR_OF(1,p_gain), 63, 41, 34, 26, 27, 28, - 7, AMR_OF(1,pulses[0]), 91, 83, 81, 99, 78, 87, 103, - 2, AMR_OF(1,pulses[1]), 65, 66, - 4, AMR_OF(2,p_lag), 17, 45, 52, 57, - 6, AMR_OF(2,p_gain), 62, 40, 33, 39, 24, 25, - 7, AMR_OF(2,pulses[0]), 90, 80, 95, 98, 77, 86, 102, - 2, AMR_OF(2,pulses[1]), 75, 64, - 4, AMR_OF(3,p_lag), 16, 44, 56, 69, - 6, AMR_OF(3,p_gain), 61, 55, 32, 36, 37, 38, - 7, AMR_OF(3,pulses[0]), 89, 94, 93, 97, 76, 85, 101, - 2, AMR_OF(3,pulses[1]), 73, 74, - 0 -}; - -static const uint8_t order_MODE_5k9[] = { - 8, AMR_BIT(lsf[0]), 7, 6, 0, 3, 5, 4, 2, 1, - 9, AMR_BIT(lsf[1]), 13, 12, 8, 11, 10, 15, 9, 14, 23, - 9, AMR_BIT(lsf[2]), 71, 56, 60, 70, 59, 57, 58, 69, 76, - 8, AMR_OF(0,p_lag), 16, 18, 22, 20, 30, 38, 44, 42, - 6, AMR_OF(0,p_gain), 75, 48, 52, 40, 34, 26, - 9, AMR_OF(0,pulses[0]), 101, 89, 93, 117, 105, 81, 85, 109, 97, - 2, AMR_OF(0,pulses[1]), 67, 78, - 4, AMR_OF(1,p_lag), 28, 36, 46, 87, - 6, AMR_OF(1,p_gain), 74, 63, 51, 55, 33, 25, - 9, AMR_OF(1,pulses[0]), 100, 88, 92, 116, 104, 80, 84, 108, 96, - 2, AMR_OF(1,pulses[1]), 64, 79, - 8, AMR_OF(2,p_lag), 31, 17, 21, 19, 29, 37, 43, 41, - 6, AMR_OF(2,p_gain), 73, 62, 50, 54, 32, 24, - 9, AMR_OF(2,pulses[0]), 99, 103, 91, 115, 119, 95, 83, 107, 111, - 2, AMR_OF(2,pulses[1]), 66, 77, - 4, AMR_OF(3,p_lag), 27, 35, 45, 86, - 6, AMR_OF(3,p_gain), 72, 61, 49, 53, 47, 39, - 9, AMR_OF(3,pulses[0]), 98, 102, 90, 114, 118, 94, 82, 106, 110, - 2, AMR_OF(3,pulses[1]), 65, 68, - 0 -}; - -static const uint8_t order_MODE_6k7[] = { - 8, AMR_BIT(lsf[0]), 7, 6, 15, 4, 5, 3, 2, 0, - 9, AMR_BIT(lsf[1]), 14, 13, 8, 12, 10, 1, 9, 11, 29, - 9, AMR_BIT(lsf[2]), 57, 58, 50, 56, 60, 59, 49, 71, 70, - 8, AMR_OF(0,p_lag), 17, 19, 23, 21, 31, 24, 32, 52, - 7, AMR_OF(0,p_gain), 36, 82, 69, 46, 42, 48, 77, - 11, AMR_OF(0,pulses[0]), 109, 97, 133, 121, 101, 89, 125, 113, 93, 117, - 105, - 3, AMR_OF(0,pulses[1]), 81, 73, 65, - 4, AMR_OF(1,p_lag), 28, 26, 38, 54, - 7, AMR_OF(1,p_gain), 35, 83, 68, 45, 41, 63, 76, - 11, AMR_OF(1,pulses[0]), 108, 96, 132, 120, 100, 88, 124, 112, 92, 116, - 104, - 3, AMR_OF(1,pulses[1]), 80, 72, 64, - 8, AMR_OF(2,p_lag), 16, 18, 22, 20, 30, 39, 47, 51, - 7, AMR_OF(2,p_gain), 34, 84, 67, 44, 40, 62, 75, - 11, AMR_OF(2,pulses[0]), 107, 111, 131, 135, 99, 103, 123, 127, 91, 115, - 119, - 3, AMR_OF(2,pulses[1]), 95, 87, 79, - 4, AMR_OF(3,p_lag), 27, 25, 37, 53, - 7, AMR_OF(3,p_gain), 33, 85, 66, 43, 55, 61, 74, - 11, AMR_OF(3,pulses[0]), 106, 110, 130, 134, 98, 102, 122, 126, 90, 114, - 118, - 3, AMR_OF(3,pulses[1]), 94, 86, 78, - 0 -}; - -static const uint8_t order_MODE_7k4[] = { - 8, AMR_BIT(lsf[0]), 7, 6, 5, 4, 3, 2, 1, 0, - 9, AMR_BIT(lsf[1]), 15, 14, 13, 12, 11, 10, 9, 8, 23, - 9, AMR_BIT(lsf[2]), 53, 52, 51, 58, 40, 55, 54, 57, 56, - 8, AMR_OF(0,p_lag), 22, 20, 18, 16, 30, 50, 95, 94, - 7, AMR_OF(0,p_gain), 28, 24, 73, 36, 32, 62, 67, - 13, AMR_OF(0,pulses[0]), 127, 123, 135, 131, 143, 139, 151, 103, 102, 101, - 100, 99, 98, - 4, AMR_OF(0,pulses[1]), 83, 75, 79, 71, - 5, AMR_OF(1,p_lag), 44, 42, 49, 93, 92, - 7, AMR_OF(1,p_gain), 27, 39, 72, 35, 47, 61, 66, - 13, AMR_OF(1,pulses[0]), 126, 122, 134, 130, 142, 138, 150, 97, 96, 111, - 110, 109, 108, - 4, AMR_OF(1,pulses[1]), 82, 74, 78, 70, - 8, AMR_OF(2,p_lag), 21, 19, 17, 31, 29, 48, 91, 90, - 7, AMR_OF(2,p_gain), 26, 38, 87, 34, 46, 60, 65, - 13, AMR_OF(2,pulses[0]), 125, 121, 133, 129, 141, 137, 149, 107, 106, 105, - 104, 119, 118, - 4, AMR_OF(2,pulses[1]), 81, 85, 77, 69, - 5, AMR_OF(3,p_lag), 43, 41, 63, 89, 88, - 7, AMR_OF(3,p_gain), 25, 37, 86, 33, 45, 59, 64, - 13, AMR_OF(3,pulses[0]), 124, 120, 132, 128, 140, 136, 148, 117, 116, 115, - 114, 113, 112, - 4, AMR_OF(3,pulses[1]), 80, 84, 76, 68, - 0 -}; - -static const uint8_t order_MODE_7k95[] = { - 9, AMR_BIT(lsf[0]), 67, 68, 1, 2, 3, 4, 5, 6, 7, - 9, AMR_BIT(lsf[1]), 14, 13, 9, 12, 11, 0, 10, 15, 8, - 9, AMR_BIT(lsf[2]), 18, 19, 23, 17, 22, 20, 21, 66, 65, - 8, AMR_OF(0,p_lag), 44, 42, 40, 54, 52, 56, 64, 78, - 4, AMR_OF(0,p_gain), 36, 32, 72, 80, - 5, AMR_OF(0,fixed_gain), 16, 28, 24, 60, 84, - 13, AMR_OF(0,pulses[0]), 135, 109, 144, 156, 120, 97, 148, 121, 101, 122, - 123, 89, 124, - 4, AMR_OF(0,pulses[1]), 125, 126, 127, 112, - 6, AMR_OF(1,p_lag), 50, 48, 62, 70, 76, 74, - 4, AMR_OF(1,p_gain), 35, 47, 87, 95, - 5, AMR_OF(1,fixed_gain), 31, 27, 39, 59, 83, - 13, AMR_OF(1,pulses[0]), 129, 108, 159, 155, 130, 96, 147, 131, 100, 132, - 133, 88, 134, - 4, AMR_OF(1,pulses[1]), 113, 114, 115, 116, - 8, AMR_OF(2,p_lag), 43, 41, 55, 53, 51, 71, 79, 77, - 4, AMR_OF(2,p_gain), 34, 46, 86, 94, - 5, AMR_OF(2,fixed_gain), 30, 26, 38, 58, 82, - 13, AMR_OF(2,pulses[0]), 139, 107, 158, 154, 140, 111, 146, 141, 99, 142, - 143, 103, 128, - 4, AMR_OF(2,pulses[1]), 105, 90, 91, 92, - 6, AMR_OF(3,p_lag), 49, 63, 61, 69, 75, 73, - 4, AMR_OF(3,p_gain), 33, 45, 85, 93, - 5, AMR_OF(3,fixed_gain), 29, 25, 37, 57, 81, - 13, AMR_OF(3,pulses[0]), 149, 106, 157, 153, 150, 110, 145, 151, 98, 136, - 137, 102, 138, - 4, AMR_OF(3,pulses[1]), 117, 118, 119, 104, - 0 -}; - -static const uint8_t order_MODE_10k2[] = { - 8, AMR_BIT(lsf[0]), 0, 1, 2, 3, 4, 5, 6, 7, - 9, AMR_BIT(lsf[1]), 23, 8, 9, 10, 11, 12, 13, 14, 15, - 9, AMR_BIT(lsf[2]), 57, 58, 62, 56, 60, 59, 61, 71, 70, - 8, AMR_OF(0,p_lag), 22, 21, 20, 19, 18, 17, 42, 41, - 7, AMR_OF(0,p_gain), 38, 50, 84, 37, 36, 85, 83, - 1, AMR_OF(0,pulses[0]), 66, - 1, AMR_OF(0,pulses[1]), 67, - 1, AMR_OF(0,pulses[2]), 68, - 1, AMR_OF(0,pulses[3]), 69, - 10, AMR_OF(0,pulses[4]), 145, 144, 156, 153, 154, 163, 161, 192, 206, 195, - 10, AMR_OF(0,pulses[5]), 158, 159, 157, 152, 155, 165, 160, 205, 204, 194, - 7, AMR_OF(0,pulses[6]), 167, 166, 162, 164, 196, 207, 193, - 5, AMR_OF(1,p_lag), 26, 25, 54, 53, 89, - 7, AMR_OF(1,p_gain), 35, 49, 81, 34, 33, 82, 80, - 1, AMR_OF(1,pulses[0]), 78, - 1, AMR_OF(1,pulses[1]), 79, - 1, AMR_OF(1,pulses[2]), 64, - 1, AMR_OF(1,pulses[3]), 65, - 10, AMR_OF(1,pulses[4]), 103, 102, 98, 111, 96, 105, 119, 185, 199, 188, - 10, AMR_OF(1,pulses[5]), 100, 101, 99, 110, 97, 107, 118, 198, 197, 187, - 7, AMR_OF(1,pulses[6]), 109, 108, 104, 106, 189, 184, 186, - 8, AMR_OF(2,p_lag), 16, 31, 30, 29, 28, 27, 40, 55, - 7, AMR_OF(2,p_gain), 32, 48, 94, 47, 46, 95, 93, - 1, AMR_OF(2,pulses[0]), 74, - 1, AMR_OF(2,pulses[1]), 75, - 1, AMR_OF(2,pulses[2]), 76, - 1, AMR_OF(2,pulses[3]), 77, - 10, AMR_OF(2,pulses[4]), 117, 116, 112, 125, 126, 135, 133, 178, 176, 181, - 10, AMR_OF(2,pulses[5]), 114, 115, 113, 124, 127, 121, 132, 191, 190, 180, - 7, AMR_OF(2,pulses[6]), 123, 122, 134, 120, 182, 177, 179, - 5, AMR_OF(3,p_lag), 24, 39, 52, 51, 88, - 7, AMR_OF(3,p_gain), 45, 63, 91, 44, 43, 92, 90, - 1, AMR_OF(3,pulses[0]), 86, - 1, AMR_OF(3,pulses[1]), 87, - 1, AMR_OF(3,pulses[2]), 72, - 1, AMR_OF(3,pulses[3]), 73, - 10, AMR_OF(3,pulses[4]), 131, 130, 142, 139, 140, 149, 147, 171, 169, 174, - 10, AMR_OF(3,pulses[5]), 128, 129, 143, 138, 141, 151, 146, 168, 183, 173, - 7, AMR_OF(3,pulses[6]), 137, 136, 148, 150, 175, 170, 172, - 0 -}; - -static const uint8_t order_MODE_12k2[] = { - 7, AMR_BIT(lsf[0]), 7, 6, 5, 4, 3, 2, 1, - 8, AMR_BIT(lsf[1]), 0, 15, 14, 13, 12, 11, 10, 9, - 9, AMR_BIT(lsf[2]), 23, 22, 21, 20, 19, 18, 17, 16, 8, - 8, AMR_BIT(lsf[3]), 31, 30, 29, 28, 27, 86, 85, 84, - 6, AMR_BIT(lsf[4]), 83, 82, 81, 80, 127, 126, - 9, AMR_OF(0,p_lag), 26, 24, 38, 36, 34, 32, 46, 44, 42, - 4, AMR_OF(0,p_gain), 40, 52, 48, 95, - 5, AMR_OF(0,fixed_gain), 60, 56, 68, 91, 111, - 3, AMR_OF(0,pulses[0]), 191, 176, 177, - 4, AMR_OF(0,pulses[1]), 103, 123, 124, 125, - 3, AMR_OF(0,pulses[2]), 188, 189, 190, - 4, AMR_OF(0,pulses[3]), 99, 120, 121, 122, - 3, AMR_OF(0,pulses[4]), 185, 186, 187, - 4, AMR_OF(0,pulses[5]), 107, 133, 134, 135, - 3, AMR_OF(0,pulses[6]), 198, 199, 184, - 4, AMR_OF(0,pulses[7]), 119, 130, 131, 132, - 3, AMR_OF(0,pulses[8]), 195, 196, 197, - 4, AMR_OF(0,pulses[9]), 115, 143, 128, 129, - 6, AMR_OF(1,p_lag), 64, 78, 76, 74, 72, 245, - 4, AMR_OF(1,p_gain), 55, 51, 63, 94, - 5, AMR_OF(1,fixed_gain), 59, 71, 67, 90, 110, - 3, AMR_OF(1,pulses[0]), 192, 193, 194, - 4, AMR_OF(1,pulses[1]), 102, 140, 141, 142, - 3, AMR_OF(1,pulses[2]), 205, 206, 207, - 4, AMR_OF(1,pulses[3]), 98, 137, 138, 139, - 3, AMR_OF(1,pulses[4]), 202, 203, 204, - 4, AMR_OF(1,pulses[5]), 106, 150, 151, 136, - 3, AMR_OF(1,pulses[6]), 215, 200, 201, - 4, AMR_OF(1,pulses[7]), 118, 147, 148, 149, - 3, AMR_OF(1,pulses[8]), 212, 213, 214, - 4, AMR_OF(1,pulses[9]), 114, 144, 145, 146, - 9, AMR_OF(2,p_lag), 25, 39, 37, 35, 33, 47, 45, 43, 41, - 4, AMR_OF(2,p_gain), 54, 50, 62, 93, - 5, AMR_OF(2,fixed_gain), 58, 70, 66, 89, 109, - 3, AMR_OF(2,pulses[0]), 209, 210, 211, - 4, AMR_OF(2,pulses[1]), 101, 157, 158, 159, - 3, AMR_OF(2,pulses[2]), 222, 223, 208, - 4, AMR_OF(2,pulses[3]), 97, 154, 155, 156, - 3, AMR_OF(2,pulses[4]), 219, 220, 221, - 4, AMR_OF(2,pulses[5]), 105, 167, 152, 153, - 3, AMR_OF(2,pulses[6]), 216, 217, 218, - 4, AMR_OF(2,pulses[7]), 117, 164, 165, 166, - 3, AMR_OF(2,pulses[8]), 229, 230, 231, - 4, AMR_OF(2,pulses[9]), 113, 161, 162, 163, - 6, AMR_OF(3,p_lag), 79, 77, 75, 73, 87, 244, - 4, AMR_OF(3,p_gain), 53, 49, 61, 92, - 5, AMR_OF(3,fixed_gain), 57, 69, 65, 88, 108, - 3, AMR_OF(3,pulses[0]), 226, 227, 228, - 4, AMR_OF(3,pulses[1]), 100, 174, 175, 160, - 3, AMR_OF(3,pulses[2]), 239, 224, 225, - 4, AMR_OF(3,pulses[3]), 96, 171, 172, 173, - 3, AMR_OF(3,pulses[4]), 236, 237, 238, - 4, AMR_OF(3,pulses[5]), 104, 168, 169, 170, - 3, AMR_OF(3,pulses[6]), 233, 234, 235, - 4, AMR_OF(3,pulses[7]), 116, 181, 182, 183, - 3, AMR_OF(3,pulses[8]), 246, 247, 232, - 4, AMR_OF(3,pulses[9]), 112, 178, 179, 180, - 0 -}; - -/** - * position of the bitmapping data for each packet type in - * the AMRNBFrame - */ -static const uint8_t * const amr_unpacking_bitmaps_per_mode[N_MODES] = { - order_MODE_4k75, - order_MODE_5k15, - order_MODE_5k9, - order_MODE_6k7, - order_MODE_7k4, - order_MODE_7k95, - order_MODE_10k2, - order_MODE_12k2, -}; - -/** number of bytes for each mode */ -static const uint8_t frame_sizes_nb[N_MODES] = { - 12, 13, 15, 17, 19, 20, 26, 31, 5 -}; - -/** - * Base-5 representation for values 0-124 - * - * This is useful for decoding pulse positions in 10.2 kbit/s frames. - * Safe values are provided for out of range positions 125-127. - */ -static const uint8_t base_five_table[128][3] = { - {0, 0, 0}, {0, 0, 1}, {0, 0, 2}, {0, 0, 3}, {0, 0, 4}, {0, 1, 0}, {0, 1, 1}, - {0, 1, 2}, {0, 1, 3}, {0, 1, 4}, {0, 2, 0}, {0, 2, 1}, {0, 2, 2}, {0, 2, 3}, - {0, 2, 4}, {0, 3, 0}, {0, 3, 1}, {0, 3, 2}, {0, 3, 3}, {0, 3, 4}, {0, 4, 0}, - {0, 4, 1}, {0, 4, 2}, {0, 4, 3}, {0, 4, 4}, {1, 0, 0}, {1, 0, 1}, {1, 0, 2}, - {1, 0, 3}, {1, 0, 4}, {1, 1, 0}, {1, 1, 1}, {1, 1, 2}, {1, 1, 3}, {1, 1, 4}, - {1, 2, 0}, {1, 2, 1}, {1, 2, 2}, {1, 2, 3}, {1, 2, 4}, {1, 3, 0}, {1, 3, 1}, - {1, 3, 2}, {1, 3, 3}, {1, 3, 4}, {1, 4, 0}, {1, 4, 1}, {1, 4, 2}, {1, 4, 3}, - {1, 4, 4}, {2, 0, 0}, {2, 0, 1}, {2, 0, 2}, {2, 0, 3}, {2, 0, 4}, {2, 1, 0}, - {2, 1, 1}, {2, 1, 2}, {2, 1, 3}, {2, 1, 4}, {2, 2, 0}, {2, 2, 1}, {2, 2, 2}, - {2, 2, 3}, {2, 2, 4}, {2, 3, 0}, {2, 3, 1}, {2, 3, 2}, {2, 3, 3}, {2, 3, 4}, - {2, 4, 0}, {2, 4, 1}, {2, 4, 2}, {2, 4, 3}, {2, 4, 4}, {3, 0, 0}, {3, 0, 1}, - {3, 0, 2}, {3, 0, 3}, {3, 0, 4}, {3, 1, 0}, {3, 1, 1}, {3, 1, 2}, {3, 1, 3}, - {3, 1, 4}, {3, 2, 0}, {3, 2, 1}, {3, 2, 2}, {3, 2, 3}, {3, 2, 4}, {3, 3, 0}, - {3, 3, 1}, {3, 3, 2}, {3, 3, 3}, {3, 3, 4}, {3, 4, 0}, {3, 4, 1}, {3, 4, 2}, - {3, 4, 3}, {3, 4, 4}, {4, 0, 0}, {4, 0, 1}, {4, 0, 2}, {4, 0, 3}, {4, 0, 4}, - {4, 1, 0}, {4, 1, 1}, {4, 1, 2}, {4, 1, 3}, {4, 1, 4}, {4, 2, 0}, {4, 2, 1}, - {4, 2, 2}, {4, 2, 3}, {4, 2, 4}, {4, 3, 0}, {4, 3, 1}, {4, 3, 2}, {4, 3, 3}, - {4, 3, 4}, {4, 4, 0}, {4, 4, 1}, {4, 4, 2}, {4, 4, 3}, {4, 4, 4}, {0, 0, 0}, - {0, 0, 0}, {0, 0, 0} -}; - -/** - * Values for the lsp vector from the 4th subframe of the - * previous subframe values. - * - * @note: Taken from Decoder_amr_reset in Q15 using val/1000 - */ -static const int8_t lsp_sub4_init[LP_FILTER_ORDER] = { - 30, 26, 21, 15, 8, 0, -8, -15, -21, -26 -}; - -/** - * Mean lsp values. - * - * @note: Taken from Decoder_amr_reset in Q15 - */ -static const int16_t lsp_avg_init[LP_FILTER_ORDER] = { - 1384, 2077, 3420, 5108, 6742, 8122, 9863, 11092, 12714, 13701 -}; - -// LSF tables - -// These are stored as integers to save space. The values are taken from -// q_plsf_3.tab and q_plsf_5.tab in 3GPP TS 26.090. - -static const int16_t lsf_3_3_MODE_5k15[128][4] = { -{ 419, 163, -30, -262}, { -455, -789,-1430, -721}, { 1006, 664, 269, 25}, -{ 619, 260, 183, 96}, { -968,-1358, -388, 135}, { -693, 835, 456, 154}, -{ 1105, 703, 569, 363}, { 1625, 1326, 985, 748}, { -220, 219, 76, -208}, -{-1455,-1662, 49, 149}, { -964, -172, -752, -336}, { 625, 209, -250, -66}, -{-1017, -838, -2, 317}, {-2168,-1485, -138, 123}, {-1876,-2099, -521, 85}, -{ -967, -366, -695, -881}, { -921,-1011, -763, -949}, { -124, -256, -352, -660}, -{ 178, 463, 354, 304}, {-1744, -591, -282, 79}, {-2249, 175, 867, 499}, -{ -138, -180, -181, -21}, {-2291,-1241, -460, -520}, { -771, 451, -10, -308}, -{ 271, -65, 4, 214}, { -279, -435, -43, -348}, { -670, 35, -65, -211}, -{ 806, 535, 85, 297}, { 57, 239, 722, 493}, { 225, 661, 840, 547}, -{ -540, -376, 14, 349}, { 469, 721, 331, 162}, { -544, -752, -62, -10}, -{ 398, -88, 724, 701}, { -19, -533, -94, 601}, { 136, -71, -681, -747}, -{ -166, -344, 261, -50}, { 161, -52, 485, 337}, {-1675, 50, 190, -93}, -{-2282, -231, -194, -82}, { -95, -595, -154, 128}, { 894, 501, 588, 457}, -{ -345, 206, 122, 110}, { -631, -227, -569, 3}, { 408, 239, 397, 226}, -{ -197, -2, 128, 491}, { 1281, 904, 292, 215}, { 538, 306, 259, 509}, -{ -677,-1047, 13, 321}, { -679, -588, -358, -212}, { -558, 243, 646, 479}, -{ 486, 342, 634, 532}, { 107, 802, 331, 136}, { -112, -398,-1031, -286}, -{ -326, -705, 288, 272}, { 1299, 1144, 1178, 860}, { -423, 121, -385, -148}, -{ -295, -302, -834, -819}, { 16, -24, -201, -476}, { 555, 91, -245, 294}, -{ -38, -379, -962,-1221}, {-1191,-1518, -273, -395}, { -390,-1013, -645, 573}, -{-1843,-1030, 505, 468}, { 744, 947, 609, 493}, { -689,-1172, -628, -135}, -{-1026, 195, 411, 196}, { 1582, 1147, 575, 337}, {-1239, -777, -648, -142}, -{ 595, 825, 967, 735}, {-1206, -970, -81, -342}, { -745, 13, -72, 375}, -{ 454, 19, 1407, 921}, {-1647, -172, 861, 562}, { 928, 1537, 1063, 740}, -{-2472, -952, 264, 82}, { -502, -965,-1334, 123}, { 867, 1236, 534, 171}, -{-2320, -460, 780, 363}, {-1190, -617, 252, -61}, { -174, 34, 1011, 788}, -{-2333, 247, 423, 153}, { -16, -355, 262, 449}, {-1576,-1073, -544, -371}, -{ -615, -305, 1051, 805}, { 687, 528, 6, -182}, { 935, 875, 1002, 809}, -{ 199, 257, 126, 76}, { -584,-1138, 599, 556}, {-1105,-1391,-1591, -519}, -{ -977,-1325, 108, 347}, { -722, -975, 365, 101}, { -145, 681, 249, -153}, -{ 0, -334, -570, 159}, { 412, 285, -336, -617}, { -953, -966, 887, 689}, -{-1251, 84, -185, -398}, { -592, 433, 1044, 653}, { 85, 329, -40, 361}, -{ -433, -705, 466, 574}, { -154, 654, 592, 290}, { -167, 72, 349, 175}, -{ 674, 297, 977, 720}, { 1235, 1204, 757, 488}, { -400, -269, 538, 372}, -{-1350,-1387,-1194, -91}, { 1262, 876, 775, 700}, { -599, -38, -430, -722}, -{ 1976, 1630, 991, 608}, { 111, 276, -226, -96}, { -947, -388, -11, -7}, -{ -303, -531, -839, 338}, { 1734, 1710, 1405, 1013}, { -516, -855, -645, 210}, -{ -688, -416, 513, 230}, { -822, -637,-1146, -320}, { -952, -658, -694, 183}, -{ -114, -623, 818, 674}, { -191, -204, 731, 635}, { 51, 1221, 883, 576}, -{ -954, -431, 826, 598}, { -342, -755, -900, -407}, {-1126, -354, -206, -512}, -{ -547, -810, -357, -620}, { 66, 515, -73, -410}, { -872, -945,-1444,-1227}, -{ 191, -17, -544, -231}, {-1540, -544, -901, -886} -}; - -static const int16_t lsf_3_1_MODE_7k95[512][3] = { -{ -890,-1550,-2541}, { -819, -970, 175}, { -826,-1234, -762}, -{ -599, -22, 634}, { -811, -987, -902}, { -323, 203, 26}, -{ -383, -235, -781}, { -399, 1262, 906}, { -932,-1399,-1380}, -{ -624, 93, 87}, { -414, -539, -691}, { 37, 633, 510}, -{ -387, -476,-1330}, { 399, 66, 263}, { -407, -49, -335}, -{ -417, 1041, 1865}, { -779,-1089,-1440}, { -746, -858, 832}, -{ -581, -759, -371}, { -673, -506, 2088}, { -560, -634,-1179}, -{ 271, 241, 14}, { -438, -244, -397}, { 463, 1202, 1047}, -{ -606, -797,-1438}, { -51, -323, 481}, { -224, -584, -527}, -{ 494, 881, 682}, { -433, -306,-1002}, { 554, 659, 222}, -{ 171, -160, -353}, { 681, 1798, 1565}, { -852,-1181,-1695}, -{ -336, -666, 114}, { -581, -756, -744}, { -195, 375, 497}, -{ -465, -804,-1098}, { 154, 282, -131}, { -50, -191, -719}, -{ 323, 732, 1542}, { -722, -819,-1404}, { 105, -250, 185}, -{ -178, -502, -742}, { 321, 510, 1111}, { -323, -567, -966}, -{ 127, 484, 338}, { -160, 52, -338}, { 732, 1367, 1554}, -{ -626, -802,-1696}, { -286, -586, 676}, { -695, -343, -370}, -{ -490, 295, 1893}, { -630, -574,-1014}, { -80, 645, -69}, -{ -6, -318, -364}, { 782, 1450, 1038}, { -313, -733,-1395}, -{ 120, 60, 477}, { -264, -585, -123}, { 711, 1245, 633}, -{ -91, -355,-1016}, { 771, 758, 261}, { 253, 81, -474}, -{ 930, 2215, 1720}, { -808,-1099,-1925}, { -560, -782, 169}, -{ -804,-1074, -188}, { -626, -55, 1405}, { -694, -716,-1194}, -{ -660, 354, 329}, { -514, -55, -543}, { 366, 1033, 1182}, -{ -658, -959,-1357}, { -55, -184, 93}, { -605, -286, -662}, -{ 404, 449, 827}, { -286, -350,-1263}, { 628, 306, 227}, -{ -16, 147, -623}, { 186, 923, 2146}, { -674, -890,-1606}, -{ -443, -228, 339}, { -369, -790, -409}, { 231, 86, 1469}, -{ -448, -581,-1061}, { 594, 450, -177}, { -124, -170, -447}, -{ 671, 1159, 1404}, { -476, -667,-1511}, { -77, -138, 716}, -{ -177, -372, -381}, { 451, 934, 915}, { -250, -432, -822}, -{ 272, 828, 446}, { 26, 19, -31}, { 698, 1692, 2168}, -{ -646, -977,-1924}, { -179, -473, 268}, { -379, -745, -691}, -{ 11, 127, 1033}, { -488, -917, -825}, { 61, 323, 135}, -{ 147, -145, -686}, { 685, 786, 1682}, { -506, -848,-1297}, -{ 35, 90, 222}, { -23, -346, -670}, { 455, 591, 1287}, -{ -203, -593,-1086}, { 652, 352, 437}, { 39, 63, -457}, -{ 841, 1265, 2105}, { -520, -882,-1584}, { -328, -711, 1421}, -{ -596, -342, -70}, { 209, 173, 1928}, { -423, -598, -921}, -{ 421, 605, -38}, { -2, -245, -127}, { 896, 1969, 1135}, -{ -379, -518,-1579}, { 173, 118, 753}, { -55, -381, -52}, -{ 985, 1021, 753}, { -2, -291, -891}, { 753, 992, 423}, -{ 264, 131, -196}, { 895, 2274, 2543}, { -635,-1088,-2499}, -{ -529, -982, 526}, { -764, -830, -548}, { -436, 316, 599}, -{ -675, -940, -746}, { -57, 236, -11}, { -201, -81, -798}, -{ 16, 845, 1558}, { -737, -985,-1212}, { -468, 17, 290}, -{ -279, -584, -700}, { 183, 822, 705}, { -265, -492,-1187}, -{ 421, 152, 468}, { -390, 166, -268}, { 39, 1550, 1868}, -{ -635, -966,-1571}, { -453, -492, 910}, { -284,-1027, -75}, -{ -181, -133, 1852}, { -445, -624,-1174}, { 420, 367, -49}, -{ -389, -212, -169}, { 707, 1073, 1208}, { -539, -710,-1449}, -{ 83, -163, 484}, { -236, -543, -355}, { 338, 1175, 814}, -{ -246, -309, -958}, { 606, 760, 60}, { 166, -8, -163}, -{ -306, 1849, 2563}, { -747,-1025,-1783}, { -419, -446, 209}, -{ -718, -566, -534}, { -506, 693, 857}, { -463, -697,-1082}, -{ 325, 431, -206}, { -15, -8, -763}, { 545, 919, 1518}, -{ -611, -783,-1313}, { 256, -55, 208}, { -165, -348, -662}, -{ 321, 680, 930}, { -326, -429, -951}, { 484, 446, 570}, -{ -197, 72, -73}, { 909, 1455, 1741}, { -563, -737,-1974}, -{ -124, -416, 718}, { -478, -404, -314}, { -16, 446, 1636}, -{ -551, -537, -750}, { -58, 638, 214}, { 55, -185, -271}, -{ 1148, 1301, 1212}, { -483, -671,-1264}, { 117, 285, 543}, -{ -204, -391, -111}, { 513, 1538, 854}, { -114, -190, -978}, -{ 877, 595, 464}, { 260, 260, -311}, { 748, 2283, 2216}, -{ -517, -945,-2171}, { -326, -708, 378}, { -812, -691, -232}, -{ -560, 687, 1409}, { -732, -690, -836}, { -359, 645, 386}, -{ -265, 62, -678}, { 145, 1644, 1208}, { -555, -988,-1233}, -{ -78, 14, 114}, { -327, -358, -489}, { 392, 677, 697}, -{ -201, -236,-1140}, { 693, 449, 178}, { -243, 256, -433}, -{ 611, 1385, 2456}, { -612, -901,-1464}, { -307, -17, 499}, -{ -315, -667, -254}, { 256, 428, 1463}, { -486, -422,-1056}, -{ 655, 370, 18}, { -102, -185, -276}, { 755, 1578, 1335}, -{ -488, -603,-1418}, { 182, -93, 870}, { -73, -458, -348}, -{ 835, 862, 957}, { -282, -333, -746}, { 547, 839, 428}, -{ 273, -89, 13}, { 940, 1708, 2576}, { -418,-1084,-1758}, -{ -44, -358, 259}, { -497, -643, -560}, { 99, 557, 961}, -{ -421, -766, -917}, { 295, 326, 184}, { 175, 15, -626}, -{ 532, 878, 1981}, { -443, -768,-1275}, { 221, 156, 268}, -{ 39, -363, -505}, { 695, 772, 1140}, { -162, -459, -912}, -{ 709, 444, 658}, { 25, 303, -312}, { 1268, 1410, 1715}, -{ -297, -766,-1836}, { -263, -108, 1070}, { -406, -13, -129}, -{ 57, 438, 2734}, { -374, -487, -835}, { 304, 696, 164}, -{ 104, -235, 5}, { 1611, 1900, 1399}, { -229, -582,-1325}, -{ 405, 192, 817}, { -87, -438, 111}, { 1028, 1199, 993}, -{ 68, -175, -934}, { 1033, 1117, 451}, { 478, 200, -248}, -{ 2127, 2696, 2042}, { -835,-1323,-2131}, { -799, -692, 466}, -{ -812,-1032, -469}, { -622, 288, 920}, { -701, -841,-1070}, -{ -411, 512, 8}, { -390, -91, -744}, { -30, 1043, 1161}, -{ -822,-1148,-1156}, { -294, -46, 110}, { -411, -374, -678}, -{ 214, 531, 668}, { -406, -420,-1194}, { 487, 232, 303}, -{ -318, 91, -472}, { 123, 1232, 2445}, { -722, -952,-1495}, -{ -738, -675, 1332}, { -543, -606, -211}, { -95, -98, 1508}, -{ -549, -514,-1193}, { 473, 211, 73}, { -288, -112, -389}, -{ 537, 1332, 1258}, { -567, -755,-1545}, { 71, -283, 632}, -{ -170, -481, -493}, { 681, 1002, 817}, { -356, -331, -877}, -{ 419, 706, 346}, { 241, -34, -326}, { 377, 1950, 1883}, -{ -727,-1075,-1625}, { -233, -543, 116}, { -524, -806, -585}, -{ -73, 478, 729}, { -288, -925,-1143}, { 173, 447, -52}, -{ 68, -229, -606}, { 449, 529, 1797}, { -591, -875,-1363}, -{ 183, -144, 324}, { -103, -452, -666}, { 623, 488, 1176}, -{ -238, -511,-1004}, { 326, 552, 458}, { 136, 108, -319}, -{ 626, 1343, 1883}, { -490, -646,-1730}, { -186, -449, 984}, -{ -738, -76, -170}, { -550, 755, 2560}, { -496, -510, -947}, -{ 210, 694, -52}, { 84, -322, -199}, { 1090, 1625, 1224}, -{ -376, -603,-1396}, { 343, 74, 632}, { -175, -502, -32}, -{ 972, 1332, 734}, { 52, -295,-1113}, { 1065, 918, 160}, -{ 393, 107, -397}, { 1214, 2649, 1741}, { -632,-1201,-1891}, -{ -719, -277, 353}, { -651, -880, -122}, { -211, 209, 1338}, -{ -562, -714,-1059}, { -208, 388, 159}, { -320, -61, -551}, -{ 293, 1092, 1443}, { -648, -865,-1253}, { -49, -143, 305}, -{ -401, -227, -585}, { 561, 532, 927}, { -117, -443,-1188}, -{ 507, 436, 292}, { -79, 233, -458}, { 671, 1025, 2396}, -{ -633, -842,-1525}, { -308, -286, 640}, { -373, -621, -407}, -{ 418, 253, 1305}, { -315, -581,-1137}, { 572, 685, -281}, -{ 61, -68, -371}, { 991, 1101, 1498}, { -493, -683,-1362}, -{ -47, 164, 704}, { -256, -314, -268}, { 631, 949, 1052}, -{ -118, -348, -833}, { 68, 1180, 568}, { 152, 117, 34}, -{ 1113, 1902, 2239}, { -601, -959,-1706}, { -143, -489, 480}, -{ -332, -655, -574}, { 54, 353, 1192}, { -462, -652, -796}, -{ 150, 549, 112}, { 195, -111, -515}, { 679, 1108, 1647}, -{ -558, -749,-1217}, { -9, 272, 341}, { -53, -265, -535}, -{ 489, 843, 1298}, { -120, -482,-1032}, { 632, 543, 408}, -{ 179, 306, -526}, { 1124, 1464, 2244}, { -417, -786,-1562}, -{ -224, -384, 1364}, { -377, -459, -25}, { 385, 489, 2174}, -{ -332, -651, -829}, { 544, 553, 61}, { 22, -113, -89}, -{ 1128, 1725, 1524}, { -216, -373,-1653}, { 161, 316, 908}, -{ -165, -222, -67}, { 1362, 1175, 789}, { 73, -252, -767}, -{ 738, 932, 616}, { 362, 246, -126}, { 787, 2654, 3027}, -{ -691,-1106,-2190}, { -565, -588, 524}, { -590, -979, -490}, -{ -263, 397, 982}, { -577, -837, -945}, { -22, 435, -49}, -{ -190, -118, -629}, { -88, 1240, 1513}, { -636,-1051,-1019}, -{ -291, 189, 259}, { -257, -470, -629}, { 145, 945, 894}, -{ -326, -364,-1094}, { 543, 260, 630}, { -202, 189, -209}, -{ 357, 1379, 2091}, { -569,-1075,-1449}, { -714, -239, 919}, -{ -420, -705, -84}, { -109, -114, 2407}, { -413, -529,-1177}, -{ 482, 368, 131}, { -186, -72, -131}, { 861, 1255, 1220}, -{ -611, -658,-1341}, { 227, -121, 631}, { -176, -489, -218}, -{ 745, 1175, 957}, { -321, -148, -936}, { 671, 966, 216}, -{ 340, -3, -143}, { 469, 1848, 2437}, { -729, -961,-1683}, -{ -213, -254, 321}, { -511, -438, -521}, { -126, 725, 903}, -{ -340, -685,-1032}, { 316, 480, 20}, { 23, -89, -551}, -{ 353, 1051, 1789}, { -544, -757,-1364}, { 298, -25, 436}, -{ -100, -392, -519}, { 467, 754, 1078}, { -210, -398,-1078}, -{ 620, 658, 630}, { 33, 147, -178}, { 921, 1687, 1921}, -{ -325, -528,-1978}, { 2, -285, 910}, { -371, -490, -230}, -{ 0, 597, 2010}, { -496, -395, -834}, { 37, 945, 245}, -{ 181, -160, -144}, { 1481, 1373, 1357}, { -355, -601,-1270}, -{ 298, 322, 672}, { -193, -336, 77}, { 1089, 1533, 922}, -{ 177, -39,-1125}, { 996, 781, 536}, { 456, 366, -432}, -{ 1415, 2440, 2279}, { -466, -758,-2325}, { -303, -509, 387}, -{ -727, -557, 66}, { -145, 643, 1248}, { -544, -676, -916}, -{ -225, 862, 588}, { -152, 40, -533}, { 423, 1423, 1558}, -{ -572, -843,-1145}, { -128, 85, 461}, { -238, -257, -584}, -{ 605, 748, 861}, { 24, -202,-1409}, { 797, 487, 303}, -{ -181, 364, -182}, { 616, 1378, 2942}, { -494, -852,-1441}, -{ -292, 61, 812}, { -84, -723, -182}, { 555, 532, 1506}, -{ -365, -493,-1057}, { 822, 588, 11}, { -14, -18, -230}, -{ 1001, 1401, 1451}, { -474, -569,-1292}, { 302, 62, 1062}, -{ -70, -376, -222}, { 982, 974, 1149}, { -196, -234, -795}, -{ 479, 1098, 499}, { 362, 58, 70}, { 1147, 2069, 2857}, -{ -487, -878,-1824}, { 73, -288, 348}, { -358, -500, -508}, -{ 199, 721, 1242}, { -78, -697, -795}, { 361, 536, 196}, -{ 374, 110, -735}, { 847, 1051, 1896}, { -366, -713,-1182}, -{ 315, 320, 429}, { 72, -215, -450}, { 759, 886, 1363}, -{ -30, -428, -834}, { 861, 627, 796}, { 118, 468, -279}, -{ 1355, 1883, 1893}, { -188, -642,-1612}, { 63, -175, 1198}, -{ -418, -211, 51}, { 414, 587, 2601}, { -234, -557, -858}, -{ 424, 889, 222}, { 136, -101, 83}, { 1413, 2278, 1383}, -{ -84, -445,-1389}, { 414, 313, 1045}, { 29, -343, 65}, -{ 1552, 1647, 980}, { 183, -91, -829}, { 1273, 1413, 360}, -{ 553, 272, -107}, { 1587, 3149, 2603} -}; - -static const int16_t lsf_3_1[256][3] = { -{ 6, 82, -131}, { 154, -56, -735}, { 183, -65, -265}, -{ 9, -210, -361}, { 113, 718, 1817}, { 1010, 1214, 1573}, -{ 857, 1333, 2276}, { 827, 1568, 1933}, { 717, 1989, 2206}, -{ 838, 1172, 1823}, { 721, 1000, 2154}, { 286, 476, 1509}, -{ -247, -531, 230}, { 147, -82, 569}, { 26, -177, -944}, -{ -27, -273, 692}, { -164, -264, -183}, { 224, 790, 1039}, -{ 899, 946, 601}, { 485, 771, 1150}, { 524, 677, 903}, -{ -140, 375, 778}, { 410, 676, 429}, { 301, 530, 1009}, -{ 719, 646, 38}, { 226, 367, 40}, { 145, -45, -505}, -{ 290, 121, -121}, { 302, 127, 166}, { -124, -383, -956}, -{ -358, -455, -977}, { 715, 878, 894}, { 978, 923, 211}, -{ 477, 272, 64}, { 188, -78, 17}, { -143, -65, 38}, -{ 643, 586, 621}, { -134, -426, -651}, { 347, 545, 2820}, -{ 1188, 2726, 2442}, { 142, -80, 1735}, { 283, 130, 461}, -{ -262, -399,-1145}, { -411, 155, 430}, { 329, 375, 779}, -{ 53, -226, -139}, { -129, -236, 1682}, { 285, 744, 1327}, -{ 738, 697, 1664}, { 312, 409, 266}, { 325, 720, 135}, -{ 1, 221, 453}, { 8, 203, 145}, { 299, 640, 760}, -{ 29, 468, 638}, { 103, 429, 379}, { 420, 954, 932}, -{ 1326, 1210, 1258}, { 704, 1012, 1152}, { -166, -444, -266}, -{ -316, -130, -376}, { 191, 1151, 1904}, { -240, -543,-1260}, -{ -112, 268, 1207}, { 70, 1062, 1583}, { 278, 1360, 1574}, -{ -258, -272, -768}, { 19, 563, 2240}, { -3, -265, 135}, -{ -295, -591, -388}, { 140, 354, -206}, { -260, -504, -795}, -{ -433, -718,-1319}, { 109, 331, 962}, { -429, -87, 652}, -{ -296, 426, 1019}, { -239, 775, 851}, { 489, 1334, 1073}, -{ -334, -332, 25}, { 543, 1206, 1807}, { 326, 61, 727}, -{ 578, 849, 1405}, { -208, -277, 329}, { -152, 64, 669}, -{ -434, -678, -727}, { -454, -71, 251}, { 605, 480, 254}, -{ -482, 11, 996}, { -289, 395, 486}, { 722, 1049, 1440}, -{ -30, -316, -786}, { -106, -115, -619}, { 861, 1474, 1412}, -{ 1055, 1366, 1184}, { 812, 1237, 925}, { 42, -251, -576}, -{ 342, 141, -454}, { -168, -80, 1359}, { -342, -656,-1763}, -{ 100, 821, 725}, { 990, 747, 800}, { 332, 440, 568}, -{ 663, 379, 852}, { 112, 165, -369}, { 597, 910, 282}, -{ -8, 834, 1281}, { -352, 572, 695}, { 462, 2246, 1806}, -{ 345, 190, 1374}, { 416, 915, 2166}, { 168, -82, 280}, -{ -516, -446, 840}, { 47, 533, 44}, { -362, -711,-1143}, -{ 22, 193, 1472}, { -85, 233, 1813}, { -62, 579, 1504}, -{ 550, 944, 1749}, { 723, 650, 1148}, { 972, 884, 1395}, -{ -425, 643, 0}, { 1000, 952, 1098}, { 249, 1446, 672}, -{ -334, -87, 2172}, { -554, 1882, 2672}, { 140, 1826, 1853}, -{ 920, 1749, 2590}, { 1076, 1933, 2038}, { -137, -443,-1555}, -{ 1269, 1174, 468}, { -493, -122, 1521}, { -451, 1033, 1214}, -{ 482, 1695, 1118}, { 815, 649, 384}, { -446, -692, 107}, -{ -319, -605, -118}, { -207, -505, 525}, { -468, -12, 2736}, -{ 75, 1934, 1305}, { 880, 2358, 2267}, { 1285, 1575, 2004}, -{ -48, -304,-1186}, { -435, -461, -251}, { -366, -404, -547}, -{ -289, -605, -597}, { -538, -810, -165}, { -120, 3, 356}, -{ 639, 1241, 1502}, { 96, 177, 750}, { -435, -585,-1174}, -{ -356, 109, -79}, { -485, 288, 2005}, { 9, 1116, 731}, -{ 880, 2134, 946}, { -265, 1585, 1065}, { 1157, 1210, 843}, -{ -498, -668, 431}, { 374, 321, -229}, { 1440, 2101, 1381}, -{ 449, 461, 1155}, { -105, 39, -384}, { -263, 367, 182}, -{ -371, -660, 773}, { -188, 1151, 971}, { 1333, 1632, 1435}, -{ 774, 1267, 1221}, { -482, -832,-1489}, { -237, -210, 860}, -{ 890, 1615, 1064}, { 472, 1062, 1192}, { 185, 1077, 989}, -{ -568, -992,-1704}, { -449, -902,-2043}, { -142, -377, -458}, -{ -210, -554,-1029}, { -11, 1133, 2265}, { -329, -675, -893}, -{ -250, 657, 1187}, { 519, 1510, 1779}, { 520, 539, 1403}, -{ 527, 1421, 1302}, { -563, -871,-1248}, { -147, -463, 879}, -{ -76, 2334, 2840}, { 563, 2573, 2385}, { 632, 1926, 2920}, -{ 719, 2023, 1840}, { -545, -723, 1108}, { 129, -125, 884}, -{ 1417, 1632, 925}, { -94, 1566, 1751}, { -341, 1533, 1551}, -{ 591, 395, -274}, { -76, 981, 2831}, { 153, 2985, 1844}, -{ 1032, 2565, 2749}, { 1508, 2832, 1879}, { 791, 1199, 538}, -{ -190, -453, 1489}, { -278, -548, 1158}, { -245, 1941, 2044}, -{ 1024, 1560, 1650}, { 512, 253, 466}, { -62, -323, 1151}, -{ -473, -376, 507}, { -433, 1380, 2162}, { 899, 1943, 1445}, -{ 134, 704, 440}, { 460, 525, -28}, { -450, 279, 1338}, -{ 0, 971, 252}, { -445, -627, -991}, { -348, -602,-1424}, -{ 398, 712, 1656}, { -107, 314, -178}, { 93, 2226, 2238}, -{ 518, 849, 656}, { -462, -711, -447}, { 174, -34, 1191}, -{ -119, 42, 1005}, { -372, 274, 758}, { 1036, 2352, 1838}, -{ 675, 1724, 1498}, { 430, 1286, 2133}, { -129, -439, 0}, -{ -373, 800, 2144}, { 6, 1587, 2478}, { 478, 596, 2128}, -{ -428, -736, 1505}, { 385, 178, 980}, { 139, 449, 1225}, -{ -526, -842, -982}, { 145, 1554, 1242}, { 623, 1448, 656}, -{ 349, 1016, 1482}, { 31, -280, 415}, { -316, 724, 1641}, -{ 360, 1058, 556}, { -436, -358, 1201}, { -355, 1123, 1939}, -{ 401, 1584, 2248}, { -527,-1012, 355}, { 233, 238, 2233}, -{ -550, -897, -639}, { -365, -501, 1957}, { 389, 1860, 1621}, -{ 162, 1132, 1264}, { -237, 1174, 1390}, { -640, -411, 116}, -{ -228, 1694, 2298}, { 1639, 2186, 2267}, { 562, 1273, 2658}, -{ 323, 338, 1774}, { 578, 1107, 852}, { 22, 594, 934}, -{ -143, 718, 446} -}; - - -static const int16_t lsf_3_2[512][3] = { -{ 50, 71, -9}, { -338, -698,-1407}, { 102, -138, -820}, -{ -310, -469,-1147}, { 414, 67, -267}, { 1060, 814, 1441}, -{ 1548, 1360, 1272}, { 1754, 1895, 1661}, { 2019, 2133, 1820}, -{ 1808, 2318, 1845}, { 644, -93, 454}, { 858, 329, -136}, -{ 489, -258, -128}, { -198, -745, -41}, { -52, -265, -985}, -{ 346, 137, 479}, {-1741, -748, -684}, {-1163,-1725, -367}, -{ -895,-1145, -784}, { -488, -946, -968}, { -85, -390, -725}, -{ 215, -340, -171}, { 1020, 916, 1969}, { 564, 179, 746}, -{ 662, 977, 1734}, { 887, 622, 914}, { 939, 856, 1165}, -{ 309, 688, 803}, { 917, 161, 570}, { 118, -20, -283}, -{ -816, -42, 204}, {-1228, -325, -462}, { -963, -202, -143}, -{ -988, -484, -361}, { -702, -978, -477}, { -302, -790,-1188}, -{ -100, -786,-1088}, {-1054, -947,-1684}, { -202, -843, -782}, -{-1039,-1378, -901}, { -624, -110, -85}, { 356, 213, -10}, -{ -493, 364, 774}, { 425, 822, 479}, { -83, 557, 520}, -{ -992,-1560, -572}, { -603, -741, -26}, { -502, -638, -903}, -{ 209, 306, 147}, { -316, -593, -596}, { -85, -211, -225}, -{ -918, -529, 117}, { 233, -439, -738}, { 1101, 751, 633}, -{ 1457, 1716, 1511}, { 1765, 1457, 910}, { 1122, 1156, 849}, -{ 1354, 868, 470}, { -871,-1150,-1796}, { -871, -861, -992}, -{ -118, 155, 212}, {-1051, -849, -606}, {-1117,-1849,-2750}, -{-1019,-1427,-1869}, { 370, -184, -414}, { 959, 493, 104}, -{ 958, 1039, 543}, { 154, 653, 201}, { 1249, 507, 150}, -{ 663, 503, 230}, { 623, 777, 675}, { 659, 88, -110}, -{ 843, 244, 224}, { 382, 541, 302}, { 724, 433, 666}, -{ 1166, 734, 341}, { -138, 20, -397}, {-1183, -424, -46}, -{ -321, -352, -124}, { 1333, 1021, 1080}, { 262, 366, 723}, -{ 922, 283, -551}, { 31, -636, -611}, { -689, -697, -415}, -{ -952, -779, -201}, {-1329, -598, -359}, { -953,-1285, 166}, -{ 493, 305, 221}, { 846, 703, 610}, { 840, 936, 774}, -{ -723,-1324,-1261}, { -357,-1025,-1388}, {-1096,-1376, -365}, -{-1416,-1881, -608}, {-1798,-1727, -674}, { -545,-1173, -703}, -{ 678, 786, 148}, { -123, 696, 1288}, { 644, 350, -10}, -{ 414, 614, 15}, { 137, 344, -211}, { -814,-1512, -819}, -{ -391, -930, -588}, { 47, -591, -898}, { -909,-1097, -163}, -{-1272,-1167, -157}, {-1464,-1525, -389}, {-1274,-1188, -624}, -{ 671, 213, 454}, { 124, -274, -525}, { -729, -496, -152}, -{-1344, 122, 135}, {-2905, -589, -394}, {-1728, 441, -50}, -{ 1476, 904, 787}, { 316, 236, -440}, { -347, 217, 413}, -{ -911, -917, 121}, { -455, -932, 202}, { -92, -465, -375}, -{ 488, 390, 474}, { 876, 729, 316}, {-1815,-1312, -669}, -{ 87, 962, 432}, { 563, -249,-1058}, { 250, 285, 1105}, -{ 1141, 427, 696}, {-1038,-1664,-1582}, { -948, 346, 160}, -{ -309, -272, -858}, { 670, 624, 1250}, { -944, -408, -666}, -{ -606, -320, -384}, { -492, 230, 65}, { 334, -50, -16}, -{ -16, -690,-1397}, { 1791, 1716, 1399}, { 2478, 2063, 1404}, -{ 1245, 1471, 1426}, { -382,-1037, -2}, { 173, -398, 1145}, -{ 1491, 2024, 1801}, { 772, 1274, 1506}, { 1429, 1735, 2001}, -{ 1079, 1218, 1273}, {-1154,-1851,-1329}, { -808,-1133,-1096}, -{ -451,-1033,-1722}, { 65, 578, -84}, {-1476,-2434,-1778}, -{ -765,-1366, -494}, { -218, -594, -931}, { 337, -236, 562}, -{ 2357, 2662, 1938}, { 1489, 1276, 874}, { 189, 358, 374}, -{-1519,-2281,-2346}, { -967,-1271,-2095}, { -628,-1188,-1542}, -{ 1661, 1043, 546}, { 565, 1061, 732}, { -64, -836, -434}, -{ -436, -96, 203}, { 1078, 1216, 1636}, { 907, 1534, 986}, -{ 326, 965, 845}, { 142, -84, 197}, { 470, 2379, 1570}, -{ 1133, 470, 1214}, { 395, 1376, 1200}, { 1125, 1042, 348}, -{ -543,-1234, -376}, { -215, -181, 481}, {-1947,-1621, -210}, -{ -750,-1185, 390}, { 29, -399, 27}, { 820, 1236, 755}, -{ 695, 979, 409}, { -174, 1197, 1035}, { 912, 1356, 1846}, -{ -992,-1437, 484}, {-1485,-1700, 208}, { -412, 1204, 1432}, -{ -271, 896, 1144}, { -416, 1777, 1434}, {-1696,-2644, -204}, -{-1789,-1551, 1033}, {-1656,-1559, 1303}, {-1253,-1589, 1081}, -{ -669,-1095, -66}, { -682, 320, -345}, { 659, 305, 1069}, -{-1292, -804, -19}, {-1635,-1291, 29}, {-1683, -497, 71}, -{ -287, -7, -100}, { -494, -962, -237}, { 852, 1881, 1740}, -{-1217,-1387, 227}, { -660, 302, 373}, { 96, 1087, 1257}, -{-1074,-1669, 160}, { 485, 2076, 1798}, { -934, -220, 552}, -{ -596, -612, 237}, { 336, 1720, 879}, { 643, 629, 434}, -{ 1267, 522, 1633}, { 15, 244, -441}, { 1475, 717, 184}, -{ 1819, 1590, 1709}, { 988, 261, 937}, { 2093, 2345, 1520}, -{ 2139, 1858, 1606}, { -577, -579,-1203}, { -956, 135, -488}, -{ -464, 51, -338}, { -629, -348, -723}, { 1146, 2073, 1442}, -{ 2192, 1466, 911}, {-1444,-1572,-2278}, { 1400, 710, 1297}, -{ 1335, 633, 928}, { 1434, 2194, 2594}, { 2422, 2204, 1881}, -{ 982, 2242, 1854}, { 380, 792, 1145}, { -63, -539, 414}, -{ -252, -964, -314}, {-1261, -683, -780}, { -831, -526,-1005}, -{-1666,-1135, -424}, {-1611, -452, -299}, { 1268, 1048, 642}, -{ 1147, 853, 856}, { -675, -336, 139}, { 2268, 1343, 1418}, -{ 29, 768, 797}, {-1224, 423, 564}, {-1318,-1082, 245}, -{-1302, -812, 573}, {-1298,-1617, 646}, { -968, 834, 723}, -{ 993, 1652, 2027}, { -191, -817, 432}, { 662, 60, 198}, -{ 626, 997, 1330}, { 1648, 1963, 1289}, {-1597, -93, -45}, -{-1088, 37, -84}, { 1653, 2607, 2337}, { 1065, 2040, 2377}, -{ 1139, 2326, 2118}, { 859, 357, 1510}, { 664, 1227, 1099}, -{ 479, 1360, 912}, { 1897, 1754, 2019}, { 1168, 1909, 1784}, -{ 399, 34, 256}, { -593, -304,-1053}, { 547, 1694, 1407}, -{ 647, -99, -341}, { 1492, 1647, 1190}, { 38, -644, -212}, -{ 395, 846, 222}, { -704, -765, -716}, { -724,-1964,-2804}, -{ -150, 291, -82}, { 1233, 1459, 1007}, { -140, -155, 153}, -{ 439, 297, 1568}, {-1529, -410, -636}, { 1536, 455, -237}, -{-1328, -139, -260}, { 531, 554, 868}, { 269, 1264, 606}, -{ -233, 883, 463}, { 742, 600, -120}, { -73, 421, 212}, -{ -439, -58, 804}, {-1286,-1241, 728}, { 294, -490, 50}, -{ -591, -905,-1254}, { 42, -687, 147}, { -25, 273, 596}, -{ -311, 1213, 601}, { -754, 849, 584}, { 429, 607, 587}, -{ -602, -166, 461}, { -796, -823, 777}, { 1380, 910, 1755}, -{ 119, 1417, 972}, { -219, -880,-1596}, {-1049,-1010, 438}, -{ -713,-1379, 78}, { 0, -447,-1179}, {-1136,-1319,-1573}, -{ 2248, 1767, 1309}, { 946, 1583, 1432}, { 1150, 482, 436}, -{ -469,-1108, 618}, { -447, -966, 1088}, {-1252,-1515, -114}, -{-1104,-2008, -579}, { 210, 613, 497}, {-1975,-1437, 642}, -{-1269, -856, 1011}, {-1646,-1185, 1063}, {-1555, -672, 1204}, -{-1692,-1114, 623}, { -979,-1326,-1277}, { 539, -147, 894}, -{-1354, -897, -434}, { 888, 475, 428}, { 153, -384, 338}, -{-1492, -511, 359}, { -974,-1115, -470}, { 105, -550, 677}, -{ -937,-1145, 877}, { 380, -260, 210}, { 1685, 924, 1256}, -{ 1775, 1190, 1095}, { 1419, 631, 533}, { 627, 299, -347}, -{ -411, -534, 647}, { -650, 29, -595}, { -378,-1367, 1563}, -{ 1402, 1121, 1465}, { 1089, 1410, 648}, {-2096,-1090, -6}, -{ 311, -194, -869}, { -639, -831, 416}, {-1162,-1224, 1349}, -{-1247, -941, 1813}, {-2193,-1987, 453}, { -619,-1367, -956}, -{-1606,-1972,-1507}, {-1175,-1057,-1104}, { -377, 601, 201}, -{ 1876, 825, 374}, { -430,-1323, 29}, {-1397,-1249,-1331}, -{-1007,-1504, 960}, {-1401,-2009, 197}, {-1379,-1949, -236}, -{-1077, 123, 422}, { 615, 1269, 546}, { -306, 1526, 904}, -{ 1194, 1788, 1177}, { -626, -884,-1526}, { 199, 766, 1504}, -{-1065, 862, 197}, {-1034,-1773, -887}, { -800, 145, 599}, -{-1134, -519, 626}, {-1205,-1926, 500}, { -910,-1041,-1395}, -{-1476,-1567, -969}, { -523, 842, 34}, { 1794, 646, 862}, -{-1207,-1888,-1002}, { -78, -9, -672}, { 1044, 759, 80}, -{ -600, 1139, 1019}, { 57, 2000, 1422}, { -833, 1414, 1121}, -{-1202, 1630, 1260}, { -461, 1420, 1244}, { 1537, 975, 253}, -{ -283, 324, -359}, { 599, -195, 106}, { 588, 62, -587}, -{ -757, 645, 205}, { 51, 1201, 758}, {-1209, 673, -390}, -{ -624, 1581, 941}, { -151, 1023, 735}, { 2820, 1301, 690}, -{ -302, 524, -99}, { -900,-1588,-1189}, { 1084, 251, 238}, -{ 2014, 1792, 1010}, { 1245, 1633, 1741}, {-1227,-1540,-1208}, -{ -621, 456, -109}, { 40, -65, 788}, { -805, -699,-1350}, -{ -583, 904, 832}, { -801, 532, 594}, { 1972, 1408, 1351}, -{-1177,-1880,-2114}, { -773, 568, 948}, {-1015, 1079, 1260}, -{-1111, 482, -130}, { 1778, 1044, 780}, {-1491, 245, 912}, -{ -316,-1141, -917}, { -536,-1442,-2346}, { -785,-1546,-1988}, -{-2003, 257, 909}, {-1849, -633,-1209}, {-1538,-1918,-1054}, -{ 1606, 2239, 1576}, { -567,-1500,-1544}, {-1279, 195, 1369}, -{ -817, 293, 1219}, { -525, 630, 1197}, {-1698,-2425,-1840}, -{ -303, 731, 747}, {-1169, -251, 269}, { -950, -75, 1684}, -{-1182, -453, 1005}, {-1599, 585, 378}, {-2075, -571, -427}, -{ -529,-1159,-1171}, { -283, -205, -564}, { -796, 1246, 717}, -{ 2277, 927, 539}, { -454, 559, 440}, { -717, 1460, 1615}, -{-1030, 1052, 1610}, {-1169, -138, 847}, { 226, 39, -612}, -{-1251, -106, -729}, { -651, 968, 1302}, { -714, -636, 1727}, -{ 353, 1069, 410}, { -798, -156, 1099}, { -574, 918, 446}, -{-1310, 1012, 466}, { 1408, 1591, 765}, { 1429, 1380, 1757}, -{ 1949, 1956, 2378}, { 1578, 2047, 2148}, { 916, 98, -7}, -{ 1893, 1418, 2141}, { 348, 1405, 1579}, { 152, 1134, 1801}, -{ -267, 154, 1395}, {-1166, 469, 1054}, {-1142, -405,-1073}, -{-1341,-2264,-1581}, { -364, 869, 1706}, {-1162, 549, 1550}, -{-1225,-1932,-1666}, {-1485,-1977,-2055}, {-1727, -906, -98}, -{-1897, 233, 1492}, { 892, 108, -331}, {-1728,-1170,-1700}, -{-1060, 1980, 1790}, {-1070,-1741,-1909}, { -11, 1539, 1317}, -{-1600, 94, 497}, { 421, 443, -197}, {-1578, -349, -994}, -{ -599, -539, 1140}, { -965,-1419, -129}, {-1341, 175, -447}, -{ -375, 1311, 2055}, { -371, -650, -307}, {-1073, 605, 365}, -{-2057, -113, 430}, { 652, 914, 967}, {-1012,-1586,-2323}, -{ 1505, 1248, 559}, { 262, -486, -401}, {-1727, 1342, 1546}, -{ 50, 56, 432}, { -330, 119, -604}, {-1517,-1080, -810}, -{ 946, 1127, 1055}, {-1400,-1703,-1712}, {-1270, -704,-1317}, -{ 807, 1821, 1143}, { 2760, 1606, 2171}, { 1120, 409, -150}, -{ -147, 404, 959}, { 2439, 1911, 2189}, { -906, -141, -866}, -{ -904, -142, -458}, { -557, -708,-1679}, { -830,-1431,-1583}, -{-1842,-1346,-1086}, {-1604, -272, 915}, {-1196, 772, 1056}, -{ -638,-1234,-1897}, { -500, -81, -822}, {-1289,-1613, -735}, -{ -117, 785, 168}, {-1090, 1133, 922}, {-1096, -746, 1384}, -{ 287, -547,-1063}, {-1376,-2201,-1204}, {-2176,-1570,-1757}, -{-1511,-2241, -771}, {-1737, 1099, 830}, {-1588, 724, 1243}, -{-1542, 693, 805}, {-1690, -240, 1665}, {-1700, -4, -668}, -{ 2149, 816, 1042}, { -818,-1841, 22}, { -764, -507, 449}, -{-1151, -617, 289}, { -843,-1596, -240}, { 498, -234, -657}, -{ -752, 480, 1678}, { -319, -481, 193}, { -811, 171, -119}, -{-2128, -202, -848}, { 1717, 1140, 1700} -}; - -static const int16_t lsf_3_3[512][4] = { -{ 67, -17, 66, -12}, {-1690, -581, -104, -272}, {-1076,-1186,-1845, -376}, -{-1140, -926, -420, -58}, { -259, -656,-1134, -553}, { 1788, 1227, 455, 129}, -{ 462, 441, -240, -528}, { 840, 514, 130, -75}, { 1114, 623, 153, 216}, -{ 1068, 564, -6, -276}, { 1119, 727, 190, -68}, { 704, 306, 119, -264}, -{ 329, 61, -100, 156}, { 364, 123, 183, -208}, { -171, -123, 220, -65}, -{ -306, -62, 402, 17}, { -660, -938, -266, 0}, { 385, 235, 276, 285}, -{ 320, 268, -336, -200}, { -724, 17, -84, 381}, { -544, 429, 494, 519}, -{ -117, 288, 304, 329}, { 643, 157, 701, 508}, { 1200, 625, 796, 608}, -{ 998, 421, 492, 632}, { 1204, 780, 446, 132}, { 1257, 844, 547, 449}, -{ 829, 658, 541, 470}, { 1132, 1258, 918, 639}, { 547, 51, 423, 279}, -{ 9, 392, 83, 94}, { 542, 543, 229, -147}, { -198, 129, 194, -185}, -{ -863,-1321, -302, 30}, { -597, -629, -19, 114}, { -900,-1081, 466, 353}, -{-1483,-1573, 15, -143}, {-1708,-2059, -751, 196}, {-1876,-2067, -642, -258}, -{-2335,-1470, -450, -564}, { -584, -186, -872, -414}, {-1805, -988,-1125,-1310}, -{ -726,-1129, 28, 169}, {-1039, -864, -718, -246}, { 484, 36, -233, -49}, -{ 265, 67, 289, 467}, { 178, 543, 810, 540}, { 84, 282, 672, 703}, -{ -975, -777, 129, 287}, { -938, -227, 955, 595}, {-1617, -289, 836, 649}, -{-1847, -215, 1106, 718}, {-2034,-1085, 650, 440}, {-2101, -529, 907, 575}, -{-2011, -336, 670, 204}, {-2389, -692, 360, 137}, {-2156,-2204, -9, 280}, -{ -266, 119, 39, 193}, { 78, -59, -120, 226}, { -975, -858, -781,-1095}, -{ -619, -413, -451, -842}, {-1216,-1321, -813, -883}, {-1376,-1615, -394, -428}, -{ -737,-1113, -549, -790}, { -880, -975, -967, -642}, { -985, -886,-1273,-1361}, -{ -473, -804,-1401,-1407}, { 160, -265, -919, -275}, { -248, -250, -718, -380}, -{ 97, -103, -375, -229}, { -415, -193, -135, -555}, { 628, 361, 119, 216}, -{ 579, 364, 391, 209}, { 634, 522, -154, -148}, { 526, 389, 170, 33}, -{ 105, 267, 64, 380}, {-1503,-1000, -30, -369}, {-1070, 58, 647, 223}, -{-1520, -291, 621, 307}, {-1531, 156, 762, 404}, {-2029, 141, 734, 499}, -{-1849, -650, 306, 512}, { -187, -104, -59, 438}, { 134, -230, 156, -186}, -{ -61, -260, -16, 10}, { -569, -3, -421, -297}, {-1725, -521, -346, 178}, -{-1362, -59, -44, 157}, {-2146, -461, -470, -349}, {-2170, -1, -369, -121}, -{-1579, -373, -900,-1015}, {-1117, -591, -613, -784}, { -561, 122, -75, -449}, -{ -4, -171, -123, -372}, { 192, 168, -76, -132}, { 252, -107, 340, 210}, -{ 392, 509, 272, 181}, { -109, 145, 218, 119}, { -416, -263, 485, 265}, -{ -181, -8, -286, 226}, { -244, -218, 69, -290}, { -158, 191, -1, -64}, -{ -592, -90, 213, -96}, { 255, 435, 178, -80}, { -369, -18, -33, -80}, -{ -42, 415, 140, -222}, { 1143, 651, 649, 329}, { 767, 556, 249, 235}, -{ 948, 413, 442, 279}, { 141, 339, 356, 557}, { -470, -170, 99, 237}, -{ -569, -800, 352, 565}, { 282, 473, 470, 332}, { -199, -690,-1284, -917}, -{ -193, -426, -800,-1122}, { -26, -371, -490, -193}, { 637, 595, 519, 330}, -{ 408, -115, 79, 12}, { 477, 87, -103, -376}, { -666, -347, -277, -291}, -{ -510, -481, 169, 297}, { -829, -738, -205, -171}, { -320, -540, 328, 283}, -{ -859, -958, 442, -2}, { 556, 686, 130, 56}, { 1383, 1012, 755, 427}, -{ 612, 741, 628, 553}, { -339, -796, 134, 277}, { -633,-1085, -2, -246}, -{ -880,-1035,-1607,-1064}, { -994, -474,-1138, -488}, { -414, -795, 73, -206}, -{ -8, -139, 439, 204}, { -176, -578, 23, 131}, { -269, -757, -191, 245}, -{ -109, -338, 112, 316}, { 120, -406, -118, 611}, { -180, -186, -645, 115}, -{ -173, 34, -518, -489}, { -151, 61, -583, -844}, { 220, -138, -681,-1020}, -{ 391, -17, -598, -321}, { 157, -295, 129, 155}, { -926, -875, -987, 285}, -{ 241, -83, -125, -125}, { 620, 597, 432, 92}, { 393, 78, 409, 61}, -{ -393, -739, -413, -748}, { 83, 54, 361, 27}, {-1084, 130, -337, -694}, -{-1565, 297, 318, -19}, {-1873, 36, 51, -317}, {-2323, -246, 231, -84}, -{-2306, -783, 40, -179}, {-2233, -930, -474, -462}, { -754, -86, -288, -626}, -{-2411, -455, -63, 171}, {-1099,-1094, -26, -143}, {-1193, -455, -406, -381}, -{ -605, -210, -96, -51}, { -580, -476, -276, -15}, {-1195, -634,-1203, -881}, -{ -378, -221, -669, -952}, { 594, 178, -403, -676}, { 763, 327, 601, 290}, -{ 172, 300, 203, 157}, { -56, -336, 356, 24}, { -228, -296, -259, -29}, -{ -186, 263, 416, 14}, { -353, 373, -12, -216}, { 257, 96, 174, 57}, -{-1526, -616, -954, -499}, { -497, -152, -333, 125}, { 105, 200, 179, -97}, -{ -331, -224, 765, 697}, { 760, 256, 301, 59}, { 455, -85, 204, 288}, -{ -514, 240, 251, -109}, { 256, 417, -34, -413}, { 101, 430, 384, 156}, -{ -31, -10, 206, 426}, { 589, 145, 143, 71}, { 808, 906, 333, 349}, -{ 986, 938, 589, 331}, { 1300, 824, 187, 509}, { 1062, 653, 379, 466}, -{ 1462, 937, 401, 274}, { 787, 861, 265, 2}, { 609, 553, 28, 305}, -{ 926, 340, 106, 386}, { 241, -267, -147, 225}, { -178, -534, 347, 502}, -{ -643, -381, 397, 30}, { -651, -733, -435, 398}, { -407, -726, -484, -248}, -{ -789, -914, -438, -476}, { -498, -390, 75, -295}, { -964, -590, -606, 150}, -{ -121, -49, -155, -78}, { 935, 550, 389, 38}, { -321, 127, 424, 315}, -{ -285, -113, 283, 259}, { 658, 203, 322, 486}, { 903, 505, 748, 417}, -{ 611, 423, 555, 512}, { 239, -83, -578, -19}, { -339, -731, 349, 13}, -{ -934,-1399, -114, -360}, { 107, 692, 182, 90}, {-1243,-1538,-1551, -725}, -{ -568, -903,-1363, -525}, { -517, -853, -861,-1004}, { -168, -690, -835, 63}, -{ -137, -556, -547, 144}, { -286, -817, 485, 319}, { -147, -408, 526, 246}, -{ -347, -434, 297, -28}, { -290, -471,-1110,-1285}, { -460, -359, -988, -794}, -{ 1347, 1299, 690, 523}, { 1216, 1068, 1094, 757}, { 825, 1140, 752, 494}, -{ 1252, 1365, 1195, 898}, { 521, 1053, 532, 432}, { -334, -216, -313, -263}, -{ -160, 52, -472, -155}, { 127, 136, -380, 44}, { 851, 410, -162, -489}, -{ 123, -255, -796, -667}, { 1090, 917, 789, 493}, { 1397, 1197, 558, 202}, -{ -51, -118, -342, -701}, { 83, 108, -42, -441}, { 61, 95, 287, 256}, -{ -27, 89, 524, 531}, { 351, 227, 592, 545}, { 697, 155, -164, 307}, -{ 638, 274, -489, -50}, { 754, 240, -166, -124}, { -116, -579,-1212, -63}, -{ 190, -295,-1040,-1296}, { 147, -376, -177, -113}, { 841, 1241, 1051, 668}, -{ 2, 293, 551, 304}, {-1096, -953, -248, 376}, { -750, -965, 87, 516}, -{ -275, -516, 689, 391}, { -379, -643, 876, 594}, { -390,-1013, -645, 573}, -{ -107, -568, -689, -826}, {-1025, -27, -328, -203}, { 861, 749, 548, 233}, -{-1660,-1043, 451, 108}, { -660, -620, 430, 236}, { 21, -396,-1158, -631}, -{ 1372, 1298, 967, 577}, { 1125, 1125, 589, 454}, { -323, -865, -467, 153}, -{ -468, -699, -804, -509}, { -392, -718, -204, -35}, { -603,-1093, -567, -162}, -{ -505,-1004, -102, 350}, { 219, 224, 423, 252}, { 395, 591, 608, 363}, -{ -746, -96, 373, 172}, { 171, 295, 714, 339}, { 233, 77, 107, 277}, -{ 157, 153, -499, -356}, { 1547, 1073, 576, 494}, { -292, -339, -504, -592}, -{ -903, -72, -619, -481}, {-1594,-1117, -567, -254}, { -793, -507, -564, -291}, -{ -492, -532, 502, 560}, { -382, 427, 600, 230}, { -227, 477, 251, 75}, -{ 285, 842, 813, 476}, {-1310,-1333, 186, 377}, { -587, -917, 643, 381}, -{-1186, -553, 411, 82}, {-1127, -820, -174, -540}, { -604, 119, 543, 205}, -{ -380, 657, 909, 567}, { 112, -298, -374, 114}, { -857, -251, 56, 159}, -{ 401, 345, -34, -140}, { -111, -607, 41, 614}, { 355, -114, -77, 474}, -{ 578, 56, 1450, 924}, { 1098, 1420, 741, 400}, { 246, 22, 588, 313}, -{ -121, 327, 831, 472}, {-1138, -608, 856, 552}, {-1241,-1072, 638, 600}, -{ -358, 254, -333, -303}, { -646, 739, 358, 74}, { 1226, 1671, 1221, 849}, -{ 2241, 1624, 983, 636}, { 1841, 1477, 749, 384}, { 350, 263, 87, 128}, -{-1902, -941, -144, -64}, {-1734, -255, 288, -31}, {-2644,-1238, 366, 235}, -{-1643,-1092,-1344, -304}, { -541,-1075,-1116, 123}, {-1178, -252, -816, -180}, -{-1016, 533, 565, 233}, { -487, -430, -188, 334}, { 867, 1236, 534, 171}, -{-1590,-1607, 635, 630}, {-2196, 310, 924, 412}, {-2358, -328, 956, 529}, -{-2639, -377, 630, 278}, {-2602, 317, 799, 299}, {-2406, 133, 340, 31}, -{-2156,-1468, 131, 125}, {-1184, -490, -139, 46}, { -744, 447, 891, 564}, -{ 67, -451, 646, 604}, { -553, -429, -876, 396}, { 162, -66, 1305, 915}, -{ 479, 579, 1088, 794}, { 450, 278, 566, 324}, {-1057, -154, 148, -177}, -{-2545, 168, 1070, 592}, {-2351, -42, 819, 345}, {-2344, -707, 721, 250}, -{-2175,-1497, -309, 122}, { -78, -73, 120, 173}, { -4, 262, -263, -261}, -{ -431, -64, -405, -732}, {-2609, 116, -83, -193}, {-1525, -944, -477, -725}, -{ -508, 307, 170, 172}, { 832, 417, 832, 686}, { -225, 177, 894, 818}, -{ -482, -389, 1279, 1039}, { -383, 201, -350, 40}, { 730, 635, 226, 526}, -{ 503, 462, 338, 398}, { 535, 714, 40, -282}, { 1482, 1471, 1085, 731}, -{ 1561, 1072, 909, 693}, { 1419, 1282, 889, 879}, { 1153, 728, 1186, 840}, -{ -226, 1130, 949, 689}, { -494, -986,-1556, -128}, { -568, -721, -713, -26}, -{ 317, 524, 70, 135}, { -405, -865,-1766, -652}, { -174, -801, 885, 773}, -{ -153, -91, 1099, 751}, { -506,-1149, 853, 646}, { 241, 782, 519, 539}, -{ 1853, 1700, 1101, 684}, {-1249,-1486, -464, 188}, { -893,-1409,-1312, -341}, -{ -135, 438, -175, 18}, { 1111, 976, 319, 208}, {-1430,-1768, 83, 458}, -{ -530,-1000, 307, 129}, { -840, -15, -29, -356}, { -911, -924,-1147, -242}, -{ -119, -528, 127, -133}, { -761, -765, 190, -83}, { -315, 895, 522, 231}, -{ -222, 102, -63, -428}, { 316, 699, 379, 70}, { 25, 716, 314, -108}, -{ 507, 874, 566, 238}, { 108, 941, 519, 195}, { 425, -60, -427, 257}, -{ 139, -103, -630, 446}, { 334, 370, 412, 48}, { -172, -690, -283, 557}, -{ 187, -286, 158, 483}, { 140, 270, -344, -631}, { 924, 579, -116, 132}, -{ 142, 466, -68, -64}, { 230, -145, -302, -542}, { -803, -912, 1018, 737}, -{ -773, 1015, 630, 297}, {-2596, 95, 445, 336}, {-2122, 491, 510, 191}, -{-1253, 161, -2, -324}, {-1450, -633, -712, -105}, { -842, -254, -411, 100}, -{ -640, -290, 1010, 763}, { -650, 313, 1169, 730}, { 140, 505, 1030, 766}, -{ 772, 287, 1067, 823}, { 495, 749, 305, 323}, { -164, 462, 78, 399}, -{ -342, -874, 69, 597}, { -16, 620, 621, 337}, { -138, -444, -265, 218}, -{ 84, -450, 953, 666}, { -222, -803, 541, 604}, { -921,-1376, 244, 116}, -{ -841, -723, 630, 588}, { 140, 663, 294, 368}, { 935, 1046, 881, 759}, -{ 1746, 1464, 916, 628}, { 436, 963, 281, 1}, { -119, 74, 542, 213}, -{ 1, -567, 301, 241}, { 260, 435, 222, 396}, { 936, 957, 1108, 703}, -{ 510, 506, 808, 478}, { 601, 694, 960, 620}, { 972, 741, 980, 600}, -{ 834, 717, 767, 684}, { 643, 972, 935, 638}, { 501, 661, 720, 851}, -{ -105, -632, -303, -117}, { -429, 130, 789, 442}, { -522, -188, 704, 373}, -{ -759, 42, 814, 523}, { -531,-1137, 373, 578}, { -682,-1203, -455, 285}, -{-1163,-1577,-1098, 44}, { 81, -82, 712, 363}, { 477, 246, 954, 622}, -{ 1604, 1622, 1277, 891}, { 1409, 859, 924, 892}, { 774, 1041, 947, 1142}, -{ 40, -546, -75, 288}, { -616, -106, -697, -26}, { -169, -160, -891, -739}, -{ -279, -384,-1029, -350}, { 1781, 1308, 1046, 816}, { 1580, 1533, 1472, 1178}, -{ 1505, 1076, 1216, 899}, { 890, 904, 564, 654}, { 920, 692, 1021, 856}, -{ -493, 132, 177, 505}, { 71, 195, -28, 97}, { 456, 351, -164, 88}, -{ 439, 278, -40, 350}, { 1395, 949, 234, -95}, { -805, -472, 38, -163}, -{ 367, -98, 489, 523}, { 1025, 1178, 1212, 906}, { 319, 1314, 814, 461}, -{ -123, -543, -804, 447}, { -748, -324, -897,-1127}, { -737, -501, -789, -713}, -{ 715, 777, 1239, 922}, { 1949, 1939, 1368, 865}, { 730, 880, 758, 388}, -{ -871, 454, 17, -251}, { -381, -810,-1583, 239}, { -521, -966, -792, 259}, -{ -890,-1358, -770, -73}, { 166, 349, -212, 323}, { -840, -301, 473, 435}, -{ -679, -464, 728, 351}, { -156, -199, 667, 432}, { 29, -252, 415, 480}, -{ -731, -379, 145, 559}, { -528, -631,-1158, -159}, { 445, 273, 123, 639}, -{ 373, -126, 800, 568}, { 84, -162, 720, 712}, { -830, -536, -185, 222}, -{ 408, 452, 501, 771}, { -897,-1355, -67, 442}, { -792,-1406, 566, 602}, -{ 167, -326, 509, 330}, { -95, -626, -730, -344}, { 1668, 1217, 779, 455}, -{ 1316, 828, 584, 719}, { 404, -31, 1013, 789}, { 89, 107, 891, 549}, -{ 871, 1581, 917, 671}, { 866, 1479, 1289, 854}, { 391, 1068, 1122, 812}, -{ 78, -562, 345, 563}, { 429, -103, 417, 787}, { -122, -437, 411, 788}, -{ -913, -417, 602, 754}, { -226, -16, 151, 760}, { -700, 118, -104, -14}, -{-1128, 48, 284, 393}, { -390, -419, -639, -116}, { -910, 306, 316, -13}, -{ 1207, 984, 821, 669}, {-1195, -693, 140, -213}, { -884, -416, -199, -558}, -{ -616, 245, -404, -664}, { 262, 56, -617, -724}, { -85, -491, -320, -656}, -{ -570, -831, -129, -528}, {-1506, -63, -367, -385}, { -358, -321, 4, 51}, -{ -366, -214, 319, 511}, { 146, 671, -17, -291}, { -110, 464, -139, -496}, -{ -202, 220, -312, -631}, { -660, -73, -655, -820}, { -662, -653,-1288, -857}, -{ -430, -953, -959, -264}, { -49, -468, -72, -381}, { -350, -563, -193, -407}, -{ 55, -408, -803, 11}, { -309, 649, 188, -198}, { -512, 461, -79, -458}, -{-1318, -263, -134, -523}, {-1657, -435, -495, -765}, { 57, -347, -414, 434}, -{-1141, -242, -664, -857}, { 34, -68, -707, -338} -}; - -static const int16_t lsf_5_1[128][4] = { -{ -451,-1065, -529,-1305}, { -450, -756, -497, -863}, { -384, -619, -413, -669}, -{ -317, -538, -331, -556}, { -414, -508, -424, -378}, { -274, -324, -434, -614}, -{ -226, -500, -232, -514}, { -263, -377, -298, -410}, { -151, -710, -174, -818}, -{ -149, -412, -156, -429}, { -288, -462, -186, -203}, { -170, -302, -191, -321}, -{ -131, -147, -297, -395}, { -228, -214, -245, -192}, { -67, -316, -71, -327}, -{ -104, -205, -94, -183}, { -143, -38, -193, -95}, { 16, -76, -124, -248}, -{ 23, -237, 24, -244}, { 18, -136, 44, -111}, { -33, -24, -25, 0}, -{ 149, 19, 23, -143}, { 158, -169, 174, -181}, { 133, -55, 165, -26}, -{ 111, 84, 98, 75}, { 87, 183, -115, -11}, { -8, 130, 11, 170}, -{ 254, 77, 205, 17}, { 183, 112, 262, 194}, { 202, 287, 95, 189}, -{ -42, -105, 234, 179}, { 39, 186, 163, 345}, { 332, 199, 299, 161}, -{ -54, 285, -78, 281}, { -133, 141, -182, 111}, { 249, 341, 271, 364}, -{ 93, 403, 75, 391}, { 92, 510, -138, 220}, { -185, -29, -34, 361}, -{ -115, 320, 3, 554}, { 99, 286, 218, 591}, { -245, 406, -268, 453}, -{ 0, 580, 25, 606}, { 275, 532, 148, 450}, { -73, 739, -285, 518}, -{ -288, 94, -203, 674}, { -140, -74, 205, 714}, { -114, 299, 176, 923}, -{ 182, 557, 240, 705}, { -16, 513, 485, 593}, { 293, 384, 451, 617}, -{ -38, 50, 563, 529}, { 303, 209, 459, 363}, { 433, 452, 450, 454}, -{ 367, 606, 477, 741}, { 432, 353, 368, 267}, { 361, 716, 273, 583}, -{ 453, 166, 510, 172}, { 201, 629, 274, 191}, { 568, 639, 302, 298}, -{ 634, 387, 643, 350}, { 587, 560, 612, 565}, { 600, 788, 487, 672}, -{ 512, 1015, 321, 333}, { 357, 854, -125, 413}, { 474, 712, 17, -151}, -{ 564, 285, 270, -241}, { 971, 889, 489, 220}, { 510, 896, 549, 924}, -{ 327, 825, 290, 911}, { 540, 1108, 158, 805}, { 199, 957, 511, 730}, -{ 100, 874, 13, 791}, { 435, 632, 676, 972}, { 249, 900, 467, 1218}, -{ 781, 1074, 585, 785}, { -23, 669, 267, 1043}, { 619, 1084, 615, 1145}, -{ 622, 905, 916, 1049}, { 80, 331, 584, 1075}, { 89, 639, 988, 961}, -{ 770, 720, 798, 699}, { 492, 447, 899, 627}, { 271, 1188, 725, 1333}, -{ 87, 603, 832, 1603}, { 616, 1127, 890, 1505}, { 1000, 1156, 866, 1009}, -{ 995, 827, 1149, 858}, { 817, 1450, 773, 1320}, { 500, 1389, 312, 1153}, -{ -20, 1084, 64, 1283}, { 2, 1172, 399, 1869}, { 514, 1706, 502, 1636}, -{ 886, 1522, 416, 600}, { 1131, 1350, 1275, 1390}, { 889, 1795, 914, 1766}, -{ 227, 1183, 1250, 1826}, { 505, 1854, 919, 2353}, { -199, 431, 152, 1735}, -{ -213, -28, 392, 1334}, { -153, -52, 978, 1151}, { -323, -400, 813, 1703}, -{ -136, 84, 1449, 2015}, { -331, -143, -137, 1192}, { -256, 534, -157, 1031}, -{ -307, -439, 542, 731}, { -329, -420, -97, 616}, { -362, -168, -322, 366}, -{ -247, -110, -211, 89}, { -196, -309, 20, 59}, { -364, -463, -286, 89}, -{ -336, 175, -432, 141}, { -379, -190, -434, -196}, { -79, 150, -278, -227}, -{ -280, 166, -555, -422}, { -155, 541, -366, 54}, { -29, -83, -301, -774}, -{ 186, 628, -397, -264}, { 242, 293, -197, -585}, { 124, 410, 53, -133}, -{ 10, 340, -570,-1065}, { 65, -446, 68, -493}, { 383, 937, -357, -711}, -{ -359, -250, -677,-1068}, { 292, -26, 363, 6}, { 607, 1313, -127, -10}, -{ 1513, 1886, 713, 972}, { 1469, 2181, 1443, 2016} -}; - -static const int16_t lsf_5_2[256][4] = { -{-1631,-1600,-1796,-2290}, {-1027,-1770,-1100,-2025}, {-1277,-1388,-1367,-1534}, -{ -947,-1461, -972,-1524}, { -999,-1222,-1020,-1172}, { -815, -987, -992,-1371}, -{-1216,-1006,-1289,-1094}, { -744,-1268, -755,-1293}, { -862, -923, -905, -984}, -{ -678,-1051, -685,-1050}, {-1087, -985,-1062, -679}, { -989, -641,-1127, -976}, -{ -762, -654, -890, -806}, { -833,-1091, -706, -629}, { -621, -806, -640, -812}, -{ -775, -634, -779, -543}, { -996, -565,-1075, -580}, { -546, -611, -572, -619}, -{ -760, -290, -879, -526}, { -823, -462, -795, -253}, { -553, -415, -589, -439}, -{ -533, -340, -692, -935}, { -505, -772, -702,-1131}, { -263, -306, -971, -483}, -{ -445, -74, -555, -548}, { -614, -129, -693, -234}, { -396, -246, -475, -250}, -{ -265, -404, -376, -514}, { -417, -510, -300, -313}, { -334, -664, -463, -814}, -{ -386, -704, -337, -615}, { -234, -201, -233, -239}, { -167, -567, -203, -619}, -{ -147, -415, -115, -352}, { -166, -750, -171, -761}, { -270, -879, -264, -903}, -{ -367, -744, 43, -475}, { 14, -653, 43, -670}, { 11, -448, -59, -521}, -{ -126, -119, -155, -613}, { -42, -863, -27, -931}, { 136, -483, 183, -468}, -{ 55, -298, 55, -304}, { 313, -609, 313, -720}, { 322, -167, 100, -541}, -{ -3, -119, -111, -187}, { 233, -236, 260, -234}, { 26, -165, 134, -45}, -{ -40, -549, 360, -203}, { 378, -388, 450, -383}, { 275, 20, 182, -103}, -{ 246, -111, 431, 37}, { 462, -146, 487, -157}, { -284, -59, 503, -184}, -{ 24, 53, -3, 54}, { 122, 259, 333, 66}, { 484, 104, 436, 68}, -{ 195, 116, 190, 206}, { 269, -9, 482, 352}, { 382, 285, 399, 277}, -{ 452, 256, 69, 186}, { 13, 297, -13, 259}, { -95, 30, 56, 394}, -{ 196, 425, 205, 456}, { 281, 577, 15, 191}, { 375, 290, 407, 576}, -{ -56, 227, 544, 405}, { 0, 549, -92, 528}, { -229, 351, -245, 338}, -{ -362, 435, 167, 527}, { -75, 302, 91, 824}, { 129, 599, 496, 679}, -{ 186, 749, 153, 737}, { -281, 600, -348, 615}, { -236, 769, 41, 881}, -{ 38, 890, -220, 841}, { -357, 883, -393, 903}, { -634, 474, -444, 850}, -{ -175, 678, -493, 242}, { -519, 785, -714, 582}, { -541, 366, -543, 434}, -{ -597, 500, -765, 222}, { -702, 917, -743, 962}, { -869, 501, -899, 548}, -{ -379, 200, -435, 157}, { -819, 214, -861, 157}, { -614, 40, -632, 94}, -{ -883, -54, -741, 516}, { -501, 298, -614, -171}, { -870, -161, -865, -23}, -{ -818, 93,-1015, -267}, { -662, -359, -549, 2}, { -442, -121, -377, 0}, -{ -227, 33, -414, -126}, { -129, 212, -934, 34}, {-1082, -282,-1119, -268}, -{ -710, -825, -420, -191}, {-1076, -928, -917, -93}, { -628, -358, 97, 7}, -{ -206, -393, -101, 24}, { -203, 38, -168, 83}, { -599, -423, -279, 426}, -{ -700, 118, -75, 206}, { -981, -673, -680, 417}, { -367, 37, -279, 474}, -{ -129, -318, 319, 296}, { -626, -39, 343, 602}, { -696, -39, -303, 940}, -{ 104, 233, -380, 137}, { -36, 269, -75, -214}, { 120, 43, -529, -477}, -{ 459, 164, -202, -229}, { -49, -167, 609, 792}, { 98, -220, 915, 148}, -{ 293, 283, 869, 91}, { 575, 394, 326, -78}, { 717, 67, 365, -323}, -{ 616, -36, 731, 27}, { 619, 238, 632, 273}, { 448, 99, 801, 476}, -{ 869, 273, 685, 64}, { 789, 72, 1021, 217}, { 793, 459, 734, 360}, -{ 646, 480, 360, 322}, { 429, 464, 638, 430}, { 756, 363, 1000, 404}, -{ 683, 528, 602, 615}, { 655, 413, 946, 687}, { 937, 602, 904, 604}, -{ 555, 737, 786, 662}, { 467, 654, 362, 589}, { 929, 710, 498, 478}, -{ 415, 420, 693, 883}, { 813, 683, 781, 925}, { 913, 939, 726, 732}, -{ 491, 853, 531, 948}, { 734, 963, 315, 808}, { 761, 755, 1144, 760}, -{ 655, 1076, 826, 1057}, { 1091, 838, 1003, 808}, { 1047, 1133, 659, 1101}, -{ 992, 1050, 1074, 1075}, { 971, 694, 1226, 1054}, { 571, 841, 884, 1404}, -{ 1379, 1096, 1080, 861}, { 1231, 735, 1284, 760}, { 1272, 991, 1367, 1053}, -{ 1257, 700, 1050, 534}, { 988, 453, 1264, 599}, { 1140, 679, 1621, 815}, -{ 1384, 521, 1317, 393}, { 1564, 805, 1448, 686}, { 1068, 648, 875, 307}, -{ 1083, 361, 1047, 317}, { 1417, 964, 675, 571}, { 1152, 79, 1114, -47}, -{ 1530, 311, 1721, 314}, { 1166, 689, 514, -94}, { 349, 282, 1412, 328}, -{ 1025, 487, -65, 57}, { 805, 970, 36, 62}, { 769, -263, 791, -346}, -{ 637, 699, -137, 620}, { 534, 541, -735, 194}, { 711, 300, -268, -863}, -{ 926, 769, -708, -428}, { 506, 174, -892, -630}, { 435, 547,-1435, -258}, -{ 621, 471,-1018,-1368}, { -393, 521, -920, -686}, { -25, 20, -982,-1156}, -{ 340, 9,-1558,-1135}, { -352, 48,-1579, -402}, { -887, 6,-1156, -888}, -{ -548, -352,-1643,-1168}, { -159, 610,-2024, -963}, { -225, 193,-1656,-1960}, -{ -245, -493, -964,-1680}, { -936, -635,-1299,-1744}, {-1388, -604,-1540, -835}, -{-1397, -135,-1588, -290}, {-1670, -712,-2011,-1632}, {-1663, -27,-2258, -811}, -{-1157, 184,-1265, 189}, {-1367, 586,-2011, 201}, { -790, 712,-1210, 3}, -{-1033, 808,-1251, 830}, { -111, 635,-1636, 447}, { -463, -949, -445, -928}, -{ -504,-1162, -501,-1211}, { 144, -351, -372,-1052}, { -283,-1059, -279,-1123}, -{ -575,-1438, -587,-1614}, { -935, -984, 229, 690}, { -921, -719, -403, 1362}, -{ -685, -465, 874, 397}, { -509, -46, 317, 1334}, { -485, 456, 813, 439}, -{ -411, 339, 898, 1067}, { -425, 46, 1441, 497}, { -909, -800, 1465, 1046}, -{ -254, -321, 1430, 1165}, { 68, 350, 1034, 666}, { 370, 11, 1311, 790}, -{ 143, 232, 1041, 1562}, { -114, 663, 1616, 1078}, { 454, 579, 1275, 1040}, -{ -76, 909, 752, 1067}, { 153, 512, 348, 1214}, { 614, 385, 1843, 808}, -{ 269, 1034, 203, 1086}, { 652, 1017, 1783, 1130}, { 429, 1327, 387, 1384}, -{ -49, 1183, -72, 1215}, { -416, 1001, 544, 1749}, { -352, 1223, -502, 1199}, -{ -589, 569, -227, 1630}, { -142, 1578, -230, 1715}, { -714, 1288, -838, 1398}, -{ 1131, 1357, -208, 1232}, { 437, 965, -929, 818}, { 811, 1410, 859, 1507}, -{ 164, 1212, 1387, 1793}, { 484, 1874, 456, 2063}, { 996, 1170, 1326, 1402}, -{ 1316, 1360, 1135, 1262}, { 1234, 1618, 1361, 1768}, { 1421, 1227, 1584, 1347}, -{ 854, 672, 1685, 1566}, { 1139, 1270, 2016, 1825}, { 1773, 1581, 1532, 1460}, -{ 1487, 946, 1659, 1021}, { 1744, 1212, 1392, 977}, { 1772, 1161, 1826, 1164}, -{ 1718, 1429, 1973, 1591}, { 1185, 864, 2132, 1061}, { 1799, 814, 1838, 757}, -{ 2104, 1315, 2054, 1258}, { 2113, 915, 2331, 930}, { 1467, 1147, 2590, 1439}, -{ 2245, 1744, 2090, 1620}, { 2358, 1454, 2666, 1506}, { 1876, 1837, 2070, 1975}, -{ 1739, 1577, 682, 1289}, { 1584, 2045, 1454, 2098}, { 2498, 2004, 2711, 2066}, -{ 726, 1588, 2756, 2336}, { 228, 847, 2456, 1659}, { 36, 301, 1942, 1957}, -{ -446, -96, 2154, 1396}, { 1533, 1101, 14, 608}, { -923, -732, 1383, 1982}, -{ 1345, 952, -680, 321}, { 1281, 1268,-1594, 365}, { 941, 946,-1737, -822}, -{ 2374, 2787, 1821, 2788} -}; - -static const int16_t lsf_5_3[256][4] = { -{-1812,-2275,-1879,-2537}, {-1640,-1848,-1695,-2004}, {-1220,-1912,-1221,-2106}, -{-1559,-1588,-1573,-1556}, {-1195,-1615,-1224,-1727}, {-1359,-1151,-1616,-1948}, -{-1274,-1391,-1305,-1403}, {-1607,-1179,-1676,-1311}, {-1443,-1478,-1367, -898}, -{-1256,-1059,-1331,-1134}, { -982,-1133,-1149,-1504}, {-1080,-1308,-1020,-1183}, -{ -980,-1486, -967,-1495}, { -988, -922,-1047,-1077}, { -838,-1179, -858,-1222}, -{-1131,-1041,-1064, -767}, { -872,-1157, -701, -880}, { -706, -906, -774,-1016}, -{ -578,-1080, -801,-1478}, { -591,-1111, -592,-1146}, { -713,-1388, -640,-1376}, -{ -597,-1059, -416, -903}, { -686, -832, -661, -708}, { -444, -868, -490, -921}, -{ -374, -776, -619,-1170}, { -585, -549, -769, -795}, { -435, -659, -530, -741}, -{ -498, -837, -357, -597}, { -279, -871, -243, -887}, { -282, -665, -280, -667}, -{ -165, -560, -394, -903}, { -362, -410, -448, -583}, { -409, -574, -313, -357}, -{ -637, -548, -570, -436}, { -896, -504, -382, -757}, { -58, -481, -165, -618}, -{ -191, -374, -234, -382}, { -222, -683, -25, -480}, { -418, -359, -730, -353}, -{ -324, -157, -432, -322}, { -394, -303, -284, -104}, { -601, -289, -556, -196}, -{ -588, -150, -659, -608}, { -473, -24, -68, -448}, { -474, -8, -506, -45}, -{ -748, -184, -844, -252}, { -901, -91, -584, -97}, { -652, 138, -764, -131}, -{ -678, -12, -670, 165}, { -259, -3, -840, -107}, { -909, 37, -992, 44}, -{ -854, -415, -839, 13}, {-1001, -271,-1026, -309}, { -798, -478, -832, -488}, -{ -943, 168,-1112, -387}, {-1185, -101,-1183, -40}, { -941, -316,-1030, -770}, -{-1044, -625,-1081, -538}, {-1224, -299,-1312, -436}, {-1197, -663,-1167, -161}, -{-1216, -690,-1237, -831}, {-1432, -720,-1403, -493}, { -898, -740, -922, -801}, -{-1102, -402,-1579, -964}, {-1061, -638,-1269,-1438}, {-1499, -934,-1502, -895}, -{-1598, -564,-1723, -717}, { -606, -597,-1166,-1085}, {-1369, -468,-1946,-1493}, -{-1838, -953,-1932, -931}, {-1499, -188,-1635, -421}, {-1457, -338,-1448, -22}, -{-1942, -422,-2006, -249}, { -496, -114,-1910, -755}, {-1289, 174,-1451, -109}, -{ -482, -257,-1221, -508}, {-1617, 151,-1694, 208}, { -654, 107,-1651, 29}, -{-1141, 279,-1215, 306}, {-1228, -506, -730, -175}, {-1236, -101, -969, 551}, -{ -870, 278, -823, 315}, { -563, 376,-1051, 228}, { -507, 280, -599, 281}, -{ -758, 253, -305, 379}, { -755, -134, -611, 660}, { -824, 536, -817, 646}, -{ -413, 49, -341, 177}, { -453, 526, -482, 589}, { -71, 339, -657, 264}, -{ -244, 295, -237, 315}, { -387, 569, -506, -9}, { -377, 14, -160, 661}, -{ -216, 40, -308, -46}, { 95, 214, -242, 167}, { -86, 192, -56, 27}, -{ -76, 31, 36, 309}, { -106, -182, -113, 74}, { -441, -22, 23, 139}, -{ 81, -11, 44, 15}, { -87, -137, -118, -207}, { -158, -58, 272, -92}, -{ -156, -441, 8, -136}, { 128, -221, 101, -218}, { 40, -197, -76, -456}, -{ 9, -445, 33, -423}, { 226, 60, 73, -222}, { 156, -399, 280, -318}, -{ 245, -341, 166, -499}, { 339, -190, 327, -219}, { 325, -137, -89, -596}, -{ 100, -627, 144, -677}, { 487, 28, 252, -391}, { 214, -41, 282, -28}, -{ 99, -286, 331, 49}, { 459, -388, 565, -369}, { 436, 28, 336, -9}, -{ 397, -167, 618, 34}, { 596, -17, 561, -140}, { 299, 79, 522, 125}, -{ 203, 2, 244, 288}, { 255, 211, 175, 82}, { 596, 187, 517, 108}, -{ 381, 255, 365, 297}, { 497, 352, 327, -82}, { 25, 210, 371, 245}, -{ 261, 3, 545, 449}, { 140, 294, 44, 295}, { 212, 347, 244, 494}, -{ 331, 528, 201, 307}, { 349, 411, 613, 284}, { 614, 413, 464, 322}, -{ 624, 397, 97, 200}, { -160, 384, 149, 362}, { 495, 525, 269, 585}, -{ 33, 491, -121, 433}, { 427, 611, 498, 516}, { 171, 443, 497, 666}, -{ 440, 275, 566, 575}, { 146, 639, 155, 670}, { -33, 173, 212, 696}, -{ -166, 601, -191, 695}, { -489, 503, 175, 742}, { 214, 476, 372, 1083}, -{ 578, 530, 586, 777}, { 425, 874, 315, 841}, { 374, 848, -165, 565}, -{ 35, 991, -39, 1062}, { 329, 712, 786, 840}, { 645, 795, 661, 676}, -{ 571, 918, 632, 1079}, { 673, 817, 318, 388}, { 874, 1012, 564, 848}, -{ 880, 620, 557, 479}, { 671, 453, 692, 468}, { 840, 642, 844, 645}, -{ 506, 428, 897, 567}, { 837, 387, 962, 499}, { 691, 561, 939, 926}, -{ 783, 296, 790, 268}, { 1028, 530, 874, 329}, { 548, 143, 675, 291}, -{ 503, 66, 1041, 359}, { 786, 97, 805, 33}, { 837, 470, 511, 49}, -{ 1092, 327, 1174, 323}, { 3, 242, 872, 474}, { 689, 429, 1329, 678}, -{ 1042, 620, 1109, 664}, { 321, 193, 889, 950}, { 1153, 874, 893, 635}, -{ 877, 862, 948, 913}, { 1293, 665, 1320, 639}, { 997, 793, 1402, 1030}, -{ 1176, 1012, 1110, 959}, { 1410, 925, 1403, 915}, { 543, 862, 1116, 1222}, -{ 835, 1190, 835, 1190}, { 959, 1148, 1147, 1376}, { 1300, 1193, 1415, 1231}, -{ 1335, 1341, 746, 1092}, { 1711, 1283, 1389, 1073}, { 1334, 1566, 1153, 1475}, -{ 1645, 1137, 1825, 1220}, { 1056, 1382, 1521, 1730}, { 1632, 1545, 1620, 1542}, -{ 855, 1596, 865, 1667}, { 693, 885, 1716, 1519}, { 1167, 1296, 2209, 1760}, -{ 1952, 1493, 2020, 1482}, { 1534, 1866, 1694, 2008}, { 1566, 748, 1761, 825}, -{ 294, 1392, 1084, 2058}, { 621, 1315, 365, 1287}, { 198, 1028, 488, 1408}, -{ 249, 403, 1014, 1561}, { 324, 363, 1645, 1044}, { 193, 367, 2034, 1859}, -{ -251, 579, 750, 994}, { -243, 30, 1325, 879}, { -28, -169, 624, 917}, -{ -453, 159, 186, 1370}, { -614, 6, 537, 392}, { -94, -291, 781, 229}, -{ -128, -298, 245, 491}, { -701, -648, 972, 789}, { -501, -640, 178, 255}, -{ -365, -390, -255, 317}, { -958, -294, -191, 228}, { -775, -447, 157, -237}, -{ -657, -720, -407, 92}, { -117, -611, 334, -230}, { -679,-1084, -144, -317}, -{ -901, -861, -738, -360}, { -85, -727, -90, -787}, { 100, -22, -391, -263}, -{ -56, -73, -337, -754}, { 5, -189, -706, -624}, { 89, -344, -135,-1113}, -{ -353, -237, -684,-1135}, { -275,-1102, -269,-1203}, { 152, 145, -722,-1232}, -{ 49, 80,-1248, -776}, { -248, 391, -732, -547}, { 469, 218, -255, -864}, -{ 69, 366, -166, -485}, { -688, 191,-1212,-1196}, { -170, -169,-1308,-1631}, -{ 321, 470,-1419,-1243}, { -64, 272,-1361, -248}, { 492, 565, -721, -609}, -{ 195, 485, -573, -133}, { 427, 202, -171, -118}, { 199, 575, 2, -31}, -{ 694, 755,-1366, -39}, { 552, 557, -489, 271}, { 680, 537, 13, -453}, -{ 855, 954, -133, -52}, { -81, 738,-1169, 637}, { 1055, 1059, -95, 676}, -{ 1259, 1081, 489, 305}, { -449, 954, -534, 996}, { -969, 866,-1058, 1059}, -{-1294, 618,-1416, 617}, { -458, 1366, -159, 1821}, { -774, -528, -14, 1110}, -{-1202, -901, -772, 433}, {-1256,-1255,-1011, -302}, { -602, -585, -759,-1618}, -{ -760,-1549, -840,-1921}, { -816, -539,-1769,-2235}, { -227, -36,-2034,-1831}, -{-2107,-1126,-2471,-1816}, {-1470, 252,-2701, -415}, { -571, -467, 1509, 1554}, -{ 2180, 1975, 2326, 2020} -}; - -static const int16_t lsf_5_4[256][4] = { -{-1857,-1681,-1857,-1755}, {-2056,-1150,-2134,-1654}, {-1619,-1099,-1704,-1131}, -{-1345,-1608,-1359,-1638}, {-1338,-1293,-1325,-1265}, {-1664,-1649,-1487, -851}, -{-1346,-1832,-1413,-2188}, {-1282, -681,-1785,-1649}, { -966,-1082,-1183,-1676}, -{-1054,-1073,-1142,-1158}, {-1207, -744,-1274, -997}, { -934,-1383, -927,-1416}, -{-1010,-1305, -783, -955}, {-1049, -900, -993, -817}, { -737, -823, -972,-1189}, -{ -738,-1094, -738,-1154}, { -784, -801, -810, -786}, { -892, -520,-1000, -818}, -{ -644, -965, -577, -882}, { -541, -694, -671, -917}, { -595, -642, -646, -615}, -{ -956, -621, -925, -515}, { -727, -483, -815, -485}, { -840, -578, -440, -713}, -{ -578, -325, -657, -670}, { -386, -570, -441, -666}, { -514, -787, -392, -529}, -{ -522, -453, -487, -423}, { -616, -585, -617, -157}, { -662, -268, -680, -348}, -{ -322, -323, -632, -444}, { -304, -430, -332, -458}, { -277, -468, -659, -793}, -{ -319, -636, -227, -554}, { -373, -347, -334, -210}, { -456, -192, -530, -242}, -{ -216, -198, -366, -370}, { -338, -161, -409, -748}, { -107, -380, -294, -643}, -{ -223, -665, -234, -741}, { -141, -496, -130, -510}, { -139, -327, -172, -305}, -{ -306, -580, -164, -263}, { -262, -172, -67, -402}, { 31, -366, -10, -436}, -{ -86, -527, 71, -377}, { -22, -609, -12, -678}, { -67, -319, 63, -191}, -{ 35, -181, -39, -242}, { 126, -167, -140, -544}, { 155, -297, 174, -297}, -{ 38, -8, 117, -380}, { 197, -452, 240, -522}, { 223, -103, 110, -187}, -{ 87, -155, 169, -47}, { 157, 26, -83, -100}, { 128, 80, 209, -62}, -{ 6, 7, 22, 5}, { 318, -20, 248, -45}, { -200, -63, 156, -69}, -{ 250, -183, 369, -126}, { -113, -76, -142, -122}, { -64, -254, -31, 35}, -{ -177, -71, -7, 171}, { 93, 27, 108, 212}, { -330, -209, -123, -70}, -{ -279, 95, -96, 20}, { -188, -61, -314, 87}, { -300, -78, -354, -134}, -{ 11, 122, -140, 122}, { -275, 152, -293, 140}, { -82, 138, -321, -111}, -{ -480, -156, -359, 76}, { -254, -40, -635, -96}, { -522, 79, -507, 8}, -{ -268, 303, -539, 68}, { -446, 61, -522, 306}, { 111, 189, -435, 122}, -{ -379, 166, -571, -398}, { -632, -74, -747, -95}, { -455, 194, -952, 83}, -{ -798, 192, -755, 192}, { -781, -162, -619, 234}, { -663, -297, -488, -109}, -{ -964, -132, -838, -68}, { -843, 58,-1112, -86}, { -805, -299, -944, -253}, -{ -778, -50, -965, -549}, { -352, -98, -992, -343}, {-1117, -315,-1117, -307}, -{-1155, -374, -637, -230}, {-1166, -43,-1299, -100}, { -925, -393,-1274, -600}, -{ -689, -130,-1479, -312}, {-1321, -254,-1464, -442}, {-1292, -613,-1261, -503}, -{-1501, -368,-1322, 26}, {-1432, -66,-1743, -161}, {-1644, -467,-1760, -548}, -{-1393, -568,-1556, -871}, {-1495,-1034,-1387, -571}, {-1917, -528,-1783, -123}, -{-1897, -231,-2054, -323}, {-2052, -906,-1976, -567}, {-1917, -620,-2047, -989}, -{-1077, -370,-2031, -704}, {-2355, -749,-2740,-1089}, {-1909, 159,-2012, 248}, -{ -626, -123,-2339, -962}, { -669, -408,-1379,-1174}, { -452, -364,-1044, -735}, -{ -132, 183,-1620, -752}, { -547, -307, -777,-1261}, { -98, 41, -880,-1091}, -{ -257, 97,-1602,-1833}, { 31, -26, -644, -561}, { -180, -546, -385,-1095}, -{ -410, -802, -414, -827}, { -457, -970, -490,-1109}, { -215, -916, -144, -937}, -{ -493,-1269, -517,-1507}, { 181, 101, -332, -889}, { -836, -937, -559, -429}, -{ -629, -547, -183, -337}, { -545, -82, -250, -286}, { 5, -132, -348, -252}, -{ -293, -472, -158, 100}, { -29, 197, -236, -424}, { -861, -213, -140, -7}, -{ -427, -443, 187, -97}, { -684, -736, -293, 258}, { -368, -152, -150, 392}, -{ -609, 175, -142, 299}, { -138, 152, -119, 329}, { -486, -52, 293, 198}, -{ -183, 117, 175, 331}, { -58, -274, 231, 300}, { -288, 330, -305, 372}, -{ -111, 409, -9, 423}, { 83, 256, 67, 367}, { -19, 248, 91, 113}, -{ -35, 406, -191, 154}, { 238, 296, 5, 197}, { 141, 221, 313, 198}, -{ 211, 421, 244, 334}, { 88, 426, -243, 454}, { 202, 552, -5, 403}, -{ 291, 185, 219, 301}, { 251, 138, 128, 69}, { 197, 288, -140, -61}, -{ 188, 361, 197, 598}, { 442, 273, 290, 143}, { 472, 482, 157, 370}, -{ 415, 321, 372, 385}, { 402, 552, 155, 24}, { 550, 263, -11, 21}, -{ 360, 227, 147, -254}, { 424, 97, 366, -13}, { 375, 141, 449, 232}, -{ 396, 507, 474, 272}, { 701, 324, 362, -47}, { 587, 148, 543, 69}, -{ 400, -51, 561, 59}, { 220, -10, 352, 147}, { 206, 211, 653, 185}, -{ 563, 297, 565, 284}, { 594, 121, 766, 192}, { 398, 118, 642, 434}, -{ 233, 264, 481, 467}, { 129, -165, 699, 239}, { 90, 26, 342, 474}, -{ -55, 27, 388, 94}, { -172, 0, 725, 379}, { -60, 337, 370, 465}, -{ 95, 319, 806, 595}, { 78, 260, 497, 851}, { 210, 560, 458, 574}, -{ -464, 202, 497, 625}, { -202, 152, 48, 712}, { -20, 566, 100, 715}, -{ 455, 468, 411, 605}, { 319, 646, 195, 615}, { 401, 538, 680, 739}, -{ 201, 667, 434, 954}, { 454, 425, 646, 491}, { 606, 681, 416, 508}, -{ 497, 822, 426, 815}, { 660, 647, 628, 716}, { 697, 466, 618, 457}, -{ 685, 460, 365, 309}, { 721, 567, 836, 601}, { 609, 300, 825, 459}, -{ 943, 687, 681, 533}, { 915, 598, 591, 243}, { 876, 451, 874, 420}, -{ 786, 317, 732, 220}, { 922, 317, 1108, 367}, { 531, 466, 1028, 649}, -{ 1053, 615, 1034, 553}, { 829, 602, 1021, 799}, { 927, 803, 878, 763}, -{ 799, 496, 1373, 773}, { 585, 770, 803, 930}, { 1099, 793, 1222, 862}, -{ 1209, 895, 1025, 727}, { 772, 845, 1172, 1115}, { 867, 1021, 830, 1013}, -{ 841, 910, 506, 703}, { 1239, 1077, 620, 819}, { 1196, 1083, 1155, 1081}, -{ 1142, 907, 1547, 1121}, { 1309, 648, 1343, 612}, { 1484, 988, 1479, 937}, -{ 985, 1328, 955, 1341}, { 429, 910, 841, 1338}, { 564, 1179, 412, 1156}, -{ 1427, 1320, 1434, 1330}, { 640, 760, 1726, 1410}, { 190, 555, 1073, 1005}, -{ 426, 257, 839, 980}, { 235, 231, 1520, 1167}, { 109, 293, 1014, 1569}, -{ 305, 142, 1148, 539}, { -291, -108, 1213, 972}, { 22, -216, 667, 828}, -{ -482, 438, 453, 1431}, { -581, -422, 789, 387}, { -358, -454, 174, 780}, -{ -36, -372, 390, -134}, { -629, 160, -306, 751}, {-1258, -331, 177, 522}, -{ -248, 574, -251, 639}, { -531, 407, -596, 394}, { -419, 789, -617, 801}, -{ -986, 399, -857, 727}, { -7, 518, -703, 310}, {-1143, -24,-1002, 287}, -{ -960, 363,-1299, 312}, {-1534, 245,-1557, 305}, { 28, 153, -859, -175}, -{ -33, 332,-1398, -154}, { 212, 410, -593, -197}, {-1092, -704, -904, -65}, -{ 282, 367, -918, -686}, { 345, 93, -258, -357}, { 696, 644, -693, -28}, -{ 448, 493, -273, 193}, { 527, 546, -243, -513}, { 384, -136, 273, -353}, -{ 512, -142, 537, -198}, { 941, 750, 83, 248}, { 578, 861, -56, 592}, -{ 842, 44, 892, 24}, { 33, 890, -16, 982}, { 831, 1398, 1535, 1898}, -{ 1716, 1376, 1948, 1465} -}; - -static const int16_t lsf_5_5[64][4] = { -{-1002, -929,-1096,-1203}, { -641, -931, -604, -961}, { -779, -673, -835, -788}, -{ -416, -664, -458, -766}, { -652, -521, -662, -495}, {-1023, -509,-1023, -428}, -{ -444, -552, -368, -449}, { -479, -211,-1054, -903}, { -316, -249, -569, -591}, -{ -569, -275, -541, -191}, { -716, -188, -842, -264}, { -333, -248, -318, -228}, -{ -275, 1, -567, -228}, { -115, -221, -238, -374}, { -197, -507, -222, -579}, -{ -258, -432, -61, -244}, { -345, 2, -338, 39}, { -215, -169, -58, 0}, -{ -56, -6, -203, -131}, { 1, -186, -5, -211}, { 6, -380, 11, -418}, -{ -116, 131, -134, 113}, { 89, -4, 71, -2}, { -19, -192, 262, 24}, -{ 189, 151, -133, -109}, { 186, -153, 166, -219}, { 37, 139, 193, 171}, -{ 337, 124, 158, -61}, { 141, 226, -13, 190}, { 231, 34, 354, 109}, -{ 316, 201, 244, 164}, { 330, -85, 390, -84}, { 254, 327, 257, 335}, -{ 491, 147, 476, 105}, { 54, 77, 437, 370}, { 421, 314, 449, 342}, -{ 329, 126, 673, 292}, { 571, 388, 243, 193}, { 653, 320, 621, 280}, -{ 194, 380, 517, 581}, { 45, 323, 111, 422}, { 489, 395, 734, 534}, -{ 622, 546, 486, 502}, { 318, 572, 189, 550}, { 385, 422, -157, 153}, -{ -125, 382, -197, 386}, { -263, 334, 228, 697}, { -188, 1, 51, 297}, -{ -507, 213, -376, 397}, { -24, 255, -547, 89}, { -502, -94, 387, 179}, -{ -620, 68, -684, 112}, { -642, -350, -260, 172}, { -438, -324, 264, 648}, -{ -964, -4,-1121, 7}, { -134, 134,-1133, -306}, { 143, 96, -420, -497}, -{-1221, -350,-1527, -685}, { -161, 72, 873, 691}, { 732, 283, 921, 353}, -{ 334, 475, 1095, 821}, { 864, 524, 843, 497}, { 714, 711, 788, 750}, -{ 1076, 714, 1204, 753} -}; - -static const float lsf_3_mean[LP_FILTER_ORDER] = { - 377.441, 554.688, 922.363, 1339.84, 1702.15, - 2046.390, 2452.880, 2741.460, 3116.70, 3348.14 -}; - -static const float lsf_5_mean[LP_FILTER_ORDER] = { - 337.891, 507.080, 834.961, 1247.07, 1646.00, - 1982.910, 2407.960, 2708.010, 3104.00, 3344.97 -}; - -/** Prediction factor table for modes other than 12.2kbit/s */ -static const float pred_fac[LP_FILTER_ORDER] = { - 0.291626, 0.328644, 0.383636, 0.405640, 0.438873, - 0.355560, 0.323120, 0.298065, 0.262238, 0.197876, -}; - -// fixed tables - -/** - * number of pulses per mode - */ -static const uint8_t pulses_nb_per_mode[] = {2, 2, 2, 3, 4, 4, 8, 10}; - -/** track start positions for algebraic code book routines */ -static const uint8_t track_position[16] = { - 0, 2, 0, 3, 0, 2, 0, 3, 1, 3, 2, 4, 1, 4, 1, 4 -}; - -/** 3-bit Gray code to binary lookup table */ -static const uint8_t gray_decode[8] = { 0, 5, 15, 10, 25, 30, 20, 35 }; - - -// gain tables - -/** scalar quantized pitch gain table for 7.95 and 12.2 kbps modes */ -static const uint16_t qua_gain_pit[16] = { - 0, 3277, 6556, 8192, 9830, 11469, 12288, 13107, - 13926, 14746, 15565, 16384, 17203, 18022, 18842, 19661 -}; - -/** scalar quantized fixed gain table for 7.95 and 12.2 kbps modes */ -static const uint16_t qua_gain_code[32] = { - 159, 206, 268, 349, 419, 482, 554, 637, - 733, 842, 969, 1114, 1281, 1473, 1694, 1948, - 2241, 2577, 2963, 3408, 3919, 4507, 5183, 5960, - 6855, 7883, 9065, 10425, 12510, 16263, 21142, 27485 -}; - -/** desired mean innovation energy, indexed by active mode */ -static const float energy_mean[8] = { - 33.0, 33.0, 33.0, 28.75, 30.0, 36.0, 33.0, 36.0 -}; - -/** 4-tap moving average prediction coefficients in reverse order */ -static const float energy_pred_fac[4] = { 0.19, 0.34, 0.58, 0.68 }; - -/** gain table for 4.75 kbps mode - * - * first index has even/odd indexes for subframes 0,2/1,3 - * second index is {pitch_gain, fixed_gain_factor} */ -static const uint16_t gains_MODE_4k75[512][2] = { -{ 812, 128}, { 542, 140}, { 2873, 1135}, { 2266, 3402}, { 2067, 563}, -{12677, 647}, { 4132, 1798}, { 5601, 5285}, { 7689, 374}, { 3735, 441}, -{10912, 2638}, {11807, 2494}, {20490, 797}, { 5218, 675}, { 6724, 8354}, -{ 5282, 1696}, { 1488, 428}, { 5882, 452}, { 5332, 4072}, { 3583, 1268}, -{ 2469, 901}, {15894, 1005}, {14982, 3271}, {10331, 4858}, { 3635, 2021}, -{ 2596, 835}, {12360, 4892}, {12206, 1704}, {13432, 1604}, { 9118, 2341}, -{ 3968, 1538}, { 5479, 9936}, { 3795, 417}, { 1359, 414}, { 3640, 1569}, -{ 7995, 3541}, {11405, 645}, { 8552, 635}, { 4056, 1377}, {16608, 6124}, -{11420, 700}, { 2007, 607}, {12415, 1578}, {11119, 4654}, {13680, 1708}, -{11990, 1229}, { 7996, 7297}, {13231, 5715}, { 2428, 1159}, { 2073, 1941}, -{ 6218, 6121}, { 3546, 1804}, { 8925, 1802}, { 8679, 1580}, {13935, 3576}, -{13313, 6237}, { 6142, 1130}, { 5994, 1734}, {14141, 4662}, {11271, 3321}, -{12226, 1551}, {13931, 3015}, { 5081,10464}, { 9444, 6706}, { 1689, 683}, -{ 1436, 1306}, { 7212, 3933}, { 4082, 2713}, { 7793, 704}, {15070, 802}, -{ 6299, 5212}, { 4337, 5357}, { 6676, 541}, { 6062, 626}, {13651, 3700}, -{11498, 2408}, {16156, 716}, {12177, 751}, { 8065,11489}, { 6314, 2256}, -{ 4466, 496}, { 7293, 523}, {10213, 3833}, { 8394, 3037}, { 8403, 966}, -{14228, 1880}, { 8703, 5409}, {16395, 4863}, { 7420, 1979}, { 6089, 1230}, -{ 9371, 4398}, {14558, 3363}, {13559, 2873}, {13163, 1465}, { 5534, 1678}, -{13138,14771}, { 7338, 600}, { 1318, 548}, { 4252, 3539}, {10044, 2364}, -{10587, 622}, {13088, 669}, {14126, 3526}, { 5039, 9784}, {15338, 619}, -{ 3115, 590}, {16442, 3013}, {15542, 4168}, {15537, 1611}, {15405, 1228}, -{16023, 9299}, { 7534, 4976}, { 1990, 1213}, {11447, 1157}, {12512, 5519}, -{ 9475, 2644}, { 7716, 2034}, {13280, 2239}, {16011, 5093}, { 8066, 6761}, -{10083, 1413}, { 5002, 2347}, {12523, 5975}, {15126, 2899}, {18264, 2289}, -{15827, 2527}, {16265,10254}, {14651,11319}, { 1797, 337}, { 3115, 397}, -{ 3510, 2928}, { 4592, 2670}, { 7519, 628}, {11415, 656}, { 5946, 2435}, -{ 6544, 7367}, { 8238, 829}, { 4000, 863}, {10032, 2492}, {16057, 3551}, -{18204, 1054}, { 6103, 1454}, { 5884, 7900}, {18752, 3468}, { 1864, 544}, -{ 9198, 683}, {11623, 4160}, { 4594, 1644}, { 3158, 1157}, {15953, 2560}, -{12349, 3733}, {17420, 5260}, { 6106, 2004}, { 2917, 1742}, {16467, 5257}, -{16787, 1680}, {17205, 1759}, { 4773, 3231}, { 7386, 6035}, {14342,10012}, -{ 4035, 442}, { 4194, 458}, { 9214, 2242}, { 7427, 4217}, {12860, 801}, -{11186, 825}, {12648, 2084}, {12956, 6554}, { 9505, 996}, { 6629, 985}, -{10537, 2502}, {15289, 5006}, {12602, 2055}, {15484, 1653}, {16194, 6921}, -{14231, 5790}, { 2626, 828}, { 5615, 1686}, {13663, 5778}, { 3668, 1554}, -{11313, 2633}, { 9770, 1459}, {14003, 4733}, {15897, 6291}, { 6278, 1870}, -{ 7910, 2285}, {16978, 4571}, {16576, 3849}, {15248, 2311}, {16023, 3244}, -{14459,17808}, {11847, 2763}, { 1981, 1407}, { 1400, 876}, { 4335, 3547}, -{ 4391, 4210}, { 5405, 680}, {17461, 781}, { 6501, 5118}, { 8091, 7677}, -{ 7355, 794}, { 8333, 1182}, {15041, 3160}, {14928, 3039}, {20421, 880}, -{14545, 852}, {12337,14708}, { 6904, 1920}, { 4225, 933}, { 8218, 1087}, -{10659, 4084}, {10082, 4533}, { 2735, 840}, {20657, 1081}, {16711, 5966}, -{15873, 4578}, {10871, 2574}, { 3773, 1166}, {14519, 4044}, {20699, 2627}, -{15219, 2734}, {15274, 2186}, { 6257, 3226}, {13125,19480}, { 7196, 930}, -{ 2462, 1618}, { 4515, 3092}, {13852, 4277}, {10460, 833}, {17339, 810}, -{16891, 2289}, {15546, 8217}, {13603, 1684}, { 3197, 1834}, {15948, 2820}, -{15812, 5327}, {17006, 2438}, {16788, 1326}, {15671, 8156}, {11726, 8556}, -{ 3762, 2053}, { 9563, 1317}, {13561, 6790}, {12227, 1936}, { 8180, 3550}, -{13287, 1778}, {16299, 6599}, {16291, 7758}, { 8521, 2551}, { 7225, 2645}, -{18269, 7489}, {16885, 2248}, {17882, 2884}, {17265, 3328}, { 9417,20162}, -{11042, 8320}, { 1286, 620}, { 1431, 583}, { 5993, 2289}, { 3978, 3626}, -{ 5144, 752}, {13409, 830}, { 5553, 2860}, {11764, 5908}, {10737, 560}, -{ 5446, 564}, {13321, 3008}, {11946, 3683}, {19887, 798}, { 9825, 728}, -{13663, 8748}, { 7391, 3053}, { 2515, 778}, { 6050, 833}, { 6469, 5074}, -{ 8305, 2463}, { 6141, 1865}, {15308, 1262}, {14408, 4547}, {13663, 4515}, -{ 3137, 2983}, { 2479, 1259}, {15088, 4647}, {15382, 2607}, {14492, 2392}, -{12462, 2537}, { 7539, 2949}, {12909,12060}, { 5468, 684}, { 3141, 722}, -{ 5081, 1274}, {12732, 4200}, {15302, 681}, { 7819, 592}, { 6534, 2021}, -{16478, 8737}, {13364, 882}, { 5397, 899}, {14656, 2178}, {14741, 4227}, -{14270, 1298}, {13929, 2029}, {15477, 7482}, {15815, 4572}, { 2521, 2013}, -{ 5062, 1804}, { 5159, 6582}, { 7130, 3597}, {10920, 1611}, {11729, 1708}, -{16903, 3455}, {16268, 6640}, { 9306, 1007}, { 9369, 2106}, {19182, 5037}, -{12441, 4269}, {15919, 1332}, {15357, 3512}, {11898,14141}, {16101, 6854}, -{ 2010, 737}, { 3779, 861}, {11454, 2880}, { 3564, 3540}, { 9057, 1241}, -{12391, 896}, { 8546, 4629}, {11561, 5776}, { 8129, 589}, { 8218, 588}, -{18728, 3755}, {12973, 3149}, {15729, 758}, {16634, 754}, {15222,11138}, -{15871, 2208}, { 4673, 610}, {10218, 678}, {15257, 4146}, { 5729, 3327}, -{ 8377, 1670}, {19862, 2321}, {15450, 5511}, {14054, 5481}, { 5728, 2888}, -{ 7580, 1346}, {14384, 5325}, {16236, 3950}, {15118, 3744}, {15306, 1435}, -{14597, 4070}, {12301,15696}, { 7617, 1699}, { 2170, 884}, { 4459, 4567}, -{18094, 3306}, {12742, 815}, {14926, 907}, {15016, 4281}, {15518, 8368}, -{17994, 1087}, { 2358, 865}, {16281, 3787}, {15679, 4596}, {16356, 1534}, -{16584, 2210}, {16833, 9697}, {15929, 4513}, { 3277, 1085}, { 9643, 2187}, -{11973, 6068}, { 9199, 4462}, { 8955, 1629}, {10289, 3062}, {16481, 5155}, -{15466, 7066}, {13678, 2543}, { 5273, 2277}, {16746, 6213}, {16655, 3408}, -{20304, 3363}, {18688, 1985}, {14172,12867}, {15154,15703}, { 4473, 1020}, -{ 1681, 886}, { 4311, 4301}, { 8952, 3657}, { 5893, 1147}, {11647, 1452}, -{15886, 2227}, { 4582, 6644}, { 6929, 1205}, { 6220, 799}, {12415, 3409}, -{15968, 3877}, {19859, 2109}, { 9689, 2141}, {14742, 8830}, {14480, 2599}, -{ 1817, 1238}, { 7771, 813}, {19079, 4410}, { 5554, 2064}, { 3687, 2844}, -{17435, 2256}, {16697, 4486}, {16199, 5388}, { 8028, 2763}, { 3405, 2119}, -{17426, 5477}, {13698, 2786}, {19879, 2720}, { 9098, 3880}, {18172, 4833}, -{17336,12207}, { 5116, 996}, { 4935, 988}, { 9888, 3081}, { 6014, 5371}, -{15881, 1667}, { 8405, 1183}, {15087, 2366}, {19777, 7002}, {11963, 1562}, -{ 7279, 1128}, {16859, 1532}, {15762, 5381}, {14708, 2065}, {20105, 2155}, -{17158, 8245}, {17911, 6318}, { 5467, 1504}, { 4100, 2574}, {17421, 6810}, -{ 5673, 2888}, {16636, 3382}, { 8975, 1831}, {20159, 4737}, {19550, 7294}, -{ 6658, 2781}, {11472, 3321}, {19397, 5054}, {18878, 4722}, {16439, 2373}, -{20430, 4386}, {11353,26526}, {11593, 3068}, { 2866, 1566}, { 5108, 1070}, -{ 9614, 4915}, { 4939, 3536}, { 7541, 878}, {20717, 851}, { 6938, 4395}, -{16799, 7733}, {10137, 1019}, { 9845, 964}, {15494, 3955}, {15459, 3430}, -{18863, 982}, {20120, 963}, {16876,12887}, {14334, 4200}, { 6599, 1220}, -{ 9222, 814}, {16942, 5134}, { 5661, 4898}, { 5488, 1798}, {20258, 3962}, -{17005, 6178}, {17929, 5929}, { 9365, 3420}, { 7474, 1971}, {19537, 5177}, -{19003, 3006}, {16454, 3788}, {16070, 2367}, { 8664, 2743}, { 9445,26358}, -{10856, 1287}, { 3555, 1009}, { 5606, 3622}, {19453, 5512}, {12453, 797}, -{20634, 911}, {15427, 3066}, {17037,10275}, {18883, 2633}, { 3913, 1268}, -{19519, 3371}, {18052, 5230}, {19291, 1678}, {19508, 3172}, {18072,10754}, -{16625, 6845}, { 3134, 2298}, {10869, 2437}, {15580, 6913}, {12597, 3381}, -{11116, 3297}, {16762, 2424}, {18853, 6715}, {17171, 9887}, {12743, 2605}, -{ 8937, 3140}, {19033, 7764}, {18347, 3880}, {20475, 3682}, {19602, 3380}, -{13044,19373}, {10526,23124} -}; - -/** gain table for 6.70, 7.40 and 10.2 kbps modes - * - * second index is {pitch_gain, fixed_gain_factor} */ -static const uint16_t gains_high[128][2] = { -{ 577, 662}, { 806, 1836}, { 3109, 1052}, { 4181, 1387}, { 2373, 1425}, -{ 3248, 1985}, { 1827, 2320}, { 941, 3314}, { 2351, 2977}, { 3616, 2420}, -{ 3451, 3096}, { 2955, 4301}, { 1848, 4500}, { 3884, 5416}, { 1187, 7210}, -{ 3083, 9000}, { 7384, 883}, { 5962, 1506}, { 5155, 2134}, { 7944, 2009}, -{ 6507, 2250}, { 7670, 2752}, { 5952, 3016}, { 4898, 3764}, { 6989, 3588}, -{ 8174, 3978}, { 6064, 4404}, { 7709, 5087}, { 5523, 6021}, { 7769, 7126}, -{ 6060, 7938}, { 5594,11487}, {10581, 1356}, { 9049, 1597}, { 9794, 2035}, -{ 8946, 2415}, {10296, 2584}, { 9407, 2734}, { 8700, 3218}, { 9757, 3395}, -{10177, 3892}, { 9170, 4528}, {10152, 5004}, { 9114, 5735}, {10500, 6266}, -{10110, 7631}, { 8844, 8727}, { 8956,12496}, {12924, 976}, {11435, 1755}, -{12138, 2328}, {11388, 2368}, {10700, 3064}, {12332, 2861}, {11722, 3327}, -{11270, 3700}, {10861, 4413}, {12082, 4533}, {11283, 5205}, {11960, 6305}, -{11167, 7534}, {12128, 8329}, {10969,10777}, {10300,17376}, {13899, 1681}, -{12580, 2045}, {13265, 2439}, {14033, 2989}, {13452, 3098}, {12396, 3658}, -{13510, 3780}, {12880, 4272}, {13533, 4861}, {12667, 5457}, {13854, 6106}, -{13031, 6483}, {13557, 7721}, {12957, 9311}, {13714,11551}, {12591,15206}, -{15113, 1540}, {15072, 2333}, {14527, 2511}, {14692, 3199}, {15382, 3560}, -{14133, 3960}, {15102, 4236}, {14332, 4824}, {14846, 5451}, {15306, 6083}, -{14329, 6888}, {15060, 7689}, {14406, 9426}, {15387, 9741}, {14824,14271}, -{13600,24939}, {16396, 1969}, {16817, 2832}, {15713, 2843}, {16104, 3336}, -{16384, 3963}, {16940, 4579}, {15711, 4599}, {16222, 5448}, {16832, 6382}, -{15745, 7141}, {16326, 7469}, {16611, 8624}, {17028,10418}, {15905,11817}, -{16878,14690}, {16515,20870}, {18142, 2083}, {19401, 3178}, {17508, 3426}, -{20054, 4027}, {18069, 4249}, {18952, 5066}, {17711, 5402}, {19835, 6192}, -{17950, 7014}, {21318, 7877}, {17910, 9289}, {19144, 9290}, {20517,11381}, -{18075,14485}, {19999,17882}, {18842,32764} -}; - -/** gain table for 5.15 and 5.90 kbps modes - * - * second index is {pitch_gain, fixed_gain_factor} */ -static const uint16_t gains_low[64][2] = { -{10813,28753}, {20480, 2785}, {18841, 6594}, { 6225, 7413}, {17203,10444}, -{21626, 1269}, {21135, 4423}, {11304, 1556}, {19005,12820}, {17367, 2498}, -{17858, 4833}, { 9994, 2498}, {17530, 7864}, {14254, 1884}, {15892, 3153}, -{ 6717, 1802}, {18186,20193}, {18022, 3031}, {16711, 5857}, { 8847, 4014}, -{15892, 8970}, {18022, 1392}, {16711, 4096}, { 8192, 655}, {15237,13926}, -{14254, 3112}, {14090, 4669}, { 5406, 2703}, {13434, 6553}, {12451, 901}, -{12451, 2662}, { 3768, 655}, {14745,23511}, {19169, 2457}, {20152, 5079}, -{ 6881, 4096}, {20480, 8560}, {19660, 737}, {19005, 4259}, { 7864, 2088}, -{11468,12288}, {15892, 1474}, {15728, 4628}, { 9175, 1433}, {16056, 7004}, -{14827, 737}, {15073, 2252}, { 5079, 1228}, {13271,17326}, {16547, 2334}, -{15073, 5816}, { 3932, 3686}, {14254, 8601}, {16875, 778}, {15073, 3809}, -{ 6062, 614}, { 9338, 9256}, {13271, 1761}, {13271, 3522}, { 2457, 1966}, -{11468, 5529}, {10485, 737}, {11632, 3194}, { 1474, 778} -}; - - -// pre-processing tables - -/** impulse response filter tables converted to float from Q15 int32_t - * used for anti-sparseness processing */ -static const float ir_filter_strong_MODE_7k95[AMR_SUBFRAME_SIZE] = { - 0.817169, 0.024445, 0.076447, -0.020844, -0.042175, 0.017761, 0.018433, --0.038879, 0.107147, -0.179871, 0.138367, -0.015228, -0.059204, 0.091888, --0.154358, 0.171326, -0.060730, -0.032379, -0.044525, 0.135559, -0.021362, --0.162811, 0.140656, 0.013794, -0.017975, -0.102295, 0.090118, 0.038666, --0.036987, -0.079041, 0.052826, 0.112000, -0.136566, -0.029755, 0.134003, --0.077423, 0.028961, -0.041595, -0.029877, 0.174988, -}; - -static const float ir_filter_strong[AMR_SUBFRAME_SIZE] = { - 0.448303, 0.351501, 0.038696, -0.084259, -0.173065, 0.229309, -0.001068, --0.085663, -0.092773, 0.147186, 0.090088, -0.257080, 0.115509, 0.044403, - 0.066498, -0.263580, 0.245697, -0.064178, -0.044373, 0.023712, 0.033813, --0.072784, 0.068787, -0.011078, -0.020569, -0.064178, 0.184509, -0.173370, - 0.032715, 0.095306, -0.154358, 0.162109, -0.071075, -0.113770, 0.211304, --0.118683, 0.020599, -0.054169, 0.000885, 0.309601, -}; - -static const float ir_filter_medium[AMR_SUBFRAME_SIZE] = { - 0.923889, 0.116913, -0.123169, 0.090698, -0.031982, -0.030579, 0.075592, --0.092865, 0.085907, -0.068085, 0.053497, -0.049164, 0.052307, -0.054169, - 0.047089, -0.030762, 0.013092, -0.005157, 0.014404, -0.038574, 0.066406, --0.082581, 0.076996, -0.049469, 0.010498, 0.025208, -0.046661, 0.052612, --0.050568, 0.051910, -0.062958, 0.080688, -0.093384, 0.088409, -0.060364, - 0.016998, 0.023804, -0.041779, 0.025696, 0.019989, -}; - -static const float * const ir_filters_lookup[2] = { - ir_filter_strong, ir_filter_medium -}; -static const float * const ir_filters_lookup_MODE_7k95[2] = { - ir_filter_strong_MODE_7k95, ir_filter_medium -}; - -// High-pass coefficients - -static const float highpass_zeros[2] = { -2.0, 1.0 }; -static const float highpass_poles[2] = { -1.933105469, 0.935913085 }; -static const float highpass_gain = 0.939819335; - -#endif /* AVCODEC_AMRNBDATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdec.c deleted file mode 100644 index e2b30d787..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrnbdec.c +++ /dev/null @@ -1,1095 +0,0 @@ -/* - * AMR narrowband decoder - * Copyright (c) 2006-2007 Robert Swain - * Copyright (c) 2009 Colin McQuillan - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -/** - * @file - * AMR narrowband decoder - * - * This decoder uses floats for simplicity and so is not bit-exact. One - * difference is that differences in phase can accumulate. The test sequences - * in 3GPP TS 26.074 can still be useful. - * - * - Comparing this file's output to the output of the ref decoder gives a - * PSNR of 30 to 80. Plotting the output samples shows a difference in - * phase in some areas. - * - * - Comparing both decoders against their input, this decoder gives a similar - * PSNR. If the test sequence homing frames are removed (this decoder does - * not detect them), the PSNR is at least as good as the reference on 140 - * out of 169 tests. - */ - - -#include -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/float_dsp.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "libavutil/common.h" -#include "libavutil/avassert.h" -#include "celp_math.h" -#include "celp_filters.h" -#include "acelp_filters.h" -#include "acelp_vectors.h" -#include "acelp_pitch_delay.h" -#include "lsp.h" -#include "amr.h" -#include "internal.h" - -#include "amrnbdata.h" - -#define AMR_BLOCK_SIZE 160 ///< samples per frame -#define AMR_SAMPLE_BOUND 32768.0 ///< threshold for synthesis overflow - -/** - * Scale from constructed speech to [-1,1] - * - * AMR is designed to produce 16-bit PCM samples (3GPP TS 26.090 4.2) but - * upscales by two (section 6.2.2). - * - * Fundamentally, this scale is determined by energy_mean through - * the fixed vector contribution to the excitation vector. - */ -#define AMR_SAMPLE_SCALE (2.0 / 32768.0) - -/** Prediction factor for 12.2kbit/s mode */ -#define PRED_FAC_MODE_12k2 0.65 - -#define LSF_R_FAC (8000.0 / 32768.0) ///< LSF residual tables to Hertz -#define MIN_LSF_SPACING (50.0488 / 8000.0) ///< Ensures stability of LPC filter -#define PITCH_LAG_MIN_MODE_12k2 18 ///< Lower bound on decoded lag search in 12.2kbit/s mode - -/** Initial energy in dB. Also used for bad frames (unimplemented). */ -#define MIN_ENERGY -14.0 - -/** Maximum sharpening factor - * - * The specification says 0.8, which should be 13107, but the reference C code - * uses 13017 instead. (Amusingly the same applies to SHARP_MAX in g729dec.c.) - */ -#define SHARP_MAX 0.79449462890625 - -/** Number of impulse response coefficients used for tilt factor */ -#define AMR_TILT_RESPONSE 22 -/** Tilt factor = 1st reflection coefficient * gamma_t */ -#define AMR_TILT_GAMMA_T 0.8 -/** Adaptive gain control factor used in post-filter */ -#define AMR_AGC_ALPHA 0.9 - -typedef struct AMRContext { - AMRNBFrame frame; ///< decoded AMR parameters (lsf coefficients, codebook indexes, etc) - uint8_t bad_frame_indicator; ///< bad frame ? 1 : 0 - enum Mode cur_frame_mode; - - int16_t prev_lsf_r[LP_FILTER_ORDER]; ///< residual LSF vector from previous subframe - double lsp[4][LP_FILTER_ORDER]; ///< lsp vectors from current frame - double prev_lsp_sub4[LP_FILTER_ORDER]; ///< lsp vector for the 4th subframe of the previous frame - - float lsf_q[4][LP_FILTER_ORDER]; ///< Interpolated LSF vector for fixed gain smoothing - float lsf_avg[LP_FILTER_ORDER]; ///< vector of averaged lsf vector - - float lpc[4][LP_FILTER_ORDER]; ///< lpc coefficient vectors for 4 subframes - - uint8_t pitch_lag_int; ///< integer part of pitch lag from current subframe - - float excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1 + AMR_SUBFRAME_SIZE]; ///< current excitation and all necessary excitation history - float *excitation; ///< pointer to the current excitation vector in excitation_buf - - float pitch_vector[AMR_SUBFRAME_SIZE]; ///< adaptive code book (pitch) vector - float fixed_vector[AMR_SUBFRAME_SIZE]; ///< algebraic codebook (fixed) vector (must be kept zero between frames) - - float prediction_error[4]; ///< quantified prediction errors {20log10(^gamma_gc)} for previous four subframes - float pitch_gain[5]; ///< quantified pitch gains for the current and previous four subframes - float fixed_gain[5]; ///< quantified fixed gains for the current and previous four subframes - - float beta; ///< previous pitch_gain, bounded by [0.0,SHARP_MAX] - uint8_t diff_count; ///< the number of subframes for which diff has been above 0.65 - uint8_t hang_count; ///< the number of subframes since a hangover period started - - float prev_sparse_fixed_gain; ///< previous fixed gain; used by anti-sparseness processing to determine "onset" - uint8_t prev_ir_filter_nr; ///< previous impulse response filter "impNr": 0 - strong, 1 - medium, 2 - none - uint8_t ir_filter_onset; ///< flag for impulse response filter strength - - float postfilter_mem[10]; ///< previous intermediate values in the formant filter - float tilt_mem; ///< previous input to tilt compensation filter - float postfilter_agc; ///< previous factor used for adaptive gain control - float high_pass_mem[2]; ///< previous intermediate values in the high-pass filter - - float samples_in[LP_FILTER_ORDER + AMR_SUBFRAME_SIZE]; ///< floating point samples - - ACELPFContext acelpf_ctx; ///< context for filters for ACELP-based codecs - ACELPVContext acelpv_ctx; ///< context for vector operations for ACELP-based codecs - CELPFContext celpf_ctx; ///< context for filters for CELP-based codecs - CELPMContext celpm_ctx; ///< context for fixed point math operations - -} AMRContext; - -/** Double version of ff_weighted_vector_sumf() */ -static void weighted_vector_sumd(double *out, const double *in_a, - const double *in_b, double weight_coeff_a, - double weight_coeff_b, int length) -{ - int i; - - for (i = 0; i < length; i++) - out[i] = weight_coeff_a * in_a[i] - + weight_coeff_b * in_b[i]; -} - -static av_cold int amrnb_decode_init(AVCodecContext *avctx) -{ - AMRContext *p = avctx->priv_data; - int i; - - if (avctx->channels > 1) { - avpriv_report_missing_feature(avctx, "multi-channel AMR"); - return AVERROR_PATCHWELCOME; - } - - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - if (!avctx->sample_rate) - avctx->sample_rate = 8000; - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - - // p->excitation always points to the same position in p->excitation_buf - p->excitation = &p->excitation_buf[PITCH_DELAY_MAX + LP_FILTER_ORDER + 1]; - - for (i = 0; i < LP_FILTER_ORDER; i++) { - p->prev_lsp_sub4[i] = lsp_sub4_init[i] * 1000 / (float)(1 << 15); - p->lsf_avg[i] = p->lsf_q[3][i] = lsp_avg_init[i] / (float)(1 << 15); - } - - for (i = 0; i < 4; i++) - p->prediction_error[i] = MIN_ENERGY; - - ff_acelp_filter_init(&p->acelpf_ctx); - ff_acelp_vectors_init(&p->acelpv_ctx); - ff_celp_filter_init(&p->celpf_ctx); - ff_celp_math_init(&p->celpm_ctx); - - return 0; -} - - -/** - * Unpack an RFC4867 speech frame into the AMR frame mode and parameters. - * - * The order of speech bits is specified by 3GPP TS 26.101. - * - * @param p the context - * @param buf pointer to the input buffer - * @param buf_size size of the input buffer - * - * @return the frame mode - */ -static enum Mode unpack_bitstream(AMRContext *p, const uint8_t *buf, - int buf_size) -{ - enum Mode mode; - - // Decode the first octet. - mode = buf[0] >> 3 & 0x0F; // frame type - p->bad_frame_indicator = (buf[0] & 0x4) != 0x4; // quality bit - - if (mode >= N_MODES || buf_size < frame_sizes_nb[mode] + 1) { - return NO_DATA; - } - - if (mode < MODE_DTX) - ff_amr_bit_reorder((uint16_t *) &p->frame, sizeof(AMRNBFrame), buf + 1, - amr_unpacking_bitmaps_per_mode[mode]); - - return mode; -} - - -/// @name AMR pitch LPC coefficient decoding functions -/// @{ - -/** - * Interpolate the LSF vector (used for fixed gain smoothing). - * The interpolation is done over all four subframes even in MODE_12k2. - * - * @param[in] ctx The Context - * @param[in,out] lsf_q LSFs in [0,1] for each subframe - * @param[in] lsf_new New LSFs in [0,1] for subframe 4 - */ -static void interpolate_lsf(ACELPVContext *ctx, float lsf_q[4][LP_FILTER_ORDER], float *lsf_new) -{ - int i; - - for (i = 0; i < 4; i++) - ctx->weighted_vector_sumf(lsf_q[i], lsf_q[3], lsf_new, - 0.25 * (3 - i), 0.25 * (i + 1), - LP_FILTER_ORDER); -} - -/** - * Decode a set of 5 split-matrix quantized lsf indexes into an lsp vector. - * - * @param p the context - * @param lsp output LSP vector - * @param lsf_no_r LSF vector without the residual vector added - * @param lsf_quantizer pointers to LSF dictionary tables - * @param quantizer_offset offset in tables - * @param sign for the 3 dictionary table - * @param update store data for computing the next frame's LSFs - */ -static void lsf2lsp_for_mode12k2(AMRContext *p, double lsp[LP_FILTER_ORDER], - const float lsf_no_r[LP_FILTER_ORDER], - const int16_t *lsf_quantizer[5], - const int quantizer_offset, - const int sign, const int update) -{ - int16_t lsf_r[LP_FILTER_ORDER]; // residual LSF vector - float lsf_q[LP_FILTER_ORDER]; // quantified LSF vector - int i; - - for (i = 0; i < LP_FILTER_ORDER >> 1; i++) - memcpy(&lsf_r[i << 1], &lsf_quantizer[i][quantizer_offset], - 2 * sizeof(*lsf_r)); - - if (sign) { - lsf_r[4] *= -1; - lsf_r[5] *= -1; - } - - if (update) - memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); - - for (i = 0; i < LP_FILTER_ORDER; i++) - lsf_q[i] = lsf_r[i] * (LSF_R_FAC / 8000.0) + lsf_no_r[i] * (1.0 / 8000.0); - - ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER); - - if (update) - interpolate_lsf(&p->acelpv_ctx, p->lsf_q, lsf_q); - - ff_acelp_lsf2lspd(lsp, lsf_q, LP_FILTER_ORDER); -} - -/** - * Decode a set of 5 split-matrix quantized lsf indexes into 2 lsp vectors. - * - * @param p pointer to the AMRContext - */ -static void lsf2lsp_5(AMRContext *p) -{ - const uint16_t *lsf_param = p->frame.lsf; - float lsf_no_r[LP_FILTER_ORDER]; // LSFs without the residual vector - const int16_t *lsf_quantizer[5]; - int i; - - lsf_quantizer[0] = lsf_5_1[lsf_param[0]]; - lsf_quantizer[1] = lsf_5_2[lsf_param[1]]; - lsf_quantizer[2] = lsf_5_3[lsf_param[2] >> 1]; - lsf_quantizer[3] = lsf_5_4[lsf_param[3]]; - lsf_quantizer[4] = lsf_5_5[lsf_param[4]]; - - for (i = 0; i < LP_FILTER_ORDER; i++) - lsf_no_r[i] = p->prev_lsf_r[i] * LSF_R_FAC * PRED_FAC_MODE_12k2 + lsf_5_mean[i]; - - lsf2lsp_for_mode12k2(p, p->lsp[1], lsf_no_r, lsf_quantizer, 0, lsf_param[2] & 1, 0); - lsf2lsp_for_mode12k2(p, p->lsp[3], lsf_no_r, lsf_quantizer, 2, lsf_param[2] & 1, 1); - - // interpolate LSP vectors at subframes 1 and 3 - weighted_vector_sumd(p->lsp[0], p->prev_lsp_sub4, p->lsp[1], 0.5, 0.5, LP_FILTER_ORDER); - weighted_vector_sumd(p->lsp[2], p->lsp[1] , p->lsp[3], 0.5, 0.5, LP_FILTER_ORDER); -} - -/** - * Decode a set of 3 split-matrix quantized lsf indexes into an lsp vector. - * - * @param p pointer to the AMRContext - */ -static void lsf2lsp_3(AMRContext *p) -{ - const uint16_t *lsf_param = p->frame.lsf; - int16_t lsf_r[LP_FILTER_ORDER]; // residual LSF vector - float lsf_q[LP_FILTER_ORDER]; // quantified LSF vector - const int16_t *lsf_quantizer; - int i, j; - - lsf_quantizer = (p->cur_frame_mode == MODE_7k95 ? lsf_3_1_MODE_7k95 : lsf_3_1)[lsf_param[0]]; - memcpy(lsf_r, lsf_quantizer, 3 * sizeof(*lsf_r)); - - lsf_quantizer = lsf_3_2[lsf_param[1] << (p->cur_frame_mode <= MODE_5k15)]; - memcpy(lsf_r + 3, lsf_quantizer, 3 * sizeof(*lsf_r)); - - lsf_quantizer = (p->cur_frame_mode <= MODE_5k15 ? lsf_3_3_MODE_5k15 : lsf_3_3)[lsf_param[2]]; - memcpy(lsf_r + 6, lsf_quantizer, 4 * sizeof(*lsf_r)); - - // calculate mean-removed LSF vector and add mean - for (i = 0; i < LP_FILTER_ORDER; i++) - lsf_q[i] = (lsf_r[i] + p->prev_lsf_r[i] * pred_fac[i]) * (LSF_R_FAC / 8000.0) + lsf_3_mean[i] * (1.0 / 8000.0); - - ff_set_min_dist_lsf(lsf_q, MIN_LSF_SPACING, LP_FILTER_ORDER); - - // store data for computing the next frame's LSFs - interpolate_lsf(&p->acelpv_ctx, p->lsf_q, lsf_q); - memcpy(p->prev_lsf_r, lsf_r, LP_FILTER_ORDER * sizeof(*lsf_r)); - - ff_acelp_lsf2lspd(p->lsp[3], lsf_q, LP_FILTER_ORDER); - - // interpolate LSP vectors at subframes 1, 2 and 3 - for (i = 1; i <= 3; i++) - for(j = 0; j < LP_FILTER_ORDER; j++) - p->lsp[i-1][j] = p->prev_lsp_sub4[j] + - (p->lsp[3][j] - p->prev_lsp_sub4[j]) * 0.25 * i; -} - -/// @} - - -/// @name AMR pitch vector decoding functions -/// @{ - -/** - * Like ff_decode_pitch_lag(), but with 1/6 resolution - */ -static void decode_pitch_lag_1_6(int *lag_int, int *lag_frac, int pitch_index, - const int prev_lag_int, const int subframe) -{ - if (subframe == 0 || subframe == 2) { - if (pitch_index < 463) { - *lag_int = (pitch_index + 107) * 10923 >> 16; - *lag_frac = pitch_index - *lag_int * 6 + 105; - } else { - *lag_int = pitch_index - 368; - *lag_frac = 0; - } - } else { - *lag_int = ((pitch_index + 5) * 10923 >> 16) - 1; - *lag_frac = pitch_index - *lag_int * 6 - 3; - *lag_int += av_clip(prev_lag_int - 5, PITCH_LAG_MIN_MODE_12k2, - PITCH_DELAY_MAX - 9); - } -} - -static void decode_pitch_vector(AMRContext *p, - const AMRNBSubframe *amr_subframe, - const int subframe) -{ - int pitch_lag_int, pitch_lag_frac; - enum Mode mode = p->cur_frame_mode; - - if (p->cur_frame_mode == MODE_12k2) { - decode_pitch_lag_1_6(&pitch_lag_int, &pitch_lag_frac, - amr_subframe->p_lag, p->pitch_lag_int, - subframe); - } else - ff_decode_pitch_lag(&pitch_lag_int, &pitch_lag_frac, - amr_subframe->p_lag, - p->pitch_lag_int, subframe, - mode != MODE_4k75 && mode != MODE_5k15, - mode <= MODE_6k7 ? 4 : (mode == MODE_7k95 ? 5 : 6)); - - p->pitch_lag_int = pitch_lag_int; // store previous lag in a uint8_t - - pitch_lag_frac <<= (p->cur_frame_mode != MODE_12k2); - - pitch_lag_int += pitch_lag_frac > 0; - - /* Calculate the pitch vector by interpolating the past excitation at the - pitch lag using a b60 hamming windowed sinc function. */ - p->acelpf_ctx.acelp_interpolatef(p->excitation, - p->excitation + 1 - pitch_lag_int, - ff_b60_sinc, 6, - pitch_lag_frac + 6 - 6*(pitch_lag_frac > 0), - 10, AMR_SUBFRAME_SIZE); - - memcpy(p->pitch_vector, p->excitation, AMR_SUBFRAME_SIZE * sizeof(float)); -} - -/// @} - - -/// @name AMR algebraic code book (fixed) vector decoding functions -/// @{ - -/** - * Decode a 10-bit algebraic codebook index from a 10.2 kbit/s frame. - */ -static void decode_10bit_pulse(int code, int pulse_position[8], - int i1, int i2, int i3) -{ - // coded using 7+3 bits with the 3 LSBs being, individually, the LSB of 1 of - // the 3 pulses and the upper 7 bits being coded in base 5 - const uint8_t *positions = base_five_table[code >> 3]; - pulse_position[i1] = (positions[2] << 1) + ( code & 1); - pulse_position[i2] = (positions[1] << 1) + ((code >> 1) & 1); - pulse_position[i3] = (positions[0] << 1) + ((code >> 2) & 1); -} - -/** - * Decode the algebraic codebook index to pulse positions and signs and - * construct the algebraic codebook vector for MODE_10k2. - * - * @param fixed_index positions of the eight pulses - * @param fixed_sparse pointer to the algebraic codebook vector - */ -static void decode_8_pulses_31bits(const int16_t *fixed_index, - AMRFixed *fixed_sparse) -{ - int pulse_position[8]; - int i, temp; - - decode_10bit_pulse(fixed_index[4], pulse_position, 0, 4, 1); - decode_10bit_pulse(fixed_index[5], pulse_position, 2, 6, 5); - - // coded using 5+2 bits with the 2 LSBs being, individually, the LSB of 1 of - // the 2 pulses and the upper 5 bits being coded in base 5 - temp = ((fixed_index[6] >> 2) * 25 + 12) >> 5; - pulse_position[3] = temp % 5; - pulse_position[7] = temp / 5; - if (pulse_position[7] & 1) - pulse_position[3] = 4 - pulse_position[3]; - pulse_position[3] = (pulse_position[3] << 1) + ( fixed_index[6] & 1); - pulse_position[7] = (pulse_position[7] << 1) + ((fixed_index[6] >> 1) & 1); - - fixed_sparse->n = 8; - for (i = 0; i < 4; i++) { - const int pos1 = (pulse_position[i] << 2) + i; - const int pos2 = (pulse_position[i + 4] << 2) + i; - const float sign = fixed_index[i] ? -1.0 : 1.0; - fixed_sparse->x[i ] = pos1; - fixed_sparse->x[i + 4] = pos2; - fixed_sparse->y[i ] = sign; - fixed_sparse->y[i + 4] = pos2 < pos1 ? -sign : sign; - } -} - -/** - * Decode the algebraic codebook index to pulse positions and signs, - * then construct the algebraic codebook vector. - * - * nb of pulses | bits encoding pulses - * For MODE_4k75 or MODE_5k15, 2 | 1-3, 4-6, 7 - * MODE_5k9, 2 | 1, 2-4, 5-6, 7-9 - * MODE_6k7, 3 | 1-3, 4, 5-7, 8, 9-11 - * MODE_7k4 or MODE_7k95, 4 | 1-3, 4-6, 7-9, 10, 11-13 - * - * @param fixed_sparse pointer to the algebraic codebook vector - * @param pulses algebraic codebook indexes - * @param mode mode of the current frame - * @param subframe current subframe number - */ -static void decode_fixed_sparse(AMRFixed *fixed_sparse, const uint16_t *pulses, - const enum Mode mode, const int subframe) -{ - av_assert1(MODE_4k75 <= (signed)mode && mode <= MODE_12k2); - - if (mode == MODE_12k2) { - ff_decode_10_pulses_35bits((const int16_t *) pulses, fixed_sparse, gray_decode, 5, 3); - } else if (mode == MODE_10k2) { - decode_8_pulses_31bits((const int16_t *) pulses, fixed_sparse); - } else { - int *pulse_position = fixed_sparse->x; - int i, pulse_subset; - const int fixed_index = pulses[0]; - - if (mode <= MODE_5k15) { - pulse_subset = ((fixed_index >> 3) & 8) + (subframe << 1); - pulse_position[0] = ( fixed_index & 7) * 5 + track_position[pulse_subset]; - pulse_position[1] = ((fixed_index >> 3) & 7) * 5 + track_position[pulse_subset + 1]; - fixed_sparse->n = 2; - } else if (mode == MODE_5k9) { - pulse_subset = ((fixed_index & 1) << 1) + 1; - pulse_position[0] = ((fixed_index >> 1) & 7) * 5 + pulse_subset; - pulse_subset = (fixed_index >> 4) & 3; - pulse_position[1] = ((fixed_index >> 6) & 7) * 5 + pulse_subset + (pulse_subset == 3 ? 1 : 0); - fixed_sparse->n = pulse_position[0] == pulse_position[1] ? 1 : 2; - } else if (mode == MODE_6k7) { - pulse_position[0] = (fixed_index & 7) * 5; - pulse_subset = (fixed_index >> 2) & 2; - pulse_position[1] = ((fixed_index >> 4) & 7) * 5 + pulse_subset + 1; - pulse_subset = (fixed_index >> 6) & 2; - pulse_position[2] = ((fixed_index >> 8) & 7) * 5 + pulse_subset + 2; - fixed_sparse->n = 3; - } else { // mode <= MODE_7k95 - pulse_position[0] = gray_decode[ fixed_index & 7]; - pulse_position[1] = gray_decode[(fixed_index >> 3) & 7] + 1; - pulse_position[2] = gray_decode[(fixed_index >> 6) & 7] + 2; - pulse_subset = (fixed_index >> 9) & 1; - pulse_position[3] = gray_decode[(fixed_index >> 10) & 7] + pulse_subset + 3; - fixed_sparse->n = 4; - } - for (i = 0; i < fixed_sparse->n; i++) - fixed_sparse->y[i] = (pulses[1] >> i) & 1 ? 1.0 : -1.0; - } -} - -/** - * Apply pitch lag to obtain the sharpened fixed vector (section 6.1.2) - * - * @param p the context - * @param subframe unpacked amr subframe - * @param mode mode of the current frame - * @param fixed_sparse sparse respresentation of the fixed vector - */ -static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode, - AMRFixed *fixed_sparse) -{ - // The spec suggests the current pitch gain is always used, but in other - // modes the pitch and codebook gains are joinly quantized (sec 5.8.2) - // so the codebook gain cannot depend on the quantized pitch gain. - if (mode == MODE_12k2) - p->beta = FFMIN(p->pitch_gain[4], 1.0); - - fixed_sparse->pitch_lag = p->pitch_lag_int; - fixed_sparse->pitch_fac = p->beta; - - // Save pitch sharpening factor for the next subframe - // MODE_4k75 only updates on the 2nd and 4th subframes - this follows from - // the fact that the gains for two subframes are jointly quantized. - if (mode != MODE_4k75 || subframe & 1) - p->beta = av_clipf(p->pitch_gain[4], 0.0, SHARP_MAX); -} -/// @} - - -/// @name AMR gain decoding functions -/// @{ - -/** - * fixed gain smoothing - * Note that where the spec specifies the "spectrum in the q domain" - * in section 6.1.4, in fact frequencies should be used. - * - * @param p the context - * @param lsf LSFs for the current subframe, in the range [0,1] - * @param lsf_avg averaged LSFs - * @param mode mode of the current frame - * - * @return fixed gain smoothed - */ -static float fixed_gain_smooth(AMRContext *p , const float *lsf, - const float *lsf_avg, const enum Mode mode) -{ - float diff = 0.0; - int i; - - for (i = 0; i < LP_FILTER_ORDER; i++) - diff += fabs(lsf_avg[i] - lsf[i]) / lsf_avg[i]; - - // If diff is large for ten subframes, disable smoothing for a 40-subframe - // hangover period. - p->diff_count++; - if (diff <= 0.65) - p->diff_count = 0; - - if (p->diff_count > 10) { - p->hang_count = 0; - p->diff_count--; // don't let diff_count overflow - } - - if (p->hang_count < 40) { - p->hang_count++; - } else if (mode < MODE_7k4 || mode == MODE_10k2) { - const float smoothing_factor = av_clipf(4.0 * diff - 1.6, 0.0, 1.0); - const float fixed_gain_mean = (p->fixed_gain[0] + p->fixed_gain[1] + - p->fixed_gain[2] + p->fixed_gain[3] + - p->fixed_gain[4]) * 0.2; - return smoothing_factor * p->fixed_gain[4] + - (1.0 - smoothing_factor) * fixed_gain_mean; - } - return p->fixed_gain[4]; -} - -/** - * Decode pitch gain and fixed gain factor (part of section 6.1.3). - * - * @param p the context - * @param amr_subframe unpacked amr subframe - * @param mode mode of the current frame - * @param subframe current subframe number - * @param fixed_gain_factor decoded gain correction factor - */ -static void decode_gains(AMRContext *p, const AMRNBSubframe *amr_subframe, - const enum Mode mode, const int subframe, - float *fixed_gain_factor) -{ - if (mode == MODE_12k2 || mode == MODE_7k95) { - p->pitch_gain[4] = qua_gain_pit [amr_subframe->p_gain ] - * (1.0 / 16384.0); - *fixed_gain_factor = qua_gain_code[amr_subframe->fixed_gain] - * (1.0 / 2048.0); - } else { - const uint16_t *gains; - - if (mode >= MODE_6k7) { - gains = gains_high[amr_subframe->p_gain]; - } else if (mode >= MODE_5k15) { - gains = gains_low [amr_subframe->p_gain]; - } else { - // gain index is only coded in subframes 0,2 for MODE_4k75 - gains = gains_MODE_4k75[(p->frame.subframe[subframe & 2].p_gain << 1) + (subframe & 1)]; - } - - p->pitch_gain[4] = gains[0] * (1.0 / 16384.0); - *fixed_gain_factor = gains[1] * (1.0 / 4096.0); - } -} - -/// @} - - -/// @name AMR preprocessing functions -/// @{ - -/** - * Circularly convolve a sparse fixed vector with a phase dispersion impulse - * response filter (D.6.2 of G.729 and 6.1.5 of AMR). - * - * @param out vector with filter applied - * @param in source vector - * @param filter phase filter coefficients - * - * out[n] = sum(i,0,len-1){ in[i] * filter[(len + n - i)%len] } - */ -static void apply_ir_filter(float *out, const AMRFixed *in, - const float *filter) -{ - float filter1[AMR_SUBFRAME_SIZE], ///< filters at pitch lag*1 and *2 - filter2[AMR_SUBFRAME_SIZE]; - int lag = in->pitch_lag; - float fac = in->pitch_fac; - int i; - - if (lag < AMR_SUBFRAME_SIZE) { - ff_celp_circ_addf(filter1, filter, filter, lag, fac, - AMR_SUBFRAME_SIZE); - - if (lag < AMR_SUBFRAME_SIZE >> 1) - ff_celp_circ_addf(filter2, filter, filter1, lag, fac, - AMR_SUBFRAME_SIZE); - } - - memset(out, 0, sizeof(float) * AMR_SUBFRAME_SIZE); - for (i = 0; i < in->n; i++) { - int x = in->x[i]; - float y = in->y[i]; - const float *filterp; - - if (x >= AMR_SUBFRAME_SIZE - lag) { - filterp = filter; - } else if (x >= AMR_SUBFRAME_SIZE - (lag << 1)) { - filterp = filter1; - } else - filterp = filter2; - - ff_celp_circ_addf(out, out, filterp, x, y, AMR_SUBFRAME_SIZE); - } -} - -/** - * Reduce fixed vector sparseness by smoothing with one of three IR filters. - * Also know as "adaptive phase dispersion". - * - * This implements 3GPP TS 26.090 section 6.1(5). - * - * @param p the context - * @param fixed_sparse algebraic codebook vector - * @param fixed_vector unfiltered fixed vector - * @param fixed_gain smoothed gain - * @param out space for modified vector if necessary - */ -static const float *anti_sparseness(AMRContext *p, AMRFixed *fixed_sparse, - const float *fixed_vector, - float fixed_gain, float *out) -{ - int ir_filter_nr; - - if (p->pitch_gain[4] < 0.6) { - ir_filter_nr = 0; // strong filtering - } else if (p->pitch_gain[4] < 0.9) { - ir_filter_nr = 1; // medium filtering - } else - ir_filter_nr = 2; // no filtering - - // detect 'onset' - if (fixed_gain > 2.0 * p->prev_sparse_fixed_gain) { - p->ir_filter_onset = 2; - } else if (p->ir_filter_onset) - p->ir_filter_onset--; - - if (!p->ir_filter_onset) { - int i, count = 0; - - for (i = 0; i < 5; i++) - if (p->pitch_gain[i] < 0.6) - count++; - if (count > 2) - ir_filter_nr = 0; - - if (ir_filter_nr > p->prev_ir_filter_nr + 1) - ir_filter_nr--; - } else if (ir_filter_nr < 2) - ir_filter_nr++; - - // Disable filtering for very low level of fixed_gain. - // Note this step is not specified in the technical description but is in - // the reference source in the function Ph_disp. - if (fixed_gain < 5.0) - ir_filter_nr = 2; - - if (p->cur_frame_mode != MODE_7k4 && p->cur_frame_mode < MODE_10k2 - && ir_filter_nr < 2) { - apply_ir_filter(out, fixed_sparse, - (p->cur_frame_mode == MODE_7k95 ? - ir_filters_lookup_MODE_7k95 : - ir_filters_lookup)[ir_filter_nr]); - fixed_vector = out; - } - - // update ir filter strength history - p->prev_ir_filter_nr = ir_filter_nr; - p->prev_sparse_fixed_gain = fixed_gain; - - return fixed_vector; -} - -/// @} - - -/// @name AMR synthesis functions -/// @{ - -/** - * Conduct 10th order linear predictive coding synthesis. - * - * @param p pointer to the AMRContext - * @param lpc pointer to the LPC coefficients - * @param fixed_gain fixed codebook gain for synthesis - * @param fixed_vector algebraic codebook vector - * @param samples pointer to the output speech samples - * @param overflow 16-bit overflow flag - */ -static int synthesis(AMRContext *p, float *lpc, - float fixed_gain, const float *fixed_vector, - float *samples, uint8_t overflow) -{ - int i; - float excitation[AMR_SUBFRAME_SIZE]; - - // if an overflow has been detected, the pitch vector is scaled down by a - // factor of 4 - if (overflow) - for (i = 0; i < AMR_SUBFRAME_SIZE; i++) - p->pitch_vector[i] *= 0.25; - - p->acelpv_ctx.weighted_vector_sumf(excitation, p->pitch_vector, fixed_vector, - p->pitch_gain[4], fixed_gain, AMR_SUBFRAME_SIZE); - - // emphasize pitch vector contribution - if (p->pitch_gain[4] > 0.5 && !overflow) { - float energy = p->celpm_ctx.dot_productf(excitation, excitation, - AMR_SUBFRAME_SIZE); - float pitch_factor = - p->pitch_gain[4] * - (p->cur_frame_mode == MODE_12k2 ? - 0.25 * FFMIN(p->pitch_gain[4], 1.0) : - 0.5 * FFMIN(p->pitch_gain[4], SHARP_MAX)); - - for (i = 0; i < AMR_SUBFRAME_SIZE; i++) - excitation[i] += pitch_factor * p->pitch_vector[i]; - - ff_scale_vector_to_given_sum_of_squares(excitation, excitation, energy, - AMR_SUBFRAME_SIZE); - } - - p->celpf_ctx.celp_lp_synthesis_filterf(samples, lpc, excitation, - AMR_SUBFRAME_SIZE, - LP_FILTER_ORDER); - - // detect overflow - for (i = 0; i < AMR_SUBFRAME_SIZE; i++) - if (fabsf(samples[i]) > AMR_SAMPLE_BOUND) { - return 1; - } - - return 0; -} - -/// @} - - -/// @name AMR update functions -/// @{ - -/** - * Update buffers and history at the end of decoding a subframe. - * - * @param p pointer to the AMRContext - */ -static void update_state(AMRContext *p) -{ - memcpy(p->prev_lsp_sub4, p->lsp[3], LP_FILTER_ORDER * sizeof(p->lsp[3][0])); - - memmove(&p->excitation_buf[0], &p->excitation_buf[AMR_SUBFRAME_SIZE], - (PITCH_DELAY_MAX + LP_FILTER_ORDER + 1) * sizeof(float)); - - memmove(&p->pitch_gain[0], &p->pitch_gain[1], 4 * sizeof(float)); - memmove(&p->fixed_gain[0], &p->fixed_gain[1], 4 * sizeof(float)); - - memmove(&p->samples_in[0], &p->samples_in[AMR_SUBFRAME_SIZE], - LP_FILTER_ORDER * sizeof(float)); -} - -/// @} - - -/// @name AMR Postprocessing functions -/// @{ - -/** - * Get the tilt factor of a formant filter from its transfer function - * - * @param p The Context - * @param lpc_n LP_FILTER_ORDER coefficients of the numerator - * @param lpc_d LP_FILTER_ORDER coefficients of the denominator - */ -static float tilt_factor(AMRContext *p, float *lpc_n, float *lpc_d) -{ - float rh0, rh1; // autocorrelation at lag 0 and 1 - - // LP_FILTER_ORDER prior zeros are needed for ff_celp_lp_synthesis_filterf - float impulse_buffer[LP_FILTER_ORDER + AMR_TILT_RESPONSE] = { 0 }; - float *hf = impulse_buffer + LP_FILTER_ORDER; // start of impulse response - - hf[0] = 1.0; - memcpy(hf + 1, lpc_n, sizeof(float) * LP_FILTER_ORDER); - p->celpf_ctx.celp_lp_synthesis_filterf(hf, lpc_d, hf, - AMR_TILT_RESPONSE, - LP_FILTER_ORDER); - - rh0 = p->celpm_ctx.dot_productf(hf, hf, AMR_TILT_RESPONSE); - rh1 = p->celpm_ctx.dot_productf(hf, hf + 1, AMR_TILT_RESPONSE - 1); - - // The spec only specifies this check for 12.2 and 10.2 kbit/s - // modes. But in the ref source the tilt is always non-negative. - return rh1 >= 0.0 ? rh1 / rh0 * AMR_TILT_GAMMA_T : 0.0; -} - -/** - * Perform adaptive post-filtering to enhance the quality of the speech. - * See section 6.2.1. - * - * @param p pointer to the AMRContext - * @param lpc interpolated LP coefficients for this subframe - * @param buf_out output of the filter - */ -static void postfilter(AMRContext *p, float *lpc, float *buf_out) -{ - int i; - float *samples = p->samples_in + LP_FILTER_ORDER; // Start of input - - float speech_gain = p->celpm_ctx.dot_productf(samples, samples, - AMR_SUBFRAME_SIZE); - - float pole_out[AMR_SUBFRAME_SIZE + LP_FILTER_ORDER]; // Output of pole filter - const float *gamma_n, *gamma_d; // Formant filter factor table - float lpc_n[LP_FILTER_ORDER], lpc_d[LP_FILTER_ORDER]; // Transfer function coefficients - - if (p->cur_frame_mode == MODE_12k2 || p->cur_frame_mode == MODE_10k2) { - gamma_n = ff_pow_0_7; - gamma_d = ff_pow_0_75; - } else { - gamma_n = ff_pow_0_55; - gamma_d = ff_pow_0_7; - } - - for (i = 0; i < LP_FILTER_ORDER; i++) { - lpc_n[i] = lpc[i] * gamma_n[i]; - lpc_d[i] = lpc[i] * gamma_d[i]; - } - - memcpy(pole_out, p->postfilter_mem, sizeof(float) * LP_FILTER_ORDER); - p->celpf_ctx.celp_lp_synthesis_filterf(pole_out + LP_FILTER_ORDER, lpc_d, samples, - AMR_SUBFRAME_SIZE, LP_FILTER_ORDER); - memcpy(p->postfilter_mem, pole_out + AMR_SUBFRAME_SIZE, - sizeof(float) * LP_FILTER_ORDER); - - p->celpf_ctx.celp_lp_zero_synthesis_filterf(buf_out, lpc_n, - pole_out + LP_FILTER_ORDER, - AMR_SUBFRAME_SIZE, LP_FILTER_ORDER); - - ff_tilt_compensation(&p->tilt_mem, tilt_factor(p, lpc_n, lpc_d), buf_out, - AMR_SUBFRAME_SIZE); - - ff_adaptive_gain_control(buf_out, buf_out, speech_gain, AMR_SUBFRAME_SIZE, - AMR_AGC_ALPHA, &p->postfilter_agc); -} - -/// @} - -static int amrnb_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - - AMRContext *p = avctx->priv_data; // pointer to private data - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - float *buf_out; // pointer to the output data buffer - int i, subframe, ret; - float fixed_gain_factor; - AMRFixed fixed_sparse = {0}; // fixed vector up to anti-sparseness processing - float spare_vector[AMR_SUBFRAME_SIZE]; // extra stack space to hold result from anti-sparseness processing - float synth_fixed_gain; // the fixed gain that synthesis should use - const float *synth_fixed_vector; // pointer to the fixed vector that synthesis should use - - /* get output buffer */ - frame->nb_samples = AMR_BLOCK_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - buf_out = (float *)frame->data[0]; - - p->cur_frame_mode = unpack_bitstream(p, buf, buf_size); - if (p->cur_frame_mode == NO_DATA) { - av_log(avctx, AV_LOG_ERROR, "Corrupt bitstream\n"); - return AVERROR_INVALIDDATA; - } - if (p->cur_frame_mode == MODE_DTX) { - avpriv_report_missing_feature(avctx, "dtx mode"); - av_log(avctx, AV_LOG_INFO, "Note: libopencore_amrnb supports dtx\n"); - return AVERROR_PATCHWELCOME; - } - - if (p->cur_frame_mode == MODE_12k2) { - lsf2lsp_5(p); - } else - lsf2lsp_3(p); - - for (i = 0; i < 4; i++) - ff_acelp_lspd2lpc(p->lsp[i], p->lpc[i], 5); - - for (subframe = 0; subframe < 4; subframe++) { - const AMRNBSubframe *amr_subframe = &p->frame.subframe[subframe]; - - decode_pitch_vector(p, amr_subframe, subframe); - - decode_fixed_sparse(&fixed_sparse, amr_subframe->pulses, - p->cur_frame_mode, subframe); - - // The fixed gain (section 6.1.3) depends on the fixed vector - // (section 6.1.2), but the fixed vector calculation uses - // pitch sharpening based on the on the pitch gain (section 6.1.3). - // So the correct order is: pitch gain, pitch sharpening, fixed gain. - decode_gains(p, amr_subframe, p->cur_frame_mode, subframe, - &fixed_gain_factor); - - pitch_sharpening(p, subframe, p->cur_frame_mode, &fixed_sparse); - - if (fixed_sparse.pitch_lag == 0) { - av_log(avctx, AV_LOG_ERROR, "The file is corrupted, pitch_lag = 0 is not allowed\n"); - return AVERROR_INVALIDDATA; - } - ff_set_fixed_vector(p->fixed_vector, &fixed_sparse, 1.0, - AMR_SUBFRAME_SIZE); - - p->fixed_gain[4] = - ff_amr_set_fixed_gain(fixed_gain_factor, - p->celpm_ctx.dot_productf(p->fixed_vector, - p->fixed_vector, - AMR_SUBFRAME_SIZE) / - AMR_SUBFRAME_SIZE, - p->prediction_error, - energy_mean[p->cur_frame_mode], energy_pred_fac); - - // The excitation feedback is calculated without any processing such - // as fixed gain smoothing. This isn't mentioned in the specification. - for (i = 0; i < AMR_SUBFRAME_SIZE; i++) - p->excitation[i] *= p->pitch_gain[4]; - ff_set_fixed_vector(p->excitation, &fixed_sparse, p->fixed_gain[4], - AMR_SUBFRAME_SIZE); - - // In the ref decoder, excitation is stored with no fractional bits. - // This step prevents buzz in silent periods. The ref encoder can - // emit long sequences with pitch factor greater than one. This - // creates unwanted feedback if the excitation vector is nonzero. - // (e.g. test sequence T19_795.COD in 3GPP TS 26.074) - for (i = 0; i < AMR_SUBFRAME_SIZE; i++) - p->excitation[i] = truncf(p->excitation[i]); - - // Smooth fixed gain. - // The specification is ambiguous, but in the reference source, the - // smoothed value is NOT fed back into later fixed gain smoothing. - synth_fixed_gain = fixed_gain_smooth(p, p->lsf_q[subframe], - p->lsf_avg, p->cur_frame_mode); - - synth_fixed_vector = anti_sparseness(p, &fixed_sparse, p->fixed_vector, - synth_fixed_gain, spare_vector); - - if (synthesis(p, p->lpc[subframe], synth_fixed_gain, - synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 0)) - // overflow detected -> rerun synthesis scaling pitch vector down - // by a factor of 4, skipping pitch vector contribution emphasis - // and adaptive gain control - synthesis(p, p->lpc[subframe], synth_fixed_gain, - synth_fixed_vector, &p->samples_in[LP_FILTER_ORDER], 1); - - postfilter(p, p->lpc[subframe], buf_out + subframe * AMR_SUBFRAME_SIZE); - - // update buffers and history - ff_clear_fixed_vector(p->fixed_vector, &fixed_sparse, AMR_SUBFRAME_SIZE); - update_state(p); - } - - p->acelpf_ctx.acelp_apply_order_2_transfer_function(buf_out, - buf_out, highpass_zeros, - highpass_poles, - highpass_gain * AMR_SAMPLE_SCALE, - p->high_pass_mem, AMR_BLOCK_SIZE); - - /* Update averaged lsf vector (used for fixed gain smoothing). - * - * Note that lsf_avg should not incorporate the current frame's LSFs - * for fixed_gain_smooth. - * The specification has an incorrect formula: the reference decoder uses - * qbar(n-1) rather than qbar(n) in section 6.1(4) equation 71. */ - p->acelpv_ctx.weighted_vector_sumf(p->lsf_avg, p->lsf_avg, p->lsf_q[3], - 0.84, 0.16, LP_FILTER_ORDER); - - *got_frame_ptr = 1; - - /* return the amount of bytes consumed if everything was OK */ - return frame_sizes_nb[p->cur_frame_mode] + 1; // +7 for rounding and +8 for TOC -} - - -AVCodec ff_amrnb_decoder = { - .name = "amrnb", - .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_AMR_NB, - .priv_data_size = sizeof(AMRContext), - .init = amrnb_decode_init, - .decode = amrnb_decode_frame, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdata.h deleted file mode 100644 index 8390582b0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdata.h +++ /dev/null @@ -1,1890 +0,0 @@ -/* - * AMR wideband data and definitions - * Copyright (c) 2010 Marcelo Galvao Povoa - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AMR wideband data and definitions - */ - -#ifndef AVCODEC_AMRWBDATA_H -#define AVCODEC_AMRWBDATA_H - -#include -#include - -#define LP_ORDER 16 ///< linear predictive coding filter order -#define LP_ORDER_16k 20 ///< lpc filter order at 16kHz -#define HB_FIR_SIZE 30 ///< amount of past data needed by HB filters -#define UPS_FIR_SIZE 12 ///< upsampling filter size -#define UPS_MEM_SIZE (2 * UPS_FIR_SIZE) - -#define MIN_ISF_SPACING (128.0 / 32768.0) ///< minimum isf gap -#define PRED_FACTOR (1.0 / 3.0) -#define MIN_ENERGY -14.0 ///< initial innnovation energy (dB) -#define ENERGY_MEAN 30.0 ///< mean innovation energy (dB) in all modes -#define PREEMPH_FAC 0.68 ///< factor used to de-emphasize synthesis - -#define AMRWB_SFR_SIZE 64 ///< samples per subframe at 12.8 kHz -#define AMRWB_SFR_SIZE_16k 80 ///< samples per subframe at 16 kHz -#define AMRWB_P_DELAY_MAX 231 ///< maximum pitch delay value -#define AMRWB_P_DELAY_MIN 34 - -/* Relative mode ordering is sensitive */ -enum Mode { - MODE_6k60 = 0, ///< 6.60 kbit/s - MODE_8k85, ///< 8.85 kbit/s - MODE_12k65, ///< 12.65 kbit/s - MODE_14k25, ///< 14.25 kbit/s - MODE_15k85, ///< 15.85 kbit/s - MODE_18k25, ///< 18.25 kbit/s - MODE_19k85, ///< 19.85 kbit/s - MODE_23k05, ///< 23.05 kbit/s - MODE_23k85, ///< 23.85 kbit/s - MODE_SID, ///< comfort noise frame - /* 10-13: Future use */ - SP_LOST = 14, ///< speech lost - NO_DATA ///< no transmission -}; - -/* All decoded parameters in these structs must be 2 bytes long - * because of the direct indexing at the frame parsing */ -typedef struct AMRWBSubFrame { - uint16_t adap; ///< adaptive codebook index - uint16_t ltp; ///< ltp-filtering flag - uint16_t vq_gain; ///< VQ adaptive and innovative gains - uint16_t hb_gain; ///< high-band energy index (mode 23k85 only) - uint16_t pul_ih[4]; ///< MSBs part of codebook index (high modes only) - uint16_t pul_il[4]; ///< LSBs part of codebook index -} AMRWBSubFrame; - -typedef struct AMRWBFrame { - uint16_t vad; ///< voice activity detection flag - uint16_t isp_id[7]; ///< index of ISP subvectors - AMRWBSubFrame subframe[4]; ///< data for subframes -} AMRWBFrame; - -/** The index of a frame parameter */ -#define AMR_BIT(field) (offsetof(AMRWBFrame, field)) -/** The index of a subframe-specific parameter */ -#define AMR_OF(frame_num, variable) AMR_BIT(subframe[frame_num].variable) - -//As defined in 3GPP TS 26.201 V9.0.0 -//Tables for bit parsing in Core Frame speech frames -//The reordered bits are in order of decreasing importance and -//may be contiguously separated in Class A, B and C bits. - -// Each field in AMRWBFrame is stored as: -// * one byte for the number of bits in the field -// * one byte for the field index -// * then, one byte for each bit of the field (from most-significant to least) -// of the position of that bit in the AMR frame. -static const uint16_t order_MODE_6k60[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 24, 33, 39, 12, 6, 5, 4, 13, - 8, AMR_BIT(isp_id[1]), 65, 79, 64, 78, 51, 61, 71, 70, - 7, AMR_BIT(isp_id[2]), 52, 55, 44, 54, 53, 43, 42, - 7, AMR_BIT(isp_id[3]), 60, 59, 58, 57, 56, 75, 74, - 6, AMR_BIT(isp_id[4]), 73, 72, 86, 87, 85, 84, - 8, AMR_OF(0, adap), 11, 10, 9, 8, 28, 27, 49, 69, - 6, AMR_OF(0, pul_il[0]), 83, 91, 99, 107, 115, 123, - 6, AMR_OF(0, pul_il[1]), 82, 103, 111, 119, 127, 135, - 6, AMR_OF(0, vq_gain), 38, 23, 34, 19, 3, 15, - 5, AMR_OF(1, adap), 32, 41, 63, 67, 77, - 6, AMR_OF(1, pul_il[0]), 81, 90, 98, 106, 114, 122, - 6, AMR_OF(1, pul_il[1]), 80, 102, 110, 118, 126, 134, - 6, AMR_OF(1, vq_gain), 26, 22, 36, 18, 2, 14, - 5, AMR_OF(2, adap), 45, 40, 50, 48, 68, - 6, AMR_OF(2, pul_il[0]), 95, 89, 97, 105, 113, 121, - 6, AMR_OF(2, pul_il[1]), 94, 101, 109, 117, 125, 133, - 6, AMR_OF(2, vq_gain), 37, 21, 35, 17, 1, 31, - 5, AMR_OF(3, adap), 47, 46, 62, 66, 76, - 6, AMR_OF(3, pul_il[0]), 93, 88, 96, 104, 112, 120, - 6, AMR_OF(3, pul_il[1]), 92, 100, 108, 116, 124, 132, - 6, AMR_OF(3, vq_gain), 25, 20, 29, 16, 0, 30, - 0 -}; - -static const uint16_t order_MODE_8k85[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 47, 32, 2, 6, 3, 5, 4, 60, - 8, AMR_BIT(isp_id[1]), 69, 50, 67, 41, 51, 49, 59, 53, - 6, AMR_BIT(isp_id[2]), 40, 55, 43, 54, 42, 62, - 7, AMR_BIT(isp_id[3]), 63, 48, 52, 61, 77, 78, 72, - 7, AMR_BIT(isp_id[4]), 85, 56, 86, 68, 74, 73, 81, - 5, AMR_BIT(isp_id[5]), 82, 95, 80, 94, 91, - 5, AMR_BIT(isp_id[6]), 90, 89, 88, 103, 87, - 8, AMR_OF(0, adap), 1, 0, 15, 35, 33, 58, 64, 84, - 5, AMR_OF(0, pul_il[0]), 102, 118, 134, 150, 166, - 5, AMR_OF(0, pul_il[1]), 101, 114, 130, 146, 162, - 5, AMR_OF(0, pul_il[2]), 100, 126, 142, 158, 174, - 5, AMR_OF(0, pul_il[3]), 99, 122, 138, 154, 170, - 6, AMR_OF(0, vq_gain), 11, 39, 19, 31, 27, 23, - 5, AMR_OF(1, adap), 46, 71, 66, 76, 93, - 5, AMR_OF(1, pul_il[0]), 98, 117, 133, 149, 165, - 5, AMR_OF(1, pul_il[1]), 97, 113, 129, 145, 161, - 5, AMR_OF(1, pul_il[2]), 96, 125, 141, 157, 173, - 5, AMR_OF(1, pul_il[3]), 111, 121, 137, 153, 169, - 6, AMR_OF(1, vq_gain), 10, 38, 18, 30, 26, 22, - 8, AMR_OF(2, adap), 14, 13, 12, 34, 45, 57, 79, 83, - 5, AMR_OF(2, pul_il[0]), 110, 116, 132, 148, 164, - 5, AMR_OF(2, pul_il[1]), 109, 112, 128, 144, 160, - 5, AMR_OF(2, pul_il[2]), 108, 124, 140, 156, 172, - 5, AMR_OF(2, pul_il[3]), 107, 120, 136, 152, 168, - 6, AMR_OF(2, vq_gain), 9, 37, 17, 29, 25, 21, - 5, AMR_OF(3, adap), 44, 70, 65, 75, 92, - 5, AMR_OF(3, pul_il[0]), 106, 115, 131, 147, 163, - 5, AMR_OF(3, pul_il[1]), 105, 127, 143, 159, 175, - 5, AMR_OF(3, pul_il[2]), 104, 123, 139, 155, 171, - 5, AMR_OF(3, pul_il[3]), 119, 135, 151, 167, 183, - 6, AMR_OF(3, vq_gain), 8, 36, 16, 28, 24, 20, - 0 -}; - -static const uint16_t order_MODE_12k65[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 9, AMR_OF(0, pul_il[0]), 106, 122, 154, 186, 218, 134, 166, 198, - 230, - 9, AMR_OF(0, pul_il[1]), 105, 130, 162, 194, 226, 142, 174, 206, - 238, - 9, AMR_OF(0, pul_il[2]), 104, 138, 170, 202, 234, 150, 182, 214, - 246, - 9, AMR_OF(0, pul_il[3]), 119, 146, 178, 210, 242, 158, 190, 222, - 254, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 9, AMR_OF(1, pul_il[0]), 118, 121, 153, 185, 217, 133, 165, 197, - 229, - 9, AMR_OF(1, pul_il[1]), 117, 129, 161, 193, 225, 141, 173, 205, - 237, - 9, AMR_OF(1, pul_il[2]), 116, 137, 169, 201, 233, 149, 181, 213, - 245, - 9, AMR_OF(1, pul_il[3]), 115, 145, 177, 209, 241, 157, 189, 221, - 253, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 9, AMR_OF(2, pul_il[0]), 114, 120, 152, 184, 216, 132, 164, 196, - 228, - 9, AMR_OF(2, pul_il[1]), 113, 128, 160, 192, 224, 140, 172, 204, - 236, - 9, AMR_OF(2, pul_il[2]), 112, 136, 168, 200, 232, 148, 180, 212, - 244, - 9, AMR_OF(2, pul_il[3]), 127, 144, 176, 208, 240, 156, 188, 220, - 252, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 9, AMR_OF(3, pul_il[0]), 126, 135, 167, 199, 231, 131, 163, 195, - 227, - 9, AMR_OF(3, pul_il[1]), 125, 143, 175, 207, 239, 139, 171, 203, - 235, - 9, AMR_OF(3, pul_il[2]), 124, 151, 183, 215, 247, 147, 179, 211, - 243, - 9, AMR_OF(3, pul_il[3]), 123, 159, 191, 223, 255, 155, 187, 219, - 251, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_14k25[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 13, AMR_OF(0, pul_il[0]), 114, 186, 210, 234, 258, 106, 126, 162, - 170, 198, 222, 246, 270, - 13, AMR_OF(0, pul_il[1]), 122, 194, 218, 242, 266, 118, 134, 174, - 182, 206, 230, 254, 278, - 9, AMR_OF(0, pul_il[2]), 130, 138, 146, 154, 178, 202, 226, 250, - 274, - 9, AMR_OF(0, pul_il[3]), 142, 150, 158, 166, 190, 214, 238, 262, - 286, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 13, AMR_OF(1, pul_il[0]), 113, 185, 209, 233, 257, 105, 125, 161, - 169, 197, 221, 245, 269, - 13, AMR_OF(1, pul_il[1]), 121, 193, 217, 241, 265, 117, 133, 173, - 181, 205, 229, 253, 277, - 9, AMR_OF(1, pul_il[2]), 129, 137, 145, 153, 177, 201, 225, 249, - 273, - 9, AMR_OF(1, pul_il[3]), 141, 149, 157, 165, 189, 213, 237, 261, - 285, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 13, AMR_OF(2, pul_il[0]), 112, 184, 208, 232, 256, 104, 124, 160, - 168, 196, 220, 244, 268, - 13, AMR_OF(2, pul_il[1]), 120, 192, 216, 240, 264, 116, 132, 172, - 180, 204, 228, 252, 276, - 9, AMR_OF(2, pul_il[2]), 128, 136, 144, 152, 176, 200, 224, 248, - 272, - 9, AMR_OF(2, pul_il[3]), 140, 148, 156, 164, 188, 212, 236, 260, - 284, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 13, AMR_OF(3, pul_il[0]), 127, 199, 223, 247, 271, 119, 123, 175, - 183, 195, 219, 243, 267, - 13, AMR_OF(3, pul_il[1]), 135, 207, 231, 255, 279, 115, 131, 171, - 179, 203, 227, 251, 275, - 9, AMR_OF(3, pul_il[2]), 143, 151, 159, 167, 191, 215, 239, 263, - 287, - 9, AMR_OF(3, pul_il[3]), 139, 147, 155, 163, 187, 211, 235, 259, - 283, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_15k85[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 13, AMR_OF(0, pul_il[0]), 122, 154, 170, 218, 266, 138, 106, 182, - 230, 278, 178, 226, 274, - 13, AMR_OF(0, pul_il[1]), 134, 166, 190, 238, 286, 150, 118, 186, - 234, 282, 198, 246, 294, - 13, AMR_OF(0, pul_il[2]), 130, 162, 194, 242, 290, 146, 114, 206, - 254, 302, 202, 250, 298, - 13, AMR_OF(0, pul_il[3]), 142, 174, 214, 262, 310, 158, 126, 210, - 258, 306, 222, 270, 318, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 13, AMR_OF(1, pul_il[0]), 121, 153, 169, 217, 265, 137, 105, 181, - 229, 277, 177, 225, 273, - 13, AMR_OF(1, pul_il[1]), 133, 165, 189, 237, 285, 149, 117, 185, - 233, 281, 197, 245, 293, - 13, AMR_OF(1, pul_il[2]), 129, 161, 193, 241, 289, 145, 113, 205, - 253, 301, 201, 249, 297, - 13, AMR_OF(1, pul_il[3]), 141, 173, 213, 261, 309, 157, 125, 209, - 257, 305, 221, 269, 317, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 13, AMR_OF(2, pul_il[0]), 120, 152, 168, 216, 264, 136, 104, 180, - 228, 276, 176, 224, 272, - 13, AMR_OF(2, pul_il[1]), 132, 164, 188, 236, 284, 148, 116, 184, - 232, 280, 196, 244, 292, - 13, AMR_OF(2, pul_il[2]), 128, 160, 192, 240, 288, 144, 112, 204, - 252, 300, 200, 248, 296, - 13, AMR_OF(2, pul_il[3]), 140, 172, 212, 260, 308, 156, 124, 208, - 256, 304, 220, 268, 316, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 13, AMR_OF(3, pul_il[0]), 135, 167, 183, 231, 279, 151, 119, 179, - 227, 275, 191, 239, 287, - 13, AMR_OF(3, pul_il[1]), 131, 163, 187, 235, 283, 147, 115, 199, - 247, 295, 195, 243, 291, - 13, AMR_OF(3, pul_il[2]), 143, 175, 207, 255, 303, 159, 127, 203, - 251, 299, 215, 263, 311, - 13, AMR_OF(3, pul_il[3]), 139, 171, 211, 259, 307, 155, 123, 223, - 271, 319, 219, 267, 315, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_18k25[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 2, AMR_OF(0, pul_ih[0]), 124, 115, - 2, AMR_OF(0, pul_ih[1]), 150, 117, - 2, AMR_OF(0, pul_ih[2]), 129, 114, - 2, AMR_OF(0, pul_ih[3]), 121, 131, - 14, AMR_OF(0, pul_il[0]), 161, 257, 343, 199, 177, 303, 204, 173, - 168, 260, 277, 307, 338, 128, - 14, AMR_OF(0, pul_il[1]), 194, 286, 347, 222, 214, 316, 236, 152, - 166, 242, 284, 308, 344, 142, - 14, AMR_OF(0, pul_il[2]), 169, 273, 353, 202, 189, 311, 240, 200, - 171, 261, 309, 296, 345, 130, - 14, AMR_OF(0, pul_il[3]), 198, 275, 349, 187, 163, 282, 193, 195, - 175, 234, 265, 289, 328, 119, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 2, AMR_OF(1, pul_ih[0]), 139, 104, - 2, AMR_OF(1, pul_ih[1]), 135, 118, - 2, AMR_OF(1, pul_ih[2]), 112, 127, - 2, AMR_OF(1, pul_ih[3]), 140, 141, - 14, AMR_OF(1, pul_il[0]), 179, 276, 340, 225, 223, 321, 235, 190, - 182, 271, 310, 315, 352, 125, - 14, AMR_OF(1, pul_il[1]), 153, 264, 329, 232, 209, 323, 231, 165, - 191, 279, 290, 312, 367, 134, - 14, AMR_OF(1, pul_il[2]), 167, 269, 341, 205, 197, 298, 224, 160, - 170, 259, 280, 317, 357, 148, - 14, AMR_OF(1, pul_il[3]), 203, 272, 342, 227, 192, 299, 233, 172, - 183, 256, 283, 326, 355, 106, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 2, AMR_OF(2, pul_ih[0]), 144, 120, - 2, AMR_OF(2, pul_ih[1]), 157, 123, - 2, AMR_OF(2, pul_ih[2]), 145, 138, - 2, AMR_OF(2, pul_ih[3]), 132, 154, - 14, AMR_OF(2, pul_il[0]), 241, 319, 365, 252, 253, 331, 254, 230, - 220, 263, 285, 314, 364, 156, - 14, AMR_OF(2, pul_il[1]), 247, 291, 339, 249, 250, 332, 267, 196, - 207, 268, 304, 324, 356, 158, - 14, AMR_OF(2, pul_il[2]), 210, 300, 348, 243, 237, 333, 246, 206, - 219, 266, 318, 335, 363, 159, - 14, AMR_OF(2, pul_il[3]), 239, 306, 366, 221, 226, 297, 251, 184, - 178, 258, 292, 305, 346, 116, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 2, AMR_OF(3, pul_ih[0]), 143, 126, - 2, AMR_OF(3, pul_ih[1]), 137, 122, - 2, AMR_OF(3, pul_ih[2]), 149, 105, - 2, AMR_OF(3, pul_ih[3]), 133, 136, - 14, AMR_OF(3, pul_il[0]), 162, 287, 337, 244, 229, 322, 218, 180, - 186, 262, 274, 288, 351, 146, - 14, AMR_OF(3, pul_il[1]), 212, 294, 358, 248, 228, 334, 215, 174, - 176, 270, 293, 301, 354, 147, - 14, AMR_OF(3, pul_il[2]), 185, 327, 336, 211, 213, 313, 245, 181, - 188, 255, 281, 325, 350, 151, - 14, AMR_OF(3, pul_il[3]), 201, 295, 359, 216, 208, 320, 238, 164, - 155, 217, 278, 302, 330, 113, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_19k85[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 10, AMR_OF(0, pul_ih[0]), 134, 153, 263, 342, 399, 154, 106, 177, - 317, 265, - 10, AMR_OF(0, pul_ih[1]), 128, 167, 270, 351, 385, 160, 105, 213, - 329, 259, - 2, AMR_OF(0, pul_ih[2]), 123, 147, - 2, AMR_OF(0, pul_ih[3]), 131, 143, - 10, AMR_OF(0, pul_il[0]), 346, 118, 170, 201, 296, 368, 250, 284, - 341, 391, - 10, AMR_OF(0, pul_il[1]), 345, 104, 166, 196, 281, 374, 242, 269, - 327, 390, - 14, AMR_OF(0, pul_il[2]), 141, 171, 291, 364, 229, 210, 308, 228, - 206, 200, 258, 295, 313, 361, - 14, AMR_OF(0, pul_il[3]), 144, 188, 282, 366, 217, 216, 309, 218, - 193, 182, 245, 287, 300, 367, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 10, AMR_OF(1, pul_ih[0]), 139, 169, 267, 348, 389, 163, 116, 189, - 343, 268, - 10, AMR_OF(1, pul_ih[1]), 120, 161, 249, 339, 397, 152, 114, 230, - 334, 303, - 2, AMR_OF(1, pul_ih[2]), 125, 138, - 2, AMR_OF(1, pul_ih[3]), 112, 129, - 10, AMR_OF(1, pul_il[0]), 349, 122, 162, 203, 288, 372, 278, 274, - 312, 377, - 10, AMR_OF(1, pul_il[1]), 357, 126, 165, 214, 298, 362, 252, 260, - 321, 378, - 14, AMR_OF(1, pul_il[2]), 150, 199, 266, 355, 211, 180, 285, 241, - 195, 198, 243, 275, 323, 375, - 14, AMR_OF(1, pul_il[3]), 142, 191, 256, 353, 208, 220, 314, 237, - 190, 212, 255, 304, 318, 371, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 10, AMR_OF(2, pul_ih[0]), 159, 168, 302, 356, 395, 178, 132, 185, - 330, 286, - 10, AMR_OF(2, pul_ih[1]), 158, 181, 292, 358, 396, 176, 133, 235, - 331, 276, - 2, AMR_OF(2, pul_ih[2]), 130, 157, - 2, AMR_OF(2, pul_ih[3]), 124, 136, - 10, AMR_OF(2, pul_il[0]), 354, 121, 194, 246, 322, 379, 272, 273, - 332, 398, - 10, AMR_OF(2, pul_il[1]), 359, 140, 186, 236, 333, 376, 290, 301, - 338, 387, - 14, AMR_OF(2, pul_il[2]), 155, 227, 319, 369, 253, 254, 350, 248, - 224, 239, 240, 293, 315, 383, - 14, AMR_OF(2, pul_il[3]), 156, 209, 297, 373, 225, 215, 326, 247, - 197, 184, 232, 289, 310, 365, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 10, AMR_OF(3, pul_ih[0]), 148, 164, 264, 340, 388, 183, 117, 205, - 336, 261, - 10, AMR_OF(3, pul_ih[1]), 146, 174, 257, 335, 384, 173, 113, 187, - 320, 279, - 2, AMR_OF(3, pul_ih[2]), 127, 151, - 2, AMR_OF(3, pul_ih[3]), 119, 137, - 10, AMR_OF(3, pul_il[0]), 352, 135, 172, 238, 306, 381, 262, 271, - 328, 382, - 10, AMR_OF(3, pul_il[1]), 347, 115, 179, 219, 305, 380, 277, 294, - 337, 386, - 14, AMR_OF(3, pul_il[2]), 145, 192, 307, 370, 234, 223, 324, 244, - 202, 204, 251, 299, 325, 360, - 14, AMR_OF(3, pul_il[3]), 149, 221, 311, 363, 226, 222, 316, 231, - 207, 175, 233, 280, 283, 344, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_23k05[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 77, 58, 75, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 85, 86, 80, - 7, AMR_BIT(isp_id[4]), 93, 64, 94, 76, 82, 81, 89, - 5, AMR_BIT(isp_id[5]), 90, 103, 88, 102, 99, - 5, AMR_BIT(isp_id[6]), 98, 97, 96, 111, 95, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 72, - 92, - 1, AMR_OF(0, ltp), 110, - 11, AMR_OF(0, pul_ih[0]), 118, 129, 131, 153, 170, 282, 298, 210, - 191, 357, 317, - 11, AMR_OF(0, pul_ih[1]), 126, 146, 135, 165, 187, 273, 345, 295, - 172, 338, 340, - 11, AMR_OF(0, pul_ih[2]), 119, 137, 141, 167, 208, 304, 366, 256, - 177, 339, 328, - 11, AMR_OF(0, pul_ih[3]), 116, 130, 120, 166, 190, 252, 311, 239, - 173, 343, 318, - 11, AMR_OF(0, pul_il[0]), 245, 180, 342, 424, 259, 277, 266, 380, - 398, 423, 440, - 11, AMR_OF(0, pul_il[1]), 218, 207, 367, 434, 201, 240, 275, 363, - 399, 419, 452, - 11, AMR_OF(0, pul_il[2]), 274, 188, 348, 425, 242, 204, 262, 365, - 402, 431, 463, - 11, AMR_OF(0, pul_il[3]), 221, 183, 337, 439, 243, 216, 251, 354, - 390, 411, 462, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 6, AMR_OF(1, adap), 35, 54, 79, 74, 84, 101, - 1, AMR_OF(1, ltp), 109, - 11, AMR_OF(1, pul_ih[0]), 115, 140, 142, 161, 230, 291, 351, 235, - 181, 293, 310, - 11, AMR_OF(1, pul_ih[1]), 104, 138, 132, 162, 211, 315, 347, 233, - 176, 320, 329, - 11, AMR_OF(1, pul_ih[2]), 106, 134, 125, 154, 205, 267, 306, 220, - 185, 330, 297, - 11, AMR_OF(1, pul_ih[3]), 105, 148, 122, 152, 215, 302, 350, 254, - 178, 319, 313, - 11, AMR_OF(1, pul_il[0]), 269, 189, 382, 432, 272, 228, 263, 383, - 406, 422, 453, - 11, AMR_OF(1, pul_il[1]), 286, 206, 377, 446, 226, 222, 265, 368, - 404, 416, 454, - 11, AMR_OF(1, pul_il[2]), 247, 195, 358, 445, 224, 236, 309, 341, - 375, 408, 449, - 11, AMR_OF(1, pul_il[3]), 225, 192, 359, 436, 250, 258, 290, 389, - 400, 420, 448, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 87, - 91, - 1, AMR_OF(2, ltp), 108, - 11, AMR_OF(2, pul_ih[0]), 139, 144, 145, 169, 234, 327, 395, 299, - 244, 356, 379, - 11, AMR_OF(2, pul_ih[1]), 127, 156, 158, 171, 231, 308, 397, 355, - 261, 371, 335, - 11, AMR_OF(2, pul_ih[2]), 123, 155, 157, 193, 241, 362, 384, 323, - 238, 392, 361, - 11, AMR_OF(2, pul_ih[3]), 114, 147, 121, 175, 196, 333, 373, 303, - 184, 353, 322, - 11, AMR_OF(2, pul_il[0]), 271, 203, 385, 442, 307, 276, 334, 405, - 412, 427, 459, - 11, AMR_OF(2, pul_il[1]), 278, 200, 388, 447, 292, 288, 296, 403, - 415, 429, 460, - 11, AMR_OF(2, pul_il[2]), 312, 214, 393, 433, 279, 301, 314, 391, - 410, 426, 450, - 11, AMR_OF(2, pul_il[3]), 280, 186, 376, 437, 268, 260, 255, 364, - 414, 417, 441, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 6, AMR_OF(3, adap), 34, 53, 78, 73, 83, 100, - 1, AMR_OF(3, ltp), 107, - 11, AMR_OF(3, pul_ih[0]), 112, 159, 143, 164, 213, 281, 332, 284, - 168, 344, 325, - 11, AMR_OF(3, pul_ih[1]), 113, 150, 149, 179, 199, 316, 324, 285, - 237, 360, 336, - 11, AMR_OF(3, pul_ih[2]), 124, 136, 151, 174, 209, 326, 349, 248, - 198, 374, 331, - 11, AMR_OF(3, pul_ih[3]), 117, 128, 133, 163, 202, 300, 372, 305, - 194, 387, 321, - 11, AMR_OF(3, pul_il[0]), 249, 182, 352, 428, 253, 264, 289, 413, - 407, 418, 461, - 11, AMR_OF(3, pul_il[1]), 287, 212, 369, 444, 223, 246, 217, 346, - 394, 401, 451, - 11, AMR_OF(3, pul_il[2]), 219, 197, 378, 435, 229, 257, 283, 396, - 409, 430, 455, - 11, AMR_OF(3, pul_il[3]), 232, 160, 370, 438, 227, 270, 294, 381, - 386, 421, 443, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 0 -}; - -static const uint16_t order_MODE_23k85[] = { - 1, AMR_BIT(vad), 7, - 8, AMR_BIT(isp_id[0]), 55, 40, 14, 6, 15, 5, 0, 68, - 8, AMR_BIT(isp_id[1]), 93, 58, 91, 49, 59, 57, 67, 61, - 6, AMR_BIT(isp_id[2]), 48, 63, 51, 62, 50, 70, - 7, AMR_BIT(isp_id[3]), 71, 56, 60, 69, 101, 102, 96, - 7, AMR_BIT(isp_id[4]), 109, 64, 110, 92, 98, 97, 105, - 5, AMR_BIT(isp_id[5]), 106, 119, 104, 118, 115, - 5, AMR_BIT(isp_id[6]), 114, 113, 112, 127, 111, - 9, AMR_OF(0, adap), 13, 12, 11, 10, 9, 41, 66, 88, - 108, - 1, AMR_OF(0, ltp), 126, - 11, AMR_OF(0, pul_ih[0]), 134, 145, 147, 169, 186, 298, 314, 226, - 207, 373, 333, - 11, AMR_OF(0, pul_ih[1]), 142, 162, 151, 181, 203, 289, 361, 311, - 188, 354, 356, - 11, AMR_OF(0, pul_ih[2]), 135, 153, 157, 183, 224, 320, 382, 272, - 193, 355, 344, - 11, AMR_OF(0, pul_ih[3]), 132, 146, 136, 182, 206, 268, 327, 255, - 189, 359, 334, - 11, AMR_OF(0, pul_il[0]), 261, 196, 358, 440, 275, 293, 282, 396, - 414, 439, 456, - 11, AMR_OF(0, pul_il[1]), 234, 223, 383, 450, 217, 256, 291, 379, - 415, 435, 468, - 11, AMR_OF(0, pul_il[2]), 290, 204, 364, 441, 258, 220, 278, 381, - 418, 447, 479, - 11, AMR_OF(0, pul_il[3]), 237, 199, 353, 455, 259, 232, 267, 370, - 406, 427, 478, - 7, AMR_OF(0, vq_gain), 4, 19, 45, 27, 39, 33, 31, - 4, AMR_OF(0, hb_gain), 79, 78, 77, 76, - 6, AMR_OF(1, adap), 35, 54, 95, 90, 100, 117, - 1, AMR_OF(1, ltp), 125, - 11, AMR_OF(1, pul_ih[0]), 131, 156, 158, 177, 246, 307, 367, 251, - 197, 309, 326, - 11, AMR_OF(1, pul_ih[1]), 120, 154, 148, 178, 227, 331, 363, 249, - 192, 336, 345, - 11, AMR_OF(1, pul_ih[2]), 122, 150, 141, 170, 221, 283, 322, 236, - 201, 346, 313, - 11, AMR_OF(1, pul_ih[3]), 121, 164, 138, 168, 231, 318, 366, 270, - 194, 335, 329, - 11, AMR_OF(1, pul_il[0]), 285, 205, 398, 448, 288, 244, 279, 399, - 422, 438, 469, - 11, AMR_OF(1, pul_il[1]), 302, 222, 393, 462, 242, 238, 281, 384, - 420, 432, 470, - 11, AMR_OF(1, pul_il[2]), 263, 211, 374, 461, 240, 252, 325, 357, - 391, 424, 465, - 11, AMR_OF(1, pul_il[3]), 241, 208, 375, 452, 266, 274, 306, 405, - 416, 436, 464, - 7, AMR_OF(1, vq_gain), 3, 18, 44, 26, 38, 32, 30, - 4, AMR_OF(1, hb_gain), 75, 74, 73, 72, - 9, AMR_OF(2, adap), 8, 23, 22, 21, 20, 52, 65, 103, - 107, - 1, AMR_OF(2, ltp), 124, - 11, AMR_OF(2, pul_ih[0]), 155, 160, 161, 185, 250, 343, 411, 315, - 260, 372, 395, - 11, AMR_OF(2, pul_ih[1]), 143, 172, 174, 187, 247, 324, 413, 371, - 277, 387, 351, - 11, AMR_OF(2, pul_ih[2]), 139, 171, 173, 209, 257, 378, 400, 339, - 254, 408, 377, - 11, AMR_OF(2, pul_ih[3]), 130, 163, 137, 191, 212, 349, 389, 319, - 200, 369, 338, - 11, AMR_OF(2, pul_il[0]), 287, 219, 401, 458, 323, 292, 350, 421, - 428, 443, 475, - 11, AMR_OF(2, pul_il[1]), 294, 216, 404, 463, 308, 304, 312, 419, - 431, 445, 476, - 11, AMR_OF(2, pul_il[2]), 328, 230, 409, 449, 295, 317, 330, 407, - 426, 442, 466, - 11, AMR_OF(2, pul_il[3]), 296, 202, 392, 453, 284, 276, 271, 380, - 430, 433, 457, - 7, AMR_OF(2, vq_gain), 2, 17, 43, 25, 37, 47, 29, - 4, AMR_OF(2, hb_gain), 87, 86, 85, 84, - 6, AMR_OF(3, adap), 34, 53, 94, 89, 99, 116, - 1, AMR_OF(3, ltp), 123, - 11, AMR_OF(3, pul_ih[0]), 128, 175, 159, 180, 229, 297, 348, 300, - 184, 360, 341, - 11, AMR_OF(3, pul_ih[1]), 129, 166, 165, 195, 215, 332, 340, 301, - 253, 376, 352, - 11, AMR_OF(3, pul_ih[2]), 140, 152, 167, 190, 225, 342, 365, 264, - 214, 390, 347, - 11, AMR_OF(3, pul_ih[3]), 133, 144, 149, 179, 218, 316, 388, 321, - 210, 403, 337, - 11, AMR_OF(3, pul_il[0]), 265, 198, 368, 444, 269, 280, 305, 429, - 423, 434, 477, - 11, AMR_OF(3, pul_il[1]), 303, 228, 385, 460, 239, 262, 233, 362, - 410, 417, 467, - 11, AMR_OF(3, pul_il[2]), 235, 213, 394, 451, 245, 273, 299, 412, - 425, 446, 471, - 11, AMR_OF(3, pul_il[3]), 248, 176, 386, 454, 243, 286, 310, 397, - 402, 437, 459, - 7, AMR_OF(3, vq_gain), 1, 16, 42, 24, 36, 46, 28, - 4, AMR_OF(3, hb_gain), 83, 82, 81, 80, - 0 -}; - -/** Reordering array addresses for each mode */ -static const uint16_t* amr_bit_orderings_by_mode[] = { - order_MODE_6k60, - order_MODE_8k85, - order_MODE_12k65, - order_MODE_14k25, - order_MODE_15k85, - order_MODE_18k25, - order_MODE_19k85, - order_MODE_23k05, - order_MODE_23k85 -}; - -// Extracted from 3GPP TS 26.173 V9.0.0 (qpisf_2s.tab) -// The *_36b tables are used in 6k60 mode -// Stored in fixed-point to save some space -/** Indexed tables for retrieval of quantized ISF vectors in Q15 */ -static const int16_t dico1_isf[256][9] = { - { 579, 1081, 1035, 390, 3, -263, -198, -82, 38}, - { 18, -68, -12, 313, 761, 405, 249, 111, -76}, - { 740, 1263, 1292, 1006, 997, 1019, 1017, 976, 923}, - { -91, 827, 948, 648, 613, 535, 522, 490, 421}, - { 41, -44, -281, -472, 652, 534, 193, 135, -90}, - { 41, -121, -356, -60, 663, 307, 61, -48, -344}, - { 557, 946, 1049, 867, 846, 990, 1112, 1262, 1241}, - { -118, -204, 328, 512, 870, 793, 610, 402, 186}, - { 156, 293, 74, -338, -475, -897, -594, -161, -497}, - { 226, 131, -138, 307, 169, -271, -164, -387, -624}, - { 62, -32, -61, -252, -541, -828, -1027, -523, -662}, - { 102, -61, 141, 112, -270, -251, -541, 25, -150}, - { 6, -132, -356, -686, -96, -322, -522, -31, -326}, - { -36, -209, -521, -229, 307, -132, -5, -99, -384}, - { 60, -51, -237, -668, -973, -407, -708, -75, -172}, - { 26, -138, -266, 111, -302, 43, -278, -356, -359}, - { 570, 822, 496, -154, -312, -92, 137, 279, 371}, - { -146, 368, 409, 68, 6, 77, 167, 202, 162}, - { 633, 898, 996, 756, 662, 683, 783, 909, 996}, - { -103, 294, 607, 415, 483, 462, 480, 431, 408}, - { -120, -338, -612, -524, 584, 331, 92, 433, 276}, - { -178, -293, -154, -41, 269, 100, -9, 213, 160}, - { 830, 736, 278, 820, 1254, 686, 712, 1039, 473}, - { -218, -304, 463, 454, 397, 273, 202, 286, 273}, - { -232, 7, 6, -388, -472, -427, -378, -167, -100}, - { -294, -183, 134, -47, 101, -88, -84, -117, -3}, - { 57, 17, -202, -634, -989, -1119, -533, 176, -36}, - { 120, -28, 23, 111, -319, 318, -22, -77, 266}, - { -271, -464, -434, -658, -640, -385, -385, -99, -69}, - { -198, -259, -266, -44, -39, -139, -137, 171, 66}, - { 9, -145, -377, -846, -1000, -111, -325, 342, 135}, - { -81, -286, -380, 192, -57, 307, 76, -24, -140}, - { 677, 702, 247, 56, 249, 141, -105, -236, -99}, - { 36, -39, -69, 348, 198, -93, 322, 91, -72}, - { 503, 885, 1508, 1307, 1282, 1172, 1119, 1209, 1061}, - { 416, 719, 989, 1227, 1001, 1052, 954, 741, 1044}, - { -127, -376, -657, 139, 623, 223, 501, 306, 220}, - { -113, -384, -796, 504, 438, 85, 213, -83, -194}, - { 585, 1132, 1233, 1091, 1247, 1433, 1512, 1448, 1314}, - { -174, -422, 7, 1155, 1089, 1182, 1003, 945, 806}, - { 8, -126, -317, -103, -351, -695, -98, -268, -537}, - { 33, -103, -290, 167, -39, -407, 44, -208, -375}, - { 104, -23, -64, -291, -637, -851, -1084, -61, -112}, - { -75, -306, -434, 218, -148, -354, -680, -133, -216}, - { -121, -377, -718, -97, -130, -361, -156, -379, -599}, - { -56, -254, -586, 235, 157, -214, 11, -260, -149}, - { -124, -267, -397, -580, -593, -527, -805, -385, 346}, - { -193, -440, -708, -351, -141, -255, -499, -147, -185}, - { 448, 660, 494, 208, 509, 461, 338, 291, 149}, - { -223, 88, 335, 159, 212, 191, 286, 308, 205}, - { -31, 469, 803, 659, 619, 658, 843, 987, 1113}, - { -171, -242, 514, 362, 295, 524, 552, 694, 585}, - { -64, -308, -448, -21, 284, 786, 446, 289, 92}, - { -218, -390, -7, 169, 206, 330, 352, 408, 358}, - { -36, 702, 959, 859, 861, 1115, 1269, 1357, 1305}, - { -133, -341, -65, 678, 417, 440, 486, 518, 780}, - { 33, -44, -191, -344, -461, -755, -201, 217, -31}, - { -353, -547, -44, 123, -61, -68, -79, 29, 60}, - { 73, -57, -406, -766, -1243, -1203, 240, 400, 165}, - { -73, -282, -601, -213, -171, -375, 332, 35, -103}, - { -29, -207, -553, -476, -638, -908, 172, -22, -135}, - { -192, -239, -164, -103, -111, -47, 153, 125, 110}, - { -1, -203, -570, -1030, -1424, -535, 155, 1, 147}, - { -333, -653, -865, -197, -158, -21, -44, 95, 108}, - { 389, 588, 490, 33, -237, -524, -628, -136, -260}, - { 40, -177, -462, 453, 862, 380, 131, -130, -405}, - { 842, 1678, 1841, 1549, 1474, 1256, 1082, 905, 742}, - { 370, 1216, 1768, 1633, 1212, 636, 22, -330, 71}, - { -76, -281, -741, -742, 898, 619, 277, 71, -222}, - { -32, -265, -556, -25, 994, 682, 305, 126, -165}, - { 73, 738, 893, 968, 993, 1768, 2273, 1840, 1391}, - { -69, -349, -585, 234, 1158, 903, 626, 510, 251}, - { -1, -99, -272, -210, -603, -351, -540, -811, -383}, - { -16, -230, -504, 410, 149, -205, -343, -651, -639}, - { 103, -9, -227, -205, -562, -781, -1079, -1208, -156}, - { 143, 63, -135, -67, -317, -602, -784, -1154, -640}, - { -144, -391, -674, -622, -200, -254, -660, -947, -395}, - { -40, -250, -625, 27, 543, 94, -131, -386, -673}, - { -123, -371, -757, -451, -564, -614, -415, -711, -35}, - { -116, -309, -593, -268, 239, -33, -338, -650, -135}, - { 94, 251, 554, 57, -312, -423, -154, -57, 235}, - { -268, -71, 381, 114, -44, -87, 125, 173, 133}, - { 1513, 1714, 1238, 534, 276, 315, 461, 459, 508}, - { -131, -19, 1149, 670, 486, 356, 309, 369, 296}, - { -223, -501, -899, -722, -70, 6, 131, 310, 394}, - { -99, -303, -517, 249, 64, -53, 135, -11, 453}, - { -147, -399, -730, -401, 817, 738, 802, 749, 575}, - { -154, -435, -739, 800, 593, 366, 529, 318, 326}, - { -224, 45, -39, -387, -515, -518, -608, -384, -321}, - { -315, -377, 143, -101, -113, -377, -177, -144, -12}, - { 117, 40, -239, -651, -1051, -581, -737, -990, -328}, - { 26, -50, -157, -23, -453, -283, -531, -546, 192}, - { -252, -501, -743, -589, -627, -499, -328, -118, -72}, - { -324, -494, -244, -306, -144, -177, -262, -135, -78}, - { -36, -234, -519, -961, -1290, -314, -479, -371, -45}, - { -95, -292, -535, -8, -300, 112, -164, -277, 198}, - { -99, -128, 880, 836, 579, 351, 23, -95, -217}, - { -27, -258, 124, 1011, 597, 425, 144, 7, -73}, - { 421, 1293, 1640, 1623, 1742, 1617, 1499, 1284, 1006}, - { -95, 752, 1680, 1569, 1618, 1436, 1200, 980, 712}, - { -69, -300, -683, -435, 1132, 899, 504, 332, 109}, - { -74, -323, -637, 563, 1074, 608, 371, 105, -49}, - { -78, 831, 1194, 1110, 1378, 1481, 1492, 1365, 1217}, - { -259, -121, 1440, 1334, 1628, 1490, 1438, 1223, 933}, - { -82, -306, -613, -222, -378, -675, -545, -671, -845}, - { 53, -124, -347, 422, 52, -125, -270, -529, 9}, - { 79, -89, -320, -662, -999, -1199, -1243, -676, -297}, - { -68, -273, -611, 137, -146, -397, -627, -845, -220}, - { -112, -346, -797, -826, 234, -132, -188, -278, -522}, - { -159, -405, -734, -419, 293, 74, -167, -167, 184}, - { -153, -437, -833, -1080, -336, -472, -561, -340, -253}, - { -169, -423, -820, -904, -131, -19, -346, -604, 31}, - { 33, -31, 312, 62, -148, 49, -59, 564, 486}, - { -306, -333, 194, -44, 67, 72, 147, 205, 243}, - { -207, -49, 1360, 983, 969, 991, 1014, 1110, 973}, - { -211, -172, 883, 627, 711, 674, 705, 798, 746}, - { -88, -325, -763, -974, 687, 908, 514, 382, 172}, - { -292, -612, -805, 63, 131, 270, 259, 352, 348}, - { -235, -84, 955, 818, 1120, 1289, 1559, 1480, 1285}, - { -180, -461, -614, 657, 691, 745, 854, 783, 713}, - { -97, -309, -477, -614, -777, -734, -768, -526, -472}, - { -344, -476, -35, -169, 49, -77, -150, -240, -141}, - { -52, -268, -639, -919, -1278, -1113, -342, -333, -151}, - { -68, -242, -585, -73, -209, -478, -159, -429, 133}, - { -197, -499, -1005, -1268, -272, -224, -105, -67, 17}, - { -363, -618, -414, -116, -62, 20, 10, 116, 108}, - { -195, -475, -906, -1260, -891, -441, -277, -142, -28}, - { -226, -519, -950, -700, -275, -266, -116, -105, 82}, - { 404, 511, 520, 327, 17, -194, -333, -536, -586}, - { -114, -130, 276, 237, 204, 342, 135, -16, -111}, - { 670, 1208, 1168, 860, 742, 601, 528, 403, 309}, - { 397, 621, 966, 752, 579, 398, 400, 329, 252}, - { 191, 180, -137, -467, 272, 106, -95, 17, -192}, - { -80, -290, -626, 194, 598, 196, 21, -281, 77}, - { 510, 864, 1108, 807, 939, 902, 925, 717, 481}, - { 137, 367, 534, 764, 670, 382, 296, 153, 84}, - { 303, 497, 144, -85, -125, -539, -482, -464, -764}, - { 233, 347, 68, -147, 169, -210, -242, -226, -482}, - { 307, 422, 154, -175, -386, -722, -724, -904, -1015}, - { 309, 308, 160, -60, -470, -420, -598, -791, -219}, - { 68, 121, -137, -560, -146, -446, -515, -494, -729}, - { 130, 53, -227, 46, 474, 32, -161, -192, -490}, - { 213, 164, -71, -465, -876, -161, -456, -587, -48}, - { 218, 117, 39, 177, -194, -88, -226, -418, 50}, - { 210, 547, 569, 279, 121, -44, -50, 10, -84}, - { 58, 140, 182, -5, 267, 117, 106, 211, 198}, - { 539, 835, 913, 719, 617, 544, 591, 565, 642}, - { 153, 559, 872, 460, 222, 108, 188, 180, 183}, - { 158, 119, 284, -153, -271, 229, 87, 110, -57}, - { -183, 82, 118, 21, 13, 40, 118, 191, 185}, - { 162, 889, 654, 108, -34, 244, 488, 561, 532}, - { 163, 56, 609, 341, 50, 329, 68, 266, 218}, - { 100, 206, 18, -304, -107, -436, -487, -65, -306}, - { -86, 154, 134, -30, -45, -73, -104, -80, -96}, - { 245, 330, 10, -440, -849, -1082, 79, 40, -265}, - { 196, 372, 272, -181, -493, -389, 275, 80, -59}, - { 2, -12, -246, -505, -100, -436, 21, -187, -431}, - { -221, -48, 36, -271, -186, -147, -109, 26, 71}, - { 213, 140, 72, -351, -620, -84, -363, 69, 46}, - { 91, 167, -3, -95, -99, -105, -48, 114, 147}, - { 259, 249, 172, 607, 406, 52, 59, -189, -320}, - { 115, -85, -54, 574, 128, 226, -59, -253, 130}, - { -62, 1033, 1308, 1035, 1127, 1098, 1029, 961, 823}, - { 39, 364, 757, 940, 728, 660, 659, 583, 770}, - { -115, -338, -760, -471, 394, 37, 441, 178, 6}, - { -57, -305, -525, 796, 453, 188, -4, -114, 248}, - { 71, 444, 797, 731, 1096, 1157, 1222, 1029, 811}, - { 135, 359, 551, 425, 749, 815, 874, 704, 502}, - { 132, 247, 0, -206, -449, -750, -258, -514, -633}, - { 248, 249, 91, 121, -195, -499, -90, -282, -435}, - { 78, 20, -277, -623, -983, -1224, -415, -458, -639}, - { 347, 509, 208, -179, -464, -728, -76, -237, -486}, - { -103, -343, -756, -713, -265, -609, -191, -398, -636}, - { -121, -383, -749, 567, 252, -36, -354, -417, -50}, - { 204, 100, -149, -650, -1081, -47, -7, -263, 111}, - { -46, -180, -267, -324, -562, -394, -692, 398, 292}, - { 482, 670, 683, 624, 442, 165, 116, 36, -149}, - { 108, 247, 291, 247, 355, 122, 109, 224, 296}, - { -14, 945, 990, 801, 755, 815, 847, 913, 892}, - { 292, 349, 725, 482, 388, 329, 429, 620, 667}, - { -34, 197, 213, -127, 84, 494, 620, 575, 375}, - { 126, 207, 172, 167, 362, 202, 296, 395, 455}, - { -6, 250, 539, 467, 636, 801, 1149, 1287, 1118}, - { 27, 240, 369, 280, 440, 411, 634, 892, 953}, - { 159, 170, -58, -395, -797, -690, 77, -211, -334}, - { -5, -28, -13, -74, -335, -603, 300, 88, -205}, - { 82, -33, -364, -698, -1203, -1153, 110, -146, -289}, - { 113, 1, -243, -588, -994, -496, 414, 160, 42}, - { -56, -247, -440, -693, -996, -479, 11, -178, -357}, - { -151, -353, -327, -211, -340, 141, 65, 425, 453}, - { 34, -169, -455, -932, -1215, 138, 499, 256, 324}, - { 68, 139, -15, -547, -478, 17, 306, 502, 481}, - { -32, -134, 445, 129, -143, -244, -503, -507, -599}, - { 61, -140, -345, 496, 458, -2, 20, -227, -514}, - { 394, 1765, 1666, 1339, 1117, 806, 642, 479, 380}, - { 215, 519, 920, 1053, 1090, 791, 528, 290, 155}, - { -54, -233, -647, -602, 639, 294, -2, -167, -442}, - { -78, -315, -791, -113, 820, 403, 158, -116, -356}, - { 529, 1851, 2003, 1228, 622, -41, -416, 344, 819}, - { -105, -379, -236, 1224, 893, 749, 568, 356, 214}, - { -17, -199, -144, 50, -283, -247, -578, -846, -1087}, - { 69, -11, -381, -206, 209, -284, -387, -416, -716}, - { 39, -5, -145, -374, -682, -909, -1074, -1169, -1066}, - { 287, 226, 67, -221, -662, -171, -421, -642, -707}, - { -132, -348, -538, -448, -20, -4, -354, -748, -933}, - { 4, -75, -289, -598, 317, 52, -208, -297, -559}, - { -88, -264, -358, -589, -631, -248, -523, -822, -1071}, - { 70, -8, 54, -314, -515, 92, -146, -274, -493}, - { 199, 62, 391, 158, -141, 71, -219, -203, -207}, - { 152, 40, 329, 162, -29, 48, -149, 108, 127}, - { 635, 1058, 883, 492, 372, 312, 317, 274, 241}, - { 267, 722, 1256, 882, 625, 248, 8, -81, -60}, - { -58, -138, -291, -600, -12, -2, -39, 147, 117}, - { -107, -345, -513, 459, 76, 92, -272, 388, 262}, - { 362, 516, 203, -409, -716, -831, -331, 185, 209}, - { -117, -391, -298, 671, 292, 538, 257, 166, -38}, - { -102, -319, -194, -283, -573, -262, -579, -219, -444}, - { -235, 78, 11, -168, -101, -229, -263, -321, -123}, - { 70, 50, -170, -599, -996, -588, -263, -516, -455}, - { 394, 363, 229, -136, -538, 21, -183, -348, -201}, - { -124, -368, -640, -879, -847, -209, -409, -494, -515}, - { -127, -341, -541, -425, -510, -10, -252, -473, -291}, - { 84, -69, -201, -676, -868, 103, -311, -132, -320}, - { 5, -173, -188, -297, -628, 197, -57, 7, -11}, - { 49, -160, 56, 558, 111, 33, -311, -440, -463}, - { -1, -246, -307, 862, 453, 139, -170, -355, -232}, - { 279, 966, 1642, 1478, 1463, 1123, 795, 525, 339}, - { -197, -38, 1702, 1331, 1252, 950, 692, 504, 426}, - { -108, -344, -861, -1172, 444, 354, 88, -46, -220}, - { -53, -321, -494, 1113, 744, 364, 198, -34, -75}, - { 457, 955, 1177, 1214, 1427, 1457, 1345, 917, 539}, - { -69, 199, 897, 1140, 1343, 1183, 977, 742, 522}, - { 122, 44, -269, 27, -155, -562, -307, -590, -773}, - { 154, 42, -160, 252, -129, -305, -471, -733, -371}, - { 135, 185, -82, -416, -722, -913, -504, -743, -880}, - { 149, 214, -84, -329, -680, -835, -426, -661, -81}, - { -128, -380, -735, -998, -337, 17, -182, -467, -697}, - { -84, -290, -510, -592, 13, 440, 154, -38, -279}, - { 70, -61, -246, -727, -1047, -80, -381, -535, -704}, - { 178, -2, -146, -670, -938, 482, 138, 63, 65}, - { -11, 15, 772, 443, 142, -20, -209, -126, -161}, - { -32, -249, 95, 552, 124, 30, -343, 82, -86}, - { 148, 751, 1515, 1105, 867, 606, 474, 448, 399}, - { -163, -257, 899, 1097, 906, 751, 502, 390, 294}, - { -51, -258, -447, -806, -368, 763, 464, 364, 183}, - { -166, -374, -367, 87, 35, 399, 418, 856, 833}, - { -205, -310, 588, 778, 785, 1065, 1118, 1245, 1157}, - { -173, -312, 107, 345, 400, 790, 870, 1113, 1001}, - { -7, -120, -387, -410, -614, -943, -226, -384, -491}, - { -203, -288, -51, -331, -90, -178, -408, -573, -338}, - { 56, -29, -273, -627, -1041, -798, -247, -467, 148}, - { 66, -2, -205, -205, -575, -349, -57, -352, -58}, - { -45, -225, -471, -924, -497, 77, -32, 44, -135}, - { -277, -491, -497, -502, -424, -202, -137, 77, 96}, - { 26, -179, -469, -1008, -1260, 262, -35, -132, -259}, - { -66, -232, -447, -533, -789, -191, -100, -267, 364} -}; - -static const int16_t dico2_isf[256][7] = { - { 1357, 1313, 1136, 784, 438, 181, 145}, - { 636, 648, 667, 568, 442, 217, 362}, - { 427, 440, 674, 524, 332, 117, -417}, - { 121, 295, 468, 465, 230, 44, -221}, - { -147, -240, 149, 80, 390, 278, 106}, - { -418, -556, 552, 511, 235, 144, -95}, - { 43, 193, 274, 150, 67, 34, -273}, - { -43, -126, 171, 416, 282, 63, -354}, - { -372, -86, -344, -108, -94, -182, -89}, - { -600, -840, -200, 465, 258, -11, -253}, - { -48, 329, 97, -290, -543, -795, -354}, - { -570, -117, 187, 10, -133, -416, -76}, - { -618, -129, -247, -371, 45, -76, 277}, - { -1022, -1079, 126, 474, 254, 127, 52}, - { -281, 76, -167, -361, -283, -551, -283}, - { -119, -52, -1, 134, -32, -204, -415}, - { 1064, 827, 637, 684, 464, 209, 12}, - { 482, 416, 449, 371, 335, 294, 194}, - { 719, 576, 365, 135, 113, 91, -199}, - { 298, 176, 493, 366, 194, 163, 36}, - { -35, -236, -259, -36, -4, 99, 152}, - { -98, -306, -27, 228, 90, 111, -86}, - { 91, 13, -211, -258, -106, 86, -64}, - { 73, -35, -57, -31, 162, 35, -192}, - { -109, -335, -629, -66, -61, -128, 322}, - { -495, -669, -728, 193, 31, -220, 122}, - { 324, 95, -89, -91, -409, -710, -154}, - { 0, -234, 92, 33, -343, -609, -220}, - { -343, -408, -476, -655, -153, 82, 222}, - { -490, -745, -255, 49, -48, 135, -127}, - { 119, -67, -328, -390, -272, -545, -56}, - { -57, -130, -10, -7, -164, -47, -22}, - { 984, 1064, 961, 568, 210, -27, 16}, - { 811, 691, 754, 514, 224, -35, 166}, - { 662, 704, 618, 386, 57, -211, -257}, - { 510, 359, 418, 393, 91, -144, -18}, - { -193, -31, -27, 223, 89, -143, 24}, - { -112, -98, 471, 319, 185, 3, 175}, - { 252, 146, -47, 272, 48, -211, -234}, - { 146, 69, 203, 364, 68, -52, 51}, - { -259, -478, -697, -349, -758, -501, 63}, - { -501, -769, -289, 79, -311, -497, -106}, - { 251, 53, -235, -469, -895, -884, 145}, - { -416, -551, 140, -133, -523, -775, 44}, - { -326, -423, -713, -497, -86, -431, 99}, - { -757, -772, -160, -76, -46, -32, 379}, - { 85, -35, -200, -401, -663, -1040, -247}, - { -180, -330, -92, -376, 27, -183, -110}, - { 1279, 1086, 781, 502, 324, 164, 157}, - { 682, 466, 449, 277, 146, 28, 409}, - { 635, 472, 390, 107, -232, -538, -139}, - { 196, 396, 332, 213, 209, -29, -81}, - { 150, -95, -312, 76, -77, -320, -50}, - { 46, 9, 47, 175, 139, 30, 384}, - { 218, 206, -24, -250, -96, -276, -183}, - { 26, 119, 38, 14, -4, -133, -52}, - { -477, -614, -987, -715, -631, -813, 200}, - { -744, -1009, -1065, -745, -631, -171, 18}, - { -137, -251, -483, -613, -980, -1203, 12}, - { -605, -767, -562, -686, -1088, -515, 58}, - { -202, -428, -782, -1072, -96, -234, -179}, - { -480, -709, -1070, -897, -131, -92, 321}, - { -145, -193, -512, -729, -572, -765, -210}, - { -331, -585, -525, -631, -281, -208, -303}, - { 1165, 1104, 939, 828, 716, 426, 155}, - { 6, -109, 820, 778, 415, 113, -27}, - { 381, 339, 314, 265, 121, -9, -474}, - { -373, 47, 584, 442, 99, -231, -113}, - { -496, -38, -285, 262, 305, 170, 4}, - { -587, -556, 69, 66, 471, 354, 13}, - { -138, 70, -18, 106, 67, 167, -302}, - { -445, -141, 185, 191, 151, 83, -133}, - { -257, -521, -720, -198, 134, -46, -182}, - { -819, -1168, -777, 512, 359, 95, -113}, - { 137, -2, -74, -138, -401, -114, -371}, - { -242, -466, 204, 223, -31, -212, -192}, - { -532, -637, -466, -686, 256, 277, -139}, - { -1141, -1244, -381, -75, -54, 14, 88}, - { -311, 115, -143, -499, -343, 124, -416}, - { -616, -147, -135, 43, -4, 121, -369}, - { 835, 783, 641, 390, 355, 350, 64}, - { 72, 194, 443, 467, 436, 219, 372}, - { 464, 369, 192, 4, -156, -72, -226}, - { 57, 206, 303, 205, 188, 101, 265}, - { -40, -205, -488, -184, 276, 64, -26}, - { -217, -433, -297, 137, 328, 308, -289}, - { 378, 81, -308, -465, 57, -37, 227}, - { -100, 24, -36, -151, 199, 8, 143}, - { -426, -697, -1059, -133, 388, 161, 321}, - { -644, -1023, -1271, 39, 66, -123, 70}, - { 372, 177, -173, -556, -553, -304, -189}, - { -117, -369, -425, -122, -462, -152, -73}, - { -649, -850, -1189, -767, 497, 360, 222}, - { -798, -1139, -1455, -190, 430, 234, 179}, - { 42, -94, -405, -692, 38, -202, -246}, - { -169, -366, -290, -88, -64, 32, -292}, - { 1010, 923, 938, 710, 465, 230, 342}, - { 217, 300, 1054, 675, 68, -458, -179}, - { 78, 453, 316, 18, -237, -496, -243}, - { 167, 21, 424, 215, -91, -303, -170}, - { -290, -81, -70, -67, 40, 54, -59}, - { -353, -427, -90, 53, 94, 9, 54}, - { -28, 318, 283, 15, -240, -58, 79}, - { -75, -121, 229, 35, 58, 6, -133}, - { -351, -514, -744, -834, -705, -137, 164}, - { -1124, -1388, -1055, -230, -73, 40, 36}, - { -163, -233, -532, -785, -1170, -697, 96}, - { -788, -959, -246, -430, -624, -165, -8}, - { -856, -540, -630, -907, -337, -70, 76}, - { -937, -1042, -659, -733, -208, 199, -26}, - { -523, 78, -98, -501, -869, -890, -81}, - { -624, -703, -45, -348, -25, 87, -186}, - { 1005, 823, 546, 249, 90, -22, 207}, - { 298, 397, 381, 319, 200, 62, 303}, - { 473, 379, 133, -247, -632, -441, 75}, - { 284, 208, 391, 115, -25, 44, 95}, - { -72, 79, -95, -63, -129, -293, 203}, - { -164, -349, 115, 122, 69, -1, 378}, - { 348, 170, 99, 58, -179, -302, 188}, - { -190, -2, 150, 23, -51, -11, 216}, - { -615, -863, -1090, -1427, -802, -48, -6}, - { -961, -1276, -1548, -727, -58, 56, 223}, - { -124, -255, -561, -988, -1277, -148, -82}, - { -480, -660, -891, -1191, -1339, -325, 20}, - { -621, -917, -1296, -1350, 264, 289, 50}, - { -844, -1022, -1345, -1329, -293, 46, 278}, - { -260, -468, -829, -1176, -533, -560, -78}, - { -215, -484, -822, -1233, -791, 15, -138}, - { 1301, 1317, 1262, 1048, 716, 357, -64}, - { 578, 824, 925, 802, 630, 362, 102}, - { 470, 925, 767, 514, 327, 190, -112}, - { 225, 492, 495, 437, 598, 384, -45}, - { 43, 82, -42, 175, 519, 342, -64}, - { -304, -154, 159, 576, 403, 221, 327}, - { 214, 244, 122, -62, 312, 92, -160}, - { 218, 208, 310, 268, 306, 323, -199}, - { -285, -269, -79, -124, -143, -153, 236}, - { -205, -384, -426, 344, 59, -185, -184}, - { -272, 247, 126, -210, -518, -468, 78}, - { -99, -120, 502, 160, -280, -557, 304}, - { -423, -17, -283, -443, 215, 212, -140}, - { -564, -684, -228, 510, 361, 130, 323}, - { -428, 335, 98, -65, 36, -215, -246}, - { -362, 51, 364, -16, -234, 150, -165}, - { 914, 883, 751, 653, 676, 464, -153}, - { 631, 545, 535, 720, 596, 360, -81}, - { 783, 712, 512, 439, 341, 251, -391}, - { 497, 417, 249, 372, 295, 173, -193}, - { 128, -110, -385, 93, 39, 173, -231}, - { 216, -59, -253, 462, 389, 154, 69}, - { 455, 270, -4, -337, -49, 233, -322}, - { 307, 143, 53, 218, 128, 236, -156}, - { -37, -186, -240, -411, -110, 9, 399}, - { -140, -365, -628, 258, 380, 214, 277}, - { 131, 454, 177, -285, -520, 108, -214}, - { 77, -141, 201, -123, -490, -131, 60}, - { -14, -194, -521, -741, 273, 362, -33}, - { -362, -566, -287, -228, 161, 237, 317}, - { -269, 195, -75, -375, -204, 11, 77}, - { -128, -264, -156, -223, -475, 265, 27}, - { 1238, 1147, 916, 689, 432, 210, -280}, - { 800, 664, 879, 726, 411, 160, -164}, - { 454, 686, 536, 275, 147, 46, 111}, - { 303, 486, 512, 355, 241, 181, -69}, - { 79, 92, 29, 147, 233, 52, 17}, - { -171, 289, 131, 439, 271, 3, -10}, - { 413, 241, 144, 174, 155, -2, 14}, - { 58, 217, 247, 219, 149, 175, -18}, - { 228, -8, -240, -206, -513, -191, 202}, - { -96, -272, -454, 33, -300, -575, 46}, - { -10, -108, -246, -347, -770, -535, 9}, - { -326, -430, -61, -321, -704, -299, 201}, - { -1, -280, -603, -419, -185, 18, -36}, - { -516, -522, -379, -291, -181, -97, 27}, - { -159, -313, -525, -224, -510, -831, -197}, - { -292, -459, -59, -310, -562, -143, -351}, - { 1066, 912, 631, 389, 207, 86, -224}, - { 596, 512, 596, 505, 314, 122, -48}, - { 787, 861, 441, -93, -303, 33, -190}, - { 257, 469, 337, 51, 15, 298, -93}, - { 295, 73, -119, 25, 36, 23, 108}, - { -28, -3, -32, 114, 21, 185, 107}, - { 482, 305, 15, -279, -319, 52, 96}, - { 226, 46, 115, 72, -136, 133, -125}, - { 18, -207, -559, -590, -503, -482, 321}, - { -571, -789, -951, -172, -441, -538, 113}, - { 181, 14, -310, -641, -1001, -202, 159}, - { -136, -393, -433, -513, -911, -144, -22}, - { 72, -265, -706, -954, -159, 53, 332}, - { -338, -591, -852, -383, -395, 56, 44}, - { 43, -158, -464, -897, -631, -157, -294}, - { -161, -128, -328, -573, -483, -125, 11}, - { 1017, 906, 1051, 1005, 679, 341, -102}, - { 359, 334, 1567, 1314, 723, 105, 10}, - { -65, 726, 529, 301, 220, 43, -273}, - { -510, 436, 719, 566, 358, 179, 114}, - { -560, 298, 133, -120, 342, 225, 14}, - { -899, -101, 217, 617, 400, 146, -58}, - { -41, 352, 82, -196, 39, 121, -167}, - { -212, 59, 447, 284, 423, 250, -169}, - { -371, -484, -596, 30, -41, 249, 22}, - { -372, -650, -794, 477, 445, 216, -79}, - { -352, 275, 17, -443, -929, 92, 19}, - { -699, -696, 431, 264, -49, -310, 182}, - { -978, -217, -430, -400, 101, 261, 72}, - { -929, -889, -357, -13, 463, 378, 236}, - { -826, 56, 30, -299, -360, -128, -51}, - { -878, -299, -111, 75, 65, 36, 3}, - { 817, 368, -25, 354, 697, 591, -173}, - { 309, 212, 222, 751, 484, 140, -56}, - { 593, 379, 70, -8, 258, 180, 110}, - { 165, -46, 255, 297, 219, 273, 105}, - { 160, -70, -358, -181, 379, 330, 319}, - { -238, -369, -198, 740, 580, 319, -143}, - { 201, 109, -202, -456, 328, 276, -141}, - { 203, 170, 111, 42, 207, 360, 188}, - { -345, -399, -513, -233, 650, 422, 81}, - { -635, -961, -1220, 463, 539, 204, 209}, - { 202, -25, -194, -498, -787, 193, -143}, - { -449, -538, 195, -106, -331, 68, 62}, - { -228, -477, -840, -576, 317, 128, 283}, - { -671, -937, -807, -114, 391, 335, -62}, - { 246, 2, -314, -679, -303, 180, -88}, - { -107, -272, 90, -198, -28, 290, -112}, - { 885, 1149, 1021, 712, 496, 281, -83}, - { 269, 492, 787, 643, 347, 70, 124}, - { 336, 636, 499, 92, -229, -179, 191}, - { 26, 402, 564, 340, 149, -11, 135}, - { -440, 561, 470, 204, -72, -186, 140}, - { -720, 14, 355, 229, 68, -133, 465}, - { 110, 310, 103, 12, 106, 29, 158}, - { -178, 113, 161, 142, 121, 115, 27}, - { -651, -414, -645, -152, -164, -13, -429}, - { -639, -944, -681, -104, -81, 52, -189}, - { -663, -164, -316, -683, -954, -205, -83}, - { -609, -669, -172, -517, -694, 283, -80}, - { -646, -152, -383, -678, -246, -40, -143}, - { -747, -796, -745, -390, -98, 43, 275}, - { -599, -199, -398, -433, -436, -538, 31}, - { -1107, -568, -376, -265, -126, -21, 1}, - { 847, 573, 308, 392, 305, 101, 55}, - { 273, 293, 201, 267, 346, 201, 123}, - { 727, 480, 226, 2, -65, -138, 164}, - { 273, 208, 173, 292, 12, 253, 174}, - { 340, 207, 180, 88, 116, 46, 475}, - { -460, -166, -30, 13, 110, 173, 396}, - { 137, 88, 43, -137, -94, 34, 284}, - { 96, -14, 226, 40, 63, 70, 130}, - { -467, -735, -1012, -1174, -307, 305, -67}, - { -612, -920, -1146, -567, -8, 92, -25}, - { -182, -271, -492, -754, -857, 287, -75}, - { -494, -787, -689, -683, -709, 137, -326}, - { -288, -550, -903, -1105, 334, 321, -62}, - { -354, -653, -834, -445, 1, 377, -152}, - { -162, -306, -608, -937, -297, 247, -192}, - { -234, -477, -244, -488, -266, 342, -332} -}; - -static const int16_t dico21_isf[64][3] = { - { 329, 409, 249}, { -33, 505, 160}, - { -29, -14, 582}, { -262, 127, 354}, - { 145, 237, 175}, { -152, 245, 122}, - { 27, 42, 340}, { -84, -93, 311}, - { 285, 222, -156}, { 47, -43, -504}, - { 234, 121, 385}, { 104, -317, 45}, - { 176, 195, 8}, { 104, -59, -94}, - { 177, 53, 192}, { -34, -127, 152}, - { 570, 277, -34}, { -67, -329, -639}, - { -157, -272, 462}, { -177, -462, 198}, - { 322, 179, 115}, { -386, 171, 19}, - { 19, -12, 195}, { -120, -252, 201}, - { 304, 36, -336}, { -128, -221, -380}, - { 171, -185, 296}, { -242, -312, 23}, - { 198, 39, 16}, { -3, -177, -111}, - { 111, -93, 76}, { -92, -223, 4}, - { 177, 406, -44}, { -168, 380, -149}, - { -4, 273, 331}, { -420, 513, 277}, - { 21, 247, 47}, { -58, 131, -2}, - { -3, 134, 180}, { -145, 40, 175}, - { 189, 74, -145}, { -27, -45, -325}, - { 370, -114, -21}, { -83, -415, -173}, - { 77, 95, -51}, { -40, -30, -67}, - { 71, 88, 86}, { -35, -98, 14}, - { 69, 197, -334}, { -196, 79, -231}, - { -348, -137, 218}, { -352, -89, -85}, - { 47, 201, -130}, { -165, 37, -15}, - { -43, 3, 86}, { -161, -108, 79}, - { 83, 21, -237}, { -81, -149, -238}, - { 150, -186, -251}, { -186, -249, -162}, - { -19, 66, -139}, { -26, -50, -181}, - { 24, 11, 0}, { -130, -105, -98} -}; - -static const int16_t dico22_isf[128][3] = { - { -127, 310, 42}, { -242, 197, 5}, - { -151, 84, -17}, { -214, 127, -149}, - { -247, -131, 159}, { -268, -267, -95}, - { -217, 1, -79}, { -271, -80, -185}, - { -45, 436, 159}, { 165, 199, 391}, - { -33, 81, 187}, { -66, -42, 355}, - { -298, -57, 343}, { -108, -537, 226}, - { -144, -23, 193}, { 176, -402, 87}, - { 53, 296, 25}, { -84, 253, -104}, - { -58, 105, -126}, { -169, 174, -314}, - { -48, 44, -294}, { -164, -417, -242}, - { -139, 3, -194}, { -155, -207, -211}, - { 119, 322, 213}, { 333, 50, 380}, - { 237, 247, -2}, { 466, -16, 201}, - { 238, -255, -107}, { 67, -440, -149}, - { 122, -88, -139}, { 88, -247, -73}, - { -41, 231, 167}, { -62, 155, 16}, - { -65, 16, 77}, { -68, -2, -63}, - { -151, -300, 160}, { -18, -333, 54}, - { -56, -94, 5}, { 2, -190, 14}, - { 92, 148, 209}, { 108, 9, 272}, - { 108, 35, 110}, { 142, -85, 145}, - { 47, -157, 279}, { 3, -320, 246}, - { 43, -72, 68}, { 86, -217, 135}, - { 36, 140, 79}, { 56, 175, -49}, - { 26, 45, 3}, { 73, 55, -101}, - { 109, -183, -242}, { -4, -283, -242}, - { 48, -68, -48}, { -6, -153, -122}, - { 161, 196, 96}, { 232, 80, 190}, - { 165, 97, 11}, { 258, -31, 71}, - { 267, -77, -91}, { 311, -209, 87}, - { 152, -14, -22}, { 150, -149, 9}, - { -324, 557, 187}, { -384, 307, 46}, - { -251, 27, 77}, { -365, 77, -52}, - { -482, -84, 160}, { -424, -515, -64}, - { -294, -120, -4}, { -476, -116, -109}, - { -97, 318, 365}, { 106, 627, 445}, - { -190, 120, 287}, { -146, 65, 619}, - { -427, 242, 363}, { -361, -371, 432}, - { -347, 102, 168}, { -629, 195, -14}, - { -65, 476, -47}, { -297, 320, -168}, - { -55, 356, -264}, { -391, 82, -286}, - { -51, -31, -556}, { -178, -399, -586}, - { -205, -49, -360}, { -343, -238, -337}, - { 220, 457, 58}, { 561, 467, 259}, - { 340, 270, -168}, { 450, 77, -280}, - { 60, 167, -413}, { 133, -252, -492}, - { 216, 157, -290}, { 282, 0, -495}, - { -226, 293, 183}, { -157, 135, 122}, - { -158, -59, 39}, { -133, -118, -97}, - { -332, -309, 113}, { -160, -425, -6}, - { -149, -211, 24}, { -80, -277, -90}, - { -11, 125, 338}, { 130, -71, 465}, - { 5, -45, 184}, { 237, -95, 253}, - { -139, -197, 297}, { -19, -300, 511}, - { -63, -152, 139}, { 250, -289, 336}, - { 124, 339, -150}, { 34, 176, -208}, - { 171, 166, -116}, { 94, 38, -229}, - { 75, -65, -339}, { -78, -205, -385}, - { 0, -30, -163}, { -56, -110, -242}, - { 321, 244, 194}, { 505, 238, -1}, - { 317, 116, 65}, { 309, 88, -74}, - { 452, -51, -50}, { 334, -217, -290}, - { 211, 41, -152}, { 238, -55, -260} -}; - -static const int16_t dico23_isf[128][3] = { - { -10, 151, 359}, { 136, 298, 223}, - { 255, -104, 290}, { 423, 6, 183}, - { -270, -269, -98}, { -52, -82, 13}, - { -82, -274, -97}, { 90, -246, -72}, - { -299, -70, 421}, { -88, 365, 430}, - { 187, -318, 381}, { 380, 37, 488}, - { -373, -316, 79}, { -308, -101, 5}, - { -135, -451, 8}, { 72, -421, -154}, - { 180, 170, -121}, { 62, 177, -40}, - { 326, 80, -105}, { 248, 263, -5}, - { -168, -181, -221}, { -2, -23, -158}, - { -14, -149, -121}, { 119, -91, -147}, - { 119, 332, -153}, { 49, 303, 34}, - { 442, -55, -69}, { 217, 454, 58}, - { -359, -187, -375}, { -42, 50, -274}, - { -8, -267, -249}, { 85, -86, -346}, - { -77, -40, 345}, { 89, 134, 219}, - { 156, -80, 160}, { 108, 40, 116}, - { -158, -206, 29}, { 5, -32, 175}, - { -65, -158, 146}, { 55, -78, 73}, - { -114, -222, 353}, { -47, 81, 211}, - { 49, -151, 268}, { 105, 4, 302}, - { -263, -132, 183}, { -151, -28, 201}, - { -177, -307, 166}, { 101, -221, 130}, - { 74, 58, -98}, { 32, 44, 13}, - { 194, 30, -142}, { 170, 96, 8}, - { -136, -119, -91}, { -65, 8, -55}, - { 3, -188, 12}, { 45, -63, -49}, - { 149, -21, -19}, { 24, 144, 95}, - { 254, -22, 60}, { 161, 196, 96}, - { -158, -61, 48}, { -70, 33, 82}, - { -23, -321, 58}, { 155, -147, 5}, - { -364, 328, 77}, { -21, 453, 173}, - { -108, 82, 630}, { 367, 263, 208}, - { -300, -62, -176}, { -205, 143, -158}, - { -169, -410, -264}, { 257, -269, -100}, - { -636, 289, -2}, { -292, 627, 173}, - { -382, -363, 387}, { 248, 524, 447}, - { -521, -111, -107}, { -395, 118, -274}, - { -343, -680, -125}, { -172, -447, -663}, - { 75, 148, -367}, { -79, 263, -94}, - { 249, 148, -286}, { 380, 271, -162}, - { -142, -4, -186}, { -57, 111, -125}, - { -35, -108, -254}, { 100, 29, -242}, - { -80, 303, -264}, { -78, 464, -57}, - { 248, -22, -494}, { 661, 662, 44}, - { -193, -40, -330}, { -178, 145, -337}, - { -90, -199, -400}, { -40, -23, -498}, - { -192, 114, 315}, { -41, 244, 190}, - { 88, -97, 485}, { 241, 80, 212}, - { -246, 40, 87}, { -156, 147, 134}, - { -2, -334, 239}, { 308, -203, 110}, - { -459, 251, 422}, { -218, 310, 228}, - { -86, -346, 654}, { 184, 175, 425}, - { -481, -63, 169}, { -349, 117, 188}, - { -125, -560, 310}, { 158, -416, 94}, - { 46, 171, -192}, { -63, 157, 14}, - { 256, -35, -271}, { 322, 123, 53}, - { -214, 4, -76}, { -156, 86, -18}, - { 128, -197, -232}, { 265, -90, -98}, - { -308, 332, -145}, { -131, 308, 58}, - { 509, 59, -339}, { 562, 196, -14}, - { -378, 100, -47}, { -234, 202, 1}, - { 104, -270, -493}, { 319, -210, -325} -}; - -static const int16_t dico24_isf[32][3] = { - { -79, -89, -4}, { -171, 77, -211}, - { 160, -193, 98}, { 120, -103, 323}, - { 32, -22, -129}, { 72, 78, -268}, - { 182, -76, -66}, { 309, 99, -145}, - { -229, -157, -84}, { -383, 98, -71}, - { -90, -352, 12}, { -284, -178, 178}, - { -65, -125, -166}, { -87, -175, -351}, - { 42, -198, -48}, { 154, -140, -243}, - { -77, 18, 108}, { -39, 355, 91}, - { 87, 8, 155}, { -4, 158, 239}, - { 128, 95, -54}, { 7, 246, -124}, - { 258, 15, 89}, { 206, 216, 98}, - { -201, 9, 18}, { -312, 233, 204}, - { -39, -174, 155}, { -144, -9, 284}, - { -57, 70, -69}, { -157, 187, 18}, - { 54, -30, 23}, { 24, 135, 55} -}; - -static const int16_t dico25_isf[32][4] = { - { 169, 142, -119, 115}, { 206, -20, 94, 226}, - { -106, 313, -21, 16}, { -62, 161, 71, 255}, - { -89, 101, -185, 125}, { 72, -30, -201, 344}, - { -258, 33, -8, 81}, { -104, -154, 72, 296}, - { 144, -68, -268, -25}, { 81, -78, -87, 106}, - { 22, 155, -186, -119}, { -46, -28, 27, 91}, - { -114, -37, -175, -33}, { -94, -222, -189, 122}, - { -132, -119, -191, -270}, { -172, -173, 18, -43}, - { 279, 135, -42, -128}, { 187, -86, 229, -138}, - { 159, 240, 140, 46}, { 69, 25, 227, 77}, - { 21, 115, 13, 8}, { 68, -248, 126, 81}, - { -150, 137, 207, -9}, { -154, -133, 289, 67}, - { 143, -37, -86, -326}, { 180, -32, 19, -23}, - { 26, 168, 116, -233}, { -32, -26, 118, -78}, - { 3, -8, -45, -115}, { 57, -215, -54, -83}, - { -209, 112, -22, -167}, { -91, -151, 168, -262} -}; - -static const int16_t dico21_isf_36b[128][5] = { - { -52, -96, 212, 315, -73}, { 82, -204, 363, 136, -197}, - { -126, -331, 183, 218, 143}, { -49, -41, 557, 230, 72}, - { 2, -73, 163, 377, 221}, { 133, 111, 278, 215, -110}, - { -102, -20, 284, 113, 273}, { 84, 319, 290, 18, 85}, - { -25, -5, 125, 132, -204}, { -38, -5, 286, -9, -356}, - { -140, -256, 92, 117, -189}, { -144, 191, 313, 51, -98}, - { 167, -10, 44, 247, 36}, { 381, 197, 238, 74, 6}, - { 38, -408, 29, -3, -85}, { 92, 266, 157, -25, -200}, - { 161, -121, 70, 84, -140}, { -16, -86, 112, -94, -189}, - { -269, -270, 351, 107, -24}, { -68, -67, 492, -103, -155}, - { -53, -131, 62, 122, 10}, { 135, 84, 283, -55, -120}, - { -12, -219, 331, -81, 167}, { 220, -136, 147, -172, -42}, - { 140, -95, -109, -88, -194}, { 0, -2, -4, -33, -381}, - { -66, -217, 152, -186, -402}, { 244, 108, 156, -140, -395}, - { 113, -136, -196, 110, -24}, { 214, 118, 11, -64, -131}, - { -110, -286, -6, -332, 16}, { 94, 97, 79, -291, -205}, - { -5, -39, -20, 252, -96}, { 76, 174, 101, 163, 61}, - { -69, -239, -55, 399, 6}, { -115, 319, 164, 275, 196}, - { -15, 36, -47, 331, 121}, { 226, 209, 271, 325, 184}, - { 13, -80, -218, 471, 353}, { 288, 378, 16, -51, 251}, - { 174, 116, 52, 149, -279}, { 235, 276, 39, 120, -48}, - { 0, -108, -108, 241, -339}, { -93, 534, 45, 33, -87}, - { 194, 149, -71, 405, -44}, { 409, 370, 81, -186, -154}, - { 25, -102, -448, 124, -173}, { 22, 408, -110, -310, -214}, - { -26, 23, -83, 114, 14}, { -110, 164, 52, 223, -82}, - { 37, -25, -263, 306, -15}, { -466, 415, 292, 165, -18}, - { 29, -19, -171, 155, 182}, { 179, 144, -27, 231, 258}, - { -103, -247, -396, 238, 113}, { 375, -154, -109, -4, 156}, - { 98, 85, -292, -5, -124}, { 116, 139, -116, -98, -294}, - { -14, -83, -278, -117, -378}, { 106, 33, -106, -344, -484}, - { 119, 17, -412, 138, 166}, { 384, 101, -204, 88, -156}, - { -121, -284, -300, -1, -166}, { 280, 33, -152, -313, -81}, - { -37, 22, 229, 153, 37}, { -60, -83, 236, -8, -41}, - { -169, -228, 126, -20, 363}, { -235, 17, 364, -156, 156}, - { -25, -30, 72, 144, 156}, { 153, -26, 256, 97, 144}, - { -21, -37, 48, -65, 250}, { 63, 77, 273, -128, 124}, - { -129, -26, 40, 9, -115}, { -6, 82, 38, -90, -182}, - { -336, -13, 28, 158, 91}, { -30, 241, 137, -170, -17}, - { 146, 14, -11, 33, 61}, { 192, 197, 54, -84, 85}, - { 23, -200, -78, -29, 140}, { 122, 237, 106, -341, 136}, - { -57, -142, -85, -16, -74}, { -59, -90, -8, -187, -20}, - { -211, -267, 216, -179, -110}, { -50, -7, 220, -267, -70}, - { -57, -42, -17, -15, 71}, { 32, 21, 63, -137, 33}, - { -137, -175, 104, -68, 97}, { -67, -43, 133, -301, 221}, - { -116, -200, -81, -92, -272}, { -64, -41, -54, -244, -220}, - { -287, -242, -50, -87, -89}, { -245, 236, 102, -166, -295}, - { 66, 24, -162, -71, 95}, { 66, 136, -90, -220, -36}, - { -98, -161, -222, -188, 29}, { -18, 18, -19, -415, 9}, - { 49, 61, 100, 39, -56}, { -111, 82, 135, -31, 52}, - { -90, -153, -93, 189, 182}, { -214, 295, 119, -74, 284}, - { 2, 137, 37, 47, 182}, { 92, 117, 184, -53, 373}, - { -21, -14, -35, 136, 391}, { 146, 129, -164, -28, 333}, - { 92, 80, -84, 100, -134}, { -8, 217, -32, 3, -47}, - { -151, 251, -215, 142, 92}, { -224, 310, -172, -275, 98}, - { 159, 155, -177, 112, 53}, { 205, 27, 8, -240, 192}, - { 169, 120, -319, -201, 106}, { 11, 36, -86, -237, 455}, - { -109, -154, -163, 174, -55}, { -38, 32, -101, -78, -59}, - { -205, -321, -97, 69, 79}, { -310, 44, 18, -185, 34}, - { -115, -20, -148, -39, 203}, { -29, 154, -30, -158, 166}, - { -45, -131, -317, -24, 363}, { -165, -205, -112, -222, 265}, - { -32, -44, -150, 54, -193}, { -6, -38, -255, -169, -115}, - { -266, 87, -189, -36, -169}, { -60, -87, -266, -436, -170}, - { -68, -81, -278, 24, 38}, { -23, -19, -155, -256, 141}, - { -61, -226, -565, -175, 71}, { 9, -29, -237, -515, 263} -}; - -static const int16_t dico22_isf_36b[128][4] = { - { -298, -6, 95, 31}, { -213, -87, -122, 261}, - { 4, -49, 208, 14}, { -129, -110, 30, 118}, - { -214, 258, 110, -235}, { -41, -18, -126, 120}, - { 103, 65, 127, -37}, { 126, -36, -24, 25}, - { -138, -67, -278, -186}, { -164, -194, -201, 78}, - { -211, -87, -51, -221}, { -174, -79, -94, -39}, - { 23, -6, -157, -240}, { 22, -110, -153, -68}, - { 148, -5, -2, -149}, { -1, -135, -39, -179}, - { 68, 360, -117, -15}, { 137, 47, -278, 146}, - { 136, 260, 135, 65}, { 61, 116, -45, 97}, - { 231, 379, 87, -120}, { 338, 177, -272, 3}, - { 266, 156, 28, -69}, { 260, 84, -85, 86}, - { -266, 154, -256, -182}, { -17, -65, -304, -6}, - { -40, 175, -151, -180}, { -27, 27, -87, -63}, - { 121, 114, -166, -469}, { 159, -66, -323, -231}, - { 214, 152, -141, -212}, { 137, 36, -184, -51}, - { -282, -237, 40, 10}, { -48, -235, -37, 251}, - { -54, -323, 136, 29}, { -88, -174, 213, 198}, - { -390, 99, -63, -375}, { 107, -169, -164, 424}, - { 69, -111, 141, -167}, { 74, -129, 65, 144}, - { -353, -207, -205, -109}, { -160, -386, -355, 98}, - { -176, -493, -20, -143}, { -252, -432, -2, 216}, - { -90, -174, -168, -411}, { 13, -284, -229, -160}, - { -87, -279, 34, -251}, { -75, -263, -58, -42}, - { 420, 53, -211, -358}, { 384, -35, -374, 396}, - { 68, -228, 323, -2}, { 167, -307, 192, 194}, - { 459, 329, -5, -332}, { 375, 79, -7, 313}, - { 282, -124, 200, -92}, { 271, -162, -70, 180}, - { -157, -298, -514, -309}, { 58, -163, -546, 18}, - { 124, -364, 167, -238}, { 83, -411, -117, 96}, - { 140, -112, -388, -624}, { 259, -133, -317, 41}, - { 163, -130, -64, -334}, { 226, -165, -124, -110}, - { -466, -61, 6, 229}, { -153, 205, -145, 242}, - { -159, 48, 195, 148}, { -58, 28, 31, 279}, - { -303, 185, 279, -4}, { -61, 197, 59, 86}, - { -114, 123, 168, -52}, { 35, 36, 100, 126}, - { -407, 102, -77, -40}, { -338, -1, -342, 156}, - { -179, 105, -34, -97}, { -185, 84, -35, 108}, - { -133, 107, -91, -357}, { -180, 54, -229, 24}, - { -44, 47, 47, -182}, { -66, 13, 45, 4}, - { -339, 251, 64, 226}, { -42, 101, -350, 275}, - { -99, 398, 142, 121}, { 111, 12, -102, 260}, - { 0, 505, 260, -94}, { 161, 285, -96, 224}, - { -4, 206, 314, 33}, { 167, 139, 88, 204}, - { -235, 316, -60, -25}, { -8, -150, -312, 201}, - { -36, 292, 61, -104}, { -40, 174, -162, 42}, - { -21, 402, -29, -351}, { 21, 152, -360, -93}, - { 57, 191, 212, -196}, { 76, 158, -21, -69}, - { -328, -185, 331, 119}, { -53, 285, 56, 337}, - { -107, -24, 405, 29}, { -18, 137, 272, 277}, - { -255, 22, 173, -191}, { 295, 322, 325, 302}, - { 21, -27, 332, -178}, { 119, 13, 271, 129}, - { -455, -180, 116, -191}, { -227, 62, -148, 524}, - { -176, -287, 282, -157}, { -243, 13, 199, 430}, - { -59, -49, 115, -365}, { 72, -172, -137, 93}, - { -138, -126, 141, -84}, { 5, -124, 38, -20}, - { -258, 311, 601, 213}, { 94, 130, -61, 502}, - { -1, -157, 485, 313}, { 146, -74, 158, 345}, - { 276, 135, 280, -57}, { 490, 252, 99, 43}, - { 267, -74, 429, 105}, { 278, -23, 119, 94}, - { -542, 488, 257, -115}, { -84, -244, -438, 478}, - { -113, -545, 387, 101}, { -95, -306, 111, 498}, - { 95, 166, 22, -301}, { 420, -15, -58, -78}, - { 270, 29, 122, -282}, { 160, -240, 50, -38} -}; - -static const int16_t dico23_isf_36b[64][7] = { - { 81, -18, 68, -27, -122, -280, -4}, - { 45, -177, 209, -30, -136, -74, 131}, - { -44, 101, -75, -88, -48, -137, -54}, - { -245, -28, 63, -18, -112, -103, 58}, - { -79, -6, 220, -65, 114, -35, -50}, - { 109, -65, 143, -114, 129, 76, 125}, - { 166, 90, -61, -242, 186, -74, -43}, - { -46, -92, 49, -227, 24, -155, 39}, - { 67, 85, 99, -42, 53, -184, -281}, - { 142, -122, 0, 21, -142, -15, -17}, - { 223, 92, -21, -48, -82, -14, -167}, - { 51, -37, -243, -30, -90, 18, -56}, - { 54, 105, 74, 86, 69, 13, -101}, - { 196, 72, -89, 43, 65, 19, 39}, - { 121, 34, 131, -82, 25, 213, -156}, - { 101, -102, -136, -21, 57, 214, 22}, - { 36, -124, 205, 204, 58, -156, -83}, - { 83, -117, 137, 137, 85, 116, 44}, - { -92, -148, -68, 11, -102, -197, -220}, - { -76, -185, -58, 132, -26, -183, 85}, - { -7, -31, -2, 23, 205, -151, 10}, - { -27, -37, -5, -18, 292, 131, 1}, - { 117, -168, 9, -93, 80, -59, -125}, - { -182, -244, 98, -24, 135, -22, 94}, - { 221, 97, 106, 42, 43, -160, 83}, - { 25, -64, -21, 6, 14, -15, 154}, - { 126, 15, -140, 150, -10, -207, -114}, - { 79, -63, -211, -70, -28, -217, 165}, - { 46, 38, -22, 281, 132, -62, 109}, - { 112, 54, -112, -93, 208, 27, 296}, - { 115, 10, -147, 41, 216, 42, -276}, - { 50, -115, -254, 167, 117, -2, 61}, - { 17, 144, 34, -72, -186, -150, 272}, - { -29, -66, -89, -95, -149, 129, 251}, - { 122, 0, -50, -234, -91, 36, 26}, - { -105, -102, -88, -121, -236, -7, -11}, - { -204, 109, 5, -191, 105, -15, 163}, - { -80, 32, -24, -209, 41, 294, 70}, - { -106, -94, -204, -118, 120, -50, -37}, - { -82, -241, 46, -131, -29, 150, -55}, - { 33, 155, 120, -89, -8, 7, 62}, - { 213, 82, 61, 18, -161, 144, 152}, - { 30, 131, 65, -87, -255, -17, -107}, - { -8, 85, -64, 51, -162, 223, -53}, - { -134, 261, 69, -56, 218, 72, -111}, - { 2, 155, -113, -87, 49, 85, -28}, - { -163, 42, -1, -196, 7, 39, -245}, - { 14, -137, -79, 11, -160, 202, -293}, - { -94, 33, 208, 100, 56, -44, 326}, - { -78, -41, 232, 13, -142, 227, 80}, - { -16, -87, 201, 33, -133, 15, -183}, - { -58, -192, -47, 184, -128, 133, 99}, - { -205, 11, -155, 78, 52, 72, 141}, - { -246, 26, 99, 151, 59, 115, -64}, - { -79, -47, -16, -14, 6, 47, -43}, - { -72, -178, -27, 162, 112, 43, -174}, - { -175, 238, 186, 71, -54, -188, -76}, - { -225, 233, 39, -39, -158, 122, 44}, - { -26, 43, 84, 130, -93, -51, 22}, - { 3, 92, -150, 136, -182, -57, 97}, - { -131, 179, -78, 80, 91, -165, 90}, - { -2, 148, 15, 130, 65, 175, 117}, - { -138, 114, -137, 132, 3, -10, -186}, - { 140, -4, -37, 254, -62, 92, -109} -}; - -/** Means of ISF vectors in Q15 */ -static const int16_t isf_mean[LP_ORDER] = { - 738, 1326, 2336, 3578, 4596, 5662, 6711, 7730, - 8750, 9753, 10705, 11728, 12833, 13971, 15043, 4037 -}; - -/** Initialization tables for the processed ISF vector in Q15 */ -static const int16_t isf_init[LP_ORDER] = { - 1024, 2048, 3072, 4096, 5120, 6144, 7168, 8192, - 9216, 10240, 11264, 12288, 13312, 14336, 15360, 3840 -}; - -/** ISF/ISP interpolation coefficients for each subframe */ -static const float isfp_inter[4] = { 0.45, 0.8, 0.96, 1.0 }; - -/** Coefficients for FIR interpolation of excitation vector - * at pitch lag resulting the adaptive codebook vector */ -static const float ac_inter[65] = { - 9.400024e-01, - 8.563843e-01, 6.322632e-01, 3.375854e-01, 5.908203e-02, - -1.310425e-01, -1.994019e-01, -1.585693e-01, -5.633545e-02, - 4.760742e-02, 1.067505e-01, 1.036987e-01, 5.206299e-02, - -1.519775e-02, -6.372070e-02, -7.366943e-02, -4.650879e-02, - -9.765625e-04, 3.820801e-02, 5.316162e-02, 4.003906e-02, - 9.338379e-03, -2.166748e-02, -3.778076e-02, -3.320312e-02, - -1.300049e-02, 1.068115e-02, 2.587891e-02, 2.630615e-02, - 1.379395e-02, -3.662109e-03, -1.678467e-02, -1.983643e-02, - -1.275635e-02, -5.493164e-04, 1.007080e-02, 1.409912e-02, - 1.068115e-02, 2.624512e-03, -5.371094e-03, -9.338379e-03, - -8.117676e-03, -3.173828e-03, 2.319336e-03, 5.615234e-03, - 5.554199e-03, 2.868652e-03, -6.103516e-04, -2.990723e-03, - -3.356934e-03, -2.014160e-03, -1.220703e-04, 1.342773e-03, - 1.708984e-03, 1.159668e-03, 2.441406e-04, -4.272461e-04, - -6.103516e-04, -4.272461e-04, -1.220703e-04, 6.103516e-05, - 1.220703e-04, 6.103516e-05, 0.000000e+00, 0.000000e+00 -}; - -/** [i][j] is the number of pulses present in track j at mode i */ -static const uint8_t pulses_nb_per_mode_tr[][4] = { - {1, 1, 0, 0}, {1, 1, 1, 1}, {2, 2, 2, 2}, - {3, 3, 2, 2}, {3, 3, 3, 3}, {4, 4, 4, 4}, - {5, 5, 4, 4}, {6, 6, 6, 6}, {6, 6, 6, 6} -}; - -/** Tables for decoding quantized gains { pitch (Q14), fixed factor (Q11) } */ -static const int16_t qua_gain_6b[64][2] = { - { 1566, 1332}, { 1577, 3557}, - { 3071, 6490}, { 4193, 10163}, - { 4496, 2534}, { 5019, 4488}, - { 5586, 15614}, { 5725, 1422}, - { 6453, 580}, { 6724, 6831}, - { 7657, 3527}, { 8072, 2099}, - { 8232, 5319}, { 8827, 8775}, - { 9740, 2868}, { 9856, 1465}, - { 10087, 12488}, { 10241, 4453}, - { 10859, 6618}, { 11321, 3587}, - { 11417, 1800}, { 11643, 2428}, - { 11718, 988}, { 12312, 5093}, - { 12523, 8413}, { 12574, 26214}, - { 12601, 3396}, { 13172, 1623}, - { 13285, 2423}, { 13418, 6087}, - { 13459, 12810}, { 13656, 3607}, - { 14111, 4521}, { 14144, 1229}, - { 14425, 1871}, { 14431, 7234}, - { 14445, 2834}, { 14628, 10036}, - { 14860, 17496}, { 15161, 3629}, - { 15209, 5819}, { 15299, 2256}, - { 15518, 4722}, { 15663, 1060}, - { 15759, 7972}, { 15939, 11964}, - { 16020, 2996}, { 16086, 1707}, - { 16521, 4254}, { 16576, 6224}, - { 16894, 2380}, { 16906, 681}, - { 17213, 8406}, { 17610, 3418}, - { 17895, 5269}, { 18168, 11748}, - { 18230, 1575}, { 18607, 32767}, - { 18728, 21684}, { 19137, 2543}, - { 19422, 6577}, { 19446, 4097}, - { 19450, 9056}, { 20371, 14885} -}; - -static const int16_t qua_gain_7b[128][2] = { - { 204, 441}, { 464, 1977}, - { 869, 1077}, { 1072, 3062}, - { 1281, 4759}, { 1647, 1539}, - { 1845, 7020}, { 1853, 634}, - { 1995, 2336}, { 2351, 15400}, - { 2661, 1165}, { 2702, 3900}, - { 2710, 10133}, { 3195, 1752}, - { 3498, 2624}, { 3663, 849}, - { 3984, 5697}, { 4214, 3399}, - { 4415, 1304}, { 4695, 2056}, - { 5376, 4558}, { 5386, 676}, - { 5518, 23554}, { 5567, 7794}, - { 5644, 3061}, { 5672, 1513}, - { 5957, 2338}, { 6533, 1060}, - { 6804, 5998}, { 6820, 1767}, - { 6937, 3837}, { 7277, 414}, - { 7305, 2665}, { 7466, 11304}, - { 7942, 794}, { 8007, 1982}, - { 8007, 1366}, { 8326, 3105}, - { 8336, 4810}, { 8708, 7954}, - { 8989, 2279}, { 9031, 1055}, - { 9247, 3568}, { 9283, 1631}, - { 9654, 6311}, { 9811, 2605}, - { 10120, 683}, { 10143, 4179}, - { 10245, 1946}, { 10335, 1218}, - { 10468, 9960}, { 10651, 3000}, - { 10951, 1530}, { 10969, 5290}, - { 11203, 2305}, { 11325, 3562}, - { 11771, 6754}, { 11839, 1849}, - { 11941, 4495}, { 11954, 1298}, - { 11975, 15223}, { 11977, 883}, - { 11986, 2842}, { 12438, 2141}, - { 12593, 3665}, { 12636, 8367}, - { 12658, 1594}, { 12886, 2628}, - { 12984, 4942}, { 13146, 1115}, - { 13224, 524}, { 13341, 3163}, - { 13399, 1923}, { 13549, 5961}, - { 13606, 1401}, { 13655, 2399}, - { 13782, 3909}, { 13868, 10923}, - { 14226, 1723}, { 14232, 2939}, - { 14278, 7528}, { 14439, 4598}, - { 14451, 984}, { 14458, 2265}, - { 14792, 1403}, { 14818, 3445}, - { 14899, 5709}, { 15017, 15362}, - { 15048, 1946}, { 15069, 2655}, - { 15405, 9591}, { 15405, 4079}, - { 15570, 7183}, { 15687, 2286}, - { 15691, 1624}, { 15699, 3068}, - { 15772, 5149}, { 15868, 1205}, - { 15970, 696}, { 16249, 3584}, - { 16338, 1917}, { 16424, 2560}, - { 16483, 4438}, { 16529, 6410}, - { 16620, 11966}, { 16839, 8780}, - { 17030, 3050}, { 17033, 18325}, - { 17092, 1568}, { 17123, 5197}, - { 17351, 2113}, { 17374, 980}, - { 17566, 26214}, { 17609, 3912}, - { 17639, 32767}, { 18151, 7871}, - { 18197, 2516}, { 18202, 5649}, - { 18679, 3283}, { 18930, 1370}, - { 19271, 13757}, { 19317, 4120}, - { 19460, 1973}, { 19654, 10018}, - { 19764, 6792}, { 19912, 5135}, - { 20040, 2841}, { 21234, 19833} -}; - -/** 4-tap moving average prediction coefficients in reverse order */ -static const float energy_pred_fac[4] = { 0.2, 0.3, 0.4, 0.5 }; - -/** impulse response filter tables converted to float from Q15 - * used for anti-sparseness processing */ -static const float ir_filter_str[64] = { - 6.159058e-01, 2.958069e-01, 9.979248e-02, -1.048889e-01, - 8.740234e-02, -1.599121e-01, 4.849243e-02, -4.141235e-02, - 1.831055e-02, 1.188049e-01, -4.568481e-02, -2.130127e-02, - 3.671265e-02, -1.601868e-01, 3.659058e-02, 1.639099e-01, - -4.541016e-02, -2.151489e-02, -8.810425e-02, 6.030273e-02, - 2.740479e-02, 2.200317e-02, -1.182861e-01, 1.289978e-01, - -1.560059e-01, 1.953125e-01, -3.149414e-02, -1.441956e-01, - 1.249084e-01, -1.328125e-01, 9.780884e-02, 6.500244e-02, - -6.091309e-02, -5.599976e-02, 8.081055e-02, -5.450439e-02, - -1.239014e-02, 1.748657e-02, 7.580566e-02, -1.101074e-01, - 9.579468e-02, -4.159546e-02, -7.830811e-02, 1.162109e-01, - -1.950073e-02, -6.259155e-02, -1.651001e-02, 7.250977e-02, - 1.199951e-01, -1.911011e-01, 4.370117e-02, -1.098938e-01, - 1.492004e-01, 1.129150e-02, 1.730347e-02, -3.549194e-02, - -8.709717e-02, 5.841064e-02, 1.190186e-03, -7.379150e-02, - 1.054077e-01, 9.078979e-02, -1.227112e-01, 1.047058e-01 -}; - -static const float ir_filter_mid[64] = { - 7.354126e-01, 3.192139e-01, -1.606140e-01, -2.328491e-02, - 6.250000e-02, -2.828979e-02, 5.349731e-02, -1.014099e-01, - 6.750488e-02, 1.989746e-02, -6.549072e-02, 7.589722e-02, - -1.080017e-01, 1.253967e-01, -6.430054e-02, -1.141357e-02, - -1.910400e-02, 1.303101e-01, -1.673889e-01, 6.820679e-02, - 5.670166e-02, -8.450317e-02, 2.270508e-02, 3.479004e-02, - -2.328491e-02, -4.928589e-02, 1.239014e-01, -1.395874e-01, - 9.100342e-02, -3.549194e-02, 2.230835e-02, -3.350830e-02, - 2.450562e-02, 5.096436e-03, -2.178955e-02, 1.849365e-02, - -1.708984e-02, 1.950073e-02, 1.312256e-03, -5.389404e-02, - 9.851074e-02, -8.489990e-02, 2.029419e-02, 2.328491e-02, - 7.110596e-03, -6.109619e-02, 3.939819e-02, 5.709839e-02, - -1.058960e-01, 3.149414e-02, 8.270264e-02, -1.232910e-01, - 1.105957e-01, -1.286011e-01, 1.614990e-01, -1.303101e-01, - 4.769897e-02, 3.295898e-03, -1.770020e-02, 5.010986e-02, - -7.501221e-02, 2.920532e-02, 1.660156e-02, 7.751465e-02 -}; - -static const float * const ir_filters_lookup[2] = { - ir_filter_str, ir_filter_mid -}; - -/** High-pass filters coefficients for 31 Hz and 400 Hz cutoff */ -static const float hpf_zeros[2] = { -2.0, 1.0 }; -static const float hpf_31_poles[2] = { -1.978881836, 0.979125977 }; -static const float hpf_31_gain = 0.989501953; - -static const float hpf_400_poles[2] = { -1.787109375, 0.864257812 }; -static const float hpf_400_gain = 0.893554687; - -/** Interpolation coefficients for 5/4 signal upsampling - * Table from the reference source was reordered for efficiency */ -static const float upsample_fir[4][24] = { - { -6.103516e-05, 7.324219e-04, -2.014160e-03, 4.150391e-03, - -7.263184e-03, 1.165771e-02, -1.776123e-02, 2.624512e-02, - -3.869629e-02, 5.877686e-02, -9.863281e-02, 2.314453e-01, - 9.348755e-01, -1.523438e-01, 7.861328e-02, -4.937744e-02, - 3.308105e-02, -2.252197e-02, 1.507568e-02, -9.765625e-03, - 5.859375e-03, -3.173828e-03, 1.403809e-03, -3.662109e-04 }, - { -2.441406e-04, 1.464844e-03, -3.784180e-03, 7.568359e-03, - -1.300049e-02, 2.062988e-02, -3.112793e-02, 4.589844e-02, - -6.781006e-02, 1.042480e-01, -1.815186e-01, 5.016479e-01, - 7.548828e-01, -2.094727e-01, 1.148071e-01, -7.348633e-02, - 4.956055e-02, -3.369141e-02, 2.246094e-02, -1.434326e-02, - 8.483887e-03, -4.455566e-03, 1.831055e-03, -4.272461e-04 }, - { -4.272461e-04, 1.831055e-03, -4.455566e-03, 8.483887e-03, - -1.434326e-02, 2.246094e-02, -3.369141e-02, 4.956055e-02, - -7.348633e-02, 1.148071e-01, -2.094727e-01, 7.548828e-01, - 5.016479e-01, -1.815186e-01, 1.042480e-01, -6.781006e-02, - 4.589844e-02, -3.112793e-02, 2.062988e-02, -1.300049e-02, - 7.568359e-03, -3.784180e-03, 1.464844e-03, -2.441406e-04 }, - { -3.662109e-04, 1.403809e-03, -3.173828e-03, 5.859375e-03, - -9.765625e-03, 1.507568e-02, -2.252197e-02, 3.308105e-02, - -4.937744e-02, 7.861328e-02, -1.523438e-01, 9.348755e-01, - 2.314453e-01, -9.863281e-02, 5.877686e-02, -3.869629e-02, - 2.624512e-02, -1.776123e-02, 1.165771e-02, -7.263184e-03, - 4.150391e-03, -2.014160e-03, 7.324219e-04, -6.103516e-05 } -}; - -/** High band quantized gains for 23k85 in Q14 */ -static const uint16_t qua_hb_gain[16] = { - 3624, 4673, 5597, 6479, 7425, 8378, 9324, 10264, - 11210, 12206, 13391, 14844, 16770, 19655, 24289, 32728 -}; - -/** High-band post-processing FIR filters coefficients from Q15 */ -static const float bpf_6_7_coef[31] = { // band pass, 6kHz and 7kHz cutoffs - -2.441406e-04, 3.585815e-04, 2.441406e-04, - -2.059937e-04, -2.815248e-03, 8.560180e-03, - -1.084137e-02, 0.000000e+00, 2.897645e-02, - -6.774902e-02, 9.421540e-02, -8.380128e-02, - 2.706910e-02, 5.924987e-02, -1.373367e-01, - 1.687469e-01, - -1.373367e-01, 5.924987e-02, 2.706910e-02, - -8.380128e-02, 9.421540e-02, -6.774902e-02, - 2.897645e-02, 0.000000e+00, -1.084137e-02, - 8.560180e-03, -2.815248e-03, -2.059937e-04, - 2.441406e-04, 3.585815e-04, -2.441406e-04 -}; - -static const float lpf_7_coef[31] = { // low pass, 7kHz cutoff - -6.408691e-04, 1.434326e-03, -2.716064e-03, - 4.455566e-03, -6.195068e-03, 6.988525e-03, - -5.401611e-03, 0.000000e+00, 1.022339e-02, - -2.560425e-02, 4.531860e-02, -6.747437e-02, - 8.944702e-02, -1.080933e-01, 1.206360e-01, - 8.753052e-01, - 1.206360e-01, -1.080933e-01, 8.944702e-02, - -6.747437e-02, 4.531860e-02, -2.560425e-02, - 1.022339e-02, 0.000000e+00, -5.401611e-03, - 6.988525e-03, -6.195068e-03, 4.455566e-03, - -2.716064e-03, 1.434326e-03, -6.408691e-04 -}; - -/** Core frame sizes in each mode */ -static const uint16_t cf_sizes_wb[] = { - 132, 177, 253, 285, 317, 365, 397, 461, 477, - 40 /// SID/comfort noise frame -}; - -#endif /* AVCODEC_AMRWBDATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdec.c deleted file mode 100644 index 35c9cf6a2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/amrwbdec.c +++ /dev/null @@ -1,1281 +0,0 @@ -/* - * AMR wideband decoder - * Copyright (c) 2010 Marcelo Galvao Povoa - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A particular PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AMR wideband decoder - */ - -#include "libavutil/channel_layout.h" -#include "libavutil/common.h" -#include "libavutil/float_dsp.h" -#include "libavutil/lfg.h" -#include "libavutil/internal.h" - -#include "avcodec.h" -#include "lsp.h" -#include "celp_filters.h" -#include "celp_math.h" -#include "acelp_filters.h" -#include "acelp_vectors.h" -#include "acelp_pitch_delay.h" -#include "internal.h" - -#define AMR_USE_16BIT_TABLES -#include "amr.h" - -#include "amrwbdata.h" -#include "mips/amrwbdec_mips.h" - -typedef struct { - AMRWBFrame frame; ///< AMRWB parameters decoded from bitstream - enum Mode fr_cur_mode; ///< mode index of current frame - uint8_t fr_quality; ///< frame quality index (FQI) - float isf_cur[LP_ORDER]; ///< working ISF vector from current frame - float isf_q_past[LP_ORDER]; ///< quantized ISF vector of the previous frame - float isf_past_final[LP_ORDER]; ///< final processed ISF vector of the previous frame - double isp[4][LP_ORDER]; ///< ISP vectors from current frame - double isp_sub4_past[LP_ORDER]; ///< ISP vector for the 4th subframe of the previous frame - - float lp_coef[4][LP_ORDER]; ///< Linear Prediction Coefficients from ISP vector - - uint8_t base_pitch_lag; ///< integer part of pitch lag for the next relative subframe - uint8_t pitch_lag_int; ///< integer part of pitch lag of the previous subframe - - float excitation_buf[AMRWB_P_DELAY_MAX + LP_ORDER + 2 + AMRWB_SFR_SIZE]; ///< current excitation and all necessary excitation history - float *excitation; ///< points to current excitation in excitation_buf[] - - float pitch_vector[AMRWB_SFR_SIZE]; ///< adaptive codebook (pitch) vector for current subframe - float fixed_vector[AMRWB_SFR_SIZE]; ///< algebraic codebook (fixed) vector for current subframe - - float prediction_error[4]; ///< quantified prediction errors {20log10(^gamma_gc)} for previous four subframes - float pitch_gain[6]; ///< quantified pitch gains for the current and previous five subframes - float fixed_gain[2]; ///< quantified fixed gains for the current and previous subframes - - float tilt_coef; ///< {beta_1} related to the voicing of the previous subframe - - float prev_sparse_fixed_gain; ///< previous fixed gain; used by anti-sparseness to determine "onset" - uint8_t prev_ir_filter_nr; ///< previous impulse response filter "impNr": 0 - strong, 1 - medium, 2 - none - float prev_tr_gain; ///< previous initial gain used by noise enhancer for threshold - - float samples_az[LP_ORDER + AMRWB_SFR_SIZE]; ///< low-band samples and memory from synthesis at 12.8kHz - float samples_up[UPS_MEM_SIZE + AMRWB_SFR_SIZE]; ///< low-band samples and memory processed for upsampling - float samples_hb[LP_ORDER_16k + AMRWB_SFR_SIZE_16k]; ///< high-band samples and memory from synthesis at 16kHz - - float hpf_31_mem[2], hpf_400_mem[2]; ///< previous values in the high pass filters - float demph_mem[1]; ///< previous value in the de-emphasis filter - float bpf_6_7_mem[HB_FIR_SIZE]; ///< previous values in the high-band band pass filter - float lpf_7_mem[HB_FIR_SIZE]; ///< previous values in the high-band low pass filter - - AVLFG prng; ///< random number generator for white noise excitation - uint8_t first_frame; ///< flag active during decoding of the first frame - ACELPFContext acelpf_ctx; ///< context for filters for ACELP-based codecs - ACELPVContext acelpv_ctx; ///< context for vector operations for ACELP-based codecs - CELPFContext celpf_ctx; ///< context for filters for CELP-based codecs - CELPMContext celpm_ctx; ///< context for fixed point math operations - -} AMRWBContext; - -static av_cold int amrwb_decode_init(AVCodecContext *avctx) -{ - AMRWBContext *ctx = avctx->priv_data; - int i; - - if (avctx->channels > 1) { - avpriv_report_missing_feature(avctx, "multi-channel AMR"); - return AVERROR_PATCHWELCOME; - } - - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - if (!avctx->sample_rate) - avctx->sample_rate = 16000; - avctx->sample_fmt = AV_SAMPLE_FMT_FLT; - - av_lfg_init(&ctx->prng, 1); - - ctx->excitation = &ctx->excitation_buf[AMRWB_P_DELAY_MAX + LP_ORDER + 1]; - ctx->first_frame = 1; - - for (i = 0; i < LP_ORDER; i++) - ctx->isf_past_final[i] = isf_init[i] * (1.0f / (1 << 15)); - - for (i = 0; i < 4; i++) - ctx->prediction_error[i] = MIN_ENERGY; - - ff_acelp_filter_init(&ctx->acelpf_ctx); - ff_acelp_vectors_init(&ctx->acelpv_ctx); - ff_celp_filter_init(&ctx->celpf_ctx); - ff_celp_math_init(&ctx->celpm_ctx); - - return 0; -} - -/** - * Decode the frame header in the "MIME/storage" format. This format - * is simpler and does not carry the auxiliary frame information. - * - * @param[in] ctx The Context - * @param[in] buf Pointer to the input buffer - * - * @return The decoded header length in bytes - */ -static int decode_mime_header(AMRWBContext *ctx, const uint8_t *buf) -{ - /* Decode frame header (1st octet) */ - ctx->fr_cur_mode = buf[0] >> 3 & 0x0F; - ctx->fr_quality = (buf[0] & 0x4) == 0x4; - - return 1; -} - -/** - * Decode quantized ISF vectors using 36-bit indexes (6K60 mode only). - * - * @param[in] ind Array of 5 indexes - * @param[out] isf_q Buffer for isf_q[LP_ORDER] - * - */ -static void decode_isf_indices_36b(uint16_t *ind, float *isf_q) -{ - int i; - - for (i = 0; i < 9; i++) - isf_q[i] = dico1_isf[ind[0]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 7; i++) - isf_q[i + 9] = dico2_isf[ind[1]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 5; i++) - isf_q[i] += dico21_isf_36b[ind[2]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 4; i++) - isf_q[i + 5] += dico22_isf_36b[ind[3]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 7; i++) - isf_q[i + 9] += dico23_isf_36b[ind[4]][i] * (1.0f / (1 << 15)); -} - -/** - * Decode quantized ISF vectors using 46-bit indexes (except 6K60 mode). - * - * @param[in] ind Array of 7 indexes - * @param[out] isf_q Buffer for isf_q[LP_ORDER] - * - */ -static void decode_isf_indices_46b(uint16_t *ind, float *isf_q) -{ - int i; - - for (i = 0; i < 9; i++) - isf_q[i] = dico1_isf[ind[0]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 7; i++) - isf_q[i + 9] = dico2_isf[ind[1]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 3; i++) - isf_q[i] += dico21_isf[ind[2]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 3; i++) - isf_q[i + 3] += dico22_isf[ind[3]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 3; i++) - isf_q[i + 6] += dico23_isf[ind[4]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 3; i++) - isf_q[i + 9] += dico24_isf[ind[5]][i] * (1.0f / (1 << 15)); - - for (i = 0; i < 4; i++) - isf_q[i + 12] += dico25_isf[ind[6]][i] * (1.0f / (1 << 15)); -} - -/** - * Apply mean and past ISF values using the prediction factor. - * Updates past ISF vector. - * - * @param[in,out] isf_q Current quantized ISF - * @param[in,out] isf_past Past quantized ISF - * - */ -static void isf_add_mean_and_past(float *isf_q, float *isf_past) -{ - int i; - float tmp; - - for (i = 0; i < LP_ORDER; i++) { - tmp = isf_q[i]; - isf_q[i] += isf_mean[i] * (1.0f / (1 << 15)); - isf_q[i] += PRED_FACTOR * isf_past[i]; - isf_past[i] = tmp; - } -} - -/** - * Interpolate the fourth ISP vector from current and past frames - * to obtain an ISP vector for each subframe. - * - * @param[in,out] isp_q ISPs for each subframe - * @param[in] isp4_past Past ISP for subframe 4 - */ -static void interpolate_isp(double isp_q[4][LP_ORDER], const double *isp4_past) -{ - int i, k; - - for (k = 0; k < 3; k++) { - float c = isfp_inter[k]; - for (i = 0; i < LP_ORDER; i++) - isp_q[k][i] = (1.0 - c) * isp4_past[i] + c * isp_q[3][i]; - } -} - -/** - * Decode an adaptive codebook index into pitch lag (except 6k60, 8k85 modes). - * Calculate integer lag and fractional lag always using 1/4 resolution. - * In 1st and 3rd subframes the index is relative to last subframe integer lag. - * - * @param[out] lag_int Decoded integer pitch lag - * @param[out] lag_frac Decoded fractional pitch lag - * @param[in] pitch_index Adaptive codebook pitch index - * @param[in,out] base_lag_int Base integer lag used in relative subframes - * @param[in] subframe Current subframe index (0 to 3) - */ -static void decode_pitch_lag_high(int *lag_int, int *lag_frac, int pitch_index, - uint8_t *base_lag_int, int subframe) -{ - if (subframe == 0 || subframe == 2) { - if (pitch_index < 376) { - *lag_int = (pitch_index + 137) >> 2; - *lag_frac = pitch_index - (*lag_int << 2) + 136; - } else if (pitch_index < 440) { - *lag_int = (pitch_index + 257 - 376) >> 1; - *lag_frac = (pitch_index - (*lag_int << 1) + 256 - 376) << 1; - /* the actual resolution is 1/2 but expressed as 1/4 */ - } else { - *lag_int = pitch_index - 280; - *lag_frac = 0; - } - /* minimum lag for next subframe */ - *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0), - AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); - // XXX: the spec states clearly that *base_lag_int should be - // the nearest integer to *lag_int (minus 8), but the ref code - // actually always uses its floor, I'm following the latter - } else { - *lag_int = (pitch_index + 1) >> 2; - *lag_frac = pitch_index - (*lag_int << 2); - *lag_int += *base_lag_int; - } -} - -/** - * Decode an adaptive codebook index into pitch lag for 8k85 and 6k60 modes. - * The description is analogous to decode_pitch_lag_high, but in 6k60 the - * relative index is used for all subframes except the first. - */ -static void decode_pitch_lag_low(int *lag_int, int *lag_frac, int pitch_index, - uint8_t *base_lag_int, int subframe, enum Mode mode) -{ - if (subframe == 0 || (subframe == 2 && mode != MODE_6k60)) { - if (pitch_index < 116) { - *lag_int = (pitch_index + 69) >> 1; - *lag_frac = (pitch_index - (*lag_int << 1) + 68) << 1; - } else { - *lag_int = pitch_index - 24; - *lag_frac = 0; - } - // XXX: same problem as before - *base_lag_int = av_clip(*lag_int - 8 - (*lag_frac < 0), - AMRWB_P_DELAY_MIN, AMRWB_P_DELAY_MAX - 15); - } else { - *lag_int = (pitch_index + 1) >> 1; - *lag_frac = (pitch_index - (*lag_int << 1)) << 1; - *lag_int += *base_lag_int; - } -} - -/** - * Find the pitch vector by interpolating the past excitation at the - * pitch delay, which is obtained in this function. - * - * @param[in,out] ctx The context - * @param[in] amr_subframe Current subframe data - * @param[in] subframe Current subframe index (0 to 3) - */ -static void decode_pitch_vector(AMRWBContext *ctx, - const AMRWBSubFrame *amr_subframe, - const int subframe) -{ - int pitch_lag_int, pitch_lag_frac; - int i; - float *exc = ctx->excitation; - enum Mode mode = ctx->fr_cur_mode; - - if (mode <= MODE_8k85) { - decode_pitch_lag_low(&pitch_lag_int, &pitch_lag_frac, amr_subframe->adap, - &ctx->base_pitch_lag, subframe, mode); - } else - decode_pitch_lag_high(&pitch_lag_int, &pitch_lag_frac, amr_subframe->adap, - &ctx->base_pitch_lag, subframe); - - ctx->pitch_lag_int = pitch_lag_int; - pitch_lag_int += pitch_lag_frac > 0; - - /* Calculate the pitch vector by interpolating the past excitation at the - pitch lag using a hamming windowed sinc function */ - ctx->acelpf_ctx.acelp_interpolatef(exc, - exc + 1 - pitch_lag_int, - ac_inter, 4, - pitch_lag_frac + (pitch_lag_frac > 0 ? 0 : 4), - LP_ORDER, AMRWB_SFR_SIZE + 1); - - /* Check which pitch signal path should be used - * 6k60 and 8k85 modes have the ltp flag set to 0 */ - if (amr_subframe->ltp) { - memcpy(ctx->pitch_vector, exc, AMRWB_SFR_SIZE * sizeof(float)); - } else { - for (i = 0; i < AMRWB_SFR_SIZE; i++) - ctx->pitch_vector[i] = 0.18 * exc[i - 1] + 0.64 * exc[i] + - 0.18 * exc[i + 1]; - memcpy(exc, ctx->pitch_vector, AMRWB_SFR_SIZE * sizeof(float)); - } -} - -/** Get x bits in the index interval [lsb,lsb+len-1] inclusive */ -#define BIT_STR(x,lsb,len) (((x) >> (lsb)) & ((1 << (len)) - 1)) - -/** Get the bit at specified position */ -#define BIT_POS(x, p) (((x) >> (p)) & 1) - -/** - * The next six functions decode_[i]p_track decode exactly i pulses - * positions and amplitudes (-1 or 1) in a subframe track using - * an encoded pulse indexing (TS 26.190 section 5.8.2). - * - * The results are given in out[], in which a negative number means - * amplitude -1 and vice versa (i.e., ampl(x) = x / abs(x) ). - * - * @param[out] out Output buffer (writes i elements) - * @param[in] code Pulse index (no. of bits varies, see below) - * @param[in] m (log2) Number of potential positions - * @param[in] off Offset for decoded positions - */ -static inline void decode_1p_track(int *out, int code, int m, int off) -{ - int pos = BIT_STR(code, 0, m) + off; ///code: m+1 bits - - out[0] = BIT_POS(code, m) ? -pos : pos; -} - -static inline void decode_2p_track(int *out, int code, int m, int off) ///code: 2m+1 bits -{ - int pos0 = BIT_STR(code, m, m) + off; - int pos1 = BIT_STR(code, 0, m) + off; - - out[0] = BIT_POS(code, 2*m) ? -pos0 : pos0; - out[1] = BIT_POS(code, 2*m) ? -pos1 : pos1; - out[1] = pos0 > pos1 ? -out[1] : out[1]; -} - -static void decode_3p_track(int *out, int code, int m, int off) ///code: 3m+1 bits -{ - int half_2p = BIT_POS(code, 2*m - 1) << (m - 1); - - decode_2p_track(out, BIT_STR(code, 0, 2*m - 1), - m - 1, off + half_2p); - decode_1p_track(out + 2, BIT_STR(code, 2*m, m + 1), m, off); -} - -static void decode_4p_track(int *out, int code, int m, int off) ///code: 4m bits -{ - int half_4p, subhalf_2p; - int b_offset = 1 << (m - 1); - - switch (BIT_STR(code, 4*m - 2, 2)) { /* case ID (2 bits) */ - case 0: /* 0 pulses in A, 4 pulses in B or vice versa */ - half_4p = BIT_POS(code, 4*m - 3) << (m - 1); // which has 4 pulses - subhalf_2p = BIT_POS(code, 2*m - 3) << (m - 2); - - decode_2p_track(out, BIT_STR(code, 0, 2*m - 3), - m - 2, off + half_4p + subhalf_2p); - decode_2p_track(out + 2, BIT_STR(code, 2*m - 2, 2*m - 1), - m - 1, off + half_4p); - break; - case 1: /* 1 pulse in A, 3 pulses in B */ - decode_1p_track(out, BIT_STR(code, 3*m - 2, m), - m - 1, off); - decode_3p_track(out + 1, BIT_STR(code, 0, 3*m - 2), - m - 1, off + b_offset); - break; - case 2: /* 2 pulses in each half */ - decode_2p_track(out, BIT_STR(code, 2*m - 1, 2*m - 1), - m - 1, off); - decode_2p_track(out + 2, BIT_STR(code, 0, 2*m - 1), - m - 1, off + b_offset); - break; - case 3: /* 3 pulses in A, 1 pulse in B */ - decode_3p_track(out, BIT_STR(code, m, 3*m - 2), - m - 1, off); - decode_1p_track(out + 3, BIT_STR(code, 0, m), - m - 1, off + b_offset); - break; - } -} - -static void decode_5p_track(int *out, int code, int m, int off) ///code: 5m bits -{ - int half_3p = BIT_POS(code, 5*m - 1) << (m - 1); - - decode_3p_track(out, BIT_STR(code, 2*m + 1, 3*m - 2), - m - 1, off + half_3p); - - decode_2p_track(out + 3, BIT_STR(code, 0, 2*m + 1), m, off); -} - -static void decode_6p_track(int *out, int code, int m, int off) ///code: 6m-2 bits -{ - int b_offset = 1 << (m - 1); - /* which half has more pulses in cases 0 to 2 */ - int half_more = BIT_POS(code, 6*m - 5) << (m - 1); - int half_other = b_offset - half_more; - - switch (BIT_STR(code, 6*m - 4, 2)) { /* case ID (2 bits) */ - case 0: /* 0 pulses in A, 6 pulses in B or vice versa */ - decode_1p_track(out, BIT_STR(code, 0, m), - m - 1, off + half_more); - decode_5p_track(out + 1, BIT_STR(code, m, 5*m - 5), - m - 1, off + half_more); - break; - case 1: /* 1 pulse in A, 5 pulses in B or vice versa */ - decode_1p_track(out, BIT_STR(code, 0, m), - m - 1, off + half_other); - decode_5p_track(out + 1, BIT_STR(code, m, 5*m - 5), - m - 1, off + half_more); - break; - case 2: /* 2 pulses in A, 4 pulses in B or vice versa */ - decode_2p_track(out, BIT_STR(code, 0, 2*m - 1), - m - 1, off + half_other); - decode_4p_track(out + 2, BIT_STR(code, 2*m - 1, 4*m - 4), - m - 1, off + half_more); - break; - case 3: /* 3 pulses in A, 3 pulses in B */ - decode_3p_track(out, BIT_STR(code, 3*m - 2, 3*m - 2), - m - 1, off); - decode_3p_track(out + 3, BIT_STR(code, 0, 3*m - 2), - m - 1, off + b_offset); - break; - } -} - -/** - * Decode the algebraic codebook index to pulse positions and signs, - * then construct the algebraic codebook vector. - * - * @param[out] fixed_vector Buffer for the fixed codebook excitation - * @param[in] pulse_hi MSBs part of the pulse index array (higher modes only) - * @param[in] pulse_lo LSBs part of the pulse index array - * @param[in] mode Mode of the current frame - */ -static void decode_fixed_vector(float *fixed_vector, const uint16_t *pulse_hi, - const uint16_t *pulse_lo, const enum Mode mode) -{ - /* sig_pos stores for each track the decoded pulse position indexes - * (1-based) multiplied by its corresponding amplitude (+1 or -1) */ - int sig_pos[4][6]; - int spacing = (mode == MODE_6k60) ? 2 : 4; - int i, j; - - switch (mode) { - case MODE_6k60: - for (i = 0; i < 2; i++) - decode_1p_track(sig_pos[i], pulse_lo[i], 5, 1); - break; - case MODE_8k85: - for (i = 0; i < 4; i++) - decode_1p_track(sig_pos[i], pulse_lo[i], 4, 1); - break; - case MODE_12k65: - for (i = 0; i < 4; i++) - decode_2p_track(sig_pos[i], pulse_lo[i], 4, 1); - break; - case MODE_14k25: - for (i = 0; i < 2; i++) - decode_3p_track(sig_pos[i], pulse_lo[i], 4, 1); - for (i = 2; i < 4; i++) - decode_2p_track(sig_pos[i], pulse_lo[i], 4, 1); - break; - case MODE_15k85: - for (i = 0; i < 4; i++) - decode_3p_track(sig_pos[i], pulse_lo[i], 4, 1); - break; - case MODE_18k25: - for (i = 0; i < 4; i++) - decode_4p_track(sig_pos[i], (int) pulse_lo[i] + - ((int) pulse_hi[i] << 14), 4, 1); - break; - case MODE_19k85: - for (i = 0; i < 2; i++) - decode_5p_track(sig_pos[i], (int) pulse_lo[i] + - ((int) pulse_hi[i] << 10), 4, 1); - for (i = 2; i < 4; i++) - decode_4p_track(sig_pos[i], (int) pulse_lo[i] + - ((int) pulse_hi[i] << 14), 4, 1); - break; - case MODE_23k05: - case MODE_23k85: - for (i = 0; i < 4; i++) - decode_6p_track(sig_pos[i], (int) pulse_lo[i] + - ((int) pulse_hi[i] << 11), 4, 1); - break; - default: break; - } - - memset(fixed_vector, 0, sizeof(float) * AMRWB_SFR_SIZE); - - for (i = 0; i < 4; i++) - for (j = 0; j < pulses_nb_per_mode_tr[mode][i]; j++) { - int pos = (FFABS(sig_pos[i][j]) - 1) * spacing + i; - - fixed_vector[pos] += sig_pos[i][j] < 0 ? -1.0 : 1.0; - } -} - -/** - * Decode pitch gain and fixed gain correction factor. - * - * @param[in] vq_gain Vector-quantized index for gains - * @param[in] mode Mode of the current frame - * @param[out] fixed_gain_factor Decoded fixed gain correction factor - * @param[out] pitch_gain Decoded pitch gain - */ -static void decode_gains(const uint8_t vq_gain, const enum Mode mode, - float *fixed_gain_factor, float *pitch_gain) -{ - const int16_t *gains = (mode <= MODE_8k85 ? qua_gain_6b[vq_gain] : - qua_gain_7b[vq_gain]); - - *pitch_gain = gains[0] * (1.0f / (1 << 14)); - *fixed_gain_factor = gains[1] * (1.0f / (1 << 11)); -} - -/** - * Apply pitch sharpening filters to the fixed codebook vector. - * - * @param[in] ctx The context - * @param[in,out] fixed_vector Fixed codebook excitation - */ -// XXX: Spec states this procedure should be applied when the pitch -// lag is less than 64, but this checking seems absent in reference and AMR-NB -static void pitch_sharpening(AMRWBContext *ctx, float *fixed_vector) -{ - int i; - - /* Tilt part */ - for (i = AMRWB_SFR_SIZE - 1; i != 0; i--) - fixed_vector[i] -= fixed_vector[i - 1] * ctx->tilt_coef; - - /* Periodicity enhancement part */ - for (i = ctx->pitch_lag_int; i < AMRWB_SFR_SIZE; i++) - fixed_vector[i] += fixed_vector[i - ctx->pitch_lag_int] * 0.85; -} - -/** - * Calculate the voicing factor (-1.0 = unvoiced to 1.0 = voiced). - * - * @param[in] p_vector, f_vector Pitch and fixed excitation vectors - * @param[in] p_gain, f_gain Pitch and fixed gains - * @param[in] ctx The context - */ -// XXX: There is something wrong with the precision here! The magnitudes -// of the energies are not correct. Please check the reference code carefully -static float voice_factor(float *p_vector, float p_gain, - float *f_vector, float f_gain, - CELPMContext *ctx) -{ - double p_ener = (double) ctx->dot_productf(p_vector, p_vector, - AMRWB_SFR_SIZE) * - p_gain * p_gain; - double f_ener = (double) ctx->dot_productf(f_vector, f_vector, - AMRWB_SFR_SIZE) * - f_gain * f_gain; - - return (p_ener - f_ener) / (p_ener + f_ener); -} - -/** - * Reduce fixed vector sparseness by smoothing with one of three IR filters, - * also known as "adaptive phase dispersion". - * - * @param[in] ctx The context - * @param[in,out] fixed_vector Unfiltered fixed vector - * @param[out] buf Space for modified vector if necessary - * - * @return The potentially overwritten filtered fixed vector address - */ -static float *anti_sparseness(AMRWBContext *ctx, - float *fixed_vector, float *buf) -{ - int ir_filter_nr; - - if (ctx->fr_cur_mode > MODE_8k85) // no filtering in higher modes - return fixed_vector; - - if (ctx->pitch_gain[0] < 0.6) { - ir_filter_nr = 0; // strong filtering - } else if (ctx->pitch_gain[0] < 0.9) { - ir_filter_nr = 1; // medium filtering - } else - ir_filter_nr = 2; // no filtering - - /* detect 'onset' */ - if (ctx->fixed_gain[0] > 3.0 * ctx->fixed_gain[1]) { - if (ir_filter_nr < 2) - ir_filter_nr++; - } else { - int i, count = 0; - - for (i = 0; i < 6; i++) - if (ctx->pitch_gain[i] < 0.6) - count++; - - if (count > 2) - ir_filter_nr = 0; - - if (ir_filter_nr > ctx->prev_ir_filter_nr + 1) - ir_filter_nr--; - } - - /* update ir filter strength history */ - ctx->prev_ir_filter_nr = ir_filter_nr; - - ir_filter_nr += (ctx->fr_cur_mode == MODE_8k85); - - if (ir_filter_nr < 2) { - int i; - const float *coef = ir_filters_lookup[ir_filter_nr]; - - /* Circular convolution code in the reference - * decoder was modified to avoid using one - * extra array. The filtered vector is given by: - * - * c2(n) = sum(i,0,len-1){ c(i) * coef( (n - i + len) % len ) } - */ - - memset(buf, 0, sizeof(float) * AMRWB_SFR_SIZE); - for (i = 0; i < AMRWB_SFR_SIZE; i++) - if (fixed_vector[i]) - ff_celp_circ_addf(buf, buf, coef, i, fixed_vector[i], - AMRWB_SFR_SIZE); - fixed_vector = buf; - } - - return fixed_vector; -} - -/** - * Calculate a stability factor {teta} based on distance between - * current and past isf. A value of 1 shows maximum signal stability. - */ -static float stability_factor(const float *isf, const float *isf_past) -{ - int i; - float acc = 0.0; - - for (i = 0; i < LP_ORDER - 1; i++) - acc += (isf[i] - isf_past[i]) * (isf[i] - isf_past[i]); - - // XXX: This part is not so clear from the reference code - // the result is more accurate changing the "/ 256" to "* 512" - return FFMAX(0.0, 1.25 - acc * 0.8 * 512); -} - -/** - * Apply a non-linear fixed gain smoothing in order to reduce - * fluctuation in the energy of excitation. - * - * @param[in] fixed_gain Unsmoothed fixed gain - * @param[in,out] prev_tr_gain Previous threshold gain (updated) - * @param[in] voice_fac Frame voicing factor - * @param[in] stab_fac Frame stability factor - * - * @return The smoothed gain - */ -static float noise_enhancer(float fixed_gain, float *prev_tr_gain, - float voice_fac, float stab_fac) -{ - float sm_fac = 0.5 * (1 - voice_fac) * stab_fac; - float g0; - - // XXX: the following fixed-point constants used to in(de)crement - // gain by 1.5dB were taken from the reference code, maybe it could - // be simpler - if (fixed_gain < *prev_tr_gain) { - g0 = FFMIN(*prev_tr_gain, fixed_gain + fixed_gain * - (6226 * (1.0f / (1 << 15)))); // +1.5 dB - } else - g0 = FFMAX(*prev_tr_gain, fixed_gain * - (27536 * (1.0f / (1 << 15)))); // -1.5 dB - - *prev_tr_gain = g0; // update next frame threshold - - return sm_fac * g0 + (1 - sm_fac) * fixed_gain; -} - -/** - * Filter the fixed_vector to emphasize the higher frequencies. - * - * @param[in,out] fixed_vector Fixed codebook vector - * @param[in] voice_fac Frame voicing factor - */ -static void pitch_enhancer(float *fixed_vector, float voice_fac) -{ - int i; - float cpe = 0.125 * (1 + voice_fac); - float last = fixed_vector[0]; // holds c(i - 1) - - fixed_vector[0] -= cpe * fixed_vector[1]; - - for (i = 1; i < AMRWB_SFR_SIZE - 1; i++) { - float cur = fixed_vector[i]; - - fixed_vector[i] -= cpe * (last + fixed_vector[i + 1]); - last = cur; - } - - fixed_vector[AMRWB_SFR_SIZE - 1] -= cpe * last; -} - -/** - * Conduct 16th order linear predictive coding synthesis from excitation. - * - * @param[in] ctx Pointer to the AMRWBContext - * @param[in] lpc Pointer to the LPC coefficients - * @param[out] excitation Buffer for synthesis final excitation - * @param[in] fixed_gain Fixed codebook gain for synthesis - * @param[in] fixed_vector Algebraic codebook vector - * @param[in,out] samples Pointer to the output samples and memory - */ -static void synthesis(AMRWBContext *ctx, float *lpc, float *excitation, - float fixed_gain, const float *fixed_vector, - float *samples) -{ - ctx->acelpv_ctx.weighted_vector_sumf(excitation, ctx->pitch_vector, fixed_vector, - ctx->pitch_gain[0], fixed_gain, AMRWB_SFR_SIZE); - - /* emphasize pitch vector contribution in low bitrate modes */ - if (ctx->pitch_gain[0] > 0.5 && ctx->fr_cur_mode <= MODE_8k85) { - int i; - float energy = ctx->celpm_ctx.dot_productf(excitation, excitation, - AMRWB_SFR_SIZE); - - // XXX: Weird part in both ref code and spec. A unknown parameter - // {beta} seems to be identical to the current pitch gain - float pitch_factor = 0.25 * ctx->pitch_gain[0] * ctx->pitch_gain[0]; - - for (i = 0; i < AMRWB_SFR_SIZE; i++) - excitation[i] += pitch_factor * ctx->pitch_vector[i]; - - ff_scale_vector_to_given_sum_of_squares(excitation, excitation, - energy, AMRWB_SFR_SIZE); - } - - ctx->celpf_ctx.celp_lp_synthesis_filterf(samples, lpc, excitation, - AMRWB_SFR_SIZE, LP_ORDER); -} - -/** - * Apply to synthesis a de-emphasis filter of the form: - * H(z) = 1 / (1 - m * z^-1) - * - * @param[out] out Output buffer - * @param[in] in Input samples array with in[-1] - * @param[in] m Filter coefficient - * @param[in,out] mem State from last filtering - */ -static void de_emphasis(float *out, float *in, float m, float mem[1]) -{ - int i; - - out[0] = in[0] + m * mem[0]; - - for (i = 1; i < AMRWB_SFR_SIZE; i++) - out[i] = in[i] + out[i - 1] * m; - - mem[0] = out[AMRWB_SFR_SIZE - 1]; -} - -/** - * Upsample a signal by 5/4 ratio (from 12.8kHz to 16kHz) using - * a FIR interpolation filter. Uses past data from before *in address. - * - * @param[out] out Buffer for interpolated signal - * @param[in] in Current signal data (length 0.8*o_size) - * @param[in] o_size Output signal length - * @param[in] ctx The context - */ -static void upsample_5_4(float *out, const float *in, int o_size, CELPMContext *ctx) -{ - const float *in0 = in - UPS_FIR_SIZE + 1; - int i, j, k; - int int_part = 0, frac_part; - - i = 0; - for (j = 0; j < o_size / 5; j++) { - out[i] = in[int_part]; - frac_part = 4; - i++; - - for (k = 1; k < 5; k++) { - out[i] = ctx->dot_productf(in0 + int_part, - upsample_fir[4 - frac_part], - UPS_MEM_SIZE); - int_part++; - frac_part--; - i++; - } - } -} - -/** - * Calculate the high-band gain based on encoded index (23k85 mode) or - * on the low-band speech signal and the Voice Activity Detection flag. - * - * @param[in] ctx The context - * @param[in] synth LB speech synthesis at 12.8k - * @param[in] hb_idx Gain index for mode 23k85 only - * @param[in] vad VAD flag for the frame - */ -static float find_hb_gain(AMRWBContext *ctx, const float *synth, - uint16_t hb_idx, uint8_t vad) -{ - int wsp = (vad > 0); - float tilt; - - if (ctx->fr_cur_mode == MODE_23k85) - return qua_hb_gain[hb_idx] * (1.0f / (1 << 14)); - - tilt = ctx->celpm_ctx.dot_productf(synth, synth + 1, AMRWB_SFR_SIZE - 1) / - ctx->celpm_ctx.dot_productf(synth, synth, AMRWB_SFR_SIZE); - - /* return gain bounded by [0.1, 1.0] */ - return av_clipf((1.0 - FFMAX(0.0, tilt)) * (1.25 - 0.25 * wsp), 0.1, 1.0); -} - -/** - * Generate the high-band excitation with the same energy from the lower - * one and scaled by the given gain. - * - * @param[in] ctx The context - * @param[out] hb_exc Buffer for the excitation - * @param[in] synth_exc Low-band excitation used for synthesis - * @param[in] hb_gain Wanted excitation gain - */ -static void scaled_hb_excitation(AMRWBContext *ctx, float *hb_exc, - const float *synth_exc, float hb_gain) -{ - int i; - float energy = ctx->celpm_ctx.dot_productf(synth_exc, synth_exc, - AMRWB_SFR_SIZE); - - /* Generate a white-noise excitation */ - for (i = 0; i < AMRWB_SFR_SIZE_16k; i++) - hb_exc[i] = 32768.0 - (uint16_t) av_lfg_get(&ctx->prng); - - ff_scale_vector_to_given_sum_of_squares(hb_exc, hb_exc, - energy * hb_gain * hb_gain, - AMRWB_SFR_SIZE_16k); -} - -/** - * Calculate the auto-correlation for the ISF difference vector. - */ -static float auto_correlation(float *diff_isf, float mean, int lag) -{ - int i; - float sum = 0.0; - - for (i = 7; i < LP_ORDER - 2; i++) { - float prod = (diff_isf[i] - mean) * (diff_isf[i - lag] - mean); - sum += prod * prod; - } - return sum; -} - -/** - * Extrapolate a ISF vector to the 16kHz range (20th order LP) - * used at mode 6k60 LP filter for the high frequency band. - * - * @param[out] isf Buffer for extrapolated isf; contains LP_ORDER - * values on input - */ -static void extrapolate_isf(float isf[LP_ORDER_16k]) -{ - float diff_isf[LP_ORDER - 2], diff_mean; - float corr_lag[3]; - float est, scale; - int i, j, i_max_corr; - - isf[LP_ORDER_16k - 1] = isf[LP_ORDER - 1]; - - /* Calculate the difference vector */ - for (i = 0; i < LP_ORDER - 2; i++) - diff_isf[i] = isf[i + 1] - isf[i]; - - diff_mean = 0.0; - for (i = 2; i < LP_ORDER - 2; i++) - diff_mean += diff_isf[i] * (1.0f / (LP_ORDER - 4)); - - /* Find which is the maximum autocorrelation */ - i_max_corr = 0; - for (i = 0; i < 3; i++) { - corr_lag[i] = auto_correlation(diff_isf, diff_mean, i + 2); - - if (corr_lag[i] > corr_lag[i_max_corr]) - i_max_corr = i; - } - i_max_corr++; - - for (i = LP_ORDER - 1; i < LP_ORDER_16k - 1; i++) - isf[i] = isf[i - 1] + isf[i - 1 - i_max_corr] - - isf[i - 2 - i_max_corr]; - - /* Calculate an estimate for ISF(18) and scale ISF based on the error */ - est = 7965 + (isf[2] - isf[3] - isf[4]) / 6.0; - scale = 0.5 * (FFMIN(est, 7600) - isf[LP_ORDER - 2]) / - (isf[LP_ORDER_16k - 2] - isf[LP_ORDER - 2]); - - for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++) - diff_isf[j] = scale * (isf[i] - isf[i - 1]); - - /* Stability insurance */ - for (i = 1; i < LP_ORDER_16k - LP_ORDER; i++) - if (diff_isf[i] + diff_isf[i - 1] < 5.0) { - if (diff_isf[i] > diff_isf[i - 1]) { - diff_isf[i - 1] = 5.0 - diff_isf[i]; - } else - diff_isf[i] = 5.0 - diff_isf[i - 1]; - } - - for (i = LP_ORDER - 1, j = 0; i < LP_ORDER_16k - 1; i++, j++) - isf[i] = isf[i - 1] + diff_isf[j] * (1.0f / (1 << 15)); - - /* Scale the ISF vector for 16000 Hz */ - for (i = 0; i < LP_ORDER_16k - 1; i++) - isf[i] *= 0.8; -} - -/** - * Spectral expand the LP coefficients using the equation: - * y[i] = x[i] * (gamma ** i) - * - * @param[out] out Output buffer (may use input array) - * @param[in] lpc LP coefficients array - * @param[in] gamma Weighting factor - * @param[in] size LP array size - */ -static void lpc_weighting(float *out, const float *lpc, float gamma, int size) -{ - int i; - float fac = gamma; - - for (i = 0; i < size; i++) { - out[i] = lpc[i] * fac; - fac *= gamma; - } -} - -/** - * Conduct 20th order linear predictive coding synthesis for the high - * frequency band excitation at 16kHz. - * - * @param[in] ctx The context - * @param[in] subframe Current subframe index (0 to 3) - * @param[in,out] samples Pointer to the output speech samples - * @param[in] exc Generated white-noise scaled excitation - * @param[in] isf Current frame isf vector - * @param[in] isf_past Past frame final isf vector - */ -static void hb_synthesis(AMRWBContext *ctx, int subframe, float *samples, - const float *exc, const float *isf, const float *isf_past) -{ - float hb_lpc[LP_ORDER_16k]; - enum Mode mode = ctx->fr_cur_mode; - - if (mode == MODE_6k60) { - float e_isf[LP_ORDER_16k]; // ISF vector for extrapolation - double e_isp[LP_ORDER_16k]; - - ctx->acelpv_ctx.weighted_vector_sumf(e_isf, isf_past, isf, isfp_inter[subframe], - 1.0 - isfp_inter[subframe], LP_ORDER); - - extrapolate_isf(e_isf); - - e_isf[LP_ORDER_16k - 1] *= 2.0; - ff_acelp_lsf2lspd(e_isp, e_isf, LP_ORDER_16k); - ff_amrwb_lsp2lpc(e_isp, hb_lpc, LP_ORDER_16k); - - lpc_weighting(hb_lpc, hb_lpc, 0.9, LP_ORDER_16k); - } else { - lpc_weighting(hb_lpc, ctx->lp_coef[subframe], 0.6, LP_ORDER); - } - - ctx->celpf_ctx.celp_lp_synthesis_filterf(samples, hb_lpc, exc, AMRWB_SFR_SIZE_16k, - (mode == MODE_6k60) ? LP_ORDER_16k : LP_ORDER); -} - -/** - * Apply a 15th order filter to high-band samples. - * The filter characteristic depends on the given coefficients. - * - * @param[out] out Buffer for filtered output - * @param[in] fir_coef Filter coefficients - * @param[in,out] mem State from last filtering (updated) - * @param[in] in Input speech data (high-band) - * - * @remark It is safe to pass the same array in in and out parameters - */ - -#ifndef hb_fir_filter -static void hb_fir_filter(float *out, const float fir_coef[HB_FIR_SIZE + 1], - float mem[HB_FIR_SIZE], const float *in) -{ - int i, j; - float data[AMRWB_SFR_SIZE_16k + HB_FIR_SIZE]; // past and current samples - - memcpy(data, mem, HB_FIR_SIZE * sizeof(float)); - memcpy(data + HB_FIR_SIZE, in, AMRWB_SFR_SIZE_16k * sizeof(float)); - - for (i = 0; i < AMRWB_SFR_SIZE_16k; i++) { - out[i] = 0.0; - for (j = 0; j <= HB_FIR_SIZE; j++) - out[i] += data[i + j] * fir_coef[j]; - } - - memcpy(mem, data + AMRWB_SFR_SIZE_16k, HB_FIR_SIZE * sizeof(float)); -} -#endif /* hb_fir_filter */ - -/** - * Update context state before the next subframe. - */ -static void update_sub_state(AMRWBContext *ctx) -{ - memmove(&ctx->excitation_buf[0], &ctx->excitation_buf[AMRWB_SFR_SIZE], - (AMRWB_P_DELAY_MAX + LP_ORDER + 1) * sizeof(float)); - - memmove(&ctx->pitch_gain[1], &ctx->pitch_gain[0], 5 * sizeof(float)); - memmove(&ctx->fixed_gain[1], &ctx->fixed_gain[0], 1 * sizeof(float)); - - memmove(&ctx->samples_az[0], &ctx->samples_az[AMRWB_SFR_SIZE], - LP_ORDER * sizeof(float)); - memmove(&ctx->samples_up[0], &ctx->samples_up[AMRWB_SFR_SIZE], - UPS_MEM_SIZE * sizeof(float)); - memmove(&ctx->samples_hb[0], &ctx->samples_hb[AMRWB_SFR_SIZE_16k], - LP_ORDER_16k * sizeof(float)); -} - -static int amrwb_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AMRWBContext *ctx = avctx->priv_data; - AVFrame *frame = data; - AMRWBFrame *cf = &ctx->frame; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int expected_fr_size, header_size; - float *buf_out; - float spare_vector[AMRWB_SFR_SIZE]; // extra stack space to hold result from anti-sparseness processing - float fixed_gain_factor; // fixed gain correction factor (gamma) - float *synth_fixed_vector; // pointer to the fixed vector that synthesis should use - float synth_fixed_gain; // the fixed gain that synthesis should use - float voice_fac, stab_fac; // parameters used for gain smoothing - float synth_exc[AMRWB_SFR_SIZE]; // post-processed excitation for synthesis - float hb_exc[AMRWB_SFR_SIZE_16k]; // excitation for the high frequency band - float hb_samples[AMRWB_SFR_SIZE_16k]; // filtered high-band samples from synthesis - float hb_gain; - int sub, i, ret; - - /* get output buffer */ - frame->nb_samples = 4 * AMRWB_SFR_SIZE_16k; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - buf_out = (float *)frame->data[0]; - - header_size = decode_mime_header(ctx, buf); - if (ctx->fr_cur_mode > MODE_SID) { - av_log(avctx, AV_LOG_ERROR, - "Invalid mode %d\n", ctx->fr_cur_mode); - return AVERROR_INVALIDDATA; - } - expected_fr_size = ((cf_sizes_wb[ctx->fr_cur_mode] + 7) >> 3) + 1; - - if (buf_size < expected_fr_size) { - av_log(avctx, AV_LOG_ERROR, - "Frame too small (%d bytes). Truncated file?\n", buf_size); - *got_frame_ptr = 0; - return AVERROR_INVALIDDATA; - } - - if (!ctx->fr_quality || ctx->fr_cur_mode > MODE_SID) - av_log(avctx, AV_LOG_ERROR, "Encountered a bad or corrupted frame\n"); - - if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */ - avpriv_request_sample(avctx, "SID mode"); - return AVERROR_PATCHWELCOME; - } - - ff_amr_bit_reorder((uint16_t *) &ctx->frame, sizeof(AMRWBFrame), - buf + header_size, amr_bit_orderings_by_mode[ctx->fr_cur_mode]); - - /* Decode the quantized ISF vector */ - if (ctx->fr_cur_mode == MODE_6k60) { - decode_isf_indices_36b(cf->isp_id, ctx->isf_cur); - } else { - decode_isf_indices_46b(cf->isp_id, ctx->isf_cur); - } - - isf_add_mean_and_past(ctx->isf_cur, ctx->isf_q_past); - ff_set_min_dist_lsf(ctx->isf_cur, MIN_ISF_SPACING, LP_ORDER - 1); - - stab_fac = stability_factor(ctx->isf_cur, ctx->isf_past_final); - - ctx->isf_cur[LP_ORDER - 1] *= 2.0; - ff_acelp_lsf2lspd(ctx->isp[3], ctx->isf_cur, LP_ORDER); - - /* Generate a ISP vector for each subframe */ - if (ctx->first_frame) { - ctx->first_frame = 0; - memcpy(ctx->isp_sub4_past, ctx->isp[3], LP_ORDER * sizeof(double)); - } - interpolate_isp(ctx->isp, ctx->isp_sub4_past); - - for (sub = 0; sub < 4; sub++) - ff_amrwb_lsp2lpc(ctx->isp[sub], ctx->lp_coef[sub], LP_ORDER); - - for (sub = 0; sub < 4; sub++) { - const AMRWBSubFrame *cur_subframe = &cf->subframe[sub]; - float *sub_buf = buf_out + sub * AMRWB_SFR_SIZE_16k; - - /* Decode adaptive codebook (pitch vector) */ - decode_pitch_vector(ctx, cur_subframe, sub); - /* Decode innovative codebook (fixed vector) */ - decode_fixed_vector(ctx->fixed_vector, cur_subframe->pul_ih, - cur_subframe->pul_il, ctx->fr_cur_mode); - - pitch_sharpening(ctx, ctx->fixed_vector); - - decode_gains(cur_subframe->vq_gain, ctx->fr_cur_mode, - &fixed_gain_factor, &ctx->pitch_gain[0]); - - ctx->fixed_gain[0] = - ff_amr_set_fixed_gain(fixed_gain_factor, - ctx->celpm_ctx.dot_productf(ctx->fixed_vector, - ctx->fixed_vector, - AMRWB_SFR_SIZE) / - AMRWB_SFR_SIZE, - ctx->prediction_error, - ENERGY_MEAN, energy_pred_fac); - - /* Calculate voice factor and store tilt for next subframe */ - voice_fac = voice_factor(ctx->pitch_vector, ctx->pitch_gain[0], - ctx->fixed_vector, ctx->fixed_gain[0], - &ctx->celpm_ctx); - ctx->tilt_coef = voice_fac * 0.25 + 0.25; - - /* Construct current excitation */ - for (i = 0; i < AMRWB_SFR_SIZE; i++) { - ctx->excitation[i] *= ctx->pitch_gain[0]; - ctx->excitation[i] += ctx->fixed_gain[0] * ctx->fixed_vector[i]; - ctx->excitation[i] = truncf(ctx->excitation[i]); - } - - /* Post-processing of excitation elements */ - synth_fixed_gain = noise_enhancer(ctx->fixed_gain[0], &ctx->prev_tr_gain, - voice_fac, stab_fac); - - synth_fixed_vector = anti_sparseness(ctx, ctx->fixed_vector, - spare_vector); - - pitch_enhancer(synth_fixed_vector, voice_fac); - - synthesis(ctx, ctx->lp_coef[sub], synth_exc, synth_fixed_gain, - synth_fixed_vector, &ctx->samples_az[LP_ORDER]); - - /* Synthesis speech post-processing */ - de_emphasis(&ctx->samples_up[UPS_MEM_SIZE], - &ctx->samples_az[LP_ORDER], PREEMPH_FAC, ctx->demph_mem); - - ctx->acelpf_ctx.acelp_apply_order_2_transfer_function(&ctx->samples_up[UPS_MEM_SIZE], - &ctx->samples_up[UPS_MEM_SIZE], hpf_zeros, hpf_31_poles, - hpf_31_gain, ctx->hpf_31_mem, AMRWB_SFR_SIZE); - - upsample_5_4(sub_buf, &ctx->samples_up[UPS_FIR_SIZE], - AMRWB_SFR_SIZE_16k, &ctx->celpm_ctx); - - /* High frequency band (6.4 - 7.0 kHz) generation part */ - ctx->acelpf_ctx.acelp_apply_order_2_transfer_function(hb_samples, - &ctx->samples_up[UPS_MEM_SIZE], hpf_zeros, hpf_400_poles, - hpf_400_gain, ctx->hpf_400_mem, AMRWB_SFR_SIZE); - - hb_gain = find_hb_gain(ctx, hb_samples, - cur_subframe->hb_gain, cf->vad); - - scaled_hb_excitation(ctx, hb_exc, synth_exc, hb_gain); - - hb_synthesis(ctx, sub, &ctx->samples_hb[LP_ORDER_16k], - hb_exc, ctx->isf_cur, ctx->isf_past_final); - - /* High-band post-processing filters */ - hb_fir_filter(hb_samples, bpf_6_7_coef, ctx->bpf_6_7_mem, - &ctx->samples_hb[LP_ORDER_16k]); - - if (ctx->fr_cur_mode == MODE_23k85) - hb_fir_filter(hb_samples, lpf_7_coef, ctx->lpf_7_mem, - hb_samples); - - /* Add the low and high frequency bands */ - for (i = 0; i < AMRWB_SFR_SIZE_16k; i++) - sub_buf[i] = (sub_buf[i] + hb_samples[i]) * (1.0f / (1 << 15)); - - /* Update buffers and history */ - update_sub_state(ctx); - } - - /* update state for next frame */ - memcpy(ctx->isp_sub4_past, ctx->isp[3], LP_ORDER * sizeof(ctx->isp[3][0])); - memcpy(ctx->isf_past_final, ctx->isf_cur, LP_ORDER * sizeof(float)); - - *got_frame_ptr = 1; - - return expected_fr_size; -} - -AVCodec ff_amrwb_decoder = { - .name = "amrwb", - .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_AMR_WB, - .priv_data_size = sizeof(AMRWBContext), - .init = amrwb_decode_init, - .decode = amrwb_decode_frame, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/apedec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/apedec.c deleted file mode 100644 index 68c7f9fab..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/apedec.c +++ /dev/null @@ -1,1593 +0,0 @@ -/* - * Monkey's Audio lossless audio decoder - * Copyright (c) 2007 Benjamin Zores - * based upon libdemac from Dave Chapman. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/avassert.h" -#include "libavutil/channel_layout.h" -#include "libavutil/opt.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "dsputil.h" -#include "bytestream.h" -#include "internal.h" -#include "get_bits.h" -#include "unary.h" - -/** - * @file - * Monkey's Audio lossless audio decoder - */ - -#define MAX_CHANNELS 2 -#define MAX_BYTESPERSAMPLE 3 - -#define APE_FRAMECODE_MONO_SILENCE 1 -#define APE_FRAMECODE_STEREO_SILENCE 3 -#define APE_FRAMECODE_PSEUDO_STEREO 4 - -#define HISTORY_SIZE 512 -#define PREDICTOR_ORDER 8 -/** Total size of all predictor histories */ -#define PREDICTOR_SIZE 50 - -#define YDELAYA (18 + PREDICTOR_ORDER*4) -#define YDELAYB (18 + PREDICTOR_ORDER*3) -#define XDELAYA (18 + PREDICTOR_ORDER*2) -#define XDELAYB (18 + PREDICTOR_ORDER) - -#define YADAPTCOEFFSA 18 -#define XADAPTCOEFFSA 14 -#define YADAPTCOEFFSB 10 -#define XADAPTCOEFFSB 5 - -/** - * Possible compression levels - * @{ - */ -enum APECompressionLevel { - COMPRESSION_LEVEL_FAST = 1000, - COMPRESSION_LEVEL_NORMAL = 2000, - COMPRESSION_LEVEL_HIGH = 3000, - COMPRESSION_LEVEL_EXTRA_HIGH = 4000, - COMPRESSION_LEVEL_INSANE = 5000 -}; -/** @} */ - -#define APE_FILTER_LEVELS 3 - -/** Filter orders depending on compression level */ -static const uint16_t ape_filter_orders[5][APE_FILTER_LEVELS] = { - { 0, 0, 0 }, - { 16, 0, 0 }, - { 64, 0, 0 }, - { 32, 256, 0 }, - { 16, 256, 1280 } -}; - -/** Filter fraction bits depending on compression level */ -static const uint8_t ape_filter_fracbits[5][APE_FILTER_LEVELS] = { - { 0, 0, 0 }, - { 11, 0, 0 }, - { 11, 0, 0 }, - { 10, 13, 0 }, - { 11, 13, 15 } -}; - - -/** Filters applied to the decoded data */ -typedef struct APEFilter { - int16_t *coeffs; ///< actual coefficients used in filtering - int16_t *adaptcoeffs; ///< adaptive filter coefficients used for correcting of actual filter coefficients - int16_t *historybuffer; ///< filter memory - int16_t *delay; ///< filtered values - - int avg; -} APEFilter; - -typedef struct APERice { - uint32_t k; - uint32_t ksum; -} APERice; - -typedef struct APERangecoder { - uint32_t low; ///< low end of interval - uint32_t range; ///< length of interval - uint32_t help; ///< bytes_to_follow resp. intermediate value - unsigned int buffer; ///< buffer for input/output -} APERangecoder; - -/** Filter histories */ -typedef struct APEPredictor { - int32_t *buf; - - int32_t lastA[2]; - - int32_t filterA[2]; - int32_t filterB[2]; - - int32_t coeffsA[2][4]; ///< adaption coefficients - int32_t coeffsB[2][5]; ///< adaption coefficients - int32_t historybuffer[HISTORY_SIZE + PREDICTOR_SIZE]; - - unsigned int sample_pos; -} APEPredictor; - -/** Decoder context */ -typedef struct APEContext { - AVClass *class; ///< class for AVOptions - AVCodecContext *avctx; - DSPContext dsp; - int channels; - int samples; ///< samples left to decode in current frame - int bps; - - int fileversion; ///< codec version, very important in decoding process - int compression_level; ///< compression levels - int fset; ///< which filter set to use (calculated from compression level) - int flags; ///< global decoder flags - - uint32_t CRC; ///< frame CRC - int frameflags; ///< frame flags - APEPredictor predictor; ///< predictor used for final reconstruction - - int32_t *decoded_buffer; - int decoded_size; - int32_t *decoded[MAX_CHANNELS]; ///< decoded data for each channel - int blocks_per_loop; ///< maximum number of samples to decode for each call - - int16_t* filterbuf[APE_FILTER_LEVELS]; ///< filter memory - - APERangecoder rc; ///< rangecoder used to decode actual values - APERice riceX; ///< rice code parameters for the second channel - APERice riceY; ///< rice code parameters for the first channel - APEFilter filters[APE_FILTER_LEVELS][2]; ///< filters used for reconstruction - GetBitContext gb; - - uint8_t *data; ///< current frame data - uint8_t *data_end; ///< frame data end - int data_size; ///< frame data allocated size - const uint8_t *ptr; ///< current position in frame data - - int error; - - void (*entropy_decode_mono)(struct APEContext *ctx, int blockstodecode); - void (*entropy_decode_stereo)(struct APEContext *ctx, int blockstodecode); - void (*predictor_decode_mono)(struct APEContext *ctx, int count); - void (*predictor_decode_stereo)(struct APEContext *ctx, int count); -} APEContext; - -static void ape_apply_filters(APEContext *ctx, int32_t *decoded0, - int32_t *decoded1, int count); - -static void entropy_decode_mono_0000(APEContext *ctx, int blockstodecode); -static void entropy_decode_stereo_0000(APEContext *ctx, int blockstodecode); -static void entropy_decode_mono_3860(APEContext *ctx, int blockstodecode); -static void entropy_decode_stereo_3860(APEContext *ctx, int blockstodecode); -static void entropy_decode_mono_3900(APEContext *ctx, int blockstodecode); -static void entropy_decode_stereo_3900(APEContext *ctx, int blockstodecode); -static void entropy_decode_stereo_3930(APEContext *ctx, int blockstodecode); -static void entropy_decode_mono_3990(APEContext *ctx, int blockstodecode); -static void entropy_decode_stereo_3990(APEContext *ctx, int blockstodecode); - -static void predictor_decode_mono_3800(APEContext *ctx, int count); -static void predictor_decode_stereo_3800(APEContext *ctx, int count); -static void predictor_decode_mono_3930(APEContext *ctx, int count); -static void predictor_decode_stereo_3930(APEContext *ctx, int count); -static void predictor_decode_mono_3950(APEContext *ctx, int count); -static void predictor_decode_stereo_3950(APEContext *ctx, int count); - -// TODO: dsputilize - -static av_cold int ape_decode_close(AVCodecContext *avctx) -{ - APEContext *s = avctx->priv_data; - int i; - - for (i = 0; i < APE_FILTER_LEVELS; i++) - av_freep(&s->filterbuf[i]); - - av_freep(&s->decoded_buffer); - av_freep(&s->data); - s->decoded_size = s->data_size = 0; - - return 0; -} - -static av_cold int ape_decode_init(AVCodecContext *avctx) -{ - APEContext *s = avctx->priv_data; - int i; - - if (avctx->extradata_size != 6) { - av_log(avctx, AV_LOG_ERROR, "Incorrect extradata\n"); - return AVERROR(EINVAL); - } - if (avctx->channels > 2) { - av_log(avctx, AV_LOG_ERROR, "Only mono and stereo is supported\n"); - return AVERROR(EINVAL); - } - s->bps = avctx->bits_per_coded_sample; - switch (s->bps) { - case 8: - avctx->sample_fmt = AV_SAMPLE_FMT_U8P; - break; - case 16: - avctx->sample_fmt = AV_SAMPLE_FMT_S16P; - break; - case 24: - avctx->sample_fmt = AV_SAMPLE_FMT_S32P; - break; - default: - avpriv_request_sample(avctx, - "%d bits per coded sample", s->bps); - return AVERROR_PATCHWELCOME; - } - s->avctx = avctx; - s->channels = avctx->channels; - s->fileversion = AV_RL16(avctx->extradata); - s->compression_level = AV_RL16(avctx->extradata + 2); - s->flags = AV_RL16(avctx->extradata + 4); - - av_log(avctx, AV_LOG_DEBUG, "Compression Level: %d - Flags: %d\n", - s->compression_level, s->flags); - if (s->compression_level % 1000 || s->compression_level > COMPRESSION_LEVEL_INSANE || - !s->compression_level || - (s->fileversion < 3930 && s->compression_level == COMPRESSION_LEVEL_INSANE)) { - av_log(avctx, AV_LOG_ERROR, "Incorrect compression level %d\n", - s->compression_level); - return AVERROR_INVALIDDATA; - } - s->fset = s->compression_level / 1000 - 1; - for (i = 0; i < APE_FILTER_LEVELS; i++) { - if (!ape_filter_orders[s->fset][i]) - break; - FF_ALLOC_OR_GOTO(avctx, s->filterbuf[i], - (ape_filter_orders[s->fset][i] * 3 + HISTORY_SIZE) * 4, - filter_alloc_fail); - } - - if (s->fileversion < 3860) { - s->entropy_decode_mono = entropy_decode_mono_0000; - s->entropy_decode_stereo = entropy_decode_stereo_0000; - } else if (s->fileversion < 3900) { - s->entropy_decode_mono = entropy_decode_mono_3860; - s->entropy_decode_stereo = entropy_decode_stereo_3860; - } else if (s->fileversion < 3930) { - s->entropy_decode_mono = entropy_decode_mono_3900; - s->entropy_decode_stereo = entropy_decode_stereo_3900; - } else if (s->fileversion < 3990) { - s->entropy_decode_mono = entropy_decode_mono_3900; - s->entropy_decode_stereo = entropy_decode_stereo_3930; - } else { - s->entropy_decode_mono = entropy_decode_mono_3990; - s->entropy_decode_stereo = entropy_decode_stereo_3990; - } - - if (s->fileversion < 3930) { - s->predictor_decode_mono = predictor_decode_mono_3800; - s->predictor_decode_stereo = predictor_decode_stereo_3800; - } else if (s->fileversion < 3950) { - s->predictor_decode_mono = predictor_decode_mono_3930; - s->predictor_decode_stereo = predictor_decode_stereo_3930; - } else { - s->predictor_decode_mono = predictor_decode_mono_3950; - s->predictor_decode_stereo = predictor_decode_stereo_3950; - } - - ff_dsputil_init(&s->dsp, avctx); - avctx->channel_layout = (avctx->channels==2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; - - return 0; -filter_alloc_fail: - ape_decode_close(avctx); - return AVERROR(ENOMEM); -} - -/** - * @name APE range decoding functions - * @{ - */ - -#define CODE_BITS 32 -#define TOP_VALUE ((unsigned int)1 << (CODE_BITS-1)) -#define SHIFT_BITS (CODE_BITS - 9) -#define EXTRA_BITS ((CODE_BITS-2) % 8 + 1) -#define BOTTOM_VALUE (TOP_VALUE >> 8) - -/** Start the decoder */ -static inline void range_start_decoding(APEContext *ctx) -{ - ctx->rc.buffer = bytestream_get_byte(&ctx->ptr); - ctx->rc.low = ctx->rc.buffer >> (8 - EXTRA_BITS); - ctx->rc.range = (uint32_t) 1 << EXTRA_BITS; -} - -/** Perform normalization */ -static inline void range_dec_normalize(APEContext *ctx) -{ - while (ctx->rc.range <= BOTTOM_VALUE) { - ctx->rc.buffer <<= 8; - if(ctx->ptr < ctx->data_end) { - ctx->rc.buffer += *ctx->ptr; - ctx->ptr++; - } else { - ctx->error = 1; - } - ctx->rc.low = (ctx->rc.low << 8) | ((ctx->rc.buffer >> 1) & 0xFF); - ctx->rc.range <<= 8; - } -} - -/** - * Calculate culmulative frequency for next symbol. Does NO update! - * @param ctx decoder context - * @param tot_f is the total frequency or (code_value)1<rc.help = ctx->rc.range / tot_f; - return ctx->rc.low / ctx->rc.help; -} - -/** - * Decode value with given size in bits - * @param ctx decoder context - * @param shift number of bits to decode - */ -static inline int range_decode_culshift(APEContext *ctx, int shift) -{ - range_dec_normalize(ctx); - ctx->rc.help = ctx->rc.range >> shift; - return ctx->rc.low / ctx->rc.help; -} - - -/** - * Update decoding state - * @param ctx decoder context - * @param sy_f the interval length (frequency of the symbol) - * @param lt_f the lower end (frequency sum of < symbols) - */ -static inline void range_decode_update(APEContext *ctx, int sy_f, int lt_f) -{ - ctx->rc.low -= ctx->rc.help * lt_f; - ctx->rc.range = ctx->rc.help * sy_f; -} - -/** Decode n bits (n <= 16) without modelling */ -static inline int range_decode_bits(APEContext *ctx, int n) -{ - int sym = range_decode_culshift(ctx, n); - range_decode_update(ctx, 1, sym); - return sym; -} - - -#define MODEL_ELEMENTS 64 - -/** - * Fixed probabilities for symbols in Monkey Audio version 3.97 - */ -static const uint16_t counts_3970[22] = { - 0, 14824, 28224, 39348, 47855, 53994, 58171, 60926, - 62682, 63786, 64463, 64878, 65126, 65276, 65365, 65419, - 65450, 65469, 65480, 65487, 65491, 65493, -}; - -/** - * Probability ranges for symbols in Monkey Audio version 3.97 - */ -static const uint16_t counts_diff_3970[21] = { - 14824, 13400, 11124, 8507, 6139, 4177, 2755, 1756, - 1104, 677, 415, 248, 150, 89, 54, 31, - 19, 11, 7, 4, 2, -}; - -/** - * Fixed probabilities for symbols in Monkey Audio version 3.98 - */ -static const uint16_t counts_3980[22] = { - 0, 19578, 36160, 48417, 56323, 60899, 63265, 64435, - 64971, 65232, 65351, 65416, 65447, 65466, 65476, 65482, - 65485, 65488, 65490, 65491, 65492, 65493, -}; - -/** - * Probability ranges for symbols in Monkey Audio version 3.98 - */ -static const uint16_t counts_diff_3980[21] = { - 19578, 16582, 12257, 7906, 4576, 2366, 1170, 536, - 261, 119, 65, 31, 19, 10, 6, 3, - 3, 2, 1, 1, 1, -}; - -/** - * Decode symbol - * @param ctx decoder context - * @param counts probability range start position - * @param counts_diff probability range widths - */ -static inline int range_get_symbol(APEContext *ctx, - const uint16_t counts[], - const uint16_t counts_diff[]) -{ - int symbol, cf; - - cf = range_decode_culshift(ctx, 16); - - if(cf > 65492){ - symbol= cf - 65535 + 63; - range_decode_update(ctx, 1, cf); - if(cf > 65535) - ctx->error=1; - return symbol; - } - /* figure out the symbol inefficiently; a binary search would be much better */ - for (symbol = 0; counts[symbol + 1] <= cf; symbol++); - - range_decode_update(ctx, counts_diff[symbol], counts[symbol]); - - return symbol; -} -/** @} */ // group rangecoder - -static inline void update_rice(APERice *rice, unsigned int x) -{ - int lim = rice->k ? (1 << (rice->k + 4)) : 0; - rice->ksum += ((x + 1) / 2) - ((rice->ksum + 16) >> 5); - - if (rice->ksum < lim) - rice->k--; - else if (rice->ksum >= (1 << (rice->k + 5))) - rice->k++; -} - -static inline int get_rice_ook(GetBitContext *gb, int k) -{ - unsigned int x; - - x = get_unary(gb, 1, get_bits_left(gb)); - - if (k) - x = (x << k) | get_bits(gb, k); - - return x; -} - -static inline int ape_decode_value_3860(APEContext *ctx, GetBitContext *gb, - APERice *rice) -{ - unsigned int x, overflow; - - overflow = get_unary(gb, 1, get_bits_left(gb)); - - if (ctx->fileversion > 3880) { - while (overflow >= 16) { - overflow -= 16; - rice->k += 4; - } - } - - if (!rice->k) - x = overflow; - else if(rice->k <= MIN_CACHE_BITS) { - x = (overflow << rice->k) + get_bits(gb, rice->k); - } else { - av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", rice->k); - return AVERROR_INVALIDDATA; - } - rice->ksum += x - ((rice->ksum + 8) >> 4); - if (rice->ksum < (rice->k ? 1 << (rice->k + 4) : 0)) - rice->k--; - else if (rice->ksum >= (1 << (rice->k + 5)) && rice->k < 24) - rice->k++; - - /* Convert to signed */ - if (x & 1) - return (x >> 1) + 1; - else - return -(x >> 1); -} - -static inline int ape_decode_value_3900(APEContext *ctx, APERice *rice) -{ - unsigned int x, overflow; - int tmpk; - - overflow = range_get_symbol(ctx, counts_3970, counts_diff_3970); - - if (overflow == (MODEL_ELEMENTS - 1)) { - tmpk = range_decode_bits(ctx, 5); - overflow = 0; - } else - tmpk = (rice->k < 1) ? 0 : rice->k - 1; - - if (tmpk <= 16 || ctx->fileversion < 3910) { - if (tmpk > 23) { - av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); - return AVERROR_INVALIDDATA; - } - x = range_decode_bits(ctx, tmpk); - } else if (tmpk <= 32) { - x = range_decode_bits(ctx, 16); - x |= (range_decode_bits(ctx, tmpk - 16) << 16); - } else { - av_log(ctx->avctx, AV_LOG_ERROR, "Too many bits: %d\n", tmpk); - return AVERROR_INVALIDDATA; - } - x += overflow << tmpk; - - update_rice(rice, x); - - /* Convert to signed */ - if (x & 1) - return (x >> 1) + 1; - else - return -(x >> 1); -} - -static inline int ape_decode_value_3990(APEContext *ctx, APERice *rice) -{ - unsigned int x, overflow; - int base, pivot; - - pivot = rice->ksum >> 5; - if (pivot == 0) - pivot = 1; - - overflow = range_get_symbol(ctx, counts_3980, counts_diff_3980); - - if (overflow == (MODEL_ELEMENTS - 1)) { - overflow = range_decode_bits(ctx, 16) << 16; - overflow |= range_decode_bits(ctx, 16); - } - - if (pivot < 0x10000) { - base = range_decode_culfreq(ctx, pivot); - range_decode_update(ctx, 1, base); - } else { - int base_hi = pivot, base_lo; - int bbits = 0; - - while (base_hi & ~0xFFFF) { - base_hi >>= 1; - bbits++; - } - base_hi = range_decode_culfreq(ctx, base_hi + 1); - range_decode_update(ctx, 1, base_hi); - base_lo = range_decode_culfreq(ctx, 1 << bbits); - range_decode_update(ctx, 1, base_lo); - - base = (base_hi << bbits) + base_lo; - } - - x = base + overflow * pivot; - - update_rice(rice, x); - - /* Convert to signed */ - if (x & 1) - return (x >> 1) + 1; - else - return -(x >> 1); -} - -static void decode_array_0000(APEContext *ctx, GetBitContext *gb, - int32_t *out, APERice *rice, int blockstodecode) -{ - int i; - int ksummax, ksummin; - - rice->ksum = 0; - for (i = 0; i < 5; i++) { - out[i] = get_rice_ook(&ctx->gb, 10); - rice->ksum += out[i]; - } - rice->k = av_log2(rice->ksum / 10) + 1; - if (rice->k >= 24) - return; - for (; i < 64; i++) { - out[i] = get_rice_ook(&ctx->gb, rice->k); - rice->ksum += out[i]; - rice->k = av_log2(rice->ksum / ((i + 1) * 2)) + 1; - if (rice->k >= 24) - return; - } - ksummax = 1 << (rice->k + 7); - ksummin = rice->k ? (1 << (rice->k + 6)) : 0; - for (; i < blockstodecode; i++) { - out[i] = get_rice_ook(&ctx->gb, rice->k); - rice->ksum += out[i] - out[i - 64]; - while (rice->ksum < ksummin) { - rice->k--; - ksummin = rice->k ? ksummin >> 1 : 0; - ksummax >>= 1; - } - while (rice->ksum >= ksummax) { - rice->k++; - if (rice->k > 24) - return; - ksummax <<= 1; - ksummin = ksummin ? ksummin << 1 : 128; - } - } - - for (i = 0; i < blockstodecode; i++) { - if (out[i] & 1) - out[i] = (out[i] >> 1) + 1; - else - out[i] = -(out[i] >> 1); - } -} - -static void entropy_decode_mono_0000(APEContext *ctx, int blockstodecode) -{ - decode_array_0000(ctx, &ctx->gb, ctx->decoded[0], &ctx->riceY, - blockstodecode); -} - -static void entropy_decode_stereo_0000(APEContext *ctx, int blockstodecode) -{ - decode_array_0000(ctx, &ctx->gb, ctx->decoded[0], &ctx->riceY, - blockstodecode); - decode_array_0000(ctx, &ctx->gb, ctx->decoded[1], &ctx->riceX, - blockstodecode); -} - -static void entropy_decode_mono_3860(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - - while (blockstodecode--) - *decoded0++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceY); -} - -static void entropy_decode_stereo_3860(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - int blocks = blockstodecode; - - while (blockstodecode--) - *decoded0++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceY); - while (blocks--) - *decoded1++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceX); -} - -static void entropy_decode_mono_3900(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - - while (blockstodecode--) - *decoded0++ = ape_decode_value_3900(ctx, &ctx->riceY); -} - -static void entropy_decode_stereo_3900(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - int blocks = blockstodecode; - - while (blockstodecode--) - *decoded0++ = ape_decode_value_3900(ctx, &ctx->riceY); - range_dec_normalize(ctx); - // because of some implementation peculiarities we need to backpedal here - ctx->ptr -= 1; - range_start_decoding(ctx); - while (blocks--) - *decoded1++ = ape_decode_value_3900(ctx, &ctx->riceX); -} - -static void entropy_decode_stereo_3930(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - - while (blockstodecode--) { - *decoded0++ = ape_decode_value_3900(ctx, &ctx->riceY); - *decoded1++ = ape_decode_value_3900(ctx, &ctx->riceX); - } -} - -static void entropy_decode_mono_3990(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - - while (blockstodecode--) - *decoded0++ = ape_decode_value_3990(ctx, &ctx->riceY); -} - -static void entropy_decode_stereo_3990(APEContext *ctx, int blockstodecode) -{ - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - - while (blockstodecode--) { - *decoded0++ = ape_decode_value_3990(ctx, &ctx->riceY); - *decoded1++ = ape_decode_value_3990(ctx, &ctx->riceX); - } -} - -static int init_entropy_decoder(APEContext *ctx) -{ - /* Read the CRC */ - if (ctx->fileversion >= 3900) { - if (ctx->data_end - ctx->ptr < 6) - return AVERROR_INVALIDDATA; - ctx->CRC = bytestream_get_be32(&ctx->ptr); - } else { - ctx->CRC = get_bits_long(&ctx->gb, 32); - } - - /* Read the frame flags if they exist */ - ctx->frameflags = 0; - if ((ctx->fileversion > 3820) && (ctx->CRC & 0x80000000)) { - ctx->CRC &= ~0x80000000; - - if (ctx->data_end - ctx->ptr < 6) - return AVERROR_INVALIDDATA; - ctx->frameflags = bytestream_get_be32(&ctx->ptr); - } - - /* Initialize the rice structs */ - ctx->riceX.k = 10; - ctx->riceX.ksum = (1 << ctx->riceX.k) * 16; - ctx->riceY.k = 10; - ctx->riceY.ksum = (1 << ctx->riceY.k) * 16; - - if (ctx->fileversion >= 3900) { - /* The first 8 bits of input are ignored. */ - ctx->ptr++; - - range_start_decoding(ctx); - } - - return 0; -} - -static const int32_t initial_coeffs_fast_3320[1] = { - 375, -}; - -static const int32_t initial_coeffs_a_3800[3] = { - 64, 115, 64, -}; - -static const int32_t initial_coeffs_b_3800[2] = { - 740, 0 -}; - -static const int32_t initial_coeffs_3930[4] = { - 360, 317, -109, 98 -}; - -static void init_predictor_decoder(APEContext *ctx) -{ - APEPredictor *p = &ctx->predictor; - - /* Zero the history buffers */ - memset(p->historybuffer, 0, PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - - /* Initialize and zero the coefficients */ - if (ctx->fileversion < 3930) { - if (ctx->compression_level == COMPRESSION_LEVEL_FAST) { - memcpy(p->coeffsA[0], initial_coeffs_fast_3320, - sizeof(initial_coeffs_fast_3320)); - memcpy(p->coeffsA[1], initial_coeffs_fast_3320, - sizeof(initial_coeffs_fast_3320)); - } else { - memcpy(p->coeffsA[0], initial_coeffs_a_3800, - sizeof(initial_coeffs_a_3800)); - memcpy(p->coeffsA[1], initial_coeffs_a_3800, - sizeof(initial_coeffs_a_3800)); - } - } else { - memcpy(p->coeffsA[0], initial_coeffs_3930, sizeof(initial_coeffs_3930)); - memcpy(p->coeffsA[1], initial_coeffs_3930, sizeof(initial_coeffs_3930)); - } - memset(p->coeffsB, 0, sizeof(p->coeffsB)); - if (ctx->fileversion < 3930) { - memcpy(p->coeffsB[0], initial_coeffs_b_3800, - sizeof(initial_coeffs_b_3800)); - memcpy(p->coeffsB[1], initial_coeffs_b_3800, - sizeof(initial_coeffs_b_3800)); - } - - p->filterA[0] = p->filterA[1] = 0; - p->filterB[0] = p->filterB[1] = 0; - p->lastA[0] = p->lastA[1] = 0; - - p->sample_pos = 0; -} - -/** Get inverse sign of integer (-1 for positive, 1 for negative and 0 for zero) */ -static inline int APESIGN(int32_t x) { - return (x < 0) - (x > 0); -} - -static av_always_inline int filter_fast_3320(APEPredictor *p, - const int decoded, const int filter, - const int delayA) -{ - int32_t predictionA; - - p->buf[delayA] = p->lastA[filter]; - if (p->sample_pos < 3) { - p->lastA[filter] = decoded; - p->filterA[filter] = decoded; - return decoded; - } - - predictionA = p->buf[delayA] * 2 - p->buf[delayA - 1]; - p->lastA[filter] = decoded + (predictionA * p->coeffsA[filter][0] >> 9); - - if ((decoded ^ predictionA) > 0) - p->coeffsA[filter][0]++; - else - p->coeffsA[filter][0]--; - - p->filterA[filter] += p->lastA[filter]; - - return p->filterA[filter]; -} - -static av_always_inline int filter_3800(APEPredictor *p, - const int decoded, const int filter, - const int delayA, const int delayB, - const int start, const int shift) -{ - int32_t predictionA, predictionB, sign; - int32_t d0, d1, d2, d3, d4; - - p->buf[delayA] = p->lastA[filter]; - p->buf[delayB] = p->filterB[filter]; - if (p->sample_pos < start) { - predictionA = decoded + p->filterA[filter]; - p->lastA[filter] = decoded; - p->filterB[filter] = decoded; - p->filterA[filter] = predictionA; - return predictionA; - } - d2 = p->buf[delayA]; - d1 = (p->buf[delayA] - p->buf[delayA - 1]) << 1; - d0 = p->buf[delayA] + ((p->buf[delayA - 2] - p->buf[delayA - 1]) << 3); - d3 = p->buf[delayB] * 2 - p->buf[delayB - 1]; - d4 = p->buf[delayB]; - - predictionA = d0 * p->coeffsA[filter][0] + - d1 * p->coeffsA[filter][1] + - d2 * p->coeffsA[filter][2]; - - sign = APESIGN(decoded); - p->coeffsA[filter][0] += (((d0 >> 30) & 2) - 1) * sign; - p->coeffsA[filter][1] += (((d1 >> 28) & 8) - 4) * sign; - p->coeffsA[filter][2] += (((d2 >> 28) & 8) - 4) * sign; - - predictionB = d3 * p->coeffsB[filter][0] - - d4 * p->coeffsB[filter][1]; - p->lastA[filter] = decoded + (predictionA >> 11); - sign = APESIGN(p->lastA[filter]); - p->coeffsB[filter][0] += (((d3 >> 29) & 4) - 2) * sign; - p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign; - - p->filterB[filter] = p->lastA[filter] + (predictionB >> shift); - p->filterA[filter] = p->filterB[filter] + ((p->filterA[filter] * 31) >> 5); - - return p->filterA[filter]; -} - -static void long_filter_high_3800(int32_t *buffer, int order, int shift, - int32_t *coeffs, int32_t *delay, int length) -{ - int i, j; - int32_t dotprod, sign; - - memset(coeffs, 0, order * sizeof(*coeffs)); - for (i = 0; i < order; i++) - delay[i] = buffer[i]; - for (i = order; i < length; i++) { - dotprod = 0; - sign = APESIGN(buffer[i]); - for (j = 0; j < order; j++) { - dotprod += delay[j] * coeffs[j]; - coeffs[j] -= (((delay[j] >> 30) & 2) - 1) * sign; - } - buffer[i] -= dotprod >> shift; - for (j = 0; j < order - 1; j++) - delay[j] = delay[j + 1]; - delay[order - 1] = buffer[i]; - } -} - -static void long_filter_ehigh_3830(int32_t *buffer, int length) -{ - int i, j; - int32_t dotprod, sign; - int32_t coeffs[8], delay[8]; - - memset(coeffs, 0, sizeof(coeffs)); - memset(delay, 0, sizeof(delay)); - for (i = 0; i < length; i++) { - dotprod = 0; - sign = APESIGN(buffer[i]); - for (j = 7; j >= 0; j--) { - dotprod += delay[j] * coeffs[j]; - coeffs[j] -= (((delay[j] >> 30) & 2) - 1) * sign; - } - for (j = 7; j > 0; j--) - delay[j] = delay[j - 1]; - delay[0] = buffer[i]; - buffer[i] -= dotprod >> 9; - } -} - -static void predictor_decode_stereo_3800(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - int32_t coeffs[256], delay[256]; - int start = 4, shift = 10; - - if (ctx->compression_level == COMPRESSION_LEVEL_HIGH) { - start = 16; - long_filter_high_3800(decoded0, 16, 9, coeffs, delay, count); - long_filter_high_3800(decoded1, 16, 9, coeffs, delay, count); - } else if (ctx->compression_level == COMPRESSION_LEVEL_EXTRA_HIGH) { - int order = 128, shift2 = 11; - - if (ctx->fileversion >= 3830) { - order <<= 1; - shift++; - shift2++; - long_filter_ehigh_3830(decoded0 + order, count - order); - long_filter_ehigh_3830(decoded1 + order, count - order); - } - start = order; - long_filter_high_3800(decoded0, order, shift2, coeffs, delay, count); - long_filter_high_3800(decoded1, order, shift2, coeffs, delay, count); - } - - while (count--) { - int X = *decoded0, Y = *decoded1; - if (ctx->compression_level == COMPRESSION_LEVEL_FAST) { - *decoded0 = filter_fast_3320(p, Y, 0, YDELAYA); - decoded0++; - *decoded1 = filter_fast_3320(p, X, 1, XDELAYA); - decoded1++; - } else { - *decoded0 = filter_3800(p, Y, 0, YDELAYA, YDELAYB, - start, shift); - decoded0++; - *decoded1 = filter_3800(p, X, 1, XDELAYA, XDELAYB, - start, shift); - decoded1++; - } - - /* Combined */ - p->buf++; - p->sample_pos++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - } -} - -static void predictor_decode_mono_3800(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - int32_t coeffs[256], delay[256]; - int start = 4, shift = 10; - - if (ctx->compression_level == COMPRESSION_LEVEL_HIGH) { - start = 16; - long_filter_high_3800(decoded0, 16, 9, coeffs, delay, count); - } else if (ctx->compression_level == COMPRESSION_LEVEL_EXTRA_HIGH) { - int order = 128, shift2 = 11; - - if (ctx->fileversion >= 3830) { - order <<= 1; - shift++; - shift2++; - long_filter_ehigh_3830(decoded0 + order, count - order); - } - start = order; - long_filter_high_3800(decoded0, order, shift2, coeffs, delay, count); - } - - while (count--) { - if (ctx->compression_level == COMPRESSION_LEVEL_FAST) { - *decoded0 = filter_fast_3320(p, *decoded0, 0, YDELAYA); - decoded0++; - } else { - *decoded0 = filter_3800(p, *decoded0, 0, YDELAYA, YDELAYB, - start, shift); - decoded0++; - } - - /* Combined */ - p->buf++; - p->sample_pos++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - } -} - -static av_always_inline int predictor_update_3930(APEPredictor *p, - const int decoded, const int filter, - const int delayA) -{ - int32_t predictionA, sign; - int32_t d0, d1, d2, d3; - - p->buf[delayA] = p->lastA[filter]; - d0 = p->buf[delayA ]; - d1 = p->buf[delayA ] - p->buf[delayA - 1]; - d2 = p->buf[delayA - 1] - p->buf[delayA - 2]; - d3 = p->buf[delayA - 2] - p->buf[delayA - 3]; - - predictionA = d0 * p->coeffsA[filter][0] + - d1 * p->coeffsA[filter][1] + - d2 * p->coeffsA[filter][2] + - d3 * p->coeffsA[filter][3]; - - p->lastA[filter] = decoded + (predictionA >> 9); - p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5); - - sign = APESIGN(decoded); - p->coeffsA[filter][0] += ((d0 < 0) * 2 - 1) * sign; - p->coeffsA[filter][1] += ((d1 < 0) * 2 - 1) * sign; - p->coeffsA[filter][2] += ((d2 < 0) * 2 - 1) * sign; - p->coeffsA[filter][3] += ((d3 < 0) * 2 - 1) * sign; - - return p->filterA[filter]; -} - -static void predictor_decode_stereo_3930(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - - ape_apply_filters(ctx, ctx->decoded[0], ctx->decoded[1], count); - - while (count--) { - /* Predictor Y */ - int Y = *decoded1, X = *decoded0; - *decoded0 = predictor_update_3930(p, Y, 0, YDELAYA); - decoded0++; - *decoded1 = predictor_update_3930(p, X, 1, XDELAYA); - decoded1++; - - /* Combined */ - p->buf++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - } -} - -static void predictor_decode_mono_3930(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - - ape_apply_filters(ctx, ctx->decoded[0], NULL, count); - - while (count--) { - *decoded0 = predictor_update_3930(p, *decoded0, 0, YDELAYA); - decoded0++; - - p->buf++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - } -} - -static av_always_inline int predictor_update_filter(APEPredictor *p, - const int decoded, const int filter, - const int delayA, const int delayB, - const int adaptA, const int adaptB) -{ - int32_t predictionA, predictionB, sign; - - p->buf[delayA] = p->lastA[filter]; - p->buf[adaptA] = APESIGN(p->buf[delayA]); - p->buf[delayA - 1] = p->buf[delayA] - p->buf[delayA - 1]; - p->buf[adaptA - 1] = APESIGN(p->buf[delayA - 1]); - - predictionA = p->buf[delayA ] * p->coeffsA[filter][0] + - p->buf[delayA - 1] * p->coeffsA[filter][1] + - p->buf[delayA - 2] * p->coeffsA[filter][2] + - p->buf[delayA - 3] * p->coeffsA[filter][3]; - - /* Apply a scaled first-order filter compression */ - p->buf[delayB] = p->filterA[filter ^ 1] - ((p->filterB[filter] * 31) >> 5); - p->buf[adaptB] = APESIGN(p->buf[delayB]); - p->buf[delayB - 1] = p->buf[delayB] - p->buf[delayB - 1]; - p->buf[adaptB - 1] = APESIGN(p->buf[delayB - 1]); - p->filterB[filter] = p->filterA[filter ^ 1]; - - predictionB = p->buf[delayB ] * p->coeffsB[filter][0] + - p->buf[delayB - 1] * p->coeffsB[filter][1] + - p->buf[delayB - 2] * p->coeffsB[filter][2] + - p->buf[delayB - 3] * p->coeffsB[filter][3] + - p->buf[delayB - 4] * p->coeffsB[filter][4]; - - p->lastA[filter] = decoded + ((predictionA + (predictionB >> 1)) >> 10); - p->filterA[filter] = p->lastA[filter] + ((p->filterA[filter] * 31) >> 5); - - sign = APESIGN(decoded); - p->coeffsA[filter][0] += p->buf[adaptA ] * sign; - p->coeffsA[filter][1] += p->buf[adaptA - 1] * sign; - p->coeffsA[filter][2] += p->buf[adaptA - 2] * sign; - p->coeffsA[filter][3] += p->buf[adaptA - 3] * sign; - p->coeffsB[filter][0] += p->buf[adaptB ] * sign; - p->coeffsB[filter][1] += p->buf[adaptB - 1] * sign; - p->coeffsB[filter][2] += p->buf[adaptB - 2] * sign; - p->coeffsB[filter][3] += p->buf[adaptB - 3] * sign; - p->coeffsB[filter][4] += p->buf[adaptB - 4] * sign; - - return p->filterA[filter]; -} - -static void predictor_decode_stereo_3950(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - - ape_apply_filters(ctx, ctx->decoded[0], ctx->decoded[1], count); - - while (count--) { - /* Predictor Y */ - *decoded0 = predictor_update_filter(p, *decoded0, 0, YDELAYA, YDELAYB, - YADAPTCOEFFSA, YADAPTCOEFFSB); - decoded0++; - *decoded1 = predictor_update_filter(p, *decoded1, 1, XDELAYA, XDELAYB, - XADAPTCOEFFSA, XADAPTCOEFFSB); - decoded1++; - - /* Combined */ - p->buf++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - } -} - -static void predictor_decode_mono_3950(APEContext *ctx, int count) -{ - APEPredictor *p = &ctx->predictor; - int32_t *decoded0 = ctx->decoded[0]; - int32_t predictionA, currentA, A, sign; - - ape_apply_filters(ctx, ctx->decoded[0], NULL, count); - - currentA = p->lastA[0]; - - while (count--) { - A = *decoded0; - - p->buf[YDELAYA] = currentA; - p->buf[YDELAYA - 1] = p->buf[YDELAYA] - p->buf[YDELAYA - 1]; - - predictionA = p->buf[YDELAYA ] * p->coeffsA[0][0] + - p->buf[YDELAYA - 1] * p->coeffsA[0][1] + - p->buf[YDELAYA - 2] * p->coeffsA[0][2] + - p->buf[YDELAYA - 3] * p->coeffsA[0][3]; - - currentA = A + (predictionA >> 10); - - p->buf[YADAPTCOEFFSA] = APESIGN(p->buf[YDELAYA ]); - p->buf[YADAPTCOEFFSA - 1] = APESIGN(p->buf[YDELAYA - 1]); - - sign = APESIGN(A); - p->coeffsA[0][0] += p->buf[YADAPTCOEFFSA ] * sign; - p->coeffsA[0][1] += p->buf[YADAPTCOEFFSA - 1] * sign; - p->coeffsA[0][2] += p->buf[YADAPTCOEFFSA - 2] * sign; - p->coeffsA[0][3] += p->buf[YADAPTCOEFFSA - 3] * sign; - - p->buf++; - - /* Have we filled the history buffer? */ - if (p->buf == p->historybuffer + HISTORY_SIZE) { - memmove(p->historybuffer, p->buf, - PREDICTOR_SIZE * sizeof(*p->historybuffer)); - p->buf = p->historybuffer; - } - - p->filterA[0] = currentA + ((p->filterA[0] * 31) >> 5); - *(decoded0++) = p->filterA[0]; - } - - p->lastA[0] = currentA; -} - -static void do_init_filter(APEFilter *f, int16_t *buf, int order) -{ - f->coeffs = buf; - f->historybuffer = buf + order; - f->delay = f->historybuffer + order * 2; - f->adaptcoeffs = f->historybuffer + order; - - memset(f->historybuffer, 0, (order * 2) * sizeof(*f->historybuffer)); - memset(f->coeffs, 0, order * sizeof(*f->coeffs)); - f->avg = 0; -} - -static void init_filter(APEContext *ctx, APEFilter *f, int16_t *buf, int order) -{ - do_init_filter(&f[0], buf, order); - do_init_filter(&f[1], buf + order * 3 + HISTORY_SIZE, order); -} - -static void do_apply_filter(APEContext *ctx, int version, APEFilter *f, - int32_t *data, int count, int order, int fracbits) -{ - int res; - int absres; - - while (count--) { - /* round fixedpoint scalar product */ - res = ctx->dsp.scalarproduct_and_madd_int16(f->coeffs, f->delay - order, - f->adaptcoeffs - order, - order, APESIGN(*data)); - res = (res + (1 << (fracbits - 1))) >> fracbits; - res += *data; - *data++ = res; - - /* Update the output history */ - *f->delay++ = av_clip_int16(res); - - if (version < 3980) { - /* Version ??? to < 3.98 files (untested) */ - f->adaptcoeffs[0] = (res == 0) ? 0 : ((res >> 28) & 8) - 4; - f->adaptcoeffs[-4] >>= 1; - f->adaptcoeffs[-8] >>= 1; - } else { - /* Version 3.98 and later files */ - - /* Update the adaption coefficients */ - absres = FFABS(res); - if (absres) - *f->adaptcoeffs = ((res & (-1<<31)) ^ (-1<<30)) >> - (25 + (absres <= f->avg*3) + (absres <= f->avg*4/3)); - else - *f->adaptcoeffs = 0; - - f->avg += (absres - f->avg) / 16; - - f->adaptcoeffs[-1] >>= 1; - f->adaptcoeffs[-2] >>= 1; - f->adaptcoeffs[-8] >>= 1; - } - - f->adaptcoeffs++; - - /* Have we filled the history buffer? */ - if (f->delay == f->historybuffer + HISTORY_SIZE + (order * 2)) { - memmove(f->historybuffer, f->delay - (order * 2), - (order * 2) * sizeof(*f->historybuffer)); - f->delay = f->historybuffer + order * 2; - f->adaptcoeffs = f->historybuffer + order; - } - } -} - -static void apply_filter(APEContext *ctx, APEFilter *f, - int32_t *data0, int32_t *data1, - int count, int order, int fracbits) -{ - do_apply_filter(ctx, ctx->fileversion, &f[0], data0, count, order, fracbits); - if (data1) - do_apply_filter(ctx, ctx->fileversion, &f[1], data1, count, order, fracbits); -} - -static void ape_apply_filters(APEContext *ctx, int32_t *decoded0, - int32_t *decoded1, int count) -{ - int i; - - for (i = 0; i < APE_FILTER_LEVELS; i++) { - if (!ape_filter_orders[ctx->fset][i]) - break; - apply_filter(ctx, ctx->filters[i], decoded0, decoded1, count, - ape_filter_orders[ctx->fset][i], - ape_filter_fracbits[ctx->fset][i]); - } -} - -static int init_frame_decoder(APEContext *ctx) -{ - int i, ret; - if ((ret = init_entropy_decoder(ctx)) < 0) - return ret; - init_predictor_decoder(ctx); - - for (i = 0; i < APE_FILTER_LEVELS; i++) { - if (!ape_filter_orders[ctx->fset][i]) - break; - init_filter(ctx, ctx->filters[i], ctx->filterbuf[i], - ape_filter_orders[ctx->fset][i]); - } - return 0; -} - -static void ape_unpack_mono(APEContext *ctx, int count) -{ - if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { - /* We are pure silence, so we're done. */ - av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence mono\n"); - return; - } - - ctx->entropy_decode_mono(ctx, count); - - /* Now apply the predictor decoding */ - ctx->predictor_decode_mono(ctx, count); - - /* Pseudo-stereo - just copy left channel to right channel */ - if (ctx->channels == 2) { - memcpy(ctx->decoded[1], ctx->decoded[0], count * sizeof(*ctx->decoded[1])); - } -} - -static void ape_unpack_stereo(APEContext *ctx, int count) -{ - int32_t left, right; - int32_t *decoded0 = ctx->decoded[0]; - int32_t *decoded1 = ctx->decoded[1]; - - if (ctx->frameflags & APE_FRAMECODE_STEREO_SILENCE) { - /* We are pure silence, so we're done. */ - av_log(ctx->avctx, AV_LOG_DEBUG, "pure silence stereo\n"); - return; - } - - ctx->entropy_decode_stereo(ctx, count); - - /* Now apply the predictor decoding */ - ctx->predictor_decode_stereo(ctx, count); - - /* Decorrelate and scale to output depth */ - while (count--) { - left = *decoded1 - (*decoded0 / 2); - right = left + *decoded0; - - *(decoded0++) = left; - *(decoded1++) = right; - } -} - -static int ape_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - APEContext *s = avctx->priv_data; - uint8_t *sample8; - int16_t *sample16; - int32_t *sample24; - int i, ch, ret; - int blockstodecode; - - /* this should never be negative, but bad things will happen if it is, so - check it just to make sure. */ - av_assert0(s->samples >= 0); - - if(!s->samples){ - uint32_t nblocks, offset; - int buf_size; - - if (!avpkt->size) { - *got_frame_ptr = 0; - return 0; - } - if (avpkt->size < 8) { - av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); - return AVERROR_INVALIDDATA; - } - buf_size = avpkt->size & ~3; - if (buf_size != avpkt->size) { - av_log(avctx, AV_LOG_WARNING, "packet size is not a multiple of 4. " - "extra bytes at the end will be skipped.\n"); - } - if (s->fileversion < 3950) // previous versions overread two bytes - buf_size += 2; - av_fast_padded_malloc(&s->data, &s->data_size, buf_size); - if (!s->data) - return AVERROR(ENOMEM); - s->dsp.bswap_buf((uint32_t*)s->data, (const uint32_t*)buf, buf_size >> 2); - memset(s->data + (buf_size & ~3), 0, buf_size & 3); - s->ptr = s->data; - s->data_end = s->data + buf_size; - - nblocks = bytestream_get_be32(&s->ptr); - offset = bytestream_get_be32(&s->ptr); - if (s->fileversion >= 3900) { - if (offset > 3) { - av_log(avctx, AV_LOG_ERROR, "Incorrect offset passed\n"); - s->data = NULL; - return AVERROR_INVALIDDATA; - } - if (s->data_end - s->ptr < offset) { - av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); - return AVERROR_INVALIDDATA; - } - s->ptr += offset; - } else { - if ((ret = init_get_bits8(&s->gb, s->ptr, s->data_end - s->ptr)) < 0) - return ret; - if (s->fileversion > 3800) - skip_bits_long(&s->gb, offset * 8); - else - skip_bits_long(&s->gb, offset); - } - - if (!nblocks || nblocks > INT_MAX) { - av_log(avctx, AV_LOG_ERROR, "Invalid sample count: %u.\n", nblocks); - return AVERROR_INVALIDDATA; - } - s->samples = nblocks; - - /* Initialize the frame decoder */ - if (init_frame_decoder(s) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error reading frame header\n"); - return AVERROR_INVALIDDATA; - } - } - - if (!s->data) { - *got_frame_ptr = 0; - return avpkt->size; - } - - blockstodecode = FFMIN(s->blocks_per_loop, s->samples); - // for old files coefficients were not interleaved, - // so we need to decode all of them at once - if (s->fileversion < 3930) - blockstodecode = s->samples; - - /* reallocate decoded sample buffer if needed */ - av_fast_malloc(&s->decoded_buffer, (unsigned int *) &s->decoded_size, - 2 * FFALIGN(blockstodecode, 8) * sizeof(*s->decoded_buffer)); - if (!s->decoded_buffer) - return AVERROR(ENOMEM); - memset(s->decoded_buffer, 0, s->decoded_size); - s->decoded[0] = s->decoded_buffer; - s->decoded[1] = s->decoded_buffer + FFALIGN(blockstodecode, 8); - - /* get output buffer */ - frame->nb_samples = blockstodecode; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - - s->error=0; - - if ((s->channels == 1) || (s->frameflags & APE_FRAMECODE_PSEUDO_STEREO)) - ape_unpack_mono(s, blockstodecode); - else - ape_unpack_stereo(s, blockstodecode); - emms_c(); - - if (s->error) { - s->samples=0; - av_log(avctx, AV_LOG_ERROR, "Error decoding frame\n"); - return AVERROR_INVALIDDATA; - } - - switch (s->bps) { - case 8: - for (ch = 0; ch < s->channels; ch++) { - sample8 = (uint8_t *)frame->data[ch]; - for (i = 0; i < blockstodecode; i++) - *sample8++ = (s->decoded[ch][i] + 0x80) & 0xff; - } - break; - case 16: - for (ch = 0; ch < s->channels; ch++) { - sample16 = (int16_t *)frame->data[ch]; - for (i = 0; i < blockstodecode; i++) - *sample16++ = s->decoded[ch][i]; - } - break; - case 24: - for (ch = 0; ch < s->channels; ch++) { - sample24 = (int32_t *)frame->data[ch]; - for (i = 0; i < blockstodecode; i++) - *sample24++ = s->decoded[ch][i] << 8; - } - break; - } - - s->samples -= blockstodecode; - - *got_frame_ptr = 1; - - return !s->samples ? avpkt->size : 0; -} - -static void ape_flush(AVCodecContext *avctx) -{ - APEContext *s = avctx->priv_data; - s->samples= 0; -} - -#define OFFSET(x) offsetof(APEContext, x) -#define PAR (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) -static const AVOption options[] = { - { "max_samples", "maximum number of samples decoded per call", OFFSET(blocks_per_loop), AV_OPT_TYPE_INT, { .i64 = 4608 }, 1, INT_MAX, PAR, "max_samples" }, - { "all", "no maximum. decode all samples for each packet at once", 0, AV_OPT_TYPE_CONST, { .i64 = INT_MAX }, INT_MIN, INT_MAX, PAR, "max_samples" }, - { NULL}, -}; - -static const AVClass ape_decoder_class = { - .class_name = "APE decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_ape_decoder = { - .name = "ape", - .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_APE, - .priv_data_size = sizeof(APEContext), - .init = ape_decode_init, - .close = ape_decode_close, - .decode = ape_decode_frame, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DELAY | CODEC_CAP_DR1, - .flush = ape_flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, - AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S32P, - AV_SAMPLE_FMT_NONE }, - .priv_class = &ape_decoder_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac.c deleted file mode 100644 index 12e8997db..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * common functions for the ATRAC family of decoders - * - * Copyright (c) 2006-2013 Maxim Poliakovski - * Copyright (c) 2006-2008 Benjamin Larsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - */ - -#include -#include -#include -#include - -#include "avcodec.h" -#include "atrac.h" - -float ff_atrac_sf_table[64]; -static float qmf_window[48]; - -static const float qmf_48tap_half[24] = { - -0.00001461907, -0.00009205479,-0.000056157569,0.00030117269, - 0.0002422519, -0.00085293897,-0.0005205574, 0.0020340169, - 0.00078333891, -0.0042153862, -0.00075614988, 0.0078402944, - -0.000061169922,-0.01344162, 0.0024626821, 0.021736089, - -0.007801671, -0.034090221, 0.01880949, 0.054326009, - -0.043596379, -0.099384367, 0.13207909, 0.46424159 -}; - -av_cold void ff_atrac_generate_tables(void) -{ - int i; - float s; - - /* Generate scale factors */ - if (!ff_atrac_sf_table[63]) - for (i=0 ; i<64 ; i++) - ff_atrac_sf_table[i] = pow(2.0, (i - 15) / 3.0); - - /* Generate the QMF window. */ - if (!qmf_window[47]) - for (i=0 ; i<24; i++) { - s = qmf_48tap_half[i] * 2.0; - qmf_window[i] = qmf_window[47 - i] = s; - } -} - -av_cold void ff_atrac_init_gain_compensation(AtracGCContext *gctx, int id2exp_offset, - int loc_scale) -{ - int i; - - gctx->loc_scale = loc_scale; - gctx->loc_size = 1 << loc_scale; - gctx->id2exp_offset = id2exp_offset; - - /* Generate gain level table. */ - for (i = 0; i < 16; i++) - gctx->gain_tab1[i] = powf(2.0, id2exp_offset - i); - - /* Generate gain interpolation table. */ - for (i = -15; i < 16; i++) - gctx->gain_tab2[i + 15] = powf(2.0, -1.0f / gctx->loc_size * i); -} - -void ff_atrac_gain_compensation(AtracGCContext *gctx, float *in, float *prev, - AtracGainInfo *gc_now, AtracGainInfo *gc_next, - int num_samples, float *out) -{ - float lev, gc_scale, gain_inc; - int i, pos, lastpos; - - gc_scale = gc_next->num_points ? gctx->gain_tab1[gc_next->lev_code[0]] - : 1.0f; - - if (!gc_now->num_points) { - for (pos = 0; pos < num_samples; pos++) - out[pos] = in[pos] * gc_scale + prev[pos]; - } else { - pos = 0; - - for (i = 0; i < gc_now->num_points; i++) { - lastpos = gc_now->loc_code[i] << gctx->loc_scale; - - lev = gctx->gain_tab1[gc_now->lev_code[i]]; - gain_inc = gctx->gain_tab2[(i + 1 < gc_now->num_points ? gc_now->lev_code[i + 1] - : gctx->id2exp_offset) - - gc_now->lev_code[i] + 15]; - - /* apply constant gain level and overlap */ - for (; pos < lastpos; pos++) - out[pos] = (in[pos] * gc_scale + prev[pos]) * lev; - - /* interpolate between two different gain levels */ - for (; pos < lastpos + gctx->loc_size; pos++) { - out[pos] = (in[pos] * gc_scale + prev[pos]) * lev; - lev *= gain_inc; - } - } - - for (; pos < num_samples; pos++) - out[pos] = in[pos] * gc_scale + prev[pos]; - } - - /* copy the overlapping part into the delay buffer */ - memcpy(prev, &in[num_samples], num_samples * sizeof(float)); -} - -void ff_atrac_iqmf(float *inlo, float *inhi, unsigned int nIn, float *pOut, - float *delayBuf, float *temp) -{ - int i, j; - float *p1, *p3; - - memcpy(temp, delayBuf, 46*sizeof(float)); - - p3 = temp + 46; - - /* loop1 */ - for(i=0; i -#include -#include - -#include "libavutil/attributes.h" -#include "libavutil/float_dsp.h" -#include "libavutil/libm.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "bytestream.h" -#include "fft.h" -#include "fmtconvert.h" -#include "get_bits.h" -#include "internal.h" - -#include "atrac.h" -#include "atrac3data.h" - -#define JOINT_STEREO 0x12 -#define STEREO 0x2 - -#define SAMPLES_PER_FRAME 1024 -#define MDCT_SIZE 512 - -typedef struct GainBlock { - AtracGainInfo g_block[4]; -} GainBlock; - -typedef struct TonalComponent { - int pos; - int num_coefs; - float coef[8]; -} TonalComponent; - -typedef struct ChannelUnit { - int bands_coded; - int num_components; - float prev_frame[SAMPLES_PER_FRAME]; - int gc_blk_switch; - TonalComponent components[64]; - GainBlock gain_block[2]; - - DECLARE_ALIGNED(32, float, spectrum)[SAMPLES_PER_FRAME]; - DECLARE_ALIGNED(32, float, imdct_buf)[SAMPLES_PER_FRAME]; - - float delay_buf1[46]; ///mdct_ctx.imdct_calc(&q->mdct_ctx, output, input); - - /* Perform windowing on the output. */ - q->fdsp.vector_fmul(output, output, mdct_window, MDCT_SIZE); -} - -/* - * indata descrambling, only used for data coming from the rm container - */ -static int decode_bytes(const uint8_t *input, uint8_t *out, int bytes) -{ - int i, off; - uint32_t c; - const uint32_t *buf; - uint32_t *output = (uint32_t *)out; - - off = (intptr_t)input & 3; - buf = (const uint32_t *)(input - off); - if (off) - c = av_be2ne32((0x537F6103U >> (off * 8)) | (0x537F6103U << (32 - (off * 8)))); - else - c = av_be2ne32(0x537F6103U); - bytes += 3 + off; - for (i = 0; i < bytes / 4; i++) - output[i] = c ^ buf[i]; - - if (off) - avpriv_request_sample(NULL, "Offset of %d", off); - - return off; -} - -static av_cold void init_imdct_window(void) -{ - int i, j; - - /* generate the mdct window, for details see - * http://wiki.multimedia.cx/index.php?title=RealAudio_atrc#Windows */ - for (i = 0, j = 255; i < 128; i++, j--) { - float wi = sin(((i + 0.5) / 256.0 - 0.5) * M_PI) + 1.0; - float wj = sin(((j + 0.5) / 256.0 - 0.5) * M_PI) + 1.0; - float w = 0.5 * (wi * wi + wj * wj); - mdct_window[i] = mdct_window[511 - i] = wi / w; - mdct_window[j] = mdct_window[511 - j] = wj / w; - } -} - -static av_cold int atrac3_decode_close(AVCodecContext *avctx) -{ - ATRAC3Context *q = avctx->priv_data; - - av_free(q->units); - av_free(q->decoded_bytes_buffer); - - ff_mdct_end(&q->mdct_ctx); - - return 0; -} - -/** - * Mantissa decoding - * - * @param selector which table the output values are coded with - * @param coding_flag constant length coding or variable length coding - * @param mantissas mantissa output table - * @param num_codes number of values to get - */ -static void read_quant_spectral_coeffs(GetBitContext *gb, int selector, - int coding_flag, int *mantissas, - int num_codes) -{ - int i, code, huff_symb; - - if (selector == 1) - num_codes /= 2; - - if (coding_flag != 0) { - /* constant length coding (CLC) */ - int num_bits = clc_length_tab[selector]; - - if (selector > 1) { - for (i = 0; i < num_codes; i++) { - if (num_bits) - code = get_sbits(gb, num_bits); - else - code = 0; - mantissas[i] = code; - } - } else { - for (i = 0; i < num_codes; i++) { - if (num_bits) - code = get_bits(gb, num_bits); // num_bits is always 4 in this case - else - code = 0; - mantissas[i * 2 ] = mantissa_clc_tab[code >> 2]; - mantissas[i * 2 + 1] = mantissa_clc_tab[code & 3]; - } - } - } else { - /* variable length coding (VLC) */ - if (selector != 1) { - for (i = 0; i < num_codes; i++) { - huff_symb = get_vlc2(gb, spectral_coeff_tab[selector-1].table, - spectral_coeff_tab[selector-1].bits, 3); - huff_symb += 1; - code = huff_symb >> 1; - if (huff_symb & 1) - code = -code; - mantissas[i] = code; - } - } else { - for (i = 0; i < num_codes; i++) { - huff_symb = get_vlc2(gb, spectral_coeff_tab[selector - 1].table, - spectral_coeff_tab[selector - 1].bits, 3); - mantissas[i * 2 ] = mantissa_vlc_tab[huff_symb * 2 ]; - mantissas[i * 2 + 1] = mantissa_vlc_tab[huff_symb * 2 + 1]; - } - } - } -} - -/** - * Restore the quantized band spectrum coefficients - * - * @return subband count, fix for broken specification/files - */ -static int decode_spectrum(GetBitContext *gb, float *output) -{ - int num_subbands, coding_mode, i, j, first, last, subband_size; - int subband_vlc_index[32], sf_index[32]; - int mantissas[128]; - float scale_factor; - - num_subbands = get_bits(gb, 5); // number of coded subbands - coding_mode = get_bits1(gb); // coding Mode: 0 - VLC/ 1-CLC - - /* get the VLC selector table for the subbands, 0 means not coded */ - for (i = 0; i <= num_subbands; i++) - subband_vlc_index[i] = get_bits(gb, 3); - - /* read the scale factor indexes from the stream */ - for (i = 0; i <= num_subbands; i++) { - if (subband_vlc_index[i] != 0) - sf_index[i] = get_bits(gb, 6); - } - - for (i = 0; i <= num_subbands; i++) { - first = subband_tab[i ]; - last = subband_tab[i + 1]; - - subband_size = last - first; - - if (subband_vlc_index[i] != 0) { - /* decode spectral coefficients for this subband */ - /* TODO: This can be done faster is several blocks share the - * same VLC selector (subband_vlc_index) */ - read_quant_spectral_coeffs(gb, subband_vlc_index[i], coding_mode, - mantissas, subband_size); - - /* decode the scale factor for this subband */ - scale_factor = ff_atrac_sf_table[sf_index[i]] * - inv_max_quant[subband_vlc_index[i]]; - - /* inverse quantize the coefficients */ - for (j = 0; first < last; first++, j++) - output[first] = mantissas[j] * scale_factor; - } else { - /* this subband was not coded, so zero the entire subband */ - memset(output + first, 0, subband_size * sizeof(*output)); - } - } - - /* clear the subbands that were not coded */ - first = subband_tab[i]; - memset(output + first, 0, (SAMPLES_PER_FRAME - first) * sizeof(*output)); - return num_subbands; -} - -/** - * Restore the quantized tonal components - * - * @param components tonal components - * @param num_bands number of coded bands - */ -static int decode_tonal_components(GetBitContext *gb, - TonalComponent *components, int num_bands) -{ - int i, b, c, m; - int nb_components, coding_mode_selector, coding_mode; - int band_flags[4], mantissa[8]; - int component_count = 0; - - nb_components = get_bits(gb, 5); - - /* no tonal components */ - if (nb_components == 0) - return 0; - - coding_mode_selector = get_bits(gb, 2); - if (coding_mode_selector == 2) - return AVERROR_INVALIDDATA; - - coding_mode = coding_mode_selector & 1; - - for (i = 0; i < nb_components; i++) { - int coded_values_per_component, quant_step_index; - - for (b = 0; b <= num_bands; b++) - band_flags[b] = get_bits1(gb); - - coded_values_per_component = get_bits(gb, 3); - - quant_step_index = get_bits(gb, 3); - if (quant_step_index <= 1) - return AVERROR_INVALIDDATA; - - if (coding_mode_selector == 3) - coding_mode = get_bits1(gb); - - for (b = 0; b < (num_bands + 1) * 4; b++) { - int coded_components; - - if (band_flags[b >> 2] == 0) - continue; - - coded_components = get_bits(gb, 3); - - for (c = 0; c < coded_components; c++) { - TonalComponent *cmp = &components[component_count]; - int sf_index, coded_values, max_coded_values; - float scale_factor; - - sf_index = get_bits(gb, 6); - if (component_count >= 64) - return AVERROR_INVALIDDATA; - - cmp->pos = b * 64 + get_bits(gb, 6); - - max_coded_values = SAMPLES_PER_FRAME - cmp->pos; - coded_values = coded_values_per_component + 1; - coded_values = FFMIN(max_coded_values, coded_values); - - scale_factor = ff_atrac_sf_table[sf_index] * - inv_max_quant[quant_step_index]; - - read_quant_spectral_coeffs(gb, quant_step_index, coding_mode, - mantissa, coded_values); - - cmp->num_coefs = coded_values; - - /* inverse quant */ - for (m = 0; m < coded_values; m++) - cmp->coef[m] = mantissa[m] * scale_factor; - - component_count++; - } - } - } - - return component_count; -} - -/** - * Decode gain parameters for the coded bands - * - * @param block the gainblock for the current band - * @param num_bands amount of coded bands - */ -static int decode_gain_control(GetBitContext *gb, GainBlock *block, - int num_bands) -{ - int b, j; - int *level, *loc; - - AtracGainInfo *gain = block->g_block; - - for (b = 0; b <= num_bands; b++) { - gain[b].num_points = get_bits(gb, 3); - level = gain[b].lev_code; - loc = gain[b].loc_code; - - for (j = 0; j < gain[b].num_points; j++) { - level[j] = get_bits(gb, 4); - loc[j] = get_bits(gb, 5); - if (j && loc[j] <= loc[j - 1]) - return AVERROR_INVALIDDATA; - } - } - - /* Clear the unused blocks. */ - for (; b < 4 ; b++) - gain[b].num_points = 0; - - return 0; -} - -/** - * Combine the tonal band spectrum and regular band spectrum - * - * @param spectrum output spectrum buffer - * @param num_components number of tonal components - * @param components tonal components for this band - * @return position of the last tonal coefficient - */ -static int add_tonal_components(float *spectrum, int num_components, - TonalComponent *components) -{ - int i, j, last_pos = -1; - float *input, *output; - - for (i = 0; i < num_components; i++) { - last_pos = FFMAX(components[i].pos + components[i].num_coefs, last_pos); - input = components[i].coef; - output = &spectrum[components[i].pos]; - - for (j = 0; j < components[i].num_coefs; j++) - output[j] += input[j]; - } - - return last_pos; -} - -#define INTERPOLATE(old, new, nsample) \ - ((old) + (nsample) * 0.125 * ((new) - (old))) - -static void reverse_matrixing(float *su1, float *su2, int *prev_code, - int *curr_code) -{ - int i, nsample, band; - float mc1_l, mc1_r, mc2_l, mc2_r; - - for (i = 0, band = 0; band < 4 * 256; band += 256, i++) { - int s1 = prev_code[i]; - int s2 = curr_code[i]; - nsample = band; - - if (s1 != s2) { - /* Selector value changed, interpolation needed. */ - mc1_l = matrix_coeffs[s1 * 2 ]; - mc1_r = matrix_coeffs[s1 * 2 + 1]; - mc2_l = matrix_coeffs[s2 * 2 ]; - mc2_r = matrix_coeffs[s2 * 2 + 1]; - - /* Interpolation is done over the first eight samples. */ - for (; nsample < band + 8; nsample++) { - float c1 = su1[nsample]; - float c2 = su2[nsample]; - c2 = c1 * INTERPOLATE(mc1_l, mc2_l, nsample - band) + - c2 * INTERPOLATE(mc1_r, mc2_r, nsample - band); - su1[nsample] = c2; - su2[nsample] = c1 * 2.0 - c2; - } - } - - /* Apply the matrix without interpolation. */ - switch (s2) { - case 0: /* M/S decoding */ - for (; nsample < band + 256; nsample++) { - float c1 = su1[nsample]; - float c2 = su2[nsample]; - su1[nsample] = c2 * 2.0; - su2[nsample] = (c1 - c2) * 2.0; - } - break; - case 1: - for (; nsample < band + 256; nsample++) { - float c1 = su1[nsample]; - float c2 = su2[nsample]; - su1[nsample] = (c1 + c2) * 2.0; - su2[nsample] = c2 * -2.0; - } - break; - case 2: - case 3: - for (; nsample < band + 256; nsample++) { - float c1 = su1[nsample]; - float c2 = su2[nsample]; - su1[nsample] = c1 + c2; - su2[nsample] = c1 - c2; - } - break; - default: - av_assert1(0); - } - } -} - -static void get_channel_weights(int index, int flag, float ch[2]) -{ - if (index == 7) { - ch[0] = 1.0; - ch[1] = 1.0; - } else { - ch[0] = (index & 7) / 7.0; - ch[1] = sqrt(2 - ch[0] * ch[0]); - if (flag) - FFSWAP(float, ch[0], ch[1]); - } -} - -static void channel_weighting(float *su1, float *su2, int *p3) -{ - int band, nsample; - /* w[x][y] y=0 is left y=1 is right */ - float w[2][2]; - - if (p3[1] != 7 || p3[3] != 7) { - get_channel_weights(p3[1], p3[0], w[0]); - get_channel_weights(p3[3], p3[2], w[1]); - - for (band = 256; band < 4 * 256; band += 256) { - for (nsample = band; nsample < band + 8; nsample++) { - su1[nsample] *= INTERPOLATE(w[0][0], w[0][1], nsample - band); - su2[nsample] *= INTERPOLATE(w[1][0], w[1][1], nsample - band); - } - for(; nsample < band + 256; nsample++) { - su1[nsample] *= w[1][0]; - su2[nsample] *= w[1][1]; - } - } - } -} - -/** - * Decode a Sound Unit - * - * @param snd the channel unit to be used - * @param output the decoded samples before IQMF in float representation - * @param channel_num channel number - * @param coding_mode the coding mode (JOINT_STEREO or regular stereo/mono) - */ -static int decode_channel_sound_unit(ATRAC3Context *q, GetBitContext *gb, - ChannelUnit *snd, float *output, - int channel_num, int coding_mode) -{ - int band, ret, num_subbands, last_tonal, num_bands; - GainBlock *gain1 = &snd->gain_block[ snd->gc_blk_switch]; - GainBlock *gain2 = &snd->gain_block[1 - snd->gc_blk_switch]; - - if (coding_mode == JOINT_STEREO && channel_num == 1) { - if (get_bits(gb, 2) != 3) { - av_log(NULL,AV_LOG_ERROR,"JS mono Sound Unit id != 3.\n"); - return AVERROR_INVALIDDATA; - } - } else { - if (get_bits(gb, 6) != 0x28) { - av_log(NULL,AV_LOG_ERROR,"Sound Unit id != 0x28.\n"); - return AVERROR_INVALIDDATA; - } - } - - /* number of coded QMF bands */ - snd->bands_coded = get_bits(gb, 2); - - ret = decode_gain_control(gb, gain2, snd->bands_coded); - if (ret) - return ret; - - snd->num_components = decode_tonal_components(gb, snd->components, - snd->bands_coded); - if (snd->num_components < 0) - return snd->num_components; - - num_subbands = decode_spectrum(gb, snd->spectrum); - - /* Merge the decoded spectrum and tonal components. */ - last_tonal = add_tonal_components(snd->spectrum, snd->num_components, - snd->components); - - - /* calculate number of used MLT/QMF bands according to the amount of coded - spectral lines */ - num_bands = (subband_tab[num_subbands] - 1) >> 8; - if (last_tonal >= 0) - num_bands = FFMAX((last_tonal + 256) >> 8, num_bands); - - - /* Reconstruct time domain samples. */ - for (band = 0; band < 4; band++) { - /* Perform the IMDCT step without overlapping. */ - if (band <= num_bands) - imlt(q, &snd->spectrum[band * 256], snd->imdct_buf, band & 1); - else - memset(snd->imdct_buf, 0, 512 * sizeof(*snd->imdct_buf)); - - /* gain compensation and overlapping */ - ff_atrac_gain_compensation(&q->gainc_ctx, snd->imdct_buf, - &snd->prev_frame[band * 256], - &gain1->g_block[band], &gain2->g_block[band], - 256, &output[band * 256]); - } - - /* Swap the gain control buffers for the next frame. */ - snd->gc_blk_switch ^= 1; - - return 0; -} - -static int decode_frame(AVCodecContext *avctx, const uint8_t *databuf, - float **out_samples) -{ - ATRAC3Context *q = avctx->priv_data; - int ret, i; - uint8_t *ptr1; - - if (q->coding_mode == JOINT_STEREO) { - /* channel coupling mode */ - /* decode Sound Unit 1 */ - init_get_bits(&q->gb, databuf, avctx->block_align * 8); - - ret = decode_channel_sound_unit(q, &q->gb, q->units, out_samples[0], 0, - JOINT_STEREO); - if (ret != 0) - return ret; - - /* Framedata of the su2 in the joint-stereo mode is encoded in - * reverse byte order so we need to swap it first. */ - if (databuf == q->decoded_bytes_buffer) { - uint8_t *ptr2 = q->decoded_bytes_buffer + avctx->block_align - 1; - ptr1 = q->decoded_bytes_buffer; - for (i = 0; i < avctx->block_align / 2; i++, ptr1++, ptr2--) - FFSWAP(uint8_t, *ptr1, *ptr2); - } else { - const uint8_t *ptr2 = databuf + avctx->block_align - 1; - for (i = 0; i < avctx->block_align; i++) - q->decoded_bytes_buffer[i] = *ptr2--; - } - - /* Skip the sync codes (0xF8). */ - ptr1 = q->decoded_bytes_buffer; - for (i = 4; *ptr1 == 0xF8; i++, ptr1++) { - if (i >= avctx->block_align) - return AVERROR_INVALIDDATA; - } - - - /* set the bitstream reader at the start of the second Sound Unit*/ - init_get_bits8(&q->gb, ptr1, q->decoded_bytes_buffer + avctx->block_align - ptr1); - - /* Fill the Weighting coeffs delay buffer */ - memmove(q->weighting_delay, &q->weighting_delay[2], - 4 * sizeof(*q->weighting_delay)); - q->weighting_delay[4] = get_bits1(&q->gb); - q->weighting_delay[5] = get_bits(&q->gb, 3); - - for (i = 0; i < 4; i++) { - q->matrix_coeff_index_prev[i] = q->matrix_coeff_index_now[i]; - q->matrix_coeff_index_now[i] = q->matrix_coeff_index_next[i]; - q->matrix_coeff_index_next[i] = get_bits(&q->gb, 2); - } - - /* Decode Sound Unit 2. */ - ret = decode_channel_sound_unit(q, &q->gb, &q->units[1], - out_samples[1], 1, JOINT_STEREO); - if (ret != 0) - return ret; - - /* Reconstruct the channel coefficients. */ - reverse_matrixing(out_samples[0], out_samples[1], - q->matrix_coeff_index_prev, - q->matrix_coeff_index_now); - - channel_weighting(out_samples[0], out_samples[1], q->weighting_delay); - } else { - /* normal stereo mode or mono */ - /* Decode the channel sound units. */ - for (i = 0; i < avctx->channels; i++) { - /* Set the bitstream reader at the start of a channel sound unit. */ - init_get_bits(&q->gb, - databuf + i * avctx->block_align / avctx->channels, - avctx->block_align * 8 / avctx->channels); - - ret = decode_channel_sound_unit(q, &q->gb, &q->units[i], - out_samples[i], i, q->coding_mode); - if (ret != 0) - return ret; - } - } - - /* Apply the iQMF synthesis filter. */ - for (i = 0; i < avctx->channels; i++) { - float *p1 = out_samples[i]; - float *p2 = p1 + 256; - float *p3 = p2 + 256; - float *p4 = p3 + 256; - ff_atrac_iqmf(p1, p2, 256, p1, q->units[i].delay_buf1, q->temp_buf); - ff_atrac_iqmf(p4, p3, 256, p3, q->units[i].delay_buf2, q->temp_buf); - ff_atrac_iqmf(p1, p3, 512, p1, q->units[i].delay_buf3, q->temp_buf); - } - - return 0; -} - -static int atrac3_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - ATRAC3Context *q = avctx->priv_data; - int ret; - const uint8_t *databuf; - - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, - "Frame too small (%d bytes). Truncated file?\n", buf_size); - return AVERROR_INVALIDDATA; - } - - /* get output buffer */ - frame->nb_samples = SAMPLES_PER_FRAME; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - - /* Check if we need to descramble and what buffer to pass on. */ - if (q->scrambled_stream) { - decode_bytes(buf, q->decoded_bytes_buffer, avctx->block_align); - databuf = q->decoded_bytes_buffer; - } else { - databuf = buf; - } - - ret = decode_frame(avctx, databuf, (float **)frame->extended_data); - if (ret) { - av_log(NULL, AV_LOG_ERROR, "Frame decoding error!\n"); - return ret; - } - - *got_frame_ptr = 1; - - return avctx->block_align; -} - -static av_cold void atrac3_init_static_data(void) -{ - int i; - - init_imdct_window(); - ff_atrac_generate_tables(); - - /* Initialize the VLC tables. */ - for (i = 0; i < 7; i++) { - spectral_coeff_tab[i].table = &atrac3_vlc_table[atrac3_vlc_offs[i]]; - spectral_coeff_tab[i].table_allocated = atrac3_vlc_offs[i + 1] - - atrac3_vlc_offs[i ]; - init_vlc(&spectral_coeff_tab[i], 9, huff_tab_sizes[i], - huff_bits[i], 1, 1, - huff_codes[i], 1, 1, INIT_VLC_USE_NEW_STATIC); - } -} - -static av_cold int atrac3_decode_init(AVCodecContext *avctx) -{ - static int static_init_done; - int i, ret; - int version, delay, samples_per_frame, frame_factor; - const uint8_t *edata_ptr = avctx->extradata; - ATRAC3Context *q = avctx->priv_data; - - if (avctx->channels <= 0 || avctx->channels > 2) { - av_log(avctx, AV_LOG_ERROR, "Channel configuration error!\n"); - return AVERROR(EINVAL); - } - - if (!static_init_done) - atrac3_init_static_data(); - static_init_done = 1; - - /* Take care of the codec-specific extradata. */ - if (avctx->extradata_size == 14) { - /* Parse the extradata, WAV format */ - av_log(avctx, AV_LOG_DEBUG, "[0-1] %d\n", - bytestream_get_le16(&edata_ptr)); // Unknown value always 1 - edata_ptr += 4; // samples per channel - q->coding_mode = bytestream_get_le16(&edata_ptr); - av_log(avctx, AV_LOG_DEBUG,"[8-9] %d\n", - bytestream_get_le16(&edata_ptr)); //Dupe of coding mode - frame_factor = bytestream_get_le16(&edata_ptr); // Unknown always 1 - av_log(avctx, AV_LOG_DEBUG,"[12-13] %d\n", - bytestream_get_le16(&edata_ptr)); // Unknown always 0 - - /* setup */ - samples_per_frame = SAMPLES_PER_FRAME * avctx->channels; - version = 4; - delay = 0x88E; - q->coding_mode = q->coding_mode ? JOINT_STEREO : STEREO; - q->scrambled_stream = 0; - - if (avctx->block_align != 96 * avctx->channels * frame_factor && - avctx->block_align != 152 * avctx->channels * frame_factor && - avctx->block_align != 192 * avctx->channels * frame_factor) { - av_log(avctx, AV_LOG_ERROR, "Unknown frame/channel/frame_factor " - "configuration %d/%d/%d\n", avctx->block_align, - avctx->channels, frame_factor); - return AVERROR_INVALIDDATA; - } - } else if (avctx->extradata_size == 12 || avctx->extradata_size == 10) { - /* Parse the extradata, RM format. */ - version = bytestream_get_be32(&edata_ptr); - samples_per_frame = bytestream_get_be16(&edata_ptr); - delay = bytestream_get_be16(&edata_ptr); - q->coding_mode = bytestream_get_be16(&edata_ptr); - q->scrambled_stream = 1; - - } else { - av_log(NULL, AV_LOG_ERROR, "Unknown extradata size %d.\n", - avctx->extradata_size); - return AVERROR(EINVAL); - } - - /* Check the extradata */ - - if (version != 4) { - av_log(avctx, AV_LOG_ERROR, "Version %d != 4.\n", version); - return AVERROR_INVALIDDATA; - } - - if (samples_per_frame != SAMPLES_PER_FRAME && - samples_per_frame != SAMPLES_PER_FRAME * 2) { - av_log(avctx, AV_LOG_ERROR, "Unknown amount of samples per frame %d.\n", - samples_per_frame); - return AVERROR_INVALIDDATA; - } - - if (delay != 0x88E) { - av_log(avctx, AV_LOG_ERROR, "Unknown amount of delay %x != 0x88E.\n", - delay); - return AVERROR_INVALIDDATA; - } - - if (q->coding_mode == STEREO) - av_log(avctx, AV_LOG_DEBUG, "Normal stereo detected.\n"); - else if (q->coding_mode == JOINT_STEREO) { - if (avctx->channels != 2) { - av_log(avctx, AV_LOG_ERROR, "Invalid coding mode\n"); - return AVERROR_INVALIDDATA; - } - av_log(avctx, AV_LOG_DEBUG, "Joint stereo detected.\n"); - } else { - av_log(avctx, AV_LOG_ERROR, "Unknown channel coding mode %x!\n", - q->coding_mode); - return AVERROR_INVALIDDATA; - } - - if (avctx->block_align >= UINT_MAX / 2) - return AVERROR(EINVAL); - - q->decoded_bytes_buffer = av_mallocz(FFALIGN(avctx->block_align, 4) + - FF_INPUT_BUFFER_PADDING_SIZE); - if (q->decoded_bytes_buffer == NULL) - return AVERROR(ENOMEM); - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - /* initialize the MDCT transform */ - if ((ret = ff_mdct_init(&q->mdct_ctx, 9, 1, 1.0 / 32768)) < 0) { - av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); - av_freep(&q->decoded_bytes_buffer); - return ret; - } - - /* init the joint-stereo decoding data */ - q->weighting_delay[0] = 0; - q->weighting_delay[1] = 7; - q->weighting_delay[2] = 0; - q->weighting_delay[3] = 7; - q->weighting_delay[4] = 0; - q->weighting_delay[5] = 7; - - for (i = 0; i < 4; i++) { - q->matrix_coeff_index_prev[i] = 3; - q->matrix_coeff_index_now[i] = 3; - q->matrix_coeff_index_next[i] = 3; - } - - ff_atrac_init_gain_compensation(&q->gainc_ctx, 4, 3); - avpriv_float_dsp_init(&q->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - ff_fmt_convert_init(&q->fmt_conv, avctx); - - q->units = av_mallocz(sizeof(*q->units) * avctx->channels); - if (!q->units) { - atrac3_decode_close(avctx); - return AVERROR(ENOMEM); - } - - return 0; -} - -AVCodec ff_atrac3_decoder = { - .name = "atrac3", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 (Adaptive TRansform Acoustic Coding 3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ATRAC3, - .priv_data_size = sizeof(ATRAC3Context), - .init = atrac3_decode_init, - .close = atrac3_decode_close, - .decode = atrac3_decode_frame, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3data.h deleted file mode 100644 index 5d91274f4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3data.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * ATRAC3 compatible decoder data - * Copyright (c) 2006-2007 Maxim Poliakovski - * Copyright (c) 2006-2007 Benjamin Larsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * ATRAC3 AKA RealAudio 8 compatible decoder data - */ - -#ifndef AVCODEC_ATRAC3DATA_H -#define AVCODEC_ATRAC3DATA_H - -#include - -/* VLC tables */ - -static const uint8_t huffcode1[9] = { - 0x0, 0x4, 0x5, 0xC, 0xD, 0x1C, 0x1D, 0x1E, 0x1F -}; - -static const uint8_t huffbits1[9] = { 1, 3, 3, 4, 4, 5, 5, 5, 5 }; - -static const uint8_t huffcode2[5] = { 0x0, 0x4, 0x5, 0x6, 0x7 }; - -static const uint8_t huffbits2[5] = { 1, 3, 3, 3, 3 }; - -static const uint8_t huffcode3[7] = { 0x0, 0x4, 0x5, 0xC, 0xD, 0xE, 0xF }; - -static const uint8_t huffbits3[7] = { 1, 3, 3, 4, 4, 4, 4 }; - -static const uint8_t huffcode4[9] = { - 0x0, 0x4, 0x5, 0xC, 0xD, 0x1C, 0x1D, 0x1E, 0x1F -}; - -static const uint8_t huffbits4[9] = { 1, 3, 3, 4, 4, 5, 5, 5, 5 }; - -static const uint8_t huffcode5[15] = { - 0x00, 0x02, 0x03, 0x08, 0x09, 0x0A, 0x0B, 0x1C, - 0x1D, 0x3C, 0x3D, 0x3E, 0x3F, 0x0C, 0x0D -}; - -static const uint8_t huffbits5[15] = { - 2, 3, 3, 4, 4, 4, 4, 5, 5, 6, 6, 6, 6, 4, 4 -}; - -static const uint8_t huffcode6[31] = { - 0x00, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x14, - 0x15, 0x16, 0x17, 0x18, 0x19, 0x34, 0x35, 0x36, - 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x78, 0x79, 0x7A, - 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x08, 0x09 -}; - -static const uint8_t huffbits6[31] = { - 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, - 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 4, 4 -}; - -static const uint8_t huffcode7[63] = { - 0x00, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, - 0x0F, 0x10, 0x11, 0x24, 0x25, 0x26, 0x27, 0x28, - 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, - 0x31, 0x32, 0x33, 0x68, 0x69, 0x6A, 0x6B, 0x6C, - 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74, - 0x75, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, - 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, - 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, 0x02, 0x03 -}; - -static const uint8_t huffbits7[63] = { - 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 4, 4 -}; - -static const uint8_t huff_tab_sizes[7] = { - 9, 5, 7, 9, 15, 31, 63, -}; - -static const uint8_t* const huff_codes[7] = { - huffcode1, huffcode2, huffcode3, huffcode4, huffcode5, huffcode6, huffcode7 -}; - -static const uint8_t* const huff_bits[7] = { - huffbits1, huffbits2, huffbits3, huffbits4, huffbits5, huffbits6, huffbits7, -}; - -static const uint16_t atrac3_vlc_offs[9] = { - 0, 512, 1024, 1536, 2048, 2560, 3072, 3584, 4096 -}; - -/* selector tables */ - -static const uint8_t clc_length_tab[8] = { 0, 4, 3, 3, 4, 4, 5, 6 }; - -static const int8_t mantissa_clc_tab[4] = { 0, 1, -2, -1 }; - -static const int8_t mantissa_vlc_tab[18] = { - 0, 0, 0, 1, 0, -1, 1, 0, -1, 0, 1, 1, 1, -1, -1, 1, -1, -1 -}; - - -/* tables for the scalefactor decoding */ - -static const float inv_max_quant[8] = { - 0.0, 1.0 / 1.5, 1.0 / 2.5, 1.0 / 3.5, - 1.0 / 4.5, 1.0 / 7.5, 1.0 / 15.5, 1.0 / 31.5 -}; - -static const uint16_t subband_tab[33] = { - 0, 8, 16, 24, 32, 40, 48, 56, - 64, 80, 96, 112, 128, 144, 160, 176, - 192, 224, 256, 288, 320, 352, 384, 416, - 448, 480, 512, 576, 640, 704, 768, 896, - 1024 -}; - -/* joint stereo related tables */ -static const float matrix_coeffs[8] = { - 0.0, 2.0, 2.0, 2.0, 0.0, 0.0, 1.0, 1.0 -}; - -#endif /* AVCODEC_ATRAC3DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.c deleted file mode 100644 index 08c90cde9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.c +++ /dev/null @@ -1,1818 +0,0 @@ -/* - * ATRAC3+ compatible decoder - * - * Copyright (c) 2010-2013 Maxim Poliakovski - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Bitstream parser for ATRAC3+ decoder. - */ - -#include "libavutil/avassert.h" -#include "avcodec.h" -#include "get_bits.h" -#include "atrac3plus.h" -#include "atrac3plus_data.h" - -static VLC_TYPE tables_data[154276][2]; -static VLC wl_vlc_tabs[4]; -static VLC sf_vlc_tabs[8]; -static VLC ct_vlc_tabs[4]; -static VLC spec_vlc_tabs[112]; -static VLC gain_vlc_tabs[11]; -static VLC tone_vlc_tabs[7]; - -#define GET_DELTA(gb, delta_bits) \ - ((delta_bits) ? get_bits((gb), (delta_bits)) : 0) - -/** - * Generate canonical VLC table from given descriptor. - * - * @param[in] cb ptr to codebook descriptor - * @param[in] xlat ptr to translation table or NULL - * @param[in,out] tab_offset starting offset to the generated vlc table - * @param[out] out_vlc ptr to vlc table to be generated - */ -static av_cold void build_canonical_huff(const uint8_t *cb, const uint8_t *xlat, - int *tab_offset, VLC *out_vlc) -{ - int i, b; - uint16_t codes[256]; - uint8_t bits[256]; - unsigned code = 0; - int index = 0; - int min_len = *cb++; // get shortest codeword length - int max_len = *cb++; // get longest codeword length - - for (b = min_len; b <= max_len; b++) { - for (i = *cb++; i > 0; i--) { - av_assert0(index < 256); - bits[index] = b; - codes[index] = code++; - index++; - } - code <<= 1; - } - - out_vlc->table = &tables_data[*tab_offset]; - out_vlc->table_allocated = 1 << max_len; - - ff_init_vlc_sparse(out_vlc, max_len, index, bits, 1, 1, codes, 2, 2, - xlat, 1, 1, INIT_VLC_USE_NEW_STATIC); - - *tab_offset += 1 << max_len; -} - -av_cold void ff_atrac3p_init_vlcs(void) -{ - int i, wl_vlc_offs, ct_vlc_offs, sf_vlc_offs, tab_offset; - - static int wl_nb_bits[4] = { 2, 3, 5, 5 }; - static int wl_nb_codes[4] = { 3, 5, 8, 8 }; - static const uint8_t *wl_bits[4] = { - atrac3p_wl_huff_bits1, atrac3p_wl_huff_bits2, - atrac3p_wl_huff_bits3, atrac3p_wl_huff_bits4 - }; - static const uint8_t *wl_codes[4] = { - atrac3p_wl_huff_code1, atrac3p_wl_huff_code2, - atrac3p_wl_huff_code3, atrac3p_wl_huff_code4 - }; - static const uint8_t *wl_xlats[4] = { - atrac3p_wl_huff_xlat1, atrac3p_wl_huff_xlat2, NULL, NULL - }; - - static int ct_nb_bits[4] = { 3, 4, 4, 4 }; - static int ct_nb_codes[4] = { 4, 8, 8, 8 }; - static const uint8_t *ct_bits[4] = { - atrac3p_ct_huff_bits1, atrac3p_ct_huff_bits2, - atrac3p_ct_huff_bits2, atrac3p_ct_huff_bits3 - }; - static const uint8_t *ct_codes[4] = { - atrac3p_ct_huff_code1, atrac3p_ct_huff_code2, - atrac3p_ct_huff_code2, atrac3p_ct_huff_code3 - }; - static const uint8_t *ct_xlats[4] = { - NULL, NULL, atrac3p_ct_huff_xlat1, NULL - }; - - static int sf_nb_bits[8] = { 9, 9, 9, 9, 6, 6, 7, 7 }; - static int sf_nb_codes[8] = { 64, 64, 64, 64, 16, 16, 16, 16 }; - static const uint8_t *sf_bits[8] = { - atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits1, atrac3p_sf_huff_bits2, - atrac3p_sf_huff_bits3, atrac3p_sf_huff_bits4, atrac3p_sf_huff_bits4, - atrac3p_sf_huff_bits5, atrac3p_sf_huff_bits6 - }; - static const uint16_t *sf_codes[8] = { - atrac3p_sf_huff_code1, atrac3p_sf_huff_code1, atrac3p_sf_huff_code2, - atrac3p_sf_huff_code3, atrac3p_sf_huff_code4, atrac3p_sf_huff_code4, - atrac3p_sf_huff_code5, atrac3p_sf_huff_code6 - }; - static const uint8_t *sf_xlats[8] = { - atrac3p_sf_huff_xlat1, atrac3p_sf_huff_xlat2, NULL, NULL, - atrac3p_sf_huff_xlat4, atrac3p_sf_huff_xlat5, NULL, NULL - }; - - static const uint8_t *gain_cbs[11] = { - atrac3p_huff_gain_npoints1_cb, atrac3p_huff_gain_npoints1_cb, - atrac3p_huff_gain_lev1_cb, atrac3p_huff_gain_lev2_cb, - atrac3p_huff_gain_lev3_cb, atrac3p_huff_gain_lev4_cb, - atrac3p_huff_gain_loc3_cb, atrac3p_huff_gain_loc1_cb, - atrac3p_huff_gain_loc4_cb, atrac3p_huff_gain_loc2_cb, - atrac3p_huff_gain_loc5_cb - }; - static const uint8_t *gain_xlats[11] = { - NULL, atrac3p_huff_gain_npoints2_xlat, atrac3p_huff_gain_lev1_xlat, - atrac3p_huff_gain_lev2_xlat, atrac3p_huff_gain_lev3_xlat, - atrac3p_huff_gain_lev4_xlat, atrac3p_huff_gain_loc3_xlat, - atrac3p_huff_gain_loc1_xlat, atrac3p_huff_gain_loc4_xlat, - atrac3p_huff_gain_loc2_xlat, atrac3p_huff_gain_loc5_xlat - }; - - static const uint8_t *tone_cbs[7] = { - atrac3p_huff_tonebands_cb, atrac3p_huff_numwavs1_cb, - atrac3p_huff_numwavs2_cb, atrac3p_huff_wav_ampsf1_cb, - atrac3p_huff_wav_ampsf2_cb, atrac3p_huff_wav_ampsf3_cb, - atrac3p_huff_freq_cb - }; - static const uint8_t *tone_xlats[7] = { - NULL, NULL, atrac3p_huff_numwavs2_xlat, atrac3p_huff_wav_ampsf1_xlat, - atrac3p_huff_wav_ampsf2_xlat, atrac3p_huff_wav_ampsf3_xlat, - atrac3p_huff_freq_xlat - }; - - for (i = 0, wl_vlc_offs = 0, ct_vlc_offs = 2508; i < 4; i++) { - wl_vlc_tabs[i].table = &tables_data[wl_vlc_offs]; - wl_vlc_tabs[i].table_allocated = 1 << wl_nb_bits[i]; - ct_vlc_tabs[i].table = &tables_data[ct_vlc_offs]; - ct_vlc_tabs[i].table_allocated = 1 << ct_nb_bits[i]; - - ff_init_vlc_sparse(&wl_vlc_tabs[i], wl_nb_bits[i], wl_nb_codes[i], - wl_bits[i], 1, 1, - wl_codes[i], 1, 1, - wl_xlats[i], 1, 1, - INIT_VLC_USE_NEW_STATIC); - - ff_init_vlc_sparse(&ct_vlc_tabs[i], ct_nb_bits[i], ct_nb_codes[i], - ct_bits[i], 1, 1, - ct_codes[i], 1, 1, - ct_xlats[i], 1, 1, - INIT_VLC_USE_NEW_STATIC); - - wl_vlc_offs += wl_vlc_tabs[i].table_allocated; - ct_vlc_offs += ct_vlc_tabs[i].table_allocated; - } - - for (i = 0, sf_vlc_offs = 76; i < 8; i++) { - sf_vlc_tabs[i].table = &tables_data[sf_vlc_offs]; - sf_vlc_tabs[i].table_allocated = 1 << sf_nb_bits[i]; - - ff_init_vlc_sparse(&sf_vlc_tabs[i], sf_nb_bits[i], sf_nb_codes[i], - sf_bits[i], 1, 1, - sf_codes[i], 2, 2, - sf_xlats[i], 1, 1, - INIT_VLC_USE_NEW_STATIC); - sf_vlc_offs += sf_vlc_tabs[i].table_allocated; - } - - tab_offset = 2564; - - /* build huffman tables for spectrum decoding */ - for (i = 0; i < 112; i++) { - if (atrac3p_spectra_tabs[i].cb) - build_canonical_huff(atrac3p_spectra_tabs[i].cb, - atrac3p_spectra_tabs[i].xlat, - &tab_offset, &spec_vlc_tabs[i]); - else - spec_vlc_tabs[i].table = 0; - } - - /* build huffman tables for gain data decoding */ - for (i = 0; i < 11; i++) - build_canonical_huff(gain_cbs[i], gain_xlats[i], &tab_offset, &gain_vlc_tabs[i]); - - /* build huffman tables for tone decoding */ - for (i = 0; i < 7; i++) - build_canonical_huff(tone_cbs[i], tone_xlats[i], &tab_offset, &tone_vlc_tabs[i]); -} - -/** - * Decode number of coded quantization units. - * - * @param[in] gb the GetBit context - * @param[in,out] chan ptr to the channel parameters - * @param[in,out] ctx ptr to the channel unit context - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int num_coded_units(GetBitContext *gb, Atrac3pChanParams *chan, - Atrac3pChanUnitCtx *ctx, AVCodecContext *avctx) -{ - chan->fill_mode = get_bits(gb, 2); - if (!chan->fill_mode) { - chan->num_coded_vals = ctx->num_quant_units; - } else { - chan->num_coded_vals = get_bits(gb, 5); - if (chan->num_coded_vals > ctx->num_quant_units) { - av_log(avctx, AV_LOG_ERROR, - "Invalid number of transmitted units!\n"); - return AVERROR_INVALIDDATA; - } - - if (chan->fill_mode == 3) - chan->split_point = get_bits(gb, 2) + (chan->ch_num << 1) + 1; - } - - return 0; -} - -/** - * Add weighting coefficients to the decoded word-length information. - * - * @param[in,out] ctx ptr to the channel unit context - * @param[in,out] chan ptr to the channel parameters - * @param[in] wtab_idx index of the table of weights - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int add_wordlen_weights(Atrac3pChanUnitCtx *ctx, - Atrac3pChanParams *chan, int wtab_idx, - AVCodecContext *avctx) -{ - int i; - const int8_t *weights_tab = - &atrac3p_wl_weights[chan->ch_num * 3 + wtab_idx - 1][0]; - - for (i = 0; i < ctx->num_quant_units; i++) { - chan->qu_wordlen[i] += weights_tab[i]; - if (chan->qu_wordlen[i] < 0 || chan->qu_wordlen[i] > 7) { - av_log(avctx, AV_LOG_ERROR, - "WL index out of range: pos=%d, val=%d!\n", - i, chan->qu_wordlen[i]); - return AVERROR_INVALIDDATA; - } - } - - return 0; -} - -/** - * Subtract weighting coefficients from decoded scalefactors. - * - * @param[in,out] ctx ptr to the channel unit context - * @param[in,out] chan ptr to the channel parameters - * @param[in] wtab_idx index of table of weights - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int subtract_sf_weights(Atrac3pChanUnitCtx *ctx, - Atrac3pChanParams *chan, int wtab_idx, - AVCodecContext *avctx) -{ - int i; - const int8_t *weights_tab = &atrac3p_sf_weights[wtab_idx - 1][0]; - - for (i = 0; i < ctx->used_quant_units; i++) { - chan->qu_sf_idx[i] -= weights_tab[i]; - if (chan->qu_sf_idx[i] < 0 || chan->qu_sf_idx[i] > 63) { - av_log(avctx, AV_LOG_ERROR, - "SF index out of range: pos=%d, val=%d!\n", - i, chan->qu_sf_idx[i]); - return AVERROR_INVALIDDATA; - } - } - - return 0; -} - -/** - * Unpack vector quantization tables. - * - * @param[in] start_val start value for the unpacked table - * @param[in] shape_vec ptr to table to unpack - * @param[out] dst ptr to output array - * @param[in] num_values number of values to unpack - */ -static inline void unpack_vq_shape(int start_val, const int8_t *shape_vec, - int *dst, int num_values) -{ - int i; - - if (num_values) { - dst[0] = dst[1] = dst[2] = start_val; - for (i = 3; i < num_values; i++) - dst[i] = start_val - shape_vec[atrac3p_qu_num_to_seg[i] - 1]; - } -} - -#define UNPACK_SF_VQ_SHAPE(gb, dst, num_vals) \ - start_val = get_bits((gb), 6); \ - unpack_vq_shape(start_val, &atrac3p_sf_shapes[get_bits((gb), 6)][0], \ - (dst), (num_vals)) - -/** - * Decode word length for each quantization unit of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_channel_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, AVCodecContext *avctx) -{ - int i, weight_idx = 0, delta, diff, pos, delta_bits, min_val, flag, - ret, start_val; - VLC *vlc_tab; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - chan->fill_mode = 0; - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* coded using constant number of bits */ - for (i = 0; i < ctx->num_quant_units; i++) - chan->qu_wordlen[i] = get_bits(gb, 3); - break; - case 1: - if (ch_num) { - if ((ret = num_coded_units(gb, chan, ctx, avctx)) < 0) - return ret; - - if (chan->num_coded_vals) { - vlc_tab = &wl_vlc_tabs[get_bits(gb, 2)]; - - for (i = 0; i < chan->num_coded_vals; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_wordlen[i] = (ref_chan->qu_wordlen[i] + delta) & 7; - } - } - } else { - weight_idx = get_bits(gb, 2); - if ((ret = num_coded_units(gb, chan, ctx, avctx)) < 0) - return ret; - - if (chan->num_coded_vals) { - pos = get_bits(gb, 5); - if (pos > chan->num_coded_vals) { - av_log(avctx, AV_LOG_ERROR, - "WL mode 1: invalid position!\n"); - return AVERROR_INVALIDDATA; - } - - delta_bits = get_bits(gb, 2); - min_val = get_bits(gb, 3); - - for (i = 0; i < pos; i++) - chan->qu_wordlen[i] = get_bits(gb, 3); - - for (i = pos; i < chan->num_coded_vals; i++) - chan->qu_wordlen[i] = (min_val + GET_DELTA(gb, delta_bits)) & 7; - } - } - break; - case 2: - if ((ret = num_coded_units(gb, chan, ctx, avctx)) < 0) - return ret; - - if (ch_num && chan->num_coded_vals) { - vlc_tab = &wl_vlc_tabs[get_bits(gb, 2)]; - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_wordlen[0] = (ref_chan->qu_wordlen[0] + delta) & 7; - - for (i = 1; i < chan->num_coded_vals; i++) { - diff = ref_chan->qu_wordlen[i] - ref_chan->qu_wordlen[i - 1]; - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_wordlen[i] = (chan->qu_wordlen[i - 1] + diff + delta) & 7; - } - } else if (chan->num_coded_vals) { - flag = get_bits(gb, 1); - vlc_tab = &wl_vlc_tabs[get_bits(gb, 1)]; - - start_val = get_bits(gb, 3); - unpack_vq_shape(start_val, - &atrac3p_wl_shapes[start_val][get_bits(gb, 4)][0], - chan->qu_wordlen, chan->num_coded_vals); - - if (!flag) { - for (i = 0; i < chan->num_coded_vals; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_wordlen[i] = (chan->qu_wordlen[i] + delta) & 7; - } - } else { - for (i = 0; i < (chan->num_coded_vals & - 2); i += 2) - if (!get_bits1(gb)) { - chan->qu_wordlen[i] = (chan->qu_wordlen[i] + - get_vlc2(gb, vlc_tab->table, - vlc_tab->bits, 1)) & 7; - chan->qu_wordlen[i + 1] = (chan->qu_wordlen[i + 1] + - get_vlc2(gb, vlc_tab->table, - vlc_tab->bits, 1)) & 7; - } - - if (chan->num_coded_vals & 1) - chan->qu_wordlen[i] = (chan->qu_wordlen[i] + - get_vlc2(gb, vlc_tab->table, - vlc_tab->bits, 1)) & 7; - } - } - break; - case 3: - weight_idx = get_bits(gb, 2); - if ((ret = num_coded_units(gb, chan, ctx, avctx)) < 0) - return ret; - - if (chan->num_coded_vals) { - vlc_tab = &wl_vlc_tabs[get_bits(gb, 2)]; - - /* first coefficient is coded directly */ - chan->qu_wordlen[0] = get_bits(gb, 3); - - for (i = 1; i < chan->num_coded_vals; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_wordlen[i] = (chan->qu_wordlen[i - 1] + delta) & 7; - } - } - break; - } - - if (chan->fill_mode == 2) { - for (i = chan->num_coded_vals; i < ctx->num_quant_units; i++) - chan->qu_wordlen[i] = ch_num ? get_bits1(gb) : 1; - } else if (chan->fill_mode == 3) { - pos = ch_num ? chan->num_coded_vals + chan->split_point - : ctx->num_quant_units - chan->split_point; - for (i = chan->num_coded_vals; i < pos; i++) - chan->qu_wordlen[i] = 1; - } - - if (weight_idx) - return add_wordlen_weights(ctx, chan, weight_idx, avctx); - - return 0; -} - -/** - * Decode scale factor indexes for each quant unit of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_channel_sf_idx(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, AVCodecContext *avctx) -{ - int i, weight_idx = 0, delta, diff, num_long_vals, - delta_bits, min_val, vlc_sel, start_val; - VLC *vlc_tab; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* coded using constant number of bits */ - for (i = 0; i < ctx->used_quant_units; i++) - chan->qu_sf_idx[i] = get_bits(gb, 6); - break; - case 1: - if (ch_num) { - vlc_tab = &sf_vlc_tabs[get_bits(gb, 2)]; - - for (i = 0; i < ctx->used_quant_units; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_sf_idx[i] = (ref_chan->qu_sf_idx[i] + delta) & 0x3F; - } - } else { - weight_idx = get_bits(gb, 2); - if (weight_idx == 3) { - UNPACK_SF_VQ_SHAPE(gb, chan->qu_sf_idx, ctx->used_quant_units); - - num_long_vals = get_bits(gb, 5); - delta_bits = get_bits(gb, 2); - min_val = get_bits(gb, 4) - 7; - - for (i = 0; i < num_long_vals; i++) - chan->qu_sf_idx[i] = (chan->qu_sf_idx[i] + - get_bits(gb, 4) - 7) & 0x3F; - - /* all others are: min_val + delta */ - for (i = num_long_vals; i < ctx->used_quant_units; i++) - chan->qu_sf_idx[i] = (chan->qu_sf_idx[i] + min_val + - GET_DELTA(gb, delta_bits)) & 0x3F; - } else { - num_long_vals = get_bits(gb, 5); - delta_bits = get_bits(gb, 3); - min_val = get_bits(gb, 6); - if (num_long_vals > ctx->used_quant_units || delta_bits == 7) { - av_log(avctx, AV_LOG_ERROR, - "SF mode 1: invalid parameters!\n"); - return AVERROR_INVALIDDATA; - } - - /* read full-precision SF indexes */ - for (i = 0; i < num_long_vals; i++) - chan->qu_sf_idx[i] = get_bits(gb, 6); - - /* all others are: min_val + delta */ - for (i = num_long_vals; i < ctx->used_quant_units; i++) - chan->qu_sf_idx[i] = (min_val + - GET_DELTA(gb, delta_bits)) & 0x3F; - } - } - break; - case 2: - if (ch_num) { - vlc_tab = &sf_vlc_tabs[get_bits(gb, 2)]; - - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_sf_idx[0] = (ref_chan->qu_sf_idx[0] + delta) & 0x3F; - - for (i = 1; i < ctx->used_quant_units; i++) { - diff = ref_chan->qu_sf_idx[i] - ref_chan->qu_sf_idx[i - 1]; - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_sf_idx[i] = (chan->qu_sf_idx[i - 1] + diff + delta) & 0x3F; - } - } else { - vlc_tab = &sf_vlc_tabs[get_bits(gb, 2) + 4]; - - UNPACK_SF_VQ_SHAPE(gb, chan->qu_sf_idx, ctx->used_quant_units); - - for (i = 0; i < ctx->used_quant_units; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_sf_idx[i] = (chan->qu_sf_idx[i] + - sign_extend(delta, 4)) & 0x3F; - } - } - break; - case 3: - if (ch_num) { - /* copy coefficients from reference channel */ - for (i = 0; i < ctx->used_quant_units; i++) - chan->qu_sf_idx[i] = ref_chan->qu_sf_idx[i]; - } else { - weight_idx = get_bits(gb, 2); - vlc_sel = get_bits(gb, 2); - vlc_tab = &sf_vlc_tabs[vlc_sel]; - - if (weight_idx == 3) { - vlc_tab = &sf_vlc_tabs[vlc_sel + 4]; - - UNPACK_SF_VQ_SHAPE(gb, chan->qu_sf_idx, ctx->used_quant_units); - - diff = (get_bits(gb, 4) + 56) & 0x3F; - chan->qu_sf_idx[0] = (chan->qu_sf_idx[0] + diff) & 0x3F; - - for (i = 1; i < ctx->used_quant_units; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - diff = (diff + sign_extend(delta, 4)) & 0x3F; - chan->qu_sf_idx[i] = (diff + chan->qu_sf_idx[i]) & 0x3F; - } - } else { - /* 1st coefficient is coded directly */ - chan->qu_sf_idx[0] = get_bits(gb, 6); - - for (i = 1; i < ctx->used_quant_units; i++) { - delta = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - chan->qu_sf_idx[i] = (chan->qu_sf_idx[i - 1] + delta) & 0x3F; - } - } - } - break; - } - - if (weight_idx && weight_idx < 3) - return subtract_sf_weights(ctx, chan, weight_idx, avctx); - - return 0; -} - -/** - * Decode word length information for each channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_quant_wordlen(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ch_num, i, ret; - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - memset(ctx->channels[ch_num].qu_wordlen, 0, - sizeof(ctx->channels[ch_num].qu_wordlen)); - - if ((ret = decode_channel_wordlen(gb, ctx, ch_num, avctx)) < 0) - return ret; - } - - /* scan for last non-zero coeff in both channels and - * set number of quant units having coded spectrum */ - for (i = ctx->num_quant_units - 1; i >= 0; i--) - if (ctx->channels[0].qu_wordlen[i] || - (num_channels == 2 && ctx->channels[1].qu_wordlen[i])) - break; - ctx->used_quant_units = i + 1; - - return 0; -} - -/** - * Decode scale factor indexes for each channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_scale_factors(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ch_num, ret; - - if (!ctx->used_quant_units) - return 0; - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - memset(ctx->channels[ch_num].qu_sf_idx, 0, - sizeof(ctx->channels[ch_num].qu_sf_idx)); - - if ((ret = decode_channel_sf_idx(gb, ctx, ch_num, avctx)) < 0) - return ret; - } - - return 0; -} - -/** - * Decode number of code table values. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int get_num_ct_values(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - AVCodecContext *avctx) -{ - int num_coded_vals; - - if (get_bits1(gb)) { - num_coded_vals = get_bits(gb, 5); - if (num_coded_vals > ctx->used_quant_units) { - av_log(avctx, AV_LOG_ERROR, - "Invalid number of code table indexes: %d!\n", num_coded_vals); - return AVERROR_INVALIDDATA; - } - return num_coded_vals; - } else - return ctx->used_quant_units; -} - -#define DEC_CT_IDX_COMMON(OP) \ - num_vals = get_num_ct_values(gb, ctx, avctx); \ - if (num_vals < 0) \ - return num_vals; \ - \ - for (i = 0; i < num_vals; i++) { \ - if (chan->qu_wordlen[i]) { \ - chan->qu_tab_idx[i] = OP; \ - } else if (ch_num && ref_chan->qu_wordlen[i]) \ - /* get clone master flag */ \ - chan->qu_tab_idx[i] = get_bits1(gb); \ - } - -#define CODING_DIRECT get_bits(gb, num_bits) - -#define CODING_VLC get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1) - -#define CODING_VLC_DELTA \ - (!i) ? CODING_VLC \ - : (pred + get_vlc2(gb, delta_vlc->table, \ - delta_vlc->bits, 1)) & mask; \ - pred = chan->qu_tab_idx[i] - -#define CODING_VLC_DIFF \ - (ref_chan->qu_tab_idx[i] + \ - get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1)) & mask - -/** - * Decode code table indexes for each quant unit of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_channel_code_tab(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, AVCodecContext *avctx) -{ - int i, num_vals, num_bits, pred; - int mask = ctx->use_full_table ? 7 : 3; /* mask for modular arithmetic */ - VLC *vlc_tab, *delta_vlc; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - chan->table_type = get_bits1(gb); - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* directly coded */ - num_bits = ctx->use_full_table + 2; - DEC_CT_IDX_COMMON(CODING_DIRECT); - break; - case 1: /* entropy-coded */ - vlc_tab = ctx->use_full_table ? &ct_vlc_tabs[1] - : ct_vlc_tabs; - DEC_CT_IDX_COMMON(CODING_VLC); - break; - case 2: /* entropy-coded delta */ - if (ctx->use_full_table) { - vlc_tab = &ct_vlc_tabs[1]; - delta_vlc = &ct_vlc_tabs[2]; - } else { - vlc_tab = ct_vlc_tabs; - delta_vlc = ct_vlc_tabs; - } - pred = 0; - DEC_CT_IDX_COMMON(CODING_VLC_DELTA); - break; - case 3: /* entropy-coded difference to master */ - if (ch_num) { - vlc_tab = ctx->use_full_table ? &ct_vlc_tabs[3] - : ct_vlc_tabs; - DEC_CT_IDX_COMMON(CODING_VLC_DIFF); - } - break; - } - - return 0; -} - -/** - * Decode code table indexes for each channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_code_table_indexes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ch_num, ret; - - if (!ctx->used_quant_units) - return 0; - - ctx->use_full_table = get_bits1(gb); - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - memset(ctx->channels[ch_num].qu_tab_idx, 0, - sizeof(ctx->channels[ch_num].qu_tab_idx)); - - if ((ret = decode_channel_code_tab(gb, ctx, ch_num, avctx)) < 0) - return ret; - } - - return 0; -} - -/** - * Decode huffman-coded spectral lines for a given quant unit. - * - * This is a generalized version for all known coding modes. - * Its speed can be improved by creating separate functions for each mode. - * - * @param[in] gb the GetBit context - * @param[in] tab code table telling how to decode spectral lines - * @param[in] vlc_tab ptr to the huffman table associated with the code table - * @param[out] out pointer to buffer where decoded data should be stored - * @param[in] num_specs number of spectral lines to decode - */ -static void decode_qu_spectra(GetBitContext *gb, const Atrac3pSpecCodeTab *tab, - VLC *vlc_tab, int16_t *out, const int num_specs) -{ - int i, j, pos, cf; - int group_size = tab->group_size; - int num_coeffs = tab->num_coeffs; - int bits = tab->bits; - int is_signed = tab->is_signed; - unsigned val, mask = (1 << bits) - 1; - - for (pos = 0; pos < num_specs;) { - if (group_size == 1 || get_bits1(gb)) { - for (j = 0; j < group_size; j++) { - val = get_vlc2(gb, vlc_tab->table, vlc_tab->bits, 1); - - for (i = 0; i < num_coeffs; i++) { - cf = val & mask; - if (is_signed) - cf = sign_extend(cf, bits); - else if (cf && get_bits1(gb)) - cf = -cf; - - out[pos++] = cf; - val >>= bits; - } - } - } else /* group skipped */ - pos += group_size * num_coeffs; - } -} - -/** - * Decode huffman-coded IMDCT spectrum for all channels. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - */ -static void decode_spectrum(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int i, ch_num, qu, wordlen, codetab, tab_index, num_specs; - const Atrac3pSpecCodeTab *tab; - Atrac3pChanParams *chan; - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - chan = &ctx->channels[ch_num]; - - memset(chan->spectrum, 0, sizeof(chan->spectrum)); - - /* set power compensation level to disabled */ - memset(chan->power_levs, ATRAC3P_POWER_COMP_OFF, sizeof(chan->power_levs)); - - for (qu = 0; qu < ctx->used_quant_units; qu++) { - num_specs = ff_atrac3p_qu_to_spec_pos[qu + 1] - - ff_atrac3p_qu_to_spec_pos[qu]; - - wordlen = chan->qu_wordlen[qu]; - codetab = chan->qu_tab_idx[qu]; - if (wordlen) { - if (!ctx->use_full_table) - codetab = atrac3p_ct_restricted_to_full[chan->table_type][wordlen - 1][codetab]; - - tab_index = (chan->table_type * 8 + codetab) * 7 + wordlen - 1; - tab = &atrac3p_spectra_tabs[tab_index]; - - /* this allows reusing VLC tables */ - if (tab->redirect >= 0) - tab_index = tab->redirect; - - decode_qu_spectra(gb, tab, &spec_vlc_tabs[tab_index], - &chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]], - num_specs); - } else if (ch_num && ctx->channels[0].qu_wordlen[qu] && !codetab) { - /* copy coefficients from master */ - memcpy(&chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]], - &ctx->channels[0].spectrum[ff_atrac3p_qu_to_spec_pos[qu]], - num_specs * - sizeof(chan->spectrum[ff_atrac3p_qu_to_spec_pos[qu]])); - chan->qu_wordlen[qu] = ctx->channels[0].qu_wordlen[qu]; - } - } - - /* Power compensation levels only present in the bitstream - * if there are more than 2 quant units. The lowest two units - * correspond to the frequencies 0...351 Hz, whose shouldn't - * be affected by the power compensation. */ - if (ctx->used_quant_units > 2) { - num_specs = atrac3p_subband_to_num_powgrps[ctx->num_coded_subbands - 1]; - for (i = 0; i < num_specs; i++) - chan->power_levs[i] = get_bits(gb, 4); - } - } -} - -/** - * Retrieve specified amount of flag bits from the input bitstream. - * The data can be shortened in the case of the following two common conditions: - * if all bits are zero then only one signal bit = 0 will be stored, - * if all bits are ones then two signal bits = 1,0 will be stored. - * Otherwise, all necessary bits will be directly stored - * prefixed by two signal bits = 1,1. - * - * @param[in] gb ptr to the GetBitContext - * @param[out] out where to place decoded flags - * @param[in] num_flags number of flags to process - * @return: 0 = all flag bits are zero, 1 = there is at least one non-zero flag bit - */ -static int get_subband_flags(GetBitContext *gb, uint8_t *out, int num_flags) -{ - int i, result; - - memset(out, 0, num_flags); - - result = get_bits1(gb); - if (result) { - if (get_bits1(gb)) - for (i = 0; i < num_flags; i++) - out[i] = get_bits1(gb); - else - memset(out, 1, num_flags); - } - - return result; -} - -/** - * Decode mdct window shape flags for all channels. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - */ -static void decode_window_shape(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels) -{ - int ch_num; - - for (ch_num = 0; ch_num < num_channels; ch_num++) - get_subband_flags(gb, ctx->channels[ch_num].wnd_shape, - ctx->num_subbands); -} - -/** - * Decode number of gain control points. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] coded_subbands number of subbands to process - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_gainc_npoints(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int coded_subbands) -{ - int i, delta, delta_bits, min_val; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* fixed-length coding */ - for (i = 0; i < coded_subbands; i++) - chan->gain_data[i].num_points = get_bits(gb, 3); - break; - case 1: /* variable-length coding */ - for (i = 0; i < coded_subbands; i++) - chan->gain_data[i].num_points = - get_vlc2(gb, gain_vlc_tabs[0].table, - gain_vlc_tabs[0].bits, 1); - break; - case 2: - if (ch_num) { /* VLC modulo delta to master channel */ - for (i = 0; i < coded_subbands; i++) { - delta = get_vlc2(gb, gain_vlc_tabs[1].table, - gain_vlc_tabs[1].bits, 1); - chan->gain_data[i].num_points = - (ref_chan->gain_data[i].num_points + delta) & 7; - } - } else { /* VLC modulo delta to previous */ - chan->gain_data[0].num_points = - get_vlc2(gb, gain_vlc_tabs[0].table, - gain_vlc_tabs[0].bits, 1); - - for (i = 1; i < coded_subbands; i++) { - delta = get_vlc2(gb, gain_vlc_tabs[1].table, - gain_vlc_tabs[1].bits, 1); - chan->gain_data[i].num_points = - (chan->gain_data[i - 1].num_points + delta) & 7; - } - } - break; - case 3: - if (ch_num) { /* copy data from master channel */ - for (i = 0; i < coded_subbands; i++) - chan->gain_data[i].num_points = - ref_chan->gain_data[i].num_points; - } else { /* shorter delta to min */ - delta_bits = get_bits(gb, 2); - min_val = get_bits(gb, 3); - - for (i = 0; i < coded_subbands; i++) { - chan->gain_data[i].num_points = min_val + GET_DELTA(gb, delta_bits); - if (chan->gain_data[i].num_points > 7) - return AVERROR_INVALIDDATA; - } - } - } - - return 0; -} - -/** - * Implements coding mode 3 (slave) for gain compensation levels. - * - * @param[out] dst ptr to the output array - * @param[in] ref ptr to the reference channel - */ -static inline void gainc_level_mode3s(AtracGainInfo *dst, AtracGainInfo *ref) -{ - int i; - - for (i = 0; i < dst->num_points; i++) - dst->lev_code[i] = (i >= ref->num_points) ? 7 : ref->lev_code[i]; -} - -/** - * Implements coding mode 1 (master) for gain compensation levels. - * - * @param[in] gb the GetBit context - * @param[in] ctx ptr to the channel unit context - * @param[out] dst ptr to the output array - */ -static inline void gainc_level_mode1m(GetBitContext *gb, - Atrac3pChanUnitCtx *ctx, - AtracGainInfo *dst) -{ - int i, delta; - - if (dst->num_points > 0) - dst->lev_code[0] = get_vlc2(gb, gain_vlc_tabs[2].table, - gain_vlc_tabs[2].bits, 1); - - for (i = 1; i < dst->num_points; i++) { - delta = get_vlc2(gb, gain_vlc_tabs[3].table, - gain_vlc_tabs[3].bits, 1); - dst->lev_code[i] = (dst->lev_code[i - 1] + delta) & 0xF; - } -} - -/** - * Decode level code for each gain control point. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] coded_subbands number of subbands to process - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_gainc_levels(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int coded_subbands) -{ - int sb, i, delta, delta_bits, min_val, pred; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* fixed-length coding */ - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) - chan->gain_data[sb].lev_code[i] = get_bits(gb, 4); - break; - case 1: - if (ch_num) { /* VLC modulo delta to master channel */ - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) { - delta = get_vlc2(gb, gain_vlc_tabs[5].table, - gain_vlc_tabs[5].bits, 1); - pred = (i >= ref_chan->gain_data[sb].num_points) - ? 7 : ref_chan->gain_data[sb].lev_code[i]; - chan->gain_data[sb].lev_code[i] = (pred + delta) & 0xF; - } - } else { /* VLC modulo delta to previous */ - for (sb = 0; sb < coded_subbands; sb++) - gainc_level_mode1m(gb, ctx, &chan->gain_data[sb]); - } - break; - case 2: - if (ch_num) { /* VLC modulo delta to previous or clone master */ - for (sb = 0; sb < coded_subbands; sb++) - if (chan->gain_data[sb].num_points > 0) { - if (get_bits1(gb)) - gainc_level_mode1m(gb, ctx, &chan->gain_data[sb]); - else - gainc_level_mode3s(&chan->gain_data[sb], - &ref_chan->gain_data[sb]); - } - } else { /* VLC modulo delta to lev_codes of previous subband */ - if (chan->gain_data[0].num_points > 0) - gainc_level_mode1m(gb, ctx, &chan->gain_data[0]); - - for (sb = 1; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) { - delta = get_vlc2(gb, gain_vlc_tabs[4].table, - gain_vlc_tabs[4].bits, 1); - pred = (i >= chan->gain_data[sb - 1].num_points) - ? 7 : chan->gain_data[sb - 1].lev_code[i]; - chan->gain_data[sb].lev_code[i] = (pred + delta) & 0xF; - } - } - break; - case 3: - if (ch_num) { /* clone master */ - for (sb = 0; sb < coded_subbands; sb++) - gainc_level_mode3s(&chan->gain_data[sb], - &ref_chan->gain_data[sb]); - } else { /* shorter delta to min */ - delta_bits = get_bits(gb, 2); - min_val = get_bits(gb, 4); - - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) { - chan->gain_data[sb].lev_code[i] = min_val + GET_DELTA(gb, delta_bits); - if (chan->gain_data[sb].lev_code[i] > 15) - return AVERROR_INVALIDDATA; - } - } - break; - } - - return 0; -} - -/** - * Implements coding mode 0 for gain compensation locations. - * - * @param[in] gb the GetBit context - * @param[in] ctx ptr to the channel unit context - * @param[out] dst ptr to the output array - * @param[in] pos position of the value to be processed - */ -static inline void gainc_loc_mode0(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - AtracGainInfo *dst, int pos) -{ - int delta_bits; - - if (!pos || dst->loc_code[pos - 1] < 15) - dst->loc_code[pos] = get_bits(gb, 5); - else if (dst->loc_code[pos - 1] >= 30) - dst->loc_code[pos] = 31; - else { - delta_bits = av_log2(30 - dst->loc_code[pos - 1]) + 1; - dst->loc_code[pos] = dst->loc_code[pos - 1] + - get_bits(gb, delta_bits) + 1; - } -} - -/** - * Implements coding mode 1 for gain compensation locations. - * - * @param[in] gb the GetBit context - * @param[in] ctx ptr to the channel unit context - * @param[out] dst ptr to the output array - */ -static inline void gainc_loc_mode1(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - AtracGainInfo *dst) -{ - int i; - VLC *tab; - - if (dst->num_points > 0) { - /* 1st coefficient is stored directly */ - dst->loc_code[0] = get_bits(gb, 5); - - for (i = 1; i < dst->num_points; i++) { - /* switch VLC according to the curve direction - * (ascending/descending) */ - tab = (dst->lev_code[i] <= dst->lev_code[i - 1]) - ? &gain_vlc_tabs[7] - : &gain_vlc_tabs[9]; - dst->loc_code[i] = dst->loc_code[i - 1] + - get_vlc2(gb, tab->table, tab->bits, 1); - } - } -} - -/** - * Decode location code for each gain control point. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] coded_subbands number of subbands to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_gainc_loc_codes(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int coded_subbands, - AVCodecContext *avctx) -{ - int sb, i, delta, delta_bits, min_val, pred, more_than_ref; - AtracGainInfo *dst, *ref; - VLC *tab; - Atrac3pChanParams *chan = &ctx->channels[ch_num]; - Atrac3pChanParams *ref_chan = &ctx->channels[0]; - - switch (get_bits(gb, 2)) { /* switch according to coding mode */ - case 0: /* sequence of numbers in ascending order */ - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) - gainc_loc_mode0(gb, ctx, &chan->gain_data[sb], i); - break; - case 1: - if (ch_num) { - for (sb = 0; sb < coded_subbands; sb++) { - if (chan->gain_data[sb].num_points <= 0) - continue; - dst = &chan->gain_data[sb]; - ref = &ref_chan->gain_data[sb]; - - /* 1st value is vlc-coded modulo delta to master */ - delta = get_vlc2(gb, gain_vlc_tabs[10].table, - gain_vlc_tabs[10].bits, 1); - pred = ref->num_points > 0 ? ref->loc_code[0] : 0; - dst->loc_code[0] = (pred + delta) & 0x1F; - - for (i = 1; i < dst->num_points; i++) { - more_than_ref = i >= ref->num_points; - if (dst->lev_code[i] > dst->lev_code[i - 1]) { - /* ascending curve */ - if (more_than_ref) { - delta = - get_vlc2(gb, gain_vlc_tabs[9].table, - gain_vlc_tabs[9].bits, 1); - dst->loc_code[i] = dst->loc_code[i - 1] + delta; - } else { - if (get_bits1(gb)) - gainc_loc_mode0(gb, ctx, dst, i); // direct coding - else - dst->loc_code[i] = ref->loc_code[i]; // clone master - } - } else { /* descending curve */ - tab = more_than_ref ? &gain_vlc_tabs[7] - : &gain_vlc_tabs[10]; - delta = get_vlc2(gb, tab->table, tab->bits, 1); - if (more_than_ref) - dst->loc_code[i] = dst->loc_code[i - 1] + delta; - else - dst->loc_code[i] = (ref->loc_code[i] + delta) & 0x1F; - } - } - } - } else /* VLC delta to previous */ - for (sb = 0; sb < coded_subbands; sb++) - gainc_loc_mode1(gb, ctx, &chan->gain_data[sb]); - break; - case 2: - if (ch_num) { - for (sb = 0; sb < coded_subbands; sb++) { - if (chan->gain_data[sb].num_points <= 0) - continue; - dst = &chan->gain_data[sb]; - ref = &ref_chan->gain_data[sb]; - if (dst->num_points > ref->num_points || get_bits1(gb)) - gainc_loc_mode1(gb, ctx, dst); - else /* clone master for the whole subband */ - for (i = 0; i < chan->gain_data[sb].num_points; i++) - dst->loc_code[i] = ref->loc_code[i]; - } - } else { - /* data for the first subband is coded directly */ - for (i = 0; i < chan->gain_data[0].num_points; i++) - gainc_loc_mode0(gb, ctx, &chan->gain_data[0], i); - - for (sb = 1; sb < coded_subbands; sb++) { - if (chan->gain_data[sb].num_points <= 0) - continue; - dst = &chan->gain_data[sb]; - - /* 1st value is vlc-coded modulo delta to the corresponding - * value of the previous subband if any or zero */ - delta = get_vlc2(gb, gain_vlc_tabs[6].table, - gain_vlc_tabs[6].bits, 1); - pred = dst[-1].num_points > 0 - ? dst[-1].loc_code[0] : 0; - dst->loc_code[0] = (pred + delta) & 0x1F; - - for (i = 1; i < dst->num_points; i++) { - more_than_ref = i >= dst[-1].num_points; - /* Select VLC table according to curve direction and - * presence of prediction. */ - tab = &gain_vlc_tabs[(dst->lev_code[i] > dst->lev_code[i - 1]) * - 2 + more_than_ref + 6]; - delta = get_vlc2(gb, tab->table, tab->bits, 1); - if (more_than_ref) - dst->loc_code[i] = dst->loc_code[i - 1] + delta; - else - dst->loc_code[i] = (dst[-1].loc_code[i] + delta) & 0x1F; - } - } - } - break; - case 3: - if (ch_num) { /* clone master or direct or direct coding */ - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) { - if (i >= ref_chan->gain_data[sb].num_points) - gainc_loc_mode0(gb, ctx, &chan->gain_data[sb], i); - else - chan->gain_data[sb].loc_code[i] = - ref_chan->gain_data[sb].loc_code[i]; - } - } else { /* shorter delta to min */ - delta_bits = get_bits(gb, 2) + 1; - min_val = get_bits(gb, 5); - - for (sb = 0; sb < coded_subbands; sb++) - for (i = 0; i < chan->gain_data[sb].num_points; i++) - chan->gain_data[sb].loc_code[i] = min_val + i + - get_bits(gb, delta_bits); - } - break; - } - - /* Validate decoded information */ - for (sb = 0; sb < coded_subbands; sb++) { - dst = &chan->gain_data[sb]; - for (i = 0; i < chan->gain_data[sb].num_points; i++) { - if (dst->loc_code[i] < 0 || dst->loc_code[i] > 31 || - (i && dst->loc_code[i] <= dst->loc_code[i - 1])) { - av_log(avctx, AV_LOG_ERROR, - "Invalid gain location: ch=%d, sb=%d, pos=%d, val=%d\n", - ch_num, sb, i, dst->loc_code[i]); - return AVERROR_INVALIDDATA; - } - } - } - - return 0; -} - -/** - * Decode gain control data for all channels. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_gainc_data(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ch_num, coded_subbands, sb, ret; - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - memset(ctx->channels[ch_num].gain_data, 0, - sizeof(*ctx->channels[ch_num].gain_data) * ATRAC3P_SUBBANDS); - - if (get_bits1(gb)) { /* gain control data present? */ - coded_subbands = get_bits(gb, 4) + 1; - if (get_bits1(gb)) /* is high band gain data replication on? */ - ctx->channels[ch_num].num_gain_subbands = get_bits(gb, 4) + 1; - else - ctx->channels[ch_num].num_gain_subbands = coded_subbands; - - if ((ret = decode_gainc_npoints(gb, ctx, ch_num, coded_subbands)) < 0 || - (ret = decode_gainc_levels(gb, ctx, ch_num, coded_subbands)) < 0 || - (ret = decode_gainc_loc_codes(gb, ctx, ch_num, coded_subbands, avctx)) < 0) - return ret; - - if (coded_subbands > 0) { /* propagate gain data if requested */ - for (sb = coded_subbands; sb < ctx->channels[ch_num].num_gain_subbands; sb++) - ctx->channels[ch_num].gain_data[sb] = - ctx->channels[ch_num].gain_data[sb - 1]; - } - } else { - ctx->channels[ch_num].num_gain_subbands = 0; - } - } - - return 0; -} - -/** - * Decode envelope for all tones of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] band_has_tones ptr to an array of per-band-flags: - * 1 - tone data present - */ -static void decode_tones_envelope(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int band_has_tones[]) -{ - int sb; - Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; - Atrac3pWavesData *ref = ctx->channels[0].tones_info; - - if (!ch_num || !get_bits1(gb)) { /* mode 0: fixed-length coding */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb]) - continue; - dst[sb].pend_env.has_start_point = get_bits1(gb); - dst[sb].pend_env.start_pos = dst[sb].pend_env.has_start_point - ? get_bits(gb, 5) : -1; - dst[sb].pend_env.has_stop_point = get_bits1(gb); - dst[sb].pend_env.stop_pos = dst[sb].pend_env.has_stop_point - ? get_bits(gb, 5) : 32; - } - } else { /* mode 1(slave only): copy master */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb]) - continue; - dst[sb].pend_env.has_start_point = ref[sb].pend_env.has_start_point; - dst[sb].pend_env.has_stop_point = ref[sb].pend_env.has_stop_point; - dst[sb].pend_env.start_pos = ref[sb].pend_env.start_pos; - dst[sb].pend_env.stop_pos = ref[sb].pend_env.stop_pos; - } - } -} - -/** - * Decode number of tones for each subband of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] band_has_tones ptr to an array of per-band-flags: - * 1 - tone data present - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_band_numwavs(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int band_has_tones[], - AVCodecContext *avctx) -{ - int mode, sb, delta; - Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; - Atrac3pWavesData *ref = ctx->channels[0].tones_info; - - mode = get_bits(gb, ch_num + 1); - switch (mode) { - case 0: /** fixed-length coding */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) - if (band_has_tones[sb]) - dst[sb].num_wavs = get_bits(gb, 4); - break; - case 1: /** variable-length coding */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) - if (band_has_tones[sb]) - dst[sb].num_wavs = - get_vlc2(gb, tone_vlc_tabs[1].table, - tone_vlc_tabs[1].bits, 1); - break; - case 2: /** VLC modulo delta to master (slave only) */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) - if (band_has_tones[sb]) { - delta = get_vlc2(gb, tone_vlc_tabs[2].table, - tone_vlc_tabs[2].bits, 1); - delta = sign_extend(delta, 3); - dst[sb].num_wavs = (ref[sb].num_wavs + delta) & 0xF; - } - break; - case 3: /** copy master (slave only) */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) - if (band_has_tones[sb]) - dst[sb].num_wavs = ref[sb].num_wavs; - break; - } - - /** initialize start tone index for each subband */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) - if (band_has_tones[sb]) { - if (ctx->waves_info->tones_index + dst[sb].num_wavs > 48) { - av_log(avctx, AV_LOG_ERROR, - "Too many tones: %d (max. 48), frame: %d!\n", - ctx->waves_info->tones_index + dst[sb].num_wavs, - avctx->frame_number); - return AVERROR_INVALIDDATA; - } - dst[sb].start_index = ctx->waves_info->tones_index; - ctx->waves_info->tones_index += dst[sb].num_wavs; - } - - return 0; -} - -/** - * Decode frequency information for each subband of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] band_has_tones ptr to an array of per-band-flags: - * 1 - tone data present - */ -static void decode_tones_frequency(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int band_has_tones[]) -{ - int sb, i, direction, nbits, pred, delta; - Atrac3pWaveParam *iwav, *owav; - Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; - Atrac3pWavesData *ref = ctx->channels[0].tones_info; - - if (!ch_num || !get_bits1(gb)) { /* mode 0: fixed-length coding */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - iwav = &ctx->waves_info->waves[dst[sb].start_index]; - direction = (dst[sb].num_wavs > 1) ? get_bits1(gb) : 0; - if (direction) { /** packed numbers in descending order */ - if (dst[sb].num_wavs) - iwav[dst[sb].num_wavs - 1].freq_index = get_bits(gb, 10); - for (i = dst[sb].num_wavs - 2; i >= 0 ; i--) { - nbits = av_log2(iwav[i+1].freq_index) + 1; - iwav[i].freq_index = get_bits(gb, nbits); - } - } else { /** packed numbers in ascending order */ - for (i = 0; i < dst[sb].num_wavs; i++) { - if (!i || iwav[i - 1].freq_index < 512) - iwav[i].freq_index = get_bits(gb, 10); - else { - nbits = av_log2(1023 - iwav[i - 1].freq_index) + 1; - iwav[i].freq_index = get_bits(gb, nbits) + - 1024 - (1 << nbits); - } - } - } - } - } else { /* mode 1: VLC modulo delta to master (slave only) */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - iwav = &ctx->waves_info->waves[ref[sb].start_index]; - owav = &ctx->waves_info->waves[dst[sb].start_index]; - for (i = 0; i < dst[sb].num_wavs; i++) { - delta = get_vlc2(gb, tone_vlc_tabs[6].table, - tone_vlc_tabs[6].bits, 1); - delta = sign_extend(delta, 8); - pred = (i < ref[sb].num_wavs) ? iwav[i].freq_index : - (ref[sb].num_wavs ? iwav[ref[sb].num_wavs - 1].freq_index : 0); - owav[i].freq_index = (pred + delta) & 0x3FF; - } - } - } -} - -/** - * Decode amplitude information for each subband of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] band_has_tones ptr to an array of per-band-flags: - * 1 - tone data present - */ -static void decode_tones_amplitude(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int band_has_tones[]) -{ - int mode, sb, j, i, diff, maxdiff, fi, delta, pred; - Atrac3pWaveParam *wsrc, *wref; - int refwaves[48]; - Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; - Atrac3pWavesData *ref = ctx->channels[0].tones_info; - - if (ch_num) { - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - wsrc = &ctx->waves_info->waves[dst[sb].start_index]; - wref = &ctx->waves_info->waves[ref[sb].start_index]; - for (j = 0; j < dst[sb].num_wavs; j++) { - for (i = 0, fi = 0, maxdiff = 1024; i < ref[sb].num_wavs; i++) { - diff = FFABS(wsrc[j].freq_index - wref[i].freq_index); - if (diff < maxdiff) { - maxdiff = diff; - fi = i; - } - } - - if (maxdiff < 8) - refwaves[dst[sb].start_index + j] = fi + ref[sb].start_index; - else if (j < ref[sb].num_wavs) - refwaves[dst[sb].start_index + j] = j + ref[sb].start_index; - else - refwaves[dst[sb].start_index + j] = -1; - } - } - } - - mode = get_bits(gb, ch_num + 1); - - switch (mode) { - case 0: /** fixed-length coding */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - if (ctx->waves_info->amplitude_mode) - for (i = 0; i < dst[sb].num_wavs; i++) - ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = get_bits(gb, 6); - else - ctx->waves_info->waves[dst[sb].start_index].amp_sf = get_bits(gb, 6); - } - break; - case 1: /** min + VLC delta */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - if (ctx->waves_info->amplitude_mode) - for (i = 0; i < dst[sb].num_wavs; i++) - ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = - get_vlc2(gb, tone_vlc_tabs[3].table, - tone_vlc_tabs[3].bits, 1) + 20; - else - ctx->waves_info->waves[dst[sb].start_index].amp_sf = - get_vlc2(gb, tone_vlc_tabs[4].table, - tone_vlc_tabs[4].bits, 1) + 24; - } - break; - case 2: /** VLC modulo delta to master (slave only) */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb] || !dst[sb].num_wavs) - continue; - for (i = 0; i < dst[sb].num_wavs; i++) { - delta = get_vlc2(gb, tone_vlc_tabs[5].table, - tone_vlc_tabs[5].bits, 1); - delta = sign_extend(delta, 5); - pred = refwaves[dst[sb].start_index + i] >= 0 ? - ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf : 34; - ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = (pred + delta) & 0x3F; - } - } - break; - case 3: /** clone master (slave only) */ - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb]) - continue; - for (i = 0; i < dst[sb].num_wavs; i++) - ctx->waves_info->waves[dst[sb].start_index + i].amp_sf = - refwaves[dst[sb].start_index + i] >= 0 - ? ctx->waves_info->waves[refwaves[dst[sb].start_index + i]].amp_sf - : 32; - } - break; - } -} - -/** - * Decode phase information for each subband of a channel. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] ch_num channel to process - * @param[in] band_has_tones ptr to an array of per-band-flags: - * 1 - tone data present - */ -static void decode_tones_phase(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int ch_num, int band_has_tones[]) -{ - int sb, i; - Atrac3pWaveParam *wparam; - Atrac3pWavesData *dst = ctx->channels[ch_num].tones_info; - - for (sb = 0; sb < ctx->waves_info->num_tone_bands; sb++) { - if (!band_has_tones[sb]) - continue; - wparam = &ctx->waves_info->waves[dst[sb].start_index]; - for (i = 0; i < dst[sb].num_wavs; i++) - wparam[i].phase_index = get_bits(gb, 5); - } -} - -/** - * Decode tones info for all channels. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -static int decode_tones_info(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ch_num, i, ret; - int band_has_tones[16]; - - for (ch_num = 0; ch_num < num_channels; ch_num++) - memset(ctx->channels[ch_num].tones_info, 0, - sizeof(*ctx->channels[ch_num].tones_info) * ATRAC3P_SUBBANDS); - - ctx->waves_info->tones_present = get_bits1(gb); - if (!ctx->waves_info->tones_present) - return 0; - - memset(ctx->waves_info->waves, 0, sizeof(ctx->waves_info->waves)); - - ctx->waves_info->amplitude_mode = get_bits1(gb); - if (!ctx->waves_info->amplitude_mode) { - avpriv_report_missing_feature(avctx, "GHA amplitude mode 0"); - return AVERROR_PATCHWELCOME; - } - - ctx->waves_info->num_tone_bands = - get_vlc2(gb, tone_vlc_tabs[0].table, - tone_vlc_tabs[0].bits, 1) + 1; - - if (num_channels == 2) { - get_subband_flags(gb, ctx->waves_info->tone_sharing, ctx->waves_info->num_tone_bands); - get_subband_flags(gb, ctx->waves_info->tone_master, ctx->waves_info->num_tone_bands); - if (get_subband_flags(gb, ctx->waves_info->phase_shift, - ctx->waves_info->num_tone_bands)) { - avpriv_report_missing_feature(avctx, "GHA Phase shifting"); - return AVERROR_PATCHWELCOME; - } - } - - ctx->waves_info->tones_index = 0; - - for (ch_num = 0; ch_num < num_channels; ch_num++) { - for (i = 0; i < ctx->waves_info->num_tone_bands; i++) - band_has_tones[i] = !ch_num ? 1 : !ctx->waves_info->tone_sharing[i]; - - decode_tones_envelope(gb, ctx, ch_num, band_has_tones); - if ((ret = decode_band_numwavs(gb, ctx, ch_num, band_has_tones, - avctx)) < 0) - return ret; - - decode_tones_frequency(gb, ctx, ch_num, band_has_tones); - decode_tones_amplitude(gb, ctx, ch_num, band_has_tones); - decode_tones_phase(gb, ctx, ch_num, band_has_tones); - } - - if (num_channels == 2) { - for (i = 0; i < ctx->waves_info->num_tone_bands; i++) { - if (ctx->waves_info->tone_sharing[i]) - ctx->channels[1].tones_info[i] = ctx->channels[0].tones_info[i]; - - if (ctx->waves_info->tone_master[i]) - FFSWAP(Atrac3pWavesData, ctx->channels[0].tones_info[i], - ctx->channels[1].tones_info[i]); - } - } - - return 0; -} - -int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx) -{ - int ret; - - /* parse sound header */ - ctx->num_quant_units = get_bits(gb, 5) + 1; - if (ctx->num_quant_units > 28 && ctx->num_quant_units < 32) { - av_log(avctx, AV_LOG_ERROR, - "Invalid number of quantization units: %d!\n", - ctx->num_quant_units); - return AVERROR_INVALIDDATA; - } - - ctx->mute_flag = get_bits1(gb); - - /* decode various sound parameters */ - if ((ret = decode_quant_wordlen(gb, ctx, num_channels, avctx)) < 0) - return ret; - - ctx->num_subbands = atrac3p_qu_to_subband[ctx->num_quant_units - 1] + 1; - ctx->num_coded_subbands = ctx->used_quant_units - ? atrac3p_qu_to_subband[ctx->used_quant_units - 1] + 1 - : 0; - - if ((ret = decode_scale_factors(gb, ctx, num_channels, avctx)) < 0) - return ret; - - if ((ret = decode_code_table_indexes(gb, ctx, num_channels, avctx)) < 0) - return ret; - - decode_spectrum(gb, ctx, num_channels, avctx); - - if (num_channels == 2) { - get_subband_flags(gb, ctx->swap_channels, ctx->num_coded_subbands); - get_subband_flags(gb, ctx->negate_coeffs, ctx->num_coded_subbands); - } - - decode_window_shape(gb, ctx, num_channels); - - if ((ret = decode_gainc_data(gb, ctx, num_channels, avctx)) < 0) - return ret; - - if ((ret = decode_tones_info(gb, ctx, num_channels, avctx)) < 0) - return ret; - - /* decode global noise info */ - ctx->noise_present = get_bits1(gb); - if (ctx->noise_present) { - ctx->noise_level_index = get_bits(gb, 4); - ctx->noise_table_index = get_bits(gb, 4); - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.h deleted file mode 100644 index 1b001fae6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus.h +++ /dev/null @@ -1,240 +0,0 @@ -/* - * ATRAC3+ compatible decoder - * - * Copyright (c) 2010-2013 Maxim Poliakovski - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Global structures, constants and data for ATRAC3+ decoder. - */ - -#ifndef AVCODEC_ATRAC3PLUS_H -#define AVCODEC_ATRAC3PLUS_H - -#include - -#include "libavutil/float_dsp.h" -#include "atrac.h" -#include "avcodec.h" -#include "fft.h" -#include "get_bits.h" - -/** Global unit sizes */ -#define ATRAC3P_SUBBANDS 16 ///< number of PQF subbands -#define ATRAC3P_SUBBAND_SAMPLES 128 ///< number of samples per subband -#define ATRAC3P_FRAME_SAMPLES (ATRAC3P_SUBBAND_SAMPLES * ATRAC3P_SUBBANDS) - -#define ATRAC3P_PQF_FIR_LEN 12 ///< length of the prototype FIR of the PQF - -/** Global constants */ -#define ATRAC3P_POWER_COMP_OFF 15 ///< disable power compensation - -/** ATRAC3+ channel unit types */ -enum Atrac3pChannelUnitTypes { - CH_UNIT_MONO = 0, ///< unit containing one coded channel - CH_UNIT_STEREO = 1, ///< unit containing two jointly-coded channels - CH_UNIT_EXTENSION = 2, ///< unit containing extension information - CH_UNIT_TERMINATOR = 3 ///< unit sequence terminator -}; - -/** Per-channel IPQF history */ -typedef struct Atrac3pIPQFChannelCtx { - DECLARE_ALIGNED(32, float, buf1)[ATRAC3P_PQF_FIR_LEN * 2][8]; - DECLARE_ALIGNED(32, float, buf2)[ATRAC3P_PQF_FIR_LEN * 2][8]; - int pos; -} Atrac3pIPQFChannelCtx; - -/** Amplitude envelope of a group of sine waves */ -typedef struct Atrac3pWaveEnvelope { - int has_start_point; ///< indicates start point within the GHA window - int has_stop_point; ///< indicates stop point within the GHA window - int start_pos; ///< start position expressed in n*4 samples - int stop_pos; ///< stop position expressed in n*4 samples -} Atrac3pWaveEnvelope; - -/** Parameters of a group of sine waves */ -typedef struct Atrac3pWavesData { - Atrac3pWaveEnvelope pend_env; ///< pending envelope from the previous frame - Atrac3pWaveEnvelope curr_env; ///< group envelope from the current frame - int num_wavs; ///< number of sine waves in the group - int start_index; ///< start index into global tones table for that subband -} Atrac3pWavesData; - -/** Parameters of a single sine wave */ -typedef struct Atrac3pWaveParam { - int freq_index; ///< wave frequency index - int amp_sf; ///< quantized amplitude scale factor - int amp_index; ///< quantized amplitude index - int phase_index; ///< quantized phase index -} Atrac3pWaveParam; - -/** Sound channel parameters */ -typedef struct Atrac3pChanParams { - int ch_num; - int num_coded_vals; ///< number of transmitted quant unit values - int fill_mode; - int split_point; - int table_type; ///< table type: 0 - tone?, 1- noise? - int qu_wordlen[32]; ///< array of word lengths for each quant unit - int qu_sf_idx[32]; ///< array of scale factor indexes for each quant unit - int qu_tab_idx[32]; ///< array of code table indexes for each quant unit - int16_t spectrum[2048]; ///< decoded IMDCT spectrum - uint8_t power_levs[5]; ///< power compensation levels - - /* imdct window shape history (2 frames) for overlapping. */ - uint8_t wnd_shape_hist[2][ATRAC3P_SUBBANDS]; ///< IMDCT window shape, 0=sine/1=steep - uint8_t *wnd_shape; ///< IMDCT window shape for current frame - uint8_t *wnd_shape_prev; ///< IMDCT window shape for previous frame - - /* gain control data history (2 frames) for overlapping. */ - AtracGainInfo gain_data_hist[2][ATRAC3P_SUBBANDS]; ///< gain control data for all subbands - AtracGainInfo *gain_data; ///< gain control data for next frame - AtracGainInfo *gain_data_prev; ///< gain control data for previous frame - int num_gain_subbands; ///< number of subbands with gain control data - - /* tones data history (2 frames) for overlapping. */ - Atrac3pWavesData tones_info_hist[2][ATRAC3P_SUBBANDS]; - Atrac3pWavesData *tones_info; - Atrac3pWavesData *tones_info_prev; -} Atrac3pChanParams; - -/* Per-unit sine wave parameters */ -typedef struct Atrac3pWaveSynthParams { - int tones_present; ///< 1 - tones info present - int amplitude_mode; ///< 1 - low range, 0 - high range - int num_tone_bands; ///< number of PQF bands with tones - uint8_t tone_sharing[ATRAC3P_SUBBANDS]; ///< 1 - subband-wise tone sharing flags - uint8_t tone_master[ATRAC3P_SUBBANDS]; ///< 1 - subband-wise tone channel swapping - uint8_t phase_shift[ATRAC3P_SUBBANDS]; ///< 1 - subband-wise 180° phase shifting - int tones_index; ///< total sum of tones in this unit - Atrac3pWaveParam waves[48]; -} Atrac3pWaveSynthParams; - -/** Channel unit parameters */ -typedef struct Atrac3pChanUnitCtx { - /* channel unit variables */ - int unit_type; ///< unit type (mono/stereo) - int num_quant_units; - int num_subbands; - int used_quant_units; ///< number of quant units with coded spectrum - int num_coded_subbands; ///< number of subbands with coded spectrum - int mute_flag; ///< mute flag - int use_full_table; ///< 1 - full table list, 0 - restricted one - int noise_present; ///< 1 - global noise info present - int noise_level_index; ///< global noise level index - int noise_table_index; ///< global noise RNG table index - uint8_t swap_channels[ATRAC3P_SUBBANDS]; ///< 1 - perform subband-wise channel swapping - uint8_t negate_coeffs[ATRAC3P_SUBBANDS]; ///< 1 - subband-wise IMDCT coefficients negation - Atrac3pChanParams channels[2]; - - /* Variables related to GHA tones */ - Atrac3pWaveSynthParams wave_synth_hist[2]; ///< waves synth history for two frames - Atrac3pWaveSynthParams *waves_info; - Atrac3pWaveSynthParams *waves_info_prev; - - Atrac3pIPQFChannelCtx ipqf_ctx[2]; - DECLARE_ALIGNED(32, float, prev_buf)[2][ATRAC3P_FRAME_SAMPLES]; ///< overlapping buffer -} Atrac3pChanUnitCtx; - -/** - * Initialize VLC tables for bitstream parsing. - */ -void ff_atrac3p_init_vlcs(void); - -/** - * Decode bitstream data of a channel unit. - * - * @param[in] gb the GetBit context - * @param[in,out] ctx ptr to the channel unit context - * @param[in] num_channels number of channels to process - * @param[in] avctx ptr to the AVCodecContext - * @return result code: 0 = OK, otherwise - error code - */ -int ff_atrac3p_decode_channel_unit(GetBitContext *gb, Atrac3pChanUnitCtx *ctx, - int num_channels, AVCodecContext *avctx); - -/** - * Initialize IMDCT transform. - * - * @param[in] avctx ptr to the AVCodecContext - * @param[in] mdct_ctx pointer to MDCT transform context - */ -void ff_atrac3p_init_imdct(AVCodecContext *avctx, FFTContext *mdct_ctx); - -/** - * Initialize sine waves synthesizer. - */ -void ff_atrac3p_init_wave_synth(void); - -/** - * Synthesize sine waves for a particular subband. - * - * @param[in] ch_unit pointer to the channel unit context - * @param[in] fdsp pointer to float DSP context - * @param[in] ch_num which channel to process - * @param[in] sb which subband to process - * @param[out] out receives processed data - */ -void ff_atrac3p_generate_tones(Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, - int ch_num, int sb, float *out); - -/** - * Perform power compensation aka noise dithering. - * - * @param[in] ctx ptr to the channel context - * @param[in] ch_index which channel to process - * @param[in,out] sp ptr to channel spectrum to process - * @param[in] rng_index indicates which RNG table to use - * @param[in] sb_num which subband to process - */ -void ff_atrac3p_power_compensation(Atrac3pChanUnitCtx *ctx, int ch_index, - float *sp, int rng_index, int sb_num); - -/** - * Regular IMDCT and windowing without overlapping, - * with spectrum reversal in the odd subbands. - * - * @param[in] fdsp pointer to float DSP context - * @param[in] mdct_ctx pointer to MDCT transform context - * @param[in] pIn float input - * @param[out] pOut float output - * @param[in] wind_id which MDCT window to apply - * @param[in] sb subband number - */ -void ff_atrac3p_imdct(AVFloatDSPContext *fdsp, FFTContext *mdct_ctx, float *pIn, - float *pOut, int wind_id, int sb); - -/** - * Subband synthesis filter based on the polyphase quadrature (pseudo-QMF) - * filter bank. - * - * @param[in] dct_ctx ptr to the pre-initialized IDCT context - * @param[in,out] hist ptr to the filter history - * @param[in] in input data to process - * @param[out] out receives processed data - */ -void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist, - const float *in, float *out); - -extern const uint16_t ff_atrac3p_qu_to_spec_pos[33]; -extern const float ff_atrac3p_sf_tab[64]; -extern const float ff_atrac3p_mant_tab[8]; - -#endif /* AVCODEC_ATRAC3PLUS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus_data.h deleted file mode 100644 index 2a107eef1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plus_data.h +++ /dev/null @@ -1,1914 +0,0 @@ -/* - * ATRAC3+ compatible decoder - * - * Copyright (c) 2010-2013 Maxim Poliakovski - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ATRAC3PLUS_DATA_H -#define AVCODEC_ATRAC3PLUS_DATA_H - -#include -#include - -/** VLC tables for wordlen */ -static const uint8_t atrac3p_wl_huff_code1[3] = { 0, 2, 3 }; - -static const uint8_t atrac3p_wl_huff_bits1[3] = { 1, 2, 2 }; - -static const uint8_t atrac3p_wl_huff_xlat1[3] = { 0, 1, 7 }; - -static const uint8_t atrac3p_wl_huff_code2[5] = { 0, 4, 5, 6, 7 }; - -static const uint8_t atrac3p_wl_huff_bits2[5] = { 1, 3, 3, 3, 3 }; - -static const uint8_t atrac3p_wl_huff_xlat2[5] = { 0, 1, 2, 6, 7 }; - -static const uint8_t atrac3p_wl_huff_code3[8] = { - 0, 4, 0xC, 0x1E, 0x1F, 0xD, 0xE, 5 -}; - -static const uint8_t atrac3p_wl_huff_bits3[8] = { 1, 3, 4, 5, 5, 4, 4, 3 }; - -static const uint8_t atrac3p_wl_huff_code4[8] = { - 0, 4, 0xC, 0xD, 0x1E, 0x1F, 0xE, 5 -}; - -static const uint8_t atrac3p_wl_huff_bits4[8] = { 1, 3, 4, 4, 5, 5, 4, 3 }; - -/** VLC tables for scale factor indexes */ -static const uint16_t atrac3p_sf_huff_code1[64] = { - 0, 2, 3, 4, 5, 0xC, 0xD, 0xE0, - 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0x1CE, 0x1CF, - 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5, 0x1D6, 0x1D7, - 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC, 0x1DD, 0x1DE, 0x1DF, - 0x1E0, 0x1E1, 0x1E2, 0x1E3, 0x1E4, 0x1E5, 0x1E6, 0x1E7, - 0x1E8, 0x1E9, 0x1EA, 0x1EB, 0x1EC, 0x1ED, 0x1EE, 0x1EF, - 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, 0x1F5, 0x1F6, 0x1F7, - 0x1F8, 0x1F9, 0x1FA, 0x1FB, 0x1FC, 0x1FD, 0x1FE, 0x1FF -}; - -static const uint8_t atrac3p_sf_huff_bits1[64] = { - 2, 3, 3, 3, 3, 4, 4, 8, 8, 8, 8, 8, 8, 8, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9 -}; - -static const uint8_t atrac3p_sf_huff_xlat1[64] = { - 0, 1, 61, 62, 63, 2, 60, 3, 4, 5, 6, 57, 58, 59, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 -}; - -static const uint8_t atrac3p_sf_huff_xlat2[64] = { - 0, 1, 2, 62, 63, 3, 61, 4, 5, 6, 57, 58, 59, 60, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56 -}; - -static const uint16_t atrac3p_sf_huff_code2[64] = { - 0, 4, 0x18, 0x19, 0x70, 0x1CA, 0x1CB, 0x1CC, - 0x1CD, 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, - 0x1D5, 0x1D6, 0x1D7, 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC, - 0x1DD, 0x1DE, 0x1DF, 0x1E0, 0x1E1, 0x1E2, 0x1E3, 0x1E4, - 0x1E5, 0x1E6, 0x1E7, 0x1E8, 0x1E9, 0x1EA, 0x1EB, 0x1EC, - 0x1ED, 0x1EE, 0x1EF, 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, - 0x1F5, 0x1F6, 0x1F7, 0x1F8, 0x1F9, 0x1FA, 0x1FB, 0x1FC, - 0x1FD, 0x1FE, 0x1FF, 0xE4, 0x71, 0x1A, 0x1B, 5 -}; - -static const uint8_t atrac3p_sf_huff_bits2[64] = { - 1, 3, 5, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 7, 5, 5, 3 -}; - -static const uint16_t atrac3p_sf_huff_code3[64] = { - 0, 2, 3, 0x18, 0x19, 0x70, 0x1CC, 0x1CD, - 0x1CE, 0x1CF, 0x1D0, 0x1D1, 0x1D2, 0x1D3, 0x1D4, 0x1D5, - 0x1D6, 0x1D7, 0x1D8, 0x1D9, 0x1DA, 0x1DB, 0x1DC, 0x1DD, - 0x1DE, 0x1DF, 0x1E0, 0x1E1, 0x1E2, 0x1E3, 0x1E4, 0x1E5, - 0x1E6, 0x1E7, 0x1E8, 0x1E9, 0x1EA, 0x1EB, 0x1EC, 0x1ED, - 0x1EE, 0x1EF, 0x1F0, 0x1F1, 0x1F2, 0x1F3, 0x1F4, 0x1F5, - 0x1F6, 0x1F7, 0x1F8, 0x1F9, 0x1FA, 0x1FB, 0x1FC, 0x1FD, - 0x1FE, 0x1FF, 0x71, 0x72, 0x1A, 0x1B, 4, 5 -}; - -static const uint8_t atrac3p_sf_huff_bits3[64] = { - 2, 3, 3, 5, 5, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 7, 7, 5, 5, 3, 3 -}; - -static const uint16_t atrac3p_sf_huff_code4[16] = { - 0, 2, 3, 4, 5, 0xC, 0xD, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0, 0x3D, 0x3E, 0x3F -}; - -static const uint8_t atrac3p_sf_huff_bits4[16] = { - 2, 3, 3, 3, 3, 4, 4, 6, 6, 6, 6, 6, 0, 6, 6, 6 -}; - -static const uint8_t atrac3p_sf_huff_xlat4[16] = { - 0, 1, 13, 14, 15, 2, 12, 3, 4, 5, 6, 7, 8, 9, 10, 11 -}; - -static const uint8_t atrac3p_sf_huff_xlat5[16] = { - 0, 1, 2, 14, 15, 3, 13, 4, 5, 6, 7, 9, 8, 10, 11, 12 -}; - -static const uint16_t atrac3p_sf_huff_code5[16] = { - 0, 4, 0xC, 0x1C, 0x78, 0x79, 0x7A, 0x7B, - 0, 0x7C, 0x7D, 0x7E, 0x7F, 0x1D, 0xD, 5 -}; - -static const uint8_t atrac3p_sf_huff_bits5[16] = { - 1, 3, 4, 5, 7, 7, 7, 7, 0, 7, 7, 7, 7, 5, 4, 3 -}; - -static const uint16_t atrac3p_sf_huff_code6[16] = { - 0, 2, 3, 0xC, 0x1C, 0x3C, 0x7C, 0x7D, 0, 0x7E, 0x7F, 0x3D, 0x1D, 0xD, 4, 5 -}; - -static const uint8_t atrac3p_sf_huff_bits6[16] = { - 2, 3, 3, 4, 5, 6, 7, 7, 0, 7, 7, 6, 5, 4, 3, 3 -}; - -/** VLC tables for code table indexes */ -static const uint8_t atrac3p_ct_huff_code1[4] = { 0, 2, 6, 7 }; - -static const uint8_t atrac3p_ct_huff_bits1[4] = { 1, 2, 3, 3 }; - -static const uint8_t atrac3p_ct_huff_code2[8] = { 0, 2, 3, 4, 5, 6, 0xE, 0xF }; - -static const uint8_t atrac3p_ct_huff_bits2[8] = { 2, 3, 3, 3, 3, 3, 4, 4 }; - -static const uint8_t atrac3p_ct_huff_xlat1[8] = { 0, 1, 2, 3, 6, 7, 4, 5 }; - -static const uint8_t atrac3p_ct_huff_code3[8] = { - 0, 4, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF -}; - -static const uint8_t atrac3p_ct_huff_bits3[8] = { 1, 3, 4, 4, 4, 4, 4, 4 }; - -/* weights for quantized word lengths */ -static const int8_t atrac3p_wl_weights[6][32] = { - { 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 2, 2, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }, - { 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 5, 5, 5, 4, 4, 4, 3, 3, 3, 2, 2, 2, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 6, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 3, 2, 2, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -/* weights for quantized scale factors - * sf_weights[i] = i / (tab_idx + 1) - * where tab_idx = [1,2] */ -static const int8_t atrac3p_sf_weights[2][32] = { - { 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, - 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15 }, - { 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, - 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10, 10 } -}; - -/** Ungroup table for word length segments. - * Numbers in this table tell which coeff belongs to which segment. */ -static const uint8_t atrac3p_qu_num_to_seg[32] = { - 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, - 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, 9, 9 -}; - -/** Map quant unit number to subband number */ -static const uint8_t atrac3p_qu_to_subband[32] = { - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, - 3, 3, 4, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 -}; - -/** Map subband number to number of power compensation groups */ -static const int atrac3p_subband_to_num_powgrps[16] = { - 1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5 -}; - -/** 3D base shape tables. The values are grouped together as follows: - * [num_start_values = 8][num_shape_tables = 16][num_seg_coeffs = 9] - * For each of the 8 start values there are 16 different shapes each - * 9 coefficients long. */ -static const int8_t atrac3p_wl_shapes[8][16][9] = { - { { 0, 0, 0, 0, 0, 0, 0, -2, -1 }, - { 0, 0, 0, 0, 0, 0, 0, -5, -1 }, - { 0, 0, 0, -7, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, -7, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, -5, 0, 0 }, - { 0, 0, 0, 0, -5, 0, 0, 0, 0 }, - { -7, -7, 0, 0, 0, 0, 0, 0, 0 }, - { 0, -7, 0, 0, 0, 0, 0, 0, 0 }, - { -2, -2, -5, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, -2, -5, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, -2, -5, 0, 0 }, - { 0, 0, 0, -5, 0, 0, 0, 0, 0 }, - { 0, -2, -7, -2, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, -2, -5, 0, 0, 0 }, - { 0, 0, 0, -5, -5, 0, 0, 0, 0 }, - { 0, 0, 0, -5, -2, 0, 0, 0, 0 } }, - { { -1, -5, -3, -2, -1, -1, 0, 0, 0 }, - { -2, -5, -3, -3, -2, -1, -1, 0, 0 }, - { 0, -1, -1, -1, 0, 0, 0, 0, 0 }, - { -1, -3, 0, 0, 0, 0, 0, 0, 0 }, - { -1, -2, 0, 0, 0, 0, 0, 0, 0 }, - { -1, -3, -1, 0, 0, 0, 0, 1, 1 }, - { -1, -5, -3, -3, -2, -1, 0, 0, 0 }, - { -1, -1, -4, -2, -2, -1, -1, 0, 0 }, - { -1, -1, -3, -2, -3, -1, -1, -1, 0 }, - { -1, -4, -2, -3, -1, 0, 0, 0, 0 }, - { 0, -1, -2, -2, -1, -1, 0, 0, 0 }, - { 0, -2, -1, 0, 0, 0, 0, 0, 0 }, - { -1, -1, 0, 0, 0, 0, 0, 0, 0 }, - { -1, -1, -3, -2, -2, -1, -1, -1, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, -1, -3, -2, -2, -1, -1, -1, 0 }, }, - { { -1, -2, 0, 1, 1, 1, 1, 1, 1 }, - { 0, -1, 1, 1, 1, 1, 1, 1, 1 }, - { 0, -2, 1, 1, 1, 1, 1, 1, 1 }, - { 0, -2, 0, 1, 1, 1, 1, 1, 1 }, - { -1, -1, 0, 1, 1, 1, 1, 1, 1 }, - { 0, 0, -1, 0, 1, 1, 1, 1, 1 }, - { -1, -1, 1, 1, 1, 1, 1, 1, 1 }, - { 0, 0, -1, 1, 1, 1, 1, 1, 1 }, - { 0, -1, 0, 1, 1, 1, 1, 1, 1 }, - { -1, -1, -1, 1, 1, 1, 1, 1, 1 }, - { 0, 0, 0, 0, 1, 1, 1, 1, 1 }, - { 0, 0, 0, 1, 1, 1, 1, 1, 1 }, - { 0, -1, -1, 1, 1, 1, 1, 1, 1 }, - { 0, 1, 0, 1, 1, 1, 1, 1, 1 }, - { 0, -3, -2, 1, 1, 1, 1, 2, 2 }, - { -3, -5, -3, 2, 2, 2, 2, 2, 2 }, }, - { { -1, -2, 0, 2, 2, 2, 2, 2, 2 }, - { -1, -2, 0, 1, 2, 2, 2, 2, 2 }, - { 0, -2, 0, 2, 2, 2, 2, 2, 2 }, - { -1, 0, 1, 2, 2, 2, 2, 2, 2 }, - { 0, 0, 1, 2, 2, 2, 2, 2, 2 }, - { 0, -2, 0, 1, 2, 2, 2, 2, 2 }, - { 0, -1, 1, 2, 2, 2, 2, 2, 2 }, - { -1, -1, 0, 2, 2, 2, 2, 2, 2 }, - { -1, -1, 0, 1, 2, 2, 2, 2, 2 }, - { -1, -2, -1, 2, 2, 2, 2, 2, 2 }, - { 0, -1, 0, 2, 2, 2, 2, 2, 2 }, - { 1, 1, 0, 1, 2, 2, 2, 2, 2 }, - { 0, 1, 2, 2, 2, 2, 2, 2, 2 }, - { 1, 0, 0, 1, 2, 2, 2, 2, 2 }, - { 0, 0, 0, 1, 2, 2, 2, 2, 2 }, - { -1, -1, -1, 1, 2, 2, 2, 2, 2 }, }, - { { 0, 1, 2, 3, 3, 3, 3, 3, 3 }, - { 1, 1, 2, 3, 3, 3, 3, 3, 3 }, - { -1, 0, 1, 2, 3, 3, 3, 3, 3 }, - { 0, 0, 2, 3, 3, 3, 3, 3, 3 }, - { -1, 0, 1, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 3, 3, 3, 3, 3, 3 }, - { 1, 2, 3, 3, 3, 3, 3, 3, 3 }, - { 1, 2, 2, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 1, 3, 3, 3, 3, 3, 3 }, - { 0, 0, 1, 2, 3, 3, 3, 3, 3 }, - { -1, 1, 2, 3, 3, 3, 3, 3, 3 }, - { -1, 0, 2, 3, 3, 3, 3, 3, 3 }, - { 2, 2, 3, 3, 3, 3, 3, 3, 3 }, - { 1, 1, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 2, 3, 3, 3, 3, 3, 3, 3 }, - { 0, 1, 1, 2, 3, 3, 3, 3, 3 }, }, - { { 0, 1, 2, 3, 4, 4, 4, 4, 4 }, - { 1, 2, 3, 4, 4, 4, 4, 4, 4 }, - { 0, 0, 2, 3, 4, 4, 4, 4, 4 }, - { 1, 1, 2, 4, 4, 4, 4, 4, 4 }, - { 0, 1, 2, 4, 4, 4, 4, 4, 4 }, - { -1, 0, 1, 3, 4, 4, 4, 4, 4 }, - { 0, 0, 1, 3, 4, 4, 4, 4, 4 }, - { 1, 1, 2, 3, 4, 4, 4, 4, 4 }, - { 0, 1, 1, 3, 4, 4, 4, 4, 4 }, - { 2, 2, 3, 4, 4, 4, 4, 4, 4 }, - { 1, 1, 3, 4, 4, 4, 4, 4, 4 }, - { 1, 2, 2, 4, 4, 4, 4, 4, 4 }, - { -1, 0, 2, 3, 4, 4, 4, 4, 4 }, - { 0, 1, 3, 4, 4, 4, 4, 4, 4 }, - { 1, 2, 2, 3, 4, 4, 4, 4, 4 }, - { 0, 2, 3, 4, 4, 4, 4, 4, 4 }, }, - { { 1, 2, 3, 4, 5, 5, 5, 5, 5 }, - { 0, 1, 2, 3, 4, 5, 5, 5, 5 }, - { 0, 1, 2, 3, 5, 5, 5, 5, 5 }, - { 1, 1, 3, 4, 5, 5, 5, 5, 5 }, - { 1, 1, 2, 4, 5, 5, 5, 5, 5 }, - { 1, 2, 2, 4, 5, 5, 5, 5, 5 }, - { 1, 1, 2, 3, 5, 5, 5, 5, 5 }, - { 2, 2, 3, 4, 5, 5, 5, 5, 5 }, - { 0, 1, 2, 4, 5, 5, 5, 5, 5 }, - { 2, 2, 3, 5, 5, 5, 5, 5, 5 }, - { 1, 2, 3, 5, 5, 5, 5, 5, 5 }, - { 0, 1, 3, 4, 5, 5, 5, 5, 5 }, - { 1, 2, 2, 3, 5, 5, 5, 5, 5 }, - { 2, 3, 4, 5, 5, 5, 5, 5, 5 }, - { 0, 2, 3, 4, 5, 5, 5, 5, 5 }, - { 1, 1, 1, 3, 4, 5, 5, 5, 5 }, }, - { { 1, 2, 3, 4, 5, 5, 5, 6, 6 }, - { 1, 2, 3, 4, 5, 6, 6, 6, 6 }, - { 2, 3, 4, 5, 6, 6, 6, 6, 6 }, - { 1, 2, 3, 4, 6, 6, 6, 6, 6 }, - { 2, 2, 3, 4, 5, 5, 5, 6, 6 }, - { 1, 2, 3, 4, 5, 5, 6, 6, 6 }, - { 2, 2, 3, 4, 6, 6, 6, 6, 6 }, - { 2, 2, 3, 4, 5, 6, 6, 6, 6 }, - { 2, 2, 4, 5, 6, 6, 6, 6, 6 }, - { 2, 2, 3, 5, 6, 6, 6, 6, 6 }, - { 1, 2, 3, 5, 6, 6, 6, 6, 6 }, - { 2, 3, 3, 5, 6, 6, 6, 6, 6 }, - { 1, 2, 4, 5, 6, 6, 6, 6, 6 }, - { 2, 2, 3, 4, 5, 5, 6, 6, 6 }, - { 2, 3, 3, 4, 6, 6, 6, 6, 6 }, - { 1, 3, 4, 5, 6, 6, 6, 6, 6 } } -}; - -/** 2D base shape tables for scale factor coding. - * The values are grouped together as follows: - * [num_shape_tables = 64][num_seg_coeffs = 9] */ -static const int8_t atrac3p_sf_shapes[64][9] = { - { -3, -2, -1, 0, 3, 5, 6, 8, 40 }, - { -3, -2, 0, 1, 7, 9, 11, 13, 20 }, - { -1, 0, 0, 1, 6, 8, 10, 13, 41 }, - { 0, 0, 0, 2, 5, 5, 6, 8, 14 }, - { 0, 0, 0, 2, 6, 7, 8, 11, 47 }, - { 0, 0, 1, 2, 5, 7, 8, 10, 32 }, - { 0, 0, 1, 3, 8, 10, 12, 14, 47 }, - { 0, 0, 2, 4, 9, 10, 12, 14, 40 }, - { 0, 0, 3, 5, 9, 10, 12, 14, 22 }, - { 0, 1, 3, 5, 10, 14, 18, 22, 31 }, - { 0, 2, 5, 6, 10, 10, 10, 12, 46 }, - { 0, 2, 5, 7, 12, 14, 15, 18, 44 }, - { 1, 1, 4, 5, 7, 7, 8, 9, 15 }, - { 1, 2, 2, 2, 4, 5, 7, 9, 26 }, - { 1, 2, 2, 3, 6, 7, 7, 8, 47 }, - { 1, 2, 2, 3, 6, 8, 10, 13, 22 }, - { 1, 3, 4, 7, 13, 17, 21, 24, 41 }, - { 1, 4, 0, 4, 10, 12, 13, 14, 17 }, - { 2, 3, 3, 3, 6, 8, 10, 13, 48 }, - { 2, 3, 3, 4, 9, 12, 14, 17, 47 }, - { 2, 3, 3, 5, 10, 12, 14, 17, 25 }, - { 2, 3, 5, 7, 8, 9, 9, 9, 13 }, - { 2, 3, 5, 9, 16, 21, 25, 28, 33 }, - { 2, 4, 5, 8, 12, 14, 17, 19, 26 }, - { 2, 4, 6, 8, 12, 13, 13, 15, 20 }, - { 2, 4, 7, 12, 20, 26, 30, 32, 35 }, - { 3, 3, 5, 6, 12, 14, 16, 19, 34 }, - { 3, 4, 4, 5, 7, 9, 10, 11, 48 }, - { 3, 4, 5, 6, 8, 9, 10, 11, 16 }, - { 3, 5, 5, 5, 7, 9, 10, 13, 35 }, - { 3, 5, 5, 7, 10, 12, 13, 15, 49 }, - { 3, 5, 7, 7, 8, 7, 9, 12, 21 }, - { 3, 5, 7, 8, 12, 14, 15, 15, 24 }, - { 3, 5, 7, 10, 16, 21, 24, 27, 44 }, - { 3, 5, 8, 14, 21, 26, 28, 29, 42 }, - { 3, 6, 10, 13, 18, 19, 20, 22, 27 }, - { 3, 6, 11, 16, 24, 27, 28, 29, 31 }, - { 4, 5, 4, 3, 4, 6, 8, 11, 18 }, - { 4, 6, 5, 6, 9, 10, 12, 14, 20 }, - { 4, 6, 7, 6, 6, 6, 7, 8, 46 }, - { 4, 6, 7, 9, 13, 16, 18, 20, 48 }, - { 4, 6, 7, 9, 14, 17, 20, 23, 31 }, - { 4, 6, 9, 11, 14, 15, 15, 17, 21 }, - { 4, 8, 13, 20, 27, 32, 35, 36, 38 }, - { 5, 6, 6, 4, 5, 6, 7, 6, 6 }, - { 5, 7, 7, 8, 9, 9, 10, 12, 49 }, - { 5, 8, 9, 9, 10, 11, 12, 13, 42 }, - { 5, 8, 10, 12, 15, 16, 17, 19, 42 }, - { 5, 8, 12, 17, 26, 31, 32, 33, 44 }, - { 5, 9, 13, 16, 20, 22, 23, 23, 35 }, - { 6, 8, 8, 7, 6, 5, 6, 8, 15 }, - { 6, 8, 8, 8, 9, 10, 12, 16, 24 }, - { 6, 8, 8, 9, 10, 10, 11, 11, 13 }, - { 6, 8, 10, 13, 19, 21, 24, 26, 32 }, - { 6, 9, 10, 11, 13, 13, 14, 16, 49 }, - { 7, 9, 9, 10, 13, 14, 16, 19, 27 }, - { 7, 10, 12, 13, 16, 16, 17, 17, 27 }, - { 7, 10, 12, 14, 17, 19, 20, 22, 48 }, - { 8, 9, 10, 9, 10, 11, 11, 11, 19 }, - { 8, 11, 12, 12, 13, 13, 13, 13, 17 }, - { 8, 11, 13, 14, 16, 17, 19, 20, 27 }, - { 8, 12, 17, 22, 26, 28, 29, 30, 33 }, - { 10, 14, 16, 19, 21, 22, 22, 24, 28 }, - { 10, 15, 17, 18, 21, 22, 23, 25, 43 } -}; - -static const uint8_t atrac3p_ct_restricted_to_full[2][7][4] = { - { { 0, 5, 4, 1 }, - { 0, 1, 2, 3 }, - { 3, 0, 4, 2 }, - { 4, 0, 1, 2 }, - { 1, 0, 4, 3 }, - { 3, 0, 2, 1 }, - { 0, 3, 1, 2 } }, - { { 4, 0, 1, 2 }, - { 0, 3, 2, 1 }, - { 0, 1, 2, 3 }, - { 0, 1, 2, 4 }, - { 0, 1, 2, 3 }, - { 1, 4, 2, 0 }, - { 0, 1, 2, 3 } } -}; - -/** Tables for spectrum coding */ -static const uint8_t huff_a01_cb[14] = { - 1, 12, 1, 0, 0, 1, 7, 0, 19, 5, 13, 21, 6, 8 -}; - -static const uint8_t huff_a01_xlat[81] = { - 0x00, 0x03, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x50, 0xD0, 0x70, - 0xF0, 0xC4, 0x14, 0x34, 0x4C, 0x1C, 0x3C, 0x41, 0xC1, 0x31, 0x05, 0x0D, - 0xC3, 0x13, 0x07, 0x0F, 0x44, 0xCC, 0x11, 0x43, 0x33, 0x54, 0x74, 0xDC, - 0xFC, 0x71, 0x15, 0x4D, 0xCD, 0x1D, 0xD3, 0xC7, 0x37, 0x3F, 0xD4, 0xF4, - 0x5C, 0x7C, 0x51, 0xD1, 0xF1, 0x45, 0xC5, 0x35, 0xDD, 0x3D, 0x53, 0x73, - 0xF3, 0x47, 0x17, 0x77, 0x4F, 0xCF, 0x1F, 0x55, 0xF5, 0x7D, 0xD7, 0x5F, - 0xFF, 0xD5, 0x75, 0x5D, 0xFD, 0x57, 0xF7, 0xDF, 0x7F -}; - -static const uint8_t huff_a02_cb[13] = { - 2, 12, 1, 0, 4, 11, 0, 1, 29, 6, 20, 7, 2 -}; - -static const uint8_t huff_a02_xlat[81] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x50, 0x44, 0x14, 0x54, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x90, 0x80, 0x20, 0x60, 0x84, 0x94, 0x24, 0x64, - 0x08, 0x48, 0x18, 0x58, 0x81, 0x91, 0x21, 0x85, 0x95, 0x65, 0x09, 0x49, - 0x19, 0x59, 0x02, 0x42, 0x12, 0x52, 0x06, 0x46, 0x16, 0x56, 0x88, 0x61, - 0x25, 0x29, 0x69, 0x5A, 0xA0, 0xA4, 0x98, 0x28, 0x68, 0xA1, 0xA5, 0x89, - 0x99, 0xA9, 0x82, 0x92, 0x22, 0x62, 0x96, 0x26, 0x66, 0x0A, 0x4A, 0x1A, - 0xA8, 0x86, 0xA6, 0x8A, 0x9A, 0x2A, 0x6A, 0xA2, 0xAA -}; - -static const uint8_t huff_a03_cb[9] = { 3, 9, 1, 8, 0, 13, 18, 7, 2 }; - -static const uint8_t huff_a03_xlat[49] = { - 0x00, 0x08, 0x38, 0x01, 0x09, 0x39, 0x07, 0x0F, 0x3F, 0x10, 0x30, 0x11, - 0x31, 0x02, 0x0A, 0x3A, 0x05, 0x06, 0x0E, 0x3E, 0x17, 0x37, 0x18, 0x28, - 0x19, 0x29, 0x2A, 0x32, 0x03, 0x0B, 0x33, 0x3B, 0x0D, 0x15, 0x3D, 0x16, - 0x1E, 0x36, 0x1F, 0x2F, 0x12, 0x1A, 0x13, 0x2B, 0x1D, 0x35, 0x2E, 0x1B, - 0x2D -}; - -static const uint8_t huff_a04_cb[4] = { 2, 3, 2, 4 }; -static const uint8_t huff_a04_xlat[6] = { 1, 2, 0, 3, 4, 5 }; - -static const uint8_t huff_a05_cb[12] = { - 3, 12, 1, 3, 5, 8, 12, 23, 72, 68, 31, 2 -}; - -static const uint8_t huff_a05_xlat[225] = { - 0x00, 0x10, 0xF0, 0x01, 0x11, 0xF1, 0x0F, 0x1F, 0xFF, 0x20, 0xE0, 0xE1, - 0x02, 0xF2, 0x0E, 0x1E, 0x2F, 0x30, 0xD0, 0x21, 0x12, 0x22, 0xE2, 0x03, - 0x0D, 0x2E, 0xEE, 0xFE, 0xEF, 0x40, 0xC0, 0x31, 0xC1, 0xD1, 0x32, 0xD2, - 0x13, 0x23, 0xE3, 0xF3, 0x04, 0xF4, 0x0C, 0x1C, 0x1D, 0x2D, 0xED, 0xFD, - 0x3E, 0xDE, 0x3F, 0xDF, 0x50, 0x60, 0x70, 0x90, 0xA0, 0xB0, 0x41, 0x51, - 0x61, 0x71, 0x91, 0xA1, 0xB1, 0x42, 0x62, 0x92, 0xA2, 0xC2, 0x33, 0xC3, - 0xD3, 0x14, 0x24, 0x34, 0xD4, 0xE4, 0x05, 0x15, 0xF5, 0x06, 0x16, 0x26, - 0xE6, 0xF6, 0x07, 0x17, 0xE7, 0xF7, 0x09, 0x19, 0x29, 0xF9, 0x0A, 0x1A, - 0x2A, 0xEA, 0xFA, 0x0B, 0x1B, 0xFB, 0x2C, 0x3C, 0xDC, 0xEC, 0xFC, 0x3D, - 0x4D, 0xCD, 0xDD, 0x4E, 0x6E, 0x7E, 0xAE, 0xCE, 0x4F, 0x5F, 0x6F, 0x7F, - 0x9F, 0xAF, 0xBF, 0xCF, 0x52, 0x72, 0xB2, 0x43, 0x53, 0x63, 0x73, 0x93, - 0xA3, 0xB3, 0x44, 0x64, 0x74, 0x94, 0xA4, 0xB4, 0xC4, 0x25, 0x35, 0xA5, - 0xC5, 0xD5, 0xE5, 0x36, 0x46, 0xB6, 0xC6, 0xD6, 0x27, 0x37, 0x47, 0xB7, - 0xC7, 0xD7, 0x39, 0x49, 0x59, 0xC9, 0xD9, 0xE9, 0x3A, 0x4A, 0x5A, 0xCA, - 0xDA, 0x2B, 0x3B, 0x4B, 0x6B, 0x7B, 0xDB, 0xEB, 0x4C, 0x5C, 0x6C, 0x7C, - 0x9C, 0xAC, 0xCC, 0x5D, 0x6D, 0x7D, 0x9D, 0xAD, 0xBD, 0x5E, 0x9E, 0xBE, - 0x54, 0x45, 0x55, 0x65, 0x75, 0x95, 0xB5, 0x56, 0x66, 0x76, 0x96, 0xA6, - 0x57, 0x67, 0x97, 0xA7, 0x69, 0x79, 0xA9, 0xB9, 0x6A, 0x7A, 0x9A, 0xAA, - 0xBA, 0x5B, 0x9B, 0xAB, 0xBB, 0xCB, 0xBC, 0x77, 0x99 -}; - -static const uint8_t huff_a06_cb[7] = { - 2, 6, 1, 3, 2, 6, 4 -}; - -static const uint8_t huff_a06_xlat[16] = { - 1, 0, 2, 3, 4, 5, 6, 7, 8, 9, 13, 14, 10, 11, 12, 15 -}; - -static const uint8_t huff_a07_cb[11] = { - 2, 10, 1, 2, 2, 2, 6, 14, 21, 13, 2 -}; - -static const uint8_t huff_a07_xlat[63] = { - 0, 1, 63, 2, 62, 3, 61, 4, 5, 6, 58, 59, 60, 7, 8, 9, - 10, 26, 27, 28, 36, 37, 38, 54, 55, 56, 57, 11, 12, 13, 14, 15, - 16, 25, 29, 30, 31, 33, 34, 35, 39, 47, 48, 49, 50, 51, 52, 53, - 17, 18, 19, 20, 21, 22, 23, 41, 42, 43, 44, 45, 46, 24, 40 -}; - -static const uint8_t huff_a11_cb[13] = { - 1, 11, 1, 0, 0, 0, 8, 1, 18, 9, 22, 10, 12 -}; - -static const uint8_t huff_a11_xlat[81] = { - 0x00, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x03, 0xD0, 0x50, 0x70, - 0xF0, 0xC4, 0x34, 0x4C, 0xCC, 0x1C, 0x41, 0xC1, 0x31, 0x05, 0x0D, 0x43, - 0xC3, 0x13, 0x07, 0x0F, 0x44, 0x14, 0x74, 0xDC, 0x3C, 0x11, 0x1D, 0x33, - 0x37, 0x54, 0xD4, 0xF4, 0x5C, 0x7C, 0xFC, 0xD1, 0x71, 0xF1, 0x15, 0x35, - 0x4D, 0xCD, 0xDD, 0x3D, 0xD3, 0x73, 0x47, 0xC7, 0x17, 0x77, 0x3F, 0x51, - 0x45, 0xC5, 0x55, 0x53, 0xF3, 0x4F, 0xCF, 0x1F, 0xFF, 0xD5, 0x75, 0xF5, - 0x5D, 0x7D, 0xFD, 0x57, 0xD7, 0xF7, 0x5F, 0xDF, 0x7F -}; - -static const uint8_t huff_a12_cb[8] = { 5, 10, 16, 11, 32, 19, 1, 2 }; - -static const uint8_t huff_a12_xlat[81] = { - 0x00, 0x40, 0x10, 0x50, 0x04, 0x44, 0x14, 0x54, 0x01, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x90, 0x94, 0x58, 0x91, 0x95, 0x19, 0x59, 0x06, - 0x46, 0x16, 0x56, 0x80, 0x60, 0x84, 0x24, 0x64, 0xA4, 0x08, 0x48, 0x18, - 0x68, 0x81, 0x21, 0x61, 0xA1, 0x85, 0x25, 0x65, 0xA5, 0x09, 0x49, 0x99, - 0x69, 0xA9, 0x02, 0x42, 0x12, 0x52, 0x96, 0x26, 0x66, 0x1A, 0x5A, 0x20, - 0xA0, 0x88, 0x98, 0x28, 0xA8, 0x89, 0x29, 0x82, 0x92, 0x22, 0x62, 0x86, - 0xA6, 0x0A, 0x4A, 0x9A, 0x6A, 0xAA, 0xA2, 0x8A, 0x2A -}; - -static const uint8_t huff_a13_cb[12] = { - 1, 10, 1, 0, 0, 4, 2, 2, 9, 15, 12, 4 -}; - -static const uint8_t huff_a13_xlat[49] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x39, 0x0F, 0x09, 0x3F, 0x10, 0x30, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x3E, 0x17, 0x18, 0x28, 0x11, 0x29, 0x0A, 0x32, - 0x03, 0x0B, 0x3B, 0x05, 0x0D, 0x3D, 0x16, 0x1F, 0x37, 0x19, 0x12, 0x1A, - 0x2A, 0x13, 0x33, 0x15, 0x35, 0x1E, 0x2E, 0x36, 0x2F, 0x1B, 0x2B, 0x1D, - 0x2D -}; - -static const uint8_t huff_a14_cb[12] = { - 2, 11, 1, 0, 4, 3, 5, 16, 28, 34, 26, 4 -}; - -static const uint8_t huff_a14_xlat[121] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x11, 0x02, - 0x0E, 0x30, 0x50, 0xB0, 0xD0, 0x21, 0xE1, 0x12, 0xF2, 0x03, 0x05, 0x0B, - 0x0D, 0x1E, 0xFE, 0x2F, 0xEF, 0x40, 0xC0, 0x31, 0x51, 0xB1, 0xC1, 0xD1, - 0x22, 0x52, 0xE2, 0x13, 0xF3, 0x04, 0x15, 0xF5, 0x1B, 0xEB, 0xFB, 0x0C, - 0x1D, 0xFD, 0x2E, 0x5E, 0xEE, 0x3F, 0x5F, 0xBF, 0xDF, 0x41, 0x32, 0x42, - 0xB2, 0xD2, 0x23, 0x53, 0xB3, 0xE3, 0x14, 0x24, 0xE4, 0xF4, 0x25, 0x35, - 0xD5, 0xE5, 0x2B, 0x3B, 0xDB, 0x1C, 0x2C, 0xBC, 0xEC, 0xFC, 0x2D, 0xBD, - 0xED, 0x3E, 0x4E, 0xBE, 0xDE, 0x4F, 0xCF, 0xC2, 0x33, 0x43, 0xC3, 0xD3, - 0x34, 0x44, 0x54, 0xB4, 0xD4, 0x45, 0x55, 0xC5, 0x4B, 0xCB, 0x3C, 0x4C, - 0x5C, 0xCC, 0xDC, 0x3D, 0x4D, 0x5D, 0xCD, 0xDD, 0xCE, 0xC4, 0xB5, 0x5B, - 0xBB -}; - -static const uint8_t huff_a15_cb[9] = { 5, 11, 9, 12, 16, 44, 98, 42, 4 }; - -static const uint8_t huff_a15_xlat[225] = { - 0x00, 0x10, 0xF0, 0x01, 0x11, 0xF1, 0x0F, 0x1F, 0xFF, 0x20, 0xE0, 0x21, - 0xE1, 0x02, 0x12, 0xF2, 0x0E, 0x1E, 0xFE, 0x2F, 0xEF, 0x30, 0xD0, 0x31, - 0xD1, 0x22, 0xE2, 0x03, 0x13, 0xF3, 0x0D, 0x1D, 0xFD, 0x2E, 0xEE, 0x3F, - 0xDF, 0x40, 0x60, 0x70, 0x90, 0xA0, 0xC0, 0x41, 0xC1, 0x32, 0x42, 0xC2, - 0xD2, 0x23, 0x33, 0xD3, 0xE3, 0x04, 0x14, 0x24, 0xE4, 0xF4, 0x06, 0x16, - 0xF6, 0x07, 0x09, 0x0A, 0x1A, 0xFA, 0x0C, 0x1C, 0x2C, 0xEC, 0xFC, 0x2D, - 0x3D, 0xDD, 0xED, 0x3E, 0x4E, 0xCE, 0xDE, 0x4F, 0xCF, 0x50, 0xB0, 0x51, - 0x61, 0x71, 0x91, 0xA1, 0xB1, 0x52, 0x62, 0x72, 0x92, 0xA2, 0xB2, 0x43, - 0x53, 0x63, 0x73, 0x93, 0xA3, 0xC3, 0x34, 0x44, 0x64, 0xA4, 0xC4, 0xD4, - 0x05, 0x15, 0x25, 0x35, 0xD5, 0xE5, 0xF5, 0x26, 0x36, 0x46, 0xC6, 0xD6, - 0xE6, 0x17, 0x27, 0x37, 0xC7, 0xD7, 0xE7, 0xF7, 0x19, 0x29, 0x39, 0xC9, - 0xD9, 0xE9, 0xF9, 0x2A, 0x3A, 0x4A, 0x5A, 0xCA, 0xDA, 0xEA, 0x0B, 0x1B, - 0x2B, 0x3B, 0xCB, 0xDB, 0xEB, 0xFB, 0x3C, 0x4C, 0x6C, 0x7C, 0x9C, 0xAC, - 0xBC, 0xCC, 0xDC, 0x4D, 0x5D, 0x6D, 0x7D, 0x9D, 0xAD, 0xBD, 0xCD, 0x5E, - 0x6E, 0x7E, 0x9E, 0xAE, 0xBE, 0x5F, 0x6F, 0x7F, 0x9F, 0xAF, 0xBF, 0xB3, - 0x54, 0x74, 0x94, 0xB4, 0x45, 0x55, 0x65, 0x75, 0x95, 0xA5, 0xB5, 0xC5, - 0x56, 0x66, 0x76, 0x96, 0xA6, 0xB6, 0x47, 0x57, 0x67, 0xA7, 0xB7, 0x49, - 0x59, 0x69, 0xA9, 0xB9, 0x6A, 0x7A, 0x9A, 0xAA, 0xBA, 0x4B, 0x5B, 0x6B, - 0x7B, 0x9B, 0xAB, 0xBB, 0x5C, 0x77, 0x97, 0x79, 0x99 -}; - -static const uint8_t huff_a16_cb[13] = { - 2, 12, 1, 1, 2, 2, 5, 7, 21, 54, 85, 62, 16 -}; - -static const uint8_t huff_a16_xlat[256] = { - 0x00, 0x01, 0x10, 0x11, 0x21, 0x12, 0x20, 0x31, 0x02, 0x22, 0x13, 0x30, - 0x41, 0x32, 0x03, 0x23, 0x14, 0x24, 0x40, 0x51, 0x61, 0xD1, 0xE1, 0x42, - 0x52, 0xD2, 0x33, 0x43, 0xD3, 0x04, 0x34, 0x05, 0x15, 0x25, 0x16, 0x1D, - 0x2D, 0x1E, 0x2E, 0x50, 0x60, 0xD0, 0xE0, 0xF0, 0x71, 0x81, 0xF1, 0x62, - 0x72, 0xE2, 0xF2, 0x53, 0x63, 0xE3, 0xF3, 0x44, 0x54, 0xD4, 0xE4, 0xF4, - 0x35, 0x45, 0x55, 0xD5, 0xE5, 0xF5, 0x06, 0x26, 0x36, 0xD6, 0x07, 0x17, - 0x27, 0x37, 0xD7, 0x18, 0x28, 0x1C, 0x0D, 0x3D, 0x4D, 0x5D, 0x6D, 0x8D, - 0x0E, 0x3E, 0x4E, 0x5E, 0x0F, 0x1F, 0x2F, 0x3F, 0x5F, 0x70, 0x80, 0x90, - 0xC0, 0x91, 0xA1, 0xB1, 0xC1, 0x82, 0x92, 0xA2, 0xC2, 0x73, 0x83, 0x93, - 0xA3, 0xC3, 0x64, 0x74, 0x84, 0x94, 0xA4, 0xC4, 0x65, 0x75, 0x85, 0x46, - 0x56, 0x66, 0xC6, 0xE6, 0xF6, 0x47, 0x57, 0xE7, 0xF7, 0x08, 0x38, 0x48, - 0x58, 0x68, 0xD8, 0xE8, 0xF8, 0x09, 0x19, 0x29, 0x39, 0x59, 0xD9, 0xE9, - 0xF9, 0x1A, 0x2A, 0x3A, 0xDA, 0xEA, 0xFA, 0x1B, 0x2B, 0xDB, 0xEB, 0xFB, - 0x0C, 0x2C, 0x3C, 0xDC, 0xEC, 0x7D, 0x9D, 0xAD, 0xBD, 0xCD, 0x6E, 0x7E, - 0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0x4F, 0x6F, 0x7F, 0x8F, 0xAF, 0xA0, 0xB2, - 0xB3, 0xB4, 0x95, 0xA5, 0xB5, 0xC5, 0x76, 0x86, 0x96, 0xA6, 0xB6, 0x67, - 0x77, 0x87, 0x97, 0xC7, 0x78, 0x88, 0x98, 0xC8, 0x49, 0x69, 0x79, 0x89, - 0x99, 0xC9, 0x0A, 0x4A, 0x5A, 0x6A, 0x7A, 0xCA, 0x0B, 0x3B, 0x4B, 0x5B, - 0x6B, 0xCB, 0x4C, 0x5C, 0x6C, 0x7C, 0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xFC, - 0xDD, 0xED, 0xFD, 0xDE, 0xEE, 0xFE, 0x9F, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF, - 0xB0, 0xA7, 0xB7, 0xA8, 0xB8, 0xA9, 0xB9, 0x8A, 0x9A, 0xAA, 0xBA, 0x7B, - 0x8B, 0x9B, 0xAB, 0xBB -}; - -static const uint8_t huff_a17_cb[9] = { 3, 9, 3, 2, 5, 7, 17, 23, 6 }; - -static const uint8_t huff_a17_xlat[63] = { - 0, 1, 63, 2, 62, 3, 4, 59, 60, 61, 5, 6, 7, 8, 56, 57, - 58, 9, 10, 11, 12, 13, 14, 26, 27, 36, 37, 38, 50, 51, 52, 53, - 54, 55, 15, 16, 17, 18, 19, 20, 21, 25, 28, 29, 30, 31, 33, 34, - 35, 39, 43, 44, 45, 46, 47, 48, 49, 22, 23, 24, 40, 41, 42 -}; - -static const uint8_t huff_a21_cb[14] = { - 1, 12, 1, 0, 0, 2, 6, 0, 7, 21, 15, 17, 8, 4 -}; - -static const uint8_t huff_a21_xlat[81] = { - 0x00, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x03, 0xD0, 0x70, 0x34, - 0x1C, 0x0D, 0x13, 0x07, 0x50, 0xF0, 0x44, 0xC4, 0x14, 0x74, 0x4C, 0xCC, - 0xDC, 0x3C, 0x41, 0xC1, 0x11, 0x31, 0x05, 0x1D, 0x43, 0xC3, 0x33, 0x37, - 0x0F, 0x54, 0xF4, 0xFC, 0xD1, 0x71, 0x15, 0x4D, 0xCD, 0xDD, 0xD3, 0x73, - 0x47, 0xC7, 0x77, 0x3F, 0xD4, 0x5C, 0x7C, 0x51, 0xF1, 0x45, 0xC5, 0x55, - 0x35, 0x3D, 0x53, 0xF3, 0x17, 0x4F, 0xCF, 0x1F, 0xFF, 0x75, 0xF5, 0x5D, - 0x7D, 0xD7, 0xF7, 0x5F, 0xDF, 0xD5, 0xFD, 0x57, 0x7F -}; - -static const uint8_t huff_a22_cb[10] = { 2, 9, 1, 4, 0, 4, 3, 8, 3, 2 }; - -static const uint8_t huff_a22_xlat[25] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x09, 0x39, 0x0F, 0x3F, 0x10, 0x02, 0x06, - 0x30, 0x11, 0x31, 0x0A, 0x3A, 0x0E, 0x17, 0x37, 0x32, 0x16, 0x3E, 0x12, - 0x36 -}; - -static const uint8_t huff_a23_cb[9] = { 3, 9, 5, 0, 4, 6, 10, 16, 8 }; - -static const uint8_t huff_a23_xlat[49] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x09, 0x39, 0x0F, 0x3F, 0x10, 0x30, 0x02, - 0x3A, 0x06, 0x0E, 0x18, 0x28, 0x11, 0x31, 0x0A, 0x03, 0x05, 0x3E, 0x17, - 0x37, 0x19, 0x29, 0x12, 0x2A, 0x32, 0x0B, 0x33, 0x3B, 0x0D, 0x15, 0x3D, - 0x16, 0x1E, 0x36, 0x1F, 0x2F, 0x1A, 0x13, 0x1B, 0x2B, 0x1D, 0x2D, 0x35, - 0x2E -}; - -static const uint8_t huff_a24_cb[5] = { 2, 4, 3, 1, 2 }; - -static const uint8_t huff_a25_cb[5] = { 2, 4, 1, 5, 2 }; - -static const uint8_t huff_a25_xlat[8] = { 1, 0, 2, 3, 4, 5, 6, 7 }; - -static const uint8_t huff_a26_cb[10] = { 4, 11, 3, 4, 12, 15, 34, 83, 75, 30 }; - -static const uint8_t huff_a26_xlat[256] = { - 0x00, 0x01, 0x11, 0x10, 0x21, 0x12, 0x22, 0x20, 0x30, 0x31, 0x41, 0x02, - 0x32, 0x03, 0x13, 0x23, 0x33, 0x14, 0x24, 0x40, 0x51, 0x61, 0x42, 0x52, - 0x43, 0x53, 0x04, 0x34, 0x44, 0x15, 0x25, 0x35, 0x16, 0x26, 0x50, 0x60, - 0x71, 0x81, 0xD1, 0x62, 0x72, 0x82, 0xD2, 0x63, 0x73, 0xD3, 0x54, 0x64, - 0x05, 0x45, 0x55, 0x65, 0x06, 0x36, 0x46, 0x56, 0x17, 0x27, 0x37, 0x47, - 0x18, 0x28, 0x38, 0x19, 0x1D, 0x2D, 0x3D, 0x1E, 0x70, 0x80, 0x90, 0xD0, - 0xE0, 0x91, 0xA1, 0xB1, 0xC1, 0xE1, 0xF1, 0x92, 0xA2, 0xC2, 0xE2, 0xF2, - 0x83, 0x93, 0xA3, 0xC3, 0xE3, 0xF3, 0x74, 0x84, 0x94, 0xA4, 0xC4, 0xD4, - 0xE4, 0xF4, 0x75, 0x85, 0x95, 0xD5, 0xE5, 0x66, 0x76, 0x86, 0xD6, 0xE6, - 0x07, 0x57, 0x67, 0x77, 0xD7, 0x08, 0x48, 0x58, 0x68, 0xD8, 0x09, 0x29, - 0x39, 0x49, 0x59, 0x69, 0x1A, 0x2A, 0x3A, 0x4A, 0x1B, 0x2B, 0x1C, 0x2C, - 0x3C, 0x4C, 0x0D, 0x4D, 0x5D, 0x6D, 0x7D, 0x8D, 0x0E, 0x2E, 0x3E, 0x4E, - 0x5E, 0x6E, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0xA0, 0xB0, 0xC0, 0xF0, 0xB2, - 0xB3, 0xB4, 0xA5, 0xB5, 0xC5, 0xF5, 0x96, 0xA6, 0xB6, 0xC6, 0xF6, 0x87, - 0x97, 0xA7, 0xB7, 0xC7, 0xE7, 0xF7, 0x78, 0x88, 0x98, 0xA8, 0xC8, 0xE8, - 0xF8, 0x79, 0x89, 0x99, 0xC9, 0xD9, 0xE9, 0xF9, 0x0A, 0x5A, 0x6A, 0x7A, - 0x8A, 0xDA, 0xEA, 0xFA, 0x0B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, 0x8B, 0xDB, - 0x0C, 0x5C, 0x6C, 0x7C, 0x8C, 0x9C, 0xDC, 0x9D, 0xAD, 0xBD, 0xCD, 0x7E, - 0x8E, 0x9E, 0xAE, 0xBE, 0x0F, 0x6F, 0x7F, 0x8F, 0x9F, 0xAF, 0xB8, 0xA9, - 0xB9, 0x9A, 0xAA, 0xBA, 0xCA, 0x9B, 0xAB, 0xBB, 0xCB, 0xEB, 0xFB, 0xAC, - 0xBC, 0xCC, 0xEC, 0xFC, 0xDD, 0xED, 0xFD, 0xCE, 0xDE, 0xEE, 0xFE, 0xBF, - 0xCF, 0xDF, 0xEF, 0xFF -}; - -static const uint8_t huff_a27_cb[7] = { 4, 8, 3, 14, 10, 20, 16 }; - -static const uint8_t huff_a27_xlat[63] = { - 0, 2, 3, 1, 5, 6, 7, 9, 54, 55, 56, 58, 59, 60, 61, 62, - 63, 4, 8, 10, 11, 12, 14, 49, 52, 53, 57, 13, 15, 16, 17, 18, - 19, 22, 23, 25, 26, 30, 39, 43, 44, 45, 46, 47, 48, 50, 51, 20, - 21, 24, 27, 28, 29, 31, 33, 34, 35, 36, 37, 38, 40, 41, 42 -}; - -static const uint8_t huff_a31_cb[8] = { 1, 6, 1, 0, 3, 1, 0, 4 }; - -static const uint8_t huff_a31_xlat[9] = { - 0x00, 0x04, 0x0C, 0x01, 0x03, 0x05, 0x0D, 0x07, 0x0F -}; - -static const uint8_t huff_a32_cb[13] = { - 1, 11, 1, 0, 0, 2, 2, 6, 12, 18, 19, 15, 6 -}; - -static const uint8_t huff_a32_xlat[81] = { - 0x00, 0x40, 0x01, 0x10, 0x04, 0x80, 0x50, 0x20, 0x14, 0x05, 0x02, 0x90, - 0x60, 0x44, 0x54, 0x24, 0x08, 0x18, 0x41, 0x11, 0x15, 0x09, 0x06, 0xA0, - 0x84, 0x94, 0x64, 0xA4, 0x48, 0x58, 0x28, 0x51, 0x21, 0x45, 0x55, 0x25, - 0x19, 0x12, 0x16, 0x0A, 0x1A, 0x68, 0xA8, 0x81, 0x91, 0x61, 0xA1, 0x85, - 0x95, 0x65, 0xA5, 0x49, 0x59, 0x29, 0x69, 0x42, 0x52, 0x46, 0x56, 0x2A, - 0x88, 0x98, 0x89, 0x99, 0xA9, 0x82, 0x92, 0x22, 0x62, 0x86, 0x26, 0x66, - 0x4A, 0x5A, 0x6A, 0xA2, 0x96, 0xA6, 0x8A, 0x9A, 0xAA -}; - -static const uint8_t huff_a33_cb[12] = { - 3, 12, 1, 1, 13, 1, 14, 28, 33, 81, 32, 52 -}; - -static const uint8_t huff_a33_xlat[256] = { - 0x00, 0x10, 0x40, 0x50, 0x04, 0x44, 0x14, 0x54, 0x01, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x90, 0x20, 0x94, 0x64, 0x18, 0x21, 0x95, 0x19, - 0x69, 0x02, 0x52, 0x06, 0x46, 0x16, 0x80, 0x60, 0x84, 0xD4, 0x24, 0x08, - 0x48, 0x58, 0x68, 0x81, 0x91, 0x61, 0x85, 0x25, 0x65, 0xA5, 0x09, 0x49, - 0x59, 0x29, 0x42, 0x12, 0x56, 0x96, 0xA6, 0x0A, 0x17, 0x1B, 0xD0, 0xC4, - 0x74, 0xF4, 0x88, 0xC8, 0x28, 0xA1, 0x71, 0xC5, 0xD5, 0x75, 0x99, 0xB9, - 0x4D, 0x1D, 0x2D, 0x6D, 0x22, 0x62, 0x66, 0x4A, 0x1A, 0x9A, 0x6A, 0x8E, - 0x5E, 0x43, 0x23, 0x07, 0x47, 0x57, 0x6B, 0xC0, 0xA0, 0xE0, 0x70, 0xB0, - 0xA4, 0xE4, 0x34, 0xB4, 0x98, 0xD8, 0xA8, 0x38, 0x78, 0x0C, 0x4C, 0x1C, - 0x5C, 0x9C, 0x6C, 0x7C, 0xC1, 0xD1, 0xE1, 0x31, 0xE5, 0x35, 0xB5, 0xF5, - 0x89, 0xA9, 0x79, 0xF9, 0x0D, 0xCD, 0x9D, 0xDD, 0xAD, 0x3D, 0x7D, 0x82, - 0xC2, 0x92, 0xD2, 0xE2, 0x72, 0xF2, 0x86, 0xD6, 0xE6, 0x76, 0xB6, 0x8A, - 0x5A, 0xDA, 0xEA, 0xFA, 0x4E, 0x1E, 0x9E, 0xEE, 0x03, 0x13, 0x53, 0x97, - 0xB7, 0x0B, 0x4B, 0x8B, 0x5B, 0x9B, 0xEB, 0x7B, 0x0F, 0x4F, 0x1F, 0x5F, - 0x9F, 0x2F, 0x3F, 0xBF, 0xE8, 0xB8, 0xF8, 0x8C, 0x2C, 0x3C, 0xFC, 0xB1, - 0xC9, 0xD9, 0xE9, 0x39, 0x5D, 0xED, 0xBD, 0xA2, 0x32, 0x26, 0x36, 0x2A, - 0xAA, 0xBA, 0x0E, 0x2E, 0x6E, 0x83, 0xC3, 0x93, 0x63, 0xB3, 0xA7, 0x37, - 0x30, 0xF0, 0xCC, 0xDC, 0xAC, 0xEC, 0xBC, 0xF1, 0x8D, 0xFD, 0xB2, 0xC6, - 0xF6, 0xCA, 0x3A, 0x7A, 0xCE, 0xDE, 0xAE, 0x3E, 0x7E, 0xBE, 0xFE, 0xD3, - 0xA3, 0xE3, 0x33, 0x73, 0xF3, 0x87, 0xC7, 0xD7, 0x27, 0x67, 0xE7, 0x77, - 0xF7, 0xCB, 0xDB, 0x2B, 0xAB, 0x3B, 0xBB, 0xFB, 0x8F, 0xCF, 0xDF, 0x6F, - 0xAF, 0xEF, 0x7F, 0xFF -}; - -static const uint8_t huff_a34_cb[7] = { 1, 5, 1, 1, 1, 1, 2 }; - -static const uint8_t huff_a34_xlat[6] = { 1, 0, 2, 3, 4, 5 }; - -static const uint8_t huff_a35_cb[11] = { 2, 10, 1, 0, 2, 3, 6, 19, 9, 75, 110 }; - -static const uint8_t huff_a35_xlat[225] = { - 0x00, 0xF0, 0x0F, 0x10, 0x01, 0xFF, 0x20, 0xE0, 0x11, 0xF1, 0x0E, 0x1F, - 0x30, 0x40, 0xD0, 0x21, 0xE1, 0x02, 0x12, 0x22, 0xE2, 0xF2, 0x03, 0x13, - 0x1E, 0x2E, 0x3E, 0xEE, 0xFE, 0x2F, 0xEF, 0xD2, 0x43, 0xF3, 0x04, 0x0D, - 0x2D, 0x3D, 0x3F, 0xDF, 0x50, 0x60, 0x70, 0x90, 0xB0, 0x31, 0x41, 0x91, - 0xA1, 0xC1, 0xD1, 0x42, 0xA2, 0xC2, 0x23, 0x33, 0xE3, 0x24, 0x34, 0xB4, - 0xD4, 0xF4, 0x05, 0x15, 0x45, 0xE5, 0x16, 0x36, 0x56, 0xA6, 0xC6, 0xD6, - 0xF6, 0x57, 0xC7, 0xF7, 0x09, 0x29, 0x49, 0x59, 0x69, 0xF9, 0x0A, 0x2A, - 0x3A, 0x4A, 0xDA, 0xEA, 0xFA, 0x0B, 0x2B, 0xAB, 0xEB, 0xFB, 0x0C, 0x1C, - 0x2C, 0x3C, 0x4C, 0x5C, 0xCC, 0xDC, 0xFC, 0x1D, 0x4D, 0x6D, 0xBD, 0xCD, - 0xED, 0xFD, 0x4E, 0x6E, 0xCE, 0xDE, 0x7F, 0xA0, 0xC0, 0x51, 0x61, 0x71, - 0xB1, 0x32, 0x52, 0x62, 0x72, 0x92, 0xB2, 0x53, 0x63, 0x73, 0x93, 0xA3, - 0xB3, 0xC3, 0xD3, 0x14, 0x44, 0x54, 0x64, 0x74, 0x94, 0xA4, 0xC4, 0xE4, - 0x25, 0x35, 0x55, 0x65, 0x75, 0x95, 0xA5, 0xB5, 0xC5, 0xD5, 0xF5, 0x06, - 0x26, 0x46, 0x66, 0x76, 0x96, 0xB6, 0xE6, 0x07, 0x17, 0x27, 0x37, 0x47, - 0x67, 0x77, 0x97, 0xA7, 0xB7, 0xD7, 0xE7, 0x19, 0x39, 0x79, 0x99, 0xA9, - 0xB9, 0xC9, 0xD9, 0xE9, 0x1A, 0x5A, 0x6A, 0x7A, 0x9A, 0xAA, 0xBA, 0xCA, - 0x1B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, 0x9B, 0xBB, 0xCB, 0xDB, 0x6C, 0x7C, - 0x9C, 0xAC, 0xBC, 0xEC, 0x5D, 0x7D, 0x9D, 0xAD, 0xDD, 0x5E, 0x7E, 0x9E, - 0xAE, 0xBE, 0x4F, 0x5F, 0x6F, 0x9F, 0xAF, 0xBF, 0xCF -}; - -static const uint8_t huff_a36_cb[12] = { - 3, 12, 1, 3, 5, 5, 13, 27, 69, 96, 35, 2 -}; - -static const uint8_t huff_a36_xlat[256] = { - 0x00, 0x10, 0x01, 0x11, 0x20, 0x21, 0x02, 0x12, 0x22, 0x31, 0x41, 0x32, - 0x13, 0x23, 0x30, 0x40, 0x51, 0x42, 0x03, 0x33, 0x43, 0x04, 0x14, 0x24, - 0x34, 0x15, 0x25, 0x50, 0x61, 0x71, 0xD1, 0x52, 0x62, 0x72, 0xD2, 0x53, - 0x63, 0xD3, 0x44, 0x54, 0x64, 0x05, 0x35, 0x45, 0x55, 0x16, 0x26, 0x36, - 0x46, 0x17, 0x27, 0x1D, 0x2D, 0x3D, 0x60, 0x70, 0xD0, 0x81, 0x91, 0xA1, - 0xC1, 0xE1, 0xF1, 0x82, 0x92, 0xC2, 0xE2, 0xF2, 0x73, 0x83, 0xE3, 0xF3, - 0x74, 0x84, 0xC4, 0xD4, 0xE4, 0xF4, 0x65, 0x75, 0x85, 0xD5, 0xE5, 0x06, - 0x56, 0x66, 0xD6, 0xE6, 0x07, 0x37, 0x47, 0x57, 0x67, 0xD7, 0xE7, 0x18, - 0x28, 0x38, 0x48, 0x58, 0xD8, 0x19, 0x29, 0x2A, 0x1C, 0x2C, 0x0D, 0x4D, - 0x5D, 0x6D, 0x7D, 0x8D, 0x9D, 0x1E, 0x2E, 0x3E, 0x4E, 0x5E, 0x6E, 0x7E, - 0x1F, 0x2F, 0x3F, 0x80, 0x90, 0xA0, 0xC0, 0xE0, 0xF0, 0xB1, 0xA2, 0xB2, - 0x93, 0xA3, 0xB3, 0xC3, 0x94, 0xA4, 0xB4, 0x95, 0xA5, 0xB5, 0xC5, 0xF5, - 0x76, 0x86, 0x96, 0xA6, 0xC6, 0xF6, 0x77, 0x87, 0x97, 0xA7, 0xC7, 0xF7, - 0x08, 0x68, 0x78, 0x88, 0x98, 0xC8, 0xE8, 0xF8, 0x09, 0x39, 0x49, 0x59, - 0x69, 0x79, 0x89, 0xD9, 0xE9, 0xF9, 0x0A, 0x1A, 0x3A, 0x4A, 0x5A, 0x6A, - 0xDA, 0xEA, 0xFA, 0x1B, 0x2B, 0x3B, 0x4B, 0x5B, 0xDB, 0xEB, 0xFB, 0x0C, - 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x8C, 0x9C, 0xDC, 0xEC, 0xAD, 0xBD, 0xCD, - 0xDD, 0xED, 0x0E, 0x8E, 0x9E, 0xAE, 0xBE, 0x0F, 0x4F, 0x5F, 0x6F, 0x7F, - 0x8F, 0x9F, 0xAF, 0xB0, 0xB6, 0xB7, 0xA8, 0xB8, 0x99, 0xA9, 0xB9, 0xC9, - 0x7A, 0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0x0B, 0x6B, 0x7B, 0x8B, 0x9B, 0xCB, - 0xAC, 0xBC, 0xCC, 0xFC, 0xFD, 0xCE, 0xDE, 0xEE, 0xFE, 0xBF, 0xCF, 0xDF, - 0xEF, 0xFF, 0xAB, 0xBB -}; - -static const uint8_t huff_a37_cb[7] = { 4, 8, 7, 6, 8, 22, 20 }; - -static const uint8_t huff_a37_xlat[63] = { - 0, 1, 2, 3, 61, 62, 63, 4, 5, 6, 58, 59, 60, 7, 8, 9, - 10, 54, 55, 56, 57, 11, 12, 13, 14, 15, 16, 25, 26, 27, 28, 29, - 30, 35, 36, 37, 38, 48, 49, 50, 51, 52, 53, 17, 18, 19, 20, 21, - 22, 23, 24, 31, 33, 34, 39, 40, 41, 42, 43, 44, 45, 46, 47 -}; - -static const uint8_t huff_a41_cb[14] = { - 1, 12, 1, 0, 0, 6, 2, 0, 0, 0, 19, 9, 24, 20 -}; - -static const uint8_t huff_a41_xlat[81] = { - 0x00, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x03, 0x50, 0xD0, 0x70, - 0xF0, 0xC4, 0x34, 0x4C, 0xCC, 0x1C, 0x41, 0xC1, 0x31, 0x05, 0x0D, 0x43, - 0xC3, 0x13, 0x07, 0x0F, 0x44, 0x14, 0x74, 0xDC, 0x3C, 0x11, 0x1D, 0x33, - 0x37, 0x54, 0xD4, 0xF4, 0x5C, 0x7C, 0xFC, 0xD1, 0x71, 0xF1, 0xC5, 0x15, - 0x35, 0x4D, 0xCD, 0xDD, 0x3D, 0xD3, 0x73, 0x47, 0xC7, 0x17, 0x77, 0x1F, - 0x3F, 0x51, 0x45, 0x55, 0xD5, 0x75, 0xF5, 0x5D, 0x7D, 0xFD, 0x53, 0xF3, - 0x57, 0xD7, 0xF7, 0x4F, 0xCF, 0x5F, 0xDF, 0x7F, 0xFF -}; - -static const uint8_t huff_a42_cb[10] = { 3, 10, 1, 2, 13, 1, 31, 13, 16, 4 }; - -static const uint8_t huff_a42_xlat[81] = { - 0x00, 0x40, 0x01, 0x10, 0x50, 0x04, 0x44, 0x14, 0x54, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x59, 0x80, 0x90, 0x20, 0x60, 0x84, 0x94, 0x24, - 0x64, 0x08, 0x48, 0x18, 0x58, 0x81, 0x91, 0x21, 0x61, 0x85, 0x95, 0x25, - 0x65, 0x09, 0x49, 0x19, 0x02, 0x42, 0x12, 0x52, 0x06, 0x46, 0x16, 0x56, - 0xA0, 0xA4, 0x68, 0xA1, 0xA5, 0x99, 0x29, 0x69, 0x96, 0x66, 0x4A, 0x1A, - 0x5A, 0x88, 0x98, 0x28, 0x89, 0xA9, 0x82, 0x92, 0x22, 0x62, 0x86, 0x26, - 0xA6, 0x0A, 0x9A, 0x2A, 0x6A, 0xA8, 0xA2, 0x8A, 0xAA -}; - -static const uint8_t huff_a43_cb[5] = { 2, 4, 2, 3, 2 }; - -static const uint8_t huff_a43_xlat[7] = { 0, 7, 1, 2, 6, 3, 5 }; - -static const uint8_t huff_a44_cb[9] = { 4, 10, 5, 4, 12, 17, 47, 24, 12 }; - -static const uint8_t huff_a44_xlat[121] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x11, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x21, - 0xE1, 0x02, 0x12, 0xF2, 0x0E, 0x1E, 0xFE, 0x2F, 0xEF, 0x30, 0x50, 0xD0, - 0xD1, 0x22, 0xE2, 0x03, 0x13, 0xF3, 0x0D, 0x1D, 0x2D, 0xFD, 0x2E, 0xEE, - 0x3F, 0xDF, 0x40, 0xB0, 0xC0, 0x31, 0x41, 0x51, 0xB1, 0xC1, 0x32, 0xB2, - 0xC2, 0xD2, 0x23, 0xB3, 0xD3, 0xE3, 0x04, 0x14, 0xE4, 0xF4, 0x05, 0x15, - 0xD5, 0xE5, 0xF5, 0x0B, 0x1B, 0x2B, 0x3B, 0xEB, 0xFB, 0x0C, 0x1C, 0x2C, - 0xFC, 0x3D, 0x5D, 0xED, 0x3E, 0x4E, 0x5E, 0xBE, 0xDE, 0x4F, 0x5F, 0xBF, - 0xCF, 0x42, 0x52, 0x33, 0x53, 0xC3, 0x24, 0xB4, 0xD4, 0x25, 0x35, 0xC5, - 0x4B, 0xCB, 0xDB, 0x3C, 0x4C, 0x5C, 0xDC, 0xEC, 0x4D, 0xBD, 0xCD, 0xDD, - 0xCE, 0x43, 0x34, 0x44, 0x54, 0xC4, 0x45, 0x55, 0xB5, 0x5B, 0xBB, 0xBC, - 0xCC -}; - -static const uint8_t huff_a45_cb[5] = { 2, 4, 2, 2, 4 }; - -static const uint8_t huff_a45_xlat[8] = { 1, 2, 0, 3, 4, 5, 6, 7 }; - -static const uint8_t huff_a46_cb[7] = { 5, 9, 1, 16, 31, 36, 172 }; - -static const uint8_t huff_a46_xlat[256] = { - 0x02, 0x00, 0x30, 0x21, 0x31, 0x41, 0x61, 0x12, 0x22, 0x42, 0x62, 0x43, - 0x53, 0x24, 0x45, 0x26, 0x27, 0x10, 0x40, 0xB0, 0x01, 0x11, 0x81, 0x32, - 0x52, 0x72, 0x92, 0x03, 0x13, 0x33, 0x63, 0x14, 0x34, 0x54, 0x64, 0x74, - 0x05, 0x15, 0x25, 0x35, 0x55, 0x65, 0x06, 0x46, 0x56, 0x57, 0x67, 0x88, - 0x20, 0x51, 0x91, 0xD1, 0xF2, 0x23, 0x83, 0x93, 0x04, 0x44, 0x84, 0x94, - 0x75, 0x85, 0xC5, 0x36, 0x66, 0x96, 0xB6, 0x07, 0x37, 0x97, 0x08, 0x28, - 0x38, 0x48, 0x68, 0x09, 0x69, 0x79, 0x0A, 0x2A, 0x1B, 0x9B, 0x2C, 0x4D, - 0x50, 0x60, 0x70, 0x80, 0x90, 0xA0, 0xC0, 0xD0, 0xE0, 0xF0, 0x71, 0xA1, - 0xB1, 0xC1, 0xE1, 0xF1, 0x82, 0xA2, 0xB2, 0xC2, 0xD2, 0xE2, 0x73, 0xA3, - 0xB3, 0xC3, 0xD3, 0xE3, 0xF3, 0xA4, 0xB4, 0xC4, 0xD4, 0xE4, 0xF4, 0x95, - 0xA5, 0xB5, 0xD5, 0xE5, 0xF5, 0x16, 0x76, 0x86, 0xA6, 0xC6, 0xD6, 0xE6, - 0xF6, 0x17, 0x47, 0x77, 0x87, 0xA7, 0xB7, 0xC7, 0xD7, 0xE7, 0xF7, 0x18, - 0x58, 0x78, 0x98, 0xA8, 0xB8, 0xC8, 0xD8, 0xE8, 0xF8, 0x19, 0x29, 0x39, - 0x49, 0x59, 0x89, 0x99, 0xA9, 0xB9, 0xC9, 0xD9, 0xE9, 0xF9, 0x1A, 0x3A, - 0x4A, 0x5A, 0x6A, 0x7A, 0x8A, 0x9A, 0xAA, 0xBA, 0xCA, 0xDA, 0xEA, 0xFA, - 0x0B, 0x2B, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, 0x8B, 0xAB, 0xBB, 0xCB, 0xDB, - 0xEB, 0xFB, 0x0C, 0x1C, 0x3C, 0x4C, 0x5C, 0x6C, 0x7C, 0x8C, 0x9C, 0xAC, - 0xBC, 0xCC, 0xDC, 0xEC, 0xFC, 0x0D, 0x1D, 0x2D, 0x3D, 0x5D, 0x6D, 0x7D, - 0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0xDD, 0xED, 0xFD, 0x0E, 0x1E, 0x2E, 0x3E, - 0x4E, 0x5E, 0x6E, 0x7E, 0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0xDE, 0xEE, 0xFE, - 0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F, 0x8F, 0x9F, 0xAF, 0xBF, - 0xCF, 0xDF, 0xEF, 0xFF -}; - -static const uint8_t huff_a47_cb[8] = { 4, 9, 5, 12, 9, 12, 15, 10 }; - -static const uint8_t huff_a47_xlat[63] = { - 0, 1, 2, 62, 63, 3, 4, 5, 6, 8, 54, 56, 57, 58, 59, 60, - 61, 7, 9, 10, 11, 12, 13, 14, 53, 55, 15, 16, 17, 18, 19, 20, - 21, 36, 37, 39, 42, 52, 22, 25, 28, 35, 38, 40, 41, 43, 45, 46, - 47, 48, 49, 50, 51, 23, 24, 26, 27, 29, 30, 31, 33, 34, 44 -}; - -static const uint8_t huff_a51_cb[12] = { - 2, 11, 1, 0, 6, 2, 6, 18, 4, 26, 6, 12 -}; - -static const uint8_t huff_a51_xlat[81] = { - 0x00, 0x40, 0xC0, 0x30, 0x04, 0x01, 0x03, 0x10, 0x0C, 0xD0, 0x70, 0x34, - 0x1C, 0x0D, 0x07, 0x50, 0xF0, 0x44, 0xC4, 0x14, 0x4C, 0xCC, 0x3C, 0x41, - 0xC1, 0x11, 0x31, 0x05, 0x43, 0xC3, 0x13, 0x33, 0x0F, 0x74, 0xDC, 0x1D, - 0x37, 0x54, 0xD4, 0xF4, 0x5C, 0x7C, 0xFC, 0xD1, 0x71, 0xF1, 0xC5, 0x15, - 0x35, 0x4D, 0xCD, 0xDD, 0x3D, 0x53, 0xD3, 0x73, 0x47, 0xC7, 0x17, 0x77, - 0x4F, 0x1F, 0x3F, 0x51, 0x45, 0x55, 0xF3, 0xCF, 0xFF, 0xD5, 0x75, 0xF5, - 0x5D, 0x7D, 0xFD, 0x57, 0xD7, 0xF7, 0x5F, 0xDF, 0x7F -}; - -static const uint8_t huff_a52_cb[12] = { 1, 10, 1, 0, 2, 2, 0, 4, 3, 8, 3, 2 }; - -static const uint8_t huff_a52_xlat[25] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x09, 0x39, 0x0F, 0x3F, 0x10, 0x02, 0x06, - 0x30, 0x11, 0x31, 0x0A, 0x3A, 0x0E, 0x17, 0x37, 0x32, 0x16, 0x3E, 0x12, - 0x36 -}; - -static const uint8_t huff_a53_xlat[7] = { 0, 1, 2, 6, 7, 3, 5 }; - -static const uint8_t huff_a54_cb[8] = { 4, 9, 4, 7, 12, 19, 21, 58 }; - -static const uint8_t huff_a54_xlat[121] = { - 0x00, 0x01, 0x0F, 0x1F, 0x10, 0xE0, 0xF0, 0x11, 0xF1, 0x2F, 0xFF, 0x20, - 0x21, 0xE1, 0x02, 0x12, 0xF2, 0x03, 0xF3, 0x0E, 0x2E, 0xFE, 0x3F, 0x30, - 0x40, 0xD0, 0xC1, 0xD1, 0x22, 0xC2, 0x33, 0xE3, 0x0C, 0xCC, 0x0D, 0x1D, - 0x2D, 0xFD, 0x1E, 0x3E, 0x5E, 0xEF, 0xC0, 0x52, 0xB2, 0xD2, 0x43, 0xC3, - 0xD3, 0x24, 0x45, 0xF5, 0x4B, 0x5B, 0xFB, 0x1C, 0x3D, 0xBD, 0xDD, 0xEE, - 0xBF, 0xCF, 0xDF, 0x50, 0xB0, 0x31, 0x41, 0x51, 0xB1, 0x32, 0x42, 0xE2, - 0x13, 0x23, 0x53, 0xB3, 0x04, 0x14, 0x34, 0x44, 0x54, 0xB4, 0xC4, 0xD4, - 0xE4, 0xF4, 0x05, 0x15, 0x25, 0x35, 0x55, 0xB5, 0xC5, 0xD5, 0xE5, 0x0B, - 0x1B, 0x2B, 0x3B, 0xBB, 0xCB, 0xDB, 0xEB, 0x2C, 0x3C, 0x4C, 0x5C, 0xBC, - 0xDC, 0xEC, 0xFC, 0x4D, 0x5D, 0xCD, 0xED, 0x4E, 0xBE, 0xCE, 0xDE, 0x4F, - 0x5F -}; - -static const uint8_t huff_a55_cb[8] = { 1, 6, 1, 1, 1, 0, 3, 2 }; - -static const uint8_t huff_a55_xlat[8] = { 0, 1, 2, 3, 6, 7, 4, 5 }; - -static const uint8_t huff_a56_cb[7] = { 3, 7, 1, 8, 6, 8, 8 }; - -static const uint8_t huff_a56_xlat[31] = { - 4, 0, 1, 2, 3, 28, 29, 30, 31, 5, 6, 7, 24, 25, 27, 8, - 9, 14, 19, 21, 22, 23, 26, 10, 11, 12, 13, 15, 17, 18, 20 -}; - -static const uint8_t huff_a57_cb[9] = { 3, 9, 1, 5, 7, 8, 16, 22, 4 }; - -static const uint8_t huff_a57_xlat[63] = { - 0, 1, 2, 61, 62, 63, 3, 4, 5, 6, 58, 59, - 60, 7, 8, 9, 10, 54, 55, 56, 57, 11, 12, 13, - 14, 15, 26, 27, 28, 36, 37, 38, 49, 50, 51, 52, - 53, 16, 17, 18, 19, 20, 21, 23, 24, 25, 29, 30, - 31, 33, 34, 35, 39, 43, 44, 45, 46, 47, 48, 22, - 40, 41, 42 -}; - -static const uint8_t huff_a61_cb[12] = { - 2, 11, 1, 0, 8, 0, 1, 16, 10, 29, 12, 4 -}; - -static const uint8_t huff_a61_xlat[81] = { - 0x00, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x03, 0x70, 0x50, 0xD0, - 0xF0, 0x44, 0xC4, 0x14, 0x34, 0x4C, 0x1C, 0x3C, 0x31, 0x05, 0x0D, 0x13, - 0x07, 0x0F, 0x74, 0xCC, 0xDC, 0xFC, 0x41, 0xC1, 0x11, 0x43, 0xC3, 0x33, - 0x54, 0xD4, 0xF4, 0x5C, 0x7C, 0x51, 0xD1, 0x71, 0xF1, 0x45, 0xC5, 0x15, - 0x35, 0x4D, 0xCD, 0x1D, 0x3D, 0x53, 0xD3, 0x73, 0xF3, 0x47, 0xC7, 0x17, - 0x37, 0x4F, 0xCF, 0x1F, 0x3F, 0x55, 0xD5, 0x75, 0xF5, 0x5D, 0xDD, 0xFD, - 0x57, 0xD7, 0x77, 0xF7, 0xFF, 0x7D, 0x5F, 0xDF, 0x7F -}; - -static const uint8_t huff_a62_cb[8] = { 3, 8, 5, 2, 2, 9, 5, 2 }; - -static const uint8_t huff_a62_xlat[25] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x39, 0x0F, 0x09, 0x3F, 0x10, 0x30, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x17, 0x37, 0x11, 0x0A, 0x32, 0x16, 0x3E, 0x12, - 0x36 -}; - -static const uint8_t huff_a63_cb[11] = { - 3, 11, 1, 1, 10, 4, 16, 29, 46, 75, 74 -}; - -static const uint8_t huff_a63_xlat[256] = { - 0x00, 0x40, 0x10, 0x50, 0x04, 0x44, 0x14, 0x01, 0x41, 0x05, 0x45, 0x55, - 0x54, 0x11, 0x51, 0x15, 0x80, 0x90, 0x60, 0x24, 0x64, 0xA4, 0x48, 0x61, - 0x95, 0x25, 0xA5, 0x02, 0x42, 0x52, 0x16, 0x56, 0x20, 0x84, 0x94, 0x18, - 0x58, 0x81, 0x91, 0x85, 0x65, 0x09, 0x49, 0x19, 0x59, 0x99, 0x29, 0x69, - 0x79, 0x5D, 0x12, 0x62, 0x06, 0x46, 0x86, 0x66, 0x1A, 0x5A, 0x6A, 0x47, - 0x17, 0xC0, 0xA0, 0xE0, 0xC4, 0xD4, 0x74, 0x08, 0x78, 0x0C, 0x4C, 0x1C, - 0x5C, 0xD1, 0x21, 0xE1, 0x71, 0xC5, 0xE5, 0x75, 0xB5, 0x89, 0xBD, 0x92, - 0x22, 0x96, 0xA6, 0x36, 0x0A, 0x4A, 0x8A, 0x9A, 0x2A, 0x7A, 0xDE, 0x6E, - 0x43, 0x13, 0x53, 0x23, 0x07, 0x77, 0x4B, 0x1B, 0x9B, 0x6B, 0x2F, 0xD0, - 0x30, 0x70, 0xE4, 0x34, 0xF4, 0xC8, 0x98, 0x28, 0x68, 0xA8, 0xE8, 0x38, - 0xB8, 0xF8, 0x9C, 0x2C, 0x6C, 0x7C, 0xA1, 0xB1, 0xD5, 0x35, 0xC9, 0xD9, - 0xA9, 0xE9, 0x39, 0xB9, 0xF9, 0xCD, 0x1D, 0x2D, 0xAD, 0x7D, 0xC2, 0xD2, - 0xA2, 0xB2, 0xF2, 0xC6, 0x26, 0x76, 0xB6, 0xDA, 0xAA, 0xEA, 0x3A, 0xFA, - 0x0E, 0x4E, 0x2E, 0x7E, 0xBE, 0xFE, 0x03, 0x83, 0x63, 0xA3, 0xB3, 0x87, - 0x57, 0x97, 0xD7, 0x27, 0x0B, 0x8B, 0x5B, 0x2B, 0xAB, 0xCF, 0x1F, 0x9F, - 0x7F, 0xBF, 0xB0, 0xF0, 0xB4, 0x88, 0xD8, 0x8C, 0xCC, 0xDC, 0xAC, 0xEC, - 0x3C, 0xBC, 0xFC, 0xC1, 0x31, 0xF1, 0xF5, 0x0D, 0x4D, 0x8D, 0x9D, 0xDD, - 0x6D, 0xED, 0x3D, 0xFD, 0x82, 0xE2, 0x32, 0x72, 0xD6, 0xE6, 0xF6, 0xCA, - 0xBA, 0x8E, 0xCE, 0x1E, 0x5E, 0x9E, 0xAE, 0xEE, 0x3E, 0xC3, 0x93, 0xD3, - 0xE3, 0x33, 0x73, 0xF3, 0xC7, 0x67, 0xA7, 0xE7, 0x37, 0xB7, 0xF7, 0xCB, - 0xDB, 0xEB, 0x3B, 0x7B, 0xBB, 0xFB, 0x0F, 0x4F, 0x8F, 0x5F, 0xDF, 0x6F, - 0xAF, 0xEF, 0x3F, 0xFF -}; - -static const uint8_t huff_a64_cb[8] = { 4, 9, 1, 7, 12, 36, 63, 2 }; - -static const uint8_t huff_a64_xlat[121] = { - 0x00, 0x10, 0x20, 0xE0, 0xF0, 0x02, 0x0E, 0xEF, 0x30, 0x01, 0x11, 0x21, - 0x31, 0xF1, 0x12, 0xF2, 0x1E, 0xEE, 0xDF, 0xFF, 0x40, 0xC0, 0xD0, 0xD1, - 0xE1, 0x22, 0x32, 0x42, 0xD2, 0xE2, 0x03, 0x13, 0x23, 0xB3, 0xC3, 0xE3, - 0xF3, 0xE4, 0x05, 0xF5, 0x2B, 0x0C, 0xFC, 0x1D, 0x2D, 0xBD, 0xDD, 0xFD, - 0x2E, 0x4E, 0xDE, 0xFE, 0x0F, 0x1F, 0x2F, 0x3F, 0x50, 0xB0, 0x41, 0x51, - 0xB1, 0xC1, 0x52, 0xB2, 0xC2, 0x33, 0x43, 0x53, 0xD3, 0x04, 0x14, 0x24, - 0x34, 0x44, 0x54, 0xB4, 0xC4, 0xD4, 0xF4, 0x15, 0x25, 0x35, 0x45, 0x55, - 0xB5, 0xC5, 0xD5, 0xE5, 0x0B, 0x1B, 0x3B, 0x4B, 0x5B, 0xBB, 0xCB, 0xDB, - 0xEB, 0xFB, 0x1C, 0x2C, 0x3C, 0x4C, 0x5C, 0xBC, 0xCC, 0xDC, 0xEC, 0x0D, - 0x3D, 0x4D, 0x5D, 0xCD, 0xED, 0x3E, 0x5E, 0xBE, 0xCE, 0x4F, 0xCF, 0x5F, - 0xBF -}; - -static const uint8_t huff_a65_cb[8] = { 2, 7, 3, 0, 1, 3, 4, 4 }; - -static const uint8_t huff_a65_xlat[15] = { - 0, 1, 15, 14, 2, 3, 13, 4, 6, 10, 12, 5, 7, 9, 11 -}; - -static const uint8_t huff_a66_cb[11] = { 2, 10, 1, 2, 2, 6, 8, 6, 3, 1, 2 }; - -static const uint8_t huff_a66_xlat[31] = { - 0, 1, 31, 2, 30, 3, 4, 15, 17, 28, 29, 5, 6, 7, 8, 24, - 25, 26, 27, 9, 10, 11, 21, 22, 23, 12, 19, 20, 13, 14, 18 -}; - -static const uint8_t huff_a67_cb[10] = { 2, 9, 1, 1, 3, 4, 6, 13, 25, 10 }; - -static const uint8_t huff_a67_xlat[63] = { - 0, 1, 2, 62, 63, 3, 4, 60, 61, 5, 6, 7, 57, 58, 59, 8, - 9, 10, 11, 12, 13, 26, 38, 52, 53, 54, 55, 56, 14, 15, 16, 17, - 18, 19, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 39, 45, 46, - 47, 48, 49, 50, 51, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44 -}; - -static const uint8_t huff_a71_cb[5] = { 1, 3, 1, 1, 2 }; - -static const uint8_t huff_a72_cb[12] = { - 2, 11, 1, 0, 4, 8, 3, 8, 24, 17, 12, 4 -}; - -static const uint8_t huff_a72_xlat[81] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x50, 0x44, 0x14, 0x54, 0x41, 0x11, 0x05, - 0x15, 0x51, 0x45, 0x55, 0x80, 0x90, 0x20, 0x64, 0x08, 0x19, 0x02, 0x06, - 0x60, 0x84, 0x94, 0x24, 0x48, 0x18, 0x58, 0x81, 0x91, 0x21, 0x61, 0x85, - 0x95, 0x25, 0x65, 0x09, 0x49, 0x59, 0x42, 0x12, 0x52, 0x46, 0x16, 0x56, - 0xA0, 0xA4, 0x98, 0x28, 0x68, 0xA1, 0xA5, 0x99, 0x29, 0x69, 0x96, 0x26, - 0x66, 0x0A, 0x4A, 0x1A, 0x5A, 0x88, 0xA8, 0x89, 0xA9, 0x82, 0x92, 0x22, - 0x62, 0x86, 0xA6, 0x2A, 0x6A, 0xA2, 0x8A, 0x9A, 0xAA -}; - -static const uint8_t huff_a73_cb[11] = { 2, 10, 1, 1, 5, 2, 8, 7, 13, 8, 4 }; - -static const uint8_t huff_a73_xlat[49] = { - 0x00, 0x08, 0x38, 0x01, 0x39, 0x07, 0x0F, 0x09, 0x3F, 0x10, 0x30, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x17, 0x11, 0x0A, 0x32, 0x0D, 0x16, 0x3E, 0x37, - 0x18, 0x28, 0x19, 0x29, 0x12, 0x2A, 0x03, 0x3B, 0x05, 0x15, 0x1E, 0x1F, - 0x2F, 0x1A, 0x0B, 0x2B, 0x33, 0x35, 0x3D, 0x2E, 0x36, 0x13, 0x1B, 0x1D, - 0x2D -}; - -static const uint8_t huff_a74_cb[14] = { - 1, 12, 1, 0, 0, 4, 0, 4, 5, 9, 30, 45, 21, 2 -}; - -static const uint8_t huff_a74_xlat[121] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x11, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x02, - 0xF2, 0x0E, 0x21, 0xE1, 0x12, 0xE2, 0x1E, 0x2E, 0xFE, 0x2F, 0xEF, 0x30, - 0x50, 0xB0, 0xC0, 0xD0, 0x31, 0xB1, 0xD1, 0x22, 0xD2, 0x03, 0x13, 0xE3, - 0xF3, 0xF4, 0x05, 0xE5, 0xF5, 0x0B, 0x1B, 0x0C, 0x0D, 0x1D, 0x2D, 0xFD, - 0x3E, 0xEE, 0x3F, 0x5F, 0xDF, 0x40, 0x41, 0x51, 0xC1, 0x32, 0x42, 0x52, - 0xB2, 0xC2, 0x23, 0x33, 0xB3, 0xC3, 0xD3, 0x04, 0x14, 0x24, 0xD4, 0xE4, - 0x15, 0x25, 0xC5, 0xD5, 0x2B, 0x3B, 0xEB, 0xFB, 0x1C, 0x2C, 0x3C, 0x5C, - 0xEC, 0xFC, 0x3D, 0x5D, 0xDD, 0xED, 0x4E, 0x5E, 0xBE, 0xCE, 0xDE, 0x4F, - 0xBF, 0xCF, 0x43, 0x53, 0x34, 0x54, 0xB4, 0xC4, 0x35, 0x45, 0x55, 0xB5, - 0x4B, 0x5B, 0xCB, 0xDB, 0x4C, 0xBC, 0xCC, 0xDC, 0x4D, 0xBD, 0xCD, 0x44, - 0xBB -}; - -static const uint8_t huff_a75_cb[7] = { 2, 6, 1, 3, 3, 4, 4 }; - -static const uint8_t huff_a75_xlat[15] = { - 0, 1, 14, 15, 2, 3, 13, 4, 6, 10, 12, 5, 7, 9, 11 -}; - -static const uint8_t huff_a76_cb[12] = { - 3, 12, 1, 3, 4, 8, 10, 36, 60, 78, 48, 8 -}; - -static const uint8_t huff_a76_xlat[256] = { - 0x00, 0x10, 0x01, 0x11, 0x20, 0x21, 0x02, 0x12, 0x30, 0x31, 0x41, 0x22, - 0x03, 0x13, 0x23, 0x14, 0x40, 0x51, 0x61, 0x32, 0x42, 0x33, 0x04, 0x24, - 0x15, 0x16, 0x50, 0x60, 0xD0, 0x71, 0x81, 0xD1, 0xE1, 0xF1, 0x52, 0x62, - 0x72, 0xD2, 0x43, 0x53, 0x63, 0xD3, 0x34, 0x44, 0x54, 0x05, 0x25, 0x35, - 0x45, 0x06, 0x26, 0x36, 0x17, 0x27, 0x18, 0x0D, 0x1D, 0x2D, 0x3D, 0x1E, - 0x2E, 0x1F, 0x70, 0x80, 0xE0, 0xF0, 0x91, 0xA1, 0xC1, 0x82, 0x92, 0xC2, - 0xE2, 0xF2, 0x73, 0x83, 0x93, 0xE3, 0xF3, 0x64, 0x74, 0x84, 0xD4, 0xE4, - 0xF4, 0x55, 0x65, 0xD5, 0xE5, 0xF5, 0x46, 0x56, 0x66, 0xD6, 0x07, 0x37, - 0x47, 0x57, 0x08, 0x28, 0x38, 0x48, 0x19, 0x29, 0x39, 0x1A, 0x2A, 0x1B, - 0x1C, 0x2C, 0x3C, 0x4D, 0x5D, 0x6D, 0x0E, 0x3E, 0x4E, 0x5E, 0x0F, 0x2F, - 0x3F, 0x4F, 0x90, 0xA0, 0xB0, 0xC0, 0xB1, 0xA2, 0xB2, 0xA3, 0xB3, 0xC3, - 0x94, 0xA4, 0xB4, 0xC4, 0x75, 0x85, 0x95, 0xA5, 0xC5, 0x76, 0x86, 0x96, - 0xE6, 0xF6, 0x67, 0x77, 0x87, 0xD7, 0xE7, 0xF7, 0x58, 0x68, 0x78, 0x88, - 0xD8, 0xE8, 0xF8, 0x09, 0x49, 0x59, 0x69, 0xD9, 0xE9, 0xF9, 0x0A, 0x3A, - 0x4A, 0x5A, 0xDA, 0xEA, 0x0B, 0x2B, 0x3B, 0x4B, 0xDB, 0x0C, 0x4C, 0x5C, - 0x6C, 0xDC, 0x7D, 0x8D, 0x9D, 0xAD, 0xBD, 0xCD, 0x6E, 0x7E, 0x8E, 0x9E, - 0xAE, 0xBE, 0x5F, 0x6F, 0x7F, 0x8F, 0x9F, 0xAF, 0xB5, 0xA6, 0xB6, 0xC6, - 0x97, 0xA7, 0xC7, 0x98, 0xA8, 0xB8, 0xC8, 0x79, 0x89, 0x99, 0xA9, 0xB9, - 0xC9, 0x6A, 0x7A, 0x8A, 0x9A, 0xAA, 0xCA, 0xFA, 0x5B, 0x6B, 0x7B, 0x8B, - 0xCB, 0xEB, 0xFB, 0x7C, 0x8C, 0x9C, 0xAC, 0xBC, 0xEC, 0xFC, 0xDD, 0xED, - 0xFD, 0xCE, 0xDE, 0xEE, 0xFE, 0xBF, 0xCF, 0xDF, 0xB7, 0xBA, 0x9B, 0xAB, - 0xBB, 0xCC, 0xEF, 0xFF -}; - -static const uint8_t huff_b01_cb[14] = { - 1, 12, 1, 0, 0, 2, 6, 0, 11, 13, 12, 24, 4, 8 -}; - -static const uint8_t huff_b01_xlat[81] = { - 0x00, 0x01, 0x03, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x50, 0xD0, 0x70, - 0xF0, 0x34, 0x1C, 0x05, 0x0D, 0x13, 0x07, 0x0F, 0x44, 0xC4, 0x14, 0x4C, - 0xCC, 0x3C, 0x41, 0xC1, 0x11, 0x31, 0x43, 0xC3, 0x33, 0x54, 0x74, 0xDC, - 0xFC, 0x71, 0x15, 0x4D, 0x1D, 0xD3, 0xC7, 0x37, 0x3F, 0xD4, 0xF4, 0x5C, - 0x7C, 0x51, 0xD1, 0xF1, 0x45, 0xC5, 0x55, 0x35, 0xCD, 0xDD, 0x3D, 0x53, - 0x73, 0xF3, 0x47, 0x17, 0x77, 0x4F, 0xCF, 0x1F, 0xFF, 0xF5, 0x7D, 0xD7, - 0x5F, 0xD5, 0x75, 0x5D, 0xFD, 0x57, 0xF7, 0xDF, 0x7F -}; - -static const uint8_t huff_b02_cb[14] = { - 1, 12, 1, 0, 0, 4, 0, 8, 4, 9, 19, 13, 13, 10 -}; - -static const uint8_t huff_b02_xlat[81] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x50, 0x44, 0x14, 0x54, 0x41, 0x11, 0x05, - 0x15, 0x80, 0x51, 0x45, 0x55, 0x90, 0x20, 0x60, 0x24, 0x08, 0x18, 0x09, - 0x02, 0x06, 0x84, 0x94, 0x64, 0x48, 0x58, 0x81, 0x91, 0x21, 0x61, 0x95, - 0x25, 0x65, 0x19, 0x59, 0x42, 0x12, 0x46, 0x16, 0x56, 0xA0, 0xA4, 0x28, - 0x68, 0x85, 0xA5, 0x49, 0x29, 0x69, 0x52, 0x0A, 0x1A, 0x5A, 0x88, 0x98, - 0xA1, 0x89, 0x99, 0xA9, 0x22, 0x62, 0x96, 0x26, 0x66, 0x4A, 0x6A, 0xA8, - 0x82, 0x92, 0xA2, 0x86, 0xA6, 0x8A, 0x9A, 0x2A, 0xAA -}; - -static const uint8_t huff_b03_cb[11] = { 1, 9, 1, 0, 0, 4, 0, 5, 12, 13, 14 }; - -static const uint8_t huff_b03_xlat[49] = { - 0x00, 0x08, 0x38, 0x01, 0x07, 0x30, 0x09, 0x39, 0x0F, 0x3F, 0x10, 0x18, - 0x28, 0x31, 0x02, 0x3A, 0x03, 0x05, 0x06, 0x0E, 0x17, 0x37, 0x11, 0x19, - 0x29, 0x0A, 0x32, 0x0B, 0x3B, 0x0D, 0x15, 0x3D, 0x3E, 0x1F, 0x2F, 0x12, - 0x1A, 0x2A, 0x13, 0x1B, 0x2B, 0x33, 0x1D, 0x2D, 0x35, 0x16, 0x1E, 0x2E, - 0x36 -}; - -static const uint8_t huff_b04_cb[12] = { - 2, 11, 1, 0, 4, 4, 5, 9, 30, 45, 21, 2 -}; - -static const uint8_t huff_b04_xlat[121] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x11, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x02, - 0xF2, 0x0E, 0x21, 0xE1, 0x12, 0xE2, 0x1E, 0x2E, 0xFE, 0x2F, 0xEF, 0x30, - 0x50, 0xB0, 0xC0, 0xD0, 0x31, 0xB1, 0xD1, 0x22, 0xD2, 0x03, 0x13, 0xE3, - 0xF3, 0xF4, 0x05, 0xE5, 0xF5, 0x0B, 0x1B, 0x0C, 0x0D, 0x1D, 0x2D, 0xFD, - 0x3E, 0xEE, 0x3F, 0x5F, 0xDF, 0x40, 0x41, 0x51, 0xC1, 0x32, 0x42, 0x52, - 0xB2, 0xC2, 0x23, 0x33, 0xB3, 0xC3, 0xD3, 0x04, 0x14, 0x24, 0xD4, 0xE4, - 0x15, 0x25, 0xC5, 0xD5, 0x2B, 0x3B, 0xEB, 0xFB, 0x1C, 0x2C, 0x3C, 0x5C, - 0xEC, 0xFC, 0x3D, 0x5D, 0xDD, 0xED, 0x4E, 0x5E, 0xBE, 0xCE, 0xDE, 0x4F, - 0xBF, 0xCF, 0x43, 0x53, 0x34, 0x54, 0xB4, 0xC4, 0x35, 0x45, 0x55, 0xB5, - 0x4B, 0x5B, 0xCB, 0xDB, 0x4C, 0xBC, 0xCC, 0xDC, 0x4D, 0xBD, 0xCD, 0x44, - 0xBB -}; - -static const uint8_t huff_b05_cb[11] = { - 3, 11, 1, 4, 4, 4, 12, 30, 73, 75, 22 -}; - -static const uint8_t huff_b05_xlat[225] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x11, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x02, - 0x0E, 0x30, 0xD0, 0x21, 0xE1, 0x12, 0xF2, 0x03, 0x0D, 0x1E, 0xFE, 0x2F, - 0xEF, 0x40, 0x60, 0x70, 0x90, 0xA0, 0xC0, 0x31, 0xD1, 0x22, 0x32, 0xD2, - 0xE2, 0x13, 0x23, 0xE3, 0xF3, 0x04, 0x06, 0x07, 0x09, 0x0A, 0x0C, 0x1D, - 0x2D, 0xFD, 0x2E, 0x3E, 0xEE, 0x3F, 0xDF, 0x50, 0xB0, 0x41, 0x51, 0x61, - 0x71, 0x91, 0xA1, 0xB1, 0xC1, 0x42, 0x62, 0x72, 0x92, 0xA2, 0xC2, 0x33, - 0x93, 0xA3, 0xD3, 0x14, 0x24, 0xE4, 0xF4, 0x05, 0x15, 0xF5, 0x16, 0x26, - 0xD6, 0xE6, 0xF6, 0x17, 0x27, 0xD7, 0xE7, 0xF7, 0x19, 0x29, 0x39, 0xE9, - 0xF9, 0x1A, 0x2A, 0xEA, 0xFA, 0x0B, 0x1B, 0xFB, 0x1C, 0x2C, 0xEC, 0xFC, - 0x3D, 0x7D, 0x9D, 0xDD, 0xED, 0x4E, 0x6E, 0x7E, 0x9E, 0xAE, 0xCE, 0xDE, - 0x4F, 0x5F, 0x6F, 0x7F, 0x9F, 0xAF, 0xBF, 0xCF, 0x52, 0xB2, 0x43, 0x53, - 0x63, 0x73, 0xB3, 0xC3, 0x34, 0x44, 0x64, 0x74, 0x94, 0xA4, 0xB4, 0xC4, - 0xD4, 0x25, 0x35, 0x65, 0x75, 0x95, 0xA5, 0xD5, 0xE5, 0x36, 0x46, 0x56, - 0x66, 0xA6, 0xB6, 0xC6, 0x37, 0x47, 0x57, 0xB7, 0xC7, 0x49, 0x59, 0x69, - 0xB9, 0xC9, 0xD9, 0x3A, 0x4A, 0x5A, 0x6A, 0xAA, 0xBA, 0xCA, 0xDA, 0x2B, - 0x3B, 0x6B, 0x7B, 0x9B, 0xAB, 0xDB, 0xEB, 0x3C, 0x4C, 0x6C, 0x7C, 0x9C, - 0xAC, 0xCC, 0xDC, 0x4D, 0x5D, 0x6D, 0xAD, 0xBD, 0xCD, 0x5E, 0xBE, 0x54, - 0x45, 0x55, 0xB5, 0xC5, 0x76, 0x96, 0x67, 0x77, 0x97, 0xA7, 0x79, 0x99, - 0xA9, 0x7A, 0x9A, 0x4B, 0x5B, 0xBB, 0xCB, 0x5C, 0xBC -}; - -static const uint8_t huff_b07_cb[9] = { 3, 9, 3, 2, 4, 8, 23, 13, 10 }; - -static const uint8_t huff_b07_xlat[63] = { - 0, 1, 63, 2, 62, 3, 4, 60, 61, 5, 6, 7, 8, 56, 57, 58, - 59, 9, 10, 11, 12, 25, 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, - 37, 38, 39, 51, 52, 53, 54, 55, 13, 14, 15, 16, 17, 18, 19, 45, - 46, 47, 48, 49, 50, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44 -}; - -static const uint8_t huff_b12_cb[10] = { 3, 10, 1, 3, 12, 0, 30, 9, 18, 8 }; - -static const uint8_t huff_b12_xlat[81] = { - 0x00, 0x40, 0x04, 0x01, 0x10, 0x50, 0x44, 0x14, 0x54, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x80, 0x90, 0x20, 0x60, 0x84, 0x94, 0x24, 0x64, - 0x08, 0x48, 0x18, 0x81, 0x91, 0x61, 0x85, 0x95, 0x25, 0x65, 0x09, 0x49, - 0x19, 0x59, 0x02, 0x42, 0x12, 0x52, 0x06, 0x46, 0x16, 0x56, 0xA4, 0x58, - 0x68, 0x21, 0xA5, 0x29, 0x69, 0x1A, 0x5A, 0xA0, 0x88, 0x98, 0x28, 0xA1, - 0x89, 0x99, 0xA9, 0x92, 0x22, 0x62, 0x86, 0x96, 0x26, 0x66, 0x0A, 0x4A, - 0x6A, 0xA8, 0x82, 0xA2, 0xA6, 0x8A, 0x9A, 0x2A, 0xAA -}; - -static const uint8_t huff_b14_cb[14] = { - 1, 12, 1, 0, 0, 4, 0, 3, 5, 16, 28, 34, 26, 4 -}; - -static const uint8_t huff_b14_xlat[121] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0xF1, 0x1F, 0xFF, 0x20, 0xE0, 0x11, 0x02, - 0x0E, 0x30, 0x50, 0xB0, 0xD0, 0x21, 0xE1, 0x12, 0xF2, 0x03, 0x05, 0x0B, - 0x0D, 0x1E, 0xFE, 0x2F, 0xEF, 0x40, 0xC0, 0x31, 0x51, 0xB1, 0xC1, 0xD1, - 0x22, 0x52, 0xE2, 0x13, 0xF3, 0x04, 0x15, 0xF5, 0x1B, 0xEB, 0xFB, 0x0C, - 0x1D, 0xFD, 0x2E, 0x5E, 0xEE, 0x3F, 0x5F, 0xBF, 0xDF, 0x41, 0x32, 0x42, - 0xB2, 0xD2, 0x23, 0x53, 0xB3, 0xE3, 0x14, 0x24, 0xE4, 0xF4, 0x25, 0x35, - 0xD5, 0xE5, 0x2B, 0x3B, 0xDB, 0x1C, 0x2C, 0xBC, 0xEC, 0xFC, 0x2D, 0xBD, - 0xED, 0x3E, 0x4E, 0xBE, 0xDE, 0x4F, 0xCF, 0xC2, 0x33, 0x43, 0xC3, 0xD3, - 0x34, 0x44, 0x54, 0xB4, 0xD4, 0x45, 0x55, 0xC5, 0x4B, 0xCB, 0x3C, 0x4C, - 0x5C, 0xCC, 0xDC, 0x3D, 0x4D, 0x5D, 0xCD, 0xDD, 0xCE, 0xC4, 0xB5, 0x5B, - 0xBB -}; - -static const uint8_t huff_b16_cb[11] = { - 4, 12, 4, 4, 9, 13, 37, 76, 72, 39, 2 -}; - -static const uint8_t huff_b16_xlat[256] = { - 0x00, 0x10, 0x01, 0x11, 0x20, 0x21, 0x02, 0x12, 0x30, 0x31, 0x41, 0x22, - 0x32, 0x03, 0x13, 0x23, 0x14, 0x40, 0x51, 0x61, 0x42, 0x52, 0x33, 0x43, - 0x04, 0x24, 0x34, 0x15, 0x25, 0x16, 0x50, 0x60, 0x70, 0x71, 0x81, 0xD1, - 0xE1, 0x62, 0x72, 0x82, 0xD2, 0x53, 0x63, 0x73, 0xD3, 0x44, 0x54, 0x05, - 0x35, 0x45, 0x55, 0x06, 0x26, 0x36, 0x07, 0x17, 0x27, 0x37, 0x18, 0x28, - 0x19, 0x1D, 0x2D, 0x3D, 0x1E, 0x2E, 0x1F, 0x80, 0x90, 0xD0, 0xE0, 0xF0, - 0x91, 0xA1, 0xB1, 0xC1, 0xF1, 0x92, 0xA2, 0xB2, 0xC2, 0xE2, 0xF2, 0x83, - 0x93, 0xA3, 0xC3, 0xE3, 0xF3, 0x64, 0x74, 0x84, 0x94, 0xD4, 0xE4, 0xF4, - 0x65, 0x75, 0x85, 0xD5, 0xE5, 0x46, 0x56, 0x66, 0x76, 0xD6, 0xE6, 0x47, - 0x57, 0x67, 0xD7, 0x08, 0x38, 0x48, 0x58, 0x09, 0x29, 0x39, 0x49, 0x0A, - 0x1A, 0x2A, 0x3A, 0x1B, 0x2B, 0x0C, 0x1C, 0x2C, 0x3C, 0x0D, 0x4D, 0x5D, - 0x6D, 0x7D, 0x0E, 0x3E, 0x4E, 0x5E, 0x6E, 0x0F, 0x2F, 0x3F, 0x4F, 0xA0, - 0xB0, 0xC0, 0xB3, 0xA4, 0xB4, 0xC4, 0x95, 0xA5, 0xB5, 0xC5, 0xF5, 0x86, - 0x96, 0xA6, 0xB6, 0xC6, 0xF6, 0x77, 0x87, 0x97, 0xA7, 0xC7, 0xE7, 0xF7, - 0x68, 0x78, 0x88, 0x98, 0xD8, 0xE8, 0xF8, 0x59, 0x69, 0x79, 0x89, 0xD9, - 0xE9, 0xF9, 0x4A, 0x5A, 0x6A, 0x7A, 0xDA, 0xEA, 0x0B, 0x3B, 0x4B, 0x5B, - 0xDB, 0xEB, 0x4C, 0x5C, 0x6C, 0x7C, 0x8C, 0xDC, 0x8D, 0x9D, 0xAD, 0xBD, - 0xCD, 0x7E, 0x8E, 0x9E, 0xAE, 0xBE, 0x5F, 0x6F, 0x7F, 0x8F, 0x9F, 0xB7, - 0xA8, 0xB8, 0xC8, 0x99, 0xA9, 0xB9, 0xC9, 0x8A, 0x9A, 0xAA, 0xBA, 0xCA, - 0xFA, 0x6B, 0x7B, 0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0xFB, 0x9C, 0xAC, 0xBC, - 0xCC, 0xEC, 0xFC, 0xDD, 0xED, 0xFD, 0xCE, 0xDE, 0xEE, 0xFE, 0xAF, 0xBF, - 0xCF, 0xDF, 0xEF, 0xFF -}; - -static const uint8_t huff_b26_cb[12] = { - 3, 12, 2, 2, 4, 5, 11, 26, 67, 78, 51, 10 -}; - -static const uint8_t huff_b26_xlat[256] = { - 0x00, 0x01, 0x10, 0x11, 0x20, 0x21, 0x02, 0x12, 0x30, 0x31, 0x22, 0x03, - 0x13, 0x40, 0x41, 0x51, 0x32, 0x42, 0x23, 0x33, 0x04, 0x14, 0x24, 0x15, - 0x50, 0x61, 0x71, 0xD1, 0xE1, 0x52, 0x62, 0xD2, 0x43, 0x53, 0xD3, 0x34, - 0x44, 0x05, 0x25, 0x35, 0x06, 0x16, 0x26, 0x17, 0x18, 0x1D, 0x2D, 0x3D, - 0x1E, 0x2E, 0x60, 0x70, 0x80, 0xD0, 0xE0, 0xF0, 0x81, 0x91, 0xA1, 0xC1, - 0xF1, 0x72, 0x82, 0x92, 0xC2, 0xE2, 0xF2, 0x63, 0x73, 0xE3, 0xF3, 0x54, - 0x64, 0x74, 0xD4, 0xE4, 0xF4, 0x45, 0x55, 0x65, 0xD5, 0xE5, 0xF5, 0x36, - 0x46, 0x56, 0xD6, 0xE6, 0x07, 0x27, 0x37, 0x47, 0xD7, 0x08, 0x28, 0x38, - 0x19, 0x29, 0x1A, 0x1B, 0x1C, 0x2C, 0x0D, 0x4D, 0x5D, 0x6D, 0x7D, 0x0E, - 0x3E, 0x4E, 0x5E, 0x6E, 0x0F, 0x1F, 0x2F, 0x3F, 0x4F, 0x90, 0xA0, 0xC0, - 0xB1, 0xA2, 0xB2, 0x83, 0x93, 0xA3, 0xB3, 0xC3, 0x84, 0x94, 0xA4, 0xC4, - 0x75, 0x85, 0x95, 0xC5, 0x66, 0x76, 0x86, 0x96, 0xC6, 0xF6, 0x57, 0x67, - 0x77, 0xE7, 0xF7, 0x48, 0x58, 0x68, 0x78, 0xD8, 0xE8, 0xF8, 0x09, 0x39, - 0x49, 0x59, 0xD9, 0xE9, 0xF9, 0x0A, 0x2A, 0x3A, 0x4A, 0xDA, 0xEA, 0x0B, - 0x2B, 0x3B, 0xDB, 0xEB, 0x0C, 0x3C, 0x4C, 0x5C, 0x6C, 0xDC, 0x8D, 0x9D, - 0xAD, 0xBD, 0xCD, 0x7E, 0x8E, 0x9E, 0xAE, 0xBE, 0xCE, 0x5F, 0x6F, 0x7F, - 0x8F, 0x9F, 0xAF, 0xB0, 0xB4, 0xA5, 0xB5, 0xA6, 0xB6, 0x87, 0x97, 0xA7, - 0xB7, 0xC7, 0x88, 0x98, 0xA8, 0xC8, 0x69, 0x79, 0x89, 0x99, 0xA9, 0xC9, - 0x5A, 0x6A, 0x7A, 0x9A, 0xCA, 0xFA, 0x4B, 0x5B, 0x6B, 0x7B, 0xCB, 0xFB, - 0x7C, 0x8C, 0x9C, 0xAC, 0xBC, 0xCC, 0xEC, 0xFC, 0xDD, 0xED, 0xFD, 0xDE, - 0xEE, 0xFE, 0xBF, 0xCF, 0xDF, 0xEF, 0xB8, 0xB9, 0x8A, 0xAA, 0xBA, 0x8B, - 0x9B, 0xAB, 0xBB, 0xFF -}; - -static const uint8_t huff_b32_cb[12] = { - 2, 11, 1, 0, 4, 6, 7, 10, 22, 11, 16, 4 -}; - -static const uint8_t huff_b32_xlat[81] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x50, 0x44, 0x14, 0x41, 0x11, 0x05, 0x80, - 0x54, 0x51, 0x45, 0x15, 0x55, 0x02, 0x90, 0x20, 0x60, 0x84, 0x24, 0x08, - 0x18, 0x09, 0x12, 0x06, 0xA0, 0x94, 0x64, 0x48, 0x58, 0x81, 0x91, 0x21, - 0x61, 0x85, 0x95, 0x25, 0x65, 0x49, 0x19, 0x59, 0x42, 0x52, 0x46, 0x16, - 0x56, 0x0A, 0xA4, 0x28, 0x68, 0xA1, 0xA5, 0x29, 0x69, 0x26, 0x4A, 0x1A, - 0x5A, 0x88, 0x98, 0xA8, 0x89, 0x99, 0xA9, 0x82, 0x92, 0x22, 0x62, 0x86, - 0x96, 0x66, 0x9A, 0x2A, 0x6A, 0xA2, 0xA6, 0x8A, 0xAA -}; - -static const uint8_t huff_b33_cb[13] = { - 2, 12, 1, 0, 0, 4, 11, 8, 28, 92, 97, 13, 2 -}; - -static const uint8_t huff_b33_xlat[256] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x50, 0x44, 0x14, 0x54, 0x41, 0x11, 0x51, - 0x05, 0x45, 0x15, 0x55, 0x20, 0x95, 0x65, 0x49, 0x59, 0x52, 0x46, 0x16, - 0x80, 0x90, 0x60, 0x84, 0x94, 0x24, 0x64, 0xA4, 0x08, 0x48, 0x18, 0x58, - 0x81, 0x91, 0x21, 0x61, 0x85, 0x25, 0x09, 0x19, 0x69, 0x02, 0x42, 0x12, - 0x06, 0x56, 0x5A, 0x57, 0xD0, 0x74, 0x68, 0x5C, 0xC1, 0xD5, 0xA5, 0xE5, - 0x75, 0xB5, 0xF5, 0x99, 0xD9, 0xA9, 0xE9, 0x79, 0xB9, 0xF9, 0x1D, 0x5D, - 0x9D, 0xDD, 0x6D, 0xAD, 0xED, 0x7D, 0xBD, 0xFD, 0x82, 0x92, 0xD2, 0x62, - 0x96, 0xD6, 0x26, 0x66, 0xA6, 0xE6, 0x76, 0xB6, 0xF6, 0x0A, 0x4A, 0x1A, - 0x9A, 0xDA, 0x2A, 0x6A, 0xAA, 0xEA, 0x7A, 0xBA, 0xFA, 0x5E, 0x9E, 0xDE, - 0x6E, 0xAE, 0xEE, 0x7E, 0xBE, 0xFE, 0x03, 0x13, 0x53, 0x17, 0x97, 0xD7, - 0x67, 0xA7, 0xE7, 0x77, 0xB7, 0xF7, 0x5B, 0x9B, 0xDB, 0x6B, 0xAB, 0xEB, - 0x7B, 0xBB, 0xFB, 0x5F, 0x9F, 0xDF, 0x6F, 0xAF, 0xEF, 0x7F, 0xBF, 0xFF, - 0xC0, 0xA0, 0xE0, 0x30, 0xC4, 0xD4, 0xE4, 0x34, 0xB4, 0xF4, 0x88, 0xC8, - 0x98, 0xD8, 0x28, 0xA8, 0xE8, 0x38, 0x78, 0xB8, 0xF8, 0x0C, 0x4C, 0x1C, - 0x9C, 0xDC, 0x6C, 0xAC, 0xEC, 0x7C, 0xBC, 0xFC, 0xD1, 0xA1, 0xE1, 0x31, - 0x71, 0xB1, 0xF1, 0xC5, 0x35, 0x89, 0xC9, 0x29, 0x39, 0x0D, 0x4D, 0x8D, - 0xCD, 0x2D, 0x3D, 0x22, 0xA2, 0xE2, 0x72, 0xB2, 0xF2, 0x86, 0xC6, 0x36, - 0x8A, 0xCA, 0x3A, 0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x2E, 0x3E, 0x43, 0x83, - 0x93, 0xD3, 0x23, 0x63, 0xA3, 0xE3, 0x73, 0xB3, 0xF3, 0x07, 0x47, 0x87, - 0xC7, 0x27, 0x37, 0x4B, 0x8B, 0xCB, 0x1B, 0x2B, 0x3B, 0x4F, 0x8F, 0xCF, - 0x1F, 0x70, 0xB0, 0xF0, 0x8C, 0xCC, 0x2C, 0x3C, 0xC2, 0x32, 0xC3, 0x0F, - 0x2F, 0x3F, 0x33, 0x0B -}; - -static const uint8_t huff_b35_cb[14] = { - 1, 12, 1, 0, 0, 0, 4, 6, 6, 14, 42, 63, 59, 30 -}; - -static const uint8_t huff_b35_xlat[225] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x11, 0xF1, 0x02, 0x0E, 0x1F, 0xFF, 0x20, - 0xE0, 0x21, 0xF2, 0xFE, 0xEF, 0x30, 0xD0, 0xE1, 0x12, 0x22, 0xE2, 0x03, - 0x0D, 0x1D, 0x1E, 0x2E, 0xEE, 0x2F, 0xDF, 0x40, 0x60, 0x70, 0x90, 0xA0, - 0xB0, 0xC0, 0x31, 0x71, 0x91, 0xC1, 0xD1, 0x32, 0xD2, 0x13, 0xE3, 0xF3, - 0x04, 0x05, 0x06, 0x07, 0x17, 0xF7, 0x09, 0x19, 0x0A, 0x1A, 0xFA, 0x0C, - 0x1C, 0x2D, 0xED, 0xFD, 0x3E, 0x7E, 0xDE, 0x3F, 0x6F, 0x7F, 0x9F, 0xAF, - 0xCF, 0x50, 0x41, 0x51, 0x61, 0xA1, 0xB1, 0x62, 0x72, 0x92, 0xA2, 0xC2, - 0x23, 0x33, 0x63, 0x73, 0x93, 0xA3, 0xD3, 0x14, 0x24, 0x34, 0xD4, 0xE4, - 0xF4, 0x15, 0xF5, 0x16, 0x26, 0xD6, 0xE6, 0xF6, 0x27, 0x37, 0x47, 0xE7, - 0x29, 0x39, 0xC9, 0xD9, 0xE9, 0xF9, 0x2A, 0xEA, 0x0B, 0x1B, 0xFB, 0x2C, - 0x7C, 0xEC, 0xFC, 0x3D, 0x4D, 0x6D, 0x7D, 0xDD, 0x4E, 0x5E, 0x6E, 0x9E, - 0xAE, 0xCE, 0x4F, 0x5F, 0x42, 0x52, 0xB2, 0x43, 0xB3, 0xC3, 0x44, 0x64, - 0x74, 0x94, 0xA4, 0x25, 0x35, 0x65, 0x75, 0x95, 0xA5, 0xE5, 0x36, 0x46, - 0x66, 0x76, 0x96, 0xA6, 0xB6, 0xC6, 0x57, 0xA7, 0xB7, 0xC7, 0xD7, 0x59, - 0xA9, 0xB9, 0x3A, 0x4A, 0x6A, 0xCA, 0xDA, 0x2B, 0x3B, 0x6B, 0x9B, 0xAB, - 0xDB, 0xEB, 0x3C, 0x6C, 0x9C, 0xAC, 0xCC, 0xDC, 0x5D, 0x9D, 0xAD, 0xBD, - 0xCD, 0xBE, 0xBF, 0x53, 0x54, 0xB4, 0xC4, 0x45, 0x55, 0xB5, 0xC5, 0xD5, - 0x56, 0x67, 0x77, 0x97, 0x49, 0x69, 0x79, 0x99, 0x5A, 0x7A, 0x9A, 0xAA, - 0xBA, 0x4B, 0x5B, 0x7B, 0xBB, 0xCB, 0x4C, 0x5C, 0xBC -}; - -static const uint8_t huff_b37_cb[13] = { - 1, 11, 1, 0, 2, 0, 2, 2, 6, 17, 14, 13, 6 -}; - -static const uint8_t huff_b37_xlat[63] = { - 0, 1, 63, 2, 62, 3, 61, 4, 5, 6, 58, 59, 60, 7, 8, 9, - 10, 25, 26, 27, 28, 29, 34, 35, 37, 38, 39, 55, 56, 57, 11, 13, - 14, 15, 30, 31, 33, 36, 49, 50, 51, 52, 53, 54, 12, 16, 17, 18, - 19, 21, 41, 43, 44, 45, 46, 47, 48, 20, 22, 23, 24, 40, 42 -}; - -static const uint8_t huff_b41_cb[14] = { - 1, 12, 1, 0, 0, 1, 7, 0, 20, 4, 10, 24, 2, 12 -}; - -static const uint8_t huff_b41_xlat[81] = { - 0x00, 0x01, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x03, 0x50, 0xD0, 0x70, - 0xF0, 0xC4, 0x14, 0x34, 0x4C, 0x1C, 0x3C, 0xC1, 0x11, 0x31, 0x05, 0x0D, - 0xC3, 0x13, 0x33, 0x07, 0x0F, 0x44, 0xCC, 0x41, 0x43, 0x54, 0x74, 0xDC, - 0xFC, 0x71, 0x15, 0x4D, 0x1D, 0x37, 0x3F, 0xD4, 0xF4, 0x5C, 0x7C, 0x51, - 0xD1, 0xF1, 0x45, 0xC5, 0x35, 0xCD, 0xDD, 0x3D, 0x53, 0xD3, 0x73, 0xF3, - 0x47, 0xC7, 0x17, 0x77, 0x4F, 0xCF, 0x1F, 0x55, 0xFF, 0xD5, 0x75, 0xF5, - 0x5D, 0x7D, 0xFD, 0x57, 0xD7, 0xF7, 0x5F, 0xDF, 0x7F -}; - -static const uint8_t huff_b42_cb[11] = { 1, 9, 1, 0, 1, 3, 2, 3, 7, 4, 4 }; - -static const uint8_t huff_b42_xlat[25] = { - 0x00, 0x07, 0x08, 0x38, 0x01, 0x39, 0x0F, 0x10, 0x09, 0x3F, 0x30, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x17, 0x11, 0x0A, 0x3E, 0x37, 0x12, 0x32, 0x16, - 0x36 -}; - -static const uint8_t huff_b43_cb[10] = { 2, 9, 1, 1, 3, 4, 9, 15, 12, 4 }; - -static const uint8_t huff_b43_xlat[49] = { - 0x00, 0x07, 0x08, 0x38, 0x01, 0x09, 0x39, 0x0F, 0x3F, 0x10, 0x30, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x17, 0x37, 0x18, 0x28, 0x11, 0x19, 0x29, 0x0A, - 0x03, 0x0B, 0x3B, 0x05, 0x0D, 0x3D, 0x3E, 0x1F, 0x2F, 0x12, 0x1A, 0x2A, - 0x32, 0x13, 0x33, 0x15, 0x35, 0x16, 0x1E, 0x2E, 0x36, 0x1B, 0x2B, 0x1D, - 0x2D -}; - -static const uint8_t huff_b47_cb[10] = { 2, 9, 1, 1, 3, 4, 6, 14, 22, 12 }; - -static const uint8_t huff_b47_xlat[63] = { - 0, 1, 2, 62, 63, 3, 4, 60, 61, 5, 6, 7, 57, 58, 59, 8, - 9, 10, 11, 12, 26, 27, 37, 38, 52, 53, 54, 55, 56, 13, 14, 15, - 16, 17, 18, 25, 28, 29, 30, 31, 33, 34, 35, 36, 39, 46, 47, 48, - 49, 50, 51, 19, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44, 45 -}; - -static const uint8_t huff_b52_cb[11] = { 1, 9, 1, 0, 1, 3, 2, 3, 7, 4, 4 }; - -static const uint8_t huff_b52_xlat[25] = { - 0x00, 0x01, 0x08, 0x38, 0x07, 0x39, 0x0F, 0x30, 0x09, 0x3F, 0x10, 0x31, - 0x02, 0x3A, 0x06, 0x0E, 0x17, 0x11, 0x0A, 0x3E, 0x37, 0x12, 0x32, 0x16, - 0x36 -}; - -static const uint8_t huff_b53_cb[7] = { 1, 5, 1, 1, 1, 0, 4 }; // same as b63!!! - -static const uint8_t huff_b53_xlat[7] = { 0, 7, 1, 2, 3, 5, 6 }; - -static const uint8_t huff_b56_cb[11] = { 1, 9, 1, 0, 2, 0, 2, 4, 11, 9, 2 }; - -static const uint8_t huff_b56_xlat[31] = { - 0, 1, 31, 2, 30, 3, 4, 13, 29, 5, 6, 7, 14, 15, 17, 18, - 19, 26, 27, 28, 8, 9, 12, 20, 21, 22, 23, 24, 25, 10, 11 -}; - -static const uint8_t huff_b62_cb[14] = { - 1, 12, 1, 0, 0, 2, 3, 5, 12, 14, 18, 15, 9, 2 -}; - -static const uint8_t huff_b62_xlat[81] = { - 0x00, 0x40, 0x01, 0x10, 0x04, 0x02, 0x80, 0x50, 0x90, 0x05, 0x06, 0x20, - 0x60, 0x44, 0x14, 0x54, 0x24, 0x08, 0x18, 0x41, 0x11, 0x15, 0x09, 0xA0, - 0x84, 0x94, 0x64, 0xA4, 0x28, 0x51, 0x45, 0x55, 0x19, 0x12, 0x16, 0x0A, - 0x1A, 0x48, 0x58, 0x68, 0x81, 0x91, 0x21, 0x61, 0x85, 0x95, 0x25, 0x65, - 0x49, 0x59, 0x29, 0x69, 0x42, 0x46, 0x56, 0x88, 0x98, 0xA8, 0xA1, 0xA5, - 0x99, 0xA9, 0x52, 0x22, 0x26, 0x66, 0x4A, 0x5A, 0x2A, 0x6A, 0x89, 0x82, - 0x92, 0x62, 0x86, 0x96, 0xA6, 0x8A, 0xAA, 0xA2, 0x9A -}; - -static const uint8_t huff_b63_cb[7] = { 1, 5, 1, 1, 1, 0, 4 }; - -static const uint8_t huff_b63_xlat[7] = { 0, 1, 7, 2, 3, 5, 6 }; - -static const uint8_t huff_b64_cb[7] = { 1, 5, 1, 1, 1, 1, 2 }; - -static const uint8_t huff_b64_xlat[6] = { 1, 0, 2, 5, 3, 4 }; - -static const uint8_t huff_b65_cb[14] = { - 1, 12, 1, 0, 0, 2, 2, 2, 6, 12, 34, 92, 54, 20 -}; - -static const uint8_t huff_b65_xlat[225] = { - 0x00, 0xF0, 0x01, 0x10, 0x0F, 0x11, 0xF1, 0x20, 0xE0, 0x02, 0x0E, 0x1F, - 0xFF, 0xD0, 0x21, 0xE1, 0x12, 0xF2, 0x07, 0x0A, 0x0D, 0x1E, 0xFE, 0x2F, - 0xEF, 0x30, 0x70, 0x90, 0xA0, 0xC0, 0x71, 0x91, 0xC1, 0xD1, 0x32, 0x92, - 0xE2, 0x03, 0x13, 0x63, 0x04, 0x06, 0xE6, 0xE7, 0xF7, 0x09, 0x19, 0x39, - 0xFA, 0x0C, 0x1C, 0xDD, 0xED, 0xFD, 0x2E, 0x7E, 0x9E, 0x3F, 0x9F, 0x40, - 0x50, 0x60, 0xB0, 0x31, 0x41, 0x61, 0xA1, 0xB1, 0x22, 0x42, 0x72, 0xA2, - 0xB2, 0xC2, 0xD2, 0x23, 0x33, 0x73, 0xA3, 0xC3, 0xD3, 0xE3, 0xF3, 0x14, - 0x24, 0x34, 0x44, 0x74, 0xD4, 0xE4, 0x05, 0x25, 0x45, 0x65, 0x95, 0xA5, - 0x16, 0x26, 0x46, 0x76, 0xA6, 0xB6, 0xC6, 0xD6, 0xF6, 0x17, 0x27, 0x37, - 0x47, 0x67, 0xA7, 0xD7, 0x29, 0x69, 0xB9, 0xD9, 0xE9, 0xF9, 0x1A, 0x2A, - 0x3A, 0x9A, 0xCA, 0xDA, 0xEA, 0x0B, 0x1B, 0x3B, 0x6B, 0xEB, 0xFB, 0x2C, - 0x6C, 0xEC, 0xFC, 0x1D, 0x2D, 0x4D, 0x6D, 0x9D, 0xAD, 0x3E, 0x4E, 0x6E, - 0xAE, 0xCE, 0xEE, 0x4F, 0x5F, 0x6F, 0xDF, 0x51, 0x52, 0x62, 0x43, 0x93, - 0xB3, 0x54, 0x94, 0xA4, 0xF4, 0x15, 0x75, 0xB5, 0xE5, 0xF5, 0x36, 0x56, - 0x66, 0x96, 0x57, 0x77, 0x49, 0x59, 0xA9, 0xC9, 0x4A, 0x5A, 0x6A, 0x7A, - 0xAA, 0xBA, 0x2B, 0x4B, 0x7B, 0x9B, 0xAB, 0xDB, 0x3C, 0x4C, 0x7C, 0x9C, - 0xAC, 0xBC, 0xCC, 0x3D, 0x5D, 0x7D, 0xBD, 0xCD, 0x5E, 0xBE, 0xDE, 0xBF, - 0xCF, 0x53, 0x64, 0xB4, 0xC4, 0x35, 0x55, 0xC5, 0xD5, 0x97, 0xB7, 0xC7, - 0x79, 0x99, 0x5B, 0xBB, 0xCB, 0x5C, 0xDC, 0x7F, 0xAF -}; - -static const uint8_t huff_b66_cb[14] = { - 1, 12, 1, 0, 0, 3, 0, 3, 3, 10, 40, 85, 61, 50 -}; - -static const uint8_t huff_b66_xlat[256] = { - 0x00, 0x10, 0x01, 0x11, 0x21, 0x02, 0x12, 0x20, 0x22, 0x13, 0x30, 0x31, - 0x41, 0xD1, 0xE1, 0x32, 0x52, 0x03, 0x23, 0x2D, 0x40, 0x50, 0x60, 0x80, - 0xD0, 0xE0, 0x51, 0x61, 0xF1, 0x42, 0x62, 0xD2, 0xE2, 0xF2, 0x33, 0x43, - 0xC3, 0xD3, 0xE3, 0x04, 0x14, 0xD4, 0xF4, 0x25, 0x35, 0x16, 0x17, 0xF7, - 0xD8, 0x1C, 0x3C, 0x0D, 0x1D, 0x3D, 0x5D, 0x0E, 0x1E, 0x2E, 0x7E, 0x2F, - 0xC0, 0xF0, 0x71, 0x81, 0x91, 0xC1, 0x72, 0x82, 0x92, 0xB2, 0xC2, 0x53, - 0x63, 0x73, 0x93, 0xA3, 0xF3, 0x24, 0x44, 0x64, 0x84, 0xA4, 0xB4, 0x05, - 0x15, 0x95, 0xD5, 0x06, 0x26, 0x36, 0x46, 0x96, 0xD6, 0xE6, 0xF6, 0x07, - 0x27, 0x37, 0xD7, 0xE7, 0x08, 0x18, 0x28, 0x38, 0xE8, 0xF8, 0x09, 0x19, - 0x29, 0xE9, 0xF9, 0x0A, 0x1A, 0xCA, 0xDA, 0xEA, 0x0B, 0x1B, 0xDB, 0xEB, - 0xFB, 0x2C, 0x4C, 0x5C, 0x7C, 0x8C, 0x4D, 0x6D, 0x8D, 0x9D, 0xFD, 0x3E, - 0x5E, 0x6E, 0x8E, 0x9E, 0xEE, 0x0F, 0x1F, 0x3F, 0x4F, 0x5F, 0x6F, 0x7F, - 0xCF, 0x70, 0xA1, 0xA2, 0x83, 0xB3, 0x34, 0x74, 0xC4, 0xE4, 0x55, 0x65, - 0x85, 0xA5, 0xC5, 0xE5, 0xF5, 0x56, 0x66, 0x76, 0x86, 0xA6, 0xC6, 0x57, - 0x67, 0x77, 0x97, 0xA7, 0x48, 0x88, 0x98, 0x49, 0x59, 0x79, 0x99, 0x3A, - 0x4A, 0x8A, 0xBA, 0xFA, 0x2B, 0x7B, 0x0C, 0xAC, 0xBC, 0xCC, 0xEC, 0x7D, - 0xAD, 0xBD, 0xDD, 0x4E, 0xBE, 0xCE, 0xFE, 0x8F, 0x9F, 0xAF, 0xBF, 0xDF, - 0xEF, 0xFF, 0x90, 0xA0, 0xB0, 0xB1, 0x54, 0x94, 0x45, 0x75, 0xB5, 0xB6, - 0x47, 0x87, 0xB7, 0xC7, 0x58, 0x68, 0x78, 0xA8, 0xB8, 0xC8, 0x39, 0x69, - 0x89, 0xA9, 0xB9, 0xC9, 0xD9, 0x2A, 0x5A, 0x6A, 0x7A, 0x9A, 0xAA, 0x3B, - 0x4B, 0x5B, 0x6B, 0x8B, 0x9B, 0xAB, 0xBB, 0xCB, 0x6C, 0x9C, 0xDC, 0xFC, - 0xCD, 0xED, 0xAE, 0xDE -}; - -static const uint8_t huff_b67_cb[10] = { 2, 9, 1, 2, 1, 4, 7, 10, 26, 12 }; - -static const uint8_t huff_b67_xlat[63] = { - 0, 1, 63, 62, 2, 3, 60, 61, 4, 5, 6, 7, 57, 58, 59, 8, - 9, 10, 11, 12, 52, 53, 54, 55, 56, 13, 14, 15, 16, 17, 18, 25, - 26, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 46, 47, 48, - 49, 50, 51, 19, 20, 21, 22, 23, 24, 40, 41, 42, 43, 44, 45 -}; - -static const uint8_t huff_b71_cb[14] = { - 1, 12, 1, 0, 0, 1, 7, 0, 19, 5, 13, 23, 0, 12 -}; - -static const uint8_t huff_b71_xlat[81] = { - 0x00, 0x03, 0x40, 0xC0, 0x10, 0x30, 0x04, 0x0C, 0x01, 0x50, 0xD0, 0x70, - 0xF0, 0xC4, 0x14, 0x34, 0x4C, 0x1C, 0x3C, 0xC1, 0x11, 0x31, 0x05, 0x0D, - 0x13, 0x33, 0x07, 0x0F, 0x44, 0xCC, 0x41, 0x43, 0xC3, 0x54, 0x74, 0xDC, - 0xFC, 0xF1, 0xC5, 0x15, 0x1D, 0x53, 0xC7, 0x37, 0x4F, 0x3F, 0xD4, 0xF4, - 0x5C, 0x7C, 0x51, 0xD1, 0x71, 0x45, 0x55, 0x35, 0x4D, 0xCD, 0xDD, 0x3D, - 0xD3, 0x73, 0xF3, 0x47, 0x17, 0x77, 0xCF, 0x1F, 0xFF, 0xD5, 0x75, 0xF5, - 0x5D, 0x7D, 0xFD, 0x57, 0xD7, 0xF7, 0x5F, 0xDF, 0x7F -}; - -static const uint8_t huff_b73_cb[13] = { - 1, 11, 1, 0, 0, 0, 1, 4, 9, 4, 103, 110, 24 -}; - -static const uint8_t huff_b73_xlat[256] = { - 0x00, 0x40, 0x10, 0x04, 0x01, 0x05, 0x50, 0x14, 0x54, 0x41, 0x11, 0x51, - 0x45, 0x15, 0x55, 0x44, 0x95, 0x6A, 0x03, 0x80, 0xC0, 0x90, 0xD0, 0x94, - 0xD4, 0x24, 0x64, 0x58, 0x91, 0xA1, 0x85, 0xD5, 0x25, 0x65, 0xA5, 0xE5, - 0x75, 0xB5, 0xF5, 0x19, 0x59, 0x99, 0xD9, 0x69, 0xA9, 0xE9, 0x79, 0xB9, - 0xF9, 0x4D, 0x5D, 0x9D, 0xDD, 0x6D, 0xAD, 0xED, 0x7D, 0xBD, 0xFD, 0x02, - 0x42, 0x52, 0x06, 0x46, 0x16, 0x56, 0x96, 0xD6, 0x26, 0x66, 0xA6, 0xE6, - 0x76, 0xB6, 0xF6, 0x1A, 0x5A, 0x9A, 0xDA, 0xAA, 0xEA, 0x7A, 0xBA, 0xFA, - 0x5E, 0x9E, 0xDE, 0x6E, 0xAE, 0xEE, 0x7E, 0xBE, 0xFE, 0x07, 0x47, 0x57, - 0x97, 0xD7, 0x67, 0xA7, 0xE7, 0x77, 0xB7, 0xF7, 0x5B, 0x9B, 0xDB, 0x6B, - 0xAB, 0xEB, 0x7B, 0xBB, 0xFB, 0x5F, 0x9F, 0xDF, 0x6F, 0xAF, 0xEF, 0x7F, - 0xBF, 0xFF, 0x20, 0x60, 0x70, 0xB0, 0xF0, 0x84, 0xC4, 0xA4, 0xE4, 0x74, - 0xB4, 0xF4, 0x08, 0x88, 0x18, 0x98, 0xD8, 0x68, 0xA8, 0xE8, 0x78, 0xB8, - 0xF8, 0x1C, 0x5C, 0x9C, 0xDC, 0x6C, 0xAC, 0xEC, 0x3C, 0x7C, 0xBC, 0xFC, - 0x81, 0xD1, 0x21, 0x61, 0xE1, 0x71, 0xB1, 0xF1, 0xC5, 0x35, 0x09, 0x49, - 0x89, 0xC9, 0x29, 0x39, 0x0D, 0x8D, 0xCD, 0x1D, 0x2D, 0x3D, 0x92, 0xD2, - 0x22, 0x62, 0xA2, 0xE2, 0x72, 0xB2, 0xF2, 0x86, 0xC6, 0x36, 0x0A, 0x4A, - 0x8A, 0xCA, 0x2A, 0x3A, 0x0E, 0x4E, 0x8E, 0xCE, 0x1E, 0x2E, 0x3E, 0x13, - 0x53, 0x93, 0xD3, 0x63, 0xA3, 0xE3, 0x73, 0xB3, 0xF3, 0x87, 0xC7, 0x17, - 0x27, 0x37, 0x0B, 0x4B, 0x8B, 0xCB, 0x1B, 0x2B, 0x3B, 0x0F, 0x4F, 0x8F, - 0xCF, 0x1F, 0x2F, 0x3F, 0xA0, 0xE0, 0x30, 0x34, 0x48, 0xC8, 0x28, 0x38, - 0x0C, 0x4C, 0x8C, 0xCC, 0x2C, 0xC1, 0x31, 0x82, 0xC2, 0x12, 0x32, 0x43, - 0x83, 0xC3, 0x23, 0x33 -}; - -static const uint8_t huff_b74_cb[8] = { 1, 6, 1, 0, 2, 2, 2, 4 }; - -static const uint8_t huff_b74_xlat[11] = { - 0, 1, 15, 2, 14, 5, 13, 3, 4, 11, 12 -}; - -static const uint8_t huff_b75_cb[13] = { - 2, 12, 1, 4, 0, 0, 0, 8, 11, 24, 53, 64, 60 -}; - -static const uint8_t huff_b75_xlat[225] = { - 0x00, 0x10, 0xF0, 0x01, 0x0F, 0x20, 0xE0, 0x11, 0xF1, 0x02, 0x0E, 0x1F, - 0xFF, 0xD0, 0x21, 0xE1, 0x12, 0xF2, 0x03, 0x0D, 0x1E, 0xFE, 0x2F, 0xEF, - 0x30, 0x40, 0x60, 0x70, 0x90, 0xA0, 0xC0, 0x31, 0xD1, 0x22, 0xE2, 0x13, - 0xF3, 0x04, 0x06, 0x07, 0x09, 0x0C, 0x1D, 0xFD, 0x2E, 0xEE, 0x3F, 0xDF, - 0x50, 0xB0, 0x41, 0x61, 0x71, 0x91, 0xA1, 0xC1, 0x32, 0x62, 0x72, 0x92, - 0xA2, 0xD2, 0x23, 0xD3, 0xE3, 0x14, 0xF4, 0x05, 0x16, 0x26, 0xE6, 0xF6, - 0x17, 0x27, 0xE7, 0xF7, 0x19, 0x29, 0xF9, 0x0A, 0x1A, 0x2A, 0xFA, 0x0B, - 0x1C, 0x2C, 0xFC, 0x2D, 0x3D, 0xED, 0x3E, 0x4E, 0x7E, 0x9E, 0xDE, 0x4F, - 0x6F, 0x7F, 0x9F, 0xAF, 0xCF, 0x51, 0xB1, 0x42, 0x52, 0xB2, 0xC2, 0x33, - 0x63, 0x73, 0x93, 0xA3, 0xB3, 0xC3, 0x24, 0x34, 0x74, 0xA4, 0xD4, 0xE4, - 0x15, 0x25, 0x65, 0x95, 0xE5, 0xF5, 0x36, 0xD6, 0x37, 0x47, 0xC7, 0xD7, - 0x39, 0x59, 0xB9, 0xC9, 0xD9, 0xE9, 0x3A, 0x6A, 0xDA, 0xEA, 0x1B, 0x2B, - 0x9B, 0xAB, 0xEB, 0xFB, 0x6C, 0x7C, 0x9C, 0xAC, 0xEC, 0x4D, 0x6D, 0x7D, - 0x9D, 0xAD, 0xBD, 0xDD, 0x5E, 0x6E, 0xAE, 0xCE, 0x5F, 0x43, 0x53, 0x44, - 0x54, 0x64, 0x94, 0xB4, 0xC4, 0x35, 0x45, 0x55, 0x75, 0xA5, 0xB5, 0xC5, - 0xD5, 0x46, 0x56, 0x66, 0x76, 0x96, 0xA6, 0xB6, 0xC6, 0x57, 0x67, 0x77, - 0x97, 0xA7, 0xB7, 0x49, 0x69, 0x79, 0x99, 0xA9, 0x4A, 0x5A, 0x7A, 0x9A, - 0xAA, 0xBA, 0xCA, 0x3B, 0x4B, 0x5B, 0x6B, 0x7B, 0xBB, 0xCB, 0xDB, 0x3C, - 0x4C, 0x5C, 0xBC, 0xCC, 0xDC, 0x5D, 0xCD, 0xBE, 0xBF -}; - -static const uint8_t huff_b77_cb[12] = { - 2, 11, 1, 0, 4, 6, 10, 12, 7, 15, 4, 4 -}; - -static const uint8_t huff_b77_xlat[63] = { - 0, 1, 2, 62, 63, 3, 4, 5, 59, 60, 61, 6, 7, 8, 9, 10, - 54, 55, 56, 57, 58, 11, 12, 13, 14, 15, 16, 47, 49, 50, 51, 52, - 53, 17, 18, 19, 20, 45, 46, 48, 21, 22, 23, 24, 25, 26, 27, 37, - 38, 39, 40, 41, 42, 43, 44, 28, 29, 30, 35, 31, 33, 34, 36 -}; - -/** Tables for spectrum coding. */ -typedef struct Atrac3pSpecCodeTab { - uint8_t group_size; ///< number of coefficients grouped together - uint8_t num_coeffs; ///< 1 - map index to a single value, > 1 - map index to a vector of values - uint8_t bits; ///< number of bits a single coefficient occupy - uint8_t is_signed; ///< 1 - values in that table are signed ones, otherwise - absolute ones - - int redirect; ///< if >= 0: tells which huffman table must be reused - const uint8_t *cb; ///< pointer to the codebook descriptor - const uint8_t *xlat; ///< pointer to the translation table or NULL if none -} Atrac3pSpecCodeTab; - -static const Atrac3pSpecCodeTab atrac3p_spectra_tabs[112] = { - /* table set = A */ - /* code table = 0 */ - { 1, 4, 2, 1, -1, huff_a01_cb, huff_a01_xlat }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_a02_cb, huff_a02_xlat }, // wordlen = 2 - { 1, 2, 3, 1, -1, huff_a03_cb, huff_a03_xlat }, // wordlen = 3 - { 1, 1, 3, 0, -1, huff_a04_cb, huff_a04_xlat }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_a05_cb, huff_a05_xlat }, // wordlen = 5 - { 1, 1, 4, 0, -1, huff_a06_cb, huff_a06_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a07_cb, huff_a07_xlat }, // wordlen = 7 - - /* code table = 1 */ - { 4, 4, 2, 1, -1, huff_a11_cb, huff_a11_xlat }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_a12_cb, huff_a12_xlat }, // wordlen = 2 - { 1, 2, 3, 1, -1, huff_a13_cb, huff_a13_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_a14_cb, huff_a14_xlat }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_a15_cb, huff_a15_xlat }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_a16_cb, huff_a16_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a17_cb, huff_a17_xlat }, // wordlen = 7 - - /* code table = 2 */ - { 1, 4, 2, 1, -1, huff_a21_cb, huff_a21_xlat }, // wordlen = 1 - { 1, 2, 3, 1, -1, huff_a22_cb, huff_a22_xlat }, // wordlen = 2 - { 1, 2, 3, 1, -1, huff_a23_cb, huff_a23_xlat }, // wordlen = 3 - { 1, 1, 3, 0, -1, huff_a24_cb, NULL }, // wordlen = 4 - { 1, 1, 3, 0, -1, huff_a25_cb, huff_a25_xlat }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_a26_cb, huff_a26_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a27_cb, huff_a27_xlat }, // wordlen = 7 - - /* code table = 3 */ - { 1, 2, 2, 1, -1, huff_a31_cb, huff_a31_xlat }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_a32_cb, huff_a32_xlat }, // wordlen = 2 - { 1, 4, 2, 0, -1, huff_a33_cb, huff_a33_xlat }, // wordlen = 3 - { 1, 1, 3, 0, -1, huff_a34_cb, huff_a34_xlat }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_a35_cb, huff_a35_xlat }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_a36_cb, huff_a36_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a37_cb, huff_a37_xlat }, // wordlen = 7 - - /* code table = 4 */ - { 1, 4, 2, 1, -1, huff_a41_cb, huff_a41_xlat }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_a42_cb, huff_a42_xlat }, // wordlen = 2 - { 1, 1, 3, 1, -1, huff_a43_cb, huff_a43_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_a44_cb, huff_a44_xlat }, // wordlen = 4 - { 1, 1, 3, 0, -1, huff_a45_cb, huff_a45_xlat }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_a46_cb, huff_a46_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a47_cb, huff_a47_xlat }, // wordlen = 7 - - /* code table = 5 */ - { 1, 4, 2, 1, -1, huff_a51_cb, huff_a51_xlat }, // wordlen = 1 - { 1, 2, 3, 1, -1, huff_a52_cb, huff_a52_xlat }, // wordlen = 2 - { 1, 1, 3, 1, -1, huff_a43_cb, huff_a53_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_a54_cb, huff_a54_xlat }, // wordlen = 4 - { 1, 1, 3, 0, -1, huff_a55_cb, huff_a55_xlat }, // wordlen = 5 - { 1, 1, 5, 1, -1, huff_a56_cb, huff_a56_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a57_cb, huff_a57_xlat }, // wordlen = 7 - - /* code table = 6 */ - { 2, 4, 2, 1, -1, huff_a61_cb, huff_a61_xlat }, // wordlen = 1 - { 1, 2, 3, 1, -1, huff_a62_cb, huff_a62_xlat }, // wordlen = 2 - { 1, 4, 2, 0, -1, huff_a63_cb, huff_a63_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_a64_cb, huff_a64_xlat }, // wordlen = 4 - { 1, 1, 4, 1, -1, huff_a65_cb, huff_a65_xlat }, // wordlen = 5 - { 1, 1, 5, 1, -1, huff_a66_cb, huff_a66_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_a67_cb, huff_a67_xlat }, // wordlen = 7 - - /* code table = 7 */ - { 1, 2, 1, 0, -1, huff_a71_cb, NULL }, // wordlen = 1 - { 2, 4, 2, 0, -1, huff_a72_cb, huff_a72_xlat }, // wordlen = 2 - { 1, 2, 3, 1, -1, huff_a73_cb, huff_a73_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_a74_cb, huff_a74_xlat }, // wordlen = 4 - { 1, 1, 4, 1, -1, huff_a75_cb, huff_a75_xlat }, // wordlen = 5 - { 2, 2, 4, 0, -1, huff_a76_cb, huff_a76_xlat }, // wordlen = 6 - { 4, 1, 6, 1, 6, NULL, NULL }, // wordlen = 7 - - /* table set = B */ - /* code table = 0 */ - { 4, 4, 2, 1, -1, huff_b01_cb, huff_b01_xlat }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_b02_cb, huff_b02_xlat }, // wordlen = 2 - { 4, 2, 3, 1, -1, huff_b03_cb, huff_b03_xlat }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_b04_cb, huff_b04_xlat }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_b05_cb, huff_b05_xlat }, // wordlen = 5 - { 1, 1, 4, 0, 5, NULL, NULL }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_b07_cb, huff_b07_xlat }, // wordlen = 7 - - /* code table = 1 */ - { 1, 4, 2, 1, 14, NULL, NULL }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_b12_cb, huff_b12_xlat }, // wordlen = 2 - { 1, 2, 3, 1, 9, NULL, NULL }, // wordlen = 3 - { 1, 2, 4, 1, -1, huff_b14_cb, huff_b14_xlat }, // wordlen = 4 - { 1, 2, 4, 1, 11, NULL, NULL }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_b16_cb, huff_b16_xlat }, // wordlen = 6 - { 1, 1, 6, 1, 6, NULL, NULL }, // wordlen = 7 - - /* code table = 2 */ - { 4, 4, 2, 1, 28, NULL, NULL }, // wordlen = 1 - { 4, 4, 2, 0, 22, NULL, NULL }, // wordlen = 2 - { 1, 2, 3, 1, 2, NULL, NULL }, // wordlen = 3 - { 1, 2, 4, 1, 31, NULL, NULL }, // wordlen = 4 - { 2, 2, 4, 1, 60, NULL, NULL }, // wordlen = 5 - { 2, 2, 4, 0, -1, huff_b26_cb, huff_b26_xlat }, // wordlen = 6 - { 4, 1, 6, 1, 6, NULL, NULL }, // wordlen = 7 - - /* code table = 3 */ - { 1, 4, 2, 1, 35, NULL, NULL }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_b32_cb, huff_b32_xlat }, // wordlen = 2 - { 1, 4, 2, 0, -1, huff_b33_cb, huff_b33_xlat }, // wordlen = 3 - { 2, 2, 4, 1, 59, NULL, NULL }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_b35_cb, huff_b35_xlat }, // wordlen = 5 - { 1, 2, 4, 0, 75, NULL, NULL }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_b37_cb, huff_b37_xlat }, // wordlen = 7 - - /* code table = 4 */ - { 1, 4, 2, 1, -1, huff_b41_cb, huff_b41_xlat }, // wordlen = 1 - { 4, 2, 3, 1, -1, huff_b42_cb, huff_b42_xlat }, // wordlen = 2 - { 1, 2, 3, 1, -1, huff_b43_cb, huff_b43_xlat }, // wordlen = 3 - { 4, 2, 4, 1, 66, NULL, NULL }, // wordlen = 4 - { 1, 1, 3, 0, 32, NULL, NULL }, // wordlen = 5 - { 1, 2, 4, 0, 12, NULL, NULL }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_b47_cb, huff_b47_xlat }, // wordlen = 7 - - /* code table = 5 */ - { 2, 4, 2, 1, 42, NULL, NULL }, // wordlen = 1 - { 1, 2, 3, 1, -1, huff_b52_cb, huff_b52_xlat }, // wordlen = 2 - { 4, 1, 3, 1, -1, huff_b53_cb, huff_b53_xlat }, // wordlen = 3 - { 1, 1, 3, 0, 17, NULL, NULL }, // wordlen = 4 - { 1, 1, 3, 0, 39, NULL, NULL }, // wordlen = 5 - { 1, 1, 5, 1, -1, huff_b56_cb, huff_b56_xlat }, // wordlen = 6 - { 2, 1, 6, 1, 62, NULL, NULL }, // wordlen = 7 - - /* code table = 6 */ - { 1, 4, 2, 1, 28, NULL, NULL }, // wordlen = 1 - { 1, 4, 2, 0, -1, huff_b62_cb, huff_b62_xlat }, // wordlen = 2 - { 1, 1, 3, 1, -1, huff_b63_cb, huff_b63_xlat }, // wordlen = 3 - { 1, 1, 3, 0, -1, huff_b64_cb, huff_b64_xlat }, // wordlen = 4 - { 4, 2, 4, 1, -1, huff_b65_cb, huff_b65_xlat }, // wordlen = 5 - { 1, 2, 4, 0, -1, huff_b66_cb, huff_b66_xlat }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_b67_cb, huff_b67_xlat }, // wordlen = 7 - - /* code table = 7 */ - { 1, 4, 2, 1, -1, huff_b71_cb, huff_b71_xlat }, // wordlen = 1 - { 4, 4, 2, 0, 78, NULL, NULL }, // wordlen = 2 - { 4, 4, 2, 0, -1, huff_b73_cb, huff_b73_xlat }, // wordlen = 3 - { 1, 1, 4, 1, -1, huff_b74_cb, huff_b74_xlat }, // wordlen = 4 - { 1, 2, 4, 1, -1, huff_b75_cb, huff_b75_xlat }, // wordlen = 5 - { 1, 1, 5, 1, 47, NULL, NULL }, // wordlen = 6 - { 1, 1, 6, 1, -1, huff_b77_cb, huff_b77_xlat }, // wordlen = 7 -}; - -/* Huffman tables for gain control data. */ -static const uint8_t atrac3p_huff_gain_npoints1_cb[9] = { - 1, 7, 1, 1, 1, 1, 1, 1, 2 -}; - -static const uint8_t atrac3p_huff_gain_npoints2_xlat[8] = { - 0, 1, 7, 2, 6, 3, 4, 5 -}; - -static const uint8_t atrac3p_huff_gain_lev1_cb[9] = { 1, 7, 1, 0, 2, 2, 1, 2, 8 }; -static const uint8_t atrac3p_huff_gain_lev1_xlat[16] = { - 7, 5, 8, 6, 9, 4, 10, 11, 0, 1, 2, 3, 12, 13, 14, 15 -}; - -static const uint8_t atrac3p_huff_gain_lev2_cb[11] = { - 1, 9, 1, 1, 1, 1, 1, 0, 2, 0, 8 -}; - -static const uint8_t atrac3p_huff_gain_lev2_xlat[15] = { - 15, 14, 1, 13, 2, 3, 12, 4, 5, 6, 7, 8, 9, 10, 11 -}; - -static const uint8_t atrac3p_huff_gain_lev3_cb[11] = { - 1, 9, 1, 0, 3, 1, 1, 0, 2, 0, 8 -}; - -static const uint8_t atrac3p_huff_gain_lev3_xlat[16] = { - 0, 1, 14, 15, 2, 13, 3, 12, 4, 5, 6, 7, 8, 9, 10, 11 -}; - -static const uint8_t atrac3p_huff_gain_lev4_cb[11] = { - 1, 9, 1, 1, 1, 1, 1, 0, 1, 2, 8 -}; - -static const uint8_t atrac3p_huff_gain_lev4_xlat[16] = { - 0, 1, 15, 14, 2, 13, 3, 12, 4, 5, 6, 7, 8, 9, 10, 11 -}; - -static const uint8_t atrac3p_huff_gain_loc1_cb[9] = { 2, 8, 1, 2, 4, 4, 4, 0, 16 }; -static const uint8_t atrac3p_huff_gain_loc1_xlat[31] = { - 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 -}; - -static const uint8_t atrac3p_huff_gain_loc2_cb[8] = { 3, 8, 5, 3, 2, 3, 2, 16 }; -static const uint8_t atrac3p_huff_gain_loc2_xlat[31] = { - 2, 3, 4, 5, 6, 1, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31 -}; - -static const uint8_t atrac3p_huff_gain_loc3_cb[7] = { 2, 6, 1, 0, 2, 11, 18 }; -static const uint8_t atrac3p_huff_gain_loc3_xlat[32] = { - 0, 1, 31, 2, 3, 4, 5, 6, 7, 26, 27, 28, 29, 30, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 -}; - -static const uint8_t atrac3p_huff_gain_loc4_cb[5] = { 4, 6, 3, 23, 6 }; -static const uint8_t atrac3p_huff_gain_loc4_xlat[32] = { - 0, 28, 29, 1, 2, 3, 4, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 5, 6, 7, 8, 9, 10 -}; - -static const uint8_t atrac3p_huff_gain_loc5_cb[9] = { 1, 7, 1, 0, 0, 3, 2, 6, 20 }; -static const uint8_t atrac3p_huff_gain_loc5_xlat[32] = { - 0, 1, 2, 31, 3, 4, 5, 6, 7, 8, 29, 30, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28 -}; - -/* Huffman tables for GHA waves data. */ -static const uint8_t atrac3p_huff_tonebands_cb[8] = { 1, 6, 1, 0, 1, 2, 4, 8 }; -static const uint8_t atrac3p_huff_numwavs1_cb[9] = { 1, 7, 1, 1, 1, 1, 1, 1, 2 }; -static const uint8_t atrac3p_huff_numwavs2_cb[8] = { 1, 6, 1, 1, 1, 1, 0, 4 }; -static const uint8_t atrac3p_huff_numwavs2_xlat[8] = { 0, 1, 7, 2, 3, 4, 5, 6 }; -static const uint8_t atrac3p_huff_wav_ampsf1_cb[7] = { 4, 8, 10, 8, 6, 0, 8 }; -static const uint8_t atrac3p_huff_wav_ampsf1_xlat[32] = { - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 5, 6, 7, 18, 19, 20, - 21, 22, 4, 23, 24, 25, 26, 27, 0, 1, 2, 3, 28, 29, 30, 31 -}; - -static const uint8_t atrac3p_huff_wav_ampsf2_cb[7] = { 4, 8, 11, 5, 6, 6, 4 }; -static const uint8_t atrac3p_huff_wav_ampsf2_xlat[32] = { - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 14, 15, 16, 17, 29, - 9, 10, 11, 12, 13, 30, 4, 5, 6, 7, 8, 31, 0, 1, 2, 3 -}; - -static const uint8_t atrac3p_huff_wav_ampsf3_cb[9] = { 2, 8, 1, 3, 3, 1, 4, 4, 16 }; -static const uint8_t atrac3p_huff_wav_ampsf3_xlat[32] = { - 0, 1, 2, 31, 3, 29, 30, 4, 5, 6, 27, 28, 7, 24, 25, 26, - 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 -}; - -static const uint8_t atrac3p_huff_freq_cb[13] = { - 1, 11, 1, 0, 0, 2, 2, 0, 9, 9, 29, 104, 100 -}; - -static const uint8_t atrac3p_huff_freq_xlat[256] = { - 0, 1, 255, 2, 254, 3, 4, 5, 6, 7, 8, 251, 252, 253, 9, 10, - 11, 12, 246, 247, 248, 249, 250, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, - 38, 243, 244, 245, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193 -}; - -#endif /* AVCODEC_ATRAC3PLUS_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdec.c deleted file mode 100644 index 652bd7890..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdec.c +++ /dev/null @@ -1,396 +0,0 @@ -/* - * ATRAC3+ compatible decoder - * - * Copyright (c) 2010-2013 Maxim Poliakovski - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Sony ATRAC3+ compatible decoder. - * - * Container formats used to store its data: - * RIFF WAV (.at3) and Sony OpenMG (.oma, .aa3). - * - * Technical description of this codec can be found here: - * http://wiki.multimedia.cx/index.php?title=ATRAC3plus - * - * Kudos to Benjamin Larsson and Michael Karcher - * for their precious technical help! - */ - -#include -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/float_dsp.h" -#include "avcodec.h" -#include "get_bits.h" -#include "internal.h" -#include "atrac.h" -#include "atrac3plus.h" - -typedef struct ATRAC3PContext { - GetBitContext gb; - AVFloatDSPContext fdsp; - - DECLARE_ALIGNED(32, float, samples)[2][ATRAC3P_FRAME_SAMPLES]; ///< quantized MDCT spectrum - DECLARE_ALIGNED(32, float, mdct_buf)[2][ATRAC3P_FRAME_SAMPLES]; ///< output of the IMDCT - DECLARE_ALIGNED(32, float, time_buf)[2][ATRAC3P_FRAME_SAMPLES]; ///< output of the gain compensation - DECLARE_ALIGNED(32, float, outp_buf)[2][ATRAC3P_FRAME_SAMPLES]; - - AtracGCContext gainc_ctx; ///< gain compensation context - FFTContext mdct_ctx; - FFTContext ipqf_dct_ctx; ///< IDCT context used by IPQF - - Atrac3pChanUnitCtx *ch_units; ///< global channel units - - int num_channel_blocks; ///< number of channel blocks - uint8_t channel_blocks[5]; ///< channel configuration descriptor - uint64_t my_channel_layout; ///< current channel layout -} ATRAC3PContext; - -static av_cold int atrac3p_decode_close(AVCodecContext *avctx) -{ - av_free(((ATRAC3PContext *)(avctx->priv_data))->ch_units); - - return 0; -} - -static av_cold int set_channel_params(ATRAC3PContext *ctx, - AVCodecContext *avctx) -{ - memset(ctx->channel_blocks, 0, sizeof(ctx->channel_blocks)); - - switch (avctx->channels) { - case 1: - if (avctx->channel_layout != AV_CH_FRONT_LEFT) - avctx->channel_layout = AV_CH_LAYOUT_MONO; - - ctx->num_channel_blocks = 1; - ctx->channel_blocks[0] = CH_UNIT_MONO; - break; - case 2: - avctx->channel_layout = AV_CH_LAYOUT_STEREO; - ctx->num_channel_blocks = 1; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - break; - case 3: - avctx->channel_layout = AV_CH_LAYOUT_SURROUND; - ctx->num_channel_blocks = 2; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - ctx->channel_blocks[1] = CH_UNIT_MONO; - break; - case 4: - avctx->channel_layout = AV_CH_LAYOUT_4POINT0; - ctx->num_channel_blocks = 3; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - ctx->channel_blocks[1] = CH_UNIT_MONO; - ctx->channel_blocks[2] = CH_UNIT_MONO; - break; - case 6: - avctx->channel_layout = AV_CH_LAYOUT_5POINT1_BACK; - ctx->num_channel_blocks = 4; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - ctx->channel_blocks[1] = CH_UNIT_MONO; - ctx->channel_blocks[2] = CH_UNIT_STEREO; - ctx->channel_blocks[3] = CH_UNIT_MONO; - break; - case 7: - avctx->channel_layout = AV_CH_LAYOUT_6POINT1_BACK; - ctx->num_channel_blocks = 5; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - ctx->channel_blocks[1] = CH_UNIT_MONO; - ctx->channel_blocks[2] = CH_UNIT_STEREO; - ctx->channel_blocks[3] = CH_UNIT_MONO; - ctx->channel_blocks[4] = CH_UNIT_MONO; - break; - case 8: - avctx->channel_layout = AV_CH_LAYOUT_7POINT1; - ctx->num_channel_blocks = 5; - ctx->channel_blocks[0] = CH_UNIT_STEREO; - ctx->channel_blocks[1] = CH_UNIT_MONO; - ctx->channel_blocks[2] = CH_UNIT_STEREO; - ctx->channel_blocks[3] = CH_UNIT_STEREO; - ctx->channel_blocks[4] = CH_UNIT_MONO; - break; - default: - av_log(avctx, AV_LOG_ERROR, - "Unsupported channel count: %d!\n", avctx->channels); - return AVERROR_INVALIDDATA; - } - - return 0; -} - -static av_cold int atrac3p_decode_init(AVCodecContext *avctx) -{ - ATRAC3PContext *ctx = avctx->priv_data; - int i, ch, ret; - - if (!avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); - return AVERROR(EINVAL); - } - - ff_atrac3p_init_vlcs(); - - avpriv_float_dsp_init(&ctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - - /* initialize IPQF */ - ff_mdct_init(&ctx->ipqf_dct_ctx, 5, 1, 32.0 / 32768.0); - - ff_atrac3p_init_imdct(avctx, &ctx->mdct_ctx); - - ff_atrac_init_gain_compensation(&ctx->gainc_ctx, 6, 2); - - ff_atrac3p_init_wave_synth(); - - if ((ret = set_channel_params(ctx, avctx)) < 0) - return ret; - - ctx->my_channel_layout = avctx->channel_layout; - - ctx->ch_units = av_mallocz(sizeof(*ctx->ch_units) * - ctx->num_channel_blocks); - if (!ctx->ch_units) { - atrac3p_decode_close(avctx); - return AVERROR(ENOMEM); - } - - for (i = 0; i < ctx->num_channel_blocks; i++) { - for (ch = 0; ch < 2; ch++) { - ctx->ch_units[i].channels[ch].ch_num = ch; - ctx->ch_units[i].channels[ch].wnd_shape = &ctx->ch_units[i].channels[ch].wnd_shape_hist[0][0]; - ctx->ch_units[i].channels[ch].wnd_shape_prev = &ctx->ch_units[i].channels[ch].wnd_shape_hist[1][0]; - ctx->ch_units[i].channels[ch].gain_data = &ctx->ch_units[i].channels[ch].gain_data_hist[0][0]; - ctx->ch_units[i].channels[ch].gain_data_prev = &ctx->ch_units[i].channels[ch].gain_data_hist[1][0]; - ctx->ch_units[i].channels[ch].tones_info = &ctx->ch_units[i].channels[ch].tones_info_hist[0][0]; - ctx->ch_units[i].channels[ch].tones_info_prev = &ctx->ch_units[i].channels[ch].tones_info_hist[1][0]; - } - - ctx->ch_units[i].waves_info = &ctx->ch_units[i].wave_synth_hist[0]; - ctx->ch_units[i].waves_info_prev = &ctx->ch_units[i].wave_synth_hist[1]; - } - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - return 0; -} - -static void decode_residual_spectrum(Atrac3pChanUnitCtx *ctx, - float out[2][ATRAC3P_FRAME_SAMPLES], - int num_channels, - AVCodecContext *avctx) -{ - int i, sb, ch, qu, nspeclines, RNG_index; - float *dst, q; - int16_t *src; - /* calculate RNG table index for each subband */ - int sb_RNG_index[ATRAC3P_SUBBANDS] = { 0 }; - - if (ctx->mute_flag) { - for (ch = 0; ch < num_channels; ch++) - memset(out[ch], 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out[ch])); - return; - } - - for (qu = 0, RNG_index = 0; qu < ctx->used_quant_units; qu++) - RNG_index += ctx->channels[0].qu_sf_idx[qu] + - ctx->channels[1].qu_sf_idx[qu]; - - for (sb = 0; sb < ctx->num_coded_subbands; sb++, RNG_index += 128) - sb_RNG_index[sb] = RNG_index & 0x3FC; - - /* inverse quant and power compensation */ - for (ch = 0; ch < num_channels; ch++) { - /* clear channel's residual spectrum */ - memset(out[ch], 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out[ch])); - - for (qu = 0; qu < ctx->used_quant_units; qu++) { - src = &ctx->channels[ch].spectrum[ff_atrac3p_qu_to_spec_pos[qu]]; - dst = &out[ch][ff_atrac3p_qu_to_spec_pos[qu]]; - nspeclines = ff_atrac3p_qu_to_spec_pos[qu + 1] - - ff_atrac3p_qu_to_spec_pos[qu]; - - if (ctx->channels[ch].qu_wordlen[qu] > 0) { - q = ff_atrac3p_sf_tab[ctx->channels[ch].qu_sf_idx[qu]] * - ff_atrac3p_mant_tab[ctx->channels[ch].qu_wordlen[qu]]; - for (i = 0; i < nspeclines; i++) - dst[i] = src[i] * q; - } - } - - for (sb = 0; sb < ctx->num_coded_subbands; sb++) - ff_atrac3p_power_compensation(ctx, ch, &out[ch][0], - sb_RNG_index[sb], sb); - } - - if (ctx->unit_type == CH_UNIT_STEREO) { - for (sb = 0; sb < ctx->num_coded_subbands; sb++) { - if (ctx->swap_channels[sb]) { - for (i = 0; i < ATRAC3P_SUBBAND_SAMPLES; i++) - FFSWAP(float, out[0][sb * ATRAC3P_SUBBAND_SAMPLES + i], - out[1][sb * ATRAC3P_SUBBAND_SAMPLES + i]); - } - - /* flip coefficients' sign if requested */ - if (ctx->negate_coeffs[sb]) - for (i = 0; i < ATRAC3P_SUBBAND_SAMPLES; i++) - out[1][sb * ATRAC3P_SUBBAND_SAMPLES + i] = -(out[1][sb * ATRAC3P_SUBBAND_SAMPLES + i]); - } - } -} - -static void reconstruct_frame(ATRAC3PContext *ctx, Atrac3pChanUnitCtx *ch_unit, - int num_channels, AVCodecContext *avctx) -{ - int ch, sb; - - for (ch = 0; ch < num_channels; ch++) { - for (sb = 0; sb < ch_unit->num_subbands; sb++) { - /* inverse transform and windowing */ - ff_atrac3p_imdct(&ctx->fdsp, &ctx->mdct_ctx, - &ctx->samples[ch][sb * ATRAC3P_SUBBAND_SAMPLES], - &ctx->mdct_buf[ch][sb * ATRAC3P_SUBBAND_SAMPLES], - (ch_unit->channels[ch].wnd_shape_prev[sb] << 1) + - ch_unit->channels[ch].wnd_shape[sb], sb); - - /* gain compensation and overlapping */ - ff_atrac_gain_compensation(&ctx->gainc_ctx, - &ctx->mdct_buf[ch][sb * ATRAC3P_SUBBAND_SAMPLES], - &ch_unit->prev_buf[ch][sb * ATRAC3P_SUBBAND_SAMPLES], - &ch_unit->channels[ch].gain_data_prev[sb], - &ch_unit->channels[ch].gain_data[sb], - ATRAC3P_SUBBAND_SAMPLES, - &ctx->time_buf[ch][sb * ATRAC3P_SUBBAND_SAMPLES]); - } - - /* zero unused subbands in both output and overlapping buffers */ - memset(&ch_unit->prev_buf[ch][ch_unit->num_subbands * ATRAC3P_SUBBAND_SAMPLES], - 0, - (ATRAC3P_SUBBANDS - ch_unit->num_subbands) * - ATRAC3P_SUBBAND_SAMPLES * - sizeof(ch_unit->prev_buf[ch][ch_unit->num_subbands * ATRAC3P_SUBBAND_SAMPLES])); - memset(&ctx->time_buf[ch][ch_unit->num_subbands * ATRAC3P_SUBBAND_SAMPLES], - 0, - (ATRAC3P_SUBBANDS - ch_unit->num_subbands) * - ATRAC3P_SUBBAND_SAMPLES * - sizeof(ctx->time_buf[ch][ch_unit->num_subbands * ATRAC3P_SUBBAND_SAMPLES])); - - /* resynthesize and add tonal signal */ - if (ch_unit->waves_info->tones_present || - ch_unit->waves_info_prev->tones_present) { - for (sb = 0; sb < ch_unit->num_subbands; sb++) - if (ch_unit->channels[ch].tones_info[sb].num_wavs || - ch_unit->channels[ch].tones_info_prev[sb].num_wavs) { - ff_atrac3p_generate_tones(ch_unit, &ctx->fdsp, ch, sb, - &ctx->time_buf[ch][sb * 128]); - } - } - - /* subband synthesis and acoustic signal output */ - ff_atrac3p_ipqf(&ctx->ipqf_dct_ctx, &ch_unit->ipqf_ctx[ch], - &ctx->time_buf[ch][0], &ctx->outp_buf[ch][0]); - } - - /* swap window shape and gain control buffers. */ - for (ch = 0; ch < num_channels; ch++) { - FFSWAP(uint8_t *, ch_unit->channels[ch].wnd_shape, - ch_unit->channels[ch].wnd_shape_prev); - FFSWAP(AtracGainInfo *, ch_unit->channels[ch].gain_data, - ch_unit->channels[ch].gain_data_prev); - FFSWAP(Atrac3pWavesData *, ch_unit->channels[ch].tones_info, - ch_unit->channels[ch].tones_info_prev); - } - - FFSWAP(Atrac3pWaveSynthParams *, ch_unit->waves_info, ch_unit->waves_info_prev); -} - -static int atrac3p_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - ATRAC3PContext *ctx = avctx->priv_data; - AVFrame *frame = data; - int i, ret, ch_unit_id, ch_block = 0, out_ch_index = 0, channels_to_process; - float **samples_p = (float **)frame->extended_data; - - frame->nb_samples = ATRAC3P_FRAME_SAMPLES; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return ret; - } - - if ((ret = init_get_bits8(&ctx->gb, avpkt->data, avpkt->size)) < 0) - return ret; - - if (get_bits1(&ctx->gb)) { - av_log(avctx, AV_LOG_ERROR, "Invalid start bit!\n"); - return AVERROR_INVALIDDATA; - } - - while (get_bits_left(&ctx->gb) >= 2 && - (ch_unit_id = get_bits(&ctx->gb, 2)) != CH_UNIT_TERMINATOR) { - if (ch_unit_id == CH_UNIT_EXTENSION) { - avpriv_report_missing_feature(avctx, "Channel unit extension"); - return AVERROR_PATCHWELCOME; - } - if (ch_block >= ctx->num_channel_blocks || - ctx->channel_blocks[ch_block] != ch_unit_id) { - av_log(avctx, AV_LOG_ERROR, - "Frame data doesn't match channel configuration!\n"); - return AVERROR_INVALIDDATA; - } - - ctx->ch_units[ch_block].unit_type = ch_unit_id; - channels_to_process = ch_unit_id + 1; - - if ((ret = ff_atrac3p_decode_channel_unit(&ctx->gb, - &ctx->ch_units[ch_block], - channels_to_process, - avctx)) < 0) - return ret; - - decode_residual_spectrum(&ctx->ch_units[ch_block], ctx->samples, - channels_to_process, avctx); - reconstruct_frame(ctx, &ctx->ch_units[ch_block], - channels_to_process, avctx); - - for (i = 0; i < channels_to_process; i++) - memcpy(samples_p[out_ch_index + i], ctx->outp_buf[i], - ATRAC3P_FRAME_SAMPLES * sizeof(**samples_p)); - - ch_block++; - out_ch_index += channels_to_process; - } - - *got_frame_ptr = 1; - - return avctx->block_align; -} - -AVCodec ff_atrac3p_decoder = { - .name = "atrac3plus", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3+ (Adaptive TRansform Acoustic Coding 3+)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ATRAC3P, - .priv_data_size = sizeof(ATRAC3PContext), - .init = atrac3p_decode_init, - .close = atrac3p_decode_close, - .decode = atrac3p_decode_frame, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdsp.c deleted file mode 100644 index 3522af1e5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/atrac3plusdsp.c +++ /dev/null @@ -1,638 +0,0 @@ -/* - * ATRAC3+ compatible decoder - * - * Copyright (c) 2010-2013 Maxim Poliakovski - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * DSP functions for ATRAC3+ decoder. - */ - -#include - -#include "libavutil/float_dsp.h" -#include "avcodec.h" -#include "sinewin.h" -#include "fft.h" -#include "atrac3plus.h" - -/** - * Map quant unit number to its position in the spectrum. - * To get the number of spectral lines in each quant unit do the following: - * num_specs = qu_to_spec_pos[i+1] - qu_to_spec_pos[i] - */ -const uint16_t ff_atrac3p_qu_to_spec_pos[33] = { - 0, 16, 32, 48, 64, 80, 96, 112, - 128, 160, 192, 224, 256, 288, 320, 352, - 384, 448, 512, 576, 640, 704, 768, 896, - 1024, 1152, 1280, 1408, 1536, 1664, 1792, 1920, - 2048 -}; - -/* Scalefactors table. */ -/* Approx. Equ: pow(2.0, (i - 16.0 + 0.501783948) / 3.0) */ -const float ff_atrac3p_sf_tab[64] = { - 0.027852058, 0.0350914, 0.044212341, 0.055704117, 0.0701828, - 0.088424683, 0.11140823, 0.1403656, 0.17684937, 0.22281647, 0.2807312, 0.35369873, - 0.44563293, 0.5614624, 0.70739746, 0.89126587, 1.1229248, 1.4147949, 1.7825317, - 2.2458496, 2.8295898, 3.5650635, 4.4916992, 5.6591797, 7.130127, 8.9833984, - 11.318359, 14.260254, 17.966797, 22.636719, 28.520508, 35.933594, 45.273438, - 57.041016, 71.867188, 90.546875, 114.08203, 143.73438, 181.09375, 228.16406, - 287.46875, 362.1875, 456.32812, 574.9375, 724.375, 912.65625, 1149.875, - 1448.75, 1825.3125, 2299.75, 2897.5, 3650.625, 4599.5, 5795.0, - 7301.25, 9199.0, 11590.0, 14602.5, 18398.0, 23180.0, 29205.0, - 36796.0, 46360.0, 58410.0 -}; - -/* Mantissa table. */ -/* pow(10, x * log10(2) + 0.05) / 2 / ([1,2,3,5,7,15,31] + 0.5) */ -const float ff_atrac3p_mant_tab[8] = { - 0.0, - 0.74801636, - 0.44882202, - 0.32058716, - 0.20400238, - 0.1496048, - 0.07239151, - 0.035619736 -}; - -#define ATRAC3P_MDCT_SIZE (ATRAC3P_SUBBAND_SAMPLES * 2) - -av_cold void ff_atrac3p_init_imdct(AVCodecContext *avctx, FFTContext *mdct_ctx) -{ - ff_init_ff_sine_windows(7); - ff_init_ff_sine_windows(6); - - /* Initialize the MDCT transform. */ - ff_mdct_init(mdct_ctx, 8, 1, -1.0); -} - -#define TWOPI (2 * M_PI) - -#define DEQUANT_PHASE(ph) (((ph) & 0x1F) << 6) - -static DECLARE_ALIGNED(32, float, sine_table)[2048]; ///< wave table -static DECLARE_ALIGNED(32, float, hann_window)[256]; ///< Hann windowing function -static float amp_sf_tab[64]; ///< scalefactors for quantized amplitudes - -av_cold void ff_atrac3p_init_wave_synth(void) -{ - int i; - - /* generate sine wave table */ - for (i = 0; i < 2048; i++) - sine_table[i] = sin(TWOPI * i / 2048); - - /* generate Hann window */ - for (i = 0; i < 256; i++) - hann_window[i] = (1.0f - cos(TWOPI * i / 256.0f)) * 0.5f; - - /* generate amplitude scalefactors table */ - for (i = 0; i < 64; i++) - amp_sf_tab[i] = pow(2.0f, ((double)i - 3) / 4.0f); -} - -/** - * Synthesize sine waves according to given parameters. - * - * @param[in] synth_param ptr to common synthesis parameters - * @param[in] waves_info parameters for each sine wave - * @param[in] envelope envelope data for all waves in a group - * @param[in] phase_shift flag indicates 180° phase shift - * @param[in] reg_offset region offset for trimming envelope data - * @param[out] out receives sythesized data - */ -static void waves_synth(Atrac3pWaveSynthParams *synth_param, - Atrac3pWavesData *waves_info, - Atrac3pWaveEnvelope *envelope, - int phase_shift, int reg_offset, float *out) -{ - int i, wn, inc, pos; - double amp; - Atrac3pWaveParam *wave_param = &synth_param->waves[waves_info->start_index]; - - for (wn = 0; wn < waves_info->num_wavs; wn++, wave_param++) { - /* amplitude dequantization */ - amp = amp_sf_tab[wave_param->amp_sf] * - (!synth_param->amplitude_mode - ? (wave_param->amp_index + 1) / 15.13f - : 1.0f); - - inc = wave_param->freq_index; - pos = DEQUANT_PHASE(wave_param->phase_index) - (reg_offset ^ 128) * inc & 2047; - - /* waveform generation */ - for (i = 0; i < 128; i++) { - out[i] += sine_table[pos] * amp; - pos = (pos + inc) & 2047; - } - } - - /* fade in with steep Hann window if requested */ - if (envelope->has_start_point) { - pos = (envelope->start_pos << 2) - reg_offset; - if (pos > 0 && pos <= 128) { - memset(out, 0, pos * sizeof(*out)); - if (!envelope->has_stop_point || - envelope->start_pos != envelope->stop_pos) { - out[pos + 0] *= hann_window[0]; - out[pos + 1] *= hann_window[32]; - out[pos + 2] *= hann_window[64]; - out[pos + 3] *= hann_window[96]; - } - } - } - - /* fade out with steep Hann window if requested */ - if (envelope->has_stop_point) { - pos = (envelope->stop_pos + 1 << 2) - reg_offset; - if (pos > 0 && pos <= 128) { - out[pos - 4] *= hann_window[96]; - out[pos - 3] *= hann_window[64]; - out[pos - 2] *= hann_window[32]; - out[pos - 1] *= hann_window[0]; - memset(&out[pos], 0, (128 - pos) * sizeof(out[pos])); - } - } -} - -void ff_atrac3p_generate_tones(Atrac3pChanUnitCtx *ch_unit, AVFloatDSPContext *fdsp, - int ch_num, int sb, float *out) -{ - DECLARE_ALIGNED(32, float, wavreg1)[128] = { 0 }; - DECLARE_ALIGNED(32, float, wavreg2)[128] = { 0 }; - int i, reg1_env_nonzero, reg2_env_nonzero; - Atrac3pWavesData *tones_now = &ch_unit->channels[ch_num].tones_info_prev[sb]; - Atrac3pWavesData *tones_next = &ch_unit->channels[ch_num].tones_info[sb]; - - /* reconstruct full envelopes for both overlapping regions - * from truncated bitstream data */ - if (tones_next->pend_env.has_start_point && - tones_next->pend_env.start_pos < tones_next->pend_env.stop_pos) { - tones_next->curr_env.has_start_point = 1; - tones_next->curr_env.start_pos = tones_next->pend_env.start_pos + 32; - } else if (tones_now->pend_env.has_start_point) { - tones_next->curr_env.has_start_point = 1; - tones_next->curr_env.start_pos = tones_now->pend_env.start_pos; - } else { - tones_next->curr_env.has_start_point = 0; - tones_next->curr_env.start_pos = 0; - } - - if (tones_now->pend_env.has_stop_point && - tones_now->pend_env.stop_pos >= tones_next->curr_env.start_pos) { - tones_next->curr_env.has_stop_point = 1; - tones_next->curr_env.stop_pos = tones_now->pend_env.stop_pos; - } else if (tones_next->pend_env.has_stop_point) { - tones_next->curr_env.has_stop_point = 1; - tones_next->curr_env.stop_pos = tones_next->pend_env.stop_pos + 32; - } else { - tones_next->curr_env.has_stop_point = 0; - tones_next->curr_env.stop_pos = 64; - } - - /* is the visible part of the envelope non-zero? */ - reg1_env_nonzero = (tones_now->curr_env.stop_pos < 32) ? 0 : 1; - reg2_env_nonzero = (tones_next->curr_env.start_pos >= 32) ? 0 : 1; - - /* synthesize waves for both overlapping regions */ - if (tones_now->num_wavs && reg1_env_nonzero) - waves_synth(ch_unit->waves_info_prev, tones_now, &tones_now->curr_env, - ch_unit->waves_info_prev->phase_shift[sb] & ch_num, - 128, wavreg1); - - if (tones_next->num_wavs && reg2_env_nonzero) - waves_synth(ch_unit->waves_info, tones_next, &tones_next->curr_env, - ch_unit->waves_info->phase_shift[sb] & ch_num, 0, wavreg2); - - /* Hann windowing for non-faded wave signals */ - if (tones_now->num_wavs && tones_next->num_wavs && - reg1_env_nonzero && reg2_env_nonzero) { - fdsp->vector_fmul(wavreg1, wavreg1, &hann_window[128], 128); - fdsp->vector_fmul(wavreg2, wavreg2, hann_window, 128); - } else { - if (tones_now->num_wavs && !tones_now->curr_env.has_stop_point) - fdsp->vector_fmul(wavreg1, wavreg1, &hann_window[128], 128); - - if (tones_next->num_wavs && !tones_next->curr_env.has_start_point) - fdsp->vector_fmul(wavreg2, wavreg2, hann_window, 128); - } - - /* Overlap and add to residual */ - for (i = 0; i < 128; i++) - out[i] += wavreg1[i] + wavreg2[i]; -} - -static const int subband_to_powgrp[ATRAC3P_SUBBANDS] = { - 0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4 -}; - -/* noise table for power compensation */ -static const float noise_tab[1024] = { - -0.01358032, -0.05593872, 0.01696777, -0.14871216, -0.26412964, -0.09893799, 0.25723267, - 0.02008057, -0.72235107, -0.44351196, -0.22985840, 0.16833496, 0.46902466, 0.05917358, - -0.15179443, 0.41299438, -0.01287842, 0.13360596, 0.43557739, -0.09530640, -0.58422852, - 0.39266968, -0.08343506, -0.25604248, 0.22848511, 0.26013184, -0.65588379, 0.17288208, - -0.08673096, -0.05203247, 0.07299805, -0.28665161, -0.35806274, 0.06552124, -0.09387207, - 0.21099854, -0.28347778, -0.72402954, 0.05050659, -0.10635376, -0.18853760, 0.29724121, - 0.20703125, -0.29791260, -0.37634277, 0.47970581, -0.09976196, 0.32641602, -0.29248047, - -0.28237915, 0.26028442, -0.36157227, 0.22042847, -0.03222656, -0.37268066, -0.03759766, - 0.09909058, 0.23284912, 0.19320679, 0.14453125, -0.02139282, -0.19702148, 0.31533813, - -0.16741943, 0.35031128, -0.35656738, -0.66128540, -0.00701904, 0.20898438, 0.26837158, - -0.33706665, -0.04568481, 0.12600708, 0.10284424, 0.07321167, -0.18280029, 0.38101196, - 0.21301270, 0.04541016, 0.01156616, -0.26391602, -0.02346802, -0.22125244, 0.29760742, - -0.36233521, -0.31314087, -0.13967896, -0.11276245, -0.19433594, 0.34490967, 0.02343750, - 0.21963501, -0.02777100, -0.67678833, -0.08999634, 0.14233398, -0.27697754, 0.51422119, - -0.05047607, 0.48327637, 0.37167358, -0.60806274, 0.18728638, -0.15191650, 0.00637817, - 0.02832031, -0.15618896, 0.60644531, 0.21826172, 0.06384277, -0.31863403, 0.08816528, - 0.15447998, -0.07015991, -0.08154297, -0.40966797, -0.39785767, -0.11709595, 0.22052002, - 0.18466187, -0.17257690, 0.03759766, -0.06195068, 0.00433350, 0.12176514, 0.34011841, - 0.25610352, -0.05294800, 0.41033936, 0.16854858, -0.76187134, 0.13845825, -0.19418335, - -0.21524048, -0.44412231, -0.08160400, -0.28195190, -0.01873779, 0.15524292, -0.37438965, - -0.44860840, 0.43096924, -0.24746704, 0.49856567, 0.14859009, 0.38159180, 0.20541382, - -0.39175415, -0.65850830, -0.43716431, 0.13037109, -0.05111694, 0.39956665, 0.21447754, - -0.04861450, 0.33654785, 0.10589600, -0.88085938, -0.30822754, 0.38577271, 0.30047607, - 0.38836670, 0.09118652, -0.36477661, -0.01641846, -0.23031616, 0.26058960, 0.18859863, - -0.21868896, -0.17861938, -0.29754639, 0.09777832, 0.10806274, -0.51605225, 0.00076294, - 0.13259888, 0.11090088, -0.24084473, 0.24957275, 0.01379395, -0.04141235, -0.04937744, - 0.57394409, 0.27410889, 0.27587891, 0.45013428, -0.32592773, 0.11160278, -0.00970459, - 0.29092407, 0.03356934, -0.70925903, 0.04882812, 0.43499756, 0.07720947, -0.27554321, - -0.01742554, -0.08413696, -0.04028320, -0.52850342, -0.07330322, 0.05181885, 0.21362305, - -0.18765259, 0.07058716, -0.03009033, 0.32662964, 0.27023315, -0.28002930, 0.17568970, - 0.03338623, 0.30242920, -0.03921509, 0.32174683, -0.23733521, 0.08575439, -0.38269043, - 0.09194946, -0.07238770, 0.17941284, -0.51278687, -0.25146484, 0.19790649, -0.19195557, - 0.16549683, 0.42456055, 0.39129639, -0.02868652, 0.17980957, 0.24902344, -0.76583862, - -0.20959473, 0.61013794, 0.37011719, 0.36859131, -0.04486084, 0.10678101, -0.15994263, - -0.05328369, 0.28463745, -0.06420898, -0.36987305, -0.28009033, -0.11764526, 0.04312134, - -0.08038330, 0.04885864, -0.03067017, -0.00042725, 0.34289551, -0.00988770, 0.34838867, - 0.32516479, -0.16271973, 0.38269043, 0.03240967, 0.12417603, -0.14331055, -0.34902954, - -0.18325806, 0.29421997, 0.44284058, 0.75170898, -0.67245483, -0.12176514, 0.27914429, - -0.29806519, 0.19863892, 0.30087280, 0.22680664, -0.36633301, -0.32534790, -0.57553101, - -0.16641235, 0.43811035, 0.08331299, 0.15942383, 0.26516724, -0.24240112, -0.11761475, - -0.16827393, -0.14260864, 0.46343994, 0.11804199, -0.55514526, -0.02520752, -0.14309692, - 0.00448608, 0.02749634, -0.30545044, 0.70965576, 0.45108032, 0.66439819, -0.68255615, - -0.12496948, 0.09146118, -0.21109009, -0.23791504, 0.79943848, -0.35205078, -0.24963379, - 0.18719482, -0.19079590, 0.07458496, 0.07623291, -0.28781128, -0.37121582, -0.19580078, - -0.01773071, -0.16717529, 0.13040161, 0.14672852, 0.42379761, 0.03582764, 0.11431885, - 0.05145264, 0.44702148, 0.08963013, 0.01367188, -0.54519653, -0.12692261, 0.21176147, - 0.04925537, 0.30670166, -0.11029053, 0.19555664, -0.27740479, 0.23043823, 0.15554810, - -0.19299316, -0.25729370, 0.17800903, -0.03579712, -0.05065918, -0.06933594, -0.09500122, - -0.07821655, 0.23889160, -0.31900024, 0.03073120, -0.00415039, 0.61315918, 0.37176514, - -0.13442993, -0.15536499, -0.19216919, -0.37899780, 0.19992065, 0.02630615, -0.12573242, - 0.25927734, -0.02447510, 0.29629517, -0.40731812, -0.17333984, 0.24310303, -0.10607910, - 0.14828491, 0.08792114, -0.18743896, -0.05572510, -0.04833984, 0.10473633, -0.29028320, - -0.67687988, -0.28170776, -0.41687012, 0.05413818, -0.23284912, 0.09555054, -0.08969116, - -0.15112305, 0.12738037, 0.35986328, 0.28948975, 0.30691528, 0.23956299, 0.06973267, - -0.31198120, -0.18450928, 0.22280884, -0.21600342, 0.23522949, -0.61840820, -0.13012695, - 0.26412964, 0.47320557, -0.26440430, 0.38757324, 0.17352295, -0.26104736, -0.25866699, - -0.12274170, -0.29733276, 0.07687378, 0.18588257, -0.08880615, 0.31185913, 0.05313110, - -0.10885620, -0.14901733, -0.22323608, -0.08538818, 0.19812012, 0.19732666, -0.18927002, - 0.29058838, 0.25555420, -0.48599243, 0.18768311, 0.01345825, 0.34887695, 0.21530151, - 0.19857788, 0.18661499, -0.01394653, -0.09063721, -0.38781738, 0.27160645, -0.20379639, - -0.32119751, -0.23889160, 0.27096558, 0.24951172, 0.07922363, 0.07479858, -0.50946045, - 0.10220337, 0.58364868, -0.19503784, -0.18560791, -0.01165771, 0.47195435, 0.22430420, - -0.38635254, -0.03732300, -0.09179688, 0.06991577, 0.15106201, 0.20605469, -0.05969238, - -0.41821289, 0.12231445, -0.04672241, -0.05117798, -0.11523438, -0.51849365, -0.04077148, - 0.44284058, -0.64086914, 0.17019653, 0.02236938, 0.22848511, -0.23214722, -0.32354736, - -0.14068604, -0.29690552, -0.19891357, 0.02774048, -0.20965576, -0.52191162, -0.19299316, - -0.07290649, 0.49053955, -0.22302246, 0.05642700, 0.13122559, -0.20819092, -0.83590698, - -0.08181763, 0.26797485, -0.00091553, -0.09457397, 0.17089844, -0.27020264, 0.30270386, - 0.05496216, 0.09564209, -0.08590698, 0.02130127, 0.35931396, 0.21728516, -0.15396118, - -0.05053711, 0.02719116, 0.16302490, 0.43212891, 0.10229492, -0.40820312, 0.21646118, - 0.08435059, -0.11145020, -0.39962769, -0.05618286, -0.10223389, -0.60839844, 0.33724976, - -0.06341553, -0.47369385, -0.32852173, 0.05242920, 0.19635010, -0.19137573, -0.67901611, - 0.16180420, 0.05133057, -0.22283936, 0.09646606, 0.24288940, -0.45007324, 0.08804321, - 0.14053345, 0.22619629, -0.01000977, 0.36355591, -0.19863892, -0.30364990, -0.24118042, - -0.57461548, 0.26498413, 0.04345703, -0.09796143, -0.47714233, -0.23739624, 0.18737793, - 0.08926392, -0.02795410, 0.00305176, -0.08700562, -0.38711548, 0.03222656, 0.10940552, - -0.41906738, -0.01620483, -0.47061157, 0.37985229, -0.21624756, 0.47976685, -0.20046997, - -0.62533569, -0.26907349, -0.02877808, 0.00671387, -0.29071045, -0.24685669, -0.15722656, - -0.26055908, 0.29968262, 0.28225708, -0.08990479, -0.16748047, -0.46759033, -0.25067139, - -0.25183105, -0.45932007, 0.05828857, 0.29006958, 0.23840332, -0.17974854, 0.26931763, - 0.10696411, -0.06848145, -0.17126465, -0.10522461, -0.55386353, -0.42306519, -0.07608032, - 0.24380493, 0.38586426, 0.16882324, 0.26751709, 0.17303467, 0.35809326, -0.22094727, - -0.30703735, -0.28497314, -0.04321289, 0.15219116, -0.17071533, -0.39334106, 0.03439331, - -0.10809326, -0.30590820, 0.26449585, -0.07412720, 0.13638306, -0.01062012, 0.27996826, - 0.04397583, -0.05557251, -0.56933594, 0.03363037, -0.00949097, 0.52642822, -0.44329834, - 0.28308105, -0.05499268, -0.23312378, -0.29870605, -0.05123901, 0.26831055, -0.35238647, - -0.30993652, 0.34646606, -0.19775391, 0.44595337, 0.13769531, 0.45358276, 0.19961548, - 0.42681885, 0.15722656, 0.00128174, 0.23757935, 0.40988159, 0.25164795, -0.00732422, - -0.12405396, -0.43420410, -0.00402832, 0.34243774, 0.36264038, 0.18807983, -0.09301758, - -0.10296631, 0.05532837, -0.31652832, 0.14337158, 0.35040283, 0.32540894, 0.05728149, - -0.12030029, -0.25942993, -0.20312500, -0.16491699, -0.46051025, -0.08004761, 0.50772095, - 0.16168213, 0.28439331, 0.08105469, -0.19104004, 0.38589478, -0.16400146, -0.25454712, - 0.20281982, -0.20730591, -0.06311035, 0.32937622, 0.15032959, -0.05340576, 0.30487061, - -0.11648560, 0.38009644, -0.20062256, 0.43466187, 0.01150513, 0.35754395, -0.13146973, - 0.67489624, 0.05212402, 0.27914429, -0.39431763, 0.75308228, -0.13366699, 0.24453735, - 0.42248535, -0.65905762, -0.00546265, -0.03491211, -0.13659668, -0.08294678, -0.45666504, - 0.27188110, 0.12731934, 0.61148071, 0.10449219, -0.28836060, 0.00091553, 0.24618530, - 0.13119507, 0.05685425, 0.17355347, 0.42034912, 0.08514404, 0.24536133, 0.18951416, - -0.19107056, -0.15036011, 0.02334595, 0.54986572, 0.32321167, -0.16104126, -0.03054810, - 0.43594360, 0.17309570, 0.61053467, 0.24731445, 0.33334351, 0.15240479, 0.15588379, - 0.36425781, -0.30407715, -0.13302612, 0.00427246, 0.04171753, -0.33178711, 0.34216309, - -0.12463379, -0.02764893, 0.05905151, -0.31436157, 0.16531372, 0.34542847, -0.03292847, - 0.12527466, -0.12313843, -0.13171387, 0.04757690, -0.45095825, -0.19085693, 0.35342407, - -0.23239136, -0.34387207, 0.11264038, -0.15740967, 0.05273438, 0.74942017, 0.21505737, - 0.08514404, -0.42391968, -0.19531250, 0.35293579, 0.25305176, 0.15731812, -0.70324707, - -0.21591187, 0.35604858, 0.14132690, 0.11724854, 0.15853882, -0.24597168, 0.07019043, - 0.02127075, 0.12658691, 0.06390381, -0.12292480, 0.15441895, -0.47640991, 0.06195068, - 0.58981323, -0.15151978, -0.03604126, -0.45059204, -0.01672363, -0.46997070, 0.25750732, - 0.18084717, 0.06661987, 0.13253784, 0.67828369, 0.11370850, 0.11325073, -0.04611206, - -0.07791138, -0.36544800, -0.06747437, -0.31594849, 0.16131592, 0.41983032, 0.11071777, - -0.36889648, 0.30963135, -0.37875366, 0.58508301, 0.00393677, 0.12338257, 0.03424072, - -0.21728516, -0.12838745, -0.46981812, 0.05868530, -0.25015259, 0.27407837, 0.65240479, - -0.34429932, -0.15179443, 0.14056396, 0.33505249, 0.28826904, 0.09921265, 0.34390259, - 0.13656616, -0.23608398, 0.00863647, 0.02627563, -0.19119263, 0.19775391, -0.07214355, - 0.07809448, 0.03454590, -0.03417969, 0.00033569, -0.23095703, 0.18673706, 0.05798340, - 0.03814697, -0.04318237, 0.05487061, 0.08633423, 0.55950928, -0.06347656, 0.10333252, - 0.25305176, 0.05853271, 0.12246704, -0.25543213, -0.34262085, -0.36437988, -0.21304321, - -0.05093384, 0.02777100, 0.07620239, -0.21215820, -0.09326172, 0.19021606, -0.40579224, - -0.01193237, 0.19845581, -0.35336304, -0.07397461, 0.20104980, 0.08615112, -0.44375610, - 0.11419678, 0.24453735, -0.16555786, -0.05081177, -0.01406860, 0.27893066, -0.18692017, - 0.07473755, 0.03451538, -0.39733887, 0.21548462, -0.22534180, -0.39651489, -0.04989624, - -0.57662964, 0.06390381, 0.62020874, -0.13470459, 0.04345703, -0.21862793, -0.02789307, - 0.51696777, -0.27587891, 0.39004517, 0.09857178, -0.00738525, 0.31317139, 0.00048828, - -0.46572876, 0.29531860, -0.10009766, -0.27856445, 0.03594971, 0.25048828, -0.74584961, - -0.25350952, -0.03302002, 0.31188965, 0.01571655, 0.46710205, 0.21591187, 0.07260132, - -0.42132568, -0.53900146, -0.13674927, -0.16571045, -0.34454346, 0.12359619, -0.11184692, - 0.00967407, 0.34576416, -0.05761719, 0.34848022, 0.17645264, -0.39395142, 0.10339355, - 0.18215942, 0.20697021, 0.59109497, -0.11560059, -0.07385254, 0.10397339, 0.35437012, - -0.22863770, 0.01794434, 0.17559814, -0.17495728, 0.12142944, 0.10928345, -1.00000000, - -0.01379395, 0.21237183, -0.27035522, 0.27319336, -0.37066650, 0.41354370, -0.40054321, - 0.00689697, 0.26321411, 0.39266968, 0.65298462, 0.41625977, -0.13909912, 0.78375244, - -0.30941772, 0.20169067, -0.39367676, 0.94021606, -0.24066162, 0.05557251, -0.24533081, - -0.05444336, -0.76754761, -0.19375610, -0.11041260, -0.17532349, 0.16006470, 0.02188110, - 0.17465210, -0.04342651, -0.56777954, -0.40988159, 0.26687622, 0.11700439, -0.00344849, - -0.05395508, 0.37426758, -0.40719604, -0.15032959, -0.01660156, 0.04196167, -0.04559326, - -0.12969971, 0.12011719, 0.08419800, -0.11199951, 0.35174561, 0.10275269, -0.25686646, - 0.48446655, 0.03225708, 0.28408813, -0.18701172, 0.36282349, -0.03280640, 0.32302856, - 0.17233276, 0.48269653, 0.31112671, -0.04946899, 0.12774658, 0.52685547, 0.10211182, - 0.05953979, 0.05999756, 0.20144653, 0.00744629, 0.27316284, 0.24377441, 0.39672852, - 0.01702881, -0.35513306, 0.11364746, -0.13555908, 0.48880005, -0.15417480, -0.09149170, - -0.02615356, 0.46246338, -0.72250366, 0.22332764, 0.23849487, -0.25686646, -0.08514404, - -0.02062988, -0.34494019, -0.02297974, -0.80386353, -0.08074951, -0.12689209, -0.06896973, - 0.24099731, -0.35650635, -0.09558105, 0.29254150, 0.23132324, -0.16726685, 0.00000000, - -0.24237061, 0.30899048, 0.29504395, -0.20898438, 0.17059326, -0.07672119, -0.14395142, - 0.05572510, 0.20602417, -0.51550293, -0.03167725, -0.48840332, -0.20425415, 0.14144897, - 0.07275391, -0.76669312, -0.22488403, 0.20651245, 0.03259277, 0.00085449, 0.03039551, - 0.47555542, 0.38351440 -}; - -/** Noise level table for power compensation. - * Equ: pow(2.0f, (double)(6 - i) / 3.0f) where i = 0...15 */ -static const float pwc_levs[16] = { - 3.96875, 3.15625, 2.5, 2.0, 1.59375, 1.25, 1.0, 0.78125, - 0.625, 0.5, 0.40625, 0.3125, 0.25, 0.1875, 0.15625, 0.0 -}; - -/** Map subband number to quant unit number. */ -static const int subband_to_qu[17] = { - 0, 8, 12, 16, 18, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 -}; - -void ff_atrac3p_power_compensation(Atrac3pChanUnitCtx *ctx, int ch_index, - float *sp, int rng_index, int sb) -{ - AtracGainInfo *g1, *g2; - float pwcsp[ATRAC3P_SUBBAND_SAMPLES], *dst, grp_lev, qu_lev; - int i, gain_lev, gcv = 0, qu, nsp; - int swap_ch = (ctx->unit_type == CH_UNIT_STEREO && ctx->swap_channels[sb]) ? 1 : 0; - - if (ctx->channels[ch_index ^ swap_ch].power_levs[subband_to_powgrp[sb]] == ATRAC3P_POWER_COMP_OFF) - return; - - /* generate initial noise spectrum */ - for (i = 0; i < ATRAC3P_SUBBAND_SAMPLES; i++, rng_index++) - pwcsp[i] = noise_tab[rng_index & 0x3FF]; - - /* check gain control information */ - g1 = &ctx->channels[ch_index ^ swap_ch].gain_data[sb]; - g2 = &ctx->channels[ch_index ^ swap_ch].gain_data_prev[sb]; - - gain_lev = (g1->num_points > 0) ? (6 - g1->lev_code[0]) : 0; - - for (i = 0; i < g2->num_points; i++) - gcv = FFMAX(gcv, gain_lev - (g2->lev_code[i] - 6)); - - for (i = 0; i < g1->num_points; i++) - gcv = FFMAX(gcv, 6 - g1->lev_code[i]); - - grp_lev = pwc_levs[ctx->channels[ch_index ^ swap_ch].power_levs[subband_to_powgrp[sb]]] / (1 << gcv); - - /* skip the lowest two quant units (frequencies 0...351 Hz) for subband 0 */ - for (qu = subband_to_qu[sb] + (!sb ? 2 : 0); qu < subband_to_qu[sb + 1]; qu++) { - if (ctx->channels[ch_index].qu_wordlen[qu] <= 0) - continue; - - qu_lev = ff_atrac3p_sf_tab[ctx->channels[ch_index].qu_sf_idx[qu]] * - ff_atrac3p_mant_tab[ctx->channels[ch_index].qu_wordlen[qu]] / - (1 << ctx->channels[ch_index].qu_wordlen[qu]) * grp_lev; - - dst = &sp[ff_atrac3p_qu_to_spec_pos[qu]]; - nsp = ff_atrac3p_qu_to_spec_pos[qu + 1] - ff_atrac3p_qu_to_spec_pos[qu]; - - for (i = 0; i < nsp; i++) - dst[i] += pwcsp[i] * qu_lev; - } -} - -void ff_atrac3p_imdct(AVFloatDSPContext *fdsp, FFTContext *mdct_ctx, float *pIn, - float *pOut, int wind_id, int sb) -{ - int i; - - if (sb & 1) - for (i = 0; i < ATRAC3P_SUBBAND_SAMPLES / 2; i++) - FFSWAP(float, pIn[i], pIn[ATRAC3P_SUBBAND_SAMPLES - 1 - i]); - - mdct_ctx->imdct_calc(mdct_ctx, pOut, pIn); - - /* Perform windowing on the output. - * ATRAC3+ uses two different MDCT windows: - * - The first one is just the plain sine window of size 256 - * - The 2nd one is the plain sine window of size 128 - * wrapped into zero (at the start) and one (at the end) regions. - * Both regions are 32 samples long. */ - if (wind_id & 2) { /* 1st half: steep window */ - memset(pOut, 0, sizeof(float) * 32); - fdsp->vector_fmul(&pOut[32], &pOut[32], ff_sine_64, 64); - } else /* 1st half: simple sine window */ - fdsp->vector_fmul(pOut, pOut, ff_sine_128, ATRAC3P_MDCT_SIZE / 2); - - if (wind_id & 1) { /* 2nd half: steep window */ - fdsp->vector_fmul_reverse(&pOut[160], &pOut[160], ff_sine_64, 64); - memset(&pOut[224], 0, sizeof(float) * 32); - } else /* 2nd half: simple sine window */ - fdsp->vector_fmul_reverse(&pOut[128], &pOut[128], ff_sine_128, - ATRAC3P_MDCT_SIZE / 2); -} - -/* lookup table for fast modulo 23 op required for cyclic buffers of the IPQF */ -static const int mod23_lut[26] = { - 23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0 -}; - -/* First half of the 384-tap IPQF filtering coefficients. */ -static const float ipqf_coeffs1[ATRAC3P_PQF_FIR_LEN][16] = { - { -5.8336207e-7, -8.0604229e-7, -4.2005411e-7, -4.4400572e-8, - 3.226247e-8, 3.530856e-8, 1.2660377e-8, 0.000010516783, - -0.000011838618, 6.005389e-7, 0.0000014333754, 0.0000023108685, - 0.0000032569742, 0.0000046192422, 0.0000063894258, 0.0000070302972 }, - { -0.0000091622824, -0.000010502935, -0.0000079212787, -0.0000041712024, - -0.0000026336629, -0.0000015432918, -5.7168614e-7, 0.0000018111954, - 0.000023530851, 0.00002780562, 0.000032302323, 0.000036968919, - 0.000041575615, 0.000045337845, 0.000046043948, 0.000048585582 }, - { -0.000064464548, -0.000068306952, -0.000073081472, -0.00007612785, - -0.000074850752, -0.000070208509, -0.000062285151, -0.000058270442, - -0.000056296329, -0.000049888811, -0.000035615325, -0.000018532943, - 0.0000016657353, 0.00002610587, 0.000053397067, 0.00008079566 }, - { -0.00054488552, -0.00052537228, -0.00049731287, -0.00045778, - -0.00040612387, -0.00034301577, -0.00026866337, -0.00018248901, - -0.000084307925, 0.000025081157, 0.00014135583, 0.00026649953, - 0.00039945057, 0.00053928449, 0.00068422867, 0.00083093712 }, - { -0.0014771431, -0.001283227, -0.0010566821, -0.00079780724, - -0.00050782406, -0.00018855913, 0.00015771533, 0.00052769453, - 0.00091862219, 0.001326357, 0.0017469483, 0.0021754825, - 0.0026067684, 0.0030352892, 0.0034549395, 0.0038591374 }, - { -0.0022995141, -0.001443546, -0.00049266568, 0.00055068987, - 0.001682895, 0.0028992873, 0.0041943151, 0.0055614738, - 0.0069935122, 0.0084823566, 0.010018963, 0.011593862, - 0.013196872, 0.014817309, 0.016444042, 0.018065533 }, - { -0.034426283, -0.034281436, -0.033992987, -0.033563249, - -0.032995768, -0.032295227, -0.031467363, -0.030518902, - -0.02945766, -0.028291954, -0.027031265, -0.025685543, - -0.024265358, -0.022781773, -0.021246184, -0.019670162 }, - { -0.0030586775, -0.0037203205, -0.0042847847, -0.0047529764, - -0.0051268316, -0.0054091476, -0.0056034233, -0.005714261, - -0.0057445862, -0.0057025906, -0.0055920109, -0.0054194843, - -0.0051914565, -0.0049146507, -0.0045959447, -0.0042418269 }, - { -0.0016376863, -0.0017651899, -0.0018608454, -0.0019252141, - -0.0019593791, -0.0019653172, -0.0019450618, -0.0018990048, - -0.00183808, -0.0017501717, -0.0016481078, -0.0015320742, - -0.0014046903, -0.0012685474, -0.001125814, -0.00097943726 }, - { -0.00055432378, -0.00055472925, -0.00054783461, -0.00053276919, - -0.00051135791, -0.00048466062, -0.00045358928, -0.00042499689, - -0.00036942671, -0.0003392619, -0.00030001783, -0.00025986304, - -0.0002197204, -0.00018116167, -0.00014691355, -0.00011279432 }, - { -0.000064147389, -0.00006174868, -0.000054267788, -0.000047133824, - -0.000042927582, -0.000039477309, -0.000036340745, -0.000029687517, - -0.000049787737, -0.000041577889, -0.000033864744, -0.000026534748, - -0.000019841305, -0.000014789486, -0.000013131184, -0.0000099198869 }, - { -0.0000062990207, -0.0000072701259, -0.000011984052, -0.000017348082, - -0.000019907106, -0.000021348773, -0.000021961965, -0.000012203576, - -0.000010840992, 4.6299544e-7, 5.2588763e-7, 2.7792686e-7, - -2.3649704e-7, -0.0000010897784, -9.171448e-7, -5.22682e-7 } -}; - -/* Second half of the 384-tap IPQF filtering coefficients. */ -static const float ipqf_coeffs2[ATRAC3P_PQF_FIR_LEN][16] = { - { 5.22682e-7, 9.171448e-7, 0.0000010897784, 2.3649704e-7, - -2.7792686e-7, -5.2588763e-7, -4.6299544e-7, 0.000010840992, - -0.000012203576, -0.000021961965, -0.000021348773, -0.000019907106, - -0.000017348082, -0.000011984052, -0.0000072701259, -0.0000062990207 }, - { 0.0000099198869, 0.000013131184, 0.000014789486, 0.000019841305, - 0.000026534748, 0.000033864744, 0.000041577889, 0.000049787737, - -0.000029687517, -0.000036340745, -0.000039477309, -0.000042927582, - -0.000047133824, -0.000054267788, -0.00006174868, -0.000064147389 }, - { 0.00011279432, 0.00014691355, 0.00018116167, 0.0002197204, - 0.00025986304, 0.00030001783, 0.0003392619, 0.00036942671, - -0.00042499689, -0.00045358928, -0.00048466062, -0.00051135791, - -0.00053276919, -0.00054783461, -0.00055472925, -0.00055432378 }, - { 0.00097943726, 0.001125814, 0.0012685474, 0.0014046903, - 0.0015320742, 0.0016481078, 0.0017501717, 0.00183808, - -0.0018990048, -0.0019450618, -0.0019653172, -0.0019593791, - -0.0019252141, -0.0018608454, -0.0017651899, -0.0016376863 }, - { 0.0042418269, 0.0045959447, 0.0049146507, 0.0051914565, - 0.0054194843, 0.0055920109, 0.0057025906, 0.0057445862, - -0.005714261, -0.0056034233, -0.0054091476, -0.0051268316, - -0.0047529764, -0.0042847847, -0.0037203205, -0.0030586775 }, - { 0.019670162, 0.021246184, 0.022781773, 0.024265358, - 0.025685543, 0.027031265, 0.028291954, 0.02945766, - -0.030518902, -0.031467363, -0.032295227, -0.032995768, - -0.033563249, -0.033992987, -0.034281436, -0.034426283 }, - { -0.018065533, -0.016444042, -0.014817309, -0.013196872, - -0.011593862, -0.010018963, -0.0084823566, -0.0069935122, - 0.0055614738, 0.0041943151, 0.0028992873, 0.001682895, - 0.00055068987, -0.00049266568, -0.001443546, -0.0022995141 }, - { -0.0038591374, -0.0034549395, -0.0030352892, -0.0026067684, - -0.0021754825, -0.0017469483, -0.001326357, -0.00091862219, - 0.00052769453, 0.00015771533, -0.00018855913, -0.00050782406, - -0.00079780724, -0.0010566821, -0.001283227, -0.0014771431 }, - { -0.00083093712, -0.00068422867, -0.00053928449, -0.00039945057, - -0.00026649953, -0.00014135583, -0.000025081157, 0.000084307925, - -0.00018248901, -0.00026866337, -0.00034301577, -0.00040612387, - -0.00045778, -0.00049731287, -0.00052537228, -0.00054488552 }, - { -0.00008079566, -0.000053397067, -0.00002610587, -0.0000016657353, - 0.000018532943, 0.000035615325, 0.000049888811, 0.000056296329, - -0.000058270442, -0.000062285151, -0.000070208509, -0.000074850752, - -0.00007612785, -0.000073081472, -0.000068306952, -0.000064464548 }, - { -0.000048585582, -0.000046043948, -0.000045337845, -0.000041575615, - -0.000036968919, -0.000032302323, -0.00002780562, -0.000023530851, - 0.0000018111954, -5.7168614e-7, -0.0000015432918, -0.0000026336629, - -0.0000041712024, -0.0000079212787, -0.000010502935, -0.0000091622824 }, - { -0.0000070302972, -0.0000063894258, -0.0000046192422, -0.0000032569742, - -0.0000023108685, -0.0000014333754, -6.005389e-7, 0.000011838618, - 0.000010516783, 1.2660377e-8, 3.530856e-8, 3.226247e-8, - -4.4400572e-8, -4.2005411e-7, -8.0604229e-7, -5.8336207e-7 } -}; - -void ff_atrac3p_ipqf(FFTContext *dct_ctx, Atrac3pIPQFChannelCtx *hist, - const float *in, float *out) -{ - int i, s, sb, t, pos_now, pos_next; - DECLARE_ALIGNED(32, float, idct_in)[ATRAC3P_SUBBANDS]; - DECLARE_ALIGNED(32, float, idct_out)[ATRAC3P_SUBBANDS]; - - memset(out, 0, ATRAC3P_FRAME_SAMPLES * sizeof(*out)); - - for (s = 0; s < ATRAC3P_SUBBAND_SAMPLES; s++) { - /* pick up one sample from each subband */ - for (sb = 0; sb < ATRAC3P_SUBBANDS; sb++) - idct_in[sb] = in[sb * ATRAC3P_SUBBAND_SAMPLES + s]; - - /* Calculate the sine and cosine part of the PQF using IDCT-IV */ - dct_ctx->imdct_half(dct_ctx, idct_out, idct_in); - - /* append the result to the history */ - for (i = 0; i < 8; i++) { - hist->buf1[hist->pos][i] = idct_out[i + 8]; - hist->buf2[hist->pos][i] = idct_out[7 - i]; - } - - pos_now = hist->pos; - pos_next = mod23_lut[pos_now + 2]; // pos_next = (pos_now + 1) % 23; - - for (t = 0; t < ATRAC3P_PQF_FIR_LEN; t++) { - for (i = 0; i < 8; i++) { - out[s * 16 + i + 0] += hist->buf1[pos_now][i] * ipqf_coeffs1[t][i] + - hist->buf2[pos_next][i] * ipqf_coeffs2[t][i]; - out[s * 16 + i + 8] += hist->buf1[pos_now][7 - i] * ipqf_coeffs1[t][i + 8] + - hist->buf2[pos_next][7 - i] * ipqf_coeffs2[t][i + 8]; - } - - pos_now = mod23_lut[pos_next + 2]; // pos_now = (pos_now + 2) % 23; - pos_next = mod23_lut[pos_now + 2]; // pos_next = (pos_next + 2) % 23; - } - - hist->pos = mod23_lut[hist->pos]; // hist->pos = (hist->pos - 1) % 23; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.c deleted file mode 100644 index 2200f3770..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/mem.h" -#include "avfft.h" -#include "fft.h" -#include "rdft.h" -#include "dct.h" - -/* FFT */ - -FFTContext *av_fft_init(int nbits, int inverse) -{ - FFTContext *s = av_mallocz(sizeof(*s)); - - if (s && ff_fft_init(s, nbits, inverse)) - av_freep(&s); - - return s; -} - -void av_fft_permute(FFTContext *s, FFTComplex *z) -{ - s->fft_permute(s, z); -} - -void av_fft_calc(FFTContext *s, FFTComplex *z) -{ - s->fft_calc(s, z); -} - -av_cold void av_fft_end(FFTContext *s) -{ - if (s) { - ff_fft_end(s); - av_free(s); - } -} - -#if CONFIG_MDCT - -FFTContext *av_mdct_init(int nbits, int inverse, double scale) -{ - FFTContext *s = av_malloc(sizeof(*s)); - - if (s && ff_mdct_init(s, nbits, inverse, scale)) - av_freep(&s); - - return s; -} - -void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - s->imdct_calc(s, output, input); -} - -void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - s->imdct_half(s, output, input); -} - -void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - s->mdct_calc(s, output, input); -} - -av_cold void av_mdct_end(FFTContext *s) -{ - if (s) { - ff_mdct_end(s); - av_free(s); - } -} - -#endif /* CONFIG_MDCT */ - -#if CONFIG_RDFT - -RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans) -{ - RDFTContext *s = av_malloc(sizeof(*s)); - - if (s && ff_rdft_init(s, nbits, trans)) - av_freep(&s); - - return s; -} - -void av_rdft_calc(RDFTContext *s, FFTSample *data) -{ - s->rdft_calc(s, data); -} - -av_cold void av_rdft_end(RDFTContext *s) -{ - if (s) { - ff_rdft_end(s); - av_free(s); - } -} - -#endif /* CONFIG_RDFT */ - -#if CONFIG_DCT - -DCTContext *av_dct_init(int nbits, enum DCTTransformType inverse) -{ - DCTContext *s = av_malloc(sizeof(*s)); - - if (s && ff_dct_init(s, nbits, inverse)) - av_freep(&s); - - return s; -} - -void av_dct_calc(DCTContext *s, FFTSample *data) -{ - s->dct_calc(s, data); -} - -av_cold void av_dct_end(DCTContext *s) -{ - if (s) { - ff_dct_end(s); - av_free(s); - } -} - -#endif /* CONFIG_DCT */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpacket.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpacket.c deleted file mode 100644 index f966bfe89..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpacket.c +++ /dev/null @@ -1,565 +0,0 @@ -/* - * AVPacket functions for libavcodec - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "libavutil/internal.h" -#include "libavutil/mem.h" -#include "avcodec.h" -#include "bytestream.h" -#include "internal.h" - -#if FF_API_DESTRUCT_PACKET - -void av_destruct_packet(AVPacket *pkt) -{ - av_free(pkt->data); - pkt->data = NULL; - pkt->size = 0; -} - -/* a dummy destruct callback for the callers that assume AVPacket.destruct == - * NULL => static data */ -static void dummy_destruct_packet(AVPacket *pkt) -{ - av_assert0(0); -} -#endif - -void av_init_packet(AVPacket *pkt) -{ - pkt->pts = AV_NOPTS_VALUE; - pkt->dts = AV_NOPTS_VALUE; - pkt->pos = -1; - pkt->duration = 0; - pkt->convergence_duration = 0; - pkt->flags = 0; - pkt->stream_index = 0; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = NULL; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - pkt->buf = NULL; - pkt->side_data = NULL; - pkt->side_data_elems = 0; -} - -static int packet_alloc(AVBufferRef **buf, int size) -{ - int ret; - if ((unsigned)size >= (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) - return AVERROR(EINVAL); - - ret = av_buffer_realloc(buf, size + FF_INPUT_BUFFER_PADDING_SIZE); - if (ret < 0) - return ret; - - memset((*buf)->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - return 0; -} - -int av_new_packet(AVPacket *pkt, int size) -{ - AVBufferRef *buf = NULL; - int ret = packet_alloc(&buf, size); - if (ret < 0) - return ret; - - av_init_packet(pkt); - pkt->buf = buf; - pkt->data = buf->data; - pkt->size = size; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dummy_destruct_packet; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - return 0; -} - -void av_shrink_packet(AVPacket *pkt, int size) -{ - if (pkt->size <= size) - return; - pkt->size = size; - memset(pkt->data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); -} - -int av_grow_packet(AVPacket *pkt, int grow_by) -{ - int new_size; - av_assert0((unsigned)pkt->size <= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE); - if (!pkt->size) - return av_new_packet(pkt, grow_by); - if ((unsigned)grow_by > - INT_MAX - (pkt->size + FF_INPUT_BUFFER_PADDING_SIZE)) - return -1; - - new_size = pkt->size + grow_by + FF_INPUT_BUFFER_PADDING_SIZE; - if (pkt->buf) { - int ret = av_buffer_realloc(&pkt->buf, new_size); - if (ret < 0) - return ret; - } else { - pkt->buf = av_buffer_alloc(new_size); - if (!pkt->buf) - return AVERROR(ENOMEM); - memcpy(pkt->buf->data, pkt->data, FFMIN(pkt->size, pkt->size + grow_by)); -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dummy_destruct_packet; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - } - pkt->data = pkt->buf->data; - pkt->size += grow_by; - memset(pkt->data + pkt->size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - return 0; -} - -int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size) -{ - if (size >= INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) - return AVERROR(EINVAL); - - pkt->buf = av_buffer_create(data, size + FF_INPUT_BUFFER_PADDING_SIZE, - av_buffer_default_free, NULL, 0); - if (!pkt->buf) - return AVERROR(ENOMEM); - - pkt->data = data; - pkt->size = size; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dummy_destruct_packet; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - return 0; -} - -#define ALLOC_MALLOC(data, size) data = av_malloc(size) -#define ALLOC_BUF(data, size) \ -do { \ - av_buffer_realloc(&pkt->buf, size); \ - data = pkt->buf ? pkt->buf->data : NULL; \ -} while (0) - -#define DUP_DATA(dst, src, size, padding, ALLOC) \ - do { \ - void *data; \ - if (padding) { \ - if ((unsigned)(size) > \ - (unsigned)(size) + FF_INPUT_BUFFER_PADDING_SIZE) \ - goto failed_alloc; \ - ALLOC(data, size + FF_INPUT_BUFFER_PADDING_SIZE); \ - } else { \ - ALLOC(data, size); \ - } \ - if (!data) \ - goto failed_alloc; \ - memcpy(data, src, size); \ - if (padding) \ - memset((uint8_t *)data + size, 0, \ - FF_INPUT_BUFFER_PADDING_SIZE); \ - dst = data; \ - } while (0) - -/* Makes duplicates of data, side_data, but does not copy any other fields */ -static int copy_packet_data(AVPacket *pkt, AVPacket *src, int dup) -{ - pkt->data = NULL; - pkt->side_data = NULL; - if (pkt->buf) { - AVBufferRef *ref = av_buffer_ref(src->buf); - if (!ref) - return AVERROR(ENOMEM); - pkt->buf = ref; - pkt->data = ref->data; - } else { - DUP_DATA(pkt->data, src->data, pkt->size, 1, ALLOC_BUF); - } -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dummy_destruct_packet; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (pkt->side_data_elems && dup) - pkt->side_data = src->side_data; - if (pkt->side_data_elems && !dup) { - return av_copy_packet_side_data(pkt, src); - } - return 0; - -failed_alloc: - av_free_packet(pkt); - return AVERROR(ENOMEM); -} - -int av_copy_packet_side_data(AVPacket *pkt, AVPacket *src) -{ - if (src->side_data_elems) { - int i; - DUP_DATA(pkt->side_data, src->side_data, - src->side_data_elems * sizeof(*src->side_data), 0, ALLOC_MALLOC); - if (src != pkt) { - memset(pkt->side_data, 0, - src->side_data_elems * sizeof(*src->side_data)); - } - for (i = 0; i < src->side_data_elems; i++) { - DUP_DATA(pkt->side_data[i].data, src->side_data[i].data, - src->side_data[i].size, 1, ALLOC_MALLOC); - pkt->side_data[i].size = src->side_data[i].size; - pkt->side_data[i].type = src->side_data[i].type; - } - } - pkt->side_data_elems = src->side_data_elems; - return 0; - -failed_alloc: - av_free_packet(pkt); - return AVERROR(ENOMEM); -} - -int av_dup_packet(AVPacket *pkt) -{ - AVPacket tmp_pkt; - -FF_DISABLE_DEPRECATION_WARNINGS - if (!pkt->buf && pkt->data -#if FF_API_DESTRUCT_PACKET - && !pkt->destruct -#endif - ) { -FF_ENABLE_DEPRECATION_WARNINGS - tmp_pkt = *pkt; - return copy_packet_data(pkt, &tmp_pkt, 1); - } - return 0; -} - -int av_copy_packet(AVPacket *dst, AVPacket *src) -{ - *dst = *src; - return copy_packet_data(dst, src, 0); -} - -void av_packet_free_side_data(AVPacket *pkt) -{ - int i; - for (i = 0; i < pkt->side_data_elems; i++) - av_free(pkt->side_data[i].data); - av_freep(&pkt->side_data); - pkt->side_data_elems = 0; -} - -void av_free_packet(AVPacket *pkt) -{ - if (pkt) { -FF_DISABLE_DEPRECATION_WARNINGS - if (pkt->buf) - av_buffer_unref(&pkt->buf); -#if FF_API_DESTRUCT_PACKET - else if (pkt->destruct) - pkt->destruct(pkt); - pkt->destruct = NULL; -#endif -FF_ENABLE_DEPRECATION_WARNINGS - pkt->data = NULL; - pkt->size = 0; - - av_packet_free_side_data(pkt); - } -} - -uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size) -{ - int elems = pkt->side_data_elems; - - if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data)) - return NULL; - if ((unsigned)size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) - return NULL; - - pkt->side_data = av_realloc(pkt->side_data, - (elems + 1) * sizeof(*pkt->side_data)); - if (!pkt->side_data) - return NULL; - - pkt->side_data[elems].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!pkt->side_data[elems].data) - return NULL; - pkt->side_data[elems].size = size; - pkt->side_data[elems].type = type; - pkt->side_data_elems++; - - return pkt->side_data[elems].data; -} - -uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int *size) -{ - int i; - - for (i = 0; i < pkt->side_data_elems; i++) { - if (pkt->side_data[i].type == type) { - if (size) - *size = pkt->side_data[i].size; - return pkt->side_data[i].data; - } - } - return NULL; -} - -#define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL - -int av_packet_merge_side_data(AVPacket *pkt){ - if(pkt->side_data_elems){ - AVBufferRef *buf; - int i; - uint8_t *p; - uint64_t size= pkt->size + 8LL + FF_INPUT_BUFFER_PADDING_SIZE; - AVPacket old= *pkt; - for (i=0; i INT_MAX) - return AVERROR(EINVAL); - buf = av_buffer_alloc(size); - if (!buf) - return AVERROR(ENOMEM); - pkt->buf = buf; - pkt->data = p = buf->data; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dummy_destruct_packet; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - pkt->size = size - FF_INPUT_BUFFER_PADDING_SIZE; - bytestream_put_buffer(&p, old.data, old.size); - for (i=old.side_data_elems-1; i>=0; i--) { - bytestream_put_buffer(&p, old.side_data[i].data, old.side_data[i].size); - bytestream_put_be32(&p, old.side_data[i].size); - *p++ = old.side_data[i].type | ((i==old.side_data_elems-1)*128); - } - bytestream_put_be64(&p, FF_MERGE_MARKER); - av_assert0(p-pkt->data == pkt->size); - memset(p, 0, FF_INPUT_BUFFER_PADDING_SIZE); - av_free_packet(&old); - pkt->side_data_elems = 0; - pkt->side_data = NULL; - return 1; - } - return 0; -} - -int av_packet_split_side_data(AVPacket *pkt){ - if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){ - int i; - unsigned int size; - uint8_t *p; - - p = pkt->data + pkt->size - 8 - 5; - for (i=1; ; i++){ - size = AV_RB32(p); - if (size>INT_MAX || p - pkt->data < size) - return 0; - if (p[4]&128) - break; - p-= size+5; - } - - pkt->side_data = av_malloc(i * sizeof(*pkt->side_data)); - if (!pkt->side_data) - return AVERROR(ENOMEM); - - p= pkt->data + pkt->size - 8 - 5; - for (i=0; ; i++){ - size= AV_RB32(p); - av_assert0(size<=INT_MAX && p - pkt->data >= size); - pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); - pkt->side_data[i].size = size; - pkt->side_data[i].type = p[4]&127; - if (!pkt->side_data[i].data) - return AVERROR(ENOMEM); - memcpy(pkt->side_data[i].data, p-size, size); - pkt->size -= size + 5; - if(p[4]&128) - break; - p-= size+5; - } - pkt->size -= 8; - pkt->side_data_elems = i+1; - return 1; - } - return 0; -} - -uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size) -{ - AVDictionaryEntry *t = NULL; - uint8_t *data = NULL; - *size = 0; - - if (!dict) - return NULL; - - while ((t = av_dict_get(dict, "", t, AV_DICT_IGNORE_SUFFIX))) { - const size_t keylen = strlen(t->key); - const size_t valuelen = strlen(t->value); - const size_t new_size = *size + keylen + 1 + valuelen + 1; - uint8_t *const new_data = av_realloc(data, new_size); - - if (!new_data) - goto fail; - data = new_data; - if (new_size > INT_MAX) - goto fail; - - memcpy(data + *size, t->key, keylen + 1); - memcpy(data + *size + keylen + 1, t->value, valuelen + 1); - - *size = new_size; - } - - return data; - -fail: - av_freep(&data); - *size = 0; - return NULL; -} - -int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict) -{ - const uint8_t *end = data + size; - int ret = 0; - - if (!dict || !data || !size) - return ret; - if (size && end[-1]) - return AVERROR_INVALIDDATA; - while (data < end) { - const uint8_t *key = data; - const uint8_t *val = data + strlen(key) + 1; - - if (val >= end) - return AVERROR_INVALIDDATA; - - ret = av_dict_set(dict, key, val, 0); - if (ret < 0) - break; - data = val + strlen(val) + 1; - } - - return ret; -} - -int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, - int size) -{ - int i; - - for (i = 0; i < pkt->side_data_elems; i++) { - if (pkt->side_data[i].type == type) { - if (size > pkt->side_data[i].size) - return AVERROR(ENOMEM); - pkt->side_data[i].size = size; - return 0; - } - } - return AVERROR(ENOENT); -} - -int av_packet_copy_props(AVPacket *dst, const AVPacket *src) -{ - int i; - - dst->pts = src->pts; - dst->dts = src->dts; - dst->pos = src->pos; - dst->duration = src->duration; - dst->convergence_duration = src->convergence_duration; - dst->flags = src->flags; - dst->stream_index = src->stream_index; - dst->side_data_elems = src->side_data_elems; - - for (i = 0; i < src->side_data_elems; i++) { - enum AVPacketSideDataType type = src->side_data[i].type; - int size = src->side_data[i].size; - uint8_t *src_data = src->side_data[i].data; - uint8_t *dst_data = av_packet_new_side_data(dst, type, size); - - if (!dst_data) { - av_packet_free_side_data(dst); - return AVERROR(ENOMEM); - } - memcpy(dst_data, src_data, size); - } - - return 0; -} - -void av_packet_unref(AVPacket *pkt) -{ - av_packet_free_side_data(pkt); - av_buffer_unref(&pkt->buf); - av_init_packet(pkt); - pkt->data = NULL; - pkt->size = 0; -} - -int av_packet_ref(AVPacket *dst, AVPacket *src) -{ - int ret; - - ret = av_packet_copy_props(dst, src); - if (ret < 0) - return ret; - - if (!src->buf) { - ret = packet_alloc(&dst->buf, src->size); - if (ret < 0) - goto fail; - memcpy(dst->buf->data, src->data, src->size); - } else - dst->buf = av_buffer_ref(src->buf); - - dst->size = src->size; - dst->data = dst->buf->data; - return 0; -fail: - av_packet_free_side_data(dst); - return ret; -} - -void av_packet_move_ref(AVPacket *dst, AVPacket *src) -{ - *dst = *src; - av_init_packet(src); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpicture.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpicture.c deleted file mode 100644 index a6f89ef88..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avpicture.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * AVPicture management routines - * Copyright (c) 2001, 2002, 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AVPicture management routines - */ - -#include "avcodec.h" -#include "internal.h" -#include "libavutil/common.h" -#include "libavutil/pixdesc.h" -#include "libavutil/imgutils.h" -#include "libavutil/colorspace.h" - -int avpicture_fill(AVPicture *picture, const uint8_t *ptr, - enum AVPixelFormat pix_fmt, int width, int height) -{ - return av_image_fill_arrays(picture->data, picture->linesize, - ptr, pix_fmt, width, height, 1); -} - -int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, int width, int height, - unsigned char *dest, int dest_size) -{ - return av_image_copy_to_buffer(dest, dest_size, - (const uint8_t * const*)src->data, src->linesize, - pix_fmt, width, height, 1); -} - -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height) -{ - return av_image_get_buffer_size(pix_fmt, width, height, 1); -} - -int avpicture_alloc(AVPicture *picture, - enum AVPixelFormat pix_fmt, int width, int height) -{ - int ret = av_image_alloc(picture->data, picture->linesize, - width, height, pix_fmt, 1); - if (ret < 0) { - memset(picture, 0, sizeof(AVPicture)); - return ret; - } - - return 0; -} - -void avpicture_free(AVPicture *picture) -{ - av_free(picture->data[0]); -} - -void av_picture_copy(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height) -{ - av_image_copy(dst->data, dst->linesize, (const uint8_t **)src->data, - src->linesize, pix_fmt, width, height); -} - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bit_depth_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bit_depth_template.c deleted file mode 100644 index 96f5edec0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bit_depth_template.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "rnd_avg.h" -#include "libavutil/intreadwrite.h" - -#ifndef BIT_DEPTH -#define BIT_DEPTH 8 -#endif - -#ifdef AVCODEC_H264_HIGH_DEPTH_H -# undef pixel -# undef pixel2 -# undef pixel4 -# undef dctcoef -# undef INIT_CLIP -# undef no_rnd_avg_pixel4 -# undef rnd_avg_pixel4 -# undef AV_RN2P -# undef AV_RN4P -# undef AV_RN4PA -# undef AV_WN2P -# undef AV_WN4P -# undef AV_WN4PA -# undef CLIP -# undef FUNC -# undef FUNCC -# undef av_clip_pixel -# undef PIXEL_SPLAT_X4 -#else -# define AVCODEC_H264_HIGH_DEPTH_H -#endif - -#if BIT_DEPTH > 8 -# define pixel uint16_t -# define pixel2 uint32_t -# define pixel4 uint64_t -# define dctcoef int32_t - -# define INIT_CLIP -# define no_rnd_avg_pixel4 no_rnd_avg64 -# define rnd_avg_pixel4 rnd_avg64 -# define AV_RN2P AV_RN32 -# define AV_RN4P AV_RN64 -# define AV_RN4PA AV_RN64A -# define AV_WN2P AV_WN32 -# define AV_WN4P AV_WN64 -# define AV_WN4PA AV_WN64A -# define PIXEL_SPLAT_X4(x) ((x)*0x0001000100010001ULL) - -# define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH) -# define CLIP(a) av_clip_uintp2(a, BIT_DEPTH) -#else -# define pixel uint8_t -# define pixel2 uint16_t -# define pixel4 uint32_t -# define dctcoef int16_t - -# define INIT_CLIP -# define no_rnd_avg_pixel4 no_rnd_avg32 -# define rnd_avg_pixel4 rnd_avg32 -# define AV_RN2P AV_RN16 -# define AV_RN4P AV_RN32 -# define AV_RN4PA AV_RN32A -# define AV_WN2P AV_WN16 -# define AV_WN4P AV_WN32 -# define AV_WN4PA AV_WN32A -# define PIXEL_SPLAT_X4(x) ((x)*0x01010101U) - -# define av_clip_pixel(a) av_clip_uint8(a) -# define CLIP(a) av_clip_uint8(a) -#endif - -#define FUNC3(a, b, c) a ## _ ## b ## c -#define FUNC2(a, b, c) FUNC3(a, b, c) -#define FUNC(a) FUNC2(a, BIT_DEPTH,) -#define FUNCC(a) FUNC2(a, BIT_DEPTH, _c) diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream.c deleted file mode 100644 index b38c5d222..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Common bit i/o utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * Copyright (c) 2010 Loren Merritt - * - * alternative bitstream reader & writer by Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * bitstream api. - */ - -#include "libavutil/atomic.h" -#include "libavutil/avassert.h" -#include "avcodec.h" -#include "mathops.h" -#include "get_bits.h" -#include "put_bits.h" - -const uint8_t ff_log2_run[41]={ - 0, 0, 0, 0, 1, 1, 1, 1, - 2, 2, 2, 2, 3, 3, 3, 3, - 4, 4, 5, 5, 6, 6, 7, 7, - 8, 9,10,11,12,13,14,15, -16,17,18,19,20,21,22,23, -24, -}; - -void avpriv_align_put_bits(PutBitContext *s) -{ - put_bits(s, s->bit_left & 7, 0); -} - -void avpriv_put_string(PutBitContext *pb, const char *string, - int terminate_string) -{ - while (*string) { - put_bits(pb, 8, *string); - string++; - } - if (terminate_string) - put_bits(pb, 8, 0); -} - -void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length) -{ - int words = length >> 4; - int bits = length & 15; - int i; - - if (length == 0) - return; - - if (CONFIG_SMALL || words < 16 || put_bits_count(pb) & 7) { - for (i = 0; i < words; i++) - put_bits(pb, 16, AV_RB16(src + 2 * i)); - } else { - for (i = 0; put_bits_count(pb) & 31; i++) - put_bits(pb, 8, src[i]); - flush_put_bits(pb); - memcpy(put_bits_ptr(pb), src + i, 2 * words - i); - skip_put_bytes(pb, 2 * words - i); - } - - put_bits(pb, bits, AV_RB16(src + 2 * words) >> (16 - bits)); -} - -/* VLC decoding */ - -#define GET_DATA(v, table, i, wrap, size) \ -{ \ - const uint8_t *ptr = (const uint8_t *)table + i * wrap; \ - switch(size) { \ - case 1: \ - v = *(const uint8_t *)ptr; \ - break; \ - case 2: \ - v = *(const uint16_t *)ptr; \ - break; \ - default: \ - v = *(const uint32_t *)ptr; \ - break; \ - } \ -} - - -static int alloc_table(VLC *vlc, int size, int use_static) -{ - int index = vlc->table_size; - - vlc->table_size += size; - if (vlc->table_size > vlc->table_allocated) { - if (use_static) - abort(); // cannot do anything, init_vlc() is used with too little memory - vlc->table_allocated += (1 << vlc->bits); - vlc->table = av_realloc_f(vlc->table, vlc->table_allocated, sizeof(VLC_TYPE) * 2); - if (!vlc->table) { - vlc->table_allocated = 0; - vlc->table_size = 0; - return AVERROR(ENOMEM); - } - } - return index; -} - -static av_always_inline uint32_t bitswap_32(uint32_t x) -{ - return (uint32_t)ff_reverse[ x & 0xFF] << 24 | - (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 | - (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 | - (uint32_t)ff_reverse[ x >> 24]; -} - -typedef struct { - uint8_t bits; - uint16_t symbol; - /** codeword, with the first bit-to-be-read in the msb - * (even if intended for a little-endian bitstream reader) */ - uint32_t code; -} VLCcode; - -static int compare_vlcspec(const void *a, const void *b) -{ - const VLCcode *sa = a, *sb = b; - return (sa->code >> 1) - (sb->code >> 1); -} -/** - * Build VLC decoding tables suitable for use with get_vlc(). - * - * @param vlc the context to be initted - * - * @param table_nb_bits max length of vlc codes to store directly in this table - * (Longer codes are delegated to subtables.) - * - * @param nb_codes number of elements in codes[] - * - * @param codes descriptions of the vlc codes - * These must be ordered such that codes going into the same subtable are contiguous. - * Sorting by VLCcode.code is sufficient, though not necessary. - */ -static int build_table(VLC *vlc, int table_nb_bits, int nb_codes, - VLCcode *codes, int flags) -{ - int table_size, table_index, index, code_prefix, symbol, subtable_bits; - int i, j, k, n, nb, inc; - uint32_t code; - VLC_TYPE (*table)[2]; - - table_size = 1 << table_nb_bits; - if (table_nb_bits > 30) - return -1; - table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC); - av_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size); - if (table_index < 0) - return table_index; - table = &vlc->table[table_index]; - - for (i = 0; i < table_size; i++) { - table[i][1] = 0; //bits - table[i][0] = -1; //codes - } - - /* first pass: map codes and compute auxiliary table sizes */ - for (i = 0; i < nb_codes; i++) { - n = codes[i].bits; - code = codes[i].code; - symbol = codes[i].symbol; - av_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code); - if (n <= table_nb_bits) { - /* no need to add another table */ - j = code >> (32 - table_nb_bits); - nb = 1 << (table_nb_bits - n); - inc = 1; - if (flags & INIT_VLC_LE) { - j = bitswap_32(code); - inc = 1 << n; - } - for (k = 0; k < nb; k++) { - av_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n); - if (table[j][1] /*bits*/ != 0) { - av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); - return AVERROR_INVALIDDATA; - } - table[j][1] = n; //bits - table[j][0] = symbol; - j += inc; - } - } else { - /* fill auxiliary table recursively */ - n -= table_nb_bits; - code_prefix = code >> (32 - table_nb_bits); - subtable_bits = n; - codes[i].bits = n; - codes[i].code = code << table_nb_bits; - for (k = i+1; k < nb_codes; k++) { - n = codes[k].bits - table_nb_bits; - if (n <= 0) - break; - code = codes[k].code; - if (code >> (32 - table_nb_bits) != code_prefix) - break; - codes[k].bits = n; - codes[k].code = code << table_nb_bits; - subtable_bits = FFMAX(subtable_bits, n); - } - subtable_bits = FFMIN(subtable_bits, table_nb_bits); - j = (flags & INIT_VLC_LE) ? bitswap_32(code_prefix) >> (32 - table_nb_bits) : code_prefix; - table[j][1] = -subtable_bits; - av_dlog(NULL, "%4x: n=%d (subtable)\n", - j, codes[i].bits + table_nb_bits); - index = build_table(vlc, subtable_bits, k-i, codes+i, flags); - if (index < 0) - return index; - /* note: realloc has been done, so reload tables */ - table = &vlc->table[table_index]; - table[j][0] = index; //code - av_assert0(table[j][0] == index); - i = k-1; - } - } - return table_index; -} - - -/* Build VLC decoding tables suitable for use with get_vlc(). - - 'nb_bits' set thee decoding table size (2^nb_bits) entries. The - bigger it is, the faster is the decoding. But it should not be too - big to save memory and L1 cache. '9' is a good compromise. - - 'nb_codes' : number of vlcs codes - - 'bits' : table which gives the size (in bits) of each vlc code. - - 'codes' : table which gives the bit pattern of of each vlc code. - - 'symbols' : table which gives the values to be returned from get_vlc(). - - 'xxx_wrap' : give the number of bytes between each entry of the - 'bits' or 'codes' tables. - - 'xxx_size' : gives the number of bytes of each entry of the 'bits' - or 'codes' tables. - - 'wrap' and 'size' allows to use any memory configuration and types - (byte/word/long) to store the 'bits', 'codes', and 'symbols' tables. - - 'use_static' should be set to 1 for tables, which should be freed - with av_free_static(), 0 if ff_free_vlc() will be used. -*/ -int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, - const void *bits, int bits_wrap, int bits_size, - const void *codes, int codes_wrap, int codes_size, - const void *symbols, int symbols_wrap, int symbols_size, - int flags) -{ - VLCcode *buf; - int i, j, ret; - VLCcode localbuf[1500]; // the maximum currently needed is 1296 by rv34 - void *state; - - vlc->bits = nb_bits; - if (flags & INIT_VLC_USE_NEW_STATIC) { - while ((state = avpriv_atomic_ptr_cas(&vlc->init_state, NULL, vlc))) { - if (state == vlc + 1) { - av_assert0(vlc->table_size && vlc->table_size == vlc->table_allocated); - return 0; - } - } - av_assert0(!vlc->table_size); - av_assert0(nb_codes + 1 <= FF_ARRAY_ELEMS(localbuf)); - buf = localbuf; - } else { - vlc->table = NULL; - vlc->table_allocated = 0; - vlc->table_size = 0; - - buf = av_malloc((nb_codes + 1) * sizeof(VLCcode)); - if (!buf) - return AVERROR(ENOMEM); - } - - - av_assert0(symbols_size <= 2 || !symbols); - j = 0; -#define COPY(condition)\ - for (i = 0; i < nb_codes; i++) { \ - GET_DATA(buf[j].bits, bits, i, bits_wrap, bits_size); \ - if (!(condition)) \ - continue; \ - if (buf[j].bits > 3*nb_bits || buf[j].bits>32) { \ - av_log(NULL, AV_LOG_ERROR, "Too long VLC (%d) in init_vlc\n", buf[j].bits);\ - if (!(flags & INIT_VLC_USE_NEW_STATIC)) \ - av_free(buf); \ - return -1; \ - } \ - GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \ - if (buf[j].code >= (1LL< nb_bits); - // qsort is the slowest part of init_vlc, and could probably be improved or avoided - qsort(buf, j, sizeof(VLCcode), compare_vlcspec); - COPY(buf[j].bits && buf[j].bits <= nb_bits); - nb_codes = j; - - ret = build_table(vlc, nb_bits, nb_codes, buf, flags); - - if (flags & INIT_VLC_USE_NEW_STATIC) { - if(vlc->table_size != vlc->table_allocated) - av_log(NULL, AV_LOG_ERROR, "needed %d had %d\n", vlc->table_size, vlc->table_allocated); - state = avpriv_atomic_ptr_cas(&vlc->init_state, vlc, vlc+1); - av_assert0(state == vlc); - av_assert0(ret >= 0); - } else { - av_free(buf); - if (ret < 0) { - av_freep(&vlc->table); - return ret; - } - } - return 0; -} - - -void ff_free_vlc(VLC *vlc) -{ - av_freep(&vlc->table); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream_filter.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream_filter.c deleted file mode 100644 index 3ee582fb2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bitstream_filter.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "avcodec.h" -#include "libavutil/atomic.h" -#include "libavutil/mem.h" - -static AVBitStreamFilter *first_bitstream_filter = NULL; - -AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f) -{ - if (f) - return f->next; - else - return first_bitstream_filter; -} - -void av_register_bitstream_filter(AVBitStreamFilter *bsf) -{ - do { - bsf->next = first_bitstream_filter; - } while(bsf->next != avpriv_atomic_ptr_cas((void * volatile *)&first_bitstream_filter, bsf->next, bsf)); -} - -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name) -{ - AVBitStreamFilter *bsf = first_bitstream_filter; - - while (bsf) { - if (!strcmp(name, bsf->name)) { - AVBitStreamFilterContext *bsfc = - av_mallocz(sizeof(AVBitStreamFilterContext)); - bsfc->filter = bsf; - bsfc->priv_data = - bsf->priv_data_size ? av_mallocz(bsf->priv_data_size) : NULL; - return bsfc; - } - bsf = bsf->next; - } - return NULL; -} - -void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc) -{ - if (!bsfc) - return; - if (bsfc->filter->close) - bsfc->filter->close(bsfc); - av_freep(&bsfc->priv_data); - av_parser_close(bsfc->parser); - av_free(bsfc); -} - -int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, - AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe) -{ - *poutbuf = (uint8_t *)buf; - *poutbuf_size = buf_size; - return bsfc->filter->filter(bsfc, avctx, args, poutbuf, poutbuf_size, - buf, buf_size, keyframe); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bytestream.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bytestream.h deleted file mode 100644 index f2458591c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/bytestream.h +++ /dev/null @@ -1,348 +0,0 @@ -/* - * Bytestream functions - * copyright (c) 2006 Baptiste Coudurier - * Copyright (c) 2012 Aneesh Dogra (lionaneesh) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_BYTESTREAM_H -#define AVCODEC_BYTESTREAM_H - -#include -#include - -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" - -typedef struct GetByteContext { - const uint8_t *buffer, *buffer_end, *buffer_start; -} GetByteContext; - -typedef struct PutByteContext { - uint8_t *buffer, *buffer_end, *buffer_start; - int eof; -} PutByteContext; - -#define DEF(type, name, bytes, read, write) \ -static av_always_inline type bytestream_get_ ## name(const uint8_t **b) \ -{ \ - (*b) += bytes; \ - return read(*b - bytes); \ -} \ -static av_always_inline void bytestream_put_ ## name(uint8_t **b, \ - const type value) \ -{ \ - write(*b, value); \ - (*b) += bytes; \ -} \ -static av_always_inline void bytestream2_put_ ## name ## u(PutByteContext *p, \ - const type value) \ -{ \ - bytestream_put_ ## name(&p->buffer, value); \ -} \ -static av_always_inline void bytestream2_put_ ## name(PutByteContext *p, \ - const type value) \ -{ \ - if (!p->eof && (p->buffer_end - p->buffer >= bytes)) { \ - write(p->buffer, value); \ - p->buffer += bytes; \ - } else \ - p->eof = 1; \ -} \ -static av_always_inline type bytestream2_get_ ## name ## u(GetByteContext *g) \ -{ \ - return bytestream_get_ ## name(&g->buffer); \ -} \ -static av_always_inline type bytestream2_get_ ## name(GetByteContext *g) \ -{ \ - if (g->buffer_end - g->buffer < bytes) \ - return 0; \ - return bytestream2_get_ ## name ## u(g); \ -} \ -static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \ -{ \ - if (g->buffer_end - g->buffer < bytes) \ - return 0; \ - return read(g->buffer); \ -} - -DEF(uint64_t, le64, 8, AV_RL64, AV_WL64) -DEF(unsigned int, le32, 4, AV_RL32, AV_WL32) -DEF(unsigned int, le24, 3, AV_RL24, AV_WL24) -DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) -DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) -DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) -DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) -DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) -DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) - -#if HAVE_BIGENDIAN -# define bytestream2_get_ne16 bytestream2_get_be16 -# define bytestream2_get_ne24 bytestream2_get_be24 -# define bytestream2_get_ne32 bytestream2_get_be32 -# define bytestream2_get_ne64 bytestream2_get_be64 -# define bytestream2_get_ne16u bytestream2_get_be16u -# define bytestream2_get_ne24u bytestream2_get_be24u -# define bytestream2_get_ne32u bytestream2_get_be32u -# define bytestream2_get_ne64u bytestream2_get_be64u -# define bytestream2_put_ne16 bytestream2_put_be16 -# define bytestream2_put_ne24 bytestream2_put_be24 -# define bytestream2_put_ne32 bytestream2_put_be32 -# define bytestream2_put_ne64 bytestream2_put_be64 -# define bytestream2_peek_ne16 bytestream2_peek_be16 -# define bytestream2_peek_ne24 bytestream2_peek_be24 -# define bytestream2_peek_ne32 bytestream2_peek_be32 -# define bytestream2_peek_ne64 bytestream2_peek_be64 -#else -# define bytestream2_get_ne16 bytestream2_get_le16 -# define bytestream2_get_ne24 bytestream2_get_le24 -# define bytestream2_get_ne32 bytestream2_get_le32 -# define bytestream2_get_ne64 bytestream2_get_le64 -# define bytestream2_get_ne16u bytestream2_get_le16u -# define bytestream2_get_ne24u bytestream2_get_le24u -# define bytestream2_get_ne32u bytestream2_get_le32u -# define bytestream2_get_ne64u bytestream2_get_le64u -# define bytestream2_put_ne16 bytestream2_put_le16 -# define bytestream2_put_ne24 bytestream2_put_le24 -# define bytestream2_put_ne32 bytestream2_put_le32 -# define bytestream2_put_ne64 bytestream2_put_le64 -# define bytestream2_peek_ne16 bytestream2_peek_le16 -# define bytestream2_peek_ne24 bytestream2_peek_le24 -# define bytestream2_peek_ne32 bytestream2_peek_le32 -# define bytestream2_peek_ne64 bytestream2_peek_le64 -#endif - -static av_always_inline void bytestream2_init(GetByteContext *g, - const uint8_t *buf, - int buf_size) -{ - av_assert0(buf_size >= 0); - g->buffer = buf; - g->buffer_start = buf; - g->buffer_end = buf + buf_size; -} - -static av_always_inline void bytestream2_init_writer(PutByteContext *p, - uint8_t *buf, - int buf_size) -{ - av_assert0(buf_size >= 0); - p->buffer = buf; - p->buffer_start = buf; - p->buffer_end = buf + buf_size; - p->eof = 0; -} - -static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g) -{ - return g->buffer_end - g->buffer; -} - -static av_always_inline unsigned int bytestream2_get_bytes_left_p(PutByteContext *p) -{ - return p->buffer_end - p->buffer; -} - -static av_always_inline void bytestream2_skip(GetByteContext *g, - unsigned int size) -{ - g->buffer += FFMIN(g->buffer_end - g->buffer, size); -} - -static av_always_inline void bytestream2_skipu(GetByteContext *g, - unsigned int size) -{ - g->buffer += size; -} - -static av_always_inline void bytestream2_skip_p(PutByteContext *p, - unsigned int size) -{ - int size2; - if (p->eof) - return; - size2 = FFMIN(p->buffer_end - p->buffer, size); - if (size2 != size) - p->eof = 1; - p->buffer += size2; -} - -static av_always_inline int bytestream2_tell(GetByteContext *g) -{ - return (int)(g->buffer - g->buffer_start); -} - -static av_always_inline int bytestream2_tell_p(PutByteContext *p) -{ - return (int)(p->buffer - p->buffer_start); -} - -static av_always_inline int bytestream2_size(GetByteContext *g) -{ - return (int)(g->buffer_end - g->buffer_start); -} - -static av_always_inline int bytestream2_size_p(PutByteContext *p) -{ - return (int)(p->buffer_end - p->buffer_start); -} - -static av_always_inline int bytestream2_seek(GetByteContext *g, - int offset, - int whence) -{ - switch (whence) { - case SEEK_CUR: - offset = av_clip(offset, -(g->buffer - g->buffer_start), - g->buffer_end - g->buffer); - g->buffer += offset; - break; - case SEEK_END: - offset = av_clip(offset, -(g->buffer_end - g->buffer_start), 0); - g->buffer = g->buffer_end + offset; - break; - case SEEK_SET: - offset = av_clip(offset, 0, g->buffer_end - g->buffer_start); - g->buffer = g->buffer_start + offset; - break; - default: - return AVERROR(EINVAL); - } - return bytestream2_tell(g); -} - -static av_always_inline int bytestream2_seek_p(PutByteContext *p, - int offset, - int whence) -{ - p->eof = 0; - switch (whence) { - case SEEK_CUR: - if (p->buffer_end - p->buffer < offset) - p->eof = 1; - offset = av_clip(offset, -(p->buffer - p->buffer_start), - p->buffer_end - p->buffer); - p->buffer += offset; - break; - case SEEK_END: - if (offset > 0) - p->eof = 1; - offset = av_clip(offset, -(p->buffer_end - p->buffer_start), 0); - p->buffer = p->buffer_end + offset; - break; - case SEEK_SET: - if (p->buffer_end - p->buffer_start < offset) - p->eof = 1; - offset = av_clip(offset, 0, p->buffer_end - p->buffer_start); - p->buffer = p->buffer_start + offset; - break; - default: - return AVERROR(EINVAL); - } - return bytestream2_tell_p(p); -} - -static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, - uint8_t *dst, - unsigned int size) -{ - int size2 = FFMIN(g->buffer_end - g->buffer, size); - memcpy(dst, g->buffer, size2); - g->buffer += size2; - return size2; -} - -static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, - uint8_t *dst, - unsigned int size) -{ - memcpy(dst, g->buffer, size); - g->buffer += size; - return size; -} - -static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, - const uint8_t *src, - unsigned int size) -{ - int size2; - if (p->eof) - return 0; - size2 = FFMIN(p->buffer_end - p->buffer, size); - if (size2 != size) - p->eof = 1; - memcpy(p->buffer, src, size2); - p->buffer += size2; - return size2; -} - -static av_always_inline unsigned int bytestream2_put_bufferu(PutByteContext *p, - const uint8_t *src, - unsigned int size) -{ - memcpy(p->buffer, src, size); - p->buffer += size; - return size; -} - -static av_always_inline void bytestream2_set_buffer(PutByteContext *p, - const uint8_t c, - unsigned int size) -{ - int size2; - if (p->eof) - return; - size2 = FFMIN(p->buffer_end - p->buffer, size); - if (size2 != size) - p->eof = 1; - memset(p->buffer, c, size2); - p->buffer += size2; -} - -static av_always_inline void bytestream2_set_bufferu(PutByteContext *p, - const uint8_t c, - unsigned int size) -{ - memset(p->buffer, c, size); - p->buffer += size; -} - -static av_always_inline unsigned int bytestream2_get_eof(PutByteContext *p) -{ - return p->eof; -} - -static av_always_inline unsigned int bytestream_get_buffer(const uint8_t **b, - uint8_t *dst, - unsigned int size) -{ - memcpy(dst, *b, size); - (*b) += size; - return size; -} - -static av_always_inline void bytestream_put_buffer(uint8_t **b, - const uint8_t *src, - unsigned int size) -{ - memcpy(*b, src, size); - (*b) += size; -} - -#endif /* AVCODEC_BYTESTREAM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/cbrt_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/cbrt_tablegen.h deleted file mode 100644 index a9d34dc75..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/cbrt_tablegen.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Header file for hardcoded AAC cube-root table - * - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_CBRT_TABLEGEN_H -#define AVCODEC_CBRT_TABLEGEN_H - -#include -#include - -#if CONFIG_HARDCODED_TABLES -#define cbrt_tableinit() -#include "libavcodec/cbrt_tables.h" -#else -static uint32_t cbrt_tab[1 << 13]; - -static void cbrt_tableinit(void) -{ - if (!cbrt_tab[(1<<13) - 1]) { - int i; - for (i = 0; i < 1<<13; i++) { - union { - float f; - uint32_t i; - } f; - f.f = cbrtf(i) * i; - cbrt_tab[i] = f.i; - } - } -} -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AVCODEC_CBRT_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.c deleted file mode 100644 index 09d62d4b8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * various filters for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "config.h" - -#include "avcodec.h" -#include "celp_filters.h" -#include "libavutil/avassert.h" -#include "libavutil/common.h" - -void ff_celp_convolve_circ(int16_t* fc_out, const int16_t* fc_in, - const int16_t* filter, int len) -{ - int i, k; - - memset(fc_out, 0, len * sizeof(int16_t)); - - /* Since there are few pulses over an entire subframe (i.e. almost - all fc_in[i] are zero) it is faster to loop over fc_in first. */ - for (i = 0; i < len; i++) { - if (fc_in[i]) { - for (k = 0; k < i; k++) - fc_out[k] += (fc_in[i] * filter[len + k - i]) >> 15; - - for (k = i; k < len; k++) - fc_out[k] += (fc_in[i] * filter[ k - i]) >> 15; - } - } -} - -void ff_celp_circ_addf(float *out, const float *in, - const float *lagged, int lag, float fac, int n) -{ - int k; - for (k = 0; k < lag; k++) - out[k] = in[k] + fac * lagged[n + k - lag]; - for (; k < n; k++) - out[k] = in[k] + fac * lagged[ k - lag]; -} - -int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs, - const int16_t *in, int buffer_length, - int filter_length, int stop_on_overflow, - int shift, int rounder) -{ - int i,n; - - for (n = 0; n < buffer_length; n++) { - int sum = -rounder, sum1; - for (i = 1; i <= filter_length; i++) - sum += filter_coeffs[i-1] * out[n-i]; - - sum1 = ((-sum >> 12) + in[n]) >> shift; - sum = av_clip_int16(sum1); - - if (stop_on_overflow && sum != sum1) - return 1; - - out[n] = sum; - } - - return 0; -} - -void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, - const float* in, int buffer_length, - int filter_length) -{ - int i,n; - -#if 0 // Unoptimized code path for improved readability - for (n = 0; n < buffer_length; n++) { - out[n] = in[n]; - for (i = 1; i <= filter_length; i++) - out[n] -= filter_coeffs[i-1] * out[n-i]; - } -#else - float out0, out1, out2, out3; - float old_out0, old_out1, old_out2, old_out3; - float a,b,c; - - a = filter_coeffs[0]; - b = filter_coeffs[1]; - c = filter_coeffs[2]; - b -= filter_coeffs[0] * filter_coeffs[0]; - c -= filter_coeffs[1] * filter_coeffs[0]; - c -= filter_coeffs[0] * b; - - av_assert2((filter_length&1)==0 && filter_length>=4); - - old_out0 = out[-4]; - old_out1 = out[-3]; - old_out2 = out[-2]; - old_out3 = out[-1]; - for (n = 0; n <= buffer_length - 4; n+=4) { - float tmp0,tmp1,tmp2; - float val; - - out0 = in[0]; - out1 = in[1]; - out2 = in[2]; - out3 = in[3]; - - out0 -= filter_coeffs[2] * old_out1; - out1 -= filter_coeffs[2] * old_out2; - out2 -= filter_coeffs[2] * old_out3; - - out0 -= filter_coeffs[1] * old_out2; - out1 -= filter_coeffs[1] * old_out3; - - out0 -= filter_coeffs[0] * old_out3; - - val = filter_coeffs[3]; - - out0 -= val * old_out0; - out1 -= val * old_out1; - out2 -= val * old_out2; - out3 -= val * old_out3; - - for (i = 5; i < filter_length; i += 2) { - old_out3 = out[-i]; - val = filter_coeffs[i-1]; - - out0 -= val * old_out3; - out1 -= val * old_out0; - out2 -= val * old_out1; - out3 -= val * old_out2; - - old_out2 = out[-i-1]; - - val = filter_coeffs[i]; - - out0 -= val * old_out2; - out1 -= val * old_out3; - out2 -= val * old_out0; - out3 -= val * old_out1; - - FFSWAP(float, old_out0, old_out2); - old_out1 = old_out3; - } - - tmp0 = out0; - tmp1 = out1; - tmp2 = out2; - - out3 -= a * tmp2; - out2 -= a * tmp1; - out1 -= a * tmp0; - - out3 -= b * tmp1; - out2 -= b * tmp0; - - out3 -= c * tmp0; - - - out[0] = out0; - out[1] = out1; - out[2] = out2; - out[3] = out3; - - old_out0 = out0; - old_out1 = out1; - old_out2 = out2; - old_out3 = out3; - - out += 4; - in += 4; - } - - out -= n; - in -= n; - for (; n < buffer_length; n++) { - out[n] = in[n]; - for (i = 1; i <= filter_length; i++) - out[n] -= filter_coeffs[i-1] * out[n-i]; - } -#endif -} - -void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs, - const float *in, int buffer_length, - int filter_length) -{ - int i,n; - - for (n = 0; n < buffer_length; n++) { - out[n] = in[n]; - for (i = 1; i <= filter_length; i++) - out[n] += filter_coeffs[i-1] * in[n-i]; - } -} - -void ff_celp_filter_init(CELPFContext *c) -{ - c->celp_lp_synthesis_filterf = ff_celp_lp_synthesis_filterf; - c->celp_lp_zero_synthesis_filterf = ff_celp_lp_zero_synthesis_filterf; - - if(HAVE_MIPSFPU) - ff_celp_filter_init_mips(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.h deleted file mode 100644 index f644ec325..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_filters.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * various filters for CELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_CELP_FILTERS_H -#define AVCODEC_CELP_FILTERS_H - -#include - -typedef struct CELPFContext { - /** - * LP synthesis filter. - * @param[out] out pointer to output buffer - * - the array out[-filter_length, -1] must - * contain the previous result of this filter - * @param filter_coeffs filter coefficients. - * @param in input signal - * @param buffer_length amount of data to process - * @param filter_length filter length (10 for 10th order LP filter). Must be - * greater than 4 and even. - * - * @note Output buffer must contain filter_length samples of past - * speech data before pointer. - * - * Routine applies 1/A(z) filter to given speech data. - */ - void (*celp_lp_synthesis_filterf)(float *out, const float *filter_coeffs, - const float *in, int buffer_length, - int filter_length); - - /** - * LP zero synthesis filter. - * @param[out] out pointer to output buffer - * @param filter_coeffs filter coefficients. - * @param in input signal - * - the array in[-filter_length, -1] must - * contain the previous input of this filter - * @param buffer_length amount of data to process (should be a multiple of eight) - * @param filter_length filter length (10 for 10th order LP filter; - * should be a multiple of two) - * - * @note Output buffer must contain filter_length samples of past - * speech data before pointer. - * - * Routine applies A(z) filter to given speech data. - */ - void (*celp_lp_zero_synthesis_filterf)(float *out, const float *filter_coeffs, - const float *in, int buffer_length, - int filter_length); - -}CELPFContext; - -/** - * Initialize CELPFContext. - */ -void ff_celp_filter_init(CELPFContext *c); -void ff_celp_filter_init_mips(CELPFContext *c); - -/** - * Circularly convolve fixed vector with a phase dispersion impulse - * response filter (D.6.2 of G.729 and 6.1.5 of AMR). - * @param fc_out vector with filter applied - * @param fc_in source vector - * @param filter phase filter coefficients - * - * fc_out[n] = sum(i,0,len-1){ fc_in[i] * filter[(len + n - i)%len] } - * - * @note fc_in and fc_out should not overlap! - */ -void ff_celp_convolve_circ(int16_t *fc_out, const int16_t *fc_in, - const int16_t *filter, int len); - -/** - * Add an array to a rotated array. - * - * out[k] = in[k] + fac * lagged[k-lag] with wrap-around - * - * @param out result vector - * @param in samples to be added unfiltered - * @param lagged samples to be rotated, multiplied and added - * @param lag lagged vector delay in the range [0, n] - * @param fac scalefactor for lagged samples - * @param n number of samples - */ -void ff_celp_circ_addf(float *out, const float *in, - const float *lagged, int lag, float fac, int n); - -/** - * LP synthesis filter. - * @param[out] out pointer to output buffer - * @param filter_coeffs filter coefficients (-0x8000 <= (3.12) < 0x8000) - * @param in input signal - * @param buffer_length amount of data to process - * @param filter_length filter length (10 for 10th order LP filter) - * @param stop_on_overflow 1 - return immediately if overflow occurs - * 0 - ignore overflows - * @param shift the result is shifted right by this value - * @param rounder the amount to add for rounding (usually 0x800 or 0xfff) - * - * @return 1 if overflow occurred, 0 - otherwise - * - * @note Output buffer must contain filter_length samples of past - * speech data before pointer. - * - * Routine applies 1/A(z) filter to given speech data. - */ -int ff_celp_lp_synthesis_filter(int16_t *out, const int16_t *filter_coeffs, - const int16_t *in, int buffer_length, - int filter_length, int stop_on_overflow, - int shift, int rounder); - -/** - * LP synthesis filter. - * @param[out] out pointer to output buffer - * - the array out[-filter_length, -1] must - * contain the previous result of this filter - * @param filter_coeffs filter coefficients. - * @param in input signal - * @param buffer_length amount of data to process - * @param filter_length filter length (10 for 10th order LP filter). Must be - * greater than 4 and even. - * - * @note Output buffer must contain filter_length samples of past - * speech data before pointer. - * - * Routine applies 1/A(z) filter to given speech data. - */ -void ff_celp_lp_synthesis_filterf(float *out, const float *filter_coeffs, - const float *in, int buffer_length, - int filter_length); - -/** - * LP zero synthesis filter. - * @param[out] out pointer to output buffer - * @param filter_coeffs filter coefficients. - * @param in input signal - * - the array in[-filter_length, -1] must - * contain the previous input of this filter - * @param buffer_length amount of data to process - * @param filter_length filter length (10 for 10th order LP filter) - * - * @note Output buffer must contain filter_length samples of past - * speech data before pointer. - * - * Routine applies A(z) filter to given speech data. - */ -void ff_celp_lp_zero_synthesis_filterf(float *out, const float *filter_coeffs, - const float *in, int buffer_length, - int filter_length); - -#endif /* AVCODEC_CELP_FILTERS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.c deleted file mode 100644 index a96b1aed9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Various fixed-point math operations - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "libavutil/avassert.h" -#include "avcodec.h" -#include "mathops.h" -#include "celp_math.h" -#include "libavutil/common.h" - -static const uint16_t exp2a[]= -{ - 0, 1435, 2901, 4400, 5931, 7496, 9096, 10730, - 12400, 14106, 15850, 17632, 19454, 21315, 23216, 25160, - 27146, 29175, 31249, 33368, 35534, 37747, 40009, 42320, - 44682, 47095, 49562, 52082, 54657, 57289, 59979, 62727, -}; - -static const uint16_t exp2b[]= -{ - 3, 712, 1424, 2134, 2845, 3557, 4270, 4982, - 5696, 6409, 7124, 7839, 8554, 9270, 9986, 10704, - 11421, 12138, 12857, 13576, 14295, 15014, 15734, 16455, - 17176, 17898, 18620, 19343, 20066, 20790, 21514, 22238, -}; - -int ff_exp2(uint16_t power) -{ - unsigned int result= exp2a[power>>10] + 0x10000; - - av_assert2(power <= 0x7fff); - - result= (result<<3) + ((result*exp2b[(power>>5)&31])>>17); - return result + ((result*(power&31)*89)>>22); -} - -/** - * Table used to compute log2(x) - * - * tab_log2[i] = (1<<15) * log2(1 + i/32), i=0..32 - */ -static const uint16_t tab_log2[33] = -{ -#ifdef G729_BITEXACT - 0, 1455, 2866, 4236, 5568, 6863, 8124, 9352, - 10549, 11716, 12855, 13967, 15054, 16117, 17156, 18172, - 19167, 20142, 21097, 22033, 22951, 23852, 24735, 25603, - 26455, 27291, 28113, 28922, 29716, 30497, 31266, 32023, 32767, -#else - 4, 1459, 2870, 4240, 5572, 6867, 8127, 9355, - 10552, 11719, 12858, 13971, 15057, 16120, 17158, 18175, - 19170, 20145, 21100, 22036, 22954, 23854, 24738, 25605, - 26457, 27294, 28116, 28924, 29719, 30500, 31269, 32025, 32769, -#endif -}; - -int ff_log2_q15(uint32_t value) -{ - uint8_t power_int; - uint8_t frac_x0; - uint16_t frac_dx; - - // Stripping zeros from beginning - power_int = av_log2(value); - value <<= (31 - power_int); - - // b31 is always non-zero now - frac_x0 = (value & 0x7c000000) >> 26; // b26-b31 and [32..63] -> [0..31] - frac_dx = (value & 0x03fff800) >> 11; - - value = tab_log2[frac_x0]; - value += (frac_dx * (tab_log2[frac_x0+1] - tab_log2[frac_x0])) >> 15; - - return (power_int << 15) + value; -} - -int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length) -{ - int i; - int64_t sum = 0; - - for (i = 0; i < length; i++) - sum += MUL16(a[i], b[i]); - - return sum; -} - -float ff_dot_productf(const float* a, const float* b, int length) -{ - float sum = 0; - int i; - - for(i=0; idot_productf = ff_dot_productf; - - if(HAVE_MIPSFPU) - ff_celp_math_init_mips(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.h deleted file mode 100644 index 18d3ad94d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/celp_math.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Various fixed-point math operations - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_CELP_MATH_H -#define AVCODEC_CELP_MATH_H - -#include - -typedef struct CELPMContext { - /** - * Return the dot product. - * @param a input data array - * @param b input data array - * @param length number of elements - * - * @return dot product = sum of elementwise products - */ - float (*dot_productf)(const float* a, const float* b, int length); - -}CELPMContext; - -/** - * Initialize CELPMContext. - */ -void ff_celp_math_init(CELPMContext *c); -void ff_celp_math_init_mips(CELPMContext *c); - -/** - * fixed-point implementation of exp2(x) in [0; 1] domain. - * @param power argument to exp2, 0 <= power <= 0x7fff - * - * @return value of (1<<20) * exp2(power / (1<<15)) - * 0x8000c <= result <= 0xfffea - */ -int ff_exp2(uint16_t power); - -/** - * Calculate log2(x). - * @param value function argument, 0 < value <= 7fff ffff - * - * @return value of (1<<15) * log2(value) - */ -int ff_log2_q15(uint32_t value); - -/** - * Shift value left or right depending on sign of offset parameter. - * @param value value to shift - * @param offset shift offset - * - * @return value << offset, if offset>=0; value >> -offset - otherwise - */ -static inline int bidir_sal(int value, int offset) -{ - if(offset < 0) return value >> -offset; - else return value << offset; -} - -/** - * returns the dot product of 2 int16_t vectors. - * @param a input data array - * @param b input data array - * @param length number of elements - * - * @return dot product = sum of elementwise products - */ -int64_t ff_dot_product(const int16_t *a, const int16_t *b, int length); - -/** - * Return the dot product. - * @param a input data array - * @param b input data array - * @param length number of elements - * - * @return dot product = sum of elementwise products - */ -float ff_dot_productf(const float* a, const float* b, int length); - -#endif /* AVCODEC_CELP_MATH_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/codec_desc.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/codec_desc.c deleted file mode 100644 index 8aafa4e19..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/codec_desc.c +++ /dev/null @@ -1,2669 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * This table was generated from the long and short names of AVCodecs - * please see the respective codec sources for authorship - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/common.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "version.h" - -static const AVCodecDescriptor codec_descriptors[] = { - /* video codecs */ - { - .id = AV_CODEC_ID_MPEG1VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mpeg1video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1 video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MPEG2VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mpeg2video", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-2 video"), - .props = AV_CODEC_PROP_LOSSY, - }, -#if FF_API_XVMC - { - .id = AV_CODEC_ID_MPEG2VIDEO_XVMC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mpegvideo_xvmc", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-1/2 video XvMC (X-Video Motion Compensation)"), - .props = AV_CODEC_PROP_LOSSY, - }, -#endif /* FF_API_XVMC */ - { - .id = AV_CODEC_ID_H261, - .type = AVMEDIA_TYPE_VIDEO, - .name = "h261", - .long_name = NULL_IF_CONFIG_SMALL("H.261"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_H263, - .type = AVMEDIA_TYPE_VIDEO, - .name = "h263", - .long_name = NULL_IF_CONFIG_SMALL("H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RV10, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rv10", - .long_name = NULL_IF_CONFIG_SMALL("RealVideo 1.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RV20, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rv20", - .long_name = NULL_IF_CONFIG_SMALL("RealVideo 2.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MJPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mjpeg", - .long_name = NULL_IF_CONFIG_SMALL("Motion JPEG"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MJPEGB, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mjpegb", - .long_name = NULL_IF_CONFIG_SMALL("Apple MJPEG-B"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_LJPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ljpeg", - .long_name = NULL_IF_CONFIG_SMALL("Lossless JPEG"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SP5X, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sp5x", - .long_name = NULL_IF_CONFIG_SMALL("Sunplus JPEG (SP5X)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_JPEGLS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "jpegls", - .long_name = NULL_IF_CONFIG_SMALL("JPEG-LS"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MPEG4, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mpeg4", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RAWVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rawvideo", - .long_name = NULL_IF_CONFIG_SMALL("raw video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MSMPEG4V1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msmpeg4v1", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MSMPEG4V2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msmpeg4v2", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MSMPEG4V3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msmpeg4v3", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 part 2 Microsoft variant version 3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wmv1", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 7"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMV2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wmv2", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 8"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_H263P, - .type = AVMEDIA_TYPE_VIDEO, - .name = "h263p", - .long_name = NULL_IF_CONFIG_SMALL("H.263+ / H.263-1998 / H.263 version 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_H263I, - .type = AVMEDIA_TYPE_VIDEO, - .name = "h263i", - .long_name = NULL_IF_CONFIG_SMALL("Intel H.263"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FLV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "flv1", - .long_name = NULL_IF_CONFIG_SMALL("FLV / Sorenson Spark / Sorenson H.263 (Flash Video)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SVQ1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "svq1", - .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SVQ3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "svq3", - .long_name = NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 3 / Sorenson Video 3 / SVQ3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_DVVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dvvideo", - .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_HUFFYUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "huffyuv", - .long_name = NULL_IF_CONFIG_SMALL("HuffYUV"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_CYUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cyuv", - .long_name = NULL_IF_CONFIG_SMALL("Creative YUV (CYUV)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_H264, - .type = AVMEDIA_TYPE_VIDEO, - .name = "h264", - .long_name = NULL_IF_CONFIG_SMALL("H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_INDEO3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "indeo3", - .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp3", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_THEORA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "theora", - .long_name = NULL_IF_CONFIG_SMALL("Theora"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ASV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "asv1", - .long_name = NULL_IF_CONFIG_SMALL("ASUS V1"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ASV2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "asv2", - .long_name = NULL_IF_CONFIG_SMALL("ASUS V2"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FFV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ffv1", - .long_name = NULL_IF_CONFIG_SMALL("FFmpeg video codec #1"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_4XM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "4xm", - .long_name = NULL_IF_CONFIG_SMALL("4X Movie"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VCR1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vcr1", - .long_name = NULL_IF_CONFIG_SMALL("ATI VCR1"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CLJR, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cljr", - .long_name = NULL_IF_CONFIG_SMALL("Cirrus Logic AccuPak"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MDEC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mdec", - .long_name = NULL_IF_CONFIG_SMALL("Sony PlayStation MDEC (Motion DECoder)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ROQ, - .type = AVMEDIA_TYPE_VIDEO, - .name = "roq", - .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_INTERPLAY_VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "interplayvideo", - .long_name = NULL_IF_CONFIG_SMALL("Interplay MVE video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_XAN_WC3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xan_wc3", - .long_name = NULL_IF_CONFIG_SMALL("Wing Commander III / Xan"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_XAN_WC4, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xan_wc4", - .long_name = NULL_IF_CONFIG_SMALL("Wing Commander IV / Xxan"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RPZA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rpza", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime video (RPZA)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CINEPAK, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cinepak", - .long_name = NULL_IF_CONFIG_SMALL("Cinepak"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WS_VQA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ws_vqa", - .long_name = NULL_IF_CONFIG_SMALL("Westwood Studios VQA (Vector Quantized Animation) video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MSRLE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msrle", - .long_name = NULL_IF_CONFIG_SMALL("Microsoft RLE"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MSVIDEO1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msvideo1", - .long_name = NULL_IF_CONFIG_SMALL("Microsoft Video 1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_IDCIN, - .type = AVMEDIA_TYPE_VIDEO, - .name = "idcin", - .long_name = NULL_IF_CONFIG_SMALL("id Quake II CIN video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_8BPS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "8bps", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime 8BPS video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SMC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "smc", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime Graphics (SMC)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FLIC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "flic", - .long_name = NULL_IF_CONFIG_SMALL("Autodesk Animator Flic video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_TRUEMOTION1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "truemotion1", - .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 1.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VMDVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vmdvideo", - .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MSZH, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mszh", - .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) MSZH"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ZLIB, - .type = AVMEDIA_TYPE_VIDEO, - .name = "zlib", - .long_name = NULL_IF_CONFIG_SMALL("LCL (LossLess Codec Library) ZLIB"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_QTRLE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "qtrle", - .long_name = NULL_IF_CONFIG_SMALL("QuickTime Animation (RLE) video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SNOW, - .type = AVMEDIA_TYPE_VIDEO, - .name = "snow", - .long_name = NULL_IF_CONFIG_SMALL("Snow"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_TSCC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tscc", - .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Capture Codec"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ULTI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ulti", - .long_name = NULL_IF_CONFIG_SMALL("IBM UltiMotion"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_QDRAW, - .type = AVMEDIA_TYPE_VIDEO, - .name = "qdraw", - .long_name = NULL_IF_CONFIG_SMALL("Apple QuickDraw"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_VIXL, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vixl", - .long_name = NULL_IF_CONFIG_SMALL("Miro VideoXL"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_QPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "qpeg", - .long_name = NULL_IF_CONFIG_SMALL("Q-team QPEG"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PNG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "png", - .long_name = NULL_IF_CONFIG_SMALL("PNG (Portable Network Graphics) image"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PPM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ppm", - .long_name = NULL_IF_CONFIG_SMALL("PPM (Portable PixelMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PBM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pbm", - .long_name = NULL_IF_CONFIG_SMALL("PBM (Portable BitMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PGM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pgm", - .long_name = NULL_IF_CONFIG_SMALL("PGM (Portable GrayMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PGMYUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pgmyuv", - .long_name = NULL_IF_CONFIG_SMALL("PGMYUV (Portable GrayMap YUV) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PAM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pam", - .long_name = NULL_IF_CONFIG_SMALL("PAM (Portable AnyMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_FFVHUFF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ffvhuff", - .long_name = NULL_IF_CONFIG_SMALL("Huffyuv FFmpeg variant"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_RV30, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rv30", - .long_name = NULL_IF_CONFIG_SMALL("RealVideo 3.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RV40, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rv40", - .long_name = NULL_IF_CONFIG_SMALL("RealVideo 4.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VC1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vc1", - .long_name = NULL_IF_CONFIG_SMALL("SMPTE VC-1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMV3, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wmv3", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_LOCO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "loco", - .long_name = NULL_IF_CONFIG_SMALL("LOCO"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_WNV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wnv1", - .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AASC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "aasc", - .long_name = NULL_IF_CONFIG_SMALL("Autodesk RLE"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_INDEO2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "indeo2", - .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FRAPS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "fraps", - .long_name = NULL_IF_CONFIG_SMALL("Fraps"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_TRUEMOTION2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "truemotion2", - .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BMP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "bmp", - .long_name = NULL_IF_CONFIG_SMALL("BMP (Windows and OS/2 bitmap)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_CSCD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cscd", - .long_name = NULL_IF_CONFIG_SMALL("CamStudio"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MMVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mmvideo", - .long_name = NULL_IF_CONFIG_SMALL("American Laser Games MM Video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ZMBV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "zmbv", - .long_name = NULL_IF_CONFIG_SMALL("Zip Motion Blocks Video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_AVS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "avs", - .long_name = NULL_IF_CONFIG_SMALL("AVS (Audio Video Standard) video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SMACKVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "smackvideo", - .long_name = NULL_IF_CONFIG_SMALL("Smacker video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_NUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "nuv", - .long_name = NULL_IF_CONFIG_SMALL("NuppelVideo/RTJPEG"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_KMVC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "kmvc", - .long_name = NULL_IF_CONFIG_SMALL("Karl Morton's video codec"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FLASHSV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "flashsv", - .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v1"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_CAVS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cavs", - .long_name = NULL_IF_CONFIG_SMALL("Chinese AVS (Audio Video Standard) (AVS1-P2, JiZhun profile)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_JPEG2000, - .type = AVMEDIA_TYPE_VIDEO, - .name = "jpeg2000", - .long_name = NULL_IF_CONFIG_SMALL("JPEG 2000"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_VMNC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vmnc", - .long_name = NULL_IF_CONFIG_SMALL("VMware Screen Codec / VMware Video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_VP5, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp5", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP5"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP6, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp6", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP6"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP6F, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp6f", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TARGA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "targa", - .long_name = NULL_IF_CONFIG_SMALL("Truevision Targa image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DSICINVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dsicinvideo", - .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TIERTEXSEQVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tiertexseqvideo", - .long_name = NULL_IF_CONFIG_SMALL("Tiertex Limited SEQ video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TIFF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tiff", - .long_name = NULL_IF_CONFIG_SMALL("TIFF image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_GIF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "gif", - .long_name = NULL_IF_CONFIG_SMALL("GIF (Graphics Interchange Format)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DXA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dxa", - .long_name = NULL_IF_CONFIG_SMALL("Feeble Files/ScummVM DXA"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DNXHD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dnxhd", - .long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_THP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "thp", - .long_name = NULL_IF_CONFIG_SMALL("Nintendo Gamecube THP video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SGI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sgi", - .long_name = NULL_IF_CONFIG_SMALL("SGI image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SGIRLE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sgirle", - .long_name = NULL_IF_CONFIG_SMALL("SGI RLE 8-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_C93, - .type = AVMEDIA_TYPE_VIDEO, - .name = "c93", - .long_name = NULL_IF_CONFIG_SMALL("Interplay C93"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BETHSOFTVID, - .type = AVMEDIA_TYPE_VIDEO, - .name = "bethsoftvid", - .long_name = NULL_IF_CONFIG_SMALL("Bethesda VID video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PTX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ptx", - .long_name = NULL_IF_CONFIG_SMALL("V.Flash PTX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TXD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "txd", - .long_name = NULL_IF_CONFIG_SMALL("Renderware TXD (TeXture Dictionary) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP6A, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp6a", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP6 (Flash version, with alpha channel)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AMV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "amv", - .long_name = NULL_IF_CONFIG_SMALL("AMV Video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VB, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vb", - .long_name = NULL_IF_CONFIG_SMALL("Beam Software VB"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PCX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pcx", - .long_name = NULL_IF_CONFIG_SMALL("PC Paintbrush PCX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SUNRAST, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sunrast", - .long_name = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_INDEO4, - .type = AVMEDIA_TYPE_VIDEO, - .name = "indeo4", - .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 4"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_INDEO5, - .type = AVMEDIA_TYPE_VIDEO, - .name = "indeo5", - .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo Video Interactive 5"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MIMIC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mimic", - .long_name = NULL_IF_CONFIG_SMALL("Mimic"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RL2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "rl2", - .long_name = NULL_IF_CONFIG_SMALL("RL2 video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ESCAPE124, - .type = AVMEDIA_TYPE_VIDEO, - .name = "escape124", - .long_name = NULL_IF_CONFIG_SMALL("Escape 124"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_DIRAC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dirac", - .long_name = NULL_IF_CONFIG_SMALL("Dirac"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_BFI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "bfi", - .long_name = NULL_IF_CONFIG_SMALL("Brute Force & Ignorance"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CMV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cmv", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts CMV video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MOTIONPIXELS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "motionpixels", - .long_name = NULL_IF_CONFIG_SMALL("Motion Pixels video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TGV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tgv", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGV video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TGQ, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tgq", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TGQ video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TQI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tqi", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts TQI video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AURA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "aura", - .long_name = NULL_IF_CONFIG_SMALL("Auravision AURA"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AURA2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "aura2", - .long_name = NULL_IF_CONFIG_SMALL("Auravision Aura 2"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_V210X, - .type = AVMEDIA_TYPE_VIDEO, - .name = "v210x", - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_TMV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tmv", - .long_name = NULL_IF_CONFIG_SMALL("8088flex TMV"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_V210, - .type = AVMEDIA_TYPE_VIDEO, - .name = "v210", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DPX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dpx", - .long_name = NULL_IF_CONFIG_SMALL("DPX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MAD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mad", - .long_name = NULL_IF_CONFIG_SMALL("Electronic Arts Madcow Video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FRWU, - .type = AVMEDIA_TYPE_VIDEO, - .name = "frwu", - .long_name = NULL_IF_CONFIG_SMALL("Forward Uncompressed"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_FLASHSV2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "flashsv2", - .long_name = NULL_IF_CONFIG_SMALL("Flash Screen Video v2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CDGRAPHICS, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cdgraphics", - .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_R210, - .type = AVMEDIA_TYPE_VIDEO, - .name = "r210", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ANM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "anm", - .long_name = NULL_IF_CONFIG_SMALL("Deluxe Paint Animation"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BINKVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "binkvideo", - .long_name = NULL_IF_CONFIG_SMALL("Bink video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_IFF_ILBM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "iff_ilbm", - .long_name = NULL_IF_CONFIG_SMALL("IFF ILBM"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_IFF_BYTERUN1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "iff_byterun1", - .long_name = NULL_IF_CONFIG_SMALL("IFF ByteRun1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_KGV1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "kgv1", - .long_name = NULL_IF_CONFIG_SMALL("Kega Game Video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_YOP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "yop", - .long_name = NULL_IF_CONFIG_SMALL("Psygnosis YOP Video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP8, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp8", - .long_name = NULL_IF_CONFIG_SMALL("On2 VP8"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VP9, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vp9", - .long_name = NULL_IF_CONFIG_SMALL("Google VP9"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PICTOR, - .type = AVMEDIA_TYPE_VIDEO, - .name = "pictor", - .long_name = NULL_IF_CONFIG_SMALL("Pictor/PC Paint"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ANSI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ansi", - .long_name = NULL_IF_CONFIG_SMALL("ASCII/ANSI art"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_A64_MULTI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "a64_multi", - .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_A64_MULTI5, - .type = AVMEDIA_TYPE_VIDEO, - .name = "a64_multi5", - .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_R10K, - .type = AVMEDIA_TYPE_VIDEO, - .name = "r10k", - .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MVC1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mvc1", - .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 1"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MVC2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mvc2", - .long_name = NULL_IF_CONFIG_SMALL("Silicon Graphics Motion Video Compressor 2"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MXPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mxpeg", - .long_name = NULL_IF_CONFIG_SMALL("Mobotix MxPEG video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_LAGARITH, - .type = AVMEDIA_TYPE_VIDEO, - .name = "lagarith", - .long_name = NULL_IF_CONFIG_SMALL("Lagarith lossless"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PRORES, - .type = AVMEDIA_TYPE_VIDEO, - .name = "prores", - .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes (iCodec Pro)"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_JV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "jv", - .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_DFA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dfa", - .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMV3IMAGE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "wmv3image", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VC1IMAGE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vc1image", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Video 9 Image v2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_UTVIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "utvideo", - .long_name = NULL_IF_CONFIG_SMALL("Ut Video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_BMV_VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "bmv_video", - .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_VBLE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "vble", - .long_name = NULL_IF_CONFIG_SMALL("VBLE Lossless Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DXTORY, - .type = AVMEDIA_TYPE_VIDEO, - .name = "dxtory", - .long_name = NULL_IF_CONFIG_SMALL("Dxtory"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_V410, - .type = AVMEDIA_TYPE_VIDEO, - .name = "v410", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:4:4 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_XWD, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xwd", - .long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_CDXL, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cdxl", - .long_name = NULL_IF_CONFIG_SMALL("Commodore CDXL video"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_XBM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xbm", - .long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ZEROCODEC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "zerocodec", - .long_name = NULL_IF_CONFIG_SMALL("ZeroCodec Lossless Video"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MSS1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mss1", - .long_name = NULL_IF_CONFIG_SMALL("MS Screen 1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MSA1, - .type = AVMEDIA_TYPE_VIDEO, - .name = "msa1", - .long_name = NULL_IF_CONFIG_SMALL("MS ATC Screen"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TSCC2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "tscc2", - .long_name = NULL_IF_CONFIG_SMALL("TechSmith Screen Codec 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MTS2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mts2", - .long_name = NULL_IF_CONFIG_SMALL("MS Expression Encoder Screen"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CLLC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cllc", - .long_name = NULL_IF_CONFIG_SMALL("Canopus Lossless Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MSS2, - .type = AVMEDIA_TYPE_VIDEO, - .name = "mss2", - .long_name = NULL_IF_CONFIG_SMALL("MS Windows Media Video V9 Screen"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AIC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "aic", - .long_name = NULL_IF_CONFIG_SMALL("Apple Intermediate Codec"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_Y41P, - .type = AVMEDIA_TYPE_VIDEO, - .name = "y41p", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed YUV 4:1:1 12-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_ESCAPE130, - .type = AVMEDIA_TYPE_VIDEO, - .name = "escape130", - .long_name = NULL_IF_CONFIG_SMALL("Escape 130"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_EXR, - .type = AVMEDIA_TYPE_VIDEO, - .name = "exr", - .long_name = NULL_IF_CONFIG_SMALL("OpenEXR image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_AVRP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "avrp", - .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_012V, - .type = AVMEDIA_TYPE_VIDEO, - .name = "012v", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_AVUI, - .type = AVMEDIA_TYPE_VIDEO, - .name = "avui", - .long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_AYUV, - .type = AVMEDIA_TYPE_VIDEO, - .name = "ayuv", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_TARGA_Y216, - .type = AVMEDIA_TYPE_VIDEO, - .name = "targa_y216", - .long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_V308, - .type = AVMEDIA_TYPE_VIDEO, - .name = "v308", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_V408, - .type = AVMEDIA_TYPE_VIDEO, - .name = "v408", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_YUV4, - .type = AVMEDIA_TYPE_VIDEO, - .name = "yuv4", - .long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_SANM, - .type = AVMEDIA_TYPE_VIDEO, - .name = "sanm", - .long_name = NULL_IF_CONFIG_SMALL("LucasArts SMUSH video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PAF_VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "paf_video", - .long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AVRN, - .type = AVMEDIA_TYPE_VIDEO, - .name = "avrn", - .long_name = NULL_IF_CONFIG_SMALL("Avid AVI Codec"), - }, - { - .id = AV_CODEC_ID_CPIA, - .type = AVMEDIA_TYPE_VIDEO, - .name = "cpia", - .long_name = NULL_IF_CONFIG_SMALL("CPiA video format"), - }, - { - .id = AV_CODEC_ID_XFACE, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xface", - .long_name = NULL_IF_CONFIG_SMALL("X-face image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BRENDER_PIX, - .type = AVMEDIA_TYPE_VIDEO, - .name = "brender_pix", - .long_name = NULL_IF_CONFIG_SMALL("BRender PIX image"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SMVJPEG, - .type = AVMEDIA_TYPE_VIDEO, - .name = "smv", - .long_name = NULL_IF_CONFIG_SMALL("Sigmatel Motion Video"), - }, - - { - .id = AV_CODEC_ID_G2M, - .type = AVMEDIA_TYPE_VIDEO, - .name = "g2m", - .long_name = NULL_IF_CONFIG_SMALL("Go2Meeting"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WEBP, - .type = AVMEDIA_TYPE_VIDEO, - .name = "webp", - .long_name = NULL_IF_CONFIG_SMALL("WebP"), - .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | - AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_HNM4_VIDEO, - .type = AVMEDIA_TYPE_VIDEO, - .name = "hnm4video", - .long_name = NULL_IF_CONFIG_SMALL("HNM 4 video"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_HEVC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "hevc", - .long_name = NULL_IF_CONFIG_SMALL("H.265 / HEVC (High Efficiency Video Coding)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FIC, - .type = AVMEDIA_TYPE_VIDEO, - .name = "fic", - .long_name = NULL_IF_CONFIG_SMALL("Mirillis FIC"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* various PCM "codecs" */ - { - .id = AV_CODEC_ID_PCM_S16LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s16le", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S16BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s16be", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U16LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u16le", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U16BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u16be", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 16-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S8, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s8", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U8, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u8", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 8-bit"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_MULAW, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_mulaw", - .long_name = NULL_IF_CONFIG_SMALL("PCM mu-law / G.711 mu-law"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PCM_ALAW, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_alaw", - .long_name = NULL_IF_CONFIG_SMALL("PCM A-law / G.711 A-law"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PCM_S32LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s32le", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S32BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s32be", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U32LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u32le", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U32BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u32be", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 32-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S24LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s24le", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S24BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s24be", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U24LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u24le", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_U24BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_u24be", - .long_name = NULL_IF_CONFIG_SMALL("PCM unsigned 24-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S24DAUD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s24daud", - .long_name = NULL_IF_CONFIG_SMALL("PCM D-Cinema audio signed 24-bit"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_ZORK, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_zork", - .long_name = NULL_IF_CONFIG_SMALL("PCM Zork"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_PCM_S16BE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s16be_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit big-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S16LE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s16le_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S24LE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s24le_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 24-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S32LE_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s32le_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 32-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_DVD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_dvd", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20|24-bit big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F32BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f32be", - .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F32LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f32le", - .long_name = NULL_IF_CONFIG_SMALL("PCM 32-bit floating point little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F64BE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f64be", - .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point big-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_F64LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_f64le", - .long_name = NULL_IF_CONFIG_SMALL("PCM 64-bit floating point little-endian"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_BLURAY, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_bluray", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 16|20|24-bit big-endian for Blu-ray media"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_LXF, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_lxf", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 20-bit little-endian planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_S302M, - .type = AVMEDIA_TYPE_AUDIO, - .name = "s302m", - .long_name = NULL_IF_CONFIG_SMALL("SMPTE 302M"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_PCM_S8_PLANAR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "pcm_s8_planar", - .long_name = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - - /* various ADPCM codecs */ - { - .id = AV_CODEC_ID_ADPCM_IMA_QT, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_qt", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA QuickTime"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_WAV, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_wav", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA WAV"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_DK3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_dk3", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_DK4, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_dk4", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Duck DK4"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_WS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_ws", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Westwood"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_SMJPEG, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_smjpeg", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Loki SDL MJPEG"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_MS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ms", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Microsoft"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_4XM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_4xm", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM 4X Movie"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_XA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_xa", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM CDROM XA"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_ADX, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_adx", - .long_name = NULL_IF_CONFIG_SMALL("SEGA CRI ADX ADPCM"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_G726, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_g726", - .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_CT, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ct", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Creative Technology"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_SWF, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_swf", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Shockwave Flash"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_YAMAHA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_yamaha", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Yamaha"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_SBPRO_4, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_sbpro_4", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 4-bit"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_SBPRO_3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_sbpro_3", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2.6-bit"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_SBPRO_2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_sbpro_2", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sound Blaster Pro 2-bit"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_THP, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_thp", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo Gamecube THP"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_AMV, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_amv", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA AMV"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA_R1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea_r1", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA_R3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea_r3", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R3"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA_R2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea_r2", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts R2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_EA_SEAD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_ea_sead", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts SEAD"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_EA_EACS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_ea_eacs", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Electronic Arts EACS"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA_XAS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea_xas", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts XAS"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_EA_MAXIS_XA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ea_maxis_xa", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Electronic Arts Maxis CDROM XA"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_ISS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_iss", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Funcom ISS"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_G722, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_g722", - .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_APC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_apc", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA CRYO APC"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_AFC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_afc", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo Gamecube AFC"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_OKI, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_oki", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Dialogic OKI"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_DTK, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_dtk", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM Nintendo Gamecube DTK"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_IMA_RAD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_ima_rad", - .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Radical"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ADPCM_G726LE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "adpcm_g726le", - .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM little-endian"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* AMR */ - { - .id = AV_CODEC_ID_AMR_NB, - .type = AVMEDIA_TYPE_AUDIO, - .name = "amr_nb", - .long_name = NULL_IF_CONFIG_SMALL("AMR-NB (Adaptive Multi-Rate NarrowBand)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AMR_WB, - .type = AVMEDIA_TYPE_AUDIO, - .name = "amr_wb", - .long_name = NULL_IF_CONFIG_SMALL("AMR-WB (Adaptive Multi-Rate WideBand)"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* RealAudio codecs*/ - { - .id = AV_CODEC_ID_RA_144, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ra_144", - .long_name = NULL_IF_CONFIG_SMALL("RealAudio 1.0 (14.4K)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RA_288, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ra_288", - .long_name = NULL_IF_CONFIG_SMALL("RealAudio 2.0 (28.8K)"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* various DPCM codecs */ - { - .id = AV_CODEC_ID_ROQ_DPCM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "roq_dpcm", - .long_name = NULL_IF_CONFIG_SMALL("DPCM id RoQ"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_INTERPLAY_DPCM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "interplay_dpcm", - .long_name = NULL_IF_CONFIG_SMALL("DPCM Interplay"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_XAN_DPCM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "xan_dpcm", - .long_name = NULL_IF_CONFIG_SMALL("DPCM Xan"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SOL_DPCM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sol_dpcm", - .long_name = NULL_IF_CONFIG_SMALL("DPCM Sol"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* audio codecs */ - { - .id = AV_CODEC_ID_MP2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp2", - .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MP3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp3", - .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AAC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "aac", - .long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AC3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ac3", - .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_DTS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "dts", - .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_VORBIS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "vorbis", - .long_name = NULL_IF_CONFIG_SMALL("Vorbis"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_DVAUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "dvaudio", - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMAV1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wmav1", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMAV2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wmav2", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MACE3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mace3", - .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 3:1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MACE6, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mace6", - .long_name = NULL_IF_CONFIG_SMALL("MACE (Macintosh Audio Compression/Expansion) 6:1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VMDAUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "vmdaudio", - .long_name = NULL_IF_CONFIG_SMALL("Sierra VMD audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FLAC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "flac", - .long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MP3ADU, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp3adu", - .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MP3ON4, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp3on4", - .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SHORTEN, - .type = AVMEDIA_TYPE_AUDIO, - .name = "shorten", - .long_name = NULL_IF_CONFIG_SMALL("Shorten"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ALAC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "alac", - .long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_WESTWOOD_SND1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "westwood_snd1", - .long_name = NULL_IF_CONFIG_SMALL("Westwood Audio (SND1)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_GSM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "gsm", - .long_name = NULL_IF_CONFIG_SMALL("GSM"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_QDM2, - .type = AVMEDIA_TYPE_AUDIO, - .name = "qdm2", - .long_name = NULL_IF_CONFIG_SMALL("QDesign Music Codec 2"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_COOK, - .type = AVMEDIA_TYPE_AUDIO, - .name = "cook", - .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TRUESPEECH, - .type = AVMEDIA_TYPE_AUDIO, - .name = "truespeech", - .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TTA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "tta", - .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_SMACKAUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "smackaudio", - .long_name = NULL_IF_CONFIG_SMALL("Smacker audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_QCELP, - .type = AVMEDIA_TYPE_AUDIO, - .name = "qcelp", - .long_name = NULL_IF_CONFIG_SMALL("QCELP / PureVoice"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WAVPACK, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wavpack", - .long_name = NULL_IF_CONFIG_SMALL("WavPack"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_DSICINAUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "dsicinaudio", - .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_IMC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "imc", - .long_name = NULL_IF_CONFIG_SMALL("IMC (Intel Music Coder)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MUSEPACK7, - .type = AVMEDIA_TYPE_AUDIO, - .name = "musepack7", - .long_name = NULL_IF_CONFIG_SMALL("Musepack SV7"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MLP, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mlp", - .long_name = NULL_IF_CONFIG_SMALL("MLP (Meridian Lossless Packing)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_GSM_MS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "gsm_ms", - .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ATRAC3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "atrac3", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 (Adaptive TRansform Acoustic Coding 3)"), - .props = AV_CODEC_PROP_LOSSY, - }, -#if FF_API_VOXWARE - { - .id = AV_CODEC_ID_VOXWARE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "voxware", - .long_name = NULL_IF_CONFIG_SMALL("Voxware RT29 Metasound"), - .props = AV_CODEC_PROP_LOSSY, - }, -#endif - { - .id = AV_CODEC_ID_APE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ape", - .long_name = NULL_IF_CONFIG_SMALL("Monkey's Audio"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_NELLYMOSER, - .type = AVMEDIA_TYPE_AUDIO, - .name = "nellymoser", - .long_name = NULL_IF_CONFIG_SMALL("Nellymoser Asao"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MUSEPACK8, - .type = AVMEDIA_TYPE_AUDIO, - .name = "musepack8", - .long_name = NULL_IF_CONFIG_SMALL("Musepack SV8"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SPEEX, - .type = AVMEDIA_TYPE_AUDIO, - .name = "speex", - .long_name = NULL_IF_CONFIG_SMALL("Speex"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMAVOICE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wmavoice", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMAPRO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wmapro", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_WMALOSSLESS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wmalossless", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ATRAC3P, - .type = AVMEDIA_TYPE_AUDIO, - .name = "atrac3p", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC3+ (Adaptive TRansform Acoustic Coding 3+)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_EAC3, - .type = AVMEDIA_TYPE_AUDIO, - .name = "eac3", - .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SIPR, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sipr", - .long_name = NULL_IF_CONFIG_SMALL("RealAudio SIPR / ACELP.NET"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_MP1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp1", - .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TWINVQ, - .type = AVMEDIA_TYPE_AUDIO, - .name = "twinvq", - .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TRUEHD, - .type = AVMEDIA_TYPE_AUDIO, - .name = "truehd", - .long_name = NULL_IF_CONFIG_SMALL("TrueHD"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_MP4ALS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "mp4als", - .long_name = NULL_IF_CONFIG_SMALL("MPEG-4 Audio Lossless Coding (ALS)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_ATRAC1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "atrac1", - .long_name = NULL_IF_CONFIG_SMALL("ATRAC1 (Adaptive TRansform Acoustic Coding)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BINKAUDIO_RDFT, - .type = AVMEDIA_TYPE_AUDIO, - .name = "binkaudio_rdft", - .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (RDFT)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BINKAUDIO_DCT, - .type = AVMEDIA_TYPE_AUDIO, - .name = "binkaudio_dct", - .long_name = NULL_IF_CONFIG_SMALL("Bink Audio (DCT)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_AAC_LATM, - .type = AVMEDIA_TYPE_AUDIO, - .name = "aac_latm", - .long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding LATM syntax)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_QDMC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "qdmc", - .long_name = NULL_IF_CONFIG_SMALL("QDesign Music"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_CELT, - .type = AVMEDIA_TYPE_AUDIO, - .name = "celt", - .long_name = NULL_IF_CONFIG_SMALL("Constrained Energy Lapped Transform (CELT)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_G723_1, - .type = AVMEDIA_TYPE_AUDIO, - .name = "g723_1", - .long_name = NULL_IF_CONFIG_SMALL("G.723.1"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_G729, - .type = AVMEDIA_TYPE_AUDIO, - .name = "g729", - .long_name = NULL_IF_CONFIG_SMALL("G.729"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_8SVX_EXP, - .type = AVMEDIA_TYPE_AUDIO, - .name = "8svx_exp", - .long_name = NULL_IF_CONFIG_SMALL("8SVX exponential"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_8SVX_FIB, - .type = AVMEDIA_TYPE_AUDIO, - .name = "8svx_fib", - .long_name = NULL_IF_CONFIG_SMALL("8SVX fibonacci"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_BMV_AUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "bmv_audio", - .long_name = NULL_IF_CONFIG_SMALL("Discworld II BMV audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_RALF, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ralf", - .long_name = NULL_IF_CONFIG_SMALL("RealAudio Lossless"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_IAC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "iac", - .long_name = NULL_IF_CONFIG_SMALL("IAC (Indeo Audio Coder)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_ILBC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "ilbc", - .long_name = NULL_IF_CONFIG_SMALL("iLBC (Internet Low Bitrate Codec)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_VIMA, - .type = AVMEDIA_TYPE_AUDIO, - .name = "vima", - .long_name = NULL_IF_CONFIG_SMALL("LucasArts VIMA audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_FFWAVESYNTH, - .type = AVMEDIA_TYPE_AUDIO, - .name = "wavesynth", - .long_name = NULL_IF_CONFIG_SMALL("Wave synthesis pseudo-codec"), - }, - { - .id = AV_CODEC_ID_SONIC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sonic", - .long_name = NULL_IF_CONFIG_SMALL("Sonic"), - }, - { - .id = AV_CODEC_ID_SONIC_LS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "sonicls", - .long_name = NULL_IF_CONFIG_SMALL("Sonic lossless"), - }, - { - .id = AV_CODEC_ID_PAF_AUDIO, - .type = AVMEDIA_TYPE_AUDIO, - .name = "paf_audio", - .long_name = NULL_IF_CONFIG_SMALL("Amazing Studio Packed Animation File Audio"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_OPUS, - .type = AVMEDIA_TYPE_AUDIO, - .name = "opus", - .long_name = NULL_IF_CONFIG_SMALL("Opus (Opus Interactive Audio Codec)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_COMFORT_NOISE, - .type = AVMEDIA_TYPE_AUDIO, - .name = "comfortnoise", - .long_name = NULL_IF_CONFIG_SMALL("RFC 3389 Comfort Noise"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_TAK, - .type = AVMEDIA_TYPE_AUDIO, - .name = "tak", - .long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"), - .props = AV_CODEC_PROP_LOSSLESS, - }, - { - .id = AV_CODEC_ID_METASOUND, - .type = AVMEDIA_TYPE_AUDIO, - .name = "metasound", - .long_name = NULL_IF_CONFIG_SMALL("Voxware MetaSound"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_EVRC, - .type = AVMEDIA_TYPE_AUDIO, - .name = "evrc", - .long_name = NULL_IF_CONFIG_SMALL("EVRC (Enhanced Variable Rate Codec)"), - .props = AV_CODEC_PROP_LOSSY, - }, - { - .id = AV_CODEC_ID_SMV, - .type = AVMEDIA_TYPE_AUDIO, - .name = "smv", - .long_name = NULL_IF_CONFIG_SMALL("SMV (Selectable Mode Vocoder)"), - .props = AV_CODEC_PROP_LOSSY, - }, - - /* subtitle codecs */ - { - .id = AV_CODEC_ID_DVD_SUBTITLE, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "dvd_subtitle", - .long_name = NULL_IF_CONFIG_SMALL("DVD subtitles"), - .props = AV_CODEC_PROP_BITMAP_SUB, - }, - { - .id = AV_CODEC_ID_DVB_SUBTITLE, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "dvb_subtitle", - .long_name = NULL_IF_CONFIG_SMALL("DVB subtitles"), - .props = AV_CODEC_PROP_BITMAP_SUB, - }, - { - .id = AV_CODEC_ID_TEXT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "text", - .long_name = NULL_IF_CONFIG_SMALL("raw UTF-8 text"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_XSUB, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "xsub", - .long_name = NULL_IF_CONFIG_SMALL("XSUB"), - .props = AV_CODEC_PROP_BITMAP_SUB, - }, - { - .id = AV_CODEC_ID_ASS, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "ass", - .long_name = NULL_IF_CONFIG_SMALL("ASS (Advanced SSA) subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_SSA, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "ssa", - .long_name = NULL_IF_CONFIG_SMALL("SSA (SubStation Alpha) subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_MOV_TEXT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "mov_text", - .long_name = NULL_IF_CONFIG_SMALL("MOV text"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_HDMV_PGS_SUBTITLE, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "hdmv_pgs_subtitle", - .long_name = NULL_IF_CONFIG_SMALL("HDMV Presentation Graphic Stream subtitles"), - .props = AV_CODEC_PROP_BITMAP_SUB, - }, - { - .id = AV_CODEC_ID_DVB_TELETEXT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "dvb_teletext", - .long_name = NULL_IF_CONFIG_SMALL("DVB teletext"), - }, - { - .id = AV_CODEC_ID_SRT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "srt", - .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle with embedded timing"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_SUBRIP, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "subrip", - .long_name = NULL_IF_CONFIG_SMALL("SubRip subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_MICRODVD, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "microdvd", - .long_name = NULL_IF_CONFIG_SMALL("MicroDVD subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_MPL2, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "mpl2", - .long_name = NULL_IF_CONFIG_SMALL("MPL2 subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_EIA_608, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "eia_608", - .long_name = NULL_IF_CONFIG_SMALL("EIA-608 closed captions"), - }, - { - .id = AV_CODEC_ID_JACOSUB, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "jacosub", - .long_name = NULL_IF_CONFIG_SMALL("JACOsub subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_PJS, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "pjs", - .long_name = NULL_IF_CONFIG_SMALL("PJS (Phoenix Japanimation Society) subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_SAMI, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "sami", - .long_name = NULL_IF_CONFIG_SMALL("SAMI subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_REALTEXT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "realtext", - .long_name = NULL_IF_CONFIG_SMALL("RealText subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_SUBVIEWER1, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "subviewer1", - .long_name = NULL_IF_CONFIG_SMALL("SubViewer v1 subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_SUBVIEWER, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "subviewer", - .long_name = NULL_IF_CONFIG_SMALL("SubViewer subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_VPLAYER, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "vplayer", - .long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_WEBVTT, - .type = AVMEDIA_TYPE_SUBTITLE, - .name = "webvtt", - .long_name = NULL_IF_CONFIG_SMALL("WebVTT subtitle"), - .props = AV_CODEC_PROP_TEXT_SUB, - }, - { - .id = AV_CODEC_ID_BINTEXT, - .type = AVMEDIA_TYPE_VIDEO, - .name = "bintext", - .long_name = NULL_IF_CONFIG_SMALL("Binary text"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_XBIN, - .type = AVMEDIA_TYPE_VIDEO, - .name = "xbin", - .long_name = NULL_IF_CONFIG_SMALL("eXtended BINary text"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_IDF, - .type = AVMEDIA_TYPE_VIDEO, - .name = "idf", - .long_name = NULL_IF_CONFIG_SMALL("iCEDraw text"), - .props = AV_CODEC_PROP_INTRA_ONLY, - }, - { - .id = AV_CODEC_ID_SMPTE_KLV, - .type = AVMEDIA_TYPE_DATA, - .name = "klv", - .long_name = NULL_IF_CONFIG_SMALL("SMPTE 336M Key-Length-Value (KLV) metadata"), - }, - { - .id = AV_CODEC_ID_DVD_NAV, - .type = AVMEDIA_TYPE_DATA, - .name = "dvd_nav_packet", - .long_name = NULL_IF_CONFIG_SMALL("DVD Nav packet"), - }, - { - .id = AV_CODEC_ID_TIMED_ID3, - .type = AVMEDIA_TYPE_DATA, - .name = "timed_id3", - .long_name = NULL_IF_CONFIG_SMALL("timed ID3 metadata"), - }, - -}; - -const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id) -{ - int i; - - for (i = 0; i < FF_ARRAY_ELEMS(codec_descriptors); i++) - if (codec_descriptors[i].id == id) - return &codec_descriptors[i]; - return NULL; -} - -const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev) -{ - if (!prev) - return &codec_descriptors[0]; - if (prev - codec_descriptors < FF_ARRAY_ELEMS(codec_descriptors) - 1) - return prev + 1; - return NULL; -} - -const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name) -{ - const AVCodecDescriptor *desc = NULL; - - while ((desc = avcodec_descriptor_next(desc))) { - if (!strcmp(desc->name, name)) - return desc; - } - return NULL; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/copy_block.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/copy_block.h deleted file mode 100644 index a73910d80..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/copy_block.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_COPY_BLOCK_H -#define AVCODEC_COPY_BLOCK_H - -#include - -#include "libavutil/intreadwrite.h" - -static inline void copy_block2(uint8_t *dst, const uint8_t *src, int dstStride, int srcStride, int h) -{ - int i; - for(i=0; i -#include - -#include "libavutil/error.h" - -#include "dca.h" -#include "put_bits.h" - -const uint32_t avpriv_dca_sample_rates[16] = -{ - 0, 8000, 16000, 32000, 0, 0, 11025, 22050, 44100, 0, 0, - 12000, 24000, 48000, 96000, 192000 -}; - -int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - int max_size) -{ - uint32_t mrk; - int i, tmp; - const uint16_t *ssrc = (const uint16_t *) src; - uint16_t *sdst = (uint16_t *) dst; - PutBitContext pb; - - if ((unsigned) src_size > (unsigned) max_size) - src_size = max_size; - - mrk = AV_RB32(src); - switch (mrk) { - case DCA_MARKER_RAW_BE: - memcpy(dst, src, src_size); - return src_size; - case DCA_MARKER_RAW_LE: - for (i = 0; i < (src_size + 1) >> 1; i++) - *sdst++ = av_bswap16(*ssrc++); - return src_size; - case DCA_MARKER_14B_BE: - case DCA_MARKER_14B_LE: - init_put_bits(&pb, dst, max_size); - for (i = 0; i < (src_size + 1) >> 1; i++, src += 2) { - tmp = ((mrk == DCA_MARKER_14B_BE) ? AV_RB16(src) : AV_RL16(src)) & 0x3FFF; - put_bits(&pb, 14, tmp); - } - flush_put_bits(&pb); - return (put_bits_count(&pb) + 7) >> 3; - default: - return AVERROR_INVALIDDATA; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca.h deleted file mode 100644 index d60b28207..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * DCA compatible decoder - * Copyright (C) 2004 Gildas Bazin - * Copyright (C) 2004 Benjamin Zores - * Copyright (C) 2006 Benjamin Larsson - * Copyright (C) 2007 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCA_H -#define AVCODEC_DCA_H - -#include -#include "libavutil/internal.h" - -/** DCA syncwords, also used for bitstream type detection */ -#define DCA_MARKER_RAW_BE 0x7FFE8001 -#define DCA_MARKER_RAW_LE 0xFE7F0180 -#define DCA_MARKER_14B_BE 0x1FFFE800 -#define DCA_MARKER_14B_LE 0xFF1F00E8 - -/** DCA-HD specific block starts with this marker. */ -#define DCA_HD_MARKER 0x64582025 - -extern av_export const uint32_t avpriv_dca_sample_rates[16]; - -/** - * Convert bitstream to one representation based on sync marker - */ -int ff_dca_convert_bitstream(const uint8_t *src, int src_size, uint8_t *dst, - int max_size); - -#endif /* AVCODEC_DCA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca_parser.c deleted file mode 100644 index 9b7337112..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dca_parser.c +++ /dev/null @@ -1,172 +0,0 @@ -/* - * DCA parser - * Copyright (C) 2004 Gildas Bazin - * Copyright (C) 2004 Benjamin Zores - * Copyright (C) 2006 Benjamin Larsson - * Copyright (C) 2007 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "parser.h" -#include "dca.h" -#include "get_bits.h" - -typedef struct DCAParseContext { - ParseContext pc; - uint32_t lastmarker; - int size; - int framesize; - int hd_pos; -} DCAParseContext; - -#define IS_MARKER(state, i, buf, buf_size) \ - ((state == DCA_MARKER_14B_LE && (i < buf_size-2) && (buf[i+1] & 0xF0) == 0xF0 && buf[i+2] == 0x07) \ - || (state == DCA_MARKER_14B_BE && (i < buf_size-2) && buf[i+1] == 0x07 && (buf[i+2] & 0xF0) == 0xF0) \ - || state == DCA_MARKER_RAW_LE || state == DCA_MARKER_RAW_BE || state == DCA_HD_MARKER) - -/** - * Find the end of the current frame in the bitstream. - * @return the position of the first byte of the next frame, or -1 - */ -static int dca_find_frame_end(DCAParseContext * pc1, const uint8_t * buf, - int buf_size) -{ - int start_found, i; - uint32_t state; - ParseContext *pc = &pc1->pc; - - start_found = pc->frame_start_found; - state = pc->state; - - i = 0; - if (!start_found) { - for (i = 0; i < buf_size; i++) { - state = (state << 8) | buf[i]; - if (IS_MARKER(state, i, buf, buf_size)) { - if (!pc1->lastmarker || state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER) { - start_found = 1; - pc1->lastmarker = state; - i++; - break; - } - } - } - } - if (start_found) { - for (; i < buf_size; i++) { - pc1->size++; - state = (state << 8) | buf[i]; - if (state == DCA_HD_MARKER && !pc1->hd_pos) - pc1->hd_pos = pc1->size; - if (IS_MARKER(state, i, buf, buf_size) && (state == pc1->lastmarker || pc1->lastmarker == DCA_HD_MARKER)) { - if(pc1->framesize > pc1->size) - continue; - pc->frame_start_found = 0; - pc->state = -1; - pc1->size = 0; - return i - 3; - } - } - } - pc->frame_start_found = start_found; - pc->state = state; - return END_NOT_FOUND; -} - -static av_cold int dca_parse_init(AVCodecParserContext * s) -{ - DCAParseContext *pc1 = s->priv_data; - - pc1->lastmarker = 0; - return 0; -} - -static int dca_parse_params(const uint8_t *buf, int buf_size, int *duration, - int *sample_rate, int *framesize) -{ - GetBitContext gb; - uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 }; - int ret, sample_blocks, sr_code; - - if (buf_size < 12) - return AVERROR_INVALIDDATA; - - if ((ret = ff_dca_convert_bitstream(buf, 12, hdr, 12)) < 0) - return ret; - - init_get_bits(&gb, hdr, 96); - - skip_bits_long(&gb, 39); - sample_blocks = get_bits(&gb, 7) + 1; - if (sample_blocks < 8) - return AVERROR_INVALIDDATA; - *duration = 256 * (sample_blocks / 8); - - *framesize = get_bits(&gb, 14) + 1; - if (*framesize < 95) - return AVERROR_INVALIDDATA; - - skip_bits(&gb, 6); - sr_code = get_bits(&gb, 4); - *sample_rate = avpriv_dca_sample_rates[sr_code]; - if (*sample_rate == 0) - return AVERROR_INVALIDDATA; - - return 0; -} - -static int dca_parse(AVCodecParserContext * s, - AVCodecContext * avctx, - const uint8_t ** poutbuf, int *poutbuf_size, - const uint8_t * buf, int buf_size) -{ - DCAParseContext *pc1 = s->priv_data; - ParseContext *pc = &pc1->pc; - int next, duration, sample_rate; - - if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { - next = buf_size; - } else { - next = dca_find_frame_end(pc1, buf, buf_size); - - if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - } - - /* read the duration and sample rate from the frame header */ - if (!dca_parse_params(buf, buf_size, &duration, &sample_rate, &pc1->framesize)) { - s->duration = duration; - avctx->sample_rate = sample_rate; - } else - s->duration = 0; - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - -AVCodecParser ff_dca_parser = { - .codec_ids = { AV_CODEC_ID_DTS }, - .priv_data_size = sizeof(DCAParseContext), - .parser_init = dca_parse_init, - .parser_parse = dca_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadata.h deleted file mode 100644 index 0ae125c2f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadata.h +++ /dev/null @@ -1,7662 +0,0 @@ -/* - * DCA compatible decoder data - * Copyright (C) 2004 Gildas Bazin - * Copyright (c) 2006 Benjamin Larsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCADATA_H -#define AVCODEC_DCADATA_H - -#include -#include "libavutil/mem.h" - -/* Generic tables */ - -static const uint32_t dca_bit_rates[32] = -{ - 32000, 56000, 64000, 96000, 112000, 128000, - 192000, 224000, 256000, 320000, 384000, - 448000, 512000, 576000, 640000, 768000, - 896000, 1024000, 1152000, 1280000, 1344000, - 1408000, 1411200, 1472000, 1536000, 1920000, - 2048000, 3072000, 3840000, 1/*open*/, 2/*variable*/, 3/*lossless*/ -}; - -static const uint8_t dca_channels[16] = -{ - 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8 -}; - -static const uint8_t dca_bits_per_sample[7] = -{ - 16, 16, 20, 20, 0, 24, 24 -}; - - -/* Adpcm data */ - -/* 16bits signed fractional Q13 binary codes */ -static const int16_t adpcm_vb[4096][4] = -{ - { 9928, -2618, -1093, -1263 }, - { 11077, -2876, -1747, -308 }, - { 10503, -1082, -1426, -1167 }, - { 9337, -2403, -1495, 274 }, - { 10698, -2529, -532, -1122 }, - { 10368, -3974, -1264, -750 }, - { 10070, -3667, 346, 863 }, - { 10278, -3093, 311, -576 }, - { 9894, -1330, -1428, -860 }, - { 10544, -1923, -1058, -971 }, - { 10996, -1632, -841, -1404 }, - { 11832, -3465, 1658, -1990 }, - { 10852, -688, -2658, -499 }, - { 10546, -1749, -147, -1733 }, - { 10801, -1004, -708, -1453 }, - { 10588, -441, -2113, -952 }, - { 10141, -3331, -582, -1432 }, - { 9608, -2590, 383, 258 }, - { 11422, -3265, 229, -1544 }, - { 10460, -1338, -713, -1568 }, - { 10306, -1721, -1660, -603 }, - { 9580, -1812, -1235, -1061 }, - { 11471, -2285, -1617, -607 }, - { 10081, -2225, -1408, -868 }, - { 10715, -2624, -1367, -704 }, - { 10616, -1871, -2770, -35 }, - { 9352, -2340, -1024, -1566 }, - { 11065, -1458, -1926, -735 }, - { 11334, -2056, -1041, -1144 }, - { 9825, -2048, -794, -1536 }, - { 11850, -2695, -1123, -867 }, - { 10654, -2226, -1891, -373 }, - { 10024, -1557, -808, -1069 }, - { 11142, -1266, -3238, 128 }, - { 11729, -3282, -514, -1011 }, - { 11402, -2094, -2335, -189 }, - { 10195, -3658, 181, -1875 }, - { 11431, -2626, -404, -1377 }, - { 11001, -3868, -619, -1077 }, - { 10894, -2559, 274, -1758 }, - { 9633, -1482, -2253, -773 }, - { 11245, -3321, 830, -1972 }, - { 9768, -2701, -199, -1859 }, - { 10500, -2042, 525, -2043 }, - { 11669, -4069, 293, -1468 }, - { 9192, -1991, -583, -61 }, - { 10057, -3220, -2015, -473 }, - { 9497, -2315, -2490, -467 }, - { 10455, -3069, -1194, -1007 }, - { 9994, -1936, -60, -1225 }, - { 9295, -2156, -1761, -1134 }, - { 10085, -3748, -1026, 197 }, - { 9334, -2360, 804, -351 }, - { 11561, -2553, 1352, -2313 }, - { 12837, -3998, 1195, -1958 }, - { 10114, -1100, -2414, -394 }, - { 9341, -2530, 315, 755 }, - { 10131, -3164, 1411, -674 }, - { 9535, -905, -1551, 579 }, - { 11717, -1519, -3051, 91 }, - { 9824, -2911, -2775, 192 }, - { 9662, -2934, -561, 1450 }, - { 11085, -3392, -1298, -659 }, - { 8955, -2102, -1899, 703 }, - { 8607, -1742, -4348, 814 }, - { 7640, -2063, -3617, 52 }, - { 7074, -826, -4325, 4375 }, - { 7714, 584, -4238, 1927 }, - { 6355, -952, -4912, 3127 }, - { 7069, -660, -6413, 4087 }, - { 8313, -132, -2964, -876 }, - { 6952, -1422, -3962, -24 }, - { 9299, -734, -3088, -263 }, - { 9484, -574, -4513, 466 }, - { 7246, -91, -3735, -704 }, - { 8325, -1417, -3090, -530 }, - { 6469, -1226, -4757, 829 }, - { 6652, -368, -5682, 1393 }, - { 7971, -1278, -2284, 1205 }, - { 7229, -699, -3556, 1840 }, - { 7994, 1284, -2729, 732 }, - { 9005, -698, -4522, 2189 }, - { 6963, 197, -2727, 380 }, - { 8527, 135, -3991, -213 }, - { 8840, 934, -3014, -567 }, - { 10125, 418, -3284, -371 }, - { 6367, 361, -2318, 2554 }, - { 7892, 172, -5247, 4673 }, - { 6674, 387, -5424, 4398 }, - { 6240, 684, -4047, 1219 }, - { 11170, -794, -5081, 1195 }, - { 11765, -648, -6265, 2052 }, - { 10845, -775, -3837, 366 }, - { 12496, -689, -8260, 3562 }, - { 7893, -1166, -4972, 988 }, - { 8592, 1052, -5986, 3087 }, - { 7277, 1874, -5685, 3579 }, - { 6900, 2016, -4809, 3491 }, - { 8530, -2405, -3250, 1986 }, - { 9426, 494, -7067, 5038 }, - { 10285, 564, -8210, 5370 }, - { 8749, -2207, -3980, 2852 }, - { 9653, -2686, -4300, 1400 }, - { 9770, -2286, -5663, 4233 }, - { 8490, -4, -7048, 4496 }, - { 7697, -1209, -5328, 3183 }, - { 6451, 801, -4324, -554 }, - { 7387, 1806, -5265, 545 }, - { 7450, -2302, -4445, 1418 }, - { 8817, -1370, -5827, 2168 }, - { 10324, -2406, -5629, 2579 }, - { 8863, -2578, -3537, 467 }, - { 6901, -1624, -3169, 3392 }, - { 7846, 156, -6948, 3381 }, - { 7928, -1115, -5972, 4816 }, - { 6089, -599, -4368, -320 }, - { 7833, 1246, -3960, -621 }, - { 8931, 2521, -6768, 2052 }, - { 8900, 1944, -4126, 40 }, - { 7661, -34, -2855, 2480 }, - { 5873, 474, -3262, 3712 }, - { 7535, -234, -4699, 216 }, - { 5856, 143, -5142, 73 }, - { 8944, -106, -5874, 3663 }, - { 7134, 426, -5879, 2895 }, - { 10199, 1011, -4762, 369 }, - { 8454, 264, -5971, 1291 }, - { 7822, -2449, -4333, 4540 }, - { 6200, -2758, -2632, 1497 }, - { 6070, -4315, -2699, 414 }, - { 7047, -3739, -3210, 1060 }, - { 5675, -3801, -2717, -407 }, - { 4789, -4063, -2628, -744 }, - { 4023, -3366, -3133, -726 }, - { 4296, -2407, -3381, -513 }, - { 4388, -2931, -2820, 1512 }, - { 4559, -4233, -1941, 1976 }, - { 6702, -3208, -1755, 1680 }, - { 4416, -3521, -1052, 2984 }, - { 7154, -4266, -1203, 3732 }, - { 3625, -4242, -3244, 1395 }, - { 6518, -2856, -1304, 2887 }, - { 6170, -1949, -3014, 3973 }, - { 5189, -2451, -4020, 3477 }, - { 6218, -2988, -1921, 3844 }, - { 4827, -3688, -1928, 3343 }, - { 6668, -3991, -2805, 3095 }, - { 5297, -3115, -3684, 2390 }, - { 5354, -4614, -2662, 1504 }, - { 4196, -3091, -4147, 1135 }, - { 3540, -2893, -4007, 100 }, - { 5569, -1602, -4007, 1909 }, - { 4341, -2091, -4272, 252 }, - { 5559, -2878, -3832, 498 }, - { 4548, -4479, -2898, -27 }, - { 5176, -2494, -4635, 1476 }, - { 3294, -3485, -3738, 716 }, - { 4920, -1229, -4195, -365 }, - { 3257, -3518, -3349, 2862 }, - { 5286, -1948, -3485, -778 }, - { 6502, -3051, -152, 2854 }, - { 5864, -4192, -1076, 3451 }, - { 4656, -3122, -3448, 179 }, - { 5907, -754, -1596, 3116 }, - { 7229, -3680, -1590, 2892 }, - { 5107, -3888, -3364, 806 }, - { 6764, -2635, -3450, 134 }, - { 5258, -2827, -2844, -1052 }, - { 5798, -1725, -4305, 205 }, - { 5404, -1213, -3362, 449 }, - { 6224, -2738, -3046, -581 }, - { 4223, -2438, -2725, 3745 }, - { 4751, -3411, -2123, 116 }, - { 3868, -3000, -3954, 2297 }, - { 6819, -2899, -4277, 2825 }, - { 4207, -4754, -2808, 865 }, - { 4804, -1494, -1997, 4688 }, - { 5282, -2213, -548, 3559 }, - { 5580, -1912, -566, 4370 }, - { 6168, -2857, -672, 4053 }, - { 6583, -4515, -2850, 1670 }, - { 6511, -3093, -3988, 1421 }, - { 4646, -1790, -1443, 3650 }, - { 5915, -924, -2020, 896 }, - { 7814, -4181, -3152, 2007 }, - { 6190, -2238, -4817, 2279 }, - { 4737, -4034, -3288, 1835 }, - { 8161, -3633, -3423, 3137 }, - { 7415, -2351, -2088, 4290 }, - { 4106, -2517, -62, 2905 }, - { 4909, -3145, -614, 4112 }, - { 4938, -3281, -397, 1100 }, - { -173, 919, 1589, -5363 }, - { -13, 796, -295, -6655 }, - { -1860, -829, 1141, -4555 }, - { 2298, -838, -664, -5005 }, - { -884, -1097, 2074, -4613 }, - { -101, 281, 2846, -4535 }, - { 1166, 453, 2429, -5910 }, - { 879, -664, 2370, -5452 }, - { 1415, -370, -1699, -4727 }, - { -1413, 1277, -669, -6649 }, - { 2133, 304, -968, -4624 }, - { 380, 586, -2087, -4892 }, - { 1336, 275, -82, -5789 }, - { -2459, 1057, -34, -5416 }, - { 2278, -1758, 866, -5653 }, - { 1945, -2295, -149, -5302 }, - { 1287, -3525, 996, -5255 }, - { 2297, 803, 1177, -6067 }, - { 187, -180, -619, -6202 }, - { -793, -2537, 1554, -5057 }, - { -2703, -204, -629, -5853 }, - { -1007, -146, 313, -5582 }, - { 830, 357, 869, -6363 }, - { -228, -575, -3177, -4433 }, - { -1001, -1553, -142, -5708 }, - { -1644, 1683, 1721, -4533 }, - { 893, 1924, -15, -5791 }, - { 2195, 2061, -262, -5471 }, - { 3031, 270, 311, -5096 }, - { 1912, 1638, -1523, -4677 }, - { -3142, -55, 253, -4914 }, - { 356, -1680, 343, -6123 }, - { -2241, -1734, -976, -5939 }, - { -2196, -2893, 547, -4938 }, - { -1245, 126, -1916, -5419 }, - { -249, -3755, -1422, -5594 }, - { 575, -2683, -1926, -4566 }, - { -762, 1885, 192, -5880 }, - { -811, -2562, -1068, -6013 }, - { -2264, -3086, -976, -4775 }, - { 70, -1215, 2880, -4410 }, - { 714, -3760, 2916, -4691 }, - { -244, -3404, 1740, -4493 }, - { 684, -5137, -328, -5608 }, - { -529, -3825, -1786, -4535 }, - { -713, -4743, -1118, -5546 }, - { 2718, -3788, 1798, -5708 }, - { -1639, -3679, -1564, -6095 }, - { 1693, -2642, -1389, -4539 }, - { 505, -1573, -1651, -4878 }, - { -835, -2256, -1941, -5352 }, - { 1464, -411, 1993, -6441 }, - { 493, -3184, -145, -6148 }, - { -1413, 499, -1617, -6479 }, - { -294, 1722, -1419, -5725 }, - { -2937, -1528, -175, -4624 }, - { -594, -5911, -56, -6146 }, - { -300, -4275, 1156, -5947 }, - { 552, -2643, 2669, -3959 }, - { 905, -4158, 1789, -5809 }, - { 1336, -2009, 2108, -5903 }, - { 1555, -3600, 1110, -6759 }, - { -1294, -3464, 77, -6084 }, - { -1139, -4006, -1270, -4181 }, - { -5094, -3296, 1092, -2847 }, - { -5503, -2883, 1984, -2067 }, - { -4671, -4218, -1417, -4132 }, - { -3763, -3818, 1262, -3082 }, - { -5132, -3430, 2928, -728 }, - { -5957, -2877, 1251, -2446 }, - { -4425, -2319, -212, -4276 }, - { -6201, -1993, 1774, -2182 }, - { -5500, -3836, 2201, -1396 }, - { -6934, -2334, 2366, -1293 }, - { -6124, -4140, 1337, -1977 }, - { -6553, -4186, 1756, -1325 }, - { -5126, -1258, 744, -3656 }, - { -5167, -1390, 1581, -2895 }, - { -4525, -3398, 2429, -1865 }, - { -4076, -3183, 2027, -2510 }, - { -6191, -3274, 1838, -1814 }, - { -4454, -2753, 2723, -1185 }, - { -6655, -4797, 251, -2595 }, - { -6332, -2232, 1832, 217 }, - { -5869, -1698, 134, 340 }, - { -6614, -1045, 2126, -1932 }, - { -4859, -2107, 2010, -2435 }, - { -6274, -1622, 2808, -1374 }, - { -3119, -3209, 521, -3988 }, - { -5676, -2082, -420, -2711 }, - { -7073, -3623, 696, -2343 }, - { -5986, -4224, 572, -2454 }, - { -4340, -4521, 882, -2771 }, - { -6178, -1933, 535, -1444 }, - { -4923, -4163, 1744, -2066 }, - { -6410, -1519, 1058, -2683 }, - { -5077, -1185, 856, -2216 }, - { -7091, -2444, 687, -2597 }, - { -5284, -2165, 3239, -993 }, - { -4763, -1497, 197, -3179 }, - { -4128, -4958, -396, -3578 }, - { -5054, -3878, -647, -2672 }, - { -7005, -3348, 1679, -1579 }, - { -5767, -1017, 2582, -1915 }, - { -7069, -2787, 1331, -2070 }, - { -5532, -2296, 706, -2950 }, - { -5059, -3543, -821, -3637 }, - { -6639, -1835, 1016, -696 }, - { -5611, -5220, -694, -3371 }, - { -5994, -2803, 2933, -729 }, - { -5948, -619, 1596, -2676 }, - { -5486, -4419, 153, -3265 }, - { -4329, -3440, 1646, -1439 }, - { -4083, -3978, 177, -3569 }, - { -4289, -2599, 1224, -3075 }, - { -5707, -3253, 1912, -759 }, - { -6606, -3437, 2562, -571 }, - { -5254, -2444, 769, -352 }, - { -6545, -3154, 582, -1103 }, - { -5328, -2241, 2566, -1775 }, - { -7216, -1936, 1538, -1983 }, - { -3730, -2451, 426, -3869 }, - { -5110, -1385, 2031, -1169 }, - { -6470, -2715, 269, -3123 }, - { -5806, -2480, -97, -3832 }, - { -3683, -4916, -490, -4330 }, - { -6341, -2083, -669, -115 }, - { -4913, -4079, -837, -4673 }, - { -3274, -2497, 2334, -2652 }, - { -1286, -1731, 2550, -3756 }, - { -3375, -877, 926, -3977 }, - { -2525, -2079, 2879, -2625 }, - { -5308, -504, 3111, -1607 }, - { -4904, 460, 4093, -1232 }, - { -1993, 1616, 4656, -1913 }, - { -3481, -1176, 3119, -2236 }, - { -4132, -1502, 2339, -2545 }, - { -2542, 1151, 3569, -2550 }, - { -4381, 430, 3147, -2082 }, - { -3888, 867, 3899, -1657 }, - { -2861, 1290, 4202, -1979 }, - { -3893, -253, 2363, -2764 }, - { -1705, 688, 3827, -2923 }, - { -2223, 2312, 3700, -3148 }, - { -1986, -720, 5021, -795 }, - { -3177, 242, 1952, -3352 }, - { -1854, 1509, 2528, -3815 }, - { -3173, 97, 5019, -706 }, - { -2689, -145, 1375, -3915 }, - { -4838, -385, 2488, -2427 }, - { -4557, -355, 1603, -3060 }, - { -3522, 1832, 3292, -2674 }, - { -3769, 780, 2378, -2704 }, - { -4323, -1932, 3414, -1169 }, - { -2740, 1158, 2729, -3273 }, - { -3647, 210, 1464, -2892 }, - { -2342, -2097, 1513, -3727 }, - { -4422, -1242, 3130, -1833 }, - { -1308, -1039, 4290, -1875 }, - { -1754, -2535, 3298, -2314 }, - { -4102, -186, 4037, -1094 }, - { -1008, 1570, 3290, 171 }, - { -3322, -2621, 2791, -1536 }, - { -2539, -2597, 3442, -1672 }, - { -3411, -2015, 3670, -1174 }, - { -2097, 730, 5581, -1399 }, - { -1510, -74, 4820, -2004 }, - { -4086, -868, 4425, -771 }, - { -956, -986, 3640, -2925 }, - { -2087, -1250, 3464, -2458 }, - { -3308, -2411, 1334, -3667 }, - { -2264, -389, 4004, -1854 }, - { -680, 239, 4058, -3388 }, - { -1357, 30, 2993, -3658 }, - { -3601, -552, 1177, -1136 }, - { -2641, 442, 4374, -1625 }, - { -2525, 770, 1640, -3895 }, - { -3172, -891, 3893, -1608 }, - { -2996, 13, 3277, -2414 }, - { -899, 1055, 4470, -2501 }, - { -422, -584, 3475, -3787 }, - { -1978, -593, 2566, -3415 }, - { -3150, -1280, 2362, -3047 }, - { -3592, 224, 1026, -3932 }, - { -4840, -1189, 3633, -879 }, - { -3952, -2255, 2916, -1826 }, - { -1695, 28, 1810, -349 }, - { -745, -2484, 3308, -3293 }, - { -1016, 1563, 5365, -1823 }, - { -2172, -1787, 4266, -1287 }, - { -1241, -1951, 3982, -2413 }, - { -2009, -2639, 2330, -3480 }, - { 5105, -1618, -2588, -2015 }, - { 6497, -1523, -3218, -910 }, - { 6526, -2305, -2029, -1790 }, - { 5289, -99, -3436, -400 }, - { 5781, -1623, -1577, -2617 }, - { 5259, -670, -3125, -1700 }, - { 6343, -1256, -331, -3222 }, - { 7967, -678, -2195, -1462 }, - { 6119, -695, -2988, -1538 }, - { 6108, 494, -3359, -1548 }, - { 5067, 969, -2328, -2707 }, - { 7595, -435, -1497, -2056 }, - { 6929, -719, -2420, -1665 }, - { 5190, 584, -2982, -2103 }, - { 6106, -444, -1411, -2739 }, - { 5584, 289, -1804, -2803 }, - { 5276, 227, -1180, -3361 }, - { 7544, -1525, -1834, -1725 }, - { 5986, -1470, -2606, -1701 }, - { 5096, -765, -1712, -3006 }, - { 5423, -149, -3933, -1157 }, - { 7651, 26, -2445, -1507 }, - { 4745, -464, -1735, -2362 }, - { 5352, -1011, -1094, -1999 }, - { 6300, -672, -542, -1950 }, - { 6675, -1020, -1318, -1059 }, - { 7218, -2036, -603, -2462 }, - { 7755, -1514, -2430, -1229 }, - { 5041, 449, -1056, -2405 }, - { 6710, -2277, -1344, -2284 }, - { 6824, -1347, -2254, 251 }, - { 6068, -1857, -983, -1316 }, - { 5603, -2177, -2730, -1477 }, - { 5838, -1059, -3604, -970 }, - { 5076, -789, -335, -2413 }, - { 6191, -1634, -2000, -2129 }, - { 5092, -1292, -2543, -1034 }, - { 5305, 435, -1710, -1850 }, - { 6140, 561, -2176, -2380 }, - { 6752, 348, -2496, -1890 }, - { 6405, 273, -1098, -2778 }, - { 6942, -1340, -496, -1381 }, - { 5238, -687, -2454, -2349 }, - { 6959, -882, -1833, -2061 }, - { 6292, -253, -2125, -2199 }, - { 5838, -574, -759, -3215 }, - { 6954, -1484, -640, -2771 }, - { 7498, -1706, -1210, -2154 }, - { 6772, -1003, -1235, -2532 }, - { 6014, 228, -2154, -1108 }, - { 6943, -2178, -2644, -1122 }, - { 7262, -763, -3056, -1090 }, - { 6273, -1478, -1072, 177 }, - { 4734, 425, -2912, 357 }, - { 7129, 168, -1537, -2327 }, - { 7204, -434, -746, -2660 }, - { 6879, 57, -3087, -1310 }, - { 4623, -610, -718, -3459 }, - { 6565, -543, -1998, -339 }, - { 4752, -277, -2066, -1405 }, - { 7435, -1416, -1904, -505 }, - { 4076, 150, -1222, -3556 }, - { 7082, -28, -1456, -1174 }, - { 5941, -446, -1326, -1158 }, - { 3870, -1648, -2474, -2589 }, - { 858, 37, -3387, -3721 }, - { 3557, -1503, -1664, -3383 }, - { 3336, -1972, -3079, -2216 }, - { 3186, 60, -4185, -863 }, - { 3456, -773, -3066, -2457 }, - { 4131, -913, -2060, -2601 }, - { 4431, -691, -4114, -972 }, - { 3461, -334, -3680, -1751 }, - { 2006, -459, -2214, -3827 }, - { 1322, 32, -2816, -3203 }, - { 4425, -1897, -2791, -1946 }, - { 4504, 23, -3421, -1909 }, - { 3090, -885, -2366, -3264 }, - { 3209, -2363, -3730, -834 }, - { 3312, -1471, -3641, -1579 }, - { 4184, -1669, -3323, -1248 }, - { 2190, -931, -3302, -2944 }, - { 2947, -229, -4791, -1195 }, - { 2020, -1626, -2700, -3125 }, - { 2214, -326, -4352, -1683 }, - { 3286, -2619, -2412, -2458 }, - { 1000, -2571, -4129, -2158 }, - { 2496, -2627, -3611, -1433 }, - { 2043, -2191, -2167, -3827 }, - { 2571, -2544, -1915, -3222 }, - { 2022, -1501, -3856, -2165 }, - { 2685, -1180, -1461, -4038 }, - { 1610, -2313, -4391, -1173 }, - { 2340, -2490, -4215, -516 }, - { 1742, -2615, -3632, -2146 }, - { 523, -1293, -4246, -2442 }, - { 3725, -2723, -3014, -1576 }, - { 3554, -1381, -4200, -824 }, - { 1291, -1594, -4777, -1430 }, - { 1452, 515, -2960, -3830 }, - { 4264, -894, -3305, -1826 }, - { 2606, -1452, -4522, -966 }, - { 1196, -830, -4807, -1816 }, - { 1054, -775, -2616, -4071 }, - { 4206, 415, -4344, -1132 }, - { 3044, 491, -4126, -1934 }, - { 988, -901, -3353, -3443 }, - { 1729, -3063, -2267, -3370 }, - { 3915, 912, -2989, -2387 }, - { 3781, 300, -2457, -3050 }, - { 2712, 924, -1350, -1206 }, - { 4230, 405, -2343, 665 }, - { 1878, -873, -225, -29 }, - { 3510, 56, -1334, -3420 }, - { 2850, 1447, -2651, -3150 }, - { 1510, -706, -4125, -2483 }, - { 3115, 793, -1692, -3894 }, - { 2667, 213, -2973, -2786 }, - { 1184, -2384, -3051, -3173 }, - { 2139, 796, -2079, -3697 }, - { 1464, -1483, -3726, -2754 }, - { 2407, -1148, -3915, -1569 }, - { 2612, -1779, -3217, -2271 }, - { 2406, -2870, -2937, -2496 }, - { 2140, 126, -3646, -2758 }, - { 2952, -1036, 268, -1423 }, - { 93, -1931, -3841, -3535 }, - { 389, -2953, -3383, -3343 }, - { 8652, -5511, -1662, 565 }, - { 7427, -2791, -2535, -842 }, - { 8541, -4253, -1407, -988 }, - { 8018, -3203, -2998, 105 }, - { 7231, -3926, -958, 1308 }, - { 7331, -3690, -363, 2586 }, - { 6803, -3646, -2226, -903 }, - { 8163, -2811, -477, -2235 }, - { 9356, -3818, -1685, -684 }, - { 8466, -2854, -302, -698 }, - { 8458, -3224, 517, 279 }, - { 8074, -2619, -1326, 2596 }, - { 8779, -2761, -2527, -441 }, - { 6533, -2887, -899, -696 }, - { 7394, -2305, -1642, -120 }, - { 8281, -3780, -22, 1305 }, - { 9158, -4413, -779, 901 }, - { 9031, -5240, -1109, 1678 }, - { 8717, -3650, 410, -1075 }, - { 7317, -3197, -818, -2264 }, - { 7934, -2385, -1214, -1886 }, - { 8256, -4441, -291, -587 }, - { 7358, -3395, 1090, -270 }, - { 9446, -4910, -1343, -473 }, - { 8187, -4726, -808, 1166 }, - { 7504, -3845, -47, 267 }, - { 8029, -2146, -1283, -383 }, - { 7461, -2705, -853, 783 }, - { 9367, -3636, -645, -354 }, - { 8955, -3473, -308, -1947 }, - { 8676, -2683, -2099, 1485 }, - { 7481, -3003, -871, -444 }, - { 8015, -2839, -1673, 1175 }, - { 6947, -4643, -1527, -1047 }, - { 7622, -2575, -137, -960 }, - { 9388, -4279, -707, -1322 }, - { 8382, -5259, -1283, -565 }, - { 6856, -4138, -1030, 630 }, - { 8659, -2571, -1124, -1666 }, - { 8763, -3807, -537, 2543 }, - { 8049, -3578, -2186, -604 }, - { 8272, -2351, -1985, -1214 }, - { 6855, -3796, -1527, -1631 }, - { 7178, -2896, -1600, -1756 }, - { 7040, -2888, -89, -1586 }, - { 6261, -3403, -264, 998 }, - { 7756, -4699, -1543, -834 }, - { 7682, -4622, -758, -1721 }, - { 8839, -4232, -2932, 1959 }, - { 9363, -4679, -1956, 39 }, - { 7883, -3616, -1414, -1432 }, - { 8828, -3188, -1356, -1312 }, - { 7746, -3987, -121, -2424 }, - { 9262, -3256, -693, 818 }, - { 7670, -3420, -148, 3504 }, - { 7344, -3183, 608, 1595 }, - { 8976, -4139, -1848, 1304 }, - { 6708, -4131, 33, -852 }, - { 7840, -4429, -2275, 79 }, - { 8980, -3858, -2838, 453 }, - { 7815, -4604, -2563, 944 }, - { 8372, -4422, -1783, 3071 }, - { 8623, -5128, -1754, 2888 }, - { 7462, -3281, 889, 920 }, - { 8416, -59, -1320, -1825 }, - { 7928, -1488, -414, -2499 }, - { 8110, -977, -1047, -2042 }, - { 8278, -687, -1597, -1550 }, - { 7988, -174, -977, -2106 }, - { 8609, -1547, -1628, -1527 }, - { 9000, -1798, -946, -1761 }, - { 8954, -872, -1404, -1594 }, - { 8939, 466, -748, -1212 }, - { 9549, -329, -177, -1360 }, - { 9411, -18, -1126, -1568 }, - { 8859, -782, -488, -1338 }, - { 8955, -218, -43, -1209 }, - { 9131, -69, -453, -1001 }, - { 9069, -1519, -1091, -1199 }, - { 9247, -1309, -566, -1146 }, - { 8528, -1617, -287, -1313 }, - { 7763, -745, -149, -2040 }, - { 8294, -343, 257, -2633 }, - { 10149, -893, -552, -1649 }, - { 9398, -915, 218, -2042 }, - { 9703, -1194, -675, -1592 }, - { 9586, -700, -427, -1710 }, - { 8930, 497, -1445, -1218 }, - { 9285, -1323, -163, -1552 }, - { 8431, -1289, -985, -1404 }, - { 8965, -655, 653, -1483 }, - { 9542, -1001, -951, -1128 }, - { 9205, -647, -37, -882 }, - { 8603, -56, 514, -1793 }, - { 9300, -12, -1324, -567 }, - { 8773, 238, -184, -1456 }, - { 9941, -1306, -69, -1792 }, - { 9360, 279, -376, -1919 }, - { 9180, -285, 95, -2170 }, - { 9922, -501, -970, -1570 }, - { 8341, -1493, -856, -2092 }, - { 8780, -981, -850, -1014 }, - { 9721, -548, -1504, -1094 }, - { 9973, -1493, 482, -2105 }, - { 8707, -333, -1027, -1087 }, - { 9098, -469, -315, -1723 }, - { 8879, -1050, -661, -2020 }, - { 8857, 602, -866, -1918 }, - { 8945, -1025, -2154, -1071 }, - { 8484, -1930, -468, -2179 }, - { 9177, -1903, -224, -2112 }, - { 8652, -137, -2097, -1214 }, - { 9063, -973, -1405, -772 }, - { 9328, -456, 662, -2469 }, - { 10101, -697, 127, -2113 }, - { 9685, 811, -2359, -1024 }, - { 8586, -94, -460, -1982 }, - { 7924, -141, -509, -2513 }, - { 7773, -669, -107, -2835 }, - { 8636, -1064, -46, -2409 }, - { 9748, 596, -1815, -1349 }, - { 8924, 304, 547, -2614 }, - { 9442, 746, -1153, -1679 }, - { 9454, -278, -529, -1976 }, - { 8488, 561, -32, -2160 }, - { 10083, -63, -1544, -1364 }, - { 9390, -1278, 568, -1131 }, - { 9740, -49, -2253, -910 }, - { 3636, -2391, -1115, -3614 }, - { 6014, -3204, -1902, -1808 }, - { 5787, -3497, -1116, -2590 }, - { 4365, -3046, -1632, -2668 }, - { 4733, -2192, -2029, -2468 }, - { 5412, -2753, -1633, -2464 }, - { 4455, -3375, -767, -3399 }, - { 4456, -1644, -983, -2841 }, - { 4039, -2523, 38, -3967 }, - { 3406, -2662, 72, -4757 }, - { 4279, -2005, 1055, -4399 }, - { 4321, -1377, -860, -3786 }, - { 3743, -5739, -651, -3047 }, - { 3528, -5510, 361, -4060 }, - { 6496, -4886, -136, -2689 }, - { 4513, -5254, 551, -4010 }, - { 6557, -3413, -92, -3063 }, - { 4186, -2059, 187, 47 }, - { 6210, -4117, -1256, -1985 }, - { 6038, -4343, 351, -2124 }, - { 4305, -4780, -2077, -1897 }, - { 4480, -3815, -2228, -1533 }, - { 5582, -3689, 1221, -3429 }, - { 5532, -4874, 1195, -2765 }, - { 6518, -2853, -905, -2568 }, - { 5467, -2192, 470, -4115 }, - { 4139, -1577, 240, -3493 }, - { 5281, -1926, -729, -3340 }, - { 5214, -2870, 1359, -4289 }, - { 3046, -3510, -1536, -3214 }, - { 5433, -2881, -1230, -1184 }, - { 4861, -3932, -1071, -2791 }, - { 5693, -4234, -1906, -1502 }, - { 4004, -3935, -1804, -2383 }, - { 3728, -3792, 681, -4773 }, - { 3621, -3030, -1951, -2598 }, - { 5133, -3903, 44, -3700 }, - { 3561, -3451, 1183, -5301 }, - { 5026, -2762, -2341, -1780 }, - { 5841, -2492, -467, -3210 }, - { 5591, -1791, 497, -2472 }, - { 5054, -3898, -1822, -2097 }, - { 5813, -2792, 83, -1469 }, - { 4432, -4497, 1670, -5193 }, - { 5338, -4653, -1109, -2200 }, - { 3239, -4401, -648, -3655 }, - { 2147, -3598, -1200, -4242 }, - { 4417, -2271, -1552, -3210 }, - { 6494, -4360, 852, -3565 }, - { 2393, -6358, -856, -4524 }, - { 4959, -4196, -847, -1403 }, - { 4924, -5438, -226, -3026 }, - { 4254, -5303, -1306, -2424 }, - { 4121, -3126, -2334, -1981 }, - { 3437, -4443, -1464, -2953 }, - { 3203, -3459, -529, -4339 }, - { 5896, -5945, 543, -3246 }, - { 1987, -4733, -220, -4863 }, - { 4358, -4431, -514, -3081 }, - { 4583, -2416, -492, -2287 }, - { 2943, -5035, 419, -4927 }, - { 5358, -5129, 987, -4309 }, - { 4460, -3392, 1752, -5634 }, - { 3415, -4633, 1507, -5945 }, - { 811, -4692, -445, 2333 }, - { 1009, -5613, -1857, 1360 }, - { 1338, -2712, -2720, 3036 }, - { 1002, -3754, -2582, 2344 }, - { 750, -4608, -2334, 714 }, - { 2043, -3207, -2822, 2173 }, - { -140, -4654, -2953, 357 }, - { -54, -4026, -2376, 2695 }, - { 1858, -5022, -717, 2287 }, - { 2064, -3894, -722, 3255 }, - { 2727, -4558, -332, 2603 }, - { 1810, -5378, 283, 1826 }, - { 3935, -4326, 762, 3383 }, - { -767, -4697, -2510, 1922 }, - { 2146, -4312, -3090, 1641 }, - { 54, -5881, -2114, 921 }, - { 1992, -5766, -640, 1574 }, - { 1200, -5371, -1114, 1828 }, - { 2973, -5337, 34, 2266 }, - { 1531, -5018, -2817, 1192 }, - { 3078, -4570, 117, 1990 }, - { 924, -4286, -1388, 2713 }, - { 142, -5058, -2848, 1487 }, - { -106, -6180, -881, 842 }, - { 673, -5433, -229, 1596 }, - { 783, -5710, -2784, 562 }, - { 1935, -5729, -2009, 856 }, - { -410, -3375, -3326, 2734 }, - { 234, -3000, -2628, 3260 }, - { 733, -3405, -3806, 1589 }, - { 771, -4285, -3544, 1314 }, - { 1192, -3563, -3960, 2178 }, - { 206, -5555, -1250, 1546 }, - { -130, -3815, -1210, 3041 }, - { 646, -3940, -393, 2992 }, - { -184, -4931, -1767, 1925 }, - { 2746, -5120, -2275, 1464 }, - { 2440, -3731, -3352, 2729 }, - { -490, -4942, -3779, 997 }, - { 68, -2636, -4167, 3778 }, - { 48, -3986, -4118, 2106 }, - { -978, -5486, -1336, 1390 }, - { 1126, -5297, -855, 640 }, - { -472, -3975, -3622, 1557 }, - { 2456, -5344, -1523, 1648 }, - { -774, -5652, -2417, 1147 }, - { 995, -6122, -812, 1132 }, - { 3282, -4571, -1763, 2175 }, - { 3655, -3862, -676, 3568 }, - { 3038, -3647, -1672, 3381 }, - { 2595, -2964, -2772, 3263 }, - { 4176, -3353, -1148, 4354 }, - { 1603, -3442, -1500, 3444 }, - { 828, -6226, -1783, 678 }, - { 1421, -3333, -3080, 3403 }, - { 1121, -4727, -1924, 1984 }, - { -186, -5083, -682, 1796 }, - { 819, -2778, -3488, 530 }, - { 421, -2873, -3832, 2596 }, - { 2164, -4263, -1605, 2282 }, - { 585, -4437, -682, -491 }, - { -644, -4452, -1157, 2325 }, - { 1991, -4299, 210, 2834 }, - { 2135, -3632, -2113, 665 }, - { -7482, -2724, -2662, -1380 }, - { -6983, -2166, -3756, -3509 }, - { -7085, -1439, -2397, -3112 }, - { -7760, -3049, -3319, -2822 }, - { -8413, -2760, -4406, -3298 }, - { -5995, -3943, -1260, -3750 }, - { -7879, -1554, -3464, -2606 }, - { -6314, -2034, -3878, -1681 }, - { -8849, -2084, -1399, -1231 }, - { -7153, -2602, -1384, -817 }, - { -8041, -2571, -407, -2785 }, - { -7246, -2233, -1578, 260 }, - { -7336, -3883, -4061, -1342 }, - { -7619, -3908, -2342, 382 }, - { -8684, -3724, -1662, -727 }, - { -7850, -2922, -1770, -3449 }, - { -6766, -2034, -1293, -1988 }, - { -6895, -2116, -968, -3744 }, - { -7136, -5147, -2618, -2809 }, - { -8224, -3724, -2519, -1589 }, - { -6711, -2750, -3021, -219 }, - { -8059, -1638, -1102, -3175 }, - { -8710, -4839, -3963, -3143 }, - { -9363, -4965, -3257, -1002 }, - { -6099, -1751, -3157, -395 }, - { -6453, -3216, -4597, -483 }, - { -7879, -5477, -839, -2638 }, - { -7202, -4038, -526, -2856 }, - { -8022, -1228, -1910, -1646 }, - { -9117, -1393, -1582, -2535 }, - { -9095, -2693, -636, -2605 }, - { -9076, -2580, -3481, -2519 }, - { -8327, -4859, -2422, 83 }, - { -8368, -2129, -2324, -2173 }, - { -8554, -4563, -3842, -2007 }, - { -10462, -4261, -1934, -2084 }, - { -9717, -3187, -2294, -1896 }, - { -9625, -3889, -3020, -3224 }, - { -9857, -4955, -4239, -2184 }, - { -9752, -2351, -2277, -3129 }, - { -7219, -1302, -2639, -1603 }, - { -7477, -4360, -3718, -559 }, - { -5680, -2033, -2326, -3078 }, - { -10190, -5548, -4643, -3601 }, - { -9431, -4121, -879, -2479 }, - { -8365, -5450, -2020, -1439 }, - { -6289, -5178, -1605, -3845 }, - { -8319, -3866, -687, -2792 }, - { -8131, -1031, -3608, -3947 }, - { -10510, -2560, -1199, -2082 }, - { -11015, -3640, -2748, -3041 }, - { -8762, -5022, -5231, -1162 }, - { -10153, -2715, -4648, -4859 }, - { -7930, -5205, -1900, -3600 }, - { -9561, -3548, -4812, -3722 }, - { -7663, -4709, -1180, -1475 }, - { -9073, -5707, -1815, -2980 }, - { -8602, -2363, -2675, -3770 }, - { -9967, -5614, -3575, -3838 }, - { -8324, -1005, -2131, -3254 }, - { -10331, -5737, -2550, -2940 }, - { -8234, -3354, -3361, -4479 }, - { -8140, -1951, -4526, -4545 }, - { -6679, -2662, -2284, -4182 }, - { -1122, -1514, -6427, -212 }, - { 54, -1660, -5424, -1404 }, - { 254, -2778, -5222, 846 }, - { -267, -1661, -6577, 814 }, - { -305, -2021, -5759, 1484 }, - { -1791, -2446, -6867, -86 }, - { -2929, -3158, -6603, -1799 }, - { -1391, -3189, -5557, -1053 }, - { -1602, -884, -6767, -1213 }, - { -361, -318, -6219, -44 }, - { -4078, -2635, -5523, -433 }, - { -956, 478, -4382, 1470 }, - { -3300, -2462, -6021, -2721 }, - { 708, -2434, -5085, -540 }, - { -2435, -3607, -5647, -2110 }, - { -491, -1134, -4681, -2886 }, - { 87, -3435, -4641, -1194 }, - { -586, -2927, -4784, 366 }, - { -1394, -2326, -6021, 350 }, - { 97, -2519, -4678, -2120 }, - { -1547, -1907, -5069, -2993 }, - { 268, -3724, -4719, 127 }, - { -827, -1190, -5912, 1144 }, - { -3959, -2322, -6898, -1974 }, - { -2728, -2228, -6426, -562 }, - { -456, -666, -5785, -1609 }, - { 531, -1096, -5731, -656 }, - { -3569, -688, -3915, 110 }, - { -4752, -1725, -4393, -377 }, - { -3210, -3315, -6960, -840 }, - { -688, -3416, -4971, 1221 }, - { -1833, 77, -6491, -2434 }, - { -239, -255, -6850, -886 }, - { -2112, -1490, -6291, -2689 }, - { -1544, -4579, -5198, -1261 }, - { -2771, -4014, -5520, 683 }, - { -1635, -2829, -5512, 1214 }, - { -958, -2582, -4823, 2360 }, - { -2077, -4566, -4642, 365 }, - { -3112, -4214, -5960, -823 }, - { -2467, -2510, -4858, 1467 }, - { -1561, -3399, -5822, 211 }, - { -775, -1081, -4424, 2636 }, - { -1263, 25, -6378, -1392 }, - { -3476, -366, -5417, -1393 }, - { -3176, -1476, -4149, 1466 }, - { -2479, 518, -4448, -257 }, - { -2992, 158, -4660, -1279 }, - { -1320, -3872, -4479, 1147 }, - { -1475, -312, -5318, 539 }, - { -3527, -1679, -5860, -1681 }, - { -3397, -3438, -5593, 1866 }, - { -4089, -2439, -4763, 1275 }, - { -748, -4513, -4687, -48 }, - { -2166, -4531, -4691, -2856 }, - { -2385, -853, -6035, -627 }, - { -1194, -4091, -4472, -1963 }, - { -682, -3234, -4084, -3033 }, - { -3255, -5015, -5328, -12 }, - { -2313, -3436, -4601, -155 }, - { -2792, -1038, -6947, -2019 }, - { -1244, -1526, -5771, -1882 }, - { -4679, -3731, -5506, 283 }, - { -3062, -66, -3558, -758 }, - { -4895, -1187, 4751, 3728 }, - { -7600, -2752, 3320, 4613 }, - { -5703, -2975, 3944, 2659 }, - { -4972, -1257, -246, 2952 }, - { -4221, -2487, 1702, 4295 }, - { -2900, -1529, 2458, 4935 }, - { -5061, 407, 2416, 4050 }, - { -6931, -3478, 2761, 2213 }, - { -6037, -3921, 3192, 1866 }, - { -6113, -811, 2407, 3782 }, - { -5878, -1716, 1207, 3478 }, - { -5953, -2853, 2207, 2712 }, - { -6807, -3223, 2749, 3595 }, - { -3272, -3157, 1389, 3788 }, - { -5368, -1904, 1980, 5077 }, - { -7235, -1398, 3075, 4548 }, - { -4765, -3487, 2755, 2796 }, - { -7658, -4435, 2694, 2582 }, - { -6997, -4282, 456, 3832 }, - { -5563, -3115, -63, 3713 }, - { -4244, -4220, 1450, 2767 }, - { -3801, -2194, 190, 4303 }, - { -5458, -4119, 1958, 2274 }, - { -7300, -3469, 3514, 3193 }, - { -4594, -2067, 775, 4752 }, - { -3389, -1654, 1464, 5412 }, - { -4845, -3483, 964, 3437 }, - { -6007, -2818, 1666, 4659 }, - { -8709, -5007, 1757, 3287 }, - { -5833, -4389, 1025, 3171 }, - { -5788, -1780, 3944, 3661 }, - { -4430, -920, 1938, 4753 }, - { -7066, -1857, 4591, 4538 }, - { -3549, -513, 1427, 5317 }, - { -7517, -1220, 2883, 3049 }, - { -7605, -2687, 1874, 2735 }, - { -8718, -4035, 2676, 3730 }, - { -7990, -3907, 1185, 2607 }, - { -6058, -1744, 3349, 5157 }, - { -5954, 565, 3161, 3250 }, - { -6478, -612, 1930, 2271 }, - { -6535, -1445, -2, 1618 }, - { -8963, -4151, 1192, 4044 }, - { -7227, -3570, 1600, 4234 }, - { -4674, 79, 595, 3015 }, - { -3974, 430, 2727, 5137 }, - { -5299, 9, 3714, 4779 }, - { -6779, -2699, -8, 2436 }, - { -7016, -1145, 1293, 2310 }, - { -6955, -3312, 1534, 1801 }, - { -4025, 740, 1850, 4054 }, - { -9589, -3460, 4154, 5270 }, - { -4404, -1181, 4298, 5173 }, - { -7356, -4583, -18, 2644 }, - { -6516, -1235, 4439, 6234 }, - { -3453, -301, 4344, 4464 }, - { -4643, 1530, 3315, 4340 }, - { -4575, -2557, 3754, 3682 }, - { -3643, -3501, 2051, 2997 }, - { -5412, -2475, 2301, 1579 }, - { -5846, 259, 1360, 2348 }, - { -5258, -1358, 1050, 838 }, - { -5542, -219, 6377, 5750 }, - { -5713, -2952, 922, 899 }, - { -2049, -1135, 5206, 1033 }, - { -1693, -1886, 4835, -106 }, - { -2344, -3504, 4232, -13 }, - { -2475, -2334, 5043, 1126 }, - { -787, -2549, 3880, 2138 }, - { -3159, -2341, 4830, 2887 }, - { -1780, -1009, 6240, 2061 }, - { -4327, -3363, 2818, 886 }, - { -3376, -2743, 4104, 207 }, - { -3250, -4640, 2718, 1498 }, - { -382, -1075, 4382, 3460 }, - { -2416, -4168, 3530, 816 }, - { -1756, -2708, 4861, 622 }, - { -1879, -2097, 5156, 2889 }, - { -2496, -2418, 3722, 2671 }, - { -2717, -3252, 3341, 1944 }, - { -4063, -4091, 3306, 267 }, - { -3549, -3808, 3747, 842 }, - { -2635, 546, 5794, 1894 }, - { -1857, -1121, 4383, 3964 }, - { -2226, -2166, 3489, 3678 }, - { -3492, -660, 5323, 1063 }, - { -3033, -3130, 4382, 1828 }, - { -2703, -625, 6369, 2851 }, - { -1656, -2842, 4584, -528 }, - { -4781, -2622, 4390, 2097 }, - { -413, -2045, 5081, 3035 }, - { -3810, -2662, 4532, 1095 }, - { -3144, -1858, 5215, 1880 }, - { -3562, -1795, 4928, 670 }, - { -4800, -1509, 5189, 1859 }, - { -1085, -3832, 4169, 900 }, - { -1969, -3270, 2857, 2878 }, - { -4267, -4140, 3176, 1805 }, - { -5145, -3727, 3524, 1168 }, - { -1346, -1876, 5501, 1748 }, - { -4998, -2945, 3699, 338 }, - { -3458, -3096, 3406, -635 }, - { -1751, -3209, 3508, 395 }, - { -2507, 170, 5987, 705 }, - { -3756, -1072, 5647, 3536 }, - { -2870, -1439, 5026, 3212 }, - { -3913, -3225, 3669, 2144 }, - { -3739, 226, 5747, 764 }, - { -2052, -820, 5266, 3093 }, - { -3214, -3820, 2409, 2391 }, - { -4398, -2588, 3501, -218 }, - { -4484, -1763, 4180, -198 }, - { -3368, -1525, 4362, -134 }, - { -2407, 224, 4905, 3533 }, - { -1369, -2937, 4728, 1788 }, - { -4848, -1707, 4159, 851 }, - { -3454, -1749, 4281, 3230 }, - { -1990, -3853, 3487, 1735 }, - { -3117, 92, 6155, 4075 }, - { -2676, -2472, 4078, -589 }, - { -1547, -2012, 2626, 1835 }, - { -4275, -588, 4824, 725 }, - { -601, -2249, 3736, 3548 }, - { -4060, -61, 5333, 3097 }, - { -4303, 7, 6551, 3054 }, - { -5003, -1029, 5786, 3319 }, - { -2810, -728, 5392, 199 }, - { -1232, -200, 5228, 3121 }, - { 2621, 165, -6255, 298 }, - { 3669, 537, -6844, 1564 }, - { 1598, -1190, -6235, 2523 }, - { 2164, -32, -6894, 1383 }, - { 853, -1597, -6069, 1449 }, - { 1377, -1661, -5266, 108 }, - { 2660, 48, -5172, -517 }, - { 1903, -391, -5677, 1010 }, - { 3792, 206, -5274, -11 }, - { 1239, 2776, -2929, 2721 }, - { 4071, 149, -7259, 3125 }, - { 1436, -480, -6156, -196 }, - { 1373, -1960, -5005, 3122 }, - { 3413, -1271, -5176, 3283 }, - { 3060, -68, -6495, 2238 }, - { 2700, -2075, -4681, 91 }, - { 2928, -1728, -5168, 1858 }, - { 4424, 828, -4471, 88 }, - { 2672, -2604, -4038, 2753 }, - { 5223, -123, -6749, 2295 }, - { 4237, -420, -5538, 1353 }, - { 4744, -1281, -4097, 4708 }, - { 1103, -2764, -4751, 2024 }, - { 3747, -1913, -3911, 3960 }, - { 2470, -1416, -5542, 615 }, - { 4847, -1354, -5334, 1733 }, - { 5336, 88, -7593, 4007 }, - { 2388, -2880, -4807, 1037 }, - { 4495, 1391, -5685, -139 }, - { 5253, 1637, -6450, 1533 }, - { 1199, 795, -5515, 1261 }, - { 1397, -1259, -4252, 3838 }, - { 746, 70, -6640, 604 }, - { 1584, 166, -4972, 3072 }, - { 380, -999, -5397, 2267 }, - { 2974, 1707, -3242, 5360 }, - { 5202, -403, -5453, 2832 }, - { 3718, -1731, -4760, 714 }, - { 4150, -975, -4792, 61 }, - { 2925, -818, -4841, 15 }, - { 5301, 577, -4006, 3259 }, - { 5265, 1986, -5679, 3028 }, - { 3752, 1928, -4509, 3729 }, - { 3278, 1925, -6370, 1247 }, - { 5107, 1721, -4853, 3127 }, - { 3279, 2982, -2515, 4005 }, - { 4622, 668, -6204, 759 }, - { 6034, 317, -5763, 4818 }, - { -558, 57, -3785, 2817 }, - { 4476, 1616, -3965, 4536 }, - { 5953, 2056, -8215, 2715 }, - { 4387, 2613, -7463, 868 }, - { 5834, 1088, -4736, 4924 }, - { 6473, -856, -6991, 4172 }, - { 4959, -293, -5162, 76 }, - { 2731, -843, -6119, 3847 }, - { 3245, 1202, -6833, 616 }, - { 2553, 1383, -3829, 3859 }, - { 4332, 2099, -3480, 3622 }, - { 2110, 2683, -2728, 3990 }, - { 876, 1167, -3290, 3466 }, - { 3991, 1709, -2410, 4077 }, - { 5105, 939, -2584, 3256 }, - { 4719, 688, -1566, 3040 }, - { -3632, 4335, 1266, -3303 }, - { -4956, 3207, 1312, -2806 }, - { -4669, 2627, 2663, -2435 }, - { -4282, 3708, 2303, -3038 }, - { -4536, 2297, -175, -3350 }, - { -5234, 2503, -139, -880 }, - { -3978, 1512, 1092, -3619 }, - { -4519, 4649, 1363, -2455 }, - { -5118, 3132, 1961, -1577 }, - { -5196, 3379, -182, -1378 }, - { -6420, 4486, 2397, -1993 }, - { -5030, 5046, 1292, -1118 }, - { -4559, 2573, -927, -1406 }, - { -3501, 3730, 691, -4930 }, - { -4364, 2758, 1007, -3909 }, - { -4026, 2839, -1559, -2340 }, - { -5037, 4053, 836, -1571 }, - { -4727, 5136, 1110, -3588 }, - { -5245, 2799, -999, -2164 }, - { -4954, 1501, 422, -3963 }, - { -5994, 2726, 1462, -2833 }, - { -5621, 5159, 2038, -2512 }, - { -4991, 2291, 1917, -3151 }, - { -5469, 4382, -148, -2978 }, - { -5858, 1983, 807, -2720 }, - { -4709, 3556, 952, -467 }, - { -2489, 2362, 1714, -4230 }, - { -4717, 5004, -1180, -3672 }, - { -5914, 3653, 1359, -1317 }, - { -5506, 2995, 780, -1059 }, - { -5287, 3945, 2480, -2293 }, - { -3849, 4358, 322, -1770 }, - { -3911, 3570, 252, -3185 }, - { -3660, 5128, 158, -3719 }, - { -4599, 3277, -503, -2727 }, - { -3673, 3760, -1252, -3339 }, - { -5161, 2337, 388, -1943 }, - { -3529, 2216, 2156, -3080 }, - { -4309, 4331, 1808, -1460 }, - { -4782, 3820, 480, -2504 }, - { -4166, 3544, -378, -1567 }, - { -5572, 2466, -418, -2909 }, - { -6096, 2930, 119, -1878 }, - { -5963, 3554, 1011, -2233 }, - { -6433, 4335, 935, -2930 }, - { -5004, 3314, -1352, -3430 }, - { -6042, 3463, -1008, -3940 }, - { -4671, 2214, -640, -5040 }, - { -2795, 3759, 1412, -3803 }, - { -3647, 4436, 729, -515 }, - { -3594, 1033, 56, -4148 }, - { -2908, 3027, 2889, -3485 }, - { -3338, 2234, 313, -4285 }, - { -3825, 4497, -561, -2634 }, - { -6167, 3012, -48, -3149 }, - { -4828, 3515, -969, -4475 }, - { -5789, 2757, -539, -4173 }, - { -2452, 3067, 564, -4249 }, - { -4921, 1358, 1331, -2889 }, - { -3127, 4239, -1045, -1523 }, - { -4780, 2326, -1118, -3446 }, - { -3908, 5546, 152, -2622 }, - { -6972, 2976, 337, -2809 }, - { -4839, 4613, -35, -4077 }, - { -1408, 4822, -1149, -4997 }, - { -981, 4979, -912, -6304 }, - { -2098, 5689, -888, -2878 }, - { -3343, 4814, -657, -4434 }, - { -2461, 3601, -967, -4869 }, - { -2652, 3944, 87, -5520 }, - { -1104, 6076, 174, -6407 }, - { 355, 5370, -1721, -5869 }, - { 1242, 4497, -1107, -5091 }, - { -89, 4002, -1491, -5182 }, - { 1059, 5693, -1591, -4905 }, - { 1323, 4682, -2078, -4768 }, - { 818, 3996, -549, -5468 }, - { -287, 4529, 929, -5543 }, - { -919, 5519, -2791, -2844 }, - { -1407, 5679, -3289, -3974 }, - { -189, 6530, -3547, -4002 }, - { -900, 7039, -3371, -4855 }, - { -2983, 7211, -363, -4835 }, - { -814, 6503, -104, -5106 }, - { -2386, 6896, 809, -4919 }, - { 845, 4492, 352, -6621 }, - { -1998, 7237, -1646, -4231 }, - { -3380, 6251, 471, -4577 }, - { -1908, 7059, 84, -5726 }, - { -340, 6346, -803, -6265 }, - { -2279, 5834, -47, -4633 }, - { -1532, 5286, -1748, -1901 }, - { -2757, 6188, -453, -3415 }, - { -1255, 6405, -2043, -6357 }, - { 918, 5581, -121, -5667 }, - { 1840, 5336, -821, -5034 }, - { -2475, 4992, -1825, -3104 }, - { -2413, 5606, -1789, -4298 }, - { 132, 5128, -2389, -4442 }, - { 223, 6400, -2653, -4742 }, - { -673, 5012, 680, -4582 }, - { -1657, 6624, -349, -3596 }, - { -755, 6289, -1860, -3978 }, - { -572, 6894, -1946, -5207 }, - { -1141, 4756, -2665, -5586 }, - { -1073, 4269, -431, -4030 }, - { 186, 5761, 916, -5868 }, - { -1907, 4836, 1017, -5106 }, - { -963, 3363, -1248, -6348 }, - { -3262, 4774, -1818, -5858 }, - { 847, 3812, -2538, -4302 }, - { -1223, 5903, 1360, -5479 }, - { -1094, 6923, -1244, -2381 }, - { 267, 6276, -709, -2846 }, - { -157, 5840, 1124, -4266 }, - { 889, 3206, -910, -5305 }, - { -1736, 3344, 582, -4838 }, - { -2357, 5676, -2695, -6277 }, - { -1916, 6901, -986, -5397 }, - { -3062, 6028, -695, -5687 }, - { 1836, 3566, -1357, -5226 }, - { -2176, 4938, 646, -3872 }, - { -2199, 3055, -208, -6124 }, - { -236, 3032, -821, -5325 }, - { -3989, 7277, -565, -3899 }, - { -595, 4362, 74, -5975 }, - { 684, 5874, -841, -4424 }, - { -2731, 6305, -2389, -5465 }, - { -5775, 1325, -56, -2528 }, - { -7029, -534, -1890, -3278 }, - { -5798, -15, -2734, -2210 }, - { -5504, -1198, -353, -3659 }, - { -5079, 960, -894, -4336 }, - { -6073, -36, -133, -3014 }, - { -5782, -259, -1025, -3986 }, - { -6843, 1262, -807, -1639 }, - { -5263, -918, -3290, -579 }, - { -4840, 461, -2158, -533 }, - { -6014, -50, -620, 504 }, - { -5843, 241, -1359, -282 }, - { -5898, 577, 769, -3271 }, - { -6833, -946, -466, -3347 }, - { -6026, 1459, -512, -729 }, - { -7361, 747, -388, -1110 }, - { -6391, 2142, -1160, -2513 }, - { -6995, 304, 498, -2673 }, - { -6757, 679, -386, -433 }, - { -5222, 1688, -1093, -1032 }, - { -5019, 575, 184, -3627 }, - { -4237, 628, -3507, -1243 }, - { -7479, -456, -1722, -1486 }, - { -6464, 713, -1273, -1153 }, - { -6255, 1682, -606, -3607 }, - { -7033, 1497, -71, -1955 }, - { -6694, 1556, -1721, -3214 }, - { -6114, -356, 813, -2575 }, - { -5308, 632, -1851, -1636 }, - { -5742, -911, -1733, 383 }, - { -6083, -387, -2313, -879 }, - { -6535, -530, -1505, -2083 }, - { -4896, 1223, -2750, -1816 }, - { -6392, -463, -3247, -2093 }, - { -5373, 1264, -2706, -3042 }, - { -3894, -1390, -1020, -891 }, - { -6179, 1168, -1966, -1922 }, - { -5162, 1668, -1617, -1916 }, - { -6453, 920, -1169, -2432 }, - { -6130, 2005, -536, -1519 }, - { -6552, -98, -518, -1938 }, - { -7528, 355, -1101, -1772 }, - { -5745, 610, -247, -1360 }, - { -7003, 177, -2064, -1958 }, - { -6956, -570, -2220, -4225 }, - { -7830, 791, -1394, -2774 }, - { -7634, 480, -3171, -4224 }, - { -7913, 1154, -350, -2381 }, - { -5063, 1704, -1804, -2977 }, - { -4887, -524, -2703, 188 }, - { -5551, 406, -1620, -3063 }, - { -7109, 1342, 381, -3021 }, - { -6846, 631, -458, -3398 }, - { -4606, -605, 11, -3930 }, - { -8134, -225, -1738, -2648 }, - { -7043, 402, -2734, -3059 }, - { -7417, 1825, -2545, -4389 }, - { -6971, -236, -1031, -665 }, - { -5752, 2111, -1632, -3808 }, - { -7660, -78, -624, -3135 }, - { -6358, 619, -1951, -3911 }, - { -8134, 408, -1935, -3695 }, - { -6335, 1911, -2368, -4505 }, - { -7116, 2163, -344, -2753 }, - { 2357, 4488, 2220, -5682 }, - { 1385, 3206, 2300, -5305 }, - { 1419, 2557, 5203, -3516 }, - { 262, 4315, 3920, -1847 }, - { 3316, 3187, 1612, -5609 }, - { 1729, 2350, 1673, -6068 }, - { 1603, 6126, 1467, -2839 }, - { -1339, 3316, 3691, -3530 }, - { -563, 4618, 3180, -4548 }, - { 463, 4624, 3111, -5614 }, - { 1246, 5455, 3356, -5720 }, - { 480, 2149, 5422, -2893 }, - { 1768, 4827, 913, -5579 }, - { -149, 5381, 4366, -3297 }, - { 985, 3672, 2644, -92 }, - { -258, 2911, 5817, -2213 }, - { 3428, 3289, 3351, -3541 }, - { -666, 3295, 4727, -2869 }, - { 35, 6641, 4160, -4052 }, - { 623, 6787, 3156, -4560 }, - { 2654, 4360, 4676, -4632 }, - { 1386, 5246, 4834, -4497 }, - { 3488, 4574, 3856, -5946 }, - { 383, 4481, 4168, -4110 }, - { 1753, 3652, 4288, -3326 }, - { 1344, 4905, 2508, -4660 }, - { 1580, 4106, 3104, -2224 }, - { 2027, 5038, 1683, -1554 }, - { 446, 3699, 5872, -3013 }, - { 4637, 4087, 3578, -5018 }, - { 2629, 3560, 5331, -4900 }, - { 1527, 6674, 2523, -4131 }, - { -1437, 2804, 2528, -4464 }, - { -229, 3355, 2016, -5537 }, - { 3666, 3418, 4374, -4581 }, - { 1192, 3799, 923, -6596 }, - { 2040, 2956, 448, -5322 }, - { 2468, 5768, 4029, -5869 }, - { 3438, 6516, 3529, -6667 }, - { 2737, 5495, 680, -5535 }, - { 3896, 5727, 1801, -4958 }, - { 4988, 4957, 3592, -6518 }, - { -542, 4416, 5794, -2787 }, - { 4136, 4354, 2064, -4696 }, - { 3067, 5936, 1207, -3396 }, - { 2789, 4966, 2405, -3854 }, - { 1731, 3270, 3251, -1063 }, - { 1767, 5537, 2084, -2349 }, - { 465, 3116, 4532, -837 }, - { 1499, 2627, 4610, -2212 }, - { 122, 3095, 3642, -3552 }, - { 2542, 2866, 2705, -6402 }, - { 3134, 4323, 698, -4785 }, - { 731, 1859, 3112, -5242 }, - { 2553, 2980, 3241, -4846 }, - { 1329, 5310, 1607, -6624 }, - { 2468, 1858, 3476, -1034 }, - { -172, 4996, 2000, -5562 }, - { 2621, 4220, 1574, -3386 }, - { -333, 1832, 3362, -4117 }, - { 2169, 6762, 3065, -6225 }, - { 2844, 5528, 3223, -4765 }, - { 526, 5175, 1644, -4267 }, - { 2922, 4426, 2414, -2610 }, - { 452, 1399, -4516, -2636 }, - { 2872, 1720, -4667, -1435 }, - { 1279, 702, -5424, -1984 }, - { 2187, 870, -5021, -1341 }, - { 583, -144, -4628, -2464 }, - { 3, 2237, -5284, -2827 }, - { -19, 1005, -5460, -1819 }, - { 2897, 2084, -5885, -515 }, - { -400, 3370, -5527, -2947 }, - { 1505, 2593, -5518, -1802 }, - { 1341, 4534, -5094, -1899 }, - { 3241, 3670, -5493, -1252 }, - { -1287, 921, -5994, -1675 }, - { 627, 408, -6652, -364 }, - { -260, 1127, -4849, -3247 }, - { 371, 3400, -5976, -2285 }, - { 1533, 1566, -6373, -610 }, - { 2462, 4274, -6184, -1254 }, - { 1782, 3363, -6222, -1381 }, - { 572, 4650, -5673, -2754 }, - { 2674, 3414, -4460, -2154 }, - { 3614, 3820, -6883, -398 }, - { 1136, -1, -5511, -1112 }, - { -1773, 1137, -5647, -2377 }, - { -753, 2104, -6085, -2565 }, - { -204, 3025, -4731, -1418 }, - { -1486, 1438, -4380, -216 }, - { 302, 858, -5786, -264 }, - { 3486, 1495, -5234, -783 }, - { 888, 2327, -3423, -3720 }, - { -259, 772, -6596, -1311 }, - { -1197, 2073, -5174, -1826 }, - { 1500, 3470, -4462, -2645 }, - { 3072, 1960, -3277, -2264 }, - { 1841, 952, -4324, -2340 }, - { 1994, 2200, -3940, -2923 }, - { -1782, 1699, -4667, -1075 }, - { -1464, 2906, -3468, -375 }, - { 366, 2380, -3747, 1467 }, - { -545, 1645, -4619, 376 }, - { 1724, 2350, -2374, -3512 }, - { 3184, 2628, -2996, -3275 }, - { 734, 2010, -6239, -1479 }, - { 524, 3756, -4496, -3263 }, - { 1492, 3570, -3494, -3600 }, - { -932, 618, -5389, -2894 }, - { -133, 2161, -4083, -3267 }, - { 786, 774, -3279, -3731 }, - { 1078, 803, -3843, -3007 }, - { -332, 3405, -3347, 40 }, - { -17, 6, -4005, -3690 }, - { -189, 4372, -4488, -2561 }, - { -450, 3846, -3790, -1370 }, - { 362, 2212, -5272, -15 }, - { -1529, 791, -6802, -2296 }, - { 2145, 4241, -4474, 376 }, - { 1813, 2426, -2932, -2726 }, - { -542, 4557, -3140, -1080 }, - { 1192, 3784, -4371, -20 }, - { 2784, 5188, -6399, -1394 }, - { 431, 4561, -3673, -1398 }, - { 1382, 3096, -4083, 1253 }, - { 1209, 4224, -2930, 1500 }, - { 2798, 2684, -6676, -606 }, - { -2396, 1510, -5381, -2713 }, - { -2625, 2542, -4032, -2880 }, - { -1231, 3967, -4098, -2886 }, - { -1393, 2374, -3862, -4525 }, - { -2495, 1665, -1637, -5445 }, - { -3854, 1759, -1750, -4944 }, - { -2373, 1668, -2856, -6251 }, - { -2668, 1981, -886, -4557 }, - { -2927, 4427, -3451, -6172 }, - { -1925, 2596, -4696, -2527 }, - { -3202, 2847, -3928, -5896 }, - { -3332, 1665, -5025, -3412 }, - { -3212, 3115, -4155, -4062 }, - { -1013, 3205, -5133, -3751 }, - { -2022, 4595, -3947, -5611 }, - { -3556, 1755, -3715, -2300 }, - { -1784, 4114, -2723, -1773 }, - { -3586, 4081, -2733, -4942 }, - { -1608, 3685, -4154, -4573 }, - { -3368, 4042, -4452, -6227 }, - { -1407, 3881, -5729, -3719 }, - { -2751, 3281, -5077, -4999 }, - { -3791, 2410, -4906, -5288 }, - { -730, 2303, -4217, -3755 }, - { -1812, 2311, -5492, -3709 }, - { -610, 4336, -3915, -3783 }, - { -2841, 4337, -4278, -4430 }, - { -1662, 4666, -4661, -3964 }, - { -589, 5209, -4923, -3682 }, - { -4155, 2234, -4076, -4218 }, - { -3951, 2770, -2665, -2805 }, - { -2302, 3228, -3717, -1908 }, - { -3129, 4373, -2264, -2851 }, - { -447, 1363, -3578, -4323 }, - { -2648, 4237, -3159, -3071 }, - { -4072, 3241, -3541, -4605 }, - { -4507, 3458, -2339, -3838 }, - { -1646, 997, -4926, -3970 }, - { -3025, 1614, -3940, -1242 }, - { -1337, 1756, -3163, -5529 }, - { -3203, 1865, -3282, -4354 }, - { -1646, 2118, -2203, -6018 }, - { 174, 1871, -2707, -4639 }, - { -2607, 1485, -4778, -4750 }, - { -2199, 3991, -3134, -4879 }, - { -2962, 3323, -2816, -2419 }, - { -5286, 2495, -4548, -5395 }, - { -2810, 3710, -2274, -4211 }, - { -330, 3006, -2993, -4678 }, - { -1187, 2411, -2743, -5196 }, - { -664, 4033, -3101, -5641 }, - { -1458, 3602, -2816, -5371 }, - { -4116, 4923, -3321, -5630 }, - { -4165, 2528, -2592, -4798 }, - { -2759, 3080, -2333, -5719 }, - { -5157, 3011, -5526, -6348 }, - { -3095, 2126, -5881, -4234 }, - { -4377, 3849, -3600, -6099 }, - { -1994, 4947, -5235, -4753 }, - { -1067, 600, -3258, -5133 }, - { -4992, 3302, -2208, -5051 }, - { -3377, 2981, -1655, -4815 }, - { -3325, 2446, -1787, -6116 }, - { -2341, 2737, -3240, -6347 }, - { -2258, -3732, 3710, -1235 }, - { -1558, -3849, 2694, -3012 }, - { -599, -4837, 3050, -2951 }, - { -2246, -5433, 2798, -1910 }, - { -2255, -4989, 3260, 270 }, - { -3026, -5353, 2693, -1036 }, - { -1151, -6097, 1097, -3782 }, - { -3391, -6012, 2130, -1303 }, - { -2850, -4422, 3375, -480 }, - { -1138, -3779, 1491, -4162 }, - { -551, -3892, 3787, -2082 }, - { -3221, -3676, 3144, -1202 }, - { -3023, -5196, 2650, 605 }, - { -1756, -5729, 2646, 321 }, - { -2693, -4409, 494, -4797 }, - { -1913, -4573, 3372, -1730 }, - { -1277, -3604, 4061, -993 }, - { -420, -4993, 1351, -4796 }, - { -3052, -5333, 1435, -1242 }, - { -602, -5034, 3869, -1141 }, - { -2436, -4680, 1665, -3019 }, - { -2657, -3658, 1459, -3391 }, - { -1220, -6246, 2749, -525 }, - { -3838, -4844, 2265, -1735 }, - { -1247, -5679, 3356, -1417 }, - { -917, -5448, 3342, 105 }, - { -1756, -6839, 2276, -2350 }, - { -412, -5206, 1764, -3539 }, - { -1439, -6915, 1442, -3750 }, - { -1381, -4439, 3863, -282 }, - { -3482, -4953, 2726, -336 }, - { -1376, -5931, 1714, -1987 }, - { -1716, -4405, 2608, 105 }, - { -1590, -5191, 2652, -2704 }, - { -2149, -6442, 2453, -1263 }, - { -3426, -3832, 2334, -1829 }, - { -2747, -5948, 2362, -173 }, - { -2435, -3267, 2966, -1710 }, - { -3979, -4282, 2705, -775 }, - { -356, -4238, 2544, -4343 }, - { -1363, -6471, 2817, -1836 }, - { -2878, -5117, 218, -3149 }, - { -3539, -5196, 1710, -2356 }, - { -2888, -4537, 2746, -1701 }, - { -1870, -4439, 1496, -4121 }, - { -1486, -3388, 3349, -2145 }, - { -3333, -4138, 1467, -2876 }, - { -345, -5340, 1012, -1190 }, - { -1672, -4992, 2289, -1029 }, - { -2146, -5528, 3038, -635 }, - { -316, -3656, 3426, -3152 }, - { -2695, -5812, 2336, -2050 }, - { -2067, -6052, 737, -3258 }, - { -2664, -4205, -350, -1266 }, - { -617, -5406, 80, -4853 }, - { -2418, -3825, 1853, -1326 }, - { -1961, -4339, 583, -4315 }, - { -1495, -5141, -133, -5205 }, - { -3208, -6440, 1691, -2069 }, - { -2632, -3633, 2325, -2761 }, - { -2624, -5670, 1252, -3676 }, - { -3687, -5608, 687, -2833 }, - { -3320, -5707, 16, -3877 }, - { -2738, -6112, 84, -5135 }, - { 2277, -5661, 3076, 843 }, - { 1555, -5769, 2821, -5236 }, - { 536, -6381, 603, -4910 }, - { 734, -4609, 3314, -4092 }, - { 1836, -4547, 3267, -4322 }, - { -13, -5976, 3752, -1607 }, - { 1423, -6318, 2336, 398 }, - { 365, -7779, 1498, -534 }, - { 2104, -8366, 2946, -1345 }, - { 143, -5545, 1898, -3756 }, - { 655, -6852, 1430, 148 }, - { 4, -6653, 2397, -59 }, - { 2346, -5996, 4562, -934 }, - { 1229, -7104, 2963, -598 }, - { -528, -7048, 2887, -1790 }, - { 1451, -6857, 3900, -1637 }, - { 554, -6018, 3336, 9 }, - { 3278, -5758, 4034, 129 }, - { 3541, -7145, 4905, -1575 }, - { 2339, -6907, 3464, -301 }, - { 2775, -7301, 1667, -3894 }, - { 539, -7887, 991, -4156 }, - { 2115, -7421, 3131, -3075 }, - { 2803, -8546, 2564, -5836 }, - { 2869, -5833, 1620, -4561 }, - { 2591, -7281, 3215, -4719 }, - { -1228, -8477, 706, -4782 }, - { 1967, -5243, 4813, -1940 }, - { 701, -7010, 2273, -3893 }, - { 915, -8470, 1918, -5620 }, - { -94, -6715, 156, -3873 }, - { 1074, -5607, 4389, -1017 }, - { 2739, -6551, 1227, -3521 }, - { 725, -7835, 2701, -1291 }, - { -493, -7475, 2263, -1075 }, - { -412, -6508, 2984, -744 }, - { 665, -5451, 3725, -2692 }, - { 1499, -8129, 3564, -2072 }, - { 2870, -6333, 4487, -2108 }, - { 706, -5007, 3911, -152 }, - { -482, -8660, 1483, -2900 }, - { 2481, -6596, 2518, -1715 }, - { 1403, -6414, 1398, -5387 }, - { 652, -6267, 583, -5942 }, - { 694, -7540, 646, -6272 }, - { 2275, -7614, 256, -5015 }, - { 1416, -9727, 1900, -3153 }, - { 2760, -6433, 3875, -3771 }, - { 2325, -11196, 2182, -5155 }, - { 1223, -11061, 1377, -5097 }, - { 108, -10603, 307, -4952 }, - { -118, -8268, 1650, -1572 }, - { 1839, -7943, 1755, -612 }, - { 2501, -9056, 981, -2969 }, - { 2902, -8476, 1491, -5780 }, - { 1995, -11175, 1585, -3643 }, - { 696, -8212, 828, -2474 }, - { 1526, -8649, 1380, -1210 }, - { 461, -7253, 3222, -2229 }, - { 2966, -8641, 4121, -3271 }, - { 833, -6039, 2361, -1086 }, - { 3565, -7312, 1980, -5427 }, - { 2850, -8671, 3760, -1846 }, - { 2643, -7281, 2163, -173 }, - { 3463, -3706, -3132, -923 }, - { 1315, -3825, -3443, 2 }, - { 2594, -4083, -3815, 670 }, - { 1826, -4291, -2741, -155 }, - { 868, -3749, -4175, -298 }, - { 2008, -4237, -3897, -517 }, - { 1242, -3493, -4335, -1335 }, - { -88, -4142, -3390, -1529 }, - { 2176, -3488, -3822, -975 }, - { 1706, -5188, -3415, -637 }, - { 2717, -6159, -2333, -882 }, - { 1276, -3978, -4361, 537 }, - { 2471, -5556, -2866, -208 }, - { 799, -4673, -4086, 56 }, - { 1901, -4786, -3533, 270 }, - { 3036, -3902, -3606, -333 }, - { 2249, -3317, -4319, -144 }, - { 2594, -4207, -2105, -2930 }, - { 4008, -4774, -2626, -902 }, - { 1038, -3659, -3496, -2454 }, - { 2725, -3597, -3298, -1535 }, - { 1662, -5803, -2813, 175 }, - { 705, -3757, -3441, -1484 }, - { 1860, -5987, -2821, -886 }, - { 3786, -4918, -2199, -1929 }, - { 3683, -4235, -2547, -1287 }, - { 2531, -4896, -2956, -1593 }, - { 1005, -5585, -3324, -180 }, - { 1625, -5229, -1756, -3642 }, - { 1494, -5041, -2989, -2685 }, - { 2718, -4655, -3224, -867 }, - { 2374, -6640, -1745, -2975 }, - { 2133, -6436, -2477, -1499 }, - { 1833, -4418, -3523, -1512 }, - { 1128, -4910, -2658, -1106 }, - { 689, -4777, -2831, -2085 }, - { 3593, -5280, -2627, -315 }, - { 3264, -3771, -2673, -1861 }, - { 3202, -5602, -2409, 402 }, - { 552, -4618, -2221, -3002 }, - { 3095, -5356, -2666, -1083 }, - { 3401, -4609, -3146, 45 }, - { 3051, -4662, -2192, -2232 }, - { 2798, -5552, -2462, -1941 }, - { 2354, -5815, -2223, -2619 }, - { 192, -3708, -2807, -2658 }, - { 1886, -4226, -1862, -3529 }, - { 2526, -3976, -2819, -2332 }, - { 1577, -3870, -2711, -2806 }, - { 1288, -5588, -3382, -1403 }, - { 2711, -5399, -1564, -3253 }, - { 1459, -5492, -2222, -322 }, - { 2823, -5091, -2886, 776 }, - { 3559, -5821, -2109, -1360 }, - { 1587, -6331, -2760, -1909 }, - { 2139, -5213, -2874, -2120 }, - { 1318, -4337, -3695, -2098 }, - { 821, -4471, -1849, -565 }, - { 3329, -4782, -1725, -89 }, - { 582, -4914, -4105, -1119 }, - { 417, -4144, -4072, -2529 }, - { -199, -3803, -2765, -4042 }, - { 2731, -4283, -2143, 1 }, - { 2911, -6187, -1951, -2116 }, - { 1573, -6094, -493, -2838 }, - { 2081, -6927, -864, -3211 }, - { 1058, -7826, 79, -364 }, - { 3147, -5570, -684, -978 }, - { 3572, -5856, 1060, 1824 }, - { 1143, -6702, -1478, 338 }, - { 2341, -7220, -88, 260 }, - { 3639, -6861, 668, 815 }, - { 2227, -6268, -1706, 446 }, - { 3390, -6082, -353, 1302 }, - { 1123, -7556, -1237, -430 }, - { 1729, -7742, 729, -218 }, - { 1457, -6774, 587, 579 }, - { 505, -6919, -569, 371 }, - { 1106, -7245, 78, 158 }, - { 2755, -6745, -1122, 338 }, - { 3069, -6040, -1415, 986 }, - { 2174, -7064, -1430, -283 }, - { 1390, -8626, -446, -3031 }, - { 3534, -6890, -431, 547 }, - { 2267, -9618, 475, -2994 }, - { 3672, -7673, 75, -115 }, - { 2131, -7560, -1206, -750 }, - { 2972, -7477, -685, -262 }, - { 1604, -6637, -672, 699 }, - { 1666, -7577, -577, -240 }, - { 1591, -6554, -2158, -94 }, - { 2348, -6286, -353, 1123 }, - { 2017, -8810, -412, -1805 }, - { 2892, -6713, -1765, -554 }, - { 2500, -6828, -1995, -1197 }, - { 3877, -6639, -224, -1655 }, - { 2392, -7872, -91, -333 }, - { 3562, -7370, -532, -2836 }, - { 2552, -7614, 164, -1805 }, - { 990, -6104, 218, 438 }, - { 910, -7861, 312, -1195 }, - { 1472, -6327, 372, -640 }, - { 1576, -7143, -1983, -843 }, - { 422, -7625, -457, -278 }, - { 1797, -8532, 405, -1011 }, - { 1088, -7396, -238, -2277 }, - { 3209, -6753, -1431, -2072 }, - { 2617, -6839, 100, -2573 }, - { 2575, -8573, -387, -3188 }, - { 3618, -6971, -1190, -321 }, - { 2205, -7361, -1695, -2008 }, - { 2985, -6297, 1464, 1179 }, - { 2804, -7310, 1053, 338 }, - { 1362, -6074, -1163, -840 }, - { 3336, -6325, -1794, 21 }, - { 2836, -8109, 818, -329 }, - { 2791, -5879, 560, 1546 }, - { 2392, -6064, 135, 100 }, - { 1838, -6194, 596, 1085 }, - { 1926, -7515, -414, -4901 }, - { 3225, -7298, -1202, -1189 }, - { 3960, -7558, -659, -719 }, - { 3442, -6647, -1692, -1095 }, - { 3381, -6441, 262, -886 }, - { 1431, -8150, -1186, -1406 }, - { 340, -8498, -150, -899 }, - { 3004, -8149, -260, -953 }, - { 2749, -6611, 563, 873 }, - { -6647, -1325, -4517, -4691 }, - { -6005, -1657, -4089, -3797 }, - { -3157, 588, -5213, -3068 }, - { -3311, -1425, -6329, -3726 }, - { -5866, -819, -3857, -2744 }, - { -5001, -1799, -1075, -4621 }, - { -5330, -2650, -2672, -4664 }, - { -4930, -539, -2363, -4010 }, - { -2984, 10, -3863, -5749 }, - { -1055, -2106, -3713, -4267 }, - { -5476, -502, -4279, -6504 }, - { -5231, -1543, -5018, -6425 }, - { -5134, -363, -3165, -5109 }, - { -3953, -771, -4107, -6393 }, - { -2159, -563, -3652, -5342 }, - { -3888, -2321, -919, -5057 }, - { -1236, -597, -4235, -4193 }, - { -4053, 675, -3083, -6174 }, - { -2793, -1089, -5396, -3460 }, - { -3000, -44, -2209, -6575 }, - { -3336, -1531, -4313, -5160 }, - { -2127, 128, -4851, -3692 }, - { -3321, 136, -2067, -5660 }, - { -5215, 1404, -4374, -4356 }, - { -2747, 400, -6340, -3691 }, - { -3926, -599, -5361, -5006 }, - { -2875, -2592, -5143, -4092 }, - { -4991, -1958, -5322, -4891 }, - { -4965, -1318, -6652, -5333 }, - { -4920, -1691, -3388, -5561 }, - { -3644, -3354, -2688, -5982 }, - { -5076, -919, -4563, -2984 }, - { -6114, 250, -3884, -3915 }, - { -4014, 744, -3973, -1924 }, - { -5543, -1041, -5557, -3847 }, - { -4711, -1352, -5649, -2603 }, - { -3362, 775, -5305, -4879 }, - { -5001, 107, -3554, -2888 }, - { -6258, -1651, -6356, -6566 }, - { -4529, 407, -5003, -3865 }, - { -5154, 550, -5278, -5465 }, - { -4195, -467, -1894, -3129 }, - { -5022, 1127, -3349, -3314 }, - { -6075, 1250, -4313, -5641 }, - { -2677, -2283, -2312, -5903 }, - { -4113, 193, -1195, -4833 }, - { -3940, -1048, -1389, -5079 }, - { -3703, 917, -4043, -4451 }, - { -3366, -4231, -1534, -5488 }, - { -3326, -3583, -2091, -4903 }, - { -5144, 1254, -2532, -4949 }, - { -5982, -870, -2545, -4555 }, - { -3925, -157, -5367, -2281 }, - { -6419, -746, -5668, -4371 }, - { -5787, 518, -7096, -5805 }, - { -4258, 954, -6453, -4321 }, - { -4771, -695, -4158, -1639 }, - { -7078, -760, -5195, -5877 }, - { -7348, 83, -4101, -4586 }, - { -2430, 184, -2874, -1679 }, - { -2284, -3943, -2924, -5034 }, - { -1804, -1785, -3002, -4710 }, - { -4399, -2772, -1815, -4637 }, - { -6340, -2626, -2824, -5191 }, - { -4998, -5168, -3480, 1905 }, - { -3958, -5492, -1599, 1579 }, - { -2471, -3755, -276, 3182 }, - { -3033, -5779, -1063, 1554 }, - { -2936, -4829, -1290, 2386 }, - { -1835, -5073, -3051, 1299 }, - { -1724, -3771, -3935, 2324 }, - { -5070, -2550, -3692, 768 }, - { -4326, -5333, -297, 1878 }, - { -3472, -5619, -3094, 992 }, - { -3027, -4384, -3038, 2265 }, - { -3201, -5332, 67, 2200 }, - { -1681, -4373, -1947, 2461 }, - { -3221, -3329, -4238, 2564 }, - { -1262, -2968, -2915, 3227 }, - { -3419, -1878, -3373, 2110 }, - { -2244, -5583, -2012, 1288 }, - { -1971, -5266, -990, 1812 }, - { -2975, -2778, -452, 4063 }, - { -2198, -1165, -3298, 2965 }, - { -4782, -4894, -4767, 664 }, - { -6002, -3950, -2806, 2025 }, - { -3142, -3162, -2859, 3295 }, - { -3262, -3340, -4123, 1596 }, - { -4014, -3918, -1955, 3361 }, - { -1700, -3463, -1346, 3449 }, - { -4245, -4445, -4743, 1644 }, - { -4180, -3969, -401, 3281 }, - { -2782, -5240, -4117, 1156 }, - { -5744, -4040, -1439, 3470 }, - { -5063, -4663, -323, 3172 }, - { -4531, -3319, -844, 3988 }, - { -6226, -5125, -2064, 2976 }, - { -3115, -3267, -1531, 3898 }, - { -4628, -4421, -2864, 2808 }, - { -4559, -2989, -3442, 2024 }, - { -1775, -4487, -656, 2477 }, - { -2664, -1865, -1884, 4081 }, - { -1828, -2575, -3894, 3378 }, - { -6441, -3677, -2025, 1677 }, - { -4141, -2156, -1191, 3474 }, - { -4802, -1623, -1727, 2160 }, - { -5474, -2745, -1475, 2498 }, - { -3664, -1056, -1975, 2491 }, - { -4672, -3062, -2235, 2933 }, - { -4205, -5960, -2849, 1517 }, - { -4995, -5708, -1739, 1805 }, - { -4892, -6080, -4793, 872 }, - { -4270, -4172, -4263, 2185 }, - { -4687, -1470, -2905, 1023 }, - { -6446, -5017, -3919, 1000 }, - { -6046, -5538, -3943, 2006 }, - { -6028, -3750, -3953, 771 }, - { -5959, -4582, -5024, 824 }, - { -5818, -2576, -2249, 1326 }, - { -5659, -5345, -1119, 2500 }, - { -3346, -4155, 606, 2749 }, - { -5680, -4827, -2501, 1838 }, - { -6193, -2543, -1295, 840 }, - { -6871, -4925, -3512, 1801 }, - { -5605, -1788, -1895, 779 }, - { -3922, -5712, -4644, 510 }, - { -4745, -3869, -4533, 99 }, - { -2984, -4907, -399, 1497 }, - { 1847, -478, 3061, -5812 }, - { 4450, -1116, 3609, -6570 }, - { 3139, 99, 3007, -5532 }, - { 2590, -3782, 3138, -4770 }, - { 1881, 1204, 5778, -3404 }, - { 3631, 2060, 5566, -5038 }, - { 3461, 1961, 5167, -3800 }, - { 2947, 273, 4536, -4389 }, - { 4453, -1730, 5788, -4370 }, - { 4032, 1805, 2666, -4534 }, - { 3487, -944, 2313, -6028 }, - { 1313, 34, 4210, -4067 }, - { 5632, -1502, 5825, -5855 }, - { 7736, -547, 4879, -5476 }, - { 4906, -1512, 4760, -5760 }, - { 3843, 447, 1091, -4958 }, - { 2982, -1135, 5442, -4386 }, - { 3579, 271, 3031, -6770 }, - { 3932, -211, 4688, -5507 }, - { 4411, 1720, 2387, -5584 }, - { 5379, -479, 4575, -6280 }, - { 3613, -362, 2012, -4885 }, - { 3744, -2013, 4493, -5073 }, - { 5693, 109, 4379, -3362 }, - { 5475, -621, 5317, -3985 }, - { 6411, -673, 5708, -4752 }, - { 4933, -796, 7262, -4290 }, - { 2804, 444, 6276, -3655 }, - { 4120, -517, 6078, -4531 }, - { 5119, 841, 3486, -3910 }, - { 4738, 1539, 3525, -2970 }, - { 5086, 370, 5895, -5640 }, - { 4235, 2716, 4589, -5044 }, - { 3691, 682, 6199, -4700 }, - { 6111, -570, 6271, -6528 }, - { 2611, 1277, 3756, -4802 }, - { 4395, 970, 3807, -5879 }, - { 5225, 2299, 3242, -4333 }, - { 5144, 1778, 4946, -5545 }, - { 2989, -3016, 3247, -5495 }, - { 2983, 920, 2071, -6059 }, - { 5270, -903, 4434, -2350 }, - { 6415, -585, 3970, -3554 }, - { 3866, -197, 5216, -2884 }, - { 3767, -1298, 6702, -3315 }, - { 6299, 2620, 5284, -6824 }, - { 6654, 646, 3653, -4927 }, - { 4770, 3047, 5160, -6287 }, - { 5364, 434, 2919, -5207 }, - { 2998, 1344, 4801, -2456 }, - { 3896, 1013, 3773, -1864 }, - { 2115, 655, 2999, -6344 }, - { 5170, -981, 2849, -4464 }, - { 2735, -2159, 2717, -5776 }, - { 2430, -1952, 4392, -4559 }, - { 6143, -1180, 3659, -4746 }, - { 4978, -1483, 1726, -4875 }, - { 3486, -2383, 3306, -4301 }, - { 1434, -1372, 4171, -4770 }, - { 3354, -2627, 1525, -5093 }, - { 6790, 2386, 3995, -5909 }, - { 1475, -2674, 3451, -4204 }, - { 1999, -3494, 3693, -5556 }, - { 4764, -2848, 2856, -5589 }, - { -3677, 5131, 2827, -2934 }, - { -2844, 7078, 2852, -3580 }, - { -3902, 6434, 4118, -1911 }, - { -1769, 7530, 3492, -3541 }, - { -1937, 5679, -447, -1127 }, - { -2456, 4680, 4196, -2407 }, - { -2778, 8241, 1698, -4288 }, - { -2876, 6104, 5182, -2387 }, - { -2802, 7341, 4463, -2938 }, - { -1025, 6267, 4752, -3201 }, - { -2349, 5413, 2041, -3794 }, - { -2252, 8225, 2856, -4269 }, - { -1465, 4967, 4976, -2500 }, - { -636, 7565, 3517, -4233 }, - { -1905, 5618, 3904, -2942 }, - { -302, 6816, 3343, -3316 }, - { -2210, 4156, 2817, -3511 }, - { -717, 6568, 1863, -2951 }, - { -3873, 5682, 2164, -575 }, - { -2878, 5835, 440, -2597 }, - { -3228, 7701, 2610, -2514 }, - { -3608, 8888, 3377, -2468 }, - { -2582, 9717, 2519, -3126 }, - { -5238, 6202, 2866, -2831 }, - { -3428, 7370, 3056, -335 }, - { -1681, 8836, 1210, -2010 }, - { -3276, 6724, 1156, -3930 }, - { -894, 8149, 827, -1258 }, - { -2965, 8631, 2549, -1320 }, - { -3961, 6902, 3581, 55 }, - { -1894, 7745, 1750, -841 }, - { -821, 6844, 850, -676 }, - { -608, 6948, -4, -1376 }, - { 615, 6524, 1089, -1147 }, - { -2972, 5668, 1091, -489 }, - { -157, 4649, 2904, -413 }, - { 673, 5121, 1498, -66 }, - { -390, 5902, 1611, -245 }, - { -2349, 5478, 4772, -1320 }, - { 88, 6798, 1972, -1859 }, - { -1213, 5120, 2991, 200 }, - { -2347, 6040, 2839, 376 }, - { -578, 5976, 3364, -1796 }, - { -1391, 5872, 3002, -965 }, - { -564, 4496, 3946, -1186 }, - { -2299, 6386, 3135, -2176 }, - { -2131, 5641, 2011, 1223 }, - { -772, 5807, 1124, 895 }, - { -2837, 6758, 2297, -740 }, - { -3091, 6298, 1415, -2126 }, - { -4197, 6036, 1843, -3022 }, - { -41, 6459, 92, 344 }, - { -2241, 6860, 2095, -4396 }, - { -1931, 7088, 2117, -2135 }, - { -2375, 4422, 1688, -3169 }, - { -1742, 6674, 1538, -119 }, - { -4818, 7749, 4192, -1577 }, - { -2004, 5672, 193, -430 }, - { -3825, 6042, 2128, -1898 }, - { -1108, 8033, 2119, -3013 }, - { -2370, 5453, 1721, 266 }, - { -1570, 7134, 614, -2638 }, - { -1519, 8752, 3503, -4330 }, - { -2050, 3845, 2907, -1126 }, - { 5085, 4412, -335, -1923 }, - { 3618, 1423, -613, -4012 }, - { 4481, 3729, 589, -4631 }, - { 4270, 3216, -1763, -3168 }, - { 4241, 1796, -1701, -2796 }, - { 4787, 2338, -487, -3639 }, - { 2915, 3429, -621, -4753 }, - { 5175, 1660, -1265, -3223 }, - { 4280, 4057, -684, -4079 }, - { 4980, 4419, -1455, -2719 }, - { 5436, 2464, 387, -4197 }, - { 4507, 4018, 1121, -3314 }, - { 6020, 2401, -413, -3201 }, - { 4200, 3789, -333, -2813 }, - { 5229, 2493, -1194, -1878 }, - { 5851, 2695, -492, -2292 }, - { 5743, 3288, -697, -1221 }, - { 5692, 2612, 979, -2227 }, - { 5085, 2067, 1046, -1214 }, - { 3163, 2240, -2098, -3435 }, - { 5228, 1898, 145, -2397 }, - { 5860, 3976, -418, -2872 }, - { 6008, 3399, 1027, -3506 }, - { 4126, 2035, 1865, -893 }, - { 5375, 3596, 511, -2362 }, - { 1937, 1493, -852, -122 }, - { 3473, 4849, 547, -2603 }, - { 4631, 2977, 1141, -1768 }, - { 6149, 3050, -71, -1886 }, - { 4069, 4353, -289, -1429 }, - { 2884, 1225, -1388, 365 }, - { 5485, 2518, -235, -571 }, - { 1216, 4375, 1443, 398 }, - { 4988, 3106, 107, -1435 }, - { 4511, 2801, 307, -444 }, - { 3235, 4386, 327, -676 }, - { 2055, 3708, 1657, -305 }, - { 5839, 2374, 290, -1385 }, - { 5110, 3305, 1936, -4206 }, - { 6416, 2920, 338, -2736 }, - { 3350, 2824, -1269, -3881 }, - { 4840, 1815, 464, 186 }, - { 2399, 3332, 238, 1238 }, - { 3516, 1363, 1582, 688 }, - { 3582, 1874, 154, -4770 }, - { 3261, 2878, 886, 283 }, - { 3877, 2658, -327, 884 }, - { 4151, 3436, 2173, -2923 }, - { 3592, 3674, 1281, -1295 }, - { 4561, 3730, -1114, -1747 }, - { 4595, 3625, -558, -575 }, - { 2577, 2348, 2267, 120 }, - { 5242, 3299, 32, -3412 }, - { 4264, 3637, 709, -2320 }, - { 6556, 3570, -838, -2472 }, - { 5745, 4014, -940, -1973 }, - { 5629, 4475, 477, -3328 }, - { 5269, 3199, 1682, -3085 }, - { 4432, 2416, 1145, -3299 }, - { 4465, 2505, 2162, -2186 }, - { 4643, 4941, -88, -2885 }, - { 4568, 5231, 552, -3915 }, - { 5667, 3075, -1406, -2963 }, - { 5418, 5259, -771, -2818 }, - { -256, -7875, 511, -471 }, - { -1813, -7971, -424, -396 }, - { -306, -7006, 862, 282 }, - { -2306, -6422, -1440, 508 }, - { -245, -6787, 375, -100 }, - { -1309, -6065, -20, 779 }, - { -1656, -6047, -641, 1307 }, - { -1496, -6522, 964, 726 }, - { -2291, -6588, -202, 795 }, - { -762, -7522, 1454, -558 }, - { -2270, -7004, -834, -580 }, - { -1139, -7078, 259, 362 }, - { -2535, -7568, -1040, 49 }, - { -3786, -7280, 934, -476 }, - { -3336, -6368, 606, 1056 }, - { -3602, -6924, 52, 714 }, - { -2278, -6550, 1674, 204 }, - { -2855, -5765, 930, 1530 }, - { -2889, -7325, -215, 305 }, - { -2749, -6080, -237, 1452 }, - { -985, -6667, 1577, 400 }, - { -2036, -6083, 380, 1267 }, - { -2077, -7460, 380, -30 }, - { -1775, -7175, 1540, -386 }, - { -3065, -6927, 989, 168 }, - { -2836, -7602, 117, -3392 }, - { -1058, -6396, 593, -3078 }, - { -844, -6062, 999, -236 }, - { -3261, -6951, 1491, -720 }, - { -2186, -8484, 75, -1287 }, - { -2882, -7756, 456, -510 }, - { -1800, -6879, 960, -1183 }, - { -2554, -7241, 1614, -1474 }, - { -2608, -5305, 392, 851 }, - { -2973, -6562, -859, 858 }, - { -2640, -5989, 1031, -416 }, - { -977, -8366, 705, -1434 }, - { -1213, -7409, -77, -1390 }, - { -1335, -6657, 2125, -123 }, - { -2544, -6862, 1852, -737 }, - { -3235, -6422, 1752, -103 }, - { -1300, -7557, 939, -348 }, - { -3476, -7579, 202, -109 }, - { -2482, -6572, 753, 619 }, - { -2554, -8136, -648, -429 }, - { -1012, -7870, -3, -421 }, - { -3604, -6247, 32, -3102 }, - { -1486, -7271, 2013, -1021 }, - { -578, -6799, -523, 405 }, - { -2841, -5948, 1644, 911 }, - { -2411, -7473, 1084, -484 }, - { -2238, -6033, 294, -1059 }, - { -3459, -6470, -201, -790 }, - { -2027, -6009, 1833, 805 }, - { -1433, -8047, 1531, -1754 }, - { -3258, -7884, 763, -1422 }, - { -1544, -6928, -729, 478 }, - { -2314, -8415, 74, -3757 }, - { -3201, -5684, 95, -2214 }, - { -2423, -8694, 725, -3631 }, - { -3545, -7071, 1162, -1798 }, - { -294, -9662, 403, -2274 }, - { -2290, -5460, 1196, 402 }, - { -1603, -6713, 903, -2363 }, - { 4121, 2491, -3142, -2482 }, - { 4500, 3305, -3671, -1567 }, - { 5973, 3172, -1348, -534 }, - { 4830, 3379, -1549, 643 }, - { 5214, 3938, -2641, -2302 }, - { 4639, 4826, -5532, -847 }, - { 5639, 2731, -2170, -963 }, - { 6084, 3487, -3525, -1346 }, - { 5971, 3154, -2190, -2316 }, - { 5618, 4865, -6927, 116 }, - { 5345, 3568, -7391, 709 }, - { 5429, 5078, -3811, -1524 }, - { 6960, 2037, -3515, -1096 }, - { 7092, 2531, -4557, -588 }, - { 6061, 4247, -5651, -478 }, - { 4595, 3684, -4907, -827 }, - { 7497, 3213, -3048, -424 }, - { 5996, 2137, -3098, -1745 }, - { 6198, 5199, -2223, -2274 }, - { 6888, 2851, -2768, -1675 }, - { 6114, 4210, -2316, -954 }, - { 7127, 4242, -3041, -1408 }, - { 6126, 3668, -1517, -1427 }, - { 6245, 6129, -4225, -1186 }, - { 6816, 3213, -2101, -964 }, - { 5345, 5276, -2643, -847 }, - { 6592, 4665, -4338, 484 }, - { 6746, 3751, -3443, 124 }, - { 5453, 1980, -2738, 2606 }, - { 4662, 2179, -4226, -1059 }, - { 5571, 3208, -3554, 174 }, - { 5256, 4447, -1815, -1481 }, - { 5400, 2570, -1210, 235 }, - { 7056, 2549, -2674, 318 }, - { 4574, 4340, -2892, -130 }, - { 6203, 4587, -3273, -305 }, - { 5103, 1925, -2715, -2137 }, - { 3905, 4296, -1700, 247 }, - { 4421, 4605, -3299, 811 }, - { 5671, 1273, -3870, -924 }, - { 5486, 1805, -4901, 133 }, - { 6437, 2578, -1828, -106 }, - { 5530, 5253, -5058, 1223 }, - { 4816, 2025, -1215, 1443 }, - { 3457, 3525, -2456, 3217 }, - { 3316, 2595, -1108, 2459 }, - { 3068, 3810, -2207, 1926 }, - { 6351, 5436, -6470, 600 }, - { 6324, 4240, -5365, 2416 }, - { 4851, 4774, -4075, 1878 }, - { 4900, 3679, -5198, 1078 }, - { 8347, 3633, -4565, -171 }, - { 5244, 5718, -3853, 173 }, - { 3960, 3492, -2939, 2105 }, - { 6070, 3473, -2351, 161 }, - { 8228, 3034, -3360, -901 }, - { 7006, 3985, -1940, -1926 }, - { 7123, 4681, -4301, -878 }, - { 5122, 4097, -1851, -449 }, - { 6200, 2060, -2251, 1049 }, - { 7106, 3844, -7209, 2625 }, - { 7108, 3370, -6734, 533 }, - { 6859, 2849, -3992, 1360 }, - { 5458, 2278, -3253, 1131 }, - { -1072, -2109, 4783, -1073 }, - { -319, -2604, 4257, -2418 }, - { 2466, 1300, 3476, -314 }, - { 2847, -1502, 5296, -141 }, - { 1667, -1273, 5559, -2725 }, - { 2877, -3402, 6434, 204 }, - { 53, -2637, 5275, -1181 }, - { 1091, -2215, 5803, -1549 }, - { 2397, -922, 4327, 1182 }, - { 219, -3747, 4647, -1564 }, - { -29, -2705, 4812, 1277 }, - { 1499, -2608, 5648, 1407 }, - { 2139, -2399, 4202, 2791 }, - { -426, -2064, 5528, 151 }, - { 2560, -2803, 6179, -2806 }, - { 4537, -2479, 3797, 1095 }, - { 888, -3357, 5341, -415 }, - { 4460, -1814, 5388, -1227 }, - { 3920, -3268, 6364, -703 }, - { 3343, -4698, 4410, 784 }, - { 309, -1897, 6306, 1223 }, - { 958, -3318, 4254, -3167 }, - { -99, 1596, 6018, -1983 }, - { -429, -853, 6407, 878 }, - { 1170, -1322, 6290, -417 }, - { 2288, -505, 6303, -1999 }, - { 3312, -1674, 6749, -2494 }, - { -415, -3401, 4721, -371 }, - { -189, -1210, 4844, -2002 }, - { 888, -4142, 4377, 130 }, - { 2469, -4381, 5398, -2492 }, - { 2879, -2912, 5094, -2598 }, - { -717, -617, 5650, -685 }, - { 1470, -3863, 5352, -1684 }, - { 3935, -96, 3823, -730 }, - { 3769, -430, 3168, 694 }, - { 2556, 385, 3539, 512 }, - { 77, -1415, 5111, 2655 }, - { 2724, -2158, 6715, -822 }, - { 1832, 1001, 5385, -1900 }, - { 900, 2198, 4464, -559 }, - { 441, 69, 5921, -1743 }, - { -1161, 738, 6732, -308 }, - { 257, 2035, 4091, 736 }, - { 1607, 1288, 4355, -23 }, - { -13, 1316, 4180, 1672 }, - { 1511, 1336, 3057, 1435 }, - { 2189, -3813, 4530, 939 }, - { 3632, -706, 2646, 1375 }, - { 4266, -3761, 4241, 1077 }, - { 3101, -427, 5273, -1202 }, - { 2293, 276, 4810, -313 }, - { 3430, -1851, 3101, 2045 }, - { 3453, -2979, 5142, 942 }, - { 1683, -3281, 4802, 2002 }, - { 3954, -4715, 5611, 578 }, - { 1272, -155, 5085, 454 }, - { 128, -194, 5095, 1409 }, - { 820, 880, 5797, -2658 }, - { -1095, 656, 5774, 1095 }, - { 813, -1669, 4320, -3251 }, - { -119, 518, 6372, -651 }, - { 2922, -4299, 6115, -877 }, - { 4205, -4273, 4004, 2642 }, - { -1211, -3892, 224, 3127 }, - { -34, -4371, 1321, 2318 }, - { 77, -6326, 1201, 828 }, - { 3995, -3775, 1958, 3233 }, - { 178, -3301, 1985, 3318 }, - { 2330, -3801, 1033, 3195 }, - { 1413, -5536, 826, 1709 }, - { 2468, -3499, 3653, 3631 }, - { 741, -4617, 1723, 2008 }, - { 1246, -3043, 2978, 3949 }, - { -343, -4308, 2258, 2189 }, - { -682, -4640, 454, 2272 }, - { 1236, -4829, 2491, 1642 }, - { -512, -3766, 1182, 3052 }, - { 119, -3939, 3712, 971 }, - { -1145, -4624, 1360, 2281 }, - { 101, -4746, 2866, 1255 }, - { -1500, -5455, 539, 1637 }, - { -969, -5909, 1414, 1128 }, - { -1261, -4939, -231, 2022 }, - { -226, -5345, 1207, 705 }, - { 2712, -5109, 3205, 1866 }, - { -476, -5913, 273, 1208 }, - { -2039, -4464, 624, 2545 }, - { -2351, -3930, 2019, 2673 }, - { -2675, -4849, 1522, 1990 }, - { -1524, -3461, 1446, 3204 }, - { 477, -5314, 1710, 1577 }, - { 656, -3729, 2346, 2511 }, - { 550, -5917, 1975, 1040 }, - { 1728, -4704, 3067, 1058 }, - { -9, -5247, 506, 1760 }, - { -574, -5135, 1675, 1672 }, - { 2129, -3781, 3444, 2313 }, - { 1144, -4439, 2214, 2529 }, - { 1292, -4160, 3185, 1833 }, - { 2445, -3262, 2534, 3227 }, - { 2266, -4401, 2023, 2400 }, - { -587, -3602, 3408, 2067 }, - { -885, -4951, 3228, 1174 }, - { -728, -2711, 2807, 3552 }, - { 1019, -3043, 3195, 2954 }, - { 1888, -4615, 1140, 2454 }, - { 660, -5616, 754, 800 }, - { -1975, -5371, 1649, 1585 }, - { -1544, -5436, 2422, 1081 }, - { -422, -5882, 2390, 750 }, - { 1336, -5557, 2441, 1230 }, - { 136, -4001, 267, 2854 }, - { -522, -3289, 2226, 2728 }, - { -971, -4580, 2471, 708 }, - { 704, -5306, 3300, 1001 }, - { 325, -3464, 3555, 2398 }, - { 794, -3686, 848, 3169 }, - { 660, -3017, 4584, 3242 }, - { -1486, -3978, 2170, 1644 }, - { -1615, -4650, 2688, 1844 }, - { 750, -4578, 538, 2239 }, - { 1668, -5849, 1455, 1031 }, - { 3486, -4681, 2030, 2183 }, - { 2642, -5429, 1696, 1761 }, - { 4491, -4502, 3538, 2767 }, - { 3545, -4528, 3514, 2982 }, - { 3269, -3676, 2758, 3966 }, - { 5572, 1146, 209, -3379 }, - { 7459, 1053, 593, -1896 }, - { 4480, 200, -310, -4259 }, - { 5577, -939, 242, -3992 }, - { 8142, 442, 1257, -3083 }, - { 5442, 1261, 1424, -3236 }, - { 6260, -183, 3125, -2532 }, - { 7179, 889, 1618, -2548 }, - { 6416, 932, 2379, -2487 }, - { 7094, 2560, 961, -3392 }, - { 7322, 463, 2732, -3735 }, - { 6632, 1577, 1912, -3272 }, - { 6312, 1349, 3028, -3460 }, - { 6105, 386, 1213, -977 }, - { 5478, 1158, 1114, -486 }, - { 6493, 410, 1686, -2180 }, - { 6378, 1881, 1333, -2240 }, - { 5711, 812, 1958, -1300 }, - { 6844, 877, 730, -1189 }, - { 6824, -245, 2249, -2000 }, - { 7515, 1521, 1251, -3058 }, - { 6697, 1051, 1300, -1749 }, - { 6476, 1425, 811, -2773 }, - { 7350, 465, -76, -2849 }, - { 6975, 2095, 567, -2492 }, - { 4691, 1736, 2660, -2289 }, - { 7837, 1456, 340, -2767 }, - { 7930, 507, 838, -2074 }, - { 6106, 1502, 766, -1110 }, - { 4891, -659, 835, -3954 }, - { 7250, 141, 1369, -1523 }, - { 7651, 67, 1651, -2298 }, - { 7364, -305, 601, -3132 }, - { 7179, 193, 2491, -2871 }, - { 6504, -272, 2167, -1322 }, - { 4456, 983, 2300, -421 }, - { 4817, 457, 1695, 371 }, - { 6914, 555, 850, -3159 }, - { 5904, 1030, 202, -1959 }, - { 6258, 880, 2233, -4503 }, - { 6029, 10, 2130, -3600 }, - { 6449, 985, 1129, -3963 }, - { 6616, -18, -111, -3285 }, - { 4496, 775, 817, -4276 }, - { 6134, 2338, 1470, -2973 }, - { 6911, 152, 430, -1946 }, - { 4053, 991, 3218, -1193 }, - { 5435, 1285, 3124, -2412 }, - { 5507, 1836, 1935, -1988 }, - { 5240, 689, 2189, -2670 }, - { 6638, 1719, 606, -1799 }, - { 5556, -180, 129, -2595 }, - { 5644, 1918, 1281, -4316 }, - { 6410, 1088, -282, -3117 }, - { 6503, 1841, 312, -3514 }, - { 6947, 20, 1358, -3886 }, - { 5464, 2109, 2398, -3194 }, - { 5616, -407, 2140, -498 }, - { 6121, 2707, 2379, -4096 }, - { 7303, 1846, 2266, -4095 }, - { 5444, 470, 2718, -1553 }, - { 5817, -645, 3285, -1349 }, - { 5625, 1427, 1103, -1991 }, - { 6041, -806, 1196, -2943 }, - { 3050, -5722, 4070, -5460 }, - { 3420, -4386, 4078, -5155 }, - { 6020, -3982, 7268, -2689 }, - { 7502, -4317, 7894, -3973 }, - { 4156, -3558, 5247, -4316 }, - { 4725, -4401, 7290, -1540 }, - { 6688, -5122, 8216, -3210 }, - { 9176, -6576, 9276, -4963 }, - { 8706, -5708, 7987, -4621 }, - { 7060, -3535, 6532, -3308 }, - { 5600, -2719, 5363, -1568 }, - { 4661, -2803, 6263, -4716 }, - { 3673, -3636, 6147, -3433 }, - { 5305, -2585, 6073, -2638 }, - { 7614, -1962, 6079, -5266 }, - { 6760, -3366, 7382, -4322 }, - { 6385, -3883, 4797, -1353 }, - { 8182, -5120, 4298, -4641 }, - { 9130, -6198, 4975, -3063 }, - { 7421, -5436, 5576, -3713 }, - { 3483, -4898, 5443, -2745 }, - { 4907, -5643, 6390, -4105 }, - { 8119, -7008, 7992, -6764 }, - { 6528, -6122, 6967, -5590 }, - { 5890, -4190, 6624, -5688 }, - { 6815, -7934, 7275, -5456 }, - { 5434, -4306, 5169, -5378 }, - { 4364, -6436, 5376, -2604 }, - { 8152, -3404, 5913, -5048 }, - { 7983, -4863, 4262, -2461 }, - { 8023, -6188, 6238, -5062 }, - { 6753, -3692, 3935, -3723 }, - { 6826, -4760, 3284, -4051 }, - { 7224, -7423, 4492, -3875 }, - { 6904, -2590, 6587, -6248 }, - { 6106, -1944, 7345, -5506 }, - { 4956, -2990, 7808, -3146 }, - { 6908, -6885, 5949, -1288 }, - { 7162, -6058, 3419, -3401 }, - { 7015, -7080, 6907, -3018 }, - { 6971, -6832, 5646, -3273 }, - { 8014, -5546, 5471, -1544 }, - { 6792, -2220, 5105, -2879 }, - { 8494, -3974, 4408, -3999 }, - { 9591, -4866, 6027, -4558 }, - { 5264, -5161, 6101, -738 }, - { 5803, -6141, 5197, -5231 }, - { 4657, -6822, 3232, -5189 }, - { 4791, -5135, 3809, -4665 }, - { 6108, -5103, 2379, -3873 }, - { 4680, -3909, 3234, -5093 }, - { 5802, -3853, 3795, -4984 }, - { 4360, -7483, 4802, -3877 }, - { 5429, -7517, 5911, -3717 }, - { 6866, -2280, 4880, -4634 }, - { 10131, -4628, 4414, -4092 }, - { 10811, -5189, 7746, -5337 }, - { 5663, -8941, 5287, -5680 }, - { 8023, -5991, 7403, -2796 }, - { 9669, -6919, 6525, -4932 }, - { 7275, -3796, 4962, -2547 }, - { 8848, -4806, 5677, -3080 }, - { 8128, -4308, 7749, -6569 }, - { 4032, -5196, 2282, -6239 }, - { 6593, 700, -229, 304 }, - { 8260, 539, -66, -1259 }, - { 6605, 176, -814, -109 }, - { 8057, 0, -1, -136 }, - { 7382, -38, -484, -1129 }, - { 8373, -929, 682, -454 }, - { 7674, 690, -1278, 546 }, - { 7326, -517, 406, -1283 }, - { 7612, -1715, -1167, 1175 }, - { 8590, 441, -782, -710 }, - { 8572, -1202, -291, 260 }, - { 7308, -147, -1785, 414 }, - { 6787, -353, -672, 934 }, - { 5177, -133, 179, 82 }, - { 4161, -34, 447, 1497 }, - { 5997, -902, 1533, -121 }, - { 5727, -871, -1370, 945 }, - { 8386, -252, 293, -823 }, - { 6573, -1354, 682, 616 }, - { 7650, -2096, 725, 457 }, - { 8122, 78, 636, -1400 }, - { 8421, 428, -1620, 131 }, - { 7341, -1292, -717, 186 }, - { 7998, -49, -720, 266 }, - { 5987, -351, 669, 844 }, - { 7314, -1620, 250, -603 }, - { 7219, -1562, -572, 1994 }, - { 8682, -358, -290, -388 }, - { 5810, 155, -178, 1199 }, - { 7246, -12, 1042, -786 }, - { 7357, -923, 1468, -475 }, - { 7801, 621, -212, -724 }, - { 5346, -514, 1210, 1356 }, - { 8459, 36, -127, -779 }, - { 6878, -2429, 854, 1750 }, - { 7280, -1401, -1353, 2845 }, - { 7579, -2148, -1463, 2087 }, - { 6637, 946, -872, 750 }, - { 4807, -1100, 1289, 2602 }, - { 4495, 219, 1551, 1128 }, - { 7639, 506, 446, -1107 }, - { 6359, 188, 1009, -115 }, - { 6641, -1820, 1655, 723 }, - { 5394, -2382, 1604, 2542 }, - { 6021, -2644, 2396, 1407 }, - { 4698, 882, 245, 1525 }, - { 8103, 573, -798, -349 }, - { 8045, -519, 997, -1092 }, - { 7571, -122, 227, -338 }, - { 5347, -1200, 630, 1718 }, - { 7070, 790, 218, -544 }, - { 7440, 728, -527, -20 }, - { 6402, -355, 197, -736 }, - { 4031, 771, 866, 1895 }, - { 6009, 896, 445, -31 }, - { 5160, 1098, -856, 1784 }, - { 7980, -886, -1293, 1396 }, - { 6318, -1361, 2423, 252 }, - { 7547, -699, 133, 506 }, - { 8562, -2344, 940, 264 }, - { 5890, 1187, -1425, 2194 }, - { 6558, -645, -1311, 2621 }, - { 4634, -1671, 2075, 1623 }, - { 5614, 105, -816, 2376 }, - { 6646, 1558, -1365, 630 }, - { 6998, 1150, -2117, -990 }, - { 6555, 2311, -1093, -1783 }, - { 6682, 1430, -2391, -1940 }, - { 7861, 1555, -2977, -1188 }, - { 6745, 1723, -459, -2085 }, - { 7504, 1229, -1666, -2060 }, - { 7937, 671, -2128, -1529 }, - { 7139, 991, -735, -2632 }, - { 6867, 1592, -1303, -2324 }, - { 6401, 2230, -1732, -2508 }, - { 7201, 2184, -2169, -1988 }, - { 6636, 2190, -995, -2840 }, - { 7620, 2306, -2089, -651 }, - { 7584, 1875, -1438, -631 }, - { 9214, 1561, -2464, -1139 }, - { 6154, 1318, -1237, -2917 }, - { 7917, 2847, -1797, -1599 }, - { 8309, 2029, -2555, -465 }, - { 8204, 1282, -584, -2405 }, - { 8440, 1035, -1147, -1137 }, - { 7107, 1858, -60, -1568 }, - { 6781, 2912, -873, -1463 }, - { 7603, 1316, -319, -1249 }, - { 7833, 1335, -78, -1849 }, - { 7930, 1141, -1016, -695 }, - { 7883, 1610, -1017, -1314 }, - { 8069, 1409, -1811, -196 }, - { 8319, 1031, -582, -1590 }, - { 5948, 1537, -2153, -2373 }, - { 8684, 1171, -1871, -850 }, - { 8357, 2484, -2411, -1292 }, - { 6516, 2092, -193, -1167 }, - { 6112, 1697, 22, -525 }, - { 7161, 703, -602, -1879 }, - { 6047, 2351, -807, -219 }, - { 8072, 1854, -1817, -1553 }, - { 6956, 1304, 76, -1011 }, - { 6607, 1481, -544, -162 }, - { 6958, 2541, -265, -1938 }, - { 6416, 2514, -777, -850 }, - { 7272, 2110, -899, -1171 }, - { 7741, 2153, -283, -2614 }, - { 6482, 2041, -1758, -1221 }, - { 6762, 940, -1862, -2281 }, - { 5610, 1194, -1691, -1561 }, - { 7833, 2164, -823, -1952 }, - { 5460, 1438, -848, 1189 }, - { 6011, 1377, -771, -1557 }, - { 7679, 544, -1134, -2214 }, - { 7209, 1292, -2714, -1564 }, - { 5567, 1200, -404, -169 }, - { 5853, 1461, -1465, -518 }, - { 6782, 689, -844, -860 }, - { 7330, 1337, -1152, -71 }, - { 7189, 1506, -653, -685 }, - { 6860, 2116, -1403, -240 }, - { 8804, 1516, -1391, -1760 }, - { 7210, 2689, -1498, -989 }, - { 7030, 3022, -1441, -2083 }, - { 5649, 1836, -407, 525 }, - { 7451, 3099, -717, -2464 }, - { 7384, 1656, -2007, 398 }, - { 6504, 707, -1919, -134 }, - { -1851, 3639, -2279, -695 }, - { -4037, 1644, -77, 1329 }, - { -4025, 1960, -1565, -567 }, - { -3430, 2495, -795, 368 }, - { -4771, 2480, 993, 756 }, - { -3431, 2058, -2539, -971 }, - { -3802, 3418, 380, 217 }, - { -3074, 3350, -1652, -1056 }, - { -3705, 326, -1650, 1535 }, - { -3122, 1281, -1192, 1607 }, - { -4601, 1367, -968, 53 }, - { -3808, 958, 44, 2560 }, - { -2079, 2530, -1485, 1166 }, - { -3707, 343, -2889, 180 }, - { -5249, 1431, -31, 688 }, - { -4990, 125, -704, 1270 }, - { -2771, 1334, -2446, 746 }, - { -2292, 994, -1527, 2630 }, - { -1261, 3070, -2519, 268 }, - { -2544, 3890, -1057, -552 }, - { -4421, 255, -1980, 530 }, - { -2951, 454, -13, 3643 }, - { -2262, 1815, -370, 2880 }, - { -2383, 3657, -649, 576 }, - { -3541, -161, -1389, 2550 }, - { -4241, 1575, 1325, 2561 }, - { -2767, 4037, 1221, 1578 }, - { -3748, 2697, 1148, 1801 }, - { -4686, 2385, -220, 0 }, - { -1531, 1645, -2751, 1327 }, - { -45, 4032, -799, 2298 }, - { -2915, 2280, 709, 2495 }, - { -1199, 3278, -406, 2346 }, - { -2471, 116, -2706, 2060 }, - { -2440, 2173, -2894, -344 }, - { -3375, 2287, 1781, 3226 }, - { -2153, 3568, 1827, 2918 }, - { -862, 2267, -1626, 2527 }, - { -2698, 1135, 301, 4239 }, - { -2364, 2123, 1010, 3710 }, - { -2447, 3281, -81, 1408 }, - { -2660, 4735, 472, 258 }, - { -1053, 3097, 2682, 2398 }, - { -3366, -1037, -1152, -868 }, - { -643, 4242, 2212, 1259 }, - { 971, 3991, 934, 643 }, - { -1617, 2002, 2139, 2195 }, - { -4897, 972, 784, 1719 }, - { -1275, 2992, 1039, 3821 }, - { -392, 4973, -209, 1821 }, - { -1028, 4718, -1479, -137 }, - { 50, 3914, 553, 2210 }, - { 678, 4364, 359, 1303 }, - { -582, 4911, 514, 1671 }, - { 1276, 3914, -1252, 2934 }, - { -1496, 3984, 857, 2330 }, - { 772, 4744, -655, 2332 }, - { -799, 5283, -439, 624 }, - { 1341, 2937, 650, 2027 }, - { -1739, 4892, 1275, 1702 }, - { -892, 2596, -151, 3951 }, - { -3532, 1090, 1292, 32 }, - { 321, 3146, 2647, 1475 }, - { 264, 4199, -1591, 1317 }, - { -452, -2357, 2266, 4192 }, - { 3022, -1033, -2389, 5678 }, - { -1162, -1342, 3543, 4990 }, - { -474, -1477, -1223, 5016 }, - { -699, -2857, 900, 3835 }, - { -461, -2255, -117, 4626 }, - { 1204, -2062, -1211, 4403 }, - { 2192, -3035, -337, 3966 }, - { 108, -831, 279, 5643 }, - { 1457, -620, -2908, 5276 }, - { -2527, -78, 1085, 5460 }, - { -1978, -1918, -949, 4733 }, - { 32, 367, -1904, 5166 }, - { 1890, -1665, 440, 4752 }, - { -518, -348, 2816, 4891 }, - { 3695, -2490, -1374, 4603 }, - { 246, -1965, 3549, 3969 }, - { 1100, -3111, 656, 3737 }, - { -1379, 870, -414, 4575 }, - { 628, -357, -1227, 6179 }, - { -1129, -1318, -2457, 4576 }, - { -425, -98, -73, 6336 }, - { 367, -887, 2990, 4207 }, - { 2091, -1251, 2444, 3557 }, - { -1759, -1610, 2046, 5273 }, - { 3210, 1414, -20, 2616 }, - { 3303, -2636, 1005, 4237 }, - { -327, -3107, -640, 3687 }, - { -197, 764, 572, 5486 }, - { 646, -767, 1388, 5464 }, - { 104, 2742, -228, 3907 }, - { -236, 1829, -579, 4585 }, - { -2150, -474, -1525, 4006 }, - { -23, -2632, -2400, 3892 }, - { -12, -1739, -2910, 4867 }, - { -2310, -368, -102, 4583 }, - { -1991, -2061, 533, 4531 }, - { 3884, -1446, -153, 4393 }, - { 1568, 14, -289, 5268 }, - { -1376, -253, -2797, 3417 }, - { 3193, -2577, 2475, 3566 }, - { 3418, 617, 1350, 1857 }, - { 3792, -24, -272, 3370 }, - { 153, 1159, 2906, 2877 }, - { 511, 2162, 1548, 2741 }, - { 262, 819, -2791, 3734 }, - { 4232, -2015, 1486, 3477 }, - { 2943, -1110, -1014, 5480 }, - { 2842, 369, 703, 3476 }, - { 3011, 1634, -933, 3553 }, - { 4412, -1548, -942, 5021 }, - { -1405, 593, 2372, 5267 }, - { 2093, 2129, 896, 2365 }, - { 4845, -1980, 0, 3823 }, - { -2140, 81, 3278, 5637 }, - { 1484, 2665, -324, 3653 }, - { 10, 192, 1620, 5291 }, - { 2152, 738, -2269, 5000 }, - { 2102, 2748, -1652, 4707 }, - { 2855, -2131, -387, 5188 }, - { 1173, 676, 1338, 3277 }, - { 2340, -2329, -2064, 4095 }, - { 861, -2024, 1296, 5055 }, - { 2189, 3225, -695, 2626 }, - { 6196, -7079, 1943, -822 }, - { 4547, -4813, 3261, 1856 }, - { 4243, -6904, 3443, 448 }, - { 4581, -7503, 946, 506 }, - { 6626, -7754, 3427, 470 }, - { 3407, -9088, 3269, -1496 }, - { 4079, -6464, 2304, 777 }, - { 5621, -9336, 2684, -768 }, - { 5351, -6464, 5238, -214 }, - { 5961, -8007, 1724, -3091 }, - { 4213, -8067, 603, -246 }, - { 7208, -7403, 3168, -1738 }, - { 6098, -7700, 329, -1379 }, - { 6525, -6735, 4248, -1072 }, - { 6073, -6241, 2167, -2378 }, - { 4609, -9218, 3051, -1033 }, - { 6813, -7283, 1581, -1897 }, - { 6126, -6275, 2789, 681 }, - { 4423, -6538, 1621, -1692 }, - { 6272, -8298, 3167, -1855 }, - { 6172, -8558, 4498, -1169 }, - { 4844, -8588, 1647, -366 }, - { 6209, -8807, 1581, -369 }, - { 5389, -8059, 550, -192 }, - { 6654, -9775, 2504, -1063 }, - { 7103, -7998, 806, 530 }, - { 5662, -6736, 1565, -3620 }, - { 4165, -9564, 4191, -2131 }, - { 4526, -7181, 576, -2875 }, - { 4633, -8623, 2807, -4742 }, - { 3709, -7794, 1815, 34 }, - { 3634, -8622, 2313, -826 }, - { 6991, -8447, 2063, -3198 }, - { 7757, -9486, 2255, -558 }, - { 4149, -7778, 4728, -1696 }, - { 5767, -7427, 1113, 707 }, - { 4592, -6261, 2329, 1864 }, - { 3159, -10498, 1677, -4273 }, - { 3534, -9010, 2437, -3565 }, - { 4479, -10821, 2715, -4942 }, - { 3207, -9805, 3054, -3886 }, - { 4627, -8189, 3018, -2354 }, - { 5527, -10566, 3244, -2749 }, - { 4346, -10127, 3335, -3084 }, - { 6132, -10085, 3316, -1308 }, - { 5629, -9704, 2178, -3058 }, - { 3603, -8538, 1246, -624 }, - { 3737, -8488, 395, -3167 }, - { 5465, -11414, 2810, -4640 }, - { 5306, -7745, 2721, -3988 }, - { 7000, -9111, 1695, -1409 }, - { 6663, -7741, 2466, -4079 }, - { 4083, -7175, 1836, -4831 }, - { 3613, -9926, 1342, -3455 }, - { 6588, -8033, 457, -258 }, - { 4720, -8102, 17, -1209 }, - { 7414, -8709, 1294, -344 }, - { 5437, -10030, 4043, -1704 }, - { 4862, -9281, 1558, -1431 }, - { 6800, -6403, 5113, 862 }, - { 4623, -8242, 2667, -228 }, - { 5919, -5083, 3348, 2135 }, - { 5985, -8889, 2733, -5105 }, - { 5029, -5767, 4407, 719 }, - { 354, -6158, -838, -3001 }, - { 351, -5943, -2104, -1534 }, - { -633, -7190, -25, -4798 }, - { -1595, -7235, -3812, -1400 }, - { 103, -6197, -2933, -78 }, - { -1722, -5020, -3441, -4333 }, - { -1963, -5644, -4365, -270 }, - { -846, -5743, -3477, 196 }, - { -191, -5348, -4054, -469 }, - { -2515, -7754, -3495, -818 }, - { -2090, -6710, -2701, 117 }, - { -546, -7036, -1398, 163 }, - { -278, -7091, -2662, -536 }, - { -622, -7962, -2731, -1464 }, - { -1555, -8118, -3612, -2057 }, - { -1094, -6280, -2314, 505 }, - { -2556, -8538, -4024, -2247 }, - { 109, -7134, -3107, -1823 }, - { -900, -6954, -3340, -717 }, - { -605, -7113, -3656, -2154 }, - { 837, -6263, -3211, -2177 }, - { -417, -5810, -3871, -1469 }, - { -1318, -5649, -4207, -3198 }, - { 413, -6765, -2082, -33 }, - { -3101, -6450, -4362, -766 }, - { 755, -6489, -2967, -846 }, - { 1117, -7106, -2452, -1352 }, - { -1202, -8387, -3072, -2897 }, - { -365, -4894, -3561, -2937 }, - { -2372, -8776, -265, -4441 }, - { -1224, -8678, -896, -5074 }, - { -755, -10096, -600, -6623 }, - { 300, -8206, -225, -4568 }, - { -1176, -6824, -2633, -3527 }, - { -2006, -5443, -1526, -5849 }, - { -1115, -5540, -2363, -4785 }, - { 1059, -6812, -2543, -2654 }, - { -1976, -6861, -3062, -5508 }, - { -379, -5328, -2321, -3624 }, - { -2108, -5860, -4518, -1915 }, - { -379, -7885, -1329, -594 }, - { 774, -5389, -581, -5213 }, - { -2601, -5083, -1849, -4921 }, - { -176, -5580, 74, -5075 }, - { -204, -6780, -190, -6232 }, - { 418, -7594, -1987, -820 }, - { -1873, -8529, -2926, -1609 }, - { 1340, -6362, -919, -4975 }, - { 577, -7990, -2044, -1873 }, - { -2572, -7413, -1745, -2224 }, - { -2037, -7030, -1461, -7138 }, - { -2559, -8756, -2039, -5836 }, - { -2079, -6764, -1209, -5669 }, - { -1613, -7801, -2006, -685 }, - { -1865, -6583, -722, -3529 }, - { -589, -6358, -1377, -1003 }, - { -540, -7514, -1331, -3542 }, - { 419, -6192, -1677, -4927 }, - { -2786, -8763, -2966, -5065 }, - { -2172, -8411, -1726, -4675 }, - { -3382, -9833, -3497, -5722 }, - { -2433, -10169, -2077, -5775 }, - { -424, -9451, -1096, -3658 }, - { -537, -8522, -910, -1897 }, - { -5550, 2807, 1683, -693 }, - { -6395, 635, 3573, -1246 }, - { -7544, 2280, 2140, 44 }, - { -8751, 1136, 2951, -794 }, - { -5605, 2709, 2052, 916 }, - { -7650, 654, 869, 135 }, - { -6939, 967, 1409, 870 }, - { -7834, 2123, 3310, 974 }, - { -6935, 2818, 1274, -1678 }, - { -5605, 2233, 1013, 471 }, - { -7095, 1849, 1648, 198 }, - { -6636, 1634, 712, -37 }, - { -7279, 978, 296, -315 }, - { -7664, 3504, 3292, -216 }, - { -7836, 1209, 1221, -257 }, - { -7913, 2201, 1765, -1529 }, - { -7077, 3783, 2632, -1407 }, - { -5565, 1645, 1410, -622 }, - { -6494, 2879, 1181, -759 }, - { -7073, 3137, 3010, 550 }, - { -7249, 1839, 847, -805 }, - { -6630, 2197, 282, -1096 }, - { -8836, 1573, 1988, -1090 }, - { -7809, 1274, 836, -1198 }, - { -7895, 2970, 3511, -1097 }, - { -6960, 1664, 1356, -2442 }, - { -6582, 2866, 2273, 307 }, - { -7221, 821, 2851, -1435 }, - { -6015, 1703, 2001, -2367 }, - { -8082, 1034, 2103, 239 }, - { -5952, 1912, 301, -465 }, - { -6099, 841, 379, 567 }, - { -6343, 50, 494, 658 }, - { -6586, 983, 591, -893 }, - { -5500, 869, 2187, -2479 }, - { -6482, 60, 1545, -979 }, - { -6705, 515, 1974, -53 }, - { -6460, 1755, 1325, -1275 }, - { -6093, 2617, 2465, -623 }, - { -7330, 2161, 594, -2115 }, - { -7324, 762, 1593, -2004 }, - { -6385, 679, 1510, -2514 }, - { -6159, 241, 2976, -1631 }, - { -8583, 3030, 4045, -162 }, - { -6299, 66, 2209, -2103 }, - { -5428, 1279, 3267, -1846 }, - { -6438, 1335, 2728, -1631 }, - { -8012, 1070, 2428, -1151 }, - { -6201, 2781, 2349, -1918 }, - { -5918, 1139, 3121, -148 }, - { -6314, 2481, 3137, -1808 }, - { -7180, 1722, 2435, -1602 }, - { -6750, 1829, 3763, -1145 }, - { -6713, 1777, 2221, 1212 }, - { -7479, 1835, 3627, -479 }, - { -7299, 10, 2406, -1593 }, - { -8249, 3129, 996, -2870 }, - { -8374, 1534, 1333, -1882 }, - { -7507, 3353, 1598, -2299 }, - { -7379, 2701, 2326, -1167 }, - { -8440, 2276, 2796, -542 }, - { -10348, 1527, 2649, -1165 }, - { -8184, 3614, 2574, -1738 }, - { -5539, 1574, 1733, 1138 }, - { 9404, -7652, 67, 79 }, - { 8654, -3972, 1358, -60 }, - { 8617, -4794, 117, 2318 }, - { 7886, -4505, 1784, 1200 }, - { 8636, -6125, 3879, -1003 }, - { 9654, -6836, 1816, 205 }, - { 9374, -6553, 913, 1875 }, - { 8020, -6150, 1134, 2390 }, - { 7786, -4970, 2078, -1857 }, - { 8691, -6119, 711, 708 }, - { 9039, -5568, 2944, -1902 }, - { 9955, -5048, 1433, -601 }, - { 8089, -6927, 3093, -2846 }, - { 8487, -7024, 2415, 19 }, - { 9388, -5287, 3577, -2655 }, - { 8591, -7371, 2300, -996 }, - { 9104, -4763, 1453, -2558 }, - { 7615, -5457, 596, 164 }, - { 9860, -7047, 3433, -614 }, - { 8756, -4404, 2235, -964 }, - { 9462, -4660, 299, -1822 }, - { 10119, -5550, 2689, -1273 }, - { 10915, -7471, 2705, -1007 }, - { 11433, -7090, 1410, -1198 }, - { 9882, -7431, 2965, -1895 }, - { 7628, -5219, 769, -2661 }, - { 8169, -5318, 2262, 70 }, - { 8846, -6320, 1939, -754 }, - { 7147, -5593, 1248, -971 }, - { 10652, -5485, 935, 137 }, - { 7778, -6533, 2564, -1932 }, - { 8878, -5173, 1214, -361 }, - { 9828, -4943, 282, 510 }, - { 10042, -6134, 3895, -1914 }, - { 7965, -6630, 3566, -433 }, - { 8573, -4502, 3574, -1209 }, - { 8398, -4801, 1031, -1347 }, - { 10136, -7772, 2612, 1547 }, - { 9890, -7280, 1768, -1083 }, - { 8407, -6585, -706, -58 }, - { 7976, -7582, 229, -131 }, - { 10481, -8866, 1166, -147 }, - { 10914, -4342, 3189, -2412 }, - { 10440, -5198, -104, -1109 }, - { 11227, -6530, 2381, -2449 }, - { 8487, -8064, 1086, 230 }, - { 9975, -6123, -857, -134 }, - { 8339, -6498, 1232, -2337 }, - { 11042, -4506, 1119, -2098 }, - { 12563, -5592, 1837, -2062 }, - { 11801, -5590, 632, -1296 }, - { 10152, -5617, 1511, -1917 }, - { 7800, -6473, 51, -1337 }, - { 7941, -5560, 2438, -3270 }, - { 6554, -3834, 2100, 1476 }, - { 9065, -5520, -226, -1120 }, - { 10794, -7120, -243, 122 }, - { 10429, -6968, 272, -806 }, - { 8942, -8914, 1442, -392 }, - { 9969, -5051, 2033, -2953 }, - { 7275, -4152, 3058, -64 }, - { 11127, -5488, 4589, -3227 }, - { 9626, -6666, 2739, -2958 }, - { 6943, -5362, 4470, 1008 }, - { -7456, -967, 2936, -1002 }, - { -8622, -333, 6962, 2606 }, - { -7486, -3392, 3668, 1287 }, - { -8053, -827, 5148, 1097 }, - { -6610, 454, 4952, 96 }, - { -7701, -1982, 3161, -468 }, - { -7307, -1132, 4071, -36 }, - { -8125, -271, 5199, 3862 }, - { -9182, -1950, 2813, 1878 }, - { -9855, -952, 4794, 3010 }, - { -7241, 1431, 4202, 2468 }, - { -9646, 157, 4766, 1046 }, - { -9371, 1230, 6009, 2958 }, - { -11514, -64, 8630, 5248 }, - { -6766, 565, 2766, 2140 }, - { -8426, -9, 2852, 1271 }, - { -11291, -1113, 5087, 2937 }, - { -8297, 2092, 4495, 1264 }, - { -9983, 735, 3809, -51 }, - { -9048, -1000, 3191, -308 }, - { -7331, -1987, 2655, 1391 }, - { -7144, -21, 4333, 2161 }, - { -6032, -1540, 3543, 896 }, - { -7987, -1036, 1985, 1529 }, - { -9264, 2004, 5194, 290 }, - { -11308, -840, 5754, 1654 }, - { -9130, -2398, 4292, 2973 }, - { -6248, 838, 3563, 1223 }, - { -6819, -2760, 3511, 119 }, - { -7213, -2006, 4364, 762 }, - { -5431, -1047, 4533, 166 }, - { -7098, -641, 2021, 639 }, - { -8628, -2249, 3588, 399 }, - { -6352, -1498, 3560, -648 }, - { -7033, -2190, 4870, 2562 }, - { -7405, -46, 3772, -581 }, - { -6104, 796, 5143, 1965 }, - { -5787, 943, 5784, 3030 }, - { -8367, 1465, 7192, 4097 }, - { -8259, 789, 5694, 1963 }, - { -10614, -1899, 5748, 2645 }, - { -8258, -805, 3698, 2275 }, - { -6877, -972, 6431, 3160 }, - { -6483, 363, 7018, 3129 }, - { -6283, -1358, 5191, 1524 }, - { -8853, -3157, 4119, 1741 }, - { -6086, -267, 3883, -835 }, - { -7254, 1032, 6613, 4017 }, - { -11470, -3350, 4649, 3426 }, - { -6743, 481, 6148, 1239 }, - { -5394, -166, 5309, 3165 }, - { -7958, 1068, 4268, -240 }, - { -10520, 2256, 7916, 2828 }, - { -5132, -4, 5739, 1176 }, - { -8643, 120, 3255, -629 }, - { -9631, 1974, 8870, 4362 }, - { -10663, -1221, 3733, 589 }, - { -8224, -1843, 5806, 2655 }, - { -8282, 1255, 8647, 3478 }, - { -12311, -1505, 9043, 6256 }, - { -11312, -856, 7136, 4681 }, - { -11944, -722, 7941, 3309 }, - { -7868, -463, 6846, 4196 }, - { -8679, -241, 7410, 5347 }, - { 6759, -4680, -508, 1220 }, - { 5176, -6111, 944, 121 }, - { 6843, -5667, -1368, -533 }, - { 5616, -5884, -1471, -695 }, - { 6030, -5089, -1808, -940 }, - { 7444, -5463, -52, 1881 }, - { 4207, -6079, -506, 1571 }, - { 6785, -4410, -649, 3084 }, - { 4838, -5214, 2026, 2998 }, - { 4201, -5790, 645, 1811 }, - { 6930, -5129, -1940, 1698 }, - { 6332, -4627, 692, 3027 }, - { 6285, -4314, -106, 3644 }, - { 6255, -5450, -1975, 742 }, - { 4199, -4676, -459, 1796 }, - { 5592, -5500, 1345, 1300 }, - { 4358, -5556, -2236, 114 }, - { 4620, -5875, -1563, 888 }, - { 4892, -7550, -327, -419 }, - { 4734, -7085, 7, 613 }, - { 3883, -5562, -1969, 1080 }, - { 5610, -4990, -204, 834 }, - { 4117, -6482, -1271, 341 }, - { 6585, -5107, 892, 1169 }, - { 6632, -3683, 302, 3002 }, - { 6326, -5351, -983, -1250 }, - { 4382, -7192, -730, -158 }, - { 5227, -6540, -451, 1123 }, - { 5468, -6472, -870, -1471 }, - { 5191, -6402, -1365, -127 }, - { 7407, -6317, -973, -336 }, - { 4611, -6530, -820, -1980 }, - { 4963, -5159, -2050, -966 }, - { 4414, -5691, -211, -998 }, - { 5954, -5873, 750, -1749 }, - { 4394, -4796, -1268, 254 }, - { 7161, -6214, -1010, 689 }, - { 4965, -3598, 2372, 1711 }, - { 6248, -6180, 981, 864 }, - { 6473, -5336, 525, -600 }, - { 4591, -6864, -1131, -900 }, - { 6314, -6440, -1021, -375 }, - { 5838, -6209, -1199, 944 }, - { 5308, -5283, -2100, 1267 }, - { 4342, -5860, -1637, -1356 }, - { 5680, -4388, -1227, -104 }, - { 4900, -4098, 1449, 4046 }, - { 4677, -4284, -106, 3190 }, - { 7574, -6173, -848, 1859 }, - { 6493, -7207, -131, 726 }, - { 5513, -5261, -2117, 4 }, - { 6191, -7352, -193, -505 }, - { 5885, -4333, 324, -134 }, - { 6162, -6081, -312, -2044 }, - { 4216, -6200, -1810, -572 }, - { 5652, -7035, -696, -197 }, - { 7131, -7189, -366, -60 }, - { 5032, -4803, -1514, 2832 }, - { 7386, -4610, -606, 3489 }, - { 4211, -5031, 1221, 3047 }, - { 4050, -4653, 1584, 1469 }, - { 6852, -5302, -1861, 206 }, - { 7736, -4816, -1794, 3359 }, - { 6290, -3439, 1522, 2454 }, - { 1768, 5990, -5560, -2594 }, - { 3903, 5326, -1530, -1501 }, - { 2472, 3738, -2117, -4240 }, - { 3260, 5448, -904, -4733 }, - { 1435, 7297, -3676, -4102 }, - { 4096, 5951, -656, -3312 }, - { 2178, 6009, -3146, -3724 }, - { 3787, 5493, -5473, -1633 }, - { 2998, 7286, -3334, -3571 }, - { 2894, 6576, -4708, -2804 }, - { 830, 6163, -4286, -3348 }, - { 4755, 5569, -1730, -2739 }, - { 4604, 6065, -3562, -2605 }, - { 2749, 5141, -3986, -2775 }, - { 3942, 4875, -2143, -3340 }, - { 2819, 8517, -2004, -2724 }, - { 2146, 6298, -689, -3093 }, - { 5196, 6504, -3393, -1475 }, - { 1851, 8386, -1748, -1420 }, - { 3474, 8572, -3534, -2688 }, - { 4503, 7560, -3561, -2245 }, - { 4433, 6219, -2393, -1575 }, - { 3506, 7248, -2275, -1977 }, - { 3490, 7409, -3147, -604 }, - { 4214, 6447, -3520, 516 }, - { 619, 7034, -829, -1705 }, - { 1732, 7395, -356, -2208 }, - { 1226, 5204, -3294, -3732 }, - { 2027, 5619, -1813, -4146 }, - { 3078, 5877, 47, -2651 }, - { 1654, 5458, 424, -682 }, - { 3163, 5464, -2026, -270 }, - { 2884, 5375, -685, -530 }, - { 2950, 7286, -35, -2967 }, - { 1986, 5066, -597, 482 }, - { 3459, 4308, -3845, -2333 }, - { 3155, 7037, -1346, -4345 }, - { 2193, 6696, -717, -1319 }, - { 3677, 5089, -3892, -487 }, - { 2186, 5136, -4186, -1492 }, - { 773, 5796, -917, 817 }, - { 2489, 6546, -3570, -2117 }, - { 1223, 6469, -1362, -33 }, - { 271, 6061, -1466, -1725 }, - { 2540, 5171, -1847, 1032 }, - { 2548, 5251, -2697, 1677 }, - { 771, 7600, -768, -632 }, - { 4710, 6647, -4736, -1275 }, - { 1369, 5917, -2971, -1056 }, - { 163, 5239, -3499, -2275 }, - { 2104, 4285, -3211, -3286 }, - { 1107, 7411, -1972, -1671 }, - { 2196, 7262, -2310, -1926 }, - { -244, 6439, -1745, -839 }, - { 3293, 3832, -2890, -3000 }, - { 419, 6443, -379, -407 }, - { 3077, 4930, -1156, -2869 }, - { 2131, 5874, -2330, 224 }, - { 690, 6538, -2212, -2841 }, - { 1602, 4421, -2515, 1542 }, - { 3318, 9373, -3032, -3477 }, - { 5646, 7462, -5153, -1463 }, - { 4139, 7137, -1539, -3321 }, - { 3481, 9077, -1645, -3653 }, - { -7747, 375, -106, -543 }, - { -8587, -1379, -586, -461 }, - { -10146, -892, 2094, 694 }, - { -8103, 382, 504, -325 }, - { -8548, -92, 94, -656 }, - { -7460, 38, 152, 388 }, - { -8266, -271, -459, -883 }, - { -7935, -664, -1026, -802 }, - { -8341, -109, 853, 161 }, - { -8802, -1355, 1099, 630 }, - { -8957, -6, 1108, -669 }, - { -7260, -1520, -43, -407 }, - { -7555, -174, 668, -2562 }, - { -9014, -126, 227, -1191 }, - { -8184, 769, 290, -1375 }, - { -9476, 55, 962, -1528 }, - { -8679, 541, 755, -1030 }, - { -9842, -1626, 838, -1588 }, - { -8513, -702, 788, -1998 }, - { -10101, -1558, -366, -1841 }, - { -8135, 78, 1479, -1813 }, - { -9128, -454, 313, -1786 }, - { -7554, -1084, 831, -2442 }, - { -7576, -701, 2068, -1665 }, - { -7791, -1481, 1587, -1808 }, - { -6701, -596, -97, 802 }, - { -7418, -15, 684, -963 }, - { -7127, -477, -139, -426 }, - { -8097, -110, -36, -264 }, - { -7620, -1922, -590, -101 }, - { -7647, -1201, 279, 660 }, - { -7856, -1974, 758, -2271 }, - { -8496, -167, 2232, -1143 }, - { -8506, -1359, 624, -740 }, - { -7274, -1052, 1062, -139 }, - { -7800, -217, 91, -1794 }, - { -7030, -1694, -955, 615 }, - { -9020, -1864, 101, -2182 }, - { -9400, -740, 598, -667 }, - { -8448, -1184, 2024, -1272 }, - { -8812, -570, -897, -2384 }, - { -10559, -1286, 538, -1536 }, - { -8728, -888, -1089, -1397 }, - { -7080, -1185, 636, -1252 }, - { -9880, 233, 2344, -782 }, - { -7952, -1326, -378, -1947 }, - { -7207, -378, 1408, -2237 }, - { -8467, -1545, 902, -1987 }, - { -9163, -1474, 924, -1739 }, - { -8159, -992, -77, -2744 }, - { -8343, 148, -423, -1573 }, - { -9105, -649, -254, -1214 }, - { -8939, 456, 281, -1905 }, - { -8837, 179, -394, -2634 }, - { -9145, 757, 1547, -1319 }, - { -9775, -723, 441, -1680 }, - { -8910, -686, 1529, -1525 }, - { -9492, -1134, 2064, -938 }, - { -6111, -943, 677, -31 }, - { -7411, -613, -814, 46 }, - { -9479, -922, -430, -2061 }, - { -11298, -1268, 1318, -1117 }, - { -8190, 832, 671, -2214 }, - { -10453, -550, 1672, -886 }, - { 1044, 9353, -1651, -5423 }, - { 1034, 8149, -455, -6166 }, - { 761, 8293, -3214, -4838 }, - { 938, 8077, 164, -5130 }, - { 1295, 8673, 2582, -5490 }, - { -314, 7973, -2395, -5231 }, - { -507, 9012, -2497, -5775 }, - { 2396, 8314, -1022, -4673 }, - { -1516, 8501, 1950, -4969 }, - { -308, 7401, 1549, -4866 }, - { -112, 8340, 3003, -4920 }, - { -50, 9315, 1371, -5666 }, - { -659, 9449, 2496, -5547 }, - { 2573, 9148, -2270, -4783 }, - { 830, 7104, -438, -3907 }, - { 522, 10672, -677, -6483 }, - { -1190, 10108, -510, -6518 }, - { -427, 8271, -579, -6315 }, - { 1602, 8113, -1927, -4418 }, - { -2266, 8180, 448, -5190 }, - { -1633, 8816, -226, -5771 }, - { 759, 9481, -105, -5813 }, - { 2254, 6679, -466, -5662 }, - { -88, 6946, 895, -5958 }, - { -1705, 10009, 1394, -5574 }, - { 748, 7943, 540, -6692 }, - { 1411, 7009, 232, -6145 }, - { 697, 7290, -1221, -5342 }, - { -1764, 10580, 1944, -3981 }, - { -1334, 9124, 1195, -3903 }, - { -905, 10067, 635, -5039 }, - { 664, 10680, 49, -4625 }, - { 1374, 9536, -777, -3591 }, - { 252, 9698, -597, -2931 }, - { 824, 9164, -1014, -2144 }, - { 2438, 10569, -2289, -4424 }, - { 2101, 7102, 507, -3614 }, - { 294, 8051, -432, -1518 }, - { -665, 10337, 547, -2852 }, - { 1168, 11989, -492, -5427 }, - { 1344, 6416, 302, -5061 }, - { -1727, 12264, 1507, -4543 }, - { 674, 10889, -902, -3605 }, - { -582, 9504, 300, -3618 }, - { 641, 7654, 689, -2109 }, - { 2065, 9243, 508, -4367 }, - { 1055, 8373, 688, -3144 }, - { -641, 8185, 986, -3307 }, - { 1120, 7426, 1785, -3757 }, - { 1660, 8070, -593, -3104 }, - { 2002, 9467, -1722, -3475 }, - { 2361, 8368, 100, -3709 }, - { -772, 7845, -613, -4988 }, - { 1485, 7430, 1896, -6127 }, - { -432, 7823, -947, -2882 }, - { 313, 11122, -760, -4871 }, - { 412, 8412, -283, -4231 }, - { 1585, 10402, -1884, -3267 }, - { 321, 6952, 773, -3016 }, - { -105, 9014, 121, -2249 }, - { 1585, 10313, -977, -4812 }, - { 1619, 11869, 1306, -6876 }, - { -1168, 8886, -81, -2500 }, - { -395, 10886, 733, -6490 }, - { -4949, 4274, 3992, -1054 }, - { -4241, 5299, 4262, -1584 }, - { -2710, 3862, 4552, -1673 }, - { -4608, 2472, 3672, -1715 }, - { -2843, 2816, 4003, -2326 }, - { -5229, 2964, 5636, 90 }, - { -4924, 3442, 5015, -1096 }, - { -1281, 3313, 5537, -2066 }, - { -3808, 1939, 4351, -919 }, - { -1915, 2585, 4939, -1614 }, - { -3470, 1843, 5562, -682 }, - { -3800, 870, 5827, 144 }, - { -4985, 1452, 4728, -709 }, - { -3745, 2750, 7220, 259 }, - { -1875, 1900, 6514, -826 }, - { -4329, 1574, 7192, 1304 }, - { -5408, 1444, 6208, 631 }, - { -3327, 5312, 5707, -1541 }, - { -6966, 3334, 4034, 1028 }, - { -7484, 4245, 4218, -212 }, - { -6567, 5839, 4539, -512 }, - { -5715, 5935, 3747, -1186 }, - { -6410, 4881, 3356, -1610 }, - { -5146, 2590, 2850, 2172 }, - { -5196, 4095, 2569, -373 }, - { -5043, 6025, 4318, 692 }, - { -5525, 4884, 3513, 370 }, - { -6804, 7533, 5812, -488 }, - { -5657, 2480, 4061, 1234 }, - { -3155, 1472, 6071, 1188 }, - { -3427, 5217, 3442, 858 }, - { -4698, 3013, 5517, 2586 }, - { -4449, 2226, 5418, 3580 }, - { -6395, 3547, 5487, 2028 }, - { -3500, 5019, 4787, 1 }, - { -4038, 2578, 3073, 3151 }, - { -2750, 1955, 4469, 3856 }, - { -5696, 1659, 6118, 2469 }, - { -4350, 1241, 6840, 3126 }, - { -5565, 5058, 5196, 1314 }, - { -1642, 4190, 3948, 607 }, - { -1233, 4108, 4850, -640 }, - { -997, 3428, 3239, 1378 }, - { -6488, 2741, 6926, 2792 }, - { -4188, 3763, 4235, 2018 }, - { -3210, 3224, 5646, 1427 }, - { -5526, 6909, 5070, -627 }, - { -2815, 3994, 3425, 1903 }, - { -2163, 2734, 5423, 145 }, - { -4149, 4247, 2355, 734 }, - { -410, 2521, 4138, -16 }, - { -2411, 2385, 4927, 2105 }, - { -6077, 3591, 3114, 594 }, - { -4186, 4834, 5926, -1004 }, - { -7315, 3369, 5966, 448 }, - { -7042, 5721, 5771, 238 }, - { -4466, 3907, 3535, -1751 }, - { -2116, 3970, 6163, -1392 }, - { -7239, 2143, 8407, 3630 }, - { -5431, 4486, 6486, -42 }, - { -1874, 1617, 6333, 519 }, - { -6478, 2629, 4634, -505 }, - { -7784, 2342, 7216, 1365 }, - { -1154, 1432, 4831, 1544 }, - { -4964, -5801, 1797, 506 }, - { -4436, -6905, 1059, -1237 }, - { -5400, -6886, 884, -290 }, - { -6259, -7103, 523, -227 }, - { -4819, -6450, 1412, -450 }, - { -4056, -6213, 1725, -943 }, - { -5642, -6091, 1357, 605 }, - { -4196, -5678, 2187, -173 }, - { -4726, -5126, 2470, 321 }, - { -6642, -5091, 1507, -1005 }, - { -5304, -5250, 1944, 1579 }, - { -7179, -5520, 1468, -425 }, - { -6033, -4895, 1876, -955 }, - { -6595, -5143, 2207, 1291 }, - { -4224, -4943, 1846, 1792 }, - { -7128, -6950, 539, 724 }, - { -4369, -4901, 2590, 1103 }, - { -7413, -5696, 1712, 1440 }, - { -5885, -6821, 418, 871 }, - { -6828, -5599, 710, -1563 }, - { -6123, -5817, 1358, 1631 }, - { -5291, -5622, 578, 2138 }, - { -7171, -6004, 347, 2208 }, - { -6083, -5251, 2132, 425 }, - { -4329, -5721, 407, -2993 }, - { -5326, -5056, 1119, -1837 }, - { -5485, -5856, 185, -2389 }, - { -6529, -5178, 403, -697 }, - { -6719, -4412, 2726, 871 }, - { -5126, -5629, 1835, -771 }, - { -5622, -4361, 2973, 858 }, - { -5282, -5895, 45, -335 }, - { -4357, -5656, 1696, -1558 }, - { -7139, -6659, 627, -409 }, - { -4415, -6328, 35, 1306 }, - { -7639, -6110, 1134, 197 }, - { -3626, -5592, 2019, 901 }, - { -3547, -5064, 1176, 1738 }, - { -5075, -3899, 2087, 266 }, - { -4086, -6311, 1479, 360 }, - { -6210, -5220, -199, -1477 }, - { -3910, -5063, 1356, -15 }, - { -7616, -4977, 461, 2401 }, - { -6118, -6131, 1258, -563 }, - { -6127, -4968, 1286, -27 }, - { -4121, -5852, 1113, 1476 }, - { -5157, -4881, 1162, -662 }, - { -4637, -5031, 1179, 709 }, - { -5509, -5452, -397, 1224 }, - { -4597, -6861, 646, 467 }, - { -6247, -4043, 468, 278 }, - { -5336, -6465, 874, -1472 }, - { -6998, -6346, 78, -1798 }, - { -4915, -4530, 2756, -203 }, - { -6048, -4373, 1468, 1052 }, - { -4273, -7100, 942, -323 }, - { -6552, -4287, 2351, 69 }, - { -6954, -4613, 722, 1521 }, - { -4201, -5361, 763, -1562 }, - { -6881, -5596, -748, 669 }, - { -6695, -3547, -34, 1299 }, - { -3981, -5728, 84, 111 }, - { -4663, -4809, 2173, -1031 }, - { -6599, -6077, 1303, 256 }, - { -7596, -4265, -5791, -4140 }, - { -6610, -2758, -5288, -3936 }, - { -5880, -3865, -6563, -3088 }, - { -7228, -5510, -7677, -3912 }, - { -8854, -6553, -8318, -5361 }, - { -9362, -5249, -6413, -4319 }, - { -4418, -3110, -6368, -4358 }, - { -5544, -4203, -6863, -5013 }, - { -3056, -4316, -5567, -3181 }, - { -3078, -5999, -5051, -2657 }, - { -5884, -6292, -5756, -4013 }, - { -4825, -4549, -5535, -4053 }, - { -4443, -6126, -5316, -1368 }, - { -3972, -6341, -6098, -2686 }, - { -5751, -2781, -5398, -6230 }, - { -4466, -6135, -5570, -3679 }, - { -4291, -5992, -3564, -5189 }, - { -7189, -4429, -7279, -6082 }, - { -5076, -4433, -2748, -5366 }, - { -6225, -2825, -6833, -5663 }, - { -2989, -4792, -3960, -4492 }, - { -7836, -7773, -7722, -5741 }, - { -6559, -5703, -5844, -5589 }, - { -7612, -5438, -4136, -3774 }, - { -4218, -4176, -6591, -2333 }, - { -4837, -5063, -6581, 322 }, - { -6590, -5990, -2980, -3847 }, - { -5558, -2971, -5489, -1932 }, - { -7001, -5323, -4975, -1697 }, - { -4694, -2688, -6904, -3044 }, - { -8511, -5379, -5767, -2549 }, - { -7548, -5412, -6522, -2572 }, - { -6597, -4973, -6423, -1274 }, - { -6415, -4022, -5168, -1072 }, - { -5528, -5530, -7218, -2345 }, - { -4845, -4805, -5943, -1227 }, - { -6049, -7150, -6744, -2161 }, - { -9061, -7299, -8542, -4375 }, - { -5010, -5546, -5416, -82 }, - { -4135, -4205, -5109, -3373 }, - { -3311, -5869, -4007, -5061 }, - { -5993, -6472, -3962, -4718 }, - { -2966, -5832, -2821, -6305 }, - { -4851, -5152, -2067, -3930 }, - { -3620, -4441, -3362, -5836 }, - { -4469, -5221, -4534, -5592 }, - { -4022, -6335, -4321, -6107 }, - { -4899, -4503, -3084, -3725 }, - { -4490, -8276, -4620, -6236 }, - { -6591, -4342, -7365, -4063 }, - { -6498, -5057, -5553, 485 }, - { -6060, -2714, -7093, -4144 }, - { -6199, -7774, -7094, -4057 }, - { -7536, -6424, -6415, -4265 }, - { -7439, -2454, -6348, -4827 }, - { -5333, -7565, -4417, -4639 }, - { -4353, -7103, -4197, -2689 }, - { -5229, -6549, -5129, -6804 }, - { -6129, -7701, -5236, -4836 }, - { -6797, -3983, -3884, -4406 }, - { -6624, -4467, -4745, -5052 }, - { -3324, -7596, -2720, -6553 }, - { -5473, -6284, -1704, -4511 }, - { -4131, -7263, -3180, -5196 }, - { -7116, -5565, -3469, 685 }, - { -6002, -6021, -3858, 576 }, - { -3144, -8203, -1291, -434 }, - { -6096, -7027, -4004, 1353 }, - { -3943, -7709, -2344, -36 }, - { -4510, -6767, -2642, 631 }, - { -3657, -11541, -2570, -3984 }, - { -5959, -8854, -1333, -867 }, - { -6699, -8866, -1606, -344 }, - { -3836, -7961, -2334, -2028 }, - { -3430, -8045, -3037, -672 }, - { -3868, -9184, -3635, -1819 }, - { -4258, -9060, -2621, -1008 }, - { -3595, -8693, -2022, -752 }, - { -4573, -8048, -3166, -2622 }, - { -4852, -7903, -1405, 256 }, - { -4591, -7057, -1560, 965 }, - { -6963, -7655, -980, 808 }, - { -5179, -6641, -3356, 1196 }, - { -7102, -6941, -2798, 2123 }, - { -6867, -5834, -3320, -770 }, - { -5977, -7369, -2500, -778 }, - { -6160, -6400, -934, -2543 }, - { -6741, -7608, -355, -1289 }, - { -6856, -6466, -1433, -1643 }, - { -4786, -6292, -4970, 376 }, - { -5407, -8866, -2255, -400 }, - { -3814, -6506, -1387, -3620 }, - { -4998, -6137, -1200, -4092 }, - { -5123, -9557, -2849, -1306 }, - { -4259, -6444, -4395, -338 }, - { -5221, -6810, -883, 1225 }, - { -6137, -6215, -2165, 554 }, - { -3895, -6557, -3176, -1829 }, - { -3886, -8188, -87, -954 }, - { -7243, -6707, -2216, -316 }, - { -5592, -7606, 85, -432 }, - { -3957, -7945, -504, -144 }, - { -4617, -7624, 218, -312 }, - { -4797, -8737, -844, -1051 }, - { -4478, -8516, -1401, -454 }, - { -4557, -7058, -302, -2332 }, - { -6623, -7736, -271, -50 }, - { -3157, -7532, -1111, -2207 }, - { -3590, -7300, -1271, 517 }, - { -4442, -7306, -507, 590 }, - { -6458, -7524, -2807, 666 }, - { -4991, -8466, -3363, -785 }, - { -7474, -7541, -1056, -1839 }, - { -7501, -8316, -938, -180 }, - { -5329, -7739, -579, -2341 }, - { -4549, -7063, -176, -3539 }, - { -5191, -8612, -1504, -4250 }, - { -3083, -7058, -2251, 32 }, - { -4003, -7043, -1093, -791 }, - { -5523, -8093, -678, -114 }, - { -3022, -10265, -2070, -3109 }, - { -3905, -6274, -182, -3652 }, - { -3269, -9217, -551, -2650 }, - { -3138, -9314, -1726, -1704 }, - { -4420, -10339, -1744, -3459 }, - { -4163, -8609, -2298, -4113 }, - { -5566, -6505, -1241, -463 }, - { -3130, -9746, -2352, -4884 }, - { -7825, -3439, 1451, -1468 }, - { -8451, -3318, 2360, -435 }, - { -8462, -4130, 1438, -1024 }, - { -9425, -4564, 1328, -689 }, - { -11014, -3202, 2278, 2080 }, - { -8269, -2761, -146, -440 }, - { -7497, -2618, -166, 413 }, - { -8250, -3060, 522, -2133 }, - { -8365, -5366, 1347, -451 }, - { -8589, -3979, 2943, 714 }, - { -8111, -2572, 1272, -1748 }, - { -7830, -5193, 605, -1484 }, - { -8119, -4736, 2141, 256 }, - { -7724, -4769, 1463, -812 }, - { -7363, -3911, 2540, 4 }, - { -7974, -3397, 2363, 1366 }, - { -7359, -4204, 1752, -958 }, - { -7622, -3505, 660, 916 }, - { -9934, -3665, 3165, 828 }, - { -8721, -4162, 62, 1718 }, - { -9433, -4768, 2722, 1234 }, - { -7960, -4496, 138, 1528 }, - { -8198, -3454, -443, 631 }, - { -7756, -2246, 655, 1137 }, - { -8841, -3145, 1113, 829 }, - { -7817, -3298, 1251, 230 }, - { -9413, -2733, 323, -1862 }, - { -9408, -4168, 1270, 1549 }, - { -9037, -3892, -942, 283 }, - { -8255, -3849, 1301, 1762 }, - { -9057, -3987, -41, -682 }, - { -9441, -4187, 2019, -111 }, - { -9740, -3178, 1602, -871 }, - { -8344, -2474, 1461, 1506 }, - { -9752, -2925, 1996, 1243 }, - { -9199, -3796, 180, 537 }, - { -9060, -2405, 1140, -1562 }, - { -9348, -2376, 309, -162 }, - { -10786, -3182, -5, -1500 }, - { -8142, -4540, -434, -826 }, - { -7528, -2341, 1104, -73 }, - { -9360, -2658, 3062, 56 }, - { -8267, -2335, 2000, -1193 }, - { -12169, -3154, 1287, -640 }, - { -11398, -2120, 946, -1163 }, - { -8940, -4559, 328, -1696 }, - { -11025, -4213, 2813, 840 }, - { -9224, -3581, 2224, 2039 }, - { -8943, -3337, 1248, -1298 }, - { -7900, -4042, 485, -2080 }, - { -9221, -1947, 2191, -880 }, - { -10762, -1800, 2516, -324 }, - { -10095, -2238, 981, -1335 }, - { -11908, -2808, 3255, 645 }, - { -10640, -4105, 1283, -595 }, - { -7663, -2863, 2467, -797 }, - { -10712, -3854, 3710, 1538 }, - { -10823, -2893, 1408, -801 }, - { -9874, -3832, 256, -1638 }, - { -10394, -3391, 2315, -94 }, - { -11525, -4079, 4153, 2122 }, - { -9546, -2088, 1541, 481 }, - { -8731, -2433, 1042, 2160 }, - { -7852, -3977, -1370, 1677 }, - { 7072, -3420, 1398, -1741 }, - { 6180, -1976, 1280, -3557 }, - { 7692, -1793, 2844, -1700 }, - { 8363, -1773, 3104, -2679 }, - { 9213, -3266, 3756, -3542 }, - { 9650, -2644, 1426, -1318 }, - { 7712, -2796, 3686, -1975 }, - { 7316, -3517, 2821, -622 }, - { 7434, -2594, 2305, -2264 }, - { 7237, -1797, 255, -3114 }, - { 8663, -1983, 1338, -3056 }, - { 6616, -952, 4059, -2652 }, - { 8823, -1327, 1362, -1356 }, - { 9938, -1722, 1287, -2362 }, - { 7207, -1057, 1913, -1315 }, - { 7508, -1585, 870, -1982 }, - { 8217, -3680, 1417, -3170 }, - { 8329, -2541, 1684, -585 }, - { 8062, -2335, 252, -2800 }, - { 8204, -4108, 3097, -2569 }, - { 7701, -3367, 576, -3008 }, - { 7350, -786, 2414, -2129 }, - { 6948, -2568, 1607, -225 }, - { 7684, -2387, 1308, -3449 }, - { 8306, -3458, 2394, -1454 }, - { 8438, -2781, 1043, -1362 }, - { 9175, -2076, 2144, -1987 }, - { 8347, -2709, 3489, -4301 }, - { 5696, -2377, 2870, 851 }, - { 8825, -1243, 2219, -2603 }, - { 8801, -1614, 584, -2513 }, - { 8413, -384, 1421, -2244 }, - { 9228, -3050, 3279, -2164 }, - { 6342, -2698, 3547, -107 }, - { 10053, -2476, 2837, -3168 }, - { 7439, -604, 3177, -3991 }, - { 7749, -1064, 4329, -4855 }, - { 8655, -2177, 2252, -3519 }, - { 8490, -228, 1958, -3233 }, - { 10513, -2968, 1911, -2340 }, - { 8146, -862, 1884, -1723 }, - { 7788, -666, 3004, -2891 }, - { 7785, -1620, 4133, -3417 }, - { 10262, -3731, 3455, -2971 }, - { 8570, -905, 4519, -4649 }, - { 9129, -2562, 463, -2465 }, - { 9451, -3587, 1904, -3056 }, - { 6549, -2236, 3010, -4523 }, - { 7175, -2684, 2967, -3458 }, - { 9872, -3278, 1054, -2472 }, - { 9153, -931, 1217, -2565 }, - { 8789, -3469, 753, -2568 }, - { 6683, -3791, 1797, -3968 }, - { 6801, -1977, 2311, -452 }, - { 6336, -1572, 2612, -3264 }, - { 7996, -1008, 730, -2964 }, - { 7521, -1059, 1573, -3694 }, - { 8148, -3973, 2600, -3572 }, - { 7765, -1532, 2528, -3856 }, - { 7404, -3918, 4472, -143 }, - { 8894, -1398, 3299, -3685 }, - { 5768, -2041, 1487, -637 }, - { 5131, -2865, 2463, -811 }, - { 6439, -1568, 3500, -1550 }, - { -8878, -6798, -5319, -1452 }, - { -6332, -9713, -3112, -990 }, - { -8444, -6316, -3694, -687 }, - { -6123, -10840, -3637, -4358 }, - { -4784, -9580, -4577, -2581 }, - { -6108, -10515, -4859, -2524 }, - { -7605, -7518, -2327, -2797 }, - { -9662, -8775, -2467, -2010 }, - { -6494, -7523, -4715, -118 }, - { -8290, -8982, -1672, -317 }, - { -8798, -11051, -3888, -1426 }, - { -6273, -6623, -6791, -142 }, - { -8313, -7668, -2141, -1275 }, - { -6453, -8412, -3589, -4102 }, - { -6747, -7750, -5690, -2498 }, - { -7814, -6693, -3174, -2446 }, - { -10383, -10130, -3931, -2364 }, - { -10606, -8467, -5539, -2772 }, - { -9475, -6671, -3305, -2271 }, - { -8982, -9457, -5635, -4005 }, - { -10111, -7965, -6515, -4180 }, - { -7301, -6479, -5364, 720 }, - { -9543, -8999, -7921, -912 }, - { -9534, -8562, -3469, -384 }, - { -7601, -10344, -3205, -1127 }, - { -8088, -8620, -4954, -2888 }, - { -8202, -8406, -7038, -3775 }, - { -7312, -8324, -3334, -1775 }, - { -8566, -9262, -8071, -4174 }, - { -7068, -11300, -5573, -2907 }, - { -8295, -8952, -4366, -1544 }, - { -11104, -10210, -2285, -384 }, - { -5213, -7520, -5008, -1339 }, - { -5889, -7940, -5987, -1385 }, - { -10816, -8201, -4153, -1485 }, - { -10277, -8919, -6315, -1652 }, - { -5888, -10320, -3821, -1733 }, - { -10497, -7181, -6083, -3032 }, - { -7721, -9724, -6591, -5336 }, - { -5688, -7894, -3486, -2552 }, - { -10014, -10500, -3247, -820 }, - { -6301, -8765, -4506, -2923 }, - { -8261, -7847, -6213, -1552 }, - { -10212, -7481, -8113, -3954 }, - { -6938, -10874, -6074, -4703 }, - { -7183, -10968, -4446, -1773 }, - { -7120, -9193, -1966, -2509 }, - { -6234, -9263, -2313, -4284 }, - { -8503, -9857, -2429, -608 }, - { -9372, -7844, -8391, -2120 }, - { -7951, -7157, -6535, -11 }, - { -7256, -9473, -2172, -660 }, - { -10063, -9612, -2515, -15 }, - { -6684, -9134, -6109, -4206 }, - { -8204, -11932, -5220, -2306 }, - { -9710, -6706, -4115, -3275 }, - { -6855, -7078, -2409, -4447 }, - { -7344, -7673, -4479, -4116 }, - { -8851, -6842, -4927, -2948 }, - { -8927, -10452, -5633, -2194 }, - { -8627, -9002, -7176, -1575 }, - { -8209, -9722, -7021, -3324 }, - { -3770, -10249, -3623, -4816 }, - { -8183, -7465, -4090, 646 }, - { -8163, -7149, 200, 498 }, - { -8289, -6266, 686, -206 }, - { -10030, -6241, -1032, -1864 }, - { -8793, -8327, -773, -169 }, - { -9149, -6215, 969, -15 }, - { -8303, -5859, -7, 2006 }, - { -9682, -7283, 255, 1322 }, - { -9293, -7227, 71, -231 }, - { -8525, -6215, 287, -837 }, - { -10477, -5379, 1159, 1449 }, - { -10726, -7856, -130, 102 }, - { -8694, -7461, -1210, 690 }, - { -9367, -5324, 1103, 3170 }, - { -10686, -8055, -831, 1633 }, - { -9201, -6873, -2704, 2258 }, - { -8421, -5358, -1405, 226 }, - { -9066, -5830, -307, -1571 }, - { -11150, -7381, -2746, -900 }, - { -9978, -5925, -2006, -437 }, - { -9464, -4741, -273, 1061 }, - { -10543, -6684, -1113, 1660 }, - { -10073, -5576, 1083, -269 }, - { -8826, -5763, 1600, 1486 }, - { -10445, -9071, -1253, -64 }, - { -12085, -5799, 2, 769 }, - { -12939, -6663, 1650, 1437 }, - { -10932, -6434, -1252, -649 }, - { -11650, -7826, -2053, 710 }, - { -12122, -6733, -1889, -731 }, - { -9093, -6095, -2463, -842 }, - { -10977, -4364, 469, 420 }, - { -11488, -6908, -521, 893 }, - { -9669, -5478, -842, 337 }, - { -10606, -5203, -632, -1361 }, - { -10198, -6284, 1662, 1277 }, - { -10135, -5292, 2435, 3493 }, - { -11027, -6561, 655, 56 }, - { -10977, -5030, 1127, -358 }, - { -12766, -3986, 1348, -335 }, - { -14244, -7731, 264, 317 }, - { -15124, -10309, -508, 1447 }, - { -12821, -8638, -608, 137 }, - { -13076, -8693, -2852, -431 }, - { -11156, -5546, -2252, -1600 }, - { -8692, -7366, -819, -1223 }, - { -12507, -9816, -1714, -121 }, - { -10712, -6666, 544, 3349 }, - { -12462, -5890, -2491, -2318 }, - { -12468, -7226, 437, 232 }, - { -11300, -5226, 2068, 687 }, - { -11994, -8320, -626, 2728 }, - { -12222, -5476, 1142, 18 }, - { -10277, -8122, -2418, 2003 }, - { -13418, -6115, -3563, -2802 }, - { -14759, -9834, -1243, 21 }, - { -13699, -5665, 1525, 507 }, - { -16269, -9476, -701, 163 }, - { -12677, -5437, -247, -1019 }, - { -11827, -4295, -181, -1243 }, - { -12847, -4496, 2984, 1123 }, - { -13860, -7915, -1166, -547 }, - { -12276, -8145, -2290, -1527 }, - { -11417, -4830, 2983, 1854 }, - { -11793, -6002, 1163, 1940 }, - { 11443, -4920, -3235, 3151 }, - { 11300, -6616, -1506, 1175 }, - { 9198, -4628, -2060, 2390 }, - { 10532, -4027, -643, 912 }, - { 9902, -3573, -1606, 1327 }, - { 9653, -3536, -2240, 1869 }, - { 9948, -5171, -423, 2662 }, - { 12316, -4004, -1989, 281 }, - { 12125, -4800, -1265, -163 }, - { 10650, -2617, -2337, 1462 }, - { 9909, -4968, -2376, 916 }, - { 12944, -4647, -1958, 460 }, - { 12988, -5283, -1141, 41 }, - { 12321, -2915, -3621, 1025 }, - { 11449, -2894, -2728, 351 }, - { 12087, -3041, -2002, -32 }, - { 11558, -4031, -1343, -399 }, - { 12983, -3740, -3516, 1245 }, - { 12099, -2515, -2752, 225 }, - { 12515, -3465, -2701, 550 }, - { 14683, -5022, -5272, 2996 }, - { 12260, -3383, -1215, -528 }, - { 13810, -5422, -2443, 1166 }, - { 13421, -5378, -1886, 721 }, - { 12961, -4259, -2594, 796 }, - { 12266, -2104, -4768, 1591 }, - { 13523, -4710, -3045, 1342 }, - { 12437, -2099, -5610, 2117 }, - { 11850, -2183, -3497, 661 }, - { 12275, -3936, -597, -697 }, - { 12459, -5253, -517, -544 }, - { 12835, -4094, -1322, -168 }, - { 14360, -5677, -3305, 1859 }, - { 13905, -4552, -4309, 2117 }, - { 11559, -3412, -1847, -81 }, - { 13379, -3167, -5764, 2746 }, - { 11910, -1634, -4342, 1052 }, - { 12662, -4742, 71, -974 }, - { 13057, -3254, -4424, 1705 }, - { 15046, -5706, -4851, 3019 }, - { 14162, -4142, -5514, 2843 }, - { 12764, -1845, -6684, 2888 }, - { 13714, -2374, -7838, 3857 }, - { 13295, -1663, -8293, 4073 }, - { 10032, -4152, -3403, 1421 }, - { 10942, -5386, -2222, 950 }, - { 10532, -6385, -1750, 1925 }, - { 10273, -5972, -1534, 643 }, - { 10605, -4782, -1695, 27 }, - { 10988, -5153, -1123, -341 }, - { 11629, -5884, -1060, 48 }, - { 10441, -4045, -2431, 311 }, - { 10788, -3595, -4171, 1807 }, - { 12110, -5686, -2127, 976 }, - { 11746, -4773, -2639, 891 }, - { 11541, -5299, -3031, 1732 }, - { 11416, -2559, -5359, 2198 }, - { 11583, -5376, -704, 677 }, - { 10416, -3214, -3516, 872 }, - { 9651, -5435, -1618, 3255 }, - { 9973, -5133, -996, 3923 }, - { 11707, -4643, -430, -796 }, - { 10994, -2709, -3587, 2302 }, - { 10716, -5118, -645, 270 }, - { 14100, -10314, 1095, 1531 }, - { 12944, -8049, 1105, -741 }, - { 13276, -7035, -511, 274 }, - { 14008, -7254, -283, 139 }, - { 11594, -6536, -91, 1671 }, - { 11732, -8645, 746, 15 }, - { 14613, -7085, -1578, 1183 }, - { 13083, -6224, -750, -4 }, - { 13988, -6256, -1592, 820 }, - { 14678, -8683, 441, 126 }, - { 15571, -8872, -521, 1139 }, - { 15642, -9533, 341, 697 }, - { 15960, -9586, -168, 1121 }, - { 15464, -10239, 1433, -1 }, - { 14934, -7887, -1046, 1080 }, - { 15252, -7630, -1899, 1628 }, - { 15485, -8384, -1234, 1484 }, - { 15962, -8638, -1815, 1931 }, - { 16501, -10664, 398, 1167 }, - { 16146, -10145, 411, 918 }, - { 14573, -7475, -697, 601 }, - { 14302, -7996, 28, 257 }, - { 14769, -6792, -2286, 1574 }, - { 14144, -6137, -2169, 1257 }, - { 14770, -6271, -3111, 1933 }, - { 14110, -8312, 1083, -531 }, - { 15235, -6991, -2993, 2174 }, - { 13222, -5805, 547, -891 }, - { 14796, -8762, 1254, -246 }, - { 16040, -9181, -1005, 1551 }, - { 16487, -10086, -373, 1420 }, - { 15077, -9479, 966, 51 }, - { 13026, -6468, 932, -1080 }, - { 12703, -6152, -33, -573 }, - { 15641, -6810, -4128, 2874 }, - { 13282, -7673, 1583, -1283 }, - { 12373, -7150, 1512, -917 }, - { 12992, -7751, -678, 783 }, - { 10907, -6858, -313, 2597 }, - { 13026, -8963, 125, 2152 }, - { 12770, -9946, 1957, -505 }, - { 12482, -6849, -1268, 833 }, - { 13790, -6181, -138, -279 }, - { 12709, -8382, 2044, 227 }, - { 12244, -6630, 203, -457 }, - { 14209, -6816, -1032, 632 }, - { 15134, -8267, -288, 640 }, - { 13619, -6157, -1090, 356 }, - { 14044, -7413, 725, -484 }, - { 12958, -7753, 2585, -1980 }, - { 13188, -8396, 2306, -1558 }, - { 14379, -9980, 2132, -688 }, - { 14275, -9857, 1162, 179 }, - { 13690, -8648, 1621, -889 }, - { 11770, -6829, -746, 278 }, - { 12732, -8202, 286, 90 }, - { 13630, -10146, 1867, -207 }, - { 12072, -8740, 1299, -645 }, - { 12852, -9492, 1226, 62 }, - { 11792, -7382, -54, -116 }, - { 13779, -9014, 487, 351 }, - { 11951, -7729, 121, 834 }, - { 11970, -9781, 2276, -4 }, - { 12680, -7984, 2787, -787 }, - { 13300, -14488, 6408, -1927 }, - { 13635, -15355, 9153, -3073 }, - { 12804, -13566, 5517, -1625 }, - { 16624, -10854, 1690, 28 }, - { 20387, -18532, 6162, -261 }, - { 16515, -12642, 3392, -519 }, - { 15800, -11095, 2151, -202 }, - { 16824, -11790, 1651, 599 }, - { 17604, -13213, 2563, 538 }, - { 17892, -14177, 3562, 147 }, - { 16987, -11399, 869, 1052 }, - { 17003, -12456, 2442, 265 }, - { 21657, -21806, 9198, -1250 }, - { 16825, -13341, 3980, -686 }, - { 17525, -12714, 1887, 805 }, - { 16419, -11034, 1216, 617 }, - { 20931, -19939, 7469, -684 }, - { 18452, -15390, 4573, -191 }, - { 14778, -10077, 2841, -1209 }, - { 17402, -13319, 3042, 160 }, - { 19365, -17922, 7087, -1061 }, - { 16298, -11941, 2810, -351 }, - { 19087, -16176, 4775, -84 }, - { 17666, -12289, 938, 1224 }, - { 18581, -15894, 5132, -430 }, - { 19823, -16717, 4142, 545 }, - { 19960, -19423, 8400, -1492 }, - { 18973, -16817, 5906, -594 }, - { 19079, -15431, 3528, 503 }, - { 16667, -12485, 4467, -1302 }, - { 19791, -17797, 6196, -529 }, - { 20005, -17606, 5354, -20 }, - { 20123, -18599, 6886, -728 }, - { 19068, -14805, 2394, 1105 }, - { 14443, -13723, 5631, -2029 }, - { 14730, -14231, 5631, -1450 }, - { 16089, -15959, 7271, -2029 }, - { 13473, -11200, 3236, -924 }, - { 14413, -10902, 2347, -267 }, - { 17666, -18662, 11381, -3496 }, - { 14749, -11042, 3305, -275 }, - { 15304, -10486, 1869, -240 }, - { 14809, -12126, 3369, -616 }, - { 16896, -16561, 7307, -1845 }, - { 15782, -14336, 5380, -1264 }, - { 16395, -15520, 6415, -1588 }, - { 13681, -11114, 2584, -320 }, - { 14244, -12326, 4480, -1632 }, - { 15247, -13119, 4265, -898 }, - { 13987, -12091, 3469, -597 }, - { 13941, -12770, 4240, -839 }, - { 13771, -13627, 5252, -1384 }, - { 15010, -16074, 7592, -2249 }, - { 15852, -17226, 8619, -2655 }, - { 18921, -16916, 6875, -1501 }, - { 14909, -11678, 2768, -295 }, - { 18988, -18353, 8424, -2070 }, - { 15457, -15080, 6218, -1513 }, - { 14916, -15512, 6949, -1883 }, - { 18108, -14702, 4681, -701 }, - { 17600, -15733, 5616, -775 }, - { 14070, -13683, 6472, -2626 }, - { 13832, -11914, 5201, -2232 }, - { 18846, -19009, 9192, -1961 }, - { -11981, -10994, -6324, -2264 }, - { -10976, -9047, -6546, -3828 }, - { -11288, -10532, -7014, -4191 }, - { -10139, -10189, -7799, -2688 }, - { -10555, -9988, -9181, -2040 }, - { -11596, -11339, -10022, -2707 }, - { -13400, -13395, -11306, -4206 }, - { -9774, -12281, -7466, -4133 }, - { -10842, -13125, -8777, -4956 }, - { -11964, -15082, -9779, -5095 }, - { -9382, -10188, -9053, -4927 }, - { -11562, -11296, -3651, -985 }, - { -9287, -10083, -7918, -4069 }, - { -12821, -16556, -11410, -6195 }, - { -12628, -8959, -4521, -1113 }, - { -13845, -11581, -3649, -681 }, - { -12685, -10269, -5483, -1275 }, - { -14988, -12874, -5107, -1189 }, - { -13761, -11367, -6202, -1804 }, - { -13225, -11249, -7820, -3354 }, - { -14809, -11992, -3202, -312 }, - { -15620, -15519, -10210, -3433 }, - { -12954, -10200, -3139, -611 }, - { -11536, -9981, -5284, -923 }, - { -13034, -12417, -4612, -1098 }, - { -16911, -15505, -6123, -1352 }, - { -17396, -17685, -8330, -2171 }, - { -14120, -10764, -2265, -99 }, - { -12598, -7367, -5406, -3530 }, - { -14143, -12793, -10909, -5226 }, - { -14692, -16871, -11626, -5554 }, - { -12581, -11197, -9194, -3837 }, - { -16752, -16726, -9746, -2808 }, - { -10600, -10358, -6560, -1227 }, - { -14573, -13312, -8957, -3393 }, - { -10172, -8463, -8579, -3387 }, - { -11418, -12421, -5522, -1842 }, - { -11855, -14204, -6669, -2625 }, - { -13308, -8191, -3941, -2194 }, - { -10007, -12266, -5022, -1811 }, - { -13532, -15771, -9497, -3175 }, - { -11760, -11148, -10339, -5529 }, - { -12149, -12763, -11198, -3697 }, - { -12029, -12119, -8555, -1792 }, - { -16995, -19957, -11447, -3471 }, - { -13144, -14504, -9988, -3191 }, - { -9938, -11064, -6139, -3162 }, - { -8873, -11550, -8294, -6550 }, - { -9303, -13010, -6150, -2711 }, - { -15463, -10469, -1766, -170 }, - { -15985, -11693, -3007, -650 }, - { -17142, -10671, -1434, 47 }, - { -16063, -13858, -4817, -1058 }, - { -19446, -19599, -9594, -2464 }, - { -20076, -18744, -8313, -1889 }, - { -15047, -16085, -7590, -2250 }, - { -13481, -16195, -8552, -2998 }, - { -13829, -14869, -6704, -1932 }, - { -16357, -18484, -9802, -2959 }, - { -10551, -8393, -9303, -5070 }, - { -11345, -9156, -5641, -3107 }, - { -13217, -13449, -9270, -4541 }, - { -11988, -13732, -9995, -6374 }, - { -11007, -9519, -5168, -4107 }, - { 9930, -7858, 8061, -4375 }, - { 8274, -7867, 5992, -2096 }, - { 9692, -9675, 7621, -3670 }, - { 9589, -8110, 6509, -3010 }, - { 12617, -11976, 10122, -5360 }, - { 11867, -8895, 7948, -5323 }, - { 10388, -10482, 9234, -4324 }, - { 8188, -8220, 7810, -2737 }, - { 10407, -8787, 4806, -1930 }, - { 10348, -8845, 9233, -6614 }, - { 9422, -7091, 4820, -2878 }, - { 9758, -9796, 5584, -2256 }, - { 10188, -7994, 5347, -3343 }, - { 11133, -7455, 4015, -2306 }, - { 10676, -10744, 6093, -2629 }, - { 11522, -12184, 7848, -3375 }, - { 8805, -9883, 5317, -3071 }, - { 9498, -9654, 6555, -3592 }, - { 10488, -8008, 4066, -1252 }, - { 11261, -8930, 6068, -2738 }, - { 12180, -10397, 5027, -1531 }, - { 9138, -8531, 3601, -1959 }, - { 8107, -8380, 4970, -2061 }, - { 9737, -13248, 6438, -2617 }, - { 11178, -10423, 2622, -522 }, - { 9572, -12372, 5199, -2019 }, - { 12057, -12144, 4147, -1099 }, - { 9047, -9925, 2516, -665 }, - { 10790, -8030, 5882, -4386 }, - { 7199, -8426, 6337, -2841 }, - { 7778, -8285, 3529, -3442 }, - { 7559, -10569, 3484, -1332 }, - { 9404, -8115, 7484, -5541 }, - { 7792, -11976, 5546, -2573 }, - { 9313, -10264, 7661, -5195 }, - { 6701, -10725, 4370, -1784 }, - { 4918, -11361, 4507, -4527 }, - { 5147, -12305, 3978, -5556 }, - { 6525, -9899, 4481, -3129 }, - { 7538, -12855, 6060, -4826 }, - { 8659, -12111, 7159, -4430 }, - { 8440, -11304, 4547, -1747 }, - { 9216, -10918, 3507, -1195 }, - { 6165, -9254, 4771, -4677 }, - { 9163, -11019, 5637, -4935 }, - { 13441, -11509, 6676, -2434 }, - { 7912, -9398, 6663, -4048 }, - { 11723, -13745, 8131, -4148 }, - { 6065, -10257, 5005, -6327 }, - { 11618, -12417, 5336, -1894 }, - { 8891, -13924, 8407, -6131 }, - { 9622, -12563, 7908, -5109 }, - { 11479, -10315, 8349, -3991 }, - { 11676, -14103, 6611, -2330 }, - { 11951, -8953, 3829, -1550 }, - { 10486, -8044, 10493, -5920 }, - { 11801, -10769, 9763, -5305 }, - { 6109, -8676, 5827, -1346 }, - { 7030, -9611, 5624, -5761 }, - { 12808, -12886, 8683, -4148 }, - { 13213, -10464, 6381, -3189 }, - { 11796, -13681, 10703, -6075 }, - { 9639, -7949, 9625, -3944 }, - { 8538, -6997, 5309, 453 } -}; - -/* quantization tables */ - -static const uint32_t scale_factor_quant6[64] = { - 1, 2, 2, 3, 3, 4, 6, 7, - 10, 12, 16, 20, 26, 34, 44, 56, - 72, 93, 120, 155, 200, 257, 331, 427, - 550, 708, 912, 1175, 1514, 1950, 2512, 3236, - 4169, 5370, 6918, 8913, 11482, 14791, 19055, 24547, - 31623, 40738, 52481, 67608, 87096, 112202, 144544, 186209, - 239883, 309030, 398107, 512861, 660693, 851138, 1096478, 1412538, - 1819701, 2344229, 3019952, 3890451, 5011872, 6456542, 8317638, 0 -}; - -static const uint32_t scale_factor_quant7[128] = { - 1, 1, 2, 2, 2, 2, 3, 3, - 3, 4, 4, 5, 6, 7, 7, 8, - 10, 11, 12, 14, 16, 18, 20, 23, - 26, 30, 34, 38, 44, 50, 56, 64, - 72, 82, 93, 106, 120, 136, 155, 176, - 200, 226, 257, 292, 331, 376, 427, 484, - 550, 624, 708, 804, 912, 1035, 1175, 1334, - 1514, 1718, 1950, 2213, 2512, 2851, 3236, 3673, - 4169, 4732, 5370, 6095, 6918, 7852, 8913, 10116, - 11482, 13032, 14791, 16788, 19055, 21627, 24547, 27861, - 31623, 35892, 40738, 46238, 52481, 59566, 67608, 76736, - 87096, 98855, 112202, 127350, 144544, 164059, 186209, 211349, - 239883, 272270, 309030, 350752, 398107, 451856, 512861, 582103, - 660693, 749894, 851138, 966051, 1096478, 1244515, 1412538, 1603245, - 1819701, 2065380, 2344229, 2660725, 3019952, 3427678, 3890451, 4415704, - 5011872, 5688529, 6456542, 7328245, 8317638, 0, 0, 0 -}; - -/* 20bits unsigned fractional binary codes */ -static const uint32_t lossy_quant[32] = { - 0, 6710886, 4194304, 3355443, 2474639, 2097152, 1761608, 1426063, - 796918, 461373, 251658, 146801, 79692, 46137, 27263, 16777, - 10486, 5872, 3355, 1887, 1258, 713, 336, 168, - 84, 42, 21, 0, 0, 0, 0, 0 -}; - -static const float lossy_quant_d[32] = { - 0, 1.6, 1.0, 0.8, 0.59, 0.50, 0.42, 0.34, - 0.19, 0.11, 0.06, 0.035, 0.019, 0.011, 0.0065, 0.0040, - 0.0025, 0.0014, 0.0008, 0.00045, 0.00030, 0.00017, 0.00008, 0.00004, - 0.00002, 0.00001, 0.000005, 0, 0, 0, 0, 0 -}; - -/* 20bits unsigned fractional binary codes */ -static const uint32_t lossless_quant[32] = { - 0, 4194304, 2097152, 1384120, 1048576, 696254, 524288, 348127, - 262144, 131072, 65431, 33026, 16450, 8208, 4100, 2049, - 1024, 512, 256, 128, 64, 32, 16, 8, - 4, 2, 1, 0, 0, 0, 0, 0 -}; - -static const float lossless_quant_d[32] = { - 0, 1.0, 0.5, 0.33, 0.25, 0.166, 0.125, - 0.083, 0.0625, 0.03125, 0.0156, 7.874E-3, 3.922E-3, 1.957E-3, - 9.775E-4, 4.885E-4, 2.442E-4, 1.221E-4, 6.104E-5, 3.052E-5, 1.526E-5, - 7.629E-6, 3.815E-6, 1.907E-6, 9.537E-7, 4.768E-7, 2.384E-7, 0, - 0, 0, 0, 0 -}; - - -/* Vector quantization tables */ - -DECLARE_ALIGNED(8, static const int8_t, high_freq_vq)[1024][32] = -{ - { 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 }, - { -4, -2, 2, 1,-16,-10, 1, 3, 1, 0, 6, 1, -3, 7, 1,-22, - 2, -4, -3, 11, 14, 6, -1, 1,-13, 29,-28, 10, 10, -8, 0, -9 }, - { -8, 8, -7, 10, -3,-12, -5, -8, 1, -2, 9, -2, -5,-18, 1, 9, - -8, -8, 3, 41, 7, -9, -9, 22,-42,-29, 14,-18,-14,-32, 1,-15 }, - {-16, 8, 15, 16,-16, 5, 2, 7, -6,-16, -7, 1, 1, -3, -2, 0, - 8, 20,-26,-11, 2,-17, 0, -3,-34,-37, 10, 44, -2, 22, 2, -4 }, - { 7, 14, 5, 6, 15, -1, 3, -3, -9,-23, -5,-14, 8, -1,-14, -6, - -5, -8, 54, 31, -6, 18, 2,-19, -2,-11,-30, -6,-19, 2, -2,-14 }, - { 1, 2, -2, -1, -3, -3, 1, -5, 1, -3, -4, -8, 5, -4, 0, 1, - 3, 7, -5, -4, -3,-12, 3, -2, -3, 12,-53,-51, 6, -1, 6, 8 }, - { 0, -1, 5, 1, -6, -8, 7, 5,-18, -4, -1, 1, 0, -3, -3,-14, - -1, -6, 0,-14, -1, -1, 5, -3,-11, 1,-20, 10, 2, 19, -2, -2 }, - { 2, 4, 3, 0, 5, 0, 3, 1, -2, 0, -6, -3, -4, -5, -3, -3, - -7, 0,-34, 4,-43, 17, 0,-53,-13, -7, 24, 14, 5,-18, 9,-20 }, - { 1, 0, -3, 2, 3, -5, -2, 7,-21, 5,-25, 23, 11,-28, 2, 1, - -11, 9, 13, -6,-12, 5, 7, 2, 4,-11, -6, -1, 8, 0, 1, -2 }, - { 2, -4, -6, -4, 0, -5,-29, 13, -6,-22, -3,-43, 12,-41, 5, 24, - 18, -9,-36, -6, 4, -7, -4, 13, 4,-15, -1, -5, 1, 2, -5, 4 }, - { 0, -1, 13, -6, -5, 1, 0, -3, 1, -5, 19,-22, 31,-27, 4,-15, - -6, 15, 9,-13, 1, -9, 10,-17, 4, -1, -1, 4, 2, 0, -3, -5 }, - { -7, 3, -8, 13, 19,-12, 8,-19, -3, -2,-24, 31, 14, 0, 7,-13, - -18, 0, 3, 6, 13, -2, 1,-12,-21, 9, -2, 30, 21,-14, 2,-14 }, - { -3, -7, 8, -1, -2, -9, 6, 1, -7, 7, 13, 3, -1,-10, 30, 4, - -10, 12, 5, 6,-13, -7, -4, -2, -2, 7, -3, -6, 3, 4, 1, 2 }, - { -8, 9, 2, -3, -5, 2, 0, 9, 3, 7, -4,-16,-13, 3, 23,-27, - 18, 46,-38, 6, 4, 43, -1, 0, 8, -7, -4, -1, 11, -7, 6, -3 }, - { 1, 1, 18, -8, -6, 0, 3, 4, 22, -3, -4, -2, -4,-11, 40, -7, - -3,-13,-14, -7,-10, 14, 7, 5,-14, 11, -5, 7, 21, -2, 9, -3 }, - { 0, 0, -2, 4, -2, 0, 2, 0, -1, 2, -1, 0, 0, 2, 2, 2, - -1, 1, -3, -1,-15, -2,-63,-27,-21,-47,-14, 1,-14, 10, 0, 2 }, - { 1, 0, -4, 0, -3, -9, 4, 2, 6, -6, 0, -5, 11, -7,-15, 6, - -7, -6, 3, 7,-15, -5, 23,-13, -6, 12, -8, 9, 2, -3, 3, 4 }, - { 6, 0, 3, 0, -2, -4, 2, 1, 1, -1, 1, -2, -1, -4,-22,-15, - -46,-66, 10, 20, 2,-17, 12, -6, 1, -2, -2, 0, 1, -5, 1, 2 }, - { -1, 0, 0, 1, 0, -4, 0, 1,-10, -3, -8, 5, 7,-11, 2,-11, - 29,-25, 11, 10, 0, -1, 5, -7, -2, -5, -2, 4, 4, -3, 5, -2 }, - { 1, -1, -1, -3, -2, 1, -8, -3, 2, -2, 4, -5, -1, -7, -2, 1, - -14, -7, 3,-30,-15,-14, 3, -4, -1, 3,-13, -1, -3, 1, 2, 3 }, - { -1, -2, -3, 2, 2, -3, 3, 1, -3, 2, 0, -4, 6, 5, -5, 10, - -57, 3, 22,-50, 1, -2, -5, -6, -1, 5, 1, 2, 2, 1, -2, 2 }, - { 2, 0, -1, -7, 2, 1, 3, 2, 0, 4, 3, -2, 3, -3, 4, -4, - 24,-35, -3, 38, -6, -5, 15, 20, 3, 16, -7, -5, 0, -4, -5, 0 }, - { 0, 1, 0, 0, 0, -1, -1, 1, 1, -1, 1, -2, 0, 0, 0, 0, - 0, -1, -2, -1, -5, -2,-43, -3, 46,-52,-10, 7, -8, 11, -2, -1 }, - { 0, 0, -1, 0, -1, 2,-41, 33,-44,-48,-15,-26, -9, 6, 3, 3, - -3, 2, 2, 2, 2, -1, -1, -2, 1, 3, 0, 0, 5, 2, 3, 1 }, - { -4, 1, 6, 1, -6, -1, -2, 1,-14, -4, 0, -5, -2, 2, -2, 0, - -6, 1, 0, 8,-21, 32, -3,-36, -6, -2, -1, -7, 3, 0, 1, -6 }, - { -3, -2, 3, 0, 2, 2, 8, -4, -4, 6, 2, 1, 3, -6, 4, 3, - 13, 0,-12, -1, 25,-20, -2,-23,-15, 7, -3,-11, -3, 6, -1, 0 }, - { 0, 0, -3, -1, 0, 0, -2, -1, -2, -2, 1, -1, 0, 0, 10, 3, - -2, 3, 3, -7, -6, -5, 0, -4,-60,-16, -6, 38, 5, 6, -5, 0 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 1, -1, -1, 0, 1, 0, 0, 1, - 0, 0, -1, 0, -8, 2, -9, 10, 40, 31,-56,-21, 4, 20, -4, 7 }, - { -2, -2, 0, 4, -3, -1, 7, 3, 1, 3, -8, 0, 3, 1, 2, 5, - 1, -2, 14, 5, 4, 5, 5, 5, -5, 9,-66, 0,-20, -2, -8, 4 }, - { -2, -1, 4, -1, -8, -2, -4, -1, -3, -3, 2, -7, -3, 5, 7, -2, - 45, 31,-17,-16, -2, -2, -1,-22, 1, -1, -3, 3, 5, -3, 5, -1 }, - { -4, 0, 7, 5, 8, 7, 2, 9, -9, -9, -7,-11, -3, -8, 17, -4, - 34, 32, 18, 22, 1, 2, 1, -7, -5, 6, -1, 6, 4, 10, -2, -7 }, - { 6, 0, 14, 9, 6, -1, -2, -3, 4, -6, -8, 4, 7, -1, 28, 38, - 15, -1, 16,-11, 5, 8, 4,-10, 3,-10,-17, 5, 3, 3, 3, 1 }, - { 1, 1, 2, -1, 2, 1, 0, 0, -1, 0, 0, -2, 1, -3, 0, 1, - 2, -2, -4, -2, 0, -1, 1, -3, 1, 1, 1, -1, 8, 8, 66, 33 }, - { -5, 2, -3, -7, 2, -8, -4, 10, 17,-18, -7, 4, -4, -7, -6, -6, - -5, 5,-12, 2, 0, 6, 8, -2, 1, 4,-11, 2, 1, 8, 31, 19 }, - { 6, 9, 16, -6, -6, -1, -2, -3,-11, -2, 7, 7, 17, 3, 4, 10, - 2, 5,-13, 8, 7, 1, 4, 5, 7, 6, 7, -8, 9, -8, 33, 6 }, - { 3, -1, 1, 0, -7, -5, 0, 14, -7, 1, -7, 1, 2, -4, 7, 10, - -16, 12, 1, -6, 3, 8, -1, 10,-13, -6,-12,-23, 12, -3, 30, 14 }, - { -2,-15, 0, 8, 3,-19, 5, -3, 2, 3, 13, 7, 14, -3,-10, 0, - 8, 5, -6,-16, -8, -8, 14, 2, -1, 1, -9,-11, 11, -5, 27, 9 }, - { -8, 6, -4, 4, -4, -1, 5, 4, 1, -7, -5, -4,-15, 1, 9, 0, - 8, 4, 1,-17, 11, -2,-19, -1, -6, -8, 3,-12, 3,-17, 33,-10 }, - { -3, -1, 2, 7, 7, -2, 9, 8,-18, -1,-13,-10, -3, -3, 11, 8, - -2,-12, -8, 1, 4, 9, 14, 10, -3, 0, 2, 1, -2, 3, 31, 10 }, - { -3,-10, 8, -1, -5,-11, 7, -5, 3, 6, 1, 4,-16, 10, 5, -4, - -2,-10, -1, 13, 6, -5, -7, 12, 7, -3,-17, 1, 12, -4, 29, 8 }, - { 1, 2, 5, 2, -6, -7, 0, -1, 6, -1, 10, 6, -4, 5, 2, 2, - -2, -8, -6,-11, 14,-13, 27, 3, -2,-12, 5,-16, 2,-26, 20, 15 }, - { -1, -3, -5, -3, -3, 6, -1, 3, -5, 1, 7, 2, 1, 0, -1, -1, - 0, -1, 9, 7, -6, -3, 4, -5, -4, 8, -8,-25, -8, -4, 34, 23 }, - { -1, -2, 1, 1, -1, -2, -1, 1, -1, 0, 0, 0, 0, -2, -1, 1, - 0, 2, 1, -1, 4, 0, 0, 1, -1, 0, 5, 3, 12, -9, 68,-16 }, - { 10, 0, -8, 14, -6, 1,-12, 0, 0, -3, -5,-11, -6, 12, 9,-10, - -3, 5, 0, 7, 11, 2, 4, -3, -8, -3, 7, 4, 3, -3, 34, 4 }, - {-12, 13, -5, 7,-11, -2, -1, 1, -4,-14,-21, 3, -3, -3, -4, -7, - -9, -4, 3,-17, -2,-13, 10, -2, 12, -4, 0, -9, 1, -5, 31, 10 }, - {-10, 6, 5, 6, 4, -7, 10, 0,-28, -3, 0,-11, -1, -5, 16,-10, - -16, 7, 20, 2, -4, 2, -5, 0, 15, 6, 5,-10, 7, -9, 20, 4 }, - { 1, -7, -2, -7, 4, -3, -2, -7, -1,-14, 6,-16, 4, -5, -4, -6, - -5, 0, -2, 2, -6, 9, -5, 4,-18, 8,-10, 8, 15, 0, 32, 1 }, - { -5, 7, -3, 7, 15, -4, 0,-16, 9, 5, -5, 5, 4, -3,-12, -9, - -18, 10, 2, 2, -3, 7, 3, -1, 6, -9,-10, 3, 15, -4, 35, -7 }, - { -1,-10, 2, 2, -4, -2, 10, 2, -1, 2, -2, 1, -1,-14,-11, 3, - -8, 5, -8, -2, 6, -1, -7, 1, 7, 5, 7, 8, 30, -4, 30, 14 }, - { 2, -2, 1, 2, 3, -8, 3, 0, -2, 0, -9, 2, 1, 4, -6, -1, - -2, 5, 0, 1, -2, 12, 6, -3, 9, -3, 4,-12, 21,-39, 24, -2 }, - { 3, 5, 1, -2, -2, -2, -3, 6, -8, -2,-11, -8, -1, 4, 2, 2, - -4,-10, 12, -5,-11, 1,-15,-34,-11, -7,-11, -1, 7,-14, 38, -1 }, - { -4, 4, 8, 9, 8, 1, -5, -9, 4, -2, 15, -4, 11,-15, 20, -1, - -1, -3, 4, -9, -2, -2, -2, 8, 6, 12, -5, 0, 11,-12, 27, -4 }, - { 0, 8, -4, 3,-11, 6,-11, 2, 3, 0, 5, -8, -7, -6, -9,-21, - 4,-11, -1,-16, -7, 16, -3, 7, -7, 4, -5, 0, 11, -7, 31, 3 }, - { 1, 3, 4, 11,-11, -2, -3, -6, 6, 5, 0, 3, -9, -6, 4, -4, - 0, 4, -8, 13, -6,-13, -1, -5, -1, 4, 0, 0, 9,-22, 24, 18 }, - { -7, 3, 10,-13, -6, 6, -6, 6, 22, 1, 0,-14, 2, 3, 7, -1, - 8, 20, -1, 5, -4, 13, 9, -9, -9, 6, 0, -4, 0, -8, 31, -4 }, - { -3, -4, 0, 1, 7, 3, -7, 0, 5, -2, 1, 3, 3, 1, -5, -2, - 5, 2,-11, 4, 0, -1, 12, 0, -3,-13, 15, 8, -6,-27, 34, 0 }, - { -3, -3, 10, -4, 2, -1, -3, 0, -1, -1, -4, 2, 6, -2, 12, 1, - 3, -6, -7, -6, -5, 4,-19, -6, -8,-34, -4, -8, 10, -7, 23, 10 }, - { -7, 0, -1, -6, 8, 4, -4, 2, -5, -8, -7, -9, -8, 5, 9, 7, - -6, 1,-12,-12, -1,-16, 5, 0, 16, 3, -7, -8, 27, -4, 23, 15 }, - { -8, 4, 8, 5, 6, 11, -3, 5, 3, -1,-11, 6, -5, 0, 2, -6, - -3, -6, 4, -1, 5, -5,-12, -6, 7, -5, 9, 3, 6, -7, 29, 1 }, - { 1, 3, -2, -2, -6, -2, 1, 6, -6, -3, 1, 2, 3, 4, 1, 5, - -1, 0, 4, 2, 11, 6, 2, -3, 13, -9,-19, 18,-15,-10, 36, 21 }, - { -3, -3, 2, -1, -7, 6, -4, 1, -3, -1, -2, 2, 3, -7, -3, 0, - -2, 0, -2, 6,-19, 3, -8, 2, -6, 7, -1, 0, 29, -6, 28,-10 }, - { -5, 1, -3, -7,-12, -4, 1, 1, -1, 13,-10, -1, -9, -5,-13, 6, - 13, 3, -4, 2, 3, 11, 2, 6,-25,-16, -6, 0, 14, -1, 27, 16 }, - { -6, -1, -7, -5, -2, -5, -5, -1, 9, 1, 0, 3, -8,-12, -6, 5, - -6, 5, 3, -9, 1, 4, -7,-10, -9, -7,-17, -5,-15,-23, 25, 3 }, - { -8, -2, 9, -3, -4, 3, -1, 8, -7, -7, -5, -4, -2, 9, 4, -1, - -7, -4, -5,-16, 3, -6, 18,-13, -9, 16,-15, 8, 15,-10, 24, 5 }, - { 1,-38, 2, 34, 9, 10, 11, 2, 2, -6, 3, 2, -2, 5, 4, -7, - -1, 1, 4, 0, 3, 1, -8, -1, -6, 5, 4, 2, -4, 5, 2, -1 }, - { 1,-22, 15, 18, -2, 10,-16, -9, -8,-11, 8, 4, 0, 7,-14, -5, - -1, -7, 12, 17, 9, 5, -7, -4,-12, -6, 7, 0, 7, 2, -2, 1 }, - {-11,-29, 7, 10, 19, -1, -8, -9, 7, 1, 9, 6, 8, -7,-14, 8, - -3,-11,-13, 0, -7,-23, -2, -8, 12, 9, 2, 14, 19, 1, -1, 5 }, - {-24,-27,-11, 36, 2, 6, -3, 4, -6, 8, 0, 12, -1, -4, -6, 3, - 4, -1, 2, -3, -2, 3, 2, -1, -2, -4, 0, -1, -2, 7, 2, 3 }, - { -9,-24, 11, 13,-10,-12, 12, -2, 7, 4, 8, 13, -3, -3, 2, 9, - -3, -4, 4, 13, 5, 13, -6, -3, 1, 15, 7, -3, 0, 19, -2, -9 }, - { -8,-15, 7, 14, -4, -5, 2,-18,-19, -2, 2, 17, 16, 6,-10, 10, - -9, 14, -1, -5, -1, -6, -7, 2, 9, 11, 13, 6, -5,-12, 3, 2 }, - {-10,-37, 13, 1, 3,-14, 0,-20, 4, -3, 8, 2, -2, -3, -9, -5, - -3,-17, -1, 13,-11, 2, -6, 4, 4, 0, 3, 1, -9, -4, -5, -4 }, - { -2,-22, -5, 46, -8, 5, 9,-11, 8, 7, 7, -1, -1, -2, -7, 2, - -3, 3, -1, -2, 7, 0, 2, -1, 1, -2, -2, -3, 6, 0, -4, -6 }, - {-16,-27, 15, 16, -4, 14, -7,-26, 2, -2, 6, 5, -3, 11, 0, 2, - 3, 9, -7, -1, 2, -4, -4, -1, 6, 10, 1, 1, -3, -2, 3, 0 }, - { -3,-22, 10, 26, 1, 2, -3, 3, 17, -3, -7, 9, 1,-21, -4, 5, - 3, 0, -7, -6, 3, 3, -8, -7, -9, 3, 7, 1, -8, 12, 6, -7 }, - { -9,-25, 3, 18, 9, -6,-11, 0, -5,-12, 9, -8, -7, -6, -6, 22, - 2, -6, -3, 15, 3, 2, -2, 9, 14,-10, -7, 15, 13, 6, -2, 11 }, - { 5,-20, -5, 28, 11, 10, -4, -4, 0, -7, 3, 5, 2, -5, -8, 2, - 6, 10, 9, -9,-18, 3, 14, 1, 3, -3, -1, -6, 7, 7, 2, -1 }, - { -8,-30, 7, 12, 10, 8, 7,-13,-16, 0, 1, -1, -6,-11,-15, 4, - 1, -2, 10,-15, 1, 11, -2, 8, 9, -7, -7, 9, -5, 2, 7,-18 }, - {-10,-32, 10, 11, 3, -1, 3, -5, 5, 2, 14, -6, 3, 1, 5,-15, - -11, 6, 20, 4, 0,-12, -7, 3, 1, -1, 10, 6, -1, -9, -4, -1 }, - { 1,-25,-14, 12,-11, 9, 9,-16,-24,-17, 22, -9, 11,-30, -3, -4, - 6, -7, 9, 2, -1, -5, -6, 2, -1, -1, 10, 1, -3, 3, 4, 8 }, - {-14,-26, -6, 9, 8, 17,-11,-24, -7, -4, -8, -2, 10, 2, 2, -1, - 2, 13, 12, -7, 4, -6,-10, 6, 6,-13,-11, -7,-16, 0, -2, 5 }, - { -4,-30,-13, 12, 16, -6, 12,-16,-13, 5, 15, -2, -2,-10, -7, 7, - 11, -1, -4, -2, -4, 7, 4, -8, 1, 3, 0, 11, 3, -2, -5, 4 }, - { -4,-21, 20, 22, 2, 20, -8, 1,-12, -5, -9, 4,-10,-17, -3, -8, - -3, 3,-12, 1, -3, 0, 7, 4, 7, 7, -3, 7, 5, 3, 1, -5 }, - {-12,-20, 2, 29, 11, -6, 9, -7, -6, -4, 0, 6, 17,-13, -2,-10, - -17, -1,-18, 2, 0, 14, -6, 1, 0, 3, 2,-10, 1, -5, -2, 5 }, - { 16,-37, -1, 26, -2,-14, 1, -5,-14, 2, 2, 3, 6, 1, 1, 4, - 0, -1, 0, -2, -2, 4, 9, -6, 0, -2, 10, -7, -2, 4, 1, 0 }, - { -9,-24,-12, 5, 5, 3,-17,-14, 4, 3, 2, -4, 10,-22, -8, -3, - 6, 1, 12, -8, 4, 1, 9, -1, 18, -3, 6, 5, 3, -5, 9, -5 }, - {-14,-33, -2, 20,-13,-10, 2, -7, -1, 11, -9, -8, 18, -3, 1, 8, - 0, -2, 10, 7, -2,-13, 9, -3, -4, 5, -2, -2, -1, -5, 1, -7 }, - {-10,-23, 8, 14, 1, 7, 1, -3, -7, 4, 1, 1, 8, -7, 15,-14, - 13, 14, 2, 5,-13, -5, -8, -1, 6, 3, 6, 9, 6, 15, 14, 5 }, - {-13,-25,-10, 13,-17,-24, -7,-13, -6,-10, -8, 2, 0,-13,-10, -4, - -8, 4, -9, 9, -4, 4, -3, -3, 3, 3, -5, -9, 1, -2, 11, 2 }, - {-12,-23, 1, 18,-11, -2, 5, 9, -5, 5, 14, -9, -3, -2, -6, 2, - -2, 11,-13, 1, -3, 11, -9, -4, -2, -6, 8, 10, 1, 4, 2, 1 }, - { -5,-18, 16, 22, 2, 0, 8, -6, -9, -7, 10,-16, 23, 10,-11, -1, - 7, 2, 7, 2, 1, -5, 6, 1, 0, -4, 9, 2, -3, 1, 0, -4 }, - { -3,-26, 14, 11, 2, -9, 17, -2, -1, -5,-16, -9, -5, 10,-13, 1, - 6, 12, 10, 11, 0, 0, -3,-14, 6, -2, 0, 4, -5, -1, -7, -1 }, - {-10,-33, 1, 8, 11, -5, 1, -6, 7, 4, 5, 6, 1, -2,-10, -5, - -6, 12,-11, 5,-10, 4, 12, -1, -1, -3, 4, -1, 9, 0, 16,-17 }, - {-14,-37, 7, 7, -2, 5, -8,-11, 2,-13, 4,-19, 1, 8, 8, 4, - -9, 2, -4, 3, 12, 2, 4, -4, -8, 8, 1, 4, 8, -1, 6, -2 }, - { -6,-30, 18, 17, 1,-22, -3, 4, -7,-10, 7, 0, -8, 8, -1, 4, - 2, 8, 6, -2, 2, 7, 4, 4, 3, -6, 2, 1, -3, 1, -1, -5 }, - {-17,-18, -3, 22, -8, 1, 9, -2,-17, 20, -5, -5,-12, -5, 4, -5, - -9, 8, -2, 16, -3, 0, 19, -8, 8, 1, 2, -4, 0, 11, 0, -3 }, - { -9,-23, 3, 10, 4, 4, -3, -2, -2, -2, 1,-22, 11, 0, -2, 5, - -2, 14, -9,-11, -4, 7, 5, 32, 1, -3, -7, 0, 21, -9, 7, -6 }, - { 0, 0, 0, 2, -1, 1, 0, 1, 3, 0, 0, 1, 0, 1, 0, 1, - -3, 0, -1, -2, 0, -1, -1, -3, -1, 1, -4, 1, -1, -5,-69,-19 }, - { -3, -5, -8,-12, 4, -3,-19,-11, -5, 0,-14, 7, 18, -6, 7, 22, - 8, 14, 15, 10, 3, -1, -3, 5, -1, 7, -7, 1, -6, 3,-26,-11 }, - { -1, -6, 4, -4, -5,-16, 0, -6, -3, 11, 1, 0, 9, 5, 16, 3, - -4,-33, -4, 4, -7, 0, 1, 6,-11, -2,-13, -2,-18, 20,-25,-16 }, - { 4, 0, -1, 0, -5, 1, 0, 2, 0, 11,-10, 4,-10, 7, 16, 2, - 16, 15, 2, -1, 2, 9, 2, 8, -3, -5, -2, 0, -3, 0,-33, -2 }, - { -3,-15, 10, 10, -9, -1, 7, 3, 5, -5, -8, -8, -3, 15, -9, 4, - 12, 13,-13,-14, 10, -6, 9, 22,-27, 23, -1, 5,-24, 2,-30, 5 }, - { 0, -2, 7, -5, -5, 3, 5, 3, -3, -5, 2, 1, -4, 3, -3, -1, - 1, -2, 10, 22, -3, -4, -2, -2, -7, 3, 8, 1, 14, 4,-37, 9 }, - { -3, -4, -1, 1, -4, 0, 6, 2, 6, -7,-10,-10, -1, -4, 11, -3, - 7, -6, 4,-12, -1, 5, 1, -7, 10, -6, 17, -4, 8, 3,-40, 13 }, - { 2, 12, 4, -7, 14, -3, 16, -2, 18, 2, 13, 5, 5, 1, 11, -1, - 0, 9, 2, -6, -1, 2, -6, 2, -5, 3, 5, 1, -1, 1,-32, -7 }, - {-16, 11, 7, -4, 2, -5, -9, 9, 11, 11, 15,-13,-11, 11, 9, 4, - 3, -8,-10, 12, 12, 0, 0,-16, -9, 13, 2, 9, 4,-13,-33, 3 }, - { 6, 4, 5, 4, 3, -1, 5, 6, 4, 2,-11, -1,-15,-11, -1, 1, - 11, -3, -2, 24, -4, -6,-25,-10,-15, -8, 0, 0, -5, 4,-30, 2 }, - { 10, -3, -6, 1, -9, -5, 6, 9,-10, -3, 8, -1, 4, -1, 11,-11, - 3, 9, 11, -3, 6,-17, 5, -8,-33, 9,-13, 19, -2, 9,-25, 2 }, - { 0, 0, -1, -3, 0, -2, 1, 0, 0, 2, 1, 0, -2, 0, -1, 2, - 0, -1, 4, -1, 2, -3, 4, -2, 3, 3, 1, 0,-15, 12,-63, 27 }, - { -2, 14, 9, -1, 3, 0, 1, 1,-19, 15, 3, 4, 0,-10, 1, -5, - 3, 0, -5,-10, 2,-16, -4, 8,-12, -6, 7, -5,-10, -1,-33, -4 }, - { 0, 3, 1, 3, 1, 2, 4, 4, 9, -6, -8, -5, 1,-12, 3, 8, - -10, 6, -1, 1, 13, -5, -5, 2, -4, 13,-18,-10, -7, -9,-33, 10 }, - { -6, -3,-12, 5, -1, 11, -6, 0, -2, 1, 2, -7, 3, 1, 3, -2, - 1, 8,-10, 7, -1, -3, 3, 0, 13, 1, 6, 7,-16, -7,-39, 8 }, - { -6, -1, 11, 6, -3, 8, 3, -5, 3, 0, -5, -2, -6, -3, -4, 2, - -3, 13,-11, 1, 7, 5, 19, -5, -3,-15, -1, 7, -1, 6,-33, 8 }, - { -7, 3, -4, -3, -4, 1, 6, -5, -5, 6, -8, -1, -7, 4, -1, -6, - -2, 1, 7, 0, 1, 1, -5, 2, -2, 0,-13, -2,-31,-14,-39,-12 }, - {-10, 9, 0, -3, 1, -1, -1, 0, 1, -5, -1, -4, -2, 5, 2, -7, - 18, -8, -2,-19, -7, -7,-12,-14,-11, -1, -9,-13, -7,-12,-31, -9 }, - { -3,-16, 10, 9, 1,-10,-12, 2, -2, 2, 7, -3, -3, 1, -4, -5, - -9, 5, 7, 3, -1, 4,-11, -8, 4, 13,-10, 13, 10, -4,-36, 1 }, - { -7,-12, 4,-20, -7, -7, 2, 11, -1, -2, 3,-12, 1, 0, -6, -7, - 6, 4, 13, 3, -3, 4, 3, -6,-12, 5, -5,-22,-13, -8,-37, -6 }, - { -7, 5, 3, 5, 7, 9,-14, -3, 10, 17, -1, 1,-12, 5, -6, 0, - -4, -9, 0,-11,-14, 3, 13, 6,-25, -8,-12, 4,-10, 18,-30, -1 }, - {-10, 6,-10, 6, 6, 1,-10, 0, -7, 5, -2, 17,-18, -4, 0, -3, - -16, -6, -3, -8, 5, 1, -4, 6, -7, 16, 6, 10, -1, 0,-32,-11 }, - { -1, 9, 9, -5, 4, 9, 6, 9, -4, -2, 7, 11, 4, 2, -5, -4, - -6, 0, 2, -3, -1, 5, 10, 0, 12,-10,-18, -3, -1, 14,-33, 2 }, - { 4, -8,-18, -4, -5,-11, 4,-10, -4, 9, 13,-12, 1, -6, 1, 2, - 4, -9, 8, 3, -6, 21, 13, -1, -2, 1, -2, 6, -7, 0,-30, 1 }, - { 6, -1, 2, -3, -1, -4, 6, -4, 0, 4, 2, 2, -9, 2, 6, 3, - -2, 4, -1, 9, -6, 0, 7, -8, 5, 19, -2, 9, -5, 2,-33, -8 }, - { 2, 1, 12, -5, -8, 8, 3, -2, -4, 1, -2, 5, -4, -9, -8, -8, - 7,-11, -4, 6,-10, 7, -1, -1, -2, -1, 16, 32, -7, 20,-33, -6 }, - {-18, 2, 6, 13, 9, 9, -1, 3,-17, 24, -2, -6, 28, 8, -2, 6, - 3,-10,-34,-16,-13, -4,-15,-11,-12, -3,-10, 4, -8, 4,-31, -4 }, - {-11, 0, 18, 2,-16, -9,-13, -2, -2,-12, -3,-22, 30, 0, 8, 3, - 9, -4,-16, 1, 0,-11, 15, -2, -4, 6, -5, 6, 1, 2,-25,-12 }, - { 14, -1, 5, 7, 3,-15, -8, 1, 5, -2, 12, 13, 11,-25, 3, 1, - 0, -2, -4,-16,-23, 0, -5,-17, 7, 5, -9, 6, -5, 2,-32, -7 }, - { 3, -1, 6, 14, 2,-12, -9, -9, 4, 7, 4, 6, 5, -8, 4, 2, - 4, 5, -2, 8, 8, -6, 0, 10,-20, -1, 3, -1, 8, 23,-33, -5 }, - { -3, 11, -6, 3, -4, 5, 7, 3, 4, 5, -2, 3, -1, 30, 6, 1, - 8, -6, 0, 0, -9, 6, -9, 4, 2, 9, -6, 1,-12, 0,-34, 18 }, - {-17, 13, 0, 1, 9, -4,-11, 0, 7, 0,-10, -4, -1, 6, -6, 4, - 1, 6, -9, 3, -5, -6,-11, 2, -4, 14, 23, -3, 2, 5,-30, 12 }, - {-14, 5,-27, 2, 0, 7, 1, 4, 30, 8, 7, 5, 1, -1, 0, 5, - 8,-10, 48,-11, 12, 33, 6, 8,-15, 20, -2, -5, 32, 5,-19, 10 }, - {-16, -4,-12, -7, -2, 0, 8, -6,-20,-18, 16, -3, 0, 31, -2, 11, - 2, -9, 49,-19,-12,-23, 10, 26, 16, -2, 4,-21,-14, 13,-11, -9 }, - { -5, -9, -1, 3, -5,-21, 2, 10, 0, 0, 10,-21, -7, 7,-26, -9, - 22, 32, 58, 11, -3, 11, -5, -8,-13, 6, -5, -9, 1, 10, 14, -8 }, - { 7, 7, 10, 3, -2, -1,-11,-11, -6,-43, -3, 14,-19,-18, 19, 18, - -32, 10, 45, -6, 6, 21,-20,-12, 2, 4, 6, 6, -4, 3, 3, 1 }, - { 21, 22, -3, -2,-11, -6, -1, -2, 8, 8, 32,-21, 7, 28, -4, -6, - -3, -2, 50, 2, 2, 27, -5, -8, 12, 7, -5, -1, -4,-17, 27, 6 }, - { 13, 7, 2, -6,-12, 2,-10, -5,-17, 11, 4, 17,-12, -2, 5,-17, - 37,-16, 48,-14,-18, 29, 8, 24, 11, -5, -9, 11, -1, 1,-13, -3 }, - { 1, 1, -1, 2, 0, 0, 0, -1, 1, -1, 7, 2, -3, 3, 0, 6, - 2, 10, 54,-25, 7, 54, -5, -6, -1,-15, 9, 13,-24,-15,-12, 3 }, - { 21, 5, 8, 3, -3, -4, -2, -4, 3,-11, -5, -8, 9, 16, 8, -9, - -10, -3, 46,-46, 2, 1,-10, 10, 17, 11,-20,-36, 10, 14, 0, -5 }, - { 7,-13, -6, -9,-24, 45, 2, 8, 8, 0, 17, 20, 12,-24, 1, -7, - -15, -3, 46,-13, -2, 20, 1,-13,-11,-13, 2, 15, 1, 10, -1, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, -1, - -16, -9, 31,-69,-34, 26, 7, 17, -1, -6, -1, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -4, - -5,-20, 18,-82, 22, 3, -7, 9, 4, 6, 2, -4, -1, 0, -2, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 4, -1, - 15, -5, 62,-36, 4, 52, -7, 5, 0, 6, 1, 2, 1, 1, -1, 0 }, - { 3,-19, 19,-20, 13, -4,-11, 8, 8,-16, 10, 1,-14, 30, 1,-33, - 10,-11, 45,-30, 3, -4, -3,-13, 7, 12, 3,-22, 3, -2, -4, -2 }, - { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 2, 1, - 11, 8, 70, 48,-10, 21, 4, 9, -9, -9, -4, -6, 0, -1, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 2, -1, 80, 2,-15,-36,-10, -5, -2, 8, -2, 2, 0, 0, 0, 0 }, - { 10, 8, -8, -8,-24, 12, -1, 0, 20, 9, -1, -2, 2, -2, 12,-10, - -2,-13, 35,-43, 44, 15,-10,-25, 4, 10, -3, -5, -5, 7, -1, 3 }, - { 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, -2, -1, - -18, 9, 49,-72, 7, -8, 7, -5, 2, 3, 2, -2, 1, -2, -3, 1 }, - { -1, 4, -3, 10, 19, 4, 3, 20, 6,-24, 6, 9, 8, 15, 18, 18, - -36, 19, 57,-11, 4, -3, 8, 7, 2, -3, -2, -9,-15, -2, 12, -4 }, - { 20, 3, 11, -9, -4, 22, 42,-25, 1, 5,-10,-19, 0, 9,-16, 5, - 2, 10, 44,-29, 17, -3, -9, -2, -1, 8, 14, -7, -1, 16, -5, 1 }, - { -7, 16,-11, 12, 6, 33,-15, 14,-23, 2,-26, 8, 2, 10, 0, -5, - 8, -8, 38,-38, -4, 5, 5, 5, 1, 22,-15, 7, 6, 0, 4, 28 }, - { -1,-12, 2, 10, -2, 0, 7, 17, 12, 22, -4, 10, 25, 29, 5, 18, - 4, 1, 27,-39, 31, 17, 2, 2, 22,-23, 13, 16, 1, -7, -4, -5 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -2, 0,-14, 0, - -7,-11, 49,-22, -4, 19, 17,-39, 4,-29, 10, 2, 36, -4, 23, -1 }, - { -2, -2, -2, -2, 1, 15, -5, -7,-16, -8,-19, 16, -3,-20, 36, -9, - -3, 20, 39,-20, 0, 2, 27,-16, 10, 10,-14,-22,-16, -3, 13, -8 }, - { 5, -9, 6,-25, 7, 37, 13,-10, -5, 3, -5, 7, 18,-22, -7, 9, - -5, -4, 50,-11, -4, -5, -5, 8, -4, -2, -4,-27, 14, 20, 7, -9 }, - { 0,-14,-10,-27,-14,-17, -6, 26, 10, 2, 14,-12, -5, 0, 8, 9, - 0,-28, 55, -7,-12, -7, 4,-10, 10, 7,-12, 11, 3, 5, 9, -8 }, - { 2, 23, 4, -2, -1,-20, -2, 14, 10, -9, -9,-24, 10, 0, 11,-12, - 12, 11, 49,-25, -2, 29, 7,-13, 21,-10, 11,-17, 3, 1, -8, 5 }, - { 3, 0,-14, -6, 18, -2, 17, -9,-19, 9, -5, 9, 14, 6, 19, -3, - 27, 1, 41,-21, 20,-15, 33, 0, 26, 14, 7, 10, 3, 20, -3,-12 }, - { -1, 16, 15, -8, 3, -8, -8, 21, -5,-16,-29, 4, 1, -6, -4,-28, - 2, 31, 37,-26, -2, 13, 24, 8, -9, -6,-29, 10, 7, 2, 7, 8 }, - {-10,-10, 11, 13,-32, 2, 16, 9, 14, 23,-15,-13, 24, 13, 4,-27, - 14, 12, 31,-18, 17, 23, -2, -7,-14, 9,-17, -6,-10, 20, 9, 6 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, - 5, 1, 89, 8, 10, -6, 2, -1, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, - 4, -7, 64,-50, 7, 37, 2, 5, 0, 0, 0, 0, 0, 0, 0, 0 }, - { -2, 5, 3, -4, -4, -3, 2, -3, 3, -3, 5, 4, 1, -6, -1, 1, - 6, -2, 50,-35, -7, 43, 7, -7, -5,-26, 24, 21, 3,-15, 5, 6 }, - { -8, 21,-19, 33, -8, 22,-11, 17, 3, 0, 0, -2, 1, -3, 6, -1, - 10, -8, 4,-11, -4, -5, 0, 8, -4, 3, 1, -4, 4, 2, 8, 4 }, - { -7, 5,-20, 9,-22, 3,-14, 1, 6, 13, 23, -2, -4, -7, 2, 0, - 11, 4, 6, 3, -7,-11, -7, 4, 5, 5,-12, 8, 2, 4, 7, -3 }, - { -7, 6, -4, 20,-20, 16, -2, 7, 6, 16, 11, 12, -7, -7, 5, 3, - -9, -4, 1, 2, 5, 2, 1, -9, -2,-17, -4, 6,-10, 7, -7, -6 }, - { -9, 18,-17, 12,-24, 1, -1, 4, 14, 9, 4, 3, 2, 8,-12,-14, - 4, -8, -4, 7, 7, 6, -1, 13, -9, -4, -1, 1, 0, -4, 15, 8 }, - {-25, 2,-11, 6, -5, 24,-28, -5, 8, 12, -2, 6, 8, -3, 8, -9, - -1, -5, -1, -5, 6, -1, -1, -1, -4, 8,-12, -2,-13, 7, 2, 1 }, - {-14, 14,-18, 20,-10, 12, -2, 9, 1, 0, 12, -2, 15,-10, 26,-17, - 16,-11, 10,-10, 9, -2, 4, -8, 2, -3, 4, 4, 2, -3, -5, 1 }, - {-18, 12,-18, 21, -6, 12, -6, 13,-25, 18, 1, 11, -9, -5, 0, 10, - -5, 3, -3, 8, -9, 7, 4, 2, -9, 0, 5, 0, 2, -3, 9, -8 }, - { -4, 16, 1, 18,-30, 9, 1, 6, -8, 13, 13,-12, -6, -1, 13, 7, - 6, 2,-15, -3, 5, 5, 1, -6, 1, -5, 0, 2,-16, 0, 3, -4 }, - {-21, 1, -2, 6,-43, 18, -1, 5, -1, 4, 6, -2, -1, -3, -1, -3, - 0, 1, 2, -9, 0, -1, 0, -2, 0, -1, -1, -2, 6, 0, 1, -2 }, - {-23, 10, 4, 7,-32,-11,-18, 2, -2, -7, -6, -3, -3,-12, 19, 3, - -5, -6, 16, -6, 16, 2, 16, 16, 8, -2, 13, 8,-15,-11, 2, 10 }, - { -8, 2,-13, 2,-29, 24,-20, 19, 1, 10, -4, 10, 1, 2, -9, 11, - -1, -2, 9, -5, 19, -7, 16, -9, -2,-18, 11, 1, 1, 0, 7, -3 }, - { -6, 3, 4, 13,-26, 10,-10, 28, -7, 28, 1, 7, 0,-14, 5, 7, - 4, -4, 3, -2, 3, 3,-11, 7, 6, 4, 0, -1, 2, -1, -3, 2 }, - { -6, 16,-31, 13,-10, 17, -6, 4,-14, 4, 4, -1,-10, 12, -5, 1, - -14, 15, 0, -8, 1, -5, 3, 3, 9, -5, 7,-20, 7, 4, 11, -5 }, - {-19, 3,-17, 14,-12, 16,-22, 18, 14, 8, -2, 4, 10, 12,-14, 4, - -3, 2, 3, 7, -7, 7, -6, 2, -2, -4, -5, 0, -5, -2, 2, 1 }, - { -9, -7,-11, 24,-36, -9,-11, 5, 7,-12,-13, 18, -2, 20, 1, -4, - -1,-10, 15, -6, 14, 1, 0, 2, 1, 2, -9,-16,-11, 7, 13, 0 }, - {-24, 24,-18, 18,-22, 14,-11, 13,-12, 11,-10, 11, -7, 11, -5, -4, - -1, 1, 5, 2, 3, -1, 1, -5, 7, -4, 5, -6, 8, -7, 8, -6 }, - { -6, 18,-22, 22, 5, 11, -1, 6, 19, 22, 8, 4, -8, 20, -2, 15, - -6,-18, 0,-33, -9,-12, -1, 6, 5, 2, 5, 5, -5,-17, -3, -3 }, - { 1, 11,-16, 9,-18, 11, -4, 18, 20, 26,-10, 8, 1,-11, 8, -4, - 0, 7, 3, 5, 2, 2, 10, -2, -4, 4, -4, -2, 1, -4, -5, -1 }, - {-10, 6, -1, 18,-17, 27, -3, 10, -2, 12, -7, -9, 1, 1, -1, 7, - -12, -1, -7, -6, -1, 8, 3,-15, 8, 9, 3, -7, 4, -1, 1, -1 }, - {-14, 6,-16, 22, 2, 5, 0, 5,-18, 11, 6, -3, 22,-20, -9, -3, - 6, -6, -7,-15, 1, 15, -8, 11, 8, -3, -8, 1, -8, 2, 6, -2 }, - {-21, 5,-19, 19, -7, 4, -7, 0, -8, 6, 12, 5, -3,-22,-13, -6, - -1, -3, -2,-14, 6, -3, 1, -8, -7, -5, -6, 11, -3,-10, -5, 2 }, - { -1, 9,-12, 15, -6, 6,-19, 14, -9, 11, 3, 12,-17, -3, 8, -4, - -3, -4, 1, -5, 4, 5, -7,-15, -7, 15, -6, -5, 1, -5, -3, 1 }, - {-12, 20,-15, 20,-14, 3,-14, 9, -6, 33,-13, 6, -2, 8, -6, 7, - -5, -6, -3, -3, 0, 8, -3, -3, 1, -2, 2, 2, 6, -5, -5, -2 }, - { -7, 12,-18, 12,-18, 10, -4, 8, 2, 4, 8, 9, 0, 3, -8, 3, - 6,-12, -4, 1, 25, -5, -9, 6, -7, 0, -9, -7, 3, -5, -4, -4 }, - {-18, 12,-10, 11,-22, 0,-15, 5, -2, 2, -3, 6, -4, -4, -3,-15, - -2, -3, 21, 6,-12,-11, 19, 3, 3,-14, 7, 0,-11,-22,-10, 0 }, - {-15, 2,-30, 15,-17, 13,-16, 8, -7, 10, -8, 2, 11, 3, 10, -7, - 7,-22, 12,-10, 3,-12, 6,-10, 12,-10, 7, -8, 5, 2, 9, 1 }, - { -9, 11,-14, 6,-10, 21, 5, 12, -5, 5, 7, 21, 6, 2, -2, -1, - -1, 4, 2,-20,-18, -1,-14, 3, -1, 4, -7, 10, 1, 11, 4, -4 }, - {-22, 8,-30, 13,-21, -4, 4, -1, 12, 9, -2, -3, 2, -6, 4,-13, - -2, 8, 8, 1, -7, 3, -4, -5, -1, -7, -2, 8, 8, 7, 8, 0 }, - { -6, -4,-35, 16,-13, 15,-11, 14, -7, 9, -1, 11, 7, 0, 13, 10, - -1, 8, 1, 1, -2, 8, -1, 2, 2, 3,-10, -1, 7,-13, -3, -7 }, - {-15, 7,-16, 14,-18, 17, -6, 14, 3, 4, 7, -3, 10,-22, 5,-15, - 4, -4,-11, 15,-15, 11,-11, 20, 1, 0, 2, 1, 11, -3, 11, -7 }, - {-12, 3, 5, 16,-37, -1, 15, 15,-15, 10, 3,-10, 1, 15, 7,-15, - -13, 8, 9, -3, 2, 12, -8, 2, -5, 0, -3, 4, 5, -9, -4, 5 }, - {-16, 26, -4, 14,-22, 26, 6, -3, -8, 4, 21, 6, 16, -4,-11, 7, - -10, 3, 3, 7, -4, 2, -9, 8, -2, 2, 5, -2, -4, -2, 7, -1 }, - { -7,-10, 4, 3, 2, -4,-12,-10, -4, -5, 16, 19,-16, 1, 2, -9, - -10, 0, 9, 7, -8, 3, 12, 8, -6,-11,-13, -1, -3,-20, 6, -5 }, - {-14,-17, 3, -5, 14,-12,-12, 8, -6,-25, 21, 21, 10, -8,-12, 4, - 10, -4, 3, -9, 11, 9, 0, 4, 2,-15, 1,-14, 4, 1, 0, -4 }, - { -4, -9, -3, -1, 6, 3, -6, 6,-10, -4, 14, 8, 2, -3,-12,-19, - 0, 11,-20, 1, 6, -2,-27, -6, 10,-17,-14,-17, -9, 8, -8, 3 }, - {-12,-13, 16, -4, -2, 12, -7,-11, 2,-13, 3, 7,-16,-18, -1,-12, - -2, 1,-12, -9, -2, -6, 2, 9,-22, -3, -4,-14, -7, 7, -1, 2 }, - { -7, -8, -8, 15, 15, 18, 15, 16, -4,-37, 11, 15,-12, -1, -3, 3, - 6, 6, 0, -5, -3, -5, 9, 1, 1,-11, -1, -8, -6, 2, 3, 0 }, - { -6, 7, -5,-12, 13, 10,-18, -4, -3,-21, 6, 16,-15, -7,-12, -9, - 1,-12, -1, 10, -2, -1, -3, 4, -4, 1,-16, -1, 12, -9, 5, 9 }, - {-14, -5, 9, 3, 4, 26,-28, 3, -6,-24, 4, 5, 3, 13, 5, -1, - 3, -1, 3, 1, 1, -5, 3, 0, -7, -8, -7, -3, 3, -5, 4, 0 }, - { -4, 2,-10, -6, 25, 26, -6, 10, -6, -8, 15, 11, -6, -3, 2, -7, - 5, 14, 9, -1, 0,-12, 4, -4,-10, 1, -3, 3, -2, -2, -6, -1 }, - {-10, 8,-15,-10, 19, 17, -8, 0, -3, -7, 7, 5,-13, -1, 7, -7, - 1, 13,-12,-13, 17,-12, 1, 26,-18, -3, -5, -6, 4, 5, 8, 1 }, - { 2, -5, 3, 0, 0, 0, 2, -3, -2, -5, 7, 13, -4, 9, 0, -5, - 4, -1,-11, -8, -4, 0,-13, 2,-47,-23, -8,-11, -4, 4, -2, -3 }, - {-18, -4, 4, 5, -1, 17,-12, -8, 1,-12, 7, 20,-12, 3, -2,-11, - 16, 12, -6, 1,-13,-16, -6, -3, -3, -5, 4,-12, -5, -9, 10, 1 }, - {-11, 0, 4, 7, 7, 8, 3, -1, 3,-19, 32, 8,-19, -8, 2, 4, - -12, 15,-16, 3, 1, 9, -2, 1, -2, 8, 5, 6, -4, -1, 11, -8 }, - { 3, -1, 4, -2, 14, 32, -9,-23,-10,-12, 22, 15, -1, -2, 10, 0, - 4, 6, -8, 4,-15, -2, -1, -4, 0, -8, 4, 1, -8, 3, 4, 1 }, - {-17,-12, 6, -8, 16, 13,-20, -8, -1,-16, 10, 21,-19, 11, -9, -5, - 7, 18, -6, 7, -7,-18, 13, 2, -2, 8,-12, -9, 2, 4, -5, 16 }, - { 4, 0, 17,-11, 12, 7,-12, 5, -1,-25, 30, -8, -7, -6, -4, -7, - 9, 8, 7, 3, 3,-16, 8, 0, -2, -2,-18, -3, -4, -5, 1, 4 }, - { -3, -6, 6,-16, 17, 6, -3, 2, -9,-17, 12, 11, 11, 2,-20, 8, - 1, 1, 0, 2, -2, -6,-21,-13, -9,-15, -1, -8, -6, -8, 0, -2 }, - {-11, -7, 6, -9, 3, 6, 8, 16, 4, -5, 23, 26,-10, -3, 4, 0, - 2, 2, -4, 4, -2,-12, 12, 10,-11, 0,-10,-16, 3, 0, 0,-10 }, - { -5,-16, 10, -6, 27, 13, -3, 4, -2,-13, 15, 5, 2, 5, 3, -4, - 13, 12,-11, -7, 0, 1, 11, 12, 2, 13,-15, -8, 9, -2, 3, 8 }, - { -5, -8, 4, 3, 9, 3,-11, 10, 14,-25, 14, 8, -2, 5,-12,-21, - 2, 10, -7, 2, -3, 2, 0, 2, -1, -3, -5, -6, -1,-16, 2, 8 }, - { -1, 5, 1,-11, 5, 9, -7, 8,-13,-12, 4, 12, -4, 1, -1, -1, - 27, 29, 10, 15, 2, -6, -3, 4,-21, 10, -9,-11, -6, -1, -9, -3 }, - { -6, -3, -1, -6, 11, -5, 0, -2, -5,-31, 11, 3, -1, 5, -3, 4, - 5, 7,-10, 5,-10,-13, 4, 12,-15, -2, 2, -7, 1, -9, -3,-10 }, - { -3, -7, 17, -8, -5, 36, 8, -7, -8,-20, 12, 8, 1, -1, 3, 0, - 1, 4,-10, 3, 1, 4, -2, -3, -2, -3,-10, 4, -1, -7, 3, 2 }, - {-13, -3, -5, 9, 22, 6,-23, 3,-10, -7, 17, 17, 18,-14, -8, -8, - 2, 4, -8, 2, -3, -8, 6, 4, -1, 7, 0, 0, -3, 0,-12, -3 }, - { -3,-10,-15, -3, 9, 3,-23, -9,-13,-18, 12, 13, -2, 0, 1, 8, - -1, 2, -7,-12, -5, 14, 2, 1,-22, 6,-10, -8, -9, 28, -7,-14 }, - { -3, 1, 2, -1, 13, 7, -2, -7, 1, -3, 6, 9, -3, -2, 4, -2, - 2, 1,-10, -2, -2,-22, -2, -7,-10, -5,-11,-27,-12,-16, 4, -7 }, - { 2, -6, -3, 1, 8, 0, -2, 12, -3, -4, 58, 15,-10, -4, -2, 2, - -2, 0, -2, -6, 2, 4, -1, 1, -4, 1, -1, -5, -4, -3, 3, 1 }, - { 10, -1, 0, 5, 21, 7,-14, 6, -3,-16, 15, 17,-16, 13, 3, -6, - -4, 6,-12, -5, 1, -4, -7, -8, 2, 3, -6, 6, -1, -8, 5, 4 }, - { -6, -2, -8,-11, 15, 10, 0, 8, -6,-15, 33, 8, -2, 18,-15,-11, - 5, -1, 0, 15,-15, -4, -4, -1, 10, 7,-13, 4, -4, 0, 8, 3 }, - { -7, -2, 0, -2, 0, -2, -4, -5,-14,-16, 12, 38, 7, 12, 6, -4, - 0, -1, 0, 3, -2, -6, 0, 2, -9, 1, 0, -1, 0, -2, 4, 1 }, - { -8, -4, 18, 1, 14, 5,-12, -3, 20,-17, 5, 19,-11, -8, 11, -3, - 3, 9, -7, -8, 9,-17, 2, 15,-10,-11, 5, -5, 7, 15, -6, -2 }, - { -7, 2, 38, 5, 19, 16, -5, 4,-13,-20, 0, 4, -4, 6, 4, 2, - -7, 6, -8, -2, -5, -7, 6, 3, -4, -3, -2, -3, 7, -6, -4, 0 }, - {-11,-12, 8,-15, -3, 14, -7,-22,-11, 2, 22, 14,-19, 2,-19, -6, - 1, 3,-18, 14, 2, -6, -2, -8, -3, -6, 5, -7, -8, -4, 1, 1 }, - { 8, 7, 25,-21, 12, -6, -5, -4,-10, 6, 0, 10, 1,-12, 18, -5, - -15, 4, 1, 14, -1, 5, 8, -7, 1, -7, -3, 9, 10, 1, -1, 0 }, - { 9, 10, 32,-15, 8, 2, 11, -7,-18, -8, 2, -6, -9,-16, -3, 3, - -1, 3, 1, -5, 4, -2, 1, -8, 0, -6, -3,-11, 1, 5, 0, 0 }, - { 14, 0, 23,-25, 22, 3, 7, 10, 0, -2, 7, 8, 0, 10, 0, 0, - 3, 2, 3,-10, 0, 10, 0, -7, 0, 10, -1, -5, -7, 1, -1, 2 }, - { 12, 0, 25,-18, -5, -4, 13,-10, 3, -6, 7, 21, 0,-16, 3,-10, - -6, 5, -7, -3, 2, 5, 3, -6, 4, 9, -8, 12, -2, 3, 2, 4 }, - { 31, 15, 27,-20, 10, -7, 15,-10, 9, -8, 4, -5, 3, -3, 5, 6, - 11, -2,-12, -2, 6, -2, 1, 2, -1, -1, 1, 1, 3, 1, 1, 2 }, - { 12, -4, 13,-23, 12, -6, 2, 4, -3, 13, 6, -7, 5,-19, -7, 18, - 1, -7, 7, 1, 16, -7, 3, 0, 3, 0,-12, 8,-11, 9, 4, 7 }, - { 29, 1, 3,-22, -5, 6, 0, 12,-14, 11, 1, 6, -3, 4, 6, -2, - 4,-13, 12, 1, 1, 3,-11, 9,-10, -1, -7, 16,-11, -1, 3, 9 }, - { 4, 4, 36,-23, -5, -8,-15, 1, -6, 3, 13, -1, -5, -7, 4, 9, - 2,-11, -3, 5, 1, 3, -6, -1, -4, -4, -2, 2, 3, -1, -5, -2 }, - { 19, 10, 6,-17, 2, -4, -2, -4, -3, 13, 2, 2,-13, -7, -3,-11, - 9, -6, 1, -9, -5, 4, -5, -9,-18, -7,-11, 9, 4,-11, 8, 4 }, - { 16, -3, 9,-16, 18, -2,-12,-16,-11, 11,-18, 16,-13, 6, 2, 8, - 3, 8, -4,-16, 10,-11, -1, -3, -8, 5, -9, -4, 9, -4, 0, -3 }, - { 14, 15, 3,-23, -5, 7, -8, -6, 2, 17, 2, 12, -8,-12, 13, -1, - -9, 3, 1, 1, 19, 15, 4, -1, 1, 2, -3, 2, -3, 1, 5, 3 }, - { 32, 5,-10,-47, -5, -1, 4, 11, -7, 0, 2, -2, 1, -7, 6, -4, - 6, 2, -4, -2, 2, -2, 0, -4, 1, -6, -5, 2, -2, -1, -3, -4 }, - { 20, 8, 10,-21, -7, -9,-16, 12, 1, 4, 6, -5, 9,-11, -7, 4, - -11, 28, -3, 2, 4, -6, 10, -8, -5, -5, -9, 9, -2, -1, 6, -5 }, - { 38, 3, 23,-25, -6,-18, 3,-10, -8, 6,-10, 1,-10, 2, 2, 0, - -7, 2, -4, 5, -1, 8, -3, 0, 3, 3, -1, 1, 0, -4, -4, 0 }, - { 20, 5, 16,-22, 24,-18, 2,-12,-14, -7, -3, 10, 2, 7,-10, 2, - -8, 1, 8, -1, 4, 1, 4, -2, 5, -9,-18, -8,-13, 5,-11, 10 }, - { 14, 8,-12,-16, 9,-11, -3, -6,-25, -7, 6, 5, -7,-16, 10, 2, - -7, -1, -9, -3, 16, 4, 3, 3, -3, -3,-15, 13, -3, 4, 13, -7 }, - { 16, -9, 19,-23, 7,-19, -3, -5,-15, 11,-21, 21,-16, 18, -1, 6, - 10,-10, 18,-14, 16,-15, 6, -5, -9, 5,-17, 13,-10, 13, 0, 10 }, - { 8, -4, 4,-24, 8,-21,-18, 9,-11, 4, -6, 17, 5, -9, -2, -2, - 2, 15, -2, -3, -2, 1, 7,-13, 15,-10, -8,-11, 3, 3, -1, -1 }, - { 14, 17, 6,-32, 5,-17, -2, 0, 15, -1, -5, 16, 1, -5, -2, 9, - -3, 8, 4, -2, -2, -4, -3, 1, 0, 7, -3, 4, -5, 0, -7, 2 }, - { 24, 6, 22,-12, 8, 3,-14, 4, -7, 8, 6, 5, 6, 1, 6,-12, - 15, 10, 4, 11, 9, 6, -7, -4, 10, -9, 2, -1, -5, 11, 15, 3 }, - { 17, 12, 3,-23, 5, -1, -2, 1, -9, -1, -3, 1, 8, 1, -5, 17, - 11, 0, -2,-11, 7, 4, 0,-27, -7, 1, 2, -8, 9, 7, 5, 3 }, - { 12, 10, 12,-10, -4, 5, -1, 2,-24, 5, -8, 2, 6,-17, 19, 5, - 12, -2, 16, -7, -6,-14, 4, 1, -3, 13,-16, 5, -1, 4, 1, 1 }, - { 31, 9, 11,-17, 10, -3, -7, 7, 1, 2, 2, 4, -3, -1, 11, 4, - -5, -8, 1, 4, 15, -6,-28, 1, 8, 3, -6, 5, 17, -2, 2, -4 }, - { 11, 19, 16,-26, 0, -7, -7, 2,-13,-15,-12, 9, -3, 27, 8, 4, - -6, 1, 4, -6, 11, -1, -6, -7, -3, 0, -6, 4, -6, -7, -3, -1 }, - { 10, 18, 16,-32, 19, -9, -4, -3, -7, 8, 8, -3,-11, -2, -6,-16, - 13, 13, -6, -1, 10, -2, -2, -9, 0, -3, 9, 4, 11, -2, -6, 6 }, - { 9, 4, 19,-33, 4, 7,-12, 36, -3, -1, 8, -2, 2, -8, -9, -4, - -8, 0, 1, -1, 0, -4, -4, 3, 0, 3, 6, 0, -6, 2, 0, -2 }, - { 25, 7, 15,-12, 2,-24, -1, 24, -4, 4, 9, 0, -2, -9, 4, 6, - 3, 13, -3, 1, 5, -1, -3, -5, -1, 7, -2, 3, 4, 4, 1, 0 }, - { 19, 6, 8,-20, 9, -9, 5, -4,-13, 7, 11, -3, 5,-13, -9, 6, - -11, -1, 0, 4, 11, 26, 3, 6, -7, 12, 6, -3, 1, -9, 7, 1 }, - { 15, 6, 19,-23, -3, -9, 3, 16, -6, -4, 6, -5,-10, 1, 16,-14, - 2, 0, 2,-13, -3, 8, -6, 3, 1, 1, 2, -5, 12, -4, -8, -3 }, - { 14, 4, 16,-20, 1, 12, 0, 6, -3, 9, 4, 16, 10,-16, 5, 7, - 5, -4, -4,-18, -3,-11, -4, 4, -7, 3, 13, 7, 3, 3, 2, -7 }, - { 22, 3, -1,-30, 18, -3, -9, 9, -2, 11,-16, -2,-14, 12, 0, 4, - -5, 4, -1, 3,-20, 12, 4,-10, -2, -2,-12,-12, 10, 6, 11, -3 }, - { 15, 7, 2,-21, 5, 4, 9, -9,-33, 7, 7, 3, -6,-14, -8, 10, - 12, 0, 2, -1, 5, 4, -2, 0, -7, 0, 2, 4, 0, 1, -3, 8 }, - { -7, 0, 12, 3, 0, -6, 8, -4, 0, 2, 14,-15, 2, -7,-31, -3, - 14, 0, 14,-15, -1, -4,-15, 10, 1, -3, 1, 2, 5, 2, -8, 1 }, - { -2, 5, 1, 0, -3, 3, 3, -6, -1, 2, -4, 1,-19, 0,-11, 18, - 11, 10, 21, 5, 6, 2, 10, 3, -6, 0, -2, 13, 5, -1, -2, 9 }, - { -9, 1, -5, 0, 0,-15, 8, 4, 8, 3, 8, 12,-13, -2,-39, -2, - 4, -4, 5, -3, -4, 3, -3, 3, 10, 5, 3, 2, -3, 5, -2, 8 }, - { -9, 6, 6, -8, 12,-12, 23,-18, 4,-15, -5, 2,-20, 13, -7, 7, - 7,-12, 14,-12, 6, 1, 1, -3, -8, 9, 0, 1, -7, 3, 7, -6 }, - {-18, 13, 4, 3,-10,-30,-10, -6,-14, 1, -7, -4,-35, 5,-25, 11, - 9, 8, 19, -4, -7, -3,-18, -8, 1, 5, 10, -4,-14, -9, 3, -4 }, - { -6, -1, 4, -9, -9, 4, 20, 0, 0, 3, 11, 7,-16,-17,-20, 11, - -6,-14, 1, 4, 19, 2, -8, 6,-15, 3, 6, -5,-14, 3, 7, 2 }, - { 1, 6, -2, -8, -5, -3, 3, -8, 21, 1, 3, 16,-14, -2, -9, -4, - 13, -2, 18, 14, 14, 19,-13, 5,-10, 2, -3, 3, 5, 5, 1, -1 }, - { -1, -5, -6, -2,-11, -7, 5, -4, 5, -1, 0, 3, -3, 2,-19, 18, - 16, 4, 14,-22, -2,-11,-22, 1, -1, 11, 1, 2, 11,-10, 7,-12 }, - { 1, 4, 5, -1, -9, -5, 1, 12, 5, 6, 12, 9,-24, 23, 1, 20, - 14,-11, 13, 5, -2, -2, 5, 6, 2, 1, -9, 6, 10, 5, -4, 11 }, - { -1, -1, 1, 7, -3, -4, 8,-16, 15, -1, -7, 9,-22,-11,-11, 10, - 16, 9, -2, 4, 13, 10, 6, 16, 4, 7, 1, -8, -7,-14, -7, 4 }, - { 1, 3, -6, 0, 15, -9, -4, 0, 4, 6, 12, 9, -6, -5,-22, 17, - 7,-11, 15, -5, 1, 3,-19, 0,-15, -3, 16, 5, 5, -7,-11, 12 }, - { -2, -1, 13, 2, 4,-24, 37, -5, -2, -6, 12, 7, -2,-23, -4, 9, - 2, -3, 3, 2, 3, 3,-14, 11, 0, -4, -2, -2, 3, 10,-10, 4 }, - { 2, 9, 8, -6,-28, 14, 28,-11, 18,-11, 0, 2, -2, 4,-12, 3, - 6, 0, 7, -7, -6, 2, 5, -1, -1, -1, 5, 2, 3, 0, -3, 9 }, - { -7, 14, 5,-10, -3, 7, 4, -5, 7, -8, -7, 4,-12, 14,-16, 25, - 3, 0, 1, -5, 12,-10, 0,-10, 0, 12, 12, 17, 12, 10, -1, 0 }, - { -4, -2, 5, -2,-17, -3, 5, -5, 7,-17, 1, 5, -4, 4,-20, 0, - 11,-15, 13, -8, 10, 1, 1, 5,-12, 9, -8, 0, 6, -1,-11, 4 }, - { -3, 12, 13,-15, -7, -7, 0, 5, 33, 3, 3, -6,-13, -7,-15, 10, - 3, 3, 3, -5, 2, 7, -1, 0,-12, 2, 11, -6, -9, 0, 5, 11 }, - { -8, 5, 10, -7,-14, -4, 13, 0, 18, -3, -6, 7, 1, -6, 0, 21, - 8, -7, 10, -8, -3, 17, -9, 0, -5, 1, 4, 8, -3, 11, -5, 0 }, - { -8, 8, -3, -8, 8,-11, 16,-16, 17, 0, 8, 16,-17, 10,-16, 10, - -8, 6, 11, 0, 10, 7, 4, 5, 7, -5, -5, -6, -7, -5, -1, 16 }, - { -6, 0, 6, 1, -8, -8, 8, -7, -5,-10,-11, 8,-19, 6, -7, 13, - 5, -3, 4, -8, 7, -1,-18, 9, 0, -5, 6, 26, 3, 8, 2, 4 }, - { -2, -2, 23, -2,-20, 2, 7, -7, -6,-15, 3, 9,-19, -2,-10, 7, - -2, 7, 9, 11, 0, 4, -4, 6, 9, -2, 4, -3, 4, 3, 2, 8 }, - { -6, 12, 10,-10, -7, 4, 17, 11, -6, 1, 12, 11,-18, 8,-12, 4, - 1, 13, 6,-13, 23, 9, -5, 8, -2, -5, 1, 3, 0, -2, -4, 4 }, - { 7, 1, 7,-17, -8, 8, -1, -7, 5, -6, 4, -3,-16, 9,-24, 18, - -3, 10, 13,-11, -6,-11, -4, 10, 0, 11, 8, 2, 6, -5,-11, 4 }, - { -4, 1, -5,-10, 0, -3, 9, -2, 4, -1, 1, 5,-41,-10, -7, 4, - -3, 3, 1, 0,-12, 4, -3, 0, 2, -1, -2, -5, 3, 2, -7, 5 }, - { -2, 1, 4, 4, -3, -6, 1, 0, 12, -5, 11, 0,-17, -3, -1, 11, - 4, 1, 27,-12, 0,-14, 2,-15, -3, -9, 0, -7, -3, 15, -8, 6 }, - { -6, 4, 9, 2, 4, 3, 7,-10, 28, 1, -2, 48, 7, 0,-10, 10, - 1, -9, 2, -1, 0, 3, -5, 5, -4, -2, 7, 7, 1, 3, 2, 5 }, - { -3, 3, -1, 3, -9, 0, -1, 3, 2, -6, 39,-14,-12, 5,-19, 21, - 7, -6, 4, -1, -4, 0, -4, 1, 0, -9, 1, 10, 0, -2, 0, 7 }, - { 4, 2,-29, 12, 5, -3, 16, -6, 15,-13, -4, -1,-13, 22,-16, 17, - 16, 4, 9, -4, 4, -6, -4, 11, -8, 7, 8, 4, 3, -3, -7,-13 }, - { 0, 3, 3, -6, -4, 0, 9, 0, 5, 0, 10, 10, 4,-13,-12, 16, - 23, -4,-12, -6, -4, 20, 2, 0, -4, 23, 1, 8, 11, -4, -5, 15 }, - { -6, 4,-15, -9, -1,-19, 12,-30,-17, -4, 1,-13,-13, 4, -3, 26, - 5,-25, 11,-14, -6,-13, 0, -7, 9, 2, 8, -1, -8, 1, -8, 13 }, - { 1, 6, 1, -4, -4, 1, 2, 0, -3, 2, 10, 6, -6, -2,-11, 4, - 32, 15, 15,-47, -8, 3,-12, 4, -5, 4, -1, 0, -5, 5, 1, -7 }, - { 2, -1, 0, 0, -1, -6, 0, -6, 4, -4, 5, 9, -5, 1, -3, 51, - 4, -5, 4,-14, -1, -4, -3, 1, -4, -1, 0, 2, -8, 0, 1, 2 }, - { 0, 4, -2, -7, -2, -9, 6, -8, 11, -3, -6, 3,-11, -8,-12, 8, - 11, 5, 19, 3,-24, 19,-14, 11, -5,-18, -8,-12, -5, -4, -1, 4 }, - { 16, 9, 10, 14,-18, -2,-18,-27, 10, -5, 12, 14, 4, 0, -2, -6, - -12, -7, -1, 3, 4, 7, 11, 10, 5, -5, -7,-16, -3, -6, 6, 9 }, - { 7, 15, -9, 10,-19, 4, -5,-37, -2, -4, 8, 2, 4, -1, 1, 9, - -5, -5,-12, 1, -1, -8, 3, -3, 4, 6, 9, 3, 3, -1, 2, 4 }, - { 13, 17, 3, 9, -7, -7,-15,-17, -8,-13, -4, -8, 19, 2, 16, 25, - 7, 15, 2, 16, -5, -6,-10, -9, -7, -6, -2, -7, 7, 2, 4, 5 }, - { 24, 7, 9, 8,-13, -2, 0, -4, 1,-13, 3, 6, 7, 10, -4, 15, - 5, 7, -4, 5, -5, 3, 13, -7, 5, 15,-11, -2, 7, 5, 8, 6 }, - { 17, 6,-15, 23, -2, -1, -6, -2, 0, -4, 11, -3, 12, 15, 6, -8, - -15, 10, -9, 7, -1,-11, 2, -8, -4, 3, 4,-10, 4, 4, 11, 1 }, - { 21, 12, -3, 6, -8, 8,-11, -8, -5, -5, 3, 7, -1, -5, 12, 15, - -10,-11, 3, 15, 8, 4, 2,-15, 0, 14, 1, -8, -1, 3, 10, -7 }, - { 16, 12, 5, 13, -6, 15,-23, 0,-17, -9, 0, 4, -9, 13, 6, 18, - 0, 0, -4, -1, 0, 14, 5, -1, 8, -4, -8, -6, 5, -2, -2, 0 }, - { 14, 16, -1, 12,-15, -9, -6,-20, 4, 6, 8, 9, 3, 1, -9, -4, - -1,-11, 9, 11,-12, 1,-14, -7, 2, -8, 11, 9, -4, 10, 4,-16 }, - { 13, 10, 3, 7, 0, -8,-33, -6, 4, -4, 19, -2, 14, 6, 5, 7, - 6, -3, -1,-10,-10, -9, 4, -3, 5, 9, 2, 2, 10, 9, -2, -3 }, - { 11, 10, 25, 18, -1, -6,-21,-21,-11,-16, 6, 5, 14, 4, 8, 7, - 0,-10, -7, -9, -5, -4, 3, -1, 1, 6, -1, 6, -2, 2, -3, -9 }, - { 15, 9, 5, 22,-17, 15, -9, 7, 7, -9, 13, 9, 10, -1, 8, -3, - -2, 6, 1, 17, 8,-14, 7, -3, 12, 9, 1, 0, 1, -5, 17,-18 }, - { 25, 19,-17, 12, -4,-10, 1,-13,-19, -7, -3, 9, 6, -2, 3, 1, - 4, -2,-11,-14, -1, -7, -5, -9, 7, -1, -3, 4, -5, 1, 0, -1 }, - { 20, 8, -3,-10,-24, 3, -6, -2, 0,-12, 14, 6, 7, 11, 4, 7, - -12, -5, -8,-10, 5, -1, -4, 4, 16, 7,-14, 6, -1, -2, -7,-11 }, - { 16, 18, 17, 1,-15, -6, -5, -3, -1,-19, 8, -2, 2, 8, 12,-19, - -12, 8, 0, -3, -1, -1, 4,-14, 9, -1,-12, -1, -7, 10, -3, 5 }, - { 18, 12, -7, 7, 0, -3,-13, 0, -1, -4, 9, -2, 6, -1, 0, 1, - 15,-21, 1, -8, 25,-19, 13, -9, 2, 12, 5, -7, -3, -1, -3, 1 }, - { 13, 16, -4, 9, -2, 2, -1,-19, -7, -4, 18, -6, 14, 18, -5, 4, - -6, -3,-19,-14, -1,-12, 10, 6, 7, 17,-12,-13,-10, -4, 5, 4 }, - { 27, 17, 4, 14, -9, -2, -4, -8, 0, -6, 14,-11, -7, 2, -3, -3, - -2, -3,-13, 12, 16, 1, -5, -9,-10,-11, -2, 3, -7, 5, 11, -7 }, - { 7, 17,-16, -2,-14,-28, -7, -8, 15,-10, 7, 15, 8, 17, 13, -1, - 4, -7,-12,-11, 0, 0, 2, 3, -3, 7, -6, 6, 1,-16, 1, -2 }, - { 23, 11, -9, 15,-23, -4, -6, -4, 2, -9, -7, 9, -8, 3,-13, -4, - 8, 18, -6, -2, 1, -5, 6,-14, -5, -2, -6, -5, -3, -2, 4, -5 }, - { 12, 13, 18, 18,-35, 2, 7,-17, 3,-11, 6, 9, -3, -2, 10, -4, - 3, 3, -2, -7, 0, 2, -4, 0, -4, 0, -6, 5, 10, 4, -3, -1 }, - { 19, 11, 1, 20,-14, 4, -9,-13, -2, 11, 0, 17, -1, -1, -1, -1, - -5, -8, 0, 5, -1, -8, 5, -1, 3, 2,-12, 21, -2,-24, 5, 7 }, - { 15, 15,-15, 17,-14,-22, 3, -4,-11, -3, -7, 1, 18, 10, 1, 10, - -6, -3, 8, 2, -7, 0, -2, 1, 1, 2, -9, -2, 1, 2, -3, 4 }, - { 45, 13, 8, 17, -5, 2,-16, 2, 8, -2, 8,-15, 4, 5, -1, 7, - -6, -2, -6, 2, -3, 0, 0, -9, -1, 7, 2, 3, -3, -3, -1, 5 }, - { 1, 18, -8, 18,-12,-10, 3, 4,-22,-12, 20, 8, -3, 9, 2, 10, - -10, -3, 9, 3, 6, -3, 10, -1, -3, 2, -2, 4, 2, 3, -3,-18 }, - { 9, 10, -5, 9,-35,-21,-18,-16, -1,-12, -6, -7,-15,-19, 12, 4, - 4, 9, -7, 2, 14, 1, 4, 0, -1, 6, -7, 2, 1, 1, -4, 4 }, - { 31, 8,-17, 35, -8, 1, -5, -6, -7, -6, 10, -2, -3, 6, 9, 3, - -6, -2, 3, 3, 5, -3, 0, 6, 0, 1, -5, -3, -2, -4, -1, 0 }, - { 18, 4, -8, 7, -8,-15, -1,-16, 12, 18, 3, 19, 2, 4, 8, 8, - 0, -5, -8,-12, 10, -5, 0, 1, 0, 4, -3, 16, 11, 11, -2, -6 }, - { 27, 15,-17,-10,-23,-22, -1,-14, -4, -7, 20, -2, -7, 6, 15, -5, - 32, 4, 9,-11, -3, -8, 11, -4, -1, -4, -8, -6, -4, -5, -2, -7 }, - { 22, 4, -7, 2,-15,-11,-17,-10, 2, 0, 15, 11, 7, 12, -8, 6, - -10,-18, -6,-12, 7, 3, 22, 3, -7, 14, -5, -2,-13, -7, -1, -7 }, - { 18, 13, 9, 24, -4,-19, -9,-11, 13, 8, 2, 4, -1, 8, 14, 10, - -12, 0, 0, 5, 10, 5, 4, -1, 5, 1, -1, 11, 2, -4, 0, -9 }, - { 15, 19, -5, 1, -4,-10, -8,-27, 6, 8, 5, 10, 4, 11, 5, -5, - -11, 0,-11,-14, -4, -9, -8, -8, 6, -9, 4, -5, -1, 1, 5, -4 }, - { 18, 1,-13, 14,-14, 9,-15, -7, 12, 1, 13, -4,-20, 12, 10, 12, - -12, 7, 1,-13, 10, -6, 5, -3, 4, 8, 10,-13, -3, -6, 9, -3 }, - { 19,-14, 5, -8, -6, 2, -5, 5, -3, -1,-28, 11, 18, -6, -4, -2, - 11, 14,-43,-42, 9, 2, 20,-23, 6, 32, 0, 5, 0, 6, 9, 5 }, - { 8, 11,-14, -1, 7, 12, -7, 2,-16, 2, 10, -3, -1, -7, -7, -1, - 1,-10,-60,-23,-18, 42,-13, 9, 18,-11, 0, 1, 0, 2, -5, 1 }, - { -5, -1, 2, 0, 3, -3, 3, -2, -6, 0, -3, -3, 7, 2, 0, -2, - -2, 3,-34,-15, 37, 47, 10, 20, 9, 1, 3,-21,-25,-33,-14, 8 }, - { 5, 6, 2, -2, -2, -2, 6, 5, -5, 7, -3, 1, -5,-13, 9, 3, - -17,-19, -2,-79,-12, -7, -8, -6, -2, -2, -1, -1, -7,-13, 6, -1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, - 0, 3, 4,-87, 6,-11, 16, -9, -1, 8, 0, 5, 0, 1, 2, 1 }, - { -5, 6, 2,-24, 5, -9, -7, 0, 7, 3, -3, 16,-14,-16, 0, 18, - 15, -9,-14,-28,-17, 53, 14, -6,-28, -1, -3,-10, -7,-14, 19,-15 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -3, 0, - -13, 0,-53, 3,-22, 63, 19, 16, 1,-11, 0, -3, 0, -3, 0, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -1, -6,-43,-43, -2, 65,-13, -4, 9, 1, 1, 2, 1, 0, 0, 1 }, - { 0, 1, 0, 0, -1, 0, 1, 1, 0, 0, 1, 2, -1, -1, -3, -1, - -23, 1,-61,-55, 3,-28, -6, -4, -4, 8, 2, 1, 1, -1, 0, 0 }, - { 0, 1, -1, 1, -1, 0, -1, 0, 1, -1, 0, 1, -1, 0, -9, -4, - -48,-19,-52,-46, 11,-12, 5,-14, 0,-10, 0, 0, -1, -2, -1, 0 }, - { 0, -3, -1, -4, 2, -1, -7, 3, 1, 3, -1, 1, -3, 0, -7, 0, - 3, -7,-61,-51, -4,-21,-16,-21,-11, 14, -7, 8, 3, -5, 1, 2 }, - { 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, -1, 9, -3, - 56,-11, -6,-67, -1, 13, 0, 7, 1, -9, -1, -1, 0, 0, 1, 0 }, - { 14, 9, -2, 14,-10,-10, 9, -5, 1, -8,-23, 30, 8, -7, 23, 8, - 2, 10, -1,-27,-17, 57, 22, 4, -5, 2,-12, -6, 2, -7, -4, -9 }, - { 1, 5, 12, -2, -2, -3, 2, -3, 6, 0, 4, -2, -8, -6, 0, 16, - -15, 29,-55,-29,-24, 29, 3, 10, 6, 13, 10, -5, 21, 11,-14, 5 }, - { 4, 2, 26, -6, 10, 11,-23,-10,-27,-20, 3,-24,-11,-10,-13, 25, - -10, 5, -9,-36, -7, 43, 3,-13, 6, 13, -2, 0, 1, 3, -3, -4 }, - { -1, 0, -1, 0, 0, 0, 0, -1, 1, 0, -1, 0, 0, 0, -1, 1, - -12, 12,-26,-64,-15, 29, 37, -7, -3,-12, -5, 14, 8, -8,-10, -2 }, - { 19, -4,-11,-16, 8, 14, 5, 19, 3, 22,-11,-21, -1, -6,-11, 11, - 10,-24,-23,-40, -8, 20, 17, 5, 13, -6, 3, 14,-20, -8, 3, 28 }, - { 2,-12, 10,-14,-18, 26,-22, 4, -2, 5,-21, 8, 3, 1, 19, 0, - -12, 24,-14,-40, 15, 29,-15, 6, 15, 1,-19, 2, 4, 7,-12, -3 }, - { 0, 17, 13, 7, -5,-11, 2,-19, 3, 38,-21, -3, -6, -4, 7, 1, - 1, -5,-40,-10, -2, 35, 8, 8,-10, -8, -9, 33, 4, 4, 0, -2 }, - { -2,-12, 7, 29,-24, 2, 16, -1, -7, 16, 10, -2, -2, -2, 13, -2, - -37, 15,-22,-40,-11, 33, 10, -1, 8, 10, 6, 8, 9, 0,-12, 2 }, - { 15, -8, -9, -2, 7,-17, 7, 19, 14, 4, 12, 27, 11, 10, 4, 11, - -15, 14,-13,-48, 5, 18, 0, -9,-36,-11, 2, 4, 5, 5,-15,-12 }, - {-12, 0, 3, 4, 7, -5, 5,-14,-24,-18, -6,-15, -8,-20, 1, -7, - -33,-28,-40,-38,-18,-10, -5, 17,-12, 4, 3, -5, 5,-13, 4, -7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 3, -2, 9,-29,-11, 55, 8, 32,-36,-13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1,-39, -4,-30, 63, 28,-17, -6, 10, 7,-14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 13, -2,-50,-32, 22, 51, 4, 7, 6, 11,-20,-13, 9, -5, 21, -4 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, - -3, -9,-49,-60, -5, 45, -1, 6, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, - 3, -2, 9,-29,-11, 55, 8, 32,-36,-13, -7, 37, 4, 11, 0, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4, -1,-39, -4,-30, 63, 28,-17, -6, 10, 7,-14, -9, 11, 9, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, - 13, -2,-50,-32, 22, 51, 4, 7, 6, 11,-20,-13, 9, -5, 21, -4 }, - { -8, 2, 1, 22,-31, -6,-25, -3, -3, 1,-15,-11, -2, -3, 4,-13, - -9, 15,-18, 37, -7,-37, 12,-13,-11,-25,-10,-11,-22, 7, 16, 7 }, - { 14, 10, 4,-10, -1, -5, -7, -3, 16, 13, -5,-15, 5, 11, -1, 8, - -27, 7,-12, 49, 17,-22, 9, -2, -9, -1, 2,-15, -1, 41,-18,-17 }, - { -4, -9,-15, -3, 3, 4, 4, 2, 7, -3, -7, -8, -5, 17,-19, -7, - 36, -9,-38, 17, 1,-48, 11,-18,-13, -2, -8, 4,-10, -5, 21, 11 }, - { 15,-13, 4, 2, 1, -5, -2, 1,-10, 7, -1, 3, -6, 0, 11,-11, - 8, 20,-17, 51,-17,-41, 2, 15, 4, 8, -2, 16,-32, -1, 17, 6 }, - { -8, 8,-18, -5, 4, 6, -3, 8, 0, -4, 2, 0, -1, -4, 5, 8, - 30, 30, -8, 70, 2, 8, 2, 0, 7, 1, 13, -1, -6, -7,-11, 2 }, - { -8, -7, 9,-10,-13, 6,-11,-14, 13, 25,-26, 5, 2, -5, -5, 5, - -8, 4, 0, 33, 12,-38, -4, 6, 13, 6, 25, 34, -1, 25,-19, -5 }, - { 18, 3,-17, 4, -8, 7, 20, 1, -1, 5, -5, -2, -8, 8,-35, 15, - 24, 43, -5, 51, 5,-12, -3, 1, -2, 3, -3, -3, -9, 8, -9, 2 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 2, 10, 24, 76, -2,-22, 11, -1, 4, 33, 4, 1, -1, 1, 2, 0 }, - { 0, -1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 2, 0, - 24, 13, 32, 70, 26, 5,-21, -9, -6,-15, 2, -2, 2, 4, 1, 1 }, - { 5, -4,-11, 4, -4, 22, 10, -2, 13,-11, -4,-21,-17, 0, -7, 4, - 10,-34, 11, 52, 2,-46, -5, 0, 0, -1, 2, 4, -9, 1, 1, -7 }, - { 0, 1, 1, 0, -1, 0, 1, 0, 1, 1, 0, 1, 0, 0, -3, 1, - -8, 9, -1, 64,-13,-61, -3, 3, -5, 10, 1, 3, -1, -1, -1, -1 }, - { 0, 1, 0, -1, 0, -1, 0, 0, 1, 0, 0, 0, 1, 1, 2, 1, - 10, -2,-31, 79,-10, 27, 0, -1, 3, 8, 1, 1, 0, -1, 0, -1 }, - { 3, 12, 10, 26,-19, 10, -9, 6, -4,-15, 10, 3,-16, 6, 11,-19, - 3, 10, 18, 44, 5,-30, 5, -9, 21, 4, 20, 10, 14,-25, 8,-17 }, - { 0, 0, 0, 1, -1, 0, -1, 0, 1, 0, 1, 1, 0, 0, -6, -2, - 8, -8, 13, 69, 26,-19,-25,-17, 16, 6,-12, 22, 2, -6, 9, 5 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, - -34,-15,-33, 56, 9,-42, 9, 10, 6, 9, -8,-11, 0, -6, 15, 5 }, - { 10, 2,-14, -3,-15,-35, -1, 7,-18, 14, 8, -1,-15,-26, 6,-15, - -18, 22, 9, 33, 0,-32, -9, 3,-11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5,-11, 9, 6, 6, 6, 14, 2, -1, 10,-24,-25, - -2, -4, -1, 37, 2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 }, - { 0, 5, 2, 18,-12, 21, 22, 33, -7, 21, -9, -7, 7,-15, -7, 16, - 7, 0,-14, 44, 10,-25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25,-23, 8,-22, -3,-18, -8, 15, 12, 9, 19, - 0, 0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4, 2, 7, - -13, -2,-15, 43, -5,-30, 27, 4, 10,-27, 5, 27,-10,-10,-18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15,-13,-20, 16, 2, 13, 5,-11, -8, -5, -3, 2, 24,-23, 30, -7, - 11, 30,-15, 43, 5,-15, 15, -3,-14, 1,-23, 8, 3, 9, 4,-11 }, - { 0, -1, 0, 1, 0, -1, -1, 0, 0, 1, -2, 1, 0, 0, -4, -1, - -34,-15,-33, 56, 9,-42, 9, 10, 6, 9, -8,-11, 0, -6, 15, 5 }, - { 10, 2,-14, -3,-15,-35, -1, 7,-18, 14, 8, -1,-15,-26, 6,-15, - -18, 22, 9, 33, 0,-32, -9, 3,-11, 7, 4, -1, 5, 30, 9, 1 }, - { 4, 15, 0, 6, -5,-11, 9, 6, 6, 6, 14, 2, -1, 10,-24,-25, - -2, -4, -1, 37, 2,-29, 14, -9, 22, 17, -2, 33, 10,-25, 11,-11 }, - { 0, 5, 2, 18,-12, 21, 22, 33, -7, 21, -9, -7, 7,-15, -7, 16, - 7, 0,-14, 44, 10,-25, 5, -4, 15, -8, 10, -4, 5, 9, -1, 16 }, - { 3, 13, 12, 12, 8, 25,-23, 8,-22, -3,-18, -8, 15, 12, 9, 19, - 0, 0, -9, 49,-27,-15, -9,-15, 12, -8,-16, -7, 13, 5, 13, 2 }, - { 12, -6, 7, -2, 20, -9,-14, 12, 13, -5,-17, 22, -8, -4, 2, 7, - -13, -2,-15, 43, -5,-30, 27, 4, 10,-27, 5, 27,-10,-10,-18, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - -1, 10,-18, 70, -2,-52, -1, -7, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 15,-13,-20, 16, 2, 13, 5,-11, -8, -5, -3, 2, 24,-23, 30, -7, - 11, 30,-15, 43, 5,-15, 15, -3,-14, 1,-23, 8, 3, 9, 4,-11 }, - { 16,-18, 7, -4, 31,-15, -9,-13, 20,-12, -6, 0, 12, -6, -2, 4, - 3, -3, -1, 0, 1, 3, 3, -2, 1, 6, 4, 0, -3, 2, -5, 1 }, - { 38, -5,-13, -4, 8,-15, 11, 1, 2, -4, -1, 9, 13, 4,-12, -7, - 0, -2, 7, 2, -6, -2, -3, -2, 3, -4, 6, 15, 1, 1,-11, -2 }, - { 47,-22, 9,-26, 3, -5, 2, -7, 4, -2, 2, -2, 3, 0, 3, -4, - 3, -3, 2, -3, 7, -3, -1, 1, 1, -5, 5, 0, 2, -5, -3, -2 }, - { 14,-16, 2, -6, 7, -2, -7, -4, -4, -7, 14, -3, 7,-19,-14,-17, - -29, 6, 26, 16, -5, 13, -4, -1, 21, 14, 1, 3, -6, 0, -7, -1 }, - { 29,-11, 5, -3, 4, 11, 4,-10, 1,-22, -3,-10, 5, 4, 2, 8, - -2, -7,-12,-12, -8, -3,-18, -2, -9, -5, -1, -3, 2,-14,-14, 7 }, - { 28,-12, 5, 3, 9, -7, 0, -2, 2, 1, 4, 0, -7, -3, -2, 4, - 4, 14, 8, -1, -4, 14, -7, 17, -2, -2, -9, 2, 19, -7, 9, -8 }, - { 31,-18,-22, 8, 15, -5,-10,-15, 1, 10, 6, 7, 6, -8, 2, -1, - 12, -3, 3, -1, 1, 5, -6, -4, 0, 1, 7,-10, -2, 4, -3, -4 }, - { 53,-30, -4, 12, 2, 3, -3, -3, 0, 1, 6, 5, -5, -4, -7, 1, - 0, 2, 1, 3, 1, 5, 0, 2, 2, -1, 0, 4, 2, 0, -2, 0 }, - { 27,-18, -3, -2, 4, -8, 3, -2,-11, 2, 10, -8, -8, -4, 0, -2, - 8, 0, 9, 0,-16, 11, 1, -6, 13, -3,-10,-13,-15, 25, 1, 0 }, - { 35, -5, -1, -8, 23, 11,-14, -3, 2, -2, 8, -6, 17, -2, 7, 0, - -2, 10,-17, 13, -2, -2, 11, 11,-14, 2, -2, -3, -8, -1,-12, -5 }, - { 29, -9, 7, 3, 2,-10, 0, 3, 9, 0, -3, 5, 1,-10, 10, -5, - 3, 6,-20, -9, -6, -4, 1, 0, 12, 17, -8, 9, 3, -1, -9, 0 }, - { 15,-16, 18,-19, 16,-15, 17,-18, 13,-16, 17,-14, 15, -9, 13,-17, - 9, -7, 4, -5, 3, -4, -3, 0, -6, 7, -9, 7, -2, 7, -9, 9 }, - { 21,-10, 7, -2, 12, -7, 13,-17, 11, -2, 20, 3, 5,-11, -6, -6, - -15, 0, -9, 5,-11, 7, -1, 7, 8,-10, -9, 3, -5, 9, -8, -2 }, - { 23,-22, 15, -5, 16, -4, -3,-12, 9, 3, -1, -2, -8, 2, -2,-16, - 3, 4, -2, -6, -7, 12, -8, 2,-14, 2, -7, 11, -2, 6, -4, -1 }, - { 34,-17, -4, 8, 4, -6, 1, 8, 4, 16, 3, 6, 12, -1, -1,-15, - 6, 4, -7, -6, 6, 0, 2, 1, -2, 2, 3, 3, -3, -2, 8, -6 }, - { 18,-18, 2, -2, 10, 1, 18,-23, -3,-10, 0, 4, 20,-19, -3, -4, - 2, 8, 6, 1, -3, 1, 1, 3, 5, -1,-11, 3, -7, 5, -1, 1 }, - { 15,-14, 2, 3, 10, -8, 12,-13, 13,-15, 6, -8, -4,-10, 14, -9, - 24, 2, -7,-18, 13,-11, 8, 14, -6, -2, 3, -1, -4, 7, -7, -4 }, - { 20,-12, 13, 5, -1,-10, 15, -6, 8, -1, -3,-10, 17, 0, -6,-19, - 2, -1, 8, -3,-16, 0, -3, 2, -2, 0, 8, -9, 0, 1,-10, -9 }, - { 32, 0, -9, -5, -1, 5, 13,-11, 8, 3, 11,-11, 0, -8, -2,-14, - 7, 10, 6, -5, 1, 10, 2, 12,-10, 4, 4, 6, 4, 0, -7,-10 }, - { 16,-14, 10, -7, 11,-11, 11,-11, 18,-13, 8,-15, 16,-11, 13, -9, - 8, -7, 12,-11, 7, -6, 3, -5, 9, -5, 4, -1, 7, -4, 8, -3 }, - { 24,-27, -1, 5, 8, -5, 12, 7, 4, -3, 3, -1, -9,-11,-13, -5, - 10, 0,-13, 7, 1, -5, 4, -9, 7, -3, 13, 2, -5, -3,-17, -2 }, - { 23,-19, 15, 1,-10,-18,-12, -6, 8, -3, 12, 0,-12,-10, -4, -4, - 8,-10, 4, 2, -2, -8, 13, -3, -2, -6, 2, -3, 5, -2, 2, 11 }, - { 25,-12, 4, 2, 24, -3, 3, -6, 14, 11, 0,-21, -3, -3, 1, -8, - 7, 0, 0, 3, 3, -6, -7, 6, 2, 1, -4, 5, -1, 10, -2, 9 }, - { 24, -8, -6, 7, 16,-12, 13, -1, 11,-21, 2, -6, 3,-12, 0, 9, - 4, 11, -7, 1, 4, 1, -8, 3, 3, -6, 3, 3, 0, -8, 8, 4 }, - { 25,-21, 13, 14, 13,-18, 4, -3, 0, -5, -4, 5, -3, 0, 4, 12, - 7, 3, 5, -5, 2, -2, 3,-10, 2, -9,-15, 6, 1, 7, -5, 1 }, - { 23,-16, -2, 10, 4, -1, 3, 1, 32, 3, -5, -2, 9, 10, -1, -4, - -6, 2, 9, -1, 14, 12, -6, -1,-17, -2, -4, -9, -7, -6, -8, 3 }, - { 50, -8, 5, 2,-11, 10, 0, 0, 6, -3, 7, 0, -3, -2, -3, 0, - 6, -4, 2, -5, -9, 0, 3, 10, 1, -7, -2, -3, -6, -9, 1, -2 }, - { 28,-17, 0, -2, 2, -9, 1, 5, -4, -1, 0, 0, 19,-27, 5,-12, - 7,-14, -3, -6, 10, -2, -4, -2, 4, -5, -2, -7, 1, 7, -9, 4 }, - { 22,-19, -6, -6, 3,-22, 3, 5, 20, -8,-14, -5, 1, 1, 20, 2, - 16, 6, 3, 14, 4, 3, 5, 1, 5, -7,-10, -6, 3, -6, 1,-14 }, - { 29,-14, -8, 13, 8,-10, -6, 4, 4, -6, 5, -7, 1, 12, 14, 11, - -7, 1, 2, -9,-11, -9, 0, 4, -1, 7, 10, 4, 4, 20, -1,-11 }, - { 18, -9, 4, 1, 7,-29, 12, 1, -1, -9, -2, -1, -2, 2, 9, -8, - -13, 5, 4,-13, -4, 2, -5, -7, -6, 14,-10,-34, -3, 1, -3,-13 }, - { 38, -9, 24, 8, 11, 4, -6,-11, -2,-12, 1, 1,-11, -8, -5, -2, - -15, -8, 8, 0, 1, -7, 5, 4, -1, 8, -2, 11, -3, -1, -5, -5 }, - {-20, 11, -4, 24,-11, 1, 15, 4, 0,-28,-10, -1, 10, 10, -6, 5, - -6, 2, 7, -2, 1, -2, -6, -3, -7, 1, 2, 12, -1, 7, 0, -2 }, - { -9, 10,-23, 27, -4,-17, 20, -6, 14,-17, 5, -1, 5, -9, -7, 5, - -6, 4, -2, 9, 0, 8, 0, 1, -3, -3, -5, -8, 5, -2, -2, 12 }, - {-10, 19, 4, 9, 1,-16, 17, -2, 9,-29,-16,-11, -4, 7, -5, 4, - -1, -3, 3, 2, 3, -4, 5,-12, -2, 6, 5, -4, 4, 1, 4, 10 }, - {-20, 10,-24, 14, -5, 11, 9, 0, 16,-20, 10, -5, -6, -6, -1, 2, - -4, 5,-16, 8, -2, 5, 5,-11, 9,-11, 4,-11, -1, -1, 4, 3 }, - { -9, 11, 3, 19, 24, 4, 5,-14, 30,-17, -4, -2,-17, 7, 2, 3, - 1, 3, -7, -4, 2, -3, 1, 4, -1, -1, 3,-12, -2, 3, -3, 10 }, - {-19, 18, 11, 19, 19, 19, 10, 4, 13, 6, 5, 4, 8, 3, -2, 12, - -6, -2, 7, -6, 15, 12, 16, 16, 18, -3, -4,-20, 0, 10, -9, -3 }, - {-21, 9, 20, 12, 0, -3, 5, -9, 15,-13, 5, -5, -6, 24, 2, 9, - -5, 2, -7, 2, 5, 7, -5, 2, 15, 3, 1, -1, -4, -2, 7, 0 }, - {-18, 16, 13, 15, 2,-10, 14,-11, 4,-11, 5, 12, 12, 20, 8, 30, - 2, 11, -9, 7, 0, -3,-16, -5, -6, 5, -4,-21, 0, 5, 6, 1 }, - {-26, 8,-13, 9, 6,-10, 2,-11, 7, -4, 6,-19,-11, -6,-12, 16, - 0, 5, -7, 8, 5, 6, 17, -9, 10,-10, 5, -3,-11, 2, 4, 10 }, - {-11, 17, -3, 22, -5, 18, 3, 1, 4, -5, 14,-27, 5, -7, -4, -5, - -10, 11, 1, 15, 1, 1, -6, -5, 10,-22, -7, -7,-15, 13, -4, 5 }, - {-17, 14, -7, 13, 3, 0, 13, -6, 9,-14,-22, -1, 1, 19, 14, -3, - 4,-13,-13, 2, -4, 8, -2, -2, 13,-12, 13,-12, -7, -5, -3, 6 }, - {-17, 17, -1, 33, 6, 3, 9,-16, 3,-14, -8, 6,-17, 8, 3, 13, - 8, -6, 3, 1, -2, 0, -2, 8, 4, 9, 13,-10, 4,-17, 0, -6 }, - {-20, 7, 7, 21, 1, -3, 7, -3, -2,-12, 9, -7, 2, -3, 14, 1, - -1, -7, 12,-10, 5,-20, 11, -2, 0,-24,-17, 6, 6, -4, 3, -1 }, - { -8, 10, 6, 7, -1, -6, 28, -6, 10,-33, 1,-20, 0,-12, 10, 1, - -6, 8, -3, -1,-10, 8, 5, 0, 10, -2, 8, 16, -5, -3, -7, 4 }, - {-17, 13, 3, 15, 1, -5, 27, -5, 6, -6, 12, 2, -4, 8, -1, -3, - -2, 12,-15, 3, 4, 1, 2, -9, 0,-16,-21, 2, -4, 16, -7, 4 }, - {-15, 20, 8, 17, 5,-14, 15,-11, 21,-11, 13,-13, 2,-15,-13, 1, - -5, 5, 2, 10, -9, 4, -1, 3, 2, -4, 13, -5, 1, -4, 5, -3 }, - {-21, 8, 2, 16, -1, 2, 15,-16, 13,-12,-12, -7, -8, 2, -7, 11, - -8, 5, 2, -7, 16, -4, 1, -7, 3,-15, 6, -5, -8, 2, -8, 5 }, - {-15, 17, -6, 3, -3, 3, 9, -7, 14,-23, 11, 1, -1, 4, 7, 6, - -1,-14, 7, 6, -8, 5, 1,-15, 10, -9, 2, -3, -1, 4,-10, -4 }, - {-10, 18, 3, 11, 1, 4, 14,-14, 7, -4, 15,-10, 10,-11, 10, -4, - 5,-14, 10, 4, 15,-12, 15,-13, 20,-15, 14,-15, 8,-11, 4, -6 }, - { -7, 23, 2, 20, 7, 8, 19, -5, 9,-16, -8,-17, -5, 1, 5, -6, - -8, 1, -6, -4, 10, 6, 6, 2,-11, -4, 0, 2, 4, 7, 9, -4 }, - {-15, 20, -5, 22, 11, -8, 9, -5, 10,-13, -8, 8, 2, -2, -3, 7, - 6, 10, 1, 2, -5, -9, 1, 10, 16,-22, -7, 0, 7, 7, 6, 1 }, - {-26, 19, -5, 3, 5, 25, 18, -5, 9,-14, -8, -6, -2, -6, 2, 3, - -8, -2, -7, 7, -3, 7, 3, 4, -8, 0, 1, -8, -4, -2, -2, 1 }, - {-20, 14,-10, 6, -3, 7, 8,-32, -2, -7, -2,-10, 16,-12, -9, 15, - -2, -5, -6, 2, -7, 5, 9, 1, 6, -7, -1, 0, -2, -4, -7, 3 }, - {-14, 16, 4, 11, -8, 1, 23, -4, 17,-13,-10, 1, 12, 9, 12, -4, - 7, -1, -1, 5, -8, -6, 3, 3, -6, -3,-18, 0, 18, 20, 4, -2 }, - {-33, 19,-10, 30, 15, 2, -3, -1, -4,-14, 7, -7, -1, 7, -8, 9, - -1, -3, -5, 2, 2, 4, 0, 5, 0, 0, 2, 3, 3, -3, -3, 4 }, - { -6, 20, 0, 5, 17,-10, 18,-17, 9,-16, 4,-13, -6, 2,-14, 14, - -28, 9,-12, 25, -4, 7, 7, -8, 6, -6, -2,-10, 2,-11, -1, 2 }, - {-12, 14, 12, 52, -3, 5, -5, 4, 8,-13, 2, -5, -4, 2, -2, -1, - -2, 3, 3, 5, 2, 3, 0, 1, -5, 2, -4, -3, 1, -5, -2, 0 }, - {-13, 6, 9, 24, 0, 8, 14,-15, 18, -9,-11, -8, 3, 15, -2, -4, - -9, 4, -3, 12, 14,-13, 11, -4, 2, -4, 0, -6, -6, -6,-14, -1 }, - {-10, 28, 3, 12, 9, 3, 11,-28, 6,-11, -7, 4, 0, 7, 8, -9, - 0, -6, 0,-16, 4, 7, 4, 4, 7, 3, 4, -7, 0, -3,-10, 6 }, - {-11, 14, -2, 19, -1, -1, 7, 9, -2,-27, 10,-14, 15, -4, 12, -4, - 2, -2, -6, 12, -6, 0, -5, -4, -5, 1, 3,-11, 5, -9, 3, -8 }, - {-18, 7, 13, 16, -4, 3, 9,-10, 10,-10, -3,-22, -4,-12, 3,-16, - 0, -3,-16, 8,-11, 1, 10, -7, 15, 3, 0, -1,-13, 8, 1, 6 }, - {-20, 10,-10, 10, 8, -1, 6, 0, 16,-12, 9,-10, -1, -5, -4,-13, - 13, 16, -8, 12, -2, 14, 18, 13, 0,-16, 2, -5, -5, -5, -4, 3 }, - {-14, 5, -7,-17, 5,-13, 23, 20, -4, -1, 1, -6, 13, 5, -1, 4, - -14, -2, -7, 8, 3, 2, 2, -7, 2, -1, 4, 7, 3, -9, -1, -5 }, - {-19, 3,-24,-28, -9, -7, 19, 3, 2, 19, 7, 5,-13, 8,-15,-17, - 3,-11, 4, 13, 3, 2, -1, -3, -4, -4, 2, 0, -5, -6, 6, 2 }, - {-17, 18,-30,-20, -2, -3, 1, 15, -1,-11, 6, -4, 11, 11, -4, -5, - -10, 0, 0, 1, 3, -7, 8, 2, 5, 1, 5, -5, 1, 6, 4, 1 }, - { -6, 1,-30,-25, -1, -8, -2, -9,-17, 16, 3, -1, -2, -9, -6, -7, - -3, 12, 6, -4,-10, 0, 10, -8, -6, -5, -3,-11, -4, 0, -1, -3 }, - { -1, -1,-34,-28, 1,-10, 2, 9, 4, 16, 2, 6, 14, 17, 0, 7, - -4, 4, 4, 4, 0, 1, -1, -5, 8, 1, -4, 1, -9, -2, 5, 6 }, - {-11, 14, 1,-31, -7,-24, 9, 7, 6, 5,-13, 1, -1, 3, 4, -1, - -2, -8, -6, 3, 5, -4, -6, 7, -2, 5, 3, 3, 0, 0, -5, 2 }, - {-25, 8,-11,-18, 1, -4, 8, -3, -4, 15, 6, -5, 8, 2, 3, 4, - -4, 5, 6, 8, -7, 6, 1,-11,-15,-13, 9, -4,-14, 10, 12, 7 }, - {-20, 11,-15,-25, 3, 4, 18, 13, -4, -5, -9, -1, -5, -2, -2, -7, - 16, 5, -4, -5, -7, -2, -3, -9, 11, -2, 0, -7,-17, -6,-11, 6 }, - {-11, 18, -5,-20,-15, -3, 9, 11,-20, 12, 5, 5, 11, -3, 7, 1, - 10, -6, -3, -3, 3, 3, 14, -7, 10,-17, 9,-11, -2, -6, 7,-12 }, - {-20, 8,-14,-17, -9,-13, -3, 0,-27,-14, -3,-14, 4, 3, 6, -6, - 7, 4, 23, 9, 11, 9, 3, -4, 9, 2, 4, -1, -6, 1, -8,-11 }, - { -9, 14, 2,-37, -7, 13, 6,-11, -6, 9, 18,-11, -6, 2, 12, 4, - -1, 3, 1, -2, -2, 1, -9, -4, -2, -3, 3, 5, -6, 0, -2, -8 }, - {-29, 8, -1,-13, -2, 8, 23, 2,-10, 7, 13, -6, -5, 11, 13, 0, - -10,-13, 11,-12,-10, 6, 4, 6, 4, 3, 6, -5, -9, -2, -1, 3 }, - {-18, 6,-10,-55, -4,-11, -2, 0, 1, -3, -9, -6, 3, -2, -1, 6, - 3, -1, 3, 1, -4, -7, -2, 6, 3, -2, -1, -3, -2, 0, 4, 1 }, - {-14, 5, 3,-21, -8,-16, -4, -2,-11, 27, 15,-20, 3, 0, 1, 1, - 2, -5, -5, 4, 1, -9, 5, -3, 3, 0, -4, -2,-11, -4, -3, 7 }, - {-17, -1, -9,-17, -8,-18, 12,-13, -9, 13, -3, 3, 3, -3, 1, -2, - 0, 16, -9, 6, 12, 9, 5, 11, 2,-15, 1, -4,-16, 7, -4,-12 }, - {-18, 8, -6,-11, -8, -7, 13, 7, 1, 6, 8, -1, 21, -4, 14, 15, - 18, -4, -3, 15, 0, 9, 4, 7, 3, -1, 9, -2, 0, 7, -8, 2 }, - {-10, 7,-18,-29, 3, 12, 12, 9, 11, 4, -1,-15, 1, -1, 8, -2, - -2, 10,-15, -1, 0, 6, 12, -6, -1, 10, -6, -3,-11, -4, 9, -6 }, - {-14, 14, -9,-21,-12, -2, -1, -7, -5,-10, 5, -8, 0, 6, 9,-11, - 11, -3, -5, 3, 8, 15, -2, -4,-22, 4, -6, 12, 2, 13, 6, -7 }, - {-12, 11, -5,-29,-25, 4, 12,-13,-11, -7, 4, 2, 2, -5, 5, 8, - 7, -5, -5, 6, 3,-10, 1, -6, 6, -6, -5, -1, -2, -4, 7, 6 }, - {-15, 11, -5,-16, 0,-13, 26,-23, -6, -3, 5, -2, -2, 21, -6, -3, - -5, -1, 6, -1, 0,-13, 2, -3, -9, -1, -4, -3, 5, -4, 12,-16 }, - { -9, 9, -1,-17, -3, -6, 12, 6,-18, -2, 11,-14, -6, 3, 14,-12, - -11, -5, 14, 2, 5, -8, -4,-11, 2, -5, 16, 6, -7, -4, 8, 13 }, - {-13, 5, 3,-28,-14, 0, 6, 23, 5, 4, -1,-17, 1, -3, 0, 0, - 5, 4, 0,-18, 14, 10, 4, 2, 5, -2, 4, -3, 2, 0, 2, 0 }, - {-15, 4,-13,-16, -3,-12, -2, 2, 7, 10, 9, 3, 11, 4, 23, 14, - 9, 16, 4, 1,-12, -3, 4, -7,-15, -7,-10,-14, -6, -8, -1, -6 }, - { -7, 10, -5,-10, -3,-13, 16, -1,-12, 7, -3,-12, 2, 13, 13, 2, - 17, 15,-13, 1, -5, -2, 3, -1, 1, -3, 6, -3,-12,-16, 7, -7 }, - {-11, -5,-12,-30, -6,-22, 1, 4, -6, -3, 12, 6, 7, 0, 16, 6, - -2, 0,-22, -2, -9, 2,-13, 8, 6, -8, 4, -7, -1, -6, 4, 6 }, - {-14, 5, 1,-27, -4, 2, 1, 14,-11, -7, -8, -4, 1, 8, 0, -6, - -13, 11,-12, -7, -5, 1, 10, 7, 3, -2, 0, 6, -8, 2, 10, -1 }, - {-10, 10,-25,-13,-20, -4, 19, 3, 13, 5, 5, 7, -8, 2, 4, 2, - 3, -1, -1, -9, 14, 10, 9, 14, 3, 3, -6, 0, -5, 4, 1, -1 }, - { -9, 15,-18,-17, 4,-11, 6, 7,-12, 8, -1,-11, 2, 3, 7, 16, - -3, -9, 7,-12, 23, 0, 6, 7,-14, -9, 8, 1, -2, 6, -2, -1 }, - { -6, 9,-16,-26,-14,-11, 9, -6, 5, -2, 13, 17, 21, 7, 18,-19, - 6,-23, -2,-15, -2, 2,-10, -8, 2, 1, -2, 4, -3, -4, -5, -4 }, - { 0, 6, -5,-28,-17,-32, 2,-10, 11, 3, -5, 9, 10, 3, 11, 11, - -3, 12, -2, 2, 4, -6, 9, -4, -4, -4, -4, -9, 2, 0, 2, 4 }, - { 0, -8,-18,-34, -9, -7, -4,-11, 10, 15, 11, -1, -8, 15, 6,-13, - 9, 2, -4,-12, 0, -1, 19, 12, 6, 5, 0, -3,-10,-12, 3, -5 }, - {-10, 6, -9,-17,-12,-11, 9, -6, 11, 11, 18, -7, 0, 16, 4, 2, - -6, 3,-12, -1, 0, 1, -5,-22, -2,-12, 0, 6, 17, 5, 5, 6 }, - { 12, -5, 7, 1, -5, -2, -1, 2, 2, -4, -3, -3, -3, -2,-29, 11, - 5,-13,-73, 24, 12, 4,-14,-10, 5, 1, 0,-11, -7, -7, 7, 3 }, - { 10, -3, -1, -3, 4,-11, -5, -2, -8, 7, 9, 2, -8, -6, 6, 7, - 21, 17,-54, 47,-14,-10, 14, 19, 13, 21, -4, 3, 1, 2, -4, 2 }, - {-12, 4,-16,-12, 5, -9, -4, 19, -7,-22,-22,-17, 3, 0, -6, 8, - 23, -4,-55,-28, 2,-26, 2, 1, 4, 0,-13, 6, 0, 10, -7,-11 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1, - 35, -1,-67,-35,-24,-24, -6, 2, 2, -2, 1, 3, 2, 0, -1, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 5, 0, - 41, -4,-73,-15, 18, 4, 17, 8, -1,-16, -1, -2, 1, 0, 0, 0 }, - { -4, -4, 4, 6, -1, 2,-16,-10,-15,-10, 21, -2, -6, -2, 14, -7, - 10, -5,-55, 34,-12, 11,-13, -2, 2, 28,-26, 0, 7, 4, 21, -7 }, - { 2, 1, 15,-22, 10, -3, 14, -6, -2, 15, -2, -7, 20, 6,-15, -7, - 23, 10,-60, 8, -4, 29,-22, 2,-13, 9,-10, 12, -1, -3, 4, 7 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, -1, -2, 11, -5, - -21,-11,-60,-27,-17,-39, 6, 36, 0, -8, 2, 2, 0, 0, -2, 3 }, - { 2, -5, 9,-17, -1, 2, -3, -6, 8, 12, 7, -6,-33,-11,-14,-40, - 10, 36,-46, 0,-19, 5, 0,-10, 3, 12, -6, -8, 6,-12, -7, 1 }, - { 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, -1, 0, 1, 0, -2, 0, - 4, -2,-87, -3, -2, 2, -2, 20, 2, 6, -1, 6, 0, 0, 2, -1 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, - 1, 7,-76, 41, -7,-24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, - -32,-11,-64,-29, -9,-43, 2,-11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10,-20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2,-20,-20, - -19, 3,-47,-18,-16, -6,-15,-42,-17, 14, -6, 8, 12,-10, 11,-12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, - 10, 13,-68, -9, 26, 3, 5, 3,-21, 10,-15, 21,-22, 19, 11,-14 }, - { 1, 5, 18,-19,-29,-13, -2, 18,-10, 20, 2, 10,-10, 11, 1, 8, - -16,-17,-41, 10,-14,-25, 0,-14,-19, 17, 7,-12, 14,-11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,-43, 5, - 6,-12,-48, 19, 8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, - 22,-14,-71,-24, -2,-33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10,-11, - -17,-32,-58, 14,-14,-11, -2, 15, 2, -8, 12, 10, -9, 13,-33,-14 }, - { 15,-17,-19, 7, -8,-15,-32,-22, 7, 12, 18, 0, 0,-15, -4, 16, - 37, -2,-46, 11, 2, -8,-10, -8, 14, 9, -4, 5, 7,-17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0, 0, 1, - 1, 7,-76, 41, -7,-24, 0, -6, 3, 6, 0, -2, -1, 1, 0, 0 }, - { 0, -3, 4, 2, 3, 2, 2, 0, 3, -1, 4, 0, -1, 4, -2, -4, - -32,-11,-64,-29, -9,-43, 2,-11, -1, -7, 0, -4, -2, -2, -2, 2 }, - { 10,-20, 3, -3, 13, 13, 0, -4, 2, 7, -8, 7, -2, 2,-20,-20, - -19, 3,-47,-18,-16, -6,-15,-42,-17, 14, -6, 8, 12,-10, 11,-12 }, - { -3, -2, -2, -1, -1, 4, -3, -1, -6, -2, 3, 2, -3, 6, -1, -9, - 10, 13,-68, -9, 26, 3, 5, 3,-21, 10,-15, 21,-22, 19, 11,-14 }, - { 1, 5, 18,-19,-29,-13, -2, 18,-10, 20, 2, 10,-10, 11, 1, 8, - -16,-17,-41, 10,-14,-25, 0,-14,-19, 17, 7,-12, 14,-11, 14, 5 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, -1,-43, 5, - 6,-12,-48, 19, 8,-38, -8, -3, 22,-21,-10, 15, 20, -9, -5, 8 }, - { 0, 0, 0, 0, -1, 1, -1, 0, 0, 0, 0, 0, 0, 0, 6, -3, - 22,-14,-71,-24, -2,-33, 23, 7, -8, 7, -3, 2, -4, 1, -8, -2 }, - { 1, 0, -1, 2, 0, -2, 0, 0, -1, 0, 4, 0, 26, -1, 10,-11, - -17,-32,-58, 14,-14,-11, -2, 15, 2, -8, 12, 10, -9, 13,-33,-14 }, - { 15,-17,-19, 7, -8,-15,-32,-22, 7, 12, 18, 0, 0,-15, -4, 16, - 37, -2,-46, 11, 2, -8,-10, -8, 14, 9, -4, 5, 7,-17, 4, 3 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, 0, - -5, 3,-85, 23, -9,-17, -2, -2, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 16, 65, -2, -2, 4, 3, 0, -7, 3, 1, 3, 1, 0, 5, 1, -5, - 0, 2, -1, 3, 0, 0, -1, -2, 6, 0, -2, 0, 0, -1, 1, 1 }, - { 5, 37, -4, 8, -4, -1, 9, 17, 6, -7, 5, -1, 11, 6, -4, 7, - -2, 4, 1, -3, 11, 3, 3, -9, 6, 0, -2, -4, -5, 4,-12,-11 }, - { 15, 24,-14, 2, 6, 17, 26, 5, 8, 11, -9, -7, -6, -8, 3, -5, - 9, 10, -3, 10, 0, 1, 4, -9, 4, 9, 3, 0, 4, 0, -5, 3 }, - { 9, 36, -9, -8, 7, 7, 4, 3, -1,-16, -2, 7, -5, -6, 6, 12, - -11,-12, 9, -1, -3, -9, 12, 6, -6, 2, 2, 5, 0, 5, 6, -6 }, - { 25, 39, -5, 24, 3, 10, 3, -6, 13, -8, 3, -7, 2,-10, -5, 2, - -2, 3, 5, -2, 1, 5, -2, 3, -4, 1, -5, -4, 0, 1, -2, 0 }, - { 16, 27, -1, 0,-14, 6, 4, -5, 7, -2, -6, 0, -3, -5, 2, -1, - -1,-19, 5, -8, 0, 11, 12, 5, 0, 3, 10, 6,-14, 14,-13,-15 }, - { 12, 23,-14, 2, 1, 4, -3, 16, 7, -8, 2, -8, 8, 6, -8, -7, - -3, 0, 2, 8,-13, 7, 13, -6, -4, 6,-13,-16, 14, 11, -7, 5 }, - { 16, 28, -7, -1, 6, -3, 9, 0, -7, 3, 0, 3,-12, 20, 8, 9, - 8, 23, 8,-13, -2, 4, 9, 3, -5, 13, 5, -2, 12, 14, 5, -1 }, - { 19, 37, 19, 5, 7, 5, 10, 5, 19, 10, 14, 0, 2, 5, 1, -4, - -4, 2, 2, -5, -2, -1, 2, -6, -4, -4, -5, -3, 2, -2, -2, -2 }, - { 24, 21, 1,-11,-10, 17,-14, 14, 6, -1, -6, -1, 0,-13, -1,-12, - -2, -5, 6, -4,-12, 14, 5, -2, -8, -8, 15, -7,-30,-12, 4, 0 }, - { 11, 26, -3, 3, 5, -1, -2, 3, -2, 10, 15, -4, 10,-28, 10,-17, - -8, 1, 2, -7, -1, -6,-15, -1, 4, 5, -7, 9, 0, -5, -4, 4 }, - { 18, 32, 1, 2, -7, 4, 15, 2, -9, -2, 12,-11, 7, 11, 13, 2, - 0, 5, 9,-10, 16, 3, -3, 5, -9,-23, 2, -2, -1, 5, 2, 11 }, - { 35, 24,-20, 2, 4, -1, 5, 14,-10, -9, 8, -7, 0, 5, -7, -7, - 11, 1, 5, 3, 2, 0, -2, 3, 0, 1, 4, 0, -2, -8, 0, -4 }, - { 9, 35, -1, 2, -1,-19, -3, 12, -1, 8, 8,-13, -1, -2, 2, 5, - -8, -1, 13, -2, 11, 1, 0,-10, 0, -3, -7, 2, 1,-12, 3, 12 }, - { 20, 27,-12,-12, 7, 4, -1,-13, -1, -9, 2, 13,-11, 5, 7, -9, - 9, 1, 1, 8, -9, 0, -6, 7, 4, 2, -2, 7, 3, -2, 1, -9 }, - { 8, 37,-20, -5, 0,-21, 10, -8, 3, 19, -9, 7, -3, -8, 10, -2, - 0, 5, 6, -4, -2, -1, 0, -7, 6, 1, 0, 4, -5, 6, -8, 2 }, - { 8, 27, 1, -3, -5, 1, 6, 0, 15, 2, 17, -1, 3,-17, 10, 5, - 5, -6, -6, 6,-10, 18, -5, 0, 0, 13, 7, 10, -5, -6, -2, -4 }, - { 14, 29,-20, -4, -3, 1, -5, -1, 2, 12,-10, -3, 4,-18, 4, 14, - -4, -1, -9, 15, -2, 2, -5, -3, 2, 9, -2,-14, -3, 4, -4, -7 }, - { 23, 23,-23,-11, 27, 4, 4, -1, 7, 0, -5, 9, 2,-11, 3, 7, - -2, -5, 2, -7, -7, 13, -3, -6, 2, 3, 3, -4, -1, -8, 5, -2 }, - { 16, 26, -6, 8, -9, -1, -2, -1, -8, 4, -2, 0,-12, 9, -1, 0, - -17, -9, 30, -5,-15,-16,-13, 0, 10,-11, -7, -3, -1, 0,-11, -2 }, - { 12, 32, -4, -5, 10, 19,-10, 4,-12, 5, -6, 9,-12, -6, -6, -8, - 4, 1, 3, 0, 8, 0, -3, -4, -7, -4, 10, 8, 6, 5, -1, 4 }, - { 46, 42, -3,-14, -2, -6, 6, -2, -5, -1, -3, -3, 1, -1, 3, 1, - 1, 4, -1, 2, 3, 1, -2, 6, 0, -1, -2, 4, -2, -1, 2, 2 }, - { 9, 33,-13, 4,-11, 3, -8, 22, 12, -2, 4, 0,-16, 5, 4, -1, - 7, -6, -9, 1, 7, 5, 0, -5, 5, -1, 10, 3, -2, -1, 3, -2 }, - { 9, 30, 6, -3, 6, 1, -7, 5, 11, 14, 7, 1, 0, 2, 2, -1, - 8, 7, -6,-13,-10, -2, 1, -6, 10, 7, 6, 5, -2, -5, -1,-16 }, - { 9, 28,-11,-10, 9,-10, 15, 8, 4, 9, -4, -7, 0, -5, 9, 8, - -7, 2,-15,-23, 4, -4, 4, 16, -8, -3, 0, -8, 14, 5, -3, 15 }, - { 17, 26, -5, -5, -1, -8, 20, 18, -7, -2, 4, -7, -8, -5, -4, 16, - 0, 0, -7, -2,-13, -5, -2, 3, 12, 1, 3, -5, 2, 2, 0, -1 }, - { 11, 37, 7,-23, 6, -1, 15, 13, 4, -9, 7, 5, 3, -3, -5, -8, - -2, 3, -5, -1, -8, 7, 2, 13, 1, 3, 0, -3, -1, 2, 0, -2 }, - { 21, 33, 7, 20, 21,-10, 6, -5, -5, -6, -9, 2, 10, 0, 8, -4, - 10, 2, -2, -2, 0,-10, -6, -2, 0, -5, 3,-11, 3, -9, -3, 1 }, - { 6, 30,-15, -8, 16, 1, 4, 6, 4, 5, 8, -3, 8, -9, -1, -6, - 8, 2, -2, 4, -2, 5, 11,-21, 3,-10, 16,-11, 24, 10, 14, -6 }, - { 15, 36, -3, -9,-20, 12, 0, -7,-18, -4, -8, -9, 9, -7, -3, -1, - 2, 7, -5, -8, 6, 2, 2, -1, 7, 1, 1, -3, 3, -4, -8, 1 }, - { 16, 34, 21, 3, -9, 10, 7, 9, -7, 1, -4, -9, -4, -5, -5, 3, - 3,-19, 1, 5, 4, -2, -6, -5,-10,-11, -8, -2, 2, -5, -8, -7 }, - { 28, 29, -3, 18, -2, 0, -6, 12, -2, 10,-11, -4,-13,-12, -6, -4, - 0, 4, -1, -8, 6, 4, 12, 11, 10, 10, -3, -6, 1, 2, 1, 7 }, - { 3, 8, 22, -8, 3, 36, -8, -1, 9, 6,-13,-14, 8, -1, 1, 2, - -2, -8, 0, 3, 1, 2, -1, 5, -1, -8, 0, -2, 2, 2, -1, 1 }, - { 0, 6, 0, 0, 4, 13, -7,-16, -6, 15,-14,-21, -9,-10,-10, -6, - -21, 5, 4, 2, 12, 4, 12, 11, -4, -6, -6,-10, -7,-18, 1, 4 }, - { -1, 3, 10, 1, -1, 15, 4, -7,-16, 3, 0,-22, 10, 2, -3, -2, - 13, 5, -8, 16, -5, 4, 0,-11,-10,-22, 0, -4,-17, 5, 2, 1 }, - { 12, 8, -4, -9, 14, 40,-21, 0, 1,-15,-10,-12, 12, 6,-10, 2, - 8, 6,-12,-10,-11, 1, 0,-11, 2, 1, 13, 0, 6, 3, 8, 4 }, - {-10, 3, 5, -4, -3, 3, 0, -9, 2, 8,-22,-23, 17, 8,-17, -3, - 14, -8, -4, 1, -8, 3, 0, 5, -1, -3, -2, -4, 1,-10, 0, -2 }, - { 0, -1, 5, -7, 4, 12, -2, 0, -7, 2,-16,-15, 12, 21, -7, -4, - 7, -7,-11,-15, -7, -9, -5, -8, 0, -6, 8, -3, -8, 22, -7, -9 }, - { 7, 19, 4, -9, 24, 22, 2, -6, 8, 13,-14,-20, -4, 11, 8, -4, - -1, 2, 0, -7, 5,-17, -3, 3, -6, 5, 3, 4, -5, -7, -3, 14 }, - { -2, 6, 2, 8, -2, 5, -4, -2,-10, 3,-45,-30, -3, -3,-12, -4, - -3, -3, -1, 9, -6, -6, 5, -4, 0, 5, -1, -2, -1, 0, -6, -1 }, - { -3, 14,-16,-10, 10, 0, -2,-40, -9, 12, 2,-19, 15, -4, 4, 3, - 3, -4, 7, 1, -4, -5, 0, 4, -1, 0, -9, -2, -4, -1, -2, 0 }, - { 7, 16, 2, -7, 8, 2, 0, 1, 5, 21,-10,-26, 7, 2, -9, -7, - -3,-16, 8, 5, 5, -6, 10, 4,-14, -6, 5, 3, -2, -2, -4, 1 }, - { -9, 14, -1, 3, 3, 11, 1, -5, -3, 13,-16,-18, 20, 6, -5, 0, - -3, 2, 8, 4,-19, -9, 12, 0, -8, 2, 2, 1, 6, 13, -7,-11 }, - { 2, 5, 16, -4, 19, 15, 4, 0,-11, 7,-10,-10,-16, 18,-11,-12, - -9, -4, 7, -4, -4,-17, 1, 1, -8, -3, -3, 5, -2, -6,-11, -5 }, - { 2, 12, 0, -9,-10, 14, 6, 2, -3, 2,-12,-28, 12, 1, -1, 2, - 0, -3, -4, 7, 16, 5, -7, 8, -4, -3, -1, 3,-12, 4,-17, -5 }, - { -4, 7, 11, 6, 1, 14, -4, -6, 5, 5, -6,-24, 23, -9,-15, 13, - -7, -9,-15, 10, -1, 8, -5, 1, 12, 6, 2, 0, 4, -2, 9,-10 }, - { 1, 5, 11, 3, 6, 12, -3, 8,-21, 5, -7,-20, 12, -2, -9, -3, - 17, -7, -8, -9,-14, 3,-13, 18, -8, 9, 2, -8, 4, -8, -5, -2 }, - { -3, -3, -1, 5, -2, 15, 3, 2, 1, -8, 1,-39, -6, 13,-13, 0, - -2, -5, -6, -3, 0, -5, -2, 15, -9, 5, -3, -6, -2, 7, 0,-13 }, - { 2, 8, 5,-12,-13, 22, 8,-16, 11, 5, -2,-32, -2, -4, 11, 5, - 5, -6, 1, 3, 1, 5, 3, 6, -5, 4, 4, -8, 8, 4, 1, 3 }, - { 13, 9, 5, -4, 9, 18,-11, 2, -1, 15,-10,-19, -2, 14, 0,-10, - 1, 1,-18, 3, 2, -6, -8, 20, 7, -8, 16, 9, 9,-13, -3, -2 }, - {-13, 11, 11, -9,-10, 13, -3,-18, 2, 10, 5,-21, 6, 15,-11,-21, - 3, 14, 0,-12, 9, -1, -2, -4, 3, -3, -9, -8, -5, -2, -8, 2 }, - { 3, 3, 11, 4, 0, 13, 1, -8, 10, 13, -6,-26, 2, 12, -3, -5, - 12, -2, 1, 8, -7,-17,-19, 5, 10, 7, -3, 2, -3, 0, 5, 0 }, - { 5, 0, 3, -3, -9, 5,-15, -5, -5, 17, -5,-31, 0, 13, 13, 5, - -1, -6,-14, 7, -8, 9,-14, -2,-16, -4, -4, -6, 6, -6,-10, 6 }, - { 13, 3, 1, 7, -3, 4, -1, -2, -1, 4, -8,-32, -1, -4, 0, 3, - -10, 7, 10,-10, 4, -1, 6, 2,-16, -9, 4, 3, 13,-23, -3, -4 }, - { 4, 11, -4, -9, 4, 11,-12,-12,-12, 6, 1,-28, -3, 14, 18, -2, - -12, 7, 15, -3, -5, -7, -3, 2, -6, 4, 4, -2, -5, -3, 2,-13 }, - { 8, 7, -7, 0, 13, 7, -8, -7, 8, 36,-10,-22, 3, 23, -3,-10, - -3, 11, 1, -7, 3, 3, -1, -7, -4, 2, 3, 2, 5, 3, -4, -1 }, - { -1, 1, 13, 1, -6, -1, -6, -9,-18, 17, -5,-37, -1, -1, -6, -4, - 1, -6,-15, 2, 17, -9, 0, -3, 0, 4, 0, -5, 0, 4, 1, -5 }, - { 0, 14, 5, 0, -7, 2, -6, 17, -6, -9, 7,-16, -5, 23,-14,-13, - 8,-15, 11, 10,-11,-13,-33, -5, -2, 1, 6, 8, 0,-13, -9, 5 }, - { 11, 7, -2, -8, 9, 11, 25,-14, 7, 3, -1,-33, 14, 8, -6,-19, - 3, 3, 2, -1, -3, -1, -2,-10, -3, 1, 2, 1, 4, 2, -3, 4 }, - { -2, 8, 4, -2, 9, 13, -4, -2,-15, -3, 19,-37, 9, 25, -9, 2, - -5, -2, -2, -4, 4, 2, 2, 0, 3, 3, 3, 5, -2, -3, -4, -3 }, - { 10, 13, -1,-15, 4, 6,-18, -4, 25, 1,-23,-17, 15, 13, -8, -8, - 7, 4, -5, 3, 6, 9, -7, 6, 0, -5, 8, 0, -6, -1, -2, -2 }, - { 1, 3, 9, -5, 27, 15, -9,-31, -1, 23, -2, -9, 1, 8, -1, -7, - -2, -8, -4, -4, -2, -1, 3, 5, 0, 0, -1, 1, -7, 7, -3, -3 }, - { -8, 7, 3, -6, 8, 3,-11, -2, 36, 14, 1,-30, 6, 10,-12, -6, - -6, -2, -4, -3, -5, 0, 9, 4, -5, -5, -8, 12, 4, -3, 1, -8 }, - { -2, 9, 33, 0, 12, -3, -7, -4, -4, -1, 6,-25, 11, -6, -9,-11, - -2, -4, -2, 6, -1, -3, -6, 15, -6, 3, 10, -4, 1, 0, 5, 8 }, - {-22,-21, -9,-19, -5, -7,-12,-15, -8, 9,-19, 14, -7, -4, 5, -8, - -2, 7, 1, -3, 4, -4, 6, 11, 2, 6, -3, -5, 2, -2, 0, -3 }, - {-32,-13, 3,-24, 3, -8, 4, 1,-10, 14,-15, 0, 4, 6, -1, 6, - 7, -1, 6, 4, -3,-17, 1, 4, -6, -1, 1, 0, 3, 3, -7, -4 }, - {-32,-11, 7, -8,-12, 13, -5,-22, -4, 12,-16, 2, 0, 4, 0, 1, - 0, 6, -5, -8, 2, 6, 5, 0, -3, -6, 5, 6, 5, 5, 13, -4 }, - {-44,-33, 6, -4, 2, 0, -9, 10, 3, 4, 7, 0, -1, 7, 5, 1, - 1, -3, 1, 6, -1, 0, 2, 3, -4, 0, 0, 1, 0, -1, -2, -1 }, - {-30,-18,-24, -8, 5, 0, -2, 14, 7, 0, 1, 12, 6, 4, -9, 7, - 5, 7,-11, -5, 1, -8, -1, 2, 2, -9, 7, -1, 7, 5, 6, 6 }, - {-22,-20,-13, -9, 20, -3, 10, -8, 6, -4, 2, -7, 10, 8, 0, -1, - 2, -3, 6,-19, 2, 4, 3, 3, -7, 2, -1, -6, 1, 1, 6, -2 }, - {-27, -8, -1, 3, -1,-11, 24, 4, -1, 1, -8, 8, 5,-11, 15, -3, - -15, -1, -1,-13, -1, 1, -5, 5, 2, 3, -9, 0, 4, 3, -7, 6 }, - {-33,-16, -1, -8, 10,-23, 6, 13, -1, -3, -9, 0, 5, -7, -5,-12, - -2, 3, 3, 6, -2, -3, 2, -3, 9, -6, -3, -2, 0, 5, -3, -4 }, - {-22,-17, 11, -3, 3, 1, -1, -5, 17, 2,-15, -2, 10, -9, 6, 14, - -16,-12, 20, -1, -7, 6, -3,-12, 1, 10,-10, -1, 7, -3, -1, 10 }, - {-28,-13, 1, -3, -1, -1, 0, 3, 3, 5, 1, 10,-10, -3, 7, 2, - 4, 19, -1, -1, 10, 5, -8, 1, 11,-15, -4, -3, -5, 4,-13, 3 }, - {-22,-13, 42,-20, 5,-13, 7,-11, 1, 1, -1, 1, 6, 3, 6,-11, - 3, 3, -2, 0, -4, 4, -3, -1, -5, 2, 0, 0, -9, -1, 4, 4 }, - {-26,-15, -2, -6, -4, -2, 16, 8, 21, 8, 1, -3,-10, 7, -8,-12, - -5, 12, -9, 3, -2, -3, 18, 1,-12,-15, -4, 5, -3, 0, 12, 7 }, - {-26,-16, 5, 6, 14, -3, 15, 6, 1, -7,-13, 16,-15, 5, 11, -2, - 9, -7, -4, -2, 0, 0, -2, 7, -8, -6, -5, 2, 7, -3, 2, 12 }, - {-31,-17, -8,-30, 4, 14, 6, -6, 6,-11, 0, 3, -4, 0, 0, -4, - 0, -4, 1, 4, 3, 4, 0, -5, 3, 2, 2, 0, 2, 1, 3, 5 }, - {-61,-10, 4, 10, 4, 7, 0, -3, 0, 1, 0, -3, 0, 1, 0, -2, - -1, 1, 2, -2, 4, -3, 1, 1, -1, 1, -2, -4, -4, 4, 0, 0 }, - {-28,-13, -8, -4, 3, -3, 2, 1, 11, 14, 3, 9, 1, 13, 3, 5, - -3, -2, -2,-12,-14, -9,-11,-15,-12, -5, -4,-12, 3, -3, 0, -5 }, - {-41, 0, 12,-24, 13, 4, 5, 16, -5, -4, 0, 0, 13, -4, 1, -9, - 9, -6, -1, 6, -2, 5, 2, 9, 6, -9, -8, 8, -2, -3, -6, -4 }, - {-26,-19, -2,-15, 4,-14, 6, 0, 26, 20, 8, 9, 9, 3, -4, -5, - -8, 1, 0, -1, 5, 9, 3, 4, 4, 7, 1, 3, -2, -2,-10, 0 }, - {-29,-18, 9, -4, 1, -5,-14,-12, 5,-10, -5, 4, -5, 0, -1, -1, - 4, -5, 7,-16,-11, 2, 7,-15, 2, -4, 6, -4, -6, 7, -3, 7 }, - {-27,-16, 9,-14, 3, -8, 9, 0, 7, -4, -3, -7, 0,-10, -1, 2, - 1, -2, 15,-10, 14, 7, 6, 17, 3, -4, 3,-10, 8, -8, 3, 11 }, - {-21,-20, -8, -8, 4, 5, -3, -2, 0, -5, 14,-10, 11, -4, 13, 0, - 5,-11, 19,-18, 18, 3, -5, -3, -4, -8, 11,-10, 10, 3, 4, -9 }, - {-35,-15, 13,-12, 4, 0, -2, -4,-12, -3, -8,-24, -7, 1, 7, 8, - -3, 0, -2, -1, 3, -2, -2, -6, 8, 1, 0, 1, -6, -1, 2, -6 }, - {-19,-14, 13,-10, 9, -1, 1, 3,-12, 5,-16, 7, 13, 9, 4, -4, - 6, -5, 4, 9, -3, 17, -4, 12,-11, -6, -5, -6, 13, 2, 7, -9 }, - {-34, -8, -4, 1, 2, -1, 3, 6,-20,-11, 8, -1, 4, 2, -9, 4, - -4, -5, 16, 10, -4, 14,-13, 1, -6, 0, 2,-10, 0, -3, -3, 7 }, - {-36,-10, -8, -3, 2, -2, 14, -4, -1, -7, -4, 10, -1, -3, 15,-11, - 0, 2, 3, -1, 4, 0, 8, -1, 0, 18,-11, -5, 15, -5, 13,-12 }, - {-22,-13, 14,-20, 15, 25, 16, 10, 8, -2,-10, -5, -1, -8, 11, 8, - -1, -2, -4, 1, 2, -1, -7, 0, 0, 0, -3, 0, 2, -1, 0, 2 }, - {-31,-22, 7, 6, -2, 5,-20, 14, -6, 7, 0, 14, 3, -7, 3, -6, - -2, 1, -3, -5, 1,-10, 1,-24, 6, -2, 3, -7, 1, -7, 8, 7 }, - {-25,-20, -3, -9, 10, 6, 12, 7, 5, 4, -3, 6, -1, -5, -6, -8, - 3, 5, 6, 5,-10, 10, -4,-15,-15, -2, -9, 2, 18, 1, 8, 12 }, - {-24,-19, -2, -4, -7, 11, 6, 9, 16, 2, -7, 18, 6, -7, 6, 6, - -2, -9, 3, 12, -2, 3, -1, 6, 7, 8, 0, 8,-11, 8, 4, 2 }, - {-26,-20,-12,-12, -2, -3, 1, -5, -1, -2, 0, 3, 7, 9, -2, 2, - 9, 22, 13, 4, -4, -1, -2,-14, 5, 15, -8, -5, -7,-11,-14, -6 }, - {-21,-18, -1, -4, 0, 3, 7, -2, 10, 8, -8, -1, 15, 1, -9, 3, - 1, 3, -5, -2, 2, 4, 0, -1, 10, 2,-19, -8, 8, 30, -7, 8 }, - {-25, -6, 26, 4, -8, 4, -2, 21, 5, -4,-16, 5, 13, 4,-10, -1, - -6, -2, 2,-10,-13, 1, 3, -3, -6, -8, 2, 11, 1, -7, 0, 5 }, - { 0, -1, -2, 19,-12,-48, -6, 11, 8, -2, -4, -2, -7, 5, -3, 2, - -2, -1, -1, -7, 0, -3, -3, -4, -4, 4, 1, 3, -3, -1, -2, -5 }, - {-11, -8,-28, 18, 16,-24, -8, 19, 4, 8,-12, 9, -4, -2, 4, -7, - 6, 2, 3, 3, -4, 0, 1, -6, -4, -2, 2, 6, 0, -3, 1,-16 }, - { -9, -5,-26, 7, -3,-37,-16, -2, 2, -7, 4,-13, 0, -4, -6, -5, - -6, -4, 0, 3, 4, -3, -4, -4, 4, -3, 9, -4, -2, 2, 7, -4 }, - { 2, 9,-18, 7, 29,-24, -1, 7, 14, 10, 3, -3, -2, -5, 6,-10, - -6, -3, -8, 0, 5, 1, 4, 3,-12, 2, 6, 1, 3, 4, 1, -3 }, - {-20, 2, 8, 20, -9,-24, -4, 18, 3, 11, -1,-11, 6, 9, -1, -3, - 1, -1,-15, 3, 15, 9, 3, 2,-13, 2, -8, 8, 1, -1, 1, -8 }, - {-12, 5,-11, 6, 19,-26,-17, -6, 4, 14, 6, -8, 9, 5, -6, -5, - 2, -1, 20, 1,-11,-10,-18, 20, -7, 0, -3, 4, 2, 0, 10, 4 }, - {-15, 1, -2, 13, -8,-21,-22, 4, 4, 3, 3, -7,-31, 4,-10,-14, - 0, 8, 4, 5, 8, 11, 2, -8, 6, 7, 0, -2, 6, 8, 8, 7 }, - {-13,-10, -9, 12, 19,-16, -3, -2, 9, 2, 11,-29, -1, 9, 4, -3, - 1,-10,-10, 16, 1, 7, -7, -6, -4, -1, -5, 3, 6, 0, 3, 1 }, - {-17, -1, -5, 19, 12, -9,-21, -5, 2, 12, -7, -7, -3, 8, 7, -2, - 6, -9, -9, 1, -4, 1, 1, 3,-14, 2, -8, 0, 10, 1,-12, -6 }, - {-13, -5, 8, 15, 0,-20, -2, 20, 8, -8, 8,-19, 12, 10, 2,-11, - 0, 12, 1,-11, 0,-11,-15, 5,-11, 2, 4, -4,-11, 5, -4, -5 }, - { 3,-11, -7, 8, 0,-17,-26, 15, 19, -7, 10, -9, -5, -5, 14,-25, - 0, -8, 2, -9, -3, 9, 1, -6, 4, -4, 3, -9, -1, 6, 2, 2 }, - {-12, 5, 5, 9, 14,-18,-19, 4, 2, 16, 14,-21,-15, -9, -1, 16, - 12,-11,-10, -5, -7, 4, 15, -8, -5, -1, 1, 14, 13, -7, -1, -4 }, - {-10, -5, -1, 8, 7,-23,-10, 14, 6, 11, 10,-16, -3, 16, 6, 0, - 0, 9, 6, -2, -7, 1, 22, 5, 3, -8, 0, 3, -2,-10, 3, 0 }, - { -2,-14, 2, 16, 15,-17,-17, 6, 19, 4,-10,-15, -1, 15, 11,-14, - -8, 5, 8, 8, -2, -8,-11, 10, 10, -8,-14, 2, 13, 4, -2,-12 }, - {-10, 3, 6, 4, 19,-23,-19, 1, 4, -9,-30, 3, -6, 18, 0, 2, - 0,-11, 0, 3, 7, -2, 8, 5, 2, -3, 6, -9, 1, -4, 7, -6 }, - { 9, 5, -2, 21, 20,-33,-13, 7,-10, 8, 8,-15, -6, -4, 1, 5, - 3, 7, -2, -9, -1, 4, -6, 1, 0, 9, -1, -5, 2, 1, -3, 3 }, - { -9, -3, 3, 15, -3,-30, -7, -7,-25, 6, 2, -6, 1, 19, 1,-12, - 1, -8,-13, 9, 13, 1, 8, 2, 5, 15, -2, 3, -9, 0, -4, 4 }, - { -6,-12,-17, 25, 22,-13,-10, 9, 2, 11, -7,-16, 4, 6, 1, 0, - 0, 18, -4, -5, 4, -2, -1, -5, 0, -4, 6, 1, 6, -1, 7, 0 }, - { -1, 0,-10, 8, 8,-27, 0, -2, 29, 16, -2, -4, 9, -1, 2, 0, - 6, 10, 6, 4, 2, -7, 9,-18, 3, 3, 3,-10, 17, 10, 9, -6 }, - { -3,-12, -6, 11, 20,-32, 5, 21, 3, -4, -9, 2,-10, 1, 7, -4, - 5, 0, 0, -1, -8, -9, -7, 4,-10, 5, 0, 2, -5, 4, 9, 1 }, - { -5, -1, -5, 1, 2,-19,-13, 1, 6, 12, 2,-16,-17, 11, 10, 13, - 16,-12,-11, 3, -6, 0, 6, 4, -3, 1, 8, 2, 5,-11, 3,-14 }, - {-19, 5, 10, 11, 2,-23, -9, 16, -2, 7, 0,-11, -7, 10, 6, -7, - 26,-15, -4, 8, 6, -4, 7, -9,-15, 1, 8, -4, 4, 2,-12, 16 }, - {-11, 1, 11, -4, 1,-31,-13, -1, 8, 5, 4, -2, 0, 13, 7,-17, - 7,-10, -6, 1, 4, -1, 2, -9, -4, 9, 3, 3, -4, -5, 3, 4 }, - { -3, 1, 10, -1, 0,-15,-22, 4, 40,-11, -4, -3,-14, 9, 11, -1, - 9, -1, -6, 6, 3, -6, 0, 0,-12, 7, -2, 0, 9, 3, 1, 3 }, - { -1, -1, -1, 14, 8,-24,-14, -8, 5, 8, 5,-12,-17, 8, 2, 7, - 10, -8, 0, 4, -6, -6,-10, 8, 4,-12, 3, -9,-12, 5, 4, -3 }, - { -5, 1,-11, 8, 9,-24, 0, 2, 2, 14,-12,-13, 1, 6, 7, 0, - 7, -6, 9, 26, 11,-14, 8, 10, 1, 9, 0, 11, -2, 6, 2,-10 }, - {-13, 1, 4, 34, 19,-17,-15, 0, 3, -2, -7, -1, 0, -3, -3, -1, - 1, -1,-10, 8, 5, 0, -8, 4,-17, 9, -2, 0, 0, 6, 2, -3 }, - { -6, -4, 1, 2, 2,-14,-29, 0, 9, 34, -3, -5,-14, 6,-10, -9, - -5, -1, 0, 3, 3, 0, 1, -1, -2, -1, -1, -3, -3, -4, 3, -3 }, - { -4, 6, 3, 14, 14, -8,-29, 31, 11, 14, -4, -5, -6, 10, 6, -9, - -1,-11, -7, 1, 7, 4, 1, -6, 4, 0, 10, -7, -5, -1, 2, 4 }, - { -4, -4, -2, 14, 6,-32, -6,-14, 14, -5,-11, 10,-18, -4, 6, -8, - 9, 5, -4, 1, -4, 5, -2, -9, 3, 5, 2,-10, -6,-17, 3, 17 }, - {-16, 9, 21, 19, 4,-20,-17, 14, 9, 15, -6,-17, -1, 1, 6, -3, - 1, 1, 8, -3, -6, 6, 9, 4, 9, -9, -5, 1, -1, 0, -1, 2 }, - { -7, -5, 3, 19, 1,-20, -9, 14, 21, -7,-18, -9, 26, -7,-17, -7, - 12, 6, 0, -9, -6, 14, 9, -9, -8, 4, 15, -7, -9, -1, 9, 1 }, - {-20, 30, -6, 11, 24, -4, 0, -6, -2, 8, -4, 12, -8,-17, 0, 5, - -4, 1, -1, 3, -3, 5, 3, 3, 7, -2, -3, -2, 4, 0, 0, -1 }, - {-35, 17, 6, 1, -9, -1,-16, 3,-20,-13, 8, 7, -4, -7, -4,-20, - 7, 12, -5, 5, -5,-11, 12, -1, 15, -9, -6, 16, -4, -9,-13, 4 }, - {-21, 36,-19, 9, 0, -7, -8, 9, -4, -3, 3, 0, 7, -8, -2, -2, - -11, 13, -1, 5, -3, 7, 2, 3, -1, -2, -5, 1, -1, -2, -5, -3 }, - {-12, 33, -4, 1,-12, -9, 0,-13, -1, 2, -8, 4,-10, 6,-16, -7, - -1, -4,-10, 15, -1, 0, -5, -8, 5, 5, -3, 0, 2, -7, 1, -7 }, - {-14, 32, 5, -7,-15, 3, -5, 8, 14, 5, 9, 13, 3, 18, -3, 7, - 4,-10,-10, 10, -1, 2, 0, -2,-11, 5, -3, -4, 2, 2, 7, 4 }, - {-14, 34, 1, 20, -1,-12, 0, -3, -7, -4, 7, 18, 9, -3, 14, -7, - -9,-20, -7, -4,-13, 12, 1, 12, 5, -6, 2, -4, 0,-15, 1, 3 }, - {-21, 23, 7, -8, 3,-13, -3, 0, -6, -2, -7, 6,-12, 9, -6, -2, - -2, -4, -1, 6, 9, 5, -9, 15, 0, 8, -8, 7, 6,-15, 3, -5 }, - {-27, 32, -1, -4, -2, 4,-10, 12, -3, 8, 13, 7, 0,-15, 4, -2, - 3, 5, 7, -4, 9,-12, -1, -2, -1, -4, 0, -4, 2, -5, 6, -6 }, - {-17, 29, 15, 0, -1, -4,-10, 13, 12, -1, -8,-10,-10, 4, 7, -2, - 6, -5,-13, 19, 6, 1, -7, 2, -9, -2, 12, -4, -8, -3, 2, 4 }, - {-38, 27, 16,-15, -6, 3, -7, -4, 0, -1, 6, -2, -3, -6, 6, -6, - -3, 0, 2, 0, -4, 6, 1, -1, 0, 4, -1, 3, 4, 1, -2, 5 }, - {-33, 40, -4, 2, 1, 0, 0,-10,-14, 0, -7, 4, -1, 3, -2, 5, - 7, 6, -1, 4, 1, 3, 1, -7, 1, -4, 5, 7, 0, 4, 3, -4 }, - {-20, 25, 12, -4, 16, -4, 2, 2,-14, -2, -3, 29, -1, 1, 3, 1, - 9, -5, 2, -8, -3, 1, -7, -2, -7, 1, 0, 4, 16, -2, -1, -1 }, - {-10, 30, 17, 3, -5, -2, 0, -5,-22, 4, 5, 5, -3,-18, -6, 10, - -5, -7, 2, 8, 7, -7,-11, -2, 0, -3, 3, 2, 11, -4, 4, -4 }, - {-11, 30, 11, 4, -3, -8, 1, -2, 4, 18, 3, 1, -1, 0, -8, -4, - -3, 10, 13, 14, 5, -5, 1, 1,-10, 2, 15, 4, 9, -1, -5, -3 }, - {-17, 32, 18,-18, -3, -5, 6, 10, 1,-15, -5, 9, 8,-12,-10, -6, - 11, 9, -5, -8, -7, 10, 5,-10,-14, -4, -3, 1, 9,-11, 2, 1 }, - {-13, 28,-11, -1, 2,-16, -2, 7,-24, 0, 3, 6, 3, -1, -8, -7, - -12, 2, 2,-20, 10, 4, 0,-13, -2, -2, 1, 8,-14, 0, 4, 1 }, - {-14, 23, 12, 8, 8,-26, 2, -4,-14, 13,-14, 15, 3, -9, -1,-13, - -10, -2,-10, 6,-16, 12, 8, 0, 9,-10, -7, -4, -4, 7, -8, 8 }, - {-20, 45, 10,-14, 4, 16, 8, -9, 1, -8, 10, 5, -7, -2, 2, -5, - -1, 0, -5, 4, -6, -2, 4, 1, 3, 4, -4, 2, -2, -2, 5, 1 }, - {-20, 26, -4, 1, 7, 4, -8, 1, -5,-13, 2, 13, -7, -3, 6, -6, - 22, 0, 5, 11, -4,-11, 8, -9, 2, -2, -4, -2, 2,-13, -4, -8 }, - {-28, 18, 17, 3, -8,-23,-16, -6, 5,-10, 14, 10, 5, -1, -8, 4, - -2, 13, -3, -2, 3, 4, 3, -2, -3, -4, 0, 1, 3, 4, 0, 4 }, - {-12, 32, -6,-16, 18, 12,-16, 0, 7, 13, -4, 5, -8, -1, -3, 4, - 6, -2, -1,-13, 4, -1, 3, 12, -3,-10, 1, 6, 8,-11, -2, 4 }, - {-18, 26, 2, 5, 0, -9,-17, 14, 5, 1, 7, -3, -8, -3, 11, 7, - -5,-12, -8, 7, 0, -7, 2,-12, -9, 13,-11, 9, 6,-11, -5, 11 }, - {-24, 22,-15, -9, 8, 1, -7,-12, -9, 3, 11, 15, 14,-11, 12,-15, - -5, 7, -2, 0, -8, 3, 3, -1, 2, 11,-11, 14, -6, 13, 1, -6 }, - {-20, 28, 18, -4, -6, -5, 12, 14, 2, 10,-13, -6, -8, -6,-13, -1, - -26, 22, -3,-14, 6, 0, 10,-15,-13, -9, 6, -7, 1, -5, -4, -1 }, - {-19, 26, -8, -3,-14, -6, -9, -4, -8, 15, -8, 3,-12, -4, -2, -7, - -5, 3, 13, -3, -4,-25, 4, -1, 5,-12, -1,-13, 5, 2, 0, 6 }, - {-18, 43, 14, -8, 1,-23, -2, -2, 1, 3, -7, 0, 0, 8, -1, -3, - -5, 1, 5, 2, 0, -2, -2, -2, 1, -1, -1, -7, 0, 3, -3, 9 }, - {-11, 30, 10,-14, 3, 1, 10,-11, 1, -7, -4, 14, 2, 1, -9, 1, - -11, -2, -7, 5,-11, 1, 3, 14, 1,-16, -8, 3, -5, 7, -4, 4 }, - {-18, 24, 6, 3, 8, 7,-22, -7, -7, 3, -8, 4, 23, 9, 3, -1, - 3, 6, 7, -1, -7, 6, 4, 1, -3, 1, -6, -1, 2, -7, 3, 3 }, - {-15, 38, -7, -1,-11, 2,-17,-24, 24, 8, 7, -4, -5, 2, 2, -7, - 1, 4, 0, -9, 5, 0, -1, 1, -1, -5, -6, 3, 0, 7, 8, -3 }, - {-14, 22, 1, -5, 9,-12, -9, -5, -6, 5, 7, 8, -1, -4, -9, -3, - -33,-16, -9, -1, 12,-11, 17, -7, -3, -1, -7, 3, 2, -3, 16, -4 }, - {-14, 20, 6, 4,-10, -4, -4, -4, 1, -7, 2, 6, 8,-12, 4, 1, - -1, 12, 10, 3,-14,-10, -3, 18, -2, 33, -5,-17, 17, -5, 9, 7 }, - {-12, 23, 13, 0,-11, -8,-11, 12, -5, -9,-16, 11, 6, 4, 12, -5, - 5,-13, 7,-12, -3, 1, 2, 12, 1, -4, -1, 5, 4, 11,-12, -3 }, - { 15, 2, 14, 7, 1, 2, 1, 12, 10, 23, 4, 6,-20,-10, 4, 26, - -6, 13, 4, 3, 2,-11, 5, -7,-10, 4, 9, 1, 10, -4, 11, 4 }, - { 17, 15, 31, 17, 18, 16, 11, 24, 2, 4, 2, 3, -8, -3, 7, -3, - -5, -7, -2, -6, -4, -5, -4, -1, -4, -2, -5, -6, 2, -1, 4, -2 }, - { 16, 8, 15, 14, 3, 7, 21, 9, 8, 15, 21, 6, 8, 12, 5, -5, - 7, -3, 10, 2, -3, 8, 6, 0, 5, 5, 6, -3, 2, 4, 0, -5 }, - { 5, -4, 6, 12, 6, 13, 24, 17, -5, 17, -1, -6, -7,-10, -8,-18, - 3, -2, 2, 7,-15,-11, 12, -3, -2, -2, -4, -7, 2, 0, 5, 5 }, - { 10, -6, 8, 11, 12, 20, 22,-11, -3, 15, -3, 15, -2, -2, 0, 2, - 5, -8, 4, -5, -9, -4, -1, 2, -1, -3, 1, 3, 13, -1, 9, 7 }, - { -5, 8, 5, 11, 14, -5, 14, -9, 2, 35, 8, 15, 1, -2, 2, -2, - 4, -9, -3,-14,-12, -2, -2, -4, -2, -8, -3, 1, -6, 3, 10, 0 }, - { 16, 0, -6, 15, -3, 4, 4, 3, 3, 20, 5, -4, 10, 9, -9, -3, - -10, -2, -7, 11,-11,-10, 17, -1, 3,-15, 2, 9,-15,-10, 16, 10 }, - { 14, 4, -7, 19, 3, 0, 19, 8, 16, 34, -9, 6,-13, -1, 6, 5, - -1, -2, 4, 3, 2, 1, 1, -1, 0, -7, 2, -1, 1, 0, 6, -1 }, - { 1, 6, 9, 13, 9, 10, 15, 16, 10, 18, 13, 17, 3, -1, -7, 2, - -15,-11,-10, -4,-13, -6,-17,-13, -6,-14, 1,-10, 6, 4, -1, -1 }, - { 13, 1, 7, 10, 14, 13, -7, 5, 5, 28, 14, 14, -2, 2, 3, -3, - -13, -4, 10, -9, 19, -4, -3, 4, -5, -5, 0, 5, -5, 0, 3, -4 }, - { 1, 0, 6, 22, 9, 18, 18, -3, 5, 10, 12, -2, 1, -3, -8,-12, - 9,-10, -7, 1, -1, 19, 0, 2, -8,-11,-10, 9, 6, 11, 0, 3 }, - { 10, 11, 19, 44, 0, 14, 1, -7, 6, 22, 2, -1, 9, 2, 0, -4, - 4, 0, -6, -6, 3, 0, 0, -2, 2, -5, 1, -2, 0, 1, 1, 1 }, - { 5, 7, 0, 32, 30, 26, 5, 4, -7, -3, 15, -6, 3,-10, 7, 6, - -8, -7, 2,-13, -5, -1, -3, 7, 3, -2, -8, 0, 6, 4, 5, 0 }, - { 9, 8, -2, 4, 2, 11, 4, 29, -5, 14, 8, -5,-14, 8, 0, 9, - 8,-10, 5,-15, -6, -9, 9, -1, 18,-16, 9,-21, -3,-13, -2, 8 }, - { 25, 7, -9, 23, 20, 18, 6, 16, -9, 8, 8, -5, 11, 13, -8, 7, - 4, 10, -2, -1, -7, -9, -7, -9, -4, 1, 1, -5,-10, 8, 4, -5 }, - { 9, 2, 16, 14, -5, 14, 1, 0,-21, 17, -1, 9, 12, -3, -3, 4, - -4, 14, 10, 3, 0,-10, 7, 4, 4,-11, 2, 4, -1, -3, 9, -1 }, - { 17, 8, 11, 26, 15, -3, 14, -1, 12, 9, 10, -8, 8,-18,-11, -3, - -14, -7, 7, -3, -3, -4, 1, -7, -3, 2, -3, 16, 10, 0, 9, 6 }, - { 9, 8, 3, 8, 18, 14, 11, 1, 10, 6, 1, -4,-16, -2, 14, -2, - 1, 8, 12, 14, 3, -3, 8, 8, 12,-15, 3, -3, 3, -2, 14, 10 }, - { 22, -3,-11, 13, -7, 11, 4, 11, 3, 14, 0, -6, -2, -9, 4, 2, - -2, 0, -5,-27,-10, 3, -1, 5, 8,-24, -3,-11, -3, 2, 11, -1 }, - { 19, 2, 8, 36, 5, -6, 3, 15, -3, -4, -5, 14,-10, 1,-12,-10, - -3, -4, 3, -2, 1, -8, 4, 3, 5, -3, 0, 4, 8, -2, 8, 4 }, - { 8, 14, 15, 9, -4, 10, 5, 11, 9, 10, 8, 9,-15, 15, 6, -8, - -10,-13, 5, -8,-20,-13, -6,-11, -1, -3, -6, -4, -1, 0, 13, 15 }, - { -2, -1, 9, 12, 2, 2, 13, 3,-23, 33, 15, 2, -4, -1, 3, 8, - 8, 6, 6, -7, 8, 6, 9, -1, 3, -8, 0, -4, 1, -8, 11, -1 }, - { 6, 5, -6, 16, 2, -3, 31, 21, -9, 12, 0, -1, -4, 1,-12, 3, - -13,-18, 2,-11, -9, 2, -8, -6, 11, -3, -1, 0, -1, 0, 13, 5 }, - { 5, -1, 2, 0, 25, 5, 10, 16, -5, 21, 14, 12, 13, 2, -5, 5, - 5, -3, -2,-14, 0,-12, 7, 11, -1, -7, 19, -1, -1, -1, 8, -1 }, - { 10, 7, 3, 11, 0, 8, 22, 3, 3, 19, -4, 12, 15, 9, 5, 15, - 2, 1, 2,-10,-10, 0, 2, -1, 0, 1,-12, -1, 21, 16, 9, -7 }, - { 11, -4, -5, 24, -7, 11, 20, 11,-15, 18, 5,-13,-15, 0, -5, 9, - 1, 0, -1, -9, 4, -8, 6, -8, 1, -2, -7, 20, 9, 3, 9, 3 }, - { 20, 0,-12, -6, 9, 31, 9, 12, 8, 27, 15, 7,-16, 5, -3, -7, - -1, -9, -2, -7, -3, 4, -8, -3, 3, -6, -2, -2, -3, -6, -1, 2 }, - { 6, -6, 48, 8, -3, 19, 12, 11, -7, 2, 3, 0, -1, 1, 8, -4, - 4, -6, 0, -4, -4, -3, 3, 6, 3,-13, -8, 5, -3, -7, 8, 5 }, - { 7, -2, 6, 11, 12, 2, 14, 4, -5, 12, 2, 9, 4, 2, 0, -1, - 2, 0,-15, -9,-16, -2, 8,-17, -5,-22,-19, -5, -1,-10, 1, -2 }, - { 11, -9, 3, 12, 6, 6, 1, 17, -6, 19, 14, 7, -7, -1, -1, -9, - 9,-11,-17, 0, -6, 16, 0, 1, 9,-24, 3, 3, -9, -3, 3, -2 }, - { 9, 0, 1, 8, 1, 7, 2, -5, -3, 8, -1, 7, 2, 6, -3, -6, - 5, -2, 6, -2, -4, -3, 0, -3, 13,-50, 1, -2, 2, 4, 4, 3 }, - { 7, 0, 26, 21, -4, 2, 17, 8, 7, 11, -7, 1, -1,-15, -1,-15, - -11, -4,-17, -4, 1, -7, 3, 6, 3, -9, 2, 3, 6, 10, 6, 12 }, - { 1, -2, 2, -1,-10, -4, 6, -3, -5, -2, -8, 2, 2, 2, 8, 0, - 1, 1, 6, 0, 11, 13, 3, 4, 0,-12, 11, -5, 19, 20, 2, 5 }, - { 5, 3,-13, -2, 1,-12, 11, -7,-12, 7, 10, 0, 7, 0, -2, 4, - -6, -9,-11,-12,-23, 12, 10, -3, 0, 6, 19, -1, 24, 18, 9, 12 }, - { 6, -3, 2, 5, 2, 2, -2, -5, -8,-11, -4, 3, -8, -4, 5, -3, - -16, -4, 3,-12, -4, 3, 32, 7, 2, 8, 32,-18, -1, 12, 1, 7 }, - { 0, -8, -1, 0, -8, 7, -8, -1, -1, 4,-12, -1, 3, 0, 1,-18, - 8, 8,-14,-10,-11, 19, 9, 5, -7, 6, 8, -4, 26, 12, -1, 6 }, - { 3, 5,-14, 7, 14, 8, 20,-13,-16,-10, -2, 17, -7, 4, -8, -9, - 14, -5, 3, -4,-12, 7, 14,-10,-19,-20, 35, 8, 13, 14, -2, 9 }, - { -2, -4, -1, 1, -3, 0, -1, 1, 2, 2, 6, 0, 0, 4, 5, -2, - 3, 3, 3, -2, -7, -3, -3, -1, 6, -2, 29, 22, 13, 34, 0, 14 }, - { -3, -9, 3, 1, 5, -4, 2, 0, 7, -9, 0, 2, -5, -3, 0, 6, - -1, -1, -1, 2, 2, 4, 8, 7, 20, -6, 7, 16, 33, 20, 6, -1 }, - {-11, 1, -3, -3,-11, 3, -9,-25, -1,-16, 4, -8, 15, 1, -2, 7, - 8, 23, 2, 18,-13, 16, 3, -7, 6, 3, 16, -8, 12, 16, 3, 4 }, - { 0, 5, 5, -5, 1, -1, 2, -3, -2, 1,-13, 2, 2, 10, 6, 7, - 18, 18, 7, 9, 8, 9, 21, 14, 7, 12, 15, 14, 15, 12, 11, 5 }, - { 1, -5, 11, -2, 17, 8, 3, 0, -1, 6, 11, -7, 6, 6, 7, 5, - -15, 14, 1, 11, 4, 10, 12, 1, 2, 4, 30, 1, 11, 1, 6, 13 }, - { 2, 4, 3, -7, 5, 8,-11, 7, -5, 9,-10, 6, 8,-10, -3, 10, - 1,-29, -4,-26, 5, -8, 13, 4, 3, 6, 35, 1, 3, 6, 3, 0 }, - { -2, 1, 0, 0, -1, -3, -7, -3, -9, -3, -1, -6, 3, 4, 4, 0, - 5, -1, -2, -2, -1, -4,-10, 8, 0, -6, 10, -4, 46, 12, 2, 28 }, - { 4, -1, 4, 1, 0, 4, -2, -2, -2, -1, 2, -4, 1, 5, 0, -3, - 1, 1, -2, 0, 1, -2, -1, -1, 3, -6, 35,-11, 13, 53, -3, -1 }, - { -5, -2, 0,-13,-16, 5,-12,-11, 1,-30, 3,-18,-24, -8, -5,-19, - 1, -3, -8, 7, -7, -8, 15,-19, 4, 10, 30, 24, 6, 1, -9, 10 }, - { -4, 8, -7, -4, -6, 12, -1, -9, -4, 2, -9, 3, 2, -2, 4, 2, - 22, 9, 4, -5, 0, 5, -2, -9, -3, 1, 18,-12, 18, 16, 4, 16 }, - { -5, -8, -3, -5, -3, 6, -7, -3, -2, -5, -3, 1, 2, 2, 4, -6, - 10, 3, 12, -3, 20, 0, 27, -4, 16, 5, 18, -3, 23, 4, 12, 11 }, - { 0, 1, 0, 1, -2, 1, 2, 1, -1, 0, -2, 2, -2, -4, 1, -2, - -2, -1, -5, -2, 0, 0, -2, 2, 9, 7, 63, 5, 12, -1, 1, 0 }, - { 4, -3, -7, -5,-11, -5,-12,-10,-10,-12,-15,-12,-14,-14, 1, 1, - 10,-10, 16, 6, 2, 9, 11, 9, 9, 8, 12, -1, 13, 12, 6, 3 }, - { 7, -3, -2, 4, 6, -8, 2, -3,-12, -5, -9, -8,-10, 15, -2, -4, - 8, 9, 7,-13,-18, 34, -5, 7, 12, 22, 16,-11, 13, 25,-15,-11 }, - { -3, -2, 0, -4, 1, 0, -3,-13, -7, 13, 12, -7,-10, 13, 19, 6, - 16, 15,-12,-15, -3, 34, 1, 5, 1, -9, 11, 21, 8, 17, -5, -6 }, - { 3, -5, 0, -4, 0, 4,-11, 4, -7, -3, -1, -8, 3, -2, 2, 1, - 11, 5, 6, 14, -3, 2, -4, -7, 0, 31, 15, -2, 24, 11, 5, 4 }, - { -1, -4, -9, 5, -8,-18, -4, -9,-20,-18, 7,-14,-16, 3, 8, -3, - 29, 11,-13,-13, 7, 1, 17, 6, 6, 21, 11, 1, 14, -8, 2, 5 }, - { -3, 8,-10, -6, 12, 2, 1, 3, 3, 3, 3, -6, -8,-14, 15, -5, - 16, 4, 16, 0, 7, -1, 0, 16, 2, 1, 22, 4, 19, 13,-11, 1 }, - { 2, -3, 10, 20, -4, -1, -8, 5, -8, -9, -6, -2, -4, -7, 8,-10, - 0, 8, -6, 1, -8, 14, 13, 5, 17, -6, 26, -1, 7, -1, 0, 12 }, - { -4, -7,-31, -2, -7, -1, 5, -5, -5,-12, 4, -7, -6, 3, 15, -2, - 5, -2, 7, -1, 10, 7, 8, -1, 14, 20, 14, 9, 16, 16, 8, 24 }, - { -7, 0, -3, -6, 1, 3,-13, -6, -4, -4, -5, -9, -1,-10, -4, -8, - 2, 0, -1, 1, 24, 24, 21, 31, 5, 2, 11, 12, 7, 4, 3, 6 }, - { -3, -5, 6, -4, -3, -1, 2, -1, -2, 1, 0, -8, -1, 2, 0, -4, - 6, 22, -1, -5, 8, 12, -1, -2, 28, 27, 20,-27, 14, 1, 2, -3 }, - { 1, -5, -2, -2, 6, -2, 9, 1, -2, -5, 3, 4, 11, 5, 2, 8, - -3, -1, 1, -2, -3, -5, 5, 8, 49, 12, 8, -3, 9, 20, 12, 17 }, - { -6, 0, 1, 7, 0, 9, -2, -4, 8, 0, -2,-10, 0, 7, 21, -1, - 0, 1, 17, -7, -5, 2, 4, 16, -2, 17, 14,-20, 15, 14, 4, 15 }, - { 0, 3, -4, 9, -4, 0, 6, 4, -6, -6, -5, -7, 2, -9,-10, -2, - -5, 0, -3,-21, 9, 14,-11, 13, 29, 2, 25, 4, 22, -1, 2, -3 }, - { 2, 12,-11, 2, 16, 9, -4, 7, 1,-10,-15, 11, -4, 3, -2, 4, - 4, -5,-10, 1, 4, 19,-15, 6, -4, -2, 30, -7, 11, 21,-12, 5 }, - { -2, -3, -2, 4, -1, -5, -3, -7, -5, 1, 0, -6, 1, -6, 7, 0, - 8, -7, -3, -2, 2, 14, 2, -3,-26, -1, 26, 22, 32, 1, -2, 6 }, - { 1,-38, -1,-20, -2, -3, -6, -4, 2, 2, 7, 0, 3, 5, 3, 10, - 6, 1, -3, -5, 7, 5, -5, -4, 8, 3, 1,-14, -1, -9, -5, -4 }, - { -5,-26, -7,-19,-10, -5,-11, 5,-11,-25, -8,-14, -9,-16, -8, -6, - -17,-14, -1, -1, 6, 2, 2, 2, 3, 0, 2, 8, -8, 3, 0, -3 }, - { 17,-49, -3,-23, -1, 11, 7, 3, 4, -4, 0, 0, -1, 4, 2, 4, - -2, -4, 2, -2, -1, -2, 2, 0, 0, -1, 0, 0, 1, 2, 0, 0 }, - { 4,-34, -6, -9, 1, 21, -7, 3, -2, -1, -3, 18, 2,-16, 7, -3, - 8, 7, -5, 7, 2, 4, 8, -6, -7, -2, -5, -1, 4, 1, 2, -4 }, - { 5,-29, 13, -2,-14, 3, 1, 18,-15, 4, -8, 8,-10, 8, 2, 1, - -8, 15, 3,-10, -4, -4, -2, 0, -3, -4, 2, -3, -4, -3, 12, -6 }, - { 13,-20, 3,-18,-17, 4,-14, 13, 28, 11, -8, -6, 16, 6, 0, 10, - 3, 4, -9, 13, 5, -7, 12, -5, 0, -7, 5, 1, 3, 3, 2, 1 }, - { 3,-27, -5,-11,-21,-11,-12, 0, -5, 7,-22, 1, 3, 5, 0, -5, - 8, 7, 1, -5, -7, 2, -5, 4, 1, 3, -8, -2, 0, 4, -2, 6 }, - { 31,-45, 0, -1,-12, 1, 2, -6, 4, 3, -1, 3, 3, 0, 5, 3, - -5, 12, 4, 6, 2, 1, -2, 1, 3, 2, 5, 2, 2, 2, 3, -1 }, - { 9,-45, 6, 5, -1,-17, -2, 18, -3, 2, 0, 1, 0, -1, 10, 8, - -7, -2, -5, -8, 6, -1, 0, 4, 6, -3, 12, -1, -2, 0, 5, -7 }, - { 3,-26, -2,-12,-12, 2,-10, 16, -3, 12, 4, 5, 11, 8,-16,-17, - -2, -3, -3, 2, 5, -9, 13, 1, 10, 11, 3, 5, -2, 2, 2, -7 }, - { 8,-26, 32, -7, -5, 22, 2, 14,-10, -8, -7, 3, 3, 7, 0, -5, - 0, -1, -3, 0, 8, 4, -5, -7, 6, -1, 4, 8, 1, 1, 7, -6 }, - { 4,-31, 2,-14, 2, 0, 1, 8, -6, -1, 17, -3, 13, -6, 5,-10, - -2,-10, -2,-10, -3, 7, 1, 5, -8, 8,-14, -3,-15, 7,-10, -6 }, - { 16,-27, 13, -4,-23, 7, -9, 6, -7, 5, 4, 2, -1, -3, 23,-18, - 7, 0, -3, 4, -3, 9, -6, -2, -1, 8, -6, 2, 6, -3, 2, -2 }, - { -1,-35, -2, -8, 11, -1, -7, -3, -2, 11, 7, 6, -6,-10, 9, 6, - -3, -5, -6, -3, 9, 16,-16, -9,-20, 12, 3, 5, -3, 1, -9, 4 }, - { 2,-24, 1,-12,-16, 5, -4, 3, -4, -1,-11,-11, -8,-14, 14, 10, - -8, 20, 8, -3,-11, 1, 1, -4, -4, -7, -3, 15, 2, -6, -2, 7 }, - { 9,-21, 2,-19, -7, -5, -8, 25, 3, 17, 5, -3, 9,-12, 8, 2, - -4, 3, 3, 1, 11, -9, -4, -3, 4, 3,-22, 6, 4, 6, 11, -5 }, - { 16,-23, 13,-17,-21,-12, 5, 9,-20, 7, 6, -6, 0, 2, -9, 6, - -6,-13, -7, -1, 5, -3, 5, -7,-10, 1, 0, 8, -9, 11, 0, -8 }, - { 10,-26, -9, -7,-19, -4, 6, 16, -7, 5, -4, 4, 8, 0, 4, -1, - 6, -7, 1, -8,-11, 10,-14, 0,-16, 6, -3, 5, -1, 14, 12, 1 }, - { 8,-27, 12,-14, -1, -1,-19, 10,-11, 21,-14, 9, -8, -3, 8, -1, - 12,-13, 3, -4, -2, 0, -9, 0, -7, 2, -3, 12, 1, -3, 3, 1 }, - { 18,-20,-14,-14,-16, -3,-24, 6,-17, 2, -3,-11, 2, -3, 12, 10, - 10, 1, 10, 7, 8, 5, 5, 4, -1, 7, 2, 2, 0, 4, 7, 0 }, - { 0,-30, 9,-16,-18, 15, 12, -3, 4, -4, -5,-11, -4,-12,-10, 0, - 2, -2, -4, -1, 2, 0, -1, -6, 2, -3, 4, -5, 7, 3, 5, 7 }, - { 25,-24, -1, -6, -9, 6,-13, -2, 3, 15, -3, 11, 4, -8,-11, 2, - 0, -9, -2, 7, 4, 8, 5, -8, 5, 6, -1,-11,-15, -5, 0, 11 }, - { 0,-34, -7,-11, -7, 9, -3, 19, 4, -8, 3,-11, 11, -3, -9, 12, - 9, 9, 2, 1, -7, 1, -3, 0, -6, -2, -1, 3, 0, -7, -2, -5 }, - { 6,-34, -4, -5, -3, -9, 2, 9, -1, 9, -5, -3,-26,-12, 8, -6, - -7, 11, -8, 4, 4, 1, -1, 0, 8, 9, -4, 7, -1, 1, -3, -1 }, - { 3,-30, 5, 6,-10, 3, -7, 6, 3, 3,-26,-19, -3, 1, 7, 5, - -4, -5, 6, 10, 13,-10, 4, -7, -4, 5, -3, 9, -6, 3, 9, 5 }, - { 4,-24, 9,-19, 2, -4, -5, 8, -3, 2, 0,-15, -1, 9, -4, 22, - 6, 9, 3, 7, 11, -9, 0, -3, 4, 5, -5, 10, -8, 5, -7, -3 }, - { 8,-27, 7, -3, -1, 2, -9, 13, 7, 12, -4, -6, -6, 5, 0, 7, - 5, 1, 15, -3, -4, 0, -5, -2, 7, -5, -7, 1, -2, 13, -8, 13 }, - { 17,-22,-15,-11, -8, 16,-14, 18, 2, -1, 14, -7, 14, -6, -6, -7, - -8, 17, 6, 4, 4, -7, -5, -9,-14, -6, -1, 9, -3, 1, 6, -5 }, - { 25,-30, 2,-12,-13, 18,-18, 16, 8, -3, 10, -8, -3, -1, -6, 3, - -5, -7, 4, 6, 7, 1, 1,-11, -5, 6, 2, -4, 9, -1, -5, -2 }, - { 7,-23, 7,-15, -1, -3, -1, 0,-10, 12, 2, 5, -4, 0, 4, 6, - -1, 5, -9, -1, -1, -7, 1, 17, 9,-17,-16, 8, 4,-14, 11, 14 }, - { 0,-31, 7,-13, 3,-11, -7, 6, 1,-11, 8, -7, 15, -3, 16,-11, - -1,-15, 16, -3, 5, 0, -2, -2, -6, 11, 5, 6, 5, -5, 6, 3 }, - { 13,-24, -2,-20,-10, 7, -3, -1, 15, 2, 6, -5, -7,-10,-20, 1, - -4, 14, 8, -2, 3,-13, -3, 1, -4, 1, -3, 2, 8, -7, 16, -4 }, - { 1, -2, -2, -3, -4, -7, 0, 3, 6, 7, 3, 2, 1, -2, -1, 0, - -6, 4, 2, -4, -3, -4, 5, 9, 5, 0, -3, -3, -4, -7,-31,-50 }, - { -1, -3, 7, 2, -1, 2, 4, 6, 0, 10, -2, 0,-20, -6, -3, 9, - -20,-22, -1, -1, 15, 9,-12, 10,-13,-20, 12, 3, 5, 6, -7,-26 }, - { 0, 4, -2,-14,-12, 6,-13, 11,-10, 3, 22, 6, 16, -2, -5, 1, - -3,-11, 0, -7, 5, -5, 0, 1, -1, -6, 8, 8, 10, 9, -5,-27 }, - { -5, 10, -2, 7, 9, -9, 5, -9, 5, 4,-15, 14, 1, 3,-10, 5, - 0, -2, 7, 3,-13, 6, 9, -6, 5,-14,-17, -1, 11, 14, -2,-26 }, - { 0, 6, -3, 0, -8, 6, 0, 1, 4, -8, 2, -5, 4, 7, 15, 11, - 9, 19, -2, 14, -8, 7, -1, 3, -3, -3,-10, -2, 12, -2,-12,-29 }, - {-12, -5, 0, -3, -2, 6, 3, -3, 2, -2, 1, 11, 2, -7, 5, 1, - 2, -2,-14, 0, -1, -5, 3, 8,-28,-26, 6, -6, 3, 8,-10,-27 }, - { -1, -3, 6, 2, 4, 15, 1, 0, 2, -2, -2, 13, 3, 6, 0, 6, - -1, -4, -1, -5, 8, -1, 5, -5,-15, 11, -8, -5, 14, -6,-14,-29 }, - { -5, -6, 0, 1, 0, 6, -3, 2, -5, -1, 5, -3, 2,-10, 3, 4, - 3, 0, 13, -3, -1, 4, -4, -6, 2, 9, 8, 2, -3, 28,-11,-31 }, - { 1, -4,-10, -9, -4, -3,-15, -6, 1, 5, -3, -6, 5, -6,-22, 27, - -13, 5, 3, -7, -4, 20, -7,-12, -1,-24, -4,-13, -8,-11,-15,-21 }, - { -6, -4, 19, -6, 2, 11, -6, 1, -3,-10, 9, -9, 12,-10, 2, 1, - -9, 1, 15, 7, -5, 5,-29,-35, 4,-30, 9, 9, 19, 17, 2,-17 }, - { -3, 3, -3, 1, 2, 5, -1, 5, -2, -3, 1, -3, -8, 3, -4, -2, - -4, -1, 12, 0, 2, -8, -6, -4, 16, -1,-14, -2, 25, -6,-15,-36 }, - { 0, -1, 3, -4, -4, -1, 7, -4, 8, 0, 10, 9, -4, 1, 10, -1, - -3,-13, -5, -4, -1, -4, 8, 11, 14, -7, -5, 16, 12, 13, -1,-28 }, - { 1, -2, 2, -3, -8, 10, 4, 9, 12, 3, 5, 0, 8, -3, -6, 2, - 16,-11, 11, 0, 1, 6, 1, 18,-10,-16, -1, -4, 5,-14,-15,-20 }, - { 1,-12, 5, 4, -7, 8, -1,-17, -2, -9,-14,-11, 6, -9, 5, -4, - 3, -2, 7, 18, -5, 5, 6, -1,-11, -2,-10, -3, 8, -3, -2,-32 }, - {-12, 5, 20, -5, -6,-11, -6, -6,-13, 4, -6, 19, -8, 2, 3, -9, - -4, -4, -1, 9, -1, 21, -1, 7, 15,-10, -1, -3, 9, -3, 2,-24 }, - { 0, -3, 2, -6, 4, -1, -9, -2, -1, -3, 6, -1, -5, -6, -5, -8, - 0, -2, -6, 9, -4, 3, 2,-13, 1, -7, 23,-13, 4, -3,-15,-33 }, - { -7, 2,-15, 11,-10, 14, 0,-11, 3, -1, 12, -4, -4, 9, 11,-13, - -13, -3,-14, 1, 3, 6, -5, 8, 0, 5, 5,-10, 4, 5, -6,-30 }, - { -6, 4, 0, -5, 4, 1, -1, -1, 3, 6, 5, -2, -5, 0, -2, 5, - -4, -2, -4, -2, 4, 7, -7, -1, 1, -4, -3,-19, 37, 12, 10,-40 }, - { -7, 2, -7,-12, 17, 11, -7, 2, 2, 3, 1, -1, 3, 4, -2, -5, - 9, -9, 6, 4, 9, 12, 11, -5, 2, -1, 0, 9, 5, -7, -2,-24 }, - { -7, 6, 1, 3, 1, 0, 6, 0, 4,-12, -2, -2, 1, -9, 10, -2, - 11, -1, 21,-12, 15, -5, 10, -5, 5, -5, 14, -6, 5, -7, -3,-29 }, - { -2, 0, -5, -2, -3, 1, -3, 0, 4, 2, 3, 0, 2, -2, 7, -2, - 3, -5, 2, -1, 6, -4, 0, -3, 8,-11, 19, -8, 22,-34, 13,-35 }, - { -1, -3, -1, 9, 11, -3, -3, -1, 7, 18, 11, -5, 2,-12,-11, 18, - 9, -5, 1, -6, -9, 12, 1, -3, -3, -9,-14, 9, 9, 8, -6,-26 }, - { 0, 5, -5, -1, -1, -2, 4, 6, 8, 2, -1, -2, 5, 1, -5, -4, - 1, 1, 18, 1, 7,-10, 3, -2, 12, -1,-15, 9, 12,-14, 13,-38 }, - { 3, 0, -8, -1, 0, 8, -9, -3, -8, 16, 3, 16, -5, -9, 0, -1, - -7, -1, -4, 13, 7, 0, 1, 2, -1,-16, 0, -2, 1, 8, -8,-28 }, - { 7, 9, -5, -3, -2, 2, 0, 3, 11, -6, -4, -2, -2, -5, 28,-18, - -6, 2, 15,-10,-15,-10, -2, 0, -2, -2, 4, -3, 7, 11, 5,-30 }, - { 9, 0, -7, -1, -4, -7, 2, 2, 9, -2, 2, 3, -8, -6, -6, 3, - -10, 4, 10, 5, 21, -4, 14,-18, 1, 3,-10, -2, 6, 14, -8,-26 }, - {-14, -1, 2, 3, -3, 7, 1,-22, -1, -1, 0, 1, 12,-14, 3, -5, - 0, 10, -3, 1, -5, 12, -3, 10, -8,-22,-11,-13, -7,-10,-13,-25 }, - { -2, -5, -4, -4, -9,-18, 9, -3, -5, 17, 13, 5, 6, 11, 3, 8, - 20, 4, 2, 9, 8, 5, 6, 1, 7, -7, -6, -2, -7, 0,-17,-23 }, - { -5, -5, 2, 0, 6, 2, -2, 2, -3, 4, 4, 0, -5, -2, -4, 6, - 8, 10, -1, 1, -5, 5,-14, -2,-11, 8, 6, 25, 7, -1, 0,-43 }, - { -4, 0, 4, -2, 7, 0, 3, 17, 5, 2, -5, 1, 21, 3, -2,-10, - -16, -9, 7,-12, 9, -8, 2, 5, -5,-10, -2,-11, -5, -1, -9,-30 }, - { -2, 3, 1, -4, -1, 0, 8, 1, 12, 4, -1, -1, 3,-17, 13, 9, - 0, 7, -6, -5, 9, 1, 5, 4,-10,-18, 0, 14, 11, -4,-16,-28 }, - { -1, 0, 2, -1, 4, 1, -1, 1, -1, -2, -1, -2, 3, 0, 0, -1, - -1, 1, 2, -2, 3, 3, -2, 4, -2, -1, -6, 1, -1, -1, 6,-70 }, - { 7, 3,-11, -1, 12, -4,-14, 4, 4, -4, 4, -2, 2,-12, -4, 15, - -17, -4, -3, 6, 8, -5, 22,-22, 5,-11, 15, -4, 4, -1,-21, -1 }, - { 10, -2,-13, 11, 4, 14, 4, 9, 8, 8, 19, 15, 14, 15, 5, 10, - 8, 15, -5, 4, 14, -8, 1, 1, 2, 1, -1, -3, 21, 8,-29, 13 }, - { -6, 0, -6, 6, -1, 2, 8, -4, -5, 4, -4, -5, 0, -2, -4, 0, - 9, -2, 1, -2, 26,-19, 21,-10, 4, 1, -8, 5, 22,-10,-13, 15 }, - { 11, -5, 1, 0, 6, 3, 7, -2, -2, -3, -5, -1, -2, -6, 1, 1, - -8, -5,-13, 13, -2, -3, -1, -9,-28, 4, 2,-11, 18,-20,-24, 9 }, - { 7, 4, -3, 6, 6, -6, -7, -5, -7, -4, -4, 0, -7, -5, -6, -5, - 2,-13,-12, 2, 0, 5, 18, 15,-13, -7, 13,-20, 16,-10,-19, 6 }, - { 5, -8, -1, 5, 10, 2, -1,-10,-11, 23, 8, -5, -8, 4, -5, -4, - -5, -5,-11, -8, 5, 1, 7, -9, -9, -6, 12, 14, 17,-12,-22, 3 }, - { -5, -8, -3, 3, 12, -1, 0, -4, -5, 1, 1, 6, 1, 5, -5, 7, - -2, 7, 1, 6, 6, 2, 0, -5, 17, -4, -5,-24, 13,-20,-27, 14 }, - { -1, 2, -3, 1, -3, 1, -3, 0, -2, 3, -2, 1, 2, -1, -2, -1, - -2, -5, 5, -2, 0, -7, 1, -6, 8, 8, 11, -5, 24,-43,-13, 2 }, - { -2, 4, 7, -3, -4, 4, 13, -4, 0, 0, -2, 9, 0, -3, -6, 1, - -7, 1, -1, 10, 0, 5, -1,-24, 25,-15, 7, 2, 22,-10,-21, 0 }, - { -5, 2, 6, -2, 13, 3, 5,-12,-11, 16, 6, 10, -5, 0, -3, 6, - 5, -5, -5, 10, 12, 10, 11, -7, 8,-14, 2,-15, 13,-14, -8, -3 }, - { 5, 6, -7, -5, 5, 2, 9, 5, 0, -1, -4, 2, 8, 0, 3, 5, - -12, 3, -3, -6, 2, -1, -5, 14, 11,-20,-21,-25, 24, -1,-10, 6 }, - { -5, 5, -2, 9, 4, -4, -1, -6, 11, -6, 5, 0, 2, -3, 6, -1, - -17,-18, -4,-13, 9, -1, 9, -7, -4, -8, 2, -3, 12,-31,-18, 5 }, - { -7,-11, 6, -8, 4, -3,-12, 0, -1, -6, -3, 0, 5, 9, 7, 2, - 1, -8, -6, 8, 2, -5, 7, -1, 16,-10, 16,-12, 18, -1,-25,-12 }, - { 3,-12, 1, 2, -2,-18, -8,-15,-10, -9, 2, -7, 11,-11, 2, -1, - -1, -1, -9, -6, 3,-14, -2, -1, 2,-13, -7, -9, 19, -5,-17, 2 }, - { 7, 1, -8, 7, 17,-13,-10, 5, 7, 1, -6, 4, 9, -4, 0, 3, - 8, 1,-14, -9, 4, 7, -9, 0, 6, -5,-12, -2, 25, -2,-19, 1 }, - { 7, -3, 6, -3, 1, 6, -7, 0, 10, 0, 4, -5,-17, -4, 4, -1, - 0, -3, -7, 19, 24, -1, 21, 8, 10, 9, 8, -1, 23, -2,-18, -2 }, - { 3, -3, 0, 5, 8, -2, -9, 2, 9, 6, 19, 8, 2, 6, -9, -2, - -4, -3, -8, 7, -7, -8, 5, 4, 26, -6, 7, 18, 24, 0,-13, 4 }, - { 0,-13,-11, -1, 3, -9, 5, 4, -7, 3, 0, 2, -1, 4, -5, 2, - 9, -2,-11, 15, 1,-21, 1, -1, 0, 4,-14, -4, 24,-16,-13, 1 }, - { 1, -9, -8, 0, 0, -4, 11, -1, 14, 16, 0, 17, -2, -9,-12, 0, - -1,-14, -9,-14, 0, -2, 19, 4, 6, 4, 4,-11, 8,-17,-19, -5 }, - { -3, 1, 2, 12, -4,-18, -1, -4, -7, 14, -3, 2, 0, -7, -8, 12, - -5, -9, 14, 12, -9, -2, 4, -6, 4, 18, -1,-25, 22, 2,-23, -5 }, - { -2, 0, 0, 0, 1, 3, 5, -1, 5, -2, -2, 2, -3, 0, 1, 2, - 0, -1, 2, -1, -9, -6, -7, -4, -2, 4, -7, -5, 64, -3,-25, 4 }, - { 12, -2, -3, 0, 8, -9, 13, -7, 6, -3,-12, 12, 15, -9, -4, 2, - 9, -4,-12, 3, 14, 1, 7,-15, 15, 0, -6,-12, 0, -3,-20, 6 }, - { 2, -1, -4, 5, 9, 6, -7, 2, -2, -7, -2, 0, -1,-18, -4, -6, - -15, -5, 11, 5,-10, -1, 2, 7, 12,-19, -7, 8, 21, -4,-15, 4 }, - { 4, 2, 5, 5, -5, 1, 3, 2, -8, 13, 0, -5, -2,-14,-11, 6, - 2, 17, 8,-13, 26, -2, 5,-15, -4,-14, 12, -9, 13,-21,-23, -4 }, - { 2, -3, -2, -3, 3, -2, 6, 9, -9, 13, 4, 2, 12, -3, -3, 1, - -17,-22, -3, 4, 3, -2, 1, -9, 1, -6, 11,-13, 14, 0,-15, 6 }, - {-16, -4, 17, -2,-20,-11, 11, 10, 5, -8, 16, 2,-17,-14, 11, 11, - -6,-11, -7, 12, 12,-10, -6, 5, 8, -4, -2, -5, 28, 3,-13, 4 }, - { 0, -3, 3, -7, 6, 8,-12, 20,-19, 18,-11, 10, -5, 0, -9, 11, - 3, 0, -2, 9, -7, -5, 18, 3, -2,-16, 1, 6, 12, -7,-16, 1 }, - { 4, 1, 5, -5, 15, 2, -8, 3, 5,-11, 15, -3, 8, -8, -1, 7, - 4, 7, -2, 6, -9, 5, 12, 2, 33, -2, -6,-18, 4, 0,-18, 11 }, - { 3, -1, 1, -1, 0, 1, 4, -1, -5, 0, 1, 0, 4, 2, -1, 4, - -3, 2, 0, -2, 4, 6, -1, 6, 42, 19, -4,-37, 19, 1,-15, -4 }, - { 2, 0, -5, 0, 10, 0, 0, -5, 3, 0, 0, -3, -3, 0, 2, -4, - -10, 2, -6, 4, 4, 1, 27, -7, 17,-34, 5, -9, 15,-16, -7, -5 }, - { -2, 7, 7, -2, 9, -2,-15, 11, 11, 7, 5, 1, 15, 1, -9, 31, - 2,-15, 2, 4, 3, 4, -1, -8, 2, -7, 6,-17, 11,-14,-11, 2 }, - { 1, 1,-11, 9, 9, -6,-14,-11,-10, 8, -3, 11, 16, -9, -8,-13, - -8, 9, 0, 6, 6, -2, 13, -8, -2, 3, 13, -3, 10, -6,-17, 4 }, - { 14, 5, 4, -6,-12, 10, -7, 8, 21, -8,-30, 15, -2, 1, 11, -9, - -5, 1, 0, -1, -1, -6, -2, 3, -5, 7, 9, 5, -5, 2, 0, 1 }, - { -1, 2, 20,-17,-15, 3, 3, 7, 11,-17,-13, -6, -3, 18, 17,-15, - -4, -4, -5, 22, 14,-14, -2,-10, -7, 11, 8, -7, -3, 0, -7, 11 }, - { 7,-11, -7, -8,-14, 22, 5, 2, 6, 13,-12, -2, 10, 3, 0,-21, - -4, 20, 3, 10, 21,-10,-12, 8, 11, 2, -5, 2, 1, 3, -1, 15 }, - { -1, -2, -1, -2,-13, 8, -4, 0, 7, -2,-17, 8, 18, 5, 3, 8, - -8, -2, 3, -4, 14,-18,-13, 14, 15,-13, -1, -2, 4, 11, 1, 12 }, - { 13, -6, -4,-16,-17, 16, 21, -2, 5,-11, -9, 19, 21,-17, -3,-17, - 3, 12, 8,-12, -6, 1, -7, 9, 9, -7, -5, -1, -3, 5, -6, -4 }, - { 11, 5, 12,-20, -6, 10, 4, 12, 8, -5,-10, 15, 13, 14, 10,-15, - -13, 1, 6, 14, 15,-17,-13, 4, -5, 10, 7, -6, -8, -3, -4, 12 }, - { 25, -1, 7, -5, -7, 11, 1, 17, 13,-15,-14, -4, 5, 3, 8, -3, - -2, 2, 0, 6, 16,-12, -6, -4, 4, -3, 7,-10, -3, -7,-13, 7 }, - { -8, 10, -3,-13, 5, 2, 4, 9, 9,-17,-13, 2, 11, 1, 6, -4, - 8,-10, 4, 1, 19,-15, -4, 12, 31, 7, -5,-17, -4, 9, -2, 7 }, - { 14, -6, -6, -6,-14, 13, 17, -5, 4,-14, -9, 7, 7, -9, 3,-16, - -15, 11, 11, 6, 4,-11,-19, 3, 5, 8, 13,-14,-14, 3, -4, 12 }, - { -2, -4, 10, -4, -7, -1, 27, 5, 2,-16,-18, 4, 12, -2, -3, -2, - -1, 1, -8,-12, 3, -4, 8, 15, 2, 4, 9,-13,-14, 9, -7, 5 }, - { 4, 2,-10, -5, -7, 2, 1, 4, -1, -6,-15, 6, 1, 10, 5,-10, - -9, -1, 13, -3, 5,-21,-11, 8, 8, 5, 27,-21,-18, -5, -1, 15 }, - { 11, 1,-16, -8,-11, 0, 5, -8,-12,-13,-17, 22, 4, -6, -1,-18, - -10, 0, 19, 2, -2, -8, -7, -3, 2, -2, -9,-17, -5, 4, 4, 10 }, - { 8, -6,-19, -5, -4, 12, 14, 15, 10, -9, -1, -9, 19, 12, 0, -1, - 2, 4, 7, 9, 16,-16,-14, 9, -4, 3, 1, 0, -2, 10, -1, -1 }, - { 12, -8, 12, -9, 0, 25, 7, 9, 2,-31, -9, -4, 15, 4, -5, 1, - -10, 11, 8, 10, 0, -6, 5, 11, -1, -6, 4,-10, -9, 6, 4, 5 }, - { 14, 6,-17, -2, 17, 12, -9, 2, 0,-25,-14, 5, 20, 14, 8,-20, - 5, 2, -2, -3, 9,-13, -3, -1, -6, 3, 7, -6, 0, 2, 3, 1 }, - { 8, 4,-15, -3, 10, 18, -4, 13, 8,-22,-10, 9, 19,-15, 7, -5, - -13, 12, -4, 9, 2, -9, -6, 0, 2, 1, -9, -6, 6, 1, -1, 11 }, - { 4, 1, 4, -5,-10, 18, 7, 2, -4, -9,-11, 0, 32, -7, 4,-16, - -1, 0, 6, 3, 6, -3,-14, 16, 9, -2, 7, -1, 0, -5, 5, -3 }, - { -3, 2, 3, -8, -6, 4, 6, 2, 4,-12,-15, 2, 8, 8, 9, -3, - -18, 6, 34, 11, 12,-15, -1, 2, 9, 2, -4, -4, 2, 4, 2, -3 }, - { 18, -6,-12, -8, -1, 15, 20, -4, -1,-11, -5, 6, 6,-11,-15, -7, - 3, 7, 10, 2, 8,-10, -5, 8, 15, -5, 5,-17,-13, 13, 11, 7 }, - { 8, -4, -6, -1,-14, -3, 6, -2, 1, -5, -1, 10, 10,-15, 5, 0, - -10, -4, -3, 7, -4,-19,-15, 27, 11, 18, 3,-19, -2, 6, 0, 12 }, - { 12, 0, -5, 0, 4, -5, 1, 5, 10, -7,-11, 21, 29, 1, -2, 1, - -4,-11, -1, 13, 11,-20, -1, 4, 4, 4, -5, 6,-13, -2, 11, 9 }, - { 2, -7, -7, -3,-10, -1, 20, 12, 1,-19,-19, -1, 5, 4, -7,-25, - 14, 1, -3, 2, 12, -4, -3, -3, -2, 6, 1, 0, 3, 2, 5, -1 }, - { 12, -8, 3,-12,-10, 10, 13, 0, 23,-14,-18, 10, 0, 15, 3,-12, - -3, -5, 5, -4, 2,-14,-10, 8, 2, 9, -1,-11, -3, 5, 13, 2 }, - { 9, -6, 7, -7,-30, 17, 6, 13, 1,-14, 0, -1, 6, -9, 8, 3, - -4, 0, -1, -7, -5,-13,-19, -3, -4, 4, -6, -2,-13, 1, -2, 3 }, - { 10, 1, 3,-18,-26, 17, 4,-16, 4, -3,-13, -4, -6,-11, -4,-21, - 7, 8, 2, 5, 13, -6, 1, 5, 8, 7, 9, -6, -6, 1, -1, 2 }, - { -3, -1, 0, -2, -2, 0, -1, 3, 4,-14, -8, -9, 13, 2, 50,-23, - -8, 8, 7, 11, 16, 3, -7, 0, -2, 6, 5, -1, 1, -2, 4, 3 }, - { 1, 3, 1, 1, -6, 3, 6, 6, 2, -2, -3, 10, 2, -8, -5, -5, - 5, 4, 4, -2, 10, -8,-40, -1, 21, 8, 3, -4, -1, 13, 4, 7 }, - { 2, 0, -4, -8, 5, 2, 7, -5, 5, -8, -4, -1, 12, 2, 12,-13, - -9, 0, 1,-12, 9,-43, 1, -5, 12, 1, 3, 6, 1, -1, 3, -2 }, - { 6, -2, -1, 1, 0, 4, 8, 14, 4, -7,-23, -5, 23,-17, -6,-15, - -8, 7, 10, -1, 7,-16, 4, -6, 2, 3, -3, -3, -1, 8, -1, 4 }, - { 10, 4, -4, 1, 7, -3, 2, 11, 4, -6, -3, 8, 5, 4, 1,-45, - -6, -4, 4, 2, 1,-14,-10, 1, 1, 6, 2, -8, -1, -3, 3, 3 }, - { 1, -1, 2, -3, -8, 9, 3, 3, -2, -5, -8, 8, 7, -7, -4, -6, - 5, -9, 11, -2, 46, -5, -1, 9, -2, 0, 3, -5, -3, -5, 7, 0 }, - { -4, 1, -2, -1,-11, 11, 8, -3, -2,-10, 0, 4, 9, 9,-17,-17, - -34, -4, -5, -7, -3,-12, -3, 11, 18, 3, -2, -5,-18, -5, -3, 6 }, - { 7, -5, -3, 1, -4, -3, -5, -1, 2, 5, -2, 3,-10, 12,-18, -5, - -10, 12, -9, 4, -6, 2, 0, 16,-17, 15, 14,-12,-10, -2, -9, -1 }, - { 4, -5, -3, -5, -3, -1, 7, 18, -7, 12, 3, 5, -8, -4,-20, 1, - -25, 1, -8, 13,-10, 8,-19, -1, -8, 10, 6, -9, -1, 0, 12, 4 }, - { -4, 5, 0, -1, 2, 5, -8, -2, -6, 4, -8, 9, 3, 2, -7, 4, - -25, 13,-23, 10, 14, 15,-11, 3,-18, 4, 16, -4, 1,-10,-10, 3 }, - { 5, -3, -1, -3, 4, 1, -3, -4, -5, 1,-12, 14, -7, 11,-15, 6, - -6, 24, -4, 13, -1, 15,-13, 8, 3, 7, -5, 2, 2, 0, 3, -7 }, - { -3, 1, 0, 8, 6, -1, 6, 5, -5, -2,-12, 4, 0, -2, -3, 5, - -6, 0, -8, 9,-10, 4,-28, 12,-20, 11,-13, 7,-18, 1,-11, 1 }, - { 1, -4,-15, 5, 0,-13, -5, 13,-11, 4, -4, -5, 5,-14,-16, 0, - -14, 5,-20, 12, 10, -7, -5, 6, 6, 22, 6, -4, -2, 3, 8, 11 }, - { 13,-11, -2, 16, 16, -7, 0, 20, -7, -1, 0, 5, -9, 12, -2, -5, - -22, 5,-10, 12, -6, 11, 9, 21, -8, 15, 4, 0, -8, -4, -4, 10 }, - { 18, -4,-13, 0, 1,-15, -1, -3, 2, 10, -1, 6, 1, -4,-20, -5, - -8, 6, -8, 17, -5, 5,-10, 8,-22, 6, -5, -2, 8,-17, 8, 2 }, - { 1, -2, -9, 6,-31, -8, -8, 8, 0, 5, -9, -4, 2, 3,-12, 11, - -18, 10, -5, 3,-11, 13, -6, 11, -3, 12, -7, 3, -9, -1, 2, 11 }, - { -9, -6, 21, -8,-15, 4,-11, 12,-11, 17, -1, 2, -6, 0,-15, 13, - -12, 19, 0, 2, -6, -3, -9, 10, 3, 17, -2, 5,-10, -3, 0, 1 }, - { 4, -6, 5,-10, 1, -5, 1, 0, 0, 0, 2, 7, -2, 2, -2, 0, - -4, 3, -4, 1,-12, 6,-49, 16,-10, 13, 0, -2, 8, 6, 1, 8 }, - { 5, -8, -7, 9, 13, -5, 7, 0, 10, 11, -4, -3, -1, 13,-14, 6, - -15, -6,-14, 16, 15, 1,-18, -4,-20, 20, -7, -1, -9, -2,-10, 10 }, - {-12, 4, 0, 10, 0, 3, 8, 4,-27, -1, -2, 19, -4, 2,-13, 3, - 1, 9,-12, 1,-22, 19, -5, 4, -9, 12, 2, -9, -8, 11, -3, 7 }, - { 4, -5, 11, -6, 17,-17, 5, -4, -2, -6, 1, -5, 2, 4,-14, 6, - -20, 19,-20, 12,-21, 5,-14, 13, -2, 11, 4, -3, 0,-10, -4, -2 }, - { -2, -1, -3, 8, -9, -7,-22, -3,-24, 13, -2, 10,-15, 5, -9, 4, - -7, 0, -5, 15, -8, 11,-13, 6, -4, 19, -8, 12, -4, 6, 9, 7 }, - { 2, -3, 2, -1, 0, 3, 1, 2, 1, -4, -2, -3, 1, 5,-12, 6, - -16, 14,-23, 10,-14, 17,-15, 16, -2, 9,-25, 9,-10, 16, 4, 9 }, - { -3, 7, -8, -3, 2, 2, -4, -8, -9, 10, 3,-11, 25,-10,-28, 27, - -9, 7,-13, 9, -2, 4,-12, -8,-14, 6, 7,-10, 3, 3, -3, 5 }, - { -8, -3, 1,-10, 8, -3, -9, -4, 13, 7, 2, 4,-10, 4, 3, 7, - -18, 2,-22, 15, 4, 20, -7, 5, -6, 13, -1, 4, -7, -6, 6, 13 }, - { -2, 3, 0, 2, -4, -2, 0, 0, 1, 2, -2, -5, 0, 1, -4, 0, - -2, -3, 1, 2, -1, 2, -8, -1,-24, 68, -3, 8, 3, 3, -1, -1 }, - {-15, -2, -9, -7, -1, 8,-14, 8, 3, 6, 0, -1, -8, 8,-23, 2, - -14, 17,-15, 8, -4, 7,-18, 0, -8, -3, -1, -4,-10, 4, -1, 4 }, - { 8, 0, 2, -7, 0, 5, 1, 3,-11, 4, -8, 14, 3, 20, 1, 26, - -11, 13,-13, 20, -2, 0, -8, 2, -6, 6, -1, 9, 3, -6, -3, 10 }, - { 5, 0, -1, -7, 10, 1, -3, 5, 4, 7, -5, -1, -3, -1, 12, -3, - -15, 7, -9, 22,-19, 8, -9, 4,-23, 13,-14, 6, -6,-14, -4, 7 }, - { 14, -5, -8,-10, 25, 3,-23, -7,-28, 0, -1, -9, 4, 1,-13, 20, - -8, 10,-16, 8, 12,-13,-21, 5,-13, 11, -2, 1, 12, -7, 2,-10 }, - { -5, -4, 9, 5, -6, 35, -7, 8, 15, 2, -1, -9, -6, 2,-18, 7, - -15, 6, -3, 2, 8, 12,-30, 7, -4, 20, 2, 6, 13, -6, -4, 0 }, - { 1, 8, -9, 9, -5, 12, -9, 16, -9, 16,-17, 14,-13, 15,-18, 14, - -15, 17,-12, 14,-13, 7,-16, 13, -9, 5,-11, 10, -9, 6,-12, 13 }, - {-10, -4, 5, 3, 1, 6, 8,-14, -5, 15, 7, 4, 8, 7,-22, 8, - -7, -8,-15, 26, 1, 13, -3, 17, -5, 9, -2, 4, -6, 3, -8, 9 }, - { 8, -3, 2, 3, 3, 1, -2, -1,-11, 8, -4, 0, -6, -5, -1, 13, - -37, 9, 1, -6,-10, -2,-10, 11, 8, 13, -3, -2, -6, 8, -4, 13 }, - { 3, 2, -3, -4, -4, 7, -8, 9, -8, 9,-20, 12,-19, 15,-18, 17, - -15, 7, -1, 20,-11, 6, -6, 3, 1, 9, 2,-14, -2, -2, 2, 1 }, - { -7, 1, -1, -3, -6, 4, 4, -3, 3, -1, 5, -4, 3, 2, -1, 9, - -59, 5, -4, 30, 3, 3, -2, -3, -1, 2, 2, 1, -1, -1, -2, 1 }, - { 0, -3, 2, 0, -1, -8, 0, 2, -3, 4, -4, 1, 10, 6, -6, 8, - -7, 4, 10, 11,-41, 27,-20, 3, -3, 8, 1, 11, -5, -8, 0, 4 }, - { 5, 1, 4, -2, 1, 2, -1, 6, -7, 2, 11, 4, 0, 0, -8, 7, - -10, 0, 0, 8, 2, 10, -1, 1, -2, 44, -2,-21,-12, -3, -1, 2 }, - { -4, 4, -2, -2, 6, -8, 2, 1,-10, 14, 8, 6, 5, 1, -2, 4, - -13, 4, 2, 5, 10, -2,-21, 32, -3, 18, 9, -6, -9, -9, 10, 2 }, - { 9,-16, -6, -2, 1, 4, 22, 2, -2, 1, -3, -2, -9, 3, 16, 19, - -24, -6, -6, -5, -8, -7, 8, -7, -1,-12, 5, -3, 0, 4, 2, -3 }, - { 10, 3,-16, -4, -1, 13, 4, 4, 1, -3, 1, -6,-14, 18, 3, 8, - -8,-28,-16, 4, 4, 2, 12, 7, 9, -4, -4, 5, -1, -1, 2, 2 }, - { -5,-13,-22, -3, -8, 21, -2, -9, 21, -4, -9, 5, -8, 15, 5, 1, - -5, -9, -7, -2, -5, -5, -1, -5, -5, -5, 3, 10, -4, 0, -7, -2 }, - { 5,-10,-18, 2, 20, 4, 13,-10, 8,-15,-11, -3, -1, 16, 10, 9, - -8, 6, 7, -5, 6, 11, 5, 17, -4, 7,-11, 5, -3, -6, 2, 1 }, - { 3, -5,-19, 1, 1, -3, -2,-25,-11,-17, 0,-13, -4, 10, 10, 2, - -5, 4, 0, 3, -3, -5,-10, -2, 13,-22, 0, 3,-11, -5, 7, -1 }, - { 12,-14,-29, 6, -1, 10, 7,-17,-12, 14, 3, 9, -9, 9, 7, 6, - -3,-13, 0, 5, 3, -1, -6, -1, 0, 2, 4,-12, -5, -1, 2, 11 }, - { 12,-15, -7, -2,-12, 17, 20,-16, -2,-12, -6, 15, -6, 12, 11, 9, - 7, -6, 7, -4,-19, 6, 2, 2, 3,-11,-10, -4, -5, -3, 3, 2 }, - { 11,-22, -6, 0, 8, 18, 3,-11, -4, -7,-15,-17,-12, 6, 16, 4, - -9, 4, -5, 3, 6,-16, 10, -7, -7, -3, 5, 0, 1,-15, -4, 5 }, - { 12,-22,-16, 5, -6, 8, 12, -4, -9,-17,-11, 3, 5, 8,-17, 0, - 11, -4,-13, -6, 2, -1, -1, 3, 3,-11,-12, -1, 1, 1, 12, -2 }, - { 8,-10,-33, -5, -3, -6, 1, -7, -8, -4, -6, -1, 5, -4, -6,-12, - -16, -8, 11, 8,-14, 7, 12, 11, 4,-14, -3, 6, -7, -5, -3, 3 }, - { 0, -8, -7, 2, -4, 24, 2, -9,-11, -3, -7, 11,-12, 17, 1, -1, - 3, -5, -7, 12, 4, 11, 0, 3, 2,-18, -3, 4, 7, -6, 3, 15 }, - { 10,-15,-16, -2, -4, -9, 7,-15, -6, 2,-16, 13, -8, 7, 19,-21, - -4,-12, -9, -3, -3, 6, 11, -3, -1,-19, 3, -7, -9, -4, 3, -6 }, - { -5,-10,-21, 0, -3, -7, 18,-21, 15, -5,-12, -4,-13, 2, 6, -9, - -9,-11, -4, 13, -3, 6, 4, -1, 7, -9, -4, 9, 5, 2, 6, 3 }, - { 15, -1,-27, -2, 10, 3, 7, -8, 9, -2, 7, 1, -2, -5, 18, 9, - -11,-17, -2, 7, -9, 11, 10, 0, -8, 6,-16, -3, 2, -7, 3, 11 }, - { 4, -9,-39, 19, 6,-13, 13, -5, -5,-15, -2, 9, 0, 4, 14, 6, - -10, -4, -5, 2, -4, -2, 5,-11, 3, 3, -2, -2, -7, 9, 7,-10 }, - { 5,-11, -8, 10, -2, 12, 16, 0, 12, -2, -6, 8, 14, 8, 7, 1, - 18,-30, 4, 10, -4, -6, 2,-11, 9,-10, -8, 5, 0, 0, -7, 6 }, - { -1,-16,-10, 11, 0, 13, 12, -4, -4, -5,-21, 12, 4, 13, 14, -7, - 6,-16,-13, 8, 2, 9, 15,-12, 1, -9,-22, 10, -9, 9, 9, -7 }, - { 4,-12,-27, 1, -2, 11, 15, 3, 14,-14, -9, 0, -9, 16, 22, 10, - 16,-10, 5, -5, -9, 1, 1, 6, 6, -4, 2,-17, -5, -6,-15, -1 }, - { 7,-12,-17, 1, -9, 5, 20, -7, 3, 23, -8, -8, -8, -1, 13, 17, - -7,-13, 4, -4, 7, 14, 8, 11, -3, -3, 4, 0, 4, 6, -1, -9 }, - { 7,-15,-15, -4, 10, 12, 3,-13, 6, 14, 9, -8,-15, 14, 23, -5, - -10, -5, 1, 15,-10, -7, 1, 9, 4,-13,-10, 10, 7, -3, 2, 3 }, - { 4,-10,-14, 0, 3, 4, 0, -9, -3, -4,-11, 2,-17, 8, 2, 15, - 6,-12,-12, 15, -5, 17, 18, 3, -3, -3, -4, -6, -8, 13, 4, 10 }, - { -2,-18,-26, 10, -4, 10, 13, 4, -4,-16, -7,-17, -3, 5, -4, 2, - -15,-10, -1, -8, -7, -3, 2, 2, 8,-10, -7, 2, 2, -4, 4, -1 }, - { 4,-19, -5, -1, -1, -6, 2, -8, 10,-16,-28, -6, 8, -1, 11, 28, - 2,-10, -4, 6, -6, 6, 11, 15, -4, -2, 7, 3, 7, -7, 4, 1 }, - { -3, -6,-10, -5, 13, 18, 10,-15, -5, -3,-13, 5, 1, 2, 18, -5, - -10,-10, -7, 4, 2, 1, 5, 4, 2, 5, 4, 8, -9,-17, 7, 7 }, - { 20,-12, -2, -4, 5, 14, 7,-11, -1,-16, -6, -4,-11, 17, 14, 0, - -8,-10, -8, 10, 3, 5, 10,-16, 3, -8,-14, 10, 3, 9, 0, 3 }, - { 12,-10,-36, 0, 7, 15, 2,-16, 2, -1, 0, -1, 5, 4, 5, -3, - 1,-10, 5, -1,-15, -3,-12, 12, 2, 5, -1, 5, 6, -3, -2, 2 }, - { 17,-15,-31, 23, -4, 15, -2, -3, 6, -7, -5, 1,-12, 4, 6, 8, - -10, 8, 3, 5, -4, 1, 5, 3, -1, -4, -3, 1, 10, -4, -2, -2 }, - { 6,-18, -5, 12, 10, 12, 14,-11, 15, 2, -9, -6, -5, -2, -9, 4, - -5,-28, -4, 14, 0,-16, 9, 14, -1, 3, -4, -4, 2, 1, 0, 4 }, - { -5,-14,-31, 8, 16, 7, 13,-13, 5, 6,-16, 10, -5, 2, -2, 2, - 14, -5, 8, -5, 7,-16, 6,-13, -5, 0, -5, 8, -3, -1, 4, 3 }, - { 1, -2, -1, 0, 6, 5, 2, -4, -3, -1, 0, 1, 4, 2, 43, 28, - -12,-35, -2, -2, -7, -1, 0, 2, -1, -2, -2, 1, -4, 0, -2, 3 }, - { 2, -9,-22, 12, 3, 3, -7, -4,-19,-22,-14, -4, -1, 21, 9, -3, - -15,-16,-13, 1,-11, 4, -9, 1, -7, -1, -1, 0, -2, 9,-13, -3 }, - { -1, -3,-23, 0, 2, 12, 3, -9, -4, 7, 3, 9,-10, 1, 27, 28, - 0, 9,-15, -2, -2, 1, 6, 8, -8, 7, -3, 20, 0, 0, -1, -6 }, - { -1, 11, 8, -2, 1, 5, -6, -1, 4, 2, -4, 0, -1, -5, 4, -6, - -10,-12, 19, 1, -7, 9, -8, -9,-16,-11, -2, 12, 14, 4, 4, 34 }, - { 17, 7, -6, 1, 4,-10, -5, 4,-11, 3,-18, 4, 14,-13, -3, 1, - 0, 0,-11, 0, 7,-17, -4, 4,-11, -6, -8, 18, 0, 0, 0, 26 }, - { -6, -7, -1, -1, 11, -8, 1, 3, 2, 11, -6, -6, 10, -3, 1, -3, - 7, 4,-12, -8, 0, -9, 8,-22, -5, 0, -6, 22, -2, 11,-13, 24 }, - { -3, 4, 0, 3, 9, 10, -1, 3, -9,-12, 1, -5, 18, 0, -3, 8, - 25, 15, -8, 2, 2, -2, 4, 8, 9, -1, -5, 10, -3, 1, -1, 23 }, - { -5, 2, -9, -1, -3, 0, 3, -1,-10, -4, 0,-13, 16, 9, -1,-14, - 2, 6, -2, -6, -5, -2, -7, 7, 5, 3, 11, -2,-14, 0, -9, 30 }, - { 4, 6, 6, 5, -3, -1, 4, 5, 10, 0, 5, -4, 7,-11, 14, 14, - 7, 34, -9, 0,-10, 22, -7, -1, 7, -9, 2, -8, 0, -7, -5, 29 }, - { -4, 3, -1, -4, -3, 5, 1, -4, 0, 2, 4, 2, 1, -1,-10, 1, - 6, -6, -4, 1, 4, -3, -3, -5, 0, 3, 7,-12, 0, -2,-10, 55 }, - { 5, 9, -1, 0, 4, 9,-21, -9, 4, 2, 6, -7, 11, -7, 1, -5, - 0, -4, 2, -3,-13, -8, 0, -9, -4, 2, 16, -2,-15, -7,-11, 31 }, - { 8, 2, -1, 0, 3, -5, -5, 5, 1, -1, -9, 1, 0, -6, -2, -1, - 5, 2, 0, 0, 12, 20,-19, 1, 8,-12,-11, 0, 6, -5, 2, 31 }, - { -1, -1, -2, 1, -1, 3, -9, -5, 8, -2, 5, -1, 0, -2, 4, -2, - -3,-12, 0, -2, 3, 0, 9, 4, -1, 21, -8, 3, -4, 9, -6, 30 }, - { -4, 0, -7, 17, 10,-12, -2,-10,-12, -3, 10, 0, 11, -4,-13, -3, - 5, 6, 10, 7, -8, 0, -7,-13, 1, 0, -2, 7,-12, 4, -3, 24 }, - {-13, 9, 4, -2, 2, -4,-14, -1, -3, -5,-10, 4, 13, -2, 5, 13, - 8, 3, -2, 1, 5, -6, 7,-18,-10, 1, -1, 5, 4, 1, 0, 25 }, - { -5, -1, 18, 12, 8, 8,-16, -1, 1, 1, 1, -4, -5, 3, 3, 4, - 4,-11,-12,-16, -6, 2, 12,-13, 0, 9, 7, 9, -9, 0,-10, 24 }, - { -4, 1, -3, 0, 2, -4, 4, 1, 5, 0, -3, 2, -3, -2, 2, -1, - 1, 4, -1, -2, -2, 1, -1, -1, -4, -1, -4, -2, -6, 6, 12, 69 }, - { 8, 5, 11, 0,-15, -4, 13, 6, 0, -4, 9, 1, -5, -3, 15, 0, - 1, 6, -5, 0, 1, 6, 5, 8, 0, 7, 1, -1, -4,-11, -9, 41 }, - { -4, -9, 32, -6, 0, 7, -4, 6, -6, 1, -6, -2, 4, -8, -5, -3, - -16, -1, -2, -6, 1, 15, 0, 21, 3, -3, -4, 3,-12, 16, 2, 27 }, - { -6, -5, 1, -9, -5, 3, 7, -3, 5, 5, 14, 13, 20, -7, -1, 12, - -1, 10,-11,-11, -7, -4,-14, 7,-14, 13, 22, 18, -1, 0, 14, 28 }, - { -8, 3, -2, 0, 5, 6, -1, -4, 1, 3, -7, 3, 1,-15, 4, -9, - 22,-10, -9, -4, 1, 8, -4, 9,-15, 2, -6, -4,-16, 12,-10, 23 }, - { 0, 0, 2, 0, -1, 3, -3, -1, 3, -5, 7, 1, 5, -5, -8, 1, - 13,-15, -5, -7, 12, -6, -2, 3, 10, -5, -8, 17, -5,-11,-14, 23 }, - { -7, -4, 6, -4, 5, -6, -5, 2, -4, 11, 9, -4, 2, -2, -4, 6, - 15, 3, -3, 18,-15, -2, -6, 3, 3,-20, 17, 11, -4, 2, 3, 29 }, - { 6, 1, -6, 2, 3, 0, 0, -3, 3, 3, -1, 3, -4, -6, -6, -7, - -3, -2, -7, -2, -4, 5, 3, -5,-20,-13, -4, 10,-14,-29, 14, 37 }, - { 3, 4, 3, -6, -4, 5, 0, 3, 2, 3, 0, -2, 4, 0, -3, -5, - -4, 4, -4, 4, 4, 3, 1, -4, -4, -9,-14, 20,-30, 3,-18, 33 }, - { 0, 2, 5, -2, -4, -2, -1, 2, -6, -3, -2, -2, 2, -5, -1, 4, - 3, 2, -3, 0, -1, -1,-10, -7, 2, -4,-18, 2,-37, -1, 12, 40 }, - { -7, 2, -1, 0, -2, 4, -8, 1, -4, 12, 7, 4, 15, -7, 1, -9, - 18, 0, 12,-17, -3, -1, 0, 0, 0, 2, -6, 0, -4, -3, -1, 26 }, - { -6, 4, 8, -5, -6, -2, 2, -1, 1, -1,-15, 8, 7, -1,-17, -4, - 1, 5, 6,-11, -6, 14, 17, -5,-15, 11, 8, 0, -3,-15, -6, 28 }, - { -1, 0, 0, 0, 1, 0, -1, 0, 1, 3, 2, -2, 3, -1, -1, 2, - 2, -1, -1, -7, 1, 2, -9, 0, -1, -4,-18, 7,-10, 49,-13, 32 }, - { -1, -3, 4, 1, 2, -5, 1, -7, -1, 5, -9, 4, 4, 25, 1, -1, - 2, -5, 2, -7, 17, -2, 10, -5, 0, 2,-15, 3, -9, 7, -9, 30 }, - { -5, -1, 0, 2, 1, -1, 2, 5,-33, 3, -5, 14, 11, 7, 5, -3, - 2, -8, -4, -2, -7, -6, 4, -8, -1, -8, 2, -2, -8, -1, -4, 27 }, - { -1, 0, -1, -2, 1, -1, -2, -1, 2, 0, 1, 2, 2, 4, 1, 3, - 4, 2, 1, -7, -4, 1, -3, -4,-35,-25, 17, 10, -3,-26, -7, 32 }, - { -5, 1, 6, -2, 6, 6, -9, 3, -1, -4, 5, -4, -2, -2, -9, 2, - -5, 2, 2, 4, 3, 5, -5,-16,-31,-12,-11, 2,-19, 20, -2, 21 }, - { -5, 2, 7, -7, -7, 5, -7, 2, 0, 0, -4, 3, -1, 0, -1, -2, - 0, -3, 5,-11, -8, -3, -7, -7, 28,-11, -7, 0,-16,-11, -4, 29 }, - { 2, 1, -3, -2, -1, 3, 4, 0, 1, 0, -1, -5, 4, -5,-12, 2, - -2, -5,-22, -2, -1, 11, 8, -7,-12, 0,-34, 6, -5, 11, -8, 19 }, - { -1, -3, 5, 11, 18, -2, -2, -5, -2, 4, -1, 8, 5, -6, 1, -1, - 2, 8, 4, -5, -8, -2, 5,-18, 7, 12, 7, 19,-18, 2, -6,-13 }, - { 9, 0, 0, 5, 4, 3, -6, 4, 1, -4, 5, -1, -4, 8, 8, 6, - -8, -6, 0, 6, -3, 3, 5, -3, 17, 31, 16, 10,-13, 0, -9,-19 }, - { 12,-10, 2, -2, -2, -1, -3, 6,-12, -5, -2, 14,-16, 4, 12, 12, - 17, 4, 7,-16, 7, -6, 11, 7, 7, 2,-25, 23,-24, 5, -7, -9 }, - { 10, 4, 13, 10, 10, 3, -6, 3, 3, 2, -1, -6, 8, 4, 10, 0, - 1, 2, -4, 2, -3, -8, 0, -1, 9, 9,-10, -3,-29, 1, -1,-27 }, - { 2, 2, 0, 7, 9, -2,-10, -1, -1, 1, -9, -5, 8, 4, 1, 2, - -10, 1, 13, 12, -3, 15, -9, 2, -7, 1,-10, 23,-20,-18, -9,-15 }, - { -3, -5, -1, 8, 0, -5, -1, 4, 7, -1, -7, 2, -8, -5, 11, 7, - -6, 3, -3, -9, 7, 9,-22, 1, 6, -4, 14, 27,-25,-14, 3, -5 }, - { 1, 3, 8, 4, 7, 6, 12,-17,-15, 1, -8,-10, 7,-14, -8, 6, - -2, -2,-11,-11, -7, 13, -2, -2, 4, 5, -5, 13,-23, -6,-17, -8 }, - { -5, 4,-14, -5, -4, -5, 6, 5, -8, -5, -2,-11, -7,-12, 3,-11, - 2, -6, 4,-10, -5, -7, 14, 5, 23, 11, 7, 12,-16, -6, -4,-16 }, - { 5, 6, 2, 5, -2, -5, -5, -6, -5,-19,-13, -1, -3,-13, 5, 0, - 6, -2, -2, -6, -7, -7, -1, -9, 4, 14, 17,-12,-27, 3, 0, -1 }, - { 7, -1, 9,-10, 8, 2, -7, -2, 5, 2, -3, -7, 3, 0, 6, 4, - 12, 5, 11, 14,-13, -1, 8, 1, 13, 9, 12, 12,-18,-14,-11,-16 }, - { -7, -5, -6, -5, 0, -1, -3, 2, 2, 1, 4, 9, 2, 3, 5, -2, - 2, 1, 8, 0, 3, 0, -2, 2, 1, 7, 29, 0,-36, -5, -9,-21 }, - { 14, -6, -9, 0, -1, -8, -8,-11, 2, 2, -9,-12, 12, -4, 5, 3, - -5, -9, 11, -1, -3, 12,-21, -3, 12, 5, 3, 11,-18,-15, 1, -2 }, - { -1, 3, -9, -3, 7, -7,-18, 2, 4, 12,-10, 2, 8, -3,-14, 13, - 17, -5, 5, -9, 13, -3, -7,-18, 17, -2, 5, 7,-20, -3, -6,-11 }, - { -3, 3, 3, -1, 1, -6, -5, 1, 5, -3,-14, -6, -5, -8, 14, -6, - 7, -1, 5, 1, 15, -1, -7, -4, 6,-11, 9, -2,-37, 16, -7, -3 }, - { -1, 0, 6, 1, -3, -9, 0, 11, -8, 2, -2, 0, 5, 2, 12,-10, - 10, 13, 2, 7, -6, 2,-10,-10, 21, -5, 5, 5,-12,-23, 3,-14 }, - { 6, 0, -2, 1, 0, 1, 0, -4, 1, 1, 8, -2, 2, -5, -2, 1, - 8, -4, -1, -1, 4, -1, 2, 6, 32, 1, -5,-20,-40, -4,-18,-14 }, - { 2, 2, -7, -2, 4, 4, -1, 2, 0, -2, -4, -7, 3, 5, 0, -5, - 1, 2, -6, 4, -1, -2, -1,-15, 8, 3, 9, 46, -7,-18, 6,-11 }, - { 5, 5, 16, 21, 3,-11, -4, 11,-12, 2, 4,-12, -1, 11, 8, 1, - -4, 11,-11,-21, 1, 1,-11, 3, 13, 1, 5, 12,-25, 1, -3, -2 }, - { 1, 6, -7, 4, 2, 3, 1, -5, 8, 9,-15, 3, -3,-14, 17, 4, - -8, 14, -2, -8, -4, 5, 8, -7, 8, 9, 7, 6,-29,-17, 8, 4 }, - { -7, -7, 4, 0, 13, 1, 0, 4, 4,-16,-10, -7, 5, 9,-15,-10, - -10, 8, -4, -1,-11, -1,-10,-15, 3, 3, 14, 10,-19, 2,-18,-12 }, - { -4, 0, 2, 0, 5, -2, -9, 0, 4, -4, 2, -1, -2, 2, -4, 9, - 2, -6, -4, -2, -1, -3, -3, -1, 2, 5, -1, 11,-24,-44, -9,-15 }, - { -1,-10, 6, 21, 11, 15, -7, 10,-14, -9, -8, -8, 4, 6, 19, 1, - -6, 1, -5,-17, -8,-10, 9, 5, 11, 18, -1, 10,-16, -7, -9, -8 }, - { 3, -5, 0, 0, -2, -2, -6, 4, -4, 1, -1, 0, 7, -3, 4, -4, - -7, 7, 17,-20, 6, 4, 1, -6,-12, 31, 13, 19,-14,-10, -7, -2 }, - { -2, 6,-10, 3, 9, 6,-14, 15, 2, -5, 2,-11, 9, -8, 4, 6, - 20,-15, -3, -3, -1, 32,-21, 6, 1, 9, 11, 17,-19, 6, -1, -3 }, - { 8, 10, -2, 0, -8,-16, 7, 7, 6, 10, 4,-14, 7, -6, 21, -7, - 10, 5, 5, 0, -7, 2, -6, 0, -7, 11, -9, 15,-20, -7,-11, 2 }, - { 0, -7, 5, 2, 0, -3, -6, -4, -2, -1, -4, -5,-13, -1, 27, -9, - -6,-11, -7, 1, 11, -4, -4,-14, -2, 11, 6, 10,-19, -6,-15, 2 }, - { 0, 7, -1, 2, -7,-15, -2, -3, 13, -5, -5, 12, 3, 0, 5, -5, - -22, 2, 7, 22, 13, 0, -1, 2, 3, 2, -7, 7,-27, -4, -4,-12 }, - { 11, 1,-16, 6,-15, 1, 3, 2, 0, 2, -3, 2, 5, -2, -5, 9, - 5, -3, 3, -2,-11, 3, 9, 6, 9, 3, -1, 12,-41, 8, -6, 9 }, - { 3, -7, 3, 2, 5, 5, 0, -1, 1, 3, -5, -2,-13, 7, -1, -2, - -2, -6, 4, -6, 0, 2, -2, 2, 4, 1, -4, 1,-47,-21, 7, -6 }, - { 3, 16, -7, 13, -4, -2, 10, -3, -1, 18,-13, 7,-13, -4, 8, 4, - 8, 9, -5, 13, 8, -5, 3, -6, 7, 18, -8, 10,-25, -3,-12,-12 }, - { 1, -1, -1, 0, 2, 5, -5, -3, 0, -5, -1, 0, -4, -8, -2, 3, - 2, -2,-17, -6, -4, 1, 33, -6,-20, -6, 8, 31,-26, -8, -1, -4 }, - { 3, -3, -3, 5, -3, -2, 1, 7, 0, 3, 6, 3, 6, -2, 9, 15, - -10, -3,-15, -5, -3, -4, -6,-30, 17, -8, -2, 2,-20, 0, -8, -2 }, - { -2, -1, -1, -1, 3, -5, -2, -3, 4, -2, 0, 5, 8, -3, 1, -4, - 1, 1, -3, 4, 4,-14, 3, 11, -5, 3, -3, 7, -3, 13, 23,-16 }, - { 2, -6, 1, -3, 5, 0, -6,-11, -7, -4, -1, 2, -7, -1, -1, 7, - 1, -2, 6, 12, -6, 8,-13, 17, 25,-23,-19, -7,-12, 9, 16,-17 }, - { 9, 4, 4, 4, -3, -1, 6, -2, -3, 0, 13, -4, -7, 14, 1, -7, - 0, -5, 3,-19, -3, 5, 3, 9, -1, 9,-13, 13,-17, 4, 21,-26 }, - { 0, -5, 0, 0, -4, -5, 2, -6, -4, 5, -7, 10, 0, 2, 0, -2, - -2, 0, 4, -6, 7, -2, 6, 5, -5, 2,-12, 1,-29, 29, 27, 12 }, - { 9,-10,-22, 6, -1, -1, 9,-14,-12, -2, 1, -1, 10,-11,-16, 0, - 3, 11, 13,-14, -9, -2, -1, 6, 4,-14, 0,-10, -2, 16, 17,-11 }, - { 2, 0, -1, -2, 4, 3, -6, -2, 1, -1, 1, 3, -4, 1, 3, -4, - -1, -1, 4, -1, 1, 0, 1, 6, -5, -7, 2, 1,-47, -3, 50,-17 }, - { 8, -4,-11, -7, 11, 11, 14, -7, 12, -7, 6, 2, 13, -6, -3, -2, - -14, 6, 6, 6, 0, 2, -1, 5,-20, 2, -1, 4, -5, 6, 21,-11 }, - { -2, -9, 3, 0, -6, 7, 8, -8, 1, -3, 4, 1, 5, -2, -3, -7, - 4, 7,-12, -9, -2, 10, -6, 13, 6, 5, 20, 2,-15, 9, 28, -7 }, - { 0, -5, -6, -6, -6, 1, -6, 6, -2, 4, 8, -3, 12, -1, -4, -2, - 6, 16,-14, 9,-14, -2, -8,-27, -3, 18, -1, -7, -3, 8, 23,-23 }, - { 1, 4, -9, -1, -5, 10, -2, 1,-11, 1, -9, 4, 7, 14, -9, -2, - -3, 2, -5, -1, -6,-10, -7, 11, 20, 2, 3,-19, 3, 15, 30, -9 }, - { 7, 2,-14, -4, 0, -2, 5, 2, 5, -2, 8, -3, -7, 6, 6,-11, - -14, 1, 10, -1, -7, -8, 1, 10, 3, -6,-15,-12,-17, 4, 30, -6 }, - { 4, 2, 1, -2, 3, 0, 1, 0, 2, 0, 1, 6, -7, 0, 3, 4, - 4, -4, -2, -5, -2, 2, -1, -2, 0, -2,-11, -7, -3, 42, 24,-14 }, - { 4, 1, 3, 2, 0, -2, -3, -2, 2, -1, 4, 11, -2, 2, 3, -4, - -5, 9, 2, -4, -9, 5, 8, -1, -7, 1, 24,-13,-28, 20, 15,-22 }, - { -3, 7, 6, 3, -2, -5,-10, -2, -2, -1, -6, -6, -2,-14,-16, -6, - -5, 0, 18, 0, 9, 1, 7,-13, -5, -6, -9, 11,-15, 9, 22,-11 }, - { 9, -2, 6, 5, 2, 9,-10, 1, 1, 5, -4, 12, 2, 2,-10, -7, - -4, -6, 7, 9, 6, 15, 6, 6,-10, 10, 5,-13, -5, 6, 24,-12 }, - { 1, 3, -3, -3, 8, 1, -6, 2, -5, -3, 7, 2, 14, 6, 9, -6, - -5, -4, 27, 7, -3, 8, -6, 3, -8, 8, 22, -5, -6, -2, 22,-17 }, - { -2, -2, 3, 10, 9, 9, 12,-15, -1,-11,-13, 3, -2, 1, -3,-11, - 7, 9, 16, -3,-10, -5, -5, 1, 8, -3, 9, 9, -5, 3, 31,-12 }, - { 7, -5, 10, -4, -8, 2, 16, -2, 10, 10, -3, -2, 3, -8, -3, 3, - -13, -6, 15, 20, -9, -3,-12, 1, -2,-16, 8, 8, -1, 16, 22, -5 }, - { 5, -3,-15, -2, 12, -8, 8, -5, 2, -8, 20,-18, 14, -4, 3, 3, - 7,-13,-16, 1,-10, 7, 16, 7, 4,-14, -4, -5, -9, 8, 23, -6 }, - { 5, -4, -5, -4, 1, 8, 4, -7, -5, 8, 10, 6, -6,-10, -2, 6, - 9,-17,-14, 11, 12, -3,-13, -7, 2, 18, 3,-25,-16, 18, 22, -5 }, - { 5, 6, -7,-20, -4, 2, 8, 4,-24, -4, 1, 4, -5, -2, 1,-10, - -2, 9, 3, -4, -3, -4, -4, -4, 10, 10, 3, 0, -6, 25, 21,-11 }, - { 0, 7, -1, 14, -6, -4,-10, 5, 4, 4, 4, -5, 3, 4, -1, -7, - 8,-19, 0, 6, 2, 3,-18, -3, -6, 2, 8, 14,-26, 22, 27,-13 }, - { -2, -6, 7, -5, 12, -7, 8, -1, 3, -2, 4, 1, 8, -2, 0, 14, - 6, -5, 6, -4, -7, 7,-21, 8, 1, 8, -9, -4, -3, 11, 25,-13 }, - { 4, 4, -1, -6, 4, 9, -8, 1, -3,-10, -2, 0, 15, -9,-16, 11, - 1, 1, 6, 3, -9, -5, 16, 26, 1,-14, 1, -3,-14, 7, 15, -9 }, - {-12, -2, -9,-13, 2, 6, 14, 0, 1, 0, -1,-13, 0, 10, -1, 6, - 9, -7, 8, 8, 19, 6, -1, 9, 10, -4, 1, -7,-22, -2, 29, -7 }, - { 2, 4, 13,-12, -8, -4, -5, 13, 12, -5, -3, -3, -4, 1, -1, 10, - 15, -6, -1,-11,-30, 4, 15, -1, 9, -7, 0, -2, -7, 10, 25,-16 }, - { 7,-15, -7, -7, -1, -5, -5,-11,-20, 10, 3,-10, -3, 5, 20, -4, - 0, -2, -2, 17, 2, 0, -3, 3, 6, 5, -1,-12, -3, 15, 22,-16 }, - { 4, -1, 3, 4, -5, 0, -1, -5,-24,-29, 4, -9, 1, -3, 0, 0, - 0, -4, 7, -4, -4, -4, 3, 1, -6, 5, -3, -5,-10, 3, 25,-10 }, - { -2, -1, -1, 4, 4, -1, 2, 0, -4, -4, 2, -1, -3, -1, -2, -2, - 1, -3, -5, -1, 2, -3, -4, -4, -3, 5, -9, 1,-11, 7, 46,-46 }, - { 0, -9, 3, 4, 4, 3, -5, -6, 5, -4, 4, -2, 1, 7, -4,-10, - 13, 1, 3, -6, 4, -4, 7, 2,-19,-25, -3,-16,-12, 16, 20, -1 }, - { 18, 6, 4,-12, 0,-14, 9, -6, -1, -4, -5, 2, 1, 12, 4, 2, - 7, 0, 2, 5,-11, -5, -2, 2, -4, 10, 0, -9, -7, 9, 25, -8 }, - { 5, 0, -6, 5, 6, 3, 3,-10, -5, 1, -1, 4, 3,-11, -8, 5, - 4, -5, 5, -5, -7, -5, 11, 5, 20, -8,-16, 21, -4, 27, 23, -5 } -}; - - -/* FIR filter coefficients, they can be cut on half and maybe use float instead of double*/ - -DECLARE_ALIGNED(16, static const float, fir_32bands_perfect)[] = -{ -+1.135985195E-010, -+7.018770981E-011, --1.608403011E-008, --5.083275667E-008, --1.543309907E-007, --3.961981463E-007, --7.342250683E-007, --3.970030775E-007, --4.741137047E-007, --6.022448247E-007, --6.628192182E-007, --6.982898526E-007, --7.020648809E-007, --6.767839409E-007, --6.262345096E-007, --5.564140224E-007, -+7.003467317E-007, -+8.419976893E-007, -+9.742954035E-007, -+1.085227950E-006, -+1.162929266E-006, -+1.194632091E-006, -+1.179182050E-006, -+1.033426656E-006, -+9.451737242E-007, -+1.975324267E-006, -+1.190443072E-006, -+5.234479659E-007, -+2.014677420E-007, -+7.834767501E-008, --6.702406963E-010, --1.613285505E-009, --2.682709610E-009, --3.399493131E-009, -+1.314406006E-008, -+7.506701927E-009, -+2.788728892E-008, -+1.444918922E-007, -+3.132386439E-007, -+1.399798180E-006, -+2.032118118E-006, -+2.715013807E-006, -+3.453840463E-006, -+4.195037945E-006, -+4.896494374E-006, -+5.516381407E-006, -+6.015239251E-006, -+6.361419310E-006, -+8.006985809E-006, -+8.087732567E-006, -+7.941360309E-006, -+7.568834008E-006, -+6.986399967E-006, -+6.225028756E-006, -+5.315936960E-006, -+4.429412002E-006, -+3.332600045E-006, -+8.427224429E-007, -+4.341498823E-007, -+9.458596395E-008, -+2.975164826E-008, -+6.402664354E-008, --3.246264413E-008, --3.809887872E-008, -+8.434094667E-008, -+6.437721822E-008, -+1.189317118E-006, -+2.497214155E-006, -+3.617151151E-006, -+3.157242645E-006, -+2.319611212E-006, -+7.869333785E-006, -+9.826449968E-006, -+1.177108606E-005, -+1.379448349E-005, -+1.571428584E-005, -+1.743183020E-005, -+1.884208177E-005, -+1.987093310E-005, -+2.042970118E-005, --3.144468428E-005, --3.334947178E-005, --3.460439257E-005, --3.515914432E-005, --3.495384954E-005, --3.397853652E-005, --3.225446198E-005, --2.978993689E-005, --2.677291741E-005, --1.806914770E-005, --1.776598037E-005, --1.661818715E-005, --1.207003334E-005, --6.993315310E-006, --5.633860383E-007, --9.984935332E-007, --1.470520488E-006, --1.853591357E-006, -+7.198007665E-007, -+3.086857760E-006, -+6.084746474E-006, -+9.561075785E-006, -+1.309637537E-005, -+2.263354872E-005, -+2.847247197E-005, -+3.415624451E-005, -+3.946387005E-005, -+4.425736552E-005, -+4.839275425E-005, -+5.176846025E-005, -+5.429694284E-005, -+5.595519906E-005, -+4.916387297E-006, -+9.299508747E-006, -+1.356193479E-005, -+1.751866148E-005, -+2.093936746E-005, -+2.362549276E-005, -+2.537086584E-005, -+2.618136386E-005, -+2.554462844E-005, -+3.018750249E-005, -+2.570833203E-005, -+1.985177369E-005, -+1.191342653E-005, -+2.525620175E-006, --1.521241393E-005, --1.617751332E-005, -+1.992636317E-005, -+1.774702469E-005, -+4.624524081E-005, -+5.610509834E-005, -+6.568001118E-005, -+7.513730816E-005, -+8.413690375E-005, -+8.757545584E-005, -+9.517164290E-005, -+1.020687996E-004, -+1.084438481E-004, -+1.140582463E-004, -+1.187910311E-004, -+1.224978914E-004, -+1.250260248E-004, -+1.262027217E-004, -+1.226499153E-004, -+1.213575742E-004, -+1.180980107E-004, -+1.126275165E-004, -+1.047207043E-004, -+9.417100227E-005, -+8.078388782E-005, -+6.447290798E-005, -+4.491530854E-005, -+2.470704203E-005, --1.714242217E-006, --3.193307566E-005, --6.541742187E-005, --1.024175072E-004, --1.312203676E-004, --1.774113771E-004, --2.233728592E-004, --2.682086197E-004, --3.347633174E-004, --3.906481725E-004, --4.490280990E-004, --5.099929986E-004, --5.729619297E-004, --6.358824321E-004, --7.021900383E-004, --7.698345580E-004, --8.385353722E-004, --9.078957955E-004, --9.775133803E-004, --1.046945457E-003, --1.115717343E-003, --1.183370827E-003, --1.252829796E-003, --1.316190348E-003, --1.376571832E-003, --1.433344092E-003, --1.485876855E-003, --1.533520175E-003, --1.575609902E-003, --1.611457788E-003, --1.640390139E-003, --1.661288203E-003, --1.674512983E-003, --1.678415807E-003, --1.672798418E-003, --1.656501088E-003, --1.633993932E-003, --1.593449386E-003, -+1.542080659E-003, -+1.479332102E-003, -+1.395521569E-003, -+1.303116791E-003, -+1.196175464E-003, -+1.073757303E-003, -+9.358961834E-004, -+7.817269652E-004, -+6.114174030E-004, -+4.244441516E-004, -+2.206075296E-004, --2.719412748E-007, --2.382978710E-004, --4.935106263E-004, --7.658848190E-004, --1.055365428E-003, --1.361547387E-003, --1.684492454E-003, --2.023874084E-003, --2.379294252E-003, --2.750317100E-003, --3.136433195E-003, --3.537061159E-003, --3.951539751E-003, --4.379155114E-003, --4.819062538E-003, --5.270531867E-003, --5.732392892E-003, --6.203945260E-003, --6.683901884E-003, --7.170005701E-003, --7.664063945E-003, --8.162760176E-003, --8.665001951E-003, --9.170533158E-003, --9.676489048E-003, --1.018219907E-002, --1.068630442E-002, --1.118756086E-002, --1.168460958E-002, --1.217562053E-002, --1.265939046E-002, --1.313448418E-002, --1.359948888E-002, --1.405300573E-002, --1.449365262E-002, --1.492007636E-002, --1.533095632E-002, --1.572482102E-002, --1.610082202E-002, --1.645756140E-002, --1.679391414E-002, --1.710879989E-002, --1.740120351E-002, --1.767017506E-002, --1.791484281E-002, --1.813439466E-002, --1.832821220E-002, --1.849545911E-002, --1.863567345E-002, --1.874836907E-002, --1.883326657E-002, --1.889026538E-002, --1.891860925E-002, -+1.891860925E-002, -+1.889026538E-002, -+1.883326657E-002, -+1.874836907E-002, -+1.863567345E-002, -+1.849545911E-002, -+1.832821220E-002, -+1.813439466E-002, -+1.791484281E-002, -+1.767017506E-002, -+1.740120351E-002, -+1.710879989E-002, -+1.679391414E-002, -+1.645756140E-002, -+1.610082202E-002, -+1.572482102E-002, -+1.533095632E-002, -+1.492007636E-002, -+1.449365262E-002, -+1.405300573E-002, -+1.359948888E-002, -+1.313448418E-002, -+1.265939046E-002, -+1.217562053E-002, -+1.168460958E-002, -+1.118756086E-002, -+1.068630442E-002, -+1.018219907E-002, -+9.676489048E-003, -+9.170533158E-003, -+8.665001951E-003, -+8.162760176E-003, -+7.664063945E-003, -+7.170005701E-003, -+6.683901884E-003, -+6.203945260E-003, -+5.732392892E-003, -+5.270531867E-003, -+4.819062538E-003, -+4.379155114E-003, -+3.951539751E-003, -+3.537061159E-003, -+3.136433195E-003, -+2.750317100E-003, -+2.379294252E-003, -+2.023874084E-003, -+1.684492454E-003, -+1.361547387E-003, -+1.055365428E-003, -+7.658848190E-004, -+4.935106263E-004, -+2.382978710E-004, -+2.719412748E-007, --2.206075296E-004, --4.244441516E-004, --6.114174030E-004, --7.817269652E-004, --9.358961834E-004, --1.073757303E-003, --1.196175464E-003, --1.303116791E-003, --1.395521569E-003, --1.479332102E-003, --1.542080659E-003, -+1.593449386E-003, -+1.633993932E-003, -+1.656501088E-003, -+1.672798418E-003, -+1.678415807E-003, -+1.674512983E-003, -+1.661288203E-003, -+1.640390139E-003, -+1.611457788E-003, -+1.575609902E-003, -+1.533520175E-003, -+1.485876855E-003, -+1.433344092E-003, -+1.376571832E-003, -+1.316190348E-003, -+1.252829796E-003, -+1.183370827E-003, -+1.115717343E-003, -+1.046945457E-003, -+9.775133803E-004, -+9.078957955E-004, -+8.385353722E-004, -+7.698345580E-004, -+7.021900383E-004, -+6.358824321E-004, -+5.729619297E-004, -+5.099929986E-004, -+4.490280990E-004, -+3.906481725E-004, -+3.347633174E-004, -+2.682086197E-004, -+2.233728592E-004, -+1.774113771E-004, -+1.312203676E-004, -+1.024175072E-004, -+6.541742187E-005, -+3.193307566E-005, -+1.714242217E-006, --2.470704203E-005, --4.491530854E-005, --6.447290798E-005, --8.078388782E-005, --9.417100227E-005, --1.047207043E-004, --1.126275165E-004, --1.180980107E-004, --1.213575742E-004, --1.226499153E-004, --1.262027217E-004, --1.250260248E-004, --1.224978914E-004, --1.187910311E-004, --1.140582463E-004, --1.084438481E-004, --1.020687996E-004, --9.517164290E-005, --8.757545584E-005, --8.413690375E-005, --7.513730816E-005, --6.568001118E-005, --5.610509834E-005, --4.624524081E-005, --1.774702469E-005, --1.992636317E-005, -+1.617751332E-005, -+1.521241393E-005, --2.525620175E-006, --1.191342653E-005, --1.985177369E-005, --2.570833203E-005, --3.018750249E-005, --2.554462844E-005, --2.618136386E-005, --2.537086584E-005, --2.362549276E-005, --2.093936746E-005, --1.751866148E-005, --1.356193479E-005, --9.299508747E-006, --4.916387297E-006, --5.595519906E-005, --5.429694284E-005, --5.176846025E-005, --4.839275425E-005, --4.425736552E-005, --3.946387005E-005, --3.415624451E-005, --2.847247197E-005, --2.263354872E-005, --1.309637537E-005, --9.561075785E-006, --6.084746474E-006, --3.086857760E-006, --7.198007665E-007, -+1.853591357E-006, -+1.470520488E-006, -+9.984935332E-007, -+5.633860383E-007, -+6.993315310E-006, -+1.207003334E-005, -+1.661818715E-005, -+1.776598037E-005, -+1.806914770E-005, -+2.677291741E-005, -+2.978993689E-005, -+3.225446198E-005, -+3.397853652E-005, -+3.495384954E-005, -+3.515914432E-005, -+3.460439257E-005, -+3.334947178E-005, -+3.144468428E-005, --2.042970118E-005, --1.987093310E-005, --1.884208177E-005, --1.743183020E-005, --1.571428584E-005, --1.379448349E-005, --1.177108606E-005, --9.826449968E-006, --7.869333785E-006, --2.319611212E-006, --3.157242645E-006, --3.617151151E-006, --2.497214155E-006, --1.189317118E-006, --6.437721822E-008, --8.434094667E-008, -+3.809887872E-008, -+3.246264413E-008, --6.402664354E-008, --2.975164826E-008, --9.458596395E-008, --4.341498823E-007, --8.427224429E-007, --3.332600045E-006, --4.429412002E-006, --5.315936960E-006, --6.225028756E-006, --6.986399967E-006, --7.568834008E-006, --7.941360309E-006, --8.087732567E-006, --8.006985809E-006, --6.361419310E-006, --6.015239251E-006, --5.516381407E-006, --4.896494374E-006, --4.195037945E-006, --3.453840463E-006, --2.715013807E-006, --2.032118118E-006, --1.399798180E-006, --3.132386439E-007, --1.444918922E-007, --2.788728892E-008, --7.506701927E-009, --1.314406006E-008, -+3.399493131E-009, -+2.682709610E-009, -+1.613285505E-009, -+6.702406963E-010, --7.834767501E-008, --2.014677420E-007, --5.234479659E-007, --1.190443072E-006, --1.975324267E-006, --9.451737242E-007, --1.033426656E-006, --1.179182050E-006, --1.194632091E-006, --1.162929266E-006, --1.085227950E-006, --9.742954035E-007, --8.419976893E-007, --7.003467317E-007, -+5.564140224E-007, -+6.262345096E-007, -+6.767839409E-007, -+7.020648809E-007, -+6.982898526E-007, -+6.628192182E-007, -+6.022448247E-007, -+4.741137047E-007, -+3.970030775E-007, -+7.342250683E-007, -+3.961981463E-007, -+1.543309907E-007, -+5.083275667E-008, -+1.608403011E-008, --7.018770981E-011, --1.135985195E-010 -}; - -DECLARE_ALIGNED(16, static const float, fir_32bands_nonperfect)[] = -{ --1.390191784E-007, --1.693738625E-007, --2.030677564E-007, --2.404238444E-007, --2.818143514E-007, --3.276689142E-007, --3.784752209E-007, --4.347855338E-007, --4.972276315E-007, --5.665120852E-007, --6.434325428E-007, --7.288739425E-007, --8.238164355E-007, --9.293416952E-007, --1.046637067E-006, --1.176999604E-006, --1.321840614E-006, --1.482681114E-006, --1.661159786E-006, --1.859034001E-006, --2.078171747E-006, --2.320550948E-006, --2.588257530E-006, --2.883470643E-006, --3.208459020E-006, --3.565570978E-006, --3.957220997E-006, --4.385879038E-006, --4.854050530E-006, --5.364252502E-006, --5.918994248E-006, --6.520755960E-006, --7.171964626E-006, --7.874960829E-006, --8.631964192E-006, --9.445050637E-006, --1.031611009E-005, --1.124680875E-005, --1.223855270E-005, --1.329243969E-005, --1.440921824E-005, --1.558924305E-005, --1.683242772E-005, --1.813820381E-005, --1.950545993E-005, --2.093250441E-005, --2.241701623E-005, --2.395598858E-005, --2.554569073E-005, --2.718161704E-005, --2.885844333E-005, --3.056998685E-005, --3.230916263E-005, --3.406793985E-005, --3.583733633E-005, --3.760734762E-005, --3.936696885E-005, --4.110412556E-005, --4.280570283E-005, --4.445751256E-005, --4.604430433E-005, --4.754976908E-005, --4.895655002E-005, --5.024627535E-005, -+5.139957648E-005, -+5.239612074E-005, -+5.321469871E-005, -+5.383323878E-005, -+5.422891263E-005, -+5.437819709E-005, -+5.425697600E-005, -+5.384063843E-005, -+5.310418419E-005, -+5.202236207E-005, -+5.056979353E-005, -+4.872112549E-005, -+4.645117951E-005, -+4.373511547E-005, -+4.054862075E-005, -+3.686808850E-005, -+3.267079956E-005, -+2.793515523E-005, -+2.264085742E-005, -+1.676913780E-005, -+1.030297699E-005, -+3.227306706E-006, --4.470633485E-006, --1.280130618E-005, --2.177240640E-005, --3.138873581E-005, --4.165195787E-005, --5.256036457E-005, --6.410864444E-005, --7.628766616E-005, --8.908427117E-005, --1.024810626E-004, --1.164562127E-004, --1.309833024E-004, --1.460311323E-004, --1.615635992E-004, --1.775395358E-004, --1.939126523E-004, --2.106313768E-004, --2.276388550E-004, --2.448728774E-004, --2.622658503E-004, --2.797449124E-004, --2.972317743E-004, --3.146430245E-004, --3.318900708E-004, --3.488793736E-004, --3.655125911E-004, --3.816867538E-004, --3.972945851E-004, --4.122247046E-004, --4.263620067E-004, --4.395879805E-004, --4.517810594E-004, --4.628172028E-004, --4.725702747E-004, --4.809123348E-004, --4.877146275E-004, --4.928477574E-004, --4.961824161E-004, --4.975944757E-004, --4.969481961E-004, --4.941228544E-004, --4.889960401E-004, -+4.814492422E-004, -+4.713678791E-004, -+4.586426076E-004, -+4.431701091E-004, -+4.248536134E-004, -+4.036037717E-004, -+3.793396754E-004, -+3.519894381E-004, -+3.214911267E-004, -+2.877934603E-004, -+2.508567995E-004, -+2.106537577E-004, -+1.671699720E-004, -+1.204049113E-004, -+7.037253090E-005, -+1.710198012E-005, --3.936182839E-005, --9.895755647E-005, --1.616069785E-004, --2.272142592E-004, --2.956659591E-004, --3.668301215E-004, --4.405563814E-004, --5.166754709E-004, --5.949990009E-004, --6.753197522E-004, --7.574109477E-004, --8.410271257E-004, --9.259034996E-004, --1.011756598E-003, --1.098284614E-003, --1.185167348E-003, --1.272067428E-003, --1.358630019E-003, --1.444484224E-003, --1.529243193E-003, --1.612505526E-003, --1.693855622E-003, --1.772865304E-003, --1.849094522E-003, --1.922092517E-003, --1.991399564E-003, --2.056547208E-003, --2.117061289E-003, --2.172462177E-003, --2.222266514E-003, --2.265989315E-003, --2.303145360E-003, --2.333251061E-003, --2.355825622E-003, --2.370394068E-003, --2.376487479E-003, --2.373647178E-003, --2.361423569E-003, --2.339380793E-003, --2.307097195E-003, --2.264167881E-003, --2.210205887E-003, --2.144844970E-003, --2.067740774E-003, --1.978572691E-003, --1.877046190E-003, --1.762894331E-003, --1.635878929E-003, -+1.495792647E-003, -+1.342460280E-003, -+1.175740734E-003, -+9.955273708E-004, -+8.017504588E-004, -+5.943773431E-004, -+3.734139318E-004, -+1.389056415E-004, --1.090620208E-004, --3.703625989E-004, --6.448282511E-004, --9.322494152E-004, --1.232374110E-003, --1.544908970E-003, --1.869517611E-003, --2.205822384E-003, --2.553403843E-003, --2.911801683E-003, --3.280514618E-003, --3.659002949E-003, --4.046686925E-003, --4.442950245E-003, --4.847140983E-003, --5.258570891E-003, --5.676518660E-003, --6.100233644E-003, --6.528933067E-003, --6.961807609E-003, --7.398022339E-003, --7.836719044E-003, --8.277016692E-003, --8.718019351E-003, --9.158811532E-003, --9.598465636E-003, --1.003604382E-002, --1.047059800E-002, --1.090117730E-002, --1.132682897E-002, --1.174659748E-002, --1.215953380E-002, --1.256469358E-002, --1.296114177E-002, --1.334795821E-002, --1.372423489E-002, --1.408908330E-002, --1.444163360E-002, --1.478104480E-002, --1.510649733E-002, --1.541720331E-002, --1.571240649E-002, --1.599138230E-002, --1.625344716E-002, --1.649795473E-002, --1.672429405E-002, --1.693190821E-002, --1.712027565E-002, --1.728892699E-002, --1.743743755E-002, --1.756543480E-002, --1.767260395E-002, --1.775865816E-002, --1.782339066E-002, --1.786663756E-002, --1.788828894E-002, -+1.788828894E-002, -+1.786663756E-002, -+1.782339066E-002, -+1.775865816E-002, -+1.767260395E-002, -+1.756543480E-002, -+1.743743755E-002, -+1.728892699E-002, -+1.712027565E-002, -+1.693190821E-002, -+1.672429405E-002, -+1.649795473E-002, -+1.625344716E-002, -+1.599138230E-002, -+1.571240649E-002, -+1.541720331E-002, -+1.510649733E-002, -+1.478104480E-002, -+1.444163360E-002, -+1.408908330E-002, -+1.372423489E-002, -+1.334795821E-002, -+1.296114177E-002, -+1.256469358E-002, -+1.215953380E-002, -+1.174659748E-002, -+1.132682897E-002, -+1.090117730E-002, -+1.047059800E-002, -+1.003604382E-002, -+9.598465636E-003, -+9.158811532E-003, -+8.718019351E-003, -+8.277016692E-003, -+7.836719044E-003, -+7.398022339E-003, -+6.961807609E-003, -+6.528933067E-003, -+6.100233644E-003, -+5.676518660E-003, -+5.258570891E-003, -+4.847140983E-003, -+4.442950245E-003, -+4.046686925E-003, -+3.659002949E-003, -+3.280514618E-003, -+2.911801683E-003, -+2.553403843E-003, -+2.205822384E-003, -+1.869517611E-003, -+1.544908970E-003, -+1.232374110E-003, -+9.322494152E-004, -+6.448282511E-004, -+3.703625989E-004, -+1.090620208E-004, --1.389056415E-004, --3.734139318E-004, --5.943773431E-004, --8.017504588E-004, --9.955273708E-004, --1.175740734E-003, --1.342460280E-003, --1.495792647E-003, -+1.635878929E-003, -+1.762894331E-003, -+1.877046190E-003, -+1.978572691E-003, -+2.067740774E-003, -+2.144844970E-003, -+2.210205887E-003, -+2.264167881E-003, -+2.307097195E-003, -+2.339380793E-003, -+2.361423569E-003, -+2.373647178E-003, -+2.376487479E-003, -+2.370394068E-003, -+2.355825622E-003, -+2.333251061E-003, -+2.303145360E-003, -+2.265989315E-003, -+2.222266514E-003, -+2.172462177E-003, -+2.117061289E-003, -+2.056547208E-003, -+1.991399564E-003, -+1.922092517E-003, -+1.849094522E-003, -+1.772865304E-003, -+1.693855622E-003, -+1.612505526E-003, -+1.529243193E-003, -+1.444484224E-003, -+1.358630019E-003, -+1.272067428E-003, -+1.185167348E-003, -+1.098284614E-003, -+1.011756598E-003, -+9.259034996E-004, -+8.410271257E-004, -+7.574109477E-004, -+6.753197522E-004, -+5.949990009E-004, -+5.166754709E-004, -+4.405563814E-004, -+3.668301215E-004, -+2.956659591E-004, -+2.272142592E-004, -+1.616069785E-004, -+9.895755647E-005, -+3.936182839E-005, --1.710198012E-005, --7.037253090E-005, --1.204049113E-004, --1.671699720E-004, --2.106537577E-004, --2.508567995E-004, --2.877934603E-004, --3.214911267E-004, --3.519894381E-004, --3.793396754E-004, --4.036037717E-004, --4.248536134E-004, --4.431701091E-004, --4.586426076E-004, --4.713678791E-004, --4.814492422E-004, -+4.889960401E-004, -+4.941228544E-004, -+4.969481961E-004, -+4.975944757E-004, -+4.961824161E-004, -+4.928477574E-004, -+4.877146275E-004, -+4.809123348E-004, -+4.725702747E-004, -+4.628172028E-004, -+4.517810594E-004, -+4.395879805E-004, -+4.263620067E-004, -+4.122247046E-004, -+3.972945851E-004, -+3.816867538E-004, -+3.655125911E-004, -+3.488793736E-004, -+3.318900708E-004, -+3.146430245E-004, -+2.972317743E-004, -+2.797449124E-004, -+2.622658503E-004, -+2.448728774E-004, -+2.276388550E-004, -+2.106313768E-004, -+1.939126523E-004, -+1.775395358E-004, -+1.615635992E-004, -+1.460311323E-004, -+1.309833024E-004, -+1.164562127E-004, -+1.024810626E-004, -+8.908427117E-005, -+7.628766616E-005, -+6.410864444E-005, -+5.256036457E-005, -+4.165195787E-005, -+3.138873581E-005, -+2.177240640E-005, -+1.280130618E-005, -+4.470633485E-006, --3.227306706E-006, --1.030297699E-005, --1.676913780E-005, --2.264085742E-005, --2.793515523E-005, --3.267079956E-005, --3.686808850E-005, --4.054862075E-005, --4.373511547E-005, --4.645117951E-005, --4.872112549E-005, --5.056979353E-005, --5.202236207E-005, --5.310418419E-005, --5.384063843E-005, --5.425697600E-005, --5.437819709E-005, --5.422891263E-005, --5.383323878E-005, --5.321469871E-005, --5.239612074E-005, --5.139957648E-005, -+5.024627535E-005, -+4.895655002E-005, -+4.754976908E-005, -+4.604430433E-005, -+4.445751256E-005, -+4.280570283E-005, -+4.110412556E-005, -+3.936696885E-005, -+3.760734762E-005, -+3.583733633E-005, -+3.406793985E-005, -+3.230916263E-005, -+3.056998685E-005, -+2.885844333E-005, -+2.718161704E-005, -+2.554569073E-005, -+2.395598858E-005, -+2.241701623E-005, -+2.093250441E-005, -+1.950545993E-005, -+1.813820381E-005, -+1.683242772E-005, -+1.558924305E-005, -+1.440921824E-005, -+1.329243969E-005, -+1.223855270E-005, -+1.124680875E-005, -+1.031611009E-005, -+9.445050637E-006, -+8.631964192E-006, -+7.874960829E-006, -+7.171964626E-006, -+6.520755960E-006, -+5.918994248E-006, -+5.364252502E-006, -+4.854050530E-006, -+4.385879038E-006, -+3.957220997E-006, -+3.565570978E-006, -+3.208459020E-006, -+2.883470643E-006, -+2.588257530E-006, -+2.320550948E-006, -+2.078171747E-006, -+1.859034001E-006, -+1.661159786E-006, -+1.482681114E-006, -+1.321840614E-006, -+1.176999604E-006, -+1.046637067E-006, -+9.293416952E-007, -+8.238164355E-007, -+7.288739425E-007, -+6.434325428E-007, -+5.665120852E-007, -+4.972276315E-007, -+4.347855338E-007, -+3.784752209E-007, -+3.276689142E-007, -+2.818143514E-007, -+2.404238444E-007, -+2.030677564E-007, -+1.693738625E-007, -+1.390191784E-007 -}; - -/* pre-scale lfe fir coefficients */ -#define SCALE(c) ((c) / (256.0f * 32768.0f)) -DECLARE_ALIGNED(16, static const float, lfe_fir_64)[] = -{ - SCALE(2.658434386830777e-4), SCALE(9.029330685734748e-3), - SCALE(7.939263433218002e-2), SCALE(2.425158768892288e-1), - SCALE(3.430179357528686e-1), SCALE(2.398228943347931e-1), - SCALE(7.746443897485733e-2), SCALE(8.622321300208569e-3), - SCALE(8.179365249816328e-5), SCALE(9.450953453779220e-3), - SCALE(8.134882897138596e-2), SCALE(2.451938837766648e-1), - SCALE(3.429597318172455e-1), SCALE(2.371159791946411e-1), - SCALE(7.556436210870743e-2), SCALE(8.229630999267101e-3), - SCALE(9.439323912374676e-5), SCALE(9.887560270726680e-3), - SCALE(8.333285897970200e-2), SCALE(2.478559017181396e-1), - SCALE(3.428434133529663e-1), SCALE(2.343961596488952e-1), - SCALE(7.369252294301987e-2), SCALE(7.850865833461285e-3), - SCALE(1.082170274457894e-4), SCALE(1.033949479460716e-2), - SCALE(8.534456789493561e-2), SCALE(2.505008876323700e-1), - SCALE(3.426689505577088e-1), SCALE(2.316644787788391e-1), - SCALE(7.184901088476181e-2), SCALE(7.485736627131701e-3), - SCALE(1.233371440321207e-4), SCALE(1.080708485096693e-2), - SCALE(8.738376945257187e-2), SCALE(2.531278133392334e-1), - SCALE(3.424364924430847e-1), SCALE(2.289219647645950e-1), - SCALE(7.003392279148102e-2), SCALE(7.133882027119398e-3), - SCALE(1.397485757479444e-4), SCALE(1.129068247973919e-2), - SCALE(8.945026248693466e-2), SCALE(2.557355761528015e-1), - SCALE(3.421461284160614e-1), SCALE(2.261696159839630e-1), - SCALE(6.824731826782227e-2), SCALE(6.794991903007030e-3), - SCALE(1.575958012836054e-4), SCALE(1.179065089672804e-2), - SCALE(9.154383838176728e-2), SCALE(2.583232223987580e-1), - SCALE(3.417979776859284e-1), SCALE(2.234084606170654e-1), - SCALE(6.648923456668854e-2), SCALE(6.468691397458315e-3), - SCALE(1.769922382663936e-4), SCALE(1.230732165277004e-2), - SCALE(9.366425126791000e-2), SCALE(2.608896791934967e-1), - SCALE(3.413922190666198e-1), SCALE(2.206395119428635e-1), - SCALE(6.475970894098282e-2), SCALE(6.154712289571762e-3), - SCALE(1.981738605536520e-4), SCALE(1.284105982631445e-2), - SCALE(9.581124037504196e-2), SCALE(2.634339034557342e-1), - SCALE(3.409290313720703e-1), SCALE(2.178637981414795e-1), - SCALE(6.305878609418869e-2), SCALE(5.852684378623962e-3), - SCALE(2.211847313446924e-4), SCALE(1.339218579232693e-2), - SCALE(9.798453748226166e-2), SCALE(2.659549415111542e-1), - SCALE(3.404086530208588e-1), SCALE(2.150822728872299e-1), - SCALE(6.138643622398376e-2), SCALE(5.562345497310162e-3), - SCALE(2.460231189616024e-4), SCALE(1.396108977496624e-2), - SCALE(1.001838669180870e-1), SCALE(2.684516608715058e-1), - SCALE(3.398312926292420e-1), SCALE(2.122959494590759e-1), - SCALE(5.974265560507774e-2), SCALE(5.283284001052380e-3), - SCALE(2.726115926634520e-4), SCALE(1.454808749258518e-2), - SCALE(1.024089083075523e-1), SCALE(2.709231376647949e-1), - SCALE(3.391972482204438e-1), SCALE(2.095058411359787e-1), - SCALE(5.812742188572884e-2), SCALE(5.015311297029257e-3), - SCALE(3.013863170053810e-4), SCALE(1.515355054289102e-2), - SCALE(1.046593263745308e-1), SCALE(2.733682692050934e-1), - SCALE(3.385068178176880e-1), SCALE(2.067128717899322e-1), - SCALE(5.654069408774376e-2), SCALE(4.758012015372515e-3), - SCALE(3.328395541757345e-4), SCALE(1.577781140804291e-2), - SCALE(1.069347932934761e-1), SCALE(2.757860720157624e-1), - SCALE(3.377602994441986e-1), SCALE(2.039180546998978e-1), - SCALE(5.498242005705833e-2), SCALE(4.511159844696522e-3), - SCALE(3.658991190604866e-4), SCALE(1.642123050987720e-2), - SCALE(1.092349365353584e-1), SCALE(2.781755328178406e-1), - SCALE(3.369580209255218e-1), SCALE(2.011223286390304e-1), - SCALE(5.345252528786659e-2), SCALE(4.274417180567980e-3), - SCALE(4.018281470052898e-4), SCALE(1.708412915468216e-2), - SCALE(1.115593686699867e-1), SCALE(2.805356979370117e-1), - SCALE(3.361004292964936e-1), SCALE(1.983266174793244e-1), - SCALE(5.195093154907227e-2), SCALE(4.047499038279056e-3), - SCALE(4.401875485200435e-4), SCALE(1.776690222322941e-2), - SCALE(1.139076948165894e-1), SCALE(2.828655838966370e-1), - SCALE(3.351879119873047e-1), SCALE(1.955319195985794e-1), - SCALE(5.047753453254700e-2), SCALE(3.830091329291463e-3), - SCALE(4.812776169274002e-4), SCALE(1.846982724964619e-2), - SCALE(1.162794977426529e-1), SCALE(2.851640880107880e-1), - SCALE(3.342207968235016e-1), SCALE(1.927391141653061e-1), - SCALE(4.903224110603333e-2), SCALE(3.621967276558280e-3), - SCALE(5.252459668554366e-4), SCALE(1.919330470263958e-2), - SCALE(1.186743453145027e-1), SCALE(2.874303460121155e-1), - SCALE(3.331996202468872e-1), SCALE(1.899491697549820e-1), - SCALE(4.761491715908051e-2), SCALE(3.422776935622096e-3), - SCALE(5.721592460758984e-4), SCALE(1.993762329220772e-2), - SCALE(1.210917681455612e-1), SCALE(2.896633744239807e-1), - SCALE(3.321248590946198e-1), SCALE(1.871629506349564e-1), - SCALE(4.622544348239899e-2), SCALE(3.232272574678064e-3), - SCALE(6.222130032256246e-4), SCALE(2.070316113531590e-2), - SCALE(1.235313042998314e-1), SCALE(2.918621897697448e-1), - SCALE(3.309969604015350e-1), SCALE(1.843813359737396e-1), - SCALE(4.486365616321564e-2), SCALE(3.050152910873294e-3), - SCALE(6.755515350960195e-4), SCALE(2.149021252989769e-2), - SCALE(1.259924471378326e-1), SCALE(2.940258979797364e-1), - SCALE(3.298164308071136e-1), SCALE(1.816052496433258e-1), - SCALE(4.352942481637001e-2), SCALE(2.876190468668938e-3), - SCALE(7.324148900806904e-4), SCALE(2.229913882911205e-2), - SCALE(1.284746825695038e-1), SCALE(2.961534857749939e-1), - SCALE(3.285838961601258e-1), SCALE(1.788355410099030e-1), - SCALE(4.222255200147629e-2), SCALE(2.710093278437853e-3), - SCALE(7.928516715764999e-4), SCALE(2.313023805618286e-2), - SCALE(1.309774816036224e-1), SCALE(2.982441186904907e-1), - SCALE(3.272998929023742e-1), SCALE(1.760730892419815e-1), - SCALE(4.094288870692253e-2), SCALE(2.551567042246461e-3), - SCALE(8.570110658183694e-4), SCALE(2.398385666310787e-2), - SCALE(1.335003077983856e-1), SCALE(3.002967536449432e-1), - SCALE(3.259649574756622e-1), SCALE(1.733186990022659e-1), - SCALE(3.969023004174232e-2), SCALE(2.400433411821723e-3), - SCALE(9.251192095689476e-4), SCALE(2.486028522253036e-2), - SCALE(1.360425949096680e-1), SCALE(3.023106753826142e-1), - SCALE(3.245797157287598e-1), SCALE(1.705732345581055e-1), - SCALE(3.846437484025955e-2), SCALE(2.256359672173858e-3), - SCALE(9.974770946428180e-4), SCALE(2.575986087322235e-2), - SCALE(1.386037617921829e-1), SCALE(3.042849004268646e-1), - SCALE(3.231448531150818e-1), SCALE(1.678375005722046e-1), - SCALE(3.726511076092720e-2), SCALE(2.119151875376701e-3), - SCALE(1.073930296115577e-3), SCALE(2.668286114931106e-2), - SCALE(1.411831974983215e-1), SCALE(3.062185347080230e-1), - SCALE(3.216609656810760e-1), SCALE(1.651122719049454e-1), - SCALE(3.609224036335945e-2), SCALE(1.988604199141264e-3), - SCALE(1.155023579485714e-3), SCALE(2.762960828840732e-2), - SCALE(1.437802612781525e-1), SCALE(3.081108033657074e-1), - SCALE(3.201287388801574e-1), SCALE(1.623983532190323e-1), - SCALE(3.494550660252571e-2), SCALE(1.864377525635064e-3), - SCALE(1.240676851011813e-3), SCALE(2.860039286315441e-2), - SCALE(1.463943719863892e-1), SCALE(3.099608123302460e-1), - SCALE(3.185488879680634e-1), SCALE(1.596965193748474e-1), - SCALE(3.382468968629837e-2), SCALE(1.746327499859035e-3), - SCALE(1.331258914433420e-3), SCALE(2.959549613296986e-2), - SCALE(1.490248143672943e-1), SCALE(3.117676973342896e-1), - SCALE(3.169221282005310e-1), SCALE(1.570075154304504e-1), - SCALE(3.272953629493714e-2), SCALE(1.634211512282491e-3), - SCALE(1.426893868483603e-3), SCALE(3.061520494520664e-2), - SCALE(1.516709625720978e-1), SCALE(3.135308027267456e-1), - SCALE(3.152491748332978e-1), SCALE(1.543320864439010e-1), - SCALE(3.165979683399200e-2), SCALE(1.527829794213176e-3), -}; - -DECLARE_ALIGNED(16, static const float, lfe_fir_128)[] = -{ - SCALE(0.00053168571), SCALE(0.15878495574), SCALE(0.68603444099), SCALE(0.15492856503), - SCALE(0.00016358691), SCALE(0.16269733012), SCALE(0.68591803312), SCALE(0.15112841129), - SCALE(0.00018878609), SCALE(0.16666537523), SCALE(0.68568539619), SCALE(0.14738474786), - SCALE(0.00021643363), SCALE(0.17068879306), SCALE(0.68533653021), SCALE(0.14369773865), - SCALE(0.00024667382), SCALE(0.17476719618), SCALE(0.68487155437), SCALE(0.14006754756), - SCALE(0.00027949660), SCALE(0.17890018225), SCALE(0.68429082632), SCALE(0.13649433851), - SCALE(0.00031519096), SCALE(0.18308731914), SCALE(0.68359452486), SCALE(0.13297818601), - SCALE(0.00035398375), SCALE(0.18732811511), SCALE(0.68278300762), SCALE(0.12951917946), - SCALE(0.00039634691), SCALE(0.19162209332), SCALE(0.68185669184), SCALE(0.12611730397), - SCALE(0.00044236859), SCALE(0.19596865773), SCALE(0.68081587553), SCALE(0.12277261168), - SCALE(0.00049204525), SCALE(0.20036731660), SCALE(0.67966115475), SCALE(0.11948505789), - SCALE(0.00054522208), SCALE(0.20481738448), SCALE(0.67839306593), SCALE(0.11625462025), - SCALE(0.00060277141), SCALE(0.20931822062), SCALE(0.67701220512), SCALE(0.11308115721), - SCALE(0.00066567765), SCALE(0.21386915445), SCALE(0.67551922798), SCALE(0.10996460915), - SCALE(0.00073179678), SCALE(0.21846942604), SCALE(0.67391467094), SCALE(0.10690483451), - SCALE(0.00080365466), SCALE(0.22311829031), SCALE(0.67219948769), SCALE(0.10390164703), - SCALE(0.00088037323), SCALE(0.22781492770), SCALE(0.67037439346), SCALE(0.10095486045), - SCALE(0.00096255314), SCALE(0.23255851865), SCALE(0.66844022274), SCALE(0.09806428105), - SCALE(0.00105048984), SCALE(0.23734821379), SCALE(0.66639786959), SCALE(0.09522963315), - SCALE(0.00114431616), SCALE(0.24218304455), SCALE(0.66424828768), SCALE(0.09245070815), - SCALE(0.00124442333), SCALE(0.24706205726), SCALE(0.66199249029), SCALE(0.08972713351), - SCALE(0.00135110028), SCALE(0.25198432803), SCALE(0.65963155031), SCALE(0.08705867827), - SCALE(0.00146482687), SCALE(0.25694879889), SCALE(0.65716648102), SCALE(0.08444493264), - SCALE(0.00158570008), SCALE(0.26195442677), SCALE(0.65459835529), SCALE(0.08188561350), - SCALE(0.00171401864), SCALE(0.26700007915), SCALE(0.65192854404), SCALE(0.07938029617), - SCALE(0.00185023469), SCALE(0.27208462358), SCALE(0.64915806055), SCALE(0.07692859322), - SCALE(0.00199495023), SCALE(0.27720692754), SCALE(0.64628833532), SCALE(0.07453006506), - SCALE(0.00214785640), SCALE(0.28236576915), SCALE(0.64332056046), SCALE(0.07218432426), - SCALE(0.00231004250), SCALE(0.28755992651), SCALE(0.64025616646), SCALE(0.06989086419), - SCALE(0.00248134881), SCALE(0.29278811812), SCALE(0.63709646463), SCALE(0.06764923781), - SCALE(0.00266251224), SCALE(0.29804900289), SCALE(0.63384294510), SCALE(0.06545893103), - SCALE(0.00285378192), SCALE(0.30334126949), SCALE(0.63049703836), SCALE(0.06331945211), - SCALE(0.00305565330), SCALE(0.30866351724), SCALE(0.62706029415), SCALE(0.06123027951), - SCALE(0.00326841651), SCALE(0.31401440501), SCALE(0.62353414297), SCALE(0.05919086933), - SCALE(0.00349264755), SCALE(0.31939238310), SCALE(0.61992025375), SCALE(0.05720067024), - SCALE(0.00372874714), SCALE(0.32479602098), SCALE(0.61622029543), SCALE(0.05525910854), - SCALE(0.00397720048), SCALE(0.33022382855), SCALE(0.61243581772), SCALE(0.05336561054), - SCALE(0.00423829490), SCALE(0.33567428589), SCALE(0.60856848955), SCALE(0.05151961371), - SCALE(0.00451271003), SCALE(0.34114575386), SCALE(0.60462015867), SCALE(0.04972046614), - SCALE(0.00480085658), SCALE(0.34663668275), SCALE(0.60059231520), SCALE(0.04796761274), - SCALE(0.00510312291), SCALE(0.35214546323), SCALE(0.59648692608), SCALE(0.04626038298), - SCALE(0.00542017492), SCALE(0.35767036676), SCALE(0.59230577946), SCALE(0.04459818453), - SCALE(0.00575236930), SCALE(0.36320972443), SCALE(0.58805054426), SCALE(0.04298033938), - SCALE(0.00610029325), SCALE(0.36876192689), SCALE(0.58372318745), SCALE(0.04140623659), - SCALE(0.00646453211), SCALE(0.37432509661), SCALE(0.57932555676), SCALE(0.03987516090), - SCALE(0.00684553990), SCALE(0.37989753485), SCALE(0.57485944033), SCALE(0.03838652745), - SCALE(0.00724391919), SCALE(0.38547745347), SCALE(0.57032698393), SCALE(0.03693958372), - SCALE(0.00766016589), SCALE(0.39106300473), SCALE(0.56572991610), SCALE(0.03553372994), - SCALE(0.00809498038), SCALE(0.39665243030), SCALE(0.56107026339), SCALE(0.03416819125), - SCALE(0.00854881573), SCALE(0.40224379301), SCALE(0.55634999275), SCALE(0.03284239396), - SCALE(0.00902230106), SCALE(0.40783521533), SCALE(0.55157101154), SCALE(0.03155555204), - SCALE(0.00951600447), SCALE(0.41342487931), SCALE(0.54673534632), SCALE(0.03030703776), - SCALE(0.01003060210), SCALE(0.41901078820), SCALE(0.54184508324), SCALE(0.02909611352), - SCALE(0.01056654565), SCALE(0.42459106445), SCALE(0.53690224886), SCALE(0.02792212367), - SCALE(0.01112466771), SCALE(0.43016362190), SCALE(0.53190881014), SCALE(0.02678431384), - SCALE(0.01170534454), SCALE(0.43572667241), SCALE(0.52686679363), SCALE(0.02568206564), - SCALE(0.01230939943), SCALE(0.44127810001), SCALE(0.52177828550), SCALE(0.02461459488), - SCALE(0.01293735672), SCALE(0.44681602716), SCALE(0.51664537191), SCALE(0.02358125709), - SCALE(0.01358995494), SCALE(0.45233830810), SCALE(0.51147013903), SCALE(0.02258131653), - SCALE(0.01426773332), SCALE(0.45784294605), SCALE(0.50625455379), SCALE(0.02161412500), - SCALE(0.01497144438), SCALE(0.46332800388), SCALE(0.50100076199), SCALE(0.02067894675), - SCALE(0.01570170000), SCALE(0.46879136562), SCALE(0.49571081996), SCALE(0.01977507770), - SCALE(0.01645922661), SCALE(0.47423094511), SCALE(0.49038675427), SCALE(0.01890186779), - SCALE(0.01724460535), SCALE(0.47964480519), SCALE(0.48503074050), SCALE(0.01805862412), -}; -#undef SCALE - -/* - * D.11 Look-up Table for Downmix Scale Factors - * - * Note that the range of the entries in DmixTable[] is between -60 dB and 0 dB - * with addition of -inf (|DMixCoeff| = 0), which is coded with a DmixCode = 0. - * Furthermore, the range [-60 to 0] is subdivided into 3 regions, each with a - * different grid resolution: - * - * 1) [-60.000 to -30] with resolution of 0.500 dB - * 2) [-29.750 to -15] with resolution of 0.250 dB - * 3) [-14.875 to 0] with resolution of 0.125 dB - */ -static const float dca_dmixtable[241] = { - 0.001000, 0.001059, 0.001122, 0.001189, 0.001259, 0.001334, 0.001413, 0.001496, - 0.001585, 0.001679, 0.001778, 0.001884, 0.001995, 0.002113, 0.002239, 0.002371, - 0.002512, 0.002661, 0.002818, 0.002985, 0.003162, 0.003350, 0.003548, 0.003758, - 0.003981, 0.004217, 0.004467, 0.004732, 0.005012, 0.005309, 0.005623, 0.005957, - 0.006310, 0.006683, 0.007079, 0.007499, 0.007943, 0.008414, 0.008913, 0.009441, - 0.010000, 0.010593, 0.011220, 0.011885, 0.012589, 0.013335, 0.014125, 0.014962, - 0.015849, 0.016788, 0.017783, 0.018836, 0.019953, 0.021135, 0.022387, 0.023714, - 0.025119, 0.026607, 0.028184, 0.029854, 0.031623, 0.032546, 0.033497, 0.034475, - 0.035481, 0.036517, 0.037584, 0.038681, 0.039811, 0.040973, 0.042170, 0.043401, - 0.044668, 0.045973, 0.047315, 0.048697, 0.050119, 0.051582, 0.053088, 0.054639, - 0.056234, 0.057876, 0.059566, 0.061306, 0.063096, 0.064938, 0.066834, 0.068786, - 0.070795, 0.072862, 0.074989, 0.077179, 0.079433, 0.081752, 0.084140, 0.086596, - 0.089125, 0.091728, 0.094406, 0.097163, 0.100000, 0.102920, 0.105925, 0.109018, - 0.112202, 0.115478, 0.118850, 0.122321, 0.125893, 0.129569, 0.133352, 0.137246, - 0.141254, 0.145378, 0.149624, 0.153993, 0.158489, 0.163117, 0.167880, 0.172783, - 0.177828, 0.180406, 0.183021, 0.185674, 0.188365, 0.191095, 0.193865, 0.196675, - 0.199526, 0.202418, 0.205353, 0.208329, 0.211349, 0.214412, 0.217520, 0.220673, - 0.223872, 0.227117, 0.230409, 0.233749, 0.237137, 0.240575, 0.244062, 0.247600, - 0.251189, 0.254830, 0.258523, 0.262271, 0.266073, 0.269929, 0.273842, 0.277811, - 0.281838, 0.285924, 0.290068, 0.294273, 0.298538, 0.302866, 0.307256, 0.311709, - 0.316228, 0.320812, 0.325462, 0.330179, 0.334965, 0.339821, 0.344747, 0.349744, - 0.354813, 0.359956, 0.365174, 0.370467, 0.375837, 0.381285, 0.386812, 0.392419, - 0.398107, 0.403878, 0.409732, 0.415671, 0.421697, 0.427809, 0.434010, 0.440301, - 0.446684, 0.453158, 0.459727, 0.466391, 0.473151, 0.480010, 0.486968, 0.494026, - 0.501187, 0.508452, 0.515822, 0.523299, 0.530884, 0.538580, 0.546387, 0.554307, - 0.562341, 0.570493, 0.578762, 0.587151, 0.595662, 0.604296, 0.613056, 0.621942, - 0.630957, 0.640103, 0.649382, 0.658795, 0.668344, 0.678032, 0.687860, 0.697831, - 0.707107, 0.718208, 0.728618, 0.739180, 0.749894, 0.760764, 0.771792, 0.782979, - 0.794328, 0.805842, 0.817523, 0.829373, 0.841395, 0.853591, 0.865964, 0.878517, - 0.891251, 0.904170, 0.917276, 0.930572, 0.944061, 0.957745, 0.971628, 0.985712, - 1.000000, -}; - -static const float dca_default_coeffs[10][6][2] = { - { { 0.707107, 0.707107 }, { 0.000000, 0.000000 }, }, // A [LFE] - { { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // A + B (dual mono) [LFE] - { { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // L + R (stereo) [LFE] - { { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // (L+R) + (L-R) (sum-difference) [LFE] - { { 1.000000, 0.000000 }, { 0.000000, 1.000000 }, { 0.000000, 0.000000 }, }, // LT + RT (left and right total) [LFE] - { { 0.501187, 0.501187 }, { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.000000, 0.000000 }, }, // C + L + R [LFE] - { { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.501187, 0.501187 }, { 0.000000, 0.000000 }, }, // L + R + S [LFE] - { { 0.501187, 0.501187 }, { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.501187, 0.501187 }, { 0.000000, 0.000000 }, }, // C + L + R + S [LFE] - { { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.501187, 0.000000 }, { 0.000000, 0.501187 }, { 0.000000, 0.000000 }, }, // L + R + SL + SR [LFE] - { { 0.501187, 0.501187 }, { 0.707107, 0.000000 }, { 0.000000, 0.707107 }, { 0.501187, 0.000000 }, { 0.000000, 0.501187 }, { 0.000000, 0.000000 }, }, // C + L + R + SL + SR [LFE] -}; - -/* downmix coeffs - - TABLE 9 -______________________________________ -Down-mix coefficients for 8-channel source -audio (5 + 3 format) - lt - cen- rt lt ctr rt -lt ter ctr center - rt srd srd srd -______________________________________ -1 0.71 0.74 1.0 0.71 0.71 0.58 0.58 0.58 -2 left 1.0 0.89 0.71 0.46 0.71 0.50 - rt 0.45 0.71 0.89 1.0 0.50 0.71 -3 lt 1.0 0.89 0.71 0.45 - rt 0.45 0.71 0.89 1.0 - srd 0.71 0.71 0.71 -4 lt 1.0 0.89 0.71 0.45 - rt 0.45 0.71 0.89 1.0 - lt srd 1.0 0.71 - rt srd 0.71 0.71 -4 lt 1.0 0.5 - ctr 0.87 1.0 0.87 - rt 0.5 1.0 - srd 0.71 0.71 0.71 -5 lt 1.0 0.5 - ctr 0.87 1.0 0.87 - rt 0.5 1.0 - lt srd 1.0 0.71 - rt srd 0.71 1.0 -6 lt 1.0 0.5 - lt ctr 0.87 0.71 - rt ctr 0.71 0.87 - rt 0.5 1.0 - lt srd 1.0 0.71 - rt srd 0.71 1.0 -6 lt 1.0 0.5 - ctr 0.86 1.0 0.86 - rt 0.5 1.0 - lt srd 1.0 - ctr srd 1.0 - rt srd 1.0 -7 lt 1.0 - lt ctr 1.0 - ctr 1.0 - rt ctr 1.0 - rt 1.0 - lt srd 1.0 0.71 - rt srd 0.71 1.0 -7 lt 1.0 0.5 - lt ctr 0.87 0.71 - rt ctr 0.71 0.87 - rt 0.5 1.0 - lt srd 1.0 - ctr srd 1.0 - rt srd 1.0 -8 lt 1.0 0.5 - lt ctr 0.87 0.71 - rt ctr 0.71 0.87 - rt 0.5 1.0 - lt 1 srd 0.87 0.35 - lt 2 srd 0.5 0.61 - rt 2 srd 0.61 0.50 - rt 2 srd 0.35 0.87 - - Generation of Lt Rt - -In the case when the playback system has analog or digital surround multi-channel capability, a down matrix from 5, 4, or 3 channel to Lt Rt may be desirable. In the case when the number of decoded audio channels exceeds 5, 4 or 3 respectively a first stage down mix to 5, 4 or 3 chs should be used as described above. - -The down matrixing equations for 5-channel source audio to a two-channel Lt Rt playback system are given by: - -Left left+0.7*center-0.7*(lt surround+rt surround) - -Right=right+0.7*center+0.7*(lt surround+rt surround) - -Embedded mixing to 2-channel - -One concern arising from the proliferation of multi-channel audio systems is that most home systems presently have only two channel playback capability. To accommodate this a fixed 2-channel down matrix processes is commonly used following the multi-channel decoding stage. However, for music only applications the image quality etc. of the down matrixed signal may not match that of an equivalent stereo recording found on CD. - -The concept of embedded mixing is to allow the producer to dynamically specify the matrixing coefficients within the audio frame itself. In this way the stereo down mix at the decoder may be better matched to a 2-channel playback environment. - -CHS*2, 7-bit down mix indexes (MCOEFFS) are transmitted along with the multi-channel audio once in every frame. The indexes are converted to attenuation factors using a 7 bit LUT. The 2-ch down mix equations are as follows, - -Left Ch=sum (MCOEFF[n]*Ch[n]) for n=1, CHS - -Right Ch sum (MCOEFF[n+CHS]*Ch[n]) for n=1, CHS - -where Ch(n) represents the subband samples in the (n)th audio channel. - - -*/ - -#endif /* AVCODEC_DCADATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadec.c deleted file mode 100644 index b33d239bf..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadec.c +++ /dev/null @@ -1,2654 +0,0 @@ -/* - * DCA compatible decoder - * Copyright (C) 2004 Gildas Bazin - * Copyright (C) 2004 Benjamin Zores - * Copyright (C) 2006 Benjamin Larsson - * Copyright (C) 2007 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/common.h" -#include "libavutil/float_dsp.h" -#include "libavutil/internal.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/mathematics.h" -#include "libavutil/opt.h" -#include "libavutil/samplefmt.h" -#include "avcodec.h" -#include "fft.h" -#include "get_bits.h" -#include "dcadata.h" -#include "dcahuff.h" -#include "dca.h" -#include "mathops.h" -#include "synth_filter.h" -#include "dcadsp.h" -#include "fmtconvert.h" -#include "internal.h" - -#if ARCH_ARM -# include "arm/dca.h" -#endif - -//#define TRACE - -#define DCA_PRIM_CHANNELS_MAX (7) -#define DCA_ABITS_MAX (32) /* Should be 28 */ -#define DCA_SUBSUBFRAMES_MAX (4) -#define DCA_SUBFRAMES_MAX (16) -#define DCA_BLOCKS_MAX (16) -#define DCA_LFE_MAX (3) -#define DCA_CHSETS_MAX (4) -#define DCA_CHSET_CHANS_MAX (8) - -enum DCAMode { - DCA_MONO = 0, - DCA_CHANNEL, - DCA_STEREO, - DCA_STEREO_SUMDIFF, - DCA_STEREO_TOTAL, - DCA_3F, - DCA_2F1R, - DCA_3F1R, - DCA_2F2R, - DCA_3F2R, - DCA_4F2R -}; - -/* these are unconfirmed but should be mostly correct */ -enum DCAExSSSpeakerMask { - DCA_EXSS_FRONT_CENTER = 0x0001, - DCA_EXSS_FRONT_LEFT_RIGHT = 0x0002, - DCA_EXSS_SIDE_REAR_LEFT_RIGHT = 0x0004, - DCA_EXSS_LFE = 0x0008, - DCA_EXSS_REAR_CENTER = 0x0010, - DCA_EXSS_FRONT_HIGH_LEFT_RIGHT = 0x0020, - DCA_EXSS_REAR_LEFT_RIGHT = 0x0040, - DCA_EXSS_FRONT_HIGH_CENTER = 0x0080, - DCA_EXSS_OVERHEAD = 0x0100, - DCA_EXSS_CENTER_LEFT_RIGHT = 0x0200, - DCA_EXSS_WIDE_LEFT_RIGHT = 0x0400, - DCA_EXSS_SIDE_LEFT_RIGHT = 0x0800, - DCA_EXSS_LFE2 = 0x1000, - DCA_EXSS_SIDE_HIGH_LEFT_RIGHT = 0x2000, - DCA_EXSS_REAR_HIGH_CENTER = 0x4000, - DCA_EXSS_REAR_HIGH_LEFT_RIGHT = 0x8000, -}; - -enum DCAXxchSpeakerMask { - DCA_XXCH_FRONT_CENTER = 0x0000001, - DCA_XXCH_FRONT_LEFT = 0x0000002, - DCA_XXCH_FRONT_RIGHT = 0x0000004, - DCA_XXCH_SIDE_REAR_LEFT = 0x0000008, - DCA_XXCH_SIDE_REAR_RIGHT = 0x0000010, - DCA_XXCH_LFE1 = 0x0000020, - DCA_XXCH_REAR_CENTER = 0x0000040, - DCA_XXCH_SURROUND_REAR_LEFT = 0x0000080, - DCA_XXCH_SURROUND_REAR_RIGHT = 0x0000100, - DCA_XXCH_SIDE_SURROUND_LEFT = 0x0000200, - DCA_XXCH_SIDE_SURROUND_RIGHT = 0x0000400, - DCA_XXCH_FRONT_CENTER_LEFT = 0x0000800, - DCA_XXCH_FRONT_CENTER_RIGHT = 0x0001000, - DCA_XXCH_FRONT_HIGH_LEFT = 0x0002000, - DCA_XXCH_FRONT_HIGH_CENTER = 0x0004000, - DCA_XXCH_FRONT_HIGH_RIGHT = 0x0008000, - DCA_XXCH_LFE2 = 0x0010000, - DCA_XXCH_SIDE_FRONT_LEFT = 0x0020000, - DCA_XXCH_SIDE_FRONT_RIGHT = 0x0040000, - DCA_XXCH_OVERHEAD = 0x0080000, - DCA_XXCH_SIDE_HIGH_LEFT = 0x0100000, - DCA_XXCH_SIDE_HIGH_RIGHT = 0x0200000, - DCA_XXCH_REAR_HIGH_CENTER = 0x0400000, - DCA_XXCH_REAR_HIGH_LEFT = 0x0800000, - DCA_XXCH_REAR_HIGH_RIGHT = 0x1000000, - DCA_XXCH_REAR_LOW_CENTER = 0x2000000, - DCA_XXCH_REAR_LOW_LEFT = 0x4000000, - DCA_XXCH_REAR_LOW_RIGHT = 0x8000000, -}; - -static const uint32_t map_xxch_to_native[28] = { - AV_CH_FRONT_CENTER, - AV_CH_FRONT_LEFT, - AV_CH_FRONT_RIGHT, - AV_CH_SIDE_LEFT, - AV_CH_SIDE_RIGHT, - AV_CH_LOW_FREQUENCY, - AV_CH_BACK_CENTER, - AV_CH_BACK_LEFT, - AV_CH_BACK_RIGHT, - AV_CH_SIDE_LEFT, /* side surround left -- dup sur side L */ - AV_CH_SIDE_RIGHT, /* side surround right -- dup sur side R */ - AV_CH_FRONT_LEFT_OF_CENTER, - AV_CH_FRONT_RIGHT_OF_CENTER, - AV_CH_TOP_FRONT_LEFT, - AV_CH_TOP_FRONT_CENTER, - AV_CH_TOP_FRONT_RIGHT, - AV_CH_LOW_FREQUENCY, /* lfe2 -- duplicate lfe1 position */ - AV_CH_FRONT_LEFT_OF_CENTER, /* side front left -- dup front cntr L */ - AV_CH_FRONT_RIGHT_OF_CENTER,/* side front right -- dup front cntr R */ - AV_CH_TOP_CENTER, /* overhead */ - AV_CH_TOP_FRONT_LEFT, /* side high left -- dup */ - AV_CH_TOP_FRONT_RIGHT, /* side high right -- dup */ - AV_CH_TOP_BACK_CENTER, - AV_CH_TOP_BACK_LEFT, - AV_CH_TOP_BACK_RIGHT, - AV_CH_BACK_CENTER, /* rear low center -- dup */ - AV_CH_BACK_LEFT, /* rear low left -- dup */ - AV_CH_BACK_RIGHT /* read low right -- dup */ -}; - -enum DCAExtensionMask { - DCA_EXT_CORE = 0x001, ///< core in core substream - DCA_EXT_XXCH = 0x002, ///< XXCh channels extension in core substream - DCA_EXT_X96 = 0x004, ///< 96/24 extension in core substream - DCA_EXT_XCH = 0x008, ///< XCh channel extension in core substream - DCA_EXT_EXSS_CORE = 0x010, ///< core in ExSS (extension substream) - DCA_EXT_EXSS_XBR = 0x020, ///< extended bitrate extension in ExSS - DCA_EXT_EXSS_XXCH = 0x040, ///< XXCh channels extension in ExSS - DCA_EXT_EXSS_X96 = 0x080, ///< 96/24 extension in ExSS - DCA_EXT_EXSS_LBR = 0x100, ///< low bitrate component in ExSS - DCA_EXT_EXSS_XLL = 0x200, ///< lossless extension in ExSS -}; - -/* -1 are reserved or unknown */ -static const int dca_ext_audio_descr_mask[] = { - DCA_EXT_XCH, - -1, - DCA_EXT_X96, - DCA_EXT_XCH | DCA_EXT_X96, - -1, - -1, - DCA_EXT_XXCH, - -1, -}; - -/* extensions that reside in core substream */ -#define DCA_CORE_EXTS (DCA_EXT_XCH | DCA_EXT_XXCH | DCA_EXT_X96) - -/* Tables for mapping dts channel configurations to libavcodec multichannel api. - * Some compromises have been made for special configurations. Most configurations - * are never used so complete accuracy is not needed. - * - * L = left, R = right, C = center, S = surround, F = front, R = rear, T = total, OV = overhead. - * S -> side, when both rear and back are configured move one of them to the side channel - * OV -> center back - * All 2 channel configurations -> AV_CH_LAYOUT_STEREO - */ -static const uint64_t dca_core_channel_layout[] = { - AV_CH_FRONT_CENTER, ///< 1, A - AV_CH_LAYOUT_STEREO, ///< 2, A + B (dual mono) - AV_CH_LAYOUT_STEREO, ///< 2, L + R (stereo) - AV_CH_LAYOUT_STEREO, ///< 2, (L + R) + (L - R) (sum-difference) - AV_CH_LAYOUT_STEREO, ///< 2, LT + RT (left and right total) - AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER, ///< 3, C + L + R - AV_CH_LAYOUT_STEREO | AV_CH_BACK_CENTER, ///< 3, L + R + S - AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 4, C + L + R + S - AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 4, L + R + SL + SR - - AV_CH_LAYOUT_STEREO | AV_CH_FRONT_CENTER | AV_CH_SIDE_LEFT | - AV_CH_SIDE_RIGHT, ///< 5, C + L + R + SL + SR - - AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT | - AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER, ///< 6, CL + CR + L + R + SL + SR - - AV_CH_LAYOUT_STEREO | AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT | - AV_CH_FRONT_CENTER | AV_CH_BACK_CENTER, ///< 6, C + L + R + LR + RR + OV - - AV_CH_FRONT_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER | - AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_BACK_CENTER | - AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 6, CF + CR + LF + RF + LR + RR - - AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER | - AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO | - AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT, ///< 7, CL + C + CR + L + R + SL + SR - - AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_RIGHT_OF_CENTER | - AV_CH_LAYOUT_STEREO | AV_CH_SIDE_LEFT | AV_CH_SIDE_RIGHT | - AV_CH_BACK_LEFT | AV_CH_BACK_RIGHT, ///< 8, CL + CR + L + R + SL1 + SL2 + SR1 + SR2 - - AV_CH_FRONT_LEFT_OF_CENTER | AV_CH_FRONT_CENTER | - AV_CH_FRONT_RIGHT_OF_CENTER | AV_CH_LAYOUT_STEREO | - AV_CH_SIDE_LEFT | AV_CH_BACK_CENTER | AV_CH_SIDE_RIGHT, ///< 8, CL + C + CR + L + R + SL + S + SR -}; - -static const int8_t dca_lfe_index[] = { - 1, 2, 2, 2, 2, 3, 2, 3, 2, 3, 2, 3, 1, 3, 2, 3 -}; - -static const int8_t dca_channel_reorder_lfe[][9] = { - { 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, -1, -1, -1, -1, -1, -1}, - { 0, 1, 3, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, 4, -1, -1, -1, -1, -1}, - { 0, 1, 3, 4, -1, -1, -1, -1, -1}, - { 2, 0, 1, 4, 5, -1, -1, -1, -1}, - { 3, 4, 0, 1, 5, 6, -1, -1, -1}, - { 2, 0, 1, 4, 5, 6, -1, -1, -1}, - { 0, 6, 4, 5, 2, 3, -1, -1, -1}, - { 4, 2, 5, 0, 1, 6, 7, -1, -1}, - { 5, 6, 0, 1, 7, 3, 8, 4, -1}, - { 4, 2, 5, 0, 1, 6, 8, 7, -1}, -}; - -static const int8_t dca_channel_reorder_lfe_xch[][9] = { - { 0, 2, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, 3, -1, -1, -1, -1, -1, -1}, - { 0, 1, 3, -1, -1, -1, -1, -1, -1}, - { 0, 1, 3, -1, -1, -1, -1, -1, -1}, - { 0, 1, 3, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, 4, -1, -1, -1, -1, -1}, - { 0, 1, 3, 4, -1, -1, -1, -1, -1}, - { 2, 0, 1, 4, 5, -1, -1, -1, -1}, - { 0, 1, 4, 5, 3, -1, -1, -1, -1}, - { 2, 0, 1, 5, 6, 4, -1, -1, -1}, - { 3, 4, 0, 1, 6, 7, 5, -1, -1}, - { 2, 0, 1, 4, 5, 6, 7, -1, -1}, - { 0, 6, 4, 5, 2, 3, 7, -1, -1}, - { 4, 2, 5, 0, 1, 7, 8, 6, -1}, - { 5, 6, 0, 1, 8, 3, 9, 4, 7}, - { 4, 2, 5, 0, 1, 6, 9, 8, 7}, -}; - -static const int8_t dca_channel_reorder_nolfe[][9] = { - { 0, -1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, -1, -1, -1, -1, -1, -1}, - { 0, 1, 2, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, 3, -1, -1, -1, -1, -1}, - { 0, 1, 2, 3, -1, -1, -1, -1, -1}, - { 2, 0, 1, 3, 4, -1, -1, -1, -1}, - { 2, 3, 0, 1, 4, 5, -1, -1, -1}, - { 2, 0, 1, 3, 4, 5, -1, -1, -1}, - { 0, 5, 3, 4, 1, 2, -1, -1, -1}, - { 3, 2, 4, 0, 1, 5, 6, -1, -1}, - { 4, 5, 0, 1, 6, 2, 7, 3, -1}, - { 3, 2, 4, 0, 1, 5, 7, 6, -1}, -}; - -static const int8_t dca_channel_reorder_nolfe_xch[][9] = { - { 0, 1, -1, -1, -1, -1, -1, -1, -1}, - { 0, 1, 2, -1, -1, -1, -1, -1, -1}, - { 0, 1, 2, -1, -1, -1, -1, -1, -1}, - { 0, 1, 2, -1, -1, -1, -1, -1, -1}, - { 0, 1, 2, -1, -1, -1, -1, -1, -1}, - { 2, 0, 1, 3, -1, -1, -1, -1, -1}, - { 0, 1, 2, 3, -1, -1, -1, -1, -1}, - { 2, 0, 1, 3, 4, -1, -1, -1, -1}, - { 0, 1, 3, 4, 2, -1, -1, -1, -1}, - { 2, 0, 1, 4, 5, 3, -1, -1, -1}, - { 2, 3, 0, 1, 5, 6, 4, -1, -1}, - { 2, 0, 1, 3, 4, 5, 6, -1, -1}, - { 0, 5, 3, 4, 1, 2, 6, -1, -1}, - { 3, 2, 4, 0, 1, 6, 7, 5, -1}, - { 4, 5, 0, 1, 7, 2, 8, 3, 6}, - { 3, 2, 4, 0, 1, 5, 8, 7, 6}, -}; - -#define DCA_DOLBY 101 /* FIXME */ - -#define DCA_CHANNEL_BITS 6 -#define DCA_CHANNEL_MASK 0x3F - -#define DCA_LFE 0x80 - -#define HEADER_SIZE 14 - -#define DCA_MAX_FRAME_SIZE 16384 -#define DCA_MAX_EXSS_HEADER_SIZE 4096 - -#define DCA_BUFFER_PADDING_SIZE 1024 - -#define DCA_NSYNCAUX 0x9A1105A0 - -/** Bit allocation */ -typedef struct { - int offset; ///< code values offset - int maxbits[8]; ///< max bits in VLC - int wrap; ///< wrap for get_vlc2() - VLC vlc[8]; ///< actual codes -} BitAlloc; - -static BitAlloc dca_bitalloc_index; ///< indexes for samples VLC select -static BitAlloc dca_tmode; ///< transition mode VLCs -static BitAlloc dca_scalefactor; ///< scalefactor VLCs -static BitAlloc dca_smpl_bitalloc[11]; ///< samples VLCs - -static av_always_inline int get_bitalloc(GetBitContext *gb, BitAlloc *ba, - int idx) -{ - return get_vlc2(gb, ba->vlc[idx].table, ba->vlc[idx].bits, ba->wrap) + - ba->offset; -} - -typedef struct { - const AVClass *class; ///< class for AVOptions - AVCodecContext *avctx; - /* Frame header */ - int frame_type; ///< type of the current frame - int samples_deficit; ///< deficit sample count - int crc_present; ///< crc is present in the bitstream - int sample_blocks; ///< number of PCM sample blocks - int frame_size; ///< primary frame byte size - int amode; ///< audio channels arrangement - int sample_rate; ///< audio sampling rate - int bit_rate; ///< transmission bit rate - int bit_rate_index; ///< transmission bit rate index - - int dynrange; ///< embedded dynamic range flag - int timestamp; ///< embedded time stamp flag - int aux_data; ///< auxiliary data flag - int hdcd; ///< source material is mastered in HDCD - int ext_descr; ///< extension audio descriptor flag - int ext_coding; ///< extended coding flag - int aspf; ///< audio sync word insertion flag - int lfe; ///< low frequency effects flag - int predictor_history; ///< predictor history flag - int header_crc; ///< header crc check bytes - int multirate_inter; ///< multirate interpolator switch - int version; ///< encoder software revision - int copy_history; ///< copy history - int source_pcm_res; ///< source pcm resolution - int front_sum; ///< front sum/difference flag - int surround_sum; ///< surround sum/difference flag - int dialog_norm; ///< dialog normalisation parameter - - /* Primary audio coding header */ - int subframes; ///< number of subframes - int total_channels; ///< number of channels including extensions - int prim_channels; ///< number of primary audio channels - int subband_activity[DCA_PRIM_CHANNELS_MAX]; ///< subband activity count - int vq_start_subband[DCA_PRIM_CHANNELS_MAX]; ///< high frequency vq start subband - int joint_intensity[DCA_PRIM_CHANNELS_MAX]; ///< joint intensity coding index - int transient_huffman[DCA_PRIM_CHANNELS_MAX]; ///< transient mode code book - int scalefactor_huffman[DCA_PRIM_CHANNELS_MAX]; ///< scale factor code book - int bitalloc_huffman[DCA_PRIM_CHANNELS_MAX]; ///< bit allocation quantizer select - int quant_index_huffman[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< quantization index codebook select - float scalefactor_adj[DCA_PRIM_CHANNELS_MAX][DCA_ABITS_MAX]; ///< scale factor adjustment - - /* Primary audio coding side information */ - int subsubframes[DCA_SUBFRAMES_MAX]; ///< number of subsubframes - int partial_samples[DCA_SUBFRAMES_MAX]; ///< partial subsubframe samples count - int prediction_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction mode (ADPCM used or not) - int prediction_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< prediction VQ coefs - int bitalloc[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< bit allocation index - int transition_mode[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< transition mode (transients) - int32_t scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][2];///< scale factors (2 if transient) - int joint_huff[DCA_PRIM_CHANNELS_MAX]; ///< joint subband scale factors codebook - int joint_scale_factor[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< joint subband scale factors - float downmix_coef[DCA_PRIM_CHANNELS_MAX + 1][2]; ///< stereo downmix coefficients - int dynrange_coef; ///< dynamic range coefficient - - /* Core substream's embedded downmix coefficients (cf. ETSI TS 102 114 V1.4.1) - * Input: primary audio channels (incl. LFE if present) - * Output: downmix audio channels (up to 4, no LFE) */ - uint8_t core_downmix; ///< embedded downmix coefficients available - uint8_t core_downmix_amode; ///< audio channel arrangement of embedded downmix - uint16_t core_downmix_codes[DCA_PRIM_CHANNELS_MAX + 1][4]; ///< embedded downmix coefficients (9-bit codes) - - int32_t high_freq_vq[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS]; ///< VQ encoded high frequency subbands - - float lfe_data[2 * DCA_LFE_MAX * (DCA_BLOCKS_MAX + 4)]; ///< Low frequency effect data - int lfe_scale_factor; - - /* Subband samples history (for ADPCM) */ - DECLARE_ALIGNED(16, float, subband_samples_hist)[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][4]; - DECLARE_ALIGNED(32, float, subband_fir_hist)[DCA_PRIM_CHANNELS_MAX][512]; - DECLARE_ALIGNED(32, float, subband_fir_noidea)[DCA_PRIM_CHANNELS_MAX][32]; - int hist_index[DCA_PRIM_CHANNELS_MAX]; - DECLARE_ALIGNED(32, float, raXin)[32]; - - int output; ///< type of output - - DECLARE_ALIGNED(32, float, subband_samples)[DCA_BLOCKS_MAX][DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8]; - float *samples_chanptr[DCA_PRIM_CHANNELS_MAX + 1]; - float *extra_channels[DCA_PRIM_CHANNELS_MAX + 1]; - uint8_t *extra_channels_buffer; - unsigned int extra_channels_buffer_size; - - uint8_t dca_buffer[DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE + DCA_BUFFER_PADDING_SIZE]; - int dca_buffer_size; ///< how much data is in the dca_buffer - - const int8_t *channel_order_tab; ///< channel reordering table, lfe and non lfe - GetBitContext gb; - /* Current position in DCA frame */ - int current_subframe; - int current_subsubframe; - - int core_ext_mask; ///< present extensions in the core substream - - /* XCh extension information */ - int xch_present; ///< XCh extension present and valid - int xch_base_channel; ///< index of first (only) channel containing XCH data - int xch_disable; ///< whether the XCh extension should be decoded or not - - /* XXCH extension information */ - int xxch_chset; - int xxch_nbits_spk_mask; - uint32_t xxch_core_spkmask; - uint32_t xxch_spk_masks[4]; /* speaker masks, last element is core mask */ - int xxch_chset_nch[4]; - float xxch_dmix_sf[DCA_CHSETS_MAX]; - - uint32_t xxch_dmix_embedded; /* lower layer has mix pre-embedded, per chset */ - float xxch_dmix_coeff[DCA_PRIM_CHANNELS_MAX][32]; /* worst case sizing */ - - int8_t xxch_order_tab[32]; - int8_t lfe_index; - - /* ExSS header parser */ - int static_fields; ///< static fields present - int mix_metadata; ///< mixing metadata present - int num_mix_configs; ///< number of mix out configurations - int mix_config_num_ch[4]; ///< number of channels in each mix out configuration - - int profile; - - int debug_flag; ///< used for suppressing repeated error messages output - AVFloatDSPContext fdsp; - FFTContext imdct; - SynthFilterContext synth; - DCADSPContext dcadsp; - FmtConvertContext fmt_conv; -} DCAContext; - -static const uint16_t dca_vlc_offs[] = { - 0, 512, 640, 768, 1282, 1794, 2436, 3080, 3770, 4454, 5364, - 5372, 5380, 5388, 5392, 5396, 5412, 5420, 5428, 5460, 5492, 5508, - 5572, 5604, 5668, 5796, 5860, 5892, 6412, 6668, 6796, 7308, 7564, - 7820, 8076, 8620, 9132, 9388, 9910, 10166, 10680, 11196, 11726, 12240, - 12752, 13298, 13810, 14326, 14840, 15500, 16022, 16540, 17158, 17678, 18264, - 18796, 19352, 19926, 20468, 21472, 22398, 23014, 23622, -}; - -static av_cold void dca_init_vlcs(void) -{ - static int vlcs_initialized = 0; - int i, j, c = 14; - static VLC_TYPE dca_table[23622][2]; - - if (vlcs_initialized) - return; - - dca_bitalloc_index.offset = 1; - dca_bitalloc_index.wrap = 2; - for (i = 0; i < 5; i++) { - dca_bitalloc_index.vlc[i].table = &dca_table[dca_vlc_offs[i]]; - dca_bitalloc_index.vlc[i].table_allocated = dca_vlc_offs[i + 1] - dca_vlc_offs[i]; - init_vlc(&dca_bitalloc_index.vlc[i], bitalloc_12_vlc_bits[i], 12, - bitalloc_12_bits[i], 1, 1, - bitalloc_12_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); - } - dca_scalefactor.offset = -64; - dca_scalefactor.wrap = 2; - for (i = 0; i < 5; i++) { - dca_scalefactor.vlc[i].table = &dca_table[dca_vlc_offs[i + 5]]; - dca_scalefactor.vlc[i].table_allocated = dca_vlc_offs[i + 6] - dca_vlc_offs[i + 5]; - init_vlc(&dca_scalefactor.vlc[i], SCALES_VLC_BITS, 129, - scales_bits[i], 1, 1, - scales_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); - } - dca_tmode.offset = 0; - dca_tmode.wrap = 1; - for (i = 0; i < 4; i++) { - dca_tmode.vlc[i].table = &dca_table[dca_vlc_offs[i + 10]]; - dca_tmode.vlc[i].table_allocated = dca_vlc_offs[i + 11] - dca_vlc_offs[i + 10]; - init_vlc(&dca_tmode.vlc[i], tmode_vlc_bits[i], 4, - tmode_bits[i], 1, 1, - tmode_codes[i], 2, 2, INIT_VLC_USE_NEW_STATIC); - } - - for (i = 0; i < 10; i++) - for (j = 0; j < 7; j++) { - if (!bitalloc_codes[i][j]) - break; - dca_smpl_bitalloc[i + 1].offset = bitalloc_offsets[i]; - dca_smpl_bitalloc[i + 1].wrap = 1 + (j > 4); - dca_smpl_bitalloc[i + 1].vlc[j].table = &dca_table[dca_vlc_offs[c]]; - dca_smpl_bitalloc[i + 1].vlc[j].table_allocated = dca_vlc_offs[c + 1] - dca_vlc_offs[c]; - - init_vlc(&dca_smpl_bitalloc[i + 1].vlc[j], bitalloc_maxbits[i][j], - bitalloc_sizes[i], - bitalloc_bits[i][j], 1, 1, - bitalloc_codes[i][j], 2, 2, INIT_VLC_USE_NEW_STATIC); - c++; - } - vlcs_initialized = 1; -} - -static inline void get_array(GetBitContext *gb, int *dst, int len, int bits) -{ - while (len--) - *dst++ = get_bits(gb, bits); -} - -static inline int dca_xxch2index(DCAContext *s, int xxch_ch) -{ - int i, base, mask; - - /* locate channel set containing the channel */ - for (i = -1, base = 0, mask = (s->xxch_core_spkmask & ~DCA_XXCH_LFE1); - i <= s->xxch_chset && !(mask & xxch_ch); mask = s->xxch_spk_masks[++i]) - base += av_popcount(mask); - - return base + av_popcount(mask & (xxch_ch - 1)); -} - -static int dca_parse_audio_coding_header(DCAContext *s, int base_channel, - int xxch) -{ - int i, j; - static const float adj_table[4] = { 1.0, 1.1250, 1.2500, 1.4375 }; - static const int bitlen[11] = { 0, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3 }; - static const int thr[11] = { 0, 1, 3, 3, 3, 3, 7, 7, 7, 7, 7 }; - int hdr_pos = 0, hdr_size = 0; - float sign, mag, scale_factor; - int this_chans, acc_mask; - int embedded_downmix; - int nchans, mask[8]; - int coeff, ichan; - - /* xxch has arbitrary sized audio coding headers */ - if (xxch) { - hdr_pos = get_bits_count(&s->gb); - hdr_size = get_bits(&s->gb, 7) + 1; - } - - nchans = get_bits(&s->gb, 3) + 1; - s->total_channels = nchans + base_channel; - s->prim_channels = s->total_channels; - - /* obtain speaker layout mask & downmix coefficients for XXCH */ - if (xxch) { - acc_mask = s->xxch_core_spkmask; - - this_chans = get_bits(&s->gb, s->xxch_nbits_spk_mask - 6) << 6; - s->xxch_spk_masks[s->xxch_chset] = this_chans; - s->xxch_chset_nch[s->xxch_chset] = nchans; - - for (i = 0; i <= s->xxch_chset; i++) - acc_mask |= s->xxch_spk_masks[i]; - - /* check for downmixing information */ - if (get_bits1(&s->gb)) { - embedded_downmix = get_bits1(&s->gb); - scale_factor = - 1.0f / dca_dmixtable[(get_bits(&s->gb, 6) - 1) << 2]; - - s->xxch_dmix_sf[s->xxch_chset] = scale_factor; - - for (i = base_channel; i < s->prim_channels; i++) { - mask[i] = get_bits(&s->gb, s->xxch_nbits_spk_mask); - } - - for (j = base_channel; j < s->prim_channels; j++) { - memset(s->xxch_dmix_coeff[j], 0, sizeof(s->xxch_dmix_coeff[0])); - s->xxch_dmix_embedded |= (embedded_downmix << j); - for (i = 0; i < s->xxch_nbits_spk_mask; i++) { - if (mask[j] & (1 << i)) { - if ((1 << i) == DCA_XXCH_LFE1) { - av_log(s->avctx, AV_LOG_WARNING, - "DCA-XXCH: dmix to LFE1 not supported.\n"); - continue; - } - - coeff = get_bits(&s->gb, 7); - sign = (coeff & 64) ? 1.0 : -1.0; - mag = dca_dmixtable[((coeff & 63) - 1) << 2]; - ichan = dca_xxch2index(s, 1 << i); - s->xxch_dmix_coeff[j][ichan] = sign * mag; - } - } - } - } - } - - if (s->prim_channels > DCA_PRIM_CHANNELS_MAX) - s->prim_channels = DCA_PRIM_CHANNELS_MAX; - - - for (i = base_channel; i < s->prim_channels; i++) { - s->subband_activity[i] = get_bits(&s->gb, 5) + 2; - if (s->subband_activity[i] > DCA_SUBBANDS) - s->subband_activity[i] = DCA_SUBBANDS; - } - for (i = base_channel; i < s->prim_channels; i++) { - s->vq_start_subband[i] = get_bits(&s->gb, 5) + 1; - if (s->vq_start_subband[i] > DCA_SUBBANDS) - s->vq_start_subband[i] = DCA_SUBBANDS; - } - get_array(&s->gb, s->joint_intensity + base_channel, s->prim_channels - base_channel, 3); - get_array(&s->gb, s->transient_huffman + base_channel, s->prim_channels - base_channel, 2); - get_array(&s->gb, s->scalefactor_huffman + base_channel, s->prim_channels - base_channel, 3); - get_array(&s->gb, s->bitalloc_huffman + base_channel, s->prim_channels - base_channel, 3); - - /* Get codebooks quantization indexes */ - if (!base_channel) - memset(s->quant_index_huffman, 0, sizeof(s->quant_index_huffman)); - for (j = 1; j < 11; j++) - for (i = base_channel; i < s->prim_channels; i++) - s->quant_index_huffman[i][j] = get_bits(&s->gb, bitlen[j]); - - /* Get scale factor adjustment */ - for (j = 0; j < 11; j++) - for (i = base_channel; i < s->prim_channels; i++) - s->scalefactor_adj[i][j] = 1; - - for (j = 1; j < 11; j++) - for (i = base_channel; i < s->prim_channels; i++) - if (s->quant_index_huffman[i][j] < thr[j]) - s->scalefactor_adj[i][j] = adj_table[get_bits(&s->gb, 2)]; - - if (!xxch) { - if (s->crc_present) { - /* Audio header CRC check */ - get_bits(&s->gb, 16); - } - } else { - /* Skip to the end of the header, also ignore CRC if present */ - i = get_bits_count(&s->gb); - if (hdr_pos + 8 * hdr_size > i) - skip_bits_long(&s->gb, hdr_pos + 8 * hdr_size - i); - } - - s->current_subframe = 0; - s->current_subsubframe = 0; - -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "subframes: %i\n", s->subframes); - av_log(s->avctx, AV_LOG_DEBUG, "prim channels: %i\n", s->prim_channels); - for (i = base_channel; i < s->prim_channels; i++) { - av_log(s->avctx, AV_LOG_DEBUG, "subband activity: %i\n", - s->subband_activity[i]); - av_log(s->avctx, AV_LOG_DEBUG, "vq start subband: %i\n", - s->vq_start_subband[i]); - av_log(s->avctx, AV_LOG_DEBUG, "joint intensity: %i\n", - s->joint_intensity[i]); - av_log(s->avctx, AV_LOG_DEBUG, "transient mode codebook: %i\n", - s->transient_huffman[i]); - av_log(s->avctx, AV_LOG_DEBUG, "scale factor codebook: %i\n", - s->scalefactor_huffman[i]); - av_log(s->avctx, AV_LOG_DEBUG, "bit allocation quantizer: %i\n", - s->bitalloc_huffman[i]); - av_log(s->avctx, AV_LOG_DEBUG, "quant index huff:"); - for (j = 0; j < 11; j++) - av_log(s->avctx, AV_LOG_DEBUG, " %i", s->quant_index_huffman[i][j]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - av_log(s->avctx, AV_LOG_DEBUG, "scalefac adj:"); - for (j = 0; j < 11; j++) - av_log(s->avctx, AV_LOG_DEBUG, " %1.3f", s->scalefactor_adj[i][j]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } -#endif - - return 0; -} - -static int dca_parse_frame_header(DCAContext *s) -{ - init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); - - /* Sync code */ - skip_bits_long(&s->gb, 32); - - /* Frame header */ - s->frame_type = get_bits(&s->gb, 1); - s->samples_deficit = get_bits(&s->gb, 5) + 1; - s->crc_present = get_bits(&s->gb, 1); - s->sample_blocks = get_bits(&s->gb, 7) + 1; - s->frame_size = get_bits(&s->gb, 14) + 1; - if (s->frame_size < 95) - return AVERROR_INVALIDDATA; - s->amode = get_bits(&s->gb, 6); - s->sample_rate = avpriv_dca_sample_rates[get_bits(&s->gb, 4)]; - if (!s->sample_rate) - return AVERROR_INVALIDDATA; - s->bit_rate_index = get_bits(&s->gb, 5); - s->bit_rate = dca_bit_rates[s->bit_rate_index]; - if (!s->bit_rate) - return AVERROR_INVALIDDATA; - - skip_bits1(&s->gb); // always 0 (reserved, cf. ETSI TS 102 114 V1.4.1) - s->dynrange = get_bits(&s->gb, 1); - s->timestamp = get_bits(&s->gb, 1); - s->aux_data = get_bits(&s->gb, 1); - s->hdcd = get_bits(&s->gb, 1); - s->ext_descr = get_bits(&s->gb, 3); - s->ext_coding = get_bits(&s->gb, 1); - s->aspf = get_bits(&s->gb, 1); - s->lfe = get_bits(&s->gb, 2); - s->predictor_history = get_bits(&s->gb, 1); - - if (s->lfe > 2) { - s->lfe = 0; - av_log(s->avctx, AV_LOG_ERROR, "Invalid LFE value: %d\n", s->lfe); - return AVERROR_INVALIDDATA; - } - - /* TODO: check CRC */ - if (s->crc_present) - s->header_crc = get_bits(&s->gb, 16); - - s->multirate_inter = get_bits(&s->gb, 1); - s->version = get_bits(&s->gb, 4); - s->copy_history = get_bits(&s->gb, 2); - s->source_pcm_res = get_bits(&s->gb, 3); - s->front_sum = get_bits(&s->gb, 1); - s->surround_sum = get_bits(&s->gb, 1); - s->dialog_norm = get_bits(&s->gb, 4); - - /* FIXME: channels mixing levels */ - s->output = s->amode; - if (s->lfe) - s->output |= DCA_LFE; - -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "frame type: %i\n", s->frame_type); - av_log(s->avctx, AV_LOG_DEBUG, "samples deficit: %i\n", s->samples_deficit); - av_log(s->avctx, AV_LOG_DEBUG, "crc present: %i\n", s->crc_present); - av_log(s->avctx, AV_LOG_DEBUG, "sample blocks: %i (%i samples)\n", - s->sample_blocks, s->sample_blocks * 32); - av_log(s->avctx, AV_LOG_DEBUG, "frame size: %i bytes\n", s->frame_size); - av_log(s->avctx, AV_LOG_DEBUG, "amode: %i (%i channels)\n", - s->amode, dca_channels[s->amode]); - av_log(s->avctx, AV_LOG_DEBUG, "sample rate: %i Hz\n", - s->sample_rate); - av_log(s->avctx, AV_LOG_DEBUG, "bit rate: %i bits/s\n", - s->bit_rate); - av_log(s->avctx, AV_LOG_DEBUG, "dynrange: %i\n", s->dynrange); - av_log(s->avctx, AV_LOG_DEBUG, "timestamp: %i\n", s->timestamp); - av_log(s->avctx, AV_LOG_DEBUG, "aux_data: %i\n", s->aux_data); - av_log(s->avctx, AV_LOG_DEBUG, "hdcd: %i\n", s->hdcd); - av_log(s->avctx, AV_LOG_DEBUG, "ext descr: %i\n", s->ext_descr); - av_log(s->avctx, AV_LOG_DEBUG, "ext coding: %i\n", s->ext_coding); - av_log(s->avctx, AV_LOG_DEBUG, "aspf: %i\n", s->aspf); - av_log(s->avctx, AV_LOG_DEBUG, "lfe: %i\n", s->lfe); - av_log(s->avctx, AV_LOG_DEBUG, "predictor history: %i\n", - s->predictor_history); - av_log(s->avctx, AV_LOG_DEBUG, "header crc: %i\n", s->header_crc); - av_log(s->avctx, AV_LOG_DEBUG, "multirate inter: %i\n", - s->multirate_inter); - av_log(s->avctx, AV_LOG_DEBUG, "version number: %i\n", s->version); - av_log(s->avctx, AV_LOG_DEBUG, "copy history: %i\n", s->copy_history); - av_log(s->avctx, AV_LOG_DEBUG, - "source pcm resolution: %i (%i bits/sample)\n", - s->source_pcm_res, dca_bits_per_sample[s->source_pcm_res]); - av_log(s->avctx, AV_LOG_DEBUG, "front sum: %i\n", s->front_sum); - av_log(s->avctx, AV_LOG_DEBUG, "surround sum: %i\n", s->surround_sum); - av_log(s->avctx, AV_LOG_DEBUG, "dialog norm: %i\n", s->dialog_norm); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); -#endif - - /* Primary audio coding header */ - s->subframes = get_bits(&s->gb, 4) + 1; - - return dca_parse_audio_coding_header(s, 0, 0); -} - - -static inline int get_scale(GetBitContext *gb, int level, int value, int log2range) -{ - if (level < 5) { - /* huffman encoded */ - value += get_bitalloc(gb, &dca_scalefactor, level); - value = av_clip(value, 0, (1 << log2range) - 1); - } else if (level < 8) { - if (level + 1 > log2range) { - skip_bits(gb, level + 1 - log2range); - value = get_bits(gb, log2range); - } else { - value = get_bits(gb, level + 1); - } - } - return value; -} - -static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) -{ - /* Primary audio coding side information */ - int j, k; - - if (get_bits_left(&s->gb) < 0) - return AVERROR_INVALIDDATA; - - if (!base_channel) { - s->subsubframes[s->current_subframe] = get_bits(&s->gb, 2) + 1; - s->partial_samples[s->current_subframe] = get_bits(&s->gb, 3); - } - - for (j = base_channel; j < s->prim_channels; j++) { - for (k = 0; k < s->subband_activity[j]; k++) - s->prediction_mode[j][k] = get_bits(&s->gb, 1); - } - - /* Get prediction codebook */ - for (j = base_channel; j < s->prim_channels; j++) { - for (k = 0; k < s->subband_activity[j]; k++) { - if (s->prediction_mode[j][k] > 0) { - /* (Prediction coefficient VQ address) */ - s->prediction_vq[j][k] = get_bits(&s->gb, 12); - } - } - } - - /* Bit allocation index */ - for (j = base_channel; j < s->prim_channels; j++) { - for (k = 0; k < s->vq_start_subband[j]; k++) { - if (s->bitalloc_huffman[j] == 6) - s->bitalloc[j][k] = get_bits(&s->gb, 5); - else if (s->bitalloc_huffman[j] == 5) - s->bitalloc[j][k] = get_bits(&s->gb, 4); - else if (s->bitalloc_huffman[j] == 7) { - av_log(s->avctx, AV_LOG_ERROR, - "Invalid bit allocation index\n"); - return AVERROR_INVALIDDATA; - } else { - s->bitalloc[j][k] = - get_bitalloc(&s->gb, &dca_bitalloc_index, s->bitalloc_huffman[j]); - } - - if (s->bitalloc[j][k] > 26) { - av_dlog(s->avctx, "bitalloc index [%i][%i] too big (%i)\n", - j, k, s->bitalloc[j][k]); - return AVERROR_INVALIDDATA; - } - } - } - - /* Transition mode */ - for (j = base_channel; j < s->prim_channels; j++) { - for (k = 0; k < s->subband_activity[j]; k++) { - s->transition_mode[j][k] = 0; - if (s->subsubframes[s->current_subframe] > 1 && - k < s->vq_start_subband[j] && s->bitalloc[j][k] > 0) { - s->transition_mode[j][k] = - get_bitalloc(&s->gb, &dca_tmode, s->transient_huffman[j]); - } - } - } - - if (get_bits_left(&s->gb) < 0) - return AVERROR_INVALIDDATA; - - for (j = base_channel; j < s->prim_channels; j++) { - const uint32_t *scale_table; - int scale_sum, log_size; - - memset(s->scale_factor[j], 0, - s->subband_activity[j] * sizeof(s->scale_factor[0][0][0]) * 2); - - if (s->scalefactor_huffman[j] == 6) { - scale_table = scale_factor_quant7; - log_size = 7; - } else { - scale_table = scale_factor_quant6; - log_size = 6; - } - - /* When huffman coded, only the difference is encoded */ - scale_sum = 0; - - for (k = 0; k < s->subband_activity[j]; k++) { - if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) { - scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); - s->scale_factor[j][k][0] = scale_table[scale_sum]; - } - - if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) { - /* Get second scale factor */ - scale_sum = get_scale(&s->gb, s->scalefactor_huffman[j], scale_sum, log_size); - s->scale_factor[j][k][1] = scale_table[scale_sum]; - } - } - } - - /* Joint subband scale factor codebook select */ - for (j = base_channel; j < s->prim_channels; j++) { - /* Transmitted only if joint subband coding enabled */ - if (s->joint_intensity[j] > 0) - s->joint_huff[j] = get_bits(&s->gb, 3); - } - - if (get_bits_left(&s->gb) < 0) - return AVERROR_INVALIDDATA; - - /* Scale factors for joint subband coding */ - for (j = base_channel; j < s->prim_channels; j++) { - int source_channel; - - /* Transmitted only if joint subband coding enabled */ - if (s->joint_intensity[j] > 0) { - int scale = 0; - source_channel = s->joint_intensity[j] - 1; - - /* When huffman coded, only the difference is encoded - * (is this valid as well for joint scales ???) */ - - for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) { - scale = get_scale(&s->gb, s->joint_huff[j], 64 /* bias */, 7); - s->joint_scale_factor[j][k] = scale; /*joint_scale_table[scale]; */ - } - - if (!(s->debug_flag & 0x02)) { - av_log(s->avctx, AV_LOG_DEBUG, - "Joint stereo coding not supported\n"); - s->debug_flag |= 0x02; - } - } - } - - /* Dynamic range coefficient */ - if (!base_channel && s->dynrange) - s->dynrange_coef = get_bits(&s->gb, 8); - - /* Side information CRC check word */ - if (s->crc_present) { - get_bits(&s->gb, 16); - } - - /* - * Primary audio data arrays - */ - - /* VQ encoded high frequency subbands */ - for (j = base_channel; j < s->prim_channels; j++) - for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) - /* 1 vector -> 32 samples */ - s->high_freq_vq[j][k] = get_bits(&s->gb, 10); - - /* Low frequency effect data */ - if (!base_channel && s->lfe) { - int quant7; - /* LFE samples */ - int lfe_samples = 2 * s->lfe * (4 + block_index); - int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); - float lfe_scale; - - for (j = lfe_samples; j < lfe_end_sample; j++) { - /* Signed 8 bits int */ - s->lfe_data[j] = get_sbits(&s->gb, 8); - } - - /* Scale factor index */ - quant7 = get_bits(&s->gb, 8); - if (quant7 > 127) { - avpriv_request_sample(s->avctx, "LFEScaleIndex larger than 127"); - return AVERROR_INVALIDDATA; - } - s->lfe_scale_factor = scale_factor_quant7[quant7]; - - /* Quantization step size * scale factor */ - lfe_scale = 0.035 * s->lfe_scale_factor; - - for (j = lfe_samples; j < lfe_end_sample; j++) - s->lfe_data[j] *= lfe_scale; - } - -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "subsubframes: %i\n", - s->subsubframes[s->current_subframe]); - av_log(s->avctx, AV_LOG_DEBUG, "partial samples: %i\n", - s->partial_samples[s->current_subframe]); - - for (j = base_channel; j < s->prim_channels; j++) { - av_log(s->avctx, AV_LOG_DEBUG, "prediction mode:"); - for (k = 0; k < s->subband_activity[j]; k++) - av_log(s->avctx, AV_LOG_DEBUG, " %i", s->prediction_mode[j][k]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - for (j = base_channel; j < s->prim_channels; j++) { - for (k = 0; k < s->subband_activity[j]; k++) - av_log(s->avctx, AV_LOG_DEBUG, - "prediction coefs: %f, %f, %f, %f\n", - (float) adpcm_vb[s->prediction_vq[j][k]][0] / 8192, - (float) adpcm_vb[s->prediction_vq[j][k]][1] / 8192, - (float) adpcm_vb[s->prediction_vq[j][k]][2] / 8192, - (float) adpcm_vb[s->prediction_vq[j][k]][3] / 8192); - } - for (j = base_channel; j < s->prim_channels; j++) { - av_log(s->avctx, AV_LOG_DEBUG, "bitalloc index: "); - for (k = 0; k < s->vq_start_subband[j]; k++) - av_log(s->avctx, AV_LOG_DEBUG, "%2.2i ", s->bitalloc[j][k]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - for (j = base_channel; j < s->prim_channels; j++) { - av_log(s->avctx, AV_LOG_DEBUG, "Transition mode:"); - for (k = 0; k < s->subband_activity[j]; k++) - av_log(s->avctx, AV_LOG_DEBUG, " %i", s->transition_mode[j][k]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - for (j = base_channel; j < s->prim_channels; j++) { - av_log(s->avctx, AV_LOG_DEBUG, "Scale factor:"); - for (k = 0; k < s->subband_activity[j]; k++) { - if (k >= s->vq_start_subband[j] || s->bitalloc[j][k] > 0) - av_log(s->avctx, AV_LOG_DEBUG, " %i", s->scale_factor[j][k][0]); - if (k < s->vq_start_subband[j] && s->transition_mode[j][k]) - av_log(s->avctx, AV_LOG_DEBUG, " %i(t)", s->scale_factor[j][k][1]); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - for (j = base_channel; j < s->prim_channels; j++) { - if (s->joint_intensity[j] > 0) { - int source_channel = s->joint_intensity[j] - 1; - av_log(s->avctx, AV_LOG_DEBUG, "Joint scale factor index:\n"); - for (k = s->subband_activity[j]; k < s->subband_activity[source_channel]; k++) - av_log(s->avctx, AV_LOG_DEBUG, " %i", s->joint_scale_factor[j][k]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - } - for (j = base_channel; j < s->prim_channels; j++) - for (k = s->vq_start_subband[j]; k < s->subband_activity[j]; k++) - av_log(s->avctx, AV_LOG_DEBUG, "VQ index: %i\n", s->high_freq_vq[j][k]); - if (!base_channel && s->lfe) { - int lfe_samples = 2 * s->lfe * (4 + block_index); - int lfe_end_sample = 2 * s->lfe * (4 + block_index + s->subsubframes[s->current_subframe]); - - av_log(s->avctx, AV_LOG_DEBUG, "LFE samples:\n"); - for (j = lfe_samples; j < lfe_end_sample; j++) - av_log(s->avctx, AV_LOG_DEBUG, " %f", s->lfe_data[j]); - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } -#endif - - return 0; -} - -static void qmf_32_subbands(DCAContext *s, int chans, - float samples_in[32][8], float *samples_out, - float scale) -{ - const float *prCoeff; - - int sb_act = s->subband_activity[chans]; - - scale *= sqrt(1 / 8.0); - - /* Select filter */ - if (!s->multirate_inter) /* Non-perfect reconstruction */ - prCoeff = fir_32bands_nonperfect; - else /* Perfect reconstruction */ - prCoeff = fir_32bands_perfect; - - s->dcadsp.qmf_32_subbands(samples_in, sb_act, &s->synth, &s->imdct, - s->subband_fir_hist[chans], - &s->hist_index[chans], - s->subband_fir_noidea[chans], prCoeff, - samples_out, s->raXin, scale); -} - -static void lfe_interpolation_fir(DCAContext *s, int decimation_select, - int num_deci_sample, float *samples_in, - float *samples_out) -{ - /* samples_in: An array holding decimated samples. - * Samples in current subframe starts from samples_in[0], - * while samples_in[-1], samples_in[-2], ..., stores samples - * from last subframe as history. - * - * samples_out: An array holding interpolated samples - */ - - int idx; - const float *prCoeff; - int deciindex; - - /* Select decimation filter */ - if (decimation_select == 1) { - idx = 1; - prCoeff = lfe_fir_128; - } else { - idx = 0; - prCoeff = lfe_fir_64; - } - /* Interpolation */ - for (deciindex = 0; deciindex < num_deci_sample; deciindex++) { - s->dcadsp.lfe_fir[idx](samples_out, samples_in, prCoeff); - samples_in++; - samples_out += 2 * 32 * (1 + idx); - } -} - -/* downmixing routines */ -#define MIX_REAR1(samples, s1, rs, coef) \ - samples[0][i] += samples[s1][i] * coef[rs][0]; \ - samples[1][i] += samples[s1][i] * coef[rs][1]; - -#define MIX_REAR2(samples, s1, s2, rs, coef) \ - samples[0][i] += samples[s1][i] * coef[rs][0] + samples[s2][i] * coef[rs + 1][0]; \ - samples[1][i] += samples[s1][i] * coef[rs][1] + samples[s2][i] * coef[rs + 1][1]; - -#define MIX_FRONT3(samples, coef) \ - t = samples[c][i]; \ - u = samples[l][i]; \ - v = samples[r][i]; \ - samples[0][i] = t * coef[0][0] + u * coef[1][0] + v * coef[2][0]; \ - samples[1][i] = t * coef[0][1] + u * coef[1][1] + v * coef[2][1]; - -#define DOWNMIX_TO_STEREO(op1, op2) \ - for (i = 0; i < 256; i++) { \ - op1 \ - op2 \ - } - -static void dca_downmix(float **samples, int srcfmt, int lfe_present, - float coef[DCA_PRIM_CHANNELS_MAX + 1][2], - const int8_t *channel_mapping) -{ - int c, l, r, sl, sr, s; - int i; - float t, u, v; - - switch (srcfmt) { - case DCA_MONO: - case DCA_4F2R: - av_log(NULL, AV_LOG_ERROR, "Not implemented!\n"); - break; - case DCA_CHANNEL: - case DCA_STEREO: - case DCA_STEREO_TOTAL: - case DCA_STEREO_SUMDIFF: - break; - case DCA_3F: - c = channel_mapping[0]; - l = channel_mapping[1]; - r = channel_mapping[2]; - DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), ); - break; - case DCA_2F1R: - s = channel_mapping[2]; - DOWNMIX_TO_STEREO(MIX_REAR1(samples, s, 2, coef), ); - break; - case DCA_3F1R: - c = channel_mapping[0]; - l = channel_mapping[1]; - r = channel_mapping[2]; - s = channel_mapping[3]; - DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), - MIX_REAR1(samples, s, 3, coef)); - break; - case DCA_2F2R: - sl = channel_mapping[2]; - sr = channel_mapping[3]; - DOWNMIX_TO_STEREO(MIX_REAR2(samples, sl, sr, 2, coef), ); - break; - case DCA_3F2R: - c = channel_mapping[0]; - l = channel_mapping[1]; - r = channel_mapping[2]; - sl = channel_mapping[3]; - sr = channel_mapping[4]; - DOWNMIX_TO_STEREO(MIX_FRONT3(samples, coef), - MIX_REAR2(samples, sl, sr, 3, coef)); - break; - } - if (lfe_present) { - int lf_buf = dca_lfe_index[srcfmt]; - int lf_idx = dca_channels [srcfmt]; - for (i = 0; i < 256; i++) { - samples[0][i] += samples[lf_buf][i] * coef[lf_idx][0]; - samples[1][i] += samples[lf_buf][i] * coef[lf_idx][1]; - } - } -} - - -#ifndef decode_blockcodes -/* Very compact version of the block code decoder that does not use table - * look-up but is slightly slower */ -static int decode_blockcode(int code, int levels, int32_t *values) -{ - int i; - int offset = (levels - 1) >> 1; - - for (i = 0; i < 4; i++) { - int div = FASTDIV(code, levels); - values[i] = code - offset - div * levels; - code = div; - } - - return code; -} - -static int decode_blockcodes(int code1, int code2, int levels, int32_t *values) -{ - return decode_blockcode(code1, levels, values) | - decode_blockcode(code2, levels, values + 4); -} -#endif - -static const uint8_t abits_sizes[7] = { 7, 10, 12, 13, 15, 17, 19 }; -static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; - -static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) -{ - int k, l; - int subsubframe = s->current_subsubframe; - - const float *quant_step_table; - - /* FIXME */ - float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index]; - LOCAL_ALIGNED_16(int32_t, block, [8 * DCA_SUBBANDS]); - - /* - * Audio data - */ - - /* Select quantization step size table */ - if (s->bit_rate_index == 0x1f) - quant_step_table = lossless_quant_d; - else - quant_step_table = lossy_quant_d; - - for (k = base_channel; k < s->prim_channels; k++) { - float rscale[DCA_SUBBANDS]; - - if (get_bits_left(&s->gb) < 0) - return AVERROR_INVALIDDATA; - - for (l = 0; l < s->vq_start_subband[k]; l++) { - int m; - - /* Select the mid-tread linear quantizer */ - int abits = s->bitalloc[k][l]; - - float quant_step_size = quant_step_table[abits]; - - /* - * Determine quantization index code book and its type - */ - - /* Select quantization index code book */ - int sel = s->quant_index_huffman[k][abits]; - - /* - * Extract bits from the bit stream - */ - if (!abits) { - rscale[l] = 0; - memset(block + 8 * l, 0, 8 * sizeof(block[0])); - } else { - /* Deal with transients */ - int sfi = s->transition_mode[k][l] && subsubframe >= s->transition_mode[k][l]; - rscale[l] = quant_step_size * s->scale_factor[k][l][sfi] * - s->scalefactor_adj[k][sel]; - - if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) { - if (abits <= 7) { - /* Block code */ - int block_code1, block_code2, size, levels, err; - - size = abits_sizes[abits - 1]; - levels = abits_levels[abits - 1]; - - block_code1 = get_bits(&s->gb, size); - block_code2 = get_bits(&s->gb, size); - err = decode_blockcodes(block_code1, block_code2, - levels, block + 8 * l); - if (err) { - av_log(s->avctx, AV_LOG_ERROR, - "ERROR: block code look-up failed\n"); - return AVERROR_INVALIDDATA; - } - } else { - /* no coding */ - for (m = 0; m < 8; m++) - block[8 * l + m] = get_sbits(&s->gb, abits - 3); - } - } else { - /* Huffman coded */ - for (m = 0; m < 8; m++) - block[8 * l + m] = get_bitalloc(&s->gb, - &dca_smpl_bitalloc[abits], sel); - } - - } - } - - s->fmt_conv.int32_to_float_fmul_array8(&s->fmt_conv, subband_samples[k][0], - block, rscale, 8 * s->vq_start_subband[k]); - - for (l = 0; l < s->vq_start_subband[k]; l++) { - int m; - /* - * Inverse ADPCM if in prediction mode - */ - if (s->prediction_mode[k][l]) { - int n; - if (s->predictor_history) - subband_samples[k][l][0] += (adpcm_vb[s->prediction_vq[k][l]][0] * - s->subband_samples_hist[k][l][3] + - adpcm_vb[s->prediction_vq[k][l]][1] * - s->subband_samples_hist[k][l][2] + - adpcm_vb[s->prediction_vq[k][l]][2] * - s->subband_samples_hist[k][l][1] + - adpcm_vb[s->prediction_vq[k][l]][3] * - s->subband_samples_hist[k][l][0]) * - (1.0f / 8192); - for (m = 1; m < 8; m++) { - float sum = adpcm_vb[s->prediction_vq[k][l]][0] * - subband_samples[k][l][m - 1]; - for (n = 2; n <= 4; n++) - if (m >= n) - sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] * - subband_samples[k][l][m - n]; - else if (s->predictor_history) - sum += adpcm_vb[s->prediction_vq[k][l]][n - 1] * - s->subband_samples_hist[k][l][m - n + 4]; - subband_samples[k][l][m] += sum * (1.0f / 8192); - } - } - } - - /* - * Decode VQ encoded high frequencies - */ - if (s->subband_activity[k] > s->vq_start_subband[k]) { - if (!s->debug_flag & 0x01) { - av_log(s->avctx, AV_LOG_DEBUG, - "Stream with high frequencies VQ coding\n"); - s->debug_flag |= 0x01; - } - s->dcadsp.decode_hf(subband_samples[k], s->high_freq_vq[k], - high_freq_vq, subsubframe * 8, - s->scale_factor[k], s->vq_start_subband[k], - s->subband_activity[k]); - } - } - - /* Check for DSYNC after subsubframe */ - if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) { - if (0xFFFF == get_bits(&s->gb, 16)) { /* 0xFFFF */ -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n"); -#endif - } else { - av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n"); - return AVERROR_INVALIDDATA; - } - } - - /* Backup predictor history for adpcm */ - for (k = base_channel; k < s->prim_channels; k++) - for (l = 0; l < s->vq_start_subband[k]; l++) - AV_COPY128(s->subband_samples_hist[k][l], &subband_samples[k][l][4]); - - return 0; -} - -static int dca_filter_channels(DCAContext *s, int block_index) -{ - float (*subband_samples)[DCA_SUBBANDS][8] = s->subband_samples[block_index]; - int k; - int request_channels; - - /* 32 subbands QMF */ - for (k = 0; k < s->prim_channels; k++) { -/* static float pcm_to_double[8] = { 32768.0, 32768.0, 524288.0, 524288.0, - 0, 8388608.0, 8388608.0 };*/ - if (s->channel_order_tab[k] >= 0) - qmf_32_subbands(s, k, subband_samples[k], - s->samples_chanptr[s->channel_order_tab[k]], - M_SQRT1_2 / 32768.0 /* pcm_to_double[s->source_pcm_res] */); - } - - /* Generate LFE samples for this subsubframe FIXME!!! */ - if (s->lfe) { - lfe_interpolation_fir(s, s->lfe, 2 * s->lfe, - s->lfe_data + 2 * s->lfe * (block_index + 4), - s->samples_chanptr[s->lfe_index]); - /* Outputs 20bits pcm samples */ - } - - /* Downmixing to Stereo */ - if (s->prim_channels + !!s->lfe > 2 && - s->avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { - dca_downmix(s->samples_chanptr, s->amode, !!s->lfe, s->downmix_coef, - s->channel_order_tab); - } - - return 0; -} - - -static int dca_subframe_footer(DCAContext *s, int base_channel) -{ - int in, out, aux_data_count, aux_data_end, reserved; - uint32_t nsyncaux; - - /* - * Unpack optional information - */ - - /* presumably optional information only appears in the core? */ - if (!base_channel) { - if (s->timestamp) - skip_bits_long(&s->gb, 32); - - if (s->aux_data) { - aux_data_count = get_bits(&s->gb, 6); - - // align (32-bit) - skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); - - aux_data_end = 8 * aux_data_count + get_bits_count(&s->gb); - - if ((nsyncaux = get_bits_long(&s->gb, 32)) != DCA_NSYNCAUX) { - av_log(s->avctx, AV_LOG_ERROR, "nSYNCAUX mismatch %#"PRIx32"\n", - nsyncaux); - return AVERROR_INVALIDDATA; - } - - if (get_bits1(&s->gb)) { // bAUXTimeStampFlag - avpriv_request_sample(s->avctx, - "Auxiliary Decode Time Stamp Flag"); - // align (4-bit) - skip_bits(&s->gb, (-get_bits_count(&s->gb)) & 4); - // 44 bits: nMSByte (8), nMarker (4), nLSByte (28), nMarker (4) - skip_bits_long(&s->gb, 44); - } - - if ((s->core_downmix = get_bits1(&s->gb))) { - int am = get_bits(&s->gb, 3); - switch (am) { - case 0: - s->core_downmix_amode = DCA_MONO; - break; - case 1: - s->core_downmix_amode = DCA_STEREO; - break; - case 2: - s->core_downmix_amode = DCA_STEREO_TOTAL; - break; - case 3: - s->core_downmix_amode = DCA_3F; - break; - case 4: - s->core_downmix_amode = DCA_2F1R; - break; - case 5: - s->core_downmix_amode = DCA_2F2R; - break; - case 6: - s->core_downmix_amode = DCA_3F1R; - break; - default: - av_log(s->avctx, AV_LOG_ERROR, - "Invalid mode %d for embedded downmix coefficients\n", - am); - return AVERROR_INVALIDDATA; - } - for (out = 0; out < dca_channels[s->core_downmix_amode]; out++) { - for (in = 0; in < s->prim_channels + !!s->lfe; in++) { - uint16_t tmp = get_bits(&s->gb, 9); - if ((tmp & 0xFF) > 241) { - av_log(s->avctx, AV_LOG_ERROR, - "Invalid downmix coefficient code %"PRIu16"\n", - tmp); - return AVERROR_INVALIDDATA; - } - s->core_downmix_codes[in][out] = tmp; - } - } - } - - align_get_bits(&s->gb); // byte align - skip_bits(&s->gb, 16); // nAUXCRC16 - - // additional data (reserved, cf. ETSI TS 102 114 V1.4.1) - if ((reserved = (aux_data_end - get_bits_count(&s->gb))) < 0) { - av_log(s->avctx, AV_LOG_ERROR, - "Overread auxiliary data by %d bits\n", -reserved); - return AVERROR_INVALIDDATA; - } else if (reserved) { - avpriv_request_sample(s->avctx, - "Core auxiliary data reserved content"); - skip_bits_long(&s->gb, reserved); - } - } - - if (s->crc_present && s->dynrange) - get_bits(&s->gb, 16); - } - - return 0; -} - -/** - * Decode a dca frame block - * - * @param s pointer to the DCAContext - */ - -static int dca_decode_block(DCAContext *s, int base_channel, int block_index) -{ - int ret; - - /* Sanity check */ - if (s->current_subframe >= s->subframes) { - av_log(s->avctx, AV_LOG_DEBUG, "check failed: %i>%i", - s->current_subframe, s->subframes); - return AVERROR_INVALIDDATA; - } - - if (!s->current_subsubframe) { -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_header\n"); -#endif - /* Read subframe header */ - if ((ret = dca_subframe_header(s, base_channel, block_index))) - return ret; - } - - /* Read subsubframe */ -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n"); -#endif - if ((ret = dca_subsubframe(s, base_channel, block_index))) - return ret; - - /* Update state */ - s->current_subsubframe++; - if (s->current_subsubframe >= s->subsubframes[s->current_subframe]) { - s->current_subsubframe = 0; - s->current_subframe++; - } - if (s->current_subframe >= s->subframes) { -#ifdef TRACE - av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subframe_footer\n"); -#endif - /* Read subframe footer */ - if ((ret = dca_subframe_footer(s, base_channel))) - return ret; - } - - return 0; -} - -/** - * Return the number of channels in an ExSS speaker mask (HD) - */ -static int dca_exss_mask2count(int mask) -{ - /* count bits that mean speaker pairs twice */ - return av_popcount(mask) + - av_popcount(mask & (DCA_EXSS_CENTER_LEFT_RIGHT | - DCA_EXSS_FRONT_LEFT_RIGHT | - DCA_EXSS_FRONT_HIGH_LEFT_RIGHT | - DCA_EXSS_WIDE_LEFT_RIGHT | - DCA_EXSS_SIDE_LEFT_RIGHT | - DCA_EXSS_SIDE_HIGH_LEFT_RIGHT | - DCA_EXSS_SIDE_REAR_LEFT_RIGHT | - DCA_EXSS_REAR_LEFT_RIGHT | - DCA_EXSS_REAR_HIGH_LEFT_RIGHT)); -} - -/** - * Skip mixing coefficients of a single mix out configuration (HD) - */ -static void dca_exss_skip_mix_coeffs(GetBitContext *gb, int channels, int out_ch) -{ - int i; - - for (i = 0; i < channels; i++) { - int mix_map_mask = get_bits(gb, out_ch); - int num_coeffs = av_popcount(mix_map_mask); - skip_bits_long(gb, num_coeffs * 6); - } -} - -/** - * Parse extension substream asset header (HD) - */ -static int dca_exss_parse_asset_header(DCAContext *s) -{ - int header_pos = get_bits_count(&s->gb); - int header_size; - int channels = 0; - int embedded_stereo = 0; - int embedded_6ch = 0; - int drc_code_present; - int av_uninit(extensions_mask); - int i, j; - - if (get_bits_left(&s->gb) < 16) - return -1; - - /* We will parse just enough to get to the extensions bitmask with which - * we can set the profile value. */ - - header_size = get_bits(&s->gb, 9) + 1; - skip_bits(&s->gb, 3); // asset index - - if (s->static_fields) { - if (get_bits1(&s->gb)) - skip_bits(&s->gb, 4); // asset type descriptor - if (get_bits1(&s->gb)) - skip_bits_long(&s->gb, 24); // language descriptor - - if (get_bits1(&s->gb)) { - /* How can one fit 1024 bytes of text here if the maximum value - * for the asset header size field above was 512 bytes? */ - int text_length = get_bits(&s->gb, 10) + 1; - if (get_bits_left(&s->gb) < text_length * 8) - return -1; - skip_bits_long(&s->gb, text_length * 8); // info text - } - - skip_bits(&s->gb, 5); // bit resolution - 1 - skip_bits(&s->gb, 4); // max sample rate code - channels = get_bits(&s->gb, 8) + 1; - - if (get_bits1(&s->gb)) { // 1-to-1 channels to speakers - int spkr_remap_sets; - int spkr_mask_size = 16; - int num_spkrs[7]; - - if (channels > 2) - embedded_stereo = get_bits1(&s->gb); - if (channels > 6) - embedded_6ch = get_bits1(&s->gb); - - if (get_bits1(&s->gb)) { - spkr_mask_size = (get_bits(&s->gb, 2) + 1) << 2; - skip_bits(&s->gb, spkr_mask_size); // spkr activity mask - } - - spkr_remap_sets = get_bits(&s->gb, 3); - - for (i = 0; i < spkr_remap_sets; i++) { - /* std layout mask for each remap set */ - num_spkrs[i] = dca_exss_mask2count(get_bits(&s->gb, spkr_mask_size)); - } - - for (i = 0; i < spkr_remap_sets; i++) { - int num_dec_ch_remaps = get_bits(&s->gb, 5) + 1; - if (get_bits_left(&s->gb) < 0) - return -1; - - for (j = 0; j < num_spkrs[i]; j++) { - int remap_dec_ch_mask = get_bits_long(&s->gb, num_dec_ch_remaps); - int num_dec_ch = av_popcount(remap_dec_ch_mask); - skip_bits_long(&s->gb, num_dec_ch * 5); // remap codes - } - } - - } else { - skip_bits(&s->gb, 3); // representation type - } - } - - drc_code_present = get_bits1(&s->gb); - if (drc_code_present) - get_bits(&s->gb, 8); // drc code - - if (get_bits1(&s->gb)) - skip_bits(&s->gb, 5); // dialog normalization code - - if (drc_code_present && embedded_stereo) - get_bits(&s->gb, 8); // drc stereo code - - if (s->mix_metadata && get_bits1(&s->gb)) { - skip_bits(&s->gb, 1); // external mix - skip_bits(&s->gb, 6); // post mix gain code - - if (get_bits(&s->gb, 2) != 3) // mixer drc code - skip_bits(&s->gb, 3); // drc limit - else - skip_bits(&s->gb, 8); // custom drc code - - if (get_bits1(&s->gb)) // channel specific scaling - for (i = 0; i < s->num_mix_configs; i++) - skip_bits_long(&s->gb, s->mix_config_num_ch[i] * 6); // scale codes - else - skip_bits_long(&s->gb, s->num_mix_configs * 6); // scale codes - - for (i = 0; i < s->num_mix_configs; i++) { - if (get_bits_left(&s->gb) < 0) - return -1; - dca_exss_skip_mix_coeffs(&s->gb, channels, s->mix_config_num_ch[i]); - if (embedded_6ch) - dca_exss_skip_mix_coeffs(&s->gb, 6, s->mix_config_num_ch[i]); - if (embedded_stereo) - dca_exss_skip_mix_coeffs(&s->gb, 2, s->mix_config_num_ch[i]); - } - } - - switch (get_bits(&s->gb, 2)) { - case 0: extensions_mask = get_bits(&s->gb, 12); break; - case 1: extensions_mask = DCA_EXT_EXSS_XLL; break; - case 2: extensions_mask = DCA_EXT_EXSS_LBR; break; - case 3: extensions_mask = 0; /* aux coding */ break; - } - - /* not parsed further, we were only interested in the extensions mask */ - - if (get_bits_left(&s->gb) < 0) - return -1; - - if (get_bits_count(&s->gb) - header_pos > header_size * 8) { - av_log(s->avctx, AV_LOG_WARNING, "Asset header size mismatch.\n"); - return -1; - } - skip_bits_long(&s->gb, header_pos + header_size * 8 - get_bits_count(&s->gb)); - - if (extensions_mask & DCA_EXT_EXSS_XLL) - s->profile = FF_PROFILE_DTS_HD_MA; - else if (extensions_mask & (DCA_EXT_EXSS_XBR | DCA_EXT_EXSS_X96 | - DCA_EXT_EXSS_XXCH)) - s->profile = FF_PROFILE_DTS_HD_HRA; - - if (!(extensions_mask & DCA_EXT_CORE)) - av_log(s->avctx, AV_LOG_WARNING, "DTS core detection mismatch.\n"); - if ((extensions_mask & DCA_CORE_EXTS) != s->core_ext_mask) - av_log(s->avctx, AV_LOG_WARNING, - "DTS extensions detection mismatch (%d, %d)\n", - extensions_mask & DCA_CORE_EXTS, s->core_ext_mask); - - return 0; -} - -static int dca_xbr_parse_frame(DCAContext *s) -{ - int scale_table_high[DCA_CHSET_CHANS_MAX][DCA_SUBBANDS][2]; - int active_bands[DCA_CHSETS_MAX][DCA_CHSET_CHANS_MAX]; - int abits_high[DCA_CHSET_CHANS_MAX][DCA_SUBBANDS]; - int anctemp[DCA_CHSET_CHANS_MAX]; - int chset_fsize[DCA_CHSETS_MAX]; - int n_xbr_ch[DCA_CHSETS_MAX]; - int hdr_size, num_chsets, xbr_tmode, hdr_pos; - int i, j, k, l, chset, chan_base; - - av_log(s->avctx, AV_LOG_DEBUG, "DTS-XBR: decoding XBR extension\n"); - - /* get bit position of sync header */ - hdr_pos = get_bits_count(&s->gb) - 32; - - hdr_size = get_bits(&s->gb, 6) + 1; - num_chsets = get_bits(&s->gb, 2) + 1; - - for(i = 0; i < num_chsets; i++) - chset_fsize[i] = get_bits(&s->gb, 14) + 1; - - xbr_tmode = get_bits1(&s->gb); - - for(i = 0; i < num_chsets; i++) { - n_xbr_ch[i] = get_bits(&s->gb, 3) + 1; - k = get_bits(&s->gb, 2) + 5; - for(j = 0; j < n_xbr_ch[i]; j++) - active_bands[i][j] = get_bits(&s->gb, k) + 1; - } - - /* skip to the end of the header */ - i = get_bits_count(&s->gb); - if(hdr_pos + hdr_size * 8 > i) - skip_bits_long(&s->gb, hdr_pos + hdr_size * 8 - i); - - /* loop over the channel data sets */ - /* only decode as many channels as we've decoded base data for */ - for(chset = 0, chan_base = 0; - chset < num_chsets && chan_base + n_xbr_ch[chset] <= s->prim_channels; - chan_base += n_xbr_ch[chset++]) { - int start_posn = get_bits_count(&s->gb); - int subsubframe = 0; - int subframe = 0; - - /* loop over subframes */ - for (k = 0; k < (s->sample_blocks / 8); k++) { - /* parse header if we're on first subsubframe of a block */ - if(subsubframe == 0) { - /* Parse subframe header */ - for(i = 0; i < n_xbr_ch[chset]; i++) { - anctemp[i] = get_bits(&s->gb, 2) + 2; - } - - for(i = 0; i < n_xbr_ch[chset]; i++) { - get_array(&s->gb, abits_high[i], active_bands[chset][i], anctemp[i]); - } - - for(i = 0; i < n_xbr_ch[chset]; i++) { - anctemp[i] = get_bits(&s->gb, 3); - if(anctemp[i] < 1) { - av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: SYNC ERROR\n"); - return AVERROR_INVALIDDATA; - } - } - - /* generate scale factors */ - for(i = 0; i < n_xbr_ch[chset]; i++) { - const uint32_t *scale_table; - int nbits; - - if (s->scalefactor_huffman[chan_base+i] == 6) { - scale_table = scale_factor_quant7; - } else { - scale_table = scale_factor_quant6; - } - - nbits = anctemp[i]; - - for(j = 0; j < active_bands[chset][i]; j++) { - if(abits_high[i][j] > 0) { - scale_table_high[i][j][0] = - scale_table[get_bits(&s->gb, nbits)]; - - if(xbr_tmode && s->transition_mode[i][j]) { - scale_table_high[i][j][1] = - scale_table[get_bits(&s->gb, nbits)]; - } - } - } - } - } - - /* decode audio array for this block */ - for(i = 0; i < n_xbr_ch[chset]; i++) { - for(j = 0; j < active_bands[chset][i]; j++) { - const int xbr_abits = abits_high[i][j]; - const float quant_step_size = lossless_quant_d[xbr_abits]; - const int sfi = xbr_tmode && s->transition_mode[i][j] && subsubframe >= s->transition_mode[i][j]; - const float rscale = quant_step_size * scale_table_high[i][j][sfi]; - float *subband_samples = s->subband_samples[k][chan_base+i][j]; - int block[8]; - - if(xbr_abits <= 0) - continue; - - if(xbr_abits > 7) { - get_array(&s->gb, block, 8, xbr_abits - 3); - } else { - int block_code1, block_code2, size, levels, err; - - size = abits_sizes[xbr_abits - 1]; - levels = abits_levels[xbr_abits - 1]; - - block_code1 = get_bits(&s->gb, size); - block_code2 = get_bits(&s->gb, size); - err = decode_blockcodes(block_code1, block_code2, - levels, block); - if (err) { - av_log(s->avctx, AV_LOG_ERROR, - "ERROR: DTS-XBR: block code look-up failed\n"); - return AVERROR_INVALIDDATA; - } - } - - /* scale & sum into subband */ - for(l = 0; l < 8; l++) - subband_samples[l] += (float)block[l] * rscale; - } - } - - /* check DSYNC marker */ - if(s->aspf || subsubframe == s->subsubframes[subframe] - 1) { - if(get_bits(&s->gb, 16) != 0xffff) { - av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: Didn't get subframe DSYNC\n"); - return AVERROR_INVALIDDATA; - } - } - - /* advance sub-sub-frame index */ - if(++subsubframe >= s->subsubframes[subframe]) { - subsubframe = 0; - subframe++; - } - } - - /* skip to next channel set */ - i = get_bits_count(&s->gb); - if(start_posn + chset_fsize[chset] * 8 != i) { - j = start_posn + chset_fsize[chset] * 8 - i; - if(j < 0 || j >= 8) - av_log(s->avctx, AV_LOG_ERROR, "DTS-XBR: end of channel set," - " skipping further than expected (%d bits)\n", j); - skip_bits_long(&s->gb, j); - } - } - - return 0; -} - -/* parse initial header for XXCH and dump details */ -static int dca_xxch_decode_frame(DCAContext *s) -{ - int hdr_size, spkmsk_bits, num_chsets, core_spk, hdr_pos; - int i, chset, base_channel, chstart, fsize[8]; - - /* assume header word has already been parsed */ - hdr_pos = get_bits_count(&s->gb) - 32; - hdr_size = get_bits(&s->gb, 6) + 1; - /*chhdr_crc =*/ skip_bits1(&s->gb); - spkmsk_bits = get_bits(&s->gb, 5) + 1; - num_chsets = get_bits(&s->gb, 2) + 1; - - for (i = 0; i < num_chsets; i++) - fsize[i] = get_bits(&s->gb, 14) + 1; - - core_spk = get_bits(&s->gb, spkmsk_bits); - s->xxch_core_spkmask = core_spk; - s->xxch_nbits_spk_mask = spkmsk_bits; - s->xxch_dmix_embedded = 0; - - /* skip to the end of the header */ - i = get_bits_count(&s->gb); - if (hdr_pos + hdr_size * 8 > i) - skip_bits_long(&s->gb, hdr_pos + hdr_size * 8 - i); - - for (chset = 0; chset < num_chsets; chset++) { - chstart = get_bits_count(&s->gb); - base_channel = s->prim_channels; - s->xxch_chset = chset; - - /* XXCH and Core headers differ, see 6.4.2 "XXCH Channel Set Header" vs. - 5.3.2 "Primary Audio Coding Header", DTS Spec 1.3.1 */ - dca_parse_audio_coding_header(s, base_channel, 1); - - /* decode channel data */ - for (i = 0; i < (s->sample_blocks / 8); i++) { - if (dca_decode_block(s, base_channel, i)) { - av_log(s->avctx, AV_LOG_ERROR, - "Error decoding DTS-XXCH extension\n"); - continue; - } - } - - /* skip to end of this section */ - i = get_bits_count(&s->gb); - if (chstart + fsize[chset] * 8 > i) - skip_bits_long(&s->gb, chstart + fsize[chset] * 8 - i); - } - s->xxch_chset = num_chsets; - - return 0; -} - -/** - * Parse extension substream header (HD) - */ -static void dca_exss_parse_header(DCAContext *s) -{ - int asset_size[8]; - int ss_index; - int blownup; - int num_audiop = 1; - int num_assets = 1; - int active_ss_mask[8]; - int i, j; - int start_posn; - int hdrsize; - uint32_t mkr; - - if (get_bits_left(&s->gb) < 52) - return; - - start_posn = get_bits_count(&s->gb) - 32; - - skip_bits(&s->gb, 8); // user data - ss_index = get_bits(&s->gb, 2); - - blownup = get_bits1(&s->gb); - hdrsize = get_bits(&s->gb, 8 + 4 * blownup) + 1; // header_size - skip_bits(&s->gb, 16 + 4 * blownup); // hd_size - - s->static_fields = get_bits1(&s->gb); - if (s->static_fields) { - skip_bits(&s->gb, 2); // reference clock code - skip_bits(&s->gb, 3); // frame duration code - - if (get_bits1(&s->gb)) - skip_bits_long(&s->gb, 36); // timestamp - - /* a single stream can contain multiple audio assets that can be - * combined to form multiple audio presentations */ - - num_audiop = get_bits(&s->gb, 3) + 1; - if (num_audiop > 1) { - avpriv_request_sample(s->avctx, - "Multiple DTS-HD audio presentations"); - /* ignore such streams for now */ - return; - } - - num_assets = get_bits(&s->gb, 3) + 1; - if (num_assets > 1) { - avpriv_request_sample(s->avctx, "Multiple DTS-HD audio assets"); - /* ignore such streams for now */ - return; - } - - for (i = 0; i < num_audiop; i++) - active_ss_mask[i] = get_bits(&s->gb, ss_index + 1); - - for (i = 0; i < num_audiop; i++) - for (j = 0; j <= ss_index; j++) - if (active_ss_mask[i] & (1 << j)) - skip_bits(&s->gb, 8); // active asset mask - - s->mix_metadata = get_bits1(&s->gb); - if (s->mix_metadata) { - int mix_out_mask_size; - - skip_bits(&s->gb, 2); // adjustment level - mix_out_mask_size = (get_bits(&s->gb, 2) + 1) << 2; - s->num_mix_configs = get_bits(&s->gb, 2) + 1; - - for (i = 0; i < s->num_mix_configs; i++) { - int mix_out_mask = get_bits(&s->gb, mix_out_mask_size); - s->mix_config_num_ch[i] = dca_exss_mask2count(mix_out_mask); - } - } - } - - for (i = 0; i < num_assets; i++) - asset_size[i] = get_bits_long(&s->gb, 16 + 4 * blownup); - - for (i = 0; i < num_assets; i++) { - if (dca_exss_parse_asset_header(s)) - return; - } - - /* not parsed further, we were only interested in the extensions mask - * from the asset header */ - - if (num_assets > 0) { - j = get_bits_count(&s->gb); - if (start_posn + hdrsize * 8 > j) - skip_bits_long(&s->gb, start_posn + hdrsize * 8 - j); - - for (i = 0; i < num_assets; i++) { - start_posn = get_bits_count(&s->gb); - mkr = get_bits_long(&s->gb, 32); - - /* parse extensions that we know about */ - if (mkr == 0x655e315e) { - dca_xbr_parse_frame(s); - } else if (mkr == 0x47004a03) { - dca_xxch_decode_frame(s); - s->core_ext_mask |= DCA_EXT_XXCH; /* xxx use for chan reordering */ - } else { - av_log(s->avctx, AV_LOG_DEBUG, - "DTS-ExSS: unknown marker = 0x%08x\n", mkr); - } - - /* skip to end of block */ - j = get_bits_count(&s->gb); - if (start_posn + asset_size[i] * 8 > j) - skip_bits_long(&s->gb, start_posn + asset_size[i] * 8 - j); - } - } -} - -/** - * Main frame decoding function - * FIXME add arguments - */ -static int dca_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int channel_mask; - int channel_layout; - int lfe_samples; - int num_core_channels = 0; - int i, ret; - float **samples_flt; - float *src_chan; - float *dst_chan; - DCAContext *s = avctx->priv_data; - int core_ss_end; - int channels, full_channels; - int request_channels; - float scale; - int achan; - int chset; - int mask; - int lavc; - int posn; - int j, k; - int endch; - - s->xch_present = 0; - - s->dca_buffer_size = ff_dca_convert_bitstream(buf, buf_size, s->dca_buffer, - DCA_MAX_FRAME_SIZE + DCA_MAX_EXSS_HEADER_SIZE); - if (s->dca_buffer_size == AVERROR_INVALIDDATA) { - av_log(avctx, AV_LOG_ERROR, "Not a valid DCA frame\n"); - return AVERROR_INVALIDDATA; - } - - init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); - if ((ret = dca_parse_frame_header(s)) < 0) { - //seems like the frame is corrupt, try with the next one - return ret; - } - //set AVCodec values with parsed data - avctx->sample_rate = s->sample_rate; - avctx->bit_rate = s->bit_rate; - - s->profile = FF_PROFILE_DTS; - - for (i = 0; i < (s->sample_blocks / 8); i++) { - if ((ret = dca_decode_block(s, 0, i))) { - av_log(avctx, AV_LOG_ERROR, "error decoding block\n"); - return ret; - } - } - - /* record number of core channels incase less than max channels are requested */ - num_core_channels = s->prim_channels; - - if (s->prim_channels + !!s->lfe > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { - /* Stereo downmix coefficients - * - * The decoder can only downmix to 2-channel, so we need to ensure - * embedded downmix coefficients are actually targeting 2-channel. - */ - if (s->core_downmix && (s->core_downmix_amode == DCA_STEREO || - s->core_downmix_amode == DCA_STEREO_TOTAL)) { - int sign, code; - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { - sign = s->core_downmix_codes[i][0] & 0x100 ? 1 : -1; - code = s->core_downmix_codes[i][0] & 0x0FF; - s->downmix_coef[i][0] = (!code ? 0.0f : - sign * dca_dmixtable[code - 1]); - sign = s->core_downmix_codes[i][1] & 0x100 ? 1 : -1; - code = s->core_downmix_codes[i][1] & 0x0FF; - s->downmix_coef[i][1] = (!code ? 0.0f : - sign * dca_dmixtable[code - 1]); - } - s->output = s->core_downmix_amode; - } else { - int am = s->amode & DCA_CHANNEL_MASK; - if (am >= FF_ARRAY_ELEMS(dca_default_coeffs)) { - av_log(s->avctx, AV_LOG_ERROR, - "Invalid channel mode %d\n", am); - return AVERROR_INVALIDDATA; - } - if (s->prim_channels + !!s->lfe > - FF_ARRAY_ELEMS(dca_default_coeffs[0])) { - avpriv_request_sample(s->avctx, "Downmixing %d channels", - s->prim_channels + !!s->lfe); - return AVERROR_PATCHWELCOME; - } - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { - s->downmix_coef[i][0] = dca_default_coeffs[am][i][0]; - s->downmix_coef[i][1] = dca_default_coeffs[am][i][1]; - } - } - av_dlog(s->avctx, "Stereo downmix coeffs:\n"); - for (i = 0; i < s->prim_channels + !!s->lfe; i++) { - av_dlog(s->avctx, "L, input channel %d = %f\n", i, - s->downmix_coef[i][0]); - av_dlog(s->avctx, "R, input channel %d = %f\n", i, - s->downmix_coef[i][1]); - } - av_dlog(s->avctx, "\n"); - } - - if (s->ext_coding) - s->core_ext_mask = dca_ext_audio_descr_mask[s->ext_descr]; - else - s->core_ext_mask = 0; - - core_ss_end = FFMIN(s->frame_size, s->dca_buffer_size) * 8; - - /* only scan for extensions if ext_descr was unknown or indicated a - * supported XCh extension */ - if (s->core_ext_mask < 0 || s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) { - - /* if ext_descr was unknown, clear s->core_ext_mask so that the - * extensions scan can fill it up */ - s->core_ext_mask = FFMAX(s->core_ext_mask, 0); - - /* extensions start at 32-bit boundaries into bitstream */ - skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); - - while (core_ss_end - get_bits_count(&s->gb) >= 32) { - uint32_t bits = get_bits_long(&s->gb, 32); - - switch (bits) { - case 0x5a5a5a5a: { - int ext_amode, xch_fsize; - - s->xch_base_channel = s->prim_channels; - - /* validate sync word using XCHFSIZE field */ - xch_fsize = show_bits(&s->gb, 10); - if ((s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize) && - (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + xch_fsize + 1)) - continue; - - /* skip length-to-end-of-frame field for the moment */ - skip_bits(&s->gb, 10); - - s->core_ext_mask |= DCA_EXT_XCH; - - /* extension amode(number of channels in extension) should be 1 */ - /* AFAIK XCh is not used for more channels */ - if ((ext_amode = get_bits(&s->gb, 4)) != 1) { - av_log(avctx, AV_LOG_ERROR, "XCh extension amode %d not" - " supported!\n", ext_amode); - continue; - } - - if (s->xch_base_channel < 2) { - avpriv_request_sample(avctx, "XCh with fewer than 2 base channels"); - continue; - } - - /* much like core primary audio coding header */ - dca_parse_audio_coding_header(s, s->xch_base_channel, 0); - - for (i = 0; i < (s->sample_blocks / 8); i++) - if ((ret = dca_decode_block(s, s->xch_base_channel, i))) { - av_log(avctx, AV_LOG_ERROR, "error decoding XCh extension\n"); - continue; - } - - s->xch_present = 1; - break; - } - case 0x47004a03: - /* XXCh: extended channels */ - /* usually found either in core or HD part in DTS-HD HRA streams, - * but not in DTS-ES which contains XCh extensions instead */ - s->core_ext_mask |= DCA_EXT_XXCH; - dca_xxch_decode_frame(s); - break; - - case 0x1d95f262: { - int fsize96 = show_bits(&s->gb, 12) + 1; - if (s->frame_size != (get_bits_count(&s->gb) >> 3) - 4 + fsize96) - continue; - - av_log(avctx, AV_LOG_DEBUG, "X96 extension found at %d bits\n", - get_bits_count(&s->gb)); - skip_bits(&s->gb, 12); - av_log(avctx, AV_LOG_DEBUG, "FSIZE96 = %d bytes\n", fsize96); - av_log(avctx, AV_LOG_DEBUG, "REVNO = %d\n", get_bits(&s->gb, 4)); - - s->core_ext_mask |= DCA_EXT_X96; - break; - } - } - - skip_bits_long(&s->gb, (-get_bits_count(&s->gb)) & 31); - } - } else { - /* no supported extensions, skip the rest of the core substream */ - skip_bits_long(&s->gb, core_ss_end - get_bits_count(&s->gb)); - } - - if (s->core_ext_mask & DCA_EXT_X96) - s->profile = FF_PROFILE_DTS_96_24; - else if (s->core_ext_mask & (DCA_EXT_XCH | DCA_EXT_XXCH)) - s->profile = FF_PROFILE_DTS_ES; - - /* check for ExSS (HD part) */ - if (s->dca_buffer_size - s->frame_size > 32 && - get_bits_long(&s->gb, 32) == DCA_HD_MARKER) - dca_exss_parse_header(s); - - avctx->profile = s->profile; - - full_channels = channels = s->prim_channels + !!s->lfe; - - /* If we have XXCH then the channel layout is managed differently */ - /* note that XLL will also have another way to do things */ - if (!(s->core_ext_mask & DCA_EXT_XXCH) - || (s->core_ext_mask & DCA_EXT_XXCH && avctx->request_channels > 0 - && avctx->request_channels - < num_core_channels + !!s->lfe + s->xxch_chset_nch[0])) - { /* xxx should also do MA extensions */ - if (s->amode < 16) { - avctx->channel_layout = dca_core_channel_layout[s->amode]; -#if FF_API_REQUEST_CHANNELS -FF_DISABLE_DEPRECATION_WARNINGS - if (s->xch_present && !s->xch_disable && - (!avctx->request_channels || - avctx->request_channels > num_core_channels + !!s->lfe)) { -FF_ENABLE_DEPRECATION_WARNINGS -#else - if (s->xch_present && !s->xch_disable) { -#endif - avctx->channel_layout |= AV_CH_BACK_CENTER; - if (s->lfe) { - avctx->channel_layout |= AV_CH_LOW_FREQUENCY; - s->channel_order_tab = dca_channel_reorder_lfe_xch[s->amode]; - } else { - s->channel_order_tab = dca_channel_reorder_nolfe_xch[s->amode]; - } - if (s->channel_order_tab[s->xch_base_channel] < 0) - return AVERROR_INVALIDDATA; - } else { - channels = num_core_channels + !!s->lfe; - s->xch_present = 0; /* disable further xch processing */ - if (s->lfe) { - avctx->channel_layout |= AV_CH_LOW_FREQUENCY; - s->channel_order_tab = dca_channel_reorder_lfe[s->amode]; - } else - s->channel_order_tab = dca_channel_reorder_nolfe[s->amode]; - } - - if (channels > !!s->lfe && - s->channel_order_tab[channels - 1 - !!s->lfe] < 0) - return AVERROR_INVALIDDATA; - - if (av_get_channel_layout_nb_channels(avctx->channel_layout) != channels) { - av_log(avctx, AV_LOG_ERROR, "Number of channels %d mismatches layout %d\n", channels, av_get_channel_layout_nb_channels(avctx->channel_layout)); - return AVERROR_INVALIDDATA; - } - - if (s->prim_channels + !!s->lfe > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) { - channels = 2; - s->output = s->prim_channels == 2 ? s->amode : DCA_STEREO; - avctx->channel_layout = AV_CH_LAYOUT_STEREO; - } - else if (avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE) { - static const int8_t dca_channel_order_native[9] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; - s->channel_order_tab = dca_channel_order_native; - } - s->lfe_index = dca_lfe_index[s->amode]; - } else { - av_log(avctx, AV_LOG_ERROR, - "Non standard configuration %d !\n", s->amode); - return AVERROR_INVALIDDATA; - } - - s->xxch_dmix_embedded = 0; - } else { - /* we only get here if an XXCH channel set can be added to the mix */ - channel_mask = s->xxch_core_spkmask; - - if (request_channels > 0 - && request_channels < s->prim_channels) { - channels = num_core_channels + !!s->lfe; - for (i = 0; i < s->xxch_chset && channels + s->xxch_chset_nch[i] - <= request_channels; i++) { - channels += s->xxch_chset_nch[i]; - channel_mask |= s->xxch_spk_masks[i]; - } - } else { - channels = s->prim_channels + !!s->lfe; - for (i = 0; i < s->xxch_chset; i++) { - channel_mask |= s->xxch_spk_masks[i]; - } - } - - /* Given the DTS spec'ed channel mask, generate an avcodec version */ - channel_layout = 0; - for (i = 0; i < s->xxch_nbits_spk_mask; ++i) { - if (channel_mask & (1 << i)) { - channel_layout |= map_xxch_to_native[i]; - } - } - - /* make sure that we have managed to get equivelant dts/avcodec channel - * masks in some sense -- unfortunately some channels could overlap */ - if (av_popcount(channel_mask) != av_popcount(channel_layout)) { - av_log(avctx, AV_LOG_DEBUG, - "DTS-XXCH: Inconsistent avcodec/dts channel layouts\n"); - return AVERROR_INVALIDDATA; - } - - avctx->channel_layout = channel_layout; - - if (!(avctx->request_channel_layout & AV_CH_LAYOUT_NATIVE)) { - /* Estimate DTS --> avcodec ordering table */ - for (chset = -1, j = 0; chset < s->xxch_chset; ++chset) { - mask = chset >= 0 ? s->xxch_spk_masks[chset] - : s->xxch_core_spkmask; - for (i = 0; i < s->xxch_nbits_spk_mask; i++) { - if (mask & ~(DCA_XXCH_LFE1 | DCA_XXCH_LFE2) & (1 << i)) { - lavc = map_xxch_to_native[i]; - posn = av_popcount(channel_layout & (lavc - 1)); - s->xxch_order_tab[j++] = posn; - } - } - } - - s->lfe_index = av_popcount(channel_layout & (AV_CH_LOW_FREQUENCY-1)); - } else { /* native ordering */ - for (i = 0; i < channels; i++) - s->xxch_order_tab[i] = i; - - s->lfe_index = channels - 1; - } - - s->channel_order_tab = s->xxch_order_tab; - } - - if (avctx->channels != channels) { - if (avctx->channels) - av_log(avctx, AV_LOG_INFO, "Number of channels changed in DCA decoder (%d -> %d)\n", avctx->channels, channels); - avctx->channels = channels; - } - - /* get output buffer */ - frame->nb_samples = 256 * (s->sample_blocks / 8); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples_flt = (float **)frame->extended_data; - - /* allocate buffer for extra channels if downmixing */ - if (avctx->channels < full_channels) { - ret = av_samples_get_buffer_size(NULL, full_channels - channels, - frame->nb_samples, - avctx->sample_fmt, 0); - if (ret < 0) - return ret; - - av_fast_malloc(&s->extra_channels_buffer, - &s->extra_channels_buffer_size, ret); - if (!s->extra_channels_buffer) - return AVERROR(ENOMEM); - - ret = av_samples_fill_arrays((uint8_t **)s->extra_channels, NULL, - s->extra_channels_buffer, - full_channels - channels, - frame->nb_samples, avctx->sample_fmt, 0); - if (ret < 0) - return ret; - } - - /* filter to get final output */ - for (i = 0; i < (s->sample_blocks / 8); i++) { - int ch; - - for (ch = 0; ch < channels; ch++) - s->samples_chanptr[ch] = samples_flt[ch] + i * 256; - for (; ch < full_channels; ch++) - s->samples_chanptr[ch] = s->extra_channels[ch - channels] + i * 256; - - dca_filter_channels(s, i); - - /* If this was marked as a DTS-ES stream we need to subtract back- */ - /* channel from SL & SR to remove matrixed back-channel signal */ - if ((s->source_pcm_res & 1) && s->xch_present) { - float *back_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel]]; - float *lt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 2]]; - float *rt_chan = s->samples_chanptr[s->channel_order_tab[s->xch_base_channel - 1]]; - s->fdsp.vector_fmac_scalar(lt_chan, back_chan, -M_SQRT1_2, 256); - s->fdsp.vector_fmac_scalar(rt_chan, back_chan, -M_SQRT1_2, 256); - } - - /* If stream contains XXCH, we might need to undo an embedded downmix */ - if (s->xxch_dmix_embedded) { - /* Loop over channel sets in turn */ - ch = num_core_channels; - for (chset = 0; chset < s->xxch_chset; chset++) { - endch = ch + s->xxch_chset_nch[chset]; - mask = s->xxch_dmix_embedded; - - /* undo downmix */ - for (j = ch; j < endch; j++) { - if (mask & (1 << j)) { /* this channel has been mixed-out */ - src_chan = s->samples_chanptr[s->channel_order_tab[j]]; - for (k = 0; k < endch; k++) { - achan = s->channel_order_tab[k]; - scale = s->xxch_dmix_coeff[j][k]; - if (scale != 0.0) { - dst_chan = s->samples_chanptr[achan]; - s->fdsp.vector_fmac_scalar(dst_chan, src_chan, - -scale, 256); - } - } - } - } - - /* if a downmix has been embedded then undo the pre-scaling */ - if ((mask & (1 << ch)) && s->xxch_dmix_sf[chset] != 1.0f) { - scale = s->xxch_dmix_sf[chset]; - - for (j = 0; j < ch; j++) { - src_chan = s->samples_chanptr[s->channel_order_tab[j]]; - for (k = 0; k < 256; k++) - src_chan[k] *= scale; - } - - /* LFE channel is always part of core, scale if it exists */ - if (s->lfe) { - src_chan = s->samples_chanptr[s->lfe_index]; - for (k = 0; k < 256; k++) - src_chan[k] *= scale; - } - } - - ch = endch; - } - - } - } - - /* update lfe history */ - lfe_samples = 2 * s->lfe * (s->sample_blocks / 8); - for (i = 0; i < 2 * s->lfe * 4; i++) - s->lfe_data[i] = s->lfe_data[i + lfe_samples]; - - /* AVMatrixEncoding - * - * DCA_STEREO_TOTAL (Lt/Rt) is equivalent to Dolby Surround */ - ret = ff_side_data_update_matrix_encoding(frame, - (s->output & ~DCA_LFE) == DCA_STEREO_TOTAL ? - AV_MATRIX_ENCODING_DOLBY : AV_MATRIX_ENCODING_NONE); - if (ret < 0) - return ret; - - *got_frame_ptr = 1; - - return buf_size; -} - - - -/** - * DCA initialization - * - * @param avctx pointer to the AVCodecContext - */ - -static av_cold int dca_decode_init(AVCodecContext *avctx) -{ - DCAContext *s = avctx->priv_data; - int request_channels; - - s->avctx = avctx; - dca_init_vlcs(); - - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - ff_mdct_init(&s->imdct, 6, 1, 1.0); - ff_synth_filter_init(&s->synth); - ff_dcadsp_init(&s->dcadsp); - ff_fmt_convert_init(&s->fmt_conv, avctx); - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - /* allow downmixing to stereo */ -#if FF_API_REQUEST_CHANNELS -FF_DISABLE_DEPRECATION_WARNINGS - if (avctx->request_channels == 2) - avctx->request_channel_layout = AV_CH_LAYOUT_STEREO; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (avctx->channels > 2 && - avctx->request_channel_layout == AV_CH_LAYOUT_STEREO) - avctx->channels = 2; - - return 0; -} - -static av_cold int dca_decode_end(AVCodecContext *avctx) -{ - DCAContext *s = avctx->priv_data; - ff_mdct_end(&s->imdct); - av_freep(&s->extra_channels_buffer); - return 0; -} - -static const AVProfile profiles[] = { - { FF_PROFILE_DTS, "DTS" }, - { FF_PROFILE_DTS_ES, "DTS-ES" }, - { FF_PROFILE_DTS_96_24, "DTS 96/24" }, - { FF_PROFILE_DTS_HD_HRA, "DTS-HD HRA" }, - { FF_PROFILE_DTS_HD_MA, "DTS-HD MA" }, - { FF_PROFILE_UNKNOWN }, -}; - -static const AVOption options[] = { - { "disable_xch", "disable decoding of the XCh extension", offsetof(DCAContext, xch_disable), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_AUDIO_PARAM }, - { NULL }, -}; - -static const AVClass dca_decoder_class = { - .class_name = "DCA decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, - .category = AV_CLASS_CATEGORY_DECODER, -}; - -AVCodec ff_dca_decoder = { - .name = "dca", - .long_name = NULL_IF_CONFIG_SMALL("DCA (DTS Coherent Acoustics)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_DTS, - .priv_data_size = sizeof(DCAContext), - .init = dca_decode_init, - .decode = dca_decode_frame, - .close = dca_decode_end, - .capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, - .profiles = NULL_IF_CONFIG_SMALL(profiles), - .priv_class = &dca_decoder_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.c deleted file mode 100644 index 7d5044298..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2004 Gildas Bazin - * Copyright (c) 2010 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/intreadwrite.h" -#include "dcadsp.h" - -static void decode_hf_c(float dst[DCA_SUBBANDS][8], - const int32_t vq_num[DCA_SUBBANDS], - const int8_t hf_vq[1024][32], intptr_t vq_offset, - int32_t scale[DCA_SUBBANDS][2], - intptr_t start, intptr_t end) -{ - int i, l; - - for (l = start; l < end; l++) { - /* 1 vector -> 32 samples but we only need the 8 samples - * for this subsubframe. */ - const int8_t *ptr = &hf_vq[vq_num[l]][vq_offset]; - float fscale = scale[l][0] * (1 / 16.0); - for (i = 0; i < 8; i++) - dst[l][i] = ptr[i] * fscale; - } -} - -static inline void -dca_lfe_fir(float *out, const float *in, const float *coefs, - int decifactor) -{ - float *out2 = out + 2 * decifactor - 1; - int num_coeffs = 256 / decifactor; - int j, k; - - /* One decimated sample generates 2*decifactor interpolated ones */ - for (k = 0; k < decifactor; k++) { - float v0 = 0.0; - float v1 = 0.0; - for (j = 0; j < num_coeffs; j++, coefs++) { - v0 += in[-j] * *coefs; - v1 += in[j + 1 - num_coeffs] * *coefs; - } - *out++ = v0; - *out2-- = v1; - } -} - -static void dca_qmf_32_subbands(float samples_in[32][8], int sb_act, - SynthFilterContext *synth, FFTContext *imdct, - float synth_buf_ptr[512], - int *synth_buf_offset, float synth_buf2[32], - const float window[512], float *samples_out, - float raXin[32], float scale) -{ - int i; - int subindex; - - for (i = sb_act; i < 32; i++) - raXin[i] = 0.0; - - /* Reconstructed channel sample index */ - for (subindex = 0; subindex < 8; subindex++) { - /* Load in one sample from each subband and clear inactive subbands */ - for (i = 0; i < sb_act; i++) { - unsigned sign = (i - 1) & 2; - uint32_t v = AV_RN32A(&samples_in[i][subindex]) ^ sign << 30; - AV_WN32A(&raXin[i], v); - } - - synth->synth_filter_float(imdct, synth_buf_ptr, synth_buf_offset, - synth_buf2, window, samples_out, raXin, scale); - samples_out += 32; - } -} - -static void dca_lfe_fir0_c(float *out, const float *in, const float *coefs) -{ - dca_lfe_fir(out, in, coefs, 32); -} - -static void dca_lfe_fir1_c(float *out, const float *in, const float *coefs) -{ - dca_lfe_fir(out, in, coefs, 64); -} - -av_cold void ff_dcadsp_init(DCADSPContext *s) -{ - s->lfe_fir[0] = dca_lfe_fir0_c; - s->lfe_fir[1] = dca_lfe_fir1_c; - s->qmf_32_subbands = dca_qmf_32_subbands; - s->decode_hf = decode_hf_c; - if (ARCH_ARM) ff_dcadsp_init_arm(s); - if (ARCH_X86) ff_dcadsp_init_x86(s); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.h deleted file mode 100644 index abf577b61..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcadsp.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCADSP_H -#define AVCODEC_DCADSP_H - -#include "avfft.h" -#include "synth_filter.h" - -#define DCA_SUBBANDS 64 - -typedef struct DCADSPContext { - void (*lfe_fir[2])(float *out, const float *in, const float *coefs); - void (*qmf_32_subbands)(float samples_in[32][8], int sb_act, - SynthFilterContext *synth, FFTContext *imdct, - float synth_buf_ptr[512], - int *synth_buf_offset, float synth_buf2[32], - const float window[512], float *samples_out, - float raXin[32], float scale); - void (*decode_hf)(float dst[DCA_SUBBANDS][8], - const int32_t vq_num[DCA_SUBBANDS], - const int8_t hf_vq[1024][32], intptr_t vq_offset, - int32_t scale[DCA_SUBBANDS][2], - intptr_t start, intptr_t end); -} DCADSPContext; - -void ff_dcadsp_init(DCADSPContext *s); -void ff_dcadsp_init_arm(DCADSPContext *s); -void ff_dcadsp_init_x86(DCADSPContext *s); - -#endif /* AVCODEC_DCADSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcahuff.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcahuff.h deleted file mode 100644 index cbc8429e5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dcahuff.h +++ /dev/null @@ -1,1076 +0,0 @@ -/* - * DCA compatible decoder - huffman tables - * Copyright (C) 2004 Gildas Bazin - * Copyright (C) 2007 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCAHUFF_H -#define AVCODEC_DCAHUFF_H - -#include -#include - -#define TMODE_COUNT 4 -static const uint8_t tmode_vlc_bits[TMODE_COUNT] = { 3, 3, 3, 2 }; -static const uint16_t tmode_codes[TMODE_COUNT][4] = { - { 0x0000, 0x0002, 0x0006, 0x0007 }, - { 0x0002, 0x0006, 0x0007, 0x0000 }, - { 0x0006, 0x0007, 0x0000, 0x0002 }, - { 0x0000, 0x0001, 0x0002, 0x0003 } -}; -static const uint8_t tmode_bits[TMODE_COUNT][4] = { - { 1, 2, 3, 3 }, - { 2, 3, 3, 1 }, - { 3, 3, 1, 2 }, - { 2, 2, 2, 2 } -}; - - -#define BITALLOC_12_COUNT 5 -#define BITALLOC_12_VLC_BITS 9 -static const uint8_t bitalloc_12_vlc_bits[BITALLOC_12_COUNT] = { - 9, 7, 7, 9, 9 -}; -static const uint16_t bitalloc_12_codes[BITALLOC_12_COUNT][12] = { - { - 0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E, 0x00FF, 0x00FE, - 0x01FB, 0x01FA, 0x01F9, 0x01F8, - }, - { - 0x0001, 0x0000, 0x0002, 0x000F, 0x000C, 0x001D, 0x0039, 0x0038, - 0x0037, 0x0036, 0x0035, 0x0034, - }, - { - 0x0000, 0x0007, 0x0005, 0x0004, 0x0002, 0x000D, 0x000C, 0x0006, - 0x000F, 0x001D, 0x0039, 0x0038, - }, - { - 0x0003, 0x0002, 0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E, - 0x007E, 0x00FE, 0x01FF, 0x01FE, - }, - { - 0x0001, 0x0000, 0x0002, 0x0006, 0x000E, 0x003F, 0x003D, 0x007C, - 0x0079, 0x0078, 0x00FB, 0x00FA, - } -}; -static const uint8_t bitalloc_12_bits[BITALLOC_12_COUNT][12] = { - { 1, 2, 3, 4, 5, 6, 8, 8, 9, 9, 9, 9 }, - { 1, 2, 3, 5, 5, 6, 7, 7, 7, 7, 7, 7 }, - { 2, 3, 3, 3, 3, 4, 4, 4, 5, 6, 7, 7 }, - { 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10 }, - { 1, 2, 3, 4, 5, 7, 7, 8, 8, 8, 9, 9 } -}; - - -#define SCALES_COUNT 5 -#define SCALES_VLC_BITS 9 -static const uint16_t scales_codes[SCALES_COUNT][129] = { - { - 0x3AB0, 0x3AB2, 0x3AB4, 0x3AB6, 0x3AB8, 0x3ABA, 0x3ABC, 0x3ABE, - 0x3AC0, 0x3AC2, 0x3AC4, 0x3AC6, 0x3AC8, 0x3ACA, 0x3ACC, 0x3ACE, - 0x3AD0, 0x3AD2, 0x3AD4, 0x3AD6, 0x3AD8, 0x3ADA, 0x3ADC, 0x3ADE, - 0x3AE0, 0x3AE2, 0x3AE4, 0x3AE6, 0x3AE8, 0x3AEA, 0x3AEC, 0x3AEE, - 0x3AF0, 0x3AF2, 0x3AF4, 0x3AF6, 0x3AF8, 0x3AFA, 0x3AFC, 0x3AFE, - 0x0540, 0x0542, 0x0544, 0x0546, 0x0548, 0x054A, 0x054C, 0x054E, - 0x0558, 0x055E, 0x02AD, 0x0154, 0x0754, 0x03A8, 0x0056, 0x0028, - 0x00E8, 0x004A, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005, - 0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x004B, - 0x00E9, 0x0029, 0x0057, 0x03A9, 0x0755, 0x0155, 0x02AE, 0x055F, - 0x0559, 0x054F, 0x054D, 0x054B, 0x0549, 0x0547, 0x0545, 0x0543, - 0x0541, 0x3AFF, 0x3AFD, 0x3AFB, 0x3AF9, 0x3AF7, 0x3AF5, 0x3AF3, - 0x3AF1, 0x3AEF, 0x3AED, 0x3AEB, 0x3AE9, 0x3AE7, 0x3AE5, 0x3AE3, - 0x3AE1, 0x3ADF, 0x3ADD, 0x3ADB, 0x3AD9, 0x3AD7, 0x3AD5, 0x3AD3, - 0x3AD1, 0x3ACF, 0x3ACD, 0x3ACB, 0x3AC9, 0x3AC7, 0x3AC5, 0x3AC3, - 0x3AC1, 0x3ABF, 0x3ABD, 0x3ABB, 0x3AB9, 0x3AB7, 0x3AB5, 0x3AB3, - 0x3AB1, - }, - { - 0x0F60, 0x0F62, 0x0F64, 0x0F66, 0x0F68, 0x0F6A, 0x0F6C, 0x0F6E, - 0x0F70, 0x0F72, 0x0F74, 0x0F76, 0x0F78, 0x0F7A, 0x0F7C, 0x0F7E, - 0x0F80, 0x0F82, 0x0F84, 0x0F86, 0x0F88, 0x0F8A, 0x0F8C, 0x0F8E, - 0x0F90, 0x0F92, 0x0F94, 0x0F96, 0x0F98, 0x0F9A, 0x0F9C, 0x0F9E, - 0x0FA0, 0x0FA2, 0x0FA4, 0x0FA6, 0x0FA8, 0x0FAA, 0x0FAC, 0x0FAE, - 0x0FB0, 0x0FB2, 0x0FB4, 0x0FB6, 0x0FB8, 0x0FBA, 0x0FBC, 0x0FBE, - 0x07A0, 0x07A2, 0x03D2, 0x01EA, 0x00FC, 0x007F, 0x001C, 0x000C, - 0x0004, 0x0034, 0x0010, 0x001B, 0x0009, 0x000B, 0x000E, 0x0001, - 0x0003, 0x0002, 0x000F, 0x000C, 0x000A, 0x0000, 0x0011, 0x0035, - 0x0005, 0x000D, 0x001D, 0x003C, 0x00FD, 0x01EB, 0x03D3, 0x07A3, - 0x07A1, 0x0FBF, 0x0FBD, 0x0FBB, 0x0FB9, 0x0FB7, 0x0FB5, 0x0FB3, - 0x0FB1, 0x0FAF, 0x0FAD, 0x0FAB, 0x0FA9, 0x0FA7, 0x0FA5, 0x0FA3, - 0x0FA1, 0x0F9F, 0x0F9D, 0x0F9B, 0x0F99, 0x0F97, 0x0F95, 0x0F93, - 0x0F91, 0x0F8F, 0x0F8D, 0x0F8B, 0x0F89, 0x0F87, 0x0F85, 0x0F83, - 0x0F81, 0x0F7F, 0x0F7D, 0x0F7B, 0x0F79, 0x0F77, 0x0F75, 0x0F73, - 0x0F71, 0x0F6F, 0x0F6D, 0x0F6B, 0x0F69, 0x0F67, 0x0F65, 0x0F63, - 0x0F61, - }, - { - 0x51D0, 0x51D2, 0x51D4, 0x51D6, 0x51D8, 0x51DA, 0x51DC, 0x51DE, - 0x51E0, 0x51E2, 0x51E4, 0x51E6, 0x51E8, 0x51EA, 0x51EC, 0x51EE, - 0x51F0, 0x51F2, 0x51F4, 0x51F6, 0x51F8, 0x51FA, 0x51FC, 0x51FE, - 0x70C0, 0x70C2, 0x70C4, 0x70C6, 0x70C8, 0x70CA, 0x70CC, 0x70CE, - 0x70EC, 0x10EA, 0x3868, 0x3877, 0x0876, 0x1C35, 0x0434, 0x0A34, - 0x0E1B, 0x021B, 0x051B, 0x070F, 0x010F, 0x0380, 0x0080, 0x0140, - 0x01C1, 0x0041, 0x00A1, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012, - 0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000, - 0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B, - 0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A2, 0x0042, - 0x01C2, 0x0141, 0x0081, 0x0381, 0x028C, 0x010C, 0x051C, 0x021C, - 0x0E1C, 0x0A35, 0x0435, 0x1C3A, 0x0877, 0x0874, 0x3869, 0x10EB, - 0x70ED, 0x70CF, 0x70CD, 0x70CB, 0x70C9, 0x70C7, 0x70C5, 0x70C3, - 0x70C1, 0x51FF, 0x51FD, 0x51FB, 0x51F9, 0x51F7, 0x51F5, 0x51F3, - 0x51F1, 0x51EF, 0x51ED, 0x51EB, 0x51E9, 0x51E7, 0x51E5, 0x51E3, - 0x51E1, 0x51DF, 0x51DD, 0x51DB, 0x51D9, 0x51D7, 0x51D5, 0x51D3, - 0x51D1, - }, - { - 0x6F64, 0x6F66, 0x6F68, 0x6F6A, 0x6F6C, 0x6F6E, 0x6F70, 0x6F72, - 0x6F74, 0x6F76, 0x6F78, 0x6F7A, 0x6F7C, 0x6F7E, 0x6F80, 0x6F82, - 0x6F84, 0x6F86, 0x6F88, 0x6F8A, 0x6F8C, 0x6F8E, 0x6F90, 0x6F92, - 0x6F94, 0x6F96, 0x6F98, 0x6F9A, 0x6F9C, 0x6F9E, 0x6FA0, 0x6FA2, - 0x6FA4, 0x6FA6, 0x6FA8, 0x6FAA, 0x6FAC, 0x6FAE, 0x6FB0, 0x6FB2, - 0x6FB4, 0x6FB6, 0x17B4, 0x37DC, 0x0BDB, 0x1BEF, 0x05EE, 0x0DF8, - 0x02F8, 0x06FD, 0x017D, 0x037F, 0x00BF, 0x0040, 0x00C0, 0x0021, - 0x0061, 0x0011, 0x0031, 0x0009, 0x0019, 0x0006, 0x000E, 0x0004, - 0x0000, 0x0005, 0x000F, 0x0007, 0x001A, 0x000A, 0x0036, 0x0016, - 0x006E, 0x002E, 0x00C1, 0x0041, 0x01BC, 0x00BC, 0x037A, 0x017A, - 0x02F9, 0x0DF9, 0x05EF, 0x05EC, 0x1BD8, 0x37DD, 0x17B5, 0x6FB7, - 0x6FB5, 0x6FB3, 0x6FB1, 0x6FAF, 0x6FAD, 0x6FAB, 0x6FA9, 0x6FA7, - 0x6FA5, 0x6FA3, 0x6FA1, 0x6F9F, 0x6F9D, 0x6F9B, 0x6F99, 0x6F97, - 0x6F95, 0x6F93, 0x6F91, 0x6F8F, 0x6F8D, 0x6F8B, 0x6F89, 0x6F87, - 0x6F85, 0x6F83, 0x6F81, 0x6F7F, 0x6F7D, 0x6F7B, 0x6F79, 0x6F77, - 0x6F75, 0x6F73, 0x6F71, 0x6F6F, 0x6F6D, 0x6F6B, 0x6F69, 0x6F67, - 0x6F65, - }, - { - 0xDF54, 0xDF56, 0xDFC8, 0xDFCA, 0xDFCC, 0xDFCE, 0xDFD0, 0xDFD2, - 0xDFD4, 0xDFD6, 0xDFD8, 0xDFDA, 0xDFDC, 0xDFDE, 0xDFE0, 0xDFE2, - 0x0FE8, 0x2FEA, 0x6FA8, 0x6FF6, 0x07F5, 0x07F7, 0x37D2, 0x37F9, - 0x03F8, 0x0BF8, 0x0BFB, 0x1BEB, 0x01FA, 0x05FA, 0x09FA, 0x0DFA, - 0x0DFF, 0x00FF, 0x02FF, 0x06FB, 0x007C, 0x017C, 0x027C, 0x027F, - 0x003C, 0x00BC, 0x013C, 0x01BC, 0x001C, 0x005C, 0x009C, 0x00DC, - 0x000C, 0x002C, 0x004C, 0x006C, 0x0004, 0x0014, 0x0024, 0x0034, - 0x0000, 0x0008, 0x0010, 0x0018, 0x001E, 0x0002, 0x0006, 0x000A, - 0x000E, 0x000B, 0x0007, 0x0003, 0x001F, 0x0019, 0x0011, 0x0009, - 0x0001, 0x0035, 0x0025, 0x0015, 0x0005, 0x006D, 0x004D, 0x002D, - 0x000D, 0x00DD, 0x009D, 0x005D, 0x001D, 0x01BD, 0x013D, 0x00BD, - 0x003D, 0x037C, 0x027D, 0x017D, 0x007D, 0x06FC, 0x04FC, 0x02FC, - 0x00FC, 0x0DFB, 0x09FB, 0x05FB, 0x01FB, 0x1BF8, 0x1BE8, 0x0BF9, - 0x03F9, 0x37FA, 0x37D3, 0x17F4, 0x07F6, 0x6FF7, 0x6FA9, 0x2FEB, - 0x0FE9, 0xDFE3, 0xDFE1, 0xDFDF, 0xDFDD, 0xDFDB, 0xDFD9, 0xDFD7, - 0xDFD5, 0xDFD3, 0xDFD1, 0xDFCF, 0xDFCD, 0xDFCB, 0xDFC9, 0xDF57, - 0xDF55, - } -}; - -static const uint8_t scales_bits[SCALES_COUNT][129] = { - { - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 12, 11, 11, 10, 9, 8, - 8, 7, 6, 6, 5, 4, 4, 3, - 2, 3, 3, 4, 5, 5, 6, 7, - 8, 8, 9, 10, 11, 11, 12, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, - }, - { - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 14, 14, 13, 12, 11, 10, 8, 7, - 6, 6, 5, 5, 4, 4, 4, 3, - 3, 3, 4, 4, 4, 4, 5, 6, - 6, 7, 8, 9, 11, 12, 13, 14, - 14, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, - }, - { - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 14, 14, 14, 13, 13, 12, 12, - 12, 11, 11, 11, 10, 10, 9, 9, - 9, 8, 8, 8, 7, 7, 7, 6, - 6, 6, 5, 5, 5, 4, 4, 3, - 3, 3, 4, 4, 5, 5, 5, 6, - 6, 6, 7, 7, 7, 8, 8, 8, - 9, 9, 9, 10, 10, 10, 11, 11, - 12, 12, 12, 13, 13, 13, 14, 14, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, - }, - { - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 14, 14, 13, 13, 12, 12, - 11, 11, 10, 10, 9, 8, 8, 7, - 7, 6, 6, 5, 5, 4, 4, 3, - 2, 3, 4, 4, 5, 5, 6, 6, - 7, 7, 8, 8, 9, 9, 10, 10, - 11, 12, 12, 12, 13, 14, 14, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, - }, - { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 15, 15, 15, 15, 14, 14, 14, 14, - 13, 13, 13, 13, 12, 12, 12, 12, - 12, 11, 11, 11, 10, 10, 10, 10, - 9, 9, 9, 9, 8, 8, 8, 8, - 7, 7, 7, 7, 6, 6, 6, 6, - 5, 5, 5, 5, 5, 4, 4, 4, - 4, 4, 4, 4, 5, 5, 5, 5, - 5, 6, 6, 6, 6, 7, 7, 7, - 7, 8, 8, 8, 8, 9, 9, 9, - 9, 10, 10, 10, 10, 11, 11, 11, - 11, 12, 12, 12, 12, 13, 13, 13, - 13, 14, 14, 14, 14, 15, 15, 15, - 15, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, - } -}; - -static const uint16_t bitalloc_3_codes[3] = -{ - 0x0003, 0x0000, 0x0002, -}; -static const uint8_t bitalloc_3_bits[3] = -{ - 2, 1, 2, -}; - -static const uint16_t bitalloc_5_codes_a[5] = -{ - 0x000F, 0x0006, 0x0000, 0x0002, 0x000E, -}; -static const uint16_t bitalloc_5_codes_b[5] = -{ - 0x0007, 0x0001, 0x0002, 0x0000, 0x0006, -}; -static const uint16_t bitalloc_5_codes_c[5] = -{ - 0x0007, 0x0005, 0x0000, 0x0004, 0x0006, -}; -static const uint8_t bitalloc_5_bits_a[5] = -{ - 4, 3, 1, 2, 4, -}; -static const uint8_t bitalloc_5_bits_b[5] = -{ - 3, 2, 2, 2, 3, -}; -static const uint8_t bitalloc_5_bits_c[5] = -{ - 3, 3, 1, 3, 3, -}; - -static const uint16_t bitalloc_7_codes_a[7] = -{ - 0x001E, 0x000E, 0x0005, 0x0000, 0x0006, 0x0004, 0x001F, -}; -static const uint16_t bitalloc_7_codes_b[7] = -{ - 0x0014, 0x000B, 0x0000, 0x0003, 0x0001, 0x0004, 0x0015, -}; -static const uint16_t bitalloc_7_codes_c[7] = -{ - 0x0000, 0x0002, 0x0001, 0x0003, 0x0002, 0x0003, 0x0001, -}; -static const uint8_t bitalloc_7_bits_a[7] = -{ - 5, 4, 3, 1, 3, 3, 5, -}; -static const uint8_t bitalloc_7_bits_b[7] = -{ - 5, 4, 2, 2, 2, 3, 5, -}; -static const uint8_t bitalloc_7_bits_c[7] = -{ - 4, 4, 2, 2, 2, 4, 4, -}; - -static const uint16_t bitalloc_9_codes_a[9] = -{ - 0x0030, 0x0019, 0x0009, 0x0005, 0x0000, 0x0007, 0x000D, 0x0008, - 0x0031, -}; -static const uint16_t bitalloc_9_codes_b[9] = -{ - 0x0018, 0x001A, 0x0002, 0x0007, 0x0002, 0x0000, 0x0003, 0x001B, - 0x0019, -}; -static const uint16_t bitalloc_9_codes_c[9] = -{ - 0x001C, 0x000F, 0x0002, 0x0007, 0x0002, 0x0000, 0x0006, 0x0006, - 0x001D, -}; -static const uint8_t bitalloc_9_bits_a[9] = -{ - 6, 5, 4, 3, 1, 3, 4, 4, 6, -}; -static const uint8_t bitalloc_9_bits_b[9] = -{ - 5, 5, 3, 3, 2, 2, 3, 5, 5, -}; -static const uint8_t bitalloc_9_bits_c[9] = -{ - 6, 5, 3, 3, 2, 2, 3, 4, 6, -}; - -static const uint16_t bitalloc_13_codes_a[13] = -{ - 0x0070, 0x002E, 0x0039, 0x001D, 0x000C, 0x000F, 0x0000, 0x0004, - 0x000D, 0x000A, 0x0016, 0x002F, 0x0071, -}; -static const uint16_t bitalloc_13_codes_b[13] = -{ - 0x0038, 0x0010, 0x001D, 0x0007, 0x000F, 0x0005, 0x0000, 0x0006, - 0x0002, 0x0009, 0x0006, 0x0011, 0x0039, -}; -static const uint16_t bitalloc_13_codes_c[13] = -{ - 0x0004, 0x001A, 0x0003, 0x000E, 0x0000, 0x0003, 0x0005, 0x0004, - 0x0002, 0x000F, 0x000C, 0x001B, 0x0005, -}; -static const uint8_t bitalloc_13_bits_a[13] = -{ - 7, 6, 6, 5, 4, 4, 1, 3, 4, 4, 5, 6, 7, -}; -static const uint8_t bitalloc_13_bits_b[13] = -{ - 6, 5, 5, 4, 4, 3, 2, 3, 3, 4, 4, 5, 6, -}; -static const uint8_t bitalloc_13_bits_c[13] = -{ - 5, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 5, -}; - -static const uint16_t bitalloc_17_codes_a[17] = -{ - 0x0154, 0x00AB, 0x002B, 0x000B, 0x0003, 0x000A, 0x0001, 0x0006, - 0x0001, 0x0007, 0x0004, 0x000B, 0x0000, 0x0004, 0x0014, 0x0054, - 0x0155, -}; -static const uint16_t bitalloc_17_codes_b[17] = -{ - 0x007C, 0x003F, 0x0019, 0x000D, 0x001C, 0x0008, 0x000F, 0x0005, - 0x0000, 0x0006, 0x0002, 0x0009, 0x001D, 0x000E, 0x001E, 0x0018, - 0x007D, -}; -static const uint16_t bitalloc_17_codes_c[17] = -{ - 0x002C, 0x0017, 0x0005, 0x001C, 0x0003, 0x000A, 0x000F, 0x0003, - 0x0006, 0x0004, 0x0000, 0x000B, 0x0004, 0x001D, 0x000A, 0x0004, - 0x002D, -}; -static const uint16_t bitalloc_17_codes_d[17] = -{ - 0x0100, 0x0102, 0x0082, 0x0042, 0x0022, 0x0012, 0x000A, 0x0006, - 0x0000, 0x0007, 0x000B, 0x0013, 0x0023, 0x0043, 0x0083, 0x0103, - 0x0101, -}; -static const uint16_t bitalloc_17_codes_e[17] = -{ - 0x00E8, 0x00F6, 0x0075, 0x0034, 0x003B, 0x001B, 0x001F, 0x0004, - 0x0000, 0x0005, 0x000C, 0x001C, 0x003C, 0x0035, 0x007A, 0x00F7, - 0x00E9, -}; -static const uint16_t bitalloc_17_codes_f[17] = -{ - 0x0004, 0x0003, 0x001E, 0x0001, 0x0001, 0x000E, 0x0001, 0x0004, - 0x0006, 0x0005, 0x0002, 0x000F, 0x0006, 0x000E, 0x001F, 0x0000, - 0x0005, -}; -static const uint16_t bitalloc_17_codes_g[17] = -{ - 0x0060, 0x007E, 0x0031, 0x0019, 0x000D, 0x0004, 0x0000, 0x0006, - 0x0002, 0x0007, 0x0001, 0x0005, 0x000E, 0x001E, 0x003E, 0x007F, - 0x0061, -}; -static const uint8_t bitalloc_17_bits_a[17] = -{ - 12, 11, 9, 7, 5, 4, 3, 3, 2, 3, 3, 4, 4, 6, 8, 10, - 12, -}; -static const uint8_t bitalloc_17_bits_b[17] = -{ - 8, 7, 6, 5, 5, 4, 4, 3, 2, 3, 3, 4, 5, 5, 6, 6, - 8, -}; -static const uint8_t bitalloc_17_bits_c[17] = -{ - 7, 6, 5, 5, 4, 4, 4, 3, 3, 3, 3, 4, 4, 5, 5, 5, - 7, -}; -static const uint8_t bitalloc_17_bits_d[17] = -{ - 9, 9, 8, 7, 6, 5, 4, 3, 1, 3, 4, 5, 6, 7, 8, 9, - 9, -}; -static const uint8_t bitalloc_17_bits_e[17] = -{ - 8, 8, 7, 6, 6, 5, 5, 3, 1, 3, 4, 5, 6, 6, 7, 8, - 8, -}; -static const uint8_t bitalloc_17_bits_f[17] = -{ - 8, 7, 6, 5, 4, 4, 3, 3, 3, 3, 3, 4, 4, 5, 6, 6, - 8, -}; -static const uint8_t bitalloc_17_bits_g[17] = -{ - 8, 8, 7, 6, 5, 4, 3, 3, 2, 3, 3, 4, 5, 6, 7, 8, - 8, -}; - -static const uint16_t bitalloc_25_codes_a[25] = -{ - 0x2854, 0x142B, 0x050B, 0x0143, 0x00A2, 0x0052, 0x002E, 0x0015, - 0x0004, 0x000E, 0x0000, 0x0003, 0x0006, 0x0004, 0x0001, 0x000F, - 0x0005, 0x0016, 0x002F, 0x0053, 0x00A3, 0x00A0, 0x0284, 0x0A14, - 0x2855, -}; -static const uint16_t bitalloc_25_codes_b[25] = -{ - 0x001C, 0x000F, 0x0005, 0x0000, 0x0030, 0x0036, 0x000E, 0x0019, - 0x0001, 0x0008, 0x000E, 0x0001, 0x0005, 0x0002, 0x000F, 0x0009, - 0x0006, 0x001A, 0x000F, 0x0037, 0x0031, 0x0001, 0x0006, 0x0004, - 0x001D, -}; -static const uint16_t bitalloc_25_codes_c[25] = -{ - 0x004C, 0x0027, 0x006D, 0x0028, 0x0037, 0x000E, 0x0015, 0x0000, - 0x0005, 0x0008, 0x000B, 0x000E, 0x0001, 0x000F, 0x000C, 0x0009, - 0x0006, 0x0001, 0x001A, 0x000F, 0x0008, 0x0029, 0x0012, 0x006C, - 0x004D, -}; -static const uint16_t bitalloc_25_codes_d[25] = -{ - 0x0780, 0x0782, 0x03C2, 0x01E2, 0x00FE, 0x0079, 0x003D, 0x001C, - 0x000C, 0x0004, 0x0000, 0x0006, 0x0002, 0x0007, 0x0001, 0x0005, - 0x000D, 0x001D, 0x003E, 0x007E, 0x00FF, 0x01E3, 0x03C3, 0x0783, - 0x0781, -}; -static const uint16_t bitalloc_25_codes_e[25] = -{ - 0x003C, 0x0092, 0x0018, 0x001F, 0x004E, 0x000D, 0x0025, 0x0004, - 0x0010, 0x0000, 0x000A, 0x0002, 0x0003, 0x0003, 0x000B, 0x0001, - 0x0011, 0x0005, 0x0026, 0x000E, 0x004F, 0x0048, 0x0019, 0x0093, - 0x003D, -}; -static const uint16_t bitalloc_25_codes_f[25] = -{ - 0x0324, 0x0193, 0x00CE, 0x0065, 0x0024, 0x000C, 0x0013, 0x0004, - 0x0007, 0x000A, 0x000D, 0x000F, 0x0001, 0x0000, 0x000E, 0x000B, - 0x0008, 0x0005, 0x0018, 0x000D, 0x0025, 0x0066, 0x00CF, 0x00C8, - 0x0325, -}; -static const uint16_t bitalloc_25_codes_g[25] = -{ - 0x03A8, 0x03AE, 0x01D5, 0x0094, 0x0014, 0x004B, 0x000B, 0x003B, - 0x0013, 0x0003, 0x000F, 0x0005, 0x0001, 0x0006, 0x0000, 0x0008, - 0x001C, 0x0004, 0x0024, 0x0074, 0x0015, 0x0095, 0x01D6, 0x03AF, - 0x03A9, -}; -static const uint8_t bitalloc_25_bits_a[25] = -{ - 14, 13, 11, 9, 8, 7, 6, 5, 4, 4, 3, 3, 3, 3, 3, 4, - 4, 5, 6, 7, 8, 8, 10, 12, 14, -}; -static const uint8_t bitalloc_25_bits_b[25] = -{ - 9, 8, 7, 6, 6, 6, 5, 5, 4, 4, 4, 3, 3, 3, 4, 4, - 4, 5, 5, 6, 6, 6, 7, 7, 9, -}; -static const uint8_t bitalloc_25_bits_c[25] = -{ - 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 4, 4, 3, 4, 4, 4, - 4, 4, 5, 5, 5, 6, 6, 7, 8, -}; -static const uint8_t bitalloc_25_bits_d[25] = -{ - 12, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 3, 2, 3, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 12, -}; -static const uint8_t bitalloc_25_bits_e[25] = -{ - 8, 8, 7, 7, 7, 6, 6, 5, 5, 4, 4, 3, 2, 3, 4, 4, - 5, 5, 6, 6, 7, 7, 7, 8, 8, -}; -static const uint8_t bitalloc_25_bits_f[25] = -{ - 10, 9, 8, 7, 6, 5, 5, 4, 4, 4, 4, 4, 3, 3, 4, 4, - 4, 4, 5, 5, 6, 7, 8, 8, 10, -}; -static const uint8_t bitalloc_25_bits_g[25] = -{ - 10, 10, 9, 8, 7, 7, 6, 6, 5, 4, 4, 3, 2, 3, 3, 4, - 5, 5, 6, 7, 7, 8, 9, 10, 10, -}; - -static const uint16_t bitalloc_33_codes_a[33] = -{ - 0x1580, 0x1582, 0x0AC2, 0x0562, 0x02B2, 0x015E, 0x00AD, 0x0054, - 0x001C, 0x003C, 0x000F, 0x001F, 0x0008, 0x000B, 0x000D, 0x0000, - 0x0002, 0x0001, 0x000E, 0x000C, 0x0009, 0x0006, 0x0014, 0x003D, - 0x001D, 0x0055, 0x00AE, 0x015F, 0x02B3, 0x0563, 0x0AC3, 0x1583, - 0x1581, -}; -static const uint16_t bitalloc_33_codes_b[33] = -{ - 0x030C, 0x0187, 0x006D, 0x0028, 0x0037, 0x0066, 0x0015, 0x0031, - 0x0000, 0x000B, 0x0012, 0x001A, 0x0001, 0x0007, 0x000A, 0x000E, - 0x0001, 0x000F, 0x000B, 0x0008, 0x0004, 0x001B, 0x0013, 0x000C, - 0x0001, 0x0032, 0x001A, 0x0067, 0x0060, 0x0029, 0x00C2, 0x006C, - 0x030D, -}; -static const uint16_t bitalloc_33_codes_c[33] = -{ - 0x00CC, 0x0067, 0x0005, 0x0070, 0x0003, 0x001A, 0x0039, 0x003F, - 0x000A, 0x0012, 0x0018, 0x001D, 0x0001, 0x0003, 0x0007, 0x000A, - 0x000D, 0x000B, 0x0008, 0x0004, 0x0002, 0x001E, 0x0019, 0x0013, - 0x000B, 0x0000, 0x003E, 0x001B, 0x0018, 0x0071, 0x0032, 0x0004, - 0x00CD, -}; -static const uint16_t bitalloc_33_codes_d[33] = -{ - 0x3AF8, 0x3AFA, 0x1D7E, 0x0EBC, 0x075C, 0x03AC, 0x01D4, 0x0094, - 0x0014, 0x004B, 0x000B, 0x003B, 0x0013, 0x0003, 0x000F, 0x0005, - 0x0001, 0x0006, 0x0000, 0x0008, 0x001C, 0x0004, 0x0024, 0x0074, - 0x0015, 0x0095, 0x01D5, 0x03AD, 0x075D, 0x0EBD, 0x1D7F, 0x3AFB, - 0x3AF9, -}; -static const uint16_t bitalloc_33_codes_e[33] = -{ - 0x01C8, 0x01E6, 0x0064, 0x00E2, 0x00E5, 0x0030, 0x0033, 0x0073, - 0x007A, 0x001A, 0x003A, 0x0002, 0x001A, 0x001F, 0x0007, 0x0001, - 0x0002, 0x0002, 0x000C, 0x0000, 0x001B, 0x0003, 0x003B, 0x001B, - 0x007B, 0x0078, 0x0070, 0x0031, 0x00F2, 0x00E3, 0x0065, 0x01E7, - 0x01C9, -}; -static const uint16_t bitalloc_33_codes_f[33] = -{ - 0x0724, 0x0393, 0x01CE, 0x00E5, 0x002C, 0x0008, 0x0017, 0x003E, - 0x0005, 0x0014, 0x001D, 0x0000, 0x0003, 0x0006, 0x0008, 0x000B, - 0x000D, 0x000C, 0x0009, 0x0007, 0x0004, 0x0001, 0x001E, 0x0015, - 0x000A, 0x003F, 0x0038, 0x0009, 0x002D, 0x00E6, 0x01CF, 0x01C8, - 0x0725, -}; -static const uint16_t bitalloc_33_codes_g[33] = -{ - 0x0284, 0x0042, 0x0140, 0x0143, 0x003E, 0x00BE, 0x0011, 0x0051, - 0x0009, 0x0029, 0x0005, 0x0015, 0x0000, 0x0008, 0x000E, 0x0002, - 0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0016, 0x0006, 0x002E, - 0x000E, 0x005E, 0x001E, 0x00BF, 0x003F, 0x0020, 0x0141, 0x0043, - 0x0285, -}; -static const uint8_t bitalloc_33_bits_a[33] = -{ - 13, 13, 12, 11, 10, 9, 8, 7, 6, 6, 5, 5, 4, 4, 4, 3, - 3, 3, 4, 4, 4, 4, 5, 6, 6, 7, 8, 9, 10, 11, 12, 13, - 13, -}; -static const uint8_t bitalloc_33_bits_b[33] = -{ - 10, 9, 8, 7, 7, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, - 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, - 10, -}; -static const uint8_t bitalloc_33_bits_c[33] = -{ - 9, 8, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, 7, - 9, -}; -static const uint8_t bitalloc_33_bits_d[33] = -{ - 14, 14, 13, 12, 11, 10, 9, 8, 7, 7, 6, 6, 5, 4, 4, 3, - 2, 3, 3, 4, 5, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, - 14, -}; -static const uint8_t bitalloc_33_bits_e[33] = -{ - 9, 9, 8, 8, 8, 7, 7, 7, 7, 6, 6, 5, 5, 5, 4, 3, - 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, - 9, -}; -static const uint8_t bitalloc_33_bits_f[33] = -{ - 11, 10, 9, 8, 7, 6, 6, 6, 5, 5, 5, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 9, 9, - 11, -}; -static const uint8_t bitalloc_33_bits_g[33] = -{ - 10, 9, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 3, - 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 9, 9, - 10, -}; - -static const uint16_t bitalloc_65_codes_a[65] = -{ - 0x9E5C, 0x9E5E, 0x4F2C, 0x2794, 0x13C4, 0x1E44, 0x09E3, 0x0F23, - 0x04F3, 0x0792, 0x027E, 0x03CE, 0x013D, 0x01E5, 0x009C, 0x00CC, - 0x0040, 0x0058, 0x0067, 0x001E, 0x0021, 0x002D, 0x003D, 0x0007, - 0x0011, 0x0014, 0x0017, 0x001A, 0x001C, 0x001F, 0x0001, 0x0004, - 0x0006, 0x0005, 0x0002, 0x0000, 0x001D, 0x001B, 0x0018, 0x0015, - 0x0012, 0x000E, 0x0006, 0x0032, 0x0026, 0x001F, 0x0078, 0x0059, - 0x0041, 0x00CD, 0x009D, 0x01E6, 0x013E, 0x03CF, 0x027F, 0x0793, - 0x0790, 0x04F0, 0x09E4, 0x1E45, 0x13C5, 0x2795, 0x4F2D, 0x9E5F, - 0x9E5D, -}; -static const uint16_t bitalloc_65_codes_b[65] = -{ - 0x0A8C, 0x0547, 0x01B5, 0x0008, 0x00DB, 0x0152, 0x0005, 0x000B, - 0x008E, 0x00AE, 0x00E4, 0x0003, 0x0037, 0x0039, 0x0055, 0x006C, - 0x0073, 0x0003, 0x0015, 0x001D, 0x0028, 0x0030, 0x0037, 0x003E, - 0x0006, 0x000B, 0x000F, 0x0012, 0x0016, 0x0019, 0x001D, 0x0001, - 0x0004, 0x0002, 0x001E, 0x001A, 0x0017, 0x0013, 0x0010, 0x000C, - 0x0007, 0x003F, 0x0038, 0x0031, 0x0029, 0x0022, 0x001A, 0x0014, - 0x0000, 0x006D, 0x0056, 0x0046, 0x0038, 0x0004, 0x00E5, 0x00AF, - 0x008F, 0x006C, 0x000A, 0x0153, 0x0150, 0x0009, 0x02A2, 0x01B4, - 0x0A8D, -}; -static const uint16_t bitalloc_65_codes_c[65] = -{ - 0x045C, 0x022F, 0x03F5, 0x01BC, 0x01FB, 0x0059, 0x00D0, 0x00DF, - 0x000A, 0x002D, 0x002F, 0x0052, 0x0069, 0x0078, 0x007F, 0x000A, - 0x0010, 0x001C, 0x0023, 0x002A, 0x0035, 0x003A, 0x003D, 0x0000, - 0x0003, 0x0006, 0x0009, 0x000C, 0x000F, 0x0012, 0x0016, 0x0018, - 0x001C, 0x0019, 0x0017, 0x0013, 0x0010, 0x000D, 0x000A, 0x0007, - 0x0004, 0x0001, 0x003E, 0x003B, 0x0036, 0x002B, 0x0028, 0x001D, - 0x0011, 0x000B, 0x0004, 0x0079, 0x006E, 0x0053, 0x0044, 0x002E, - 0x000B, 0x00FC, 0x00D1, 0x008A, 0x0058, 0x01BD, 0x0116, 0x03F4, - 0x045D, -}; -static const uint16_t bitalloc_65_codes_d[65] = -{ - 0x70B0, 0x70B2, 0x70B4, 0x2852, 0x385B, 0x142E, 0x1C2E, 0x0A15, - 0x0E14, 0x0214, 0x0704, 0x0104, 0x010B, 0x0383, 0x0083, 0x0143, - 0x01C3, 0x0043, 0x00A2, 0x00E2, 0x0022, 0x0052, 0x0072, 0x0012, - 0x002A, 0x003A, 0x000A, 0x0016, 0x001E, 0x0006, 0x000C, 0x0000, - 0x0004, 0x0001, 0x000D, 0x0007, 0x001F, 0x0017, 0x000B, 0x003B, - 0x002B, 0x0013, 0x0073, 0x0053, 0x0023, 0x00E3, 0x00A3, 0x00A0, - 0x0040, 0x01C0, 0x0084, 0x0384, 0x0284, 0x0105, 0x0705, 0x0215, - 0x0E15, 0x0A16, 0x1C2F, 0x142F, 0x1428, 0x2853, 0x70B5, 0x70B3, - 0x70B1, -}; -static const uint16_t bitalloc_65_codes_e[65] = -{ - 0x032C, 0x0332, 0x0378, 0x037E, 0x008C, 0x014A, 0x0188, 0x0197, - 0x019E, 0x01BD, 0x0044, 0x0047, 0x00AA, 0x00C5, 0x00CD, 0x00DC, - 0x001C, 0x002C, 0x0053, 0x0063, 0x0068, 0x0008, 0x000F, 0x0017, - 0x002B, 0x0035, 0x0005, 0x0009, 0x0016, 0x001C, 0x0006, 0x000F, - 0x0004, 0x0000, 0x0007, 0x001D, 0x0017, 0x000A, 0x0006, 0x0036, - 0x0030, 0x0028, 0x0010, 0x0009, 0x0069, 0x0064, 0x0054, 0x002D, - 0x001D, 0x00DD, 0x00CE, 0x00CA, 0x00AB, 0x00A4, 0x0045, 0x01BE, - 0x019F, 0x0198, 0x0189, 0x014B, 0x008D, 0x037F, 0x0379, 0x0333, - 0x032D, -}; -static const uint16_t bitalloc_65_codes_f[65] = -{ - 0x0FE0, 0x0FE2, 0x0FE8, 0x0FEA, 0x0FEC, 0x0FEE, 0x0FF0, 0x0FF2, - 0x0FF4, 0x2FF2, 0x07F2, 0x07FB, 0x03F6, 0x0BFA, 0x0BFD, 0x01FF, - 0x05FF, 0x02FC, 0x007C, 0x017C, 0x003C, 0x00BC, 0x001C, 0x005C, - 0x000C, 0x002C, 0x0004, 0x0014, 0x0000, 0x0008, 0x000E, 0x0002, - 0x0006, 0x0003, 0x000F, 0x0009, 0x0001, 0x0015, 0x0005, 0x002D, - 0x000D, 0x005D, 0x001D, 0x00BD, 0x003D, 0x017D, 0x007D, 0x02FD, - 0x00FC, 0x05FC, 0x01FA, 0x0BFB, 0x03F7, 0x17F8, 0x07F3, 0x2FF3, - 0x0FF5, 0x0FF3, 0x0FF1, 0x0FEF, 0x0FED, 0x0FEB, 0x0FE9, 0x0FE3, - 0x0FE1, -}; -static const uint16_t bitalloc_65_codes_g[65] = -{ - 0x010C, 0x038A, 0x0608, 0x0786, 0x0084, 0x0087, 0x0302, 0x0305, - 0x0040, 0x00E0, 0x00E3, 0x0183, 0x001E, 0x005E, 0x009E, 0x00DE, - 0x00F1, 0x0011, 0x0039, 0x0061, 0x0079, 0x0009, 0x001D, 0x0031, - 0x003D, 0x0005, 0x000F, 0x0019, 0x001F, 0x0003, 0x0006, 0x000A, - 0x000E, 0x000B, 0x0008, 0x0004, 0x0000, 0x001A, 0x0012, 0x000A, - 0x0002, 0x0036, 0x0026, 0x0016, 0x0006, 0x006E, 0x004E, 0x002E, - 0x000E, 0x00DF, 0x009F, 0x005F, 0x001F, 0x01E0, 0x0180, 0x00E1, - 0x0041, 0x03C2, 0x0303, 0x01C4, 0x0085, 0x0787, 0x0609, 0x038B, - 0x010D, -}; -static const uint8_t bitalloc_65_bits_a[65] = -{ - 16, 16, 15, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, - 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, 4, - 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 7, 7, - 7, 8, 8, 9, 9, 10, 10, 11, 11, 11, 12, 13, 13, 14, 15, 16, - 16, -}; -static const uint8_t bitalloc_65_bits_b[65] = -{ - 12, 11, 10, 9, 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, - 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 4, - 4, 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, - 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 10, 10, - 12, -}; -static const uint8_t bitalloc_65_bits_c[65] = -{ - 11, 10, 10, 9, 9, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 6, - 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 10, - 11, -}; -static const uint8_t bitalloc_65_bits_d[65] = -{ - 15, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 10, 9, 9, - 9, 8, 8, 8, 7, 7, 7, 6, 6, 6, 5, 5, 5, 4, 4, 3, - 3, 3, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, - 8, 9, 9, 10, 10, 10, 11, 11, 12, 12, 13, 13, 13, 14, 15, 15, - 15, -}; -static const uint8_t bitalloc_65_bits_e[65] = -{ - 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, - 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, - 3, 3, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10, 10, - 10, -}; -static const uint8_t bitalloc_65_bits_f[65] = -{ - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 13, 13, 12, 12, 12, 11, - 11, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 4, 3, - 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, - 10, 11, 11, 12, 12, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, -}; -static const uint8_t bitalloc_65_bits_g[65] = -{ - 11, 11, 11, 11, 10, 10, 10, 10, 9, 9, 9, 9, 8, 8, 8, 8, - 8, 7, 7, 7, 7, 6, 6, 6, 6, 5, 5, 5, 5, 4, 4, 4, - 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, - 7, 8, 8, 8, 8, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, - 11, -}; - -static const uint16_t bitalloc_129_codes_a[129] = -{ - 0x0660, 0x0666, 0x06EC, 0x0722, 0x0760, 0x076E, 0x004C, 0x004E, - 0x00F4, 0x010A, 0x0148, 0x0156, 0x01D4, 0x01F2, 0x0331, 0x0370, - 0x0377, 0x0396, 0x03B1, 0x0024, 0x0064, 0x007B, 0x008A, 0x00A5, - 0x00D4, 0x00EB, 0x00FA, 0x019A, 0x01B9, 0x01C9, 0x01D9, 0x0010, - 0x0030, 0x0033, 0x0043, 0x0053, 0x006B, 0x007A, 0x00CA, 0x00D2, - 0x00DE, 0x00E6, 0x00F6, 0x000E, 0x001F, 0x0023, 0x002B, 0x003B, - 0x003F, 0x0067, 0x0070, 0x0077, 0x0005, 0x000D, 0x0012, 0x001B, - 0x002C, 0x0035, 0x003A, 0x0004, 0x000B, 0x0017, 0x001F, 0x0009, - 0x0008, 0x000A, 0x0000, 0x0018, 0x000C, 0x0005, 0x003C, 0x0036, - 0x002D, 0x001C, 0x0013, 0x000E, 0x0006, 0x007A, 0x0071, 0x0068, - 0x0064, 0x003C, 0x0034, 0x0028, 0x0020, 0x000F, 0x00F7, 0x00E7, - 0x00DF, 0x00D3, 0x00CB, 0x007B, 0x0074, 0x0054, 0x0044, 0x003C, - 0x0031, 0x0011, 0x01DA, 0x01CA, 0x01BA, 0x019B, 0x00FB, 0x00F8, - 0x00D5, 0x00AA, 0x008B, 0x0084, 0x0065, 0x0025, 0x03B6, 0x0397, - 0x0390, 0x0371, 0x0332, 0x01F3, 0x01D5, 0x0157, 0x0149, 0x010B, - 0x00F5, 0x004F, 0x004D, 0x076F, 0x0761, 0x0723, 0x06ED, 0x0667, - 0x0661, -}; -static const uint16_t bitalloc_129_codes_b[129] = -{ - 0x29DC, 0x14EF, 0x0455, 0x0E9C, 0x022B, 0x0489, 0x0740, 0x074F, - 0x0172, 0x0245, 0x0247, 0x030A, 0x03A1, 0x001C, 0x008B, 0x00D6, - 0x010C, 0x0148, 0x014F, 0x0186, 0x01D1, 0x0008, 0x000F, 0x0046, - 0x005D, 0x0078, 0x0087, 0x0096, 0x00A5, 0x00BC, 0x00D8, 0x00DE, - 0x00F6, 0x0005, 0x0014, 0x0024, 0x002F, 0x003A, 0x003D, 0x0049, - 0x0050, 0x0058, 0x005F, 0x0066, 0x006D, 0x0075, 0x007C, 0x0004, - 0x000B, 0x0013, 0x0018, 0x001B, 0x001F, 0x0022, 0x0026, 0x002A, - 0x002D, 0x0031, 0x0034, 0x0038, 0x003B, 0x003F, 0x0003, 0x0006, - 0x000A, 0x0007, 0x0004, 0x0000, 0x003C, 0x0039, 0x0035, 0x0032, - 0x002E, 0x002B, 0x0027, 0x0023, 0x0020, 0x001C, 0x0019, 0x0016, - 0x0010, 0x0005, 0x007D, 0x007A, 0x006E, 0x0067, 0x0060, 0x0059, - 0x0051, 0x004A, 0x0042, 0x003B, 0x0034, 0x0025, 0x0015, 0x0006, - 0x00F7, 0x00DF, 0x00D9, 0x00BD, 0x00A6, 0x0097, 0x0090, 0x0079, - 0x006A, 0x0047, 0x0044, 0x0009, 0x01D2, 0x0187, 0x0184, 0x0149, - 0x010D, 0x00D7, 0x00B8, 0x001D, 0x03A6, 0x030B, 0x029C, 0x0246, - 0x0173, 0x0114, 0x0741, 0x053A, 0x0488, 0x0E9D, 0x0A76, 0x0454, - 0x29DD, -}; -static const uint16_t bitalloc_129_codes_c[129] = -{ - 0x0E5C, 0x072F, 0x001D, 0x0724, 0x000F, 0x010D, 0x0324, 0x0393, - 0x03E9, 0x0080, 0x0087, 0x00FA, 0x0164, 0x0193, 0x01DE, 0x01F5, - 0x0010, 0x002A, 0x0041, 0x0064, 0x0073, 0x008E, 0x00A4, 0x00B3, - 0x00D6, 0x00E5, 0x00F4, 0x00FB, 0x0002, 0x0009, 0x0013, 0x001E, - 0x0026, 0x002C, 0x0033, 0x003F, 0x0041, 0x004C, 0x0053, 0x005E, - 0x0065, 0x0070, 0x0073, 0x0078, 0x007B, 0x007E, 0x0002, 0x0005, - 0x0007, 0x000B, 0x000D, 0x0011, 0x0014, 0x0017, 0x001A, 0x001D, - 0x0021, 0x0024, 0x0027, 0x002A, 0x002D, 0x0030, 0x0033, 0x0036, - 0x003A, 0x0037, 0x0034, 0x0031, 0x002E, 0x002B, 0x0028, 0x0025, - 0x0022, 0x001E, 0x001B, 0x0018, 0x0015, 0x0012, 0x000E, 0x000C, - 0x0008, 0x0006, 0x0003, 0x007F, 0x007C, 0x0079, 0x0076, 0x0071, - 0x006A, 0x005F, 0x0058, 0x004D, 0x0046, 0x0040, 0x0038, 0x002D, - 0x0027, 0x001F, 0x0014, 0x0012, 0x0003, 0x0000, 0x00F5, 0x00EE, - 0x00D7, 0x00C8, 0x00A5, 0x008F, 0x007C, 0x0065, 0x0042, 0x002B, - 0x0011, 0x0002, 0x01DF, 0x01C8, 0x0165, 0x00FB, 0x00E4, 0x0081, - 0x0006, 0x03E8, 0x0325, 0x01CA, 0x010C, 0x0725, 0x0396, 0x001C, - 0x0E5D, -}; -static const uint16_t bitalloc_129_codes_d[129] = -{ - 0xA598, 0xA59A, 0xA59C, 0xA59E, 0xC598, 0xE586, 0x3ACC, 0x52CA, - 0x62CD, 0x0D48, 0x1D67, 0x2978, 0x3167, 0x3966, 0x06A5, 0x0EBC, - 0x14BD, 0x1CB1, 0x0350, 0x0353, 0x075F, 0x0A5F, 0x0C5E, 0x0E5E, - 0x01AE, 0x03AD, 0x052D, 0x062D, 0x072D, 0x00D5, 0x01D4, 0x0294, - 0x0314, 0x0394, 0x0014, 0x0094, 0x0114, 0x0174, 0x01B4, 0x01F4, - 0x000B, 0x004B, 0x008B, 0x00BB, 0x00DB, 0x00FB, 0x001B, 0x003B, - 0x0053, 0x0063, 0x0073, 0x0003, 0x0013, 0x0023, 0x002F, 0x0037, - 0x003F, 0x0007, 0x000F, 0x0015, 0x0019, 0x001D, 0x0001, 0x0005, - 0x0009, 0x0006, 0x0002, 0x001E, 0x001A, 0x0016, 0x0010, 0x0008, - 0x0000, 0x0038, 0x0030, 0x0028, 0x001C, 0x000C, 0x007C, 0x006C, - 0x005C, 0x0044, 0x0024, 0x0004, 0x00E4, 0x00C4, 0x00A4, 0x0074, - 0x0034, 0x01F5, 0x01B5, 0x0175, 0x0115, 0x0095, 0x0015, 0x0395, - 0x0315, 0x0295, 0x01D5, 0x00D6, 0x072E, 0x062E, 0x052E, 0x03AE, - 0x01AF, 0x0E5F, 0x0C5F, 0x0C58, 0x0A58, 0x0758, 0x0351, 0x1CB2, - 0x18B2, 0x0EBD, 0x0EB2, 0x3967, 0x3960, 0x2979, 0x2964, 0x0D49, - 0x72C2, 0x52CB, 0x3ACD, 0xE587, 0xC599, 0xA59F, 0xA59D, 0xA59B, - 0xA599, -}; -static const uint16_t bitalloc_129_codes_e[129] = -{ - 0xA13C, 0xC720, 0xA13F, 0xA13E, 0xA13D, 0xE722, 0x5090, 0x6393, - 0x7392, 0x2849, 0x31CE, 0x39CE, 0x1425, 0x18E5, 0x1CE5, 0x0844, - 0x0A1C, 0x0C7C, 0x036C, 0x0423, 0x050F, 0x063F, 0x01B7, 0x0216, - 0x0285, 0x031D, 0x039D, 0x0109, 0x0140, 0x0180, 0x01C8, 0x01CF, - 0x007A, 0x008A, 0x00A2, 0x00C1, 0x00E5, 0x0014, 0x0037, 0x0043, - 0x004E, 0x0056, 0x0061, 0x006C, 0x007C, 0x000B, 0x001C, 0x001F, - 0x0023, 0x0025, 0x0029, 0x002C, 0x002E, 0x0032, 0x0034, 0x0037, - 0x003A, 0x003C, 0x003F, 0x0001, 0x0003, 0x0006, 0x0008, 0x000A, - 0x000C, 0x000B, 0x0009, 0x0007, 0x0004, 0x0002, 0x0000, 0x003D, - 0x003B, 0x0038, 0x0035, 0x0033, 0x002F, 0x002D, 0x002A, 0x0026, - 0x0024, 0x0020, 0x001D, 0x001A, 0x007D, 0x006D, 0x0062, 0x0057, - 0x004F, 0x0044, 0x003C, 0x0015, 0x00E6, 0x00C6, 0x00A3, 0x008B, - 0x007B, 0x006C, 0x01C9, 0x0181, 0x0141, 0x010A, 0x00DA, 0x031E, - 0x0286, 0x0217, 0x0210, 0x0738, 0x0638, 0x0508, 0x036D, 0x0C7D, - 0x0A1D, 0x0845, 0x1CE6, 0x18E6, 0x1426, 0x39CF, 0x31CF, 0x284E, - 0x7393, 0x7390, 0x5091, 0xE723, 0xC724, 0xC725, 0xC722, 0xC723, - 0xC721, -}; -static const uint16_t bitalloc_129_codes_f[129] = -{ - 0x762C, 0x3B17, 0x1555, 0x0608, 0x0AAB, 0x0FF2, 0x0305, 0x0307, - 0x0763, 0x0046, 0x010C, 0x01BC, 0x02AB, 0x03B6, 0x03FD, 0x0080, - 0x0087, 0x00DF, 0x0156, 0x01D9, 0x01F8, 0x01FF, 0x002A, 0x0041, - 0x0061, 0x0094, 0x00D4, 0x00EA, 0x00F2, 0x00FD, 0x0009, 0x000B, - 0x001A, 0x0026, 0x0031, 0x0040, 0x004B, 0x006B, 0x0073, 0x0077, - 0x007A, 0x007C, 0x0000, 0x0002, 0x0006, 0x0008, 0x000B, 0x000E, - 0x0011, 0x0014, 0x0016, 0x0019, 0x001C, 0x001E, 0x0021, 0x0023, - 0x0026, 0x0028, 0x002B, 0x002D, 0x002F, 0x0031, 0x0033, 0x0036, - 0x0038, 0x0037, 0x0034, 0x0032, 0x0030, 0x002E, 0x002C, 0x0029, - 0x0027, 0x0024, 0x0022, 0x001F, 0x001D, 0x001A, 0x0017, 0x0015, - 0x0012, 0x000F, 0x000C, 0x0009, 0x0007, 0x0003, 0x0001, 0x007D, - 0x007B, 0x0078, 0x0074, 0x0072, 0x0054, 0x0041, 0x0036, 0x0027, - 0x001B, 0x0014, 0x000A, 0x00FE, 0x00F3, 0x00EB, 0x00D5, 0x0095, - 0x006E, 0x0042, 0x002B, 0x0010, 0x01F9, 0x01DA, 0x0157, 0x0154, - 0x00C0, 0x0081, 0x0022, 0x03B7, 0x03B0, 0x01BD, 0x010D, 0x0047, - 0x07F8, 0x0554, 0x0306, 0x0FF3, 0x0EC4, 0x0609, 0x1D8A, 0x1554, - 0x762D, -}; -static const uint16_t bitalloc_129_codes_g[129] = -{ - 0x1E20, 0x1E5E, 0x031C, 0x051A, 0x0718, 0x0916, 0x0B14, 0x0D12, - 0x0F11, 0x0090, 0x018F, 0x028E, 0x038D, 0x048C, 0x058B, 0x068A, - 0x0789, 0x0049, 0x00C8, 0x0148, 0x01C7, 0x0247, 0x02C6, 0x0346, - 0x03C5, 0x0025, 0x0065, 0x00A5, 0x00E4, 0x0124, 0x0164, 0x01A4, - 0x01E3, 0x0013, 0x0033, 0x0053, 0x0073, 0x0093, 0x00B3, 0x00D3, - 0x00F3, 0x000A, 0x001A, 0x002A, 0x003A, 0x004A, 0x005A, 0x006A, - 0x007A, 0x0006, 0x000E, 0x0016, 0x001E, 0x0026, 0x002E, 0x0036, - 0x003E, 0x0004, 0x0008, 0x000C, 0x0010, 0x0014, 0x0018, 0x001C, - 0x0000, 0x001D, 0x0019, 0x0015, 0x0011, 0x000D, 0x0009, 0x0005, - 0x003F, 0x0037, 0x002F, 0x0027, 0x001F, 0x0017, 0x000F, 0x0007, - 0x007B, 0x006B, 0x005B, 0x004B, 0x003B, 0x002B, 0x001B, 0x000B, - 0x0008, 0x00F0, 0x00D0, 0x00B0, 0x0090, 0x0070, 0x0050, 0x0030, - 0x01E4, 0x01A5, 0x0165, 0x0125, 0x00E5, 0x00E2, 0x00A2, 0x0062, - 0x03CA, 0x0347, 0x02C7, 0x02C4, 0x0244, 0x0149, 0x00C9, 0x00C6, - 0x0796, 0x068B, 0x0688, 0x048D, 0x048A, 0x028F, 0x028C, 0x0091, - 0x0F2E, 0x0D13, 0x0B15, 0x0917, 0x0719, 0x051B, 0x031D, 0x1E5F, - 0x1E21, -}; -static const uint8_t bitalloc_129_bits_a[129] = -{ - 11, 11, 11, 11, 11, 11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 4, - 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, - 11, -}; -static const uint8_t bitalloc_129_bits_b[129] = -{ - 14, 13, 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, - 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, - 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, - 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, - 14, -}; -static const uint8_t bitalloc_129_bits_c[129] = -{ - 13, 12, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, - 13, -}; -static const uint8_t bitalloc_129_bits_d[129] = -{ - 16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, - 13, 13, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 10, 10, 10, - 10, 10, 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 7, 7, - 7, 7, 7, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, - 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, - 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, - 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 13, - 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, - 16, -}; -static const uint8_t bitalloc_129_bits_e[129] = -{ - 16, 16, 16, 16, 16, 16, 15, 15, 15, 14, 14, 14, 13, 13, 13, 12, - 12, 12, 11, 11, 11, 11, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, - 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 12, - 12, 12, 13, 13, 13, 14, 14, 14, 15, 15, 15, 16, 16, 16, 16, 16, - 16, -}; -static const uint8_t bitalloc_129_bits_f[129] = -{ - 15, 14, 13, 12, 12, 12, 11, 11, 11, 10, 10, 10, 10, 10, 10, 9, - 9, 9, 9, 9, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, - 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, - 15, -}; -static const uint8_t bitalloc_129_bits_g[129] = -{ - 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, - 11, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, - 9, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, - 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, - 4, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 13, - 13, -}; - -static const uint8_t bitalloc_sizes[10] = { 3, 5, 7, 9, 13, 17, 25, 33, 65, 129 }; - -static const int8_t bitalloc_offsets[10] = - { -1, -2, -3, -4, -6, -8, -12, -16, -32, -64 }; - -static const uint8_t bitalloc_maxbits[10][7] = { - { 2 }, - { 4, 3, 3 }, - { 5, 5, 4 }, - { 6, 5, 6 }, - { 7, 6, 5 }, - { 9, 8, 7, 9, 8, 8, 8 }, - { 9, 9, 8, 9, 8, 9, 9 }, - { 9, 9, 9, 9, 9, 9, 9 }, - { 9, 9, 9, 9, 9, 9, 9 }, - { 9, 9, 9, 9, 9, 9, 9 } -}; - -static const uint16_t* const bitalloc_codes[10][8] = { - { bitalloc_3_codes, NULL }, - { bitalloc_5_codes_a, bitalloc_5_codes_b, bitalloc_5_codes_c, NULL }, - { bitalloc_7_codes_a, bitalloc_7_codes_b, bitalloc_7_codes_c, NULL }, - { bitalloc_9_codes_a, bitalloc_9_codes_b, bitalloc_9_codes_c, NULL }, - { bitalloc_13_codes_a, bitalloc_13_codes_b, bitalloc_13_codes_c, NULL }, - { bitalloc_17_codes_a, bitalloc_17_codes_b, bitalloc_17_codes_c, bitalloc_17_codes_d, - bitalloc_17_codes_e, bitalloc_17_codes_f, bitalloc_17_codes_g, NULL }, - { bitalloc_25_codes_a, bitalloc_25_codes_b, bitalloc_25_codes_c, bitalloc_25_codes_d, - bitalloc_25_codes_e, bitalloc_25_codes_f, bitalloc_25_codes_g, NULL }, - { bitalloc_33_codes_a, bitalloc_33_codes_b, bitalloc_33_codes_c, bitalloc_33_codes_d, - bitalloc_33_codes_e, bitalloc_33_codes_f, bitalloc_33_codes_g, NULL }, - { bitalloc_65_codes_a, bitalloc_65_codes_b, bitalloc_65_codes_c, bitalloc_65_codes_d, - bitalloc_65_codes_e, bitalloc_65_codes_f, bitalloc_65_codes_g, NULL }, - { bitalloc_129_codes_a, bitalloc_129_codes_b, bitalloc_129_codes_c, bitalloc_129_codes_d, - bitalloc_129_codes_e, bitalloc_129_codes_f, bitalloc_129_codes_g, NULL } -}; - -static const uint8_t* const bitalloc_bits[10][8] = { - { bitalloc_3_bits, NULL }, - { bitalloc_5_bits_a, bitalloc_5_bits_b, bitalloc_5_bits_c, NULL }, - { bitalloc_7_bits_a, bitalloc_7_bits_b, bitalloc_7_bits_c, NULL }, - { bitalloc_9_bits_a, bitalloc_9_bits_b, bitalloc_9_bits_c, NULL }, - { bitalloc_13_bits_a, bitalloc_13_bits_b, bitalloc_13_bits_c, NULL }, - { bitalloc_17_bits_a, bitalloc_17_bits_b, bitalloc_17_bits_c, bitalloc_17_bits_d, - bitalloc_17_bits_e, bitalloc_17_bits_f, bitalloc_17_bits_g, NULL }, - { bitalloc_25_bits_a, bitalloc_25_bits_b, bitalloc_25_bits_c, bitalloc_25_bits_d, - bitalloc_25_bits_e, bitalloc_25_bits_f, bitalloc_25_bits_g, NULL }, - { bitalloc_33_bits_a, bitalloc_33_bits_b, bitalloc_33_bits_c, bitalloc_33_bits_d, - bitalloc_33_bits_e, bitalloc_33_bits_f, bitalloc_33_bits_g, NULL }, - { bitalloc_65_bits_a, bitalloc_65_bits_b, bitalloc_65_bits_c, bitalloc_65_bits_d, - bitalloc_65_bits_e, bitalloc_65_bits_f, bitalloc_65_bits_g, NULL }, - { bitalloc_129_bits_a, bitalloc_129_bits_b, bitalloc_129_bits_c, bitalloc_129_bits_d, - bitalloc_129_bits_e, bitalloc_129_bits_f, bitalloc_129_bits_g, NULL } -}; - -#endif /* AVCODEC_DCAHUFF_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.c deleted file mode 100644 index b1ee06a81..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * (I)DCT Transforms - * Copyright (c) 2009 Peter Ross - * Copyright (c) 2010 Alex Converse - * Copyright (c) 2010 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * (Inverse) Discrete Cosine Transforms. These are also known as the - * type II and type III DCTs respectively. - */ - -#include -#include - -#include "libavutil/mathematics.h" -#include "dct.h" -#include "dct32.h" - -/* sin((M_PI * x / (2 * n)) */ -#define SIN(s, n, x) (s->costab[(n) - (x)]) - -/* cos((M_PI * x / (2 * n)) */ -#define COS(s, n, x) (s->costab[x]) - -static void dst_calc_I_c(DCTContext *ctx, FFTSample *data) -{ - int n = 1 << ctx->nbits; - int i; - - data[0] = 0; - for (i = 1; i < n / 2; i++) { - float tmp1 = data[i ]; - float tmp2 = data[n - i]; - float s = SIN(ctx, n, 2 * i); - - s *= tmp1 + tmp2; - tmp1 = (tmp1 - tmp2) * 0.5f; - data[i] = s + tmp1; - data[n - i] = s - tmp1; - } - - data[n / 2] *= 2; - ctx->rdft.rdft_calc(&ctx->rdft, data); - - data[0] *= 0.5f; - - for (i = 1; i < n - 2; i += 2) { - data[i + 1] += data[i - 1]; - data[i] = -data[i + 2]; - } - - data[n - 1] = 0; -} - -static void dct_calc_I_c(DCTContext *ctx, FFTSample *data) -{ - int n = 1 << ctx->nbits; - int i; - float next = -0.5f * (data[0] - data[n]); - - for (i = 0; i < n / 2; i++) { - float tmp1 = data[i]; - float tmp2 = data[n - i]; - float s = SIN(ctx, n, 2 * i); - float c = COS(ctx, n, 2 * i); - - c *= tmp1 - tmp2; - s *= tmp1 - tmp2; - - next += c; - - tmp1 = (tmp1 + tmp2) * 0.5f; - data[i] = tmp1 - s; - data[n - i] = tmp1 + s; - } - - ctx->rdft.rdft_calc(&ctx->rdft, data); - data[n] = data[1]; - data[1] = next; - - for (i = 3; i <= n; i += 2) - data[i] = data[i - 2] - data[i]; -} - -static void dct_calc_III_c(DCTContext *ctx, FFTSample *data) -{ - int n = 1 << ctx->nbits; - int i; - - float next = data[n - 1]; - float inv_n = 1.0f / n; - - for (i = n - 2; i >= 2; i -= 2) { - float val1 = data[i]; - float val2 = data[i - 1] - data[i + 1]; - float c = COS(ctx, n, i); - float s = SIN(ctx, n, i); - - data[i] = c * val1 + s * val2; - data[i + 1] = s * val1 - c * val2; - } - - data[1] = 2 * next; - - ctx->rdft.rdft_calc(&ctx->rdft, data); - - for (i = 0; i < n / 2; i++) { - float tmp1 = data[i] * inv_n; - float tmp2 = data[n - i - 1] * inv_n; - float csc = ctx->csc2[i] * (tmp1 - tmp2); - - tmp1 += tmp2; - data[i] = tmp1 + csc; - data[n - i - 1] = tmp1 - csc; - } -} - -static void dct_calc_II_c(DCTContext *ctx, FFTSample *data) -{ - int n = 1 << ctx->nbits; - int i; - float next; - - for (i = 0; i < n / 2; i++) { - float tmp1 = data[i]; - float tmp2 = data[n - i - 1]; - float s = SIN(ctx, n, 2 * i + 1); - - s *= tmp1 - tmp2; - tmp1 = (tmp1 + tmp2) * 0.5f; - - data[i] = tmp1 + s; - data[n-i-1] = tmp1 - s; - } - - ctx->rdft.rdft_calc(&ctx->rdft, data); - - next = data[1] * 0.5; - data[1] *= -1; - - for (i = n - 2; i >= 0; i -= 2) { - float inr = data[i ]; - float ini = data[i + 1]; - float c = COS(ctx, n, i); - float s = SIN(ctx, n, i); - - data[i] = c * inr + s * ini; - data[i + 1] = next; - - next += s * inr - c * ini; - } -} - -static void dct32_func(DCTContext *ctx, FFTSample *data) -{ - ctx->dct32(data, data); -} - -av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) -{ - int n = 1 << nbits; - int i; - - memset(s, 0, sizeof(*s)); - - s->nbits = nbits; - s->inverse = inverse; - - if (inverse == DCT_II && nbits == 5) { - s->dct_calc = dct32_func; - } else { - ff_init_ff_cos_tabs(nbits + 2); - - s->costab = ff_cos_tabs[nbits + 2]; - s->csc2 = av_malloc(n / 2 * sizeof(FFTSample)); - - if (ff_rdft_init(&s->rdft, nbits, inverse == DCT_III) < 0) { - av_free(s->csc2); - return -1; - } - - for (i = 0; i < n / 2; i++) - s->csc2[i] = 0.5 / sin((M_PI / (2 * n) * (2 * i + 1))); - - switch (inverse) { - case DCT_I : s->dct_calc = dct_calc_I_c; break; - case DCT_II : s->dct_calc = dct_calc_II_c; break; - case DCT_III: s->dct_calc = dct_calc_III_c; break; - case DST_I : s->dct_calc = dst_calc_I_c; break; - } - } - - s->dct32 = ff_dct32_float; - if (ARCH_X86) - ff_dct_init_x86(s); - - return 0; -} - -av_cold void ff_dct_end(DCTContext *s) -{ - ff_rdft_end(&s->rdft); - av_free(s->csc2); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.h deleted file mode 100644 index a500521dc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * (I)DCT Transforms - * Copyright (c) 2009 Peter Ross - * Copyright (c) 2010 Alex Converse - * Copyright (c) 2010 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCT_H -#define AVCODEC_DCT_H - -#include - -#include "rdft.h" - -struct DCTContext { - int nbits; - int inverse; - RDFTContext rdft; - const float *costab; - FFTSample *csc2; - void (*dct_calc)(struct DCTContext *s, FFTSample *data); - void (*dct32)(FFTSample *out, const FFTSample *in); -}; - -/** - * Set up DCT. - * @param nbits size of the input array: - * (1 << nbits) for DCT-II, DCT-III and DST-I - * (1 << nbits) + 1 for DCT-I - * - * @note the first element of the input of DST-I is ignored - */ -int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type); -void ff_dct_end (DCTContext *s); - -void ff_dct_init_x86(DCTContext *s); - -void ff_fdct_ifast(int16_t *data); -void ff_fdct_ifast248(int16_t *data); -void ff_jpeg_fdct_islow_8(int16_t *data); -void ff_jpeg_fdct_islow_10(int16_t *data); -void ff_fdct248_islow_8(int16_t *data); -void ff_fdct248_islow_10(int16_t *data); - -void ff_j_rev_dct(int16_t *data); -void ff_j_rev_dct4(int16_t *data); -void ff_j_rev_dct2(int16_t *data); -void ff_j_rev_dct1(int16_t *data); - -void ff_fdct_mmx(int16_t *block); -void ff_fdct_mmxext(int16_t *block); -void ff_fdct_sse2(int16_t *block); - -#endif /* AVCODEC_DCT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.c deleted file mode 100644 index fb53d53ab..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Template for the Discrete Cosine Transform for 32 samples - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "dct32.h" -#include "mathops.h" - -#if DCT32_FLOAT -# define dct32 ff_dct32_float -# define FIXHR(x) ((float)(x)) -# define MULH3(x, y, s) ((s)*(y)*(x)) -# define INTFLOAT float -#else -# define dct32 ff_dct32_fixed -# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) -# define MULH3(x, y, s) MULH((s)*(x), y) -# define INTFLOAT int -#endif - - -/* tab[i][j] = 1.0 / (2.0 * cos(pi*(2*k+1) / 2^(6 - j))) */ - -/* cos(i*pi/64) */ - -#define COS0_0 FIXHR(0.50060299823519630134/2) -#define COS0_1 FIXHR(0.50547095989754365998/2) -#define COS0_2 FIXHR(0.51544730992262454697/2) -#define COS0_3 FIXHR(0.53104259108978417447/2) -#define COS0_4 FIXHR(0.55310389603444452782/2) -#define COS0_5 FIXHR(0.58293496820613387367/2) -#define COS0_6 FIXHR(0.62250412303566481615/2) -#define COS0_7 FIXHR(0.67480834145500574602/2) -#define COS0_8 FIXHR(0.74453627100229844977/2) -#define COS0_9 FIXHR(0.83934964541552703873/2) -#define COS0_10 FIXHR(0.97256823786196069369/2) -#define COS0_11 FIXHR(1.16943993343288495515/4) -#define COS0_12 FIXHR(1.48416461631416627724/4) -#define COS0_13 FIXHR(2.05778100995341155085/8) -#define COS0_14 FIXHR(3.40760841846871878570/8) -#define COS0_15 FIXHR(10.19000812354805681150/32) - -#define COS1_0 FIXHR(0.50241928618815570551/2) -#define COS1_1 FIXHR(0.52249861493968888062/2) -#define COS1_2 FIXHR(0.56694403481635770368/2) -#define COS1_3 FIXHR(0.64682178335999012954/2) -#define COS1_4 FIXHR(0.78815462345125022473/2) -#define COS1_5 FIXHR(1.06067768599034747134/4) -#define COS1_6 FIXHR(1.72244709823833392782/4) -#define COS1_7 FIXHR(5.10114861868916385802/16) - -#define COS2_0 FIXHR(0.50979557910415916894/2) -#define COS2_1 FIXHR(0.60134488693504528054/2) -#define COS2_2 FIXHR(0.89997622313641570463/2) -#define COS2_3 FIXHR(2.56291544774150617881/8) - -#define COS3_0 FIXHR(0.54119610014619698439/2) -#define COS3_1 FIXHR(1.30656296487637652785/4) - -#define COS4_0 FIXHR(0.70710678118654752439/2) - -/* butterfly operator */ -#define BF(a, b, c, s)\ -{\ - tmp0 = val##a + val##b;\ - tmp1 = val##a - val##b;\ - val##a = tmp0;\ - val##b = MULH3(tmp1, c, 1<<(s));\ -} - -#define BF0(a, b, c, s)\ -{\ - tmp0 = tab[a] + tab[b];\ - tmp1 = tab[a] - tab[b];\ - val##a = tmp0;\ - val##b = MULH3(tmp1, c, 1<<(s));\ -} - -#define BF1(a, b, c, d)\ -{\ - BF(a, b, COS4_0, 1);\ - BF(c, d,-COS4_0, 1);\ - val##c += val##d;\ -} - -#define BF2(a, b, c, d)\ -{\ - BF(a, b, COS4_0, 1);\ - BF(c, d,-COS4_0, 1);\ - val##c += val##d;\ - val##a += val##c;\ - val##c += val##b;\ - val##b += val##d;\ -} - -#define ADD(a, b) val##a += val##b - -/* DCT32 without 1/sqrt(2) coef zero scaling. */ -void dct32(INTFLOAT *out, const INTFLOAT *tab) -{ - INTFLOAT tmp0, tmp1; - - INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 , - val8 , val9 , val10, val11, val12, val13, val14, val15, - val16, val17, val18, val19, val20, val21, val22, val23, - val24, val25, val26, val27, val28, val29, val30, val31; - - /* pass 1 */ - BF0( 0, 31, COS0_0 , 1); - BF0(15, 16, COS0_15, 5); - /* pass 2 */ - BF( 0, 15, COS1_0 , 1); - BF(16, 31,-COS1_0 , 1); - /* pass 1 */ - BF0( 7, 24, COS0_7 , 1); - BF0( 8, 23, COS0_8 , 1); - /* pass 2 */ - BF( 7, 8, COS1_7 , 4); - BF(23, 24,-COS1_7 , 4); - /* pass 3 */ - BF( 0, 7, COS2_0 , 1); - BF( 8, 15,-COS2_0 , 1); - BF(16, 23, COS2_0 , 1); - BF(24, 31,-COS2_0 , 1); - /* pass 1 */ - BF0( 3, 28, COS0_3 , 1); - BF0(12, 19, COS0_12, 2); - /* pass 2 */ - BF( 3, 12, COS1_3 , 1); - BF(19, 28,-COS1_3 , 1); - /* pass 1 */ - BF0( 4, 27, COS0_4 , 1); - BF0(11, 20, COS0_11, 2); - /* pass 2 */ - BF( 4, 11, COS1_4 , 1); - BF(20, 27,-COS1_4 , 1); - /* pass 3 */ - BF( 3, 4, COS2_3 , 3); - BF(11, 12,-COS2_3 , 3); - BF(19, 20, COS2_3 , 3); - BF(27, 28,-COS2_3 , 3); - /* pass 4 */ - BF( 0, 3, COS3_0 , 1); - BF( 4, 7,-COS3_0 , 1); - BF( 8, 11, COS3_0 , 1); - BF(12, 15,-COS3_0 , 1); - BF(16, 19, COS3_0 , 1); - BF(20, 23,-COS3_0 , 1); - BF(24, 27, COS3_0 , 1); - BF(28, 31,-COS3_0 , 1); - - - - /* pass 1 */ - BF0( 1, 30, COS0_1 , 1); - BF0(14, 17, COS0_14, 3); - /* pass 2 */ - BF( 1, 14, COS1_1 , 1); - BF(17, 30,-COS1_1 , 1); - /* pass 1 */ - BF0( 6, 25, COS0_6 , 1); - BF0( 9, 22, COS0_9 , 1); - /* pass 2 */ - BF( 6, 9, COS1_6 , 2); - BF(22, 25,-COS1_6 , 2); - /* pass 3 */ - BF( 1, 6, COS2_1 , 1); - BF( 9, 14,-COS2_1 , 1); - BF(17, 22, COS2_1 , 1); - BF(25, 30,-COS2_1 , 1); - - /* pass 1 */ - BF0( 2, 29, COS0_2 , 1); - BF0(13, 18, COS0_13, 3); - /* pass 2 */ - BF( 2, 13, COS1_2 , 1); - BF(18, 29,-COS1_2 , 1); - /* pass 1 */ - BF0( 5, 26, COS0_5 , 1); - BF0(10, 21, COS0_10, 1); - /* pass 2 */ - BF( 5, 10, COS1_5 , 2); - BF(21, 26,-COS1_5 , 2); - /* pass 3 */ - BF( 2, 5, COS2_2 , 1); - BF(10, 13,-COS2_2 , 1); - BF(18, 21, COS2_2 , 1); - BF(26, 29,-COS2_2 , 1); - /* pass 4 */ - BF( 1, 2, COS3_1 , 2); - BF( 5, 6,-COS3_1 , 2); - BF( 9, 10, COS3_1 , 2); - BF(13, 14,-COS3_1 , 2); - BF(17, 18, COS3_1 , 2); - BF(21, 22,-COS3_1 , 2); - BF(25, 26, COS3_1 , 2); - BF(29, 30,-COS3_1 , 2); - - /* pass 5 */ - BF1( 0, 1, 2, 3); - BF2( 4, 5, 6, 7); - BF1( 8, 9, 10, 11); - BF2(12, 13, 14, 15); - BF1(16, 17, 18, 19); - BF2(20, 21, 22, 23); - BF1(24, 25, 26, 27); - BF2(28, 29, 30, 31); - - /* pass 6 */ - - ADD( 8, 12); - ADD(12, 10); - ADD(10, 14); - ADD(14, 9); - ADD( 9, 13); - ADD(13, 11); - ADD(11, 15); - - out[ 0] = val0; - out[16] = val1; - out[ 8] = val2; - out[24] = val3; - out[ 4] = val4; - out[20] = val5; - out[12] = val6; - out[28] = val7; - out[ 2] = val8; - out[18] = val9; - out[10] = val10; - out[26] = val11; - out[ 6] = val12; - out[22] = val13; - out[14] = val14; - out[30] = val15; - - ADD(24, 28); - ADD(28, 26); - ADD(26, 30); - ADD(30, 25); - ADD(25, 29); - ADD(29, 27); - ADD(27, 31); - - out[ 1] = val16 + val24; - out[17] = val17 + val25; - out[ 9] = val18 + val26; - out[25] = val19 + val27; - out[ 5] = val20 + val28; - out[21] = val21 + val29; - out[13] = val22 + val30; - out[29] = val23 + val31; - out[ 3] = val24 + val20; - out[19] = val25 + val21; - out[11] = val26 + val22; - out[27] = val27 + val23; - out[ 7] = val28 + val18; - out[23] = val29 + val19; - out[15] = val30 + val17; - out[31] = val31; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.h deleted file mode 100644 index f4b2471de..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCT32_H -#define AVCODEC_DCT32_H - -void ff_dct32_float(float *dst, const float *src); -void ff_dct32_fixed(int *dst, const int *src); - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32_float.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32_float.c deleted file mode 100644 index 70168f563..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dct32_float.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define DCT32_FLOAT 1 -#include "dct32.c" diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.c deleted file mode 100644 index 851014b66..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * reference discrete cosine transform (double precision) - * Copyright (C) 2009 Dylan Yudaken - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * reference discrete cosine transform (double precision) - * - * @author Dylan Yudaken (dyudaken at gmail) - * - * @note This file could be optimized a lot, but is for - * reference and so readability is better. - */ - -#include "libavutil/mathematics.h" -#include "dctref.h" - -static double coefficients[8 * 8]; - -/** - * Initialize the double precision discrete cosine transform - * functions fdct & idct. - */ -av_cold void ff_ref_dct_init(void) -{ - unsigned int i, j; - - for (j = 0; j < 8; ++j) { - coefficients[j] = sqrt(0.125); - for (i = 8; i < 64; i += 8) { - coefficients[i + j] = 0.5 * cos(i * (j + 0.5) * M_PI / 64.0); - } - } -} - -/** - * Transform 8x8 block of data with a double precision forward DCT
- * This is a reference implementation. - * - * @param block pointer to 8x8 block of data to transform - */ -void ff_ref_fdct(short *block) -{ - /* implement the equation: block = coefficients * block * coefficients' */ - - unsigned int i, j, k; - double out[8 * 8]; - - /* out = coefficients * block */ - for (i = 0; i < 64; i += 8) { - for (j = 0; j < 8; ++j) { - double tmp = 0; - for (k = 0; k < 8; ++k) { - tmp += coefficients[i + k] * block[k * 8 + j]; - } - out[i + j] = tmp * 8; - } - } - - /* block = out * (coefficients') */ - for (j = 0; j < 8; ++j) { - for (i = 0; i < 64; i += 8) { - double tmp = 0; - for (k = 0; k < 8; ++k) { - tmp += out[i + k] * coefficients[j * 8 + k]; - } - block[i + j] = floor(tmp + 0.499999999999); - } - } -} - -/** - * Transform 8x8 block of data with a double precision inverse DCT
- * This is a reference implementation. - * - * @param block pointer to 8x8 block of data to transform - */ -void ff_ref_idct(short *block) -{ - /* implement the equation: block = (coefficients') * block * coefficients */ - - unsigned int i, j, k; - double out[8 * 8]; - - /* out = block * coefficients */ - for (i = 0; i < 64; i += 8) { - for (j = 0; j < 8; ++j) { - double tmp = 0; - for (k = 0; k < 8; ++k) { - tmp += block[i + k] * coefficients[k * 8 + j]; - } - out[i + j] = tmp; - } - } - - /* block = (coefficients') * out */ - for (i = 0; i < 8; ++i) { - for (j = 0; j < 8; ++j) { - double tmp = 0; - for (k = 0; k < 64; k += 8) { - tmp += coefficients[k + i] * out[k + j]; - } - block[i * 8 + j] = floor(tmp + 0.5); - } - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.h deleted file mode 100644 index f6fde8863..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dctref.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * reference discrete cosine transform (double precision) - * Copyright (C) 2009 Dylan Yudaken - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DCTREF_H -#define AVCODEC_DCTREF_H - -void ff_ref_fdct(short *block); -void ff_ref_idct(short *block); -void ff_ref_dct_init(void); - -#endif /* AVCODEC_DCTREF_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.c deleted file mode 100644 index ab4daf329..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * Copyright (C) 2011 Jordi Ortiz - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Dirac Decoder - * @author Marco Gerards , David Conrad, Jordi Ortiz - */ - -#include "libavutil/imgutils.h" -#include "dirac.h" -#include "avcodec.h" -#include "golomb.h" -#include "internal.h" -#include "mpeg12data.h" - -/* defaults for source parameters */ -static const dirac_source_params dirac_source_parameters_defaults[] = { - { 640, 480, 2, 0, 0, 1, 1, 640, 480, 0, 0, 1, 0 }, - { 176, 120, 2, 0, 0, 9, 2, 176, 120, 0, 0, 1, 1 }, - { 176, 144, 2, 0, 1, 10, 3, 176, 144, 0, 0, 1, 2 }, - { 352, 240, 2, 0, 0, 9, 2, 352, 240, 0, 0, 1, 1 }, - { 352, 288, 2, 0, 1, 10, 3, 352, 288, 0, 0, 1, 2 }, - { 704, 480, 2, 0, 0, 9, 2, 704, 480, 0, 0, 1, 1 }, - { 704, 576, 2, 0, 1, 10, 3, 704, 576, 0, 0, 1, 2 }, - { 720, 480, 1, 1, 0, 4, 2, 704, 480, 8, 0, 3, 1 }, - { 720, 576, 1, 1, 1, 3, 3, 704, 576, 8, 0, 3, 2 }, - { 1280, 720, 1, 0, 1, 7, 1, 1280, 720, 0, 0, 3, 3 }, - { 1280, 720, 1, 0, 1, 6, 1, 1280, 720, 0, 0, 3, 3 }, - { 1920, 1080, 1, 1, 1, 4, 1, 1920, 1080, 0, 0, 3, 3 }, - { 1920, 1080, 1, 1, 1, 3, 1, 1920, 1080, 0, 0, 3, 3 }, - { 1920, 1080, 1, 0, 1, 7, 1, 1920, 1080, 0, 0, 3, 3 }, - { 1920, 1080, 1, 0, 1, 6, 1, 1920, 1080, 0, 0, 3, 3 }, - { 2048, 1080, 0, 0, 1, 2, 1, 2048, 1080, 0, 0, 4, 4 }, - { 4096, 2160, 0, 0, 1, 2, 1, 4096, 2160, 0, 0, 4, 4 }, - { 3840, 2160, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 }, - { 3840, 2160, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 }, - { 7680, 4320, 1, 0, 1, 7, 1, 3840, 2160, 0, 0, 3, 3 }, - { 7680, 4320, 1, 0, 1, 6, 1, 3840, 2160, 0, 0, 3, 3 }, -}; - -/* [DIRAC_STD] Table 10.4 - Available preset pixel aspect ratio values */ -static const AVRational dirac_preset_aspect_ratios[] = { - {1, 1}, - {10, 11}, - {12, 11}, - {40, 33}, - {16, 11}, - {4, 3}, -}; - -/* [DIRAC_STD] Values 9,10 of 10.3.5 Frame Rate. - * Table 10.3 Available preset frame rate values - */ -static const AVRational dirac_frame_rate[] = { - {15000, 1001}, - {25, 2}, -}; - -/* [DIRAC_STD] This should be equivalent to Table 10.5 Available signal - * range presets */ -static const struct { - uint8_t bitdepth; - enum AVColorRange color_range; -} pixel_range_presets[] = { - {8, AVCOL_RANGE_JPEG}, - {8, AVCOL_RANGE_MPEG}, - {10, AVCOL_RANGE_MPEG}, - {12, AVCOL_RANGE_MPEG}, -}; - -static const enum AVColorPrimaries dirac_primaries[] = { - AVCOL_PRI_BT709, - AVCOL_PRI_SMPTE170M, - AVCOL_PRI_BT470BG, -}; - -static const struct { - enum AVColorPrimaries color_primaries; - enum AVColorSpace colorspace; - enum AVColorTransferCharacteristic color_trc; -} dirac_color_presets[] = { - { AVCOL_PRI_BT709, AVCOL_SPC_BT709, AVCOL_TRC_BT709 }, - { AVCOL_PRI_SMPTE170M, AVCOL_SPC_BT470BG, AVCOL_TRC_BT709 }, - { AVCOL_PRI_BT470BG, AVCOL_SPC_BT470BG, AVCOL_TRC_BT709 }, - { AVCOL_PRI_BT709, AVCOL_SPC_BT709, AVCOL_TRC_BT709 }, - { AVCOL_PRI_BT709, AVCOL_SPC_BT709, AVCOL_TRC_UNSPECIFIED /* DCinema */ }, -}; - -/* [DIRAC_STD] Table 10.2 Supported chroma sampling formats + luma Offset */ -static const enum AVPixelFormat dirac_pix_fmt[2][3] = { - { AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV420P }, - { AV_PIX_FMT_YUVJ444P, AV_PIX_FMT_YUVJ422P, AV_PIX_FMT_YUVJ420P }, -}; - -/* [DIRAC_STD] 10.3 Parse Source Parameters. - * source_parameters(base_video_format) */ -static int parse_source_parameters(AVCodecContext *avctx, GetBitContext *gb, - dirac_source_params *source) -{ - AVRational frame_rate = {0,0}; - unsigned luma_depth = 8, luma_offset = 16; - int idx; - int chroma_x_shift, chroma_y_shift; - - /* [DIRAC_STD] 10.3.2 Frame size. frame_size(video_params) */ - /* [DIRAC_STD] custom_dimensions_flag */ - if (get_bits1(gb)) { - source->width = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_WIDTH */ - source->height = svq3_get_ue_golomb(gb); /* [DIRAC_STD] FRAME_HEIGHT */ - } - - /* [DIRAC_STD] 10.3.3 Chroma Sampling Format. - * chroma_sampling_format(video_params) */ - /* [DIRAC_STD] custom_chroma_format_flag */ - if (get_bits1(gb)) - /* [DIRAC_STD] CHROMA_FORMAT_INDEX */ - source->chroma_format = svq3_get_ue_golomb(gb); - if (source->chroma_format > 2U) { - av_log(avctx, AV_LOG_ERROR, "Unknown chroma format %d\n", - source->chroma_format); - return AVERROR_INVALIDDATA; - } - - /* [DIRAC_STD] 10.3.4 Scan Format. scan_format(video_params) */ - /* [DIRAC_STD] custom_scan_format_flag */ - if (get_bits1(gb)) - /* [DIRAC_STD] SOURCE_SAMPLING */ - source->interlaced = svq3_get_ue_golomb(gb); - if (source->interlaced > 1U) - return AVERROR_INVALIDDATA; - - /* [DIRAC_STD] 10.3.5 Frame Rate. frame_rate(video_params) */ - if (get_bits1(gb)) { /* [DIRAC_STD] custom_frame_rate_flag */ - source->frame_rate_index = svq3_get_ue_golomb(gb); - - if (source->frame_rate_index > 10U) - return AVERROR_INVALIDDATA; - - if (!source->frame_rate_index) { - /* [DIRAC_STD] FRAME_RATE_NUMER */ - frame_rate.num = svq3_get_ue_golomb(gb); - /* [DIRAC_STD] FRAME_RATE_DENOM */ - frame_rate.den = svq3_get_ue_golomb(gb); - } - } - /* [DIRAC_STD] preset_frame_rate(video_params, index) */ - if (source->frame_rate_index > 0) { - if (source->frame_rate_index <= 8) - frame_rate = ff_mpeg12_frame_rate_tab[source->frame_rate_index]; - else - /* [DIRAC_STD] Table 10.3 values 9-10 */ - frame_rate = dirac_frame_rate[source->frame_rate_index-9]; - } - av_reduce(&avctx->time_base.num, &avctx->time_base.den, - frame_rate.den, frame_rate.num, 1<<30); - - /* [DIRAC_STD] 10.3.6 Pixel Aspect Ratio. - * pixel_aspect_ratio(video_params) */ - if (get_bits1(gb)) { /* [DIRAC_STD] custom_pixel_aspect_ratio_flag */ - /* [DIRAC_STD] index */ - source->aspect_ratio_index = svq3_get_ue_golomb(gb); - - if (source->aspect_ratio_index > 6U) - return AVERROR_INVALIDDATA; - - if (!source->aspect_ratio_index) { - avctx->sample_aspect_ratio.num = svq3_get_ue_golomb(gb); - avctx->sample_aspect_ratio.den = svq3_get_ue_golomb(gb); - } - } - /* [DIRAC_STD] Take value from Table 10.4 Available preset pixel - * aspect ratio values */ - if (source->aspect_ratio_index > 0) - avctx->sample_aspect_ratio = - dirac_preset_aspect_ratios[source->aspect_ratio_index-1]; - - /* [DIRAC_STD] 10.3.7 Clean area. clean_area(video_params) */ - if (get_bits1(gb)) { /* [DIRAC_STD] custom_clean_area_flag */ - /* [DIRAC_STD] CLEAN_WIDTH */ - source->clean_width = svq3_get_ue_golomb(gb); - /* [DIRAC_STD] CLEAN_HEIGHT */ - source->clean_height = svq3_get_ue_golomb(gb); - /* [DIRAC_STD] CLEAN_LEFT_OFFSET */ - source->clean_left_offset = svq3_get_ue_golomb(gb); - /* [DIRAC_STD] CLEAN_RIGHT_OFFSET */ - source->clean_right_offset = svq3_get_ue_golomb(gb); - } - - /* [DIRAC_STD] 10.3.8 Signal range. signal_range(video_params) - * WARNING: Some adaptation seems to be done using the - * AVCOL_RANGE_MPEG/JPEG values */ - if (get_bits1(gb)) { /* [DIRAC_STD] custom_signal_range_flag */ - /* [DIRAC_STD] index */ - source->pixel_range_index = svq3_get_ue_golomb(gb); - - if (source->pixel_range_index > 4U) - return AVERROR_INVALIDDATA; - - /* This assumes either fullrange or MPEG levels only */ - if (!source->pixel_range_index) { - luma_offset = svq3_get_ue_golomb(gb); - luma_depth = av_log2(svq3_get_ue_golomb(gb))+1; - svq3_get_ue_golomb(gb); /* chroma offset */ - svq3_get_ue_golomb(gb); /* chroma excursion */ - avctx->color_range = luma_offset ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG; - } - } - /* [DIRAC_STD] Table 10.5 - * Available signal range presets <--> pixel_range_presets */ - if (source->pixel_range_index > 0) { - idx = source->pixel_range_index-1; - luma_depth = pixel_range_presets[idx].bitdepth; - avctx->color_range = pixel_range_presets[idx].color_range; - } - - if (luma_depth > 8) - av_log(avctx, AV_LOG_WARNING, "Bitdepth greater than 8\n"); - - avctx->pix_fmt = dirac_pix_fmt[!luma_offset][source->chroma_format]; - avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift); - if ((source->width % (1<height % (1<color_spec_index = svq3_get_ue_golomb(gb); - - if (source->color_spec_index > 4U) - return AVERROR_INVALIDDATA; - - avctx->color_primaries = dirac_color_presets[idx].color_primaries; - avctx->colorspace = dirac_color_presets[idx].colorspace; - avctx->color_trc = dirac_color_presets[idx].color_trc; - - if (!source->color_spec_index) { - /* [DIRAC_STD] 10.3.9.1 Colour primaries */ - if (get_bits1(gb)) { - idx = svq3_get_ue_golomb(gb); - if (idx < 3U) - avctx->color_primaries = dirac_primaries[idx]; - } - /* [DIRAC_STD] 10.3.9.2 Colour matrix */ - if (get_bits1(gb)) { - idx = svq3_get_ue_golomb(gb); - if (!idx) - avctx->colorspace = AVCOL_SPC_BT709; - else if (idx == 1) - avctx->colorspace = AVCOL_SPC_BT470BG; - } - /* [DIRAC_STD] 10.3.9.3 Transfer function */ - if (get_bits1(gb) && !svq3_get_ue_golomb(gb)) - avctx->color_trc = AVCOL_TRC_BT709; - } - } else { - idx = source->color_spec_index; - avctx->color_primaries = dirac_color_presets[idx].color_primaries; - avctx->colorspace = dirac_color_presets[idx].colorspace; - avctx->color_trc = dirac_color_presets[idx].color_trc; - } - - return 0; -} - -/* [DIRAC_STD] 10. Sequence Header. sequence_header() */ -int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, - dirac_source_params *source) -{ - unsigned version_major; - unsigned video_format, picture_coding_mode; - int ret; - - /* [DIRAC_SPEC] 10.1 Parse Parameters. parse_parameters() */ - version_major = svq3_get_ue_golomb(gb); - svq3_get_ue_golomb(gb); /* version_minor */ - avctx->profile = svq3_get_ue_golomb(gb); - avctx->level = svq3_get_ue_golomb(gb); - /* [DIRAC_SPEC] sequence_header() -> base_video_format as defined in - * 10.2 Base Video Format, table 10.1 Dirac predefined video formats */ - video_format = svq3_get_ue_golomb(gb); - - if (version_major < 2) - av_log(avctx, AV_LOG_WARNING, "Stream is old and may not work\n"); - else if (version_major > 2) - av_log(avctx, AV_LOG_WARNING, "Stream may have unhandled features\n"); - - if (video_format > 20U) - return AVERROR_INVALIDDATA; - - /* Fill in defaults for the source parameters. */ - *source = dirac_source_parameters_defaults[video_format]; - - /* [DIRAC_STD] 10.3 Source Parameters - * Override the defaults. */ - if ((ret = parse_source_parameters(avctx, gb, source))) - return ret; - - ret = ff_set_dimensions(avctx, source->width, source->height); - if (ret < 0) - return ret; - - /* [DIRAC_STD] picture_coding_mode shall be 0 for fields and 1 for frames - * currently only used to signal field coding */ - picture_coding_mode = svq3_get_ue_golomb(gb); - if (picture_coding_mode != 0) { - av_log(avctx, AV_LOG_ERROR, "Unsupported picture coding mode %d\n", - picture_coding_mode); - return AVERROR_INVALIDDATA; - } - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.h deleted file mode 100644 index b0f955bf4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * Copyright (C) 2011 Jordi Ortiz - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DIRAC_H -#define AVCODEC_DIRAC_H - -/** - * @file - * Interface to Dirac Decoder/Encoder - * @author Marco Gerards - * @author David Conrad - * @author Jordi Ortiz - */ - -#include "avcodec.h" -#include "get_bits.h" - -typedef struct dirac_source_params { - unsigned width; - unsigned height; - uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 - - uint8_t interlaced; - uint8_t top_field_first; - - uint8_t frame_rate_index; ///< index into dirac_frame_rate[] - uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] - - uint16_t clean_width; - uint16_t clean_height; - uint16_t clean_left_offset; - uint16_t clean_right_offset; - - uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] - uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] -} dirac_source_params; - -int avpriv_dirac_parse_sequence_header(AVCodecContext *avctx, GetBitContext *gb, - dirac_source_params *source); - -#endif /* AVCODEC_DIRAC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.c deleted file mode 100644 index bf913928b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Arithmetic decoder for Dirac - * @author Marco Gerards - */ - -#include "dirac_arith.h" - - -const uint16_t ff_dirac_prob[256] = { - 0, 2, 5, 8, 11, 15, 20, 24, - 29, 35, 41, 47, 53, 60, 67, 74, - 82, 89, 97, 106, 114, 123, 132, 141, - 150, 160, 170, 180, 190, 201, 211, 222, - 233, 244, 256, 267, 279, 291, 303, 315, - 327, 340, 353, 366, 379, 392, 405, 419, - 433, 447, 461, 475, 489, 504, 518, 533, - 548, 563, 578, 593, 609, 624, 640, 656, - 672, 688, 705, 721, 738, 754, 771, 788, - 805, 822, 840, 857, 875, 892, 910, 928, - 946, 964, 983, 1001, 1020, 1038, 1057, 1076, - 1095, 1114, 1133, 1153, 1172, 1192, 1211, 1231, - 1251, 1271, 1291, 1311, 1332, 1352, 1373, 1393, - 1414, 1435, 1456, 1477, 1498, 1520, 1541, 1562, - 1584, 1606, 1628, 1649, 1671, 1694, 1716, 1738, - 1760, 1783, 1806, 1828, 1851, 1874, 1897, 1920, - 1935, 1942, 1949, 1955, 1961, 1968, 1974, 1980, - 1985, 1991, 1996, 2001, 2006, 2011, 2016, 2021, - 2025, 2029, 2033, 2037, 2040, 2044, 2047, 2050, - 2053, 2056, 2058, 2061, 2063, 2065, 2066, 2068, - 2069, 2070, 2071, 2072, 2072, 2072, 2072, 2072, - 2072, 2071, 2070, 2069, 2068, 2066, 2065, 2063, - 2060, 2058, 2055, 2052, 2049, 2045, 2042, 2038, - 2033, 2029, 2024, 2019, 2013, 2008, 2002, 1996, - 1989, 1982, 1975, 1968, 1960, 1952, 1943, 1934, - 1925, 1916, 1906, 1896, 1885, 1874, 1863, 1851, - 1839, 1827, 1814, 1800, 1786, 1772, 1757, 1742, - 1727, 1710, 1694, 1676, 1659, 1640, 1622, 1602, - 1582, 1561, 1540, 1518, 1495, 1471, 1447, 1422, - 1396, 1369, 1341, 1312, 1282, 1251, 1219, 1186, - 1151, 1114, 1077, 1037, 995, 952, 906, 857, - 805, 750, 690, 625, 553, 471, 376, 255 -}; - -const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT] = { - [CTX_ZPZN_F1] = CTX_ZP_F2, - [CTX_ZPNN_F1] = CTX_ZP_F2, - [CTX_ZP_F2] = CTX_ZP_F3, - [CTX_ZP_F3] = CTX_ZP_F4, - [CTX_ZP_F4] = CTX_ZP_F5, - [CTX_ZP_F5] = CTX_ZP_F6, - [CTX_ZP_F6] = CTX_ZP_F6, - [CTX_NPZN_F1] = CTX_NP_F2, - [CTX_NPNN_F1] = CTX_NP_F2, - [CTX_NP_F2] = CTX_NP_F3, - [CTX_NP_F3] = CTX_NP_F4, - [CTX_NP_F4] = CTX_NP_F5, - [CTX_NP_F5] = CTX_NP_F6, - [CTX_NP_F6] = CTX_NP_F6, - [CTX_DELTA_Q_F] = CTX_DELTA_Q_F, -}; - -int16_t ff_dirac_prob_branchless[256][2]; - -void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length) -{ - int i; - align_get_bits(gb); - - length = FFMIN(length, get_bits_left(gb)/8); - - c->bytestream = gb->buffer + get_bits_count(gb)/8; - c->bytestream_end = c->bytestream + length; - skip_bits_long(gb, length*8); - - c->low = 0; - for (i = 0; i < 4; i++) { - c->low <<= 8; - if (c->bytestream < c->bytestream_end) - c->low |= *c->bytestream++; - else - c->low |= 0xff; - } - - c->counter = -16; - c->range = 0xffff; - - for (i = 0; i < 256; i++) { - ff_dirac_prob_branchless[i][0] = ff_dirac_prob[255-i]; - ff_dirac_prob_branchless[i][1] = -ff_dirac_prob[i]; - } - - for (i = 0; i < DIRAC_CTX_COUNT; i++) - c->contexts[i] = 0x8000; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.h deleted file mode 100644 index f9a8bba5f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_arith.h +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Arithmetic decoder for Dirac - * @author Marco Gerards - */ - -#ifndef AVCODEC_DIRAC_ARITH_H -#define AVCODEC_DIRAC_ARITH_H - -#include "bytestream.h" -#include "get_bits.h" - -enum dirac_arith_contexts { - CTX_ZPZN_F1, - CTX_ZPNN_F1, - CTX_NPZN_F1, - CTX_NPNN_F1, - CTX_ZP_F2, - CTX_ZP_F3, - CTX_ZP_F4, - CTX_ZP_F5, - CTX_ZP_F6, - CTX_NP_F2, - CTX_NP_F3, - CTX_NP_F4, - CTX_NP_F5, - CTX_NP_F6, - CTX_COEFF_DATA, - CTX_SIGN_NEG, - CTX_SIGN_ZERO, - CTX_SIGN_POS, - CTX_ZERO_BLOCK, - CTX_DELTA_Q_F, - CTX_DELTA_Q_DATA, - CTX_DELTA_Q_SIGN, - - DIRAC_CTX_COUNT -}; - -// Dirac resets the arith decoder between decoding various types of data, -// so many contexts are never used simultaneously. Thus, we can reduce -// the number of contexts needed by reusing them. -#define CTX_SB_F1 CTX_ZP_F5 -#define CTX_SB_DATA 0 -#define CTX_PMODE_REF1 0 -#define CTX_PMODE_REF2 1 -#define CTX_GLOBAL_BLOCK 2 -#define CTX_MV_F1 CTX_ZP_F2 -#define CTX_MV_DATA 0 -#define CTX_DC_F1 CTX_ZP_F5 -#define CTX_DC_DATA 0 - -typedef struct { - unsigned low; - uint16_t range; - int16_t counter; - - const uint8_t *bytestream; - const uint8_t *bytestream_end; - - uint16_t contexts[DIRAC_CTX_COUNT]; -} DiracArith; - -extern const uint8_t ff_dirac_next_ctx[DIRAC_CTX_COUNT]; -extern const uint16_t ff_dirac_prob[256]; -extern int16_t ff_dirac_prob_branchless[256][2]; - -static inline void renorm(DiracArith *c) -{ -#if HAVE_FAST_CLZ - int shift = 14 - av_log2_16bit(c->range-1) + ((c->range-1)>>15); - - c->low <<= shift; - c->range <<= shift; - c->counter += shift; -#else - while (c->range <= 0x4000) { - c->low <<= 1; - c->range <<= 1; - c->counter++; - } -#endif -} - -static inline void refill(DiracArith *c) -{ - int counter = c->counter; - - if (counter >= 0) { - int new = bytestream_get_be16(&c->bytestream); - - // the spec defines overread bits to be 1, and streams rely on this - if (c->bytestream > c->bytestream_end) { - new |= 0xff; - if (c->bytestream > c->bytestream_end+1) - new |= 0xff00; - - c->bytestream = c->bytestream_end; - } - - c->low += new << counter; - counter -= 16; - } - c->counter = counter; -} - -static inline int dirac_get_arith_bit(DiracArith *c, int ctx) -{ - int prob_zero = c->contexts[ctx]; - int range_times_prob, bit; - unsigned low = c->low; - int range = c->range; - - range_times_prob = (c->range * prob_zero) >> 16; - -#if HAVE_FAST_CMOV && HAVE_INLINE_ASM - low -= range_times_prob << 16; - range -= range_times_prob; - bit = 0; - __asm__( - "cmpl %5, %4 \n\t" - "setae %b0 \n\t" - "cmovb %3, %2 \n\t" - "cmovb %5, %1 \n\t" - : "+q"(bit), "+r"(range), "+r"(low) - : "r"(c->low), "r"(c->low>>16), - "r"(range_times_prob) - ); -#else - bit = (low >> 16) >= range_times_prob; - if (bit) { - low -= range_times_prob << 16; - range -= range_times_prob; - } else { - range = range_times_prob; - } -#endif - - c->contexts[ctx] += ff_dirac_prob_branchless[prob_zero>>8][bit]; - c->low = low; - c->range = range; - - renorm(c); - refill(c); - return bit; -} - -static inline int dirac_get_arith_uint(DiracArith *c, int follow_ctx, int data_ctx) -{ - int ret = 1; - while (!dirac_get_arith_bit(c, follow_ctx)) { - ret <<= 1; - ret += dirac_get_arith_bit(c, data_ctx); - follow_ctx = ff_dirac_next_ctx[follow_ctx]; - } - return ret-1; -} - -static inline int dirac_get_arith_int(DiracArith *c, int follow_ctx, int data_ctx) -{ - int ret = dirac_get_arith_uint(c, follow_ctx, data_ctx); - if (ret && dirac_get_arith_bit(c, data_ctx+1)) - ret = -ret; - return ret; -} - -void ff_dirac_init_arith_decoder(DiracArith *c, GetBitContext *gb, int length); - -#endif /* AVCODEC_DIRAC_ARITH_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.c deleted file mode 100644 index 698f11fa8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * Copyright (C) 2004-2010 Michael Niedermayer - * Copyright (C) 2008 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "dsputil.h" -#include "dirac_dwt.h" -#include "libavcodec/x86/dirac_dwt.h" - - -static inline int mirror(int v, int m) -{ - while ((unsigned)v > (unsigned)m) { - v = -v; - if (v < 0) - v += 2 * m; - } - return v; -} - -static void vertical_compose53iL0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, - int width) -{ - int i; - - for (i = 0; i < width; i++) - b1[i] -= (b0[i] + b2[i] + 2) >> 2; -} - - -static av_always_inline -void interleave(IDWTELEM *dst, IDWTELEM *src0, IDWTELEM *src1, int w2, int add, int shift) -{ - int i; - for (i = 0; i < w2; i++) { - dst[2*i ] = (src0[i] + add) >> shift; - dst[2*i+1] = (src1[i] + add) >> shift; - } -} - -static void horizontal_compose_dirac53i(IDWTELEM *b, IDWTELEM *temp, int w) -{ - const int w2 = w >> 1; - int x; - - temp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]); - for (x = 1; x < w2; x++) { - temp[x ] = COMPOSE_53iL0 (b[x+w2-1], b[x ], b[x+w2]); - temp[x+w2-1] = COMPOSE_DIRAC53iH0(temp[x-1], b[x+w2-1], temp[x]); - } - temp[w-1] = COMPOSE_DIRAC53iH0(temp[w2-1], b[w-1], temp[w2-1]); - - interleave(b, temp, temp+w2, w2, 1, 1); -} - -static void horizontal_compose_dd97i(IDWTELEM *b, IDWTELEM *tmp, int w) -{ - const int w2 = w >> 1; - int x; - - tmp[0] = COMPOSE_53iL0(b[w2], b[0], b[w2]); - for (x = 1; x < w2; x++) - tmp[x] = COMPOSE_53iL0(b[x+w2-1], b[x], b[x+w2]); - - // extend the edges - tmp[-1] = tmp[0]; - tmp[w2+1] = tmp[w2] = tmp[w2-1]; - - for (x = 0; x < w2; x++) { - b[2*x ] = (tmp[x] + 1)>>1; - b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1)>>1; - } -} - -static void horizontal_compose_dd137i(IDWTELEM *b, IDWTELEM *tmp, int w) -{ - const int w2 = w >> 1; - int x; - - tmp[0] = COMPOSE_DD137iL0(b[w2], b[w2], b[0], b[w2 ], b[w2+1]); - tmp[1] = COMPOSE_DD137iL0(b[w2], b[w2], b[1], b[w2+1], b[w2+2]); - for (x = 2; x < w2-1; x++) - tmp[x] = COMPOSE_DD137iL0(b[x+w2-2], b[x+w2-1], b[x], b[x+w2], b[x+w2+1]); - tmp[w2-1] = COMPOSE_DD137iL0(b[w-3], b[w-2], b[w2-1], b[w-1], b[w-1]); - - // extend the edges - tmp[-1] = tmp[0]; - tmp[w2+1] = tmp[w2] = tmp[w2-1]; - - for (x = 0; x < w2; x++) { - b[2*x ] = (tmp[x] + 1)>>1; - b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1)>>1; - } -} - -static av_always_inline -void horizontal_compose_haari(IDWTELEM *b, IDWTELEM *temp, int w, int shift) -{ - const int w2 = w >> 1; - int x; - - for (x = 0; x < w2; x++) { - temp[x ] = COMPOSE_HAARiL0(b[x ], b[x+w2]); - temp[x+w2] = COMPOSE_HAARiH0(b[x+w2], temp[x]); - } - - interleave(b, temp, temp+w2, w2, shift, shift); -} - -static void horizontal_compose_haar0i(IDWTELEM *b, IDWTELEM *temp, int w) -{ - horizontal_compose_haari(b, temp, w, 0); -} - -static void horizontal_compose_haar1i(IDWTELEM *b, IDWTELEM *temp, int w) -{ - horizontal_compose_haari(b, temp, w, 1); -} - -static void horizontal_compose_fidelityi(IDWTELEM *b, IDWTELEM *tmp, int w) -{ - const int w2 = w >> 1; - int i, x; - IDWTELEM v[8]; - - for (x = 0; x < w2; x++) { - for (i = 0; i < 8; i++) - v[i] = b[av_clip(x-3+i, 0, w2-1)]; - tmp[x] = COMPOSE_FIDELITYiH0(v[0], v[1], v[2], v[3], b[x+w2], v[4], v[5], v[6], v[7]); - } - - for (x = 0; x < w2; x++) { - for (i = 0; i < 8; i++) - v[i] = tmp[av_clip(x-4+i, 0, w2-1)]; - tmp[x+w2] = COMPOSE_FIDELITYiL0(v[0], v[1], v[2], v[3], b[x], v[4], v[5], v[6], v[7]); - } - - interleave(b, tmp+w2, tmp, w2, 0, 0); -} - -static void horizontal_compose_daub97i(IDWTELEM *b, IDWTELEM *temp, int w) -{ - const int w2 = w >> 1; - int x, b0, b1, b2; - - temp[0] = COMPOSE_DAUB97iL1(b[w2], b[0], b[w2]); - for (x = 1; x < w2; x++) { - temp[x ] = COMPOSE_DAUB97iL1(b[x+w2-1], b[x ], b[x+w2]); - temp[x+w2-1] = COMPOSE_DAUB97iH1(temp[x-1], b[x+w2-1], temp[x]); - } - temp[w-1] = COMPOSE_DAUB97iH1(temp[w2-1], b[w-1], temp[w2-1]); - - // second stage combined with interleave and shift - b0 = b2 = COMPOSE_DAUB97iL0(temp[w2], temp[0], temp[w2]); - b[0] = (b0 + 1) >> 1; - for (x = 1; x < w2; x++) { - b2 = COMPOSE_DAUB97iL0(temp[x+w2-1], temp[x ], temp[x+w2]); - b1 = COMPOSE_DAUB97iH0( b0, temp[x+w2-1], b2 ); - b[2*x-1] = (b1 + 1) >> 1; - b[2*x ] = (b2 + 1) >> 1; - b0 = b2; - } - b[w-1] = (COMPOSE_DAUB97iH0(b2, temp[w-1], b2) + 1) >> 1; -} - -static void vertical_compose_dirac53iH0(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width) -{ - int i; - - for(i=0; ivertical_compose_l0; - vertical_compose_5tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - DWTCompose *cs = d->cs + level; - - int i, y = cs->y; - IDWTELEM *b[8]; - for (i = 0; i < 6; i++) - b[i] = cs->b[i]; - b[6] = d->buffer + av_clip(y+5, 0, height-2)*stride; - b[7] = d->buffer + av_clip(y+6, 1, height-1)*stride; - - if(y+5<(unsigned)height) vertical_compose_l0( b[5], b[6], b[7], width); - if(y+1<(unsigned)height) vertical_compose_h0(b[0], b[2], b[3], b[4], b[6], width); - - if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); - if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); - - for (i = 0; i < 6; i++) - cs->b[i] = b[i+2]; - cs->y += 2; -} - -static void spatial_compose_dirac53i_dy(DWTContext *d, int level, int width, int height, int stride) -{ - vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - DWTCompose *cs = d->cs + level; - - int y= cs->y; - IDWTELEM *b[4] = { cs->b[0], cs->b[1] }; - b[2] = d->buffer + mirror(y+1, height-1)*stride; - b[3] = d->buffer + mirror(y+2, height-1)*stride; - - if(y+1<(unsigned)height) vertical_compose_l0(b[1], b[2], b[3], width); - if(y+0<(unsigned)height) vertical_compose_h0(b[0], b[1], b[2], width); - - if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); - if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); - - cs->b[0] = b[2]; - cs->b[1] = b[3]; - cs->y += 2; -} - - -static void spatial_compose_dd137i_dy(DWTContext *d, int level, int width, int height, int stride) -{ - vertical_compose_5tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_5tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - DWTCompose *cs = d->cs + level; - - int i, y = cs->y; - IDWTELEM *b[10]; - for (i = 0; i < 8; i++) - b[i] = cs->b[i]; - b[8] = d->buffer + av_clip(y+7, 0, height-2)*stride; - b[9] = d->buffer + av_clip(y+8, 1, height-1)*stride; - - if(y+5<(unsigned)height) vertical_compose_l0(b[3], b[5], b[6], b[7], b[9], width); - if(y+1<(unsigned)height) vertical_compose_h0(b[0], b[2], b[3], b[4], b[6], width); - - if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); - if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); - - for (i = 0; i < 8; i++) - cs->b[i] = b[i+2]; - cs->y += 2; -} - -// haar makes the assumption that height is even (always true for dirac) -static void spatial_compose_haari_dy(DWTContext *d, int level, int width, int height, int stride) -{ - vertical_compose_2tap vertical_compose = (void*)d->vertical_compose; - int y = d->cs[level].y; - IDWTELEM *b0 = d->buffer + (y-1)*stride; - IDWTELEM *b1 = d->buffer + (y )*stride; - - vertical_compose(b0, b1, width); - d->horizontal_compose(b0, d->temp, width); - d->horizontal_compose(b1, d->temp, width); - - d->cs[level].y += 2; -} - -// Don't do sliced idwt for fidelity; the 9 tap filter makes it a bit annoying -// Fortunately, this filter isn't used in practice. -static void spatial_compose_fidelity(DWTContext *d, int level, int width, int height, int stride) -{ - vertical_compose_9tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_9tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - int i, y; - IDWTELEM *b[8]; - - for (y = 1; y < height; y += 2) { - for (i = 0; i < 8; i++) - b[i] = d->buffer + av_clip((y-7 + 2*i), 0, height-2)*stride; - vertical_compose_h0(d->buffer + y*stride, b, width); - } - - for (y = 0; y < height; y += 2) { - for (i = 0; i < 8; i++) - b[i] = d->buffer + av_clip((y-7 + 2*i), 1, height-1)*stride; - vertical_compose_l0(d->buffer + y*stride, b, width); - } - - for (y = 0; y < height; y++) - d->horizontal_compose(d->buffer + y*stride, d->temp, width); - - d->cs[level].y = height+1; -} - -static void spatial_compose_daub97i_dy(DWTContext *d, int level, int width, int height, int stride) -{ - vertical_compose_3tap vertical_compose_l0 = (void*)d->vertical_compose_l0; - vertical_compose_3tap vertical_compose_h0 = (void*)d->vertical_compose_h0; - vertical_compose_3tap vertical_compose_l1 = (void*)d->vertical_compose_l1; - vertical_compose_3tap vertical_compose_h1 = (void*)d->vertical_compose_h1; - DWTCompose *cs = d->cs + level; - - int i, y = cs->y; - IDWTELEM *b[6]; - for (i = 0; i < 4; i++) - b[i] = cs->b[i]; - b[4] = d->buffer + mirror(y+3, height-1)*stride; - b[5] = d->buffer + mirror(y+4, height-1)*stride; - - if(y+3<(unsigned)height) vertical_compose_l1(b[3], b[4], b[5], width); - if(y+2<(unsigned)height) vertical_compose_h1(b[2], b[3], b[4], width); - if(y+1<(unsigned)height) vertical_compose_l0(b[1], b[2], b[3], width); - if(y+0<(unsigned)height) vertical_compose_h0(b[0], b[1], b[2], width); - - if(y-1<(unsigned)height) d->horizontal_compose(b[0], d->temp, width); - if(y+0<(unsigned)height) d->horizontal_compose(b[1], d->temp, width); - - for (i = 0; i < 4; i++) - cs->b[i] = b[i+2]; - cs->y += 2; -} - - -static void spatial_compose97i_init2(DWTCompose *cs, IDWTELEM *buffer, int height, int stride) -{ - cs->b[0] = buffer + mirror(-3-1, height-1)*stride; - cs->b[1] = buffer + mirror(-3 , height-1)*stride; - cs->b[2] = buffer + mirror(-3+1, height-1)*stride; - cs->b[3] = buffer + mirror(-3+2, height-1)*stride; - cs->y = -3; -} - -static void spatial_compose53i_init2(DWTCompose *cs, IDWTELEM *buffer, int height, int stride) -{ - cs->b[0] = buffer + mirror(-1-1, height-1)*stride; - cs->b[1] = buffer + mirror(-1 , height-1)*stride; - cs->y = -1; -} - -static void spatial_compose_dd97i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride) -{ - cs->b[0] = buffer + av_clip(-5-1, 0, height-2)*stride; - cs->b[1] = buffer + av_clip(-5 , 1, height-1)*stride; - cs->b[2] = buffer + av_clip(-5+1, 0, height-2)*stride; - cs->b[3] = buffer + av_clip(-5+2, 1, height-1)*stride; - cs->b[4] = buffer + av_clip(-5+3, 0, height-2)*stride; - cs->b[5] = buffer + av_clip(-5+4, 1, height-1)*stride; - cs->y = -5; -} - -static void spatial_compose_dd137i_init(DWTCompose *cs, IDWTELEM *buffer, int height, int stride) -{ - cs->b[0] = buffer + av_clip(-5-1, 0, height-2)*stride; - cs->b[1] = buffer + av_clip(-5 , 1, height-1)*stride; - cs->b[2] = buffer + av_clip(-5+1, 0, height-2)*stride; - cs->b[3] = buffer + av_clip(-5+2, 1, height-1)*stride; - cs->b[4] = buffer + av_clip(-5+3, 0, height-2)*stride; - cs->b[5] = buffer + av_clip(-5+4, 1, height-1)*stride; - cs->b[6] = buffer + av_clip(-5+5, 0, height-2)*stride; - cs->b[7] = buffer + av_clip(-5+6, 1, height-1)*stride; - cs->y = -5; -} - -int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height, - int stride, enum dwt_type type, int decomposition_count, - IDWTELEM *temp) -{ - int level; - - d->buffer = buffer; - d->width = width; - d->height = height; - d->stride = stride; - d->decomposition_count = decomposition_count; - d->temp = temp + 8; - - for(level=decomposition_count-1; level>=0; level--){ - int hl = height >> level; - int stride_l = stride << level; - - switch(type){ - case DWT_DIRAC_DD9_7: - spatial_compose_dd97i_init(d->cs+level, buffer, hl, stride_l); - break; - case DWT_DIRAC_LEGALL5_3: - spatial_compose53i_init2(d->cs+level, buffer, hl, stride_l); - break; - case DWT_DIRAC_DD13_7: - spatial_compose_dd137i_init(d->cs+level, buffer, hl, stride_l); - break; - case DWT_DIRAC_HAAR0: - case DWT_DIRAC_HAAR1: - d->cs[level].y = 1; - break; - case DWT_DIRAC_DAUB9_7: - spatial_compose97i_init2(d->cs+level, buffer, hl, stride_l); - break; - default: - d->cs[level].y = 0; - break; - } - } - - switch (type) { - case DWT_DIRAC_DD9_7: - d->spatial_compose = spatial_compose_dd97i_dy; - d->vertical_compose_l0 = (void*)vertical_compose53iL0; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; - d->horizontal_compose = horizontal_compose_dd97i; - d->support = 7; - break; - case DWT_DIRAC_LEGALL5_3: - d->spatial_compose = spatial_compose_dirac53i_dy; - d->vertical_compose_l0 = (void*)vertical_compose53iL0; - d->vertical_compose_h0 = (void*)vertical_compose_dirac53iH0; - d->horizontal_compose = horizontal_compose_dirac53i; - d->support = 3; - break; - case DWT_DIRAC_DD13_7: - d->spatial_compose = spatial_compose_dd137i_dy; - d->vertical_compose_l0 = (void*)vertical_compose_dd137iL0; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0; - d->horizontal_compose = horizontal_compose_dd137i; - d->support = 7; - break; - case DWT_DIRAC_HAAR0: - case DWT_DIRAC_HAAR1: - d->spatial_compose = spatial_compose_haari_dy; - d->vertical_compose = (void*)vertical_compose_haar; - if (type == DWT_DIRAC_HAAR0) - d->horizontal_compose = horizontal_compose_haar0i; - else - d->horizontal_compose = horizontal_compose_haar1i; - d->support = 1; - break; - case DWT_DIRAC_FIDELITY: - d->spatial_compose = spatial_compose_fidelity; - d->vertical_compose_l0 = (void*)vertical_compose_fidelityiL0; - d->vertical_compose_h0 = (void*)vertical_compose_fidelityiH0; - d->horizontal_compose = horizontal_compose_fidelityi; - d->support = 0; // not really used - break; - case DWT_DIRAC_DAUB9_7: - d->spatial_compose = spatial_compose_daub97i_dy; - d->vertical_compose_l0 = (void*)vertical_compose_daub97iL0; - d->vertical_compose_h0 = (void*)vertical_compose_daub97iH0; - d->vertical_compose_l1 = (void*)vertical_compose_daub97iL1; - d->vertical_compose_h1 = (void*)vertical_compose_daub97iH1; - d->horizontal_compose = horizontal_compose_daub97i; - d->support = 5; - break; - default: - av_log(NULL, AV_LOG_ERROR, "Unknown wavelet type %d\n", type); - return -1; - } - - if (HAVE_MMX) ff_spatial_idwt_init_mmx(d, type); - - return 0; -} - -void ff_spatial_idwt_slice2(DWTContext *d, int y) -{ - int level, support = d->support; - - for (level = d->decomposition_count-1; level >= 0; level--) { - int wl = d->width >> level; - int hl = d->height >> level; - int stride_l = d->stride << level; - - while (d->cs[level].y <= FFMIN((y>>level)+support, hl)) - d->spatial_compose(d, level, wl, hl, stride_l); - } -} - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.h deleted file mode 100644 index 25c13d1a6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_dwt.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (C) 2004-2010 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DIRAC_DWT_H -#define AVCODEC_DIRAC_DWT_H - -#include - -typedef int DWTELEM; -typedef short IDWTELEM; - -#define MAX_DWT_SUPPORT 8 -#define MAX_DECOMPOSITIONS 8 - -typedef struct DWTCompose { - IDWTELEM *b[MAX_DWT_SUPPORT]; - int y; -} DWTCompose; - -struct DWTContext; - -// Possible prototypes for vertical_compose functions -typedef void (*vertical_compose_2tap)(IDWTELEM *b0, IDWTELEM *b1, int width); -typedef void (*vertical_compose_3tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width); -typedef void (*vertical_compose_5tap)(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width); -typedef void (*vertical_compose_9tap)(IDWTELEM *dst, IDWTELEM *b[8], int width); - -typedef struct DWTContext { - IDWTELEM *buffer; - IDWTELEM *temp; - int width; - int height; - int stride; - int decomposition_count; - int support; - - void (*spatial_compose)(struct DWTContext *cs, int level, int width, int height, int stride); - void (*vertical_compose_l0)(void); - void (*vertical_compose_h0)(void); - void (*vertical_compose_l1)(void); - void (*vertical_compose_h1)(void); - void (*vertical_compose)(void); ///< one set of lowpass and highpass combined - void (*horizontal_compose)(IDWTELEM *b, IDWTELEM *tmp, int width); - - DWTCompose cs[MAX_DECOMPOSITIONS]; -} DWTContext; - -enum dwt_type { - DWT_SNOW_DAUB9_7, - DWT_SNOW_LEGALL5_3, - DWT_DIRAC_DD9_7, - DWT_DIRAC_LEGALL5_3, - DWT_DIRAC_DD13_7, - DWT_DIRAC_HAAR0, - DWT_DIRAC_HAAR1, - DWT_DIRAC_FIDELITY, - DWT_DIRAC_DAUB9_7, - DWT_NUM_TYPES -}; - -// -1 if an error occurred, e.g. the dwt_type isn't recognized -int ff_spatial_idwt_init2(DWTContext *d, IDWTELEM *buffer, int width, int height, - int stride, enum dwt_type type, int decomposition_count, - IDWTELEM *temp); - -void ff_spatial_idwt_slice2(DWTContext *d, int y); - -// shared stuff for simd optimiztions -#define COMPOSE_53iL0(b0, b1, b2)\ - (b1 - ((b0 + b2 + 2) >> 2)) - -#define COMPOSE_DIRAC53iH0(b0, b1, b2)\ - (b1 + ((b0 + b2 + 1) >> 1)) - -#define COMPOSE_DD97iH0(b0, b1, b2, b3, b4)\ - (b2 + ((-b0 + 9*b1 + 9*b3 - b4 + 8) >> 4)) - -#define COMPOSE_DD137iL0(b0, b1, b2, b3, b4)\ - (b2 - ((-b0 + 9*b1 + 9*b3 - b4 + 16) >> 5)) - -#define COMPOSE_HAARiL0(b0, b1)\ - (b0 - ((b1 + 1) >> 1)) - -#define COMPOSE_HAARiH0(b0, b1)\ - (b0 + b1) - -#define COMPOSE_FIDELITYiL0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\ - (b4 - ((-8*(b0+b8) + 21*(b1+b7) - 46*(b2+b6) + 161*(b3+b5) + 128) >> 8)) - -#define COMPOSE_FIDELITYiH0(b0, b1, b2, b3, b4, b5, b6, b7, b8)\ - (b4 + ((-2*(b0+b8) + 10*(b1+b7) - 25*(b2+b6) + 81*(b3+b5) + 128) >> 8)) - -#define COMPOSE_DAUB97iL1(b0, b1, b2)\ - (b1 - ((1817*(b0 + b2) + 2048) >> 12)) - -#define COMPOSE_DAUB97iH1(b0, b1, b2)\ - (b1 - (( 113*(b0 + b2) + 64) >> 7)) - -#define COMPOSE_DAUB97iL0(b0, b1, b2)\ - (b1 + (( 217*(b0 + b2) + 2048) >> 12)) - -#define COMPOSE_DAUB97iH0(b0, b1, b2)\ - (b1 + ((6497*(b0 + b2) + 2048) >> 12)) - - -#endif /* AVCODEC_DWT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_parser.c deleted file mode 100644 index 6df3df877..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dirac_parser.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Dirac parser - * - * Copyright (c) 2007-2008 Marco Gerards - * Copyright (c) 2008 BBC, Anuradha Suraparaju - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Dirac Parser - * @author Marco Gerards - */ - -#include - -#include "libavutil/intreadwrite.h" -#include "libavutil/mem.h" -#include "parser.h" - -#define DIRAC_PARSE_INFO_PREFIX 0x42424344 - -/** - * Find the end of the current frame in the bitstream. - * @return the position of the first byte of the next frame or -1 - */ -typedef struct DiracParseContext { - int state; - int is_synced; - int sync_offset; - int header_bytes_needed; - int overread_index; - int buffer_size; - int index; - uint8_t *buffer; - int dirac_unit_size; - uint8_t *dirac_unit; -} DiracParseContext; - -static int find_frame_end(DiracParseContext *pc, - const uint8_t *buf, int buf_size) -{ - uint32_t state = pc->state; - int i = 0; - - if (!pc->is_synced) { - for (i = 0; i < buf_size; i++) { - state = (state << 8) | buf[i]; - if (state == DIRAC_PARSE_INFO_PREFIX) { - state = -1; - pc->is_synced = 1; - pc->header_bytes_needed = 9; - pc->sync_offset = i; - break; - } - } - } - - if (pc->is_synced) { - pc->sync_offset = 0; - for (; i < buf_size; i++) { - if (state == DIRAC_PARSE_INFO_PREFIX) { - if ((buf_size-i) >= pc->header_bytes_needed) { - pc->state = -1; - return i + pc->header_bytes_needed; - } else { - pc->header_bytes_needed = 9-(buf_size-i); - break; - } - } else - state = (state << 8) | buf[i]; - } - } - pc->state = state; - return -1; -} - -typedef struct DiracParseUnit -{ - int next_pu_offset; - int prev_pu_offset; - uint8_t pu_type; -} DiracParseUnit; - -static int unpack_parse_unit(DiracParseUnit *pu, DiracParseContext *pc, - int offset) -{ - uint8_t *start = pc->buffer + offset; - uint8_t *end = pc->buffer + pc->index; - if (start < pc->buffer || (start+13 > end)) - return 0; - pu->pu_type = start[4]; - - pu->next_pu_offset = AV_RB32(start+5); - pu->prev_pu_offset = AV_RB32(start+9); - - if (pu->pu_type == 0x10 && pu->next_pu_offset == 0) - pu->next_pu_offset = 13; - - return 1; -} - -static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx, - int next, const uint8_t **buf, int *buf_size) -{ - int parse_timing_info = (s->pts == AV_NOPTS_VALUE && - s->dts == AV_NOPTS_VALUE); - DiracParseContext *pc = s->priv_data; - - if (pc->overread_index) { - memcpy(pc->buffer, pc->buffer + pc->overread_index, - pc->index - pc->overread_index); - pc->index -= pc->overread_index; - pc->overread_index = 0; - if (*buf_size == 0 && pc->buffer[4] == 0x10) { - *buf = pc->buffer; - *buf_size = pc->index; - return 0; - } - } - - if ( next == -1) { - /* Found a possible frame start but not a frame end */ - void *new_buffer = av_fast_realloc(pc->buffer, (unsigned int *) &pc->buffer_size, - pc->index + (*buf_size - - pc->sync_offset)); - pc->buffer = new_buffer; - memcpy(pc->buffer+pc->index, (*buf + pc->sync_offset), - *buf_size - pc->sync_offset); - pc->index += *buf_size - pc->sync_offset; - return -1; - } else { - /* Found a possible frame start and a possible frame end */ - DiracParseUnit pu1, pu; - void *new_buffer = av_fast_realloc(pc->buffer, (unsigned int *) &pc->buffer_size, - pc->index + next); - pc->buffer = new_buffer; - memcpy(pc->buffer + pc->index, *buf, next); - pc->index += next; - - /* Need to check if we have a valid Parse Unit. We can't go by the - * sync pattern 'BBCD' alone because arithmetic coding of the residual - * and motion data can cause the pattern triggering a false start of - * frame. So check if the previous parse offset of the next parse unit - * is equal to the next parse offset of the current parse unit then - * we can be pretty sure that we have a valid parse unit */ - if (!unpack_parse_unit(&pu1, pc, pc->index - 13) || - !unpack_parse_unit(&pu, pc, pc->index - 13 - pu1.prev_pu_offset) || - pu.next_pu_offset != pu1.prev_pu_offset || - pc->index < pc->dirac_unit_size + 13LL + pu1.prev_pu_offset - ) { - pc->index -= 9; - *buf_size = next-9; - pc->header_bytes_needed = 9; - return -1; - } - - /* All non-frame data must be accompanied by frame data. This is to - * ensure that pts is set correctly. So if the current parse unit is - * not frame data, wait for frame data to come along */ - - pc->dirac_unit = pc->buffer + pc->index - 13 - - pu1.prev_pu_offset - pc->dirac_unit_size; - - pc->dirac_unit_size += pu.next_pu_offset; - - if ((pu.pu_type&0x08) != 0x08) { - pc->header_bytes_needed = 9; - *buf_size = next; - return -1; - } - - /* Get the picture number to set the pts and dts*/ - if (parse_timing_info) { - uint8_t *cur_pu = pc->buffer + - pc->index - 13 - pu1.prev_pu_offset; - int pts = AV_RB32(cur_pu + 13); - if (s->last_pts == 0 && s->last_dts == 0) - s->dts = pts - 1; - else - s->dts = s->last_dts+1; - s->pts = pts; - if (!avctx->has_b_frames && (cur_pu[4] & 0x03)) - avctx->has_b_frames = 1; - } - if (avctx->has_b_frames && s->pts == s->dts) - s->pict_type = AV_PICTURE_TYPE_B; - - /* Finally have a complete Dirac data unit */ - *buf = pc->dirac_unit; - *buf_size = pc->dirac_unit_size; - - pc->dirac_unit_size = 0; - pc->overread_index = pc->index-13; - pc->header_bytes_needed = 9; - } - return next; -} - -static int dirac_parse(AVCodecParserContext *s, AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - DiracParseContext *pc = s->priv_data; - int next; - - *poutbuf = NULL; - *poutbuf_size = 0; - - if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { - next = buf_size; - *poutbuf = buf; - *poutbuf_size = buf_size; - /* Assume that data has been packetized into an encapsulation unit. */ - } else { - next = find_frame_end(pc, buf, buf_size); - if (!pc->is_synced && next == -1) { - /* No frame start found yet. So throw away the entire buffer. */ - return buf_size; - } - - if (dirac_combine_frame(s, avctx, next, &buf, &buf_size) < 0) { - return buf_size; - } - } - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - -static void dirac_parse_close(AVCodecParserContext *s) -{ - DiracParseContext *pc = s->priv_data; - - if (pc->buffer_size > 0) - av_free(pc->buffer); -} - -AVCodecParser ff_dirac_parser = { - .codec_ids = { AV_CODEC_ID_DIRAC }, - .priv_data_size = sizeof(DiracParseContext), - .parser_parse = dirac_parse, - .parser_close = dirac_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdec.c deleted file mode 100644 index 227c15edc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdec.c +++ /dev/null @@ -1,1974 +0,0 @@ -/* - * Copyright (C) 2007 Marco Gerards - * Copyright (C) 2009 David Conrad - * Copyright (C) 2011 Jordi Ortiz - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Dirac Decoder - * @author Marco Gerards , David Conrad, Jordi Ortiz - */ - -#include "avcodec.h" -#include "dsputil.h" -#include "get_bits.h" -#include "bytestream.h" -#include "internal.h" -#include "golomb.h" -#include "dirac_arith.h" -#include "mpeg12data.h" -#include "dirac_dwt.h" -#include "dirac.h" -#include "diracdsp.h" -#include "videodsp.h" // for ff_emulated_edge_mc_8 - -/** - * The spec limits the number of wavelet decompositions to 4 for both - * level 1 (VC-2) and 128 (long-gop default). - * 5 decompositions is the maximum before >16-bit buffers are needed. - * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting - * the others to 4 decompositions (or 3 for the fidelity filter). - * - * We use this instead of MAX_DECOMPOSITIONS to save some memory. - */ -#define MAX_DWT_LEVELS 5 - -/** - * The spec limits this to 3 for frame coding, but in practice can be as high as 6 - */ -#define MAX_REFERENCE_FRAMES 8 -#define MAX_DELAY 5 /* limit for main profile for frame coding (TODO: field coding) */ -#define MAX_FRAMES (MAX_REFERENCE_FRAMES + MAX_DELAY + 1) -#define MAX_QUANT 68 /* max quant for VC-2 */ -#define MAX_BLOCKSIZE 32 /* maximum xblen/yblen we support */ - -/** - * DiracBlock->ref flags, if set then the block does MC from the given ref - */ -#define DIRAC_REF_MASK_REF1 1 -#define DIRAC_REF_MASK_REF2 2 -#define DIRAC_REF_MASK_GLOBAL 4 - -/** - * Value of Picture.reference when Picture is not a reference picture, but - * is held for delayed output. - */ -#define DELAYED_PIC_REF 4 - -#define ff_emulated_edge_mc ff_emulated_edge_mc_8 /* Fix: change the calls to this function regarding bit depth */ - -#define CALC_PADDING(size, depth) \ - (((size + (1 << depth) - 1) >> depth) << depth) - -#define DIVRNDUP(a, b) (((a) + (b) - 1) / (b)) - -typedef struct { - AVFrame *avframe; - int interpolated[3]; /* 1 if hpel[] is valid */ - uint8_t *hpel[3][4]; - uint8_t *hpel_base[3][4]; -} DiracFrame; - -typedef struct { - union { - int16_t mv[2][2]; - int16_t dc[3]; - } u; /* anonymous unions aren't in C99 :( */ - uint8_t ref; -} DiracBlock; - -typedef struct SubBand { - int level; - int orientation; - int stride; - int width; - int height; - int quant; - IDWTELEM *ibuf; - struct SubBand *parent; - - /* for low delay */ - unsigned length; - const uint8_t *coeff_data; -} SubBand; - -typedef struct Plane { - int width; - int height; - ptrdiff_t stride; - - int idwt_width; - int idwt_height; - int idwt_stride; - IDWTELEM *idwt_buf; - IDWTELEM *idwt_buf_base; - IDWTELEM *idwt_tmp; - - /* block length */ - uint8_t xblen; - uint8_t yblen; - /* block separation (block n+1 starts after this many pixels in block n) */ - uint8_t xbsep; - uint8_t ybsep; - /* amount of overspill on each edge (half of the overlap between blocks) */ - uint8_t xoffset; - uint8_t yoffset; - - SubBand band[MAX_DWT_LEVELS][4]; -} Plane; - -typedef struct DiracContext { - AVCodecContext *avctx; - DSPContext dsp; - DiracDSPContext diracdsp; - GetBitContext gb; - dirac_source_params source; - int seen_sequence_header; - int frame_number; /* number of the next frame to display */ - Plane plane[3]; - int chroma_x_shift; - int chroma_y_shift; - - int zero_res; /* zero residue flag */ - int is_arith; /* whether coeffs use arith or golomb coding */ - int low_delay; /* use the low delay syntax */ - int globalmc_flag; /* use global motion compensation */ - int num_refs; /* number of reference pictures */ - - /* wavelet decoding */ - unsigned wavelet_depth; /* depth of the IDWT */ - unsigned wavelet_idx; - - /** - * schroedinger older than 1.0.8 doesn't store - * quant delta if only one codebook exists in a band - */ - unsigned old_delta_quant; - unsigned codeblock_mode; - - struct { - unsigned width; - unsigned height; - } codeblock[MAX_DWT_LEVELS+1]; - - struct { - unsigned num_x; /* number of horizontal slices */ - unsigned num_y; /* number of vertical slices */ - AVRational bytes; /* average bytes per slice */ - uint8_t quant[MAX_DWT_LEVELS][4]; /* [DIRAC_STD] E.1 */ - } lowdelay; - - struct { - int pan_tilt[2]; /* pan/tilt vector */ - int zrs[2][2]; /* zoom/rotate/shear matrix */ - int perspective[2]; /* perspective vector */ - unsigned zrs_exp; - unsigned perspective_exp; - } globalmc[2]; - - /* motion compensation */ - uint8_t mv_precision; /* [DIRAC_STD] REFS_WT_PRECISION */ - int16_t weight[2]; /* [DIRAC_STD] REF1_WT and REF2_WT */ - unsigned weight_log2denom; /* [DIRAC_STD] REFS_WT_PRECISION */ - - int blwidth; /* number of blocks (horizontally) */ - int blheight; /* number of blocks (vertically) */ - int sbwidth; /* number of superblocks (horizontally) */ - int sbheight; /* number of superblocks (vertically) */ - - uint8_t *sbsplit; - DiracBlock *blmotion; - - uint8_t *edge_emu_buffer[4]; - uint8_t *edge_emu_buffer_base; - - uint16_t *mctmp; /* buffer holding the MC data multipled by OBMC weights */ - uint8_t *mcscratch; - - DECLARE_ALIGNED(16, uint8_t, obmc_weight)[3][MAX_BLOCKSIZE*MAX_BLOCKSIZE]; - - void (*put_pixels_tab[4])(uint8_t *dst, const uint8_t *src[5], int stride, int h); - void (*avg_pixels_tab[4])(uint8_t *dst, const uint8_t *src[5], int stride, int h); - void (*add_obmc)(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); - dirac_weight_func weight_func; - dirac_biweight_func biweight_func; - - DiracFrame *current_picture; - DiracFrame *ref_pics[2]; - - DiracFrame *ref_frames[MAX_REFERENCE_FRAMES+1]; - DiracFrame *delay_frames[MAX_DELAY+1]; - DiracFrame all_frames[MAX_FRAMES]; -} DiracContext; - -/** - * Dirac Specification -> - * Parse code values. 9.6.1 Table 9.1 - */ -enum dirac_parse_code { - pc_seq_header = 0x00, - pc_eos = 0x10, - pc_aux_data = 0x20, - pc_padding = 0x30, -}; - -enum dirac_subband { - subband_ll = 0, - subband_hl = 1, - subband_lh = 2, - subband_hh = 3 -}; - -static const uint8_t default_qmat[][4][4] = { - { { 5, 3, 3, 0}, { 0, 4, 4, 1}, { 0, 5, 5, 2}, { 0, 6, 6, 3} }, - { { 4, 2, 2, 0}, { 0, 4, 4, 2}, { 0, 5, 5, 3}, { 0, 7, 7, 5} }, - { { 5, 3, 3, 0}, { 0, 4, 4, 1}, { 0, 5, 5, 2}, { 0, 6, 6, 3} }, - { { 8, 4, 4, 0}, { 0, 4, 4, 0}, { 0, 4, 4, 0}, { 0, 4, 4, 0} }, - { { 8, 4, 4, 0}, { 0, 4, 4, 0}, { 0, 4, 4, 0}, { 0, 4, 4, 0} }, - { { 0, 4, 4, 8}, { 0, 8, 8, 12}, { 0, 13, 13, 17}, { 0, 17, 17, 21} }, - { { 3, 1, 1, 0}, { 0, 4, 4, 2}, { 0, 6, 6, 5}, { 0, 9, 9, 7} }, -}; - -static const int qscale_tab[MAX_QUANT+1] = { - 4, 5, 6, 7, 8, 10, 11, 13, - 16, 19, 23, 27, 32, 38, 45, 54, - 64, 76, 91, 108, 128, 152, 181, 215, - 256, 304, 362, 431, 512, 609, 724, 861, - 1024, 1218, 1448, 1722, 2048, 2435, 2896, 3444, - 4096, 4871, 5793, 6889, 8192, 9742, 11585, 13777, - 16384, 19484, 23170, 27554, 32768, 38968, 46341, 55109, - 65536, 77936 -}; - -static const int qoffset_intra_tab[MAX_QUANT+1] = { - 1, 2, 3, 4, 4, 5, 6, 7, - 8, 10, 12, 14, 16, 19, 23, 27, - 32, 38, 46, 54, 64, 76, 91, 108, - 128, 152, 181, 216, 256, 305, 362, 431, - 512, 609, 724, 861, 1024, 1218, 1448, 1722, - 2048, 2436, 2897, 3445, 4096, 4871, 5793, 6889, - 8192, 9742, 11585, 13777, 16384, 19484, 23171, 27555, - 32768, 38968 -}; - -static const int qoffset_inter_tab[MAX_QUANT+1] = { - 1, 2, 2, 3, 3, 4, 4, 5, - 6, 7, 9, 10, 12, 14, 17, 20, - 24, 29, 34, 41, 48, 57, 68, 81, - 96, 114, 136, 162, 192, 228, 272, 323, - 384, 457, 543, 646, 768, 913, 1086, 1292, - 1536, 1827, 2172, 2583, 3072, 3653, 4344, 5166, - 6144, 7307, 8689, 10333, 12288, 14613, 17378, 20666, - 24576, 29226 -}; - -/* magic number division by 3 from schroedinger */ -static inline int divide3(int x) -{ - return ((x+1)*21845 + 10922) >> 16; -} - -static DiracFrame *remove_frame(DiracFrame *framelist[], int picnum) -{ - DiracFrame *remove_pic = NULL; - int i, remove_idx = -1; - - for (i = 0; framelist[i]; i++) - if (framelist[i]->avframe->display_picture_number == picnum) { - remove_pic = framelist[i]; - remove_idx = i; - } - - if (remove_pic) - for (i = remove_idx; framelist[i]; i++) - framelist[i] = framelist[i+1]; - - return remove_pic; -} - -static int add_frame(DiracFrame *framelist[], int maxframes, DiracFrame *frame) -{ - int i; - for (i = 0; i < maxframes; i++) - if (!framelist[i]) { - framelist[i] = frame; - return 0; - } - return -1; -} - -static int alloc_sequence_buffers(DiracContext *s) -{ - int sbwidth = DIVRNDUP(s->source.width, 4); - int sbheight = DIVRNDUP(s->source.height, 4); - int i, w, h, top_padding; - - /* todo: think more about this / use or set Plane here */ - for (i = 0; i < 3; i++) { - int max_xblen = MAX_BLOCKSIZE >> (i ? s->chroma_x_shift : 0); - int max_yblen = MAX_BLOCKSIZE >> (i ? s->chroma_y_shift : 0); - w = s->source.width >> (i ? s->chroma_x_shift : 0); - h = s->source.height >> (i ? s->chroma_y_shift : 0); - - /* we allocate the max we support here since num decompositions can - * change from frame to frame. Stride is aligned to 16 for SIMD, and - * 1<0) in arith decoding - * MAX_BLOCKSIZE padding for MC: blocks can spill up to half of that - * on each side */ - top_padding = FFMAX(1<plane[i].idwt_buf_base = av_mallocz((w+max_xblen)*h * sizeof(IDWTELEM)); - s->plane[i].idwt_tmp = av_malloc((w+16) * sizeof(IDWTELEM)); - s->plane[i].idwt_buf = s->plane[i].idwt_buf_base + top_padding*w; - if (!s->plane[i].idwt_buf_base || !s->plane[i].idwt_tmp) - return AVERROR(ENOMEM); - } - - w = s->source.width; - h = s->source.height; - - /* fixme: allocate using real stride here */ - s->sbsplit = av_malloc(sbwidth * sbheight); - s->blmotion = av_malloc(sbwidth * sbheight * 16 * sizeof(*s->blmotion)); - s->edge_emu_buffer_base = av_malloc((w+64)*MAX_BLOCKSIZE); - - s->mctmp = av_malloc((w+64+MAX_BLOCKSIZE) * (h+MAX_BLOCKSIZE) * sizeof(*s->mctmp)); - s->mcscratch = av_malloc((w+64)*MAX_BLOCKSIZE); - - if (!s->sbsplit || !s->blmotion || !s->mctmp || !s->mcscratch) - return AVERROR(ENOMEM); - return 0; -} - -static void free_sequence_buffers(DiracContext *s) -{ - int i, j, k; - - for (i = 0; i < MAX_FRAMES; i++) { - if (s->all_frames[i].avframe->data[0]) { - av_frame_unref(s->all_frames[i].avframe); - memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated)); - } - - for (j = 0; j < 3; j++) - for (k = 1; k < 4; k++) - av_freep(&s->all_frames[i].hpel_base[j][k]); - } - - memset(s->ref_frames, 0, sizeof(s->ref_frames)); - memset(s->delay_frames, 0, sizeof(s->delay_frames)); - - for (i = 0; i < 3; i++) { - av_freep(&s->plane[i].idwt_buf_base); - av_freep(&s->plane[i].idwt_tmp); - } - - av_freep(&s->sbsplit); - av_freep(&s->blmotion); - av_freep(&s->edge_emu_buffer_base); - - av_freep(&s->mctmp); - av_freep(&s->mcscratch); -} - -static av_cold int dirac_decode_init(AVCodecContext *avctx) -{ - DiracContext *s = avctx->priv_data; - int i; - - s->avctx = avctx; - s->frame_number = -1; - - ff_dsputil_init(&s->dsp, avctx); - ff_diracdsp_init(&s->diracdsp); - - for (i = 0; i < MAX_FRAMES; i++) { - s->all_frames[i].avframe = av_frame_alloc(); - if (!s->all_frames[i].avframe) { - while (i > 0) - av_frame_free(&s->all_frames[--i].avframe); - return AVERROR(ENOMEM); - } - } - - return 0; -} - -static void dirac_decode_flush(AVCodecContext *avctx) -{ - DiracContext *s = avctx->priv_data; - free_sequence_buffers(s); - s->seen_sequence_header = 0; - s->frame_number = -1; -} - -static av_cold int dirac_decode_end(AVCodecContext *avctx) -{ - DiracContext *s = avctx->priv_data; - int i; - - dirac_decode_flush(avctx); - for (i = 0; i < MAX_FRAMES; i++) - av_frame_free(&s->all_frames[i].avframe); - - return 0; -} - -#define SIGN_CTX(x) (CTX_SIGN_ZERO + ((x) > 0) - ((x) < 0)) - -static inline void coeff_unpack_arith(DiracArith *c, int qfactor, int qoffset, - SubBand *b, IDWTELEM *buf, int x, int y) -{ - int coeff, sign; - int sign_pred = 0; - int pred_ctx = CTX_ZPZN_F1; - - /* Check if the parent subband has a 0 in the corresponding position */ - if (b->parent) - pred_ctx += !!b->parent->ibuf[b->parent->stride * (y>>1) + (x>>1)] << 1; - - if (b->orientation == subband_hl) - sign_pred = buf[-b->stride]; - - /* Determine if the pixel has only zeros in its neighbourhood */ - if (x) { - pred_ctx += !(buf[-1] | buf[-b->stride] | buf[-1-b->stride]); - if (b->orientation == subband_lh) - sign_pred = buf[-1]; - } else { - pred_ctx += !buf[-b->stride]; - } - - coeff = dirac_get_arith_uint(c, pred_ctx, CTX_COEFF_DATA); - if (coeff) { - coeff = (coeff * qfactor + qoffset + 2) >> 2; - sign = dirac_get_arith_bit(c, SIGN_CTX(sign_pred)); - coeff = (coeff ^ -sign) + sign; - } - *buf = coeff; -} - -static inline int coeff_unpack_golomb(GetBitContext *gb, int qfactor, int qoffset) -{ - int sign, coeff; - - coeff = svq3_get_ue_golomb(gb); - if (coeff) { - coeff = (coeff * qfactor + qoffset + 2) >> 2; - sign = get_bits1(gb); - coeff = (coeff ^ -sign) + sign; - } - return coeff; -} - -/** - * Decode the coeffs in the rectangle defined by left, right, top, bottom - * [DIRAC_STD] 13.4.3.2 Codeblock unpacking loop. codeblock() - */ -static inline void codeblock(DiracContext *s, SubBand *b, - GetBitContext *gb, DiracArith *c, - int left, int right, int top, int bottom, - int blockcnt_one, int is_arith) -{ - int x, y, zero_block; - int qoffset, qfactor; - IDWTELEM *buf; - - /* check for any coded coefficients in this codeblock */ - if (!blockcnt_one) { - if (is_arith) - zero_block = dirac_get_arith_bit(c, CTX_ZERO_BLOCK); - else - zero_block = get_bits1(gb); - - if (zero_block) - return; - } - - if (s->codeblock_mode && !(s->old_delta_quant && blockcnt_one)) { - int quant = b->quant; - if (is_arith) - quant += dirac_get_arith_int(c, CTX_DELTA_Q_F, CTX_DELTA_Q_DATA); - else - quant += dirac_get_se_golomb(gb); - if (quant < 0) { - av_log(s->avctx, AV_LOG_ERROR, "Invalid quant\n"); - return; - } - b->quant = quant; - } - - b->quant = FFMIN(b->quant, MAX_QUANT); - - qfactor = qscale_tab[b->quant]; - /* TODO: context pointer? */ - if (!s->num_refs) - qoffset = qoffset_intra_tab[b->quant]; - else - qoffset = qoffset_inter_tab[b->quant]; - - buf = b->ibuf + top * b->stride; - for (y = top; y < bottom; y++) { - for (x = left; x < right; x++) { - /* [DIRAC_STD] 13.4.4 Subband coefficients. coeff_unpack() */ - if (is_arith) - coeff_unpack_arith(c, qfactor, qoffset, b, buf+x, x, y); - else - buf[x] = coeff_unpack_golomb(gb, qfactor, qoffset); - } - buf += b->stride; - } -} - -/** - * Dirac Specification -> - * 13.3 intra_dc_prediction(band) - */ -static inline void intra_dc_prediction(SubBand *b) -{ - IDWTELEM *buf = b->ibuf; - int x, y; - - for (x = 1; x < b->width; x++) - buf[x] += buf[x-1]; - buf += b->stride; - - for (y = 1; y < b->height; y++) { - buf[0] += buf[-b->stride]; - - for (x = 1; x < b->width; x++) { - int pred = buf[x - 1] + buf[x - b->stride] + buf[x - b->stride-1]; - buf[x] += divide3(pred); - } - buf += b->stride; - } -} - -/** - * Dirac Specification -> - * 13.4.2 Non-skipped subbands. subband_coeffs() - */ -static av_always_inline void decode_subband_internal(DiracContext *s, SubBand *b, int is_arith) -{ - int cb_x, cb_y, left, right, top, bottom; - DiracArith c; - GetBitContext gb; - int cb_width = s->codeblock[b->level + (b->orientation != subband_ll)].width; - int cb_height = s->codeblock[b->level + (b->orientation != subband_ll)].height; - int blockcnt_one = (cb_width + cb_height) == 2; - - if (!b->length) - return; - - init_get_bits8(&gb, b->coeff_data, b->length); - - if (is_arith) - ff_dirac_init_arith_decoder(&c, &gb, b->length); - - top = 0; - for (cb_y = 0; cb_y < cb_height; cb_y++) { - bottom = (b->height * (cb_y+1)) / cb_height; - left = 0; - for (cb_x = 0; cb_x < cb_width; cb_x++) { - right = (b->width * (cb_x+1)) / cb_width; - codeblock(s, b, &gb, &c, left, right, top, bottom, blockcnt_one, is_arith); - left = right; - } - top = bottom; - } - - if (b->orientation == subband_ll && s->num_refs == 0) - intra_dc_prediction(b); -} - -static int decode_subband_arith(AVCodecContext *avctx, void *b) -{ - DiracContext *s = avctx->priv_data; - decode_subband_internal(s, b, 1); - return 0; -} - -static int decode_subband_golomb(AVCodecContext *avctx, void *arg) -{ - DiracContext *s = avctx->priv_data; - SubBand **b = arg; - decode_subband_internal(s, *b, 0); - return 0; -} - -/** - * Dirac Specification -> - * [DIRAC_STD] 13.4.1 core_transform_data() - */ -static void decode_component(DiracContext *s, int comp) -{ - AVCodecContext *avctx = s->avctx; - SubBand *bands[3*MAX_DWT_LEVELS+1]; - enum dirac_subband orientation; - int level, num_bands = 0; - - /* Unpack all subbands at all levels. */ - for (level = 0; level < s->wavelet_depth; level++) { - for (orientation = !!level; (int)orientation < 4; orientation++) { - SubBand *b = &s->plane[comp].band[level][orientation]; - bands[num_bands++] = b; - - align_get_bits(&s->gb); - /* [DIRAC_STD] 13.4.2 subband() */ - b->length = svq3_get_ue_golomb(&s->gb); - if (b->length) { - b->quant = svq3_get_ue_golomb(&s->gb); - align_get_bits(&s->gb); - b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8; - b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0)); - skip_bits_long(&s->gb, b->length*8); - } - } - /* arithmetic coding has inter-level dependencies, so we can only execute one level at a time */ - if (s->is_arith) - avctx->execute(avctx, decode_subband_arith, &s->plane[comp].band[level][!!level], - NULL, 4-!!level, sizeof(SubBand)); - } - /* golomb coding has no inter-level dependencies, so we can execute all subbands in parallel */ - if (!s->is_arith) - avctx->execute(avctx, decode_subband_golomb, bands, NULL, num_bands, sizeof(SubBand*)); -} - -/* [DIRAC_STD] 13.5.5.2 Luma slice subband data. luma_slice_band(level,orient,sx,sy) --> if b2 == NULL */ -/* [DIRAC_STD] 13.5.5.3 Chroma slice subband data. chroma_slice_band(level,orient,sx,sy) --> if b2 != NULL */ -static void lowdelay_subband(DiracContext *s, GetBitContext *gb, int quant, - int slice_x, int slice_y, int bits_end, - SubBand *b1, SubBand *b2) -{ - int left = b1->width * slice_x / s->lowdelay.num_x; - int right = b1->width *(slice_x+1) / s->lowdelay.num_x; - int top = b1->height * slice_y / s->lowdelay.num_y; - int bottom = b1->height *(slice_y+1) / s->lowdelay.num_y; - - int qfactor = qscale_tab[FFMIN(quant, MAX_QUANT)]; - int qoffset = qoffset_intra_tab[FFMIN(quant, MAX_QUANT)]; - - IDWTELEM *buf1 = b1->ibuf + top * b1->stride; - IDWTELEM *buf2 = b2 ? b2->ibuf + top * b2->stride : NULL; - int x, y; - /* we have to constantly check for overread since the spec explictly - requires this, with the meaning that all remaining coeffs are set to 0 */ - if (get_bits_count(gb) >= bits_end) - return; - - for (y = top; y < bottom; y++) { - for (x = left; x < right; x++) { - buf1[x] = coeff_unpack_golomb(gb, qfactor, qoffset); - if (get_bits_count(gb) >= bits_end) - return; - if (buf2) { - buf2[x] = coeff_unpack_golomb(gb, qfactor, qoffset); - if (get_bits_count(gb) >= bits_end) - return; - } - } - buf1 += b1->stride; - if (buf2) - buf2 += b2->stride; - } -} - -struct lowdelay_slice { - GetBitContext gb; - int slice_x; - int slice_y; - int bytes; -}; - - -/** - * Dirac Specification -> - * 13.5.2 Slices. slice(sx,sy) - */ -static int decode_lowdelay_slice(AVCodecContext *avctx, void *arg) -{ - DiracContext *s = avctx->priv_data; - struct lowdelay_slice *slice = arg; - GetBitContext *gb = &slice->gb; - enum dirac_subband orientation; - int level, quant, chroma_bits, chroma_end; - - int quant_base = get_bits(gb, 7); /*[DIRAC_STD] qindex */ - int length_bits = av_log2(8 * slice->bytes)+1; - int luma_bits = get_bits_long(gb, length_bits); - int luma_end = get_bits_count(gb) + FFMIN(luma_bits, get_bits_left(gb)); - - /* [DIRAC_STD] 13.5.5.2 luma_slice_band */ - for (level = 0; level < s->wavelet_depth; level++) - for (orientation = !!level; (int)orientation < 4; orientation++) { - quant = FFMAX(quant_base - s->lowdelay.quant[level][orientation], 0); - lowdelay_subband(s, gb, quant, slice->slice_x, slice->slice_y, luma_end, - &s->plane[0].band[level][orientation], NULL); - } - - /* consume any unused bits from luma */ - skip_bits_long(gb, get_bits_count(gb) - luma_end); - - chroma_bits = 8*slice->bytes - 7 - length_bits - luma_bits; - chroma_end = get_bits_count(gb) + FFMIN(chroma_bits, get_bits_left(gb)); - /* [DIRAC_STD] 13.5.5.3 chroma_slice_band */ - for (level = 0; level < s->wavelet_depth; level++) - for (orientation = !!level; (int)orientation < 4; orientation++) { - quant = FFMAX(quant_base - s->lowdelay.quant[level][orientation], 0); - lowdelay_subband(s, gb, quant, slice->slice_x, slice->slice_y, chroma_end, - &s->plane[1].band[level][orientation], - &s->plane[2].band[level][orientation]); - } - - return 0; -} - -/** - * Dirac Specification -> - * 13.5.1 low_delay_transform_data() - */ -static void decode_lowdelay(DiracContext *s) -{ - AVCodecContext *avctx = s->avctx; - int slice_x, slice_y, bytes, bufsize; - const uint8_t *buf; - struct lowdelay_slice *slices; - int slice_num = 0; - - slices = av_mallocz(s->lowdelay.num_x * s->lowdelay.num_y * sizeof(struct lowdelay_slice)); - - align_get_bits(&s->gb); - /*[DIRAC_STD] 13.5.2 Slices. slice(sx,sy) */ - buf = s->gb.buffer + get_bits_count(&s->gb)/8; - bufsize = get_bits_left(&s->gb); - - for (slice_y = 0; bufsize > 0 && slice_y < s->lowdelay.num_y; slice_y++) - for (slice_x = 0; bufsize > 0 && slice_x < s->lowdelay.num_x; slice_x++) { - bytes = (slice_num+1) * s->lowdelay.bytes.num / s->lowdelay.bytes.den - - slice_num * s->lowdelay.bytes.num / s->lowdelay.bytes.den; - - slices[slice_num].bytes = bytes; - slices[slice_num].slice_x = slice_x; - slices[slice_num].slice_y = slice_y; - init_get_bits(&slices[slice_num].gb, buf, bufsize); - slice_num++; - - buf += bytes; - bufsize -= bytes*8; - } - - avctx->execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num, - sizeof(struct lowdelay_slice)); /* [DIRAC_STD] 13.5.2 Slices */ - intra_dc_prediction(&s->plane[0].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ - intra_dc_prediction(&s->plane[1].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ - intra_dc_prediction(&s->plane[2].band[0][0]); /* [DIRAC_STD] 13.3 intra_dc_prediction() */ - av_free(slices); -} - -static void init_planes(DiracContext *s) -{ - int i, w, h, level, orientation; - - for (i = 0; i < 3; i++) { - Plane *p = &s->plane[i]; - - p->width = s->source.width >> (i ? s->chroma_x_shift : 0); - p->height = s->source.height >> (i ? s->chroma_y_shift : 0); - p->idwt_width = w = CALC_PADDING(p->width , s->wavelet_depth); - p->idwt_height = h = CALC_PADDING(p->height, s->wavelet_depth); - p->idwt_stride = FFALIGN(p->idwt_width, 8); - - for (level = s->wavelet_depth-1; level >= 0; level--) { - w = w>>1; - h = h>>1; - for (orientation = !!level; orientation < 4; orientation++) { - SubBand *b = &p->band[level][orientation]; - - b->ibuf = p->idwt_buf; - b->level = level; - b->stride = p->idwt_stride << (s->wavelet_depth - level); - b->width = w; - b->height = h; - b->orientation = orientation; - - if (orientation & 1) - b->ibuf += w; - if (orientation > 1) - b->ibuf += b->stride>>1; - - if (level) - b->parent = &p->band[level-1][orientation]; - } - } - - if (i > 0) { - p->xblen = s->plane[0].xblen >> s->chroma_x_shift; - p->yblen = s->plane[0].yblen >> s->chroma_y_shift; - p->xbsep = s->plane[0].xbsep >> s->chroma_x_shift; - p->ybsep = s->plane[0].ybsep >> s->chroma_y_shift; - } - - p->xoffset = (p->xblen - p->xbsep)/2; - p->yoffset = (p->yblen - p->ybsep)/2; - } -} - -/** - * Unpack the motion compensation parameters - * Dirac Specification -> - * 11.2 Picture prediction data. picture_prediction() - */ -static int dirac_unpack_prediction_parameters(DiracContext *s) -{ - static const uint8_t default_blen[] = { 4, 12, 16, 24 }; - static const uint8_t default_bsep[] = { 4, 8, 12, 16 }; - - GetBitContext *gb = &s->gb; - unsigned idx, ref; - - align_get_bits(gb); - /* [DIRAC_STD] 11.2.2 Block parameters. block_parameters() */ - /* Luma and Chroma are equal. 11.2.3 */ - idx = svq3_get_ue_golomb(gb); /* [DIRAC_STD] index */ - - if (idx > 4) { - av_log(s->avctx, AV_LOG_ERROR, "Block prediction index too high\n"); - return -1; - } - - if (idx == 0) { - s->plane[0].xblen = svq3_get_ue_golomb(gb); - s->plane[0].yblen = svq3_get_ue_golomb(gb); - s->plane[0].xbsep = svq3_get_ue_golomb(gb); - s->plane[0].ybsep = svq3_get_ue_golomb(gb); - } else { - /*[DIRAC_STD] preset_block_params(index). Table 11.1 */ - s->plane[0].xblen = default_blen[idx-1]; - s->plane[0].yblen = default_blen[idx-1]; - s->plane[0].xbsep = default_bsep[idx-1]; - s->plane[0].ybsep = default_bsep[idx-1]; - } - /*[DIRAC_STD] 11.2.4 motion_data_dimensions() - Calculated in function dirac_unpack_block_motion_data */ - - if (!s->plane[0].xbsep || !s->plane[0].ybsep || s->plane[0].xbsep < s->plane[0].xblen/2 || s->plane[0].ybsep < s->plane[0].yblen/2) { - av_log(s->avctx, AV_LOG_ERROR, "Block separation too small\n"); - return -1; - } - if (s->plane[0].xbsep > s->plane[0].xblen || s->plane[0].ybsep > s->plane[0].yblen) { - av_log(s->avctx, AV_LOG_ERROR, "Block separation greater than size\n"); - return -1; - } - if (FFMAX(s->plane[0].xblen, s->plane[0].yblen) > MAX_BLOCKSIZE) { - av_log(s->avctx, AV_LOG_ERROR, "Unsupported large block size\n"); - return -1; - } - - /*[DIRAC_STD] 11.2.5 Motion vector precision. motion_vector_precision() - Read motion vector precision */ - s->mv_precision = svq3_get_ue_golomb(gb); - if (s->mv_precision > 3) { - av_log(s->avctx, AV_LOG_ERROR, "MV precision finer than eighth-pel\n"); - return -1; - } - - /*[DIRAC_STD] 11.2.6 Global motion. global_motion() - Read the global motion compensation parameters */ - s->globalmc_flag = get_bits1(gb); - if (s->globalmc_flag) { - memset(s->globalmc, 0, sizeof(s->globalmc)); - /* [DIRAC_STD] pan_tilt(gparams) */ - for (ref = 0; ref < s->num_refs; ref++) { - if (get_bits1(gb)) { - s->globalmc[ref].pan_tilt[0] = dirac_get_se_golomb(gb); - s->globalmc[ref].pan_tilt[1] = dirac_get_se_golomb(gb); - } - /* [DIRAC_STD] zoom_rotate_shear(gparams) - zoom/rotation/shear parameters */ - if (get_bits1(gb)) { - s->globalmc[ref].zrs_exp = svq3_get_ue_golomb(gb); - s->globalmc[ref].zrs[0][0] = dirac_get_se_golomb(gb); - s->globalmc[ref].zrs[0][1] = dirac_get_se_golomb(gb); - s->globalmc[ref].zrs[1][0] = dirac_get_se_golomb(gb); - s->globalmc[ref].zrs[1][1] = dirac_get_se_golomb(gb); - } else { - s->globalmc[ref].zrs[0][0] = 1; - s->globalmc[ref].zrs[1][1] = 1; - } - /* [DIRAC_STD] perspective(gparams) */ - if (get_bits1(gb)) { - s->globalmc[ref].perspective_exp = svq3_get_ue_golomb(gb); - s->globalmc[ref].perspective[0] = dirac_get_se_golomb(gb); - s->globalmc[ref].perspective[1] = dirac_get_se_golomb(gb); - } - } - } - - /*[DIRAC_STD] 11.2.7 Picture prediction mode. prediction_mode() - Picture prediction mode, not currently used. */ - if (svq3_get_ue_golomb(gb)) { - av_log(s->avctx, AV_LOG_ERROR, "Unknown picture prediction mode\n"); - return -1; - } - - /* [DIRAC_STD] 11.2.8 Reference picture weight. reference_picture_weights() - just data read, weight calculation will be done later on. */ - s->weight_log2denom = 1; - s->weight[0] = 1; - s->weight[1] = 1; - - if (get_bits1(gb)) { - s->weight_log2denom = svq3_get_ue_golomb(gb); - s->weight[0] = dirac_get_se_golomb(gb); - if (s->num_refs == 2) - s->weight[1] = dirac_get_se_golomb(gb); - } - return 0; -} - -/** - * Dirac Specification -> - * 11.3 Wavelet transform data. wavelet_transform() - */ -static int dirac_unpack_idwt_params(DiracContext *s) -{ - GetBitContext *gb = &s->gb; - int i, level; - unsigned tmp; - -#define CHECKEDREAD(dst, cond, errmsg) \ - tmp = svq3_get_ue_golomb(gb); \ - if (cond) { \ - av_log(s->avctx, AV_LOG_ERROR, errmsg); \ - return -1; \ - }\ - dst = tmp; - - align_get_bits(gb); - - s->zero_res = s->num_refs ? get_bits1(gb) : 0; - if (s->zero_res) - return 0; - - /*[DIRAC_STD] 11.3.1 Transform parameters. transform_parameters() */ - CHECKEDREAD(s->wavelet_idx, tmp > 6, "wavelet_idx is too big\n") - - CHECKEDREAD(s->wavelet_depth, tmp > MAX_DWT_LEVELS || tmp < 1, "invalid number of DWT decompositions\n") - - if (!s->low_delay) { - /* Codeblock parameters (core syntax only) */ - if (get_bits1(gb)) { - for (i = 0; i <= s->wavelet_depth; i++) { - CHECKEDREAD(s->codeblock[i].width , tmp < 1, "codeblock width invalid\n") - CHECKEDREAD(s->codeblock[i].height, tmp < 1, "codeblock height invalid\n") - } - - CHECKEDREAD(s->codeblock_mode, tmp > 1, "unknown codeblock mode\n") - } else - for (i = 0; i <= s->wavelet_depth; i++) - s->codeblock[i].width = s->codeblock[i].height = 1; - } else { - /* Slice parameters + quantization matrix*/ - /*[DIRAC_STD] 11.3.4 Slice coding Parameters (low delay syntax only). slice_parameters() */ - s->lowdelay.num_x = svq3_get_ue_golomb(gb); - s->lowdelay.num_y = svq3_get_ue_golomb(gb); - s->lowdelay.bytes.num = svq3_get_ue_golomb(gb); - s->lowdelay.bytes.den = svq3_get_ue_golomb(gb); - - if (s->lowdelay.bytes.den <= 0) { - av_log(s->avctx,AV_LOG_ERROR,"Invalid lowdelay.bytes.den\n"); - return AVERROR_INVALIDDATA; - } - - /* [DIRAC_STD] 11.3.5 Quantisation matrices (low-delay syntax). quant_matrix() */ - if (get_bits1(gb)) { - av_log(s->avctx,AV_LOG_DEBUG,"Low Delay: Has Custom Quantization Matrix!\n"); - /* custom quantization matrix */ - s->lowdelay.quant[0][0] = svq3_get_ue_golomb(gb); - for (level = 0; level < s->wavelet_depth; level++) { - s->lowdelay.quant[level][1] = svq3_get_ue_golomb(gb); - s->lowdelay.quant[level][2] = svq3_get_ue_golomb(gb); - s->lowdelay.quant[level][3] = svq3_get_ue_golomb(gb); - } - } else { - if (s->wavelet_depth > 4) { - av_log(s->avctx,AV_LOG_ERROR,"Mandatory custom low delay matrix missing for depth %d\n", s->wavelet_depth); - return AVERROR_INVALIDDATA; - } - /* default quantization matrix */ - for (level = 0; level < s->wavelet_depth; level++) - for (i = 0; i < 4; i++) { - s->lowdelay.quant[level][i] = default_qmat[s->wavelet_idx][level][i]; - /* haar with no shift differs for different depths */ - if (s->wavelet_idx == 3) - s->lowdelay.quant[level][i] += 4*(s->wavelet_depth-1 - level); - } - } - } - return 0; -} - -static inline int pred_sbsplit(uint8_t *sbsplit, int stride, int x, int y) -{ - static const uint8_t avgsplit[7] = { 0, 0, 1, 1, 1, 2, 2 }; - - if (!(x|y)) - return 0; - else if (!y) - return sbsplit[-1]; - else if (!x) - return sbsplit[-stride]; - - return avgsplit[sbsplit[-1] + sbsplit[-stride] + sbsplit[-stride-1]]; -} - -static inline int pred_block_mode(DiracBlock *block, int stride, int x, int y, int refmask) -{ - int pred; - - if (!(x|y)) - return 0; - else if (!y) - return block[-1].ref & refmask; - else if (!x) - return block[-stride].ref & refmask; - - /* return the majority */ - pred = (block[-1].ref & refmask) + (block[-stride].ref & refmask) + (block[-stride-1].ref & refmask); - return (pred >> 1) & refmask; -} - -static inline void pred_block_dc(DiracBlock *block, int stride, int x, int y) -{ - int i, n = 0; - - memset(block->u.dc, 0, sizeof(block->u.dc)); - - if (x && !(block[-1].ref & 3)) { - for (i = 0; i < 3; i++) - block->u.dc[i] += block[-1].u.dc[i]; - n++; - } - - if (y && !(block[-stride].ref & 3)) { - for (i = 0; i < 3; i++) - block->u.dc[i] += block[-stride].u.dc[i]; - n++; - } - - if (x && y && !(block[-1-stride].ref & 3)) { - for (i = 0; i < 3; i++) - block->u.dc[i] += block[-1-stride].u.dc[i]; - n++; - } - - if (n == 2) { - for (i = 0; i < 3; i++) - block->u.dc[i] = (block->u.dc[i]+1)>>1; - } else if (n == 3) { - for (i = 0; i < 3; i++) - block->u.dc[i] = divide3(block->u.dc[i]); - } -} - -static inline void pred_mv(DiracBlock *block, int stride, int x, int y, int ref) -{ - int16_t *pred[3]; - int refmask = ref+1; - int mask = refmask | DIRAC_REF_MASK_GLOBAL; /* exclude gmc blocks */ - int n = 0; - - if (x && (block[-1].ref & mask) == refmask) - pred[n++] = block[-1].u.mv[ref]; - - if (y && (block[-stride].ref & mask) == refmask) - pred[n++] = block[-stride].u.mv[ref]; - - if (x && y && (block[-stride-1].ref & mask) == refmask) - pred[n++] = block[-stride-1].u.mv[ref]; - - switch (n) { - case 0: - block->u.mv[ref][0] = 0; - block->u.mv[ref][1] = 0; - break; - case 1: - block->u.mv[ref][0] = pred[0][0]; - block->u.mv[ref][1] = pred[0][1]; - break; - case 2: - block->u.mv[ref][0] = (pred[0][0] + pred[1][0] + 1) >> 1; - block->u.mv[ref][1] = (pred[0][1] + pred[1][1] + 1) >> 1; - break; - case 3: - block->u.mv[ref][0] = mid_pred(pred[0][0], pred[1][0], pred[2][0]); - block->u.mv[ref][1] = mid_pred(pred[0][1], pred[1][1], pred[2][1]); - break; - } -} - -static void global_mv(DiracContext *s, DiracBlock *block, int x, int y, int ref) -{ - int ez = s->globalmc[ref].zrs_exp; - int ep = s->globalmc[ref].perspective_exp; - int (*A)[2] = s->globalmc[ref].zrs; - int *b = s->globalmc[ref].pan_tilt; - int *c = s->globalmc[ref].perspective; - - int m = (1<u.mv[ref][0] = (mx + (1<<(ez+ep))) >> (ez+ep); - block->u.mv[ref][1] = (my + (1<<(ez+ep))) >> (ez+ep); -} - -static void decode_block_params(DiracContext *s, DiracArith arith[8], DiracBlock *block, - int stride, int x, int y) -{ - int i; - - block->ref = pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF1); - block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF1); - - if (s->num_refs == 2) { - block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_REF2); - block->ref ^= dirac_get_arith_bit(arith, CTX_PMODE_REF2) << 1; - } - - if (!block->ref) { - pred_block_dc(block, stride, x, y); - for (i = 0; i < 3; i++) - block->u.dc[i] += dirac_get_arith_int(arith+1+i, CTX_DC_F1, CTX_DC_DATA); - return; - } - - if (s->globalmc_flag) { - block->ref |= pred_block_mode(block, stride, x, y, DIRAC_REF_MASK_GLOBAL); - block->ref ^= dirac_get_arith_bit(arith, CTX_GLOBAL_BLOCK) << 2; - } - - for (i = 0; i < s->num_refs; i++) - if (block->ref & (i+1)) { - if (block->ref & DIRAC_REF_MASK_GLOBAL) { - global_mv(s, block, x, y, i); - } else { - pred_mv(block, stride, x, y, i); - block->u.mv[i][0] += dirac_get_arith_int(arith + 4 + 2 * i, CTX_MV_F1, CTX_MV_DATA); - block->u.mv[i][1] += dirac_get_arith_int(arith + 5 + 2 * i, CTX_MV_F1, CTX_MV_DATA); - } - } -} - -/** - * Copies the current block to the other blocks covered by the current superblock split mode - */ -static void propagate_block_data(DiracBlock *block, int stride, int size) -{ - int x, y; - DiracBlock *dst = block; - - for (x = 1; x < size; x++) - dst[x] = *block; - - for (y = 1; y < size; y++) { - dst += stride; - for (x = 0; x < size; x++) - dst[x] = *block; - } -} - -/** - * Dirac Specification -> - * 12. Block motion data syntax - */ -static int dirac_unpack_block_motion_data(DiracContext *s) -{ - GetBitContext *gb = &s->gb; - uint8_t *sbsplit = s->sbsplit; - int i, x, y, q, p; - DiracArith arith[8]; - - align_get_bits(gb); - - /* [DIRAC_STD] 11.2.4 and 12.2.1 Number of blocks and superblocks */ - s->sbwidth = DIVRNDUP(s->source.width, 4*s->plane[0].xbsep); - s->sbheight = DIVRNDUP(s->source.height, 4*s->plane[0].ybsep); - s->blwidth = 4 * s->sbwidth; - s->blheight = 4 * s->sbheight; - - /* [DIRAC_STD] 12.3.1 Superblock splitting modes. superblock_split_modes() - decode superblock split modes */ - ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); /* svq3_get_ue_golomb(gb) is the length */ - for (y = 0; y < s->sbheight; y++) { - for (x = 0; x < s->sbwidth; x++) { - unsigned int split = dirac_get_arith_uint(arith, CTX_SB_F1, CTX_SB_DATA); - if (split > 2) - return -1; - sbsplit[x] = (split + pred_sbsplit(sbsplit+x, s->sbwidth, x, y)) % 3; - } - sbsplit += s->sbwidth; - } - - /* setup arith decoding */ - ff_dirac_init_arith_decoder(arith, gb, svq3_get_ue_golomb(gb)); - for (i = 0; i < s->num_refs; i++) { - ff_dirac_init_arith_decoder(arith + 4 + 2 * i, gb, svq3_get_ue_golomb(gb)); - ff_dirac_init_arith_decoder(arith + 5 + 2 * i, gb, svq3_get_ue_golomb(gb)); - } - for (i = 0; i < 3; i++) - ff_dirac_init_arith_decoder(arith+1+i, gb, svq3_get_ue_golomb(gb)); - - for (y = 0; y < s->sbheight; y++) - for (x = 0; x < s->sbwidth; x++) { - int blkcnt = 1 << s->sbsplit[y * s->sbwidth + x]; - int step = 4 >> s->sbsplit[y * s->sbwidth + x]; - - for (q = 0; q < blkcnt; q++) - for (p = 0; p < blkcnt; p++) { - int bx = 4 * x + p*step; - int by = 4 * y + q*step; - DiracBlock *block = &s->blmotion[by*s->blwidth + bx]; - decode_block_params(s, arith, block, s->blwidth, bx, by); - propagate_block_data(block, s->blwidth, step); - } - } - - return 0; -} - -static int weight(int i, int blen, int offset) -{ -#define ROLLOFF(i) offset == 1 ? ((i) ? 5 : 3) : \ - (1 + (6*(i) + offset - 1) / (2*offset - 1)) - - if (i < 2*offset) - return ROLLOFF(i); - else if (i > blen-1 - 2*offset) - return ROLLOFF(blen-1 - i); - return 8; -} - -static void init_obmc_weight_row(Plane *p, uint8_t *obmc_weight, int stride, - int left, int right, int wy) -{ - int x; - for (x = 0; left && x < p->xblen >> 1; x++) - obmc_weight[x] = wy*8; - for (; x < p->xblen >> right; x++) - obmc_weight[x] = wy*weight(x, p->xblen, p->xoffset); - for (; x < p->xblen; x++) - obmc_weight[x] = wy*8; - for (; x < stride; x++) - obmc_weight[x] = 0; -} - -static void init_obmc_weight(Plane *p, uint8_t *obmc_weight, int stride, - int left, int right, int top, int bottom) -{ - int y; - for (y = 0; top && y < p->yblen >> 1; y++) { - init_obmc_weight_row(p, obmc_weight, stride, left, right, 8); - obmc_weight += stride; - } - for (; y < p->yblen >> bottom; y++) { - int wy = weight(y, p->yblen, p->yoffset); - init_obmc_weight_row(p, obmc_weight, stride, left, right, wy); - obmc_weight += stride; - } - for (; y < p->yblen; y++) { - init_obmc_weight_row(p, obmc_weight, stride, left, right, 8); - obmc_weight += stride; - } -} - -static void init_obmc_weights(DiracContext *s, Plane *p, int by) -{ - int top = !by; - int bottom = by == s->blheight-1; - - /* don't bother re-initing for rows 2 to blheight-2, the weights don't change */ - if (top || bottom || by == 1) { - init_obmc_weight(p, s->obmc_weight[0], MAX_BLOCKSIZE, 1, 0, top, bottom); - init_obmc_weight(p, s->obmc_weight[1], MAX_BLOCKSIZE, 0, 0, top, bottom); - init_obmc_weight(p, s->obmc_weight[2], MAX_BLOCKSIZE, 0, 1, top, bottom); - } -} - -static const uint8_t epel_weights[4][4][4] = { - {{ 16, 0, 0, 0 }, - { 12, 4, 0, 0 }, - { 8, 8, 0, 0 }, - { 4, 12, 0, 0 }}, - {{ 12, 0, 4, 0 }, - { 9, 3, 3, 1 }, - { 6, 6, 2, 2 }, - { 3, 9, 1, 3 }}, - {{ 8, 0, 8, 0 }, - { 6, 2, 6, 2 }, - { 4, 4, 4, 4 }, - { 2, 6, 2, 6 }}, - {{ 4, 0, 12, 0 }, - { 3, 1, 9, 3 }, - { 2, 2, 6, 6 }, - { 1, 3, 3, 9 }} -}; - -/** - * For block x,y, determine which of the hpel planes to do bilinear - * interpolation from and set src[] to the location in each hpel plane - * to MC from. - * - * @return the index of the put_dirac_pixels_tab function to use - * 0 for 1 plane (fpel,hpel), 1 for 2 planes (qpel), 2 for 4 planes (qpel), and 3 for epel - */ -static int mc_subpel(DiracContext *s, DiracBlock *block, const uint8_t *src[5], - int x, int y, int ref, int plane) -{ - Plane *p = &s->plane[plane]; - uint8_t **ref_hpel = s->ref_pics[ref]->hpel[plane]; - int motion_x = block->u.mv[ref][0]; - int motion_y = block->u.mv[ref][1]; - int mx, my, i, epel, nplanes = 0; - - if (plane) { - motion_x >>= s->chroma_x_shift; - motion_y >>= s->chroma_y_shift; - } - - mx = motion_x & ~(-1 << s->mv_precision); - my = motion_y & ~(-1 << s->mv_precision); - motion_x >>= s->mv_precision; - motion_y >>= s->mv_precision; - /* normalize subpel coordinates to epel */ - /* TODO: template this function? */ - mx <<= 3 - s->mv_precision; - my <<= 3 - s->mv_precision; - - x += motion_x; - y += motion_y; - epel = (mx|my)&1; - - /* hpel position */ - if (!((mx|my)&3)) { - nplanes = 1; - src[0] = ref_hpel[(my>>1)+(mx>>2)] + y*p->stride + x; - } else { - /* qpel or epel */ - nplanes = 4; - for (i = 0; i < 4; i++) - src[i] = ref_hpel[i] + y*p->stride + x; - - /* if we're interpolating in the right/bottom halves, adjust the planes as needed - we increment x/y because the edge changes for half of the pixels */ - if (mx > 4) { - src[0] += 1; - src[2] += 1; - x++; - } - if (my > 4) { - src[0] += p->stride; - src[1] += p->stride; - y++; - } - - /* hpel planes are: - [0]: F [1]: H - [2]: V [3]: C */ - if (!epel) { - /* check if we really only need 2 planes since either mx or my is - a hpel position. (epel weights of 0 handle this there) */ - if (!(mx&3)) { - /* mx == 0: average [0] and [2] - mx == 4: average [1] and [3] */ - src[!mx] = src[2 + !!mx]; - nplanes = 2; - } else if (!(my&3)) { - src[0] = src[(my>>1) ]; - src[1] = src[(my>>1)+1]; - nplanes = 2; - } - } else { - /* adjust the ordering if needed so the weights work */ - if (mx > 4) { - FFSWAP(const uint8_t *, src[0], src[1]); - FFSWAP(const uint8_t *, src[2], src[3]); - } - if (my > 4) { - FFSWAP(const uint8_t *, src[0], src[2]); - FFSWAP(const uint8_t *, src[1], src[3]); - } - src[4] = epel_weights[my&3][mx&3]; - } - } - - /* fixme: v/h _edge_pos */ - if (x + p->xblen > p->width +EDGE_WIDTH/2 || - y + p->yblen > p->height+EDGE_WIDTH/2 || - x < 0 || y < 0) { - for (i = 0; i < nplanes; i++) { - ff_emulated_edge_mc(s->edge_emu_buffer[i], src[i], - p->stride, p->stride, - p->xblen, p->yblen, x, y, - p->width+EDGE_WIDTH/2, p->height+EDGE_WIDTH/2); - src[i] = s->edge_emu_buffer[i]; - } - } - return (nplanes>>1) + epel; -} - -static void add_dc(uint16_t *dst, int dc, int stride, - uint8_t *obmc_weight, int xblen, int yblen) -{ - int x, y; - dc += 128; - - for (y = 0; y < yblen; y++) { - for (x = 0; x < xblen; x += 2) { - dst[x ] += dc * obmc_weight[x ]; - dst[x+1] += dc * obmc_weight[x+1]; - } - dst += stride; - obmc_weight += MAX_BLOCKSIZE; - } -} - -static void block_mc(DiracContext *s, DiracBlock *block, - uint16_t *mctmp, uint8_t *obmc_weight, - int plane, int dstx, int dsty) -{ - Plane *p = &s->plane[plane]; - const uint8_t *src[5]; - int idx; - - switch (block->ref&3) { - case 0: /* DC */ - add_dc(mctmp, block->u.dc[plane], p->stride, obmc_weight, p->xblen, p->yblen); - return; - case 1: - case 2: - idx = mc_subpel(s, block, src, dstx, dsty, (block->ref&3)-1, plane); - s->put_pixels_tab[idx](s->mcscratch, src, p->stride, p->yblen); - if (s->weight_func) - s->weight_func(s->mcscratch, p->stride, s->weight_log2denom, - s->weight[0] + s->weight[1], p->yblen); - break; - case 3: - idx = mc_subpel(s, block, src, dstx, dsty, 0, plane); - s->put_pixels_tab[idx](s->mcscratch, src, p->stride, p->yblen); - idx = mc_subpel(s, block, src, dstx, dsty, 1, plane); - if (s->biweight_func) { - /* fixme: +32 is a quick hack */ - s->put_pixels_tab[idx](s->mcscratch + 32, src, p->stride, p->yblen); - s->biweight_func(s->mcscratch, s->mcscratch+32, p->stride, s->weight_log2denom, - s->weight[0], s->weight[1], p->yblen); - } else - s->avg_pixels_tab[idx](s->mcscratch, src, p->stride, p->yblen); - break; - } - s->add_obmc(mctmp, s->mcscratch, p->stride, obmc_weight, p->yblen); -} - -static void mc_row(DiracContext *s, DiracBlock *block, uint16_t *mctmp, int plane, int dsty) -{ - Plane *p = &s->plane[plane]; - int x, dstx = p->xbsep - p->xoffset; - - block_mc(s, block, mctmp, s->obmc_weight[0], plane, -p->xoffset, dsty); - mctmp += p->xbsep; - - for (x = 1; x < s->blwidth-1; x++) { - block_mc(s, block+x, mctmp, s->obmc_weight[1], plane, dstx, dsty); - dstx += p->xbsep; - mctmp += p->xbsep; - } - block_mc(s, block+x, mctmp, s->obmc_weight[2], plane, dstx, dsty); -} - -static void select_dsp_funcs(DiracContext *s, int width, int height, int xblen, int yblen) -{ - int idx = 0; - if (xblen > 8) - idx = 1; - if (xblen > 16) - idx = 2; - - memcpy(s->put_pixels_tab, s->diracdsp.put_dirac_pixels_tab[idx], sizeof(s->put_pixels_tab)); - memcpy(s->avg_pixels_tab, s->diracdsp.avg_dirac_pixels_tab[idx], sizeof(s->avg_pixels_tab)); - s->add_obmc = s->diracdsp.add_dirac_obmc[idx]; - if (s->weight_log2denom > 1 || s->weight[0] != 1 || s->weight[1] != 1) { - s->weight_func = s->diracdsp.weight_dirac_pixels_tab[idx]; - s->biweight_func = s->diracdsp.biweight_dirac_pixels_tab[idx]; - } else { - s->weight_func = NULL; - s->biweight_func = NULL; - } -} - -static void interpolate_refplane(DiracContext *s, DiracFrame *ref, int plane, int width, int height) -{ - /* chroma allocates an edge of 8 when subsampled - which for 4:2:2 means an h edge of 16 and v edge of 8 - just use 8 for everything for the moment */ - int i, edge = EDGE_WIDTH/2; - - ref->hpel[plane][0] = ref->avframe->data[plane]; - s->dsp.draw_edges(ref->hpel[plane][0], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); /* EDGE_TOP | EDGE_BOTTOM values just copied to make it build, this needs to be ensured */ - - /* no need for hpel if we only have fpel vectors */ - if (!s->mv_precision) - return; - - for (i = 1; i < 4; i++) { - if (!ref->hpel_base[plane][i]) - ref->hpel_base[plane][i] = av_malloc((height+2*edge) * ref->avframe->linesize[plane] + 32); - /* we need to be 16-byte aligned even for chroma */ - ref->hpel[plane][i] = ref->hpel_base[plane][i] + edge*ref->avframe->linesize[plane] + 16; - } - - if (!ref->interpolated[plane]) { - s->diracdsp.dirac_hpel_filter(ref->hpel[plane][1], ref->hpel[plane][2], - ref->hpel[plane][3], ref->hpel[plane][0], - ref->avframe->linesize[plane], width, height); - s->dsp.draw_edges(ref->hpel[plane][1], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(ref->hpel[plane][2], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); - s->dsp.draw_edges(ref->hpel[plane][3], ref->avframe->linesize[plane], width, height, edge, edge, EDGE_TOP | EDGE_BOTTOM); - } - ref->interpolated[plane] = 1; -} - -/** - * Dirac Specification -> - * 13.0 Transform data syntax. transform_data() - */ -static int dirac_decode_frame_internal(DiracContext *s) -{ - DWTContext d; - int y, i, comp, dsty; - - if (s->low_delay) { - /* [DIRAC_STD] 13.5.1 low_delay_transform_data() */ - for (comp = 0; comp < 3; comp++) { - Plane *p = &s->plane[comp]; - memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); - } - if (!s->zero_res) - decode_lowdelay(s); - } - - for (comp = 0; comp < 3; comp++) { - Plane *p = &s->plane[comp]; - uint8_t *frame = s->current_picture->avframe->data[comp]; - - /* FIXME: small resolutions */ - for (i = 0; i < 4; i++) - s->edge_emu_buffer[i] = s->edge_emu_buffer_base + i*FFALIGN(p->width, 16); - - if (!s->zero_res && !s->low_delay) - { - memset(p->idwt_buf, 0, p->idwt_stride * p->idwt_height * sizeof(IDWTELEM)); - decode_component(s, comp); /* [DIRAC_STD] 13.4.1 core_transform_data() */ - } - if (ff_spatial_idwt_init2(&d, p->idwt_buf, p->idwt_width, p->idwt_height, p->idwt_stride, - s->wavelet_idx+2, s->wavelet_depth, p->idwt_tmp)) - return -1; - - if (!s->num_refs) { /* intra */ - for (y = 0; y < p->height; y += 16) { - ff_spatial_idwt_slice2(&d, y+16); /* decode */ - s->diracdsp.put_signed_rect_clamped(frame + y*p->stride, p->stride, - p->idwt_buf + y*p->idwt_stride, p->idwt_stride, p->width, 16); - } - } else { /* inter */ - int rowheight = p->ybsep*p->stride; - - select_dsp_funcs(s, p->width, p->height, p->xblen, p->yblen); - - for (i = 0; i < s->num_refs; i++) - interpolate_refplane(s, s->ref_pics[i], comp, p->width, p->height); - - memset(s->mctmp, 0, 4*p->yoffset*p->stride); - - dsty = -p->yoffset; - for (y = 0; y < s->blheight; y++) { - int h = 0, - start = FFMAX(dsty, 0); - uint16_t *mctmp = s->mctmp + y*rowheight; - DiracBlock *blocks = s->blmotion + y*s->blwidth; - - init_obmc_weights(s, p, y); - - if (y == s->blheight-1 || start+p->ybsep > p->height) - h = p->height - start; - else - h = p->ybsep - (start - dsty); - if (h < 0) - break; - - memset(mctmp+2*p->yoffset*p->stride, 0, 2*rowheight); - mc_row(s, blocks, mctmp, comp, dsty); - - mctmp += (start - dsty)*p->stride + p->xoffset; - ff_spatial_idwt_slice2(&d, start + h); /* decode */ - s->diracdsp.add_rect_clamped(frame + start*p->stride, mctmp, p->stride, - p->idwt_buf + start*p->idwt_stride, p->idwt_stride, p->width, h); - - dsty += p->ybsep; - } - } - } - - - return 0; -} - -static int get_buffer_with_edge(AVCodecContext *avctx, AVFrame *f, int flags) -{ - int ret, i; - int chroma_x_shift, chroma_y_shift; - avcodec_get_chroma_sub_sample(avctx->pix_fmt, &chroma_x_shift, &chroma_y_shift); - - f->width = avctx->width + 2 * EDGE_WIDTH; - f->height = avctx->height + 2 * EDGE_WIDTH + 2; - ret = ff_get_buffer(avctx, f, flags); - if (ret < 0) - return ret; - - for (i = 0; f->data[i]; i++) { - int offset = (EDGE_WIDTH >> (i && i<3 ? chroma_y_shift : 0)) * - f->linesize[i] + 32; - f->data[i] += offset; - } - f->width = avctx->width; - f->height = avctx->height; - - return 0; -} - -/** - * Dirac Specification -> - * 11.1.1 Picture Header. picture_header() - */ -static int dirac_decode_picture_header(DiracContext *s) -{ - int retire, picnum; - int i, j, refnum, refdist; - GetBitContext *gb = &s->gb; - - /* [DIRAC_STD] 11.1.1 Picture Header. picture_header() PICTURE_NUM */ - picnum = s->current_picture->avframe->display_picture_number = get_bits_long(gb, 32); - - - av_log(s->avctx,AV_LOG_DEBUG,"PICTURE_NUM: %d\n",picnum); - - /* if this is the first keyframe after a sequence header, start our - reordering from here */ - if (s->frame_number < 0) - s->frame_number = picnum; - - s->ref_pics[0] = s->ref_pics[1] = NULL; - for (i = 0; i < s->num_refs; i++) { - refnum = picnum + dirac_get_se_golomb(gb); - refdist = INT_MAX; - - /* find the closest reference to the one we want */ - /* Jordi: this is needed if the referenced picture hasn't yet arrived */ - for (j = 0; j < MAX_REFERENCE_FRAMES && refdist; j++) - if (s->ref_frames[j] - && FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum) < refdist) { - s->ref_pics[i] = s->ref_frames[j]; - refdist = FFABS(s->ref_frames[j]->avframe->display_picture_number - refnum); - } - - if (!s->ref_pics[i] || refdist) - av_log(s->avctx, AV_LOG_DEBUG, "Reference not found\n"); - - /* if there were no references at all, allocate one */ - if (!s->ref_pics[i]) - for (j = 0; j < MAX_FRAMES; j++) - if (!s->all_frames[j].avframe->data[0]) { - s->ref_pics[i] = &s->all_frames[j]; - get_buffer_with_edge(s->avctx, s->ref_pics[i]->avframe, AV_GET_BUFFER_FLAG_REF); - break; - } - } - - /* retire the reference frames that are not used anymore */ - if (s->current_picture->avframe->reference) { - retire = picnum + dirac_get_se_golomb(gb); - if (retire != picnum) { - DiracFrame *retire_pic = remove_frame(s->ref_frames, retire); - - if (retire_pic) - retire_pic->avframe->reference &= DELAYED_PIC_REF; - else - av_log(s->avctx, AV_LOG_DEBUG, "Frame to retire not found\n"); - } - - /* if reference array is full, remove the oldest as per the spec */ - while (add_frame(s->ref_frames, MAX_REFERENCE_FRAMES, s->current_picture)) { - av_log(s->avctx, AV_LOG_ERROR, "Reference frame overflow\n"); - remove_frame(s->ref_frames, s->ref_frames[0]->avframe->display_picture_number)->avframe->reference &= DELAYED_PIC_REF; - } - } - - if (s->num_refs) { - if (dirac_unpack_prediction_parameters(s)) /* [DIRAC_STD] 11.2 Picture Prediction Data. picture_prediction() */ - return -1; - if (dirac_unpack_block_motion_data(s)) /* [DIRAC_STD] 12. Block motion data syntax */ - return -1; - } - if (dirac_unpack_idwt_params(s)) /* [DIRAC_STD] 11.3 Wavelet transform data */ - return -1; - - init_planes(s); - return 0; -} - -static int get_delayed_pic(DiracContext *s, AVFrame *picture, int *got_frame) -{ - DiracFrame *out = s->delay_frames[0]; - int i, out_idx = 0; - int ret; - - /* find frame with lowest picture number */ - for (i = 1; s->delay_frames[i]; i++) - if (s->delay_frames[i]->avframe->display_picture_number < out->avframe->display_picture_number) { - out = s->delay_frames[i]; - out_idx = i; - } - - for (i = out_idx; s->delay_frames[i]; i++) - s->delay_frames[i] = s->delay_frames[i+1]; - - if (out) { - out->avframe->reference ^= DELAYED_PIC_REF; - *got_frame = 1; - if((ret = av_frame_ref(picture, out->avframe)) < 0) - return ret; - } - - return 0; -} - -/** - * Dirac Specification -> - * 9.6 Parse Info Header Syntax. parse_info() - * 4 byte start code + byte parse code + 4 byte size + 4 byte previous size - */ -#define DATA_UNIT_HEADER_SIZE 13 - -/* [DIRAC_STD] dirac_decode_data_unit makes reference to the while defined in 9.3 - inside the function parse_sequence() */ -static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int size) -{ - DiracContext *s = avctx->priv_data; - DiracFrame *pic = NULL; - int ret, i, parse_code = buf[4]; - unsigned tmp; - - if (size < DATA_UNIT_HEADER_SIZE) - return -1; - - init_get_bits(&s->gb, &buf[13], 8*(size - DATA_UNIT_HEADER_SIZE)); - - if (parse_code == pc_seq_header) { - if (s->seen_sequence_header) - return 0; - - /* [DIRAC_STD] 10. Sequence header */ - if (avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source)) - return -1; - - avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); - - if (alloc_sequence_buffers(s)) - return -1; - - s->seen_sequence_header = 1; - } else if (parse_code == pc_eos) { /* [DIRAC_STD] End of Sequence */ - free_sequence_buffers(s); - s->seen_sequence_header = 0; - } else if (parse_code == pc_aux_data) { - if (buf[13] == 1) { /* encoder implementation/version */ - int ver[3]; - /* versions older than 1.0.8 don't store quant delta for - subbands with only one codeblock */ - if (sscanf((const char *) buf+14, "Schroedinger %d.%d.%d", ver, ver+1, ver+2) == 3) - if (ver[0] == 1 && ver[1] == 0 && ver[2] <= 7) - s->old_delta_quant = 1; - } - } else if (parse_code & 0x8) { /* picture data unit */ - if (!s->seen_sequence_header) { - av_log(avctx, AV_LOG_DEBUG, "Dropping frame without sequence header\n"); - return -1; - } - - /* find an unused frame */ - for (i = 0; i < MAX_FRAMES; i++) - if (s->all_frames[i].avframe->data[0] == NULL) - pic = &s->all_frames[i]; - if (!pic) { - av_log(avctx, AV_LOG_ERROR, "framelist full\n"); - return -1; - } - - av_frame_unref(pic->avframe); - - /* [DIRAC_STD] Defined in 9.6.1 ... */ - tmp = parse_code & 0x03; /* [DIRAC_STD] num_refs() */ - if (tmp > 2) { - av_log(avctx, AV_LOG_ERROR, "num_refs of 3\n"); - return -1; - } - s->num_refs = tmp; - s->is_arith = (parse_code & 0x48) == 0x08; /* [DIRAC_STD] using_ac() */ - s->low_delay = (parse_code & 0x88) == 0x88; /* [DIRAC_STD] is_low_delay() */ - pic->avframe->reference = (parse_code & 0x0C) == 0x0C; /* [DIRAC_STD] is_reference() */ - pic->avframe->key_frame = s->num_refs == 0; /* [DIRAC_STD] is_intra() */ - pic->avframe->pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */ - - if ((ret = get_buffer_with_edge(avctx, pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0) - return ret; - s->current_picture = pic; - s->plane[0].stride = pic->avframe->linesize[0]; - s->plane[1].stride = pic->avframe->linesize[1]; - s->plane[2].stride = pic->avframe->linesize[2]; - - /* [DIRAC_STD] 11.1 Picture parse. picture_parse() */ - if (dirac_decode_picture_header(s)) - return -1; - - /* [DIRAC_STD] 13.0 Transform data syntax. transform_data() */ - if (dirac_decode_frame_internal(s)) - return -1; - } - return 0; -} - -static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *pkt) -{ - DiracContext *s = avctx->priv_data; - AVFrame *picture = data; - uint8_t *buf = pkt->data; - int buf_size = pkt->size; - int i, data_unit_size, buf_idx = 0; - int ret; - - /* release unused frames */ - for (i = 0; i < MAX_FRAMES; i++) - if (s->all_frames[i].avframe->data[0] && !s->all_frames[i].avframe->reference) { - av_frame_unref(s->all_frames[i].avframe); - memset(s->all_frames[i].interpolated, 0, sizeof(s->all_frames[i].interpolated)); - } - - s->current_picture = NULL; - *got_frame = 0; - - /* end of stream, so flush delayed pics */ - if (buf_size == 0) - return get_delayed_pic(s, (AVFrame *)data, got_frame); - - for (;;) { - /*[DIRAC_STD] Here starts the code from parse_info() defined in 9.6 - [DIRAC_STD] PARSE_INFO_PREFIX = "BBCD" as defined in ISO/IEC 646 - BBCD start code search */ - for (; buf_idx + DATA_UNIT_HEADER_SIZE < buf_size; buf_idx++) { - if (buf[buf_idx ] == 'B' && buf[buf_idx+1] == 'B' && - buf[buf_idx+2] == 'C' && buf[buf_idx+3] == 'D') - break; - } - /* BBCD found or end of data */ - if (buf_idx + DATA_UNIT_HEADER_SIZE >= buf_size) - break; - - data_unit_size = AV_RB32(buf+buf_idx+5); - if (buf_idx + data_unit_size > buf_size || !data_unit_size) { - if(buf_idx + data_unit_size > buf_size) - av_log(s->avctx, AV_LOG_ERROR, - "Data unit with size %d is larger than input buffer, discarding\n", - data_unit_size); - buf_idx += 4; - continue; - } - /* [DIRAC_STD] dirac_decode_data_unit makes reference to the while defined in 9.3 inside the function parse_sequence() */ - if (dirac_decode_data_unit(avctx, buf+buf_idx, data_unit_size)) - { - av_log(s->avctx, AV_LOG_ERROR,"Error in dirac_decode_data_unit\n"); - return -1; - } - buf_idx += data_unit_size; - } - - if (!s->current_picture) - return buf_size; - - if (s->current_picture->avframe->display_picture_number > s->frame_number) { - DiracFrame *delayed_frame = remove_frame(s->delay_frames, s->frame_number); - - s->current_picture->avframe->reference |= DELAYED_PIC_REF; - - if (add_frame(s->delay_frames, MAX_DELAY, s->current_picture)) { - int min_num = s->delay_frames[0]->avframe->display_picture_number; - /* Too many delayed frames, so we display the frame with the lowest pts */ - av_log(avctx, AV_LOG_ERROR, "Delay frame overflow\n"); - delayed_frame = s->delay_frames[0]; - - for (i = 1; s->delay_frames[i]; i++) - if (s->delay_frames[i]->avframe->display_picture_number < min_num) - min_num = s->delay_frames[i]->avframe->display_picture_number; - - delayed_frame = remove_frame(s->delay_frames, min_num); - add_frame(s->delay_frames, MAX_DELAY, s->current_picture); - } - - if (delayed_frame) { - delayed_frame->avframe->reference ^= DELAYED_PIC_REF; - if((ret=av_frame_ref(data, delayed_frame->avframe)) < 0) - return ret; - *got_frame = 1; - } - } else if (s->current_picture->avframe->display_picture_number == s->frame_number) { - /* The right frame at the right time :-) */ - if((ret=av_frame_ref(data, s->current_picture->avframe)) < 0) - return ret; - *got_frame = 1; - } - - if (*got_frame) - s->frame_number = picture->display_picture_number + 1; - - return buf_idx; -} - -AVCodec ff_dirac_decoder = { - .name = "dirac", - .long_name = NULL_IF_CONFIG_SMALL("BBC Dirac VC-2"), - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_DIRAC, - .priv_data_size = sizeof(DiracContext), - .init = dirac_decode_init, - .close = dirac_decode_end, - .decode = dirac_decode_frame, - .capabilities = CODEC_CAP_DELAY, - .flush = dirac_decode_flush, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.c deleted file mode 100644 index 8984c13b5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (C) 2009 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "dsputil.h" -#include "diracdsp.h" -#include "libavcodec/x86/diracdsp_mmx.h" - -#define FILTER(src, stride) \ - ((21*((src)[ 0*stride] + (src)[1*stride]) \ - -7*((src)[-1*stride] + (src)[2*stride]) \ - +3*((src)[-2*stride] + (src)[3*stride]) \ - -1*((src)[-3*stride] + (src)[4*stride]) + 16) >> 5) - -static void dirac_hpel_filter(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, - int stride, int width, int height) -{ - int x, y; - - for (y = 0; y < height; y++) { - for (x = -3; x < width+5; x++) - dstv[x] = av_clip_uint8(FILTER(src+x, stride)); - - for (x = 0; x < width; x++) - dstc[x] = av_clip_uint8(FILTER(dstv+x, 1)); - - for (x = 0; x < width; x++) - dsth[x] = av_clip_uint8(FILTER(src+x, 1)); - - src += stride; - dsth += stride; - dstv += stride; - dstc += stride; - } -} - -#define PIXOP_BILINEAR(PFX, OP, WIDTH) \ - static void ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c(uint8_t *dst, const uint8_t *src[5], int stride, int h) \ - { \ - int x; \ - const uint8_t *s0 = src[0]; \ - const uint8_t *s1 = src[1]; \ - const uint8_t *s2 = src[2]; \ - const uint8_t *s3 = src[3]; \ - const uint8_t *w = src[4]; \ - \ - while (h--) { \ - for (x = 0; x < WIDTH; x++) { \ - OP(dst[x], (s0[x]*w[0] + s1[x]*w[1] + s2[x]*w[2] + s3[x]*w[3] + 8) >> 4); \ - } \ - \ - dst += stride; \ - s0 += stride; \ - s1 += stride; \ - s2 += stride; \ - s3 += stride; \ - } \ - } - -#define OP_PUT(dst, val) (dst) = (val) -#define OP_AVG(dst, val) (dst) = (((dst) + (val) + 1)>>1) - -PIXOP_BILINEAR(put, OP_PUT, 8) -PIXOP_BILINEAR(put, OP_PUT, 16) -PIXOP_BILINEAR(put, OP_PUT, 32) -PIXOP_BILINEAR(avg, OP_AVG, 8) -PIXOP_BILINEAR(avg, OP_AVG, 16) -PIXOP_BILINEAR(avg, OP_AVG, 32) - -#define op_scale1(x) block[x] = av_clip_uint8( (block[x]*weight + (1<<(log2_denom-1))) >> log2_denom) -#define op_scale2(x) dst[x] = av_clip_uint8( (src[x]*weights + dst[x]*weightd + (1<<(log2_denom-1))) >> log2_denom) - -#define DIRAC_WEIGHT(W) \ - static void weight_dirac_pixels ## W ## _c(uint8_t *block, int stride, int log2_denom, \ - int weight, int h) { \ - int x; \ - while (h--) { \ - for (x = 0; x < W; x++) { \ - op_scale1(x); \ - op_scale1(x+1); \ - } \ - block += stride; \ - } \ - } \ - static void biweight_dirac_pixels ## W ## _c(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, \ - int weightd, int weights, int h) { \ - int x; \ - while (h--) { \ - for (x = 0; x < W; x++) { \ - op_scale2(x); \ - op_scale2(x+1); \ - } \ - dst += stride; \ - src += stride; \ - } \ - } - -DIRAC_WEIGHT(8) -DIRAC_WEIGHT(16) -DIRAC_WEIGHT(32) - -#define ADD_OBMC(xblen) \ - static void add_obmc ## xblen ## _c(uint16_t *dst, const uint8_t *src, int stride, \ - const uint8_t *obmc_weight, int yblen) \ - { \ - int x; \ - while (yblen--) { \ - for (x = 0; x < xblen; x += 2) { \ - dst[x ] += src[x ] * obmc_weight[x ]; \ - dst[x+1] += src[x+1] * obmc_weight[x+1]; \ - } \ - dst += stride; \ - src += stride; \ - obmc_weight += 32; \ - } \ - } - -ADD_OBMC(8) -ADD_OBMC(16) -ADD_OBMC(32) - -static void put_signed_rect_clamped_c(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height) -{ - int x, y; - for (y = 0; y < height; y++) { - for (x = 0; x < width; x+=4) { - dst[x ] = av_clip_uint8(src[x ] + 128); - dst[x+1] = av_clip_uint8(src[x+1] + 128); - dst[x+2] = av_clip_uint8(src[x+2] + 128); - dst[x+3] = av_clip_uint8(src[x+3] + 128); - } - dst += dst_stride; - src += src_stride; - } -} - -static void add_rect_clamped_c(uint8_t *dst, const uint16_t *src, int stride, - const int16_t *idwt, int idwt_stride, - int width, int height) -{ - int x, y; - - for (y = 0; y < height; y++) { - for (x = 0; x < width; x+=2) { - dst[x ] = av_clip_uint8(((src[x ]+32)>>6) + idwt[x ]); - dst[x+1] = av_clip_uint8(((src[x+1]+32)>>6) + idwt[x+1]); - } - dst += stride; - src += stride; - idwt += idwt_stride; - } -} - -#define PIXFUNC(PFX, WIDTH) \ - c->PFX ## _dirac_pixels_tab[WIDTH>>4][0] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _c; \ - c->PFX ## _dirac_pixels_tab[WIDTH>>4][1] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l2_c; \ - c->PFX ## _dirac_pixels_tab[WIDTH>>4][2] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _l4_c; \ - c->PFX ## _dirac_pixels_tab[WIDTH>>4][3] = ff_ ## PFX ## _dirac_pixels ## WIDTH ## _bilinear_c - -void ff_diracdsp_init(DiracDSPContext *c) -{ - c->dirac_hpel_filter = dirac_hpel_filter; - c->add_rect_clamped = add_rect_clamped_c; - c->put_signed_rect_clamped = put_signed_rect_clamped_c; - - c->add_dirac_obmc[0] = add_obmc8_c; - c->add_dirac_obmc[1] = add_obmc16_c; - c->add_dirac_obmc[2] = add_obmc32_c; - - c->weight_dirac_pixels_tab[0] = weight_dirac_pixels8_c; - c->weight_dirac_pixels_tab[1] = weight_dirac_pixels16_c; - c->weight_dirac_pixels_tab[2] = weight_dirac_pixels32_c; - c->biweight_dirac_pixels_tab[0] = biweight_dirac_pixels8_c; - c->biweight_dirac_pixels_tab[1] = biweight_dirac_pixels16_c; - c->biweight_dirac_pixels_tab[2] = biweight_dirac_pixels32_c; - - PIXFUNC(put, 8); - PIXFUNC(put, 16); - PIXFUNC(put, 32); - PIXFUNC(avg, 8); - PIXFUNC(avg, 16); - PIXFUNC(avg, 32); - - if (HAVE_MMX && HAVE_YASM) ff_diracdsp_init_mmx(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.h deleted file mode 100644 index 613ca5bc8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/diracdsp.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2010 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_DIRACDSP_H -#define AVCODEC_DIRACDSP_H - -#include - -typedef void (*dirac_weight_func)(uint8_t *block, int stride, int log2_denom, int weight, int h); -typedef void (*dirac_biweight_func)(uint8_t *dst, const uint8_t *src, int stride, int log2_denom, int weightd, int weights, int h); - -typedef struct { - void (*dirac_hpel_filter)(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, const uint8_t *src, int stride, int width, int height); - /** - * dirac_pixels_tab[width][subpel] - * width is 2 for 32, 1 for 16, 0 for 8 - * subpel is 0 for fpel and hpel (only need to copy from the first plane in src) - * 1 if an average of the first 2 planes is needed (TODO: worth it?) - * 2 for general qpel (avg of 4) - * 3 for general epel (biweight of 4 using the weights in src[4]) - * src[0-3] is each of the hpel planes - * src[4] is the 1/8 pel weights if needed - */ - void (*put_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h); - void (*avg_dirac_pixels_tab[3][4])(uint8_t *dst, const uint8_t *src[5], int stride, int h); - - void (*put_signed_rect_clamped)(uint8_t *dst/*align 16*/, int dst_stride, const int16_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/); - void (*put_rect_clamped)(uint8_t *dst/*align 16*/, int dst_stride, const int16_t *src/*align 16*/, int src_stride, int width, int height/*mod 2*/); - void (*add_rect_clamped)(uint8_t *dst/*align 16*/, const uint16_t *src/*align 16*/, int stride, const int16_t *idwt/*align 16*/, int idwt_stride, int width, int height/*mod 2*/); - void (*add_dirac_obmc[3])(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); - - dirac_weight_func weight_dirac_pixels_tab[3]; - dirac_biweight_func biweight_dirac_pixels_tab[3]; -} DiracDSPContext; - -#define DECL_DIRAC_PIXOP(PFX, EXT) \ - void ff_ ## PFX ## _dirac_pixels8_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \ - void ff_ ## PFX ## _dirac_pixels16_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h); \ - void ff_ ## PFX ## _dirac_pixels32_ ## EXT(uint8_t *dst, const uint8_t *src[5], int stride, int h) - -DECL_DIRAC_PIXOP(put, c); -DECL_DIRAC_PIXOP(avg, c); -DECL_DIRAC_PIXOP(put, l2_c); -DECL_DIRAC_PIXOP(avg, l2_c); -DECL_DIRAC_PIXOP(put, l4_c); -DECL_DIRAC_PIXOP(avg, l4_c); - -void ff_diracdsp_init(DiracDSPContext *c); - -#endif /* AVCODEC_DIRACDSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.c deleted file mode 100644 index 17de1d4f6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.c +++ /dev/null @@ -1,2950 +0,0 @@ -/* - * DSP utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * DSP utils - */ - -#include "libavutil/attributes.h" -#include "libavutil/imgutils.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "copy_block.h" -#include "dct.h" -#include "dsputil.h" -#include "simple_idct.h" -#include "faandct.h" -#include "faanidct.h" -#include "imgconvert.h" -#include "mathops.h" -#include "mpegvideo.h" -#include "config.h" -#include "diracdsp.h" - -uint32_t ff_squareTbl[512] = {0, }; - -#define BIT_DEPTH 16 -#include "dsputil_template.c" -#undef BIT_DEPTH - -#define BIT_DEPTH 8 -#include "dsputil_template.c" - -// 0x7f7f7f7f or 0x7f7f7f7f7f7f7f7f or whatever, depending on the cpu's native arithmetic size -#define pb_7f (~0UL/255 * 0x7f) -#define pb_80 (~0UL/255 * 0x80) - -/* Specific zigzag scan for 248 idct. NOTE that unlike the - specification, we interleave the fields */ -const uint8_t ff_zigzag248_direct[64] = { - 0, 8, 1, 9, 16, 24, 2, 10, - 17, 25, 32, 40, 48, 56, 33, 41, - 18, 26, 3, 11, 4, 12, 19, 27, - 34, 42, 49, 57, 50, 58, 35, 43, - 20, 28, 5, 13, 6, 14, 21, 29, - 36, 44, 51, 59, 52, 60, 37, 45, - 22, 30, 7, 15, 23, 31, 38, 46, - 53, 61, 54, 62, 39, 47, 55, 63, -}; - -/* not permutated inverse zigzag_direct + 1 for MMX quantizer */ -DECLARE_ALIGNED(16, uint16_t, ff_inv_zigzag_direct16)[64]; - -const uint8_t ff_alternate_horizontal_scan[64] = { - 0, 1, 2, 3, 8, 9, 16, 17, - 10, 11, 4, 5, 6, 7, 15, 14, - 13, 12, 19, 18, 24, 25, 32, 33, - 26, 27, 20, 21, 22, 23, 28, 29, - 30, 31, 34, 35, 40, 41, 48, 49, - 42, 43, 36, 37, 38, 39, 44, 45, - 46, 47, 50, 51, 56, 57, 58, 59, - 52, 53, 54, 55, 60, 61, 62, 63, -}; - -const uint8_t ff_alternate_vertical_scan[64] = { - 0, 8, 16, 24, 1, 9, 2, 10, - 17, 25, 32, 40, 48, 56, 57, 49, - 41, 33, 26, 18, 3, 11, 4, 12, - 19, 27, 34, 42, 50, 58, 35, 43, - 51, 59, 20, 28, 5, 13, 6, 14, - 21, 29, 36, 44, 52, 60, 37, 45, - 53, 61, 22, 30, 7, 15, 23, 31, - 38, 46, 54, 62, 39, 47, 55, 63, -}; - -/* Input permutation for the simple_idct_mmx */ -static const uint8_t simple_mmx_permutation[64]={ - 0x00, 0x08, 0x04, 0x09, 0x01, 0x0C, 0x05, 0x0D, - 0x10, 0x18, 0x14, 0x19, 0x11, 0x1C, 0x15, 0x1D, - 0x20, 0x28, 0x24, 0x29, 0x21, 0x2C, 0x25, 0x2D, - 0x12, 0x1A, 0x16, 0x1B, 0x13, 0x1E, 0x17, 0x1F, - 0x02, 0x0A, 0x06, 0x0B, 0x03, 0x0E, 0x07, 0x0F, - 0x30, 0x38, 0x34, 0x39, 0x31, 0x3C, 0x35, 0x3D, - 0x22, 0x2A, 0x26, 0x2B, 0x23, 0x2E, 0x27, 0x2F, - 0x32, 0x3A, 0x36, 0x3B, 0x33, 0x3E, 0x37, 0x3F, -}; - -static const uint8_t idct_sse2_row_perm[8] = {0, 4, 1, 5, 2, 6, 3, 7}; - -av_cold void ff_init_scantable(uint8_t *permutation, ScanTable *st, - const uint8_t *src_scantable) -{ - int i; - int end; - - st->scantable= src_scantable; - - for(i=0; i<64; i++){ - int j; - j = src_scantable[i]; - st->permutated[i] = permutation[j]; - } - - end=-1; - for(i=0; i<64; i++){ - int j; - j = st->permutated[i]; - if(j>end) end=j; - st->raster_end[i]= end; - } -} - -av_cold void ff_init_scantable_permutation(uint8_t *idct_permutation, - int idct_permutation_type) -{ - int i; - - switch(idct_permutation_type){ - case FF_NO_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= i; - break; - case FF_LIBMPEG2_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2); - break; - case FF_SIMPLE_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= simple_mmx_permutation[i]; - break; - case FF_TRANSPOSE_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= ((i&7)<<3) | (i>>3); - break; - case FF_PARTTRANS_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3); - break; - case FF_SSE2_IDCT_PERM: - for(i=0; i<64; i++) - idct_permutation[i]= (i&0x38) | idct_sse2_row_perm[i&7]; - break; - default: - av_log(NULL, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n"); - } -} - -static int pix_sum_c(uint8_t * pix, int line_size) -{ - int s, i, j; - - s = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j += 8) { - s += pix[0]; - s += pix[1]; - s += pix[2]; - s += pix[3]; - s += pix[4]; - s += pix[5]; - s += pix[6]; - s += pix[7]; - pix += 8; - } - pix += line_size - 16; - } - return s; -} - -static int pix_norm1_c(uint8_t * pix, int line_size) -{ - int s, i, j; - uint32_t *sq = ff_squareTbl + 256; - - s = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j += 8) { -#if 0 - s += sq[pix[0]]; - s += sq[pix[1]]; - s += sq[pix[2]]; - s += sq[pix[3]]; - s += sq[pix[4]]; - s += sq[pix[5]]; - s += sq[pix[6]]; - s += sq[pix[7]]; -#else -#if HAVE_FAST_64BIT - register uint64_t x=*(uint64_t*)pix; - s += sq[x&0xff]; - s += sq[(x>>8)&0xff]; - s += sq[(x>>16)&0xff]; - s += sq[(x>>24)&0xff]; - s += sq[(x>>32)&0xff]; - s += sq[(x>>40)&0xff]; - s += sq[(x>>48)&0xff]; - s += sq[(x>>56)&0xff]; -#else - register uint32_t x=*(uint32_t*)pix; - s += sq[x&0xff]; - s += sq[(x>>8)&0xff]; - s += sq[(x>>16)&0xff]; - s += sq[(x>>24)&0xff]; - x=*(uint32_t*)(pix+4); - s += sq[x&0xff]; - s += sq[(x>>8)&0xff]; - s += sq[(x>>16)&0xff]; - s += sq[(x>>24)&0xff]; -#endif -#endif - pix += 8; - } - pix += line_size - 16; - } - return s; -} - -static void bswap_buf(uint32_t *dst, const uint32_t *src, int w){ - int i; - - for(i=0; i+8<=w; i+=8){ - dst[i+0]= av_bswap32(src[i+0]); - dst[i+1]= av_bswap32(src[i+1]); - dst[i+2]= av_bswap32(src[i+2]); - dst[i+3]= av_bswap32(src[i+3]); - dst[i+4]= av_bswap32(src[i+4]); - dst[i+5]= av_bswap32(src[i+5]); - dst[i+6]= av_bswap32(src[i+6]); - dst[i+7]= av_bswap32(src[i+7]); - } - for(;i 127) - *pixels = 255; - else - *pixels = (uint8_t)(*block + 128); - block++; - pixels++; - } - pixels += (line_size - 8); - } -} - -static void add_pixels8_c(uint8_t *av_restrict pixels, - int16_t *block, - int line_size) -{ - int i; - - for(i=0;i<8;i++) { - pixels[0] += block[0]; - pixels[1] += block[1]; - pixels[2] += block[2]; - pixels[3] += block[3]; - pixels[4] += block[4]; - pixels[5] += block[5]; - pixels[6] += block[6]; - pixels[7] += block[7]; - pixels += line_size; - block += 8; - } -} - -static void add_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels, - int line_size) -{ - int i; - - /* read the pixels */ - for(i=0;i<8;i++) { - pixels[0] = av_clip_uint8(pixels[0] + block[0]); - pixels[1] = av_clip_uint8(pixels[1] + block[1]); - pixels[2] = av_clip_uint8(pixels[2] + block[2]); - pixels[3] = av_clip_uint8(pixels[3] + block[3]); - pixels[4] = av_clip_uint8(pixels[4] + block[4]); - pixels[5] = av_clip_uint8(pixels[5] + block[5]); - pixels[6] = av_clip_uint8(pixels[6] + block[6]); - pixels[7] = av_clip_uint8(pixels[7] + block[7]); - pixels += line_size; - block += 8; - } -} - -static void add_pixels_clamped4_c(const int16_t *block, uint8_t *av_restrict pixels, - int line_size) -{ - int i; - - /* read the pixels */ - for(i=0;i<4;i++) { - pixels[0] = av_clip_uint8(pixels[0] + block[0]); - pixels[1] = av_clip_uint8(pixels[1] + block[1]); - pixels[2] = av_clip_uint8(pixels[2] + block[2]); - pixels[3] = av_clip_uint8(pixels[3] + block[3]); - pixels += line_size; - block += 8; - } -} - -static void add_pixels_clamped2_c(const int16_t *block, uint8_t *av_restrict pixels, - int line_size) -{ - int i; - - /* read the pixels */ - for(i=0;i<2;i++) { - pixels[0] = av_clip_uint8(pixels[0] + block[0]); - pixels[1] = av_clip_uint8(pixels[1] + block[1]); - pixels += line_size; - block += 8; - } -} - -static int sum_abs_dctelem_c(int16_t *block) -{ - int sum=0, i; - for(i=0; i<64; i++) - sum+= FFABS(block[i]); - return sum; -} - -static void fill_block16_c(uint8_t *block, uint8_t value, int line_size, int h) -{ - int i; - - for (i = 0; i < h; i++) { - memset(block, value, 16); - block += line_size; - } -} - -static void fill_block8_c(uint8_t *block, uint8_t value, int line_size, int h) -{ - int i; - - for (i = 0; i < h; i++) { - memset(block, value, 8); - block += line_size; - } -} - -#define avg2(a,b) ((a+b+1)>>1) -#define avg4(a,b,c,d) ((a+b+c+d+2)>>2) - -static void gmc1_c(uint8_t *dst, uint8_t *src, int stride, int h, int x16, int y16, int rounder) -{ - const int A=(16-x16)*(16-y16); - const int B=( x16)*(16-y16); - const int C=(16-x16)*( y16); - const int D=( x16)*( y16); - int i; - - for(i=0; i>8; - dst[1]= (A*src[1] + B*src[2] + C*src[stride+1] + D*src[stride+2] + rounder)>>8; - dst[2]= (A*src[2] + B*src[3] + C*src[stride+2] + D*src[stride+3] + rounder)>>8; - dst[3]= (A*src[3] + B*src[4] + C*src[stride+3] + D*src[stride+4] + rounder)>>8; - dst[4]= (A*src[4] + B*src[5] + C*src[stride+4] + D*src[stride+5] + rounder)>>8; - dst[5]= (A*src[5] + B*src[6] + C*src[stride+5] + D*src[stride+6] + rounder)>>8; - dst[6]= (A*src[6] + B*src[7] + C*src[stride+6] + D*src[stride+7] + rounder)>>8; - dst[7]= (A*src[7] + B*src[8] + C*src[stride+7] + D*src[stride+8] + rounder)>>8; - dst+= stride; - src+= stride; - } -} - -void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height) -{ - int y, vx, vy; - const int s= 1<>16; - src_y= vy>>16; - frac_x= src_x&(s-1); - frac_y= src_y&(s-1); - src_x>>=shift; - src_y>>=shift; - - if((unsigned)src_x < width){ - if((unsigned)src_y < height){ - index= src_x + src_y*stride; - dst[y*stride + x]= ( ( src[index ]*(s-frac_x) - + src[index +1]* frac_x )*(s-frac_y) - + ( src[index+stride ]*(s-frac_x) - + src[index+stride+1]* frac_x )* frac_y - + r)>>(shift*2); - }else{ - index= src_x + av_clip(src_y, 0, height)*stride; - dst[y*stride + x]= ( ( src[index ]*(s-frac_x) - + src[index +1]* frac_x )*s - + r)>>(shift*2); - } - }else{ - if((unsigned)src_y < height){ - index= av_clip(src_x, 0, width) + src_y*stride; - dst[y*stride + x]= ( ( src[index ]*(s-frac_y) - + src[index+stride ]* frac_y )*s - + r)>>(shift*2); - }else{ - index= av_clip(src_x, 0, width) + av_clip(src_y, 0, height)*stride; - dst[y*stride + x]= src[index ]; - } - } - - vx+= dxx; - vy+= dyx; - } - ox += dxy; - oy += dyy; - } -} - -static inline void put_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - switch(width){ - case 2: put_pixels2_8_c (dst, src, stride, height); break; - case 4: put_pixels4_8_c (dst, src, stride, height); break; - case 8: put_pixels8_8_c (dst, src, stride, height); break; - case 16:put_pixels16_8_c(dst, src, stride, height); break; - } -} - -static inline void put_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (683*(2*src[j] + src[j+1] + 1)) >> 11; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (683*(src[j] + 2*src[j+1] + 1)) >> 11; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (683*(2*src[j] + src[j+stride] + 1)) >> 11; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (683*(src[j] + 2*src[j+stride] + 1)) >> 11; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15; - } - src += stride; - dst += stride; - } -} - -static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc00_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - switch(width){ - case 2: avg_pixels2_8_c (dst, src, stride, height); break; - case 4: avg_pixels4_8_c (dst, src, stride, height); break; - case 8: avg_pixels8_8_c (dst, src, stride, height); break; - case 16:avg_pixels16_8_c(dst, src, stride, height); break; - } -} - -static inline void avg_tpel_pixels_mc10_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((683*(2*src[j] + src[j+1] + 1)) >> 11) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc20_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+1] + 1)) >> 11) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc01_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((683*(2*src[j] + src[j+stride] + 1)) >> 11) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc11_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((2731*(4*src[j] + 3*src[j+1] + 3*src[j+stride] + 2*src[j+stride+1] + 6)) >> 15) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc12_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((2731*(3*src[j] + 2*src[j+1] + 4*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc02_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((683*(src[j] + 2*src[j+stride] + 1)) >> 11) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc21_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((2731*(3*src[j] + 4*src[j+1] + 2*src[j+stride] + 3*src[j+stride+1] + 6)) >> 15) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ - int i,j; - for (i=0; i < height; i++) { - for (j=0; j < width; j++) { - dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1; - } - src += stride; - dst += stride; - } -} - -#define QPEL_MC(r, OPNAME, RND, OP) \ -static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){\ - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;\ - int i;\ - for(i=0; i>5]+1)>>1) -#define op_avg_no_rnd(a, b) a = (((a)+cm[((b) + 15)>>5])>>1) -#define op_put(a, b) a = cm[((b) + 16)>>5] -#define op_put_no_rnd(a, b) a = cm[((b) + 15)>>5] - -QPEL_MC(0, put_ , _ , op_put) -QPEL_MC(1, put_no_rnd_, _no_rnd_, op_put_no_rnd) -QPEL_MC(0, avg_ , _ , op_avg) -//QPEL_MC(1, avg_no_rnd , _ , op_avg) -#undef op_avg -#undef op_avg_no_rnd -#undef op_put -#undef op_put_no_rnd - -void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - put_pixels8_8_c(dst, src, stride, 8); -} -void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - avg_pixels8_8_c(dst, src, stride, 8); -} -void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - put_pixels16_8_c(dst, src, stride, 16); -} -void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - avg_pixels16_8_c(dst, src, stride, 16); -} - -#define put_qpel8_mc00_c ff_put_pixels8x8_c -#define avg_qpel8_mc00_c ff_avg_pixels8x8_c -#define put_qpel16_mc00_c ff_put_pixels16x16_c -#define avg_qpel16_mc00_c ff_avg_pixels16x16_c -#define put_no_rnd_qpel8_mc00_c ff_put_pixels8x8_c -#define put_no_rnd_qpel16_mc00_c ff_put_pixels16x16_c - -static void wmv2_mspel8_h_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int h){ - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - int i; - - for(i=0; i>4]; - dst[1]= cm[(9*(src[1] + src[2]) - (src[ 0] + src[3]) + 8)>>4]; - dst[2]= cm[(9*(src[2] + src[3]) - (src[ 1] + src[4]) + 8)>>4]; - dst[3]= cm[(9*(src[3] + src[4]) - (src[ 2] + src[5]) + 8)>>4]; - dst[4]= cm[(9*(src[4] + src[5]) - (src[ 3] + src[6]) + 8)>>4]; - dst[5]= cm[(9*(src[5] + src[6]) - (src[ 4] + src[7]) + 8)>>4]; - dst[6]= cm[(9*(src[6] + src[7]) - (src[ 5] + src[8]) + 8)>>4]; - dst[7]= cm[(9*(src[7] + src[8]) - (src[ 6] + src[9]) + 8)>>4]; - dst+=dstStride; - src+=srcStride; - } -} - -#if CONFIG_RV40_DECODER -void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - put_pixels16_xy2_8_c(dst, src, stride, 16); -} -void ff_avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - avg_pixels16_xy2_8_c(dst, src, stride, 16); -} -void ff_put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - put_pixels8_xy2_8_c(dst, src, stride, 8); -} -void ff_avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - avg_pixels8_xy2_8_c(dst, src, stride, 8); -} -#endif /* CONFIG_RV40_DECODER */ - -#if CONFIG_DIRAC_DECODER -#define DIRAC_MC(OPNAME)\ -void ff_ ## OPNAME ## _dirac_pixels8_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels8_8_c(dst, src[0], stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels16_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_8_c(dst, src[0], stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels32_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_8_c(dst , src[0] , stride, h);\ - OPNAME ## _pixels16_8_c(dst+16, src[0]+16, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels8_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels8_l2_8(dst, src[0], src[1], stride, stride, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels16_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_l2_8(dst, src[0], src[1], stride, stride, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels32_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_l2_8(dst , src[0] , src[1] , stride, stride, stride, h);\ - OPNAME ## _pixels16_l2_8(dst+16, src[0]+16, src[1]+16, stride, stride, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels8_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels8_l4_8(dst, src[0], src[1], src[2], src[3], stride, stride, stride, stride, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels16_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_l4_8(dst, src[0], src[1], src[2], src[3], stride, stride, stride, stride, stride, h);\ -}\ -void ff_ ## OPNAME ## _dirac_pixels32_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\ -{\ - OPNAME ## _pixels16_l4_8(dst , src[0] , src[1] , src[2] , src[3] , stride, stride, stride, stride, stride, h);\ - OPNAME ## _pixels16_l4_8(dst+16, src[0]+16, src[1]+16, src[2]+16, src[3]+16, stride, stride, stride, stride, stride, h);\ -} -DIRAC_MC(put) -DIRAC_MC(avg) -#endif - -static void wmv2_mspel8_v_lowpass(uint8_t *dst, uint8_t *src, int dstStride, int srcStride, int w){ - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - int i; - - for(i=0; i>4]; - dst[1*dstStride]= cm[(9*(src1 + src2) - (src0 + src3) + 8)>>4]; - dst[2*dstStride]= cm[(9*(src2 + src3) - (src1 + src4) + 8)>>4]; - dst[3*dstStride]= cm[(9*(src3 + src4) - (src2 + src5) + 8)>>4]; - dst[4*dstStride]= cm[(9*(src4 + src5) - (src3 + src6) + 8)>>4]; - dst[5*dstStride]= cm[(9*(src5 + src6) - (src4 + src7) + 8)>>4]; - dst[6*dstStride]= cm[(9*(src6 + src7) - (src5 + src8) + 8)>>4]; - dst[7*dstStride]= cm[(9*(src7 + src8) - (src6 + src9) + 8)>>4]; - src++; - dst++; - } -} - -static void put_mspel8_mc10_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - uint8_t half[64]; - wmv2_mspel8_h_lowpass(half, src, 8, stride, 8); - put_pixels8_l2_8(dst, src, half, stride, stride, 8, 8); -} - -static void put_mspel8_mc20_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - wmv2_mspel8_h_lowpass(dst, src, stride, stride, 8); -} - -static void put_mspel8_mc30_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - uint8_t half[64]; - wmv2_mspel8_h_lowpass(half, src, 8, stride, 8); - put_pixels8_l2_8(dst, src+1, half, stride, stride, 8, 8); -} - -static void put_mspel8_mc02_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - wmv2_mspel8_v_lowpass(dst, src, stride, stride, 8); -} - -static void put_mspel8_mc12_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - uint8_t halfH[88]; - uint8_t halfV[64]; - uint8_t halfHV[64]; - wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); - wmv2_mspel8_v_lowpass(halfV, src, 8, stride, 8); - wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8); - put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8); -} -static void put_mspel8_mc32_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - uint8_t halfH[88]; - uint8_t halfV[64]; - uint8_t halfHV[64]; - wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); - wmv2_mspel8_v_lowpass(halfV, src+1, 8, stride, 8); - wmv2_mspel8_v_lowpass(halfHV, halfH+8, 8, 8, 8); - put_pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8); -} -static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) -{ - uint8_t halfH[88]; - wmv2_mspel8_h_lowpass(halfH, src-stride, 8, stride, 11); - wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8); -} - -static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){ - if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - int x; - const int strength= ff_h263_loop_filter_strength[qscale]; - - for(x=0; x<8; x++){ - int d1, d2, ad1; - int p0= src[x-2*stride]; - int p1= src[x-1*stride]; - int p2= src[x+0*stride]; - int p3= src[x+1*stride]; - int d = (p0 - p3 + 4*(p2 - p1)) / 8; - - if (d<-2*strength) d1= 0; - else if(d<- strength) d1=-2*strength - d; - else if(d< strength) d1= d; - else if(d< 2*strength) d1= 2*strength - d; - else d1= 0; - - p1 += d1; - p2 -= d1; - if(p1&256) p1= ~(p1>>31); - if(p2&256) p2= ~(p2>>31); - - src[x-1*stride] = p1; - src[x+0*stride] = p2; - - ad1= FFABS(d1)>>1; - - d2= av_clip((p0-p3)/4, -ad1, ad1); - - src[x-2*stride] = p0 - d2; - src[x+ stride] = p3 + d2; - } - } -} - -static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){ - if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - int y; - const int strength= ff_h263_loop_filter_strength[qscale]; - - for(y=0; y<8; y++){ - int d1, d2, ad1; - int p0= src[y*stride-2]; - int p1= src[y*stride-1]; - int p2= src[y*stride+0]; - int p3= src[y*stride+1]; - int d = (p0 - p3 + 4*(p2 - p1)) / 8; - - if (d<-2*strength) d1= 0; - else if(d<- strength) d1=-2*strength - d; - else if(d< strength) d1= d; - else if(d< 2*strength) d1= 2*strength - d; - else d1= 0; - - p1 += d1; - p2 -= d1; - if(p1&256) p1= ~(p1>>31); - if(p2&256) p2= ~(p2>>31); - - src[y*stride-1] = p1; - src[y*stride+0] = p2; - - ad1= FFABS(d1)>>1; - - d2= av_clip((p0-p3)/4, -ad1, ad1); - - src[y*stride-2] = p0 - d2; - src[y*stride+1] = p3 + d2; - } - } -} - -static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h) -{ - int s, i; - - s = 0; - for(i=0;iavctx->nsse_weight; - else return score1 + FFABS(score2)*8; -} - -static int nsse8_c(void *v, uint8_t *s1, uint8_t *s2, int stride, int h){ - MpegEncContext *c = v; - int score1=0; - int score2=0; - int x,y; - - for(y=0; yavctx->nsse_weight; - else return score1 + FFABS(score2)*8; -} - -static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ - int i; - unsigned int sum=0; - - for(i=0; i<8*8; i++){ - int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT)); - int w= weight[i]; - b>>= RECON_SHIFT; - av_assert2(-512>4; - } - return sum>>2; -} - -static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){ - int i; - - for(i=0; i<8*8; i++){ - rem[i] += (basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT); - } -} - -static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){ - return 0; -} - -void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type){ - int i; - - memset(cmp, 0, sizeof(void*)*6); - - for(i=0; i<6; i++){ - switch(type&0xFF){ - case FF_CMP_SAD: - cmp[i]= c->sad[i]; - break; - case FF_CMP_SATD: - cmp[i]= c->hadamard8_diff[i]; - break; - case FF_CMP_SSE: - cmp[i]= c->sse[i]; - break; - case FF_CMP_DCT: - cmp[i]= c->dct_sad[i]; - break; - case FF_CMP_DCT264: - cmp[i]= c->dct264_sad[i]; - break; - case FF_CMP_DCTMAX: - cmp[i]= c->dct_max[i]; - break; - case FF_CMP_PSNR: - cmp[i]= c->quant_psnr[i]; - break; - case FF_CMP_BIT: - cmp[i]= c->bit[i]; - break; - case FF_CMP_RD: - cmp[i]= c->rd[i]; - break; - case FF_CMP_VSAD: - cmp[i]= c->vsad[i]; - break; - case FF_CMP_VSSE: - cmp[i]= c->vsse[i]; - break; - case FF_CMP_ZERO: - cmp[i]= zero_cmp; - break; - case FF_CMP_NSSE: - cmp[i]= c->nsse[i]; - break; -#if CONFIG_DWT - case FF_CMP_W53: - cmp[i]= c->w53[i]; - break; - case FF_CMP_W97: - cmp[i]= c->w97[i]; - break; -#endif - default: - av_log(NULL, AV_LOG_ERROR,"internal error in cmp function selection\n"); - } - } -} - -static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){ - long i; - for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){ - long a = *(long*)(src+i); - long b = *(long*)(dst+i); - *(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80); - } - for(; idsp.diff_pixels(temp, src1, src2, stride); - s->dsp.fdct(temp); - return s->dsp.sum_abs_dctelem(temp); -} - -#if CONFIG_GPL -#define DCT8_1D {\ - const int s07 = SRC(0) + SRC(7);\ - const int s16 = SRC(1) + SRC(6);\ - const int s25 = SRC(2) + SRC(5);\ - const int s34 = SRC(3) + SRC(4);\ - const int a0 = s07 + s34;\ - const int a1 = s16 + s25;\ - const int a2 = s07 - s34;\ - const int a3 = s16 - s25;\ - const int d07 = SRC(0) - SRC(7);\ - const int d16 = SRC(1) - SRC(6);\ - const int d25 = SRC(2) - SRC(5);\ - const int d34 = SRC(3) - SRC(4);\ - const int a4 = d16 + d25 + (d07 + (d07>>1));\ - const int a5 = d07 - d34 - (d25 + (d25>>1));\ - const int a6 = d07 + d34 - (d16 + (d16>>1));\ - const int a7 = d16 - d25 + (d34 + (d34>>1));\ - DST(0, a0 + a1 ) ;\ - DST(1, a4 + (a7>>2)) ;\ - DST(2, a2 + (a3>>1)) ;\ - DST(3, a5 + (a6>>2)) ;\ - DST(4, a0 - a1 ) ;\ - DST(5, a6 - (a5>>2)) ;\ - DST(6, (a2>>1) - a3 ) ;\ - DST(7, (a4>>2) - a7 ) ;\ -} - -static int dct264_sad8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ - MpegEncContext * const s= (MpegEncContext *)c; - int16_t dct[8][8]; - int i; - int sum=0; - - s->dsp.diff_pixels(dct[0], src1, src2, stride); - -#define SRC(x) dct[i][x] -#define DST(x,v) dct[i][x]= v - for( i = 0; i < 8; i++ ) - DCT8_1D -#undef SRC -#undef DST - -#define SRC(x) dct[x][i] -#define DST(x,v) sum += FFABS(v) - for( i = 0; i < 8; i++ ) - DCT8_1D -#undef SRC -#undef DST - return sum; -} -#endif - -static int dct_max8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ - MpegEncContext * const s= (MpegEncContext *)c; - LOCAL_ALIGNED_16(int16_t, temp, [64]); - int sum=0, i; - - av_assert2(h==8); - - s->dsp.diff_pixels(temp, src1, src2, stride); - s->dsp.fdct(temp); - - for(i=0; i<64; i++) - sum= FFMAX(sum, FFABS(temp[i])); - - return sum; -} - -static int quant_psnr8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ - MpegEncContext * const s= (MpegEncContext *)c; - LOCAL_ALIGNED_16(int16_t, temp, [64*2]); - int16_t * const bak = temp+64; - int sum=0, i; - - av_assert2(h==8); - s->mb_intra=0; - - s->dsp.diff_pixels(temp, src1, src2, stride); - - memcpy(bak, temp, 64*sizeof(int16_t)); - - s->block_last_index[0/*FIXME*/]= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); - s->dct_unquantize_inter(s, temp, 0, s->qscale); - ff_simple_idct_8(temp); //FIXME - - for(i=0; i<64; i++) - sum+= (temp[i]-bak[i])*(temp[i]-bak[i]); - - return sum; -} - -static int rd8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ - MpegEncContext * const s= (MpegEncContext *)c; - const uint8_t *scantable= s->intra_scantable.permutated; - LOCAL_ALIGNED_16(int16_t, temp, [64]); - LOCAL_ALIGNED_16(uint8_t, lsrc1, [64]); - LOCAL_ALIGNED_16(uint8_t, lsrc2, [64]); - int i, last, run, bits, level, distortion, start_i; - const int esc_length= s->ac_esc_length; - uint8_t * length; - uint8_t * last_length; - - av_assert2(h==8); - - copy_block8(lsrc1, src1, 8, stride, 8); - copy_block8(lsrc2, src2, 8, stride, 8); - - s->dsp.diff_pixels(temp, lsrc1, lsrc2, 8); - - s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); - - bits=0; - - if (s->mb_intra) { - start_i = 1; - length = s->intra_ac_vlc_length; - last_length= s->intra_ac_vlc_last_length; - bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma - } else { - start_i = 0; - length = s->inter_ac_vlc_length; - last_length= s->inter_ac_vlc_last_length; - } - - if(last>=start_i){ - run=0; - for(i=start_i; i=0){ - if(s->mb_intra) - s->dct_unquantize_intra(s, temp, 0, s->qscale); - else - s->dct_unquantize_inter(s, temp, 0, s->qscale); - } - - s->dsp.idct_add(lsrc2, 8, temp); - - distortion= s->dsp.sse[1](NULL, lsrc2, lsrc1, 8, 8); - - return distortion + ((bits*s->qscale*s->qscale*109 + 64)>>7); -} - -static int bit8x8_c(/*MpegEncContext*/ void *c, uint8_t *src1, uint8_t *src2, int stride, int h){ - MpegEncContext * const s= (MpegEncContext *)c; - const uint8_t *scantable= s->intra_scantable.permutated; - LOCAL_ALIGNED_16(int16_t, temp, [64]); - int i, last, run, bits, level, start_i; - const int esc_length= s->ac_esc_length; - uint8_t * length; - uint8_t * last_length; - - av_assert2(h==8); - - s->dsp.diff_pixels(temp, src1, src2, stride); - - s->block_last_index[0/*FIXME*/]= last= s->fast_dct_quantize(s, temp, 0/*FIXME*/, s->qscale, &i); - - bits=0; - - if (s->mb_intra) { - start_i = 1; - length = s->intra_ac_vlc_length; - last_length= s->intra_ac_vlc_last_length; - bits+= s->luma_dc_vlc_length[temp[0] + 256]; //FIXME chroma - } else { - start_i = 0; - length = s->inter_ac_vlc_length; - last_length= s->inter_ac_vlc_last_length; - } - - if(last>=start_i){ - run=0; - for(i=start_i; i mini) return mini; - else if((a^(1U<<31)) > maxisign) return maxi; - else return a; -} - -static void vector_clipf_c_opposite_sign(float *dst, const float *src, float *min, float *max, int len){ - int i; - uint32_t mini = *(uint32_t*)min; - uint32_t maxi = *(uint32_t*)max; - uint32_t maxisign = maxi ^ (1U<<31); - uint32_t *dsti = (uint32_t*)dst; - const uint32_t *srci = (const uint32_t*)src; - for(i=0; i 0) { - vector_clipf_c_opposite_sign(dst, src, &min, &max, len); - } else { - for(i=0; i < len; i+=8) { - dst[i ] = av_clipf(src[i ], min, max); - dst[i + 1] = av_clipf(src[i + 1], min, max); - dst[i + 2] = av_clipf(src[i + 2], min, max); - dst[i + 3] = av_clipf(src[i + 3], min, max); - dst[i + 4] = av_clipf(src[i + 4], min, max); - dst[i + 5] = av_clipf(src[i + 5], min, max); - dst[i + 6] = av_clipf(src[i + 6], min, max); - dst[i + 7] = av_clipf(src[i + 7], min, max); - } - } -} - -static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order) -{ - int res = 0; - - while (order--) - res += *v1++ * *v2++; - - return res; -} - -static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul) -{ - int res = 0; - while (order--) { - res += *v1 * *v2++; - *v1++ += mul * *v3++; - } - return res; -} - -static void apply_window_int16_c(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len) -{ - int i; - int len2 = len >> 1; - - for (i = 0; i < len2; i++) { - int16_t w = window[i]; - output[i] = (MUL16(input[i], w) + (1 << 14)) >> 15; - output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15; - } -} - -static void vector_clip_int32_c(int32_t *dst, const int32_t *src, int32_t min, - int32_t max, unsigned int len) -{ - do { - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - *dst++ = av_clip(*src++, min, max); - len -= 8; - } while (len > 0); -} - -static void jref_idct_put(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct (block); - put_pixels_clamped_c(block, dest, line_size); -} -static void jref_idct_add(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct (block); - add_pixels_clamped_c(block, dest, line_size); -} - -static void ff_jref_idct4_put(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct4 (block); - put_pixels_clamped4_c(block, dest, line_size); -} -static void ff_jref_idct4_add(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct4 (block); - add_pixels_clamped4_c(block, dest, line_size); -} - -static void ff_jref_idct2_put(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct2 (block); - put_pixels_clamped2_c(block, dest, line_size); -} -static void ff_jref_idct2_add(uint8_t *dest, int line_size, int16_t *block) -{ - ff_j_rev_dct2 (block); - add_pixels_clamped2_c(block, dest, line_size); -} - -static void ff_jref_idct1_put(uint8_t *dest, int line_size, int16_t *block) -{ - dest[0] = av_clip_uint8((block[0] + 4)>>3); -} -static void ff_jref_idct1_add(uint8_t *dest, int line_size, int16_t *block) -{ - dest[0] = av_clip_uint8(dest[0] + ((block[0] + 4)>>3)); -} - -/* init static data */ -av_cold void ff_dsputil_static_init(void) -{ - int i; - - for(i=0;i<512;i++) { - ff_squareTbl[i] = (i - 256) * (i - 256); - } - - for(i=0; i<64; i++) ff_inv_zigzag_direct16[ff_zigzag_direct[i]]= i+1; -} - -int ff_check_alignment(void){ - static int did_fail=0; - LOCAL_ALIGNED_16(int, aligned, [4]); - - if((intptr_t)aligned & 15){ - if(!did_fail){ -#if HAVE_MMX || HAVE_ALTIVEC - av_log(NULL, AV_LOG_ERROR, - "Compiler did not align stack variables. Libavcodec has been miscompiled\n" - "and may be very slow or crash. This is not a bug in libavcodec,\n" - "but in the compiler. You may try recompiling using gcc >= 4.2.\n" - "Do not report crashes to FFmpeg developers.\n"); -#endif - did_fail=1; - } - return -1; - } - return 0; -} - -av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx) -{ - ff_check_alignment(); - -#if CONFIG_ENCODERS - if (avctx->bits_per_raw_sample == 10) { - c->fdct = ff_jpeg_fdct_islow_10; - c->fdct248 = ff_fdct248_islow_10; - } else { - if(avctx->dct_algo==FF_DCT_FASTINT) { - c->fdct = ff_fdct_ifast; - c->fdct248 = ff_fdct_ifast248; - } - else if(avctx->dct_algo==FF_DCT_FAAN) { - c->fdct = ff_faandct; - c->fdct248 = ff_faandct248; - } - else { - c->fdct = ff_jpeg_fdct_islow_8; //slow/accurate/default - c->fdct248 = ff_fdct248_islow_8; - } - } -#endif //CONFIG_ENCODERS - - if(avctx->lowres==1){ - c->idct_put= ff_jref_idct4_put; - c->idct_add= ff_jref_idct4_add; - c->idct = ff_j_rev_dct4; - c->idct_permutation_type= FF_NO_IDCT_PERM; - }else if(avctx->lowres==2){ - c->idct_put= ff_jref_idct2_put; - c->idct_add= ff_jref_idct2_add; - c->idct = ff_j_rev_dct2; - c->idct_permutation_type= FF_NO_IDCT_PERM; - }else if(avctx->lowres==3){ - c->idct_put= ff_jref_idct1_put; - c->idct_add= ff_jref_idct1_add; - c->idct = ff_j_rev_dct1; - c->idct_permutation_type= FF_NO_IDCT_PERM; - }else{ - if (avctx->bits_per_raw_sample == 10) { - c->idct_put = ff_simple_idct_put_10; - c->idct_add = ff_simple_idct_add_10; - c->idct = ff_simple_idct_10; - c->idct_permutation_type = FF_NO_IDCT_PERM; - } else if (avctx->bits_per_raw_sample == 12) { - c->idct_put = ff_simple_idct_put_12; - c->idct_add = ff_simple_idct_add_12; - c->idct = ff_simple_idct_12; - c->idct_permutation_type = FF_NO_IDCT_PERM; - } else { - if(avctx->idct_algo==FF_IDCT_INT){ - c->idct_put= jref_idct_put; - c->idct_add= jref_idct_add; - c->idct = ff_j_rev_dct; - c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM; - }else if(avctx->idct_algo==FF_IDCT_FAAN){ - c->idct_put= ff_faanidct_put; - c->idct_add= ff_faanidct_add; - c->idct = ff_faanidct; - c->idct_permutation_type= FF_NO_IDCT_PERM; - }else{ //accurate/default - c->idct_put = ff_simple_idct_put_8; - c->idct_add = ff_simple_idct_add_8; - c->idct = ff_simple_idct_8; - c->idct_permutation_type= FF_NO_IDCT_PERM; - } - } - } - - c->diff_pixels = diff_pixels_c; - c->put_pixels_clamped = put_pixels_clamped_c; - c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; - c->add_pixels_clamped = add_pixels_clamped_c; - c->sum_abs_dctelem = sum_abs_dctelem_c; - c->gmc1 = gmc1_c; - c->gmc = ff_gmc_c; - c->pix_sum = pix_sum_c; - c->pix_norm1 = pix_norm1_c; - - c->fill_block_tab[0] = fill_block16_c; - c->fill_block_tab[1] = fill_block8_c; - - /* TODO [0] 16 [1] 8 */ - c->pix_abs[0][0] = pix_abs16_c; - c->pix_abs[0][1] = pix_abs16_x2_c; - c->pix_abs[0][2] = pix_abs16_y2_c; - c->pix_abs[0][3] = pix_abs16_xy2_c; - c->pix_abs[1][0] = pix_abs8_c; - c->pix_abs[1][1] = pix_abs8_x2_c; - c->pix_abs[1][2] = pix_abs8_y2_c; - c->pix_abs[1][3] = pix_abs8_xy2_c; - - c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c; - c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c; - c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c; - c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c; - c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c; - c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c; - c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c; - c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c; - c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c; - - c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c; - c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c; - c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c; - c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c; - c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c; - c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c; - c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c; - c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c; - c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c; - -#define dspfunc(PFX, IDX, NUM) \ - c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \ - c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \ - c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \ - c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \ - c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \ - c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \ - c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \ - c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \ - c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \ - c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \ - c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \ - c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \ - c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \ - c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \ - c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \ - c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c - - dspfunc(put_qpel, 0, 16); - dspfunc(put_no_rnd_qpel, 0, 16); - - dspfunc(avg_qpel, 0, 16); - /* dspfunc(avg_no_rnd_qpel, 0, 16); */ - - dspfunc(put_qpel, 1, 8); - dspfunc(put_no_rnd_qpel, 1, 8); - - dspfunc(avg_qpel, 1, 8); - /* dspfunc(avg_no_rnd_qpel, 1, 8); */ - -#undef dspfunc - - c->put_mspel_pixels_tab[0]= ff_put_pixels8x8_c; - c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c; - c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c; - c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c; - c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c; - c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c; - c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c; - c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c; - -#define SET_CMP_FUNC(name) \ - c->name[0]= name ## 16_c;\ - c->name[1]= name ## 8x8_c; - - SET_CMP_FUNC(hadamard8_diff) - c->hadamard8_diff[4]= hadamard8_intra16_c; - c->hadamard8_diff[5]= hadamard8_intra8x8_c; - SET_CMP_FUNC(dct_sad) - SET_CMP_FUNC(dct_max) -#if CONFIG_GPL - SET_CMP_FUNC(dct264_sad) -#endif - c->sad[0]= pix_abs16_c; - c->sad[1]= pix_abs8_c; - c->sse[0]= sse16_c; - c->sse[1]= sse8_c; - c->sse[2]= sse4_c; - SET_CMP_FUNC(quant_psnr) - SET_CMP_FUNC(rd) - SET_CMP_FUNC(bit) - c->vsad[0]= vsad16_c; - c->vsad[4]= vsad_intra16_c; - c->vsad[5]= vsad_intra8_c; - c->vsse[0]= vsse16_c; - c->vsse[4]= vsse_intra16_c; - c->vsse[5]= vsse_intra8_c; - c->nsse[0]= nsse16_c; - c->nsse[1]= nsse8_c; -#if CONFIG_SNOW_DECODER || CONFIG_SNOW_ENCODER - ff_dsputil_init_dwt(c); -#endif - - c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c; - - c->add_bytes= add_bytes_c; - c->diff_bytes= diff_bytes_c; - c->add_hfyu_median_prediction= add_hfyu_median_prediction_c; - c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c; - c->add_hfyu_left_prediction = add_hfyu_left_prediction_c; - c->add_hfyu_left_prediction_bgr32 = add_hfyu_left_prediction_bgr32_c; - c->bswap_buf= bswap_buf; - c->bswap16_buf = bswap16_buf; - - if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - c->h263_h_loop_filter= h263_h_loop_filter_c; - c->h263_v_loop_filter= h263_v_loop_filter_c; - } - - c->try_8x8basis= try_8x8basis_c; - c->add_8x8basis= add_8x8basis_c; - - c->vector_clipf = vector_clipf_c; - c->scalarproduct_int16 = scalarproduct_int16_c; - c->scalarproduct_and_madd_int16 = scalarproduct_and_madd_int16_c; - c->apply_window_int16 = apply_window_int16_c; - c->vector_clip_int32 = vector_clip_int32_c; - - c->shrink[0]= av_image_copy_plane; - c->shrink[1]= ff_shrink22; - c->shrink[2]= ff_shrink44; - c->shrink[3]= ff_shrink88; - - c->add_pixels8 = add_pixels8_c; - -#undef FUNC -#undef FUNCC -#define FUNC(f, depth) f ## _ ## depth -#define FUNCC(f, depth) f ## _ ## depth ## _c - - c->draw_edges = FUNCC(draw_edges, 8); - c->clear_block = FUNCC(clear_block, 8); - c->clear_blocks = FUNCC(clear_blocks, 8); - -#define BIT_DEPTH_FUNCS(depth) \ - c->get_pixels = FUNCC(get_pixels, depth); - - switch (avctx->bits_per_raw_sample) { - case 9: - case 10: - case 12: - case 14: - BIT_DEPTH_FUNCS(16); - break; - default: - if(avctx->bits_per_raw_sample<=8 || avctx->codec_type != AVMEDIA_TYPE_VIDEO) { - BIT_DEPTH_FUNCS(8); - } - break; - } - - - if (ARCH_ALPHA) - ff_dsputil_init_alpha(c, avctx); - if (ARCH_ARM) - ff_dsputil_init_arm(c, avctx); - if (ARCH_BFIN) - ff_dsputil_init_bfin(c, avctx); - if (ARCH_PPC) - ff_dsputil_init_ppc(c, avctx); - if (ARCH_SH4) - ff_dsputil_init_sh4(c, avctx); - if (HAVE_VIS) - ff_dsputil_init_vis(c, avctx); - if (ARCH_X86) - ff_dsputil_init_x86(c, avctx); - - ff_init_scantable_permutation(c->idct_permutation, - c->idct_permutation_type); -} - -av_cold void dsputil_init(DSPContext* c, AVCodecContext *avctx) -{ - ff_dsputil_init(c, avctx); -} - -av_cold void avpriv_dsputil_init(DSPContext *c, AVCodecContext *avctx) -{ - ff_dsputil_init(c, avctx); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.h deleted file mode 100644 index b9f8bdec0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil.h +++ /dev/null @@ -1,332 +0,0 @@ -/* - * DSP utils - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * DSP utils. - * note, many functions in here may use MMX which trashes the FPU state, it is - * absolutely necessary to call emms_c() between dsp & float/double code - */ - -#ifndef AVCODEC_DSPUTIL_H -#define AVCODEC_DSPUTIL_H - -#include "libavutil/intreadwrite.h" -#include "avcodec.h" -#include "rnd_avg.h" - -/* encoding scans */ -extern const uint8_t ff_alternate_horizontal_scan[64]; -extern const uint8_t ff_alternate_vertical_scan[64]; -extern const uint8_t ff_zigzag_direct[64]; -extern const uint8_t ff_zigzag248_direct[64]; - -/* pixel operations */ -#define MAX_NEG_CROP 1024 - -/* temporary */ -extern uint32_t ff_squareTbl[512]; -extern const uint8_t ff_cropTbl[256 + 2 * MAX_NEG_CROP]; - -void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); - -/* RV40 functions */ -void ff_put_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_avg_rv40_qpel16_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_put_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); -void ff_avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride); - -void ff_gmc_c(uint8_t *dst, uint8_t *src, int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); - -/* minimum alignment rules ;) -If you notice errors in the align stuff, need more alignment for some ASM code -for some CPU or need to use a function with less aligned data then send a mail -to the ffmpeg-devel mailing list, ... - -!warning These alignments might not match reality, (missing attribute((align)) -stuff somewhere possible). -I (Michael) did not check them, these are just the alignments which I think -could be reached easily ... - -!future video codecs might need functions with less strict alignment -*/ - -/* add and put pixel (decoding) */ -// blocksizes for op_pixels_func are 8x4,8x8 16x8 16x16 -//h for op_pixels_func is limited to {width/2, width} but never larger than 16 and never smaller than 4 -typedef void (*tpel_mc_func)(uint8_t *block/*align width (8 or 16)*/, const uint8_t *pixels/*align 1*/, int line_size, int w, int h); -typedef void (*qpel_mc_func)(uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, ptrdiff_t stride); - -typedef void (*op_fill_func)(uint8_t *block/*align width (8 or 16)*/, uint8_t value, int line_size, int h); - -#define DEF_OLD_QPEL(name)\ -void ff_put_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, ptrdiff_t stride);\ -void ff_put_no_rnd_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, ptrdiff_t stride);\ -void ff_avg_ ## name (uint8_t *dst/*align width (8 or 16)*/, uint8_t *src/*align 1*/, ptrdiff_t stride); - -DEF_OLD_QPEL(qpel16_mc11_old_c) -DEF_OLD_QPEL(qpel16_mc31_old_c) -DEF_OLD_QPEL(qpel16_mc12_old_c) -DEF_OLD_QPEL(qpel16_mc32_old_c) -DEF_OLD_QPEL(qpel16_mc13_old_c) -DEF_OLD_QPEL(qpel16_mc33_old_c) -DEF_OLD_QPEL(qpel8_mc11_old_c) -DEF_OLD_QPEL(qpel8_mc31_old_c) -DEF_OLD_QPEL(qpel8_mc12_old_c) -DEF_OLD_QPEL(qpel8_mc32_old_c) -DEF_OLD_QPEL(qpel8_mc13_old_c) -DEF_OLD_QPEL(qpel8_mc33_old_c) - -/* motion estimation */ -// h is limited to {width/2, width, 2*width} but never larger than 16 and never smaller than 2 -// although currently h<4 is not used as functions with width <8 are neither used nor implemented -typedef int (*me_cmp_func)(void /*MpegEncContext*/ *s, uint8_t *blk1/*align width (8 or 16)*/, uint8_t *blk2/*align 1*/, int line_size, int h)/* __attribute__ ((const))*/; - -/** - * Scantable. - */ -typedef struct ScanTable{ - const uint8_t *scantable; - uint8_t permutated[64]; - uint8_t raster_end[64]; -} ScanTable; - -void ff_init_scantable(uint8_t *, ScanTable *st, const uint8_t *src_scantable); -void ff_init_scantable_permutation(uint8_t *idct_permutation, - int idct_permutation_type); - -/** - * DSPContext. - */ -typedef struct DSPContext { - /* pixel ops : interface with DCT */ - void (*get_pixels)(int16_t *block/*align 16*/, const uint8_t *pixels/*align 8*/, int line_size); - void (*diff_pixels)(int16_t *block/*align 16*/, const uint8_t *s1/*align 8*/, const uint8_t *s2/*align 8*/, int stride); - void (*put_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); - void (*put_signed_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); - void (*add_pixels_clamped)(const int16_t *block/*align 16*/, uint8_t *pixels/*align 8*/, int line_size); - void (*add_pixels8)(uint8_t *pixels, int16_t *block, int line_size); - int (*sum_abs_dctelem)(int16_t *block/*align 16*/); - /** - * translational global motion compensation. - */ - void (*gmc1)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x16, int y16, int rounder); - /** - * global motion compensation. - */ - void (*gmc )(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, int shift, int r, int width, int height); - void (*clear_block)(int16_t *block/*align 16*/); - void (*clear_blocks)(int16_t *blocks/*align 16*/); - int (*pix_sum)(uint8_t * pix, int line_size); - int (*pix_norm1)(uint8_t * pix, int line_size); -// 16x16 8x8 4x4 2x2 16x8 8x4 4x2 8x16 4x8 2x4 - - me_cmp_func sad[6]; /* identical to pix_absAxA except additional void * */ - me_cmp_func sse[6]; - me_cmp_func hadamard8_diff[6]; - me_cmp_func dct_sad[6]; - me_cmp_func quant_psnr[6]; - me_cmp_func bit[6]; - me_cmp_func rd[6]; - me_cmp_func vsad[6]; - me_cmp_func vsse[6]; - me_cmp_func nsse[6]; - me_cmp_func w53[6]; - me_cmp_func w97[6]; - me_cmp_func dct_max[6]; - me_cmp_func dct264_sad[6]; - - me_cmp_func me_pre_cmp[6]; - me_cmp_func me_cmp[6]; - me_cmp_func me_sub_cmp[6]; - me_cmp_func mb_cmp[6]; - me_cmp_func ildct_cmp[6]; //only width 16 used - me_cmp_func frame_skip_cmp[6]; //only width 8 used - - int (*ssd_int8_vs_int16)(const int8_t *pix1, const int16_t *pix2, - int size); - - /** - * Thirdpel motion compensation with rounding (a+b+1)>>1. - * this is an array[12] of motion compensation functions for the 9 thirdpe - * positions
- * *pixels_tab[ xthirdpel + 4*ythirdpel ] - * @param block destination where the result is stored - * @param pixels source - * @param line_size number of bytes in a horizontal line of block - * @param h height - */ - tpel_mc_func put_tpel_pixels_tab[11]; //FIXME individual func ptr per width? - tpel_mc_func avg_tpel_pixels_tab[11]; //FIXME individual func ptr per width? - - qpel_mc_func put_qpel_pixels_tab[2][16]; - qpel_mc_func avg_qpel_pixels_tab[2][16]; - qpel_mc_func put_no_rnd_qpel_pixels_tab[2][16]; - qpel_mc_func put_mspel_pixels_tab[8]; - - me_cmp_func pix_abs[2][4]; - - /* huffyuv specific */ - void (*add_bytes)(uint8_t *dst/*align 16*/, uint8_t *src/*align 16*/, int w); - void (*diff_bytes)(uint8_t *dst/*align 16*/, const uint8_t *src1/*align 16*/, const uint8_t *src2/*align 1*/,int w); - /** - * subtract huffyuv's variant of median prediction - * note, this might read from src1[-1], src2[-1] - */ - void (*sub_hfyu_median_prediction)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int w, int *left, int *left_top); - void (*add_hfyu_median_prediction)(uint8_t *dst, const uint8_t *top, const uint8_t *diff, int w, int *left, int *left_top); - int (*add_hfyu_left_prediction)(uint8_t *dst, const uint8_t *src, int w, int left); - void (*add_hfyu_left_prediction_bgr32)(uint8_t *dst, const uint8_t *src, int w, int *red, int *green, int *blue, int *alpha); - /* this might write to dst[w] */ - void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w); - void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len); - - void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale); - void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale); - - /* assume len is a multiple of 8, and arrays are 16-byte aligned */ - void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */); - - /* (I)DCT */ - void (*fdct)(int16_t *block/* align 16*/); - void (*fdct248)(int16_t *block/* align 16*/); - - /* IDCT really*/ - void (*idct)(int16_t *block/* align 16*/); - - /** - * block -> idct -> clip to unsigned 8 bit -> dest. - * (-1392, 0, 0, ...) -> idct -> (-174, -174, ...) -> put -> (0, 0, ...) - * @param line_size size in bytes of a horizontal line of dest - */ - void (*idct_put)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/); - - /** - * block -> idct -> add dest -> clip to unsigned 8 bit -> dest. - * @param line_size size in bytes of a horizontal line of dest - */ - void (*idct_add)(uint8_t *dest/*align 8*/, int line_size, int16_t *block/*align 16*/); - - /** - * idct input permutation. - * several optimized IDCTs need a permutated input (relative to the normal order of the reference - * IDCT) - * this permutation must be performed before the idct_put/add, note, normally this can be merged - * with the zigzag/alternate scan
- * an example to avoid confusion: - * - (->decode coeffs -> zigzag reorder -> dequant -> reference idct ->...) - * - (x -> reference dct -> reference idct -> x) - * - (x -> reference dct -> simple_mmx_perm = idct_permutation -> simple_idct_mmx -> x) - * - (->decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant -> simple_idct_mmx ->...) - */ - uint8_t idct_permutation[64]; - int idct_permutation_type; -#define FF_NO_IDCT_PERM 1 -#define FF_LIBMPEG2_IDCT_PERM 2 -#define FF_SIMPLE_IDCT_PERM 3 -#define FF_TRANSPOSE_IDCT_PERM 4 -#define FF_PARTTRANS_IDCT_PERM 5 -#define FF_SSE2_IDCT_PERM 6 - - int (*try_8x8basis)(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale); - void (*add_8x8basis)(int16_t rem[64], int16_t basis[64], int scale); -#define BASIS_SHIFT 16 -#define RECON_SHIFT 6 - - void (*draw_edges)(uint8_t *buf, int wrap, int width, int height, int w, int h, int sides); -#define EDGE_WIDTH 16 -#define EDGE_TOP 1 -#define EDGE_BOTTOM 2 - - void (*shrink[4])(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); - - /** - * Calculate scalar product of two vectors. - * @param len length of vectors, should be multiple of 16 - */ - int32_t (*scalarproduct_int16)(const int16_t *v1, const int16_t *v2/*align 16*/, int len); - /* ape functions */ - /** - * Calculate scalar product of v1 and v2, - * and v1[i] += v3[i] * mul - * @param len length of vectors, should be multiple of 16 - */ - int32_t (*scalarproduct_and_madd_int16)(int16_t *v1/*align 16*/, const int16_t *v2, const int16_t *v3, int len, int mul); - - /** - * Apply symmetric window in 16-bit fixed-point. - * @param output destination array - * constraints: 16-byte aligned - * @param input source array - * constraints: 16-byte aligned - * @param window window array - * constraints: 16-byte aligned, at least len/2 elements - * @param len full window length - * constraints: multiple of ? greater than zero - */ - void (*apply_window_int16)(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); - - /** - * Clip each element in an array of int32_t to a given minimum and maximum value. - * @param dst destination array - * constraints: 16-byte aligned - * @param src source array - * constraints: 16-byte aligned - * @param min minimum value - * constraints: must be in the range [-(1 << 24), 1 << 24] - * @param max maximum value - * constraints: must be in the range [-(1 << 24), 1 << 24] - * @param len number of elements in the array - * constraints: multiple of 32 greater than zero - */ - void (*vector_clip_int32)(int32_t *dst, const int32_t *src, int32_t min, - int32_t max, unsigned int len); - - op_fill_func fill_block_tab[2]; -} DSPContext; - -void ff_dsputil_static_init(void); -void ff_dsputil_init(DSPContext* p, AVCodecContext *avctx); -void avpriv_dsputil_init(DSPContext* p, AVCodecContext *avctx); -attribute_deprecated void dsputil_init(DSPContext* c, AVCodecContext *avctx); - -int ff_check_alignment(void); - -void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type); - -void ff_dsputil_init_alpha(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_arm(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_bfin(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_ppc(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_vis(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_x86(DSPContext* c, AVCodecContext *avctx); - -void ff_dsputil_init_dwt(DSPContext *c); - -#endif /* AVCODEC_DSPUTIL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil_template.c deleted file mode 100644 index 96be7a6a6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dsputil_template.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * DSP utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * DSP utils - */ - -#include "bit_depth_template.c" - -#if BIT_DEPTH == 8 -/* draw the edges of width 'w' of an image of size width, height */ -//FIXME check that this is ok for mpeg4 interlaced -static void FUNCC(draw_edges)(uint8_t *p_buf, int p_wrap, int width, int height, int w, int h, int sides) -{ - pixel *buf = (pixel*)p_buf; - int wrap = p_wrap / sizeof(pixel); - pixel *ptr, *last_line; - int i; - - /* left and right */ - ptr = buf; - for(i=0;i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - l1= (c&0x03030303UL)\ - + (d&0x03030303UL);\ - h1= ((c&0xFCFCFCFCUL)>>2)\ - + ((d&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - a= AV_RN32(&src1[i*src_stride1+4]);\ - b= AV_RN32(&src2[i*src_stride2+4]);\ - c= AV_RN32(&src3[i*src_stride3+4]);\ - d= AV_RN32(&src4[i*src_stride4+4]);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - l1= (c&0x03030303UL)\ - + (d&0x03030303UL);\ - h1= ((c&0xFCFCFCFCUL)>>2)\ - + ((d&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - }\ -}\ -\ -static inline void FUNC(OPNAME ## _no_rnd_pixels8_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\ - int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ - /* FIXME HIGH BIT DEPTH*/\ - int i;\ - for(i=0; i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - l1= (c&0x03030303UL)\ - + (d&0x03030303UL);\ - h1= ((c&0xFCFCFCFCUL)>>2)\ - + ((d&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)&dst[i*dst_stride]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - a= AV_RN32(&src1[i*src_stride1+4]);\ - b= AV_RN32(&src2[i*src_stride2+4]);\ - c= AV_RN32(&src3[i*src_stride3+4]);\ - d= AV_RN32(&src4[i*src_stride4+4]);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x01010101UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - l1= (c&0x03030303UL)\ - + (d&0x03030303UL);\ - h1= ((c&0xFCFCFCFCUL)>>2)\ - + ((d&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)&dst[i*dst_stride+4]), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - }\ -}\ -static inline void FUNC(OPNAME ## _pixels16_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\ - int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ - FUNC(OPNAME ## _pixels8_l4)(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ - FUNC(OPNAME ## _pixels8_l4)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), src3+8*sizeof(pixel), src4+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ -}\ -static inline void FUNC(OPNAME ## _no_rnd_pixels16_l4)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, const uint8_t *src3, const uint8_t *src4,\ - int dst_stride, int src_stride1, int src_stride2,int src_stride3,int src_stride4, int h){\ - FUNC(OPNAME ## _no_rnd_pixels8_l4)(dst , src1 , src2 , src3 , src4 , dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ - FUNC(OPNAME ## _no_rnd_pixels8_l4)(dst+8*sizeof(pixel), src1+8*sizeof(pixel), src2+8*sizeof(pixel), src3+8*sizeof(pixel), src4+8*sizeof(pixel), dst_stride, src_stride1, src_stride2, src_stride3, src_stride4, h);\ -}\ -\ -static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\ -{\ - /* FIXME HIGH BIT DEPTH */\ - int j;\ - for(j=0; j<2; j++){\ - int i;\ - const uint32_t a= AV_RN32(pixels );\ - const uint32_t b= AV_RN32(pixels+1);\ - uint32_t l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - uint32_t l1,h1;\ -\ - pixels+=line_size;\ - for(i=0; i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - a= AV_RN32(pixels );\ - b= AV_RN32(pixels+1);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - }\ - pixels+=4-line_size*(h+1);\ - block +=4-line_size*h;\ - }\ -}\ -\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_xy2), FUNCC(OPNAME ## _pixels8_xy2), 8*sizeof(pixel))\ - -#define op_avg(a, b) a = rnd_avg_pixel4(a, b) -#define op_put(a, b) a = b -#if BIT_DEPTH == 8 -#define put_no_rnd_pixels8_8_c put_pixels8_8_c -PIXOP2(avg, op_avg) -PIXOP2(put, op_put) -#endif -#undef op_avg -#undef op_put diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.c deleted file mode 100644 index e73af29c8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/pixdesc.h" -#include "avcodec.h" -#include "dv_profile.h" - -static DVwork_chunk work_chunks_dv25pal [1*12*27]; -static DVwork_chunk work_chunks_dv25pal411[1*12*27]; -static DVwork_chunk work_chunks_dv25ntsc [1*10*27]; -static DVwork_chunk work_chunks_dv50pal [2*12*27]; -static DVwork_chunk work_chunks_dv50ntsc [2*10*27]; -static DVwork_chunk work_chunks_dv100palp [2*12*27]; -static DVwork_chunk work_chunks_dv100ntscp[2*10*27]; -static DVwork_chunk work_chunks_dv100pali [4*12*27]; -static DVwork_chunk work_chunks_dv100ntsci[4*10*27]; - -static uint32_t dv_idct_factor_sd [2*2*22*64]; -static uint32_t dv_idct_factor_hd1080[2*4*16*64]; -static uint32_t dv_idct_factor_hd720 [2*4*16*64]; - -static const uint8_t dv_audio_shuffle525[10][9] = { - { 0, 30, 60, 20, 50, 80, 10, 40, 70 }, /* 1st channel */ - { 6, 36, 66, 26, 56, 86, 16, 46, 76 }, - { 12, 42, 72, 2, 32, 62, 22, 52, 82 }, - { 18, 48, 78, 8, 38, 68, 28, 58, 88 }, - { 24, 54, 84, 14, 44, 74, 4, 34, 64 }, - - { 1, 31, 61, 21, 51, 81, 11, 41, 71 }, /* 2nd channel */ - { 7, 37, 67, 27, 57, 87, 17, 47, 77 }, - { 13, 43, 73, 3, 33, 63, 23, 53, 83 }, - { 19, 49, 79, 9, 39, 69, 29, 59, 89 }, - { 25, 55, 85, 15, 45, 75, 5, 35, 65 }, -}; - -static const uint8_t dv_audio_shuffle625[12][9] = { - { 0, 36, 72, 26, 62, 98, 16, 52, 88}, /* 1st channel */ - { 6, 42, 78, 32, 68, 104, 22, 58, 94}, - { 12, 48, 84, 2, 38, 74, 28, 64, 100}, - { 18, 54, 90, 8, 44, 80, 34, 70, 106}, - { 24, 60, 96, 14, 50, 86, 4, 40, 76}, - { 30, 66, 102, 20, 56, 92, 10, 46, 82}, - - { 1, 37, 73, 27, 63, 99, 17, 53, 89}, /* 2nd channel */ - { 7, 43, 79, 33, 69, 105, 23, 59, 95}, - { 13, 49, 85, 3, 39, 75, 29, 65, 101}, - { 19, 55, 91, 9, 45, 81, 35, 71, 107}, - { 25, 61, 97, 15, 51, 87, 5, 41, 77}, - { 31, 67, 103, 21, 57, 93, 11, 47, 83}, -}; - -/* macroblock bit budgets */ -static const uint8_t block_sizes_dv2550[8] = { - 112, 112, 112, 112, 80, 80, 0, 0, -}; - -static const uint8_t block_sizes_dv100[8] = { - 80, 80, 80, 80, 80, 80, 64, 64, -}; - -static const DVprofile dv_profiles[] = { - { .dsf = 0, - .video_stype = 0x0, - .frame_size = 120000, /* IEC 61834, SMPTE-314M - 525/60 (NTSC) */ - .difseg_size = 10, - .n_difchan = 1, - .time_base = { 1001, 30000 }, - .ltc_divisor = 30, - .height = 480, - .width = 720, - .sar = {{8, 9}, {32, 27}}, - .work_chunks = &work_chunks_dv25ntsc[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV411P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 90, - .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ - .audio_shuffle = dv_audio_shuffle525, - }, - { .dsf = 1, - .video_stype = 0x0, - .frame_size = 144000, /* IEC 61834 - 625/50 (PAL) */ - .difseg_size = 12, - .n_difchan = 1, - .time_base = { 1, 25 }, - .ltc_divisor = 25, - .height = 576, - .width = 720, - .sar = {{16, 15}, {64, 45}}, - .work_chunks = &work_chunks_dv25pal[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV420P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 108, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - }, - { .dsf = 1, - .video_stype = 0x0, - .frame_size = 144000, /* SMPTE-314M - 625/50 (PAL) */ - .difseg_size = 12, - .n_difchan = 1, - .time_base = { 1, 25 }, - .ltc_divisor = 25, - .height = 576, - .width = 720, - .sar = {{16, 15}, {64, 45}}, - .work_chunks = &work_chunks_dv25pal411[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV411P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 108, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - }, - { .dsf = 0, - .video_stype = 0x4, - .frame_size = 240000, /* SMPTE-314M - 525/60 (NTSC) 50 Mbps */ - .difseg_size = 10, /* also known as "DVCPRO50" */ - .n_difchan = 2, - .time_base = { 1001, 30000 }, - .ltc_divisor = 30, - .height = 480, - .width = 720, - .sar = {{8, 9}, {32, 27}}, - .work_chunks = &work_chunks_dv50ntsc[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 90, - .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ - .audio_shuffle = dv_audio_shuffle525, - }, - { .dsf = 1, - .video_stype = 0x4, - .frame_size = 288000, /* SMPTE-314M - 625/50 (PAL) 50 Mbps */ - .difseg_size = 12, /* also known as "DVCPRO50" */ - .n_difchan = 2, - .time_base = { 1, 25 }, - .ltc_divisor = 25, - .height = 576, - .width = 720, - .sar = {{16, 15}, {64, 45}}, - .work_chunks = &work_chunks_dv50pal[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 108, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - }, - { .dsf = 0, - .video_stype = 0x14, - .frame_size = 480000, /* SMPTE-370M - 1080i60 100 Mbps */ - .difseg_size = 10, /* also known as "DVCPRO HD" */ - .n_difchan = 4, - .time_base = { 1001, 30000 }, - .ltc_divisor = 30, - .height = 1080, - .width = 1280, - .sar = {{1, 1}, {3, 2}}, - .work_chunks = &work_chunks_dv100ntsci[0], - .idct_factor = &dv_idct_factor_hd1080[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 8, - .block_sizes = block_sizes_dv100, - .audio_stride = 90, - .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ - .audio_shuffle = dv_audio_shuffle525, - }, - { .dsf = 1, - .video_stype = 0x14, - .frame_size = 576000, /* SMPTE-370M - 1080i50 100 Mbps */ - .difseg_size = 12, /* also known as "DVCPRO HD" */ - .n_difchan = 4, - .time_base = { 1, 25 }, - .ltc_divisor = 25, - .height = 1080, - .width = 1440, - .sar = {{1, 1}, {4, 3}}, - .work_chunks = &work_chunks_dv100pali[0], - .idct_factor = &dv_idct_factor_hd1080[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 8, - .block_sizes = block_sizes_dv100, - .audio_stride = 108, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - }, - { .dsf = 0, - .video_stype = 0x18, - .frame_size = 240000, /* SMPTE-370M - 720p60 100 Mbps */ - .difseg_size = 10, /* also known as "DVCPRO HD" */ - .n_difchan = 2, - .time_base = { 1001, 60000 }, - .ltc_divisor = 60, - .height = 720, - .width = 960, - .sar = {{1, 1}, {4, 3}}, - .work_chunks = &work_chunks_dv100ntscp[0], - .idct_factor = &dv_idct_factor_hd720[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 8, - .block_sizes = block_sizes_dv100, - .audio_stride = 90, - .audio_min_samples = { 1580, 1452, 1053 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1600, 1602, 1602, 1602, 1602 }, /* per SMPTE-314M */ - .audio_shuffle = dv_audio_shuffle525, - }, - { .dsf = 1, - .video_stype = 0x18, - .frame_size = 288000, /* SMPTE-370M - 720p50 100 Mbps */ - .difseg_size = 12, /* also known as "DVCPRO HD" */ - .n_difchan = 2, - .time_base = { 1, 50 }, - .ltc_divisor = 50, - .height = 720, - .width = 960, - .sar = {{1, 1}, {4, 3}}, - .work_chunks = &work_chunks_dv100palp[0], - .idct_factor = &dv_idct_factor_hd720[0], - .pix_fmt = AV_PIX_FMT_YUV422P, - .bpm = 8, - .block_sizes = block_sizes_dv100, - .audio_stride = 90, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - }, - { .dsf = 1, - .video_stype = 0x1, - .frame_size = 144000, /* IEC 61883-5 - 625/50 (PAL) */ - .difseg_size = 12, - .n_difchan = 1, - .time_base = { 1, 25 }, - .ltc_divisor = 25, - .height = 576, - .width = 720, - .sar = {{16, 15}, {64, 45}}, - .work_chunks = &work_chunks_dv25pal[0], - .idct_factor = &dv_idct_factor_sd[0], - .pix_fmt = AV_PIX_FMT_YUV420P, - .bpm = 6, - .block_sizes = block_sizes_dv2550, - .audio_stride = 108, - .audio_min_samples = { 1896, 1742, 1264 }, /* for 48, 44.1 and 32kHz */ - .audio_samples_dist = { 1920, 1920, 1920, 1920, 1920 }, - .audio_shuffle = dv_audio_shuffle625, - } -}; - -const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys, - const uint8_t* frame, unsigned buf_size) -{ - int i, dsf, stype; - - if(buf_size < DV_PROFILE_BYTES) - return NULL; - - dsf = (frame[3] & 0x80) >> 7; - stype = frame[80 * 5 + 48 + 3] & 0x1f; - - /* 576i50 25Mbps 4:1:1 is a special case */ - if ((dsf == 1 && stype == 0 && frame[4] & 0x07 /* the APT field */) || - (stype == 31 && codec && codec->codec_tag==AV_RL32("SL25") && codec->coded_width==720 && codec->coded_height==576)) { - return &dv_profiles[2]; - } - - if( stype == 0 - && codec - && (codec->codec_tag==AV_RL32("dvsd") || codec->codec_tag==AV_RL32("CDVC")) - && codec->coded_width ==720 - && codec->coded_height==576) - return &dv_profiles[1]; - - for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) - if (dsf == dv_profiles[i].dsf && stype == dv_profiles[i].video_stype) - return &dv_profiles[i]; - - /* check if old sys matches and assumes corrupted input */ - if (sys && buf_size == sys->frame_size) - return sys; - - /* hack for trac issue #217, dv files created with QuickTime 3 */ - if ((frame[3] & 0x7f) == 0x3f && frame[80 * 5 + 48 + 3] == 0xff) - return &dv_profiles[dsf]; - - return NULL; -} - -const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, - const uint8_t* frame, unsigned buf_size) -{ - return avpriv_dv_frame_profile2(NULL, sys, frame, buf_size); -} - -const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec) -{ - int i; - int w, h; - - if (codec->coded_width || codec->coded_height) { - w = codec->coded_width; - h = codec->coded_height; - } else { - w = codec->width; - h = codec->height; - } - - for (i=0; ipix_fmt == dv_profiles[i].pix_fmt && - w == dv_profiles[i].width) - return &dv_profiles[i]; - - return NULL; -} - -void ff_dv_print_profiles(void *logctx, int loglevel) -{ - int i; - for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++) { - const DVprofile *p = &dv_profiles[i]; - av_log(logctx, loglevel, "Frame size: %dx%d; pixel format: %s, " - "framerate: %d/%d\n", p->width, p->height, av_get_pix_fmt_name(p->pix_fmt), - p->time_base.den, p->time_base.num); - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.c deleted file mode 100644 index a7e3d591a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Constants for DV codec - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Constants for DV codec. - */ - -#include "avcodec.h" -#include "dvdata.h" - -/* unquant tables (not used directly) */ -const uint8_t ff_dv_quant_shifts[22][4] = { - { 3,3,4,4 }, - { 3,3,4,4 }, - { 2,3,3,4 }, - { 2,3,3,4 }, - { 2,2,3,3 }, - { 2,2,3,3 }, - { 1,2,2,3 }, - { 1,2,2,3 }, - { 1,1,2,2 }, - { 1,1,2,2 }, - { 0,1,1,2 }, - { 0,1,1,2 }, - { 0,0,1,1 }, - { 0,0,1,1 }, - { 0,0,0,1 }, - { 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 }, -}; - -const uint8_t ff_dv_quant_offset[4] = { 6, 3, 0, 1 }; - -const int ff_dv_iweight_88[64] = { - 32768, 16710, 16710, 17735, 17015, 17735, 18197, 18079, - 18079, 18197, 18725, 18559, 19196, 18559, 18725, 19284, - 19108, 19692, 19692, 19108, 19284, 21400, 19645, 20262, - 20214, 20262, 19645, 21400, 22733, 21845, 20867, 20815, - 20815, 20867, 21845, 22733, 23173, 23173, 21400, 21400, - 21400, 23173, 23173, 24600, 23764, 22017, 22017, 23764, - 24600, 25267, 24457, 22672, 24457, 25267, 25971, 25191, - 25191, 25971, 26715, 27962, 26715, 29642, 29642, 31536, -}; -const int ff_dv_iweight_248[64] = { - 32768, 17735, 16710, 18079, 18725, 21400, 17735, 19196, - 19108, 21845, 16384, 17735, 18725, 21400, 16710, 18079, - 20262, 23173, 18197, 19692, 18725, 20262, 20815, 23764, - 17735, 19196, 19108, 21845, 20262, 23173, 18197, 19692, - 21400, 24457, 19284, 20867, 21400, 23173, 22017, 25191, - 18725, 20262, 20815, 23764, 21400, 24457, 19284, 20867, - 24457, 27962, 22733, 24600, 25971, 29642, 21400, 23173, - 22017, 25191, 24457, 27962, 22733, 24600, 25971, 29642, -}; - -/** - * The "inverse" DV100 weights are actually just the spec weights (zig-zagged). - */ -const int ff_dv_iweight_1080_y[64] = { - 128, 16, 16, 17, 17, 17, 18, 18, - 18, 18, 18, 18, 19, 18, 18, 19, - 19, 19, 19, 19, 19, 42, 38, 40, - 40, 40, 38, 42, 44, 43, 41, 41, - 41, 41, 43, 44, 45, 45, 42, 42, - 42, 45, 45, 48, 46, 43, 43, 46, - 48, 49, 48, 44, 48, 49, 101, 98, - 98, 101, 104, 109, 104, 116, 116, 123, -}; -const int ff_dv_iweight_1080_c[64] = { - 128, 16, 16, 17, 17, 17, 25, 25, - 25, 25, 26, 25, 26, 25, 26, 26, - 26, 27, 27, 26, 26, 42, 38, 40, - 40, 40, 38, 42, 44, 43, 41, 41, - 41, 41, 43, 44, 91, 91, 84, 84, - 84, 91, 91, 96, 93, 86, 86, 93, - 96, 197, 191, 177, 191, 197, 203, 197, - 197, 203, 209, 219, 209, 232, 232, 246, -}; -const int ff_dv_iweight_720_y[64] = { - 128, 16, 16, 17, 17, 17, 18, 18, - 18, 18, 18, 18, 19, 18, 18, 19, - 19, 19, 19, 19, 19, 42, 38, 40, - 40, 40, 38, 42, 44, 43, 41, 41, - 41, 41, 43, 44, 68, 68, 63, 63, - 63, 68, 68, 96, 92, 86, 86, 92, - 96, 98, 96, 88, 96, 98, 202, 196, - 196, 202, 208, 218, 208, 232, 232, 246, -}; -const int ff_dv_iweight_720_c[64] = { - 128, 24, 24, 26, 26, 26, 36, 36, - 36, 36, 36, 36, 38, 36, 36, 38, - 38, 38, 38, 38, 38, 84, 76, 80, - 80, 80, 76, 84, 88, 86, 82, 82, - 82, 82, 86, 88, 182, 182, 168, 168, - 168, 182, 182, 192, 186, 192, 172, 186, - 192, 394, 382, 354, 382, 394, 406, 394, - 394, 406, 418, 438, 418, 464, 464, 492, -}; - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.h deleted file mode 100644 index 97c20e3a1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dvdata.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Constants for DV codec - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Constants for DV codec. - */ - -#ifndef AVCODEC_DVDATA_H -#define AVCODEC_DVDATA_H - -#include "avcodec.h" -#include "dsputil.h" -#include "get_bits.h" -#include "dv_profile.h" - -typedef struct DVVideoContext { - const DVprofile *sys; - AVFrame picture; - AVCodecContext *avctx; - uint8_t *buf; - - uint8_t dv_zigzag[2][64]; - - void (*get_pixels)(int16_t *block, const uint8_t *pixels, int line_size); - void (*fdct[2])(int16_t *block); - void (*idct_put[2])(uint8_t *dest, int line_size, int16_t *block); - me_cmp_func ildct_cmp; -} DVVideoContext; - -enum dv_section_type { - dv_sect_header = 0x1f, - dv_sect_subcode = 0x3f, - dv_sect_vaux = 0x56, - dv_sect_audio = 0x76, - dv_sect_video = 0x96, -}; - -enum dv_pack_type { - dv_header525 = 0x3f, /* see dv_write_pack for important details on */ - dv_header625 = 0xbf, /* these two packs */ - dv_timecode = 0x13, - dv_audio_source = 0x50, - dv_audio_control = 0x51, - dv_audio_recdate = 0x52, - dv_audio_rectime = 0x53, - dv_video_source = 0x60, - dv_video_control = 0x61, - dv_video_recdate = 0x62, - dv_video_rectime = 0x63, - dv_unknown_pack = 0xff, -}; - -extern const uint8_t ff_dv_quant_shifts[22][4]; -extern const uint8_t ff_dv_quant_offset[4]; - -extern const int ff_dv_iweight_88[64]; -extern const int ff_dv_iweight_248[64]; -extern const int ff_dv_iweight_1080_y[64]; -extern const int ff_dv_iweight_1080_c[64]; -extern const int ff_dv_iweight_720_y[64]; -extern const int ff_dv_iweight_720_c[64]; - -#define DV_PROFILE_IS_HD(p) ((p)->video_stype & 0x10) -#define DV_PROFILE_IS_1080i50(p) (((p)->video_stype == 0x14) && ((p)->dsf == 1)) -#define DV_PROFILE_IS_720p50(p) (((p)->video_stype == 0x18) && ((p)->dsf == 1)) - -/** - * largest possible DV frame, in bytes (1080i50) - */ -#define DV_MAX_FRAME_SIZE 576000 - -/** - * maximum number of blocks per macroblock in any DV format - */ -#define DV_MAX_BPM 8 - -#define TEX_VLC_BITS 9 - -extern RL_VLC_ELEM ff_dv_rl_vlc[1184]; - -int ff_dv_init_dynamic_tables(const DVprofile *d); -int ff_dvvideo_init(AVCodecContext *avctx); - -static inline int dv_work_pool_size(const DVprofile *d) -{ - int size = d->n_difchan*d->difseg_size*27; - if (DV_PROFILE_IS_1080i50(d)) - size -= 3*27; - if (DV_PROFILE_IS_720p50(d)) - size -= 4*27; - return size; -} - -static inline void dv_calculate_mb_xy(DVVideoContext *s, DVwork_chunk *work_chunk, int m, int *mb_x, int *mb_y) -{ - *mb_x = work_chunk->mb_coordinates[m] & 0xff; - *mb_y = work_chunk->mb_coordinates[m] >> 8; - - /* We work with 720p frames split in half. The odd half-frame (chan==2,3) is displaced :-( */ - if (s->sys->height == 720 && !(s->buf[1]&0x0C)) { - *mb_y -= (*mb_y>17)?18:-72; /* shifting the Y coordinate down by 72/2 macro blocks */ - } -} - -#endif /* AVCODEC_DVDATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.c deleted file mode 100644 index b159e1682..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* - * E-AC-3 tables - * Copyright (c) 2007 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Tables taken directly from the E-AC-3 spec. - */ - -#include "eac3_data.h" -#include "ac3.h" - -const uint8_t ff_eac3_bits_vs_hebap[20] = { - 0, 2, 3, 4, 5, 7, 8, 9, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 14, 16, -}; - -/** - * Table E3.6, Gk=1 - * No gain (Gk=1) inverse quantization, remapping scale factors - * ff_eac3_gaq_remap[hebap+8] - */ -const int16_t ff_eac3_gaq_remap_1[12] = { - 4681, 2185, 1057, 520, 258, 129, 64, 32, 16, 8, 2, 0 -}; - -/** - * Table E3.6, Gk=2 & Gk=4, A - * Large mantissa inverse quantization, remapping scale factors - * ff_eac3_gaq_remap_2_4_a[hebap-8][Gk=2,4] - */ -const int16_t ff_eac3_gaq_remap_2_4_a[9][2] = { - { -10923, -4681 }, - { -14043, -6554 }, - { -15292, -7399 }, - { -15855, -7802 }, - { -16124, -7998 }, - { -16255, -8096 }, - { -16320, -8144 }, - { -16352, -8168 }, - { -16368, -8180 } -}; - -/** - * Table E3.6, Gk=2 & Gk=4, B - * Large mantissa inverse quantization, negative mantissa remapping offsets - * ff_eac3_gaq_remap_3_4_b[hebap-8][Gk=2,4] - */ -const int16_t ff_eac3_gaq_remap_2_4_b[9][2] = { - { -5461, -1170 }, - { -11703, -4915 }, - { -14199, -6606 }, - { -15327, -7412 }, - { -15864, -7805 }, - { -16126, -7999 }, - { -16255, -8096 }, - { -16320, -8144 }, - { -16352, -8168 } -}; - -static const int16_t vq_hebap1[4][6] = { -{ 7167, 4739, 1106, 4269, 10412, 4820}, -{ -5702, -3187, -14483, -1392, -2027, 849}, -{ 633, 6199, 7009, -12779, -2306, -2636}, -{ -1468, -7031, 7592, 10617, -5946, -3062}, -}; -static const int16_t vq_hebap2[8][6] = { -{ -12073, 608, -7019, 590, 4000, 869}, -{ 6692, 15689, -6178, -9239, -74, 133}, -{ 1855, -989, 20596, -2920, -4475, 225}, -{ -1194, -3901, -821, -6566, -875, -20298}, -{ -2762, -3181, -4094, -5623, -16945, 9765}, -{ 1547, 6839, 1980, 20233, -1071, -4986}, -{ 6221, -17915, -5516, 6266, 358, 1162}, -{ 3753, -1066, 4283, -3227, 15928, 10186}, -}; -static const int16_t vq_hebap3[16][6] = { -{ -10028, 20779, 10982, -4560, 798, -68}, -{ 11050, 20490, -6617, -5342, -1797, -1631}, -{ 3977, -542, 7118, -1166, 18844, 14678}, -{ -4320, -96, -7295, -492, -22050, -4277}, -{ 2692, 5856, 5530, 21862, -7212, -5325}, -{ -135, -23391, 962, 8115, -644, 382}, -{ -1563, 3400, -3299, 4693, -6892, 22398}, -{ 3535, 3030, 7296, 6214, 20476, -12099}, -{ 57, -6823, 1848, -22349, -5919, 6823}, -{ -821, -3655, -387, -6253, -1735, -22373}, -{ -6046, 1586, -18890, -14392, 9214, 705}, -{ -5716, 264, -17964, 14618, 7921, -337}, -{ -110, 108, 8, 74, -89, -50}, -{ 6612, -1517, 21687, -1658, -7949, -246}, -{ 21667, -6335, -8290, -101, -1349, -22}, -{ -22003, -6476, 7974, 648, 2054, -331}, -}; -static const int16_t vq_hebap4[32][6] = { -{ 6636, -4593, 14173, -17297, -16523, 864}, -{ 3658, 22540, 104, -1763, -84, 6}, -{ 21580, -17815, -7282, -1575, -2078, -320}, -{ -2233, 10017, -2728, 14938, -13640, -17659}, -{ -1564, -17738, -19161, 13735, 2757, 2951}, -{ 4520, 5510, 7393, 10799, 19231, -13770}, -{ 399, 2976, -1099, 5013, -1159, 22095}, -{ 3624, -2359, 4680, -2238, 22702, 3765}, -{ -4201, -8285, -6810, -12390, -18414, 15382}, -{ -5198, -6869, -10047, -8364, -16022, -20562}, -{ -142, -22671, -368, 4391, -464, -13}, -{ 814, -1118, -1089, -22019, 74, 1553}, -{ -1618, 19222, -17642, -13490, 842, -2309}, -{ 4689, 16490, 20813, -15387, -4164, -3968}, -{ -3308, 11214, -13542, 13599, -19473, 13770}, -{ 1817, 854, 21225, -966, -1643, -268}, -{ -2587, -107, -20154, 376, 1174, -304}, -{ -2919, 453, -5390, 750, -22034, -978}, -{ -19012, 16839, 10000, -3580, 2211, 1459}, -{ 1363, -2658, -33, -4067, 1165, -21985}, -{ -8592, -2760, -17520, -15985, 14897, 1323}, -{ 652, -9331, 3253, -14622, 12181, 19692}, -{ -6361, 5773, -15395, 17291, 16590, -2922}, -{ -661, -601, 1609, 22610, 992, -1045}, -{ 4961, 9107, 11225, 7829, 16320, 18627}, -{ -21872, -1433, 138, 1470, -1891, -196}, -{ -19499, -18203, 11056, -516, 2543, -2249}, -{ -1196, -17574, 20150, 11462, -401, 2619}, -{ 4638, -8154, 11891, -15759, 17615, -14955}, -{ -83, 278, 323, 55, -154, 232}, -{ 7788, 1462, 18395, 15296, -15763, -1131}, -}; -static const int16_t vq_hebap5[128][6] = { -{ -3394, -19730, 2963, 9590, 4660, 19673}, -{ -15665, -6405, 17671, 3860, -8232, -19429}, -{ 4467, 412, -17873, -8037, 691, -17307}, -{ 3580, 2363, 6886, 3763, 6379, -20522}, -{ -17230, -14133, -1396, -23939, 8373, -12537}, -{ -8073, -21469, -15638, 3214, 8105, -5965}, -{ 4343, 5169, 2683, -16822, -5146, -16558}, -{ 6348, -10668, 12995, -25500, -22090, 4091}, -{ -2880, -8366, -5968, -17158, -2638, 23132}, -{ -5095, -14281, -22371, 21741, 3689, 2961}, -{ -2443, -17739, 25155, 2707, 1594, 7}, -{ -18379, 9010, 4270, 731, -426, -640}, -{ -23695, 24732, 5642, 612, -308, -964}, -{ -767, 1268, 225, 1635, 173, 916}, -{ 5455, 6493, 4902, 10560, 23041, -17140}, -{ 17219, -21054, -18716, 4936, -3420, 3357}, -{ -1390, 15488, -21946, -14611, 1339, 542}, -{ -6866, -2254, -12070, -3075, -19981, -20622}, -{ -1803, 11775, 1343, 8917, 693, 24497}, -{ -21610, 9462, 4681, 9254, -7815, 15904}, -{ -5559, -3018, -9169, -1347, -22547, 12868}, -{ -366, 5076, -1727, 20427, -283, -2923}, -{ -1886, -6313, -939, -2081, -1399, 3513}, -{ -3161, -537, -5075, 11268, 19396, 989}, -{ 2345, 4153, 5769, -4273, 233, -399}, -{ -21894, -1138, -16474, 5902, 5488, -3211}, -{ 10007, -12530, 18829, 20932, -1158, 1790}, -{ -1165, 5014, -1199, 6415, -8418, -21038}, -{ 1892, -3534, 3815, -5846, 16427, 20288}, -{ -2664, -11627, -4147, -18311, -22710, 14848}, -{ 17256, 10419, 7764, 12040, 18956, 2525}, -{ -21419, -18685, -10897, 4368, -7051, 4539}, -{ -1574, 2050, 5760, 24756, 15983, 17678}, -{ -538, -22867, 11067, 10301, 385, 528}, -{ -8465, -3025, -16357, -23237, 16491, 3654}, -{ 5840, 575, 11890, 1947, 25157, 6653}, -{ 6625, -3516, -1964, 3850, -390, -116}, -{ 18005, 20900, 14323, -7621, -10922, 11802}, -{ -4857, -2932, -13334, -7815, 21622, 2267}, -{ -579, -9431, -748, -21321, 12367, 8265}, -{ -8317, 1375, -17847, 2921, 9062, 22046}, -{ 18398, 8635, -1503, -2418, -18295, -14734}, -{ -2987, 15129, -3331, 22300, 13878, -13639}, -{ 5874, -19026, 15587, 11350, -20738, 1971}, -{ 1581, -6955, -21440, 2455, 65, 414}, -{ 515, -4468, -665, -4672, 125, -19222}, -{ 21495, -20301, -1872, -1926, -211, -1022}, -{ 5189, -12250, -1775, -23550, -4546, 5813}, -{ 321, -6331, 14646, 6975, -1773, 867}, -{ -13814, 3180, 7927, 444, 19552, 3146}, -{ -6660, 12252, -1972, 17408, -24280, -12956}, -{ -745, 14356, -1107, 23742, -9631, -18344}, -{ 18284, -7909, -7531, 19118, 7721, -12659}, -{ 1926, 15101, -12848, 2153, 21631, 1864}, -{ -2130, 23416, 17056, -15597, -1544, 87}, -{ 8314, -11824, 14581, -20591, 7891, -2099}, -{ 19600, 22814, -17304, -2040, 285, -3863}, -{ -8214, -18322, 10724, -13744, -13469, -1666}, -{ 14351, 4880, -20034, 964, -4221, -180}, -{ -24598, -16635, 19724, 5925, 4777, 4414}, -{ -2495, 23493, -16141, 2918, -1038, -2010}, -{ 18974, -2540, 13343, 1405, -6194, -1136}, -{ 2489, 13670, 22638, -7311, -129, -2792}, -{ -13962, 16775, 23012, 728, 3397, 162}, -{ 3038, 993, 8774, -21969, -6609, 910}, -{ -12444, -22386, -2626, -5295, 19520, 9872}, -{ -1911, -18274, -18506, -14962, 4760, 7119}, -{ 8298, -2978, 25886, 7660, -7897, 1020}, -{ 6132, 15127, 18757, -24370, -6529, -6627}, -{ 7924, 12125, -9459, -23962, 5502, 937}, -{ -17056, -5373, 2522, 327, 1129, -390}, -{ 15774, 19955, -10380, 11172, -3107, 14853}, -{ -11904, -8091, -17928, -22287, -17237, -6803}, -{ -12862, -2172, -6509, 5927, 12458, -22355}, -{ -497, 322, 1038, -6643, -5404, 20311}, -{ 1083, -22984, -8494, 12130, -762, 2623}, -{ 5067, 19712, -1901, -30, -325, 85}, -{ 987, -5830, 4212, -9030, 9121, -25038}, -{ -7868, 7284, -12292, 12914, -21592, 20941}, -{ -1630, -7694, -2187, -8525, -5604, -25196}, -{ -6668, 388, -22535, 1526, 9082, 193}, -{ -7867, -22308, 5163, 362, 944, -259}, -{ 3824, -11850, 7591, -23176, 25342, 23771}, -{ -10504, 4123, -21111, 21173, 22439, -838}, -{ -4723, 21795, 6184, -122, 1642, -717}, -{ 24504, 19887, -2043, 986, 7, -55}, -{ -27313, -135, 2437, 259, 89, 307}, -{ 24446, -3873, -5391, -820, -2387, 361}, -{ 5529, 5784, 18682, 242, -21896, -4003}, -{ 22304, 4483, 722, -12242, 7570, 15448}, -{ 8673, 3009, 20437, 21108, -21100, -3080}, -{ -1132, 2705, -1825, 5420, -785, 18532}, -{ 16932, -13517, -16509, -14858, -20327, -14221}, -{ 2219, 1380, 21474, -1128, 327, 83}, -{ -2177, 21517, -3856, -14180, -204, -2191}, -{ 953, -9426, 15874, -10710, -3231, 21030}, -{ -421, -1377, 640, -8239, -20976, 2174}, -{ 4309, 18514, -9100, -18319, -15518, 3704}, -{ -5943, 449, -8387, 1075, -22210, -4992}, -{ 2953, 12788, 18285, 1430, 14937, 21731}, -{ -2913, 401, -4739, -20105, 1699, -1147}, -{ 3449, 5241, 8853, 22134, -7547, 1451}, -{ -2154, 8584, 18120, -15614, 19319, -5991}, -{ 3501, 2841, 5897, 6397, 8630, 23018}, -{ 2467, 2956, 379, 5703, -22047, -2189}, -{ -16963, -594, 18822, -5295, 1640, 774}, -{ 2896, -1424, 3586, -2292, 19910, -1822}, -{ -18575, 21219, -14001, -12573, 16466, 635}, -{ -1998, -19314, -16527, 12208, -16576, -7854}, -{ -9674, 1012, -21645, 2883, -12712, 2321}, -{ -1005, 471, -3629, 8045, -11087, 25533}, -{ 4141, -21472, -2673, 756, -663, -523}, -{ 6490, 8531, 19289, 18949, 6092, -9347}, -{ 16965, 24599, 14024, 10072, -536, -10438}, -{ -8147, 2145, -23028, -17073, 5451, -4401}, -{ -14873, 20520, -18303, -9717, -11885, -17831}, -{ -2290, -14120, 2070, 22467, 1671, 725}, -{ -8538, 14629, 3521, -20577, 6673, 8200}, -{ 20248, 4410, -1366, -585, 1229, -2449}, -{ 7467, -7148, 13667, -8246, 22392, -17320}, -{ -1932, 3875, -9064, -3812, 958, 265}, -{ -4399, 2959, -15911, 19598, 4954, -1105}, -{ 18009, -9923, -18137, -3862, 11178, 5821}, -{ -14596, -1227, 9660, 21619, 11228, -11721}, -{ -721, -1700, 109, -2142, 61, -6772}, -{ -24619, -22520, 5608, -1957, -1761, -1012}, -{ -23728, -4451, -2688, -14679, -4266, 9919}, -{ 8495, -894, 20438, -13820, -17267, 139}, -}; -static const int16_t vq_hebap6[256][6] = { -{ 10154, 7365, 16861, 18681, -22893, -3636}, -{ -2619, -3788, -5529, -5192, -9009, -20298}, -{ -5583, -22800, 21297, 7012, 745, 720}, -{ 428, -1459, 109, -3082, 361, -8403}, -{ 8161, 22401, 241, 1755, -874, -2824}, -{ 1140, 12643, 2306, 22263, -25146, -17557}, -{ -2609, 3379, 10337, -19730, -15468, -23944}, -{ -4040, -12796, -25772, 13096, 3905, 1315}, -{ 4624, -23799, 13608, 25317, -1175, 2173}, -{ -97, 13747, -5122, 23255, 4214, -22145}, -{ 6878, -322, 18264, -854, -11916, -733}, -{ 17280, -12669, -9693, 23563, -16240, -1309}, -{ 5802, -4968, 19526, -21194, -24622, -183}, -{ 5851, -16137, 15229, -9496, -1538, 377}, -{ 14096, 25057, 13419, 8290, 23320, 16818}, -{ -7261, 118, -15867, 19097, 9781, -277}, -{ -4288, 21589, -13288, -16259, 16633, -4862}, -{ 4909, -19217, 23411, 14705, -722, 125}, -{ 19462, -4732, -1928, -11527, 20770, 5425}, -{ -27562, -2881, -4331, 384, -2103, 1367}, -{ -266, -9175, 5441, 26333, -1924, 4221}, -{ -2970, -20170, -21816, 5450, -7426, 5344}, -{ -221, -6696, 603, -9140, 1308, -27506}, -{ 9621, -8380, -1967, 9403, -1651, 22817}, -{ 7566, -5250, -4165, 1385, -990, 560}, -{ -1262, 24738, -19057, 10741, 7585, -7098}, -{ 451, 20130, -9949, -6015, -2188, -1458}, -{ 22249, 9380, 9096, 10959, -2365, -3724}, -{ 18668, -650, -1234, 11092, 7678, 5969}, -{ 19207, -1485, -1076, -731, -684, 43}, -{ -4973, 13430, 20139, 60, 476, -935}, -{ -20029, 8710, 2499, 1016, -1158, 335}, -{ -26413, 18598, -2201, -669, 3409, 793}, -{ -4726, 8875, -24607, -9646, 3643, -283}, -{ 13303, -21404, -3691, -1184, -1970, 1612}, -{ 173, 60, 919, 1229, 6942, -665}, -{ 16377, 16991, 5341, -14015, -2304, -20390}, -{ 25334, -10609, 11947, -7653, -6363, 14058}, -{ 23929, -13259, -7226, -937, 234, -187}, -{ 6311, -1877, 12506, -1879, 18751, -23341}, -{ 621, 6445, 3354, -24274, 8406, 5315}, -{ -3297, -5034, -4704, -5080, -25730, 5347}, -{ -1275, -13295, -965, -23318, 1214, 26259}, -{ -6252, 10035, -20105, 15301, -16073, 5136}, -{ 9562, -3911, -19510, 4745, 22270, -4171}, -{ 7978, -19600, 14024, -5745, -20855, 8939}, -{ 7, -4039, 991, -6065, 52, -19423}, -{ 3485, 2969, 7732, 7786, 25312, 6206}, -{ -959, -12812, -1840, -22743, 7324, 10830}, -{ -4686, 1678, -10172, -5205, 4294, -1271}, -{ 3889, 1302, 7450, 638, 20374, -3133}, -{ -12496, -9123, 18463, -12343, -7238, 18552}, -{ -6185, 8649, -6903, -895, 17109, 16604}, -{ -9896, 28579, 2845, 1640, 2925, -298}, -{ 14968, -25988, 14878, -24012, 1815, -6474}, -{ 26107, 5166, 21225, 15873, 21617, 14825}, -{ -21684, 16438, 20504, -14346, -7114, -4162}, -{ 28647, 90, -1572, 789, -902, -75}, -{ -1479, 2471, -4061, 3612, -2240, 10914}, -{ 8616, 17491, 17255, -17456, 17022, -16357}, -{ -20722, -18597, 25274, 17720, -3573, 1695}, -{ -997, 6129, -6303, 11250, -11359, -19739}, -{ -74, -4001, -1584, 13384, 162, -144}, -{ -529, 21068, 7923, -11396, 422, -26}, -{ 7102, -13531, -20055, 2629, -178, -429}, -{ 9201, 1368, -22238, 2623, -20499, 24889}, -{ -432, 6675, -266, 8723, 80, 28024}, -{ 19493, -3108, -9261, 1910, -21777, 5345}, -{ 14079, -11489, 12604, 6079, 19877, 1315}, -{ 10947, 9837, -18612, 15742, 4792, 605}, -{ -1777, 3758, -4087, 21696, 6024, -576}, -{ 3567, -3578, 16379, 2680, -1752, 716}, -{ -5049, -1399, -4550, -652, -17721, -3366}, -{ -3635, -4372, -6522, -22152, 7382, 1458}, -{ 12242, 19190, 5646, -7815, -20289, 21344}, -{ -7508, 19952, 23542, -9753, 5669, -1990}, -{ -2275, 15438, 10907, -17879, 6497, 13582}, -{ -15894, -15646, -4716, 6019, 24250, -6179}, -{ -2049, -6856, -1208, 918, 17735, -69}, -{ -3721, 9099, -16065, -23621, 5981, -2344}, -{ 7862, -8918, 24033, 25508, -11033, -741}, -{ -12588, 19468, 14649, 15451, -21226, 1171}, -{ 2102, 1147, 2789, 4096, 2179, 8750}, -{ -18214, -17758, -10366, -5203, -1066, -3541}, -{ -2819, -19958, -11921, 6032, 8315, 10374}, -{ -9078, -2100, 19431, -17, 732, -689}, -{ -14512, -19224, -7095, 18727, 1870, 22906}, -{ 3912, 659, 25597, -4006, 9619, 877}, -{ 2616, 22695, -5770, 17920, 3812, 20220}, -{ 2561, 26847, -5245, -10908, 2256, -517}, -{ -4974, 198, -21983, -3608, 22174, -18924}, -{ 21308, -1211, 19144, 16691, -1588, 11390}, -{ -1790, 3959, -3488, 7003, -7107, 20877}, -{ -6108, -17955, -18722, 24763, 16508, 3211}, -{ 20462, -24987, -20361, 4484, -5111, -478}, -{ -6378, -1998, -10229, -561, -22039, -22339}, -{ 3047, -18850, 7586, 14743, -19862, 6351}, -{ -5047, 1405, -9672, 1055, -21881, 11170}, -{ 3481, -9699, 6526, -16655, 22813, 21907}, -{ -18570, 17501, 14664, 1291, 5026, 19676}, -{ 16134, -19810, -16956, -17939, -16933, 5800}, -{ -8224, 4908, 8935, 2272, -1140, -23217}, -{ 1572, 2753, -1598, 2143, -3346, -21926}, -{ -9832, -1060, -27818, 1214, 7289, 150}, -{ 98, 1538, 535, 17429, -23198, -901}, -{ 21340, -20146, 3297, -1744, -8207, -21462}, -{ -4166, -4633, -17902, 5478, 1285, 136}, -{ 18713, 21003, 24818, 11421, 1282, -4618}, -{ -3535, 7636, -265, 2141, -829, -2035}, -{ -3184, 19713, 2775, -2, 1090, 104}, -{ -6771, -20185, 2938, -2125, -36, 1268}, -{ 9560, 9430, 9586, 22100, 13827, 6296}, -{ -535, -20018, 4276, -1868, -448, -17183}, -{ -24352, 14244, -13647, -21040, 2271, 11555}, -{ -2646, 15437, -4589, 18638, -4299, -622}, -{ -20064, 4169, 18115, -1404, 13722, -1825}, -{ -16359, 9080, 744, 22021, 125, 10794}, -{ 9644, -14607, -18479, -14714, 11174, -20754}, -{ -326, -23762, 6144, 7909, 602, 1540}, -{ -6650, 6634, -12683, 21396, 20785, -6839}, -{ 4252, -21043, 5628, 18687, 23860, 8328}, -{ 17986, 5704, -5245, -18093, -555, 3219}, -{ 6091, 14232, -5117, -17456, -19452, -11649}, -{ -21586, 11302, 15434, 25590, 6777, -26683}, -{ 21355, -8244, 5877, -3540, 6079, -2567}, -{ 2603, -2455, 5421, -12286, -19100, 5574}, -{ -1721, -26393, -23664, 22904, -349, 3787}, -{ 2189, -1203, 5340, 3249, -22617, 104}, -{ -1664, -11020, -2857, -20723, -24049, 19900}, -{ 22873, -7345, -18481, -14616, -8400, -12965}, -{ 3777, 3958, 8239, 20494, -6991, -1201}, -{ -160, -1613, -793, -8681, 573, 776}, -{ 4297, -3786, 20373, 6082, -5321, -18400}, -{ 18745, 2463, 12546, -7749, -7734, -2183}, -{ 11074, -4720, 22119, 1825, -24351, 4080}, -{ 1503, -19178, -1569, 13, -313, 375}, -{ 318, -575, 2544, 178, 102, 40}, -{ -15996, -26897, 5008, 3320, 686, 1159}, -{ 25755, 26886, 574, -5930, -3916, 1407}, -{ -9148, -7665, -2875, -8384, -18663, 26400}, -{ -7445, -18040, -18396, 8802, -2252, -21886}, -{ 7851, 11773, 27485, -12847, -1410, 19590}, -{ 2240, 5947, 11247, 15980, -6499, 24280}, -{ 21673, -18515, 9771, 6550, -2730, 334}, -{ -4149, 1576, -11010, 89, -24429, -5710}, -{ 7720, 1478, 21412, -25025, -8385, 9}, -{ -2448, 10218, -12756, -16079, 1161, -21284}, -{ -8757, -14429, -22918, -14812, 2629, 13844}, -{ -7252, 2843, -9639, 2882, -14625, 24497}, -{ -674, -6530, 414, -23333, -21343, 454}, -{ 2104, -6312, 10887, 18087, -1199, 175}, -{ -493, -562, -2739, 118, -1074, 93}, -{ -10011, -4075, -28071, 22180, 15077, -636}, -{ -4637, -16408, -9003, -20418, -11608, -20932}, -{ 4815, 15892, 24238, -13634, -3074, -1059}, -{ -6724, 4610, -18772, -15283, -16685, 23988}, -{ 15349, -674, -3682, 21679, 4475, -12088}, -{ 4756, 2593, 5354, 6001, 15063, 26490}, -{ -23815, -17251, 6944, 378, 694, 670}, -{ 23392, -8839, -14713, 7544, -876, 11088}, -{ 3640, 3336, 22593, -3495, -2328, -113}, -{ 284, 6914, 3097, 10171, 6638, -18621}, -{ 2472, 5976, 11054, -11936, -603, -663}, -{ 16175, 16441, 13164, -4043, 4667, 7431}, -{ 19338, 15534, -6533, 1681, -4857, 17048}, -{ 17027, 532, -19064, -1441, -5130, 1085}, -{ -12617, -17609, 2062, -25332, 19009, -16121}, -{ 10056, -21000, -13634, -2949, 15367, 19934}, -{ -648, -1605, 10046, -1592, 13296, 19808}, -{ -1054, 10744, 538, 24938, 9630, -9052}, -{ -10099, 3042, -25076, -24052, 13971, 100}, -{ 6547, 6907, 7031, 10348, 23775, -17886}, -{ -22793, -1984, -1393, -3330, 9267, 14317}, -{ -14346, -3967, 3042, 16254, -17303, 9646}, -{ -21393, 23628, 16773, 716, 2663, 114}, -{ -19016, -3038, 1574, -245, 1463, -793}, -{ 22410, 23441, -14637, -530, 17310, 13617}, -{ -11582, 7935, -13954, 23465, -24628, 26550}, -{ -1045, 3679, -2218, 10572, 20999, -3702}, -{ -15513, 197, 16718, -24603, 4945, 5}, -{ 10781, 4335, 26790, -9059, -16152, -2840}, -{ 16075, -24100, -3933, -6833, 12645, -7029}, -{ 2096, -25572, -8370, 6814, 11, 1178}, -{ -11848, -583, -8889, -20543, -10471, -380}, -{ -2487, 24777, -21639, -19341, 1660, -732}, -{ 2313, 13679, 4085, 24549, 24691, -21179}, -{ -2366, -504, -4130, -10570, 23668, 1961}, -{ 20379, 17809, -9506, 3733, -18954, -6292}, -{ -3856, 16802, -929, -20310, -17739, 6797}, -{ 12431, 6078, -11272, -14450, 6913, 23476}, -{ 7636, -1655, 23017, 10719, -8292, 838}, -{ -8559, -1235, -18096, 3897, 16093, 1490}, -{ -3586, 8276, 15165, -3791, -21149, 1741}, -{ -4497, 21739, 2366, -278, -4792, 15549}, -{ -23122, -13708, 7668, 16232, 24120, 15025}, -{ -20043, 12821, -20160, 16691, -11655, -16081}, -{ -12601, 20239, 3496, -2549, -6745, -11850}, -{ 4441, 7812, 20783, 17080, 11523, -9643}, -{ 24766, 8494, -23298, -3262, 11101, -7120}, -{ -10107, -7623, -22152, -18303, 26645, 9550}, -{ -25549, 477, 7874, -1538, 1123, -168}, -{ 470, 9834, -347, 23945, -10381, -9467}, -{ -4096, -9702, -6856, -21544, 20845, 7174}, -{ 5370, 9748, -23765, -1190, 512, -1538}, -{ -1006, -10046, -12649, 19234, -1790, -890}, -{ 15108, 23620, -15646, -2522, -1203, -1325}, -{ -7406, -2605, 1095, -247, -473, 177}, -{ 8089, 4, 12424, -22284, 10405, -7728}, -{ 22196, 10775, -5043, 690, 534, -212}, -{ -3153, -1418, -16835, 18426, 15821, 22956}, -{ 5681, -2229, 3196, -3414, -21817, -14807}, -{ 19, 787, 1032, 170, -8295, -645}, -{ -882, -2319, -27105, 432, -4392, 1499}, -{ -1354, -11819, -76, -20380, -10293, 11328}, -{ 211, -4753, -4675, -6933, -13538, 14479}, -{ 6043, 5260, -459, -462, 143, -65}, -{ -2572, 7256, -3317, 9212, -23184, -9990}, -{ -24882, -9532, 18874, 6101, 2429, -14482}, -{ 8314, 2277, 14192, 3512, 25881, 22000}, -{ 208, 20218, -281, -24778, -63, -1183}, -{ 1095, -6034, 2706, -21935, -2655, 563}, -{ 23, -5930, 243, -8989, 5345, 20558}, -{ -15466, 12699, 4160, 11087, 20621, -10416}, -{ 20995, -85, -8468, 194, 1003, -9515}, -{ -19637, -3335, -14081, 3574, -23381, -667}, -{ -2076, 3489, -3192, -19367, 539, -1530}, -{ 7352, -15213, 22596, 19369, 1043, 16627}, -{ -1872, -413, 1235, -5276, -3550, 21903}, -{ 7931, -2008, 16968, -6799, 29393, -2475}, -{ -13589, 8389, -23636, -22091, -14178, -14297}, -{ -11575, -20090, 16056, -1848, 15721, 4500}, -{ 3849, -16581, 20161, -21155, 7778, 11864}, -{ -6547, -1273, -18837, -11218, 11636, 1044}, -{ 2528, -6691, -17917, -11362, -4894, -1008}, -{ 1241, 4260, 2319, 6111, 3485, 20209}, -{ 3014, -3048, 5316, -4539, 20831, 8702}, -{ -1790, -14683, 278, 13956, -10065, -10547}, -{ -22732, -7957, -1154, 13821, -1484, -1247}, -{ -7317, -615, 13094, 18927, 9897, 1452}, -{ 2552, -2338, 3424, -4630, 11124, -19584}, -{ -11125, -20553, -10855, -10783, -20767, 6833}, -{ 984, -15095, 5775, 25125, 5377, -19799}, -{ 517, 13272, -7458, -1711, 20612, -6013}, -{ -21417, 13251, -20795, 13449, 17281, 13104}, -{ -15811, -16248, 23093, -4037, -8195, 871}, -{ 582, 12571, -21129, -14766, -9187, 5685}, -{ 4318, -1776, 11425, -17763, -9921, 577}, -{ 6013, 16830, 17655, -25766, -4400, -3550}, -{ -13744, -16541, 3636, -3330, -21091, -15886}, -{ 6565, -11147, 8649, -13114, 23345, -13565}, -{ -2542, -9046, -7558, 29240, 3701, -383}, -{ -10612, 24995, 1893, -8210, 20920, -16210}, -{ 5276, 16726, 10659, 19940, -4799, -19324}, -{ -532, -9300, 27856, 4965, -241, 536}, -{ -765, -20706, -3412, 18870, 2765, 1420}, -{ -3059, 2708, -19022, -331, 3537, 116}, -}; -static const int16_t vq_hebap7[512][6] = { -{ -21173, 21893, 10390, 13646, 10718, -9177}, -{ -22519, -8193, 18328, -6629, 25518, -10848}, -{ 6800, -13758, -13278, 22418, 14667, -20938}, -{ 2347, 10516, 1125, -3455, 5569, 27136}, -{ -6617, 11851, -24524, 22937, 20362, -6019}, -{ -21768, 10681, -19615, -15021, -8478, -2081}, -{ -2745, 8684, -4895, 27739, 7554, -11961}, -{ -1020, 2460, -954, 4754, -627, -16368}, -{ -19702, 23097, 75, -13684, -2644, 2108}, -{ 4049, -2872, 5851, -4459, 22150, 12560}, -{ -21304, -17129, -730, 7419, -11658, -10523}, -{ 11332, 1792, 26666, 23518, -19561, -491}, -{ -17827, -16777, -13606, -14389, -22029, -2464}, -{ 1091, -5967, -7975, -16977, -20432, -21931}, -{ 18388, -1103, 1933, 13342, -17463, 18114}, -{ 22646, 17345, -9966, 17919, 18274, 698}, -{ 1484, 20297, -5754, -26515, 4941, -22263}, -{ -2603, 4587, -5842, 18464, 8767, -2568}, -{ -2797, -1602, 21713, 3099, -25683, 3224}, -{ -19027, 4693, -5007, 6060, 1972, -15095}, -{ -2189, 9516, -530, 20669, -4662, -8301}, -{ -22325, -8887, 2529, -11352, 5476, 998}, -{ 22100, -5052, 1651, -2657, 4615, 2319}, -{ 20855, -3078, -3330, 4105, 13470, 3069}, -{ 85, 17289, 10264, -14752, 214, 90}, -{ -26365, -18849, -19352, 19244, -10218, 9909}, -{ -9739, 20497, -6579, -6983, 2891, -738}, -{ 20575, -15860, -22913, 6870, 76, 327}, -{ 8744, -12877, -22945, -2372, -19424, -9771}, -{ -12886, 16183, 21084, 3821, 749, -13792}, -{ -15995, 18399, 2391, -17661, 19484, -6018}, -{ 1423, 11734, 4051, 19290, 6857, -19681}, -{ -5200, 9766, 18246, 2463, 18764, -4852}, -{ -597, 19498, 1323, -9096, -308, -1104}, -{ -3099, -25731, -15665, 25332, 4634, 2635}, -{ 19623, -2384, -7913, 11796, -9333, -14084}, -{ 2642, 26453, -21091, -10354, -1693, -1711}, -{ 22031, 21625, 11580, -22915, -4141, 129}, -{ -6122, 3542, 915, -261, -17, -383}, -{ 1696, 6704, -1425, 20838, 857, -4416}, -{ 1423, -15280, -8550, -9667, 5210, 5687}, -{ -4520, -613, -11683, 5618, 4230, 619}, -{ 937, -4963, -14102, -17104, -6906, -5952}, -{ -15068, -481, -7237, -14894, 18876, 21673}, -{ -25658, 2910, 1143, -327, -458, -995}, -{ -9656, -819, -24900, 2804, 20225, 1083}, -{ -1111, -3682, -1788, -19492, 966, 821}, -{ 7293, -21759, 10790, -7059, -23293, -1723}, -{ -282, -11093, 170, -20950, -28926, 12615}, -{ 17938, 3713, -1563, 885, 5, 564}, -{ 6116, 22696, 2242, -6951, 9975, -6132}, -{ 4338, 26808, -3705, 1976, -1079, -2570}, -{ -661, -7901, -2668, -15194, 17722, 4375}, -{ -4174, -11053, 717, -22506, 1562, 12252}, -{ -6405, 18334, 6103, 6983, 5956, 18195}, -{ 9851, 5370, 23604, -6861, -6569, -62}, -{ 21964, 13359, -683, 3785, 2168, 209}, -{ -3569, -1127, -19724, -1544, 1308, -803}, -{ -3083, 16049, -13791, -3077, 4294, 23713}, -{ -9999, 9943, -15872, 12934, -23631, 21699}, -{ 9722, 22837, 12192, 15091, 5533, 4837}, -{ 2243, 2099, 1243, 4089, 4748, 12956}, -{ 4007, -2468, 3353, -3092, 8843, 17024}, -{ 4330, 6127, 5549, 9249, 11226, 28592}, -{ -9586, -8825, 236, 1009, 455, -964}, -{ 6829, 19290, -1018, 200, 1821, 578}, -{ 5196, 957, 10372, 3330, -12800, -127}, -{ -3022, -8193, -14557, 22061, 5920, 1053}, -{ 10982, 25942, -24546, -23278, -11905, -6789}, -{ 22667, -11010, 5736, 2567, 23705, -10253}, -{ -3343, -4233, -5458, 20667, -10843, -3605}, -{ -4131, -3612, 4575, -829, -350, -847}, -{ -3303, 3451, -7398, -11604, 3023, 455}, -{ 3200, -9547, 3202, -22893, 11184, -26466}, -{ -14093, -4117, 15382, 14295, -10915, -20377}, -{ 3807, -11016, 22052, 14370, -15328, -7733}, -{ -6291, -17719, -1560, 12048, -19805, -443}, -{ -6147, -4234, -160, 8363, 22638, 11911}, -{ 19197, 1175, 7422, -9875, -4136, 4704}, -{ -72, -7652, -112, -11955, -3230, 27175}, -{ 3274, 5963, 7501, -17019, 866, -25452}, -{ 737, 1861, 1833, 2022, 2384, 4755}, -{ -5217, 7512, 3323, 2715, 3065, -1606}, -{ 4247, 565, 5629, 2497, 18019, -4920}, -{ -2833, -17920, -8062, 15738, -1018, 2136}, -{ 3050, -19483, 16930, 29835, -10222, 15153}, -{ -11346, 118, -25796, -13761, 15320, -468}, -{ -4824, 4960, -4263, 1575, -10593, 19561}, -{ -8203, -1409, -763, -1139, -607, 1408}, -{ -2203, -11415, 2021, -6388, -2600, 711}, -{ -413, -2511, -216, -3519, -28267, 1719}, -{ -14446, 17050, 13917, 13499, -25762, -16121}, -{ 19228, 7341, -12301, 682, -3791, -199}, -{ -4193, 20746, -15651, 11349, 5860, -824}, -{ -21490, -3546, -3, -1705, -3959, 9213}, -{ 15445, -1876, 2012, -19627, 16228, -4845}, -{ -2867, -3733, -7354, -175, -20119, 11174}, -{ -3571, -24587, 19700, 6654, 979, -654}, -{ 21820, -7430, -6639, -10767, -8362, 15543}, -{ 14827, 17977, -7204, -3409, 1906, -17288}, -{ 3525, -3947, -1415, -2798, 17648, 2082}, -{ -6580, -15255, -17913, 1337, 15338, 21158}, -{ 6210, 9698, 15155, -24666, -22507, -3999}, -{ -1740, -593, 1095, -7779, 25058, 5601}, -{ 21415, -432, -1658, -6898, -1438, -14454}, -{ -6943, 700, -12139, -745, -24187, 22466}, -{ 6287, 3283, 11006, 3844, 19184, 14781}, -{ -22502, 15274, 5443, -2808, -970, -3343}, -{ 3257, -3708, 4744, -8301, 22814, -10208}, -{ 24346, -20970, 19846, 987, -11958, -6277}, -{ 3906, -19701, 13060, -1609, 18641, 7466}, -{ -26409, -22549, 16305, 2014, 10975, 18032}, -{ -7039, 4655, -14818, 18739, 15789, 1296}, -{ 9310, -1681, 14667, -3326, 26535, -11853}, -{ 5728, 5917, 13400, 10020, -2236, -24704}, -{ 1741, -6727, 12695, -22009, 4080, 5450}, -{ -2621, 9393, 21143, -25938, -3162, -2529}, -{ 20672, 18894, -13939, 6990, -8260, 15811}, -{ -23818, 11183, -13639, 11868, 16045, 2630}, -{ 18361, -10220, 829, 856, -1010, 157}, -{ 14400, -4678, 5153, -13290, -27434, -11028}, -{ 21613, 11256, 17453, 7604, 13130, -484}, -{ 7, 1236, 573, 4214, 5576, -3081}, -{ 916, -9092, 1285, -8958, 1185, -28699}, -{ 21587, 23695, 19116, -2885, -14282, -8438}, -{ 23414, -6161, 12978, 3061, -9351, 2236}, -{ -3070, -7344, -20140, 5788, 582, -551}, -{ -3993, 315, -7773, 8224, -28082, -12465}, -{ 13766, -15357, 19205, -20624, 13043, -19247}, -{ 3777, -177, 8029, -1001, 17812, 5162}, -{ -7308, -4327, -18096, -620, -1350, 14932}, -{ 14756, -1221, -12819, -14922, -547, 27125}, -{ 2234, 1708, 2764, 5416, 7986, -25163}, -{ 2873, 3636, 3992, 5344, 10142, 21259}, -{ 1158, 5379, 508, -10514, 290, -1615}, -{ 1114, 24789, 16575, -25168, -298, -2832}, -{ -1107, -6144, -1918, -7791, -2971, -23276}, -{ 4016, 10793, 17317, -4342, -20982, -3383}, -{ -4494, -207, -9951, -3575, 7947, 1154}, -{ -7576, 8117, -14047, 16982, -26457, -27540}, -{ -15164, 16096, -16844, -8886, -23720, 15906}, -{ 24922, 5680, -1874, 420, 132, 117}, -{ -506, -19310, -198, 412, -311, 752}, -{ -1906, 3981, -7688, 16566, -19291, -14722}, -{ -399, -729, -3807, -4196, -12395, 7639}, -{ 3368, 2330, 9092, 23686, -10290, -1705}, -{ -3148, 2596, -7986, 14602, -4807, 16627}, -{ 8057, 1481, 49, 17205, 24869, 7474}, -{ -19304, -513, 11905, 2346, 5588, 3365}, -{ -5063, -21812, 11370, 10896, 4881, 261}, -{ 4794, 20577, 5109, -6025, -8049, -1521}, -{ 8125, -14756, 20639, -14918, 23941, -3650}, -{ 12451, 1381, 3613, 8687, -24002, 4848}, -{ 6726, 10643, 10086, 25217, -25159, -1065}, -{ 6561, 13977, 2911, 21737, 16465, -26050}, -{ -1776, 2575, -19606, -16800, 3032, 6679}, -{ 15012, -17910, -8438, -21554, -27111, 11808}, -{ 3448, -924, -15913, -1135, 5126, -20613}, -{ 7720, 2226, 17463, 5434, 28942, 17552}, -{ 1246, 15614, -11743, 24618, -17539, 3272}, -{ 3215, 17950, 2783, -722, -22672, 5979}, -{ -5678, -3184, -26087, 26034, 6583, 3302}, -{ 20310, -3555, -2715, -444, -1487, 1526}, -{ -20640, -21970, -12207, -25793, 8863, -1036}, -{ 17888, 570, -16102, 8329, -2553, 15275}, -{ -2677, 9950, -1879, 16477, -12762, -29007}, -{ -120, -2221, 219, 97, 365, 35}, -{ 1270, -718, 1480, -2689, 1930, -7527}, -{ 1896, 8750, 1906, 18235, -12692, -6174}, -{ -3733, 13713, -9882, -15960, -1376, -7146}, -{ -10600, 8496, 15967, -8792, 7532, 20439}, -{ 3041, -13457, 1032, -26952, 5787, 24984}, -{ -4590, -8220, -9322, -6112, -17243, 25745}, -{ -17808, 6970, 3752, 626, -114, 2178}, -{ 4449, -4862, 7054, -5404, 4738, -2827}, -{ 4922, -651, 18939, -9866, 848, 1886}, -{ -336, -5410, 7234, 20444, -9583, -600}, -{ 781, -19474, -12648, 6634, 1414, 450}, -{ -3399, -16770, 11107, 13200, -5498, 21663}, -{ -3265, 4859, -5961, 7530, -10837, 28086}, -{ 10350, -12901, 25699, 25640, -639, 351}, -{ 1163, 18763, -5466, -15087, -145, -1377}, -{ -14477, 27229, -31383, -32653, 21439, -2894}, -{ 15420, 18823, 22128, 19398, 22583, 13587}, -{ -10674, 10710, 5089, -4756, 909, -20760}, -{ -12948, -20660, 7410, 2722, 3427, 11585}, -{ -1105, 18374, 19731, -9650, 22442, 19634}, -{ -296, -6798, -14677, 21603, 19796, 21399}, -{ -19350, -7501, 25446, 13144, 8588, -25298}, -{ 3092, -10618, 20896, 9249, -3326, 1796}, -{ -811, 1449, 3106, 4748, 12073, -14262}, -{ -20720, 14275, -4332, -25838, -5781, -21149}, -{ -5132, 10554, -14020, -22150, 2840, -554}, -{ 25533, 17648, 14886, -21074, 2459, 25142}, -{ -9370, -1788, -12862, -5870, -25811, -11023}, -{ 6698, 819, 10313, 166, 27581, 523}, -{ 101, -19388, 3413, 9638, 64, 806}, -{ -2742, -17931, -2576, 22818, 8553, 1126}, -{ 2972, 15203, 1792, 25434, -5728, -17265}, -{ -1419, 1604, 4398, 11452, 1731, 23787}, -{ -5136, 4625, -10653, 27981, 9897, -2510}, -{ -10528, -28033, 2999, -1530, -832, -830}, -{ -11133, -12511, 22206, -7243, -23578, -21698}, -{ 16935, -21892, 1861, -9606, 9432, 19026}, -{ 10277, 9516, 26815, 2010, -4943, -9080}, -{ 5547, -2210, 14270, -15300, -19316, 1822}, -{ -4850, -783, -8959, -3076, -20056, -3197}, -{ 8232, -2794, -17752, 13308, 3229, -991}, -{ -12237, -6581, 10315, -9552, 2260, -20648}, -{ -7000, 5529, -7553, -7490, -10342, -10266}, -{ 3641, 19479, -5972, -19097, -18570, 12805}, -{ 1283, -4164, 4198, -28473, -2498, 1866}, -{ 16047, 26826, -13053, -6316, 985, -1597}, -{ -403, 13680, 6457, 25070, 27124, -20710}, -{ -18070, -1790, -24986, 5953, -954, 26600}, -{ -24224, -15383, 24788, 1953, -1136, 187}, -{ -2289, 12505, -20738, -904, 18324, 21258}, -{ 2658, -6140, 16179, 22276, -556, 2154}, -{ -6087, 13950, -25682, -27713, 4049, -4795}, -{ -21452, 26473, 19435, -9124, 895, 303}, -{ -22200, -26177, -6026, 24729, -22926, -9030}, -{ -14276, -15982, 23732, -22851, 9268, -3841}, -{ 29482, 21923, -6213, 1679, -2059, -1120}, -{ -435, 9802, -3891, 12359, -4288, -18971}, -{ 19768, -86, 2467, 1990, -1021, -5354}, -{ 20986, -8783, -5329, -23562, -4730, 2673}, -{ -5095, 5605, -4629, 19150, 26037, -12259}, -{ 972, 6858, 4551, 27949, -4025, -2272}, -{ 6075, -3260, -4989, -373, -1571, -3730}, -{ -7256, -12992, -8820, -5109, 23054, 5054}, -{ 920, 2615, 7912, -7353, -4905, 20186}, -{ -250, 5454, 3140, 6928, -18723, -2051}, -{ -10299, -4372, 19608, 4879, -661, -1885}, -{ 14816, -8603, -19815, 6135, -21210, 14108}, -{ -11945, -2223, 5018, 11892, 22741, 406}, -{ -13184, -2613, -13256, -22433, -12482, -8380}, -{ 17066, 25267, -2273, 5056, -342, 145}, -{ 8401, -17683, 19112, 10615, -19453, 17083}, -{ 20821, -5700, 12298, -25598, 10391, 7692}, -{ 4550, 15779, 17338, -19379, -4768, 1206}, -{ -7723, 10836, -27164, -11439, 6835, -1776}, -{ 2542, 3199, 4442, 17513, -3711, -914}, -{ 20960, -16774, -5814, 11087, -70, 22961}, -{ 3305, 2919, 6256, -4800, -20966, -3230}, -{ 5924, -16547, 2183, 2733, 3446, -23306}, -{ -6061, -194, -13852, -10971, 19488, 1029}, -{ 4467, -5964, -19004, 1519, -359, 855}, -{ -1581, -7607, 22070, -11580, -10032, 17102}, -{ -12412, 2553, 4324, 22500, 5751, 12170}, -{ -25127, 17996, -6384, 1180, 1182, 9622}, -{ 23462, -8471, -4392, -2669, 7638, -16835}, -{ -5511, -2887, -10757, -20883, 7246, 1053}, -{ 2703, -20602, -7554, 7516, -7740, 5868}, -{ 20670, 21901, 457, 14969, -17657, -11921}, -{ 3603, -1595, -2177, -157, -43, 605}, -{ 2513, 8954, 10527, 22559, -16100, -16041}, -{ 6002, 4951, 6795, -4862, -22400, 18849}, -{ 7590, -1693, -24688, -3404, 14169, 1214}, -{ -4398, -6663, -6870, -10083, -24596, 9253}, -{ 10468, 17751, -7748, 147, -6314, 4419}, -{ 16187, -16557, -4119, 4302, 7625, 5409}, -{ 3303, 2735, 7458, -19902, -2254, -3702}, -{ -2077, 21609, 14870, 12545, -6081, -1764}, -{ 4678, 11740, 2859, 6953, 1919, -3871}, -{ 3522, -21853, -2469, -10453, 18893, -10742}, -{ 3759, -10191, -4866, -2659, -17831, -1242}, -{ 14991, 9351, 11870, -1573, -4848, 22549}, -{ 9509, -27152, 10734, 20851, -26185, -17878}, -{ -7170, -1392, -19495, 12746, 8198, -1988}, -{ 1883, 28158, -846, -7235, 249, 233}, -{ -7200, 669, -371, -2948, 23234, -5635}, -{ 3141, 288, 3223, -1258, -98, -27607}, -{ 17373, -23235, 5110, -11199, -2574, -11487}, -{ -4928, 1518, -5456, 670, -18278, 1951}, -{ 10334, -19865, -4649, 361, -160, -923}, -{ 18732, 14264, -3155, -7485, -3328, 5959}, -{ -3614, 21077, 7276, 3536, 8121, -1528}, -{ -8422, 500, -19182, 18929, 26392, -1039}, -{ 15639, 25668, 8375, 1903, 1945, -11979}, -{ -2716, 3389, 26850, -4587, 1803, 22}, -{ 1177, -655, 1233, -2128, 7844, 1767}, -{ -761, 8209, -19290, -4593, 1923, -343}, -{ -689, -3530, -3267, -3804, -2753, 18566}, -{ -2110, 1962, -1353, 16643, 2765, -23102}, -{ -433, 4905, 302, 13016, 15933, -5905}, -{ 3203, 4126, 11181, -5496, -2529, -1160}, -{ -1091, -6469, -1415, 5682, -268, 583}, -{ -9405, -19572, 6216, 1658, 993, -75}, -{ -1695, -4504, -2289, -4088, -6556, -16577}, -{ 4760, -892, -10902, 6516, 24199, -6011}, -{ -253, 1000, 63, -81, -115, -382}, -{ -1333, 24224, -698, -4667, -2801, -19144}, -{ -876, -28866, -21873, 12677, -6344, 3235}, -{ 16847, 21145, -26172, -3183, -396, 230}, -{ 18296, -7790, -12857, -679, -1473, 5}, -{ -10488, 11429, 25805, -1122, 1401, -438}, -{ 3782, -7429, 26720, 17567, 19257, 12542}, -{ 6332, -746, 12789, 9316, -22542, -5354}, -{ 3418, -22728, 26978, 18303, 1076, 956}, -{ -27315, -2988, 920, 235, 2233, 81}, -{ 6199, 5296, 16093, 14768, -8429, -1112}, -{ -6432, 19244, 9921, -3253, 1278, -954}, -{ 24213, 2049, -22931, 2585, -2410, -4216}, -{ 9286, 14282, -19735, -3985, -2344, 1028}, -{ -20128, 17993, -9458, 23012, -16983, 8625}, -{ -6896, -20730, 3762, 17415, 22341, 19024}, -{ 842, 24181, 25062, -5839, -78, 937}, -{ -621, 19722, -24204, -1962, -14854, -56}, -{ 22766, -5119, 17365, 23868, -19480, -6558}, -{ -2158, 17490, -21435, 3340, -12819, -20295}, -{ -9621, 17325, 715, 2265, -4123, -492}, -{ 9156, 12947, 27303, -21175, -6072, -9457}, -{ -13164, -23269, -14006, -4184, 6978, 2}, -{ 938, -13381, 3520, -24297, 22902, 19589}, -{ -4911, -19774, 19764, -9310, -12650, 3819}, -{ -5462, -4249, -6987, -6260, -13943, -25150}, -{ 9341, 10369, -13862, -6704, 22556, -519}, -{ 6651, 18768, -4855, 12570, 14730, -10209}, -{ -823, 18119, 398, -1582, -116, -363}, -{ -6935, -12694, -28392, 8552, 6961, -239}, -{ -2602, -4704, -1021, 2015, 5129, 23670}, -{ -12559, -8190, -25028, 18544, 14179, 1663}, -{ 3813, 21036, -9620, -5051, -1800, -1087}, -{ -22057, 16675, 14960, 9459, 2786, 16991}, -{ -26040, -19318, -6414, 1104, 5798, -18039}, -{ -1737, 24825, 10417, -11087, 896, -5273}, -{ -1855, 11661, -2803, 24809, -21435, -19792}, -{ -23473, -16729, -5782, 5643, 2636, 4940}, -{ -1724, 4388, -26673, -13695, 10570, -25895}, -{ 15358, -19496, 26242, -18493, 1736, 8054}, -{ 5684, 20890, 4091, -19100, -14588, -10468}, -{ 17260, -16291, 14859, -17711, -19174, 12435}, -{ -27185, -12573, 6743, -562, 976, -257}, -{ 12395, -8618, -22248, -19843, 11013, 7762}, -{ 3799, 11853, -27622, -8473, 1089, -1495}, -{ 4141, -2182, -26720, -735, -774, 1469}, -{ 3125, 13762, 4606, 29257, 18771, -9958}, -{ -17465, -9445, -17562, -2530, -6435, -3726}, -{ -1742, 4351, -6841, -19773, 9627, -10654}, -{ 7251, 3525, 10835, 5601, 25198, -23348}, -{ -10300, -17830, 631, 11640, 2044, -20878}, -{ -873, -8502, -1063, -15674, -10693, 14934}, -{ -15957, 28137, 5268, 477, -1053, 1158}, -{ -1495, -8814, -5764, -24965, 25988, 7907}, -{ -1038, -114, -2308, -1319, -6480, 1472}, -{ 4895, -17897, -25850, 5301, -188, 1581}, -{ 3200, 17225, 4346, 22101, -18543, 22028}, -{ -10250, 545, -10932, 2276, -28070, 8118}, -{ 15343, 2329, 9316, 20537, 14908, 21021}, -{ 6329, 6130, -24508, 837, -8637, -5844}, -{ 7386, -501, 10503, 20131, 11435, -4755}, -{ -2745, 24174, -9274, 15273, -8389, -5835}, -{ 2992, -2864, 6048, -7473, 11687, -19996}, -{ -883, -11954, -9976, -21829, -4436, -27178}, -{ 3458, 19626, 1280, 2597, 19849, 5255}, -{ -5315, 19133, -14518, -8946, 13749, -1352}, -{ 18642, 17655, 11001, 6817, -18418, 6336}, -{ -1697, 2244, -4640, 3948, -12890, -5273}, -{ 20428, 10542, 4170, -1012, 19439, 21691}, -{ -2943, -19735, -4208, 1320, 909, -8897}, -{ 9351, -8066, -2618, -12933, 26582, 3507}, -{ 9705, -22628, 8311, 8167, -13293, 5608}, -{ 3222, 3749, -1508, 165, -52, -196}, -{ 102, -22744, -8832, 903, -11421, -14662}, -{ -120, 5998, 19765, 13401, 3628, 5197}, -{ 8528, 5827, -1066, 774, -39, -166}, -{ 9411, -9476, 9581, -13004, 24456, 24900}, -{ 17878, 2235, -21639, 20478, 4716, -7190}, -{ -2482, 9511, 1611, -21943, 14230, -1289}, -{ 9288, -2291, 23215, -3452, -10842, 11}, -{ 9496, 3041, 5130, -3890, -21219, -22589}, -{ 14262, -9838, 20195, 14019, 91, -17200}, -{ -18591, 980, 17, 821, 120, -574}, -{ 12285, -19269, 13742, 16373, -161, 6025}, -{ -3364, 1530, -4005, 2454, -10872, -23839}, -{ 105, 5085, -260, 5790, -588, 19170}, -{ 4121, 4169, 13439, 14644, 20899, 7434}, -{ -175, 13101, -3704, 23233, 3907, 10106}, -{ -6101, 23467, 5204, -1341, 1599, 13174}, -{ -3217, -3494, 15117, -8387, -11762, -4750}, -{ 1146, 4675, -19378, 14917, -5091, 249}, -{ -21506, 10136, -16473, -13305, 18382, -8601}, -{ 628, 2447, 3344, 3130, -5115, 119}, -{ 17900, -22422, -17633, 21967, -16293, -7676}, -{ 16863, 24214, 5612, -3858, -809, 3822}, -{ -2291, 10091, -2360, -25109, -1226, 312}, -{ 2957, 11256, 26745, -13266, -3455, -1128}, -{ -19762, -2708, 4604, 6355, 1638, 25501}, -{ -19593, -7753, 3159, -85, -489, -1855}, -{ 814, 12510, 19077, -4681, -2610, -1474}, -{ -23408, -19027, 8137, 19878, 7912, -282}, -{ 839, -19652, 11927, 27278, -3211, 2266}, -{ 4020, -1110, 8226, -1274, 20922, 25060}, -{ 26576, 325, -8693, -232, -2218, -699}, -{ -11293, -4200, 1805, -6673, -22940, -1339}, -{ -2005, -15886, -1047, -27687, -13235, 14370}, -{ -22073, 1949, 13175, -15656, -1846, 8055}, -{ 3039, 12025, 7132, -24632, 413, -2347}, -{ -24048, -206, 12459, -6654, -417, -10091}, -{ 18179, -23688, -20515, -16396, 7230, 763}, -{ 5659, -5085, 13878, -23729, -11077, -19587}, -{ 11340, 501, 25040, 7616, -19658, 1605}, -{ -26650, 8878, 10544, 417, 1299, 261}, -{ 14460, 11369, -3263, 9990, 8194, 18111}, -{ 1355, -20838, -9196, -16060, -8559, -730}, -{ -1918, -20937, -18293, -2461, -2651, 4316}, -{ -2810, 24521, -10996, -25721, 308, -1234}, -{ -9075, -17280, -1833, -29342, -24213, -16631}, -{ -2843, 10165, -5339, -2888, 21858, -21340}, -{ -15832, 14849, -23780, 5184, 10113, -20639}, -{ -19535, -11361, 8413, 1486, -23658, -5759}, -{ -7512, 1027, -20794, 13732, 19892, -21934}, -{ -12132, -7022, -19175, -8840, 22125, -16490}, -{ 1937, 5210, -6318, -23788, 13141, 11082}, -{ -205, 6036, -380, 8658, -233, 28020}, -{ -5523, 7477, 7635, 23595, 9763, -2590}, -{ 21658, -28313, -3086, -300, -1032, 1744}, -{ -22352, 16646, 208, 6665, -17400, -3028}, -{ 18482, 9336, -2737, -19372, 407, -4389}, -{ -4913, -17370, 18819, -17654, 13416, 15232}, -{ 7749, 6368, 23135, -18174, 7584, -4248}, -{ -1489, -6523, 586, -10157, 14964, 25568}, -{ 3844, -6156, 4897, -13045, -22526, 5647}, -{ -8491, -2105, -24774, 905, -9326, 1456}, -{ -3040, -1476, 1166, -4428, 11236, 9204}, -{ 3397, -1451, 13598, -15841, 24540, 5819}, -{ 8483, -2993, 21547, -16916, 7741, 24018}, -{ -14932, -23758, -5332, -6664, -4497, 13267}, -{ 19379, 12916, -2142, -737, 21100, -22101}, -{ 3393, -4629, 5735, -18913, -6969, 2687}, -{ 1148, -16147, -21433, -28095, -630, -14449}, -{ 7300, 672, 18530, -17452, -10149, 351}, -{ 11356, -10974, 17212, 4624, 145, 17791}, -{ -711, -3479, -2238, 15887, 2027, 0}, -{ -28048, 1794, -593, -2758, -21852, 11535}, -{ -19683, 4937, 22004, 21523, -3148, 1790}, -{ 813, 8231, 2633, 11981, -3043, 22201}, -{ 8952, -24760, -690, 14873, -2366, -5372}, -{ 8406, -5439, -274, -642, -145, 778}, -{ -6605, 7258, 20780, -23507, -18625, 22782}, -{ -22896, -25488, 10020, -1614, 1508, -1393}, -{ 7607, 407, -24678, -16385, -1804, -4699}, -{ -10592, -19139, 10462, -3747, 8721, -6919}, -{ 13010, 5292, -6230, -4884, -20904, -1797}, -{ 16891, -13770, -465, 19343, -10741, -12959}, -{ 25193, -14799, -5681, -521, -321, -1211}, -{ 6917, -3093, 20183, -26903, -12026, 1295}, -{ 305, 1992, 19457, -985, 25, -521}, -{ 6707, -3698, 8365, -8687, 21921, -27166}, -{ 4668, 5997, 7117, 11696, 24401, -10794}, -{ 744, -9416, 19893, 1963, 7922, -9824}, -{ 3430, 21282, -1736, 10844, 8821, 27015}, -{ -8813, 1521, -24038, 1651, 7838, -1208}, -{ 3911, -11221, 3273, -12541, 7168, 18402}, -{ 21642, 9117, -11536, -5256, 7077, 2382}, -{ 100, 3817, -6713, 1244, 1518, -321}, -{ 7946, -18670, 10667, -4866, 727, 776}, -{ -15883, -8150, -2087, 22739, 1567, -3482}, -{ 4380, -2735, 8469, -7025, -11424, 1317}, -{ 26970, 4393, 7665, 17561, -714, 650}, -{ -16191, -835, 8365, 1795, -14314, 16297}, -{ 4504, -10048, 7662, -26690, -17428, 2580}, -{ 48, -3984, 564, -5871, 2658, -18658}, -{ 12579, -26016, -15642, 2672, -1347, -887}, -{ -4950, 4208, -6811, 2569, -20621, -8658}, -{ -1836, -14818, -5571, -23322, -14800, 25867}, -{ 5434, -28139, -2357, -2883, -570, 2431}, -{ 13096, -2771, 24994, -12496, -24723, -1025}, -{ -5676, -4339, 1908, 18628, -21323, 17366}, -{ 27660, -27897, -15409, 1436, -7112, -2241}, -{ 8019, 3847, 24568, -469, 9674, 10683}, -{ -903, -10149, 1801, -21260, 4795, -8751}, -{ 1122, -9582, 2625, 22791, 956, 882}, -{ 7876, 19075, -9900, -24266, 7496, 9277}, -{ 980, -26764, -5386, 5396, 1086, 1648}, -{ 28838, -1270, -447, 5, -429, -20}, -{ -15283, 6132, 22812, 1252, -9963, 511}, -{ 851, 7925, -457, -12210, 4261, 7579}, -{ -4530, 8452, -1246, 14501, -24951, -5760}, -{ -17814, -10727, 9887, -23929, -13432, 1878}, -{ -15049, 10165, 16491, -14603, -11712, -21156}, -{ -3317, 840, -5683, 22413, 1994, 586}, -{ 23158, -5788, -15043, -10372, -9271, -13523}, -{ -773, -9509, -3993, -24264, 8463, 5804}, -{ -8545, -703, -12440, -3985, -25122, -28147}, -{ -16659, 16001, 2746, 1611, 5097, -1043}, -{ 41, -7181, 19903, 31555, -32237, 13927}, -{ -5658, 845, -12774, 5705, 16695, -86}, -{ 5282, 14875, 27026, 21124, 15776, -10477}, -{ 14712, 19648, -11487, -13361, -20196, -15229}, -{ 8597, -9138, -626, 10891, -6015, 6346}, -{ -1488, -1272, -1479, -1303, -3704, -5485}, -{ -3370, 17871, -6604, 24930, 25886, -3127}, -{ 8416, 27783, -1385, 5350, -4260, 19993}, -{ 5688, 362, 17246, 3809, -3246, 1088}, -{ -105, -29607, 2747, 15223, -167, 3722}, -{ 3502, -3195, 8602, 7772, -1566, -915}, -{ -491, 3257, -2423, 5522, 20606, -100}, -{ -13948, -11368, -15375, -21866, -8520, 12221}, -{ -616, 2424, -2023, 4398, -3805, 8108}, -{ -7204, 21043, 21211, -9395, -19391, 896}, -{ -5737, -15160, -21298, 17066, -1006, -366}, -{ 6261, 3240, -11937, -16213, -15820, 6581}, -{ -3155, 24796, 2733, -1257, -875, -1597}, -{ -20469, 11094, 24071, -8987, 14136, 2220}, -{ -14106, 11959, -22495, 4135, -1055, -5420}, -{ 801, -2655, 60, -5324, -790, 5937}, -{ -7372, -1764, -22433, -26060, 21707, 4178}, -{ -5715, -6648, -14908, 1325, -24044, 1493}, -{ -6024, -12488, 23930, 2950, 1601, 1173}, -{ 19067, 17630, 17929, -10654, 10928, -4958}, -{ 3231, -3284, 27336, 4174, -1683, 497}, -}; - -const int16_t (* const ff_eac3_mantissa_vq[8])[6] = { - NULL, - vq_hebap1, - vq_hebap2, - vq_hebap3, - vq_hebap4, - vq_hebap5, - vq_hebap6, - vq_hebap7, -}; - -/** - * Table E2.14 Frame Exponent Strategy Combinations - */ -const uint8_t ff_eac3_frm_expstr[32][6] = { -{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE}, -{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45}, -{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE}, -{ EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45}, -{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE}, -{ EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45, EXP_D45}, -{ EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_REUSE}, -{ EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE, EXP_D45}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D25, EXP_REUSE}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45, EXP_D45}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_REUSE}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE, EXP_D45}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D25, EXP_REUSE}, -{ EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45, EXP_D45}, -{ EXP_D45, EXP_D45, EXP_D15, EXP_REUSE, EXP_REUSE, EXP_REUSE}, -{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE, EXP_D45}, -{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D25, EXP_REUSE}, -{ EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45, EXP_D45}, -{ EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_REUSE}, -{ EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE, EXP_D45}, -{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE}, -{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45}, -}; - -/** - * Table E.25: Spectral Extension Attenuation Table - * ff_eac3_spx_atten_tab[code][bin]=pow(2.0,(bin+1)*(code+1)/-15.0); - */ -const float ff_eac3_spx_atten_tab[32][3] = { - { 0.954841603910416503f, 0.911722488558216804f, 0.870550563296124125f }, - { 0.911722488558216804f, 0.831237896142787758f, 0.757858283255198995f }, - { 0.870550563296124125f, 0.757858283255198995f, 0.659753955386447100f }, - { 0.831237896142787758f, 0.690956439983888004f, 0.574349177498517438f }, - { 0.793700525984099792f, 0.629960524947436595f, 0.500000000000000000f }, - { 0.757858283255198995f, 0.574349177498517438f, 0.435275281648062062f }, - { 0.723634618720189082f, 0.523647061410313364f, 0.378929141627599553f }, - { 0.690956439983888004f, 0.477420801955208307f, 0.329876977693223550f }, - { 0.659753955386447100f, 0.435275281648062062f, 0.287174588749258719f }, - { 0.629960524947436595f, 0.396850262992049896f, 0.250000000000000000f }, - { 0.601512518041058319f, 0.361817309360094541f, 0.217637640824031003f }, - { 0.574349177498517438f, 0.329876977693223550f, 0.189464570813799776f }, - { 0.548412489847312945f, 0.300756259020529160f, 0.164938488846611775f }, - { 0.523647061410313364f, 0.274206244923656473f, 0.143587294374629387f }, - { 0.500000000000000000f, 0.250000000000000000f, 0.125000000000000000f }, - { 0.477420801955208307f, 0.227930622139554201f, 0.108818820412015502f }, - { 0.455861244279108402f, 0.207809474035696939f, 0.094732285406899888f }, - { 0.435275281648062062f, 0.189464570813799776f, 0.082469244423305887f }, - { 0.415618948071393879f, 0.172739109995972029f, 0.071793647187314694f }, - { 0.396850262992049896f, 0.157490131236859149f, 0.062500000000000000f }, - { 0.378929141627599553f, 0.143587294374629387f, 0.054409410206007751f }, - { 0.361817309360094541f, 0.130911765352578369f, 0.047366142703449930f }, - { 0.345478219991944002f, 0.119355200488802049f, 0.041234622211652958f }, - { 0.329876977693223550f, 0.108818820412015502f, 0.035896823593657347f }, - { 0.314980262473718298f, 0.099212565748012460f, 0.031250000000000000f }, - { 0.300756259020529160f, 0.090454327340023621f, 0.027204705103003875f }, - { 0.287174588749258719f, 0.082469244423305887f, 0.023683071351724965f }, - { 0.274206244923656473f, 0.075189064755132290f, 0.020617311105826479f }, - { 0.261823530705156682f, 0.068551561230914118f, 0.017948411796828673f }, - { 0.250000000000000000f, 0.062500000000000000f, 0.015625000000000000f }, - { 0.238710400977604098f, 0.056982655534888536f, 0.013602352551501938f }, - { 0.227930622139554201f, 0.051952368508924235f, 0.011841535675862483f } -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.h deleted file mode 100644 index 10a67f16d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3_data.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * E-AC-3 tables - * Copyright (c) 2007 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_EAC3_DATA_H -#define AVCODEC_EAC3_DATA_H - -#include - -extern const uint8_t ff_eac3_bits_vs_hebap[20]; -extern const int16_t ff_eac3_gaq_remap_1[12]; -extern const int16_t ff_eac3_gaq_remap_2_4_a[9][2]; -extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2]; - -extern const int16_t (* const ff_eac3_mantissa_vq[8])[6]; -extern const uint8_t ff_eac3_frm_expstr[32][6]; -extern const float ff_eac3_spx_atten_tab[32][3]; - -#endif /* AVCODEC_EAC3_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3dec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3dec.c deleted file mode 100644 index 512c6feca..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/eac3dec.c +++ /dev/null @@ -1,608 +0,0 @@ -/* - * E-AC-3 decoder - * Copyright (c) 2007 Bartlomiej Wolowiec - * Copyright (c) 2008 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* - * There are several features of E-AC-3 that this decoder does not yet support. - * - * Enhanced Coupling - * No known samples exist. If any ever surface, this feature should not be - * too difficult to implement. - * - * Reduced Sample Rates - * No known samples exist. The spec also does not give clear information - * on how this is to be implemented. - * - * Dependent Streams - * Only the independent stream is currently decoded. Any dependent - * streams are skipped. We have only come across two examples of this, and - * they are both just test streams, one for HD-DVD and the other for - * Blu-ray. - * - * Transient Pre-noise Processing - * This is side information which a decoder should use to reduce artifacts - * caused by transients. There are samples which are known to have this - * information, but this decoder currently ignores it. - */ - - -#include "avcodec.h" -#include "internal.h" -#include "aac_ac3_parser.h" -#include "ac3.h" -#include "ac3_parser.h" -#include "ac3dec.h" -#include "ac3dec_data.h" -#include "eac3_data.h" -#include "libavutil/internal.h" - -/** gain adaptive quantization mode */ -typedef enum { - EAC3_GAQ_NO =0, - EAC3_GAQ_12, - EAC3_GAQ_14, - EAC3_GAQ_124 -} EAC3GaqMode; - -#define EAC3_SR_CODE_REDUCED 3 - -void ff_eac3_apply_spectral_extension(AC3DecodeContext *s) -{ - int bin, bnd, ch, i; - uint8_t wrapflag[SPX_MAX_BANDS]={1,0,}, num_copy_sections, copy_sizes[SPX_MAX_BANDS]; - float rms_energy[SPX_MAX_BANDS]; - - /* Set copy index mapping table. Set wrap flags to apply a notch filter at - wrap points later on. */ - bin = s->spx_dst_start_freq; - num_copy_sections = 0; - for (bnd = 0; bnd < s->num_spx_bands; bnd++) { - int copysize; - int bandsize = s->spx_band_sizes[bnd]; - if (bin + bandsize > s->spx_src_start_freq) { - copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; - bin = s->spx_dst_start_freq; - wrapflag[bnd] = 1; - } - for (i = 0; i < bandsize; i += copysize) { - if (bin == s->spx_src_start_freq) { - copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; - bin = s->spx_dst_start_freq; - } - copysize = FFMIN(bandsize - i, s->spx_src_start_freq - bin); - bin += copysize; - } - } - copy_sizes[num_copy_sections++] = bin - s->spx_dst_start_freq; - - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (!s->channel_uses_spx[ch]) - continue; - - /* Copy coeffs from normal bands to extension bands */ - bin = s->spx_src_start_freq; - for (i = 0; i < num_copy_sections; i++) { - memcpy(&s->transform_coeffs[ch][bin], - &s->transform_coeffs[ch][s->spx_dst_start_freq], - copy_sizes[i]*sizeof(float)); - bin += copy_sizes[i]; - } - - /* Calculate RMS energy for each SPX band. */ - bin = s->spx_src_start_freq; - for (bnd = 0; bnd < s->num_spx_bands; bnd++) { - int bandsize = s->spx_band_sizes[bnd]; - float accum = 0.0f; - for (i = 0; i < bandsize; i++) { - float coeff = s->transform_coeffs[ch][bin++]; - accum += coeff * coeff; - } - rms_energy[bnd] = sqrtf(accum / bandsize); - } - - /* Apply a notch filter at transitions between normal and extension - bands and at all wrap points. */ - if (s->spx_atten_code[ch] >= 0) { - const float *atten_tab = ff_eac3_spx_atten_tab[s->spx_atten_code[ch]]; - bin = s->spx_src_start_freq - 2; - for (bnd = 0; bnd < s->num_spx_bands; bnd++) { - if (wrapflag[bnd]) { - float *coeffs = &s->transform_coeffs[ch][bin]; - coeffs[0] *= atten_tab[0]; - coeffs[1] *= atten_tab[1]; - coeffs[2] *= atten_tab[2]; - coeffs[3] *= atten_tab[1]; - coeffs[4] *= atten_tab[0]; - } - bin += s->spx_band_sizes[bnd]; - } - } - - /* Apply noise-blended coefficient scaling based on previously - calculated RMS energy, blending factors, and SPX coordinates for - each band. */ - bin = s->spx_src_start_freq; - for (bnd = 0; bnd < s->num_spx_bands; bnd++) { - float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f / INT32_MIN); - float sscale = s->spx_signal_blend[ch][bnd]; - for (i = 0; i < s->spx_band_sizes[bnd]; i++) { - float noise = nscale * (int32_t)av_lfg_get(&s->dith_state); - s->transform_coeffs[ch][bin] *= sscale; - s->transform_coeffs[ch][bin++] += noise; - } - } - } -} - - -/** lrint(M_SQRT2*cos(2*M_PI/12)*(1<<23)) */ -#define COEFF_0 10273905LL - -/** lrint(M_SQRT2*cos(0*M_PI/12)*(1<<23)) = lrint(M_SQRT2*(1<<23)) */ -#define COEFF_1 11863283LL - -/** lrint(M_SQRT2*cos(5*M_PI/12)*(1<<23)) */ -#define COEFF_2 3070444LL - -/** - * Calculate 6-point IDCT of the pre-mantissas. - * All calculations are 24-bit fixed-point. - */ -static void idct6(int pre_mant[6]) -{ - int tmp; - int even0, even1, even2, odd0, odd1, odd2; - - odd1 = pre_mant[1] - pre_mant[3] - pre_mant[5]; - - even2 = ( pre_mant[2] * COEFF_0) >> 23; - tmp = ( pre_mant[4] * COEFF_1) >> 23; - odd0 = ((pre_mant[1] + pre_mant[5]) * COEFF_2) >> 23; - - even0 = pre_mant[0] + (tmp >> 1); - even1 = pre_mant[0] - tmp; - - tmp = even0; - even0 = tmp + even2; - even2 = tmp - even2; - - tmp = odd0; - odd0 = tmp + pre_mant[1] + pre_mant[3]; - odd2 = tmp + pre_mant[5] - pre_mant[3]; - - pre_mant[0] = even0 + odd0; - pre_mant[1] = even1 + odd1; - pre_mant[2] = even2 + odd2; - pre_mant[3] = even2 - odd2; - pre_mant[4] = even1 - odd1; - pre_mant[5] = even0 - odd0; -} - -void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch) -{ - int bin, blk, gs; - int end_bap, gaq_mode; - GetBitContext *gbc = &s->gbc; - int gaq_gain[AC3_MAX_COEFS]; - - gaq_mode = get_bits(gbc, 2); - end_bap = (gaq_mode < 2) ? 12 : 17; - - /* if GAQ gain is used, decode gain codes for bins with hebap between - 8 and end_bap */ - gs = 0; - if (gaq_mode == EAC3_GAQ_12 || gaq_mode == EAC3_GAQ_14) { - /* read 1-bit GAQ gain codes */ - for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { - if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < end_bap) - gaq_gain[gs++] = get_bits1(gbc) << (gaq_mode-1); - } - } else if (gaq_mode == EAC3_GAQ_124) { - /* read 1.67-bit GAQ gain codes (3 codes in 5 bits) */ - int gc = 2; - for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { - if (s->bap[ch][bin] > 7 && s->bap[ch][bin] < 17) { - if (gc++ == 2) { - int group_code = get_bits(gbc, 5); - if (group_code > 26) { - av_log(s->avctx, AV_LOG_WARNING, "GAQ gain group code out-of-range\n"); - group_code = 26; - } - gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][0]; - gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][1]; - gaq_gain[gs++] = ff_ac3_ungroup_3_in_5_bits_tab[group_code][2]; - gc = 0; - } - } - } - } - - gs=0; - for (bin = s->start_freq[ch]; bin < s->end_freq[ch]; bin++) { - int hebap = s->bap[ch][bin]; - int bits = ff_eac3_bits_vs_hebap[hebap]; - if (!hebap) { - /* zero-mantissa dithering */ - for (blk = 0; blk < 6; blk++) { - s->pre_mantissa[ch][bin][blk] = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000; - } - } else if (hebap < 8) { - /* Vector Quantization */ - int v = get_bits(gbc, bits); - for (blk = 0; blk < 6; blk++) { - s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8; - } - } else { - /* Gain Adaptive Quantization */ - int gbits, log_gain; - if (gaq_mode != EAC3_GAQ_NO && hebap < end_bap) { - log_gain = gaq_gain[gs++]; - } else { - log_gain = 0; - } - gbits = bits - log_gain; - - for (blk = 0; blk < 6; blk++) { - int mant = get_sbits(gbc, gbits); - if (log_gain && mant == -(1 << (gbits-1))) { - /* large mantissa */ - int b; - int mbits = bits - (2 - log_gain); - mant = get_sbits(gbc, mbits); - mant <<= (23 - (mbits - 1)); - /* remap mantissa value to correct for asymmetric quantization */ - if (mant >= 0) - b = 1 << (23 - log_gain); - else - b = ff_eac3_gaq_remap_2_4_b[hebap-8][log_gain-1] << 8; - mant += ((ff_eac3_gaq_remap_2_4_a[hebap-8][log_gain-1] * (int64_t)mant) >> 15) + b; - } else { - /* small mantissa, no GAQ, or Gk=1 */ - mant <<= 24 - bits; - if (!log_gain) { - /* remap mantissa value for no GAQ or Gk=1 */ - mant += (ff_eac3_gaq_remap_1[hebap-8] * (int64_t)mant) >> 15; - } - } - s->pre_mantissa[ch][bin][blk] = mant; - } - } - idct6(s->pre_mantissa[ch][bin]); - } -} - -int ff_eac3_parse_header(AC3DecodeContext *s) -{ - int i, blk, ch; - int ac3_exponent_strategy, parse_aht_info, parse_spx_atten_data; - int parse_transient_proc_info; - int num_cpl_blocks; - GetBitContext *gbc = &s->gbc; - - /* An E-AC-3 stream can have multiple independent streams which the - application can select from. each independent stream can also contain - dependent streams which are used to add or replace channels. */ - if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) { - avpriv_request_sample(s->avctx, "Dependent substream decoding"); - return AAC_AC3_PARSE_ERROR_FRAME_TYPE; - } else if (s->frame_type == EAC3_FRAME_TYPE_RESERVED) { - av_log(s->avctx, AV_LOG_ERROR, "Reserved frame type\n"); - return AAC_AC3_PARSE_ERROR_FRAME_TYPE; - } - - /* The substream id indicates which substream this frame belongs to. each - independent stream has its own substream id, and the dependent streams - associated to an independent stream have matching substream id's. */ - if (s->substreamid) { - /* only decode substream with id=0. skip any additional substreams. */ - avpriv_request_sample(s->avctx, "Additional substreams"); - return AAC_AC3_PARSE_ERROR_FRAME_TYPE; - } - - if (s->bit_alloc_params.sr_code == EAC3_SR_CODE_REDUCED) { - /* The E-AC-3 specification does not tell how to handle reduced sample - rates in bit allocation. The best assumption would be that it is - handled like AC-3 DolbyNet, but we cannot be sure until we have a - sample which utilizes this feature. */ - avpriv_request_sample(s->avctx, "Reduced sampling rate"); - return AVERROR_PATCHWELCOME; - } - skip_bits(gbc, 5); // skip bitstream id - - /* volume control params */ - for (i = 0; i < (s->channel_mode ? 1 : 2); i++) { - skip_bits(gbc, 5); // skip dialog normalization - if (get_bits1(gbc)) { - skip_bits(gbc, 8); // skip compression gain word - } - } - - /* dependent stream channel map */ - if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) { - if (get_bits1(gbc)) { - skip_bits(gbc, 16); // skip custom channel map - } - } - - /* mixing metadata */ - if (get_bits1(gbc)) { - /* center and surround mix levels */ - if (s->channel_mode > AC3_CHMODE_STEREO) { - s->preferred_downmix = get_bits(gbc, 2); - if (s->channel_mode & 1) { - /* if three front channels exist */ - s->center_mix_level_ltrt = get_bits(gbc, 3); - s->center_mix_level = get_bits(gbc, 3); - } - if (s->channel_mode & 4) { - /* if a surround channel exists */ - s->surround_mix_level_ltrt = av_clip(get_bits(gbc, 3), 3, 7); - s->surround_mix_level = av_clip(get_bits(gbc, 3), 3, 7); - } - } - - /* lfe mix level */ - if (s->lfe_on && (s->lfe_mix_level_exists = get_bits1(gbc))) { - s->lfe_mix_level = get_bits(gbc, 5); - } - - /* info for mixing with other streams and substreams */ - if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT) { - for (i = 0; i < (s->channel_mode ? 1 : 2); i++) { - // TODO: apply program scale factor - if (get_bits1(gbc)) { - skip_bits(gbc, 6); // skip program scale factor - } - } - if (get_bits1(gbc)) { - skip_bits(gbc, 6); // skip external program scale factor - } - /* skip mixing parameter data */ - switch(get_bits(gbc, 2)) { - case 1: skip_bits(gbc, 5); break; - case 2: skip_bits(gbc, 12); break; - case 3: { - int mix_data_size = (get_bits(gbc, 5) + 2) << 3; - skip_bits_long(gbc, mix_data_size); - break; - } - } - /* skip pan information for mono or dual mono source */ - if (s->channel_mode < AC3_CHMODE_STEREO) { - for (i = 0; i < (s->channel_mode ? 1 : 2); i++) { - if (get_bits1(gbc)) { - /* note: this is not in the ATSC A/52B specification - reference: ETSI TS 102 366 V1.1.1 - section: E.1.3.1.25 */ - skip_bits(gbc, 8); // skip pan mean direction index - skip_bits(gbc, 6); // skip reserved paninfo bits - } - } - } - /* skip mixing configuration information */ - if (get_bits1(gbc)) { - for (blk = 0; blk < s->num_blocks; blk++) { - if (s->num_blocks == 1 || get_bits1(gbc)) { - skip_bits(gbc, 5); - } - } - } - } - } - - /* informational metadata */ - if (get_bits1(gbc)) { - s->bitstream_mode = get_bits(gbc, 3); - skip_bits(gbc, 2); // skip copyright bit and original bitstream bit - if (s->channel_mode == AC3_CHMODE_STEREO) { - s->dolby_surround_mode = get_bits(gbc, 2); - s->dolby_headphone_mode = get_bits(gbc, 2); - } - if (s->channel_mode >= AC3_CHMODE_2F2R) { - s->dolby_surround_ex_mode = get_bits(gbc, 2); - } - for (i = 0; i < (s->channel_mode ? 1 : 2); i++) { - if (get_bits1(gbc)) { - skip_bits(gbc, 8); // skip mix level, room type, and A/D converter type - } - } - if (s->bit_alloc_params.sr_code != EAC3_SR_CODE_REDUCED) { - skip_bits1(gbc); // skip source sample rate code - } - } - - /* converter synchronization flag - If frames are less than six blocks, this bit should be turned on - once every 6 blocks to indicate the start of a frame set. - reference: RFC 4598, Section 2.1.3 Frame Sets */ - if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && s->num_blocks != 6) { - skip_bits1(gbc); // skip converter synchronization flag - } - - /* original frame size code if this stream was converted from AC-3 */ - if (s->frame_type == EAC3_FRAME_TYPE_AC3_CONVERT && - (s->num_blocks == 6 || get_bits1(gbc))) { - skip_bits(gbc, 6); // skip frame size code - } - - /* additional bitstream info */ - if (get_bits1(gbc)) { - int addbsil = get_bits(gbc, 6); - for (i = 0; i < addbsil + 1; i++) { - skip_bits(gbc, 8); // skip additional bit stream info - } - } - - /* audio frame syntax flags, strategy data, and per-frame data */ - - if (s->num_blocks == 6) { - ac3_exponent_strategy = get_bits1(gbc); - parse_aht_info = get_bits1(gbc); - } else { - /* less than 6 blocks, so use AC-3-style exponent strategy syntax, and - do not use AHT */ - ac3_exponent_strategy = 1; - parse_aht_info = 0; - } - - s->snr_offset_strategy = get_bits(gbc, 2); - parse_transient_proc_info = get_bits1(gbc); - - s->block_switch_syntax = get_bits1(gbc); - if (!s->block_switch_syntax) - memset(s->block_switch, 0, sizeof(s->block_switch)); - - s->dither_flag_syntax = get_bits1(gbc); - if (!s->dither_flag_syntax) { - for (ch = 1; ch <= s->fbw_channels; ch++) - s->dither_flag[ch] = 1; - } - s->dither_flag[CPL_CH] = s->dither_flag[s->lfe_ch] = 0; - - s->bit_allocation_syntax = get_bits1(gbc); - if (!s->bit_allocation_syntax) { - /* set default bit allocation parameters */ - s->bit_alloc_params.slow_decay = ff_ac3_slow_decay_tab[2]; - s->bit_alloc_params.fast_decay = ff_ac3_fast_decay_tab[1]; - s->bit_alloc_params.slow_gain = ff_ac3_slow_gain_tab [1]; - s->bit_alloc_params.db_per_bit = ff_ac3_db_per_bit_tab[2]; - s->bit_alloc_params.floor = ff_ac3_floor_tab [7]; - } - - s->fast_gain_syntax = get_bits1(gbc); - s->dba_syntax = get_bits1(gbc); - s->skip_syntax = get_bits1(gbc); - parse_spx_atten_data = get_bits1(gbc); - - /* coupling strategy occurrence and coupling use per block */ - num_cpl_blocks = 0; - if (s->channel_mode > 1) { - for (blk = 0; blk < s->num_blocks; blk++) { - s->cpl_strategy_exists[blk] = (!blk || get_bits1(gbc)); - if (s->cpl_strategy_exists[blk]) { - s->cpl_in_use[blk] = get_bits1(gbc); - } else { - s->cpl_in_use[blk] = s->cpl_in_use[blk-1]; - } - num_cpl_blocks += s->cpl_in_use[blk]; - } - } else { - memset(s->cpl_in_use, 0, sizeof(s->cpl_in_use)); - } - - /* exponent strategy data */ - if (ac3_exponent_strategy) { - /* AC-3-style exponent strategy syntax */ - for (blk = 0; blk < s->num_blocks; blk++) { - for (ch = !s->cpl_in_use[blk]; ch <= s->fbw_channels; ch++) { - s->exp_strategy[blk][ch] = get_bits(gbc, 2); - } - } - } else { - /* LUT-based exponent strategy syntax */ - for (ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++) { - int frmchexpstr = get_bits(gbc, 5); - for (blk = 0; blk < 6; blk++) { - s->exp_strategy[blk][ch] = ff_eac3_frm_expstr[frmchexpstr][blk]; - } - } - } - /* LFE exponent strategy */ - if (s->lfe_on) { - for (blk = 0; blk < s->num_blocks; blk++) { - s->exp_strategy[blk][s->lfe_ch] = get_bits1(gbc); - } - } - /* original exponent strategies if this stream was converted from AC-3 */ - if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT && - (s->num_blocks == 6 || get_bits1(gbc))) { - skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy - } - - /* determine which channels use AHT */ - if (parse_aht_info) { - /* For AHT to be used, all non-zero blocks must reuse exponents from - the first block. Furthermore, for AHT to be used in the coupling - channel, all blocks must use coupling and use the same coupling - strategy. */ - s->channel_uses_aht[CPL_CH]=0; - for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) { - int use_aht = 1; - for (blk = 1; blk < 6; blk++) { - if ((s->exp_strategy[blk][ch] != EXP_REUSE) || - (!ch && s->cpl_strategy_exists[blk])) { - use_aht = 0; - break; - } - } - s->channel_uses_aht[ch] = use_aht && get_bits1(gbc); - } - } else { - memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht)); - } - - /* per-frame SNR offset */ - if (!s->snr_offset_strategy) { - int csnroffst = (get_bits(gbc, 6) - 15) << 4; - int snroffst = (csnroffst + get_bits(gbc, 4)) << 2; - for (ch = 0; ch <= s->channels; ch++) - s->snr_offset[ch] = snroffst; - } - - /* transient pre-noise processing data */ - if (parse_transient_proc_info) { - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (get_bits1(gbc)) { // channel in transient processing - skip_bits(gbc, 10); // skip transient processing location - skip_bits(gbc, 8); // skip transient processing length - } - } - } - - /* spectral extension attenuation data */ - for (ch = 1; ch <= s->fbw_channels; ch++) { - if (parse_spx_atten_data && get_bits1(gbc)) { - s->spx_atten_code[ch] = get_bits(gbc, 5); - } else { - s->spx_atten_code[ch] = -1; - } - } - - /* block start information */ - if (s->num_blocks > 1 && get_bits1(gbc)) { - /* reference: Section E2.3.2.27 - nblkstrtbits = (numblks - 1) * (4 + ceiling(log2(words_per_frame))) - The spec does not say what this data is or what it's used for. - It is likely the offset of each block within the frame. */ - int block_start_bits = (s->num_blocks-1) * (4 + av_log2(s->frame_size-2)); - skip_bits_long(gbc, block_start_bits); - avpriv_request_sample(s->avctx, "Block start info"); - } - - /* syntax state initialization */ - for (ch = 1; ch <= s->fbw_channels; ch++) { - s->first_spx_coords[ch] = 1; - s->first_cpl_coords[ch] = 1; - } - s->first_cpl_leak = 1; - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.c deleted file mode 100644 index 755e8b9d3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.c +++ /dev/null @@ -1,1301 +0,0 @@ -/* - * Error resilience / concealment - * - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Error resilience / concealment. - */ - -#include - -#include "libavutil/internal.h" -#include "avcodec.h" -#include "error_resilience.h" -#include "mpegvideo.h" -#include "rectangle.h" -#include "thread.h" -#include "version.h" - -/** - * @param stride the number of MVs to get to the next row - * @param mv_step the number of MVs per row or column in a macroblock - */ -static void set_mv_strides(ERContext *s, int *mv_step, int *stride) -{ - if (s->avctx->codec_id == AV_CODEC_ID_H264) { - av_assert0(s->quarter_sample); - *mv_step = 4; - *stride = s->mb_width * 4; - } else { - *mv_step = 2; - *stride = s->b8_stride; - } -} - -/** - * Replace the current MB with a flat dc-only version. - */ -static void put_dc(ERContext *s, uint8_t *dest_y, uint8_t *dest_cb, - uint8_t *dest_cr, int mb_x, int mb_y) -{ - int *linesize = s->cur_pic->f.linesize; - int dc, dcu, dcv, y, i; - for (i = 0; i < 4; i++) { - dc = s->dc_val[0][mb_x * 2 + (i & 1) + (mb_y * 2 + (i >> 1)) * s->b8_stride]; - if (dc < 0) - dc = 0; - else if (dc > 2040) - dc = 2040; - for (y = 0; y < 8; y++) { - int x; - for (x = 0; x < 8; x++) - dest_y[x + (i & 1) * 8 + (y + (i >> 1) * 8) * linesize[0]] = dc / 8; - } - } - dcu = s->dc_val[1][mb_x + mb_y * s->mb_stride]; - dcv = s->dc_val[2][mb_x + mb_y * s->mb_stride]; - if (dcu < 0) - dcu = 0; - else if (dcu > 2040) - dcu = 2040; - if (dcv < 0) - dcv = 0; - else if (dcv > 2040) - dcv = 2040; - for (y = 0; y < 8; y++) { - int x; - for (x = 0; x < 8; x++) { - dest_cb[x + y * linesize[1]] = dcu / 8; - dest_cr[x + y * linesize[2]] = dcv / 8; - } - } -} - -static void filter181(int16_t *data, int width, int height, int stride) -{ - int x, y; - - /* horizontal filter */ - for (y = 1; y < height - 1; y++) { - int prev_dc = data[0 + y * stride]; - - for (x = 1; x < width - 1; x++) { - int dc; - dc = -prev_dc + - data[x + y * stride] * 8 - - data[x + 1 + y * stride]; - dc = (dc * 10923 + 32768) >> 16; - prev_dc = data[x + y * stride]; - data[x + y * stride] = dc; - } - } - - /* vertical filter */ - for (x = 1; x < width - 1; x++) { - int prev_dc = data[x]; - - for (y = 1; y < height - 1; y++) { - int dc; - - dc = -prev_dc + - data[x + y * stride] * 8 - - data[x + (y + 1) * stride]; - dc = (dc * 10923 + 32768) >> 16; - prev_dc = data[x + y * stride]; - data[x + y * stride] = dc; - } - } -} - -/** - * guess the dc of blocks which do not have an undamaged dc - * @param w width in 8 pixel blocks - * @param h height in 8 pixel blocks - */ -static void guess_dc(ERContext *s, int16_t *dc, int w, - int h, int stride, int is_luma) -{ - int b_x, b_y; - int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4); - uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4); - - if(!col || !dist) { - av_log(s->avctx, AV_LOG_ERROR, "guess_dc() is out of memory\n"); - goto fail; - } - - for(b_y=0; b_y>is_luma) + (b_y>>is_luma)*s->mb_stride; - int error_j= s->error_status_table[mb_index_j]; - int intra_j = IS_INTRA(s->cur_pic->mb_type[mb_index_j]); - if(intra_j==0 || !(error_j&ER_DC_ERROR)){ - color= dc[b_x + b_y*stride]; - distance= b_x; - } - col [b_x + b_y*stride][1]= color; - dist[b_x + b_y*stride][1]= distance >= 0 ? b_x-distance : 9999; - } - color= 1024; - distance= -1; - for(b_x=w-1; b_x>=0; b_x--){ - int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride; - int error_j= s->error_status_table[mb_index_j]; - int intra_j = IS_INTRA(s->cur_pic->mb_type[mb_index_j]); - if(intra_j==0 || !(error_j&ER_DC_ERROR)){ - color= dc[b_x + b_y*stride]; - distance= b_x; - } - col [b_x + b_y*stride][0]= color; - dist[b_x + b_y*stride][0]= distance >= 0 ? distance-b_x : 9999; - } - } - for(b_x=0; b_x>is_luma) + (b_y>>is_luma)*s->mb_stride; - int error_j= s->error_status_table[mb_index_j]; - int intra_j = IS_INTRA(s->cur_pic->mb_type[mb_index_j]); - if(intra_j==0 || !(error_j&ER_DC_ERROR)){ - color= dc[b_x + b_y*stride]; - distance= b_y; - } - col [b_x + b_y*stride][3]= color; - dist[b_x + b_y*stride][3]= distance >= 0 ? b_y-distance : 9999; - } - color= 1024; - distance= -1; - for(b_y=h-1; b_y>=0; b_y--){ - int mb_index_j= (b_x>>is_luma) + (b_y>>is_luma)*s->mb_stride; - int error_j= s->error_status_table[mb_index_j]; - int intra_j = IS_INTRA(s->cur_pic->mb_type[mb_index_j]); - if(intra_j==0 || !(error_j&ER_DC_ERROR)){ - color= dc[b_x + b_y*stride]; - distance= b_y; - } - col [b_x + b_y*stride][2]= color; - dist[b_x + b_y*stride][2]= distance >= 0 ? distance-b_y : 9999; - } - } - - for (b_y = 0; b_y < h; b_y++) { - for (b_x = 0; b_x < w; b_x++) { - int mb_index, error, j; - int64_t guess, weight_sum; - mb_index = (b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride; - error = s->error_status_table[mb_index]; - - if (IS_INTER(s->cur_pic->mb_type[mb_index])) - continue; // inter - if (!(error & ER_DC_ERROR)) - continue; // dc-ok - - weight_sum = 0; - guess = 0; - for (j = 0; j < 4; j++) { - int64_t weight = 256 * 256 * 256 * 16 / FFMAX(dist[b_x + b_y*stride][j], 1); - guess += weight*(int64_t)col[b_x + b_y*stride][j]; - weight_sum += weight; - } - guess = (guess + weight_sum / 2) / weight_sum; - dc[b_x + b_y * stride] = guess; - } - } - -fail: - av_freep(&col); - av_freep(&dist); -} - -/** - * simple horizontal deblocking filter used for error resilience - * @param w width in 8 pixel blocks - * @param h height in 8 pixel blocks - */ -static void h_block_filter(ERContext *s, uint8_t *dst, int w, - int h, int stride, int is_luma) -{ - int b_x, b_y, mvx_stride, mvy_stride; - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - set_mv_strides(s, &mvx_stride, &mvy_stride); - mvx_stride >>= is_luma; - mvy_stride *= mvx_stride; - - for (b_y = 0; b_y < h; b_y++) { - for (b_x = 0; b_x < w - 1; b_x++) { - int y; - int left_status = s->error_status_table[( b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride]; - int right_status = s->error_status_table[((b_x + 1) >> is_luma) + (b_y >> is_luma) * s->mb_stride]; - int left_intra = IS_INTRA(s->cur_pic->mb_type[( b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride]); - int right_intra = IS_INTRA(s->cur_pic->mb_type[((b_x + 1) >> is_luma) + (b_y >> is_luma) * s->mb_stride]); - int left_damage = left_status & ER_MB_ERROR; - int right_damage = right_status & ER_MB_ERROR; - int offset = b_x * 8 + b_y * stride * 8; - int16_t *left_mv = s->cur_pic->motion_val[0][mvy_stride * b_y + mvx_stride * b_x]; - int16_t *right_mv = s->cur_pic->motion_val[0][mvy_stride * b_y + mvx_stride * (b_x + 1)]; - if (!(left_damage || right_damage)) - continue; // both undamaged - if ((!left_intra) && (!right_intra) && - FFABS(left_mv[0] - right_mv[0]) + - FFABS(left_mv[1] + right_mv[1]) < 2) - continue; - - for (y = 0; y < 8; y++) { - int a, b, c, d; - - a = dst[offset + 7 + y * stride] - dst[offset + 6 + y * stride]; - b = dst[offset + 8 + y * stride] - dst[offset + 7 + y * stride]; - c = dst[offset + 9 + y * stride] - dst[offset + 8 + y * stride]; - - d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1); - d = FFMAX(d, 0); - if (b < 0) - d = -d; - - if (d == 0) - continue; - - if (!(left_damage && right_damage)) - d = d * 16 / 9; - - if (left_damage) { - dst[offset + 7 + y * stride] = cm[dst[offset + 7 + y * stride] + ((d * 7) >> 4)]; - dst[offset + 6 + y * stride] = cm[dst[offset + 6 + y * stride] + ((d * 5) >> 4)]; - dst[offset + 5 + y * stride] = cm[dst[offset + 5 + y * stride] + ((d * 3) >> 4)]; - dst[offset + 4 + y * stride] = cm[dst[offset + 4 + y * stride] + ((d * 1) >> 4)]; - } - if (right_damage) { - dst[offset + 8 + y * stride] = cm[dst[offset + 8 + y * stride] - ((d * 7) >> 4)]; - dst[offset + 9 + y * stride] = cm[dst[offset + 9 + y * stride] - ((d * 5) >> 4)]; - dst[offset + 10+ y * stride] = cm[dst[offset + 10 + y * stride] - ((d * 3) >> 4)]; - dst[offset + 11+ y * stride] = cm[dst[offset + 11 + y * stride] - ((d * 1) >> 4)]; - } - } - } - } -} - -/** - * simple vertical deblocking filter used for error resilience - * @param w width in 8 pixel blocks - * @param h height in 8 pixel blocks - */ -static void v_block_filter(ERContext *s, uint8_t *dst, int w, int h, - int stride, int is_luma) -{ - int b_x, b_y, mvx_stride, mvy_stride; - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - set_mv_strides(s, &mvx_stride, &mvy_stride); - mvx_stride >>= is_luma; - mvy_stride *= mvx_stride; - - for (b_y = 0; b_y < h - 1; b_y++) { - for (b_x = 0; b_x < w; b_x++) { - int x; - int top_status = s->error_status_table[(b_x >> is_luma) + (b_y >> is_luma) * s->mb_stride]; - int bottom_status = s->error_status_table[(b_x >> is_luma) + ((b_y + 1) >> is_luma) * s->mb_stride]; - int top_intra = IS_INTRA(s->cur_pic->mb_type[(b_x >> is_luma) + ( b_y >> is_luma) * s->mb_stride]); - int bottom_intra = IS_INTRA(s->cur_pic->mb_type[(b_x >> is_luma) + ((b_y + 1) >> is_luma) * s->mb_stride]); - int top_damage = top_status & ER_MB_ERROR; - int bottom_damage = bottom_status & ER_MB_ERROR; - int offset = b_x * 8 + b_y * stride * 8; - - int16_t *top_mv = s->cur_pic->motion_val[0][mvy_stride * b_y + mvx_stride * b_x]; - int16_t *bottom_mv = s->cur_pic->motion_val[0][mvy_stride * (b_y + 1) + mvx_stride * b_x]; - - if (!(top_damage || bottom_damage)) - continue; // both undamaged - - if ((!top_intra) && (!bottom_intra) && - FFABS(top_mv[0] - bottom_mv[0]) + - FFABS(top_mv[1] + bottom_mv[1]) < 2) - continue; - - for (x = 0; x < 8; x++) { - int a, b, c, d; - - a = dst[offset + x + 7 * stride] - dst[offset + x + 6 * stride]; - b = dst[offset + x + 8 * stride] - dst[offset + x + 7 * stride]; - c = dst[offset + x + 9 * stride] - dst[offset + x + 8 * stride]; - - d = FFABS(b) - ((FFABS(a) + FFABS(c) + 1) >> 1); - d = FFMAX(d, 0); - if (b < 0) - d = -d; - - if (d == 0) - continue; - - if (!(top_damage && bottom_damage)) - d = d * 16 / 9; - - if (top_damage) { - dst[offset + x + 7 * stride] = cm[dst[offset + x + 7 * stride] + ((d * 7) >> 4)]; - dst[offset + x + 6 * stride] = cm[dst[offset + x + 6 * stride] + ((d * 5) >> 4)]; - dst[offset + x + 5 * stride] = cm[dst[offset + x + 5 * stride] + ((d * 3) >> 4)]; - dst[offset + x + 4 * stride] = cm[dst[offset + x + 4 * stride] + ((d * 1) >> 4)]; - } - if (bottom_damage) { - dst[offset + x + 8 * stride] = cm[dst[offset + x + 8 * stride] - ((d * 7) >> 4)]; - dst[offset + x + 9 * stride] = cm[dst[offset + x + 9 * stride] - ((d * 5) >> 4)]; - dst[offset + x + 10 * stride] = cm[dst[offset + x + 10 * stride] - ((d * 3) >> 4)]; - dst[offset + x + 11 * stride] = cm[dst[offset + x + 11 * stride] - ((d * 1) >> 4)]; - } - } - } - } -} - -static void guess_mv(ERContext *s) -{ - uint8_t *fixed = s->er_temp_buffer; -#define MV_FROZEN 3 -#define MV_CHANGED 2 -#define MV_UNCHANGED 1 - const int mb_stride = s->mb_stride; - const int mb_width = s->mb_width; - const int mb_height = s->mb_height; - int i, depth, num_avail; - int mb_x, mb_y, mot_step, mot_stride; - - set_mv_strides(s, &mot_step, &mot_stride); - - num_avail = 0; - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - int f = 0; - int error = s->error_status_table[mb_xy]; - - if (IS_INTRA(s->cur_pic->mb_type[mb_xy])) - f = MV_FROZEN; // intra // FIXME check - if (!(error & ER_MV_ERROR)) - f = MV_FROZEN; // inter with undamaged MV - - fixed[mb_xy] = f; - if (f == MV_FROZEN) - num_avail++; - else if(s->last_pic->f.data[0] && s->last_pic->motion_val[0]){ - const int mb_y= mb_xy / s->mb_stride; - const int mb_x= mb_xy % s->mb_stride; - const int mot_index= (mb_x + mb_y*mot_stride) * mot_step; - s->cur_pic->motion_val[0][mot_index][0]= s->last_pic->motion_val[0][mot_index][0]; - s->cur_pic->motion_val[0][mot_index][1]= s->last_pic->motion_val[0][mot_index][1]; - s->cur_pic->ref_index[0][4*mb_xy] = s->last_pic->ref_index[0][4*mb_xy]; - } - } - - if ((!(s->avctx->error_concealment&FF_EC_GUESS_MVS)) || - num_avail <= mb_width / 2) { - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - const int mb_xy = mb_x + mb_y * s->mb_stride; - int mv_dir = (s->last_pic && s->last_pic->f.data[0]) ? MV_DIR_FORWARD : MV_DIR_BACKWARD; - - if (IS_INTRA(s->cur_pic->mb_type[mb_xy])) - continue; - if (!(s->error_status_table[mb_xy] & ER_MV_ERROR)) - continue; - - s->mv[0][0][0] = 0; - s->mv[0][0][1] = 0; - s->decode_mb(s->opaque, 0, mv_dir, MV_TYPE_16X16, &s->mv, - mb_x, mb_y, 0, 0); - } - } - return; - } - - for (depth = 0; ; depth++) { - int changed, pass, none_left; - - none_left = 1; - changed = 1; - for (pass = 0; (changed || pass < 2) && pass < 10; pass++) { - int mb_x, mb_y; - int score_sum = 0; - - changed = 0; - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - const int mb_xy = mb_x + mb_y * s->mb_stride; - int mv_predictor[8][2] = { { 0 } }; - int ref[8] = { 0 }; - int pred_count = 0; - int j; - int best_score = 256 * 256 * 256 * 64; - int best_pred = 0; - const int mot_index = (mb_x + mb_y * mot_stride) * mot_step; - int prev_x, prev_y, prev_ref; - - if ((mb_x ^ mb_y ^ pass) & 1) - continue; - - if (fixed[mb_xy] == MV_FROZEN) - continue; - av_assert1(!IS_INTRA(s->cur_pic->mb_type[mb_xy])); - av_assert1(s->last_pic && s->last_pic->f.data[0]); - - j = 0; - if (mb_x > 0 && fixed[mb_xy - 1] == MV_FROZEN) - j = 1; - if (mb_x + 1 < mb_width && fixed[mb_xy + 1] == MV_FROZEN) - j = 1; - if (mb_y > 0 && fixed[mb_xy - mb_stride] == MV_FROZEN) - j = 1; - if (mb_y + 1 < mb_height && fixed[mb_xy + mb_stride] == MV_FROZEN) - j = 1; - if (j == 0) - continue; - - j = 0; - if (mb_x > 0 && fixed[mb_xy - 1 ] == MV_CHANGED) - j = 1; - if (mb_x + 1 < mb_width && fixed[mb_xy + 1 ] == MV_CHANGED) - j = 1; - if (mb_y > 0 && fixed[mb_xy - mb_stride] == MV_CHANGED) - j = 1; - if (mb_y + 1 < mb_height && fixed[mb_xy + mb_stride] == MV_CHANGED) - j = 1; - if (j == 0 && pass > 1) - continue; - - none_left = 0; - - if (mb_x > 0 && fixed[mb_xy - 1]) { - mv_predictor[pred_count][0] = - s->cur_pic->motion_val[0][mot_index - mot_step][0]; - mv_predictor[pred_count][1] = - s->cur_pic->motion_val[0][mot_index - mot_step][1]; - ref[pred_count] = - s->cur_pic->ref_index[0][4 * (mb_xy - 1)]; - pred_count++; - } - if (mb_x + 1 < mb_width && fixed[mb_xy + 1]) { - mv_predictor[pred_count][0] = - s->cur_pic->motion_val[0][mot_index + mot_step][0]; - mv_predictor[pred_count][1] = - s->cur_pic->motion_val[0][mot_index + mot_step][1]; - ref[pred_count] = - s->cur_pic->ref_index[0][4 * (mb_xy + 1)]; - pred_count++; - } - if (mb_y > 0 && fixed[mb_xy - mb_stride]) { - mv_predictor[pred_count][0] = - s->cur_pic->motion_val[0][mot_index - mot_stride * mot_step][0]; - mv_predictor[pred_count][1] = - s->cur_pic->motion_val[0][mot_index - mot_stride * mot_step][1]; - ref[pred_count] = - s->cur_pic->ref_index[0][4 * (mb_xy - s->mb_stride)]; - pred_count++; - } - if (mb_y + 1cur_pic->motion_val[0][mot_index + mot_stride * mot_step][0]; - mv_predictor[pred_count][1] = - s->cur_pic->motion_val[0][mot_index + mot_stride * mot_step][1]; - ref[pred_count] = - s->cur_pic->ref_index[0][4 * (mb_xy + s->mb_stride)]; - pred_count++; - } - if (pred_count == 0) - continue; - - if (pred_count > 1) { - int sum_x = 0, sum_y = 0, sum_r = 0; - int max_x, max_y, min_x, min_y, max_r, min_r; - - for (j = 0; j < pred_count; j++) { - sum_x += mv_predictor[j][0]; - sum_y += mv_predictor[j][1]; - sum_r += ref[j]; - if (j && ref[j] != ref[j - 1]) - goto skip_mean_and_median; - } - - /* mean */ - mv_predictor[pred_count][0] = sum_x / j; - mv_predictor[pred_count][1] = sum_y / j; - ref[pred_count] = sum_r / j; - - /* median */ - if (pred_count >= 3) { - min_y = min_x = min_r = 99999; - max_y = max_x = max_r = -99999; - } else { - min_x = min_y = max_x = max_y = min_r = max_r = 0; - } - for (j = 0; j < pred_count; j++) { - max_x = FFMAX(max_x, mv_predictor[j][0]); - max_y = FFMAX(max_y, mv_predictor[j][1]); - max_r = FFMAX(max_r, ref[j]); - min_x = FFMIN(min_x, mv_predictor[j][0]); - min_y = FFMIN(min_y, mv_predictor[j][1]); - min_r = FFMIN(min_r, ref[j]); - } - mv_predictor[pred_count + 1][0] = sum_x - max_x - min_x; - mv_predictor[pred_count + 1][1] = sum_y - max_y - min_y; - ref[pred_count + 1] = sum_r - max_r - min_r; - - if (pred_count == 4) { - mv_predictor[pred_count + 1][0] /= 2; - mv_predictor[pred_count + 1][1] /= 2; - ref[pred_count + 1] /= 2; - } - pred_count += 2; - } - -skip_mean_and_median: - /* zero MV */ - pred_count++; - - if (!fixed[mb_xy] && 0) { - if (s->avctx->codec_id == AV_CODEC_ID_H264) { - // FIXME - } else { - ff_thread_await_progress(&s->last_pic->tf, - mb_y, 0); - } - if (!s->last_pic->motion_val[0] || - !s->last_pic->ref_index[0]) - goto skip_last_mv; - prev_x = s->last_pic->motion_val[0][mot_index][0]; - prev_y = s->last_pic->motion_val[0][mot_index][1]; - prev_ref = s->last_pic->ref_index[0][4 * mb_xy]; - } else { - prev_x = s->cur_pic->motion_val[0][mot_index][0]; - prev_y = s->cur_pic->motion_val[0][mot_index][1]; - prev_ref = s->cur_pic->ref_index[0][4 * mb_xy]; - } - - /* last MV */ - mv_predictor[pred_count][0] = prev_x; - mv_predictor[pred_count][1] = prev_y; - ref[pred_count] = prev_ref; - pred_count++; - -skip_last_mv: - - for (j = 0; j < pred_count; j++) { - int *linesize = s->cur_pic->f.linesize; - int score = 0; - uint8_t *src = s->cur_pic->f.data[0] + - mb_x * 16 + mb_y * 16 * linesize[0]; - - s->cur_pic->motion_val[0][mot_index][0] = - s->mv[0][0][0] = mv_predictor[j][0]; - s->cur_pic->motion_val[0][mot_index][1] = - s->mv[0][0][1] = mv_predictor[j][1]; - - // predictor intra or otherwise not available - if (ref[j] < 0) - continue; - - s->decode_mb(s->opaque, ref[j], MV_DIR_FORWARD, - MV_TYPE_16X16, &s->mv, mb_x, mb_y, 0, 0); - - if (mb_x > 0 && fixed[mb_xy - 1]) { - int k; - for (k = 0; k < 16; k++) - score += FFABS(src[k * linesize[0] - 1] - - src[k * linesize[0]]); - } - if (mb_x + 1 < mb_width && fixed[mb_xy + 1]) { - int k; - for (k = 0; k < 16; k++) - score += FFABS(src[k * linesize[0] + 15] - - src[k * linesize[0] + 16]); - } - if (mb_y > 0 && fixed[mb_xy - mb_stride]) { - int k; - for (k = 0; k < 16; k++) - score += FFABS(src[k - linesize[0]] - src[k]); - } - if (mb_y + 1 < mb_height && fixed[mb_xy + mb_stride]) { - int k; - for (k = 0; k < 16; k++) - score += FFABS(src[k + linesize[0] * 15] - - src[k + linesize[0] * 16]); - } - - if (score <= best_score) { // <= will favor the last MV - best_score = score; - best_pred = j; - } - } - score_sum += best_score; - s->mv[0][0][0] = mv_predictor[best_pred][0]; - s->mv[0][0][1] = mv_predictor[best_pred][1]; - - for (i = 0; i < mot_step; i++) - for (j = 0; j < mot_step; j++) { - s->cur_pic->motion_val[0][mot_index + i + j * mot_stride][0] = s->mv[0][0][0]; - s->cur_pic->motion_val[0][mot_index + i + j * mot_stride][1] = s->mv[0][0][1]; - } - - s->decode_mb(s->opaque, ref[best_pred], MV_DIR_FORWARD, - MV_TYPE_16X16, &s->mv, mb_x, mb_y, 0, 0); - - - if (s->mv[0][0][0] != prev_x || s->mv[0][0][1] != prev_y) { - fixed[mb_xy] = MV_CHANGED; - changed++; - } else - fixed[mb_xy] = MV_UNCHANGED; - } - } - } - - if (none_left) - return; - - for (i = 0; i < s->mb_num; i++) { - int mb_xy = s->mb_index2xy[i]; - if (fixed[mb_xy]) - fixed[mb_xy] = MV_FROZEN; - } - } -} - -static int is_intra_more_likely(ERContext *s) -{ - int is_intra_likely, i, j, undamaged_count, skip_amount, mb_x, mb_y; - - if (!s->last_pic || !s->last_pic->f.data[0]) - return 1; // no previous frame available -> use spatial prediction - - undamaged_count = 0; - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - const int error = s->error_status_table[mb_xy]; - if (!((error & ER_DC_ERROR) && (error & ER_MV_ERROR))) - undamaged_count++; - } - - if (s->avctx->codec_id == AV_CODEC_ID_H264 && s->ref_count <= 0) - return 1; - - if (undamaged_count < 5) - return 0; // almost all MBs damaged -> use temporal prediction - - // prevent dsp.sad() check, that requires access to the image - if (CONFIG_XVMC && - s->avctx->hwaccel && s->avctx->hwaccel->decode_mb && - s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I) - return 1; - - skip_amount = FFMAX(undamaged_count / 50, 1); // check only up to 50 MBs - is_intra_likely = 0; - - j = 0; - for (mb_y = 0; mb_y < s->mb_height - 1; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - int error; - const int mb_xy = mb_x + mb_y * s->mb_stride; - - error = s->error_status_table[mb_xy]; - if ((error & ER_DC_ERROR) && (error & ER_MV_ERROR)) - continue; // skip damaged - - j++; - // skip a few to speed things up - if ((j % skip_amount) != 0) - continue; - - if (s->cur_pic->f.pict_type == AV_PICTURE_TYPE_I) { - int *linesize = s->cur_pic->f.linesize; - uint8_t *mb_ptr = s->cur_pic->f.data[0] + - mb_x * 16 + mb_y * 16 * linesize[0]; - uint8_t *last_mb_ptr = s->last_pic->f.data[0] + - mb_x * 16 + mb_y * 16 * linesize[0]; - - if (s->avctx->codec_id == AV_CODEC_ID_H264) { - // FIXME - } else { - ff_thread_await_progress(&s->last_pic->tf, mb_y, 0); - } - is_intra_likely += s->dsp->sad[0](NULL, last_mb_ptr, mb_ptr, - linesize[0], 16); - // FIXME need await_progress() here - is_intra_likely -= s->dsp->sad[0](NULL, last_mb_ptr, - last_mb_ptr + linesize[0] * 16, - linesize[0], 16); - } else { - if (IS_INTRA(s->cur_pic->mb_type[mb_xy])) - is_intra_likely++; - else - is_intra_likely--; - } - } - } -// av_log(NULL, AV_LOG_ERROR, "is_intra_likely: %d type:%d\n", is_intra_likely, s->pict_type); - return is_intra_likely > 0; -} - -void ff_er_frame_start(ERContext *s) -{ - if (!s->avctx->error_concealment) - return; - - memset(s->error_status_table, ER_MB_ERROR | VP_START | ER_MB_END, - s->mb_stride * s->mb_height * sizeof(uint8_t)); - s->error_count = 3 * s->mb_num; - s->error_occurred = 0; -} - -static int er_supported(ERContext *s) -{ - if(s->avctx->hwaccel && s->avctx->hwaccel->decode_slice || - s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU || - !s->cur_pic || - s->cur_pic->field_picture - ) - return 0; - return 1; -} - -/** - * Add a slice. - * @param endx x component of the last macroblock, can be -1 - * for the last of the previous line - * @param status the status at the end (ER_MV_END, ER_AC_ERROR, ...), it is - * assumed that no earlier end or error of the same type occurred - */ -void ff_er_add_slice(ERContext *s, int startx, int starty, - int endx, int endy, int status) -{ - const int start_i = av_clip(startx + starty * s->mb_width, 0, s->mb_num - 1); - const int end_i = av_clip(endx + endy * s->mb_width, 0, s->mb_num); - const int start_xy = s->mb_index2xy[start_i]; - const int end_xy = s->mb_index2xy[end_i]; - int mask = -1; - - if (s->avctx->hwaccel && s->avctx->hwaccel->decode_slice) - return; - - if (start_i > end_i || start_xy > end_xy) { - av_log(s->avctx, AV_LOG_ERROR, - "internal error, slice end before start\n"); - return; - } - - if (!s->avctx->error_concealment) - return; - - mask &= ~VP_START; - if (status & (ER_AC_ERROR | ER_AC_END)) { - mask &= ~(ER_AC_ERROR | ER_AC_END); - s->error_count -= end_i - start_i + 1; - } - if (status & (ER_DC_ERROR | ER_DC_END)) { - mask &= ~(ER_DC_ERROR | ER_DC_END); - s->error_count -= end_i - start_i + 1; - } - if (status & (ER_MV_ERROR | ER_MV_END)) { - mask &= ~(ER_MV_ERROR | ER_MV_END); - s->error_count -= end_i - start_i + 1; - } - - if (status & ER_MB_ERROR) { - s->error_occurred = 1; - s->error_count = INT_MAX; - } - - if (mask == ~0x7F) { - memset(&s->error_status_table[start_xy], 0, - (end_xy - start_xy) * sizeof(uint8_t)); - } else { - int i; - for (i = start_xy; i < end_xy; i++) - s->error_status_table[i] &= mask; - } - - if (end_i == s->mb_num) - s->error_count = INT_MAX; - else { - s->error_status_table[end_xy] &= mask; - s->error_status_table[end_xy] |= status; - } - - s->error_status_table[start_xy] |= VP_START; - - if (start_xy > 0 && !(s->avctx->active_thread_type & FF_THREAD_SLICE) && - er_supported(s) && s->avctx->skip_top * s->mb_width < start_i) { - int prev_status = s->error_status_table[s->mb_index2xy[start_i - 1]]; - - prev_status &= ~ VP_START; - if (prev_status != (ER_MV_END | ER_DC_END | ER_AC_END)) { - s->error_occurred = 1; - s->error_count = INT_MAX; - } - } -} - -void ff_er_frame_end(ERContext *s) -{ - int *linesize = s->cur_pic->f.linesize; - int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error; - int distance; - int threshold_part[4] = { 100, 100, 100 }; - int threshold = 50; - int is_intra_likely; - int size = s->b8_stride * 2 * s->mb_height; - - /* We do not support ER of field pictures yet, - * though it should not crash if enabled. */ - if (!s->avctx->error_concealment || s->error_count == 0 || - s->avctx->lowres || - !er_supported(s) || - s->error_count == 3 * s->mb_width * - (s->avctx->skip_top + s->avctx->skip_bottom)) { - return; - } - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride]; - if (status != 0x7F) - break; - } - - if ( mb_x == s->mb_width - && s->avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO - && (s->avctx->height&16) - && s->error_count == 3 * s->mb_width * (s->avctx->skip_top + s->avctx->skip_bottom + 1) - ) { - av_log(s->avctx, AV_LOG_DEBUG, "ignoring last missing slice\n"); - return; - } - - if (s->last_pic) { - if (s->last_pic->f.width != s->cur_pic->f.width || - s->last_pic->f.height != s->cur_pic->f.height || - s->last_pic->f.format != s->cur_pic->f.format) { - av_log(s->avctx, AV_LOG_WARNING, "Cannot use previous picture in error concealment\n"); - s->last_pic = NULL; - } - } - if (s->next_pic) { - if (s->next_pic->f.width != s->cur_pic->f.width || - s->next_pic->f.height != s->cur_pic->f.height || - s->next_pic->f.format != s->cur_pic->f.format) { - av_log(s->avctx, AV_LOG_WARNING, "Cannot use next picture in error concealment\n"); - s->next_pic = NULL; - } - } - - if (s->cur_pic->motion_val[0] == NULL) { - av_log(s->avctx, AV_LOG_ERROR, "Warning MVs not available\n"); - - for (i = 0; i < 2; i++) { - s->cur_pic->ref_index_buf[i] = av_buffer_allocz(s->mb_stride * s->mb_height * 4 * sizeof(uint8_t)); - s->cur_pic->motion_val_buf[i] = av_buffer_allocz((size + 4) * 2 * sizeof(uint16_t)); - if (!s->cur_pic->ref_index_buf[i] || !s->cur_pic->motion_val_buf[i]) - break; - s->cur_pic->ref_index[i] = (int8_t*) s->cur_pic->ref_index_buf[i]->data; - s->cur_pic->motion_val[i] = (int16_t (*)[2])s->cur_pic->motion_val_buf[i]->data + 4; - } - if (i < 2) { - for (i = 0; i < 2; i++) { - av_buffer_unref(&s->cur_pic->ref_index_buf[i]); - av_buffer_unref(&s->cur_pic->motion_val_buf[i]); - s->cur_pic->ref_index[i] = NULL; - s->cur_pic->motion_val[i] = NULL; - } - return; - } - } - - if (s->avctx->debug & FF_DEBUG_ER) { - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - int status = s->error_status_table[mb_x + mb_y * s->mb_stride]; - - av_log(s->avctx, AV_LOG_DEBUG, "%2X ", status); - } - av_log(s->avctx, AV_LOG_DEBUG, "\n"); - } - } - -#if 1 - /* handle overlapping slices */ - for (error_type = 1; error_type <= 3; error_type++) { - int end_ok = 0; - - for (i = s->mb_num - 1; i >= 0; i--) { - const int mb_xy = s->mb_index2xy[i]; - int error = s->error_status_table[mb_xy]; - - if (error & (1 << error_type)) - end_ok = 1; - if (error & (8 << error_type)) - end_ok = 1; - - if (!end_ok) - s->error_status_table[mb_xy] |= 1 << error_type; - - if (error & VP_START) - end_ok = 0; - } - } -#endif -#if 1 - /* handle slices with partitions of different length */ - if (s->partitioned_frame) { - int end_ok = 0; - - for (i = s->mb_num - 1; i >= 0; i--) { - const int mb_xy = s->mb_index2xy[i]; - int error = s->error_status_table[mb_xy]; - - if (error & ER_AC_END) - end_ok = 0; - if ((error & ER_MV_END) || - (error & ER_DC_END) || - (error & ER_AC_ERROR)) - end_ok = 1; - - if (!end_ok) - s->error_status_table[mb_xy]|= ER_AC_ERROR; - - if (error & VP_START) - end_ok = 0; - } - } -#endif - /* handle missing slices */ - if (s->avctx->err_recognition & AV_EF_EXPLODE) { - int end_ok = 1; - - // FIXME + 100 hack - for (i = s->mb_num - 2; i >= s->mb_width + 100; i--) { - const int mb_xy = s->mb_index2xy[i]; - int error1 = s->error_status_table[mb_xy]; - int error2 = s->error_status_table[s->mb_index2xy[i + 1]]; - - if (error1 & VP_START) - end_ok = 1; - - if (error2 == (VP_START | ER_MB_ERROR | ER_MB_END) && - error1 != (VP_START | ER_MB_ERROR | ER_MB_END) && - ((error1 & ER_AC_END) || (error1 & ER_DC_END) || - (error1 & ER_MV_END))) { - // end & uninit - end_ok = 0; - } - - if (!end_ok) - s->error_status_table[mb_xy] |= ER_MB_ERROR; - } - } - -#if 1 - /* backward mark errors */ - distance = 9999999; - for (error_type = 1; error_type <= 3; error_type++) { - for (i = s->mb_num - 1; i >= 0; i--) { - const int mb_xy = s->mb_index2xy[i]; - int error = s->error_status_table[mb_xy]; - - if (!s->mbskip_table[mb_xy]) // FIXME partition specific - distance++; - if (error & (1 << error_type)) - distance = 0; - - if (s->partitioned_frame) { - if (distance < threshold_part[error_type - 1]) - s->error_status_table[mb_xy] |= 1 << error_type; - } else { - if (distance < threshold) - s->error_status_table[mb_xy] |= 1 << error_type; - } - - if (error & VP_START) - distance = 9999999; - } - } -#endif - - /* forward mark errors */ - error = 0; - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - int old_error = s->error_status_table[mb_xy]; - - if (old_error & VP_START) { - error = old_error & ER_MB_ERROR; - } else { - error |= old_error & ER_MB_ERROR; - s->error_status_table[mb_xy] |= error; - } - } -#if 1 - /* handle not partitioned case */ - if (!s->partitioned_frame) { - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - error = s->error_status_table[mb_xy]; - if (error & ER_MB_ERROR) - error |= ER_MB_ERROR; - s->error_status_table[mb_xy] = error; - } - } -#endif - - dc_error = ac_error = mv_error = 0; - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - error = s->error_status_table[mb_xy]; - if (error & ER_DC_ERROR) - dc_error++; - if (error & ER_AC_ERROR) - ac_error++; - if (error & ER_MV_ERROR) - mv_error++; - } - av_log(s->avctx, AV_LOG_INFO, "concealing %d DC, %d AC, %d MV errors in %c frame\n", - dc_error, ac_error, mv_error, av_get_picture_type_char(s->cur_pic->f.pict_type)); - - is_intra_likely = is_intra_more_likely(s); - - /* set unknown mb-type to most likely */ - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - error = s->error_status_table[mb_xy]; - if (!((error & ER_DC_ERROR) && (error & ER_MV_ERROR))) - continue; - - if (is_intra_likely) - s->cur_pic->mb_type[mb_xy] = MB_TYPE_INTRA4x4; - else - s->cur_pic->mb_type[mb_xy] = MB_TYPE_16x16 | MB_TYPE_L0; - } - - // change inter to intra blocks if no reference frames are available - if (!(s->last_pic && s->last_pic->f.data[0]) && - !(s->next_pic && s->next_pic->f.data[0])) - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - if (!IS_INTRA(s->cur_pic->mb_type[mb_xy])) - s->cur_pic->mb_type[mb_xy] = MB_TYPE_INTRA4x4; - } - - /* handle inter blocks with damaged AC */ - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - const int mb_xy = mb_x + mb_y * s->mb_stride; - const int mb_type = s->cur_pic->mb_type[mb_xy]; - const int dir = !(s->last_pic && s->last_pic->f.data[0]); - const int mv_dir = dir ? MV_DIR_BACKWARD : MV_DIR_FORWARD; - int mv_type; - - error = s->error_status_table[mb_xy]; - - if (IS_INTRA(mb_type)) - continue; // intra - if (error & ER_MV_ERROR) - continue; // inter with damaged MV - if (!(error & ER_AC_ERROR)) - continue; // undamaged inter - - if (IS_8X8(mb_type)) { - int mb_index = mb_x * 2 + mb_y * 2 * s->b8_stride; - int j; - mv_type = MV_TYPE_8X8; - for (j = 0; j < 4; j++) { - s->mv[0][j][0] = s->cur_pic->motion_val[dir][mb_index + (j & 1) + (j >> 1) * s->b8_stride][0]; - s->mv[0][j][1] = s->cur_pic->motion_val[dir][mb_index + (j & 1) + (j >> 1) * s->b8_stride][1]; - } - } else { - mv_type = MV_TYPE_16X16; - s->mv[0][0][0] = s->cur_pic->motion_val[dir][mb_x * 2 + mb_y * 2 * s->b8_stride][0]; - s->mv[0][0][1] = s->cur_pic->motion_val[dir][mb_x * 2 + mb_y * 2 * s->b8_stride][1]; - } - - s->decode_mb(s->opaque, 0 /* FIXME h264 partitioned slices need this set */, - mv_dir, mv_type, &s->mv, mb_x, mb_y, 0, 0); - } - } - - /* guess MVs */ - if (s->cur_pic->f.pict_type == AV_PICTURE_TYPE_B) { - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - int xy = mb_x * 2 + mb_y * 2 * s->b8_stride; - const int mb_xy = mb_x + mb_y * s->mb_stride; - const int mb_type = s->cur_pic->mb_type[mb_xy]; - int mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; - - error = s->error_status_table[mb_xy]; - - if (IS_INTRA(mb_type)) - continue; - if (!(error & ER_MV_ERROR)) - continue; // inter with undamaged MV - if (!(error & ER_AC_ERROR)) - continue; // undamaged inter - - if (!(s->last_pic && s->last_pic->f.data[0])) - mv_dir &= ~MV_DIR_FORWARD; - if (!(s->next_pic && s->next_pic->f.data[0])) - mv_dir &= ~MV_DIR_BACKWARD; - - if (s->pp_time) { - int time_pp = s->pp_time; - int time_pb = s->pb_time; - - av_assert0(s->avctx->codec_id != AV_CODEC_ID_H264); - ff_thread_await_progress(&s->next_pic->tf, mb_y, 0); - - s->mv[0][0][0] = s->next_pic->motion_val[0][xy][0] * time_pb / time_pp; - s->mv[0][0][1] = s->next_pic->motion_val[0][xy][1] * time_pb / time_pp; - s->mv[1][0][0] = s->next_pic->motion_val[0][xy][0] * (time_pb - time_pp) / time_pp; - s->mv[1][0][1] = s->next_pic->motion_val[0][xy][1] * (time_pb - time_pp) / time_pp; - } else { - s->mv[0][0][0] = 0; - s->mv[0][0][1] = 0; - s->mv[1][0][0] = 0; - s->mv[1][0][1] = 0; - } - - s->decode_mb(s->opaque, 0, mv_dir, MV_TYPE_16X16, &s->mv, - mb_x, mb_y, 0, 0); - } - } - } else - guess_mv(s); - - /* the filters below manipulate raw image, skip them */ - if (CONFIG_XVMC && s->avctx->hwaccel && s->avctx->hwaccel->decode_mb) - goto ec_clean; - /* fill DC for inter blocks */ - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - int dc, dcu, dcv, y, n; - int16_t *dc_ptr; - uint8_t *dest_y, *dest_cb, *dest_cr; - const int mb_xy = mb_x + mb_y * s->mb_stride; - const int mb_type = s->cur_pic->mb_type[mb_xy]; - - error = s->error_status_table[mb_xy]; - - if (IS_INTRA(mb_type) && s->partitioned_frame) - continue; - // if (error & ER_MV_ERROR) - // continue; // inter data damaged FIXME is this good? - - dest_y = s->cur_pic->f.data[0] + mb_x * 16 + mb_y * 16 * linesize[0]; - dest_cb = s->cur_pic->f.data[1] + mb_x * 8 + mb_y * 8 * linesize[1]; - dest_cr = s->cur_pic->f.data[2] + mb_x * 8 + mb_y * 8 * linesize[2]; - - dc_ptr = &s->dc_val[0][mb_x * 2 + mb_y * 2 * s->b8_stride]; - for (n = 0; n < 4; n++) { - dc = 0; - for (y = 0; y < 8; y++) { - int x; - for (x = 0; x < 8; x++) - dc += dest_y[x + (n & 1) * 8 + - (y + (n >> 1) * 8) * linesize[0]]; - } - dc_ptr[(n & 1) + (n >> 1) * s->b8_stride] = (dc + 4) >> 3; - } - - dcu = dcv = 0; - for (y = 0; y < 8; y++) { - int x; - for (x = 0; x < 8; x++) { - dcu += dest_cb[x + y * linesize[1]]; - dcv += dest_cr[x + y * linesize[2]]; - } - } - s->dc_val[1][mb_x + mb_y * s->mb_stride] = (dcu + 4) >> 3; - s->dc_val[2][mb_x + mb_y * s->mb_stride] = (dcv + 4) >> 3; - } - } -#if 1 - /* guess DC for damaged blocks */ - guess_dc(s, s->dc_val[0], s->mb_width*2, s->mb_height*2, s->b8_stride, 1); - guess_dc(s, s->dc_val[1], s->mb_width , s->mb_height , s->mb_stride, 0); - guess_dc(s, s->dc_val[2], s->mb_width , s->mb_height , s->mb_stride, 0); -#endif - - /* filter luma DC */ - filter181(s->dc_val[0], s->mb_width * 2, s->mb_height * 2, s->b8_stride); - -#if 1 - /* render DC only intra */ - for (mb_y = 0; mb_y < s->mb_height; mb_y++) { - for (mb_x = 0; mb_x < s->mb_width; mb_x++) { - uint8_t *dest_y, *dest_cb, *dest_cr; - const int mb_xy = mb_x + mb_y * s->mb_stride; - const int mb_type = s->cur_pic->mb_type[mb_xy]; - - error = s->error_status_table[mb_xy]; - - if (IS_INTER(mb_type)) - continue; - if (!(error & ER_AC_ERROR)) - continue; // undamaged - - dest_y = s->cur_pic->f.data[0] + mb_x * 16 + mb_y * 16 * linesize[0]; - dest_cb = s->cur_pic->f.data[1] + mb_x * 8 + mb_y * 8 * linesize[1]; - dest_cr = s->cur_pic->f.data[2] + mb_x * 8 + mb_y * 8 * linesize[2]; - - put_dc(s, dest_y, dest_cb, dest_cr, mb_x, mb_y); - } - } -#endif - - if (s->avctx->error_concealment & FF_EC_DEBLOCK) { - /* filter horizontal block boundaries */ - h_block_filter(s, s->cur_pic->f.data[0], s->mb_width * 2, - s->mb_height * 2, linesize[0], 1); - h_block_filter(s, s->cur_pic->f.data[1], s->mb_width, - s->mb_height, linesize[1], 0); - h_block_filter(s, s->cur_pic->f.data[2], s->mb_width, - s->mb_height, linesize[2], 0); - - /* filter vertical block boundaries */ - v_block_filter(s, s->cur_pic->f.data[0], s->mb_width * 2, - s->mb_height * 2, linesize[0], 1); - v_block_filter(s, s->cur_pic->f.data[1], s->mb_width, - s->mb_height, linesize[1], 0); - v_block_filter(s, s->cur_pic->f.data[2], s->mb_width, - s->mb_height, linesize[2], 0); - } - -ec_clean: - /* clean a few tables */ - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - int error = s->error_status_table[mb_xy]; - - if (s->cur_pic->f.pict_type != AV_PICTURE_TYPE_B && - (error & (ER_DC_ERROR | ER_MV_ERROR | ER_AC_ERROR))) { - s->mbskip_table[mb_xy] = 0; - } - s->mbintra_table[mb_xy] = 1; - } - s->cur_pic = NULL; - s->next_pic = NULL; - s->last_pic = NULL; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.h deleted file mode 100644 index 970fdc206..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/error_resilience.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_ERROR_RESILIENCE_H -#define AVCODEC_ERROR_RESILIENCE_H - -#include - -#include "avcodec.h" -#include "dsputil.h" - -///< current MB is the first after a resync marker -#define VP_START 1 -#define ER_AC_ERROR 2 -#define ER_DC_ERROR 4 -#define ER_MV_ERROR 8 -#define ER_AC_END 16 -#define ER_DC_END 32 -#define ER_MV_END 64 - -#define ER_MB_ERROR (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR) -#define ER_MB_END (ER_AC_END|ER_DC_END|ER_MV_END) - -typedef struct ERContext { - AVCodecContext *avctx; - DSPContext *dsp; - - int *mb_index2xy; - int mb_num; - int mb_width, mb_height; - int mb_stride; - int b8_stride; - - int error_count, error_occurred; - uint8_t *error_status_table; - uint8_t *er_temp_buffer; - int16_t *dc_val[3]; - uint8_t *mbskip_table; - uint8_t *mbintra_table; - int mv[2][4][2]; - - struct Picture *cur_pic; - struct Picture *last_pic; - struct Picture *next_pic; - - uint16_t pp_time; - uint16_t pb_time; - int quarter_sample; - int partitioned_frame; - int ref_count; - - void (*decode_mb)(void *opaque, int ref, int mv_dir, int mv_type, - int (*mv)[2][4][2], - int mb_x, int mb_y, int mb_intra, int mb_skipped); - void *opaque; -} ERContext; - -void ff_er_frame_start(ERContext *s); -void ff_er_frame_end(ERContext *s); -void ff_er_add_slice(ERContext *s, int startx, int starty, int endx, int endy, - int status); - -#endif /* AVCODEC_ERROR_RESILIENCE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.c deleted file mode 100644 index b1d7a145f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * Floating point AAN DCT - * this implementation is based upon the IJG integer AAN DCT (see jfdctfst.c) - * - * Copyright (c) 2003 Michael Niedermayer - * Copyright (c) 2003 Roman Shaposhnik - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * @file - * @brief - * Floating point AAN DCT - * @author Michael Niedermayer - */ - -#include "faandct.h" -#include "libavutil/internal.h" -#include "libavutil/libm.h" - -#define FLOAT float - -//numbers generated by simple c code (not as accurate as they could be) -/* -for(i=0; i<8; i++){ - printf("#define B%d %1.20llf\n", i, (long double)1.0/(cosl(i*acosl(-1.0)/(long double)16.0)*sqrtl(2))); -} -*/ -#define B0 1.00000000000000000000 -#define B1 0.72095982200694791383 // (cos(pi*1/16)sqrt(2))^-1 -#define B2 0.76536686473017954350 // (cos(pi*2/16)sqrt(2))^-1 -#define B3 0.85043009476725644878 // (cos(pi*3/16)sqrt(2))^-1 -#define B4 1.00000000000000000000 // (cos(pi*4/16)sqrt(2))^-1 -#define B5 1.27275858057283393842 // (cos(pi*5/16)sqrt(2))^-1 -#define B6 1.84775906502257351242 // (cos(pi*6/16)sqrt(2))^-1 -#define B7 3.62450978541155137218 // (cos(pi*7/16)sqrt(2))^-1 - - -#define A1 0.70710678118654752438 // cos(pi*4/16) -#define A2 0.54119610014619698435 // cos(pi*6/16)sqrt(2) -#define A5 0.38268343236508977170 // cos(pi*6/16) -#define A4 1.30656296487637652774 // cos(pi*2/16)sqrt(2) - -static const FLOAT postscale[64]={ -B0*B0, B0*B1, B0*B2, B0*B3, B0*B4, B0*B5, B0*B6, B0*B7, -B1*B0, B1*B1, B1*B2, B1*B3, B1*B4, B1*B5, B1*B6, B1*B7, -B2*B0, B2*B1, B2*B2, B2*B3, B2*B4, B2*B5, B2*B6, B2*B7, -B3*B0, B3*B1, B3*B2, B3*B3, B3*B4, B3*B5, B3*B6, B3*B7, -B4*B0, B4*B1, B4*B2, B4*B3, B4*B4, B4*B5, B4*B6, B4*B7, -B5*B0, B5*B1, B5*B2, B5*B3, B5*B4, B5*B5, B5*B6, B5*B7, -B6*B0, B6*B1, B6*B2, B6*B3, B6*B4, B6*B5, B6*B6, B6*B7, -B7*B0, B7*B1, B7*B2, B7*B3, B7*B4, B7*B5, B7*B6, B7*B7, -}; - -static av_always_inline void row_fdct(FLOAT temp[64], int16_t *data) -{ - FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - FLOAT tmp10, tmp11, tmp12, tmp13; - FLOAT z2, z4, z11, z13; - FLOAT av_unused z5; - int i; - - for (i=0; i<8*8; i+=8) { - tmp0= data[0 + i] + data[7 + i]; - tmp7= data[0 + i] - data[7 + i]; - tmp1= data[1 + i] + data[6 + i]; - tmp6= data[1 + i] - data[6 + i]; - tmp2= data[2 + i] + data[5 + i]; - tmp5= data[2 + i] - data[5 + i]; - tmp3= data[3 + i] + data[4 + i]; - tmp4= data[3 + i] - data[4 + i]; - - tmp10= tmp0 + tmp3; - tmp13= tmp0 - tmp3; - tmp11= tmp1 + tmp2; - tmp12= tmp1 - tmp2; - - temp[0 + i]= tmp10 + tmp11; - temp[4 + i]= tmp10 - tmp11; - - tmp12 += tmp13; - tmp12 *= A1; - temp[2 + i]= tmp13 + tmp12; - temp[6 + i]= tmp13 - tmp12; - - tmp4 += tmp5; - tmp5 += tmp6; - tmp6 += tmp7; - -#if 0 - z5= (tmp4 - tmp6) * A5; - z2= tmp4*A2 + z5; - z4= tmp6*A4 + z5; -#else - z2= tmp4*(A2+A5) - tmp6*A5; - z4= tmp6*(A4-A5) + tmp4*A5; -#endif - tmp5*=A1; - - z11= tmp7 + tmp5; - z13= tmp7 - tmp5; - - temp[5 + i]= z13 + z2; - temp[3 + i]= z13 - z2; - temp[1 + i]= z11 + z4; - temp[7 + i]= z11 - z4; - } -} - -void ff_faandct(int16_t *data) -{ - FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - FLOAT tmp10, tmp11, tmp12, tmp13; - FLOAT z2, z4, z11, z13; - FLOAT av_unused z5; - FLOAT temp[64]; - int i; - - emms_c(); - - row_fdct(temp, data); - - for (i=0; i<8; i++) { - tmp0= temp[8*0 + i] + temp[8*7 + i]; - tmp7= temp[8*0 + i] - temp[8*7 + i]; - tmp1= temp[8*1 + i] + temp[8*6 + i]; - tmp6= temp[8*1 + i] - temp[8*6 + i]; - tmp2= temp[8*2 + i] + temp[8*5 + i]; - tmp5= temp[8*2 + i] - temp[8*5 + i]; - tmp3= temp[8*3 + i] + temp[8*4 + i]; - tmp4= temp[8*3 + i] - temp[8*4 + i]; - - tmp10= tmp0 + tmp3; - tmp13= tmp0 - tmp3; - tmp11= tmp1 + tmp2; - tmp12= tmp1 - tmp2; - - data[8*0 + i]= lrintf(postscale[8*0 + i] * (tmp10 + tmp11)); - data[8*4 + i]= lrintf(postscale[8*4 + i] * (tmp10 - tmp11)); - - tmp12 += tmp13; - tmp12 *= A1; - data[8*2 + i]= lrintf(postscale[8*2 + i] * (tmp13 + tmp12)); - data[8*6 + i]= lrintf(postscale[8*6 + i] * (tmp13 - tmp12)); - - tmp4 += tmp5; - tmp5 += tmp6; - tmp6 += tmp7; - -#if 0 - z5= (tmp4 - tmp6) * A5; - z2= tmp4*A2 + z5; - z4= tmp6*A4 + z5; -#else - z2= tmp4*(A2+A5) - tmp6*A5; - z4= tmp6*(A4-A5) + tmp4*A5; -#endif - tmp5*=A1; - - z11= tmp7 + tmp5; - z13= tmp7 - tmp5; - - data[8*5 + i]= lrintf(postscale[8*5 + i] * (z13 + z2)); - data[8*3 + i]= lrintf(postscale[8*3 + i] * (z13 - z2)); - data[8*1 + i]= lrintf(postscale[8*1 + i] * (z11 + z4)); - data[8*7 + i]= lrintf(postscale[8*7 + i] * (z11 - z4)); - } -} - -void ff_faandct248(int16_t *data) -{ - FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; - FLOAT tmp10, tmp11, tmp12, tmp13; - FLOAT temp[64]; - int i; - - emms_c(); - - row_fdct(temp, data); - - for (i=0; i<8; i++) { - tmp0 = temp[8*0 + i] + temp[8*1 + i]; - tmp1 = temp[8*2 + i] + temp[8*3 + i]; - tmp2 = temp[8*4 + i] + temp[8*5 + i]; - tmp3 = temp[8*6 + i] + temp[8*7 + i]; - tmp4 = temp[8*0 + i] - temp[8*1 + i]; - tmp5 = temp[8*2 + i] - temp[8*3 + i]; - tmp6 = temp[8*4 + i] - temp[8*5 + i]; - tmp7 = temp[8*6 + i] - temp[8*7 + i]; - - tmp10 = tmp0 + tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - tmp13 = tmp0 - tmp3; - - data[8*0 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11)); - data[8*4 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11)); - - tmp12 += tmp13; - tmp12 *= A1; - data[8*2 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12)); - data[8*6 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12)); - - tmp10 = tmp4 + tmp7; - tmp11 = tmp5 + tmp6; - tmp12 = tmp5 - tmp6; - tmp13 = tmp4 - tmp7; - - data[8*1 + i] = lrintf(postscale[8*0 + i] * (tmp10 + tmp11)); - data[8*5 + i] = lrintf(postscale[8*4 + i] * (tmp10 - tmp11)); - - tmp12 += tmp13; - tmp12 *= A1; - data[8*3 + i] = lrintf(postscale[8*2 + i] * (tmp13 + tmp12)); - data[8*7 + i] = lrintf(postscale[8*6 + i] * (tmp13 - tmp12)); - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faanidct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faanidct.c deleted file mode 100644 index 405952e7a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faanidct.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Floating point AAN IDCT - * Copyright (c) 2008 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "config.h" -#include "faanidct.h" -#include "libavutil/common.h" - -/* To allow switching to double. */ -#define FLOAT float - -#define B0 1.0000000000000000000000 -#define B1 1.3870398453221474618216 // cos(pi*1/16)sqrt(2) -#define B2 1.3065629648763765278566 // cos(pi*2/16)sqrt(2) -#define B3 1.1758756024193587169745 // cos(pi*3/16)sqrt(2) -#define B4 1.0000000000000000000000 // cos(pi*4/16)sqrt(2) -#define B5 0.7856949583871021812779 // cos(pi*5/16)sqrt(2) -#define B6 0.5411961001461969843997 // cos(pi*6/16)sqrt(2) -#define B7 0.2758993792829430123360 // cos(pi*7/16)sqrt(2) - -#define A4 0.70710678118654752438 // cos(pi*4/16) -#define A2 0.92387953251128675613 // cos(pi*2/16) - -static const FLOAT prescale[64]={ -B0*B0/8, B0*B1/8, B0*B2/8, B0*B3/8, B0*B4/8, B0*B5/8, B0*B6/8, B0*B7/8, -B1*B0/8, B1*B1/8, B1*B2/8, B1*B3/8, B1*B4/8, B1*B5/8, B1*B6/8, B1*B7/8, -B2*B0/8, B2*B1/8, B2*B2/8, B2*B3/8, B2*B4/8, B2*B5/8, B2*B6/8, B2*B7/8, -B3*B0/8, B3*B1/8, B3*B2/8, B3*B3/8, B3*B4/8, B3*B5/8, B3*B6/8, B3*B7/8, -B4*B0/8, B4*B1/8, B4*B2/8, B4*B3/8, B4*B4/8, B4*B5/8, B4*B6/8, B4*B7/8, -B5*B0/8, B5*B1/8, B5*B2/8, B5*B3/8, B5*B4/8, B5*B5/8, B5*B6/8, B5*B7/8, -B6*B0/8, B6*B1/8, B6*B2/8, B6*B3/8, B6*B4/8, B6*B5/8, B6*B6/8, B6*B7/8, -B7*B0/8, B7*B1/8, B7*B2/8, B7*B3/8, B7*B4/8, B7*B5/8, B7*B6/8, B7*B7/8, -}; - -static inline void p8idct(int16_t data[64], FLOAT temp[64], uint8_t *dest, int stride, int x, int y, int type){ - int i; - FLOAT av_unused tmp0; - FLOAT s04, d04, s17, d17, s26, d26, s53, d53; - FLOAT os07, os16, os25, os34; - FLOAT od07, od16, od25, od34; - - for(i=0; i - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_FAANIDCT_H -#define AVCODEC_FAANIDCT_H - -#include - -void ff_faanidct(int16_t block[64]); -void ff_faanidct_add(uint8_t *dest, int line_size, int16_t block[64]); -void ff_faanidct_put(uint8_t *dest, int line_size, int16_t block[64]); - -#endif /* AVCODEC_FAANIDCT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft-internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft-internal.h deleted file mode 100644 index 065eeccef..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft-internal.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_FFT_INTERNAL_H -#define AVCODEC_FFT_INTERNAL_H - -#if CONFIG_FFT_FLOAT - -#define FIX15(v) (v) -#define sqrthalf (float)M_SQRT1_2 - -#define BF(x, y, a, b) do { \ - x = a - b; \ - y = a + b; \ - } while (0) - -#define CMUL(dre, dim, are, aim, bre, bim) do { \ - (dre) = (are) * (bre) - (aim) * (bim); \ - (dim) = (are) * (bim) + (aim) * (bre); \ - } while (0) - -#else - -#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits))) - -#if CONFIG_FFT_FIXED_32 - -#define CMUL(dre, dim, are, aim, bre, bim) do { \ - int64_t accu; \ - (accu) = (int64_t)(bre) * (are); \ - (accu) -= (int64_t)(bim) * (aim); \ - (dre) = (int)(((accu) + 0x40000000) >> 31); \ - (accu) = (int64_t)(bre) * (aim); \ - (accu) += (int64_t)(bim) * (are); \ - (dim) = (int)(((accu) + 0x40000000) >> 31); \ - } while (0) - -#define FIX15(a) av_clip(SCALE_FLOAT(a, 31), -2147483647, 2147483647) - -#else /* CONFIG_FFT_FIXED_32 */ - -#include "fft.h" -#include "mathops.h" - -void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input); - -#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767) - -#define sqrthalf ((int16_t)((1<<15)*M_SQRT1_2)) - -#define BF(x, y, a, b) do { \ - x = (a - b) >> 1; \ - y = (a + b) >> 1; \ - } while (0) - -#define CMULS(dre, dim, are, aim, bre, bim, sh) do { \ - (dre) = (MUL16(are, bre) - MUL16(aim, bim)) >> sh; \ - (dim) = (MUL16(are, bim) + MUL16(aim, bre)) >> sh; \ - } while (0) - -#define CMUL(dre, dim, are, aim, bre, bim) \ - CMULS(dre, dim, are, aim, bre, bim, 15) - -#define CMULL(dre, dim, are, aim, bre, bim) \ - CMULS(dre, dim, are, aim, bre, bim, 0) - -#endif /* CONFIG_FFT_FIXED_32 */ - -#endif /* CONFIG_FFT_FLOAT */ - -#define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c) -#define ff_imdct_half_c FFT_NAME(ff_imdct_half_c) -#define ff_mdct_calc_c FFT_NAME(ff_mdct_calc_c) - -void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); -void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input); -void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input); - -#endif /* AVCODEC_FFT_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.c deleted file mode 100644 index e0cf1f298..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.c +++ /dev/null @@ -1,530 +0,0 @@ -/* - * FFT/IFFT transforms - * Copyright (c) 2008 Loren Merritt - * Copyright (c) 2002 Fabrice Bellard - * Partly based on libdjbfft by D. J. Bernstein - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * FFT/IFFT transforms. - */ - -#include -#include -#include "libavutil/mathematics.h" -#include "fft.h" -#include "fft-internal.h" - -#if CONFIG_FFT_FIXED_32 -#include "fft_table.h" -#else /* CONFIG_FFT_FIXED_32 */ - -/* cos(2*pi*x/n) for 0<=x<=n/4, followed by its reverse */ -#if !CONFIG_HARDCODED_TABLES -COSTABLE(16); -COSTABLE(32); -COSTABLE(64); -COSTABLE(128); -COSTABLE(256); -COSTABLE(512); -COSTABLE(1024); -COSTABLE(2048); -COSTABLE(4096); -COSTABLE(8192); -COSTABLE(16384); -COSTABLE(32768); -COSTABLE(65536); -#endif -COSTABLE_CONST FFTSample * const FFT_NAME(ff_cos_tabs)[] = { - NULL, NULL, NULL, NULL, - FFT_NAME(ff_cos_16), - FFT_NAME(ff_cos_32), - FFT_NAME(ff_cos_64), - FFT_NAME(ff_cos_128), - FFT_NAME(ff_cos_256), - FFT_NAME(ff_cos_512), - FFT_NAME(ff_cos_1024), - FFT_NAME(ff_cos_2048), - FFT_NAME(ff_cos_4096), - FFT_NAME(ff_cos_8192), - FFT_NAME(ff_cos_16384), - FFT_NAME(ff_cos_32768), - FFT_NAME(ff_cos_65536), -}; - -#endif /* CONFIG_FFT_FIXED_32 */ - -static void fft_permute_c(FFTContext *s, FFTComplex *z); -static void fft_calc_c(FFTContext *s, FFTComplex *z); - -static int split_radix_permutation(int i, int n, int inverse) -{ - int m; - if(n <= 2) return i&1; - m = n >> 1; - if(!(i&m)) return split_radix_permutation(i, m, inverse)*2; - m >>= 1; - if(inverse == !(i&m)) return split_radix_permutation(i, m, inverse)*4 + 1; - else return split_radix_permutation(i, m, inverse)*4 - 1; -} - -av_cold void ff_init_ff_cos_tabs(int index) -{ -#if (!CONFIG_HARDCODED_TABLES) && (!CONFIG_FFT_FIXED_32) - int i; - int m = 1<= 16; - else if (i < n/2) - return is_second_half_of_fft32(i, n/2); - else if (i < 3*n/4) - return is_second_half_of_fft32(i - n/2, n/4); - else - return is_second_half_of_fft32(i - 3*n/4, n/4); -} - -static av_cold void fft_perm_avx(FFTContext *s) -{ - int i; - int n = 1 << s->nbits; - - for (i = 0; i < n; i += 16) { - int k; - if (is_second_half_of_fft32(i, n)) { - for (k = 0; k < 16; k++) - s->revtab[-split_radix_permutation(i + k, n, s->inverse) & (n - 1)] = - i + avx_tab[k]; - - } else { - for (k = 0; k < 16; k++) { - int j = i + k; - j = (j & ~7) | ((j >> 1) & 3) | ((j << 2) & 4); - s->revtab[-split_radix_permutation(i + k, n, s->inverse) & (n - 1)] = j; - } - } - } -} - -av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) -{ - int i, j, n; - - if (nbits < 2 || nbits > 16) - goto fail; - s->nbits = nbits; - n = 1 << nbits; - - s->revtab = av_malloc(n * sizeof(uint16_t)); - if (!s->revtab) - goto fail; - s->tmp_buf = av_malloc(n * sizeof(FFTComplex)); - if (!s->tmp_buf) - goto fail; - s->inverse = inverse; - s->fft_permutation = FF_FFT_PERM_DEFAULT; - - s->fft_permute = fft_permute_c; - s->fft_calc = fft_calc_c; -#if CONFIG_MDCT - s->imdct_calc = ff_imdct_calc_c; - s->imdct_half = ff_imdct_half_c; - s->mdct_calc = ff_mdct_calc_c; -#endif - -#if CONFIG_FFT_FIXED_32 - { - int n=0; - ff_fft_lut_init(fft_offsets_lut, 0, 1 << 16, &n); - } -#else /* CONFIG_FFT_FIXED_32 */ -#if CONFIG_FFT_FLOAT - if (ARCH_ARM) ff_fft_init_arm(s); - if (ARCH_PPC) ff_fft_init_ppc(s); - if (ARCH_X86) ff_fft_init_x86(s); - if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc; - if (HAVE_MIPSFPU) ff_fft_init_mips(s); -#else - if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c; - if (ARCH_ARM) ff_fft_fixed_init_arm(s); -#endif - for(j=4; j<=nbits; j++) { - ff_init_ff_cos_tabs(j); - } -#endif /* CONFIG_FFT_FIXED_32 */ - - - if (s->fft_permutation == FF_FFT_PERM_AVX) { - fft_perm_avx(s); - } else { - for(i=0; ifft_permutation == FF_FFT_PERM_SWAP_LSBS) - j = (j&~3) | ((j>>1)&1) | ((j<<1)&2); - s->revtab[-split_radix_permutation(i, n, s->inverse) & (n-1)] = j; - } - } - - return 0; - fail: - av_freep(&s->revtab); - av_freep(&s->tmp_buf); - return -1; -} - -static void fft_permute_c(FFTContext *s, FFTComplex *z) -{ - int j, np; - const uint16_t *revtab = s->revtab; - np = 1 << s->nbits; - /* TODO: handle split-radix permute in a more optimal way, probably in-place */ - for(j=0;jtmp_buf[revtab[j]] = z[j]; - memcpy(z, s->tmp_buf, np * sizeof(FFTComplex)); -} - -av_cold void ff_fft_end(FFTContext *s) -{ - av_freep(&s->revtab); - av_freep(&s->tmp_buf); -} - -#if CONFIG_FFT_FIXED_32 - -static void fft_calc_c(FFTContext *s, FFTComplex *z) { - - int nbits, i, n, num_transforms, offset, step; - int n4, n2, n34; - FFTSample tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8; - FFTComplex *tmpz; - FFTSample w_re, w_im; - FFTSample *w_re_ptr, *w_im_ptr; - const int fft_size = (1 << s->nbits); - int64_t accu; - - num_transforms = (0x2aab >> (16 - s->nbits)) | 1; - - for (n=0; n> 1) | 1; - - for (n=0; n> 31); - accu = (int64_t)Q31(M_SQRT1_2)*(tmp3 - tmp4); - tmp7 = (int32_t)((accu + 0x40000000) >> 31); - accu = (int64_t)Q31(M_SQRT1_2)*(tmp2 - tmp1); - tmp6 = (int32_t)((accu + 0x40000000) >> 31); - accu = (int64_t)Q31(M_SQRT1_2)*(tmp3 + tmp4); - tmp8 = (int32_t)((accu + 0x40000000) >> 31); - tmp1 = tmp5 + tmp7; - tmp3 = tmp5 - tmp7; - tmp2 = tmp6 + tmp8; - tmp4 = tmp6 - tmp8; - - tmpz[5].re = tmpz[1].re - tmp1; - tmpz[1].re = tmpz[1].re + tmp1; - tmpz[5].im = tmpz[1].im - tmp2; - tmpz[1].im = tmpz[1].im + tmp2; - tmpz[7].re = tmpz[3].re - tmp4; - tmpz[3].re = tmpz[3].re + tmp4; - tmpz[7].im = tmpz[3].im + tmp3; - tmpz[3].im = tmpz[3].im - tmp3; - } - - step = 1 << ((MAX_LOG2_NFFT-4) - 4); - n4 = 4; - - for (nbits=4; nbits<=s->nbits; nbits++){ - n2 = 2*n4; - n34 = 3*n4; - num_transforms = (num_transforms >> 1) | 1; - - for (n=0; n> 31); - accu = (int64_t)w_re*tmpz[ n2+i].im; - accu -= (int64_t)w_im*tmpz[ n2+i].re; - tmp2 = (int32_t)((accu + 0x40000000) >> 31); - accu = (int64_t)w_re*tmpz[n34+i].re; - accu -= (int64_t)w_im*tmpz[n34+i].im; - tmp3 = (int32_t)((accu + 0x40000000) >> 31); - accu = (int64_t)w_re*tmpz[n34+i].im; - accu += (int64_t)w_im*tmpz[n34+i].re; - tmp4 = (int32_t)((accu + 0x40000000) >> 31); - - tmp5 = tmp1 + tmp3; - tmp1 = tmp1 - tmp3; - tmp6 = tmp2 + tmp4; - tmp2 = tmp2 - tmp4; - - tmpz[ n2+i].re = tmpz[ i].re - tmp5; - tmpz[ i].re = tmpz[ i].re + tmp5; - tmpz[ n2+i].im = tmpz[ i].im - tmp6; - tmpz[ i].im = tmpz[ i].im + tmp6; - tmpz[n34+i].re = tmpz[n4+i].re - tmp2; - tmpz[ n4+i].re = tmpz[n4+i].re + tmp2; - tmpz[n34+i].im = tmpz[n4+i].im + tmp1; - tmpz[ n4+i].im = tmpz[n4+i].im - tmp1; - - w_re_ptr += step; - w_im_ptr -= step; - } - } - step >>= 1; - n4 <<= 1; - } -} - -#else /* CONFIG_FFT_FIXED_32 */ - -#define BUTTERFLIES(a0,a1,a2,a3) {\ - BF(t3, t5, t5, t1);\ - BF(a2.re, a0.re, a0.re, t5);\ - BF(a3.im, a1.im, a1.im, t3);\ - BF(t4, t6, t2, t6);\ - BF(a3.re, a1.re, a1.re, t4);\ - BF(a2.im, a0.im, a0.im, t6);\ -} - -// force loading all the inputs before storing any. -// this is slightly slower for small data, but avoids store->load aliasing -// for addresses separated by large powers of 2. -#define BUTTERFLIES_BIG(a0,a1,a2,a3) {\ - FFTSample r0=a0.re, i0=a0.im, r1=a1.re, i1=a1.im;\ - BF(t3, t5, t5, t1);\ - BF(a2.re, a0.re, r0, t5);\ - BF(a3.im, a1.im, i1, t3);\ - BF(t4, t6, t2, t6);\ - BF(a3.re, a1.re, r1, t4);\ - BF(a2.im, a0.im, i0, t6);\ -} - -#define TRANSFORM(a0,a1,a2,a3,wre,wim) {\ - CMUL(t1, t2, a2.re, a2.im, wre, -wim);\ - CMUL(t5, t6, a3.re, a3.im, wre, wim);\ - BUTTERFLIES(a0,a1,a2,a3)\ -} - -#define TRANSFORM_ZERO(a0,a1,a2,a3) {\ - t1 = a2.re;\ - t2 = a2.im;\ - t5 = a3.re;\ - t6 = a3.im;\ - BUTTERFLIES(a0,a1,a2,a3)\ -} - -/* z[0...8n-1], w[1...2n-1] */ -#define PASS(name)\ -static void name(FFTComplex *z, const FFTSample *wre, unsigned int n)\ -{\ - FFTDouble t1, t2, t3, t4, t5, t6;\ - int o1 = 2*n;\ - int o2 = 4*n;\ - int o3 = 6*n;\ - const FFTSample *wim = wre+o1;\ - n--;\ -\ - TRANSFORM_ZERO(z[0],z[o1],z[o2],z[o3]);\ - TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ - do {\ - z += 2;\ - wre += 2;\ - wim -= 2;\ - TRANSFORM(z[0],z[o1],z[o2],z[o3],wre[0],wim[0]);\ - TRANSFORM(z[1],z[o1+1],z[o2+1],z[o3+1],wre[1],wim[-1]);\ - } while(--n);\ -} - -PASS(pass) -#undef BUTTERFLIES -#define BUTTERFLIES BUTTERFLIES_BIG -PASS(pass_big) - -#define DECL_FFT(n,n2,n4)\ -static void fft##n(FFTComplex *z)\ -{\ - fft##n2(z);\ - fft##n4(z+n4*2);\ - fft##n4(z+n4*3);\ - pass(z,FFT_NAME(ff_cos_##n),n4/2);\ -} - -static void fft4(FFTComplex *z) -{ - FFTDouble t1, t2, t3, t4, t5, t6, t7, t8; - - BF(t3, t1, z[0].re, z[1].re); - BF(t8, t6, z[3].re, z[2].re); - BF(z[2].re, z[0].re, t1, t6); - BF(t4, t2, z[0].im, z[1].im); - BF(t7, t5, z[2].im, z[3].im); - BF(z[3].im, z[1].im, t4, t8); - BF(z[3].re, z[1].re, t3, t7); - BF(z[2].im, z[0].im, t2, t5); -} - -static void fft8(FFTComplex *z) -{ - FFTDouble t1, t2, t3, t4, t5, t6; - - fft4(z); - - BF(t1, z[5].re, z[4].re, -z[5].re); - BF(t2, z[5].im, z[4].im, -z[5].im); - BF(t5, z[7].re, z[6].re, -z[7].re); - BF(t6, z[7].im, z[6].im, -z[7].im); - - BUTTERFLIES(z[0],z[2],z[4],z[6]); - TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf); -} - -#if !CONFIG_SMALL -static void fft16(FFTComplex *z) -{ - FFTDouble t1, t2, t3, t4, t5, t6; - FFTSample cos_16_1 = FFT_NAME(ff_cos_16)[1]; - FFTSample cos_16_3 = FFT_NAME(ff_cos_16)[3]; - - fft8(z); - fft4(z+8); - fft4(z+12); - - TRANSFORM_ZERO(z[0],z[4],z[8],z[12]); - TRANSFORM(z[2],z[6],z[10],z[14],sqrthalf,sqrthalf); - TRANSFORM(z[1],z[5],z[9],z[13],cos_16_1,cos_16_3); - TRANSFORM(z[3],z[7],z[11],z[15],cos_16_3,cos_16_1); -} -#else -DECL_FFT(16,8,4) -#endif -DECL_FFT(32,16,8) -DECL_FFT(64,32,16) -DECL_FFT(128,64,32) -DECL_FFT(256,128,64) -DECL_FFT(512,256,128) -#if !CONFIG_SMALL -#define pass pass_big -#endif -DECL_FFT(1024,512,256) -DECL_FFT(2048,1024,512) -DECL_FFT(4096,2048,1024) -DECL_FFT(8192,4096,2048) -DECL_FFT(16384,8192,4096) -DECL_FFT(32768,16384,8192) -DECL_FFT(65536,32768,16384) - -static void (* const fft_dispatch[])(FFTComplex*) = { - fft4, fft8, fft16, fft32, fft64, fft128, fft256, fft512, fft1024, - fft2048, fft4096, fft8192, fft16384, fft32768, fft65536, -}; - -static void fft_calc_c(FFTContext *s, FFTComplex *z) -{ - fft_dispatch[s->nbits-2](z); -} -#endif /* CONFIG_FFT_FIXED_32 */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.h deleted file mode 100644 index 217090cf2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fft.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_FFT_H -#define AVCODEC_FFT_H - -#ifndef CONFIG_FFT_FLOAT -#define CONFIG_FFT_FLOAT 1 -#endif - -#ifndef CONFIG_FFT_FIXED_32 -#define CONFIG_FFT_FIXED_32 0 -#endif - -#include -#include "config.h" -#include "libavutil/mem.h" - -#if CONFIG_FFT_FLOAT - -#include "avfft.h" - -#define FFT_NAME(x) x - -typedef float FFTDouble; - -#else - -#if CONFIG_FFT_FIXED_32 - -#define Q31(x) (int)((x)*2147483648.0 + 0.5) -#define FFT_NAME(x) x ## _fixed_32 - -typedef int32_t FFTSample; - -#else /* CONFIG_FFT_FIXED_32 */ - -#define FFT_NAME(x) x ## _fixed - -typedef int16_t FFTSample; - -#endif /* CONFIG_FFT_FIXED_32 */ - -typedef struct FFTComplex { - FFTSample re, im; -} FFTComplex; - -typedef int FFTDouble; -typedef struct FFTContext FFTContext; - -#endif /* CONFIG_FFT_FLOAT */ - -typedef struct FFTDComplex { - FFTDouble re, im; -} FFTDComplex; - -/* FFT computation */ - -struct FFTContext { - int nbits; - int inverse; - uint16_t *revtab; - FFTComplex *tmp_buf; - int mdct_size; /* size of MDCT (i.e. number of input data * 2) */ - int mdct_bits; /* n = 2^nbits */ - /* pre/post rotation tables */ - FFTSample *tcos; - FFTSample *tsin; - /** - * Do the permutation needed BEFORE calling fft_calc(). - */ - void (*fft_permute)(struct FFTContext *s, FFTComplex *z); - /** - * Do a complex FFT with the parameters defined in ff_fft_init(). The - * input data must be permuted before. No 1.0/sqrt(n) normalization is done. - */ - void (*fft_calc)(struct FFTContext *s, FFTComplex *z); - void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); - void (*mdct_calcw)(struct FFTContext *s, FFTDouble *output, const FFTSample *input); - int fft_permutation; -#define FF_FFT_PERM_DEFAULT 0 -#define FF_FFT_PERM_SWAP_LSBS 1 -#define FF_FFT_PERM_AVX 2 - int mdct_permutation; -#define FF_MDCT_PERM_NONE 0 -#define FF_MDCT_PERM_INTERLEAVE 1 -}; - -#if CONFIG_HARDCODED_TABLES -#define COSTABLE_CONST const -#else -#define COSTABLE_CONST -#endif - -#define COSTABLE(size) \ - COSTABLE_CONST DECLARE_ALIGNED(32, FFTSample, FFT_NAME(ff_cos_##size))[size/2] - -extern COSTABLE(16); -extern COSTABLE(32); -extern COSTABLE(64); -extern COSTABLE(128); -extern COSTABLE(256); -extern COSTABLE(512); -extern COSTABLE(1024); -extern COSTABLE(2048); -extern COSTABLE(4096); -extern COSTABLE(8192); -extern COSTABLE(16384); -extern COSTABLE(32768); -extern COSTABLE(65536); -extern COSTABLE_CONST FFTSample* const FFT_NAME(ff_cos_tabs)[17]; - -#define ff_init_ff_cos_tabs FFT_NAME(ff_init_ff_cos_tabs) - -/** - * Initialize the cosine table in ff_cos_tabs[index] - * @param index index in ff_cos_tabs array of the table to initialize - */ -void ff_init_ff_cos_tabs(int index); - -#define ff_fft_init FFT_NAME(ff_fft_init) -#define ff_fft_end FFT_NAME(ff_fft_end) - -/** - * Set up a complex FFT. - * @param nbits log2 of the length of the input array - * @param inverse if 0 perform the forward transform, if 1 perform the inverse - */ -int ff_fft_init(FFTContext *s, int nbits, int inverse); - -void ff_fft_init_x86(FFTContext *s); -void ff_fft_init_arm(FFTContext *s); -void ff_fft_init_mips(FFTContext *s); -void ff_fft_init_ppc(FFTContext *s); - -void ff_fft_fixed_init_arm(FFTContext *s); - -void ff_fft_end(FFTContext *s); - -#define ff_mdct_init FFT_NAME(ff_mdct_init) -#define ff_mdct_end FFT_NAME(ff_mdct_end) - -int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale); -void ff_mdct_end(FFTContext *s); - -#endif /* AVCODEC_FFT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fmtconvert.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fmtconvert.c deleted file mode 100644 index 86425ee3d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/fmtconvert.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Format Conversion Utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "avcodec.h" -#include "fmtconvert.h" -#include "libavutil/common.h" - -static void int32_to_float_fmul_scalar_c(float *dst, const int32_t *src, - float mul, int len) -{ - int i; - for(i=0; iint32_to_float_fmul_scalar(&dst[i], &src[i], *mul++, 8); -} - -static av_always_inline int float_to_int16_one(const float *src){ - return av_clip_int16(lrintf(*src)); -} - -static void float_to_int16_c(int16_t *dst, const float *src, long len) -{ - int i; - for(i=0; iint32_to_float_fmul_scalar = int32_to_float_fmul_scalar_c; - c->int32_to_float_fmul_array8 = int32_to_float_fmul_array8_c; - c->float_to_int16 = float_to_int16_c; - c->float_to_int16_interleave = float_to_int16_interleave_c; - c->float_interleave = ff_float_interleave_c; - - if (ARCH_ARM) ff_fmt_convert_init_arm(c, avctx); - if (ARCH_PPC) ff_fmt_convert_init_ppc(c, avctx); - if (ARCH_X86) ff_fmt_convert_init_x86(c, avctx); - if (HAVE_MIPSFPU) ff_fmt_convert_init_mips(c); -} - -/* ffdshow custom code */ -void float_interleave(float *dst, const float **src, long len, int channels) -{ - int i,j,c; - if(channels==2){ - for(i=0; i - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_FMTCONVERT_H -#define AVCODEC_FMTCONVERT_H - -#include "avcodec.h" - -typedef struct FmtConvertContext { - /** - * Convert an array of int32_t to float and multiply by a float value. - * @param dst destination array of float. - * constraints: 16-byte aligned - * @param src source array of int32_t. - * constraints: 16-byte aligned - * @param len number of elements to convert. - * constraints: multiple of 8 - */ - void (*int32_to_float_fmul_scalar)(float *dst, const int32_t *src, - float mul, int len); - - /** - * Convert an array of int32_t to float and multiply by a float value from another array, - * stepping along the float array once for each 8 integers. - * @param c pointer to FmtConvertContext. - * @param dst destination array of float. - * constraints: 16-byte aligned - * @param src source array of int32_t. - * constraints: 16-byte aligned - * @param mul source array of float multipliers. - * @param len number of elements to convert. - * constraints: multiple of 8 - */ - void (*int32_to_float_fmul_array8)(struct FmtConvertContext *c, - float *dst, const int32_t *src, - const float *mul, int len); - - /** - * Convert an array of float to an array of int16_t. - * - * Convert floats from in the range [-32768.0,32767.0] to ints - * without rescaling - * - * @param dst destination array of int16_t. - * constraints: 16-byte aligned - * @param src source array of float. - * constraints: 16-byte aligned - * @param len number of elements to convert. - * constraints: multiple of 8 - */ - void (*float_to_int16)(int16_t *dst, const float *src, long len); - - /** - * Convert multiple arrays of float to an interleaved array of int16_t. - * - * Convert floats from in the range [-32768.0,32767.0] to ints - * without rescaling - * - * @param dst destination array of interleaved int16_t. - * constraints: 16-byte aligned - * @param src source array of float arrays, one for each channel. - * constraints: 16-byte aligned - * @param len number of elements to convert. - * constraints: multiple of 8 - * @param channels number of channels - */ - void (*float_to_int16_interleave)(int16_t *dst, const float **src, - long len, int channels); - - /** - * Convert multiple arrays of float to an array of interleaved float. - * - * @param dst destination array of interleaved float. - * constraints: 16-byte aligned - * @param src source array of float arrays, one for each channel. - * constraints: 16-byte aligned - * @param len number of elements to convert. - * constraints: multiple of 8 - * @param channels number of channels - */ - void (*float_interleave)(float *dst, const float **src, unsigned int len, - int channels); -} FmtConvertContext; - -void ff_float_interleave_c(float *dst, const float **src, unsigned int len, - int channels); - -void ff_fmt_convert_init(FmtConvertContext *c, AVCodecContext *avctx); - -void ff_fmt_convert_init_arm(FmtConvertContext *c, AVCodecContext *avctx); -void ff_fmt_convert_init_ppc(FmtConvertContext *c, AVCodecContext *avctx); -void ff_fmt_convert_init_x86(FmtConvertContext *c, AVCodecContext *avctx); -void ff_fmt_convert_init_mips(FmtConvertContext *c); - -/* ffdshow custom code */ -void float_interleave(float *dst, const float **src, long len, int channels); -void float_interleave_noscale(float *dst, const float **src, long len, int channels); - -#endif /* AVCODEC_FMTCONVERT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.c deleted file mode 100644 index 0de110d08..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright (c) 2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "frame_thread_encoder.h" - -#include "libavutil/fifo.h" -#include "libavutil/avassert.h" -#include "libavutil/imgutils.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "internal.h" -#include "thread.h" - -#if HAVE_PTHREADS -#include -#elif HAVE_W32THREADS -#include "compat/w32pthreads.h" -#elif HAVE_OS2THREADS -#include "compat/os2threads.h" -#endif - -#define MAX_THREADS 64 -#define BUFFER_SIZE (2*MAX_THREADS) - -typedef struct{ - void *indata; - void *outdata; - int64_t return_code; - unsigned index; -} Task; - -typedef struct{ - AVCodecContext *parent_avctx; - pthread_mutex_t buffer_mutex; - - AVFifoBuffer *task_fifo; - pthread_mutex_t task_fifo_mutex; - pthread_cond_t task_fifo_cond; - - Task finished_tasks[BUFFER_SIZE]; - pthread_mutex_t finished_task_mutex; - pthread_cond_t finished_task_cond; - - unsigned task_index; - unsigned finished_task_index; - - pthread_t worker[MAX_THREADS]; - int exit; -} ThreadContext; - -static void * attribute_align_arg worker(void *v){ - AVCodecContext *avctx = v; - ThreadContext *c = avctx->internal->frame_thread_encoder; - AVPacket *pkt = NULL; - - while(!c->exit){ - int got_packet, ret; - AVFrame *frame; - Task task; - - if(!pkt) pkt= av_mallocz(sizeof(*pkt)); - if(!pkt) continue; - av_init_packet(pkt); - - pthread_mutex_lock(&c->task_fifo_mutex); - while (av_fifo_size(c->task_fifo) <= 0 || c->exit) { - if(c->exit){ - pthread_mutex_unlock(&c->task_fifo_mutex); - goto end; - } - pthread_cond_wait(&c->task_fifo_cond, &c->task_fifo_mutex); - } - av_fifo_generic_read(c->task_fifo, &task, sizeof(task), NULL); - pthread_mutex_unlock(&c->task_fifo_mutex); - frame = task.indata; - - ret = avcodec_encode_video2(avctx, pkt, frame, &got_packet); - pthread_mutex_lock(&c->buffer_mutex); - av_frame_unref(frame); - pthread_mutex_unlock(&c->buffer_mutex); - av_frame_free(&frame); - if(got_packet) { - av_dup_packet(pkt); - } else { - pkt->data = NULL; - pkt->size = 0; - } - pthread_mutex_lock(&c->finished_task_mutex); - c->finished_tasks[task.index].outdata = pkt; pkt = NULL; - c->finished_tasks[task.index].return_code = ret; - pthread_cond_signal(&c->finished_task_cond); - pthread_mutex_unlock(&c->finished_task_mutex); - } -end: - av_free(pkt); - pthread_mutex_lock(&c->buffer_mutex); - avcodec_close(avctx); - pthread_mutex_unlock(&c->buffer_mutex); - av_freep(&avctx); - return NULL; -} - -int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options){ - int i=0; - ThreadContext *c; - - - if( !(avctx->thread_type & FF_THREAD_FRAME) - || !(avctx->codec->capabilities & CODEC_CAP_INTRA_ONLY)) - return 0; - - if( !avctx->thread_count - && avctx->codec_id == AV_CODEC_ID_MJPEG - && !(avctx->flags & CODEC_FLAG_QSCALE)) { - av_log(avctx, AV_LOG_DEBUG, - "Forcing thread count to 1 for MJPEG encoding, use -thread_type slice " - "or a constant quantizer if you want to use multiple cpu cores\n"); - avctx->thread_count = 1; - } - if( avctx->thread_count > 1 - && avctx->codec_id == AV_CODEC_ID_MJPEG - && !(avctx->flags & CODEC_FLAG_QSCALE)) - av_log(avctx, AV_LOG_WARNING, - "MJPEG CBR encoding works badly with frame multi-threading, consider " - "using -threads 1, -thread_type slice or a constant quantizer.\n"); - - if (avctx->codec_id == AV_CODEC_ID_HUFFYUV || - avctx->codec_id == AV_CODEC_ID_FFVHUFF) { - // huffyuv doesnt support these with multiple frame threads currently - if (avctx->context_model > 0 || (avctx->flags & CODEC_FLAG_PASS1)) { - av_log(avctx, AV_LOG_WARNING, - "Forcing thread count to 1 for huffyuv encoding with first pass or context 1\n"); - avctx->thread_count = 1; - } - } - - if(!avctx->thread_count) { - avctx->thread_count = av_cpu_count(); - avctx->thread_count = FFMIN(avctx->thread_count, MAX_THREADS); - } - - if(avctx->thread_count <= 1) - return 0; - - if(avctx->thread_count > MAX_THREADS) - return AVERROR(EINVAL); - - av_assert0(!avctx->internal->frame_thread_encoder); - c = avctx->internal->frame_thread_encoder = av_mallocz(sizeof(ThreadContext)); - if(!c) - return AVERROR(ENOMEM); - - c->parent_avctx = avctx; - - c->task_fifo = av_fifo_alloc(sizeof(Task) * BUFFER_SIZE); - if(!c->task_fifo) - goto fail; - - pthread_mutex_init(&c->task_fifo_mutex, NULL); - pthread_mutex_init(&c->finished_task_mutex, NULL); - pthread_mutex_init(&c->buffer_mutex, NULL); - pthread_cond_init(&c->task_fifo_cond, NULL); - pthread_cond_init(&c->finished_task_cond, NULL); - - for(i=0; ithread_count ; i++){ - AVDictionary *tmp = NULL; - void *tmpv; - AVCodecContext *thread_avctx = avcodec_alloc_context3(avctx->codec); - if(!thread_avctx) - goto fail; - tmpv = thread_avctx->priv_data; - *thread_avctx = *avctx; - thread_avctx->priv_data = tmpv; - thread_avctx->internal = NULL; - memcpy(thread_avctx->priv_data, avctx->priv_data, avctx->codec->priv_data_size); - thread_avctx->thread_count = 1; - thread_avctx->active_thread_type &= ~FF_THREAD_FRAME; - - av_dict_copy(&tmp, options, 0); - av_dict_set(&tmp, "threads", "1", 0); - if(avcodec_open2(thread_avctx, avctx->codec, &tmp) < 0) { - av_dict_free(&tmp); - goto fail; - } - av_dict_free(&tmp); - av_assert0(!thread_avctx->internal->frame_thread_encoder); - thread_avctx->internal->frame_thread_encoder = c; - if(pthread_create(&c->worker[i], NULL, worker, thread_avctx)) { - goto fail; - } - } - - avctx->active_thread_type = FF_THREAD_FRAME; - - return 0; -fail: - avctx->thread_count = i; - av_log(avctx, AV_LOG_ERROR, "ff_frame_thread_encoder_init failed\n"); - ff_frame_thread_encoder_free(avctx); - return -1; -} - -void ff_frame_thread_encoder_free(AVCodecContext *avctx){ - int i; - ThreadContext *c= avctx->internal->frame_thread_encoder; - - pthread_mutex_lock(&c->task_fifo_mutex); - c->exit = 1; - pthread_cond_broadcast(&c->task_fifo_cond); - pthread_mutex_unlock(&c->task_fifo_mutex); - - for (i=0; ithread_count; i++) { - pthread_join(c->worker[i], NULL); - } - - pthread_mutex_destroy(&c->task_fifo_mutex); - pthread_mutex_destroy(&c->finished_task_mutex); - pthread_mutex_destroy(&c->buffer_mutex); - pthread_cond_destroy(&c->task_fifo_cond); - pthread_cond_destroy(&c->finished_task_cond); - av_fifo_free(c->task_fifo); c->task_fifo = NULL; - av_freep(&avctx->internal->frame_thread_encoder); -} - -int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr){ - ThreadContext *c = avctx->internal->frame_thread_encoder; - Task task; - int ret; - - av_assert1(!*got_packet_ptr); - - if(frame){ - if(!(avctx->flags & CODEC_FLAG_INPUT_PRESERVED)){ - AVFrame *new = av_frame_alloc(); - if(!new) - return AVERROR(ENOMEM); - pthread_mutex_lock(&c->buffer_mutex); - ret = ff_get_buffer(c->parent_avctx, new, 0); - pthread_mutex_unlock(&c->buffer_mutex); - if(ret<0) - return ret; - new->pts = frame->pts; - new->quality = frame->quality; - new->pict_type = frame->pict_type; - av_image_copy(new->data, new->linesize, (const uint8_t **)frame->data, frame->linesize, - avctx->pix_fmt, avctx->width, avctx->height); - frame = new; - } - - task.index = c->task_index; - task.indata = (void*)frame; - pthread_mutex_lock(&c->task_fifo_mutex); - av_fifo_generic_write(c->task_fifo, &task, sizeof(task), NULL); - pthread_cond_signal(&c->task_fifo_cond); - pthread_mutex_unlock(&c->task_fifo_mutex); - - c->task_index = (c->task_index+1) % BUFFER_SIZE; - - if(!c->finished_tasks[c->finished_task_index].outdata && (c->task_index - c->finished_task_index) % BUFFER_SIZE <= avctx->thread_count) - return 0; - } - - if(c->task_index == c->finished_task_index) - return 0; - - pthread_mutex_lock(&c->finished_task_mutex); - while (!c->finished_tasks[c->finished_task_index].outdata) { - pthread_cond_wait(&c->finished_task_cond, &c->finished_task_mutex); - } - task = c->finished_tasks[c->finished_task_index]; - *pkt = *(AVPacket*)(task.outdata); - if(pkt->data) - *got_packet_ptr = 1; - av_freep(&c->finished_tasks[c->finished_task_index].outdata); - c->finished_task_index = (c->finished_task_index+1) % BUFFER_SIZE; - pthread_mutex_unlock(&c->finished_task_mutex); - - return task.return_code; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.h deleted file mode 100644 index 1da0ce180..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/frame_thread_encoder.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avcodec.h" - -int ff_frame_thread_encoder_init(AVCodecContext *avctx, AVDictionary *options); -void ff_frame_thread_encoder_free(AVCodecContext *avctx); -int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet_ptr); - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.c deleted file mode 100644 index 2c04c40b5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * G.722 ADPCM audio encoder/decoder - * - * Copyright (c) CMU 1993 Computer Science, Speech Group - * Chengxiang Lu and Alex Hauptmann - * Copyright (c) 2005 Steve Underwood - * Copyright (c) 2009 Kenan Gillet - * Copyright (c) 2010 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * G.722 ADPCM audio codec - * - * This G.722 decoder is a bit-exact implementation of the ITU G.722 - * specification for all three specified bitrates - 64000bps, 56000bps - * and 48000bps. It passes the ITU tests. - * - * @note For the 56000bps and 48000bps bitrates, the lowest 1 or 2 bits - * respectively of each byte are ignored. - */ - -#include "mathops.h" -#include "g722.h" - -static const int8_t sign_lookup[2] = { -1, 1 }; - -static const int16_t inv_log2_table[32] = { - 2048, 2093, 2139, 2186, 2233, 2282, 2332, 2383, - 2435, 2489, 2543, 2599, 2656, 2714, 2774, 2834, - 2896, 2960, 3025, 3091, 3158, 3228, 3298, 3371, - 3444, 3520, 3597, 3676, 3756, 3838, 3922, 4008 -}; -static const int16_t high_log_factor_step[2] = { 798, -214 }; -const int16_t ff_g722_high_inv_quant[4] = { -926, -202, 926, 202 }; -/** - * low_log_factor_step[index] == wl[rl42[index]] - */ -static const int16_t low_log_factor_step[16] = { - -60, 3042, 1198, 538, 334, 172, 58, -30, - 3042, 1198, 538, 334, 172, 58, -30, -60 -}; -const int16_t ff_g722_low_inv_quant4[16] = { - 0, -2557, -1612, -1121, -786, -530, -323, -150, - 2557, 1612, 1121, 786, 530, 323, 150, 0 -}; -const int16_t ff_g722_low_inv_quant6[64] = { - -17, -17, -17, -17, -3101, -2738, -2376, -2088, - -1873, -1689, -1535, -1399, -1279, -1170, -1072, -982, - -899, -822, -750, -682, -618, -558, -501, -447, - -396, -347, -300, -254, -211, -170, -130, -91, - 3101, 2738, 2376, 2088, 1873, 1689, 1535, 1399, - 1279, 1170, 1072, 982, 899, 822, 750, 682, - 618, 558, 501, 447, 396, 347, 300, 254, - 211, 170, 130, 91, 54, 17, -54, -17 -}; - -/** - * quadrature mirror filter (QMF) coefficients - * - * ITU-T G.722 Table 11 - */ -static const int16_t qmf_coeffs[12] = { - 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11, -}; - - -/** - * adaptive predictor - * - * @param cur_diff the dequantized and scaled delta calculated from the - * current codeword - */ -static void do_adaptive_prediction(struct G722Band *band, const int cur_diff) -{ - int sg[2], limit, i, cur_qtzd_reconst; - - const int cur_part_reconst = band->s_zero + cur_diff < 0; - - sg[0] = sign_lookup[cur_part_reconst != band->part_reconst_mem[0]]; - sg[1] = sign_lookup[cur_part_reconst == band->part_reconst_mem[1]]; - band->part_reconst_mem[1] = band->part_reconst_mem[0]; - band->part_reconst_mem[0] = cur_part_reconst; - - band->pole_mem[1] = av_clip((sg[0] * av_clip(band->pole_mem[0], -8191, 8191) >> 5) + - (sg[1] << 7) + (band->pole_mem[1] * 127 >> 7), -12288, 12288); - - limit = 15360 - band->pole_mem[1]; - band->pole_mem[0] = av_clip(-192 * sg[0] + (band->pole_mem[0] * 255 >> 8), -limit, limit); - - - if (cur_diff) { - for (i = 0; i < 6; i++) - band->zero_mem[i] = ((band->zero_mem[i]*255) >> 8) + - ((band->diff_mem[i]^cur_diff) < 0 ? -128 : 128); - } else - for (i = 0; i < 6; i++) - band->zero_mem[i] = (band->zero_mem[i]*255) >> 8; - - for (i = 5; i > 0; i--) - band->diff_mem[i] = band->diff_mem[i-1]; - band->diff_mem[0] = av_clip_int16(cur_diff << 1); - - band->s_zero = 0; - for (i = 5; i >= 0; i--) - band->s_zero += (band->zero_mem[i]*band->diff_mem[i]) >> 15; - - - cur_qtzd_reconst = av_clip_int16((band->s_predictor + cur_diff) << 1); - band->s_predictor = av_clip_int16(band->s_zero + - (band->pole_mem[0] * cur_qtzd_reconst >> 15) + - (band->pole_mem[1] * band->prev_qtzd_reconst >> 15)); - band->prev_qtzd_reconst = cur_qtzd_reconst; -} - -static inline int linear_scale_factor(const int log_factor) -{ - const int wd1 = inv_log2_table[(log_factor >> 6) & 31]; - const int shift = log_factor >> 11; - return shift < 0 ? wd1 >> -shift : wd1 << shift; -} - -void ff_g722_update_low_predictor(struct G722Band *band, const int ilow) -{ - do_adaptive_prediction(band, - band->scale_factor * ff_g722_low_inv_quant4[ilow] >> 10); - - // quantizer adaptation - band->log_factor = av_clip((band->log_factor * 127 >> 7) + - low_log_factor_step[ilow], 0, 18432); - band->scale_factor = linear_scale_factor(band->log_factor - (8 << 11)); -} - -void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, - const int ihigh) -{ - do_adaptive_prediction(band, dhigh); - - // quantizer adaptation - band->log_factor = av_clip((band->log_factor * 127 >> 7) + - high_log_factor_step[ihigh&1], 0, 22528); - band->scale_factor = linear_scale_factor(band->log_factor - (10 << 11)); -} - -void ff_g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2) -{ - int i; - - *xout1 = 0; - *xout2 = 0; - for (i = 0; i < 12; i++) { - MAC16(*xout2, prev_samples[2*i ], qmf_coeffs[i ]); - MAC16(*xout1, prev_samples[2*i+1], qmf_coeffs[11-i]); - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.h deleted file mode 100644 index 3f8982767..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) CMU 1993 Computer Science, Speech Group - * Chengxiang Lu and Alex Hauptmann - * Copyright (c) 2005 Steve Underwood - * Copyright (c) 2009 Kenan Gillet - * Copyright (c) 2010 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_G722_H -#define AVCODEC_G722_H - -#include -#include "avcodec.h" - -#define PREV_SAMPLES_BUF_SIZE 1024 - -typedef struct G722Context { - const AVClass *class; - int bits_per_codeword; - int16_t prev_samples[PREV_SAMPLES_BUF_SIZE]; ///< memory of past decoded samples - int prev_samples_pos; ///< the number of values in prev_samples - - /** - * The band[0] and band[1] correspond respectively to the lower band and higher band. - */ - struct G722Band { - int16_t s_predictor; ///< predictor output value - int32_t s_zero; ///< previous output signal from zero predictor - int8_t part_reconst_mem[2]; ///< signs of previous partially reconstructed signals - int16_t prev_qtzd_reconst; ///< previous quantized reconstructed signal (internal value, using low_inv_quant4) - int16_t pole_mem[2]; ///< second-order pole section coefficient buffer - int32_t diff_mem[6]; ///< quantizer difference signal memory - int16_t zero_mem[6]; ///< Seventh-order zero section coefficient buffer - int16_t log_factor; ///< delayed 2-logarithmic quantizer factor - int16_t scale_factor; ///< delayed quantizer scale factor - } band[2]; - - struct TrellisNode { - struct G722Band state; - uint32_t ssd; - int path; - } *node_buf[2], **nodep_buf[2]; - - struct TrellisPath { - int value; - int prev; - } *paths[2]; -} G722Context; - -extern const int16_t ff_g722_high_inv_quant[4]; -extern const int16_t ff_g722_low_inv_quant4[16]; -extern const int16_t ff_g722_low_inv_quant6[64]; - -void ff_g722_update_low_predictor(struct G722Band *band, const int ilow); - -void ff_g722_update_high_predictor(struct G722Band *band, const int dhigh, - const int ihigh); - -void ff_g722_apply_qmf(const int16_t *prev_samples, int *xout1, int *xout2); - -#endif /* AVCODEC_G722_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722dec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722dec.c deleted file mode 100644 index d3b89fffc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g722dec.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) CMU 1993 Computer Science, Speech Group - * Chengxiang Lu and Alex Hauptmann - * Copyright (c) 2005 Steve Underwood - * Copyright (c) 2009 Kenan Gillet - * Copyright (c) 2010 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * G.722 ADPCM audio decoder - * - * This G.722 decoder is a bit-exact implementation of the ITU G.722 - * specification for all three specified bitrates - 64000bps, 56000bps - * and 48000bps. It passes the ITU tests. - * - * @note For the 56000bps and 48000bps bitrates, the lowest 1 or 2 bits - * respectively of each byte are ignored. - */ - -#include "libavutil/channel_layout.h" -#include "libavutil/opt.h" -#include "avcodec.h" -#include "get_bits.h" -#include "g722.h" -#include "internal.h" - -#define OFFSET(x) offsetof(G722Context, x) -#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM -static const AVOption options[] = { - { "bits_per_codeword", "Bits per G722 codeword", OFFSET(bits_per_codeword), AV_OPT_TYPE_FLAGS, { .i64 = 8 }, 6, 8, AD }, - { NULL } -}; - -static const AVClass g722_decoder_class = { - .class_name = "g722 decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -static av_cold int g722_decode_init(AVCodecContext * avctx) -{ - G722Context *c = avctx->priv_data; - - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - - c->band[0].scale_factor = 8; - c->band[1].scale_factor = 2; - c->prev_samples_pos = 22; - - return 0; -} - -static const int16_t low_inv_quant5[32] = { - -35, -35, -2919, -2195, -1765, -1458, -1219, -1023, - -858, -714, -587, -473, -370, -276, -190, -110, - 2919, 2195, 1765, 1458, 1219, 1023, 858, 714, - 587, 473, 370, 276, 190, 110, 35, -35 -}; - -static const int16_t *low_inv_quants[3] = { ff_g722_low_inv_quant6, - low_inv_quant5, - ff_g722_low_inv_quant4 }; - -static int g722_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - G722Context *c = avctx->priv_data; - AVFrame *frame = data; - int16_t *out_buf; - int j, ret; - const int skip = 8 - c->bits_per_codeword; - const int16_t *quantizer_table = low_inv_quants[skip]; - GetBitContext gb; - - /* get output buffer */ - frame->nb_samples = avpkt->size * 2; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - out_buf = (int16_t *)frame->data[0]; - - init_get_bits(&gb, avpkt->data, avpkt->size * 8); - - for (j = 0; j < avpkt->size; j++) { - int ilow, ihigh, rlow, rhigh, dhigh; - int xout1, xout2; - - ihigh = get_bits(&gb, 2); - ilow = get_bits(&gb, 6 - skip); - skip_bits(&gb, skip); - - rlow = av_clip((c->band[0].scale_factor * quantizer_table[ilow] >> 10) - + c->band[0].s_predictor, -16384, 16383); - - ff_g722_update_low_predictor(&c->band[0], ilow >> (2 - skip)); - - dhigh = c->band[1].scale_factor * ff_g722_high_inv_quant[ihigh] >> 10; - rhigh = av_clip(dhigh + c->band[1].s_predictor, -16384, 16383); - - ff_g722_update_high_predictor(&c->band[1], dhigh, ihigh); - - c->prev_samples[c->prev_samples_pos++] = rlow + rhigh; - c->prev_samples[c->prev_samples_pos++] = rlow - rhigh; - ff_g722_apply_qmf(c->prev_samples + c->prev_samples_pos - 24, - &xout1, &xout2); - *out_buf++ = av_clip_int16(xout1 >> 11); - *out_buf++ = av_clip_int16(xout2 >> 11); - if (c->prev_samples_pos >= PREV_SAMPLES_BUF_SIZE) { - memmove(c->prev_samples, c->prev_samples + c->prev_samples_pos - 22, - 22 * sizeof(c->prev_samples[0])); - c->prev_samples_pos = 22; - } - } - - *got_frame_ptr = 1; - - return avpkt->size; -} - -AVCodec ff_adpcm_g722_decoder = { - .name = "g722", - .long_name = NULL_IF_CONFIG_SMALL("G.722 ADPCM"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ADPCM_G722, - .priv_data_size = sizeof(G722Context), - .init = g722_decode_init, - .decode = g722_decode_frame, - .capabilities = CODEC_CAP_DR1, - .priv_class = &g722_decoder_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1.c deleted file mode 100644 index ac279605c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1.c +++ /dev/null @@ -1,2477 +0,0 @@ -/* - * G.723.1 compatible decoder - * Copyright (c) 2006 Benjamin Larsson - * Copyright (c) 2010 Mohamed Naufal Basheer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * G.723.1 compatible decoder - */ - -#define BITSTREAM_READER_LE -#include "libavutil/channel_layout.h" -#include "libavutil/mem.h" -#include "libavutil/opt.h" -#include "avcodec.h" -#include "get_bits.h" -#include "acelp_vectors.h" -#include "celp_filters.h" -#include "celp_math.h" -#include "g723_1_data.h" -#include "internal.h" - -#define CNG_RANDOM_SEED 12345 - -typedef struct g723_1_context { - AVClass *class; - - G723_1_Subframe subframe[4]; - enum FrameType cur_frame_type; - enum FrameType past_frame_type; - enum Rate cur_rate; - uint8_t lsp_index[LSP_BANDS]; - int pitch_lag[2]; - int erased_frames; - - int16_t prev_lsp[LPC_ORDER]; - int16_t sid_lsp[LPC_ORDER]; - int16_t prev_excitation[PITCH_MAX]; - int16_t excitation[PITCH_MAX + FRAME_LEN + 4]; - int16_t synth_mem[LPC_ORDER]; - int16_t fir_mem[LPC_ORDER]; - int iir_mem[LPC_ORDER]; - - int random_seed; - int cng_random_seed; - int interp_index; - int interp_gain; - int sid_gain; - int cur_gain; - int reflection_coef; - int pf_gain; ///< formant postfilter - ///< gain scaling unit memory - int postfilter; - - int16_t audio[FRAME_LEN + LPC_ORDER + PITCH_MAX + 4]; - int16_t prev_data[HALF_FRAME_LEN]; - int16_t prev_weight_sig[PITCH_MAX]; - - - int16_t hpf_fir_mem; ///< highpass filter fir - int hpf_iir_mem; ///< and iir memories - int16_t perf_fir_mem[LPC_ORDER]; ///< perceptual filter fir - int16_t perf_iir_mem[LPC_ORDER]; ///< and iir memories - - int16_t harmonic_mem[PITCH_MAX]; -} G723_1_Context; - -static av_cold int g723_1_decode_init(AVCodecContext *avctx) -{ - G723_1_Context *p = avctx->priv_data; - - avctx->channel_layout = AV_CH_LAYOUT_MONO; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - avctx->channels = 1; - p->pf_gain = 1 << 12; - - memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); - memcpy(p->sid_lsp, dc_lsp, LPC_ORDER * sizeof(*p->sid_lsp)); - - p->cng_random_seed = CNG_RANDOM_SEED; - p->past_frame_type = SID_FRAME; - - return 0; -} - -/** - * Unpack the frame into parameters. - * - * @param p the context - * @param buf pointer to the input buffer - * @param buf_size size of the input buffer - */ -static int unpack_bitstream(G723_1_Context *p, const uint8_t *buf, - int buf_size) -{ - GetBitContext gb; - int ad_cb_len; - int temp, info_bits, i; - - init_get_bits(&gb, buf, buf_size * 8); - - /* Extract frame type and rate info */ - info_bits = get_bits(&gb, 2); - - if (info_bits == 3) { - p->cur_frame_type = UNTRANSMITTED_FRAME; - return 0; - } - - /* Extract 24 bit lsp indices, 8 bit for each band */ - p->lsp_index[2] = get_bits(&gb, 8); - p->lsp_index[1] = get_bits(&gb, 8); - p->lsp_index[0] = get_bits(&gb, 8); - - if (info_bits == 2) { - p->cur_frame_type = SID_FRAME; - p->subframe[0].amp_index = get_bits(&gb, 6); - return 0; - } - - /* Extract the info common to both rates */ - p->cur_rate = info_bits ? RATE_5300 : RATE_6300; - p->cur_frame_type = ACTIVE_FRAME; - - p->pitch_lag[0] = get_bits(&gb, 7); - if (p->pitch_lag[0] > 123) /* test if forbidden code */ - return -1; - p->pitch_lag[0] += PITCH_MIN; - p->subframe[1].ad_cb_lag = get_bits(&gb, 2); - - p->pitch_lag[1] = get_bits(&gb, 7); - if (p->pitch_lag[1] > 123) - return -1; - p->pitch_lag[1] += PITCH_MIN; - p->subframe[3].ad_cb_lag = get_bits(&gb, 2); - p->subframe[0].ad_cb_lag = 1; - p->subframe[2].ad_cb_lag = 1; - - for (i = 0; i < SUBFRAMES; i++) { - /* Extract combined gain */ - temp = get_bits(&gb, 12); - ad_cb_len = 170; - p->subframe[i].dirac_train = 0; - if (p->cur_rate == RATE_6300 && p->pitch_lag[i >> 1] < SUBFRAME_LEN - 2) { - p->subframe[i].dirac_train = temp >> 11; - temp &= 0x7FF; - ad_cb_len = 85; - } - p->subframe[i].ad_cb_gain = FASTDIV(temp, GAIN_LEVELS); - if (p->subframe[i].ad_cb_gain < ad_cb_len) { - p->subframe[i].amp_index = temp - p->subframe[i].ad_cb_gain * - GAIN_LEVELS; - } else { - return -1; - } - } - - p->subframe[0].grid_index = get_bits1(&gb); - p->subframe[1].grid_index = get_bits1(&gb); - p->subframe[2].grid_index = get_bits1(&gb); - p->subframe[3].grid_index = get_bits1(&gb); - - if (p->cur_rate == RATE_6300) { - skip_bits1(&gb); /* skip reserved bit */ - - /* Compute pulse_pos index using the 13-bit combined position index */ - temp = get_bits(&gb, 13); - p->subframe[0].pulse_pos = temp / 810; - - temp -= p->subframe[0].pulse_pos * 810; - p->subframe[1].pulse_pos = FASTDIV(temp, 90); - - temp -= p->subframe[1].pulse_pos * 90; - p->subframe[2].pulse_pos = FASTDIV(temp, 9); - p->subframe[3].pulse_pos = temp - p->subframe[2].pulse_pos * 9; - - p->subframe[0].pulse_pos = (p->subframe[0].pulse_pos << 16) + - get_bits(&gb, 16); - p->subframe[1].pulse_pos = (p->subframe[1].pulse_pos << 14) + - get_bits(&gb, 14); - p->subframe[2].pulse_pos = (p->subframe[2].pulse_pos << 16) + - get_bits(&gb, 16); - p->subframe[3].pulse_pos = (p->subframe[3].pulse_pos << 14) + - get_bits(&gb, 14); - - p->subframe[0].pulse_sign = get_bits(&gb, 6); - p->subframe[1].pulse_sign = get_bits(&gb, 5); - p->subframe[2].pulse_sign = get_bits(&gb, 6); - p->subframe[3].pulse_sign = get_bits(&gb, 5); - } else { /* 5300 bps */ - p->subframe[0].pulse_pos = get_bits(&gb, 12); - p->subframe[1].pulse_pos = get_bits(&gb, 12); - p->subframe[2].pulse_pos = get_bits(&gb, 12); - p->subframe[3].pulse_pos = get_bits(&gb, 12); - - p->subframe[0].pulse_sign = get_bits(&gb, 4); - p->subframe[1].pulse_sign = get_bits(&gb, 4); - p->subframe[2].pulse_sign = get_bits(&gb, 4); - p->subframe[3].pulse_sign = get_bits(&gb, 4); - } - - return 0; -} - -/** - * Bitexact implementation of sqrt(val/2). - */ -static int16_t square_root(unsigned val) -{ - av_assert2(!(val & 0x80000000)); - - return (ff_sqrt(val << 1) >> 1) & (~1); -} - -/** - * Calculate the number of left-shifts required for normalizing the input. - * - * @param num input number - * @param width width of the input, 15 or 31 bits - */ -static int normalize_bits(int num, int width) -{ - return width - av_log2(num) - 1; -} - -#define normalize_bits_int16(num) normalize_bits(num, 15) -#define normalize_bits_int32(num) normalize_bits(num, 31) - -/** - * Scale vector contents based on the largest of their absolutes. - */ -static int scale_vector(int16_t *dst, const int16_t *vector, int length) -{ - int bits, max = 0; - int i; - - for (i = 0; i < length; i++) - max |= FFABS(vector[i]); - - bits= 14 - av_log2_16bit(max); - bits= FFMAX(bits, 0); - - for (i = 0; i < length; i++) - dst[i] = vector[i] << bits >> 3; - - return bits - 3; -} - -/** - * Perform inverse quantization of LSP frequencies. - * - * @param cur_lsp the current LSP vector - * @param prev_lsp the previous LSP vector - * @param lsp_index VQ indices - * @param bad_frame bad frame flag - */ -static void inverse_quant(int16_t *cur_lsp, int16_t *prev_lsp, - uint8_t *lsp_index, int bad_frame) -{ - int min_dist, pred; - int i, j, temp, stable; - - /* Check for frame erasure */ - if (!bad_frame) { - min_dist = 0x100; - pred = 12288; - } else { - min_dist = 0x200; - pred = 23552; - lsp_index[0] = lsp_index[1] = lsp_index[2] = 0; - } - - /* Get the VQ table entry corresponding to the transmitted index */ - cur_lsp[0] = lsp_band0[lsp_index[0]][0]; - cur_lsp[1] = lsp_band0[lsp_index[0]][1]; - cur_lsp[2] = lsp_band0[lsp_index[0]][2]; - cur_lsp[3] = lsp_band1[lsp_index[1]][0]; - cur_lsp[4] = lsp_band1[lsp_index[1]][1]; - cur_lsp[5] = lsp_band1[lsp_index[1]][2]; - cur_lsp[6] = lsp_band2[lsp_index[2]][0]; - cur_lsp[7] = lsp_band2[lsp_index[2]][1]; - cur_lsp[8] = lsp_band2[lsp_index[2]][2]; - cur_lsp[9] = lsp_band2[lsp_index[2]][3]; - - /* Add predicted vector & DC component to the previously quantized vector */ - for (i = 0; i < LPC_ORDER; i++) { - temp = ((prev_lsp[i] - dc_lsp[i]) * pred + (1 << 14)) >> 15; - cur_lsp[i] += dc_lsp[i] + temp; - } - - for (i = 0; i < LPC_ORDER; i++) { - cur_lsp[0] = FFMAX(cur_lsp[0], 0x180); - cur_lsp[LPC_ORDER - 1] = FFMIN(cur_lsp[LPC_ORDER - 1], 0x7e00); - - /* Stability check */ - for (j = 1; j < LPC_ORDER; j++) { - temp = min_dist + cur_lsp[j - 1] - cur_lsp[j]; - if (temp > 0) { - temp >>= 1; - cur_lsp[j - 1] -= temp; - cur_lsp[j] += temp; - } - } - stable = 1; - for (j = 1; j < LPC_ORDER; j++) { - temp = cur_lsp[j - 1] + min_dist - cur_lsp[j] - 4; - if (temp > 0) { - stable = 0; - break; - } - } - if (stable) - break; - } - if (!stable) - memcpy(cur_lsp, prev_lsp, LPC_ORDER * sizeof(*cur_lsp)); -} - -/** - * Bitexact implementation of 2ab scaled by 1/2^16. - * - * @param a 32 bit multiplicand - * @param b 16 bit multiplier - */ -#define MULL2(a, b) \ - MULL(a,b,15) - -/** - * Convert LSP frequencies to LPC coefficients. - * - * @param lpc buffer for LPC coefficients - */ -static void lsp2lpc(int16_t *lpc) -{ - int f1[LPC_ORDER / 2 + 1]; - int f2[LPC_ORDER / 2 + 1]; - int i, j; - - /* Calculate negative cosine */ - for (j = 0; j < LPC_ORDER; j++) { - int index = (lpc[j] >> 7) & 0x1FF; - int offset = lpc[j] & 0x7f; - int temp1 = cos_tab[index] << 16; - int temp2 = (cos_tab[index + 1] - cos_tab[index]) * - ((offset << 8) + 0x80) << 1; - - lpc[j] = -(av_sat_dadd32(1 << 15, temp1 + temp2) >> 16); - } - - /* - * Compute sum and difference polynomial coefficients - * (bitexact alternative to lsp2poly() in lsp.c) - */ - /* Initialize with values in Q28 */ - f1[0] = 1 << 28; - f1[1] = (lpc[0] << 14) + (lpc[2] << 14); - f1[2] = lpc[0] * lpc[2] + (2 << 28); - - f2[0] = 1 << 28; - f2[1] = (lpc[1] << 14) + (lpc[3] << 14); - f2[2] = lpc[1] * lpc[3] + (2 << 28); - - /* - * Calculate and scale the coefficients by 1/2 in - * each iteration for a final scaling factor of Q25 - */ - for (i = 2; i < LPC_ORDER / 2; i++) { - f1[i + 1] = f1[i - 1] + MULL2(f1[i], lpc[2 * i]); - f2[i + 1] = f2[i - 1] + MULL2(f2[i], lpc[2 * i + 1]); - - for (j = i; j >= 2; j--) { - f1[j] = MULL2(f1[j - 1], lpc[2 * i]) + - (f1[j] >> 1) + (f1[j - 2] >> 1); - f2[j] = MULL2(f2[j - 1], lpc[2 * i + 1]) + - (f2[j] >> 1) + (f2[j - 2] >> 1); - } - - f1[0] >>= 1; - f2[0] >>= 1; - f1[1] = ((lpc[2 * i] << 16 >> i) + f1[1]) >> 1; - f2[1] = ((lpc[2 * i + 1] << 16 >> i) + f2[1]) >> 1; - } - - /* Convert polynomial coefficients to LPC coefficients */ - for (i = 0; i < LPC_ORDER / 2; i++) { - int64_t ff1 = f1[i + 1] + f1[i]; - int64_t ff2 = f2[i + 1] - f2[i]; - - lpc[i] = av_clipl_int32(((ff1 + ff2) << 3) + (1 << 15)) >> 16; - lpc[LPC_ORDER - i - 1] = av_clipl_int32(((ff1 - ff2) << 3) + - (1 << 15)) >> 16; - } -} - -/** - * Quantize LSP frequencies by interpolation and convert them to - * the corresponding LPC coefficients. - * - * @param lpc buffer for LPC coefficients - * @param cur_lsp the current LSP vector - * @param prev_lsp the previous LSP vector - */ -static void lsp_interpolate(int16_t *lpc, int16_t *cur_lsp, int16_t *prev_lsp) -{ - int i; - int16_t *lpc_ptr = lpc; - - /* cur_lsp * 0.25 + prev_lsp * 0.75 */ - ff_acelp_weighted_vector_sum(lpc, cur_lsp, prev_lsp, - 4096, 12288, 1 << 13, 14, LPC_ORDER); - ff_acelp_weighted_vector_sum(lpc + LPC_ORDER, cur_lsp, prev_lsp, - 8192, 8192, 1 << 13, 14, LPC_ORDER); - ff_acelp_weighted_vector_sum(lpc + 2 * LPC_ORDER, cur_lsp, prev_lsp, - 12288, 4096, 1 << 13, 14, LPC_ORDER); - memcpy(lpc + 3 * LPC_ORDER, cur_lsp, LPC_ORDER * sizeof(*lpc)); - - for (i = 0; i < SUBFRAMES; i++) { - lsp2lpc(lpc_ptr); - lpc_ptr += LPC_ORDER; - } -} - -/** - * Generate a train of dirac functions with period as pitch lag. - */ -static void gen_dirac_train(int16_t *buf, int pitch_lag) -{ - int16_t vector[SUBFRAME_LEN]; - int i, j; - - memcpy(vector, buf, SUBFRAME_LEN * sizeof(*vector)); - for (i = pitch_lag; i < SUBFRAME_LEN; i += pitch_lag) { - for (j = 0; j < SUBFRAME_LEN - i; j++) - buf[i + j] += vector[j]; - } -} - -/** - * Generate fixed codebook excitation vector. - * - * @param vector decoded excitation vector - * @param subfrm current subframe - * @param cur_rate current bitrate - * @param pitch_lag closed loop pitch lag - * @param index current subframe index - */ -static void gen_fcb_excitation(int16_t *vector, G723_1_Subframe *subfrm, - enum Rate cur_rate, int pitch_lag, int index) -{ - int temp, i, j; - - memset(vector, 0, SUBFRAME_LEN * sizeof(*vector)); - - if (cur_rate == RATE_6300) { - if (subfrm->pulse_pos >= max_pos[index]) - return; - - /* Decode amplitudes and positions */ - j = PULSE_MAX - pulses[index]; - temp = subfrm->pulse_pos; - for (i = 0; i < SUBFRAME_LEN / GRID_SIZE; i++) { - temp -= combinatorial_table[j][i]; - if (temp >= 0) - continue; - temp += combinatorial_table[j++][i]; - if (subfrm->pulse_sign & (1 << (PULSE_MAX - j))) { - vector[subfrm->grid_index + GRID_SIZE * i] = - -fixed_cb_gain[subfrm->amp_index]; - } else { - vector[subfrm->grid_index + GRID_SIZE * i] = - fixed_cb_gain[subfrm->amp_index]; - } - if (j == PULSE_MAX) - break; - } - if (subfrm->dirac_train == 1) - gen_dirac_train(vector, pitch_lag); - } else { /* 5300 bps */ - int cb_gain = fixed_cb_gain[subfrm->amp_index]; - int cb_shift = subfrm->grid_index; - int cb_sign = subfrm->pulse_sign; - int cb_pos = subfrm->pulse_pos; - int offset, beta, lag; - - for (i = 0; i < 8; i += 2) { - offset = ((cb_pos & 7) << 3) + cb_shift + i; - vector[offset] = (cb_sign & 1) ? cb_gain : -cb_gain; - cb_pos >>= 3; - cb_sign >>= 1; - } - - /* Enhance harmonic components */ - lag = pitch_contrib[subfrm->ad_cb_gain << 1] + pitch_lag + - subfrm->ad_cb_lag - 1; - beta = pitch_contrib[(subfrm->ad_cb_gain << 1) + 1]; - - if (lag < SUBFRAME_LEN - 2) { - for (i = lag; i < SUBFRAME_LEN; i++) - vector[i] += beta * vector[i - lag] >> 15; - } - } -} - -/** - * Get delayed contribution from the previous excitation vector. - */ -static void get_residual(int16_t *residual, int16_t *prev_excitation, int lag) -{ - int offset = PITCH_MAX - PITCH_ORDER / 2 - lag; - int i; - - residual[0] = prev_excitation[offset]; - residual[1] = prev_excitation[offset + 1]; - - offset += 2; - for (i = 2; i < SUBFRAME_LEN + PITCH_ORDER - 1; i++) - residual[i] = prev_excitation[offset + (i - 2) % lag]; -} - -static int dot_product(const int16_t *a, const int16_t *b, int length) -{ - int sum = ff_dot_product(a,b,length); - return av_sat_add32(sum, sum); -} - -/** - * Generate adaptive codebook excitation. - */ -static void gen_acb_excitation(int16_t *vector, int16_t *prev_excitation, - int pitch_lag, G723_1_Subframe *subfrm, - enum Rate cur_rate) -{ - int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1]; - const int16_t *cb_ptr; - int lag = pitch_lag + subfrm->ad_cb_lag - 1; - - int i; - int sum; - - get_residual(residual, prev_excitation, lag); - - /* Select quantization table */ - if (cur_rate == RATE_6300 && pitch_lag < SUBFRAME_LEN - 2) { - cb_ptr = adaptive_cb_gain85; - } else - cb_ptr = adaptive_cb_gain170; - - /* Calculate adaptive vector */ - cb_ptr += subfrm->ad_cb_gain * 20; - for (i = 0; i < SUBFRAME_LEN; i++) { - sum = ff_dot_product(residual + i, cb_ptr, PITCH_ORDER); - vector[i] = av_sat_dadd32(1 << 15, av_sat_add32(sum, sum)) >> 16; - } -} - -/** - * Estimate maximum auto-correlation around pitch lag. - * - * @param buf buffer with offset applied - * @param offset offset of the excitation vector - * @param ccr_max pointer to the maximum auto-correlation - * @param pitch_lag decoded pitch lag - * @param length length of autocorrelation - * @param dir forward lag(1) / backward lag(-1) - */ -static int autocorr_max(const int16_t *buf, int offset, int *ccr_max, - int pitch_lag, int length, int dir) -{ - int limit, ccr, lag = 0; - int i; - - pitch_lag = FFMIN(PITCH_MAX - 3, pitch_lag); - if (dir > 0) - limit = FFMIN(FRAME_LEN + PITCH_MAX - offset - length, pitch_lag + 3); - else - limit = pitch_lag + 3; - - for (i = pitch_lag - 3; i <= limit; i++) { - ccr = dot_product(buf, buf + dir * i, length); - - if (ccr > *ccr_max) { - *ccr_max = ccr; - lag = i; - } - } - return lag; -} - -/** - * Calculate pitch postfilter optimal and scaling gains. - * - * @param lag pitch postfilter forward/backward lag - * @param ppf pitch postfilter parameters - * @param cur_rate current bitrate - * @param tgt_eng target energy - * @param ccr cross-correlation - * @param res_eng residual energy - */ -static void comp_ppf_gains(int lag, PPFParam *ppf, enum Rate cur_rate, - int tgt_eng, int ccr, int res_eng) -{ - int pf_residual; /* square of postfiltered residual */ - int temp1, temp2; - - ppf->index = lag; - - temp1 = tgt_eng * res_eng >> 1; - temp2 = ccr * ccr << 1; - - if (temp2 > temp1) { - if (ccr >= res_eng) { - ppf->opt_gain = ppf_gain_weight[cur_rate]; - } else { - ppf->opt_gain = (ccr << 15) / res_eng * - ppf_gain_weight[cur_rate] >> 15; - } - /* pf_res^2 = tgt_eng + 2*ccr*gain + res_eng*gain^2 */ - temp1 = (tgt_eng << 15) + (ccr * ppf->opt_gain << 1); - temp2 = (ppf->opt_gain * ppf->opt_gain >> 15) * res_eng; - pf_residual = av_sat_add32(temp1, temp2 + (1 << 15)) >> 16; - - if (tgt_eng >= pf_residual << 1) { - temp1 = 0x7fff; - } else { - temp1 = (tgt_eng << 14) / pf_residual; - } - - /* scaling_gain = sqrt(tgt_eng/pf_res^2) */ - ppf->sc_gain = square_root(temp1 << 16); - } else { - ppf->opt_gain = 0; - ppf->sc_gain = 0x7fff; - } - - ppf->opt_gain = av_clip_int16(ppf->opt_gain * ppf->sc_gain >> 15); -} - -/** - * Calculate pitch postfilter parameters. - * - * @param p the context - * @param offset offset of the excitation vector - * @param pitch_lag decoded pitch lag - * @param ppf pitch postfilter parameters - * @param cur_rate current bitrate - */ -static void comp_ppf_coeff(G723_1_Context *p, int offset, int pitch_lag, - PPFParam *ppf, enum Rate cur_rate) -{ - - int16_t scale; - int i; - int temp1, temp2; - - /* - * 0 - target energy - * 1 - forward cross-correlation - * 2 - forward residual energy - * 3 - backward cross-correlation - * 4 - backward residual energy - */ - int energy[5] = {0, 0, 0, 0, 0}; - int16_t *buf = p->audio + LPC_ORDER + offset; - int fwd_lag = autocorr_max(buf, offset, &energy[1], pitch_lag, - SUBFRAME_LEN, 1); - int back_lag = autocorr_max(buf, offset, &energy[3], pitch_lag, - SUBFRAME_LEN, -1); - - ppf->index = 0; - ppf->opt_gain = 0; - ppf->sc_gain = 0x7fff; - - /* Case 0, Section 3.6 */ - if (!back_lag && !fwd_lag) - return; - - /* Compute target energy */ - energy[0] = dot_product(buf, buf, SUBFRAME_LEN); - - /* Compute forward residual energy */ - if (fwd_lag) - energy[2] = dot_product(buf + fwd_lag, buf + fwd_lag, SUBFRAME_LEN); - - /* Compute backward residual energy */ - if (back_lag) - energy[4] = dot_product(buf - back_lag, buf - back_lag, SUBFRAME_LEN); - - /* Normalize and shorten */ - temp1 = 0; - for (i = 0; i < 5; i++) - temp1 = FFMAX(energy[i], temp1); - - scale = normalize_bits(temp1, 31); - for (i = 0; i < 5; i++) - energy[i] = (energy[i] << scale) >> 16; - - if (fwd_lag && !back_lag) { /* Case 1 */ - comp_ppf_gains(fwd_lag, ppf, cur_rate, energy[0], energy[1], - energy[2]); - } else if (!fwd_lag) { /* Case 2 */ - comp_ppf_gains(-back_lag, ppf, cur_rate, energy[0], energy[3], - energy[4]); - } else { /* Case 3 */ - - /* - * Select the largest of energy[1]^2/energy[2] - * and energy[3]^2/energy[4] - */ - temp1 = energy[4] * ((energy[1] * energy[1] + (1 << 14)) >> 15); - temp2 = energy[2] * ((energy[3] * energy[3] + (1 << 14)) >> 15); - if (temp1 >= temp2) { - comp_ppf_gains(fwd_lag, ppf, cur_rate, energy[0], energy[1], - energy[2]); - } else { - comp_ppf_gains(-back_lag, ppf, cur_rate, energy[0], energy[3], - energy[4]); - } - } -} - -/** - * Classify frames as voiced/unvoiced. - * - * @param p the context - * @param pitch_lag decoded pitch_lag - * @param exc_eng excitation energy estimation - * @param scale scaling factor of exc_eng - * - * @return residual interpolation index if voiced, 0 otherwise - */ -static int comp_interp_index(G723_1_Context *p, int pitch_lag, - int *exc_eng, int *scale) -{ - int offset = PITCH_MAX + 2 * SUBFRAME_LEN; - int16_t *buf = p->audio + LPC_ORDER; - - int index, ccr, tgt_eng, best_eng, temp; - - *scale = scale_vector(buf, p->excitation, FRAME_LEN + PITCH_MAX); - buf += offset; - - /* Compute maximum backward cross-correlation */ - ccr = 0; - index = autocorr_max(buf, offset, &ccr, pitch_lag, SUBFRAME_LEN * 2, -1); - ccr = av_sat_add32(ccr, 1 << 15) >> 16; - - /* Compute target energy */ - tgt_eng = dot_product(buf, buf, SUBFRAME_LEN * 2); - *exc_eng = av_sat_add32(tgt_eng, 1 << 15) >> 16; - - if (ccr <= 0) - return 0; - - /* Compute best energy */ - best_eng = dot_product(buf - index, buf - index, SUBFRAME_LEN * 2); - best_eng = av_sat_add32(best_eng, 1 << 15) >> 16; - - temp = best_eng * *exc_eng >> 3; - - if (temp < ccr * ccr) { - return index; - } else - return 0; -} - -/** - * Peform residual interpolation based on frame classification. - * - * @param buf decoded excitation vector - * @param out output vector - * @param lag decoded pitch lag - * @param gain interpolated gain - * @param rseed seed for random number generator - */ -static void residual_interp(int16_t *buf, int16_t *out, int lag, - int gain, int *rseed) -{ - int i; - if (lag) { /* Voiced */ - int16_t *vector_ptr = buf + PITCH_MAX; - /* Attenuate */ - for (i = 0; i < lag; i++) - out[i] = vector_ptr[i - lag] * 3 >> 2; - av_memcpy_backptr((uint8_t*)(out + lag), lag * sizeof(*out), - (FRAME_LEN - lag) * sizeof(*out)); - } else { /* Unvoiced */ - for (i = 0; i < FRAME_LEN; i++) { - *rseed = *rseed * 521 + 259; - out[i] = gain * *rseed >> 15; - } - memset(buf, 0, (FRAME_LEN + PITCH_MAX) * sizeof(*buf)); - } -} - -/** - * Perform IIR filtering. - * - * @param fir_coef FIR coefficients - * @param iir_coef IIR coefficients - * @param src source vector - * @param dest destination vector - * @param width width of the output, 16 bits(0) / 32 bits(1) - */ -#define iir_filter(fir_coef, iir_coef, src, dest, width)\ -{\ - int m, n;\ - int res_shift = 16 & ~-(width);\ - int in_shift = 16 - res_shift;\ -\ - for (m = 0; m < SUBFRAME_LEN; m++) {\ - int64_t filter = 0;\ - for (n = 1; n <= LPC_ORDER; n++) {\ - filter -= (fir_coef)[n - 1] * (src)[m - n] -\ - (iir_coef)[n - 1] * ((dest)[m - n] >> in_shift);\ - }\ -\ - (dest)[m] = av_clipl_int32(((src)[m] << 16) + (filter << 3) +\ - (1 << 15)) >> res_shift;\ - }\ -} - -/** - * Adjust gain of postfiltered signal. - * - * @param p the context - * @param buf postfiltered output vector - * @param energy input energy coefficient - */ -static void gain_scale(G723_1_Context *p, int16_t * buf, int energy) -{ - int num, denom, gain, bits1, bits2; - int i; - - num = energy; - denom = 0; - for (i = 0; i < SUBFRAME_LEN; i++) { - int temp = buf[i] >> 2; - temp *= temp; - denom = av_sat_dadd32(denom, temp); - } - - if (num && denom) { - bits1 = normalize_bits(num, 31); - bits2 = normalize_bits(denom, 31); - num = num << bits1 >> 1; - denom <<= bits2; - - bits2 = 5 + bits1 - bits2; - bits2 = FFMAX(0, bits2); - - gain = (num >> 1) / (denom >> 16); - gain = square_root(gain << 16 >> bits2); - } else { - gain = 1 << 12; - } - - for (i = 0; i < SUBFRAME_LEN; i++) { - p->pf_gain = (15 * p->pf_gain + gain + (1 << 3)) >> 4; - buf[i] = av_clip_int16((buf[i] * (p->pf_gain + (p->pf_gain >> 4)) + - (1 << 10)) >> 11); - } -} - -/** - * Perform formant filtering. - * - * @param p the context - * @param lpc quantized lpc coefficients - * @param buf input buffer - * @param dst output buffer - */ -static void formant_postfilter(G723_1_Context *p, int16_t *lpc, - int16_t *buf, int16_t *dst) -{ - int16_t filter_coef[2][LPC_ORDER]; - int filter_signal[LPC_ORDER + FRAME_LEN], *signal_ptr; - int i, j, k; - - memcpy(buf, p->fir_mem, LPC_ORDER * sizeof(*buf)); - memcpy(filter_signal, p->iir_mem, LPC_ORDER * sizeof(*filter_signal)); - - for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) { - for (k = 0; k < LPC_ORDER; k++) { - filter_coef[0][k] = (-lpc[k] * postfilter_tbl[0][k] + - (1 << 14)) >> 15; - filter_coef[1][k] = (-lpc[k] * postfilter_tbl[1][k] + - (1 << 14)) >> 15; - } - iir_filter(filter_coef[0], filter_coef[1], buf + i, - filter_signal + i, 1); - lpc += LPC_ORDER; - } - - memcpy(p->fir_mem, buf + FRAME_LEN, LPC_ORDER * sizeof(int16_t)); - memcpy(p->iir_mem, filter_signal + FRAME_LEN, LPC_ORDER * sizeof(int)); - - buf += LPC_ORDER; - signal_ptr = filter_signal + LPC_ORDER; - for (i = 0; i < SUBFRAMES; i++) { - int temp; - int auto_corr[2]; - int scale, energy; - - /* Normalize */ - scale = scale_vector(dst, buf, SUBFRAME_LEN); - - /* Compute auto correlation coefficients */ - auto_corr[0] = dot_product(dst, dst + 1, SUBFRAME_LEN - 1); - auto_corr[1] = dot_product(dst, dst, SUBFRAME_LEN); - - /* Compute reflection coefficient */ - temp = auto_corr[1] >> 16; - if (temp) { - temp = (auto_corr[0] >> 2) / temp; - } - p->reflection_coef = (3 * p->reflection_coef + temp + 2) >> 2; - temp = -p->reflection_coef >> 1 & ~3; - - /* Compensation filter */ - for (j = 0; j < SUBFRAME_LEN; j++) { - dst[j] = av_sat_dadd32(signal_ptr[j], - (signal_ptr[j - 1] >> 16) * temp) >> 16; - } - - /* Compute normalized signal energy */ - temp = 2 * scale + 4; - if (temp < 0) { - energy = av_clipl_int32((int64_t)auto_corr[1] << -temp); - } else - energy = auto_corr[1] >> temp; - - gain_scale(p, dst, energy); - - buf += SUBFRAME_LEN; - signal_ptr += SUBFRAME_LEN; - dst += SUBFRAME_LEN; - } -} - -static int sid_gain_to_lsp_index(int gain) -{ - if (gain < 0x10) - return gain << 6; - else if (gain < 0x20) - return (gain - 8) << 7; - else - return (gain - 20) << 8; -} - -static inline int cng_rand(int *state, int base) -{ - *state = (*state * 521 + 259) & 0xFFFF; - return (*state & 0x7FFF) * base >> 15; -} - -static int estimate_sid_gain(G723_1_Context *p) -{ - int i, shift, seg, seg2, t, val, val_add, x, y; - - shift = 16 - p->cur_gain * 2; - if (shift > 0) - t = p->sid_gain << shift; - else - t = p->sid_gain >> -shift; - x = t * cng_filt[0] >> 16; - - if (x >= cng_bseg[2]) - return 0x3F; - - if (x >= cng_bseg[1]) { - shift = 4; - seg = 3; - } else { - shift = 3; - seg = (x >= cng_bseg[0]); - } - seg2 = FFMIN(seg, 3); - - val = 1 << shift; - val_add = val >> 1; - for (i = 0; i < shift; i++) { - t = seg * 32 + (val << seg2); - t *= t; - if (x >= t) - val += val_add; - else - val -= val_add; - val_add >>= 1; - } - - t = seg * 32 + (val << seg2); - y = t * t - x; - if (y <= 0) { - t = seg * 32 + ((val + 1) << seg2); - t = t * t - x; - val = ((seg2 - 1) << 4) + val; - if (t >= y) - val++; - } else { - t = seg * 32 + ((val - 1) << seg2); - t = t * t - x; - val = ((seg2 - 1) << 4) + val; - if (t >= y) - val--; - } - - return val; -} - -static void generate_noise(G723_1_Context *p) -{ - int i, j, idx, t; - int off[SUBFRAMES]; - int signs[SUBFRAMES / 2 * 11], pos[SUBFRAMES / 2 * 11]; - int tmp[SUBFRAME_LEN * 2]; - int16_t *vector_ptr; - int64_t sum; - int b0, c, delta, x, shift; - - p->pitch_lag[0] = cng_rand(&p->cng_random_seed, 21) + 123; - p->pitch_lag[1] = cng_rand(&p->cng_random_seed, 19) + 123; - - for (i = 0; i < SUBFRAMES; i++) { - p->subframe[i].ad_cb_gain = cng_rand(&p->cng_random_seed, 50) + 1; - p->subframe[i].ad_cb_lag = cng_adaptive_cb_lag[i]; - } - - for (i = 0; i < SUBFRAMES / 2; i++) { - t = cng_rand(&p->cng_random_seed, 1 << 13); - off[i * 2] = t & 1; - off[i * 2 + 1] = ((t >> 1) & 1) + SUBFRAME_LEN; - t >>= 2; - for (j = 0; j < 11; j++) { - signs[i * 11 + j] = ((t & 1) * 2 - 1) << 14; - t >>= 1; - } - } - - idx = 0; - for (i = 0; i < SUBFRAMES; i++) { - for (j = 0; j < SUBFRAME_LEN / 2; j++) - tmp[j] = j; - t = SUBFRAME_LEN / 2; - for (j = 0; j < pulses[i]; j++, idx++) { - int idx2 = cng_rand(&p->cng_random_seed, t); - - pos[idx] = tmp[idx2] * 2 + off[i]; - tmp[idx2] = tmp[--t]; - } - } - - vector_ptr = p->audio + LPC_ORDER; - memcpy(vector_ptr, p->prev_excitation, - PITCH_MAX * sizeof(*p->excitation)); - for (i = 0; i < SUBFRAMES; i += 2) { - gen_acb_excitation(vector_ptr, vector_ptr, - p->pitch_lag[i >> 1], &p->subframe[i], - p->cur_rate); - gen_acb_excitation(vector_ptr + SUBFRAME_LEN, - vector_ptr + SUBFRAME_LEN, - p->pitch_lag[i >> 1], &p->subframe[i + 1], - p->cur_rate); - - t = 0; - for (j = 0; j < SUBFRAME_LEN * 2; j++) - t |= FFABS(vector_ptr[j]); - t = FFMIN(t, 0x7FFF); - if (!t) { - shift = 0; - } else { - shift = -10 + av_log2(t); - if (shift < -2) - shift = -2; - } - sum = 0; - if (shift < 0) { - for (j = 0; j < SUBFRAME_LEN * 2; j++) { - t = vector_ptr[j] << -shift; - sum += t * t; - tmp[j] = t; - } - } else { - for (j = 0; j < SUBFRAME_LEN * 2; j++) { - t = vector_ptr[j] >> shift; - sum += t * t; - tmp[j] = t; - } - } - - b0 = 0; - for (j = 0; j < 11; j++) - b0 += tmp[pos[(i / 2) * 11 + j]] * signs[(i / 2) * 11 + j]; - b0 = (b0 * 2 * 2979LL + (1 << 29)) >> 30; // approximated division by 11 - - c = p->cur_gain * (p->cur_gain * SUBFRAME_LEN >> 5); - if (shift * 2 + 3 >= 0) - c >>= shift * 2 + 3; - else - c <<= -(shift * 2 + 3); - c = (av_clipl_int32(sum << 1) - c) * 2979LL >> 15; - - delta = b0 * b0 * 2 - c; - if (delta <= 0) { - x = -b0; - } else { - delta = square_root(delta); - x = delta - b0; - t = delta + b0; - if (FFABS(t) < FFABS(x)) - x = -t; - } - shift++; - if (shift < 0) - x >>= -shift; - else - x <<= shift; - x = av_clip(x, -10000, 10000); - - for (j = 0; j < 11; j++) { - idx = (i / 2) * 11 + j; - vector_ptr[pos[idx]] = av_clip_int16(vector_ptr[pos[idx]] + - (x * signs[idx] >> 15)); - } - - /* copy decoded data to serve as a history for the next decoded subframes */ - memcpy(vector_ptr + PITCH_MAX, vector_ptr, - sizeof(*vector_ptr) * SUBFRAME_LEN * 2); - vector_ptr += SUBFRAME_LEN * 2; - } - /* Save the excitation for the next frame */ - memcpy(p->prev_excitation, p->audio + LPC_ORDER + FRAME_LEN, - PITCH_MAX * sizeof(*p->excitation)); -} - -static int g723_1_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - G723_1_Context *p = avctx->priv_data; - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int dec_mode = buf[0] & 3; - - PPFParam ppf[SUBFRAMES]; - int16_t cur_lsp[LPC_ORDER]; - int16_t lpc[SUBFRAMES * LPC_ORDER]; - int16_t acb_vector[SUBFRAME_LEN]; - int16_t *out; - int bad_frame = 0, i, j, ret; - int16_t *audio = p->audio; - - if (buf_size < frame_size[dec_mode]) { - if (buf_size) - av_log(avctx, AV_LOG_WARNING, - "Expected %d bytes, got %d - skipping packet\n", - frame_size[dec_mode], buf_size); - *got_frame_ptr = 0; - return buf_size; - } - - if (unpack_bitstream(p, buf, buf_size) < 0) { - bad_frame = 1; - if (p->past_frame_type == ACTIVE_FRAME) - p->cur_frame_type = ACTIVE_FRAME; - else - p->cur_frame_type = UNTRANSMITTED_FRAME; - } - - frame->nb_samples = FRAME_LEN; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - - out = (int16_t *)frame->data[0]; - - if (p->cur_frame_type == ACTIVE_FRAME) { - if (!bad_frame) - p->erased_frames = 0; - else if (p->erased_frames != 3) - p->erased_frames++; - - inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, bad_frame); - lsp_interpolate(lpc, cur_lsp, p->prev_lsp); - - /* Save the lsp_vector for the next frame */ - memcpy(p->prev_lsp, cur_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); - - /* Generate the excitation for the frame */ - memcpy(p->excitation, p->prev_excitation, - PITCH_MAX * sizeof(*p->excitation)); - if (!p->erased_frames) { - int16_t *vector_ptr = p->excitation + PITCH_MAX; - - /* Update interpolation gain memory */ - p->interp_gain = fixed_cb_gain[(p->subframe[2].amp_index + - p->subframe[3].amp_index) >> 1]; - for (i = 0; i < SUBFRAMES; i++) { - gen_fcb_excitation(vector_ptr, &p->subframe[i], p->cur_rate, - p->pitch_lag[i >> 1], i); - gen_acb_excitation(acb_vector, &p->excitation[SUBFRAME_LEN * i], - p->pitch_lag[i >> 1], &p->subframe[i], - p->cur_rate); - /* Get the total excitation */ - for (j = 0; j < SUBFRAME_LEN; j++) { - int v = av_clip_int16(vector_ptr[j] << 1); - vector_ptr[j] = av_clip_int16(v + acb_vector[j]); - } - vector_ptr += SUBFRAME_LEN; - } - - vector_ptr = p->excitation + PITCH_MAX; - - p->interp_index = comp_interp_index(p, p->pitch_lag[1], - &p->sid_gain, &p->cur_gain); - - /* Peform pitch postfiltering */ - if (p->postfilter) { - i = PITCH_MAX; - for (j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) - comp_ppf_coeff(p, i, p->pitch_lag[j >> 1], - ppf + j, p->cur_rate); - - for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) - ff_acelp_weighted_vector_sum(p->audio + LPC_ORDER + i, - vector_ptr + i, - vector_ptr + i + ppf[j].index, - ppf[j].sc_gain, - ppf[j].opt_gain, - 1 << 14, 15, SUBFRAME_LEN); - } else { - audio = vector_ptr - LPC_ORDER; - } - - /* Save the excitation for the next frame */ - memcpy(p->prev_excitation, p->excitation + FRAME_LEN, - PITCH_MAX * sizeof(*p->excitation)); - } else { - p->interp_gain = (p->interp_gain * 3 + 2) >> 2; - if (p->erased_frames == 3) { - /* Mute output */ - memset(p->excitation, 0, - (FRAME_LEN + PITCH_MAX) * sizeof(*p->excitation)); - memset(p->prev_excitation, 0, - PITCH_MAX * sizeof(*p->excitation)); - memset(frame->data[0], 0, - (FRAME_LEN + LPC_ORDER) * sizeof(int16_t)); - } else { - int16_t *buf = p->audio + LPC_ORDER; - - /* Regenerate frame */ - residual_interp(p->excitation, buf, p->interp_index, - p->interp_gain, &p->random_seed); - - /* Save the excitation for the next frame */ - memcpy(p->prev_excitation, buf + (FRAME_LEN - PITCH_MAX), - PITCH_MAX * sizeof(*p->excitation)); - } - } - p->cng_random_seed = CNG_RANDOM_SEED; - } else { - if (p->cur_frame_type == SID_FRAME) { - p->sid_gain = sid_gain_to_lsp_index(p->subframe[0].amp_index); - inverse_quant(p->sid_lsp, p->prev_lsp, p->lsp_index, 0); - } else if (p->past_frame_type == ACTIVE_FRAME) { - p->sid_gain = estimate_sid_gain(p); - } - - if (p->past_frame_type == ACTIVE_FRAME) - p->cur_gain = p->sid_gain; - else - p->cur_gain = (p->cur_gain * 7 + p->sid_gain) >> 3; - generate_noise(p); - lsp_interpolate(lpc, p->sid_lsp, p->prev_lsp); - /* Save the lsp_vector for the next frame */ - memcpy(p->prev_lsp, p->sid_lsp, LPC_ORDER * sizeof(*p->prev_lsp)); - } - - p->past_frame_type = p->cur_frame_type; - - memcpy(p->audio, p->synth_mem, LPC_ORDER * sizeof(*p->audio)); - for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) - ff_celp_lp_synthesis_filter(p->audio + i, &lpc[j * LPC_ORDER], - audio + i, SUBFRAME_LEN, LPC_ORDER, - 0, 1, 1 << 12); - memcpy(p->synth_mem, p->audio + FRAME_LEN, LPC_ORDER * sizeof(*p->audio)); - - if (p->postfilter) { - formant_postfilter(p, lpc, p->audio, out); - } else { // if output is not postfiltered it should be scaled by 2 - for (i = 0; i < FRAME_LEN; i++) - out[i] = av_clip_int16(p->audio[LPC_ORDER + i] << 1); - } - - *got_frame_ptr = 1; - - return frame_size[dec_mode]; -} - -#define OFFSET(x) offsetof(G723_1_Context, x) -#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM - -static const AVOption options[] = { - { "postfilter", "postfilter on/off", OFFSET(postfilter), AV_OPT_TYPE_INT, - { .i64 = 1 }, 0, 1, AD }, - { NULL } -}; - - -static const AVClass g723_1dec_class = { - .class_name = "G.723.1 decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_g723_1_decoder = { - .name = "g723_1", - .long_name = NULL_IF_CONFIG_SMALL("G.723.1"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_G723_1, - .priv_data_size = sizeof(G723_1_Context), - .init = g723_1_decode_init, - .decode = g723_1_decode_frame, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, - .priv_class = &g723_1dec_class, -}; - -#if CONFIG_G723_1_ENCODER -#define BITSTREAM_WRITER_LE -#include "put_bits.h" - -static av_cold int g723_1_encode_init(AVCodecContext *avctx) -{ - G723_1_Context *p = avctx->priv_data; - - if (avctx->sample_rate != 8000) { - av_log(avctx, AV_LOG_ERROR, "Only 8000Hz sample rate supported\n"); - return -1; - } - - if (avctx->channels != 1) { - av_log(avctx, AV_LOG_ERROR, "Only mono supported\n"); - return AVERROR(EINVAL); - } - - if (avctx->bit_rate == 6300) { - p->cur_rate = RATE_6300; - } else if (avctx->bit_rate == 5300) { - av_log(avctx, AV_LOG_ERROR, "Bitrate not supported yet, use 6.3k\n"); - return AVERROR_PATCHWELCOME; - } else { - av_log(avctx, AV_LOG_ERROR, - "Bitrate not supported, use 6.3k\n"); - return AVERROR(EINVAL); - } - avctx->frame_size = 240; - memcpy(p->prev_lsp, dc_lsp, LPC_ORDER * sizeof(int16_t)); - - return 0; -} - -/** - * Remove DC component from the input signal. - * - * @param buf input signal - * @param fir zero memory - * @param iir pole memory - */ -static void highpass_filter(int16_t *buf, int16_t *fir, int *iir) -{ - int i; - for (i = 0; i < FRAME_LEN; i++) { - *iir = (buf[i] << 15) + ((-*fir) << 15) + MULL2(*iir, 0x7f00); - *fir = buf[i]; - buf[i] = av_clipl_int32((int64_t)*iir + (1 << 15)) >> 16; - } -} - -/** - * Estimate autocorrelation of the input vector. - * - * @param buf input buffer - * @param autocorr autocorrelation coefficients vector - */ -static void comp_autocorr(int16_t *buf, int16_t *autocorr) -{ - int i, scale, temp; - int16_t vector[LPC_FRAME]; - - scale_vector(vector, buf, LPC_FRAME); - - /* Apply the Hamming window */ - for (i = 0; i < LPC_FRAME; i++) - vector[i] = (vector[i] * hamming_window[i] + (1 << 14)) >> 15; - - /* Compute the first autocorrelation coefficient */ - temp = ff_dot_product(vector, vector, LPC_FRAME); - - /* Apply a white noise correlation factor of (1025/1024) */ - temp += temp >> 10; - - /* Normalize */ - scale = normalize_bits_int32(temp); - autocorr[0] = av_clipl_int32((int64_t)(temp << scale) + - (1 << 15)) >> 16; - - /* Compute the remaining coefficients */ - if (!autocorr[0]) { - memset(autocorr + 1, 0, LPC_ORDER * sizeof(int16_t)); - } else { - for (i = 1; i <= LPC_ORDER; i++) { - temp = ff_dot_product(vector, vector + i, LPC_FRAME - i); - temp = MULL2((temp << scale), binomial_window[i - 1]); - autocorr[i] = av_clipl_int32((int64_t)temp + (1 << 15)) >> 16; - } - } -} - -/** - * Use Levinson-Durbin recursion to compute LPC coefficients from - * autocorrelation values. - * - * @param lpc LPC coefficients vector - * @param autocorr autocorrelation coefficients vector - * @param error prediction error - */ -static void levinson_durbin(int16_t *lpc, int16_t *autocorr, int16_t error) -{ - int16_t vector[LPC_ORDER]; - int16_t partial_corr; - int i, j, temp; - - memset(lpc, 0, LPC_ORDER * sizeof(int16_t)); - - for (i = 0; i < LPC_ORDER; i++) { - /* Compute the partial correlation coefficient */ - temp = 0; - for (j = 0; j < i; j++) - temp -= lpc[j] * autocorr[i - j - 1]; - temp = ((autocorr[i] << 13) + temp) << 3; - - if (FFABS(temp) >= (error << 16)) - break; - - partial_corr = temp / (error << 1); - - lpc[i] = av_clipl_int32((int64_t)(partial_corr << 14) + - (1 << 15)) >> 16; - - /* Update the prediction error */ - temp = MULL2(temp, partial_corr); - error = av_clipl_int32((int64_t)(error << 16) - temp + - (1 << 15)) >> 16; - - memcpy(vector, lpc, i * sizeof(int16_t)); - for (j = 0; j < i; j++) { - temp = partial_corr * vector[i - j - 1] << 1; - lpc[j] = av_clipl_int32((int64_t)(lpc[j] << 16) - temp + - (1 << 15)) >> 16; - } - } -} - -/** - * Calculate LPC coefficients for the current frame. - * - * @param buf current frame - * @param prev_data 2 trailing subframes of the previous frame - * @param lpc LPC coefficients vector - */ -static void comp_lpc_coeff(int16_t *buf, int16_t *lpc) -{ - int16_t autocorr[(LPC_ORDER + 1) * SUBFRAMES]; - int16_t *autocorr_ptr = autocorr; - int16_t *lpc_ptr = lpc; - int i, j; - - for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) { - comp_autocorr(buf + i, autocorr_ptr); - levinson_durbin(lpc_ptr, autocorr_ptr + 1, autocorr_ptr[0]); - - lpc_ptr += LPC_ORDER; - autocorr_ptr += LPC_ORDER + 1; - } -} - -static void lpc2lsp(int16_t *lpc, int16_t *prev_lsp, int16_t *lsp) -{ - int f[LPC_ORDER + 2]; ///< coefficients of the sum and difference - ///< polynomials (F1, F2) ordered as - ///< f1[0], f2[0], ...., f1[5], f2[5] - - int max, shift, cur_val, prev_val, count, p; - int i, j; - int64_t temp; - - /* Initialize f1[0] and f2[0] to 1 in Q25 */ - for (i = 0; i < LPC_ORDER; i++) - lsp[i] = (lpc[i] * bandwidth_expand[i] + (1 << 14)) >> 15; - - /* Apply bandwidth expansion on the LPC coefficients */ - f[0] = f[1] = 1 << 25; - - /* Compute the remaining coefficients */ - for (i = 0; i < LPC_ORDER / 2; i++) { - /* f1 */ - f[2 * i + 2] = -f[2 * i] - ((lsp[i] + lsp[LPC_ORDER - 1 - i]) << 12); - /* f2 */ - f[2 * i + 3] = f[2 * i + 1] - ((lsp[i] - lsp[LPC_ORDER - 1 - i]) << 12); - } - - /* Divide f1[5] and f2[5] by 2 for use in polynomial evaluation */ - f[LPC_ORDER] >>= 1; - f[LPC_ORDER + 1] >>= 1; - - /* Normalize and shorten */ - max = FFABS(f[0]); - for (i = 1; i < LPC_ORDER + 2; i++) - max = FFMAX(max, FFABS(f[i])); - - shift = normalize_bits_int32(max); - - for (i = 0; i < LPC_ORDER + 2; i++) - f[i] = av_clipl_int32((int64_t)(f[i] << shift) + (1 << 15)) >> 16; - - /** - * Evaluate F1 and F2 at uniform intervals of pi/256 along the - * unit circle and check for zero crossings. - */ - p = 0; - temp = 0; - for (i = 0; i <= LPC_ORDER / 2; i++) - temp += f[2 * i] * cos_tab[0]; - prev_val = av_clipl_int32(temp << 1); - count = 0; - for ( i = 1; i < COS_TBL_SIZE / 2; i++) { - /* Evaluate */ - temp = 0; - for (j = 0; j <= LPC_ORDER / 2; j++) - temp += f[LPC_ORDER - 2 * j + p] * cos_tab[i * j % COS_TBL_SIZE]; - cur_val = av_clipl_int32(temp << 1); - - /* Check for sign change, indicating a zero crossing */ - if ((cur_val ^ prev_val) < 0) { - int abs_cur = FFABS(cur_val); - int abs_prev = FFABS(prev_val); - int sum = abs_cur + abs_prev; - - shift = normalize_bits_int32(sum); - sum <<= shift; - abs_prev = abs_prev << shift >> 8; - lsp[count++] = ((i - 1) << 7) + (abs_prev >> 1) / (sum >> 16); - - if (count == LPC_ORDER) - break; - - /* Switch between sum and difference polynomials */ - p ^= 1; - - /* Evaluate */ - temp = 0; - for (j = 0; j <= LPC_ORDER / 2; j++){ - temp += f[LPC_ORDER - 2 * j + p] * - cos_tab[i * j % COS_TBL_SIZE]; - } - cur_val = av_clipl_int32(temp<<1); - } - prev_val = cur_val; - } - - if (count != LPC_ORDER) - memcpy(lsp, prev_lsp, LPC_ORDER * sizeof(int16_t)); -} - -/** - * Quantize the current LSP subvector. - * - * @param num band number - * @param offset offset of the current subvector in an LPC_ORDER vector - * @param size size of the current subvector - */ -#define get_index(num, offset, size) \ -{\ - int error, max = -1;\ - int16_t temp[4];\ - int i, j;\ - for (i = 0; i < LSP_CB_SIZE; i++) {\ - for (j = 0; j < size; j++){\ - temp[j] = (weight[j + (offset)] * lsp_band##num[i][j] +\ - (1 << 14)) >> 15;\ - }\ - error = dot_product(lsp + (offset), temp, size) << 1;\ - error -= dot_product(lsp_band##num[i], temp, size);\ - if (error > max) {\ - max = error;\ - lsp_index[num] = i;\ - }\ - }\ -} - -/** - * Vector quantize the LSP frequencies. - * - * @param lsp the current lsp vector - * @param prev_lsp the previous lsp vector - */ -static void lsp_quantize(uint8_t *lsp_index, int16_t *lsp, int16_t *prev_lsp) -{ - int16_t weight[LPC_ORDER]; - int16_t min, max; - int shift, i; - - /* Calculate the VQ weighting vector */ - weight[0] = (1 << 20) / (lsp[1] - lsp[0]); - weight[LPC_ORDER - 1] = (1 << 20) / - (lsp[LPC_ORDER - 1] - lsp[LPC_ORDER - 2]); - - for (i = 1; i < LPC_ORDER - 1; i++) { - min = FFMIN(lsp[i] - lsp[i - 1], lsp[i + 1] - lsp[i]); - if (min > 0x20) - weight[i] = (1 << 20) / min; - else - weight[i] = INT16_MAX; - } - - /* Normalize */ - max = 0; - for (i = 0; i < LPC_ORDER; i++) - max = FFMAX(weight[i], max); - - shift = normalize_bits_int16(max); - for (i = 0; i < LPC_ORDER; i++) { - weight[i] <<= shift; - } - - /* Compute the VQ target vector */ - for (i = 0; i < LPC_ORDER; i++) { - lsp[i] -= dc_lsp[i] + - (((prev_lsp[i] - dc_lsp[i]) * 12288 + (1 << 14)) >> 15); - } - - get_index(0, 0, 3); - get_index(1, 3, 3); - get_index(2, 6, 4); -} - -/** - * Apply the formant perceptual weighting filter. - * - * @param flt_coef filter coefficients - * @param unq_lpc unquantized lpc vector - */ -static void perceptual_filter(G723_1_Context *p, int16_t *flt_coef, - int16_t *unq_lpc, int16_t *buf) -{ - int16_t vector[FRAME_LEN + LPC_ORDER]; - int i, j, k, l = 0; - - memcpy(buf, p->iir_mem, sizeof(int16_t) * LPC_ORDER); - memcpy(vector, p->fir_mem, sizeof(int16_t) * LPC_ORDER); - memcpy(vector + LPC_ORDER, buf + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); - - for (i = LPC_ORDER, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) { - for (k = 0; k < LPC_ORDER; k++) { - flt_coef[k + 2 * l] = (unq_lpc[k + l] * percept_flt_tbl[0][k] + - (1 << 14)) >> 15; - flt_coef[k + 2 * l + LPC_ORDER] = (unq_lpc[k + l] * - percept_flt_tbl[1][k] + - (1 << 14)) >> 15; - } - iir_filter(flt_coef + 2 * l, flt_coef + 2 * l + LPC_ORDER, vector + i, - buf + i, 0); - l += LPC_ORDER; - } - memcpy(p->iir_mem, buf + FRAME_LEN, sizeof(int16_t) * LPC_ORDER); - memcpy(p->fir_mem, vector + FRAME_LEN, sizeof(int16_t) * LPC_ORDER); -} - -/** - * Estimate the open loop pitch period. - * - * @param buf perceptually weighted speech - * @param start estimation is carried out from this position - */ -static int estimate_pitch(int16_t *buf, int start) -{ - int max_exp = 32; - int max_ccr = 0x4000; - int max_eng = 0x7fff; - int index = PITCH_MIN; - int offset = start - PITCH_MIN + 1; - - int ccr, eng, orig_eng, ccr_eng, exp; - int diff, temp; - - int i; - - orig_eng = ff_dot_product(buf + offset, buf + offset, HALF_FRAME_LEN); - - for (i = PITCH_MIN; i <= PITCH_MAX - 3; i++) { - offset--; - - /* Update energy and compute correlation */ - orig_eng += buf[offset] * buf[offset] - - buf[offset + HALF_FRAME_LEN] * buf[offset + HALF_FRAME_LEN]; - ccr = ff_dot_product(buf + start, buf + offset, HALF_FRAME_LEN); - if (ccr <= 0) - continue; - - /* Split into mantissa and exponent to maintain precision */ - exp = normalize_bits_int32(ccr); - ccr = av_clipl_int32((int64_t)(ccr << exp) + (1 << 15)) >> 16; - exp <<= 1; - ccr *= ccr; - temp = normalize_bits_int32(ccr); - ccr = ccr << temp >> 16; - exp += temp; - - temp = normalize_bits_int32(orig_eng); - eng = av_clipl_int32((int64_t)(orig_eng << temp) + (1 << 15)) >> 16; - exp -= temp; - - if (ccr >= eng) { - exp--; - ccr >>= 1; - } - if (exp > max_exp) - continue; - - if (exp + 1 < max_exp) - goto update; - - /* Equalize exponents before comparison */ - if (exp + 1 == max_exp) - temp = max_ccr >> 1; - else - temp = max_ccr; - ccr_eng = ccr * max_eng; - diff = ccr_eng - eng * temp; - if (diff > 0 && (i - index < PITCH_MIN || diff > ccr_eng >> 2)) { -update: - index = i; - max_exp = exp; - max_ccr = ccr; - max_eng = eng; - } - } - return index; -} - -/** - * Compute harmonic noise filter parameters. - * - * @param buf perceptually weighted speech - * @param pitch_lag open loop pitch period - * @param hf harmonic filter parameters - */ -static void comp_harmonic_coeff(int16_t *buf, int16_t pitch_lag, HFParam *hf) -{ - int ccr, eng, max_ccr, max_eng; - int exp, max, diff; - int energy[15]; - int i, j; - - for (i = 0, j = pitch_lag - 3; j <= pitch_lag + 3; i++, j++) { - /* Compute residual energy */ - energy[i << 1] = ff_dot_product(buf - j, buf - j, SUBFRAME_LEN); - /* Compute correlation */ - energy[(i << 1) + 1] = ff_dot_product(buf, buf - j, SUBFRAME_LEN); - } - - /* Compute target energy */ - energy[14] = ff_dot_product(buf, buf, SUBFRAME_LEN); - - /* Normalize */ - max = 0; - for (i = 0; i < 15; i++) - max = FFMAX(max, FFABS(energy[i])); - - exp = normalize_bits_int32(max); - for (i = 0; i < 15; i++) { - energy[i] = av_clipl_int32((int64_t)(energy[i] << exp) + - (1 << 15)) >> 16; - } - - hf->index = -1; - hf->gain = 0; - max_ccr = 1; - max_eng = 0x7fff; - - for (i = 0; i <= 6; i++) { - eng = energy[i << 1]; - ccr = energy[(i << 1) + 1]; - - if (ccr <= 0) - continue; - - ccr = (ccr * ccr + (1 << 14)) >> 15; - diff = ccr * max_eng - eng * max_ccr; - if (diff > 0) { - max_ccr = ccr; - max_eng = eng; - hf->index = i; - } - } - - if (hf->index == -1) { - hf->index = pitch_lag; - return; - } - - eng = energy[14] * max_eng; - eng = (eng >> 2) + (eng >> 3); - ccr = energy[(hf->index << 1) + 1] * energy[(hf->index << 1) + 1]; - if (eng < ccr) { - eng = energy[(hf->index << 1) + 1]; - - if (eng >= max_eng) - hf->gain = 0x2800; - else - hf->gain = ((eng << 15) / max_eng * 0x2800 + (1 << 14)) >> 15; - } - hf->index += pitch_lag - 3; -} - -/** - * Apply the harmonic noise shaping filter. - * - * @param hf filter parameters - */ -static void harmonic_filter(HFParam *hf, const int16_t *src, int16_t *dest) -{ - int i; - - for (i = 0; i < SUBFRAME_LEN; i++) { - int64_t temp = hf->gain * src[i - hf->index] << 1; - dest[i] = av_clipl_int32((src[i] << 16) - temp + (1 << 15)) >> 16; - } -} - -static void harmonic_noise_sub(HFParam *hf, const int16_t *src, int16_t *dest) -{ - int i; - for (i = 0; i < SUBFRAME_LEN; i++) { - int64_t temp = hf->gain * src[i - hf->index] << 1; - dest[i] = av_clipl_int32(((dest[i] - src[i]) << 16) + temp + - (1 << 15)) >> 16; - - } -} - -/** - * Combined synthesis and formant perceptual weighting filer. - * - * @param qnt_lpc quantized lpc coefficients - * @param perf_lpc perceptual filter coefficients - * @param perf_fir perceptual filter fir memory - * @param perf_iir perceptual filter iir memory - * @param scale the filter output will be scaled by 2^scale - */ -static void synth_percept_filter(int16_t *qnt_lpc, int16_t *perf_lpc, - int16_t *perf_fir, int16_t *perf_iir, - const int16_t *src, int16_t *dest, int scale) -{ - int i, j; - int16_t buf_16[SUBFRAME_LEN + LPC_ORDER]; - int64_t buf[SUBFRAME_LEN]; - - int16_t *bptr_16 = buf_16 + LPC_ORDER; - - memcpy(buf_16, perf_fir, sizeof(int16_t) * LPC_ORDER); - memcpy(dest - LPC_ORDER, perf_iir, sizeof(int16_t) * LPC_ORDER); - - for (i = 0; i < SUBFRAME_LEN; i++) { - int64_t temp = 0; - for (j = 1; j <= LPC_ORDER; j++) - temp -= qnt_lpc[j - 1] * bptr_16[i - j]; - - buf[i] = (src[i] << 15) + (temp << 3); - bptr_16[i] = av_clipl_int32(buf[i] + (1 << 15)) >> 16; - } - - for (i = 0; i < SUBFRAME_LEN; i++) { - int64_t fir = 0, iir = 0; - for (j = 1; j <= LPC_ORDER; j++) { - fir -= perf_lpc[j - 1] * bptr_16[i - j]; - iir += perf_lpc[j + LPC_ORDER - 1] * dest[i - j]; - } - dest[i] = av_clipl_int32(((buf[i] + (fir << 3)) << scale) + (iir << 3) + - (1 << 15)) >> 16; - } - memcpy(perf_fir, buf_16 + SUBFRAME_LEN, sizeof(int16_t) * LPC_ORDER); - memcpy(perf_iir, dest + SUBFRAME_LEN - LPC_ORDER, - sizeof(int16_t) * LPC_ORDER); -} - -/** - * Compute the adaptive codebook contribution. - * - * @param buf input signal - * @param index the current subframe index - */ -static void acb_search(G723_1_Context *p, int16_t *residual, - int16_t *impulse_resp, const int16_t *buf, - int index) -{ - - int16_t flt_buf[PITCH_ORDER][SUBFRAME_LEN]; - - const int16_t *cb_tbl = adaptive_cb_gain85; - - int ccr_buf[PITCH_ORDER * SUBFRAMES << 2]; - - int pitch_lag = p->pitch_lag[index >> 1]; - int acb_lag = 1; - int acb_gain = 0; - int odd_frame = index & 1; - int iter = 3 + odd_frame; - int count = 0; - int tbl_size = 85; - - int i, j, k, l, max; - int64_t temp; - - if (!odd_frame) { - if (pitch_lag == PITCH_MIN) - pitch_lag++; - else - pitch_lag = FFMIN(pitch_lag, PITCH_MAX - 5); - } - - for (i = 0; i < iter; i++) { - get_residual(residual, p->prev_excitation, pitch_lag + i - 1); - - for (j = 0; j < SUBFRAME_LEN; j++) { - temp = 0; - for (k = 0; k <= j; k++) - temp += residual[PITCH_ORDER - 1 + k] * impulse_resp[j - k]; - flt_buf[PITCH_ORDER - 1][j] = av_clipl_int32((temp << 1) + - (1 << 15)) >> 16; - } - - for (j = PITCH_ORDER - 2; j >= 0; j--) { - flt_buf[j][0] = ((residual[j] << 13) + (1 << 14)) >> 15; - for (k = 1; k < SUBFRAME_LEN; k++) { - temp = (flt_buf[j + 1][k - 1] << 15) + - residual[j] * impulse_resp[k]; - flt_buf[j][k] = av_clipl_int32((temp << 1) + (1 << 15)) >> 16; - } - } - - /* Compute crosscorrelation with the signal */ - for (j = 0; j < PITCH_ORDER; j++) { - temp = ff_dot_product(buf, flt_buf[j], SUBFRAME_LEN); - ccr_buf[count++] = av_clipl_int32(temp << 1); - } - - /* Compute energies */ - for (j = 0; j < PITCH_ORDER; j++) { - ccr_buf[count++] = dot_product(flt_buf[j], flt_buf[j], - SUBFRAME_LEN); - } - - for (j = 1; j < PITCH_ORDER; j++) { - for (k = 0; k < j; k++) { - temp = ff_dot_product(flt_buf[j], flt_buf[k], SUBFRAME_LEN); - ccr_buf[count++] = av_clipl_int32(temp<<2); - } - } - } - - /* Normalize and shorten */ - max = 0; - for (i = 0; i < 20 * iter; i++) - max = FFMAX(max, FFABS(ccr_buf[i])); - - temp = normalize_bits_int32(max); - - for (i = 0; i < 20 * iter; i++){ - ccr_buf[i] = av_clipl_int32((int64_t)(ccr_buf[i] << temp) + - (1 << 15)) >> 16; - } - - max = 0; - for (i = 0; i < iter; i++) { - /* Select quantization table */ - if (!odd_frame && pitch_lag + i - 1 >= SUBFRAME_LEN - 2 || - odd_frame && pitch_lag >= SUBFRAME_LEN - 2) { - cb_tbl = adaptive_cb_gain170; - tbl_size = 170; - } - - for (j = 0, k = 0; j < tbl_size; j++, k += 20) { - temp = 0; - for (l = 0; l < 20; l++) - temp += ccr_buf[20 * i + l] * cb_tbl[k + l]; - temp = av_clipl_int32(temp); - - if (temp > max) { - max = temp; - acb_gain = j; - acb_lag = i; - } - } - } - - if (!odd_frame) { - pitch_lag += acb_lag - 1; - acb_lag = 1; - } - - p->pitch_lag[index >> 1] = pitch_lag; - p->subframe[index].ad_cb_lag = acb_lag; - p->subframe[index].ad_cb_gain = acb_gain; -} - -/** - * Subtract the adaptive codebook contribution from the input - * to obtain the residual. - * - * @param buf target vector - */ -static void sub_acb_contrib(const int16_t *residual, const int16_t *impulse_resp, - int16_t *buf) -{ - int i, j; - /* Subtract adaptive CB contribution to obtain the residual */ - for (i = 0; i < SUBFRAME_LEN; i++) { - int64_t temp = buf[i] << 14; - for (j = 0; j <= i; j++) - temp -= residual[j] * impulse_resp[i - j]; - - buf[i] = av_clipl_int32((temp << 2) + (1 << 15)) >> 16; - } -} - -/** - * Quantize the residual signal using the fixed codebook (MP-MLQ). - * - * @param optim optimized fixed codebook parameters - * @param buf excitation vector - */ -static void get_fcb_param(FCBParam *optim, int16_t *impulse_resp, - int16_t *buf, int pulse_cnt, int pitch_lag) -{ - FCBParam param; - int16_t impulse_r[SUBFRAME_LEN]; - int16_t temp_corr[SUBFRAME_LEN]; - int16_t impulse_corr[SUBFRAME_LEN]; - - int ccr1[SUBFRAME_LEN]; - int ccr2[SUBFRAME_LEN]; - int amp, err, max, max_amp_index, min, scale, i, j, k, l; - - int64_t temp; - - /* Update impulse response */ - memcpy(impulse_r, impulse_resp, sizeof(int16_t) * SUBFRAME_LEN); - param.dirac_train = 0; - if (pitch_lag < SUBFRAME_LEN - 2) { - param.dirac_train = 1; - gen_dirac_train(impulse_r, pitch_lag); - } - - for (i = 0; i < SUBFRAME_LEN; i++) - temp_corr[i] = impulse_r[i] >> 1; - - /* Compute impulse response autocorrelation */ - temp = dot_product(temp_corr, temp_corr, SUBFRAME_LEN); - - scale = normalize_bits_int32(temp); - impulse_corr[0] = av_clipl_int32((temp << scale) + (1 << 15)) >> 16; - - for (i = 1; i < SUBFRAME_LEN; i++) { - temp = dot_product(temp_corr + i, temp_corr, SUBFRAME_LEN - i); - impulse_corr[i] = av_clipl_int32((temp << scale) + (1 << 15)) >> 16; - } - - /* Compute crosscorrelation of impulse response with residual signal */ - scale -= 4; - for (i = 0; i < SUBFRAME_LEN; i++){ - temp = dot_product(buf + i, impulse_r, SUBFRAME_LEN - i); - if (scale < 0) - ccr1[i] = temp >> -scale; - else - ccr1[i] = av_clipl_int32(temp << scale); - } - - /* Search loop */ - for (i = 0; i < GRID_SIZE; i++) { - /* Maximize the crosscorrelation */ - max = 0; - for (j = i; j < SUBFRAME_LEN; j += GRID_SIZE) { - temp = FFABS(ccr1[j]); - if (temp >= max) { - max = temp; - param.pulse_pos[0] = j; - } - } - - /* Quantize the gain (max crosscorrelation/impulse_corr[0]) */ - amp = max; - min = 1 << 30; - max_amp_index = GAIN_LEVELS - 2; - for (j = max_amp_index; j >= 2; j--) { - temp = av_clipl_int32((int64_t)fixed_cb_gain[j] * - impulse_corr[0] << 1); - temp = FFABS(temp - amp); - if (temp < min) { - min = temp; - max_amp_index = j; - } - } - - max_amp_index--; - /* Select additional gain values */ - for (j = 1; j < 5; j++) { - for (k = i; k < SUBFRAME_LEN; k += GRID_SIZE) { - temp_corr[k] = 0; - ccr2[k] = ccr1[k]; - } - param.amp_index = max_amp_index + j - 2; - amp = fixed_cb_gain[param.amp_index]; - - param.pulse_sign[0] = (ccr2[param.pulse_pos[0]] < 0) ? -amp : amp; - temp_corr[param.pulse_pos[0]] = 1; - - for (k = 1; k < pulse_cnt; k++) { - max = -1 << 30; - for (l = i; l < SUBFRAME_LEN; l += GRID_SIZE) { - if (temp_corr[l]) - continue; - temp = impulse_corr[FFABS(l - param.pulse_pos[k - 1])]; - temp = av_clipl_int32((int64_t)temp * - param.pulse_sign[k - 1] << 1); - ccr2[l] -= temp; - temp = FFABS(ccr2[l]); - if (temp > max) { - max = temp; - param.pulse_pos[k] = l; - } - } - - param.pulse_sign[k] = (ccr2[param.pulse_pos[k]] < 0) ? - -amp : amp; - temp_corr[param.pulse_pos[k]] = 1; - } - - /* Create the error vector */ - memset(temp_corr, 0, sizeof(int16_t) * SUBFRAME_LEN); - - for (k = 0; k < pulse_cnt; k++) - temp_corr[param.pulse_pos[k]] = param.pulse_sign[k]; - - for (k = SUBFRAME_LEN - 1; k >= 0; k--) { - temp = 0; - for (l = 0; l <= k; l++) { - int prod = av_clipl_int32((int64_t)temp_corr[l] * - impulse_r[k - l] << 1); - temp = av_clipl_int32(temp + prod); - } - temp_corr[k] = temp << 2 >> 16; - } - - /* Compute square of error */ - err = 0; - for (k = 0; k < SUBFRAME_LEN; k++) { - int64_t prod; - prod = av_clipl_int32((int64_t)buf[k] * temp_corr[k] << 1); - err = av_clipl_int32(err - prod); - prod = av_clipl_int32((int64_t)temp_corr[k] * temp_corr[k]); - err = av_clipl_int32(err + prod); - } - - /* Minimize */ - if (err < optim->min_err) { - optim->min_err = err; - optim->grid_index = i; - optim->amp_index = param.amp_index; - optim->dirac_train = param.dirac_train; - - for (k = 0; k < pulse_cnt; k++) { - optim->pulse_sign[k] = param.pulse_sign[k]; - optim->pulse_pos[k] = param.pulse_pos[k]; - } - } - } - } -} - -/** - * Encode the pulse position and gain of the current subframe. - * - * @param optim optimized fixed CB parameters - * @param buf excitation vector - */ -static void pack_fcb_param(G723_1_Subframe *subfrm, FCBParam *optim, - int16_t *buf, int pulse_cnt) -{ - int i, j; - - j = PULSE_MAX - pulse_cnt; - - subfrm->pulse_sign = 0; - subfrm->pulse_pos = 0; - - for (i = 0; i < SUBFRAME_LEN >> 1; i++) { - int val = buf[optim->grid_index + (i << 1)]; - if (!val) { - subfrm->pulse_pos += combinatorial_table[j][i]; - } else { - subfrm->pulse_sign <<= 1; - if (val < 0) subfrm->pulse_sign++; - j++; - - if (j == PULSE_MAX) break; - } - } - subfrm->amp_index = optim->amp_index; - subfrm->grid_index = optim->grid_index; - subfrm->dirac_train = optim->dirac_train; -} - -/** - * Compute the fixed codebook excitation. - * - * @param buf target vector - * @param impulse_resp impulse response of the combined filter - */ -static void fcb_search(G723_1_Context *p, int16_t *impulse_resp, - int16_t *buf, int index) -{ - FCBParam optim; - int pulse_cnt = pulses[index]; - int i; - - optim.min_err = 1 << 30; - get_fcb_param(&optim, impulse_resp, buf, pulse_cnt, SUBFRAME_LEN); - - if (p->pitch_lag[index >> 1] < SUBFRAME_LEN - 2) { - get_fcb_param(&optim, impulse_resp, buf, pulse_cnt, - p->pitch_lag[index >> 1]); - } - - /* Reconstruct the excitation */ - memset(buf, 0, sizeof(int16_t) * SUBFRAME_LEN); - for (i = 0; i < pulse_cnt; i++) - buf[optim.pulse_pos[i]] = optim.pulse_sign[i]; - - pack_fcb_param(&p->subframe[index], &optim, buf, pulse_cnt); - - if (optim.dirac_train) - gen_dirac_train(buf, p->pitch_lag[index >> 1]); -} - -/** - * Pack the frame parameters into output bitstream. - * - * @param frame output buffer - * @param size size of the buffer - */ -static int pack_bitstream(G723_1_Context *p, unsigned char *frame, int size) -{ - PutBitContext pb; - int info_bits, i, temp; - - init_put_bits(&pb, frame, size); - - if (p->cur_rate == RATE_6300) { - info_bits = 0; - put_bits(&pb, 2, info_bits); - } - - put_bits(&pb, 8, p->lsp_index[2]); - put_bits(&pb, 8, p->lsp_index[1]); - put_bits(&pb, 8, p->lsp_index[0]); - - put_bits(&pb, 7, p->pitch_lag[0] - PITCH_MIN); - put_bits(&pb, 2, p->subframe[1].ad_cb_lag); - put_bits(&pb, 7, p->pitch_lag[1] - PITCH_MIN); - put_bits(&pb, 2, p->subframe[3].ad_cb_lag); - - /* Write 12 bit combined gain */ - for (i = 0; i < SUBFRAMES; i++) { - temp = p->subframe[i].ad_cb_gain * GAIN_LEVELS + - p->subframe[i].amp_index; - if (p->cur_rate == RATE_6300) - temp += p->subframe[i].dirac_train << 11; - put_bits(&pb, 12, temp); - } - - put_bits(&pb, 1, p->subframe[0].grid_index); - put_bits(&pb, 1, p->subframe[1].grid_index); - put_bits(&pb, 1, p->subframe[2].grid_index); - put_bits(&pb, 1, p->subframe[3].grid_index); - - if (p->cur_rate == RATE_6300) { - skip_put_bits(&pb, 1); /* reserved bit */ - - /* Write 13 bit combined position index */ - temp = (p->subframe[0].pulse_pos >> 16) * 810 + - (p->subframe[1].pulse_pos >> 14) * 90 + - (p->subframe[2].pulse_pos >> 16) * 9 + - (p->subframe[3].pulse_pos >> 14); - put_bits(&pb, 13, temp); - - put_bits(&pb, 16, p->subframe[0].pulse_pos & 0xffff); - put_bits(&pb, 14, p->subframe[1].pulse_pos & 0x3fff); - put_bits(&pb, 16, p->subframe[2].pulse_pos & 0xffff); - put_bits(&pb, 14, p->subframe[3].pulse_pos & 0x3fff); - - put_bits(&pb, 6, p->subframe[0].pulse_sign); - put_bits(&pb, 5, p->subframe[1].pulse_sign); - put_bits(&pb, 6, p->subframe[2].pulse_sign); - put_bits(&pb, 5, p->subframe[3].pulse_sign); - } - - flush_put_bits(&pb); - return frame_size[info_bits]; -} - -static int g723_1_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr) -{ - G723_1_Context *p = avctx->priv_data; - int16_t unq_lpc[LPC_ORDER * SUBFRAMES]; - int16_t qnt_lpc[LPC_ORDER * SUBFRAMES]; - int16_t cur_lsp[LPC_ORDER]; - int16_t weighted_lpc[LPC_ORDER * SUBFRAMES << 1]; - int16_t vector[FRAME_LEN + PITCH_MAX]; - int offset, ret; - int16_t *in = (const int16_t *)frame->data[0]; - - HFParam hf[4]; - int i, j; - - highpass_filter(in, &p->hpf_fir_mem, &p->hpf_iir_mem); - - memcpy(vector, p->prev_data, HALF_FRAME_LEN * sizeof(int16_t)); - memcpy(vector + HALF_FRAME_LEN, in, FRAME_LEN * sizeof(int16_t)); - - comp_lpc_coeff(vector, unq_lpc); - lpc2lsp(&unq_lpc[LPC_ORDER * 3], p->prev_lsp, cur_lsp); - lsp_quantize(p->lsp_index, cur_lsp, p->prev_lsp); - - /* Update memory */ - memcpy(vector + LPC_ORDER, p->prev_data + SUBFRAME_LEN, - sizeof(int16_t) * SUBFRAME_LEN); - memcpy(vector + LPC_ORDER + SUBFRAME_LEN, in, - sizeof(int16_t) * (HALF_FRAME_LEN + SUBFRAME_LEN)); - memcpy(p->prev_data, in + HALF_FRAME_LEN, - sizeof(int16_t) * HALF_FRAME_LEN); - memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); - - perceptual_filter(p, weighted_lpc, unq_lpc, vector); - - memcpy(in, vector + LPC_ORDER, sizeof(int16_t) * FRAME_LEN); - memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); - memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); - - scale_vector(vector, vector, FRAME_LEN + PITCH_MAX); - - p->pitch_lag[0] = estimate_pitch(vector, PITCH_MAX); - p->pitch_lag[1] = estimate_pitch(vector, PITCH_MAX + HALF_FRAME_LEN); - - for (i = PITCH_MAX, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) - comp_harmonic_coeff(vector + i, p->pitch_lag[j >> 1], hf + j); - - memcpy(vector, p->prev_weight_sig, sizeof(int16_t) * PITCH_MAX); - memcpy(vector + PITCH_MAX, in, sizeof(int16_t) * FRAME_LEN); - memcpy(p->prev_weight_sig, vector + FRAME_LEN, sizeof(int16_t) * PITCH_MAX); - - for (i = 0, j = 0; j < SUBFRAMES; i += SUBFRAME_LEN, j++) - harmonic_filter(hf + j, vector + PITCH_MAX + i, in + i); - - inverse_quant(cur_lsp, p->prev_lsp, p->lsp_index, 0); - lsp_interpolate(qnt_lpc, cur_lsp, p->prev_lsp); - - memcpy(p->prev_lsp, cur_lsp, sizeof(int16_t) * LPC_ORDER); - - offset = 0; - for (i = 0; i < SUBFRAMES; i++) { - int16_t impulse_resp[SUBFRAME_LEN]; - int16_t residual[SUBFRAME_LEN + PITCH_ORDER - 1]; - int16_t flt_in[SUBFRAME_LEN]; - int16_t zero[LPC_ORDER], fir[LPC_ORDER], iir[LPC_ORDER]; - - /** - * Compute the combined impulse response of the synthesis filter, - * formant perceptual weighting filter and harmonic noise shaping filter - */ - memset(zero, 0, sizeof(int16_t) * LPC_ORDER); - memset(vector, 0, sizeof(int16_t) * PITCH_MAX); - memset(flt_in, 0, sizeof(int16_t) * SUBFRAME_LEN); - - flt_in[0] = 1 << 13; /* Unit impulse */ - synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), - zero, zero, flt_in, vector + PITCH_MAX, 1); - harmonic_filter(hf + i, vector + PITCH_MAX, impulse_resp); - - /* Compute the combined zero input response */ - flt_in[0] = 0; - memcpy(fir, p->perf_fir_mem, sizeof(int16_t) * LPC_ORDER); - memcpy(iir, p->perf_iir_mem, sizeof(int16_t) * LPC_ORDER); - - synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), - fir, iir, flt_in, vector + PITCH_MAX, 0); - memcpy(vector, p->harmonic_mem, sizeof(int16_t) * PITCH_MAX); - harmonic_noise_sub(hf + i, vector + PITCH_MAX, in); - - acb_search(p, residual, impulse_resp, in, i); - gen_acb_excitation(residual, p->prev_excitation,p->pitch_lag[i >> 1], - &p->subframe[i], p->cur_rate); - sub_acb_contrib(residual, impulse_resp, in); - - fcb_search(p, impulse_resp, in, i); - - /* Reconstruct the excitation */ - gen_acb_excitation(impulse_resp, p->prev_excitation, p->pitch_lag[i >> 1], - &p->subframe[i], RATE_6300); - - memmove(p->prev_excitation, p->prev_excitation + SUBFRAME_LEN, - sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); - for (j = 0; j < SUBFRAME_LEN; j++) - in[j] = av_clip_int16((in[j] << 1) + impulse_resp[j]); - memcpy(p->prev_excitation + PITCH_MAX - SUBFRAME_LEN, in, - sizeof(int16_t) * SUBFRAME_LEN); - - /* Update filter memories */ - synth_percept_filter(qnt_lpc + offset, weighted_lpc + (offset << 1), - p->perf_fir_mem, p->perf_iir_mem, - in, vector + PITCH_MAX, 0); - memmove(p->harmonic_mem, p->harmonic_mem + SUBFRAME_LEN, - sizeof(int16_t) * (PITCH_MAX - SUBFRAME_LEN)); - memcpy(p->harmonic_mem + PITCH_MAX - SUBFRAME_LEN, vector + PITCH_MAX, - sizeof(int16_t) * SUBFRAME_LEN); - - in += SUBFRAME_LEN; - offset += LPC_ORDER; - } - - if ((ret = ff_alloc_packet2(avctx, avpkt, 24)) < 0) - return ret; - - *got_packet_ptr = 1; - avpkt->size = pack_bitstream(p, avpkt->data, avpkt->size); - return 0; -} - -AVCodec ff_g723_1_encoder = { - .name = "g723_1", - .long_name = NULL_IF_CONFIG_SMALL("G.723.1"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_G723_1, - .priv_data_size = sizeof(G723_1_Context), - .init = g723_1_encode_init, - .encode2 = g723_1_encode_frame, - .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE}, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1_data.h deleted file mode 100644 index 38a6c5998..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g723_1_data.h +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * G723.1 compatible decoder data tables. - * Copyright (c) 2006 Benjamin Larsson - * Copyright (c) 2010 Mohamed Naufal Basheer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * G723.1 compatible decoder data tables - */ - -#ifndef AVCODEC_G723_1_DATA_H -#define AVCODEC_G723_1_DATA_H - -#include - -#define SUBFRAMES 4 -#define SUBFRAME_LEN 60 -#define FRAME_LEN (SUBFRAME_LEN << 2) -#define HALF_FRAME_LEN (FRAME_LEN / 2) -#define LPC_FRAME (HALF_FRAME_LEN + SUBFRAME_LEN) -#define LPC_ORDER 10 -#define LSP_BANDS 3 -#define LSP_CB_SIZE 256 -#define PITCH_MIN 18 -#define PITCH_MAX (PITCH_MIN + 127) -#define PITCH_ORDER 5 -#define GRID_SIZE 2 -#define PULSE_MAX 6 -#define GAIN_LEVELS 24 -#define COS_TBL_SIZE 512 - -/** - * G723.1 frame types - */ -typedef enum FrameType { - ACTIVE_FRAME, ///< Active speech - SID_FRAME, ///< Silence Insertion Descriptor frame - UNTRANSMITTED_FRAME -} FrameType; - -static const uint8_t frame_size[4] = { 24, 20, 4, 1 }; - -typedef enum Rate { - RATE_6300, - RATE_5300 -} Rate; - -/** - * G723.1 unpacked data subframe - */ -typedef struct G723_1_Subframe { - int ad_cb_lag; ///< adaptive codebook lag - int ad_cb_gain; - int dirac_train; - int pulse_sign; - int grid_index; - int amp_index; - int pulse_pos; -} G723_1_Subframe; - -/** - * Pitch postfilter parameters - */ -typedef struct { - int index; ///< postfilter backward/forward lag - int16_t opt_gain; ///< optimal gain - int16_t sc_gain; ///< scaling gain -} PPFParam; - -/** - * Harmonic filter parameters - */ -typedef struct { - int index; - int gain; -} HFParam; - -/** - * Optimized fixed codebook excitation parameters - */ -typedef struct { - int min_err; - int amp_index; - int grid_index; - int dirac_train; - int pulse_pos[PULSE_MAX]; - int pulse_sign[PULSE_MAX]; -} FCBParam; - -/** - * Postfilter gain weighting factors scaled by 2^15 - */ -static const int16_t ppf_gain_weight[2] = {0x1800, 0x2000}; - -/** - * LSP DC component - */ -static const int16_t dc_lsp[LPC_ORDER] = { - 0x0c3b, - 0x1271, - 0x1e0a, - 0x2a36, - 0x3630, - 0x406f, - 0x4d28, - 0x56f4, - 0x638c, - 0x6c46 -}; - -/** - * Cosine table scaled by 2^14 - */ -static const int16_t cos_tab[COS_TBL_SIZE+1] = { - 16384, 16383, 16379, 16373, 16364, 16353, 16340, 16324, - 16305, 16284, 16261, 16235, 16207, 16176, 16143, 16107, - 16069, 16029, 15986, 15941, 15893, 15843, 15791, 15736, - 15679, 15619, 15557, 15493, 15426, 15357, 15286, 15213, - 15137, 15059, 14978, 14896, 14811, 14724, 14635, 14543, - 14449, 14354, 14256, 14155, 14053, 13949, 13842, 13733, - 13623, 13510, 13395, 13279, 13160, 13039, 12916, 12792, - 12665, 12537, 12406, 12274, 12140, 12004, 11866, 11727, - 11585, 11442, 11297, 11151, 11003, 10853, 10702, 10549, - 10394, 10238, 10080, 9921, 9760, 9598, 9434, 9269, - 9102, 8935, 8765, 8595, 8423, 8250, 8076, 7900, - 7723, 7545, 7366, 7186, 7005, 6823, 6639, 6455, - 6270, 6084, 5897, 5708, 5520, 5330, 5139, 4948, - 4756, 4563, 4370, 4176, 3981, 3786, 3590, 3393, - 3196, 2999, 2801, 2603, 2404, 2205, 2006, 1806, - 1606, 1406, 1205, 1005, 804, 603, 402, 201, - 0, -201, -402, -603, -804, -1005, -1205, -1406, - -1606, -1806, -2006, -2205, -2404, -2603, -2801, -2999, - -3196, -3393, -3590, -3786, -3981, -4176, -4370, -4563, - -4756, -4948, -5139, -5330, -5520, -5708, -5897, -6084, - -6270, -6455, -6639, -6823, -7005, -7186, -7366, -7545, - -7723, -7900, -8076, -8250, -8423, -8595, -8765, -8935, - -9102, -9269, -9434, -9598, -9760, -9921, -10080, -10238, - -10394, -10549, -10702, -10853, -11003, -11151, -11297, -11442, - -11585, -11727, -11866, -12004, -12140, -12274, -12406, -12537, - -12665, -12792, -12916, -13039, -13160, -13279, -13395, -13510, - -13623, -13733, -13842, -13949, -14053, -14155, -14256, -14354, - -14449, -14543, -14635, -14724, -14811, -14896, -14978, -15059, - -15137, -15213, -15286, -15357, -15426, -15493, -15557, -15619, - -15679, -15736, -15791, -15843, -15893, -15941, -15986, -16029, - -16069, -16107, -16143, -16176, -16207, -16235, -16261, -16284, - -16305, -16324, -16340, -16353, -16364, -16373, -16379, -16383, - -16384, -16383, -16379, -16373, -16364, -16353, -16340, -16324, - -16305, -16284, -16261, -16235, -16207, -16176, -16143, -16107, - -16069, -16029, -15986, -15941, -15893, -15843, -15791, -15736, - -15679, -15619, -15557, -15493, -15426, -15357, -15286, -15213, - -15137, -15059, -14978, -14896, -14811, -14724, -14635, -14543, - -14449, -14354, -14256, -14155, -14053, -13949, -13842, -13733, - -13623, -13510, -13395, -13279, -13160, -13039, -12916, -12792, - -12665, -12537, -12406, -12274, -12140, -12004, -11866, -11727, - -11585, -11442, -11297, -11151, -11003, -10853, -10702, -10549, - -10394, -10238, -10080, -9921, -9760, -9598, -9434, -9269, - -9102, -8935, -8765, -8595, -8423, -8250, -8076, -7900, - -7723, -7545, -7366, -7186, -7005, -6823, -6639, -6455, - -6270, -6084, -5897, -5708, -5520, -5330, -5139, -4948, - -4756, -4563, -4370, -4176, -3981, -3786, -3590, -3393, - -3196, -2999, -2801, -2603, -2404, -2205, -2006, -1806, - -1606, -1406, -1205, -1005, -804, -603, -402, -201, - 0, 201, 402, 603, 804, 1005, 1205, 1406, - 1606, 1806, 2006, 2205, 2404, 2603, 2801, 2999, - 3196, 3393, 3590, 3786, 3981, 4176, 4370, 4563, - 4756, 4948, 5139, 5330, 5520, 5708, 5897, 6084, - 6270, 6455, 6639, 6823, 7005, 7186, 7366, 7545, - 7723, 7900, 8076, 8250, 8423, 8595, 8765, 8935, - 9102, 9269, 9434, 9598, 9760, 9921, 10080, 10238, - 10394, 10549, 10702, 10853, 11003, 11151, 11297, 11442, - 11585, 11727, 11866, 12004, 12140, 12274, 12406, 12537, - 12665, 12792, 12916, 13039, 13160, 13279, 13395, 13510, - 13623, 13733, 13842, 13949, 14053, 14155, 14256, 14354, - 14449, 14543, 14635, 14724, 14811, 14896, 14978, 15059, - 15137, 15213, 15286, 15357, 15426, 15493, 15557, 15619, - 15679, 15736, 15791, 15843, 15893, 15941, 15986, 16029, - 16069, 16107, 16143, 16176, 16207, 16235, 16261, 16284, - 16305, 16324, 16340, 16353, 16364, 16373, 16379, 16383, - 16384 -}; - -/** - * LSP VQ tables - */ -static const int16_t lsp_band0[LSP_CB_SIZE][3] = { - { 0, 0, 0}, { -270, -1372, -1032}, { -541, -1650, -1382}, - { -723, -2011, -2213}, { -941, -1122, -1942}, { -780, -1145, -2454}, - { -884, -1309, -1373}, {-1051, -1523, -1766}, {-1083, -1622, -2300}, - { -777, -1377, -2147}, { -935, -1467, -2763}, { -802, -1327, -3471}, - { -935, -1959, -3999}, { -240, -89, 222}, { -661, -257, -160}, - { -994, -466, -419}, { -188, -164, -278}, { -342, -512, -415}, - { -607, -511, -797}, { 16, 19, -716}, { 374, 425, -972}, - { -346, 245, -282}, { -265, 506, -754}, { -620, -147, 1955}, - { -742, -860, 2597}, { -150, -352, 2704}, { 305, 880, 1954}, - { 123, 731, 2766}, { -348, 765, 3327}, { 618, 221, 3258}, - { -178, -47, 4219}, { 393, 1304, 3842}, { 698, 1702, 4801}, - { 63, -584, 1229}, { -215, -732, 1704}, { 172, -335, 1909}, - { -2, 216, 1797}, { 353, 127, 2205}, {-1208, 188, 11}, - { -513, -75, -683}, { -973, 222, -646}, { -616, -843, -388}, - { -950, -1113, -359}, {-1431, -623, -705}, {-1398, -1063, -178}, - { -45, -461, 35}, { -9, -657, -216}, { 127, -1078, 95}, - { -950, -1156, 584}, {-1480, -1494, 449}, { -120, -705, 516}, - { -368, -961, 727}, { -378, -526, 973}, { -793, -614, 676}, - { -801, -755, 1287}, {-1476, -340, 1636}, { -505, -1254, 1543}, - {-1243, -1622, 1532}, { -776, -1477, -655}, {-1151, -1296, -823}, - {-1153, -1672, -1124}, {-1291, -2003, -1702}, { -622, -1283, 57}, - { -471, -1611, 509}, {-1060, -1570, -139}, { -873, -2156, -536}, - {-1716, -2021, -364}, {-2150, -3218, -1291}, {-1248, -1945, -2904}, - {-1215, -2633, -2855}, { 167, -244, 84}, { 349, -412, -217}, - { -40, -352, 632}, { 227, -529, 405}, { 68, -383, -443}, - { 167, -558, -706}, { -275, -854, -14}, { -351, -1089, -449}, - { 341, -72, -289}, { 603, -106, -474}, { 322, -219, -649}, - { 179, -317, -998}, { 450, -291, -996}, { 555, 195, -525}, - { 784, 272, -831}, { -148, -384, -849}, { 82, -536, -1357}, - { 238, -172, -1354}, { 422, -268, -1841}, { 297, -737, -2079}, - { -111, -801, -598}, { 1, -668, -984}, { -131, -818, -1299}, - { -329, -521, -1310}, { -151, -778, -1834}, { -93, -352, -1746}, - { -568, -640, -1821}, { -509, -941, -2183}, { 464, -815, -1250}, - { 79, -1133, -1597}, { -184, -1353, -2123}, { -196, -410, -2427}, - { -192, -833, -2810}, { -259, -1382, -3045}, { -217, 4, -1166}, - { -800, -325, -1219}, { -363, -830, -898}, { -661, -1134, -960}, - { -386, -980, -1501}, { -627, -1159, -1722}, { -903, -829, -855}, - { -685, -829, -1313}, {-1065, -959, -1405}, { 441, 25, -847}, - { 655, -27, -1181}, { 1159, -110, -705}, { 856, 253, -1671}, - { 415, 404, -1}, { 322, 903, -398}, { 670, 499, -292}, - { 803, 591, -610}, { 1144, 591, -814}, { 717, 183, 393}, - { 857, 381, 106}, { 609, 62, -27}, { 792, 198, -325}, - { 735, 805, 88}, { 1142, 812, 78}, { 1028, 366, -292}, - { 1309, 743, -237}, { 1615, 589, -79}, { 1010, 639, -243}, - { 999, 964, -311}, { 1500, 1137, -615}, { 988, 357, 646}, - { 1227, 667, 683}, { 1164, 1565, 894}, { 1392, 2015, 477}, - { 1138, 533, 250}, { 1437, 896, 391}, { 1765, 1118, 99}, - { 1112, 1090, 802}, { 1596, 846, 1134}, { 937, 1161, 279}, - { 1719, 1254, 683}, { 1338, 1086, 35}, { 1419, 1324, 428}, - { 1428, 1524, 40}, { 2108, 1594, 89}, { 1015, 544, 1222}, - { 1121, 925, 1263}, { 1030, 1318, 1485}, { 1295, 789, 1817}, - { 1323, 1272, 1909}, { 1724, 1237, 1803}, { 1797, 1689, 858}, - { 2149, 1367, 1301}, { 2302, 1867, 761}, { 2863, 2351, 1053}, - { 52, 163, -76}, { 230, 309, -492}, { -71, 619, 39}, - { -218, 856, 499}, { -654, 736, -207}, { -535, 1259, 155}, - { -480, 1476, 643}, { 262, 1081, 102}, { 309, 1592, -182}, - { 627, 1629, 534}, { 337, 643, 456}, { 758, 670, 713}, - { 202, 1126, 658}, { 612, 1131, 666}, { 686, 1223, 1136}, - { -131, 377, 525}, { 42, 708, 907}, { 87, 1488, 1035}, - { 432, 2117, 904}, { 137, 981, 1332}, { -447, 1014, 1136}, - { -839, 1793, 1246}, { -559, 297, 198}, { -850, 685, 446}, - {-1273, 632, 826}, { -401, -544, 173}, { -753, -793, 144}, - { -436, -9, 772}, { -115, -243, 1310}, { -670, -269, 374}, - {-1027, -13, 639}, { -887, -81, 1137}, {-1277, -455, 158}, - {-1411, -720, 736}, { 172, 88, 403}, { 386, 255, 756}, - { -500, 522, 910}, { -958, 659, 1388}, { -395, 301, 1344}, - { -356, 768, 1813}, { -613, 841, 2419}, { 445, -122, 252}, - { 629, -87, 723}, { 283, -253, 870}, { 456, -116, 1381}, - { 757, 180, 1059}, { 532, 408, 1509}, { 947, 288, 1806}, - { 1325, 994, 2524}, { 892, 1219, 3023}, { 1397, 1596, 3406}, - { 1143, 1552, 2546}, { 1850, 1433, 2710}, { -10, 134, 1002}, - { 154, 499, 1323}, { 508, 792, 1117}, { 509, 1340, 1616}, - { 762, 862, 1608}, { 787, 740, 2320}, { 794, 1727, 1283}, - { 465, 2108, 1660}, { -120, 1451, 1613}, { -386, 2016, 2169}, - { 891, 1225, 2050}, { 456, 1480, 2185}, { 1493, 1283, 1209}, - { 1397, 1636, 1518}, { 1776, 1738, 1552}, { 1572, 1698, 2141}, - { 1389, 2126, 1271}, { 1959, 2413, 1119}, { 1365, 2892, 1505}, - { 2206, 1971, 1623}, { 2076, 1950, 2280}, { 1717, 2291, 1867}, - { 2366, 2515, 1953}, { 2865, 2838, 2522}, { 2535, 3465, 2011}, - { 3381, 4127, 2638}, { 836, 2667, 2289}, { 1761, 2773, 2337}, - { 1415, 3325, 2911}, { 2354, 3138, 3126}, { 2659, 4192, 4010}, - { 1048, 1786, 1818}, { 1242, 2111, 2240}, { 1512, 2079, 2780}, - { 1573, 2491, 3138}, { 2230, 2377, 2782}, { 416, 1773, 2704}, - { 725, 2336, 3297}, { 1252, 2373, 3978}, { 2094, 2268, 3568}, - { 2011, 2712, 4528}, { 1341, 3507, 3876}, { 1216, 3919, 4922}, - { 1693, 4793, 6012} -}; - -static const int16_t lsp_band1[LSP_CB_SIZE][3] = { - { 0, 0, 0}, {-2114, -1302, 76}, {-2652, -1278, -1368}, - {-2847, -828, -349}, {-3812, -2190, -349}, {-3946, -364, -449}, - {-2725, -4492, -3607}, {-3495, -4764, -1744}, { -51, -756, 84}, - { -153, -1191, 504}, { 108, -1418, 1167}, { -835, -896, 390}, - { -569, -1702, 87}, {-1151, -1818, 933}, {-1826, -2547, 411}, - {-1842, -1818, 1451}, {-2438, -1611, 781}, {-2747, -2477, 1311}, - { -940, 1252, 477}, {-1629, 1688, 602}, {-1202, 617, 280}, - {-1737, 393, 580}, {-1528, 1077, 1199}, {-2165, -161, 1408}, - {-2504, -1087, 2371}, {-3458, -175, 1395}, {-1397, -98, -843}, - {-2252, -177, -1149}, {-1489, -726, -1283}, {-1558, -265, -1744}, - {-1867, -821, -1897}, {-2062, -1516, -2340}, {-2595, -1142, -2861}, - { 170, 46, -819}, { -193, -204, -1151}, { 326, -196, -1532}, - { 780, 329, -816}, { 201, 369, -1243}, { 650, -209, -1060}, - { 1144, -15, -1216}, { 1203, -259, -1867}, { -890, -564, -1430}, - { -638, -852, -1921}, { 177, -739, -1358}, { -261, -526, -1666}, - { 206, -407, -2255}, { 338, -526, -822}, { 421, -1095, -1009}, - { 765, -607, -1408}, { 825, -1295, -2004}, { 357, -905, -1815}, - { -58, -1248, -1588}, { -596, -1436, -2046}, { -73, -1159, -2116}, - { -115, -1382, -2581}, { -160, -1723, -1952}, { -6, -2196, -2954}, - { -649, -1705, -2603}, { -617, -1453, -3282}, { -949, -2019, -3102}, - { -812, 1544, 1937}, {-1854, 574, 2000}, {-1463, 1140, 2649}, - {-2683, 1748, 1452}, {-2486, 2241, 2523}, { 783, 1910, 1435}, - { 581, 2682, 1376}, { 236, 2197, 1885}, { -453, 2943, 2057}, - { -682, 2178, 2565}, {-1342, 3201, 3328}, { -288, -184, 262}, - { 121, -149, -183}, { 758, -412, 206}, { 1038, -204, 853}, - { 1577, -457, 700}, { 937, -640, -567}, { 1508, -528, -1024}, - { -225, -527, -427}, { -564, -1095, -332}, { -742, -353, -186}, - {-1288, -459, 84}, {-1853, -484, -274}, {-1554, -731, 825}, - {-2425, -234, 382}, {-1722, 293, -271}, {-2515, 425, -564}, - {-2599, 818, 464}, { -358, 118, -375}, { -613, 198, -874}, - { -690, 683, -324}, {-1352, 1155, -168}, {-1093, 129, -324}, - {-1184, 611, -858}, { 433, 386, -372}, { -120, 486, -634}, - { 234, 851, -631}, { 602, 128, 46}, { 1099, 410, 159}, - { 715, -145, -424}, { 1198, -85, -593}, { 1390, 367, -358}, - { 1683, 362, -964}, { 1711, 622, 45}, { 2033, 833, -383}, - { 2890, 549, -506}, { 7, 401, 52}, { 72, 811, 415}, - { 566, 668, 41}, { 467, 1218, 130}, { 68, 957, -187}, - { -25, 1649, -103}, { -661, 260, 214}, { -925, -94, 612}, - { -321, -422, 965}, { -788, -672, 1783}, { 400, -673, 779}, - { 741, -595, 1635}, { -161, 307, 657}, { -382, 836, 871}, - { -814, 400, 1223}, { 364, 606, 1247}, { 57, 75, 1571}, - { 151, 471, 2287}, { -81, 1021, 1502}, { 227, 1470, 1097}, - { 658, 1275, 1653}, { 664, 1478, 2377}, { 263, -127, 444}, - { 264, 89, 969}, { 794, 171, 576}, { 821, 186, 1226}, - { 404, 462, 517}, { 339, 918, 794}, { 1280, 1423, 196}, - { 1453, 2019, 365}, { 1615, 1481, 672}, { 2394, 1708, 508}, - { 806, 1238, 573}, { 713, 1158, 1078}, { 1285, 1436, 1232}, - { 1790, 1188, 1141}, { 765, 643, 864}, { 1032, 797, 1279}, - { 900, 563, 1827}, { 1514, 673, 2312}, { 1544, 1129, 3240}, - { 1469, 1050, 1594}, { 1945, 1318, 1988}, { 2397, 2026, 2060}, - { 3538, 2057, 2620}, { 1249, -118, 74}, { 1727, 194, 421}, - { 2078, -50, -463}, { 970, 688, -432}, { 1149, 952, -110}, - { 1254, 1275, -651}, { 1386, 929, 401}, { 1960, 1167, 232}, - { 407, -752, -243}, { 859, -1118, 172}, { -227, -860, -992}, - { -796, -1175, -1380}, { 8, -1282, -388}, { 353, -1781, -1037}, - { -732, -397, -807}, { -853, -28, -1342}, {-1229, -1207, -1959}, - {-1015, -1125, -2543}, {-1452, -1791, -2725}, {-1891, -2416, -3269}, - { -918, -1629, -783}, { -580, -2155, -698}, {-1097, -2364, -96}, - {-1387, -1513, 7}, {-1588, -2076, -664}, {-1473, -2740, -784}, - {-2378, -3149, -56}, {-2856, -2092, -169}, {-3391, -3708, 316}, - {-1176, -890, -614}, {-1944, -1061, -800}, { -299, -1517, -1000}, - { -640, -1850, -1526}, {-1454, -1536, -1233}, {-1890, -1955, -1756}, - {-1086, -1921, -2122}, { -750, -2325, -2260}, {-1325, -2413, -2673}, - {-1114, -2542, -3459}, {-1341, -2901, -3963}, {-1160, -2226, -1393}, - {-1001, -2772, -1573}, {-1594, -2641, -1978}, {-1534, -3046, -2624}, - {-2224, -2196, -675}, {-2807, -3054, -1102}, {-2008, -2840, -1186}, - {-1980, -3332, -1695}, {-1715, -3562, -505}, {-2527, -4000, -1887}, - {-2333, -2734, -2296}, {-3440, -2401, -3211}, {-2008, -3528, -3337}, - {-2247, -3291, -4510}, { -475, 949, 155}, { -149, 1365, 545}, - { -757, 1644, 1083}, { -217, 2053, 1353}, {-1433, 2301, 1462}, - { 495, 1661, 529}, { 10, 2037, 740}, { 2082, 1898, 978}, - { 2831, 2294, 911}, { 842, 793, 420}, { 1223, 1023, 863}, - { 1237, 451, 780}, { 1744, 708, 822}, { 1533, 284, 1384}, - { 2135, 609, 1538}, { 2305, 626, 540}, { 2368, 1187, 955}, - { 2586, 1255, -7}, { 3116, 1131, 726}, { 3431, 1730, 428}, - { 2734, 1648, 1307}, { 2988, 1231, 2010}, { 3523, 2024, 1488}, - { 1034, 1657, 871}, { 1206, 2163, 1036}, { 1807, 2372, 1233}, - { 1808, 1769, 1493}, { 1573, 2332, 1779}, { 1216, 1609, 1866}, - { 1480, 1898, 2513}, { 465, 2708, 2776}, { 771, 3638, 3338}, - { 1869, 2599, 2623}, { 2825, 2745, 2468}, { 2638, 2439, 1585}, - { 2094, 2970, 1308}, { 2022, 3057, 1999}, { 3428, 2912, 1816}, - { 4536, 2974, 2129}, { 1046, 2563, 2086}, { 1363, 3562, 2318}, - { 2511, 1891, 2984}, { 1866, 2306, 3986}, { 3272, 2924, 3682}, - { 3146, 3564, 2272}, { 3592, 3968, 2822}, { 2431, 3369, 3069}, - { 1931, 4709, 3090}, { 2629, 4220, 3986}, { 4639, 4056, 3664}, - { 4035, 5334, 4912} -}; - -static const int16_t lsp_band2[LSP_CB_SIZE][4] = { - { 0, 0, 0, 0}, { 601, 512, -542, 334}, - { 428, 1087, -484, -132}, { 652, 622, -391, -572}, - { 378, 799, 141, -860}, { 1040, 409, 112, -554}, - { 1123, 670, -75, -847}, { 1421, 494, -315, -1095}, - { 787, 1001, 114, -460}, { 988, 1672, 216, -681}, - { 1007, 1241, -132, -1247}, { 1073, 399, 186, -5}, - { 1262, 193, -694, -129}, { 325, 196, 51, -641}, - { 861, -59, 350, -458}, { 1261, 567, 586, -346}, - { 1532, 885, 210, -517}, { 2027, 937, 113, -792}, - { 1383, 1064, 334, 38}, { 1964, 1468, 459, 133}, - { 2062, 1186, -98, -121}, { 2577, 1445, 506, -373}, - { 2310, 1682, -2, -960}, { 2876, 1939, 765, 138}, - { 3581, 2360, 649, -414}, { 219, 176, -398, -309}, - { 434, -78, -435, -880}, { -344, 301, 265, -552}, - { -915, 470, 657, -380}, { 419, -432, -163, -453}, - { 351, -953, 8, -562}, { 789, -43, 20, -958}, - { 302, -594, -352, -1159}, { 1040, 108, -668, -924}, - { 1333, 210, -1217, -1663}, { 483, 589, -350, -1140}, - { 1003, 824, -802, -1184}, { 745, 58, -589, -1443}, - { 346, 247, -915, -1683}, { 270, 796, -720, -2043}, - { 1208, 722, -222, -193}, { 1486, 1180, -412, -672}, - { 1722, 179, -69, -521}, { 2047, 860, -666, -1410}, - { -146, 222, -281, -805}, { -189, 90, -114, -1307}, - { -152, 1086, -241, -764}, { -439, 733, -601, -1302}, - { -833, -167, -351, -601}, { -856, -422, -411, -1059}, - { -747, -355, -582, -1644}, { -837, 210, -916, -1144}, - {-1800, 32, -878, -1687}, { -48, -23, -1146, 52}, - { -350, -409, -1656, -364}, { 265, -728, -858, -577}, - { 458, -247, -1141, -997}, { 691, -407, -1988, -1161}, - { -66, -104, -705, -1249}, { -431, -93, -1191, -1844}, - { 203, -732, -1000, -1693}, { 10, -832, -1846, -1819}, - { 493, -128, -1436, -1768}, { 488, -311, -1730, -2540}, - { -653, -532, -1150, -1172}, {-1086, -289, -1706, -1533}, - { -699, -1205, -1216, -1766}, {-1032, -1481, -2074, -1523}, - { -721, -1220, -2277, -2600}, { 12, -539, -1484, -1131}, - { -40, -911, -2106, -441}, { -471, -484, -2267, -1549}, - { -141, -988, -3006, -1721}, {-1545, -2102, -583, 342}, - {-1383, -2772, -386, -13}, {-2118, -2589, -1205, 72}, - {-2147, -3231, -965, 390}, {-2949, -3300, -621, 637}, - {-3907, -4138, -865, 803}, {-1287, -845, -375, -548}, - {-1416, -1169, -487, -1277}, {-1400, -1690, -1027, -418}, - {-2018, -1909, -1188, -1260}, {-1418, -2222, -2029, -128}, - {-2067, -2998, -2693, -310}, { -950, -1028, -1538, 185}, - {-1616, -915, -2205, -549}, { 19, -821, -1145, 352}, - { 184, -1175, -1356, -627}, { -547, -1088, -1661, -911}, - { -216, -1502, -2197, -948}, { -795, -1306, -2374, -451}, - { -924, -1889, -2796, -680}, { -600, -1614, -3609, -885}, - {-2392, -2528, 319, 303}, {-2908, -2095, -310, 573}, - {-3460, -2141, 49, -113}, {-2231, -448, 675, -146}, - {-2805, -532, 1231, 479}, {-2684, -486, -200, 611}, - {-3525, -971, -198, 704}, {-3707, 173, 349, 254}, - {-4734, -1447, -34, 880}, { 777, -512, 114, -10}, - { 1250, -66, 442, -5}, { 604, 613, 452, -352}, - { 1224, 777, 675, -1014}, {-1372, -79, -1208, -238}, - {-2389, -17, -1157, -818}, {-1504, -673, -1133, -1060}, - {-1984, -799, -2005, -1973}, {-2037, -798, -1068, -105}, - {-3190, -899, -1817, -194}, { -156, -886, 394, -318}, - { -258, -1283, 551, 202}, { -536, -1729, 910, 331}, - { -847, -1109, 795, -163}, {-1171, -1128, 715, 519}, - {-1080, -1319, 1685, 668}, {-1000, -1921, 96, 211}, - {-1487, -2148, 831, 174}, {-1139, -374, 414, -4}, - {-1517, -1383, 396, -352}, {-1012, 439, -59, -967}, - {-1812, 706, -440, -1030}, {-1971, -329, -34, -827}, - {-2472, -1588, -151, -606}, {-2161, 374, -281, 76}, - {-3012, 231, -15, -690}, { 1104, 566, 721, 209}, - { 1685, 564, 383, 98}, { 1898, 750, 792, -97}, - { 556, -64, 561, -93}, { 876, 162, 913, -22}, - { 961, 675, 1296, 140}, { 756, -396, 851, 544}, - { 360, -303, 1341, 396}, { 878, -22, 1464, 863}, - { -309, -273, 642, -129}, { -686, -82, 842, 454}, - { -5, -47, 1069, 998}, { -94, 967, 1277, 298}, - { -489, 385, 1473, 746}, { -369, -717, 1333, 242}, - { 281, -993, 1726, 924}, { 464, 601, 1575, 1376}, - { -250, 206, 2339, 1175}, { -438, 377, -597, -285}, - {-1020, 787, -790, -287}, { -458, -410, 215, 295}, - { -589, -860, -121, 797}, {-1175, 122, -437, 466}, - {-1480, -121, 367, 924}, { 234, 323, 770, -555}, - { 145, 30, 996, 26}, { 66, 849, 93, -145}, - { -117, 1261, 474, -399}, {-1495, 1051, 218, -506}, - {-1390, 694, 994, 88}, { 616, 7, 78, 304}, - { 1060, 52, -62, 835}, { 833, 454, 649, 1359}, - { -770, 464, 47, 93}, { -574, 1199, -39, 379}, - { 114, -98, 488, 485}, { 727, 244, 606, 696}, - { -76, 455, 671, 546}, { -565, -13, 145, 819}, - { -376, 569, 448, 1128}, { 218, 122, 265, 1167}, - { 230, 738, 932, 1003}, { 138, 477, 36, 450}, - { 404, 787, -73, 1000}, { 497, 1259, 387, 1231}, - { 17, 207, 195, -79}, { 562, 358, 53, -158}, - { 493, 387, 478, 189}, { 678, 831, 640, 558}, - { -197, 523, 613, 57}, { 429, 894, 769, 111}, - { 67, 1174, 568, 511}, { 1242, 824, 251, 840}, - { 1419, 1074, 864, 481}, { 924, 1474, 669, 724}, - { 1539, 1879, 654, 1590}, { 445, 337, 1111, 541}, - { 472, 1421, 1264, 1094}, { 794, 735, 1103, 668}, - { 1055, 863, 1192, 1020}, { 778, 1105, 806, 1798}, - { 1052, 1527, 1587, 2151}, { 881, 1552, 1265, 391}, - { 726, 872, 1812, 601}, { 1469, 280, 1008, 616}, - { 1403, 577, 1803, 1244}, { 1650, 1314, 1148, 1072}, - { 1297, 1669, 1911, 1026}, { 2093, 1044, 2115, 1189}, - { 1644, 1961, 2587, 1512}, { 25, -315, -9, -106}, - { 290, -339, 428, -444}, { -68, -783, 735, 772}, - { 245, -555, 468, 47}, { 334, -895, 814, 146}, - { 235, 368, -964, -959}, { -203, 315, -1566, -1217}, - { 801, 17, -276, -354}, { 894, -495, -789, -635}, - { 716, 291, -1189, -357}, { 560, -260, -733, -2}, - { 679, -508, -1429, 211}, { -51, -62, -428, 557}, - { 322, -638, -211, 614}, { -878, -1057, -84, -71}, - { -388, -1415, -167, -318}, { -754, -1574, 214, -539}, - {-1419, -2004, -92, -787}, { -47, -856, -347, -255}, - { 23, -1211, -173, 320}, { -658, -487, -893, 353}, - { -783, -1587, -584, 507}, {-1420, -859, -378, 441}, - {-2095, -1491, -137, 439}, { -321, -1450, -1288, -12}, - { -359, -2113, -553, -8}, { -831, -1918, -1561, 32}, - {-1014, -2487, -1359, -939}, { -475, -311, -169, -236}, - { -907, -426, 276, -611}, { -96, -400, 50, -710}, - { -426, -1022, -10, -985}, { -197, -258, -744, -575}, - { -611, -930, -771, -394}, { -267, -776, -612, -939}, - { -256, -1346, -802, -1122}, { -796, -1570, -825, -754}, - { 712, 876, 141, 227}, { 981, 1509, 85, 124}, - { 1462, 1228, 979, -39}, { 1734, 999, 1481, 440}, - { 2293, 1116, 769, 440}, { 2504, 1480, 1241, 356}, - { 2474, 1909, 1558, 810}, { 917, 1134, 607, -134}, - { 509, 1809, 781, -123}, { 1712, 1506, 559, -423}, - { 2037, 2317, 726, -155}, { 3031, 2676, 1203, 331}, - { 3664, 3274, 1768, 531}, { 1610, 1839, 867, 183}, - { 1774, 1972, 1538, 97}, { 1822, 2158, 1282, 659}, - { 2222, 2758, 1818, 900}, { 3251, 2124, 1723, 996}, - { 3633, 2336, 2408, 1453}, { 2923, 3517, 2567, 1318}, -}; - -/** - * Used for the coding/decoding of the pulses positions - * for the MP-MLQ codebook - */ -static const int32_t combinatorial_table[PULSE_MAX][SUBFRAME_LEN/GRID_SIZE] = { - {118755, 98280, 80730, 65780, 53130, - 42504, 33649, 26334, 20349, 15504, - 11628, 8568, 6188, 4368, 3003, - 2002, 1287, 792, 462, 252, - 126, 56, 21, 6, 1, - 0, 0, 0, 0, 0}, - - { 23751, 20475, 17550, 14950, 12650, - 10626, 8855, 7315, 5985, 4845, - 3876, 3060, 2380, 1820, 1365, - 1001, 715, 495, 330, 210, - 126, 70, 35, 15, 5, - 1, 0, 0, 0, 0}, - - { 3654, 3276, 2925, 2600, 2300, - 2024, 1771, 1540, 1330, 1140, - 969, 816, 680, 560, 455, - 364, 286, 220, 165, 120, - 84, 56, 35, 20, 10, - 4, 1, 0, 0, 0}, - - { 406, 378, 351, 325, 300, - 276, 253, 231, 210, 190, - 171, 153, 136, 120, 105, - 91, 78, 66, 55, 45, - 36, 28, 21, 15, 10, - 6, 3, 1, 0, 0}, - - { 29, 28, 27, 26, 25, - 24, 23, 22, 21, 20, - 19, 18, 17, 16, 15, - 14, 13, 12, 11, 10, - 9, 8, 7, 6, 5, - 4, 3, 2, 1, 0}, - - { 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1}, -}; - -static const int16_t pitch_contrib[340] = { - 60, 0, 0, 2489, 60, 0, 0, 5217, - 1, 6171, 0, 3953, 0, 10364, 1, 9357, - -1, 8843, 1, 9396, 0, 5794, -1, 10816, - 2, 11606, -2, 12072, 0, 8616, 1, 12170, - 0, 14440, 0, 7787, -1, 13721, 0, 18205, - 0, 14471, 0, 15807, 1, 15275, 0, 13480, - -1, 18375, -1, 0, 1, 11194, -1, 13010, - 1, 18836, -2, 20354, 1, 16233, -1, 0, - 60, 0, 0, 12130, 0, 13385, 1, 17834, - 1, 20875, 0, 21996, 1, 0, 1, 18277, - -1, 21321, 1, 13738, -1, 19094, -1, 20387, - -1, 0, 0, 21008, 60, 0, -2, 22807, - 0, 15900, 1, 0, 0, 17989, -1, 22259, - 1, 24395, 1, 23138, 0, 23948, 1, 22997, - 2, 22604, -1, 25942, 0, 26246, 1, 25321, - 0, 26423, 0, 24061, 0, 27247, 60, 0, - -1, 25572, 1, 23918, 1, 25930, 2, 26408, - -1, 19049, 1, 27357, -1, 24538, 60, 0, - -1, 25093, 0, 28549, 1, 0, 0, 22793, - -1, 25659, 0, 29377, 0, 30276, 0, 26198, - 1, 22521, -1, 28919, 0, 27384, 1, 30162, - -1, 0, 0, 24237, -1, 30062, 0, 21763, - 1, 30917, 60, 0, 0, 31284, 0, 29433, - 1, 26821, 1, 28655, 0, 31327, 2, 30799, - 1, 31389, 0, 32322, 1, 31760, -2, 31830, - 0, 26936, -1, 31180, 1, 30875, 0, 27873, - -1, 30429, 1, 31050, 0, 0, 0, 31912, - 1, 31611, 0, 31565, 0, 25557, 0, 31357, - 60, 0, 1, 29536, 1, 28985, -1, 26984, - -1, 31587, 2, 30836, -2, 31133, 0, 30243, - -1, 30742, -1, 32090, 60, 0, 2, 30902, - 60, 0, 0, 30027, 0, 29042, 60, 0, - 0, 31756, 0, 24553, 0, 25636, -2, 30501, - 60, 0, -1, 29617, 0, 30649, 60, 0, - 0, 29274, 2, 30415, 0, 27480, 0, 31213, - -1, 28147, 0, 30600, 1, 31652, 2, 29068, - 60, 0, 1, 28571, 1, 28730, 1, 31422, - 0, 28257, 0, 24797, 60, 0, 0, 0, - 60, 0, 0, 22105, 0, 27852, 60, 0, - 60, 0, -1, 24214, 0, 24642, 0, 23305, - 60, 0, 60, 0, 1, 22883, 0, 21601, - 60, 0, 2, 25650, 60, 0, -2, 31253, - -2, 25144, 0, 17998 -}; - -/** - * Number of non-zero pulses in the MP-MLQ excitation - */ -static const int8_t pulses[4] = {6, 5, 6, 5}; - -/** - * Size of the MP-MLQ fixed excitation codebooks - */ -static const int32_t max_pos[4] = {593775, 142506, 593775, 142506}; - -static const int16_t fixed_cb_gain[GAIN_LEVELS] = { - 1, 2, 3, 4, 6, 9, 13, 18, - 26, 38, 55, 80, 115, 166, 240, 348, - 502, 726, 1050, 1517, 2193, 3170, 4582, 6623, -}; - -static const int16_t adaptive_cb_gain85[85 * 20] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 800, 1496, 167, -256, - -338, -39, -136, -1, -4, -6, -73, -8, - -15, 12, 23, 2, 16, 30, 3, -5, - -462, -686, 493, 2575, 311, -13, -28, -14, - -404, -5, -19, 13, 20, 72, 107, -77, - 8, 13, -9, -48, 1483, 144, 784, 928, - 1243, -134, -1, -37, -52, -94, -13, -71, - -6, -84, -8, -44, -112, -10, -59, -70, - -77, 275, 3522, 1056, -1254, 0, -4, -757, - -68, -95, 1, 16, -59, 4, -17, -227, - -5, 21, 269, 80, -125, -40, -264, 381, - 5027, 0, 0, -4, -8, -1542, 0, -2, - 0, 2, 0, 6, 38, 12, 81, -117, - 138, 332, 2215, 2574, 1339, -1, -6, -299, - -404, -109, -2, -18, -44, -21, -52, -348, - -11, -27, -181, -210, 3685, 2883, -887, 866, - -1639, -828, -507, -48, -45, -164, -648, 199, - 156, -194, -152, 46, 368, 288, -88, 86, - 1396, 2146, 2235, 345, 942, -118, -281, -305, - -7, -54, -182, -190, -292, -29, -45, -47, - -80, -123, -128, -19, 13, 4475, 3549, -804, - -655, 0, -1222, -768, -39, -26, -3, -2, - -969, 0, 219, 174, 0, 179, 141, -32, - -724, 254, 242, 6049, 2462, -32, -3, -3, - -2233, -370, 11, 10, -3, 267, -94, -89, - 108, -38, -36, -909, 626, -1713, 6121, 4561, - -1061, -23, -179, -2287, -1270, -68, 65, -233, - 640, -174, 477, -1704, 40, -111, 396, 295, - -350, 1391, 7985, 511, -405, -7, -118, -3892, - -15, -10, 29, 170, -678, 10, -43, -249, - -8, 34, 197, 12, 3144, -529, 608, 2530, - 3878, -603, -17, -22, -390, -918, 101, -116, - 19, -485, 81, -93, -744, 125, -144, -599, - 2589, -689, 3045, 5603, -404, -409, -29, -566, - -1916, -10, 108, -481, 128, -885, 235, -1041, - 63, -17, 75, 138, 3107, 513, 1374, -3594, - -4922, -589, -16, -115, -788, -1478, -97, -260, - -43, 681, 112, 301, 933, 154, 413, -1079, - 2468, 6010, 1107, -390, 1961, -372, -2204, -74, - -9, -234, -905, -166, -406, 58, 143, 26, - -295, -719, -132, 46, 4773, 2766, 2368, 4862, - -4044, -1390, -467, -342, -1443, -998, -806, -690, - -399, -1416, -821, -702, 1178, 682, 584, 1200, - 1665, -1879, 1443, 1701, 8562, -169, -215, -127, - -176, -4475, 190, -146, 165, -172, 195, -149, - -870, 982, -754, -889, 2716, 9011, -1007, 755, - -1785, -450, -4956, -61, -34, -194, -1493, 167, - 554, -125, -415, 46, 296, 982, -109, 82, - -2727, 7548, 1285, 938, 3420, -453, -3478, -100, - -53, -714, 1256, 213, -592, 156, -432, -73, - 569, -1576, -268, -196, 3677, 882, 4050, 1202, - 2323, -825, -47, -1001, -88, -329, -198, -909, - -218, -269, -64, -297, -521, -125, -574, -170, - 2046, -753, 122, 10102, 603, -255, -34, 0, - -6229, -22, 94, -15, 5, -1261, 464, -75, - -75, 27, -4, -372, 449, -1815, 10690, 3870, - -527, -12, -201, -6976, -914, -16, 49, -293, - 1184, -106, 428, -2525, 14, -58, 344, 124, - -941, 2352, 5049, 3650, 2637, -54, -337, -1556, - -813, -424, 135, 290, -725, 209, -524, -1125, - 151, -378, -812, -587, -1879, 796, 3117, 9569, - -404, -215, -38, -593, -5589, -9, 91, 357, - -151, 1097, -464, -1821, -46, 19, 76, 236, - -1715, 2043, -2096, 9946, 4001, -179, -254, -268, - -6038, -977, 213, -219, 261, 1041, -1240, 1272, - 418, -498, 511, -2429, -5772, -618, -3921, 284, - -3155, -2033, -23, -938, -4, -607, -218, -1381, - -148, 100, 10, 68, -1111, -119, -755, 54, - 382, 4748, 8003, -2064, 2198, -8, -1376, -3909, - -260, -294, -110, -186, -2319, 48, 598, 1008, - -51, -637, -1073, 277, -867, 3015, 11926, -1675, - 947, -45, -555, -8681, -171, -54, 159, 631, - -2195, -88, 308, 1219, 50, -174, -690, 96, - -4933, -432, 6757, 3771, 1352, -1485, -11, -2786, - -867, -111, -130, 2034, 178, 1135, 99, -1555, - 407, 35, -557, -311, 152, 9726, 4231, -1928, - 1490, -1, -5774, -1092, -226, -135, -90, -39, - -2511, 17, 1144, 498, -13, -884, -384, 175, - 2512, 193, 9033, 5361, -3148, -385, -2, -4980, - -1754, -605, -29, -1385, -106, -822, -63, -2956, - 482, 37, 1735, 1030, 8464, 2844, 12, 549, - 2132, -4373, -493, 0, -18, -277, -1469, -6, - -2, -284, -95, 0, -1101, -370, -1, -71, - 2141, -2602, 7166, 9046, -1350, -279, -413, -3134, - -4994, -111, 340, -936, 1138, -1182, 1436, -3957, - 176, -214, 590, 745, -244, 278, 13307, 1227, - -161, -3, -4, -10808, -91, -1, 4, 198, - -226, 18, -20, -997, -2, 2, 131, 12, - -1947, 8217, 6269, 917, -2559, -231, -4121, -2399, - -51, -399, 976, 745, -3144, 108, -460, -350, - -304, 1283, 979, 143, -1810, 2061, -2781, 6056, - 10058, -200, -259, -472, -2238, -6174, 227, -307, - 349, 669, -761, 1028, 1111, -1265, 1707, -3717, - 7827, 9161, -3409, 2473, -1510, -3739, -5122, -709, - -373, -139, -4376, 1628, 1906, -1181, -1382, 514, - 721, 844, -314, 228, -1430, 8313, 9541, -2955, - 1626, -124, -4218, -5556, -533, -161, 725, 832, - -4841, -257, 1499, 1721, 142, -825, -947, 293, - 2819, -4247, 5391, 8673, 2756, -485, -1101, -1774, - -4591, -463, 730, -927, 1397, -1492, 2248, -2854, - -474, 714, -907, -1459, 141, 14552, 690, 257, - -112, -1, -12926, -29, -4, 0, -125, -5, - -613, -2, -228, -10, 0, 99, 4, 1, - 11938, -1859, 1806, -962, -884, -8699, -211, -199, - -56, -47, 1355, -1316, 205, 701, -109, 106, - 644, -100, 97, -51, 3728, 1982, 2264, 4584, - 3131, -848, -239, -312, -1282, -598, -451, -515, - -273, -1043, -554, -633, -712, -378, -432, -876, - -1181, 766, 720, 14303, -216, -85, -35, -31, - -12486, -2, 55, 51, -33, 1031, -668, -628, - -15, 10, 9, 189, -4385, 4826, 10112, 1569, - 3388, -1173, -1421, -6242, -150, -700, 1291, 2706, - -2979, 420, -462, -969, 906, -998, -2091, -324, - -448, 1932, 15591, -1842, 657, -12, -227, -14837, - -207, -26, 52, 427, -1838, -50, 217, 1753, - 18, -77, -626, 74, -4141, 1844, 3962, 5517, - 6220, -1046, -207, -958, -1858, -2361, 466, 1001, - -446, 1394, -621, -1334, 1572, -700, -1504, -2094, - 729, -2299, 14755, 3657, -952, -32, -322, -13288, - -816, -55, 102, -656, 2071, -162, 513, -3294, - 42, -133, 857, 212, -1385, 5801, 13339, -3137, - 1344, -117, -2054, -10861, -600, -110, 490, 1127, - -4723, -265, 1111, 2554, 113, -476, -1094, 257, - 4710, 9661, 1073, -2467, 3274, -1354, -5697, -70, - -371, -654, -2777, -308, -633, 709, 1455, 161, - -941, -1930, -214, 493, 1843, -3624, 12422, 6898, - -1559, -207, -802, -9419, -2904, -148, 407, -1397, - 2748, -775, 1526, -5230, 175, -344, 1182, 656, - 1433, 2394, 2507, 1380, 8780, -125, -349, -383, - -116, -4705, -209, -219, -366, -120, -201, -211, - -768, -1283, -1343, -740, -1712, 12915, 5883, -2197, - 991, -179, -10181, -2112, -294, -60, 1350, 615, - -4638, -229, 1732, 789, 103, -781, -356, 133, - 15072, 2158, -1245, 910, -496, -13865, -284, -94, - -50, -15, -1986, 1145, 164, -837, -119, 69, - 456, 65, -37, 27, 4655, 7319, 4916, 586, - -3381, -1322, -3270, -1475, -20, -697, -2079, -1396, - -2196, -166, -261, -175, 960, 1510, 1014, 120, - 1191, -2140, 5120, 13498, -1418, -86, -279, -1600, - -11121, -122, 155, -372, 669, -981, 1763, -4218, - 103, -185, 443, 1168, -1530, -817, 8191, 9632, - -1452, -143, -40, -4095, -5663, -128, -76, 765, - 408, 900, 480, -4815, -135, -72, 726, 854, - -3236, 607, 1696, -2106, 11485, -639, -22, -175, - -270, -8051, 119, 335, -62, -416, 78, 218, - 2268, -425, -1189, 1476, 3203, -1903, -837, 9679, - 7057, -626, -221, -42, -5718, -3039, 372, 163, - -97, -1892, 1124, 494, -1380, 819, 360, -4169, - 213, -655, 17015, 620, -384, -2, -26, -17671, - -23, -9, 8, -221, 681, -8, 24, -644, - 5, -15, 399, 14, 5088, 35, -3339, 3726, - 8488, -1580, 0, -680, -847, -4397, -10, 1037, - 7, -1157, -8, 759, -2636, -18, 1730, -1930, - -988, 1454, -2688, 15039, 2682, -59, -129, -441, - -13805, -439, 87, -162, 238, 907, -1335, 2467, - 161, -238, 440, -2462, -4865, -2842, -53, 5495, - 6523, -1445, -493, 0, -1843, -2597, -844, -16, - -9, 1632, 953, 18, 1937, 1131, 21, -2188, - 3076, 15069, -2914, 1810, -971, -577, -13860, -518, - -200, -57, -2829, 547, 2680, -339, -1665, 322, - 182, 893, -172, 107, 1311, 5355, 11054, 2299, - -3654, -105, -1750, -7458, -322, -814, -428, -885, - -3613, -184, -751, -1551, 292, 1194, 2465, 512, - 4035, 5619, 4618, 1815, 1912, -994, -1927, -1301, - -201, -223, -1384, -1137, -1583, -447, -622, -511, - -471, -656, -539, -211, -2131, 2754, -4501, 12879, - 7432, -277, -463, -1236, -10124, -3371, 358, -585, - 756, 1675, -2165, 3538, 967, -1249, 2042, -5842, - 5618, -515, 3219, -4149, 4857, -1926, -16, -632, - -1050, -1440, 176, -1104, 101, 1422, -130, 815, - -1666, 152, -954, 1230, 1838, -1709, 1139, 16867, - 716, -206, -178, -79, -17366, -31, 191, -127, - 118, -1892, 1759, -1173, -80, 74, -49, -737, - 1978, -3845, 10050, 11854, -2492, -238, -902, -6164, - -8576, -379, 464, -1213, 2358, -1431, 2782, -7271, - 301, -585, 1529, 1803, -2600, 11246, 11289, -3647, - 1463, -412, -7720, -7778, -812, -130, 1784, 1791, - -7749, -578, 2504, 2513, 232, -1004, -1008, 325, - 3442, 907, 2725, 8970, 3638, -723, -50, -453, - -4911, -808, -190, -572, -150, -1884, -496, -1492, - -764, -201, -605, -1992, -126, 17498, 3481, -2003, - 1090, 0, -18689, -739, -244, -72, 135, 26, - -3717, -15, 2139, 425, 8, -1165, -231, 133, - -1814, 1048, -2164, 4070, 16272, -200, -67, -285, - -1011, -16160, 116, -239, 138, 450, -260, 537, - 1801, -1041, 2149, -4042, 9354, 12580, -1883, 962, - -617, -5341, -9660, -216, -56, -23, -7183, 1075, - 1446, -549, -738, 110, 352, 474, -71, 36, - 1708, 4199, 7387, 6335, 1003, -178, -1076, -3330, - -2449, -61, -437, -770, -1893, -660, -1623, -2856, - -104, -257, -452, -388, -2624, 5623, 17310, -2353, - 592, -420, -1930, -18288, -338, -21, 900, 2772, - -5941, -376, 807, 2486, 94, -203, -625, 85, - 1211, -850, 1193, -1926, 15992, -89, -44, -86, - -226, -15609, 62, -88, 61, 142, -100, 140, - -1182, 830, -1165, 1880, 3983, -2054, 11506, -19, - 3622, -968, -257, -8080, 0, -801, 499, -2797, - 1442, 4, -2, 13, -880, 454, -2544, 4, - -786, -1354, 16092, 7246, -1665, -37, -111, -15805, - -3205, -169, -65, 772, 1330, 348, 599, -7117, - -80, -137, 1636, 736, -4316, -511, 6674, 11665, - 4633, -1137, -15, -2719, -8305, -1310, -134, 1758, - 208, 3073, 364, -4752, 1220, 144, -1887, -3299, - 7912, 4557, 1937, 1885, 7037, -3821, -1267, -229, - -216, -3022, -2200, -935, -538, -910, -524, -222, - -3398, -1957, -832, -809, 3434, 2967, 5867, 8196, - 8766, -720, -537, -2101, -4100, -4690, -622, -1230, - -1062, -1718, -1484, -2935, -1837, -1588, -3139, -4385, - 5881, 9176, 8119, 3934, 3355, -2111, -5139, -4023, - -944, -687, -3294, -2914, -4547, -1412, -2203, -1949, - -1204, -1879, -1662, -805 -}; - -static const int16_t adaptive_cb_gain170[170 * 20] = { - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 776, 212, 715, 670, - 809, -36, -2, -31, -27, -39, -10, -33, - -9, -31, -8, -29, -38, -10, -35, -33, - 1296, 1316, -168, -320, -815, -102, -105, -1, - -6, -40, -104, 13, 13, 25, 25, -3, - 64, 65, -8, -15, -589, 680, 2478, 308, - -596, -21, -28, -375, -5, -21, 24, 89, - -102, 11, -12, -46, -21, 24, 90, 11, - -735, -487, -5, 2948, 468, -33, -14, 0, - -530, -13, -21, 0, 0, 132, 87, 0, - 21, 13, 0, -84, 1042, 1730, 1068, 333, - 626, -66, -182, -69, -6, -23, -110, -67, - -112, -21, -35, -21, -39, -66, -40, -12, - 486, -769, 4074, 2825, -1107, -14, -36, -1013, - -487, -74, 22, -120, 191, -83, 132, -702, - 32, -52, 275, 191, 1521, -767, -124, 4320, - 1026, -141, -35, 0, -1139, -64, 71, 11, - -5, -401, 202, 32, -95, 48, 7, -270, - 2425, 1267, 3439, -91, -1166, -359, -98, -722, - 0, -83, -187, -509, -266, 13, 7, 19, - 172, 90, 244, -6, -1251, 975, 173, 4039, - 2005, -95, -58, -1, -996, -245, 74, 13, - -10, 308, -240, -42, 153, -119, -21, -494, - 1820, 632, 1322, 2062, 1031, -202, -24, -106, - -259, -64, -70, -146, -51, -229, -79, -166, - -114, -39, -83, -129, -447, 4904, 244, -315, - -2038, -12, -1467, -3, -6, -253, 134, 6, - -73, -8, 94, 4, -55, 610, 30, -39, - -208, -1102, 463, -448, 5653, -2, -74, -13, - -12, -1950, -14, 5, 31, -5, -30, 12, - 71, 380, -159, 154, 4739, 2600, -1864, 856, - -1554, -1371, -412, -212, -44, -147, -752, 539, - 295, -247, -135, 97, 449, 246, -176, 81, - 1894, 3533, 35, -26, 2145, -219, -762, 0, - 0, -280, -408, -4, -7, 3, 5, 0, - -248, -462, -4, 3, -2699, 1841, 4072, 2443, - 1582, -444, -207, -1012, -364, -152, 303, 670, - -457, 402, -274, -607, 260, -177, -393, -236, - -844, 3358, 6106, -1059, -537, -43, -688, -2275, - -68, -17, 173, 314, -1251, -54, 217, 395, - -27, 110, 200, -34, 1251, 1016, 3020, 2210, - 1445, -95, -63, -556, -298, -127, -77, -230, - -187, -168, -137, -407, -110, -89, -266, -194, - 2099, 2277, 4038, 3533, -2870, -269, -316, -995, - -762, -503, -291, -517, -561, -452, -491, -871, - 367, 399, 707, 619, 400, -1114, 8516, 2422, - -1117, -9, -75, -4426, -358, -76, 27, -208, - 579, -59, 164, -1259, 27, -75, 580, 165, - -4398, -2011, 3912, -2407, 2258, -1180, -247, -934, - -353, -311, -540, 1050, 480, -646, -295, 575, - 606, 277, -539, 331, 1767, -1447, 4240, 6160, - -757, -190, -127, -1097, -2316, -35, 156, -457, - 374, -664, 544, -1594, 81, -66, 195, 284, - 1594, -1463, 1035, 6938, 1920, -155, -130, -65, - -2938, -225, 142, -100, 92, -675, 619, -438, - -186, 171, -121, -813, -562, 4716, 4085, -591, - 2421, -19, -1357, -1018, -21, -357, 162, 140, - -1175, -20, 170, 147, 83, -696, -603, 87, - 1552, 8778, -935, 354, -1424, -147, -4703, -53, - -7, -123, -831, 88, 501, -33, -189, 20, - 134, 763, -81, 30, 4831, -4431, 41, -1479, - -2976, -1424, -1198, 0, -133, -540, 1306, -12, - 11, 436, -400, 3, 877, -804, 7, -268, - 2090, 1192, 1006, 1645, 4853, -266, -86, -61, - -165, -1437, -152, -128, -73, -210, -119, -101, - -619, -353, -298, -487, 2386, 5712, 1426, -94, - 1350, -347, -1991, -124, 0, -111, -832, -207, - -497, 13, 32, 8, -196, -470, -117, 7, - -1349, 1091, 1659, 8891, 313, -111, -72, -168, - -4825, -5, 89, 136, -110, 732, -592, -900, - 25, -20, -31, -170, 9980, 916, -381, -808, - 88, -6080, -51, -8, -39, 0, -558, 232, - 21, 492, 45, -18, -53, -4, 2, 4, - 2338, -1031, -248, 3928, 6484, -333, -64, -3, - -942, -2566, 147, 35, -15, -560, 247, 59, - -925, 408, 98, -1555, 6166, -1240, -337, 3672, - -1277, -2320, -93, -6, -823, -99, 466, 126, - -25, -1382, 278, 75, 480, -96, -26, 286, - 4377, -132, -2588, 1701, 4865, -1169, -1, -409, - -176, -1444, 35, 691, -20, -454, 13, 268, - -1299, 39, 768, -505, 2594, 3295, 3944, 1481, - 682, -410, -662, -949, -133, -28, -521, -624, - -793, -234, -297, -356, -108, -137, -164, -61, - 4151, 624, 815, 4485, 2229, -1052, -23, -40, - -1228, -303, -158, -206, -31, -1136, -170, -223, - -565, -84, -111, -610, -3575, -361, 4924, 2791, - 4698, -780, -7, -1480, -475, -1347, -78, 1074, - 108, 609, 61, -839, 1025, 103, -1412, -800, - -2518, 3791, 8623, 315, 2465, -387, -877, -4538, - -6, -370, 582, 1325, -1995, 48, -73, -166, - 378, -570, -1297, -47, -691, 2989, 9957, -421, - -1142, -29, -545, -6051, -10, -79, 126, 420, - -1817, -17, 76, 256, -48, 208, 694, -29, - -1918, 104, -3190, -3410, -4440, -224, 0, -621, - -709, -1203, 12, -373, 20, -399, 21, -664, - -519, 28, -864, -924, -3359, -1668, 1854, 6939, - 1430, -688, -169, -209, -2939, -124, -341, 380, - 188, 1422, 706, -785, 293, 145, -161, -606, - 42, 9706, 3164, -952, 907, 0, -5750, -611, - -55, -50, -25, -8, -1874, 2, 564, 183, - -2, -537, -175, 52, 1607, 785, 2862, 4327, - 3307, -157, -37, -500, -1143, -667, -77, -280, - -137, -424, -207, -756, -324, -158, -577, -873, - 6801, 3416, 2227, 1682, -3217, -2823, -712, -302, - -172, -631, -1418, -924, -464, -698, -350, -228, - 1335, 670, 437, 330, 3459, 3898, 364, 7841, - -2640, -730, -927, -8, -3753, -425, -823, -76, - -86, -1655, -1865, -174, 557, 628, 58, 1263, - -5902, -3458, -2465, -1886, 4334, -2126, -730, -371, - -217, -1146, -1245, -888, -520, -679, -398, -283, - 1561, 915, 652, 499, -3710, 1133, 7849, 3443, - -215, -840, -78, -3760, -723, -2, 256, 1777, - -543, 779, -238, -1649, -48, 14, 103, 45, - 4132, 2828, 2, -4212, -4116, -1042, -488, 0, - -1083, -1034, -713, 0, 0, 1062, 727, 0, - 1038, 710, 0, -1058, 5875, 8496, -1796, 1376, - -1786, -2107, -4406, -197, -115, -194, -3047, 644, - 931, -493, -713, 150, 640, 926, -195, 150, - 3143, 3483, 3546, -793, 4489, -603, -740, -767, - -38, -1230, -668, -680, -754, 152, 168, 171, - -861, -954, -971, 217, 2845, 7965, 3695, -5432, - 3978, -494, -3873, -833, -1801, -966, -1383, -641, - -1796, 943, 2641, 1225, -691, -1934, -897, 1319, - 1538, 150, 7139, 2049, 3097, -144, -1, -3110, - -256, -585, -14, -670, -65, -192, -18, -892, - -290, -28, -1349, -387, 618, 7520, 4729, -238, - -3373, -23, -3452, -1365, -3, -694, -283, -178, - -2170, 8, 109, 68, 127, 1548, 973, -49, - 2965, -3013, 7912, 7076, -1997, -536, -554, -3821, - -3056, -243, 545, -1431, 1455, -1280, 1301, -3417, - 361, -367, 964, 862, 2443, -929, -1113, 9677, - 4138, -364, -52, -75, -5716, -1045, 138, 166, - -63, -1443, 549, 657, -617, 234, 281, -2444, - 1966, 3309, 10085, -3399, 2105, -236, -668, -6207, - -705, -270, -397, -1210, -2037, 408, 686, 2092, - -252, -425, -1295, 436, -112, -1368, 8868, 4822, - 2048, 0, -114, -4800, -1419, -256, -9, 61, - 740, 33, 402, -2610, 14, 171, -1108, -602, - -2597, 438, -1839, 6229, 7266, -411, -11, -206, - -2368, -3223, 69, -291, 49, 987, -166, 699, - 1152, -194, 816, -2763, 3454, 553, 9127, 4946, - -5596, -728, -18, -5084, -1493, -1911, -116, -1924, - -308, -1042, -166, -2755, 1179, 188, 3117, 1689, - -532, -663, 12262, 2495, -1004, -17, -26, -9177, - -380, -61, -21, 398, 496, 81, 101, -1867, - -32, -40, 751, 152, -2100, 1317, -1509, 11425, - 2997, -269, -105, -139, -7967, -548, 168, -193, - 121, 1464, -918, 1052, 384, -240, 276, -2090, - 1193, -2697, 11259, 5373, -763, -86, -444, -7737, - -1762, -35, 196, -819, 1853, -391, 884, -3692, - 55, -125, 525, 250, 2405, -471, 11079, 203, - 782, -353, -13, -7491, -2, -37, 69, -1626, - 318, -29, 5, -137, -114, 22, -529, -9, - -1871, 5685, 11290, -2662, 1353, -213, -1972, -7780, - -432, -111, 649, 1289, -3917, -304, 923, 1834, - 154, -469, -932, 220, -3768, 5927, -3093, 5041, - 5212, -866, -2144, -584, -1551, -1658, 1363, -711, - 1119, 1159, -1824, 951, 1198, -1885, 984, -1603, - -2546, 9502, 5969, -2440, 1928, -395, -5511, -2175, - -363, -226, 1477, 927, -3462, -379, 1415, 889, - 299, -1118, -702, 287, -4963, 3568, 4592, 5508, - 3451, -1503, -777, -1287, -1851, -727, 1080, 1391, - -1000, 1668, -1199, -1543, 1045, -751, -967, -1160, - 1745, -2586, 3983, 10899, -1551, -186, -408, -968, - -7250, -146, 275, -424, 628, -1161, 1720, -2649, - 165, -244, 377, 1032, 867, -456, -727, 3369, - 11822, -45, -12, -32, -692, -8531, 24, 38, - -20, -178, 93, 149, -625, 329, 525, -2431, - 7535, 2422, 1926, 1405, 1599, -3466, -358, -226, - -120, -156, -1114, -886, -284, -646, -207, -165, - -735, -236, -188, -137, 1041, -735, -142, 13209, - 1515, -66, -33, -1, -10649, -140, 46, 9, - -6, -839, 593, 114, -96, 68, 13, -1222, - 7950, 6745, -1444, -1008, 2721, -3857, -2777, -127, - -62, -452, -3273, 700, 594, 489, 415, -88, - -1320, -1120, 239, 167, -4754, -1379, 4522, -578, - -5733, -1379, -116, -1248, -20, -2006, -400, 1312, - 380, -167, -48, 159, -1663, -482, 1582, -202, - 3220, 5978, 5923, 2430, -2689, -633, -2181, -2141, - -360, -441, -1175, -1164, -2161, -477, -886, -878, - 528, 981, 972, 398, 377, 1312, 13978, -1470, - 677, -8, -105, -11925, -132, -28, -30, -321, - -1119, 33, 117, 1254, -15, -54, -577, 60, - -3435, 6770, 314, -885, 5686, -720, -2797, -6, - -47, -1973, 1419, 65, -129, -185, 366, 16, - 1192, -2349, -109, 307, 3171, 8774, -2260, 2679, - 3069, -613, -4699, -312, -438, -575, -1698, 437, - 1210, -518, -1435, 369, -594, -1643, 423, -501, - 5557, 1509, 5407, -125, -7386, -1884, -139, -1784, - 0, -3330, -511, -1834, -498, 42, 11, 41, - 2505, 680, 2438, -56, -2838, 2595, 13228, 271, - 1793, -491, -411, -10680, -4, -196, 449, 2291, - -2095, 47, -42, -219, 310, -284, -1447, -29, - 664, -278, 14966, 951, -711, -26, -4, -13672, - -55, -30, 11, -606, 253, -38, 16, -869, - 28, -12, 650, 41, 808, 1770, 8658, 5863, - -1486, -39, -191, -4576, -2098, -134, -87, -427, - -935, -289, -633, -3098, 73, 160, 785, 531, - 3063, 1539, 2000, -542, 9576, -572, -144, -244, - -17, -5597, -287, -374, -188, 101, 51, 66, - -1790, -900, -1169, 317, 514, 14083, -323, 896, - -891, -16, -12106, -6, -49, -48, -442, 10, - 277, -28, -770, 17, 27, 766, -17, 48, - 892, 158, 5237, 11057, -1603, -48, -1, -1674, - -7462, -156, -8, -285, -50, -602, -106, -3534, - 87, 15, 512, 1082, -1612, 2564, -4296, 12526, - 5710, -158, -401, -1126, -9576, -1990, 252, -422, - 672, 1232, -1960, 3284, 561, -893, 1497, -4365, - 4889, -6878, 612, 6109, 4753, -1459, -2887, -22, - -2277, -1379, 2052, -182, 257, -1823, 2564, -228, - -1418, 1995, -177, -1772, 3053, -506, 2403, 9625, - 1322, -569, -15, -352, -5655, -106, 94, -448, - 74, -1794, 297, -1412, -246, 40, -194, -777, - -754, 12904, 4480, -2113, 1471, -34, -10163, -1225, - -272, -132, 594, 206, -3529, -97, 1664, 577, - 67, -1159, -402, 189, 4255, 1476, 5055, 2393, - 2912, -1105, -132, -1559, -349, -517, -383, -1313, - -455, -621, -215, -738, -756, -262, -898, -425, - -1371, 535, 1417, 14604, -997, -114, -17, -122, - -13017, -60, 44, 118, -46, 1222, -477, -1263, - -83, 32, 86, 888, 5368, -1744, 4083, -1236, - 3753, -1758, -185, -1017, -93, -860, 571, -1338, - 434, 405, -131, 308, -1229, 399, -935, 283, - 1588, -3097, 14415, 3699, -1171, -154, -585, -12683, - -835, -83, 300, -1397, 2725, -358, 699, -3255, - 113, -221, 1030, 264, 212, 7989, 9471, -3344, - 2009, -2, -3895, -5475, -682, -246, -103, -123, - -4618, 43, 1630, 1933, -26, -979, -1161, 410, - 856, 2294, -627, 6930, 6929, -44, -321, -24, - -2931, -2930, -119, 32, 87, -362, -970, 265, - -362, -970, 265, -2931, 2357, -4187, 7162, 7683, - 3371, -339, -1070, -3131, -3603, -693, 602, -1030, - 1830, -1105, 1963, -3359, -485, 861, -1474, -1581, - 350, 4585, 14053, -3819, 1218, -7, -1283, -12054, - -890, -90, -97, -300, -3933, 81, 1068, 3275, - -26, -341, -1045, 284, -3248, 3531, 475, 2137, - 11711, -644, -761, -13, -278, -8372, 700, 94, - -102, 423, -460, -62, 2322, -2524, -340, -1528, - -3017, 3852, 1725, 8440, 5257, -555, -905, -181, - -4348, -1686, 709, 317, -405, 1554, -1984, -889, - 968, -1236, -553, -2708, -909, 3196, 15512, -2528, - 1066, -50, -623, -14686, -390, -69, 177, 861, - -3026, -140, 493, 2393, 59, -208, -1009, 164, - 959, -3370, 9617, 9545, -1761, -56, -693, -5645, - -5561, -189, 197, -563, 1978, -558, 1963, -5603, - 103, -362, 1034, 1026, 7575, 11796, -4845, 3252, - -1703, -3502, -8493, -1433, -645, -177, -5454, 2240, - 3488, -1503, -2341, 961, 787, 1226, -503, 338, - 6409, 1722, 1764, -4191, 6015, -2507, -181, -189, - -1072, -2208, -673, -690, -185, 1639, 440, 451, - -2353, -632, -647, 1538, -2420, 12161, 5038, 1286, - -2098, -357, -9027, -1549, -100, -268, 1796, 744, - -3740, 190, -954, -395, -310, 1557, 645, 164, - -2232, -1341, 7246, 9470, -1977, -304, -109, -3204, - -5474, -238, -182, 987, 593, 1290, 775, -4188, - -269, -161, 874, 1143, 1030, 7034, 4231, 1551, - 3077, -64, -3019, -1093, -146, -577, -442, -266, - -1816, -97, -666, -400, -193, -1321, -794, -291, - 5121, 11835, -477, -1749, 2298, -1601, -8549, -13, - -186, -322, -3699, 149, 344, 546, 1264, -50, - -718, -1660, 66, 245, -3328, 3827, 5921, 9976, - -1045, -676, -894, -2140, -6075, -66, 777, 1203, - -1383, 2027, -2330, -3605, -212, 244, 377, 636, - 3813, 5718, -4666, -3412, 5674, -887, -1995, -1329, - -710, -1965, -1331, 1086, 1628, 794, 1191, -972, - -1320, -1980, 1616, 1181, 1348, -3672, 13154, 6938, - -1690, -110, -823, -10561, -2938, -174, 302, -1082, - 2948, -570, 1555, -5570, 139, -379, 1357, 716, - 2151, -3586, 6949, 12131, -1224, -282, -785, -2947, - -8982, -91, 470, -912, 1521, -1592, 2655, -5145, - 160, -268, 519, 906, -2889, 9647, 10276, -2728, - 995, -509, -5680, -6445, -454, -60, 1701, 1812, - -6051, -481, 1606, 1711, 175, -586, -624, 165, - 6177, 2184, 555, 1985, 6589, -2329, -291, -18, - -240, -2650, -823, -209, -74, -748, -264, -67, - -2484, -878, -223, -798, -492, 391, 17166, -681, - 240, -14, -9, -17987, -28, -3, 11, 515, - -410, -20, 16, 713, 7, -5, -252, 10, - 12628, 5448, -2630, 3011, -2695, -9733, -1811, -422, - -553, -443, -4199, 2027, 874, -2321, -1001, 483, - 2077, 896, -432, 495, -3628, -534, 3447, 7002, - 6751, -803, -17, -725, -2992, -2782, -118, 763, - 112, 1550, 228, -1473, 1495, 220, -1420, -2885, - -5239, 5901, 8107, 3650, 4846, -1675, -2125, -4012, - -813, -1433, 1887, 2592, -2920, 1167, -1315, -1806, - 1550, -1745, -2398, -1080, 6157, 6678, 4099, -1074, - 2348, -2314, -2722, -1025, -70, -336, -2509, -1540, - -1670, 403, 437, 268, -882, -957, -587, 153, - 1079, 16099, 242, -881, 1690, -71, -15820, -3, - -47, -174, -1060, -16, -238, 58, 865, 13, - -111, -1661, -25, 90, -278, 227, -1039, 1636, - 16945, -4, -3, -65, -163, -17526, 3, -17, - 14, 27, -22, 103, 287, -234, 1074, -1693, - 15778, -1454, 574, -603, -107, -15195, -129, -20, - -22, 0, 1400, -553, 51, 581, -53, 21, - 103, -9, 3, -3, 2406, -836, 13224, 7993, - -4266, -353, -42, -10673, -3899, -1111, 122, -1942, - 674, -1174, 407, -6451, 626, -217, 3443, 2081, - 3184, 14368, -3336, 2255, -1801, -619, -12600, -679, - -310, -198, -2793, 648, 2926, -438, -1977, 459, - 350, 1580, -366, 247, -1698, 17076, 2504, -539, - -646, -176, -17798, -382, -17, -25, 1770, 259, - -2610, -55, 561, 82, -67, 673, 98, -21, - 2375, -797, -2696, 14483, 5383, -344, -38, -443, - -12803, -1769, 115, 391, -131, -2100, 705, 2384, - -780, 262, 886, -4759, -2691, 2554, -4520, 9573, - 10655, -442, -398, -1247, -5594, -6930, 419, -742, - 704, 1572, -1492, 2641, 1750, -1661, 2939, -6226, - -4332, -4399, -1657, 4880, 7375, -1145, -1181, -167, - -1453, -3319, -1163, -438, -444, 1290, 1310, 493, - 1950, 1980, 745, -2196, -3498, 7405, 9955, 2693, - -2971, -746, -3347, -6049, -442, -538, 1581, 2125, - -4499, 575, -1217, -1636, -634, 1342, 1805, 488, - 6717, -3792, 7739, 2798, 3489, -2754, -877, -3655, - -477, -743, 1554, -3173, 1791, -1147, 647, -1321, - -1430, 807, -1648, -595, 5263, 9770, 3463, 1069, - -3971, -1690, -5826, -732, -69, -962, -3138, -1112, - -2065, -343, -637, -226, 1275, 2368, 839, 259, - 1243, -2634, 16772, 1871, 332, -94, -423, -17169, - -213, -6, 199, -1273, 2696, -142, 300, -1915, - -25, 53, -339, -37, 2691, 2836, 3105, 5711, - 4817, -442, -491, -588, -1991, -1416, -465, -510, - -537, -938, -988, -1082, -791, -834, -913, -1679, - 4366, 2944, 7210, 3627, 1161, -1163, -529, -3172, - -803, -82, -784, -1921, -1295, -966, -651, -1596, - -309, -208, -511, -257, 13888, 3951, -671, -2305, - 3354, -11773, -953, -27, -324, -686, -3349, 569, - 161, 1954, 556, -94, -2843, -809, 137, 472, - 7053, 5847, 2929, 8378, -4794, -3036, -2086, -523, - -4284, -1403, -2517, -1261, -1045, -3607, -2990, -1498, - 2064, 1711, 857, 2451, -2191, 12838, 9182, -3915, - 1617, -293, -10059, -5146, -935, -159, 1717, 1228, - -7195, -523, 3068, 2194, 216, -1267, -906, 386, - -4881, 13114, 5767, -435, 4155, -1454, -10498, -2030, - -11, -1054, 3907, 1718, -4616, -129, 348, 153, - 1238, -3326, -1462, 110, 7843, -1250, 210, 7106, - -5203, -3754, -95, -2, -3082, -1652, 598, -100, - 16, -3402, 542, -91, 2491, -397, 66, 2257, - -2463, 8168, 14551, -3908, 1828, -370, -4072, -12923, - -932, -204, 1228, 2188, -7254, -587, 1948, 3471, - 274, -911, -1623, 436, -1579, 347, -272, -2735, - 16031, -152, -7, -4, -456, -15686, 33, -26, - 5, -263, 58, -45, 1545, -340, 266, 2676, - -6327, 1328, 5093, -5079, 7617, -2443, -107, -1583, - -1574, -3541, 513, 1967, -413, -1961, 411, 1578, - 2941, -617, -2367, 2361, 3286, -4509, 11306, 11025, - -2623, -659, -1241, -7802, -7419, -420, 904, -2267, - 3112, -2211, 3034, -7608, 526, -722, 1810, 1765, - 5567, 17853, -3754, 1166, -519, -1892, -19455, -860, - -83, -16, -6067, 1275, 4090, -396, -1271, 267, - 176, 566, -119, 37, -2136, -424, 15292, 5108, - -1648, -278, -10, -14273, -1593, -165, -55, 1993, - 396, 666, 132, -4768, -214, -42, 1538, 514, - 2267, -3297, 2549, 16563, -791, -313, -663, -396, - -16745, -38, 456, -352, 513, -2291, 3333, -2576, - 109, -159, 123, 799, 3655, 1899, -3364, 6279, - 12510, -815, -220, -690, -2406, -9552, -423, 750, - 390, -1400, -728, 1289, -2791, -1450, 2568, -4794, - 8052, 2285, -6193, 5138, 6003, -3957, -318, -2341, - -1611, -2199, -1123, 3044, 864, -2525, -716, 1942, - -2950, -837, 2269, -1882, -386, -2291, 7679, 15387, - -2723, -9, -320, -3599, -14452, -452, -54, 181, - 1074, 362, 2152, -7212, -64, -380, 1276, 2557, - 2777, -1173, 3984, 13079, 2508, -470, -84, -969, - -10440, -384, 198, -675, 285, -2217, 936, -3180, - -425, 179, -610, -2002, -1879, 1771, -2684, 16705, - 1833, -215, -191, -439, -17032, -205, 203, -308, - 290, 1916, -1805, 2736, 210, -198, 300, -1869, - 1052, 4495, 15519, 1467, -4032, -67, -1233, -14700, - -131, -992, -288, -997, -4257, -94, -402, -1389, - 259, 1106, 3819, 361, 3010, 2544, 6969, 7559, - 1996, -553, -395, -2964, -3487, -243, -467, -1280, - -1082, -1388, -1174, -3215, -366, -310, -849, -921, - -5209, -1867, 8713, 10351, 1549, -1656, -212, -4634, - -6540, -146, -593, 2770, 993, 3291, 1180, -5505, - 492, 176, -824, -979, -4314, 8513, 913, 7547, - -2723, -1135, -4423, -50, -3476, -452, 2241, 240, - -474, 1987, -3921, -420, -717, 1415, 151, 1254, - 12929, -1219, 2448, 1757, 6303, -10204, -90, -365, - -188, -2425, 962, -1932, 182, -1386, 130, -262, - -4974, 469, -941, -676, 6465, 4132, 3167, 3160, - 5697, -2551, -1042, -612, -609, -1981, -1630, -1249, - -798, -1247, -797, -611, -2248, -1437, -1101, -1099, - -3636, 4859, 18914, -1335, 810, -807, -1441, -21836, - -108, -40, 1078, 4198, -5609, -296, 396, 1541, - 179, -240, -936, 66, 8844, 7864, 654, -4063, - -5680, -4774, -3774, -26, -1007, -1969, -4245, -353, - -314, 2193, 1950, 162, 3066, 2726, 226, -1408, - 1859, 2634, 9228, 996, 9464, -211, -423, -5197, - -60, -5467, -299, -1047, -1483, -113, -160, -561, - -1074, -1521, -5330, -575, 2949, 12260, 10290, -497, - -3943, -530, -9174, -6463, -15, -949, -2206, -1852, - -7700, 89, 372, 312, 709, 2950, 2476, -119, - -2903, 1552, 14867, 9970, -496, -514, -147, -13491, - -6068, -15, 275, 2634, -1408, 1766, -944, -9047, - -87, 47, 450, 302, 3243, 8234, 7586, 3373, - 2151, -642, -4138, -3512, -694, -282, -1630, -1501, - -3812, -667, -1695, -1561, -425, -1081, -996, -442, - -9631, 60, 3501, 5359, 10150, -5662, 0, -748, - -1752, -6288, 35, 2058, -12, 3150, -19, -1145, - 5967, -37, -2169, -3320, -6874, -2553, -5446, -2195, - -7841, -2884, -397, -1810, -294, -3753, -1071, -2285, - -848, -921, -342, -729, -3290, -1221, -2606, -1050, - -3413, -1141, 4630, 13612, 7897, -711, -79, -1308, - -11310, -3806, -237, 964, 322, 2836, 948, -3847, - 1645, 550, -2231, -6561, 4410, -5678, 8006, -3992, - 3811, -1187, -1968, -3912, -973, -886, 1528, -2155, - 2775, 1074, -1383, 1951, -1025, 1321, -1862, 928, - 5659, 11535, 2203, -452, 7169, -1954, -8121, -296, - -12, -3137, -3984, -761, -1551, 156, 318, 60, - -2476, -5048, -964, 197, 2914, -2914, 3485, -3965, - 13675, -518, -518, -741, -959, -11414, 518, -620, - 620, 705, -705, 843, -2433, 2432, -2909, 3310, - 7843, 1907, 1022, 8882, 7972, -3755, -222, -63, - -4815, -3879, -913, -489, -119, -4252, -1034, -554, - -3816, -928, -497, -4322, 13807, 9531, 1436, 1612, - 1779, -11636, -5544, -125, -158, -193, -8032, -1210, - -835, -1358, -938, -141, -1499, -1035, -156, -175, - 13620, -5337, 5450, -2263, 1723, -11322, -1738, -1813, - -312, -181, 4436, -4531, 1775, 1881, -737, 752, - -1432, 561, -573, 238, 5297, 8374, 8872, 7694, - 6538, -1712, -4280, -4804, -3613, -2609, -2707, -2868, - -4534, -2487, -3932, -4166, -2113, -3341, -3540, -3070 -}; - -/** - * 0.65^i (Zero part) and 0.75^i (Pole part) scaled by 2^15 - */ -static const int16_t postfilter_tbl[2][LPC_ORDER] = { - /* Zero */ - {21299, 13844, 8999, 5849, 3802, 2471, 1606, 1044, 679, 441}, - /* Pole */ - {24576, 18432, 13824, 10368, 7776, 5832, 4374, 3281, 2460, 1845} -}; - -/** - * Hamming window coefficients scaled by 2^15 - */ -static const int16_t hamming_window[LPC_FRAME] = { - 2621, 2631, 2659, 2705, 2770, 2853, 2955, 3074, 3212, 3367, - 3541, 3731, 3939, 4164, 4405, 4663, 4937, 5226, 5531, 5851, - 6186, 6534, 6897, 7273, 7661, 8062, 8475, 8899, 9334, 9780, - 10235, 10699, 11172, 11653, 12141, 12636, 13138, 13645, 14157, 14673, - 15193, 15716, 16242, 16769, 17298, 17827, 18356, 18884, 19411, 19935, - 20457, 20975, 21489, 21999, 22503, 23002, 23494, 23978, 24455, 24924, - 25384, 25834, 26274, 26704, 27122, 27529, 27924, 28306, 28675, 29031, - 29373, 29700, 30012, 30310, 30592, 30857, 31107, 31340, 31557, 31756, - 31938, 32102, 32249, 32377, 32488, 32580, 32654, 32710, 32747, 32766, - 32766, 32747, 32710, 32654, 32580, 32488, 32377, 32249, 32102, 31938, - 31756, 31557, 31340, 31107, 30857, 30592, 30310, 30012, 29700, 29373, - 29031, 28675, 28306, 27924, 27529, 27122, 26704, 26274, 25834, 25384, - 24924, 24455, 23978, 23494, 23002, 22503, 21999, 21489, 20975, 20457, - 19935, 19411, 18884, 18356, 17827, 17298, 16769, 16242, 15716, 15193, - 14673, 14157, 13645, 13138, 12636, 12141, 11653, 11172, 10699, 10235, - 9780, 9334, 8899, 8475, 8062, 7661, 7273, 6897, 6534, 6186, - 5851, 5531, 5226, 4937, 4663, 4405, 4164, 3939, 3731, 3541, - 3367, 3212, 3074, 2955, 2853, 2770, 2705, 2659, 2631, 2621 -}; - -/** - * Binomial window coefficients scaled by 2^15 - */ -static const int16_t binomial_window[LPC_ORDER] = { - 32749, 32695, 32604, 32477, 32315, 32118, 31887, 31622, 31324, 30995 -}; - -/** - * 0.994^i scaled by 2^15 - */ -static const int16_t bandwidth_expand[LPC_ORDER] = { - 32571, 32376, 32182, 31989, 31797, 31606, 31416, 31228, 31040, 30854 -}; - -/** - * 0.5^i scaled by 2^15 - */ -static const int16_t percept_flt_tbl[2][LPC_ORDER] = { - /* Zero part */ - {29491, 26542, 23888, 21499, 19349, 17414, 15673, 14106, 12695, 11425}, - /* Pole part */ - {16384, 8192, 4096, 2048, 1024, 512, 256, 128, 64, 32} -}; - -static const int cng_adaptive_cb_lag[4] = { 1, 0, 1, 3 }; - -static const int cng_filt[4] = { 273, 998, 499, 333 }; - -static const int cng_bseg[3] = { 2048, 18432, 231233 }; - -#endif /* AVCODEC_G723_1_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g726.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g726.c deleted file mode 100644 index 073bd6fbc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g726.c +++ /dev/null @@ -1,494 +0,0 @@ -/* - * G.726 ADPCM audio codec - * Copyright (c) 2004 Roman Shaposhnik - * - * This is a very straightforward rendition of the G.726 - * Section 4 "Computational Details". - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include - -#include "libavutil/avassert.h" -#include "libavutil/channel_layout.h" -#include "libavutil/opt.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "put_bits.h" - -/** - * G.726 11bit float. - * G.726 Standard uses rather odd 11bit floating point arithmentic for - * numerous occasions. It's a mystery to me why they did it this way - * instead of simply using 32bit integer arithmetic. - */ -typedef struct Float11 { - uint8_t sign; /**< 1bit sign */ - uint8_t exp; /**< 4bit exponent */ - uint8_t mant; /**< 6bit mantissa */ -} Float11; - -static inline Float11* i2f(int i, Float11* f) -{ - f->sign = (i < 0); - if (f->sign) - i = -i; - f->exp = av_log2_16bit(i) + !!i; - f->mant = i? (i<<6) >> f->exp : 1<<5; - return f; -} - -static inline int16_t mult(Float11* f1, Float11* f2) -{ - int res, exp; - - exp = f1->exp + f2->exp; - res = (((f1->mant * f2->mant) + 0x30) >> 4); - res = exp > 19 ? res << (exp - 19) : res >> (19 - exp); - return (f1->sign ^ f2->sign) ? -res : res; -} - -static inline int sgn(int value) -{ - return (value < 0) ? -1 : 1; -} - -typedef struct G726Tables { - const int* quant; /**< quantization table */ - const int16_t* iquant; /**< inverse quantization table */ - const int16_t* W; /**< special table #1 ;-) */ - const uint8_t* F; /**< special table #2 */ -} G726Tables; - -typedef struct G726Context { - AVClass *class; - G726Tables tbls; /**< static tables needed for computation */ - - Float11 sr[2]; /**< prev. reconstructed samples */ - Float11 dq[6]; /**< prev. difference */ - int a[2]; /**< second order predictor coeffs */ - int b[6]; /**< sixth order predictor coeffs */ - int pk[2]; /**< signs of prev. 2 sez + dq */ - - int ap; /**< scale factor control */ - int yu; /**< fast scale factor */ - int yl; /**< slow scale factor */ - int dms; /**< short average magnitude of F[i] */ - int dml; /**< long average magnitude of F[i] */ - int td; /**< tone detect */ - - int se; /**< estimated signal for the next iteration */ - int sez; /**< estimated second order prediction */ - int y; /**< quantizer scaling factor for the next iteration */ - int code_size; - int little_endian; /**< little-endian bitstream as used in aiff and Sun AU */ -} G726Context; - -static const int quant_tbl16[] = /**< 16kbit/s 2bits per sample */ - { 260, INT_MAX }; -static const int16_t iquant_tbl16[] = - { 116, 365, 365, 116 }; -static const int16_t W_tbl16[] = - { -22, 439, 439, -22 }; -static const uint8_t F_tbl16[] = - { 0, 7, 7, 0 }; - -static const int quant_tbl24[] = /**< 24kbit/s 3bits per sample */ - { 7, 217, 330, INT_MAX }; -static const int16_t iquant_tbl24[] = - { INT16_MIN, 135, 273, 373, 373, 273, 135, INT16_MIN }; -static const int16_t W_tbl24[] = - { -4, 30, 137, 582, 582, 137, 30, -4 }; -static const uint8_t F_tbl24[] = - { 0, 1, 2, 7, 7, 2, 1, 0 }; - -static const int quant_tbl32[] = /**< 32kbit/s 4bits per sample */ - { -125, 79, 177, 245, 299, 348, 399, INT_MAX }; -static const int16_t iquant_tbl32[] = - { INT16_MIN, 4, 135, 213, 273, 323, 373, 425, - 425, 373, 323, 273, 213, 135, 4, INT16_MIN }; -static const int16_t W_tbl32[] = - { -12, 18, 41, 64, 112, 198, 355, 1122, - 1122, 355, 198, 112, 64, 41, 18, -12}; -static const uint8_t F_tbl32[] = - { 0, 0, 0, 1, 1, 1, 3, 7, 7, 3, 1, 1, 1, 0, 0, 0 }; - -static const int quant_tbl40[] = /**< 40kbit/s 5bits per sample */ - { -122, -16, 67, 138, 197, 249, 297, 338, - 377, 412, 444, 474, 501, 527, 552, INT_MAX }; -static const int16_t iquant_tbl40[] = - { INT16_MIN, -66, 28, 104, 169, 224, 274, 318, - 358, 395, 429, 459, 488, 514, 539, 566, - 566, 539, 514, 488, 459, 429, 395, 358, - 318, 274, 224, 169, 104, 28, -66, INT16_MIN }; -static const int16_t W_tbl40[] = - { 14, 14, 24, 39, 40, 41, 58, 100, - 141, 179, 219, 280, 358, 440, 529, 696, - 696, 529, 440, 358, 280, 219, 179, 141, - 100, 58, 41, 40, 39, 24, 14, 14 }; -static const uint8_t F_tbl40[] = - { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6, - 6, 6, 5, 4, 3, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 }; - -static const G726Tables G726Tables_pool[] = - {{ quant_tbl16, iquant_tbl16, W_tbl16, F_tbl16 }, - { quant_tbl24, iquant_tbl24, W_tbl24, F_tbl24 }, - { quant_tbl32, iquant_tbl32, W_tbl32, F_tbl32 }, - { quant_tbl40, iquant_tbl40, W_tbl40, F_tbl40 }}; - - -/** - * Para 4.2.2 page 18: Adaptive quantizer. - */ -static inline uint8_t quant(G726Context* c, int d) -{ - int sign, exp, i, dln; - - sign = i = 0; - if (d < 0) { - sign = 1; - d = -d; - } - exp = av_log2_16bit(d); - dln = ((exp<<7) + (((d<<7)>>exp)&0x7f)) - (c->y>>2); - - while (c->tbls.quant[i] < INT_MAX && c->tbls.quant[i] < dln) - ++i; - - if (sign) - i = ~i; - if (c->code_size != 2 && i == 0) /* I'm not sure this is a good idea */ - i = 0xff; - - return i; -} - -/** - * Para 4.2.3 page 22: Inverse adaptive quantizer. - */ -static inline int16_t inverse_quant(G726Context* c, int i) -{ - int dql, dex, dqt; - - dql = c->tbls.iquant[i] + (c->y >> 2); - dex = (dql>>7) & 0xf; /* 4bit exponent */ - dqt = (1<<7) + (dql & 0x7f); /* log2 -> linear */ - return (dql < 0) ? 0 : ((dqt<> 7); -} - -static int16_t g726_decode(G726Context* c, int I) -{ - int dq, re_signal, pk0, fa1, i, tr, ylint, ylfrac, thr2, al, dq0; - Float11 f; - int I_sig= I >> (c->code_size - 1); - - dq = inverse_quant(c, I); - - /* Transition detect */ - ylint = (c->yl >> 15); - ylfrac = (c->yl >> 10) & 0x1f; - thr2 = (ylint > 9) ? 0x1f << 10 : (0x20 + ylfrac) << ylint; - tr= (c->td == 1 && dq > ((3*thr2)>>2)); - - if (I_sig) /* get the sign */ - dq = -dq; - re_signal = c->se + dq; - - /* Update second order predictor coefficient A2 and A1 */ - pk0 = (c->sez + dq) ? sgn(c->sez + dq) : 0; - dq0 = dq ? sgn(dq) : 0; - if (tr) { - c->a[0] = 0; - c->a[1] = 0; - for (i=0; i<6; i++) - c->b[i] = 0; - } else { - /* This is a bit crazy, but it really is +255 not +256 */ - fa1 = av_clip((-c->a[0]*c->pk[0]*pk0)>>5, -256, 255); - - c->a[1] += 128*pk0*c->pk[1] + fa1 - (c->a[1]>>7); - c->a[1] = av_clip(c->a[1], -12288, 12288); - c->a[0] += 64*3*pk0*c->pk[0] - (c->a[0] >> 8); - c->a[0] = av_clip(c->a[0], -(15360 - c->a[1]), 15360 - c->a[1]); - - for (i=0; i<6; i++) - c->b[i] += 128*dq0*sgn(-c->dq[i].sign) - (c->b[i]>>8); - } - - /* Update Dq and Sr and Pk */ - c->pk[1] = c->pk[0]; - c->pk[0] = pk0 ? pk0 : 1; - c->sr[1] = c->sr[0]; - i2f(re_signal, &c->sr[0]); - for (i=5; i>0; i--) - c->dq[i] = c->dq[i-1]; - i2f(dq, &c->dq[0]); - c->dq[0].sign = I_sig; /* Isn't it crazy ?!?! */ - - c->td = c->a[1] < -11776; - - /* Update Ap */ - c->dms += (c->tbls.F[I]<<4) + ((- c->dms) >> 5); - c->dml += (c->tbls.F[I]<<4) + ((- c->dml) >> 7); - if (tr) - c->ap = 256; - else { - c->ap += (-c->ap) >> 4; - if (c->y <= 1535 || c->td || abs((c->dms << 2) - c->dml) >= (c->dml >> 3)) - c->ap += 0x20; - } - - /* Update Yu and Yl */ - c->yu = av_clip(c->y + c->tbls.W[I] + ((-c->y)>>5), 544, 5120); - c->yl += c->yu + ((-c->yl)>>6); - - /* Next iteration for Y */ - al = (c->ap >= 256) ? 1<<6 : c->ap >> 2; - c->y = (c->yl + (c->yu - (c->yl>>6))*al) >> 6; - - /* Next iteration for SE and SEZ */ - c->se = 0; - for (i=0; i<6; i++) - c->se += mult(i2f(c->b[i] >> 2, &f), &c->dq[i]); - c->sez = c->se >> 1; - for (i=0; i<2; i++) - c->se += mult(i2f(c->a[i] >> 2, &f), &c->sr[i]); - c->se >>= 1; - - return av_clip(re_signal << 2, -0xffff, 0xffff); -} - -static av_cold int g726_reset(G726Context *c) -{ - int i; - - c->tbls = G726Tables_pool[c->code_size - 2]; - for (i=0; i<2; i++) { - c->sr[i].mant = 1<<5; - c->pk[i] = 1; - } - for (i=0; i<6; i++) { - c->dq[i].mant = 1<<5; - } - c->yu = 544; - c->yl = 34816; - - c->y = 544; - - return 0; -} - -#if CONFIG_ADPCM_G726_ENCODER -static int16_t g726_encode(G726Context* c, int16_t sig) -{ - uint8_t i; - - i = quant(c, sig/4 - c->se) & ((1<code_size) - 1); - g726_decode(c, i); - return i; -} - -/* Interfacing to the libavcodec */ - -static av_cold int g726_encode_init(AVCodecContext *avctx) -{ - G726Context* c = avctx->priv_data; - - if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && - avctx->sample_rate != 8000) { - av_log(avctx, AV_LOG_ERROR, "Sample rates other than 8kHz are not " - "allowed when the compliance level is higher than unofficial. " - "Resample or reduce the compliance level.\n"); - return AVERROR(EINVAL); - } - av_assert0(avctx->sample_rate > 0); - - if(avctx->channels != 1){ - av_log(avctx, AV_LOG_ERROR, "Only mono is supported\n"); - return AVERROR(EINVAL); - } - - if (avctx->bit_rate) - c->code_size = (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate; - - c->code_size = av_clip(c->code_size, 2, 5); - avctx->bit_rate = c->code_size * avctx->sample_rate; - avctx->bits_per_coded_sample = c->code_size; - - g726_reset(c); - - /* select a frame size that will end on a byte boundary and have a size of - approximately 1024 bytes */ - avctx->frame_size = ((int[]){ 4096, 2736, 2048, 1640 })[c->code_size - 2]; - - return 0; -} - -static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr) -{ - G726Context *c = avctx->priv_data; - const int16_t *samples = (const int16_t *)frame->data[0]; - PutBitContext pb; - int i, ret, out_size; - - out_size = (frame->nb_samples * c->code_size + 7) / 8; - if ((ret = ff_alloc_packet2(avctx, avpkt, out_size)) < 0) - return ret; - init_put_bits(&pb, avpkt->data, avpkt->size); - - for (i = 0; i < frame->nb_samples; i++) - put_bits(&pb, c->code_size, g726_encode(c, *samples++)); - - flush_put_bits(&pb); - - avpkt->size = out_size; - *got_packet_ptr = 1; - return 0; -} - -#define OFFSET(x) offsetof(G726Context, x) -#define AE AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM -static const AVOption options[] = { - { "code_size", "Bits per code", OFFSET(code_size), AV_OPT_TYPE_INT, { .i64 = 4 }, 2, 5, AE }, - { NULL }, -}; - -static const AVClass g726_class = { - .class_name = "g726", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -static const AVCodecDefault defaults[] = { - { "b", "0" }, - { NULL }, -}; - -AVCodec ff_adpcm_g726_encoder = { - .name = "g726", - .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ADPCM_G726, - .priv_data_size = sizeof(G726Context), - .init = g726_encode_init, - .encode2 = g726_encode_frame, - .capabilities = CODEC_CAP_SMALL_LAST_FRAME, - .sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, - .priv_class = &g726_class, - .defaults = defaults, -}; -#endif - -#if CONFIG_ADPCM_G726_DECODER || CONFIG_ADPCM_G726LE_DECODER -static av_cold int g726_decode_init(AVCodecContext *avctx) -{ - G726Context* c = avctx->priv_data; - - if(avctx->channels > 1){ - avpriv_request_sample(avctx, "Decoding more than one channel"); - return AVERROR_PATCHWELCOME; - } - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - - c->little_endian = !strcmp(avctx->codec->name, "g726le"); - - c->code_size = avctx->bits_per_coded_sample; - if (c->code_size < 2 || c->code_size > 5) { - av_log(avctx, AV_LOG_ERROR, "Invalid number of bits %d\n", c->code_size); - return AVERROR(EINVAL); - } - g726_reset(c); - - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - - return 0; -} - -static int g726_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - G726Context *c = avctx->priv_data; - int16_t *samples; - GetBitContext gb; - int out_samples, ret; - - out_samples = buf_size * 8 / c->code_size; - - /* get output buffer */ - frame->nb_samples = out_samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = (int16_t *)frame->data[0]; - - init_get_bits(&gb, buf, buf_size * 8); - - while (out_samples--) - *samples++ = g726_decode(c, c->little_endian ? - get_bits_le(&gb, c->code_size) : - get_bits(&gb, c->code_size)); - - if (get_bits_left(&gb) > 0) - av_log(avctx, AV_LOG_ERROR, "Frame invalidly split, missing parser?\n"); - - *got_frame_ptr = 1; - - return buf_size; -} - -static void g726_decode_flush(AVCodecContext *avctx) -{ - G726Context *c = avctx->priv_data; - g726_reset(c); -} -#endif - -#if CONFIG_ADPCM_G726_DECODER -AVCodec ff_adpcm_g726_decoder = { - .name = "g726", - .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ADPCM_G726, - .priv_data_size = sizeof(G726Context), - .init = g726_decode_init, - .decode = g726_decode_frame, - .flush = g726_decode_flush, - .capabilities = CODEC_CAP_DR1, -}; -#endif - -#if CONFIG_ADPCM_G726LE_DECODER -AVCodec ff_adpcm_g726le_decoder = { - .name = "g726le", - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_ADPCM_G726LE, - .priv_data_size = sizeof(G726Context), - .init = g726_decode_init, - .decode = g726_decode_frame, - .flush = g726_decode_flush, - .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM little-endian"), -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729.h deleted file mode 100644 index 61683130a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * G.729, G729 Annex D decoders - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVCODEC_G729_H -#define AVCODEC_G729_H - -/** - * subframe size - */ -#define SUBFRAME_SIZE 40 - -#endif // AVCODEC_G729_H diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729data.h deleted file mode 100644 index 365ca47ec..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729data.h +++ /dev/null @@ -1,382 +0,0 @@ -/* - * data for G.729, G729 Annex D decoders - * Copyright (c) 2007 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_G729DATA_H -#define AVCODEC_G729DATA_H - -#include - -#define MA_NP 4 ///< Moving Average (MA) prediction order - -#define VQ_1ST_BITS 7 ///< first stage vector of quantizer (size in bits) -#define VQ_2ND_BITS 5 ///< second stage vector of quantizer (size in bits) - -#define GC_1ST_IDX_BITS_8K 3 ///< gain codebook (first stage) index, 8k mode (size in bits) -#define GC_2ND_IDX_BITS_8K 4 ///< gain codebook (second stage) index, 8k mode (size in bits) - -#define GC_1ST_IDX_BITS_6K4 3 ///< gain codebook (first stage) index, 6.4k mode (size in bits) -#define GC_2ND_IDX_BITS_6K4 3 ///< gain codebook (second stage) index, 6.4k mode (size in bits) - -/** - * first stage LSP codebook - * (10-dimensional, with 128 entries (3.24 of G.729) - */ -static const int16_t cb_lsp_1st[1< -#include - -#include "avcodec.h" -#include "libavutil/avutil.h" -#include "get_bits.h" -#include "dsputil.h" -#include "internal.h" - - -#include "g729.h" -#include "lsp.h" -#include "celp_math.h" -#include "celp_filters.h" -#include "acelp_filters.h" -#include "acelp_pitch_delay.h" -#include "acelp_vectors.h" -#include "g729data.h" -#include "g729postfilter.h" - -/** - * minimum quantized LSF value (3.2.4) - * 0.005 in Q13 - */ -#define LSFQ_MIN 40 - -/** - * maximum quantized LSF value (3.2.4) - * 3.135 in Q13 - */ -#define LSFQ_MAX 25681 - -/** - * minimum LSF distance (3.2.4) - * 0.0391 in Q13 - */ -#define LSFQ_DIFF_MIN 321 - -/// interpolation filter length -#define INTERPOL_LEN 11 - -/** - * minimum gain pitch value (3.8, Equation 47) - * 0.2 in (1.14) - */ -#define SHARP_MIN 3277 - -/** - * maximum gain pitch value (3.8, Equation 47) - * (EE) This does not comply with the specification. - * Specification says about 0.8, which should be - * 13107 in (1.14), but reference C code uses - * 13017 (equals to 0.7945) instead of it. - */ -#define SHARP_MAX 13017 - -/** - * MR_ENERGY (mean removed energy) = mean_energy + 10 * log10(2^26 * subframe_size) in (7.13) - */ -#define MR_ENERGY 1018156 - -#define DECISION_NOISE 0 -#define DECISION_INTERMEDIATE 1 -#define DECISION_VOICE 2 - -typedef enum { - FORMAT_G729_8K = 0, - FORMAT_G729D_6K4, - FORMAT_COUNT, -} G729Formats; - -typedef struct { - uint8_t ac_index_bits[2]; ///< adaptive codebook index for second subframe (size in bits) - uint8_t parity_bit; ///< parity bit for pitch delay - uint8_t gc_1st_index_bits; ///< gain codebook (first stage) index (size in bits) - uint8_t gc_2nd_index_bits; ///< gain codebook (second stage) index (size in bits) - uint8_t fc_signs_bits; ///< number of pulses in fixed-codebook vector - uint8_t fc_indexes_bits; ///< size (in bits) of fixed-codebook index entry -} G729FormatDescription; - -typedef struct { - DSPContext dsp; - - /// past excitation signal buffer - int16_t exc_base[2*SUBFRAME_SIZE+PITCH_DELAY_MAX+INTERPOL_LEN]; - - int16_t* exc; ///< start of past excitation data in buffer - int pitch_delay_int_prev; ///< integer part of previous subframe's pitch delay (4.1.3) - - /// (2.13) LSP quantizer outputs - int16_t past_quantizer_output_buf[MA_NP + 1][10]; - int16_t* past_quantizer_outputs[MA_NP + 1]; - - int16_t lsfq[10]; ///< (2.13) quantized LSF coefficients from previous frame - int16_t lsp_buf[2][10]; ///< (0.15) LSP coefficients (previous and current frames) (3.2.5) - int16_t *lsp[2]; ///< pointers to lsp_buf - - int16_t quant_energy[4]; ///< (5.10) past quantized energy - - /// previous speech data for LP synthesis filter - int16_t syn_filter_data[10]; - - - /// residual signal buffer (used in long-term postfilter) - int16_t residual[SUBFRAME_SIZE + RES_PREV_DATA_SIZE]; - - /// previous speech data for residual calculation filter - int16_t res_filter_data[SUBFRAME_SIZE+10]; - - /// previous speech data for short-term postfilter - int16_t pos_filter_data[SUBFRAME_SIZE+10]; - - /// (1.14) pitch gain of current and five previous subframes - int16_t past_gain_pitch[6]; - - /// (14.1) gain code from current and previous subframe - int16_t past_gain_code[2]; - - /// voice decision on previous subframe (0-noise, 1-intermediate, 2-voice), G.729D - int16_t voice_decision; - - int16_t onset; ///< detected onset level (0-2) - int16_t was_periodic; ///< whether previous frame was declared as periodic or not (4.4) - int16_t ht_prev_data; ///< previous data for 4.2.3, equation 86 - int gain_coeff; ///< (1.14) gain coefficient (4.2.4) - uint16_t rand_value; ///< random number generator value (4.4.4) - int ma_predictor_prev; ///< switched MA predictor of LSP quantizer from last good frame - - /// (14.14) high-pass filter data (past input) - int hpf_f[2]; - - /// high-pass filter data (past output) - int16_t hpf_z[2]; -} G729Context; - -static const G729FormatDescription format_g729_8k = { - .ac_index_bits = {8,5}, - .parity_bit = 1, - .gc_1st_index_bits = GC_1ST_IDX_BITS_8K, - .gc_2nd_index_bits = GC_2ND_IDX_BITS_8K, - .fc_signs_bits = 4, - .fc_indexes_bits = 13, -}; - -static const G729FormatDescription format_g729d_6k4 = { - .ac_index_bits = {8,4}, - .parity_bit = 0, - .gc_1st_index_bits = GC_1ST_IDX_BITS_6K4, - .gc_2nd_index_bits = GC_2ND_IDX_BITS_6K4, - .fc_signs_bits = 2, - .fc_indexes_bits = 9, -}; - -/** - * @brief pseudo random number generator - */ -static inline uint16_t g729_prng(uint16_t value) -{ - return 31821 * value + 13849; -} - -/** - * Get parity bit of bit 2..7 - */ -static inline int get_parity(uint8_t value) -{ - return (0x6996966996696996ULL >> (value >> 2)) & 1; -} - -/** - * Decodes LSF (Line Spectral Frequencies) from L0-L3 (3.2.4). - * @param[out] lsfq (2.13) quantized LSF coefficients - * @param[in,out] past_quantizer_outputs (2.13) quantizer outputs from previous frames - * @param ma_predictor switched MA predictor of LSP quantizer - * @param vq_1st first stage vector of quantizer - * @param vq_2nd_low second stage lower vector of LSP quantizer - * @param vq_2nd_high second stage higher vector of LSP quantizer - */ -static void lsf_decode(int16_t* lsfq, int16_t* past_quantizer_outputs[MA_NP + 1], - int16_t ma_predictor, - int16_t vq_1st, int16_t vq_2nd_low, int16_t vq_2nd_high) -{ - int i,j; - static const uint8_t min_distance[2]={10, 5}; //(2.13) - int16_t* quantizer_output = past_quantizer_outputs[MA_NP]; - - for (i = 0; i < 5; i++) { - quantizer_output[i] = cb_lsp_1st[vq_1st][i ] + cb_lsp_2nd[vq_2nd_low ][i ]; - quantizer_output[i + 5] = cb_lsp_1st[vq_1st][i + 5] + cb_lsp_2nd[vq_2nd_high][i + 5]; - } - - for (j = 0; j < 2; j++) { - for (i = 1; i < 10; i++) { - int diff = (quantizer_output[i - 1] - quantizer_output[i] + min_distance[j]) >> 1; - if (diff > 0) { - quantizer_output[i - 1] -= diff; - quantizer_output[i ] += diff; - } - } - } - - for (i = 0; i < 10; i++) { - int sum = quantizer_output[i] * cb_ma_predictor_sum[ma_predictor][i]; - for (j = 0; j < MA_NP; j++) - sum += past_quantizer_outputs[j][i] * cb_ma_predictor[ma_predictor][j][i]; - - lsfq[i] = sum >> 15; - } - - ff_acelp_reorder_lsf(lsfq, LSFQ_DIFF_MIN, LSFQ_MIN, LSFQ_MAX, 10); -} - -/** - * Restores past LSP quantizer output using LSF from previous frame - * @param[in,out] lsfq (2.13) quantized LSF coefficients - * @param[in,out] past_quantizer_outputs (2.13) quantizer outputs from previous frames - * @param ma_predictor_prev MA predictor from previous frame - * @param lsfq_prev (2.13) quantized LSF coefficients from previous frame - */ -static void lsf_restore_from_previous(int16_t* lsfq, - int16_t* past_quantizer_outputs[MA_NP + 1], - int ma_predictor_prev) -{ - int16_t* quantizer_output = past_quantizer_outputs[MA_NP]; - int i,k; - - for (i = 0; i < 10; i++) { - int tmp = lsfq[i] << 15; - - for (k = 0; k < MA_NP; k++) - tmp -= past_quantizer_outputs[k][i] * cb_ma_predictor[ma_predictor_prev][k][i]; - - quantizer_output[i] = ((tmp >> 15) * cb_ma_predictor_sum_inv[ma_predictor_prev][i]) >> 12; - } -} - -/** - * Constructs new excitation signal and applies phase filter to it - * @param[out] out constructed speech signal - * @param in original excitation signal - * @param fc_cur (2.13) original fixed-codebook vector - * @param gain_code (14.1) gain code - * @param subframe_size length of the subframe - */ -static void g729d_get_new_exc( - int16_t* out, - const int16_t* in, - const int16_t* fc_cur, - int dstate, - int gain_code, - int subframe_size) -{ - int i; - int16_t fc_new[SUBFRAME_SIZE]; - - ff_celp_convolve_circ(fc_new, fc_cur, phase_filter[dstate], subframe_size); - - for(i=0; i> 14; - out[i] += (gain_code * fc_new[i] + 0x2000) >> 14; - } -} - -/** - * Makes decision about onset in current subframe - * @param past_onset decision result of previous subframe - * @param past_gain_code gain code of current and previous subframe - * - * @return onset decision result for current subframe - */ -static int g729d_onset_decision(int past_onset, const int16_t* past_gain_code) -{ - if((past_gain_code[0] >> 1) > past_gain_code[1]) - return 2; - else - return FFMAX(past_onset-1, 0); -} - -/** - * Makes decision about voice presence in current subframe - * @param onset onset level - * @param prev_voice_decision voice decision result from previous subframe - * @param past_gain_pitch pitch gain of current and previous subframes - * - * @return voice decision result for current subframe - */ -static int16_t g729d_voice_decision(int onset, int prev_voice_decision, const int16_t* past_gain_pitch) -{ - int i, low_gain_pitch_cnt, voice_decision; - - if(past_gain_pitch[0] >= 14745) // 0.9 - voice_decision = DECISION_VOICE; - else if (past_gain_pitch[0] <= 9830) // 0.6 - voice_decision = DECISION_NOISE; - else - voice_decision = DECISION_INTERMEDIATE; - - for(i=0, low_gain_pitch_cnt=0; i<6; i++) - if(past_gain_pitch[i] < 9830) - low_gain_pitch_cnt++; - - if(low_gain_pitch_cnt > 2 && !onset) - voice_decision = DECISION_NOISE; - - if(!onset && voice_decision > prev_voice_decision + 1) - voice_decision--; - - if(onset && voice_decision < DECISION_VOICE) - voice_decision++; - - return voice_decision; -} - -static int32_t scalarproduct_int16_c(const int16_t * v1, const int16_t * v2, int order) -{ - int res = 0; - - while (order--) - res += *v1++ * *v2++; - - return res; -} - -static av_cold int decoder_init(AVCodecContext * avctx) -{ - G729Context* ctx = avctx->priv_data; - int i,k; - - if (avctx->channels != 1) { - av_log(avctx, AV_LOG_ERROR, "Only mono sound is supported (requested channels: %d).\n", avctx->channels); - return AVERROR(EINVAL); - } - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - - /* Both 8kbit/s and 6.4kbit/s modes uses two subframes per frame. */ - avctx->frame_size = SUBFRAME_SIZE << 1; - - ctx->gain_coeff = 16384; // 1.0 in (1.14) - - for (k = 0; k < MA_NP + 1; k++) { - ctx->past_quantizer_outputs[k] = ctx->past_quantizer_output_buf[k]; - for (i = 1; i < 11; i++) - ctx->past_quantizer_outputs[k][i - 1] = (18717 * i) >> 3; - } - - ctx->lsp[0] = ctx->lsp_buf[0]; - ctx->lsp[1] = ctx->lsp_buf[1]; - memcpy(ctx->lsp[0], lsp_init, 10 * sizeof(int16_t)); - - ctx->exc = &ctx->exc_base[PITCH_DELAY_MAX+INTERPOL_LEN]; - - ctx->pitch_delay_int_prev = PITCH_DELAY_MIN; - - /* random seed initialization */ - ctx->rand_value = 21845; - - /* quantized prediction error */ - for(i=0; i<4; i++) - ctx->quant_energy[i] = -14336; // -14 in (5.10) - - ff_dsputil_init(&ctx->dsp, avctx); - ctx->dsp.scalarproduct_int16 = scalarproduct_int16_c; - - return 0; -} - -static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, - AVPacket *avpkt) -{ - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int16_t *out_frame; - GetBitContext gb; - const G729FormatDescription *format; - int frame_erasure = 0; ///< frame erasure detected during decoding - int bad_pitch = 0; ///< parity check failed - int i; - int16_t *tmp; - G729Formats packet_type; - G729Context *ctx = avctx->priv_data; - int16_t lp[2][11]; // (3.12) - uint8_t ma_predictor; ///< switched MA predictor of LSP quantizer - uint8_t quantizer_1st; ///< first stage vector of quantizer - uint8_t quantizer_2nd_lo; ///< second stage lower vector of quantizer (size in bits) - uint8_t quantizer_2nd_hi; ///< second stage higher vector of quantizer (size in bits) - - int pitch_delay_int[2]; // pitch delay, integer part - int pitch_delay_3x; // pitch delay, multiplied by 3 - int16_t fc[SUBFRAME_SIZE]; // fixed-codebook vector - int16_t synth[SUBFRAME_SIZE+10]; // fixed-codebook vector - int j, ret; - int gain_before, gain_after; - int is_periodic = 0; // whether one of the subframes is declared as periodic or not - AVFrame *frame = data; - - frame->nb_samples = SUBFRAME_SIZE<<1; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - out_frame = (int16_t*) frame->data[0]; - - if (buf_size == 10) { - packet_type = FORMAT_G729_8K; - format = &format_g729_8k; - //Reset voice decision - ctx->onset = 0; - ctx->voice_decision = DECISION_VOICE; - av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729 @ 8kbit/s"); - } else if (buf_size == 8) { - packet_type = FORMAT_G729D_6K4; - format = &format_g729d_6k4; - av_log(avctx, AV_LOG_DEBUG, "Packet type: %s\n", "G.729D @ 6.4kbit/s"); - } else { - av_log(avctx, AV_LOG_ERROR, "Packet size %d is unknown.\n", buf_size); - return AVERROR_INVALIDDATA; - } - - for (i=0; i < buf_size; i++) - frame_erasure |= buf[i]; - frame_erasure = !frame_erasure; - - init_get_bits(&gb, buf, 8*buf_size); - - ma_predictor = get_bits(&gb, 1); - quantizer_1st = get_bits(&gb, VQ_1ST_BITS); - quantizer_2nd_lo = get_bits(&gb, VQ_2ND_BITS); - quantizer_2nd_hi = get_bits(&gb, VQ_2ND_BITS); - - if(frame_erasure) - lsf_restore_from_previous(ctx->lsfq, ctx->past_quantizer_outputs, - ctx->ma_predictor_prev); - else { - lsf_decode(ctx->lsfq, ctx->past_quantizer_outputs, - ma_predictor, - quantizer_1st, quantizer_2nd_lo, quantizer_2nd_hi); - ctx->ma_predictor_prev = ma_predictor; - } - - tmp = ctx->past_quantizer_outputs[MA_NP]; - memmove(ctx->past_quantizer_outputs + 1, ctx->past_quantizer_outputs, - MA_NP * sizeof(int16_t*)); - ctx->past_quantizer_outputs[0] = tmp; - - ff_acelp_lsf2lsp(ctx->lsp[1], ctx->lsfq, 10); - - ff_acelp_lp_decode(&lp[0][0], &lp[1][0], ctx->lsp[1], ctx->lsp[0], 10); - - FFSWAP(int16_t*, ctx->lsp[1], ctx->lsp[0]); - - for (i = 0; i < 2; i++) { - int gain_corr_factor; - - uint8_t ac_index; ///< adaptive codebook index - uint8_t pulses_signs; ///< fixed-codebook vector pulse signs - int fc_indexes; ///< fixed-codebook indexes - uint8_t gc_1st_index; ///< gain codebook (first stage) index - uint8_t gc_2nd_index; ///< gain codebook (second stage) index - - ac_index = get_bits(&gb, format->ac_index_bits[i]); - if(!i && format->parity_bit) - bad_pitch = get_parity(ac_index) == get_bits1(&gb); - fc_indexes = get_bits(&gb, format->fc_indexes_bits); - pulses_signs = get_bits(&gb, format->fc_signs_bits); - gc_1st_index = get_bits(&gb, format->gc_1st_index_bits); - gc_2nd_index = get_bits(&gb, format->gc_2nd_index_bits); - - if (frame_erasure) - pitch_delay_3x = 3 * ctx->pitch_delay_int_prev; - else if(!i) { - if (bad_pitch) - pitch_delay_3x = 3 * ctx->pitch_delay_int_prev; - else - pitch_delay_3x = ff_acelp_decode_8bit_to_1st_delay3(ac_index); - } else { - int pitch_delay_min = av_clip(ctx->pitch_delay_int_prev - 5, - PITCH_DELAY_MIN, PITCH_DELAY_MAX - 9); - - if(packet_type == FORMAT_G729D_6K4) - pitch_delay_3x = ff_acelp_decode_4bit_to_2nd_delay3(ac_index, pitch_delay_min); - else - pitch_delay_3x = ff_acelp_decode_5_6_bit_to_2nd_delay3(ac_index, pitch_delay_min); - } - - /* Round pitch delay to nearest (used everywhere except ff_acelp_interpolate). */ - pitch_delay_int[i] = (pitch_delay_3x + 1) / 3; - if (pitch_delay_int[i] > PITCH_DELAY_MAX) { - av_log(avctx, AV_LOG_WARNING, "pitch_delay_int %d is too large\n", pitch_delay_int[i]); - pitch_delay_int[i] = PITCH_DELAY_MAX; - } - - if (frame_erasure) { - ctx->rand_value = g729_prng(ctx->rand_value); - fc_indexes = ctx->rand_value & ((1 << format->fc_indexes_bits) - 1); - - ctx->rand_value = g729_prng(ctx->rand_value); - pulses_signs = ctx->rand_value; - } - - - memset(fc, 0, sizeof(int16_t) * SUBFRAME_SIZE); - switch (packet_type) { - case FORMAT_G729_8K: - ff_acelp_fc_pulse_per_track(fc, ff_fc_4pulses_8bits_tracks_13, - ff_fc_4pulses_8bits_track_4, - fc_indexes, pulses_signs, 3, 3); - break; - case FORMAT_G729D_6K4: - ff_acelp_fc_pulse_per_track(fc, ff_fc_2pulses_9bits_track1_gray, - ff_fc_2pulses_9bits_track2_gray, - fc_indexes, pulses_signs, 1, 4); - break; - - default: break; - } - - /* - This filter enhances harmonic components of the fixed-codebook vector to - improve the quality of the reconstructed speech. - - / fc_v[i], i < pitch_delay - fc_v[i] = < - \ fc_v[i] + gain_pitch * fc_v[i-pitch_delay], i >= pitch_delay - */ - ff_acelp_weighted_vector_sum(fc + pitch_delay_int[i], - fc + pitch_delay_int[i], - fc, 1 << 14, - av_clip(ctx->past_gain_pitch[0], SHARP_MIN, SHARP_MAX), - 0, 14, - SUBFRAME_SIZE - pitch_delay_int[i]); - - memmove(ctx->past_gain_pitch+1, ctx->past_gain_pitch, 5 * sizeof(int16_t)); - ctx->past_gain_code[1] = ctx->past_gain_code[0]; - - if (frame_erasure) { - ctx->past_gain_pitch[0] = (29491 * ctx->past_gain_pitch[0]) >> 15; // 0.90 (0.15) - ctx->past_gain_code[0] = ( 2007 * ctx->past_gain_code[0] ) >> 11; // 0.98 (0.11) - - gain_corr_factor = 0; - } else { - if (packet_type == FORMAT_G729D_6K4) { - ctx->past_gain_pitch[0] = cb_gain_1st_6k4[gc_1st_index][0] + - cb_gain_2nd_6k4[gc_2nd_index][0]; - gain_corr_factor = cb_gain_1st_6k4[gc_1st_index][1] + - cb_gain_2nd_6k4[gc_2nd_index][1]; - - /* Without check below overflow can occur in ff_acelp_update_past_gain. - It is not issue for G.729, because gain_corr_factor in it's case is always - greater than 1024, while in G.729D it can be even zero. */ - gain_corr_factor = FFMAX(gain_corr_factor, 1024); -#ifndef G729_BITEXACT - gain_corr_factor >>= 1; -#endif - } else { - ctx->past_gain_pitch[0] = cb_gain_1st_8k[gc_1st_index][0] + - cb_gain_2nd_8k[gc_2nd_index][0]; - gain_corr_factor = cb_gain_1st_8k[gc_1st_index][1] + - cb_gain_2nd_8k[gc_2nd_index][1]; - } - - /* Decode the fixed-codebook gain. */ - ctx->past_gain_code[0] = ff_acelp_decode_gain_code(&ctx->dsp, gain_corr_factor, - fc, MR_ENERGY, - ctx->quant_energy, - (const int16_t *) ma_prediction_coeff, - SUBFRAME_SIZE, 4); -#ifdef G729_BITEXACT - /* - This correction required to get bit-exact result with - reference code, because gain_corr_factor in G.729D is - two times larger than in original G.729. - - If bit-exact result is not issue then gain_corr_factor - can be simpler divided by 2 before call to g729_get_gain_code - instead of using correction below. - */ - if (packet_type == FORMAT_G729D_6K4) { - gain_corr_factor >>= 1; - ctx->past_gain_code[0] >>= 1; - } -#endif - } - ff_acelp_update_past_gain(ctx->quant_energy, gain_corr_factor, 2, frame_erasure); - - /* Routine requires rounding to lowest. */ - ff_acelp_interpolate(ctx->exc + i * SUBFRAME_SIZE, - ctx->exc + i * SUBFRAME_SIZE - pitch_delay_3x / 3, - ff_acelp_interp_filter, 6, - (pitch_delay_3x % 3) << 1, - 10, SUBFRAME_SIZE); - - ff_acelp_weighted_vector_sum(ctx->exc + i * SUBFRAME_SIZE, - ctx->exc + i * SUBFRAME_SIZE, fc, - (!ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_pitch[0], - ( ctx->was_periodic && frame_erasure) ? 0 : ctx->past_gain_code[0], - 1 << 13, 14, SUBFRAME_SIZE); - - memcpy(synth, ctx->syn_filter_data, 10 * sizeof(int16_t)); - - if (ff_celp_lp_synthesis_filter( - synth+10, - &lp[i][1], - ctx->exc + i * SUBFRAME_SIZE, - SUBFRAME_SIZE, - 10, - 1, - 0, - 0x800)) - /* Overflow occurred, downscale excitation signal... */ - for (j = 0; j < 2 * SUBFRAME_SIZE + PITCH_DELAY_MAX + INTERPOL_LEN; j++) - ctx->exc_base[j] >>= 2; - - /* ... and make synthesis again. */ - if (packet_type == FORMAT_G729D_6K4) { - int16_t exc_new[SUBFRAME_SIZE]; - - ctx->onset = g729d_onset_decision(ctx->onset, ctx->past_gain_code); - ctx->voice_decision = g729d_voice_decision(ctx->onset, ctx->voice_decision, ctx->past_gain_pitch); - - g729d_get_new_exc(exc_new, ctx->exc + i * SUBFRAME_SIZE, fc, ctx->voice_decision, ctx->past_gain_code[0], SUBFRAME_SIZE); - - ff_celp_lp_synthesis_filter( - synth+10, - &lp[i][1], - exc_new, - SUBFRAME_SIZE, - 10, - 0, - 0, - 0x800); - } else { - ff_celp_lp_synthesis_filter( - synth+10, - &lp[i][1], - ctx->exc + i * SUBFRAME_SIZE, - SUBFRAME_SIZE, - 10, - 0, - 0, - 0x800); - } - /* Save data (without postfilter) for use in next subframe. */ - memcpy(ctx->syn_filter_data, synth+SUBFRAME_SIZE, 10 * sizeof(int16_t)); - - /* Calculate gain of unfiltered signal for use in AGC. */ - gain_before = 0; - for (j = 0; j < SUBFRAME_SIZE; j++) - gain_before += FFABS(synth[j+10]); - - /* Call postfilter and also update voicing decision for use in next frame. */ - ff_g729_postfilter( - &ctx->dsp, - &ctx->ht_prev_data, - &is_periodic, - &lp[i][0], - pitch_delay_int[0], - ctx->residual, - ctx->res_filter_data, - ctx->pos_filter_data, - synth+10, - SUBFRAME_SIZE); - - /* Calculate gain of filtered signal for use in AGC. */ - gain_after = 0; - for(j=0; jgain_coeff = ff_g729_adaptive_gain_control( - gain_before, - gain_after, - synth+10, - SUBFRAME_SIZE, - ctx->gain_coeff); - - if (frame_erasure) - ctx->pitch_delay_int_prev = FFMIN(ctx->pitch_delay_int_prev + 1, PITCH_DELAY_MAX); - else - ctx->pitch_delay_int_prev = pitch_delay_int[i]; - - memcpy(synth+8, ctx->hpf_z, 2*sizeof(int16_t)); - ff_acelp_high_pass_filter( - out_frame + i*SUBFRAME_SIZE, - ctx->hpf_f, - synth+10, - SUBFRAME_SIZE); - memcpy(ctx->hpf_z, synth+8+SUBFRAME_SIZE, 2*sizeof(int16_t)); - } - - ctx->was_periodic = is_periodic; - - /* Save signal for use in next frame. */ - memmove(ctx->exc_base, ctx->exc_base + 2 * SUBFRAME_SIZE, (PITCH_DELAY_MAX+INTERPOL_LEN)*sizeof(int16_t)); - - *got_frame_ptr = 1; - return buf_size; -} - -AVCodec ff_g729_decoder = { - .name = "g729", - .long_name = NULL_IF_CONFIG_SMALL("G.729"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_G729, - .priv_data_size = sizeof(G729Context), - .init = decoder_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.c deleted file mode 100644 index fc903740e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.c +++ /dev/null @@ -1,610 +0,0 @@ -/* - * G.729, G729 Annex D postfilter - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -#include - -#include "avcodec.h" -#include "g729.h" -#include "acelp_pitch_delay.h" -#include "g729postfilter.h" -#include "celp_math.h" -#include "acelp_filters.h" -#include "acelp_vectors.h" -#include "celp_filters.h" - -#define FRAC_BITS 15 -#include "mathops.h" - -/** - * short interpolation filter (of length 33, according to spec) - * for computing signal with non-integer delay - */ -static const int16_t ff_g729_interp_filt_short[(ANALYZED_FRAC_DELAYS+1)*SHORT_INT_FILT_LEN] = { - 0, 31650, 28469, 23705, 18050, 12266, 7041, 2873, - 0, -1597, -2147, -1992, -1492, -933, -484, -188, -}; - -/** - * long interpolation filter (of length 129, according to spec) - * for computing signal with non-integer delay - */ -static const int16_t ff_g729_interp_filt_long[(ANALYZED_FRAC_DELAYS+1)*LONG_INT_FILT_LEN] = { - 0, 31915, 29436, 25569, 20676, 15206, 9639, 4439, - 0, -3390, -5579, -6549, -6414, -5392, -3773, -1874, - 0, 1595, 2727, 3303, 3319, 2850, 2030, 1023, - 0, -887, -1527, -1860, -1876, -1614, -1150, -579, - 0, 501, 859, 1041, 1044, 892, 631, 315, - 0, -266, -453, -543, -538, -455, -317, -156, - 0, 130, 218, 258, 253, 212, 147, 72, - 0, -59, -101, -122, -123, -106, -77, -40, -}; - -/** - * formant_pp_factor_num_pow[i] = FORMANT_PP_FACTOR_NUM^(i+1) - */ -static const int16_t formant_pp_factor_num_pow[10]= { - /* (0.15) */ - 18022, 9912, 5451, 2998, 1649, 907, 499, 274, 151, 83 -}; - -/** - * formant_pp_factor_den_pow[i] = FORMANT_PP_FACTOR_DEN^(i+1) - */ -static const int16_t formant_pp_factor_den_pow[10] = { - /* (0.15) */ - 22938, 16057, 11240, 7868, 5508, 3856, 2699, 1889, 1322, 925 -}; - -/** - * \brief Residual signal calculation (4.2.1 if G.729) - * \param out [out] output data filtered through A(z/FORMANT_PP_FACTOR_NUM) - * \param filter_coeffs (3.12) A(z/FORMANT_PP_FACTOR_NUM) filter coefficients - * \param in input speech data to process - * \param subframe_size size of one subframe - * - * \note in buffer must contain 10 items of previous speech data before top of the buffer - * \remark It is safe to pass the same buffer for input and output. - */ -static void residual_filter(int16_t* out, const int16_t* filter_coeffs, const int16_t* in, - int subframe_size) -{ - int i, n; - - for (n = subframe_size - 1; n >= 0; n--) { - int sum = 0x800; - for (i = 0; i < 10; i++) - sum += filter_coeffs[i] * in[n - i - 1]; - - out[n] = in[n] + (sum >> 12); - } -} - -/** - * \brief long-term postfilter (4.2.1) - * \param dsp initialized DSP context - * \param pitch_delay_int integer part of the pitch delay in the first subframe - * \param residual filtering input data - * \param residual_filt [out] speech signal with applied A(z/FORMANT_PP_FACTOR_NUM) filter - * \param subframe_size size of subframe - * - * \return 0 if long-term prediction gain is less than 3dB, 1 - otherwise - */ -static int16_t long_term_filter(DSPContext *dsp, int pitch_delay_int, - const int16_t* residual, int16_t *residual_filt, - int subframe_size) -{ - int i, k, tmp, tmp2; - int sum; - int L_temp0; - int L_temp1; - int64_t L64_temp0; - int64_t L64_temp1; - int16_t shift; - int corr_int_num, corr_int_den; - - int ener; - int16_t sh_ener; - - int16_t gain_num,gain_den; //selected signal's gain numerator and denominator - int16_t sh_gain_num, sh_gain_den; - int gain_num_square; - - int16_t gain_long_num,gain_long_den; //filtered through long interpolation filter signal's gain numerator and denominator - int16_t sh_gain_long_num, sh_gain_long_den; - - int16_t best_delay_int, best_delay_frac; - - int16_t delayed_signal_offset; - int lt_filt_factor_a, lt_filt_factor_b; - - int16_t * selected_signal; - const int16_t * selected_signal_const; //Necessary to avoid compiler warning - - int16_t sig_scaled[SUBFRAME_SIZE + RES_PREV_DATA_SIZE]; - int16_t delayed_signal[ANALYZED_FRAC_DELAYS][SUBFRAME_SIZE+1]; - int corr_den[ANALYZED_FRAC_DELAYS][2]; - - tmp = 0; - for(i=0; i 0) - for (i = 0; i < subframe_size + RES_PREV_DATA_SIZE; i++) - sig_scaled[i] = residual[i] >> shift; - else - for (i = 0; i < subframe_size + RES_PREV_DATA_SIZE; i++) - sig_scaled[i] = residual[i] << -shift; - - /* Start of best delay searching code */ - gain_num = 0; - - ener = dsp->scalarproduct_int16(sig_scaled + RES_PREV_DATA_SIZE, - sig_scaled + RES_PREV_DATA_SIZE, - subframe_size); - if (ener) { - sh_ener = FFMAX(av_log2(ener) - 14, 0); - ener >>= sh_ener; - /* Search for best pitch delay. - - sum{ r(n) * r(k,n) ] }^2 - R'(k)^2 := ------------------------- - sum{ r(k,n) * r(k,n) } - - - R(T) := sum{ r(n) * r(n-T) ] } - - - where - r(n-T) is integer delayed signal with delay T - r(k,n) is non-integer delayed signal with integer delay best_delay - and fractional delay k */ - - /* Find integer delay best_delay which maximizes correlation R(T). - - This is also equals to numerator of R'(0), - since the fine search (second step) is done with 1/8 - precision around best_delay. */ - corr_int_num = 0; - best_delay_int = pitch_delay_int - 1; - for (i = pitch_delay_int - 1; i <= pitch_delay_int + 1; i++) { - sum = dsp->scalarproduct_int16(sig_scaled + RES_PREV_DATA_SIZE, - sig_scaled + RES_PREV_DATA_SIZE - i, - subframe_size); - if (sum > corr_int_num) { - corr_int_num = sum; - best_delay_int = i; - } - } - if (corr_int_num) { - /* Compute denominator of pseudo-normalized correlation R'(0). */ - corr_int_den = dsp->scalarproduct_int16(sig_scaled - best_delay_int + RES_PREV_DATA_SIZE, - sig_scaled - best_delay_int + RES_PREV_DATA_SIZE, - subframe_size); - - /* Compute signals with non-integer delay k (with 1/8 precision), - where k is in [0;6] range. - Entire delay is qual to best_delay+(k+1)/8 - This is archieved by applying an interpolation filter of - legth 33 to source signal. */ - for (k = 0; k < ANALYZED_FRAC_DELAYS; k++) { - ff_acelp_interpolate(&delayed_signal[k][0], - &sig_scaled[RES_PREV_DATA_SIZE - best_delay_int], - ff_g729_interp_filt_short, - ANALYZED_FRAC_DELAYS+1, - 8 - k - 1, - SHORT_INT_FILT_LEN, - subframe_size + 1); - } - - /* Compute denominator of pseudo-normalized correlation R'(k). - - corr_den[k][0] is square root of R'(k) denominator, for int(T) == int(T0) - corr_den[k][1] is square root of R'(k) denominator, for int(T) == int(T0)+1 - - Also compute maximum value of above denominators over all k. */ - tmp = corr_int_den; - for (k = 0; k < ANALYZED_FRAC_DELAYS; k++) { - sum = dsp->scalarproduct_int16(&delayed_signal[k][1], - &delayed_signal[k][1], - subframe_size - 1); - corr_den[k][0] = sum + delayed_signal[k][0 ] * delayed_signal[k][0 ]; - corr_den[k][1] = sum + delayed_signal[k][subframe_size] * delayed_signal[k][subframe_size]; - - tmp = FFMAX3(tmp, corr_den[k][0], corr_den[k][1]); - } - - sh_gain_den = av_log2(tmp) - 14; - if (sh_gain_den >= 0) { - - sh_gain_num = FFMAX(sh_gain_den, sh_ener); - /* Loop through all k and find delay that maximizes - R'(k) correlation. - Search is done in [int(T0)-1; intT(0)+1] range - with 1/8 precision. */ - delayed_signal_offset = 1; - best_delay_frac = 0; - gain_den = corr_int_den >> sh_gain_den; - gain_num = corr_int_num >> sh_gain_num; - gain_num_square = gain_num * gain_num; - for (k = 0; k < ANALYZED_FRAC_DELAYS; k++) { - for (i = 0; i < 2; i++) { - int16_t gain_num_short, gain_den_short; - int gain_num_short_square; - /* Compute numerator of pseudo-normalized - correlation R'(k). */ - sum = dsp->scalarproduct_int16(&delayed_signal[k][i], - sig_scaled + RES_PREV_DATA_SIZE, - subframe_size); - gain_num_short = FFMAX(sum >> sh_gain_num, 0); - - /* - gain_num_short_square gain_num_square - R'(T)^2 = -----------------------, max R'(T)^2= -------------- - den gain_den - */ - gain_num_short_square = gain_num_short * gain_num_short; - gain_den_short = corr_den[k][i] >> sh_gain_den; - - tmp = MULL(gain_num_short_square, gain_den, FRAC_BITS); - tmp2 = MULL(gain_num_square, gain_den_short, FRAC_BITS); - - // R'(T)^2 > max R'(T)^2 - if (tmp > tmp2) { - gain_num = gain_num_short; - gain_den = gain_den_short; - gain_num_square = gain_num_short_square; - delayed_signal_offset = i; - best_delay_frac = k + 1; - } - } - } - - /* - R'(T)^2 - 2 * --------- < 1 - R(0) - */ - L64_temp0 = (int64_t)gain_num_square << ((sh_gain_num << 1) + 1); - L64_temp1 = ((int64_t)gain_den * ener) << (sh_gain_den + sh_ener); - if (L64_temp0 < L64_temp1) - gain_num = 0; - } // if(sh_gain_den >= 0) - } // if(corr_int_num) - } // if(ener) - /* End of best delay searching code */ - - if (!gain_num) { - memcpy(residual_filt, residual + RES_PREV_DATA_SIZE, subframe_size * sizeof(int16_t)); - - /* Long-term prediction gain is less than 3dB. Long-term postfilter is disabled. */ - return 0; - } - if (best_delay_frac) { - /* Recompute delayed signal with an interpolation filter of length 129. */ - ff_acelp_interpolate(residual_filt, - &sig_scaled[RES_PREV_DATA_SIZE - best_delay_int + delayed_signal_offset], - ff_g729_interp_filt_long, - ANALYZED_FRAC_DELAYS + 1, - 8 - best_delay_frac, - LONG_INT_FILT_LEN, - subframe_size + 1); - /* Compute R'(k) correlation's numerator. */ - sum = dsp->scalarproduct_int16(residual_filt, - sig_scaled + RES_PREV_DATA_SIZE, - subframe_size); - - if (sum < 0) { - gain_long_num = 0; - sh_gain_long_num = 0; - } else { - tmp = FFMAX(av_log2(sum) - 14, 0); - sum >>= tmp; - gain_long_num = sum; - sh_gain_long_num = tmp; - } - - /* Compute R'(k) correlation's denominator. */ - sum = dsp->scalarproduct_int16(residual_filt, residual_filt, subframe_size); - - tmp = FFMAX(av_log2(sum) - 14, 0); - sum >>= tmp; - gain_long_den = sum; - sh_gain_long_den = tmp; - - /* Select between original and delayed signal. - Delayed signal will be selected if it increases R'(k) - correlation. */ - L_temp0 = gain_num * gain_num; - L_temp0 = MULL(L_temp0, gain_long_den, FRAC_BITS); - - L_temp1 = gain_long_num * gain_long_num; - L_temp1 = MULL(L_temp1, gain_den, FRAC_BITS); - - tmp = ((sh_gain_long_num - sh_gain_num) << 1) - (sh_gain_long_den - sh_gain_den); - if (tmp > 0) - L_temp0 >>= tmp; - else - L_temp1 >>= -tmp; - - /* Check if longer filter increases the values of R'(k). */ - if (L_temp1 > L_temp0) { - /* Select long filter. */ - selected_signal = residual_filt; - gain_num = gain_long_num; - gain_den = gain_long_den; - sh_gain_num = sh_gain_long_num; - sh_gain_den = sh_gain_long_den; - } else - /* Select short filter. */ - selected_signal = &delayed_signal[best_delay_frac-1][delayed_signal_offset]; - - /* Rescale selected signal to original value. */ - if (shift > 0) - for (i = 0; i < subframe_size; i++) - selected_signal[i] <<= shift; - else - for (i = 0; i < subframe_size; i++) - selected_signal[i] >>= -shift; - - /* necessary to avoid compiler warning */ - selected_signal_const = selected_signal; - } // if(best_delay_frac) - else - selected_signal_const = residual + RES_PREV_DATA_SIZE - (best_delay_int + 1 - delayed_signal_offset); -#ifdef G729_BITEXACT - tmp = sh_gain_num - sh_gain_den; - if (tmp > 0) - gain_den >>= tmp; - else - gain_num >>= -tmp; - - if (gain_num > gain_den) - lt_filt_factor_a = MIN_LT_FILT_FACTOR_A; - else { - gain_num >>= 2; - gain_den >>= 1; - lt_filt_factor_a = (gain_den << 15) / (gain_den + gain_num); - } -#else - L64_temp0 = ((int64_t)gain_num) << (sh_gain_num - 1); - L64_temp1 = ((int64_t)gain_den) << sh_gain_den; - lt_filt_factor_a = FFMAX((L64_temp1 << 15) / (L64_temp1 + L64_temp0), MIN_LT_FILT_FACTOR_A); -#endif - - /* Filter through selected filter. */ - lt_filt_factor_b = 32767 - lt_filt_factor_a + 1; - - ff_acelp_weighted_vector_sum(residual_filt, residual + RES_PREV_DATA_SIZE, - selected_signal_const, - lt_filt_factor_a, lt_filt_factor_b, - 1<<14, 15, subframe_size); - - // Long-term prediction gain is larger than 3dB. - return 1; -} - -/** - * \brief Calculate reflection coefficient for tilt compensation filter (4.2.3). - * \param dsp initialized DSP context - * \param lp_gn (3.12) coefficients of A(z/FORMANT_PP_FACTOR_NUM) filter - * \param lp_gd (3.12) coefficients of A(z/FORMANT_PP_FACTOR_DEN) filter - * \param speech speech to update - * \param subframe_size size of subframe - * - * \return (3.12) reflection coefficient - * - * \remark The routine also calculates the gain term for the short-term - * filter (gf) and multiplies the speech data by 1/gf. - * - * \note All members of lp_gn, except 10-19 must be equal to zero. - */ -static int16_t get_tilt_comp(DSPContext *dsp, int16_t *lp_gn, - const int16_t *lp_gd, int16_t* speech, - int subframe_size) -{ - int rh1,rh0; // (3.12) - int temp; - int i; - int gain_term; - - lp_gn[10] = 4096; //1.0 in (3.12) - - /* Apply 1/A(z/FORMANT_PP_FACTOR_DEN) filter to hf. */ - ff_celp_lp_synthesis_filter(lp_gn + 11, lp_gd + 1, lp_gn + 11, 22, 10, 0, 0, 0x800); - /* Now lp_gn (starting with 10) contains impulse response - of A(z/FORMANT_PP_FACTOR_NUM)/A(z/FORMANT_PP_FACTOR_DEN) filter. */ - - rh0 = dsp->scalarproduct_int16(lp_gn + 10, lp_gn + 10, 20); - rh1 = dsp->scalarproduct_int16(lp_gn + 10, lp_gn + 11, 20); - - /* downscale to avoid overflow */ - temp = av_log2(rh0) - 14; - if (temp > 0) { - rh0 >>= temp; - rh1 >>= temp; - } - - if (FFABS(rh1) > rh0 || !rh0) - return 0; - - gain_term = 0; - for (i = 0; i < 20; i++) - gain_term += FFABS(lp_gn[i + 10]); - gain_term >>= 2; // (3.12) -> (5.10) - - if (gain_term > 0x400) { // 1.0 in (5.10) - temp = 0x2000000 / gain_term; // 1.0/gain_term in (0.15) - for (i = 0; i < subframe_size; i++) - speech[i] = (speech[i] * temp + 0x4000) >> 15; - } - - return -(rh1 << 15) / rh0; -} - -/** - * \brief Apply tilt compensation filter (4.2.3). - * \param res_pst [in/out] residual signal (partially filtered) - * \param k1 (3.12) reflection coefficient - * \param subframe_size size of subframe - * \param ht_prev_data previous data for 4.2.3, equation 86 - * - * \return new value for ht_prev_data -*/ -static int16_t apply_tilt_comp(int16_t* out, int16_t* res_pst, int refl_coeff, - int subframe_size, int16_t ht_prev_data) -{ - int tmp, tmp2; - int i; - int gt, ga; - int fact, sh_fact; - - if (refl_coeff > 0) { - gt = (refl_coeff * G729_TILT_FACTOR_PLUS + 0x4000) >> 15; - fact = 0x4000; // 0.5 in (0.15) - sh_fact = 15; - } else { - gt = (refl_coeff * G729_TILT_FACTOR_MINUS + 0x4000) >> 15; - fact = 0x800; // 0.5 in (3.12) - sh_fact = 12; - } - ga = (fact << 15) / av_clip_int16(32768 - FFABS(gt)); - gt >>= 1; - - /* Apply tilt compensation filter to signal. */ - tmp = res_pst[subframe_size - 1]; - - for (i = subframe_size - 1; i >= 1; i--) { - tmp2 = (res_pst[i] << 15) + ((gt * res_pst[i-1]) << 1); - tmp2 = (tmp2 + 0x4000) >> 15; - - tmp2 = (tmp2 * ga * 2 + fact) >> sh_fact; - out[i] = tmp2; - } - tmp2 = (res_pst[0] << 15) + ((gt * ht_prev_data) << 1); - tmp2 = (tmp2 + 0x4000) >> 15; - tmp2 = (tmp2 * ga * 2 + fact) >> sh_fact; - out[0] = tmp2; - - return tmp; -} - -void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing, - const int16_t *lp_filter_coeffs, int pitch_delay_int, - int16_t* residual, int16_t* res_filter_data, - int16_t* pos_filter_data, int16_t *speech, int subframe_size) -{ - int16_t residual_filt_buf[SUBFRAME_SIZE+11]; - int16_t lp_gn[33]; // (3.12) - int16_t lp_gd[11]; // (3.12) - int tilt_comp_coeff; - int i; - - /* Zero-filling is necessary for tilt-compensation filter. */ - memset(lp_gn, 0, 33 * sizeof(int16_t)); - - /* Calculate A(z/FORMANT_PP_FACTOR_NUM) filter coefficients. */ - for (i = 0; i < 10; i++) - lp_gn[i + 11] = (lp_filter_coeffs[i + 1] * formant_pp_factor_num_pow[i] + 0x4000) >> 15; - - /* Calculate A(z/FORMANT_PP_FACTOR_DEN) filter coefficients. */ - for (i = 0; i < 10; i++) - lp_gd[i + 1] = (lp_filter_coeffs[i + 1] * formant_pp_factor_den_pow[i] + 0x4000) >> 15; - - /* residual signal calculation (one-half of short-term postfilter) */ - memcpy(speech - 10, res_filter_data, 10 * sizeof(int16_t)); - residual_filter(residual + RES_PREV_DATA_SIZE, lp_gn + 11, speech, subframe_size); - /* Save data to use it in the next subframe. */ - memcpy(res_filter_data, speech + subframe_size - 10, 10 * sizeof(int16_t)); - - /* long-term filter. If long-term prediction gain is larger than 3dB (returned value is - nonzero) then declare current subframe as periodic. */ - *voicing = FFMAX(*voicing, long_term_filter(dsp, pitch_delay_int, - residual, residual_filt_buf + 10, - subframe_size)); - - /* shift residual for using in next subframe */ - memmove(residual, residual + subframe_size, RES_PREV_DATA_SIZE * sizeof(int16_t)); - - /* short-term filter tilt compensation */ - tilt_comp_coeff = get_tilt_comp(dsp, lp_gn, lp_gd, residual_filt_buf + 10, subframe_size); - - /* Apply second half of short-term postfilter: 1/A(z/FORMANT_PP_FACTOR_DEN) */ - ff_celp_lp_synthesis_filter(pos_filter_data + 10, lp_gd + 1, - residual_filt_buf + 10, - subframe_size, 10, 0, 0, 0x800); - memcpy(pos_filter_data, pos_filter_data + subframe_size, 10 * sizeof(int16_t)); - - *ht_prev_data = apply_tilt_comp(speech, pos_filter_data + 10, tilt_comp_coeff, - subframe_size, *ht_prev_data); -} - -/** - * \brief Adaptive gain control (4.2.4) - * \param gain_before gain of speech before applying postfilters - * \param gain_after gain of speech after applying postfilters - * \param speech [in/out] signal buffer - * \param subframe_size length of subframe - * \param gain_prev (3.12) previous value of gain coefficient - * - * \return (3.12) last value of gain coefficient - */ -int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech, - int subframe_size, int16_t gain_prev) -{ - int gain; // (3.12) - int n; - int exp_before, exp_after; - - if(!gain_after && gain_before) - return 0; - - if (gain_before) { - - exp_before = 14 - av_log2(gain_before); - gain_before = bidir_sal(gain_before, exp_before); - - exp_after = 14 - av_log2(gain_after); - gain_after = bidir_sal(gain_after, exp_after); - - if (gain_before < gain_after) { - gain = (gain_before << 15) / gain_after; - gain = bidir_sal(gain, exp_after - exp_before - 1); - } else { - gain = ((gain_before - gain_after) << 14) / gain_after + 0x4000; - gain = bidir_sal(gain, exp_after - exp_before); - } - gain = (gain * G729_AGC_FAC1 + 0x4000) >> 15; // gain * (1-0.9875) - } else - gain = 0; - - for (n = 0; n < subframe_size; n++) { - // gain_prev = gain + 0.9875 * gain_prev - gain_prev = (G729_AGC_FACTOR * gain_prev + 0x4000) >> 15; - gain_prev = av_clip_int16(gain + gain_prev); - speech[n] = av_clip_int16((speech[n] * gain_prev + 0x2000) >> 14); - } - return gain_prev; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.h deleted file mode 100644 index 5239fc80d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/g729postfilter.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * G.729, G729 Annex D postfilter - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef FFMPEG_G729POSTFILTER_H -#define FFMPEG_G729POSTFILTER_H - -#include -#include "dsputil.h" - -/** - * tilt compensation factor (G.729, k1>0) - * 0.2 in Q15 - */ -#define G729_TILT_FACTOR_PLUS 6554 - -/** - * tilt compensation factor (G.729, k1<0) - * 0.9 in Q15 - */ -#define G729_TILT_FACTOR_MINUS 29491 - -/* 4.2.2 */ -#define FORMANT_PP_FACTOR_NUM 18022 //0.55 in Q15 -#define FORMANT_PP_FACTOR_DEN 22938 //0.70 in Q15 - -/** - * gain adjustment factor (G.729, 4.2.4) - * 0.9875 in Q15 - */ -#define G729_AGC_FACTOR 32358 -#define G729_AGC_FAC1 (32768-G729_AGC_FACTOR) - -/** - * 1.0 / (1.0 + 0.5) in Q15 - * where 0.5 is the minimum value of - * weight factor, controlling amount of long-term postfiltering - */ -#define MIN_LT_FILT_FACTOR_A 21845 - -/** - * Short interpolation filter length - */ -#define SHORT_INT_FILT_LEN 2 - -/** - * Long interpolation filter length - */ -#define LONG_INT_FILT_LEN 8 - -/** - * Number of analyzed fractional pitch delays in second stage of long-term - * postfilter - */ -#define ANALYZED_FRAC_DELAYS 7 - -/** - * Amount of past residual signal data stored in buffer - */ -#define RES_PREV_DATA_SIZE (PITCH_DELAY_MAX + LONG_INT_FILT_LEN + 1) - -/** - * \brief Signal postfiltering (4.2) - * \param dsp initialized DSP context - * \param ht_prev_data [in/out] (Q12) pointer to variable receiving tilt - * compensation filter data from previous subframe - * \param voicing [in/out] (Q0) pointer to variable receiving voicing decision - * \param lp_filter_coeffs (Q12) LP filter coefficients - * \param pitch_delay_int integer part of the pitch delay - * \param residual [in/out] (Q0) residual signal buffer (used in long-term postfilter) - * \param res_filter_data [in/out] (Q0) speech data of previous subframe - * \param pos_filter_data [in/out] (Q0) previous speech data for short-term postfilter - * \param speech [in/out] (Q0) signal buffer - * \param subframe_size size of subframe - * - * Filtering has the following stages: - * Long-term postfilter (4.2.1) - * Short-term postfilter (4.2.2). - * Tilt-compensation (4.2.3) - */ -void ff_g729_postfilter(DSPContext *dsp, int16_t* ht_prev_data, int* voicing, - const int16_t *lp_filter_coeffs, int pitch_delay_int, - int16_t* residual, int16_t* res_filter_data, - int16_t* pos_filter_data, int16_t *speech, - int subframe_size); - -/** - * \brief Adaptive gain control (4.2.4) - * \param gain_before (Q0) gain of speech before applying postfilters - * \param gain_after (Q0) gain of speech after applying postfilters - * \param speech [in/out] (Q0) signal buffer - * \param subframe_size length of subframe - * \param gain_prev (Q12) previous value of gain coefficient - * - * \return (Q12) last value of gain coefficient - */ -int16_t ff_g729_adaptive_gain_control(int gain_before, int gain_after, int16_t *speech, - int subframe_size, int16_t gain_prev); - -#endif // FFMPEG_G729POSTFILTER_H diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/get_bits.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/get_bits.h deleted file mode 100644 index 4ddb08817..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/get_bits.h +++ /dev/null @@ -1,657 +0,0 @@ -/* - * copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * bitstream reader API header. - */ - -#ifndef AVCODEC_GET_BITS_H -#define AVCODEC_GET_BITS_H - -#include - -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/avassert.h" -#include "mathops.h" - -/* - * Safe bitstream reading: - * optionally, the get_bits API can check to ensure that we - * don't read past input buffer boundaries. This is protected - * with CONFIG_SAFE_BITSTREAM_READER at the global level, and - * then below that with UNCHECKED_BITSTREAM_READER at the per- - * decoder level. This means that decoders that check internally - * can "#define UNCHECKED_BITSTREAM_READER 1" to disable - * overread checks. - * Boundary checking causes a minor performance penalty so for - * applications that won't want/need this, it can be disabled - * globally using "#define CONFIG_SAFE_BITSTREAM_READER 0". - */ -#ifndef UNCHECKED_BITSTREAM_READER -#define UNCHECKED_BITSTREAM_READER !CONFIG_SAFE_BITSTREAM_READER -#endif - -typedef struct GetBitContext { - const uint8_t *buffer, *buffer_end; - int index; - int size_in_bits; - int size_in_bits_plus8; -} GetBitContext; - -#define VLC_TYPE int16_t - -typedef struct VLC { - int bits; - VLC_TYPE (*table)[2]; ///< code, bits - int table_size, table_allocated; - void * volatile init_state; -} VLC; - -typedef struct RL_VLC_ELEM { - int16_t level; - int8_t len; - uint8_t run; -} RL_VLC_ELEM; - -/* Bitstream reader API docs: - * name - * arbitrary name which is used as prefix for the internal variables - * - * gb - * getbitcontext - * - * OPEN_READER(name, gb) - * load gb into local variables - * - * CLOSE_READER(name, gb) - * store local vars in gb - * - * UPDATE_CACHE(name, gb) - * Refill the internal cache from the bitstream. - * After this call at least MIN_CACHE_BITS will be available. - * - * GET_CACHE(name, gb) - * Will output the contents of the internal cache, - * next bit is MSB of 32 or 64 bit (FIXME 64bit). - * - * SHOW_UBITS(name, gb, num) - * Will return the next num bits. - * - * SHOW_SBITS(name, gb, num) - * Will return the next num bits and do sign extension. - * - * SKIP_BITS(name, gb, num) - * Will skip over the next num bits. - * Note, this is equivalent to SKIP_CACHE; SKIP_COUNTER. - * - * SKIP_CACHE(name, gb, num) - * Will remove the next num bits from the cache (note SKIP_COUNTER - * MUST be called before UPDATE_CACHE / CLOSE_READER). - * - * SKIP_COUNTER(name, gb, num) - * Will increment the internal bit counter (see SKIP_CACHE & SKIP_BITS). - * - * LAST_SKIP_BITS(name, gb, num) - * Like SKIP_BITS, to be used if next call is UPDATE_CACHE or CLOSE_READER. - * - * For examples see get_bits, show_bits, skip_bits, get_vlc. - */ - -#ifdef LONG_BITSTREAM_READER -# define MIN_CACHE_BITS 32 -#else -# define MIN_CACHE_BITS 25 -#endif - -#if UNCHECKED_BITSTREAM_READER -#define OPEN_READER(name, gb) \ - unsigned int name ## _index = (gb)->index; \ - unsigned int av_unused name ## _cache - -#define HAVE_BITS_REMAINING(name, gb) 1 -#else -#define OPEN_READER(name, gb) \ - unsigned int name ## _index = (gb)->index; \ - unsigned int av_unused name ## _cache = 0; \ - unsigned int av_unused name ## _size_plus8 = (gb)->size_in_bits_plus8 - -#define HAVE_BITS_REMAINING(name, gb) name ## _index < name ## _size_plus8 -#endif - -#define CLOSE_READER(name, gb) (gb)->index = name ## _index - -# ifdef LONG_BITSTREAM_READER - -# define UPDATE_CACHE_LE(name, gb) name ## _cache = \ - AV_RL64((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7) - -# define UPDATE_CACHE_BE(name, gb) name ## _cache = \ - AV_RB64((gb)->buffer + (name ## _index >> 3)) >> (32 - (name ## _index & 7)) - -#else - -# define UPDATE_CACHE_LE(name, gb) name ## _cache = \ - AV_RL32((gb)->buffer + (name ## _index >> 3)) >> (name ## _index & 7) - -# define UPDATE_CACHE_BE(name, gb) name ## _cache = \ - AV_RB32((gb)->buffer + (name ## _index >> 3)) << (name ## _index & 7) - -#endif - - -#ifdef BITSTREAM_READER_LE - -# define UPDATE_CACHE(name, gb) UPDATE_CACHE_LE(name, gb) - -# define SKIP_CACHE(name, gb, num) name ## _cache >>= (num) - -#else - -# define UPDATE_CACHE(name, gb) UPDATE_CACHE_BE(name, gb) - -# define SKIP_CACHE(name, gb, num) name ## _cache <<= (num) - -#endif - -#if UNCHECKED_BITSTREAM_READER -# define SKIP_COUNTER(name, gb, num) name ## _index += (num) -#else -# define SKIP_COUNTER(name, gb, num) \ - name ## _index = FFMIN(name ## _size_plus8, name ## _index + (num)) -#endif - -#define SKIP_BITS(name, gb, num) \ - do { \ - SKIP_CACHE(name, gb, num); \ - SKIP_COUNTER(name, gb, num); \ - } while (0) - -#define LAST_SKIP_BITS(name, gb, num) SKIP_COUNTER(name, gb, num) - -#define SHOW_UBITS_LE(name, gb, num) zero_extend(name ## _cache, num) -#define SHOW_SBITS_LE(name, gb, num) sign_extend(name ## _cache, num) - -#define SHOW_UBITS_BE(name, gb, num) NEG_USR32(name ## _cache, num) -#define SHOW_SBITS_BE(name, gb, num) NEG_SSR32(name ## _cache, num) - -#ifdef BITSTREAM_READER_LE -# define SHOW_UBITS(name, gb, num) SHOW_UBITS_LE(name, gb, num) -# define SHOW_SBITS(name, gb, num) SHOW_SBITS_LE(name, gb, num) -#else -# define SHOW_UBITS(name, gb, num) SHOW_UBITS_BE(name, gb, num) -# define SHOW_SBITS(name, gb, num) SHOW_SBITS_BE(name, gb, num) -#endif - -#define GET_CACHE(name, gb) ((uint32_t) name ## _cache) - -static inline int get_bits_count(const GetBitContext *s) -{ - return s->index; -} - -static inline void skip_bits_long(GetBitContext *s, int n) -{ -#if UNCHECKED_BITSTREAM_READER - s->index += n; -#else - s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); -#endif -} - -/** - * read mpeg1 dc style vlc (sign bit + mantisse with no MSB). - * if MSB not set it is negative - * @param n length in bits - */ -static inline int get_xbits(GetBitContext *s, int n) -{ - register int sign; - register int32_t cache; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - cache = GET_CACHE(re, s); - sign = ~cache >> 31; - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); - return (NEG_USR32(sign ^ cache, n) ^ sign) - sign; -} - -static inline int get_sbits(GetBitContext *s, int n) -{ - register int tmp; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - tmp = SHOW_SBITS(re, s, n); - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); - return tmp; -} - -/** - * Read 1-25 bits. - */ -static inline unsigned int get_bits(GetBitContext *s, int n) -{ - register int tmp; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - tmp = SHOW_UBITS(re, s, n); - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); - return tmp; -} - -static inline unsigned int get_bits_le(GetBitContext *s, int n) -{ - register int tmp; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE_LE(re, s); - tmp = SHOW_UBITS_LE(re, s, n); - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); - return tmp; -} - -/** - * Show 1-25 bits. - */ -static inline unsigned int show_bits(GetBitContext *s, int n) -{ - register int tmp; - OPEN_READER(re, s); - av_assert2(n>0 && n<=25); - UPDATE_CACHE(re, s); - tmp = SHOW_UBITS(re, s, n); - return tmp; -} - -static inline void skip_bits(GetBitContext *s, int n) -{ - OPEN_READER(re, s); - LAST_SKIP_BITS(re, s, n); - CLOSE_READER(re, s); -} - -static inline unsigned int get_bits1(GetBitContext *s) -{ - unsigned int index = s->index; - uint8_t result = s->buffer[index >> 3]; -#ifdef BITSTREAM_READER_LE - result >>= index & 7; - result &= 1; -#else - result <<= index & 7; - result >>= 8 - 1; -#endif -#if !UNCHECKED_BITSTREAM_READER - if (s->index < s->size_in_bits_plus8) -#endif - index++; - s->index = index; - - return result; -} - -static inline unsigned int show_bits1(GetBitContext *s) -{ - return show_bits(s, 1); -} - -static inline void skip_bits1(GetBitContext *s) -{ - skip_bits(s, 1); -} - -/** - * Read 0-32 bits. - */ -static inline unsigned int get_bits_long(GetBitContext *s, int n) -{ - if (!n) { - return 0; - } else if (n <= MIN_CACHE_BITS) { - return get_bits(s, n); - } else { -#ifdef BITSTREAM_READER_LE - unsigned ret = get_bits(s, 16); - return ret | (get_bits(s, n - 16) << 16); -#else - unsigned ret = get_bits(s, 16) << (n - 16); - return ret | get_bits(s, n - 16); -#endif - } -} - -/** - * Read 0-64 bits. - */ -static inline uint64_t get_bits64(GetBitContext *s, int n) -{ - if (n <= 32) { - return get_bits_long(s, n); - } else { -#ifdef BITSTREAM_READER_LE - uint64_t ret = get_bits_long(s, 32); - return ret | (uint64_t) get_bits_long(s, n - 32) << 32; -#else - uint64_t ret = (uint64_t) get_bits_long(s, n - 32) << 32; - return ret | get_bits_long(s, 32); -#endif - } -} - -/** - * Read 0-32 bits as a signed integer. - */ -static inline int get_sbits_long(GetBitContext *s, int n) -{ - return sign_extend(get_bits_long(s, n), n); -} - -/** - * Show 0-32 bits. - */ -static inline unsigned int show_bits_long(GetBitContext *s, int n) -{ - if (n <= MIN_CACHE_BITS) { - return show_bits(s, n); - } else { - GetBitContext gb = *s; - return get_bits_long(&gb, n); - } -} - -static inline int check_marker(GetBitContext *s, const char *msg) -{ - int bit = get_bits1(s); - if (!bit) - av_log(NULL, AV_LOG_INFO, "Marker bit missing %s\n", msg); - - return bit; -} - -/** - * Initialize GetBitContext. - * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes - * larger than the actual read bits because some optimized bitstream - * readers read 32 or 64 bit at once and could read over the end - * @param bit_size the size of the buffer in bits - * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. - */ -static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, - int bit_size) -{ - int buffer_size; - int ret = 0; - - if (bit_size >= INT_MAX - 7 || bit_size < 0 || !buffer) { - buffer_size = bit_size = 0; - buffer = NULL; - ret = AVERROR_INVALIDDATA; - } - - buffer_size = (bit_size + 7) >> 3; - - s->buffer = buffer; - s->size_in_bits = bit_size; - s->size_in_bits_plus8 = bit_size + 8; - s->buffer_end = buffer + buffer_size; - s->index = 0; - - return ret; -} - -/** - * Initialize GetBitContext. - * @param buffer bitstream buffer, must be FF_INPUT_BUFFER_PADDING_SIZE bytes - * larger than the actual read bits because some optimized bitstream - * readers read 32 or 64 bit at once and could read over the end - * @param byte_size the size of the buffer in bytes - * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. - */ -static inline int init_get_bits8(GetBitContext *s, const uint8_t *buffer, - int byte_size) -{ - if (byte_size > INT_MAX / 8 || byte_size < 0) - byte_size = -1; - return init_get_bits(s, buffer, byte_size * 8); -} - -static inline const uint8_t *align_get_bits(GetBitContext *s) -{ - int n = -get_bits_count(s) & 7; - if (n) - skip_bits(s, n); - return s->buffer + (s->index >> 3); -} - -#define init_vlc(vlc, nb_bits, nb_codes, \ - bits, bits_wrap, bits_size, \ - codes, codes_wrap, codes_size, \ - flags) \ - ff_init_vlc_sparse(vlc, nb_bits, nb_codes, \ - bits, bits_wrap, bits_size, \ - codes, codes_wrap, codes_size, \ - NULL, 0, 0, flags) - -int ff_init_vlc_sparse(VLC *vlc, int nb_bits, int nb_codes, - const void *bits, int bits_wrap, int bits_size, - const void *codes, int codes_wrap, int codes_size, - const void *symbols, int symbols_wrap, int symbols_size, - int flags); -void ff_free_vlc(VLC *vlc); - -#define INIT_VLC_LE 2 -#define INIT_VLC_USE_NEW_STATIC 4 - -#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \ - do { \ - static VLC_TYPE table[static_size][2]; \ - (vlc)->table = table; \ - (vlc)->table_allocated = static_size; \ - init_vlc(vlc, bits, a, b, c, d, e, f, g, INIT_VLC_USE_NEW_STATIC); \ - } while (0) - -/** - * If the vlc code is invalid and max_depth=1, then no bits will be removed. - * If the vlc code is invalid and max_depth>1, then the number of bits removed - * is undefined. - */ -#define GET_VLC(code, name, gb, table, bits, max_depth) \ - do { \ - int n, nb_bits; \ - unsigned int index; \ - \ - index = SHOW_UBITS(name, gb, bits); \ - code = table[index][0]; \ - n = table[index][1]; \ - \ - if (max_depth > 1 && n < 0) { \ - LAST_SKIP_BITS(name, gb, bits); \ - UPDATE_CACHE(name, gb); \ - \ - nb_bits = -n; \ - \ - index = SHOW_UBITS(name, gb, nb_bits) + code; \ - code = table[index][0]; \ - n = table[index][1]; \ - if (max_depth > 2 && n < 0) { \ - LAST_SKIP_BITS(name, gb, nb_bits); \ - UPDATE_CACHE(name, gb); \ - \ - nb_bits = -n; \ - \ - index = SHOW_UBITS(name, gb, nb_bits) + code; \ - code = table[index][0]; \ - n = table[index][1]; \ - } \ - } \ - SKIP_BITS(name, gb, n); \ - } while (0) - -#define GET_RL_VLC(level, run, name, gb, table, bits, \ - max_depth, need_update) \ - do { \ - int n, nb_bits; \ - unsigned int index; \ - \ - index = SHOW_UBITS(name, gb, bits); \ - level = table[index].level; \ - n = table[index].len; \ - \ - if (max_depth > 1 && n < 0) { \ - SKIP_BITS(name, gb, bits); \ - if (need_update) { \ - UPDATE_CACHE(name, gb); \ - } \ - \ - nb_bits = -n; \ - \ - index = SHOW_UBITS(name, gb, nb_bits) + level; \ - level = table[index].level; \ - n = table[index].len; \ - } \ - run = table[index].run; \ - SKIP_BITS(name, gb, n); \ - } while (0) - -/** - * Parse a vlc code. - * @param bits is the number of bits which will be read at once, must be - * identical to nb_bits in init_vlc() - * @param max_depth is the number of times bits bits must be read to completely - * read the longest vlc code - * = (max_vlc_length + bits - 1) / bits - */ -static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], - int bits, int max_depth) -{ - int code; - - OPEN_READER(re, s); - UPDATE_CACHE(re, s); - - GET_VLC(code, re, s, table, bits, max_depth); - - CLOSE_READER(re, s); - - return code; -} - -static inline int decode012(GetBitContext *gb) -{ - int n; - n = get_bits1(gb); - if (n == 0) - return 0; - else - return get_bits1(gb) + 1; -} - -static inline int decode210(GetBitContext *gb) -{ - if (get_bits1(gb)) - return 0; - else - return 2 - get_bits1(gb); -} - -static inline int get_bits_left(GetBitContext *gb) -{ - return gb->size_in_bits - get_bits_count(gb); -} - -//#define TRACE - -#ifdef TRACE -static inline void print_bin(int bits, int n) -{ - int i; - - for (i = n - 1; i >= 0; i--) - av_log(NULL, AV_LOG_DEBUG, "%d", (bits >> i) & 1); - for (i = n; i < 24; i++) - av_log(NULL, AV_LOG_DEBUG, " "); -} - -static inline int get_bits_trace(GetBitContext *s, int n, const char *file, - const char *func, int line) -{ - int r = get_bits(s, n); - - print_bin(r, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d bit @%5d in %s %s:%d\n", - r, n, r, get_bits_count(s) - n, file, func, line); - - return r; -} - -static inline int get_vlc_trace(GetBitContext *s, VLC_TYPE (*table)[2], - int bits, int max_depth, const char *file, - const char *func, int line) -{ - int show = show_bits(s, 24); - int pos = get_bits_count(s); - int r = get_vlc2(s, table, bits, max_depth); - int len = get_bits_count(s) - pos; - int bits2 = show >> (24 - len); - - print_bin(bits2, len); - - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d vlc @%5d in %s %s:%d\n", - bits2, len, r, pos, file, func, line); - - return r; -} - -static inline int get_xbits_trace(GetBitContext *s, int n, const char *file, - const char *func, int line) -{ - int show = show_bits(s, n); - int r = get_xbits(s, n); - - print_bin(show, n); - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d xbt @%5d in %s %s:%d\n", - show, n, r, get_bits_count(s) - n, file, func, line); - - return r; -} - -#define get_bits(s, n) get_bits_trace(s , n, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_bits1(s) get_bits_trace(s, 1, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_xbits(s, n) get_xbits_trace(s, n, __FILE__, __PRETTY_FUNCTION__, __LINE__) - -#define get_vlc(s, vlc) get_vlc_trace(s, (vlc)->table, (vlc)->bits, 3, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_vlc2(s, tab, bits, max) get_vlc_trace(s, tab, bits, max, __FILE__, __PRETTY_FUNCTION__, __LINE__) - -#define tprintf(p, ...) av_log(p, AV_LOG_DEBUG, __VA_ARGS__) - -#else //TRACE -#define tprintf(p, ...) { } -#endif - -#endif /* AVCODEC_GET_BITS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.c deleted file mode 100644 index 937ac22ce..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * exp golomb vlc stuff - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief - * exp golomb vlc stuff - * @author Michael Niedermayer - */ - -#include "libavutil/common.h" - -const uint8_t ff_golomb_vlc_len[512]={ -19,17,15,15,13,13,13,13,11,11,11,11,11,11,11,11,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, -7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 -}; - -const uint8_t ff_ue_golomb_vlc_code[512]={ -32,32,32,32,32,32,32,32,31,32,32,32,32,32,32,32,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30, - 7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9,10,10,10,10,11,11,11,11,12,12,12,12,13,13,13,13,14,14,14,14, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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 -}; - -const int8_t ff_se_golomb_vlc_code[512]={ - 17, 17, 17, 17, 17, 17, 17, 17, 16, 17, 17, 17, 17, 17, 17, 17, 8, -8, 9, -9, 10,-10, 11,-11, 12,-12, 13,-13, 14,-14, 15,-15, - 4, 4, 4, 4, -4, -4, -4, -4, 5, 5, 5, 5, -5, -5, -5, -5, 6, 6, 6, 6, -6, -6, -6, -6, 7, 7, 7, 7, -7, -7, -7, -7, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, -3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 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, - 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, - 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, - 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, - 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, - 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, - 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, - 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, -}; - - -const uint8_t ff_ue_golomb_len[256]={ - 1, 3, 3, 5, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,11, -11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,13, -13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, -13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,15, -15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, -15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, -15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, -15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,17, -}; - -const uint8_t ff_interleaved_golomb_vlc_len[256]={ -9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, -9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, -9,9,7,7,9,9,7,7,5,5,5,5,5,5,5,5, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, -}; - -const uint8_t ff_interleaved_ue_golomb_vlc_code[256]={ - 15,16,7, 7, 17,18,8, 8, 3, 3, 3, 3, 3, 3, 3, 3, - 19,20,9, 9, 21,22,10,10,4, 4, 4, 4, 4, 4, 4, 4, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 23,24,11,11,25,26,12,12,5, 5, 5, 5, 5, 5, 5, 5, - 27,28,13,13,29,30,14,14,6, 6, 6, 6, 6, 6, 6, 6, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 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, - 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, - 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, - 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, -}; - -const int8_t ff_interleaved_se_golomb_vlc_code[256]={ - 8, -8, 4, 4, 9, -9, -4, -4, 2, 2, 2, 2, 2, 2, 2, 2, - 10,-10, 5, 5, 11,-11, -5, -5, -2, -2, -2, -2, -2, -2, -2, -2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 12,-12, 6, 6, 13,-13, -6, -6, 3, 3, 3, 3, 3, 3, 3, 3, - 14,-14, 7, 7, 15,-15, -7, -7, -3, -3, -3, -3, -3, -3, -3, -3, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 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, - 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, - 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, - 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, -}; - -const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]={ -0, 1, 0, 0, 2, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, -4, 5, 2, 2, 6, 7, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, -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, -8, 9, 4, 4, 10,11,5, 5, 2, 2, 2, 2, 2, 2, 2, 2, -12,13,6, 6, 14,15,7, 7, 3, 3, 3, 3, 3, 3, 3, 3, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -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, -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, -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, -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,}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.h deleted file mode 100644 index 66607ada2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/golomb.h +++ /dev/null @@ -1,557 +0,0 @@ -/* - * exp golomb vlc stuff - * Copyright (c) 2003 Michael Niedermayer - * Copyright (c) 2004 Alex Beregszaszi - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief - * exp golomb vlc stuff - * @author Michael Niedermayer and Alex Beregszaszi - */ - -#ifndef AVCODEC_GOLOMB_H -#define AVCODEC_GOLOMB_H - -#include -#include "get_bits.h" -#include "put_bits.h" - -#define INVALID_VLC 0x80000000 - -extern const uint8_t ff_golomb_vlc_len[512]; -extern const uint8_t ff_ue_golomb_vlc_code[512]; -extern const int8_t ff_se_golomb_vlc_code[512]; -extern const uint8_t ff_ue_golomb_len[256]; - -extern const uint8_t ff_interleaved_golomb_vlc_len[256]; -extern const uint8_t ff_interleaved_ue_golomb_vlc_code[256]; -extern const int8_t ff_interleaved_se_golomb_vlc_code[256]; -extern const uint8_t ff_interleaved_dirac_golomb_vlc_code[256]; - - - /** - * read unsigned exp golomb code. - */ -static inline int get_ue_golomb(GetBitContext *gb){ - unsigned int buf; - int log; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - if(buf >= (1<<27)){ - buf >>= 32 - 9; - LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); - CLOSE_READER(re, gb); - - return ff_ue_golomb_vlc_code[buf]; - }else{ - log= 2*av_log2(buf) - 31; - LAST_SKIP_BITS(re, gb, 32 - log); - CLOSE_READER(re, gb); - if (CONFIG_FTRAPV && log < 0) { - av_log(0, AV_LOG_ERROR, "Invalid UE golomb code\n"); - return AVERROR_INVALIDDATA; - } - buf>>= log; - buf--; - - return buf; - } -} - -/** - * Read an unsigned Exp-Golomb code in the range 0 to UINT32_MAX-1. - */ -static inline unsigned get_ue_golomb_long(GetBitContext *gb) -{ - unsigned buf, log; - - buf = show_bits_long(gb, 32); - log = 31 - av_log2(buf); - skip_bits_long(gb, log); - - return get_bits_long(gb, log + 1) - 1; -} - - /** - * read unsigned exp golomb code, constraint to a max of 31. - * the return value is undefined if the stored value exceeds 31. - */ -static inline int get_ue_golomb_31(GetBitContext *gb){ - unsigned int buf; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - buf >>= 32 - 9; - LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); - CLOSE_READER(re, gb); - - return ff_ue_golomb_vlc_code[buf]; -} - -static inline unsigned svq3_get_ue_golomb(GetBitContext *gb) -{ - uint32_t buf; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - if(buf&0xAA800000){ - buf >>= 32 - 8; - LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]); - CLOSE_READER(re, gb); - - return ff_interleaved_ue_golomb_vlc_code[buf]; - }else{ - unsigned ret = 1; - - do { - buf >>= 32 - 8; - LAST_SKIP_BITS(re, gb, FFMIN(ff_interleaved_golomb_vlc_len[buf], 8)); - - if (ff_interleaved_golomb_vlc_len[buf] != 9){ - ret <<= (ff_interleaved_golomb_vlc_len[buf] - 1) >> 1; - ret |= ff_interleaved_dirac_golomb_vlc_code[buf]; - break; - } - ret = (ret << 4) | ff_interleaved_dirac_golomb_vlc_code[buf]; - UPDATE_CACHE(re, gb); - buf = GET_CACHE(re, gb); - } while (ret<0x8000000U && HAVE_BITS_REMAINING(re, gb)); - - CLOSE_READER(re, gb); - return ret - 1; - } -} - -/** - * read unsigned truncated exp golomb code. - */ -static inline int get_te0_golomb(GetBitContext *gb, int range){ - av_assert2(range >= 1); - - if(range==1) return 0; - else if(range==2) return get_bits1(gb)^1; - else return get_ue_golomb(gb); -} - -/** - * read unsigned truncated exp golomb code. - */ -static inline int get_te_golomb(GetBitContext *gb, int range){ - av_assert2(range >= 1); - - if(range==2) return get_bits1(gb)^1; - else return get_ue_golomb(gb); -} - - -/** - * read signed exp golomb code. - */ -static inline int get_se_golomb(GetBitContext *gb){ - unsigned int buf; - int log; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - if(buf >= (1<<27)){ - buf >>= 32 - 9; - LAST_SKIP_BITS(re, gb, ff_golomb_vlc_len[buf]); - CLOSE_READER(re, gb); - - return ff_se_golomb_vlc_code[buf]; - }else{ - log = av_log2(buf); - LAST_SKIP_BITS(re, gb, 31 - log); - UPDATE_CACHE(re, gb); - buf = GET_CACHE(re, gb); - - buf>>= log; - - LAST_SKIP_BITS(re, gb, 32 - log); - CLOSE_READER(re, gb); - - if(buf&1) buf= -(buf>>1); - else buf= (buf>>1); - - return buf; - } -} - -static inline int svq3_get_se_golomb(GetBitContext *gb){ - unsigned int buf; - int log; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - if(buf&0xAA800000){ - buf >>= 32 - 8; - LAST_SKIP_BITS(re, gb, ff_interleaved_golomb_vlc_len[buf]); - CLOSE_READER(re, gb); - - return ff_interleaved_se_golomb_vlc_code[buf]; - }else{ - LAST_SKIP_BITS(re, gb, 8); - UPDATE_CACHE(re, gb); - buf |= 1 | (GET_CACHE(re, gb) >> 8); - - if((buf & 0xAAAAAAAA) == 0) - return INVALID_VLC; - - for(log=31; (buf & 0x80000000) == 0; log--){ - buf = (buf << 2) - ((buf << log) >> (log - 1)) + (buf >> 30); - } - - LAST_SKIP_BITS(re, gb, 63 - 2*log - 8); - CLOSE_READER(re, gb); - - return (signed) (((((buf << log) >> log) - 1) ^ -(buf & 0x1)) + 1) >> 1; - } -} - -static inline int dirac_get_se_golomb(GetBitContext *gb){ - uint32_t buf; - uint32_t ret; - - ret = svq3_get_ue_golomb(gb); - - if (ret) { - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf = SHOW_SBITS(re, gb, 1); - LAST_SKIP_BITS(re, gb, 1); - ret = (ret ^ buf) - buf; - CLOSE_READER(re, gb); - } - - return ret; -} - -/** - * read unsigned golomb rice code (ffv1). - */ -static inline int get_ur_golomb(GetBitContext *gb, int k, int limit, int esc_len){ - unsigned int buf; - int log; - - OPEN_READER(re, gb); - UPDATE_CACHE(re, gb); - buf=GET_CACHE(re, gb); - - log= av_log2(buf); - - if(log > 31-limit){ - buf >>= log - k; - buf += (30-log)<= 32-MIN_CACHE_BITS+(MIN_CACHE_BITS==32) && 32-log < limit){ - buf >>= log - k; - buf += (30-log)<size_in_bits <= re_index) - return -1; - LAST_SKIP_BITS(re, gb, 1); - UPDATE_CACHE(re, gb); - } - SKIP_BITS(re, gb, 1); - - if(i < limit - 1){ - if(k){ - buf = SHOW_UBITS(re, gb, k); - LAST_SKIP_BITS(re, gb, k); - }else{ - buf=0; - } - - CLOSE_READER(re, gb); - return buf + (i<>1; - else return -(v>>1); - -// return (v>>1) ^ -(v&1); -} - -/** - * read signed golomb rice code (flac). - */ -static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit, int esc_len){ - int v= get_ur_golomb_jpegls(gb, k, limit, esc_len); - return (v>>1) ^ -(v&1); -} - -/** - * read unsigned golomb rice code (shorten). - */ -static inline unsigned int get_ur_golomb_shorten(GetBitContext *gb, int k){ - return get_ur_golomb_jpegls(gb, k, INT_MAX, 0); -} - -/** - * read signed golomb rice code (shorten). - */ -static inline int get_sr_golomb_shorten(GetBitContext* gb, int k) -{ - int uvar = get_ur_golomb_jpegls(gb, k + 1, INT_MAX, 0); - if (uvar & 1) - return ~(uvar >> 1); - else - return uvar >> 1; -} - - - -#ifdef TRACE - -static inline int get_ue(GetBitContext *s, const char *file, const char *func, - int line) -{ - int show= show_bits(s, 24); - int pos= get_bits_count(s); - int i= get_ue_golomb(s); - int len= get_bits_count(s) - pos; - int bits= show>>(24-len); - - print_bin(bits, len); - - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d ue @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); - - return i; -} - -static inline int get_se(GetBitContext *s, const char *file, const char *func, - int line) -{ - int show= show_bits(s, 24); - int pos= get_bits_count(s); - int i= get_se_golomb(s); - int len= get_bits_count(s) - pos; - int bits= show>>(24-len); - - print_bin(bits, len); - - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d se @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); - - return i; -} - -static inline int get_te(GetBitContext *s, int r, char *file, const char *func, int line){ - int show= show_bits(s, 24); - int pos= get_bits_count(s); - int i= get_te0_golomb(s, r); - int len= get_bits_count(s) - pos; - int bits= show>>(24-len); - - print_bin(bits, len); - - av_log(NULL, AV_LOG_DEBUG, "%5d %2d %3d te @%5d in %s %s:%d\n", bits, len, i, pos, file, func, line); - - return i; -} - -#define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__) -#define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__) - -#endif - -/** - * write unsigned exp golomb code. - */ -static inline void set_ue_golomb(PutBitContext *pb, int i){ - int e; - - av_assert2(i>=0); - -#if 0 - if(i=0){ - put_bits(pb, 1, 1); - return; - } -#endif - if(i<256) - put_bits(pb, ff_ue_golomb_len[i], i+1); - else{ - e= av_log2(i+1); - - put_bits(pb, 2*e+1, i+1); - } -} - -/** - * write truncated unsigned exp golomb code. - */ -static inline void set_te_golomb(PutBitContext *pb, int i, int range){ - av_assert2(range >= 1); - av_assert2(i<=range); - - if(range==2) put_bits(pb, 1, i^1); - else set_ue_golomb(pb, i); -} - -/** - * write signed exp golomb code. 16 bits at most. - */ -static inline void set_se_golomb(PutBitContext *pb, int i){ -#if 0 - if(i<=0) i= -2*i; - else i= 2*i-1; -#elif 1 - i= 2*i-1; - if(i<0) i^= -1; //FIXME check if gcc does the right thing -#else - i= 2*i-1; - i^= (i>>31); -#endif - set_ue_golomb(pb, i); -} - -/** - * write unsigned golomb rice code (ffv1). - */ -static inline void set_ur_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){ - int e; - - av_assert2(i>=0); - - e= i>>k; - if(e=0); - - e= (i>>k) + 1; - if(e 31) { - put_bits(pb, 31, 0); - e -= 31; - } - put_bits(pb, e, 1); - if(k) - put_sbits(pb, k, i); - }else{ - while(limit > 31) { - put_bits(pb, 31, 0); - limit -= 31; - } - put_bits(pb, limit , 1); - put_bits(pb, esc_len, i - 1); - } -} - -/** - * write signed golomb rice code (ffv1). - */ -static inline void set_sr_golomb(PutBitContext *pb, int i, int k, int limit, int esc_len){ - int v; - - v = -2*i-1; - v ^= (v>>31); - - set_ur_golomb(pb, v, k, limit, esc_len); -} - -/** - * write signed golomb rice code (flac). - */ -static inline void set_sr_golomb_flac(PutBitContext *pb, int i, int k, int limit, int esc_len){ - int v; - - v = -2*i-1; - v ^= (v>>31); - - set_ur_golomb_jpegls(pb, v, k, limit, esc_len); -} - -#endif /* AVCODEC_GOLOMB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm.h deleted file mode 100644 index 53d65c4dc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * GSM common header - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_GSM_H -#define AVCODEC_GSM_H - -/* bytes per block */ -#define GSM_BLOCK_SIZE 33 -#define GSM_MS_BLOCK_SIZE 65 -#define MSN_MIN_BLOCK_SIZE 41 - -/* samples per block */ -#define GSM_FRAME_SIZE 160 - -enum GSMModes { - GSM_13000 = 0, - MSN_12400, - MSN_11800, - MSN_11200, - MSN_10600, - MSN_10000, - MSN_9400, - MSN_8800, - MSN_8200, - NUM_GSM_MODES -}; - -#endif /* AVCODEC_GSM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm_parser.c deleted file mode 100644 index 9a3b94ef1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsm_parser.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2012 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * GSM audio parser - * - * Splits packets into individual blocks. - */ - -#include "parser.h" -#include "gsm.h" - -typedef struct GSMParseContext { - ParseContext pc; - int block_size; - int duration; - int remaining; -} GSMParseContext; - -static int gsm_parse(AVCodecParserContext *s1, AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - GSMParseContext *s = s1->priv_data; - ParseContext *pc = &s->pc; - int next; - - if (!s->block_size) { - switch (avctx->codec_id) { - case AV_CODEC_ID_GSM: - s->block_size = GSM_BLOCK_SIZE; - s->duration = GSM_FRAME_SIZE; - break; - case AV_CODEC_ID_GSM_MS: - s->block_size = avctx->block_align ? avctx->block_align - : GSM_MS_BLOCK_SIZE; - s->duration = GSM_FRAME_SIZE * 2; - break; - default: - *poutbuf = buf; - *poutbuf_size = buf_size; - av_log(avctx, AV_LOG_ERROR, "Invalid codec_id\n"); - return buf_size; - } - } - - if (!s->remaining) - s->remaining = s->block_size; - if (s->remaining <= buf_size) { - next = s->remaining; - s->remaining = 0; - } else { - next = END_NOT_FOUND; - s->remaining -= buf_size; - } - - if (ff_combine_frame(pc, next, &buf, &buf_size) < 0 || !buf_size) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - - s1->duration = s->duration; - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - -AVCodecParser ff_gsm_parser = { - .codec_ids = { AV_CODEC_ID_GSM, AV_CODEC_ID_GSM_MS }, - .priv_data_size = sizeof(GSMParseContext), - .parser_parse = gsm_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec.c deleted file mode 100644 index 5a9a23a51..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * gsm 06.10 decoder - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * GSM decoder - */ - -#include "libavutil/channel_layout.h" -#include "avcodec.h" -#include "get_bits.h" -#include "internal.h" -#include "msgsmdec.h" - -#include "gsmdec_template.c" - -static av_cold int gsm_init(AVCodecContext *avctx) -{ - avctx->channels = 1; - avctx->channel_layout = AV_CH_LAYOUT_MONO; - if (!avctx->sample_rate) - avctx->sample_rate = 8000; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - - switch (avctx->codec_id) { - case AV_CODEC_ID_GSM: - avctx->frame_size = GSM_FRAME_SIZE; - avctx->block_align = GSM_BLOCK_SIZE; - break; - case AV_CODEC_ID_GSM_MS: - avctx->frame_size = 2 * GSM_FRAME_SIZE; - if (!avctx->block_align) - avctx->block_align = GSM_MS_BLOCK_SIZE; - else - if (avctx->block_align < MSN_MIN_BLOCK_SIZE || - avctx->block_align > GSM_MS_BLOCK_SIZE || - (avctx->block_align - MSN_MIN_BLOCK_SIZE) % 3) { - av_log(avctx, AV_LOG_ERROR, "Invalid block alignment %d\n", - avctx->block_align); - return AVERROR_INVALIDDATA; - } - } - - return 0; -} - -static int gsm_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - int res; - GetBitContext gb; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int16_t *samples; - - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); - return AVERROR_INVALIDDATA; - } - - /* get output buffer */ - frame->nb_samples = avctx->frame_size; - if ((res = ff_get_buffer(avctx, frame, 0)) < 0) - return res; - samples = (int16_t *)frame->data[0]; - - switch (avctx->codec_id) { - case AV_CODEC_ID_GSM: - init_get_bits(&gb, buf, buf_size * 8); - if (get_bits(&gb, 4) != 0xd) - av_log(avctx, AV_LOG_WARNING, "Missing GSM magic!\n"); - res = gsm_decode_block(avctx, samples, &gb, GSM_13000); - if (res < 0) - return res; - break; - case AV_CODEC_ID_GSM_MS: - res = ff_msgsm_decode_block(avctx, samples, buf, - (GSM_MS_BLOCK_SIZE - avctx->block_align) / 3); - if (res < 0) - return res; - default: break; - } - - *got_frame_ptr = 1; - - return avctx->block_align; -} - -static void gsm_flush(AVCodecContext *avctx) -{ - GSMContext *s = avctx->priv_data; - memset(s, 0, sizeof(*s)); -} - -#if CONFIG_GSM_DECODER -AVCodec ff_gsm_decoder = { - .name = "gsm", - .long_name = NULL_IF_CONFIG_SMALL("GSM"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_GSM, - .priv_data_size = sizeof(GSMContext), - .init = gsm_init, - .decode = gsm_decode_frame, - .flush = gsm_flush, - .capabilities = CODEC_CAP_DR1, -}; -#endif -#if CONFIG_GSM_MS_DECODER -AVCodec ff_gsm_ms_decoder = { - .name = "gsm_ms", - .long_name = NULL_IF_CONFIG_SMALL("GSM Microsoft variant"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_GSM_MS, - .priv_data_size = sizeof(GSMContext), - .init = gsm_init, - .decode = gsm_decode_frame, - .flush = gsm_flush, - .capabilities = CODEC_CAP_DR1, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.c deleted file mode 100644 index d90c69b98..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * gsm 06.10 decoder data - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "gsmdec_data.h" - -const uint16_t ff_gsm_long_term_gain_tab[4] = { - 3277, 11469, 21299, 32767 -}; - -const int16_t ff_gsm_dequant_tab[64][8] = { - { -28, -20, -12, -4, 4, 12, 20, 28}, - { -56, -40, -24, -8, 8, 24, 40, 56}, - { -84, -60, -36, -12, 12, 36, 60, 84}, - { -112, -80, -48, -16, 16, 48, 80, 112}, - { -140, -100, -60, -20, 20, 60, 100, 140}, - { -168, -120, -72, -24, 24, 72, 120, 168}, - { -196, -140, -84, -28, 28, 84, 140, 196}, - { -224, -160, -96, -32, 32, 96, 160, 224}, - { -252, -180, -108, -36, 36, 108, 180, 252}, - { -280, -200, -120, -40, 40, 120, 200, 280}, - { -308, -220, -132, -44, 44, 132, 220, 308}, - { -336, -240, -144, -48, 48, 144, 240, 336}, - { -364, -260, -156, -52, 52, 156, 260, 364}, - { -392, -280, -168, -56, 56, 168, 280, 392}, - { -420, -300, -180, -60, 60, 180, 300, 420}, - { -448, -320, -192, -64, 64, 192, 320, 448}, - { -504, -360, -216, -72, 72, 216, 360, 504}, - { -560, -400, -240, -80, 80, 240, 400, 560}, - { -616, -440, -264, -88, 88, 264, 440, 616}, - { -672, -480, -288, -96, 96, 288, 480, 672}, - { -728, -520, -312, -104, 104, 312, 520, 728}, - { -784, -560, -336, -112, 112, 336, 560, 784}, - { -840, -600, -360, -120, 120, 360, 600, 840}, - { -896, -640, -384, -128, 128, 384, 640, 896}, - { -1008, -720, -432, -144, 144, 432, 720, 1008}, - { -1120, -800, -480, -160, 160, 480, 800, 1120}, - { -1232, -880, -528, -176, 176, 528, 880, 1232}, - { -1344, -960, -576, -192, 192, 576, 960, 1344}, - { -1456, -1040, -624, -208, 208, 624, 1040, 1456}, - { -1568, -1120, -672, -224, 224, 672, 1120, 1568}, - { -1680, -1200, -720, -240, 240, 720, 1200, 1680}, - { -1792, -1280, -768, -256, 256, 768, 1280, 1792}, - { -2016, -1440, -864, -288, 288, 864, 1440, 2016}, - { -2240, -1600, -960, -320, 320, 960, 1600, 2240}, - { -2464, -1760, -1056, -352, 352, 1056, 1760, 2464}, - { -2688, -1920, -1152, -384, 384, 1152, 1920, 2688}, - { -2912, -2080, -1248, -416, 416, 1248, 2080, 2912}, - { -3136, -2240, -1344, -448, 448, 1344, 2240, 3136}, - { -3360, -2400, -1440, -480, 480, 1440, 2400, 3360}, - { -3584, -2560, -1536, -512, 512, 1536, 2560, 3584}, - { -4032, -2880, -1728, -576, 576, 1728, 2880, 4032}, - { -4480, -3200, -1920, -640, 640, 1920, 3200, 4480}, - { -4928, -3520, -2112, -704, 704, 2112, 3520, 4928}, - { -5376, -3840, -2304, -768, 768, 2304, 3840, 5376}, - { -5824, -4160, -2496, -832, 832, 2496, 4160, 5824}, - { -6272, -4480, -2688, -896, 896, 2688, 4480, 6272}, - { -6720, -4800, -2880, -960, 960, 2880, 4800, 6720}, - { -7168, -5120, -3072, -1024, 1024, 3072, 5120, 7168}, - { -8063, -5759, -3456, -1152, 1152, 3456, 5760, 8064}, - { -8959, -6399, -3840, -1280, 1280, 3840, 6400, 8960}, - { -9855, -7039, -4224, -1408, 1408, 4224, 7040, 9856}, - {-10751, -7679, -4608, -1536, 1536, 4608, 7680, 10752}, - {-11647, -8319, -4992, -1664, 1664, 4992, 8320, 11648}, - {-12543, -8959, -5376, -1792, 1792, 5376, 8960, 12544}, - {-13439, -9599, -5760, -1920, 1920, 5760, 9600, 13440}, - {-14335, -10239, -6144, -2048, 2048, 6144, 10240, 14336}, - {-16127, -11519, -6912, -2304, 2304, 6912, 11519, 16127}, - {-17919, -12799, -7680, -2560, 2560, 7680, 12799, 17919}, - {-19711, -14079, -8448, -2816, 2816, 8448, 14079, 19711}, - {-21503, -15359, -9216, -3072, 3072, 9216, 15359, 21503}, - {-23295, -16639, -9984, -3328, 3328, 9984, 16639, 23295}, - {-25087, -17919, -10752, -3584, 3584, 10752, 17919, 25087}, - {-26879, -19199, -11520, -3840, 3840, 11520, 19199, 26879}, - {-28671, -20479, -12288, -4096, 4096, 12288, 20479, 28671} -}; - -static const int apcm_bits[11][13] = { - { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1 }, - { 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1 }, - { 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1 }, - { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - { 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - { 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - { 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - { 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, - { 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 } -}; - -const int* const ff_gsm_apcm_bits[][4] = { - { apcm_bits[10], apcm_bits[10], apcm_bits[10], apcm_bits[10] }, // 13000 - { apcm_bits[10], apcm_bits[10], apcm_bits[10], apcm_bits[ 6] }, // 12400 - { apcm_bits[10], apcm_bits[10], apcm_bits[ 7], apcm_bits[ 5] }, // 11800 - { apcm_bits[10], apcm_bits[ 8], apcm_bits[ 5], apcm_bits[ 5] }, // 11200 - { apcm_bits[ 9], apcm_bits[ 5], apcm_bits[ 5], apcm_bits[ 5] }, // 10600 - { apcm_bits[ 5], apcm_bits[ 5], apcm_bits[ 5], apcm_bits[ 1] }, // 10000 - { apcm_bits[ 5], apcm_bits[ 5], apcm_bits[ 2], apcm_bits[ 0] }, // 9400 - { apcm_bits[ 5], apcm_bits[ 3], apcm_bits[ 0], apcm_bits[ 0] }, // 8800 - { apcm_bits[ 4], apcm_bits[ 0], apcm_bits[ 0], apcm_bits[ 0] }, // 8200 -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.h deleted file mode 100644 index b57194b8d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_data.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * gsm 06.10 decoder data - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_GSMDEC_DATA_H -#define AVCODEC_GSMDEC_DATA_H - -#include -#include "avcodec.h" - -typedef struct GSMContext { - // Contains first 120 elements from the previous frame - // (used by long_term_synth according to the "lag"), - // then in the following 160 elements the current - // frame is constructed. - int16_t ref_buf[280]; - int v[9]; - int lar[2][8]; - int lar_idx; - int msr; -} GSMContext; - -extern const uint16_t ff_gsm_long_term_gain_tab[4]; -extern const int16_t ff_gsm_dequant_tab[64][8]; - -extern const int* const ff_gsm_apcm_bits[][4]; - -#endif /* AVCODEC_GSMDEC_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_template.c deleted file mode 100644 index 0c60813a4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/gsmdec_template.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * gsm 06.10 decoder - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * GSM decoder - */ - -#include "get_bits.h" -#include "gsm.h" -#include "gsmdec_data.h" - -static const int requant_tab[4][8] = { - { 0 }, - { 0, 7 }, - { 0, 2, 5, 7 }, - { 0, 1, 2, 3, 4, 5, 6, 7 } -}; - -static void apcm_dequant_add(GetBitContext *gb, int16_t *dst, const int *frame_bits) -{ - int i, val; - int maxidx = get_bits(gb, 6); - const int16_t *tab = ff_gsm_dequant_tab[maxidx]; - for (i = 0; i < 13; i++) { - val = get_bits(gb, frame_bits[i]); - dst[3*i] += tab[requant_tab[frame_bits[i]][val]]; - } -} - -static inline int gsm_mult(int a, int b) -{ - return (a * b + (1 << 14)) >> 15; -} - -static void long_term_synth(int16_t *dst, int lag, int gain_idx) -{ - int i; - const int16_t *src = dst - lag; - uint16_t gain = ff_gsm_long_term_gain_tab[gain_idx]; - for (i = 0; i < 40; i++) - dst[i] = gsm_mult(gain, src[i]); -} - -static inline int decode_log_area(int coded, int factor, int offset) -{ - coded <<= 10; - coded -= offset; - return gsm_mult(coded, factor) << 1; -} - -static av_noinline int get_rrp(int filtered) -{ - int abs = FFABS(filtered); - if (abs < 11059) abs <<= 1; - else if (abs < 20070) abs += 11059; - else abs = (abs >> 2) + 26112; - return filtered < 0 ? -abs : abs; -} - -static int filter_value(int in, int rrp[8], int v[9]) -{ - int i; - for (i = 7; i >= 0; i--) { - in -= gsm_mult(rrp[i], v[i]); - v[i + 1] = v[i] + gsm_mult(rrp[i], in); - } - v[0] = in; - return in; -} - -static void short_term_synth(GSMContext *ctx, int16_t *dst, const int16_t *src) -{ - int i; - int rrp[8]; - int *lar = ctx->lar[ctx->lar_idx]; - int *lar_prev = ctx->lar[ctx->lar_idx ^ 1]; - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar_prev[i] >> 1) + (lar[i] >> 2)); - for (i = 0; i < 13; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 1) + (lar [i] >> 1)); - for (i = 13; i < 27; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp((lar_prev[i] >> 2) + (lar [i] >> 1) + (lar[i] >> 2)); - for (i = 27; i < 40; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - for (i = 0; i < 8; i++) - rrp[i] = get_rrp(lar[i]); - for (i = 40; i < 160; i++) - dst[i] = filter_value(src[i], rrp, ctx->v); - - ctx->lar_idx ^= 1; -} - -static int postprocess(int16_t *data, int msr) -{ - int i; - for (i = 0; i < 160; i++) { - msr = av_clip_int16(data[i] + gsm_mult(msr, 28180)); - data[i] = av_clip_int16(msr << 1) & ~7; - } - return msr; -} - -static int gsm_decode_block(AVCodecContext *avctx, int16_t *samples, - GetBitContext *gb, int mode) -{ - GSMContext *ctx = avctx->priv_data; - int i; - int16_t *ref_dst = ctx->ref_buf + 120; - int *lar = ctx->lar[ctx->lar_idx]; - lar[0] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); - lar[1] = decode_log_area(get_bits(gb, 6), 13107, 1 << 15); - lar[2] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) + 2048*2); - lar[3] = decode_log_area(get_bits(gb, 5), 13107, (1 << 14) - 2560*2); - lar[4] = decode_log_area(get_bits(gb, 4), 19223, (1 << 13) + 94*2); - lar[5] = decode_log_area(get_bits(gb, 4), 17476, (1 << 13) - 1792*2); - lar[6] = decode_log_area(get_bits(gb, 3), 31454, (1 << 12) - 341*2); - lar[7] = decode_log_area(get_bits(gb, 3), 29708, (1 << 12) - 1144*2); - - for (i = 0; i < 4; i++) { - int lag = get_bits(gb, 7); - int gain_idx = get_bits(gb, 2); - int offset = get_bits(gb, 2); - lag = av_clip(lag, 40, 120); - long_term_synth(ref_dst, lag, gain_idx); - apcm_dequant_add(gb, ref_dst + offset, ff_gsm_apcm_bits[mode][i]); - ref_dst += 40; - } - memcpy(ctx->ref_buf, ctx->ref_buf + 160, 120 * sizeof(*ctx->ref_buf)); - short_term_synth(ctx, samples, ctx->ref_buf + 120); - // for optimal speed this could be merged with short_term_synth, - // not done yet because it is a bit ugly - ctx->msr = postprocess(samples, ctx->msr); - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.c deleted file mode 100644 index 5f8ed9193..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "h264chroma.h" - -#define BIT_DEPTH 8 -#include "h264chroma_template.c" -#undef BIT_DEPTH - -#define BIT_DEPTH 16 -#include "h264chroma_template.c" -#undef BIT_DEPTH - -#define SET_CHROMA(depth) \ - c->put_h264_chroma_pixels_tab[0] = put_h264_chroma_mc8_ ## depth ## _c; \ - c->put_h264_chroma_pixels_tab[1] = put_h264_chroma_mc4_ ## depth ## _c; \ - c->put_h264_chroma_pixels_tab[2] = put_h264_chroma_mc2_ ## depth ## _c; \ - c->put_h264_chroma_pixels_tab[3] = put_h264_chroma_mc1_ ## depth ## _c; \ - c->avg_h264_chroma_pixels_tab[0] = avg_h264_chroma_mc8_ ## depth ## _c; \ - c->avg_h264_chroma_pixels_tab[1] = avg_h264_chroma_mc4_ ## depth ## _c; \ - c->avg_h264_chroma_pixels_tab[2] = avg_h264_chroma_mc2_ ## depth ## _c; \ - c->avg_h264_chroma_pixels_tab[3] = avg_h264_chroma_mc1_ ## depth ## _c; \ - -av_cold void ff_h264chroma_init(H264ChromaContext *c, int bit_depth) -{ - if (bit_depth > 8 && bit_depth <= 16) { - SET_CHROMA(16); - } else { - SET_CHROMA(8); - } - - if (ARCH_ARM) - ff_h264chroma_init_arm(c, bit_depth); - if (ARCH_PPC) - ff_h264chroma_init_ppc(c, bit_depth); - if (ARCH_X86) - ff_h264chroma_init_x86(c, bit_depth); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.h deleted file mode 100644 index 45bbc7d35..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_H264CHROMA_H -#define AVCODEC_H264CHROMA_H - -#include - -typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y); - -typedef struct H264ChromaContext { - h264_chroma_mc_func put_h264_chroma_pixels_tab[4]; - h264_chroma_mc_func avg_h264_chroma_pixels_tab[4]; -} H264ChromaContext; - -void ff_h264chroma_init(H264ChromaContext *c, int bit_depth); - -void ff_h264chroma_init_arm(H264ChromaContext *c, int bit_depth); -void ff_h264chroma_init_ppc(H264ChromaContext *c, int bit_depth); -void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth); - -#endif /* AVCODEC_H264CHROMA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma_template.c deleted file mode 100644 index b64172aad..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/h264chroma_template.c +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avassert.h" - -#include "bit_depth_template.c" - -#define H264_CHROMA_MC(OPNAME, OP)\ -static void FUNCC(OPNAME ## h264_chroma_mc1)(uint8_t *_dst/*align 8*/, uint8_t *_src/*align 1*/, int stride, int h, int x, int y){\ - pixel *dst = (pixel*)_dst;\ - pixel *src = (pixel*)_src;\ - const int A=(8-x)*(8-y);\ - const int B=( x)*(8-y);\ - const int C=(8-x)*( y);\ - const int D=( x)*( y);\ - int i;\ - stride >>= sizeof(pixel)-1;\ - \ - av_assert2(x<8 && y<8 && x>=0 && y>=0);\ -\ - if(D){\ - for(i=0; i>= sizeof(pixel)-1;\ - \ - av_assert2(x<8 && y<8 && x>=0 && y>=0);\ -\ - if(D){\ - for(i=0; i>= sizeof(pixel)-1;\ - \ - av_assert2(x<8 && y<8 && x>=0 && y>=0);\ -\ - if(D){\ - for(i=0; i>= sizeof(pixel)-1;\ - \ - av_assert2(x<8 && y<8 && x>=0 && y>=0);\ -\ - if(D){\ - for(i=0; i>6)+1)>>1) -#define op_put(a, b) a = (((b) + 32)>>6) - -H264_CHROMA_MC(put_ , op_put) -H264_CHROMA_MC(avg_ , op_avg) -#undef op_avg -#undef op_put diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpel_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpel_template.c deleted file mode 100644 index 3b4699927..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpel_template.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define DEF_HPEL(OPNAME, OP) \ -static inline void FUNCC(OPNAME ## _pixels2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\ - int i;\ - for(i=0; i - * - * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Half-pel DSP functions. - */ - -#include "config.h" - -#include "libavutil/attributes.h" -#include "libavutil/intreadwrite.h" -#include "hpeldsp.h" - -#define BIT_DEPTH 8 -#include "hpeldsp_template.c" - -av_cold void ff_hpeldsp_init(HpelDSPContext *c, int flags) -{ -#define hpel_funcs(prefix, idx, num) \ - c->prefix ## _pixels_tab idx [0] = prefix ## _pixels ## num ## _8_c; \ - c->prefix ## _pixels_tab idx [1] = prefix ## _pixels ## num ## _x2_8_c; \ - c->prefix ## _pixels_tab idx [2] = prefix ## _pixels ## num ## _y2_8_c; \ - c->prefix ## _pixels_tab idx [3] = prefix ## _pixels ## num ## _xy2_8_c - - hpel_funcs(put, [0], 16); - hpel_funcs(put, [1], 8); - hpel_funcs(put, [2], 4); - hpel_funcs(put, [3], 2); - hpel_funcs(put_no_rnd, [0], 16); - hpel_funcs(put_no_rnd, [1], 8); - hpel_funcs(avg, [0], 16); - hpel_funcs(avg, [1], 8); - hpel_funcs(avg, [2], 4); - hpel_funcs(avg, [3], 2); - hpel_funcs(avg_no_rnd,, 16); - - if (ARCH_AARCH64) - ff_hpeldsp_init_aarch64(c, flags); - if (ARCH_ALPHA) - ff_hpeldsp_init_alpha(c, flags); - if (ARCH_ARM) - ff_hpeldsp_init_arm(c, flags); - if (ARCH_BFIN) - ff_hpeldsp_init_bfin(c, flags); - if (ARCH_PPC) - ff_hpeldsp_init_ppc(c, flags); - if (HAVE_VIS) - ff_hpeldsp_init_vis(c, flags); - if (ARCH_X86) - ff_hpeldsp_init_x86(c, flags); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp.h deleted file mode 100644 index ec9006c31..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Half-pel DSP functions. - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Half-pel DSP functions. - */ - -#ifndef AVCODEC_HPELDSP_H -#define AVCODEC_HPELDSP_H - -#include -#include - -/* add and put pixel (decoding) */ -// blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16 -// h for hpel_pixels_func is limited to {width/2, width} but never larger -// than 16 and never smaller than 4 -typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/, - const uint8_t *pixels /*align 1*/, - ptrdiff_t line_size, int h); - -/** - * Half-pel DSP context. - */ -typedef struct HpelDSPContext { - /** - * Halfpel motion compensation with rounding (a+b+1)>>1. - * this is an array[4][4] of motion compensation functions for 4 - * horizontal blocksizes (8,16) and the 4 halfpel positions
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] - * @param block destination where the result is stored - * @param pixels source - * @param line_size number of bytes in a horizontal line of block - * @param h height - */ - op_pixels_func put_pixels_tab[4][4]; - - /** - * Halfpel motion compensation with rounding (a+b+1)>>1. - * This is an array[4][4] of motion compensation functions for 4 - * horizontal blocksizes (8,16) and the 4 halfpel positions
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] - * @param block destination into which the result is averaged (a+b+1)>>1 - * @param pixels source - * @param line_size number of bytes in a horizontal line of block - * @param h height - */ - op_pixels_func avg_pixels_tab[4][4]; - - /** - * Halfpel motion compensation with no rounding (a+b)>>1. - * this is an array[4][4] of motion compensation functions for 2 - * horizontal blocksizes (8,16) and the 4 halfpel positions
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] - * @param block destination where the result is stored - * @param pixels source - * @param line_size number of bytes in a horizontal line of block - * @param h height - */ - op_pixels_func put_no_rnd_pixels_tab[4][4]; - - /** - * Halfpel motion compensation with no rounding (a+b)>>1. - * this is an array[4] of motion compensation functions for 1 - * horizontal blocksize (16) and the 4 halfpel positions
- * *pixels_tab[0][ xhalfpel + 2*yhalfpel ] - * @param block destination into which the result is averaged (a+b)>>1 - * @param pixels source - * @param line_size number of bytes in a horizontal line of block - * @param h height - */ - op_pixels_func avg_no_rnd_pixels_tab[4]; -} HpelDSPContext; - -void ff_hpeldsp_init(HpelDSPContext *c, int flags); - -void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_bfin(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_vis(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags); - -#endif /* AVCODEC_HPELDSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp_template.c deleted file mode 100644 index 9c9fd2b9e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/hpeldsp_template.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Half-pel DSP functions. - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * gmc & q-pel & 32/64 bit based MC by Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Half-pel DSP functions. - */ - -#include "bit_depth_template.c" - -#include "hpel_template.c" - -#define PIXOP2(OPNAME, OP) \ -static inline void FUNC(OPNAME ## _no_rnd_pixels8_l2)(uint8_t *dst, const uint8_t *src1, const uint8_t *src2, int dst_stride, \ - int src_stride1, int src_stride2, int h){\ - int i;\ - for(i=0; i>= sizeof(pixel)-1;\ - a0= pixels[0];\ - b0= pixels[1] + 2;\ - a0 += b0;\ - b0 += pixels[2];\ -\ - pixels+=line_size;\ - for(i=0; i>2; /* FIXME non put */\ - block[1]= (b1+b0)>>2;\ -\ - pixels+=line_size;\ - block +=line_size;\ -\ - a0= pixels[0];\ - b0= pixels[1] + 2;\ - a0 += b0;\ - b0 += pixels[2];\ -\ - block[0]= (a1+a0)>>2;\ - block[1]= (b1+b0)>>2;\ - pixels+=line_size;\ - block +=line_size;\ - }\ -}\ -\ -static inline void FUNCC(OPNAME ## _pixels4_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\ -{\ - /* FIXME HIGH BIT DEPTH */\ - int i;\ - const uint32_t a= AV_RN32(pixels );\ - const uint32_t b= AV_RN32(pixels+1);\ - uint32_t l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - uint32_t l1,h1;\ -\ - pixels+=line_size;\ - for(i=0; i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - a= AV_RN32(pixels );\ - b= AV_RN32(pixels+1);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - }\ -}\ -\ -static inline void FUNCC(OPNAME ## _pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\ -{\ - /* FIXME HIGH BIT DEPTH */\ - int j;\ - for(j=0; j<2; j++){\ - int i;\ - const uint32_t a= AV_RN32(pixels );\ - const uint32_t b= AV_RN32(pixels+1);\ - uint32_t l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - uint32_t l1,h1;\ -\ - pixels+=line_size;\ - for(i=0; i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - a= AV_RN32(pixels );\ - b= AV_RN32(pixels+1);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x02020202UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - }\ - pixels+=4-line_size*(h+1);\ - block +=4-line_size*h;\ - }\ -}\ -\ -static inline void FUNCC(OPNAME ## _no_rnd_pixels8_xy2)(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h)\ -{\ - /* FIXME HIGH BIT DEPTH */\ - int j;\ - for(j=0; j<2; j++){\ - int i;\ - const uint32_t a= AV_RN32(pixels );\ - const uint32_t b= AV_RN32(pixels+1);\ - uint32_t l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x01010101UL;\ - uint32_t h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - uint32_t l1,h1;\ -\ - pixels+=line_size;\ - for(i=0; i>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - a= AV_RN32(pixels );\ - b= AV_RN32(pixels+1);\ - l0= (a&0x03030303UL)\ - + (b&0x03030303UL)\ - + 0x01010101UL;\ - h0= ((a&0xFCFCFCFCUL)>>2)\ - + ((b&0xFCFCFCFCUL)>>2);\ - OP(*((uint32_t*)block), h0+h1+(((l0+l1)>>2)&0x0F0F0F0FUL));\ - pixels+=line_size;\ - block +=line_size;\ - }\ - pixels+=4-line_size*(h+1);\ - block +=4-line_size*h;\ - }\ -}\ -\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_x2) , FUNCC(OPNAME ## _pixels8_x2) , 8*sizeof(pixel))\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_y2) , FUNCC(OPNAME ## _pixels8_y2) , 8*sizeof(pixel))\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _pixels16_xy2), FUNCC(OPNAME ## _pixels8_xy2), 8*sizeof(pixel))\ -av_unused CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16) , FUNCC(OPNAME ## _pixels8) , 8*sizeof(pixel))\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_x2) , FUNCC(OPNAME ## _no_rnd_pixels8_x2) , 8*sizeof(pixel))\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_y2) , FUNCC(OPNAME ## _no_rnd_pixels8_y2) , 8*sizeof(pixel))\ -CALL_2X_PIXELS(FUNCC(OPNAME ## _no_rnd_pixels16_xy2), FUNCC(OPNAME ## _no_rnd_pixels8_xy2), 8*sizeof(pixel))\ - -#define op_avg(a, b) a = rnd_avg_pixel4(a, b) -#define op_put(a, b) a = b -#if BIT_DEPTH == 8 -#define put_no_rnd_pixels8_8_c put_pixels8_8_c -PIXOP2(avg, op_avg) -PIXOP2(put, op_put) -#endif -#undef op_avg -#undef op_put diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.c deleted file mode 100644 index d586c7737..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.c +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Misc image conversion routines - * Copyright (c) 2001, 2002, 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * misc image conversion routines - */ - -/* TODO: - * - write 'ffimg' program to test all the image related stuff - * - move all api to slice based system - * - integrate deinterlacing, postprocessing and scaling in the conversion process - */ - -#include "avcodec.h" -#include "dsputil.h" -#include "imgconvert.h" -#include "internal.h" -#include "libavutil/avassert.h" -#include "libavutil/colorspace.h" -#include "libavutil/common.h" -#include "libavutil/pixdesc.h" -#include "libavutil/imgutils.h" - -#if HAVE_MMX_EXTERNAL -#include "x86/dsputil_x86.h" -#endif - -#define FF_COLOR_NA -1 -#define FF_COLOR_RGB 0 /**< RGB color space */ -#define FF_COLOR_GRAY 1 /**< gray color space */ -#define FF_COLOR_YUV 2 /**< YUV color space. 16 <= Y <= 235, 16 <= U, V <= 240 */ -#define FF_COLOR_YUV_JPEG 3 /**< YUV color space. 0 <= Y <= 255, 0 <= U, V <= 255 */ - -#if HAVE_MMX_EXTERNAL -#define deinterlace_line_inplace ff_deinterlace_line_inplace_mmx -#define deinterlace_line ff_deinterlace_line_mmx -#else -#define deinterlace_line_inplace deinterlace_line_inplace_c -#define deinterlace_line deinterlace_line_c -#endif - -#define pixdesc_has_alpha(pixdesc) \ - ((pixdesc)->nb_components == 2 || (pixdesc)->nb_components == 4 || (pixdesc)->flags & AV_PIX_FMT_FLAG_PAL) - - -void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - av_assert0(desc); - *h_shift = desc->log2_chroma_w; - *v_shift = desc->log2_chroma_h; -} - -static int get_color_type(const AVPixFmtDescriptor *desc) { - if(desc->nb_components == 1 || desc->nb_components == 2) - return FF_COLOR_GRAY; - - if(desc->name && !strncmp(desc->name, "yuvj", 4)) - return FF_COLOR_YUV_JPEG; - - if(desc->flags & AV_PIX_FMT_FLAG_RGB) - return FF_COLOR_RGB; - - if(desc->nb_components == 0) - return FF_COLOR_NA; - - return FF_COLOR_YUV; -} - -static int get_pix_fmt_depth(int *min, int *max, enum AVPixelFormat pix_fmt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int i; - - if (!desc || !desc->nb_components) { - *min = *max = 0; - return AVERROR(EINVAL); - } - - *min = INT_MAX, *max = -INT_MAX; - for (i = 0; i < desc->nb_components; i++) { - *min = FFMIN(desc->comp[i].depth_minus1+1, *min); - *max = FFMAX(desc->comp[i].depth_minus1+1, *max); - } - return 0; -} - -static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, - enum AVPixelFormat src_pix_fmt, - unsigned *lossp, unsigned consider) -{ - const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); - const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt); - int src_color, dst_color; - int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth; - int ret, loss, i, nb_components; - int score = INT_MAX - 1; - - if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE) - return ~0; - - /* compute loss */ - *lossp = loss = 0; - - if (dst_pix_fmt == src_pix_fmt) - return INT_MAX; - - if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0) - return ret; - if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0) - return ret; - - src_color = get_color_type(src_desc); - dst_color = get_color_type(dst_desc); - nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components); - - for (i = 0; i < nb_components; i++) - if (src_desc->comp[i].depth_minus1 > dst_desc->comp[i].depth_minus1 && (consider & FF_LOSS_DEPTH)) { - loss |= FF_LOSS_DEPTH; - score -= 65536 >> dst_desc->comp[i].depth_minus1; - } - - if (consider & FF_LOSS_RESOLUTION) { - if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) { - loss |= FF_LOSS_RESOLUTION; - score -= 256 << dst_desc->log2_chroma_w; - } - if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) { - loss |= FF_LOSS_RESOLUTION; - score -= 256 << dst_desc->log2_chroma_h; - } - // don't favor 422 over 420 if downsampling is needed, because 420 has much better support on the decoder side - if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 && - dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) { - score += 512; - } - } - - if(consider & FF_LOSS_COLORSPACE) - switch(dst_color) { - case FF_COLOR_RGB: - if (src_color != FF_COLOR_RGB && - src_color != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; - break; - case FF_COLOR_GRAY: - if (src_color != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; - break; - case FF_COLOR_YUV: - if (src_color != FF_COLOR_YUV) - loss |= FF_LOSS_COLORSPACE; - break; - case FF_COLOR_YUV_JPEG: - if (src_color != FF_COLOR_YUV_JPEG && - src_color != FF_COLOR_YUV && - src_color != FF_COLOR_GRAY) - loss |= FF_LOSS_COLORSPACE; - break; - default: - /* fail safe test */ - if (src_color != dst_color) - loss |= FF_LOSS_COLORSPACE; - break; - } - if(loss & FF_LOSS_COLORSPACE) - score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth_minus1, src_desc->comp[0].depth_minus1); - - if (dst_color == FF_COLOR_GRAY && - src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) { - loss |= FF_LOSS_CHROMA; - score -= 2 * 65536; - } - if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) { - loss |= FF_LOSS_ALPHA; - score -= 65536; - } - if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) && - (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) { - loss |= FF_LOSS_COLORQUANT; - score -= 65536; - } - - *lossp = loss; - return score; -} - -int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, - enum AVPixelFormat src_pix_fmt, - int has_alpha) -{ - int loss; - int ret = get_pix_fmt_score(dst_pix_fmt, src_pix_fmt, (unsigned int *)&loss, has_alpha ? ~0 : ~FF_LOSS_ALPHA); - if (ret < 0) - return ret; - return loss; -} - -enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) -{ - enum AVPixelFormat dst_pix_fmt; - int loss1, loss2, loss_mask; - const AVPixFmtDescriptor *desc1 = av_pix_fmt_desc_get(dst_pix_fmt1); - const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2); - int score1, score2; - - loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */ - if(!has_alpha) - loss_mask &= ~FF_LOSS_ALPHA; - - dst_pix_fmt = AV_PIX_FMT_NONE; - score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, (unsigned int *)&loss1, loss_mask); - score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, (unsigned int *)&loss2, loss_mask); - - if (score1 == score2) { - if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) { - dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1; - } else { - dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1; - } - } else { - dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1; - } - - if (loss_ptr) - *loss_ptr = avcodec_get_pix_fmt_loss(dst_pix_fmt, src_pix_fmt, has_alpha); - return dst_pix_fmt; -} - -#if AV_HAVE_INCOMPATIBLE_LIBAV_ABI -enum AVPixelFormat avcodec_find_best_pix_fmt2(const enum AVPixelFormat *pix_fmt_list, - enum AVPixelFormat src_pix_fmt, - int has_alpha, int *loss_ptr){ - return avcodec_find_best_pix_fmt_of_list(pix_fmt_list, src_pix_fmt, has_alpha, loss_ptr); -} -#else -enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, - enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr) -{ - return avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, has_alpha, loss_ptr); -} -#endif - -enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, - enum AVPixelFormat src_pix_fmt, - int has_alpha, int *loss_ptr){ - int i; - - enum AVPixelFormat best = AV_PIX_FMT_NONE; - - for(i=0; pix_fmt_list[i] != AV_PIX_FMT_NONE; i++) - best = avcodec_find_best_pix_fmt_of_2(best, pix_fmt_list[i], src_pix_fmt, has_alpha, loss_ptr); - - return best; -} - -/* 2x2 -> 1x1 */ -void ff_shrink22(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, - int width, int height) -{ - int w; - const uint8_t *s1, *s2; - uint8_t *d; - - for(;height > 0; height--) { - s1 = src; - s2 = s1 + src_wrap; - d = dst; - for(w = width;w >= 4; w-=4) { - d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2; - d[1] = (s1[2] + s1[3] + s2[2] + s2[3] + 2) >> 2; - d[2] = (s1[4] + s1[5] + s2[4] + s2[5] + 2) >> 2; - d[3] = (s1[6] + s1[7] + s2[6] + s2[7] + 2) >> 2; - s1 += 8; - s2 += 8; - d += 4; - } - for(;w > 0; w--) { - d[0] = (s1[0] + s1[1] + s2[0] + s2[1] + 2) >> 2; - s1 += 2; - s2 += 2; - d++; - } - src += 2 * src_wrap; - dst += dst_wrap; - } -} - -/* 4x4 -> 1x1 */ -void ff_shrink44(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, - int width, int height) -{ - int w; - const uint8_t *s1, *s2, *s3, *s4; - uint8_t *d; - - for(;height > 0; height--) { - s1 = src; - s2 = s1 + src_wrap; - s3 = s2 + src_wrap; - s4 = s3 + src_wrap; - d = dst; - for(w = width;w > 0; w--) { - d[0] = (s1[0] + s1[1] + s1[2] + s1[3] + - s2[0] + s2[1] + s2[2] + s2[3] + - s3[0] + s3[1] + s3[2] + s3[3] + - s4[0] + s4[1] + s4[2] + s4[3] + 8) >> 4; - s1 += 4; - s2 += 4; - s3 += 4; - s4 += 4; - d++; - } - src += 4 * src_wrap; - dst += dst_wrap; - } -} - -/* 8x8 -> 1x1 */ -void ff_shrink88(uint8_t *dst, int dst_wrap, - const uint8_t *src, int src_wrap, - int width, int height) -{ - int w, i; - - for(;height > 0; height--) { - for(w = width;w > 0; w--) { - int tmp=0; - for(i=0; i<8; i++){ - tmp += src[0] + src[1] + src[2] + src[3] + src[4] + src[5] + src[6] + src[7]; - src += src_wrap; - } - *(dst++) = (tmp + 32)>>6; - src += 8 - 8*src_wrap; - } - src += 8*src_wrap - 8*width; - dst += dst_wrap - width; - } -} - -/* return true if yuv planar */ -static inline int is_yuv_planar(const AVPixFmtDescriptor *desc) -{ - int i; - int planes[4] = { 0 }; - - if ( desc->flags & AV_PIX_FMT_FLAG_RGB - || !(desc->flags & AV_PIX_FMT_FLAG_PLANAR)) - return 0; - - /* set the used planes */ - for (i = 0; i < desc->nb_components; i++) - planes[desc->comp[i].plane] = 1; - - /* if there is an unused plane, the format is not planar */ - for (i = 0; i < desc->nb_components; i++) - if (!planes[i]) - return 0; - return 1; -} - -int av_picture_crop(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int top_band, int left_band) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int y_shift; - int x_shift; - - if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) - return -1; - - y_shift = desc->log2_chroma_h; - x_shift = desc->log2_chroma_w; - - if (is_yuv_planar(desc)) { - dst->data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; - dst->data[1] = src->data[1] + ((top_band >> y_shift) * src->linesize[1]) + (left_band >> x_shift); - dst->data[2] = src->data[2] + ((top_band >> y_shift) * src->linesize[2]) + (left_band >> x_shift); - } else{ - if(top_band % (1<data[0] = src->data[0] + (top_band * src->linesize[0]) + left_band; - } - - dst->linesize[0] = src->linesize[0]; - dst->linesize[1] = src->linesize[1]; - dst->linesize[2] = src->linesize[2]; - return 0; -} - -int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, - enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, - int *color) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - uint8_t *optr; - int y_shift; - int x_shift; - int yheight; - int i, y; - - if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB || - !is_yuv_planar(desc)) return -1; - - for (i = 0; i < 3; i++) { - x_shift = i ? desc->log2_chroma_w : 0; - y_shift = i ? desc->log2_chroma_h : 0; - - if (padtop || padleft) { - memset(dst->data[i], color[i], - dst->linesize[i] * (padtop >> y_shift) + (padleft >> x_shift)); - } - - if (padleft || padright) { - optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + - (dst->linesize[i] - (padright >> x_shift)); - yheight = (height - 1 - (padtop + padbottom)) >> y_shift; - for (y = 0; y < yheight; y++) { - memset(optr, color[i], (padleft + padright) >> x_shift); - optr += dst->linesize[i]; - } - } - - if (src) { /* first line */ - uint8_t *iptr = src->data[i]; - optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + - (padleft >> x_shift); - memcpy(optr, iptr, (width - padleft - padright) >> x_shift); - iptr += src->linesize[i]; - optr = dst->data[i] + dst->linesize[i] * (padtop >> y_shift) + - (dst->linesize[i] - (padright >> x_shift)); - yheight = (height - 1 - (padtop + padbottom)) >> y_shift; - for (y = 0; y < yheight; y++) { - memset(optr, color[i], (padleft + padright) >> x_shift); - memcpy(optr + ((padleft + padright) >> x_shift), iptr, - (width - padleft - padright) >> x_shift); - iptr += src->linesize[i]; - optr += dst->linesize[i]; - } - } - - if (padbottom || padright) { - optr = dst->data[i] + dst->linesize[i] * - ((height - padbottom) >> y_shift) - (padright >> x_shift); - memset(optr, color[i],dst->linesize[i] * - (padbottom >> y_shift) + (padright >> x_shift)); - } - } - return 0; -} - -#if FF_API_DEINTERLACE - -#if !HAVE_MMX_EXTERNAL -/* filter parameters: [-1 4 2 4 -1] // 8 */ -static void deinterlace_line_c(uint8_t *dst, - const uint8_t *lum_m4, const uint8_t *lum_m3, - const uint8_t *lum_m2, const uint8_t *lum_m1, - const uint8_t *lum, - int size) -{ - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - int sum; - - for(;size > 0;size--) { - sum = -lum_m4[0]; - sum += lum_m3[0] << 2; - sum += lum_m2[0] << 1; - sum += lum_m1[0] << 2; - sum += -lum[0]; - dst[0] = cm[(sum + 4) >> 3]; - lum_m4++; - lum_m3++; - lum_m2++; - lum_m1++; - lum++; - dst++; - } -} - -static void deinterlace_line_inplace_c(uint8_t *lum_m4, uint8_t *lum_m3, - uint8_t *lum_m2, uint8_t *lum_m1, - uint8_t *lum, int size) -{ - const uint8_t *cm = ff_cropTbl + MAX_NEG_CROP; - int sum; - - for(;size > 0;size--) { - sum = -lum_m4[0]; - sum += lum_m3[0] << 2; - sum += lum_m2[0] << 1; - lum_m4[0]=lum_m2[0]; - sum += lum_m1[0] << 2; - sum += -lum[0]; - lum_m2[0] = cm[(sum + 4) >> 3]; - lum_m4++; - lum_m3++; - lum_m2++; - lum_m1++; - lum++; - } -} -#endif /* !HAVE_MMX_EXTERNAL */ - -/* deinterlacing : 2 temporal taps, 3 spatial taps linear filter. The - top field is copied as is, but the bottom field is deinterlaced - against the top field. */ -static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, - const uint8_t *src1, int src_wrap, - int width, int height) -{ - const uint8_t *src_m2, *src_m1, *src_0, *src_p1, *src_p2; - int y; - - src_m2 = src1; - src_m1 = src1; - src_0=&src_m1[src_wrap]; - src_p1=&src_0[src_wrap]; - src_p2=&src_p1[src_wrap]; - for(y=0;y<(height-2);y+=2) { - memcpy(dst,src_m1,width); - dst += dst_wrap; - deinterlace_line(dst,src_m2,src_m1,src_0,src_p1,src_p2,width); - src_m2 = src_0; - src_m1 = src_p1; - src_0 = src_p2; - src_p1 += 2*src_wrap; - src_p2 += 2*src_wrap; - dst += dst_wrap; - } - memcpy(dst,src_m1,width); - dst += dst_wrap; - /* do last line */ - deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width); -} - -static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, - int width, int height) -{ - uint8_t *src_m1, *src_0, *src_p1, *src_p2; - int y; - uint8_t *buf; - buf = av_malloc(width); - - src_m1 = src1; - memcpy(buf,src_m1,width); - src_0=&src_m1[src_wrap]; - src_p1=&src_0[src_wrap]; - src_p2=&src_p1[src_wrap]; - for(y=0;y<(height-2);y+=2) { - deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width); - src_m1 = src_p1; - src_0 = src_p2; - src_p1 += 2*src_wrap; - src_p2 += 2*src_wrap; - } - /* do last line */ - deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); - av_free(buf); -} - -int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height) -{ - int i; - - if (pix_fmt != AV_PIX_FMT_YUV420P && - pix_fmt != AV_PIX_FMT_YUVJ420P && - pix_fmt != AV_PIX_FMT_YUV422P && - pix_fmt != AV_PIX_FMT_YUVJ422P && - pix_fmt != AV_PIX_FMT_YUV444P && - pix_fmt != AV_PIX_FMT_YUV411P && - pix_fmt != AV_PIX_FMT_GRAY8) - return -1; - if ((width & 3) != 0 || (height & 3) != 0) - return -1; - - for(i=0;i<3;i++) { - if (i == 1) { - switch(pix_fmt) { - case AV_PIX_FMT_YUVJ420P: - case AV_PIX_FMT_YUV420P: - width >>= 1; - height >>= 1; - break; - case AV_PIX_FMT_YUV422P: - case AV_PIX_FMT_YUVJ422P: - width >>= 1; - break; - case AV_PIX_FMT_YUV411P: - width >>= 2; - break; - default: - break; - } - if (pix_fmt == AV_PIX_FMT_GRAY8) { - break; - } - } - if (src == dst) { - deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i], - width, height); - } else { - deinterlace_bottom_field(dst->data[i],dst->linesize[i], - src->data[i], src->linesize[i], - width, height); - } - } - emms_c(); - return 0; -} - -#endif /* FF_API_DEINTERLACE */ - -#ifdef TEST - -int main(void){ - int i; - int err=0; - int skip = 0; - - for (i=0; iname) { - skip ++; - continue; - } - if (skip) { - av_log(NULL, AV_LOG_INFO, "%3d unused pixel format values\n", skip); - skip = 0; - } - av_log(NULL, AV_LOG_INFO, "pix fmt %s yuv_plan:%d avg_bpp:%d colortype:%d\n", desc->name, is_yuv_planar(desc), av_get_padded_bits_per_pixel(desc), get_color_type(desc)); - if ((!(desc->flags & AV_PIX_FMT_FLAG_ALPHA)) != (desc->nb_components != 2 && desc->nb_components != 4)) { - av_log(NULL, AV_LOG_ERROR, "Alpha flag mismatch\n"); - err = 1; - } - } - return err; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.h deleted file mode 100644 index df8cee794..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/imgconvert.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_IMGCONVERT_H -#define AVCODEC_IMGCONVERT_H - -#include - -/* 1/2^n downscaling functions */ -void ff_shrink22(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); -void ff_shrink44(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); -void ff_shrink88(uint8_t *dst, int dst_wrap, const uint8_t *src, int src_wrap, int width, int height); - -#endif /* AVCODEC_IMGCONVERT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/internal.h deleted file mode 100644 index 8aa0ac101..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/internal.h +++ /dev/null @@ -1,248 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * common internal api header. - */ - -#ifndef AVCODEC_INTERNAL_H -#define AVCODEC_INTERNAL_H - -#include - -#include "libavutil/buffer.h" -#include "libavutil/channel_layout.h" -#include "libavutil/mathematics.h" -#include "libavutil/pixfmt.h" -#include "avcodec.h" -#include "config.h" - -#define FF_SANE_NB_CHANNELS 63U - -typedef struct FramePool { - /** - * Pools for each data plane. For audio all the planes have the same size, - * so only pools[0] is used. - */ - AVBufferPool *pools[4]; - - /* - * Pool parameters - */ - int format; - int width, height; - int stride_align[AV_NUM_DATA_POINTERS]; - int linesize[4]; - int planes; - int channels; - int samples; -} FramePool; - -typedef struct AVCodecInternal { - /** - * Whether the parent AVCodecContext is a copy of the context which had - * init() called on it. - * This is used by multithreading - shared tables and picture pointers - * should be freed from the original context only. - */ - int is_copy; - - /** - * Whether to allocate progress for frame threading. - * - * The codec must set it to 1 if it uses ff_thread_await/report_progress(), - * then progress will be allocated in ff_thread_get_buffer(). The frames - * then MUST be freed with ff_thread_release_buffer(). - * - * If the codec does not need to call the progress functions (there are no - * dependencies between the frames), it should leave this at 0. Then it can - * decode straight to the user-provided frames (which the user will then - * free with av_frame_unref()), there is no need to call - * ff_thread_release_buffer(). - */ - int allocate_progress; - -#if FF_API_OLD_ENCODE_AUDIO - /** - * Internal sample count used by avcodec_encode_audio() to fabricate pts. - * Can be removed along with avcodec_encode_audio(). - */ - int64_t sample_count; -#endif - - /** - * An audio frame with less than required samples has been submitted and - * padded with silence. Reject all subsequent frames. - */ - int last_audio_frame; - - AVFrame *to_free; - - FramePool *pool; - - void *thread_ctx; - - /** - * Current packet as passed into the decoder, to avoid having to pass the - * packet into every function. - */ - AVPacket *pkt; - - /** - * temporary buffer used for encoders to store their bitstream - */ - uint8_t *byte_buffer; - unsigned int byte_buffer_size; - - void *frame_thread_encoder; - - /** - * Number of audio samples to skip at the start of the next decoded frame - */ - int skip_samples; -} AVCodecInternal; - -struct AVCodecDefault { - const uint8_t *key; - const uint8_t *value; -}; - -/** - * Return the hardware accelerated codec for codec codec_id and - * pixel format pix_fmt. - * - * @param avctx The codec context containing the codec_id and pixel format. - * @return the hardware accelerated codec, or NULL if none was found. - */ -AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx); - -/** - * Return the index into tab at which {a,b} match elements {[0],[1]} of tab. - * If there is no such matching pair then size is returned. - */ -int ff_match_2uint16(const uint16_t (*tab)[2], int size, int a, int b); - -unsigned int avpriv_toupper4(unsigned int x); - -/** - * does needed setup of pkt_pts/pos and such for (re)get_buffer(); - */ -int ff_init_buffer_info(AVCodecContext *s, AVFrame *frame); - - -void avpriv_color_frame(AVFrame *frame, const int color[4]); - -extern volatile int ff_avcodec_locked; -int ff_lock_avcodec(AVCodecContext *log_ctx); -int ff_unlock_avcodec(void); - -int avpriv_lock_avformat(void); -int avpriv_unlock_avformat(void); - -/** - * Maximum size in bytes of extradata. - * This value was chosen such that every bit of the buffer is - * addressable by a 32-bit signed integer as used by get_bits. - */ -#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE) - -/** - * Check AVPacket size and/or allocate data. - * - * Encoders supporting AVCodec.encode2() can use this as a convenience to - * ensure the output packet data is large enough, whether provided by the user - * or allocated in this function. - * - * @param avctx the AVCodecContext of the encoder - * @param avpkt the AVPacket - * If avpkt->data is already set, avpkt->size is checked - * to ensure it is large enough. - * If avpkt->data is NULL, a new buffer is allocated. - * avpkt->size is set to the specified size. - * All other AVPacket fields will be reset with av_init_packet(). - * @param size the minimum required packet size - * @return 0 on success, negative error code on failure - */ -int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size); - -int ff_alloc_packet(AVPacket *avpkt, int size); - -/** - * Rescale from sample rate to AVCodecContext.time_base. - */ -static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx, - int64_t samples) -{ - if(samples == AV_NOPTS_VALUE) - return AV_NOPTS_VALUE; - return av_rescale_q(samples, (AVRational){ 1, avctx->sample_rate }, - avctx->time_base); -} - -/** - * Get a buffer for a frame. This is a wrapper around - * AVCodecContext.get_buffer() and should be used instead calling get_buffer() - * directly. - */ -int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags); - -/** - * Identical in function to av_frame_make_writable(), except it uses - * ff_get_buffer() to allocate the buffer when needed. - */ -int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame); - -int ff_thread_can_start_frame(AVCodecContext *avctx); - -int avpriv_h264_has_num_reorder_frames(AVCodecContext *avctx); - -/** - * Call avcodec_open2 recursively by decrementing counter, unlocking mutex, - * calling the function and then restoring again. Assumes the mutex is - * already locked - */ -int ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); - -/** - * Call avcodec_close recursively, counterpart to avcodec_open2_recursive. - */ -int ff_codec_close_recursive(AVCodecContext *avctx); - -/** - * Finalize buf into extradata and set its size appropriately. - */ -int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf); - -const uint8_t *avpriv_find_start_code(const uint8_t *p, - const uint8_t *end, - uint32_t *state); - -/** - * Check that the provided frame dimensions are valid and set them on the codec - * context. - */ -int ff_set_dimensions(AVCodecContext *s, int width, int height); - -/** - * Add or update AV_FRAME_DATA_MATRIXENCODING side data. - */ -int ff_side_data_update_matrix_encoding(AVFrame *frame, - enum AVMatrixEncoding matrix_encoding); - -#endif /* AVCODEC_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/jrevdct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/jrevdct.c deleted file mode 100644 index 91780b2e4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/jrevdct.c +++ /dev/null @@ -1,1155 +0,0 @@ -/* - * This file is part of the Independent JPEG Group's software. - * - * The authors make NO WARRANTY or representation, either express or implied, - * with respect to this software, its quality, accuracy, merchantability, or - * fitness for a particular purpose. This software is provided "AS IS", and - * you, its user, assume the entire risk as to its quality and accuracy. - * - * This software is copyright (C) 1991, 1992, Thomas G. Lane. - * All Rights Reserved except as specified below. - * - * Permission is hereby granted to use, copy, modify, and distribute this - * software (or portions thereof) for any purpose, without fee, subject to - * these conditions: - * (1) If any part of the source code for this software is distributed, then - * this README file must be included, with this copyright and no-warranty - * notice unaltered; and any additions, deletions, or changes to the original - * files must be clearly indicated in accompanying documentation. - * (2) If only executable code is distributed, then the accompanying - * documentation must state that "this software is based in part on the work - * of the Independent JPEG Group". - * (3) Permission for use of this software is granted only if the user accepts - * full responsibility for any undesirable consequences; the authors accept - * NO LIABILITY for damages of any kind. - * - * These conditions apply to any software derived from or based on the IJG - * code, not just to the unmodified library. If you use our work, you ought - * to acknowledge us. - * - * Permission is NOT granted for the use of any IJG author's name or company - * name in advertising or publicity relating to this software or products - * derived from it. This software may be referred to only as "the Independent - * JPEG Group's software". - * - * We specifically permit and encourage the use of this software as the basis - * of commercial products, provided that all warranty or liability claims are - * assumed by the product vendor. - * - * This file contains the basic inverse-DCT transformation subroutine. - * - * This implementation is based on an algorithm described in - * C. Loeffler, A. Ligtenberg and G. Moschytz, "Practical Fast 1-D DCT - * Algorithms with 11 Multiplications", Proc. Int'l. Conf. on Acoustics, - * Speech, and Signal Processing 1989 (ICASSP '89), pp. 988-991. - * The primary algorithm described there uses 11 multiplies and 29 adds. - * We use their alternate method with 12 multiplies and 32 adds. - * The advantage of this method is that no data path contains more than one - * multiplication; this allows a very simple and accurate implementation in - * scaled fixed-point arithmetic, with a minimal number of shifts. - * - * I've made lots of modifications to attempt to take advantage of the - * sparse nature of the DCT matrices we're getting. Although the logic - * is cumbersome, it's straightforward and the resulting code is much - * faster. - * - * A better way to do this would be to pass in the DCT block as a sparse - * matrix, perhaps with the difference cases encoded. - */ - -/** - * @file - * Independent JPEG Group's LLM idct. - */ - -#include "libavutil/common.h" -#include "dct.h" - -#define EIGHT_BIT_SAMPLES - -#define DCTSIZE 8 -#define DCTSIZE2 64 - -#define GLOBAL - -#define RIGHT_SHIFT(x, n) ((x) >> (n)) - -typedef int16_t DCTBLOCK[DCTSIZE2]; - -#define CONST_BITS 13 - -/* - * This routine is specialized to the case DCTSIZE = 8. - */ - -#if DCTSIZE != 8 - Sorry, this code only copes with 8x8 DCTs. /* deliberate syntax err */ -#endif - - -/* - * A 2-D IDCT can be done by 1-D IDCT on each row followed by 1-D IDCT - * on each column. Direct algorithms are also available, but they are - * much more complex and seem not to be any faster when reduced to code. - * - * The poop on this scaling stuff is as follows: - * - * Each 1-D IDCT step produces outputs which are a factor of sqrt(N) - * larger than the true IDCT outputs. The final outputs are therefore - * a factor of N larger than desired; since N=8 this can be cured by - * a simple right shift at the end of the algorithm. The advantage of - * this arrangement is that we save two multiplications per 1-D IDCT, - * because the y0 and y4 inputs need not be divided by sqrt(N). - * - * We have to do addition and subtraction of the integer inputs, which - * is no problem, and multiplication by fractional constants, which is - * a problem to do in integer arithmetic. We multiply all the constants - * by CONST_SCALE and convert them to integer constants (thus retaining - * CONST_BITS bits of precision in the constants). After doing a - * multiplication we have to divide the product by CONST_SCALE, with proper - * rounding, to produce the correct output. This division can be done - * cheaply as a right shift of CONST_BITS bits. We postpone shifting - * as long as possible so that partial sums can be added together with - * full fractional precision. - * - * The outputs of the first pass are scaled up by PASS1_BITS bits so that - * they are represented to better-than-integral precision. These outputs - * require BITS_IN_JSAMPLE + PASS1_BITS + 3 bits; this fits in a 16-bit word - * with the recommended scaling. (To scale up 12-bit sample data further, an - * intermediate int32 array would be needed.) - * - * To avoid overflow of the 32-bit intermediate results in pass 2, we must - * have BITS_IN_JSAMPLE + CONST_BITS + PASS1_BITS <= 26. Error analysis - * shows that the values given below are the most effective. - */ - -#ifdef EIGHT_BIT_SAMPLES -#define PASS1_BITS 2 -#else -#define PASS1_BITS 1 /* lose a little precision to avoid overflow */ -#endif - -#define ONE ((int32_t) 1) - -#define CONST_SCALE (ONE << CONST_BITS) - -/* Convert a positive real constant to an integer scaled by CONST_SCALE. - * IMPORTANT: if your compiler doesn't do this arithmetic at compile time, - * you will pay a significant penalty in run time. In that case, figure - * the correct integer constant values and insert them by hand. - */ - -/* Actually FIX is no longer used, we precomputed them all */ -#define FIX(x) ((int32_t) ((x) * CONST_SCALE + 0.5)) - -/* Descale and correctly round an int32_t value that's scaled by N bits. - * We assume RIGHT_SHIFT rounds towards minus infinity, so adding - * the fudge factor is correct for either sign of X. - */ - -#define DESCALE(x,n) RIGHT_SHIFT((x) + (ONE << ((n)-1)), n) - -/* Multiply an int32_t variable by an int32_t constant to yield an int32_t result. - * For 8-bit samples with the recommended scaling, all the variable - * and constant values involved are no more than 16 bits wide, so a - * 16x16->32 bit multiply can be used instead of a full 32x32 multiply; - * this provides a useful speedup on many machines. - * There is no way to specify a 16x16->32 multiply in portable C, but - * some C compilers will do the right thing if you provide the correct - * combination of casts. - * NB: for 12-bit samples, a full 32-bit multiplication will be needed. - */ - -#ifdef EIGHT_BIT_SAMPLES -#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */ -#define MULTIPLY(var,const) (((int16_t) (var)) * ((int16_t) (const))) -#endif -#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */ -#define MULTIPLY(var,const) (((int16_t) (var)) * ((int32_t) (const))) -#endif -#endif - -#ifndef MULTIPLY /* default definition */ -#define MULTIPLY(var,const) ((var) * (const)) -#endif - - -/* - Unlike our decoder where we approximate the FIXes, we need to use exact -ones here or successive P-frames will drift too much with Reference frame coding -*/ -#define FIX_0_211164243 1730 -#define FIX_0_275899380 2260 -#define FIX_0_298631336 2446 -#define FIX_0_390180644 3196 -#define FIX_0_509795579 4176 -#define FIX_0_541196100 4433 -#define FIX_0_601344887 4926 -#define FIX_0_765366865 6270 -#define FIX_0_785694958 6436 -#define FIX_0_899976223 7373 -#define FIX_1_061594337 8697 -#define FIX_1_111140466 9102 -#define FIX_1_175875602 9633 -#define FIX_1_306562965 10703 -#define FIX_1_387039845 11363 -#define FIX_1_451774981 11893 -#define FIX_1_501321110 12299 -#define FIX_1_662939225 13623 -#define FIX_1_847759065 15137 -#define FIX_1_961570560 16069 -#define FIX_2_053119869 16819 -#define FIX_2_172734803 17799 -#define FIX_2_562915447 20995 -#define FIX_3_072711026 25172 - -/* - * Perform the inverse DCT on one block of coefficients. - */ - -void ff_j_rev_dct(DCTBLOCK data) -{ - int32_t tmp0, tmp1, tmp2, tmp3; - int32_t tmp10, tmp11, tmp12, tmp13; - int32_t z1, z2, z3, z4, z5; - int32_t d0, d1, d2, d3, d4, d5, d6, d7; - register int16_t *dataptr; - int rowctr; - - /* Pass 1: process rows. */ - /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - dataptr = data; - - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any row in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * row DCT calculations can be simplified this way. - */ - - register int *idataptr = (int*)dataptr; - - /* WARNING: we do the same permutation as MMX idct to simplify the - video core */ - d0 = dataptr[0]; - d2 = dataptr[1]; - d4 = dataptr[2]; - d6 = dataptr[3]; - d1 = dataptr[4]; - d3 = dataptr[5]; - d5 = dataptr[6]; - d7 = dataptr[7]; - - if ((d1 | d2 | d3 | d4 | d5 | d6 | d7) == 0) { - /* AC terms all zero */ - if (d0) { - /* Compute a 32 bit value to assign. */ - int16_t dcval = (int16_t) (d0 << PASS1_BITS); - register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); - - idataptr[0] = v; - idataptr[1] = v; - idataptr[2] = v; - idataptr[3] = v; - } - - dataptr += DCTSIZE; /* advance pointer to next row */ - continue; - } - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ -{ - if (d6) { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } - } else { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } - } - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - - if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d5, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z4 = d5 + d1; - z5 = MULTIPLY(d7 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z3 = MULTIPLY(-d7, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z5 = MULTIPLY(d5 + d7, FIX_1_175875602); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d1, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - tmp2 = MULTIPLY(d3, FIX_0_509795579); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z5 = MULTIPLY(z3, FIX_1_175875602); - z3 = MULTIPLY(-z3, FIX_0_785694958); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX_1_175875602); - - z1 = MULTIPLY(z1, FIX_0_275899380); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp0 = MULTIPLY(-d7, FIX_1_662939225); - z4 = MULTIPLY(-d1, FIX_0_390180644); - tmp3 = MULTIPLY(d1, FIX_1_111140466); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_1_387039845); - tmp1 = MULTIPLY(d7, FIX_1_175875602); - tmp2 = MULTIPLY(-d7, FIX_0_785694958); - tmp3 = MULTIPLY(d7, FIX_0_275899380); - } - } - } - } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX_1_175875602); - - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-d1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-d3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_1_662939225); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z2 = MULTIPLY(-z2, FIX_1_387039845); - tmp2 = MULTIPLY(d3, FIX_1_111140466); - z3 = MULTIPLY(-d3, FIX_1_961570560); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX_1_175875602); - z1 = MULTIPLY(-d1, FIX_0_899976223); - tmp3 = MULTIPLY(d1, FIX_0_601344887); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(z4, FIX_0_785694958); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_0_275899380); - tmp2 = MULTIPLY(-d5, FIX_1_387039845); - tmp3 = MULTIPLY(d5, FIX_0_785694958); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX_0_211164243); - tmp2 = MULTIPLY(-d3, FIX_1_451774981); - z1 = MULTIPLY(d1, FIX_1_061594337); - z2 = MULTIPLY(-d3, FIX_2_172734803); - z4 = MULTIPLY(z5, FIX_0_785694958); - z5 = MULTIPLY(z5, FIX_1_175875602); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(-d3, FIX_0_785694958); - tmp1 = MULTIPLY(-d3, FIX_1_387039845); - tmp2 = MULTIPLY(-d3, FIX_0_275899380); - tmp3 = MULTIPLY(d3, FIX_1_175875602); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX_0_275899380); - tmp1 = MULTIPLY(d1, FIX_0_785694958); - tmp2 = MULTIPLY(d1, FIX_1_175875602); - tmp3 = MULTIPLY(d1, FIX_1_387039845); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } - } -} - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[0] = (int16_t) DESCALE(tmp10 + tmp3, CONST_BITS-PASS1_BITS); - dataptr[7] = (int16_t) DESCALE(tmp10 - tmp3, CONST_BITS-PASS1_BITS); - dataptr[1] = (int16_t) DESCALE(tmp11 + tmp2, CONST_BITS-PASS1_BITS); - dataptr[6] = (int16_t) DESCALE(tmp11 - tmp2, CONST_BITS-PASS1_BITS); - dataptr[2] = (int16_t) DESCALE(tmp12 + tmp1, CONST_BITS-PASS1_BITS); - dataptr[5] = (int16_t) DESCALE(tmp12 - tmp1, CONST_BITS-PASS1_BITS); - dataptr[3] = (int16_t) DESCALE(tmp13 + tmp0, CONST_BITS-PASS1_BITS); - dataptr[4] = (int16_t) DESCALE(tmp13 - tmp0, CONST_BITS-PASS1_BITS); - - dataptr += DCTSIZE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - dataptr = data; - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Columns of zeroes can be exploited in the same way as we did with rows. - * However, the row calculation has created many nonzero AC terms, so the - * simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - - d0 = dataptr[DCTSIZE*0]; - d1 = dataptr[DCTSIZE*1]; - d2 = dataptr[DCTSIZE*2]; - d3 = dataptr[DCTSIZE*3]; - d4 = dataptr[DCTSIZE*4]; - d5 = dataptr[DCTSIZE*5]; - d6 = dataptr[DCTSIZE*6]; - d7 = dataptr[DCTSIZE*7]; - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - if (d6) { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } - } else { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } - } - - /* Odd part per figure 8; the matrix is unitary and hence its - * transpose is its inverse. i0..i3 are y7,y5,y3,y1 respectively. - */ - if (d7) { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z2 = d5 + d3; - z3 = d7 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 != 0 */ - z2 = d5 + d3; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d5, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d5, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 = z1 + z4; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7; - z4 = d5 + d1; - z5 = MULTIPLY(z3 + z4, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z3 = MULTIPLY(-d7, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 += z2 + z4; - tmp2 = z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z5 = MULTIPLY(d5 + d7, FIX_1_175875602); - - z3 += z5; - z4 += z5; - - tmp0 += z3; - tmp1 += z4; - tmp2 = z2 + z3; - tmp3 = z1 + z4; - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z3 = d7 + d3; - z5 = MULTIPLY(z3 + d1, FIX_1_175875602); - - tmp0 = MULTIPLY(d7, FIX_0_298631336); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-z1, FIX_0_899976223); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z3 = MULTIPLY(-z3, FIX_1_961570560); - z4 = MULTIPLY(-d1, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 += z1 + z3; - tmp1 = z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */ - z3 = d7 + d3; - - tmp0 = MULTIPLY(-d7, FIX_0_601344887); - z1 = MULTIPLY(-d7, FIX_0_899976223); - tmp2 = MULTIPLY(d3, FIX_0_509795579); - z2 = MULTIPLY(-d3, FIX_2_562915447); - z5 = MULTIPLY(z3, FIX_1_175875602); - z3 = MULTIPLY(-z3, FIX_0_785694958); - - tmp0 += z3; - tmp1 = z2 + z5; - tmp2 += z3; - tmp3 = z1 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 != 0 */ - z1 = d7 + d1; - z5 = MULTIPLY(z1, FIX_1_175875602); - - z1 = MULTIPLY(z1, FIX_0_275899380); - z3 = MULTIPLY(-d7, FIX_1_961570560); - tmp0 = MULTIPLY(-d7, FIX_1_662939225); - z4 = MULTIPLY(-d1, FIX_0_390180644); - tmp3 = MULTIPLY(d1, FIX_1_111140466); - - tmp0 += z1; - tmp1 = z4 + z5; - tmp2 = z3 + z5; - tmp3 += z1; - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 != 0 */ - tmp0 = MULTIPLY(-d7, FIX_1_387039845); - tmp1 = MULTIPLY(d7, FIX_1_175875602); - tmp2 = MULTIPLY(-d7, FIX_0_785694958); - tmp3 = MULTIPLY(d7, FIX_0_275899380); - } - } - } - } else { - if (d5) { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - z4 = d5 + d1; - z5 = MULTIPLY(d3 + z4, FIX_1_175875602); - - tmp1 = MULTIPLY(d5, FIX_2_053119869); - tmp2 = MULTIPLY(d3, FIX_3_072711026); - tmp3 = MULTIPLY(d1, FIX_1_501321110); - z1 = MULTIPLY(-d1, FIX_0_899976223); - z2 = MULTIPLY(-z2, FIX_2_562915447); - z3 = MULTIPLY(-d3, FIX_1_961570560); - z4 = MULTIPLY(-z4, FIX_0_390180644); - - z3 += z5; - z4 += z5; - - tmp0 = z1 + z3; - tmp1 += z2 + z4; - tmp2 += z2 + z3; - tmp3 += z1 + z4; - } else { - /* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */ - z2 = d5 + d3; - - z5 = MULTIPLY(z2, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_1_662939225); - z4 = MULTIPLY(-d5, FIX_0_390180644); - z2 = MULTIPLY(-z2, FIX_1_387039845); - tmp2 = MULTIPLY(d3, FIX_1_111140466); - z3 = MULTIPLY(-d3, FIX_1_961570560); - - tmp0 = z3 + z5; - tmp1 += z2; - tmp2 += z2; - tmp3 = z4 + z5; - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */ - z4 = d5 + d1; - - z5 = MULTIPLY(z4, FIX_1_175875602); - z1 = MULTIPLY(-d1, FIX_0_899976223); - tmp3 = MULTIPLY(d1, FIX_0_601344887); - tmp1 = MULTIPLY(-d5, FIX_0_509795579); - z2 = MULTIPLY(-d5, FIX_2_562915447); - z4 = MULTIPLY(z4, FIX_0_785694958); - - tmp0 = z1 + z5; - tmp1 += z4; - tmp2 = z2 + z5; - tmp3 += z4; - } else { - /* d1 == 0, d3 == 0, d5 != 0, d7 == 0 */ - tmp0 = MULTIPLY(d5, FIX_1_175875602); - tmp1 = MULTIPLY(d5, FIX_0_275899380); - tmp2 = MULTIPLY(-d5, FIX_1_387039845); - tmp3 = MULTIPLY(d5, FIX_0_785694958); - } - } - } else { - if (d3) { - if (d1) { - /* d1 != 0, d3 != 0, d5 == 0, d7 == 0 */ - z5 = d1 + d3; - tmp3 = MULTIPLY(d1, FIX_0_211164243); - tmp2 = MULTIPLY(-d3, FIX_1_451774981); - z1 = MULTIPLY(d1, FIX_1_061594337); - z2 = MULTIPLY(-d3, FIX_2_172734803); - z4 = MULTIPLY(z5, FIX_0_785694958); - z5 = MULTIPLY(z5, FIX_1_175875602); - - tmp0 = z1 - z4; - tmp1 = z2 + z4; - tmp2 += z5; - tmp3 += z5; - } else { - /* d1 == 0, d3 != 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(-d3, FIX_0_785694958); - tmp1 = MULTIPLY(-d3, FIX_1_387039845); - tmp2 = MULTIPLY(-d3, FIX_0_275899380); - tmp3 = MULTIPLY(d3, FIX_1_175875602); - } - } else { - if (d1) { - /* d1 != 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = MULTIPLY(d1, FIX_0_275899380); - tmp1 = MULTIPLY(d1, FIX_0_785694958); - tmp2 = MULTIPLY(d1, FIX_1_175875602); - tmp3 = MULTIPLY(d1, FIX_1_387039845); - } else { - /* d1 == 0, d3 == 0, d5 == 0, d7 == 0 */ - tmp0 = tmp1 = tmp2 = tmp3 = 0; - } - } - } - } - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[DCTSIZE*0] = (int16_t) DESCALE(tmp10 + tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*7] = (int16_t) DESCALE(tmp10 - tmp3, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*1] = (int16_t) DESCALE(tmp11 + tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*6] = (int16_t) DESCALE(tmp11 - tmp2, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*2] = (int16_t) DESCALE(tmp12 + tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*5] = (int16_t) DESCALE(tmp12 - tmp1, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*3] = (int16_t) DESCALE(tmp13 + tmp0, - CONST_BITS+PASS1_BITS+3); - dataptr[DCTSIZE*4] = (int16_t) DESCALE(tmp13 - tmp0, - CONST_BITS+PASS1_BITS+3); - - dataptr++; /* advance pointer to next column */ - } -} - -#undef DCTSIZE -#define DCTSIZE 4 -#define DCTSTRIDE 8 - -void ff_j_rev_dct4(DCTBLOCK data) -{ - int32_t tmp0, tmp1, tmp2, tmp3; - int32_t tmp10, tmp11, tmp12, tmp13; - int32_t z1; - int32_t d0, d2, d4, d6; - register int16_t *dataptr; - int rowctr; - - /* Pass 1: process rows. */ - /* Note results are scaled up by sqrt(8) compared to a true IDCT; */ - /* furthermore, we scale the results by 2**PASS1_BITS. */ - - data[0] += 4; - - dataptr = data; - - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Due to quantization, we will usually find that many of the input - * coefficients are zero, especially the AC terms. We can exploit this - * by short-circuiting the IDCT calculation for any row in which all - * the AC terms are zero. In that case each output is equal to the - * DC coefficient (with scale factor as needed). - * With typical images and quantization tables, half or more of the - * row DCT calculations can be simplified this way. - */ - - register int *idataptr = (int*)dataptr; - - d0 = dataptr[0]; - d2 = dataptr[1]; - d4 = dataptr[2]; - d6 = dataptr[3]; - - if ((d2 | d4 | d6) == 0) { - /* AC terms all zero */ - if (d0) { - /* Compute a 32 bit value to assign. */ - int16_t dcval = (int16_t) (d0 << PASS1_BITS); - register int v = (dcval & 0xffff) | ((dcval << 16) & 0xffff0000); - - idataptr[0] = v; - idataptr[1] = v; - } - - dataptr += DCTSTRIDE; /* advance pointer to next row */ - continue; - } - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - if (d6) { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } - } else { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } - } - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[0] = (int16_t) DESCALE(tmp10, CONST_BITS-PASS1_BITS); - dataptr[1] = (int16_t) DESCALE(tmp11, CONST_BITS-PASS1_BITS); - dataptr[2] = (int16_t) DESCALE(tmp12, CONST_BITS-PASS1_BITS); - dataptr[3] = (int16_t) DESCALE(tmp13, CONST_BITS-PASS1_BITS); - - dataptr += DCTSTRIDE; /* advance pointer to next row */ - } - - /* Pass 2: process columns. */ - /* Note that we must descale the results by a factor of 8 == 2**3, */ - /* and also undo the PASS1_BITS scaling. */ - - dataptr = data; - for (rowctr = DCTSIZE-1; rowctr >= 0; rowctr--) { - /* Columns of zeroes can be exploited in the same way as we did with rows. - * However, the row calculation has created many nonzero AC terms, so the - * simplification applies less often (typically 5% to 10% of the time). - * On machines with very fast multiplication, it's possible that the - * test takes more time than it's worth. In that case this section - * may be commented out. - */ - - d0 = dataptr[DCTSTRIDE*0]; - d2 = dataptr[DCTSTRIDE*1]; - d4 = dataptr[DCTSTRIDE*2]; - d6 = dataptr[DCTSTRIDE*3]; - - /* Even part: reverse the even part of the forward DCT. */ - /* The rotator is sqrt(2)*c(-6). */ - if (d6) { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 != 0 */ - z1 = MULTIPLY(d2 + d6, FIX_0_541196100); - tmp2 = z1 + MULTIPLY(-d6, FIX_1_847759065); - tmp3 = z1 + MULTIPLY(d2, FIX_0_765366865); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 != 0 */ - tmp2 = MULTIPLY(-d6, FIX_1_306562965); - tmp3 = MULTIPLY(d6, FIX_0_541196100); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } - } else { - if (d2) { - /* d0 != 0, d2 != 0, d4 != 0, d6 == 0 */ - tmp2 = MULTIPLY(d2, FIX_0_541196100); - tmp3 = MULTIPLY(d2, FIX_1_306562965); - - tmp0 = (d0 + d4) << CONST_BITS; - tmp1 = (d0 - d4) << CONST_BITS; - - tmp10 = tmp0 + tmp3; - tmp13 = tmp0 - tmp3; - tmp11 = tmp1 + tmp2; - tmp12 = tmp1 - tmp2; - } else { - /* d0 != 0, d2 == 0, d4 != 0, d6 == 0 */ - tmp10 = tmp13 = (d0 + d4) << CONST_BITS; - tmp11 = tmp12 = (d0 - d4) << CONST_BITS; - } - } - - /* Final output stage: inputs are tmp10..tmp13, tmp0..tmp3 */ - - dataptr[DCTSTRIDE*0] = tmp10 >> (CONST_BITS+PASS1_BITS+3); - dataptr[DCTSTRIDE*1] = tmp11 >> (CONST_BITS+PASS1_BITS+3); - dataptr[DCTSTRIDE*2] = tmp12 >> (CONST_BITS+PASS1_BITS+3); - dataptr[DCTSTRIDE*3] = tmp13 >> (CONST_BITS+PASS1_BITS+3); - - dataptr++; /* advance pointer to next column */ - } -} - -void ff_j_rev_dct2(DCTBLOCK data){ - int d00, d01, d10, d11; - - data[0] += 4; - d00 = data[0+0*DCTSTRIDE] + data[1+0*DCTSTRIDE]; - d01 = data[0+0*DCTSTRIDE] - data[1+0*DCTSTRIDE]; - d10 = data[0+1*DCTSTRIDE] + data[1+1*DCTSTRIDE]; - d11 = data[0+1*DCTSTRIDE] - data[1+1*DCTSTRIDE]; - - data[0+0*DCTSTRIDE]= (d00 + d10)>>3; - data[1+0*DCTSTRIDE]= (d01 + d11)>>3; - data[0+1*DCTSTRIDE]= (d00 - d10)>>3; - data[1+1*DCTSTRIDE]= (d01 - d11)>>3; -} - -void ff_j_rev_dct1(DCTBLOCK data){ - data[0] = (data[0] + 4)>>3; -} - -#undef FIX -#undef CONST_BITS diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.c deleted file mode 100644 index 5a62e9da2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avassert.h" -#include "libavutil/mathematics.h" -#include "libavutil/attributes.h" -#include "kbdwin.h" - -#define BESSEL_I0_ITER 50 // default: 50 iterations of Bessel I0 approximation - -av_cold void ff_kbd_window_init(float *window, float alpha, int n) -{ - int i, j; - double sum = 0.0, bessel, tmp; - double local_window[FF_KBD_WINDOW_MAX]; - double alpha2 = (alpha * M_PI / n) * (alpha * M_PI / n); - - av_assert0(n <= FF_KBD_WINDOW_MAX); - - for (i = 0; i < n; i++) { - tmp = i * (n - i) * alpha2; - bessel = 1.0; - for (j = BESSEL_I0_ITER; j > 0; j--) - bessel = bessel * tmp / (j * j) + 1; - sum += bessel; - local_window[i] = sum; - } - - sum++; - for (i = 0; i < n; i++) - window[i] = sqrt(local_window[i] / sum); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.h deleted file mode 100644 index 4b939756c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/kbdwin.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_KBDWIN_H -#define AVCODEC_KBDWIN_H - -/** - * Maximum window size for ff_kbd_window_init. - */ -#define FF_KBD_WINDOW_MAX 1024 - -/** - * Generate a Kaiser-Bessel Derived Window. - * @param window pointer to half window - * @param alpha determines window shape - * @param n size of half window, max FF_KBD_WINDOW_MAX - */ -void ff_kbd_window_init(float *window, float alpha, int n); - -#endif /* AVCODEC_KBDWIN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.c deleted file mode 100644 index 83643cc18..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * LPC utility code - * Copyright (c) 2006 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/common.h" -#include "libavutil/lls2.h" -#include "libavutil/internal.h" - -#define LPC_USE_DOUBLE -#include "lpc.h" -#include "libavutil/avassert.h" - - -/** - * Apply Welch window function to audio block - */ -static void lpc_apply_welch_window_c(const int32_t *data, int len, - double *w_data) -{ - int i, n2; - double w; - double c; - - /* The optimization in commit fa4ed8c does not support odd len. - * If someone wants odd len extend that change. */ - av_assert2(!(len & 1)); - - n2 = (len >> 1); - c = 2.0 / (len - 1.0); - - w_data+=n2; - data+=n2; - for(i=0; i qmax) && (sh > 0)) { - sh--; - } - - /* since negative shift values are unsupported in decoder, scale down - coefficients instead */ - if(sh == 0 && cmax > qmax) { - double scale = ((double)qmax) / cmax; - for(i=0; i=min_order-1; i--) { - if(ref[i] > 0.10) { - est = i+1; - break; - } - } - return est; -} - -int ff_lpc_calc_ref_coefs(LPCContext *s, - const int32_t *samples, int order, double *ref) -{ - double autoc[MAX_LPC_ORDER + 1]; - - s->lpc_apply_welch_window(samples, s->blocksize, s->windowed_samples); - s->lpc_compute_autocorr(s->windowed_samples, s->blocksize, order, autoc); - compute_ref_coefs(autoc, order, ref, NULL); - - return order; -} - -/** - * Calculate LPC coefficients for multiple orders - * - * @param lpc_type LPC method for determining coefficients, - * see #FFLPCType for details - */ -int ff_lpc_calc_coefs(LPCContext *s, - const int32_t *samples, int blocksize, int min_order, - int max_order, int precision, - int32_t coefs[][MAX_LPC_ORDER], int *shift, - enum FFLPCType lpc_type, int lpc_passes, - int omethod, int max_shift, int zero_shift) -{ - double autoc[MAX_LPC_ORDER+1]; - double ref[MAX_LPC_ORDER]; - double lpc[MAX_LPC_ORDER][MAX_LPC_ORDER]; - int i, j, pass = 0; - int opt_order; - - av_assert2(max_order >= MIN_LPC_ORDER && max_order <= MAX_LPC_ORDER && - lpc_type > FF_LPC_TYPE_FIXED); - av_assert0(lpc_type == FF_LPC_TYPE_CHOLESKY || lpc_type == FF_LPC_TYPE_LEVINSON); - - /* reinit LPC context if parameters have changed */ - if (blocksize != s->blocksize || max_order != s->max_order || - lpc_type != s->lpc_type) { - ff_lpc_end(s); - ff_lpc_init(s, blocksize, max_order, lpc_type); - } - - if(lpc_passes <= 0) - lpc_passes = 2; - - if (lpc_type == FF_LPC_TYPE_LEVINSON || (lpc_type == FF_LPC_TYPE_CHOLESKY && lpc_passes > 1)) { - s->lpc_apply_welch_window(samples, blocksize, s->windowed_samples); - - s->lpc_compute_autocorr(s->windowed_samples, blocksize, max_order, autoc); - - compute_lpc_coefs(autoc, max_order, &lpc[0][0], MAX_LPC_ORDER, 0, 1); - - for(i=0; i>pass) + fabs(eval - var[0]); - inv = 1/eval; - rinv = sqrt(inv); - for(j=0; j<=max_order; j++) - var[j] *= rinv; - weight += inv; - }else - weight++; - - m[pass&1].update_lls(&m[pass&1], var); - } - avpriv_solve_lls2(&m[pass&1], 0.001, 0); - } - - for(i=0; i0; i--) - ref[i] = ref[i-1] - ref[i]; - } - - opt_order = max_order; - - if(omethod == ORDER_METHOD_EST) { - opt_order = estimate_best_order(ref, min_order, max_order); - i = opt_order-1; - quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); - } else { - for(i=min_order-1; iblocksize = blocksize; - s->max_order = max_order; - s->lpc_type = lpc_type; - - s->windowed_buffer = av_mallocz((blocksize + 2 + FFALIGN(max_order, 4)) * - sizeof(*s->windowed_samples)); - if (!s->windowed_buffer) - return AVERROR(ENOMEM); - s->windowed_samples = s->windowed_buffer + FFALIGN(max_order, 4); - - s->lpc_apply_welch_window = lpc_apply_welch_window_c; - s->lpc_compute_autocorr = lpc_compute_autocorr_c; - - if (ARCH_X86) - ff_lpc_init_x86(s); - - return 0; -} - -av_cold void ff_lpc_end(LPCContext *s) -{ - av_freep(&s->windowed_buffer); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.h deleted file mode 100644 index c323230b1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lpc.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * LPC utility code - * Copyright (c) 2006 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_LPC_H -#define AVCODEC_LPC_H - -#include -#include "libavutil/avassert.h" - -#define ORDER_METHOD_EST 0 -#define ORDER_METHOD_2LEVEL 1 -#define ORDER_METHOD_4LEVEL 2 -#define ORDER_METHOD_8LEVEL 3 -#define ORDER_METHOD_SEARCH 4 -#define ORDER_METHOD_LOG 5 - -#define MIN_LPC_ORDER 1 -#define MAX_LPC_ORDER 32 - -/** - * LPC analysis type - */ -enum FFLPCType { - FF_LPC_TYPE_DEFAULT = -1, ///< use the codec default LPC type - FF_LPC_TYPE_NONE = 0, ///< do not use LPC prediction or use all zero coefficients - FF_LPC_TYPE_FIXED = 1, ///< fixed LPC coefficients - FF_LPC_TYPE_LEVINSON = 2, ///< Levinson-Durbin recursion - FF_LPC_TYPE_CHOLESKY = 3, ///< Cholesky factorization - FF_LPC_TYPE_NB , ///< Not part of ABI -}; - -typedef struct LPCContext { - int blocksize; - int max_order; - enum FFLPCType lpc_type; - double *windowed_buffer; - double *windowed_samples; - - /** - * Apply a Welch window to an array of input samples. - * The output samples have the same scale as the input, but are in double - * sample format. - * @param data input samples - * @param len number of input samples - * @param w_data output samples - */ - void (*lpc_apply_welch_window)(const int32_t *data, int len, - double *w_data); - /** - * Perform autocorrelation on input samples with delay of 0 to lag. - * @param data input samples. - * constraints: no alignment needed, but must have at - * least lag*sizeof(double) valid bytes preceding it, and - * size must be at least (len+1)*sizeof(double) if data is - * 16-byte aligned or (len+2)*sizeof(double) if data is - * unaligned. - * @param len number of input samples to process - * @param lag maximum delay to calculate - * @param autoc output autocorrelation coefficients. - * constraints: array size must be at least lag+1. - */ - void (*lpc_compute_autocorr)(const double *data, int len, int lag, - double *autoc); -} LPCContext; - - -/** - * Calculate LPC coefficients for multiple orders - */ -int ff_lpc_calc_coefs(LPCContext *s, - const int32_t *samples, int blocksize, int min_order, - int max_order, int precision, - int32_t coefs[][MAX_LPC_ORDER], int *shift, - enum FFLPCType lpc_type, int lpc_passes, - int omethod, int max_shift, int zero_shift); - -int ff_lpc_calc_ref_coefs(LPCContext *s, - const int32_t *samples, int order, double *ref); - -/** - * Initialize LPCContext. - */ -int ff_lpc_init(LPCContext *s, int blocksize, int max_order, - enum FFLPCType lpc_type); -void ff_lpc_init_x86(LPCContext *s); - -/** - * Uninitialize LPCContext. - */ -void ff_lpc_end(LPCContext *s); - -#ifdef LPC_USE_DOUBLE -#define LPC_TYPE double -#else -#define LPC_TYPE float -#endif - -/** - * Schur recursion. - * Produces reflection coefficients from autocorrelation data. - */ -static inline void compute_ref_coefs(const LPC_TYPE *autoc, int max_order, - LPC_TYPE *ref, LPC_TYPE *error) -{ - int i, j; - LPC_TYPE err; - LPC_TYPE gen0[MAX_LPC_ORDER], gen1[MAX_LPC_ORDER]; - - for (i = 0; i < max_order; i++) - gen0[i] = gen1[i] = autoc[i + 1]; - - err = autoc[0]; - ref[0] = -gen1[0] / err; - err += gen1[0] * ref[0]; - if (error) - error[0] = err; - for (i = 1; i < max_order; i++) { - for (j = 0; j < max_order - i; j++) { - gen1[j] = gen1[j + 1] + ref[i - 1] * gen0[j]; - gen0[j] = gen1[j + 1] * ref[i - 1] + gen0[j]; - } - ref[i] = -gen1[0] / err; - err += gen1[0] * ref[i]; - if (error) - error[i] = err; - } -} - -/** - * Levinson-Durbin recursion. - * Produce LPC coefficients from autocorrelation data. - */ -static inline int compute_lpc_coefs(const LPC_TYPE *autoc, int max_order, - LPC_TYPE *lpc, int lpc_stride, int fail, - int normalize) -{ - int i, j; - LPC_TYPE err; - LPC_TYPE *lpc_last = lpc; - - av_assert2(normalize || !fail); - - if (normalize) - err = *autoc++; - - if (fail && (autoc[max_order - 1] == 0 || err <= 0)) - return -1; - - for(i=0; i>1; j++) { - LPC_TYPE f = lpc_last[ j]; - LPC_TYPE b = lpc_last[i-1-j]; - lpc[ j] = f + r * b; - lpc[i-1-j] = b + r * f; - } - - if (fail && err < 0) - return -1; - - lpc_last = lpc; - lpc += lpc_stride; - } - - return 0; -} - -#endif /* AVCODEC_LPC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.c deleted file mode 100644 index 17f59ea77..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * LSP routines for ACELP-based codecs - * - * Copyright (c) 2007 Reynaldo H. Verdejo Pinochet (QCELP decoder) - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "avcodec.h" -#define FRAC_BITS 14 -#include "mathops.h" -#include "lsp.h" -#include "libavcodec/mips/lsp_mips.h" -#include "libavutil/avassert.h" - -void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order) -{ - int i, j; - - /* sort lsfq in ascending order. float bubble agorithm, - O(n) if data already sorted, O(n^2) - otherwise */ - for(i=0; i=0 && lsfq[j] > lsfq[j+1]; j--) - FFSWAP(int16_t, lsfq[j], lsfq[j+1]); - - for(i=0; i> 8; - - av_assert2(arg <= 0x3fff); - - return tab_cos[ind] + (offset * (tab_cos[ind+1] - tab_cos[ind]) >> 8); -} - -void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order) -{ - int i; - - /* Convert LSF to LSP, lsp=cos(lsf) */ - for(i=0; i> 15); // divide by PI and (0,13) -> (0,14) -} - -void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order) -{ - int i; - - for(i = 0; i < lp_order; i++) - lsp[i] = cos(2.0 * M_PI * lsf[i]); -} - -/** - * @brief decodes polynomial coefficients from LSP - * @param[out] f decoded polynomial coefficients (-0x20000000 <= (3.22) <= 0x1fffffff) - * @param lsp LSP coefficients (-0x8000 <= (0.15) <= 0x7fff) - */ -static void lsp2poly(int* f, const int16_t* lsp, int lp_half_order) -{ - int i, j; - - f[0] = 0x400000; // 1.0 in (3.22) - f[1] = -lsp[0] << 8; // *2 and (0.15) -> (3.22) - - for(i=2; i<=lp_half_order; i++) - { - f[i] = f[i-2]; - for(j=i; j>1; j--) - f[j] -= MULL(f[j-1], lsp[2*i-2], FRAC_BITS) - f[j-2]; - - f[1] -= lsp[2*i-2] << 8; - } -} - -void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order) -{ - int i; - int f1[MAX_LP_HALF_ORDER+1]; // (3.22) - int f2[MAX_LP_HALF_ORDER+1]; // (3.22) - - lsp2poly(f1, lsp , lp_half_order); - lsp2poly(f2, lsp+1, lp_half_order); - - /* 3.2.6 of G.729, Equations 25 and 26*/ - lp[0] = 4096; - for(i=1; i> 11; // divide by 2 and (3.22) -> (3.12) - lp[(lp_half_order << 1) + 1 - i] = (ff1 - ff2) >> 11; // divide by 2 and (3.22) -> (3.12) - } -} - -void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) -{ - int lp_half_order = lp_order >> 1; - double buf[MAX_LP_HALF_ORDER + 1]; - double pa[MAX_LP_HALF_ORDER + 1]; - double *qa = buf + 1; - int i,j; - - qa[-1] = 0.0; - - ff_lsp2polyf(lsp , pa, lp_half_order ); - ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); - - for (i = 1, j = lp_order - 1; i < lp_half_order; i++, j--) { - double paf = pa[i] * (1 + lsp[lp_order - 1]); - double qaf = (qa[i] - qa[i-2]) * (1 - lsp[lp_order - 1]); - lp[i-1] = (paf + qaf) * 0.5; - lp[j-1] = (paf - qaf) * 0.5; - } - - lp[lp_half_order - 1] = (1.0 + lsp[lp_order - 1]) * - pa[lp_half_order] * 0.5; - - lp[lp_order - 1] = lsp[lp_order - 1]; -} - -void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order) -{ - int16_t lsp_1st[MAX_LP_ORDER]; // (0.15) - int i; - - /* LSP values for first subframe (3.2.5 of G.729, Equation 24)*/ - for(i=0; i> 1) + (lsp_prev[i] >> 1); -#else - lsp_1st[i] = (lsp_2nd[i] + lsp_prev[i]) >> 1; -#endif - - ff_acelp_lsp2lpc(lp_1st, lsp_1st, lp_order >> 1); - - /* LSP values for second subframe (3.2.5 of G.729)*/ - ff_acelp_lsp2lpc(lp_2nd, lsp_2nd, lp_order >> 1); -} - -#ifndef ff_lsp2polyf -void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) -{ - int i, j; - - f[0] = 1.0; - f[1] = -2 * lsp[0]; - lsp -= 2; - for(i=2; i<=lp_half_order; i++) - { - double val = -2 * lsp[2*i]; - f[i] = val * f[i-1] + 2*f[i-2]; - for(j=i-1; j>1; j--) - f[j] += f[j-1] * val + f[j-2]; - f[1] += val; - } -} -#endif /* ff_lsp2polyf */ - -void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order) -{ - double pa[MAX_LP_HALF_ORDER+1], qa[MAX_LP_HALF_ORDER+1]; - float *lpc2 = lpc + (lp_half_order << 1) - 1; - - av_assert2(lp_half_order <= MAX_LP_HALF_ORDER); - - ff_lsp2polyf(lsp, pa, lp_half_order); - ff_lsp2polyf(lsp + 1, qa, lp_half_order); - - while (lp_half_order--) { - double paf = pa[lp_half_order+1] + pa[lp_half_order]; - double qaf = qa[lp_half_order+1] - qa[lp_half_order]; - - lpc [ lp_half_order] = 0.5*(paf+qaf); - lpc2[-lp_half_order] = 0.5*(paf-qaf); - } -} - -void ff_sort_nearly_sorted_floats(float *vals, int len) -{ - int i,j; - - for (i = 0; i < len - 1; i++) - for (j = i; j >= 0 && vals[j] > vals[j+1]; j--) - FFSWAP(float, vals[j], vals[j+1]); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.h deleted file mode 100644 index 46a2d47be..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/lsp.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * LSP computing for ACELP-based codecs - * - * Copyright (c) 2008 Vladimir Voroshilov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_LSP_H -#define AVCODEC_LSP_H - -#include - -/** - (I.F) means fixed-point value with F fractional and I integer bits -*/ - -/** - * @brief ensure a minimum distance between LSFs - * @param[in,out] lsfq LSF to check and adjust - * @param lsfq_min_distance minimum distance between LSFs - * @param lsfq_min minimum allowed LSF value - * @param lsfq_max maximum allowed LSF value - * @param lp_order LP filter order - */ -void ff_acelp_reorder_lsf(int16_t* lsfq, int lsfq_min_distance, int lsfq_min, int lsfq_max, int lp_order); - -/** - * Adjust the quantized LSFs so they are increasing and not too close. - * - * This step is not mentioned in the AMR spec but is in the reference C decoder. - * Omitting this step creates audible distortion on the sinusoidal sweep - * test vectors in 3GPP TS 26.074. - * - * @param[in,out] lsf LSFs in Hertz - * @param min_spacing minimum distance between two consecutive lsf values - * @param size size of the lsf vector - */ -void ff_set_min_dist_lsf(float *lsf, double min_spacing, int size); - -/** - * @brief Convert LSF to LSP - * @param[out] lsp LSP coefficients (-0x8000 <= (0.15) < 0x8000) - * @param lsf normalized LSF coefficients (0 <= (2.13) < 0x2000 * PI) - * @param lp_order LP filter order - * - * @remark It is safe to pass the same array into the lsf and lsp parameters. - */ -void ff_acelp_lsf2lsp(int16_t *lsp, const int16_t *lsf, int lp_order); - -/** - * Floating point version of ff_acelp_lsf2lsp() - */ -void ff_acelp_lsf2lspd(double *lsp, const float *lsf, int lp_order); - -/** - * @brief LSP to LP conversion (3.2.6 of G.729) - * @param[out] lp decoded LP coefficients (-0x8000 <= (3.12) < 0x8000) - * @param lsp LSP coefficients (-0x8000 <= (0.15) < 0x8000) - * @param lp_half_order LP filter order, divided by 2 - */ -void ff_acelp_lsp2lpc(int16_t* lp, const int16_t* lsp, int lp_half_order); - -/** - * LSP to LP conversion (5.2.4 of AMR-WB) - */ -void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order); - -/** - * @brief Interpolate LSP for the first subframe and convert LSP -> LP for both subframes (3.2.5 and 3.2.6 of G.729) - * @param[out] lp_1st decoded LP coefficients for first subframe (-0x8000 <= (3.12) < 0x8000) - * @param[out] lp_2nd decoded LP coefficients for second subframe (-0x8000 <= (3.12) < 0x8000) - * @param lsp_2nd LSP coefficients of the second subframe (-0x8000 <= (0.15) < 0x8000) - * @param lsp_prev LSP coefficients from the second subframe of the previous frame (-0x8000 <= (0.15) < 0x8000) - * @param lp_order LP filter order - */ -void ff_acelp_lp_decode(int16_t* lp_1st, int16_t* lp_2nd, const int16_t* lsp_2nd, const int16_t* lsp_prev, int lp_order); - - -#define MAX_LP_HALF_ORDER 10 -#define MAX_LP_ORDER (2*MAX_LP_HALF_ORDER) - -/** - * Reconstruct LPC coefficients from the line spectral pair frequencies. - * - * @param lsp line spectral pairs in cosine domain - * @param lpc linear predictive coding coefficients - * @param lp_half_order half the number of the amount of LPCs to be - * reconstructed, need to be smaller or equal to MAX_LP_HALF_ORDER - * - * @note buffers should have a minimux size of 2*lp_half_order elements. - * - * TIA/EIA/IS-733 2.4.3.3.5 - */ -void ff_acelp_lspd2lpc(const double *lsp, float *lpc, int lp_half_order); - -/** - * Sort values in ascending order. - * - * @note O(n) if data already sorted, O(n^2) - otherwise - */ -void ff_sort_nearly_sorted_floats(float *vals, int len); - -/** - * Compute the Pa / (1 + z(-1)) or Qa / (1 - z(-1)) coefficients - * needed for LSP to LPC conversion. - * We only need to calculate the 6 first elements of the polynomial. - * - * @param lsp line spectral pairs in cosine domain - * @param[out] f polynomial input/output as a vector - * - * TIA/EIA/IS-733 2.4.3.3.5-1/2 - */ -void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order); - -#endif /* AVCODEC_LSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathops.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathops.h deleted file mode 100644 index bad25afd4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathops.h +++ /dev/null @@ -1,237 +0,0 @@ -/* - * simple math operations - * Copyright (c) 2001, 2002 Fabrice Bellard - * Copyright (c) 2006 Michael Niedermayer et al - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVCODEC_MATHOPS_H -#define AVCODEC_MATHOPS_H - -#include - -#include "libavutil/common.h" -#include "config.h" - -extern const uint32_t ff_inverse[257]; -extern const uint8_t ff_reverse[256]; -extern const uint8_t ff_sqrt_tab[256]; - -#if ARCH_ARM -# include "arm/mathops.h" -#elif ARCH_AVR32 -# include "avr32/mathops.h" -#elif ARCH_BFIN -# include "bfin/mathops.h" -#elif ARCH_MIPS -# include "mips/mathops.h" -#elif ARCH_PPC -# include "ppc/mathops.h" -#elif ARCH_X86 -# include "x86/mathops.h" -#endif - -/* generic implementation */ - -#ifndef MUL64 -# define MUL64(a,b) ((int64_t)(a) * (int64_t)(b)) -#endif - -#ifndef MULL -# define MULL(a,b,s) (MUL64(a, b) >> (s)) -#endif - -#ifndef MULH -static av_always_inline int MULH(int a, int b){ - return MUL64(a, b) >> 32; -} -#endif - -#ifndef UMULH -static av_always_inline unsigned UMULH(unsigned a, unsigned b){ - return ((uint64_t)(a) * (uint64_t)(b))>>32; -} -#endif - -#ifndef MAC64 -# define MAC64(d, a, b) ((d) += MUL64(a, b)) -#endif - -#ifndef MLS64 -# define MLS64(d, a, b) ((d) -= MUL64(a, b)) -#endif - -/* signed 16x16 -> 32 multiply add accumulate */ -#ifndef MAC16 -# define MAC16(rt, ra, rb) rt += (ra) * (rb) -#endif - -/* signed 16x16 -> 32 multiply */ -#ifndef MUL16 -# define MUL16(ra, rb) ((ra) * (rb)) -#endif - -#ifndef MLS16 -# define MLS16(rt, ra, rb) ((rt) -= (ra) * (rb)) -#endif - -/* median of 3 */ -#ifndef mid_pred -#define mid_pred mid_pred -static inline av_const int mid_pred(int a, int b, int c) -{ -#if 0 - int t= (a-b)&((a-b)>>31); - a-=t; - b+=t; - b-= (b-c)&((b-c)>>31); - b+= (a-b)&((a-b)>>31); - - return b; -#else - if(a>b){ - if(c>b){ - if(c>a) b=a; - else b=c; - } - }else{ - if(b>c){ - if(c>a) b=c; - else b=a; - } - } - return b; -#endif -} -#endif - -#ifndef sign_extend -static inline av_const int sign_extend(int val, unsigned bits) -{ - unsigned shift = 8 * sizeof(int) - bits; - union { unsigned u; int s; } v = { (unsigned) val << shift }; - return v.s >> shift; -} -#endif - -#ifndef zero_extend -static inline av_const unsigned zero_extend(unsigned val, unsigned bits) -{ - return (val << ((8 * sizeof(int)) - bits)) >> ((8 * sizeof(int)) - bits); -} -#endif - -#ifndef COPY3_IF_LT -#define COPY3_IF_LT(x, y, a, b, c, d)\ -if ((y) < (x)) {\ - (x) = (y);\ - (a) = (b);\ - (c) = (d);\ -} -#endif - -#ifndef MASK_ABS -#define MASK_ABS(mask, level) do { \ - mask = level >> 31; \ - level = (level ^ mask) - mask; \ - } while (0) -#endif - -#ifndef NEG_SSR32 -# define NEG_SSR32(a,s) ((( int32_t)(a))>>(32-(s))) -#endif - -#ifndef NEG_USR32 -# define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s))) -#endif - -#if HAVE_BIGENDIAN -# ifndef PACK_2U8 -# define PACK_2U8(a,b) (((a) << 8) | (b)) -# endif -# ifndef PACK_4U8 -# define PACK_4U8(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) -# endif -# ifndef PACK_2U16 -# define PACK_2U16(a,b) (((a) << 16) | (b)) -# endif -#else -# ifndef PACK_2U8 -# define PACK_2U8(a,b) (((b) << 8) | (a)) -# endif -# ifndef PACK_4U2 -# define PACK_4U8(a,b,c,d) (((d) << 24) | ((c) << 16) | ((b) << 8) | (a)) -# endif -# ifndef PACK_2U16 -# define PACK_2U16(a,b) (((b) << 16) | (a)) -# endif -#endif - -#ifndef PACK_2S8 -# define PACK_2S8(a,b) PACK_2U8((a)&255, (b)&255) -#endif -#ifndef PACK_4S8 -# define PACK_4S8(a,b,c,d) PACK_4U8((a)&255, (b)&255, (c)&255, (d)&255) -#endif -#ifndef PACK_2S16 -# define PACK_2S16(a,b) PACK_2U16((a)&0xffff, (b)&0xffff) -#endif - -#ifndef FASTDIV -# define FASTDIV(a,b) ((uint32_t)((((uint64_t)a) * ff_inverse[b]) >> 32)) -#endif /* FASTDIV */ - -#ifndef MOD_UNLIKELY -# define MOD_UNLIKELY(modulus, dividend, divisor, prev_dividend) \ - do { \ - if ((prev_dividend) == 0 || (dividend) - (prev_dividend) != (divisor)) \ - (modulus) = (dividend) % (divisor); \ - (prev_dividend) = (dividend); \ - } while (0) -#endif - -static inline av_const unsigned int ff_sqrt(unsigned int a) -{ - unsigned int b; - - if (a < 255) return (ff_sqrt_tab[a + 1] - 1) >> 4; - else if (a < (1 << 12)) b = ff_sqrt_tab[a >> 4] >> 2; -#if !CONFIG_SMALL - else if (a < (1 << 14)) b = ff_sqrt_tab[a >> 6] >> 1; - else if (a < (1 << 16)) b = ff_sqrt_tab[a >> 8] ; -#endif - else { - int s = av_log2_16bit(a >> 16) >> 1; - unsigned int c = a >> (s + 2); - b = ff_sqrt_tab[c >> (s + 8)]; - b = FASTDIV(c,b) + (b << s); - } - - return b - (a < b * b); -} - -static inline int8_t ff_u8_to_s8(uint8_t a) -{ - union { - uint8_t u8; - int8_t s8; - } b; - b.u8 = a; - return b.s8; -} - -#endif /* AVCODEC_MATHOPS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathtables.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathtables.c deleted file mode 100644 index ec5ba7942..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mathtables.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -/* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256 - * for a>16909558, is an overestimate by less than 1 part in 1<<24 */ -const uint32_t ff_inverse[257]={ - 0, 4294967295U,2147483648U,1431655766, 1073741824, 858993460, 715827883, 613566757, - 536870912, 477218589, 429496730, 390451573, 357913942, 330382100, 306783379, 286331154, - 268435456, 252645136, 238609295, 226050911, 214748365, 204522253, 195225787, 186737709, - 178956971, 171798692, 165191050, 159072863, 153391690, 148102321, 143165577, 138547333, - 134217728, 130150525, 126322568, 122713352, 119304648, 116080198, 113025456, 110127367, - 107374183, 104755300, 102261127, 99882961, 97612894, 95443718, 93368855, 91382283, - 89478486, 87652394, 85899346, 84215046, 82595525, 81037119, 79536432, 78090315, - 76695845, 75350304, 74051161, 72796056, 71582789, 70409300, 69273667, 68174085, - 67108864, 66076420, 65075263, 64103990, 63161284, 62245903, 61356676, 60492498, - 59652324, 58835169, 58040099, 57266231, 56512728, 55778797, 55063684, 54366675, - 53687092, 53024288, 52377650, 51746594, 51130564, 50529028, 49941481, 49367441, - 48806447, 48258060, 47721859, 47197443, 46684428, 46182445, 45691142, 45210183, - 44739243, 44278014, 43826197, 43383509, 42949673, 42524429, 42107523, 41698712, - 41297763, 40904451, 40518560, 40139882, 39768216, 39403370, 39045158, 38693400, - 38347923, 38008561, 37675152, 37347542, 37025581, 36709123, 36398028, 36092163, - 35791395, 35495598, 35204650, 34918434, 34636834, 34359739, 34087043, 33818641, - 33554432, 33294321, 33038210, 32786010, 32537632, 32292988, 32051995, 31814573, - 31580642, 31350127, 31122952, 30899046, 30678338, 30460761, 30246249, 30034737, - 29826162, 29620465, 29417585, 29217465, 29020050, 28825284, 28633116, 28443493, - 28256364, 28071682, 27889399, 27709467, 27531842, 27356480, 27183338, 27012373, - 26843546, 26676816, 26512144, 26349493, 26188825, 26030105, 25873297, 25718368, - 25565282, 25414008, 25264514, 25116768, 24970741, 24826401, 24683721, 24542671, - 24403224, 24265352, 24129030, 23994231, 23860930, 23729102, 23598722, 23469767, - 23342214, 23216040, 23091223, 22967740, 22845571, 22724695, 22605092, 22486740, - 22369622, 22253717, 22139007, 22025474, 21913099, 21801865, 21691755, 21582751, - 21474837, 21367997, 21262215, 21157475, 21053762, 20951060, 20849356, 20748635, - 20648882, 20550083, 20452226, 20355296, 20259280, 20164166, 20069941, 19976593, - 19884108, 19792477, 19701685, 19611723, 19522579, 19434242, 19346700, 19259944, - 19173962, 19088744, 19004281, 18920561, 18837576, 18755316, 18673771, 18592933, - 18512791, 18433337, 18354562, 18276457, 18199014, 18122225, 18046082, 17970575, - 17895698, 17821442, 17747799, 17674763, 17602325, 17530479, 17459217, 17388532, - 17318417, 17248865, 17179870, 17111424, 17043522, 16976156, 16909321, 16843010, - 16777216 -}; - -const uint8_t ff_sqrt_tab[256]={ - 0, 16, 23, 28, 32, 36, 40, 43, 46, 48, 51, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 77, 79, 80, 82, 84, 85, 87, 88, 90, - 91, 92, 94, 95, 96, 98, 99,100,102,103,104,105,107,108,109,110,111,112,114,115,116,117,118,119,120,121,122,123,124,125,126,127, -128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,144,145,146,147,148,149,150,151,151,152,153,154,155,156,156, -157,158,159,160,160,161,162,163,164,164,165,166,167,168,168,169,170,171,171,172,173,174,174,175,176,176,177,178,179,179,180,181, -182,182,183,184,184,185,186,186,187,188,188,189,190,190,191,192,192,193,194,194,195,196,196,197,198,198,199,200,200,201,202,202, -203,204,204,205,205,206,207,207,208,208,209,210,210,211,212,212,213,213,214,215,215,216,216,217,218,218,219,219,220,220,221,222, -222,223,223,224,224,225,226,226,227,227,228,228,229,230,230,231,231,232,232,233,233,234,235,235,236,236,237,237,238,238,239,239, -240,240,241,242,242,243,243,244,244,245,245,246,246,247,247,248,248,249,249,250,250,251,251,252,252,253,253,254,254,255,255,255 -}; - -const uint8_t ff_reverse[256] = { -0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, -0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8, -0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4, -0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC, -0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2, -0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA, -0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6, -0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE, -0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1, -0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9, -0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5, -0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD, -0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3, -0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, -0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, -0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, -}; - -#define times4(x) x, x, x, x -#define times256(x) times4(times4(times4(times4(times4(x))))) - -const uint8_t ff_cropTbl[256 + 2 * 1024] = { -times256(0x00), -0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, -0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, -0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, -0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C,0x3D,0x3E,0x3F, -0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C,0x4D,0x4E,0x4F, -0x50,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x5B,0x5C,0x5D,0x5E,0x5F, -0x60,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x6B,0x6C,0x6D,0x6E,0x6F, -0x70,0x71,0x72,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F, -0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x8B,0x8C,0x8D,0x8E,0x8F, -0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D,0x9E,0x9F, -0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7,0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF, -0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9,0xBA,0xBB,0xBC,0xBD,0xBE,0xBF, -0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF, -0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, -0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, -0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, -times256(0xFF) -}; - -const uint8_t ff_zigzag_direct[64] = { - 0, 1, 8, 16, 9, 2, 3, 10, - 17, 24, 32, 25, 18, 11, 4, 5, - 12, 19, 26, 33, 40, 48, 41, 34, - 27, 20, 13, 6, 7, 14, 21, 28, - 35, 42, 49, 56, 57, 50, 43, 36, - 29, 22, 15, 23, 30, 37, 44, 51, - 58, 59, 52, 45, 38, 31, 39, 46, - 53, 60, 61, 54, 47, 55, 62, 63 -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mdct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mdct.c deleted file mode 100644 index 922d577e3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mdct.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * MDCT/IMDCT transforms - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include "libavutil/common.h" -#include "libavutil/mathematics.h" -#include "fft.h" -#include "fft-internal.h" - -/** - * @file - * MDCT/IMDCT transforms. - */ - -#if CONFIG_FFT_FLOAT -# define RSCALE(x) (x) -#else -#if CONFIG_FFT_FIXED_32 -# define RSCALE(x) (((x) + 32) >> 6) -#else /* CONFIG_FFT_FIXED_32 */ -# define RSCALE(x) ((x) >> 1) -#endif /* CONFIG_FFT_FIXED_32 */ -#endif - -/** - * init MDCT or IMDCT computation. - */ -av_cold int ff_mdct_init(FFTContext *s, int nbits, int inverse, double scale) -{ - int n, n4, i; - double alpha, theta; - int tstep; - - memset(s, 0, sizeof(*s)); - n = 1 << nbits; - s->mdct_bits = nbits; - s->mdct_size = n; - n4 = n >> 2; - s->mdct_permutation = FF_MDCT_PERM_NONE; - - if (ff_fft_init(s, s->mdct_bits - 2, inverse) < 0) - goto fail; - - s->tcos = av_malloc(n/2 * sizeof(FFTSample)); - if (!s->tcos) - goto fail; - - switch (s->mdct_permutation) { - case FF_MDCT_PERM_NONE: - s->tsin = s->tcos + n4; - tstep = 1; - break; - case FF_MDCT_PERM_INTERLEAVE: - s->tsin = s->tcos + 1; - tstep = 2; - break; - default: - goto fail; - } - - theta = 1.0 / 8.0 + (scale < 0 ? n4 : 0); - scale = sqrt(fabs(scale)); - for(i=0;itcos[i*tstep] = FIX15(-cos(alpha) * scale); - s->tsin[i*tstep] = FIX15(-sin(alpha) * scale); - } - return 0; - fail: - ff_mdct_end(s); - return -1; -} - -/** - * Compute the middle half of the inverse MDCT of size N = 2^nbits, - * thus excluding the parts that can be derived by symmetry - * @param output N/2 samples - * @param input N/2 samples - */ -void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - int k, n8, n4, n2, n, j; - const uint16_t *revtab = s->revtab; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - const FFTSample *in1, *in2; - FFTComplex *z = (FFTComplex *)output; - - n = 1 << s->mdct_bits; - n2 = n >> 1; - n4 = n >> 2; - n8 = n >> 3; - - /* pre rotation */ - in1 = input; - in2 = input + n2 - 1; - for(k = 0; k < n4; k++) { - j=revtab[k]; - CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]); - in1 += 2; - in2 -= 2; - } - s->fft_calc(s, z); - - /* post rotation + reordering */ - for(k = 0; k < n8; k++) { - FFTSample r0, i0, r1, i1; - CMUL(r0, i1, z[n8-k-1].im, z[n8-k-1].re, tsin[n8-k-1], tcos[n8-k-1]); - CMUL(r1, i0, z[n8+k ].im, z[n8+k ].re, tsin[n8+k ], tcos[n8+k ]); - z[n8-k-1].re = r0; - z[n8-k-1].im = i0; - z[n8+k ].re = r1; - z[n8+k ].im = i1; - } -} - -/** - * Compute inverse MDCT of size N = 2^nbits - * @param output N samples - * @param input N/2 samples - */ -void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input) -{ - int k; - int n = 1 << s->mdct_bits; - int n2 = n >> 1; - int n4 = n >> 2; - - ff_imdct_half_c(s, output+n4, input); - - for(k = 0; k < n4; k++) { - output[k] = -output[n2-k-1]; - output[n-k-1] = output[n2+k]; - } -} - -/** - * Compute MDCT of size N = 2^nbits - * @param input N samples - * @param out N/2 samples - */ -void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) -{ - int i, j, n, n8, n4, n2, n3; - FFTDouble re, im; - const uint16_t *revtab = s->revtab; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - FFTComplex *x = (FFTComplex *)out; - - n = 1 << s->mdct_bits; - n2 = n >> 1; - n4 = n >> 2; - n8 = n >> 3; - n3 = 3 * n4; - - /* pre rotation */ - for(i=0;ifft_calc(s, x); - - /* post rotation */ - for(i=0;itcos); - ff_fft_end(s); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/amrwbdec_mips.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/amrwbdec_mips.h deleted file mode 100644 index a469918d2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/amrwbdec_mips.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2012 - * MIPS Technologies, Inc., California. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Nedeljko Babic (nbabic@mips.com) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Reference: libavcodec/amrwbdec.c - */ -#ifndef AVCODEC_AMRWBDEC_MIPS_H -#define AVCODEC_AMRWBDEC_MIPS_H -#include "config.h" - -#if HAVE_MIPSFPU && HAVE_INLINE_ASM -void hb_fir_filter_mips(float *out, const float fir_coef[], - float mem[], const float *in); -#define hb_fir_filter hb_fir_filter_mips -#endif - -#endif /* AVCODEC_AMRWBDEC_MIPS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/lsp_mips.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/lsp_mips.h deleted file mode 100644 index c55ef03ad..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mips/lsp_mips.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2012 - * MIPS Technologies, Inc., California. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the MIPS Technologies, Inc., nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE MIPS TECHNOLOGIES, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE MIPS TECHNOLOGIES, INC. BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Author: Nedeljko Babic (nbabic@mips.com) - * - * LSP routines for ACELP-based codecs optimized for MIPS - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Reference: libavcodec/lsp.c - */ -#ifndef AVCODEC_LSP_MIPS_H -#define AVCODEC_LSP_MIPS_H - -#if HAVE_MIPSFPU && HAVE_INLINE_ASM -static av_always_inline void ff_lsp2polyf_mips(const double *lsp, double *f, int lp_half_order) -{ - int i, j = 0; - double * p_fi = f; - double * p_f = 0; - - f[0] = 1.0; - f[1] = -2 * lsp[0]; - lsp -= 2; - - for(i=2; i<=lp_half_order; i++) - { - double tmp, f_j_2, f_j_1, f_j; - double val = lsp[2*i]; - - __asm__ volatile( - "move %[p_f], %[p_fi] \n\t" - "add.d %[val], %[val], %[val] \n\t" - "addiu %[p_fi], 8 \n\t" - "ldc1 %[f_j_1], 0(%[p_f]) \n\t" - "ldc1 %[f_j], 8(%[p_f]) \n\t" - "neg.d %[val], %[val] \n\t" - "add.d %[tmp], %[f_j_1], %[f_j_1] \n\t" - "madd.d %[tmp], %[tmp], %[f_j], %[val] \n\t" - "addiu %[j], %[i], -2 \n\t" - "ldc1 %[f_j_2], -8(%[p_f]) \n\t" - "sdc1 %[tmp], 16(%[p_f]) \n\t" - "beqz %[j], ff_lsp2polyf_lp_j_end%= \n\t" - "ff_lsp2polyf_lp_j%=: \n\t" - "add.d %[tmp], %[f_j], %[f_j_2] \n\t" - "madd.d %[tmp], %[tmp], %[f_j_1], %[val] \n\t" - "mov.d %[f_j], %[f_j_1] \n\t" - "addiu %[j], -1 \n\t" - "mov.d %[f_j_1], %[f_j_2] \n\t" - "ldc1 %[f_j_2], -16(%[p_f]) \n\t" - "sdc1 %[tmp], 8(%[p_f]) \n\t" - "addiu %[p_f], -8 \n\t" - "bgtz %[j], ff_lsp2polyf_lp_j%= \n\t" - "ff_lsp2polyf_lp_j_end%=: \n\t" - - : [f_j_2]"=&f"(f_j_2), [f_j_1]"=&f"(f_j_1), [val]"+f"(val), - [tmp]"=&f"(tmp), [f_j]"=&f"(f_j), [p_f]"+r"(p_f), - [j]"+r"(j), [p_fi]"+r"(p_fi) - : [i]"r"(i) - : "memory" - ); - f[1] += val; - } -} -#define ff_lsp2polyf ff_lsp2polyf_mips -#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM */ -#endif /* AVCODEC_LSP_MIPS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mp3_header_decompress_bsf.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mp3_header_decompress_bsf.c deleted file mode 100644 index fa6b08a25..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mp3_header_decompress_bsf.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" -#include "avcodec.h" -#include "mpegaudiodecheader.h" -#include "mpegaudiodata.h" - - -static int mp3_header_decompress(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe){ - uint32_t header; - int sample_rate= avctx->sample_rate; - int sample_rate_index=0; - int lsf, mpeg25, bitrate_index, frame_size; - - header = AV_RB32(buf); - if(ff_mpa_check_header(header) >= 0){ - *poutbuf= (uint8_t *) buf; - *poutbuf_size= buf_size; - - return 0; - } - - if(avctx->extradata_size != 15 || strcmp((const char *) avctx->extradata, "FFCMP3 0.0")){ - av_log(avctx, AV_LOG_ERROR, "Extradata invalid %d\n", avctx->extradata_size); - return -1; - } - - header= AV_RB32(avctx->extradata+11) & MP3_MASK; - - lsf = sample_rate < (24000+32000)/2; - mpeg25 = sample_rate < (12000+16000)/2; - sample_rate_index= (header>>10)&3; - sample_rate= avpriv_mpa_freq_tab[sample_rate_index] >> (lsf + mpeg25); //in case sample rate is a little off - - for(bitrate_index=2; bitrate_index<30; bitrate_index++){ - frame_size = avpriv_mpa_bitrate_tab[lsf][2][bitrate_index>>1]; - frame_size = (frame_size * 144000) / (sample_rate << lsf) + (bitrate_index&1); - if(frame_size == buf_size + 4) - break; - if(frame_size == buf_size + 6) - break; - } - if(bitrate_index == 30){ - av_log(avctx, AV_LOG_ERROR, "Could not find bitrate_index.\n"); - return -1; - } - - header |= (bitrate_index&1)<<9; - header |= (bitrate_index>>1)<<12; - header |= (frame_size == buf_size + 4)<<16; //FIXME actually set a correct crc instead of 0 - - *poutbuf_size= frame_size; - *poutbuf= av_malloc(frame_size + FF_INPUT_BUFFER_PADDING_SIZE); - memcpy(*poutbuf + frame_size - buf_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); - - if(avctx->channels==2){ - uint8_t *p= *poutbuf + frame_size - buf_size; - if(lsf){ - FFSWAP(int, p[1], p[2]); - header |= (p[1] & 0xC0)>>2; - p[1] &= 0x3F; - }else{ - header |= p[1] & 0x30; - p[1] &= 0xCF; - } - } - - AV_WB32(*poutbuf, header); - - return 1; -} - -AVBitStreamFilter ff_mp3_header_decompress_bsf={ - .name = "mp3decomp", - .filter = mp3_header_decompress, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.c deleted file mode 100644 index e8c4a5d3d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * MPEG1/2 tables - * copyright (c) 2000,2001 Fabrice Bellard - * copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MPEG1/2 tables. - */ - -#include "mpeg12data.h" - -const uint16_t ff_mpeg1_default_intra_matrix[256] = { - 8, 16, 19, 22, 26, 27, 29, 34, - 16, 16, 22, 24, 27, 29, 34, 37, - 19, 22, 26, 27, 29, 34, 34, 38, - 22, 22, 26, 27, 29, 34, 37, 40, - 22, 26, 27, 29, 32, 35, 40, 48, - 26, 27, 29, 32, 35, 40, 48, 58, - 26, 27, 29, 34, 38, 46, 56, 69, - 27, 29, 35, 38, 46, 56, 69, 83 -}; - -const uint16_t ff_mpeg1_default_non_intra_matrix[64] = { - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, -}; - -const uint16_t ff_mpeg12_vlc_dc_lum_code[12] = { - 0x4, 0x0, 0x1, 0x5, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x1ff, -}; -const unsigned char ff_mpeg12_vlc_dc_lum_bits[12] = { - 3, 2, 2, 3, 3, 4, 5, 6, 7, 8, 9, 9, -}; - -const uint16_t ff_mpeg12_vlc_dc_chroma_code[12] = { - 0x0, 0x1, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe, 0x3fe, 0x3ff, -}; -const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12] = { - 2, 2, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, -}; - -static const uint16_t mpeg1_vlc[113][2] = { - { 0x3, 2 }, { 0x4, 4 }, { 0x5, 5 }, { 0x6, 7 }, - { 0x26, 8 }, { 0x21, 8 }, { 0xa, 10 }, { 0x1d, 12 }, - { 0x18, 12 }, { 0x13, 12 }, { 0x10, 12 }, { 0x1a, 13 }, - { 0x19, 13 }, { 0x18, 13 }, { 0x17, 13 }, { 0x1f, 14 }, - { 0x1e, 14 }, { 0x1d, 14 }, { 0x1c, 14 }, { 0x1b, 14 }, - { 0x1a, 14 }, { 0x19, 14 }, { 0x18, 14 }, { 0x17, 14 }, - { 0x16, 14 }, { 0x15, 14 }, { 0x14, 14 }, { 0x13, 14 }, - { 0x12, 14 }, { 0x11, 14 }, { 0x10, 14 }, { 0x18, 15 }, - { 0x17, 15 }, { 0x16, 15 }, { 0x15, 15 }, { 0x14, 15 }, - { 0x13, 15 }, { 0x12, 15 }, { 0x11, 15 }, { 0x10, 15 }, - { 0x3, 3 }, { 0x6, 6 }, { 0x25, 8 }, { 0xc, 10 }, - { 0x1b, 12 }, { 0x16, 13 }, { 0x15, 13 }, { 0x1f, 15 }, - { 0x1e, 15 }, { 0x1d, 15 }, { 0x1c, 15 }, { 0x1b, 15 }, - { 0x1a, 15 }, { 0x19, 15 }, { 0x13, 16 }, { 0x12, 16 }, - { 0x11, 16 }, { 0x10, 16 }, { 0x5, 4 }, { 0x4, 7 }, - { 0xb, 10 }, { 0x14, 12 }, { 0x14, 13 }, { 0x7, 5 }, - { 0x24, 8 }, { 0x1c, 12 }, { 0x13, 13 }, { 0x6, 5 }, - { 0xf, 10 }, { 0x12, 12 }, { 0x7, 6 }, { 0x9, 10 }, - { 0x12, 13 }, { 0x5, 6 }, { 0x1e, 12 }, { 0x14, 16 }, - { 0x4, 6 }, { 0x15, 12 }, { 0x7, 7 }, { 0x11, 12 }, - { 0x5, 7 }, { 0x11, 13 }, { 0x27, 8 }, { 0x10, 13 }, - { 0x23, 8 }, { 0x1a, 16 }, { 0x22, 8 }, { 0x19, 16 }, - { 0x20, 8 }, { 0x18, 16 }, { 0xe, 10 }, { 0x17, 16 }, - { 0xd, 10 }, { 0x16, 16 }, { 0x8, 10 }, { 0x15, 16 }, - { 0x1f, 12 }, { 0x1a, 12 }, { 0x19, 12 }, { 0x17, 12 }, - { 0x16, 12 }, { 0x1f, 13 }, { 0x1e, 13 }, { 0x1d, 13 }, - { 0x1c, 13 }, { 0x1b, 13 }, { 0x1f, 16 }, { 0x1e, 16 }, - { 0x1d, 16 }, { 0x1c, 16 }, { 0x1b, 16 }, - { 0x1, 6 }, /* escape */ - { 0x2, 2 }, /* EOB */ -}; - -static const uint16_t mpeg2_vlc[113][2] = { - {0x02, 2}, {0x06, 3}, {0x07, 4}, {0x1c, 5}, - {0x1d, 5}, {0x05, 6}, {0x04, 6}, {0x7b, 7}, - {0x7c, 7}, {0x23, 8}, {0x22, 8}, {0xfa, 8}, - {0xfb, 8}, {0xfe, 8}, {0xff, 8}, {0x1f,14}, - {0x1e,14}, {0x1d,14}, {0x1c,14}, {0x1b,14}, - {0x1a,14}, {0x19,14}, {0x18,14}, {0x17,14}, - {0x16,14}, {0x15,14}, {0x14,14}, {0x13,14}, - {0x12,14}, {0x11,14}, {0x10,14}, {0x18,15}, - {0x17,15}, {0x16,15}, {0x15,15}, {0x14,15}, - {0x13,15}, {0x12,15}, {0x11,15}, {0x10,15}, - {0x02, 3}, {0x06, 5}, {0x79, 7}, {0x27, 8}, - {0x20, 8}, {0x16,13}, {0x15,13}, {0x1f,15}, - {0x1e,15}, {0x1d,15}, {0x1c,15}, {0x1b,15}, - {0x1a,15}, {0x19,15}, {0x13,16}, {0x12,16}, - {0x11,16}, {0x10,16}, {0x05, 5}, {0x07, 7}, - {0xfc, 8}, {0x0c,10}, {0x14,13}, {0x07, 5}, - {0x26, 8}, {0x1c,12}, {0x13,13}, {0x06, 6}, - {0xfd, 8}, {0x12,12}, {0x07, 6}, {0x04, 9}, - {0x12,13}, {0x06, 7}, {0x1e,12}, {0x14,16}, - {0x04, 7}, {0x15,12}, {0x05, 7}, {0x11,12}, - {0x78, 7}, {0x11,13}, {0x7a, 7}, {0x10,13}, - {0x21, 8}, {0x1a,16}, {0x25, 8}, {0x19,16}, - {0x24, 8}, {0x18,16}, {0x05, 9}, {0x17,16}, - {0x07, 9}, {0x16,16}, {0x0d,10}, {0x15,16}, - {0x1f,12}, {0x1a,12}, {0x19,12}, {0x17,12}, - {0x16,12}, {0x1f,13}, {0x1e,13}, {0x1d,13}, - {0x1c,13}, {0x1b,13}, {0x1f,16}, {0x1e,16}, - {0x1d,16}, {0x1c,16}, {0x1b,16}, - {0x01,6}, /* escape */ - {0x06,4}, /* EOB */ -}; - -static const int8_t mpeg1_level[111] = { - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, - 33, 34, 35, 36, 37, 38, 39, 40, - 1, 2, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 1, 2, 3, 4, 5, 1, - 2, 3, 4, 1, 2, 3, 1, 2, - 3, 1, 2, 3, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, - 1, 2, 1, 2, 1, 2, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, -}; - -static const int8_t mpeg1_run[111] = { - 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, - 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 2, 2, 2, 2, 2, 3, - 3, 3, 3, 4, 4, 4, 5, 5, - 5, 6, 6, 6, 7, 7, 8, 8, - 9, 9, 10, 10, 11, 11, 12, 12, - 13, 13, 14, 14, 15, 15, 16, 16, - 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, -}; - -RLTable ff_rl_mpeg1 = { - 111, - 111, - mpeg1_vlc, - mpeg1_run, - mpeg1_level, -}; - -RLTable ff_rl_mpeg2 = { - 111, - 111, - mpeg2_vlc, - mpeg1_run, - mpeg1_level, -}; - -const uint8_t ff_mpeg12_mbAddrIncrTable[36][2] = { - {0x1, 1}, - {0x3, 3}, - {0x2, 3}, - {0x3, 4}, - {0x2, 4}, - {0x3, 5}, - {0x2, 5}, - {0x7, 7}, - {0x6, 7}, - {0xb, 8}, - {0xa, 8}, - {0x9, 8}, - {0x8, 8}, - {0x7, 8}, - {0x6, 8}, - {0x17, 10}, - {0x16, 10}, - {0x15, 10}, - {0x14, 10}, - {0x13, 10}, - {0x12, 10}, - {0x23, 11}, - {0x22, 11}, - {0x21, 11}, - {0x20, 11}, - {0x1f, 11}, - {0x1e, 11}, - {0x1d, 11}, - {0x1c, 11}, - {0x1b, 11}, - {0x1a, 11}, - {0x19, 11}, - {0x18, 11}, - {0x8, 11}, /* escape */ - {0xf, 11}, /* stuffing */ - {0x0, 8}, /* end (and 15 more 0 bits should follow) */ -}; - -const uint8_t ff_mpeg12_mbPatTable[64][2] = { - {0x1, 9}, - {0xb, 5}, - {0x9, 5}, - {0xd, 6}, - {0xd, 4}, - {0x17, 7}, - {0x13, 7}, - {0x1f, 8}, - {0xc, 4}, - {0x16, 7}, - {0x12, 7}, - {0x1e, 8}, - {0x13, 5}, - {0x1b, 8}, - {0x17, 8}, - {0x13, 8}, - {0xb, 4}, - {0x15, 7}, - {0x11, 7}, - {0x1d, 8}, - {0x11, 5}, - {0x19, 8}, - {0x15, 8}, - {0x11, 8}, - {0xf, 6}, - {0xf, 8}, - {0xd, 8}, - {0x3, 9}, - {0xf, 5}, - {0xb, 8}, - {0x7, 8}, - {0x7, 9}, - {0xa, 4}, - {0x14, 7}, - {0x10, 7}, - {0x1c, 8}, - {0xe, 6}, - {0xe, 8}, - {0xc, 8}, - {0x2, 9}, - {0x10, 5}, - {0x18, 8}, - {0x14, 8}, - {0x10, 8}, - {0xe, 5}, - {0xa, 8}, - {0x6, 8}, - {0x6, 9}, - {0x12, 5}, - {0x1a, 8}, - {0x16, 8}, - {0x12, 8}, - {0xd, 5}, - {0x9, 8}, - {0x5, 8}, - {0x5, 9}, - {0xc, 5}, - {0x8, 8}, - {0x4, 8}, - {0x4, 9}, - {0x7, 3}, - {0xa, 5}, - {0x8, 5}, - {0xc, 6} -}; - -const uint8_t ff_mpeg12_mbMotionVectorTable[17][2] = { -{ 0x1, 1 }, -{ 0x1, 2 }, -{ 0x1, 3 }, -{ 0x1, 4 }, -{ 0x3, 6 }, -{ 0x5, 7 }, -{ 0x4, 7 }, -{ 0x3, 7 }, -{ 0xb, 9 }, -{ 0xa, 9 }, -{ 0x9, 9 }, -{ 0x11, 10 }, -{ 0x10, 10 }, -{ 0xf, 10 }, -{ 0xe, 10 }, -{ 0xd, 10 }, -{ 0xc, 10 }, -}; - -const AVRational ff_mpeg12_frame_rate_tab[16] = { - { 0, 0}, - {24000, 1001}, - { 24, 1}, - { 25, 1}, - {30000, 1001}, - { 30, 1}, - { 50, 1}, - {60000, 1001}, - { 60, 1}, - // Xing's 15fps: (9) - { 15, 1}, - // libmpeg3's "Unofficial economy rates": (10-13) - { 5, 1}, - { 10, 1}, - { 12, 1}, - { 15, 1}, - { 0, 0}, -}; - -const AVRational ff_mpeg2_frame_rate_tab[] = { - { 1, 1}, - { 2, 1}, - { 3, 1}, - { 4, 1}, - { 5, 1}, - { 6, 1}, - { 8, 1}, - { 9, 1}, - { 10, 1}, - { 12, 1}, - { 15, 1}, - { 16, 1}, - { 18, 1}, - { 20, 1}, - { 24, 1}, - { 25, 1}, - { 30, 1}, - { 32, 1}, - { 36, 1}, - { 40, 1}, - { 45, 1}, - { 48, 1}, - { 50, 1}, - { 60, 1}, - { 72, 1}, - { 75, 1}, - { 80, 1}, - { 90, 1}, - { 96, 1}, - { 100, 1}, - { 120, 1}, - { 150, 1}, - { 180, 1}, - { 200, 1}, - { 240, 1}, - { 750, 1001}, - { 800, 1001}, - { 960, 1001}, - { 1000, 1001}, - { 1200, 1001}, - { 1250, 1001}, - { 1500, 1001}, - { 1600, 1001}, - { 1875, 1001}, - { 2000, 1001}, - { 2400, 1001}, - { 2500, 1001}, - { 3000, 1001}, - { 3750, 1001}, - { 4000, 1001}, - { 4800, 1001}, - { 5000, 1001}, - { 6000, 1001}, - { 7500, 1001}, - { 8000, 1001}, - { 10000, 1001}, - { 12000, 1001}, - { 15000, 1001}, - { 20000, 1001}, - { 24000, 1001}, - { 30000, 1001}, - { 60000, 1001}, - { 0, 0}, -}; - -const float ff_mpeg1_aspect[16]={ - 0.0000, - 1.0000, - 0.6735, - 0.7031, - - 0.7615, - 0.8055, - 0.8437, - 0.8935, - - 0.9157, - 0.9815, - 1.0255, - 1.0695, - - 1.0950, - 1.1575, - 1.2015, -}; - -const AVRational ff_mpeg2_aspect[16]={ - {0,1}, - {1,1}, - {4,3}, - {16,9}, - {221,100}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, - {0,1}, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.h deleted file mode 100644 index 65b94855a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg12data.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * MPEG1/2 tables - * copyright (c) 2000,2001 Fabrice Bellard - * copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MPEG1/2 tables. - */ - -#ifndef AVCODEC_MPEG12DATA_H -#define AVCODEC_MPEG12DATA_H - -#include -#include "libavutil/rational.h" -#include "rl.h" - -extern const uint16_t ff_mpeg1_default_intra_matrix[]; -extern const uint16_t ff_mpeg1_default_non_intra_matrix[64]; - -extern const uint16_t ff_mpeg12_vlc_dc_lum_code[12]; -extern const unsigned char ff_mpeg12_vlc_dc_lum_bits[12]; -extern const uint16_t ff_mpeg12_vlc_dc_chroma_code[12]; -extern const unsigned char ff_mpeg12_vlc_dc_chroma_bits[12]; - -extern RLTable ff_rl_mpeg1; -extern RLTable ff_rl_mpeg2; - -extern const uint8_t ff_mpeg12_mbAddrIncrTable[36][2]; -extern const uint8_t ff_mpeg12_mbPatTable[64][2]; - -extern const uint8_t ff_mpeg12_mbMotionVectorTable[17][2]; - -extern const AVRational ff_mpeg12_frame_rate_tab[]; -extern const AVRational ff_mpeg2_frame_rate_tab[]; - -extern const float ff_mpeg1_aspect[16]; -extern const AVRational ff_mpeg2_aspect[16]; - -#endif /* AVCODEC_MPEG12DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.c deleted file mode 100644 index 68448e6fa..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * MPEG-4 Audio common code - * Copyright (c) 2008 Baptiste Coudurier - * Copyright (c) 2009 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "get_bits.h" -#include "put_bits.h" -#include "mpeg4audio.h" - -/** - * Parse MPEG-4 audio configuration for ALS object type. - * @param[in] gb bit reader context - * @param[in] c MPEG4AudioConfig structure to fill - * @return on success 0 is returned, otherwise a value < 0 - */ -static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c) -{ - if (get_bits_left(gb) < 112) - return -1; - - if (get_bits_long(gb, 32) != MKBETAG('A','L','S','\0')) - return -1; - - // override AudioSpecificConfig channel configuration and sample rate - // which are buggy in old ALS conformance files - c->sample_rate = get_bits_long(gb, 32); - - // skip number of samples - skip_bits_long(gb, 32); - - // read number of channels - c->chan_config = 0; - c->channels = get_bits(gb, 16) + 1; - - return 0; -} - -/* XXX: make sure to update the copies in the different encoders if you change - * this table */ -const int avpriv_mpeg4audio_sample_rates[16] = { - 96000, 88200, 64000, 48000, 44100, 32000, - 24000, 22050, 16000, 12000, 11025, 8000, 7350 -}; - -const uint8_t ff_mpeg4audio_channels[8] = { - 0, 1, 2, 3, 4, 5, 6, 8 -}; - -static inline int get_object_type(GetBitContext *gb) -{ - int object_type = get_bits(gb, 5); - if (object_type == AOT_ESCAPE) - object_type = 32 + get_bits(gb, 6); - return object_type; -} - -static inline int get_sample_rate(GetBitContext *gb, int *index) -{ - *index = get_bits(gb, 4); - return *index == 0x0f ? get_bits(gb, 24) : - avpriv_mpeg4audio_sample_rates[*index]; -} - -int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, - int bit_size, int sync_extension) -{ - GetBitContext gb; - int specific_config_bitindex; - - if (bit_size <= 0 || init_get_bits(&gb, buf, bit_size) < 0) - return AVERROR_INVALIDDATA; - c->object_type = get_object_type(&gb); - c->sample_rate = get_sample_rate(&gb, &c->sampling_index); - c->chan_config = get_bits(&gb, 4); - if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) - c->channels = ff_mpeg4audio_channels[c->chan_config]; - c->sbr = -1; - c->ps = -1; - if (c->object_type == AOT_SBR || (c->object_type == AOT_PS && - // check for W6132 Annex YYYY draft MP3onMP4 - !(show_bits(&gb, 3) & 0x03 && !(show_bits(&gb, 9) & 0x3F)))) { - if (c->object_type == AOT_PS) - c->ps = 1; - c->ext_object_type = AOT_SBR; - c->sbr = 1; - c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index); - c->object_type = get_object_type(&gb); - if (c->object_type == AOT_ER_BSAC) - c->ext_chan_config = get_bits(&gb, 4); - } else { - c->ext_object_type = AOT_NULL; - c->ext_sample_rate = 0; - } - specific_config_bitindex = get_bits_count(&gb); - - if (c->object_type == AOT_ALS) { - skip_bits(&gb, 5); - if (show_bits_long(&gb, 24) != MKBETAG('\0','A','L','S')) - skip_bits_long(&gb, 24); - - specific_config_bitindex = get_bits_count(&gb); - - if (parse_config_ALS(&gb, c)) - return -1; - } - - if (c->ext_object_type != AOT_SBR && sync_extension) { - while (get_bits_left(&gb) > 15) { - if (show_bits(&gb, 11) == 0x2b7) { // sync extension - get_bits(&gb, 11); - c->ext_object_type = get_object_type(&gb); - if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(&gb)) == 1) { - c->ext_sample_rate = get_sample_rate(&gb, &c->ext_sampling_index); - if (c->ext_sample_rate == c->sample_rate) - c->sbr = -1; - } - if (get_bits_left(&gb) > 11 && get_bits(&gb, 11) == 0x548) - c->ps = get_bits1(&gb); - break; - } else - get_bits1(&gb); // skip 1 bit - } - } - - //PS requires SBR - if (!c->sbr) - c->ps = 0; - //Limit implicit PS to the HE-AACv2 Profile - if ((c->ps == -1 && c->object_type != AOT_AAC_LC) || c->channels & ~0x01) - c->ps = 0; - - return specific_config_bitindex; -} - -static av_always_inline unsigned int copy_bits(PutBitContext *pb, - GetBitContext *gb, - int bits) -{ - unsigned int el = get_bits(gb, bits); - put_bits(pb, bits, el); - return el; -} - -int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb) -{ - int five_bit_ch, four_bit_ch, comment_size, bits; - int offset = put_bits_count(pb); - - copy_bits(pb, gb, 10); //Tag, Object Type, Frequency - five_bit_ch = copy_bits(pb, gb, 4); //Front - five_bit_ch += copy_bits(pb, gb, 4); //Side - five_bit_ch += copy_bits(pb, gb, 4); //Back - four_bit_ch = copy_bits(pb, gb, 2); //LFE - four_bit_ch += copy_bits(pb, gb, 3); //Data - five_bit_ch += copy_bits(pb, gb, 4); //Coupling - if (copy_bits(pb, gb, 1)) //Mono Mixdown - copy_bits(pb, gb, 4); - if (copy_bits(pb, gb, 1)) //Stereo Mixdown - copy_bits(pb, gb, 4); - if (copy_bits(pb, gb, 1)) //Matrix Mixdown - copy_bits(pb, gb, 3); - for (bits = five_bit_ch*5+four_bit_ch*4; bits > 16; bits -= 16) - copy_bits(pb, gb, 16); - if (bits) - copy_bits(pb, gb, bits); - avpriv_align_put_bits(pb); - align_get_bits(gb); - comment_size = copy_bits(pb, gb, 8); - for (; comment_size > 0; comment_size--) - copy_bits(pb, gb, 8); - - return put_bits_count(pb) - offset; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.h deleted file mode 100644 index c38874b7e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpeg4audio.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * MPEG-4 Audio common header - * Copyright (c) 2008 Baptiste Coudurier - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MPEG4AUDIO_H -#define AVCODEC_MPEG4AUDIO_H - -#include "config.h" - -#include -#include "get_bits.h" -#include "put_bits.h" - -typedef struct MPEG4AudioConfig { - int object_type; - int sampling_index; - int sample_rate; - int chan_config; - int sbr; ///< -1 implicit, 1 presence - int ext_object_type; - int ext_sampling_index; - int ext_sample_rate; - int ext_chan_config; - int channels; - int ps; ///< -1 implicit, 1 presence -} MPEG4AudioConfig; - -extern av_export const int avpriv_mpeg4audio_sample_rates[16]; -extern const uint8_t ff_mpeg4audio_channels[8]; - -/** - * Parse MPEG-4 systems extradata to retrieve audio configuration. - * @param[in] c MPEG4AudioConfig structure to fill. - * @param[in] buf Extradata from container. - * @param[in] bit_size Extradata size in bits. - * @param[in] sync_extension look for a sync extension after config if true. - * @return On error -1 is returned, on success AudioSpecificConfig bit index in extradata. - */ -int avpriv_mpeg4audio_get_config(MPEG4AudioConfig *c, const uint8_t *buf, - int bit_size, int sync_extension); - -enum AudioObjectType { - AOT_NULL, - // Support? Name - AOT_AAC_MAIN, ///< Y Main - AOT_AAC_LC, ///< Y Low Complexity - AOT_AAC_SSR, ///< N (code in SoC repo) Scalable Sample Rate - AOT_AAC_LTP, ///< Y Long Term Prediction - AOT_SBR, ///< Y Spectral Band Replication - AOT_AAC_SCALABLE, ///< N Scalable - AOT_TWINVQ, ///< N Twin Vector Quantizer - AOT_CELP, ///< N Code Excited Linear Prediction - AOT_HVXC, ///< N Harmonic Vector eXcitation Coding - AOT_TTSI = 12, ///< N Text-To-Speech Interface - AOT_MAINSYNTH, ///< N Main Synthesis - AOT_WAVESYNTH, ///< N Wavetable Synthesis - AOT_MIDI, ///< N General MIDI - AOT_SAFX, ///< N Algorithmic Synthesis and Audio Effects - AOT_ER_AAC_LC, ///< N Error Resilient Low Complexity - AOT_ER_AAC_LTP = 19, ///< N Error Resilient Long Term Prediction - AOT_ER_AAC_SCALABLE, ///< N Error Resilient Scalable - AOT_ER_TWINVQ, ///< N Error Resilient Twin Vector Quantizer - AOT_ER_BSAC, ///< N Error Resilient Bit-Sliced Arithmetic Coding - AOT_ER_AAC_LD, ///< N Error Resilient Low Delay - AOT_ER_CELP, ///< N Error Resilient Code Excited Linear Prediction - AOT_ER_HVXC, ///< N Error Resilient Harmonic Vector eXcitation Coding - AOT_ER_HILN, ///< N Error Resilient Harmonic and Individual Lines plus Noise - AOT_ER_PARAM, ///< N Error Resilient Parametric - AOT_SSC, ///< N SinuSoidal Coding - AOT_PS, ///< N Parametric Stereo - AOT_SURROUND, ///< N MPEG Surround - AOT_ESCAPE, ///< Y Escape Value - AOT_L1, ///< Y Layer 1 - AOT_L2, ///< Y Layer 2 - AOT_L3, ///< Y Layer 3 - AOT_DST, ///< N Direct Stream Transfer - AOT_ALS, ///< Y Audio LosslesS - AOT_SLS, ///< N Scalable LosslesS - AOT_SLS_NON_CORE, ///< N Scalable LosslesS (non core) - AOT_ER_AAC_ELD, ///< N Error Resilient Enhanced Low Delay - AOT_SMR_SIMPLE, ///< N Symbolic Music Representation Simple - AOT_SMR_MAIN, ///< N Symbolic Music Representation Main - AOT_USAC_NOSBR, ///< N Unified Speech and Audio Coding (no SBR) - AOT_SAOC, ///< N Spatial Audio Object Coding - AOT_LD_SURROUND, ///< N Low Delay MPEG Surround - AOT_USAC, ///< N Unified Speech and Audio Coding -}; - -#define MAX_PCE_SIZE 304 ///= 56) || - (ch_bitrate >= 56 && ch_bitrate <= 80)) - table = 0; - else if (freq != 48000 && ch_bitrate >= 96) - table = 1; - else if (freq != 32000 && ch_bitrate <= 48) - table = 2; - else - table = 3; - } else { - table = 4; - } - return table; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio.h deleted file mode 100644 index b880b7a83..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpeg audio declarations for both encoder and decoder. - */ - -#ifndef AVCODEC_MPEGAUDIO_H -#define AVCODEC_MPEGAUDIO_H - -#ifndef CONFIG_FLOAT -# define CONFIG_FLOAT 0 -#endif - -#include - -/* max frame size, in samples */ -#define MPA_FRAME_SIZE 1152 - -/* max compressed frame size */ -#define MPA_MAX_CODED_FRAME_SIZE 1792 - -#define MPA_MAX_CHANNELS 2 - -#define SBLIMIT 32 /* number of subbands */ - -#define MPA_STEREO 0 -#define MPA_JSTEREO 1 -#define MPA_DUAL 2 -#define MPA_MONO 3 - -#ifndef FRAC_BITS -#define FRAC_BITS 23 /* fractional bits for sb_samples and dct */ -#define WFRAC_BITS 16 /* fractional bits for window */ -#endif - -#define IMDCT_SCALAR 1.759 - -#define FRAC_ONE (1 << FRAC_BITS) - -#define FIX(a) ((int)((a) * FRAC_ONE)) - -#if CONFIG_FLOAT -# define INTFLOAT float -typedef float MPA_INT; -typedef float OUT_INT; -#elif FRAC_BITS <= 15 -# define INTFLOAT int -typedef int16_t MPA_INT; -typedef int16_t OUT_INT; -#else -# define INTFLOAT int -typedef int32_t MPA_INT; -typedef int16_t OUT_INT; -#endif - -int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); - -#endif /* AVCODEC_MPEGAUDIO_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_parser.c deleted file mode 100644 index 408193671..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_parser.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * MPEG Audio parser - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "parser.h" -#include "mpegaudiodecheader.h" -#include "libavutil/common.h" - - -typedef struct MpegAudioParseContext { - ParseContext pc; - int frame_size; - uint32_t header; - int header_count; - int no_bitrate; -} MpegAudioParseContext; - -#define MPA_HEADER_SIZE 4 - -/* header + layer + bitrate + freq + lsf/mpeg25 */ -#define SAME_HEADER_MASK \ - (0xffe00000 | (3 << 17) | (3 << 10) | (3 << 19)) - -static int mpegaudio_parse(AVCodecParserContext *s1, - AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - MpegAudioParseContext *s = s1->priv_data; - ParseContext *pc = &s->pc; - uint32_t state= pc->state; - int i; - int next= END_NOT_FOUND; - - for(i=0; iframe_size){ - int inc= FFMIN(buf_size - i, s->frame_size); - i += inc; - s->frame_size -= inc; - state = 0; - - if(!s->frame_size){ - next= i; - break; - } - }else{ - while(i 4) - s->header_count = -2; - } else { - if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header) - s->header_count= -3; - s->header= state; - s->header_count++; - s->frame_size = ret-4; - - if (s->header_count > 0) { - avctx->sample_rate= sr; - avctx->channels = channels; - s1->duration = frame_size; - if (s->no_bitrate || !avctx->bit_rate) { - s->no_bitrate = 1; - avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count; - } - } - break; - } - } - } - } - - pc->state= state; - if (ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - - -AVCodecParser ff_mpegaudio_parser = { - .codec_ids = { AV_CODEC_ID_MP1, AV_CODEC_ID_MP2, AV_CODEC_ID_MP3 }, - .priv_data_size = sizeof(MpegAudioParseContext), - .parser_parse = mpegaudio_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.c deleted file mode 100644 index 90c9de430..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Generate a header file for hardcoded mpegaudiodec tables - * - * Copyright (c) 2009 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#define CONFIG_HARDCODED_TABLES 0 -#include "mpegaudio_tablegen.h" -#include "tableprint.h" - -int main(void) -{ - mpegaudio_tableinit(); - - write_fileheader(); - - WRITE_ARRAY("static const", int8_t, table_4_3_exp); - WRITE_ARRAY("static const", uint32_t, table_4_3_value); - WRITE_ARRAY("static const", uint32_t, exp_table_fixed); - WRITE_ARRAY("static const", float, exp_table_float); - WRITE_2D_ARRAY("static const", uint32_t, expval_table_fixed); - WRITE_2D_ARRAY("static const", float, expval_table_float); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.h deleted file mode 100644 index 6c15d3cb0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudio_tablegen.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Header file for hardcoded mpegaudiodec tables - * - * Copyright (c) 2009 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MPEGAUDIO_TABLEGEN_H -#define AVCODEC_MPEGAUDIO_TABLEGEN_H - -#include -#include - -#define TABLE_4_3_SIZE (8191 + 16)*4 -#if CONFIG_HARDCODED_TABLES -#define mpegaudio_tableinit() -#include "libavcodec/mpegaudio_tables.h" -#else -static int8_t table_4_3_exp[TABLE_4_3_SIZE]; -static uint32_t table_4_3_value[TABLE_4_3_SIZE]; -static uint32_t exp_table_fixed[512]; -static uint32_t expval_table_fixed[512][16]; -static float exp_table_float[512]; -static float expval_table_float[512][16]; - -#define FRAC_BITS 23 -#define IMDCT_SCALAR 1.759 - -static void mpegaudio_tableinit(void) -{ - int i, value, exponent; - for (i = 1; i < TABLE_4_3_SIZE; i++) { - double value = i / 4; - double f, fm; - int e, m; - f = value / IMDCT_SCALAR * cbrtf(value) * pow(2, (i & 3) * 0.25); - fm = frexp(f, &e); - m = (uint32_t)(fm * (1LL << 31) + 0.5); - e += FRAC_BITS - 31 + 5 - 100; - - /* normalized to FRAC_BITS */ - table_4_3_value[i] = m; - table_4_3_exp[i] = -e; - } - for (exponent = 0; exponent < 512; exponent++) { - for (value = 0; value < 16; value++) { - double f = (double)value * cbrtf(value) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5) / IMDCT_SCALAR; - expval_table_fixed[exponent][value] = llrint(f); - expval_table_float[exponent][value] = f; - } - exp_table_fixed[exponent] = expval_table_fixed[exponent][1]; - exp_table_float[exponent] = expval_table_float[exponent][1]; - } -} -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AVCODEC_MPEGAUDIO_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.c deleted file mode 100644 index 056928110..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * MPEG Audio common tables - * copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpeg audio layer common tables. - */ - -#include "mpegaudiodata.h" - - -const uint16_t avpriv_mpa_bitrate_tab[2][3][15] = { - { {0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448 }, - {0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384 }, - {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320 } }, - { {0, 32, 48, 56, 64, 80, 96, 112, 128, 144, 160, 176, 192, 224, 256}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160}, - {0, 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160} - } -}; - -const uint16_t avpriv_mpa_freq_tab[3] = { 44100, 48000, 32000 }; - -/*******************************************************/ -/* layer 2 tables */ - -const int ff_mpa_sblimit_table[5] = { 27 , 30 , 8, 12 , 30 }; - -const int ff_mpa_quant_steps[17] = { - 3, 5, 7, 9, 15, - 31, 63, 127, 255, 511, - 1023, 2047, 4095, 8191, 16383, - 32767, 65535 -}; - -/* we use a negative value if grouped */ -const int ff_mpa_quant_bits[17] = { - -5, -7, 3, -10, 4, - 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, - 15, 16 -}; - -/* encoding tables which give the quantization index. Note how it is - possible to store them efficiently ! */ -static const unsigned char alloc_table_1[] = { - 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 4, 0, 2, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 3, 0, 1, 2, 3, 4, 5, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, - 2, 0, 1, 16, -}; - -static const unsigned char alloc_table_3[] = { - 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 4, 0, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, -}; - -static const unsigned char alloc_table_4[] = { - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 4, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 3, 0, 1, 3, 4, 5, 6, 7, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, - 2, 0, 1, 3, -}; - -const unsigned char * const ff_mpa_alloc_tables[5] = -{ alloc_table_1, alloc_table_1, alloc_table_3, alloc_table_3, alloc_table_4, }; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.h deleted file mode 100644 index 29a26588b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodata.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * MPEG Audio common tables - * copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpeg audio layer common tables. - */ - -#ifndef AVCODEC_MPEGAUDIODATA_H -#define AVCODEC_MPEGAUDIODATA_H - -#include - -#include "libavutil/internal.h" - -#define MODE_EXT_MS_STEREO 2 -#define MODE_EXT_I_STEREO 1 - -extern av_export const uint16_t avpriv_mpa_bitrate_tab[2][3][15]; -extern av_export const uint16_t avpriv_mpa_freq_tab[3]; -extern const int ff_mpa_sblimit_table[5]; -extern const int ff_mpa_quant_steps[17]; -extern const int ff_mpa_quant_bits[17]; -extern const unsigned char * const ff_mpa_alloc_tables[5]; - -#endif /* AVCODEC_MPEGAUDIODATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec.c deleted file mode 100644 index fc900d855..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec.c +++ /dev/null @@ -1,2079 +0,0 @@ -/* - * MPEG Audio decoder - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MPEG Audio decoder - */ - -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/channel_layout.h" -#include "libavutil/float_dsp.h" -#include "libavutil/libm.h" -#include "avcodec.h" -#include "get_bits.h" -#include "internal.h" -#include "mathops.h" -#include "mpegaudiodsp.h" - -/* - * TODO: - * - test lsf / mpeg25 extensively. - */ - -#include "mpegaudio.h" -#include "mpegaudiodecheader.h" - -#define BACKSTEP_SIZE 512 -#define EXTRABYTES 24 -#define LAST_BUF_SIZE 2 * BACKSTEP_SIZE + EXTRABYTES - -/* layer 3 "granule" */ -typedef struct GranuleDef { - uint8_t scfsi; - int part2_3_length; - int big_values; - int global_gain; - int scalefac_compress; - uint8_t block_type; - uint8_t switch_point; - int table_select[3]; - int subblock_gain[3]; - uint8_t scalefac_scale; - uint8_t count1table_select; - int region_size[3]; /* number of huffman codes in each region */ - int preflag; - int short_start, long_end; /* long/short band indexes */ - uint8_t scale_factors[40]; - DECLARE_ALIGNED(16, INTFLOAT, sb_hybrid)[SBLIMIT * 18]; /* 576 samples */ -} GranuleDef; - -typedef struct MPADecodeContext { - MPA_DECODE_HEADER - uint8_t last_buf[LAST_BUF_SIZE]; - int last_buf_size; - /* next header (used in free format parsing) */ - uint32_t free_format_next_header; - GetBitContext gb; - GetBitContext in_gb; - DECLARE_ALIGNED(32, MPA_INT, synth_buf)[MPA_MAX_CHANNELS][512 * 2]; - int synth_buf_offset[MPA_MAX_CHANNELS]; - DECLARE_ALIGNED(32, INTFLOAT, sb_samples)[MPA_MAX_CHANNELS][36][SBLIMIT]; - INTFLOAT mdct_buf[MPA_MAX_CHANNELS][SBLIMIT * 18]; /* previous samples, for layer 3 MDCT */ - GranuleDef granules[2][2]; /* Used in Layer 3 */ - int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3 - int dither_state; - int err_recognition; - AVCodecContext* avctx; - MPADSPContext mpadsp; - AVFloatDSPContext fdsp; - AVFrame *frame; -} MPADecodeContext; - -#if CONFIG_FLOAT -# define SHR(a,b) ((a)*(1.0f/(1<<(b)))) -# define FIXR_OLD(a) ((int)((a) * FRAC_ONE + 0.5)) -# define FIXR(x) ((float)(x)) -# define FIXHR(x) ((float)(x)) -# define MULH3(x, y, s) ((s)*(y)*(x)) -# define MULLx(x, y, s) ((y)*(x)) -# define RENAME(a) a ## _float -# define OUT_FMT AV_SAMPLE_FMT_FLT -# define OUT_FMT_P AV_SAMPLE_FMT_FLTP -#else -# define SHR(a,b) ((a)>>(b)) -/* WARNING: only correct for positive numbers */ -# define FIXR_OLD(a) ((int)((a) * FRAC_ONE + 0.5)) -# define FIXR(a) ((int)((a) * FRAC_ONE + 0.5)) -# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) -# define MULH3(x, y, s) MULH((s)*(x), y) -# define MULLx(x, y, s) MULL(x,y,s) -# define RENAME(a) a ## _fixed -# define OUT_FMT AV_SAMPLE_FMT_S16 -# define OUT_FMT_P AV_SAMPLE_FMT_S16P -#endif - -/****************/ - -#define HEADER_SIZE 4 - -#include "mpegaudiodata.h" -#include "mpegaudiodectab.h" - -/* vlc structure for decoding layer 3 huffman tables */ -static VLC huff_vlc[16]; -static VLC_TYPE huff_vlc_tables[ - 0 + 128 + 128 + 128 + 130 + 128 + 154 + 166 + - 142 + 204 + 190 + 170 + 542 + 460 + 662 + 414 - ][2]; -static const int huff_vlc_tables_sizes[16] = { - 0, 128, 128, 128, 130, 128, 154, 166, - 142, 204, 190, 170, 542, 460, 662, 414 -}; -static VLC huff_quad_vlc[2]; -static VLC_TYPE huff_quad_vlc_tables[128+16][2]; -static const int huff_quad_vlc_tables_sizes[2] = { 128, 16 }; -/* computed from band_size_long */ -static uint16_t band_index_long[9][23]; -#include "mpegaudio_tablegen.h" -/* intensity stereo coef table */ -static INTFLOAT is_table[2][16]; -static INTFLOAT is_table_lsf[2][2][16]; -static INTFLOAT csa_table[8][4]; - -static int16_t division_tab3[1<<6 ]; -static int16_t division_tab5[1<<8 ]; -static int16_t division_tab9[1<<11]; - -static int16_t * const division_tabs[4] = { - division_tab3, division_tab5, NULL, division_tab9 -}; - -/* lower 2 bits: modulo 3, higher bits: shift */ -static uint16_t scale_factor_modshift[64]; -/* [i][j]: 2^(-j/3) * FRAC_ONE * 2^(i+2) / (2^(i+2) - 1) */ -static int32_t scale_factor_mult[15][3]; -/* mult table for layer 2 group quantization */ - -#define SCALE_GEN(v) \ -{ FIXR_OLD(1.0 * (v)), FIXR_OLD(0.7937005259 * (v)), FIXR_OLD(0.6299605249 * (v)) } - -static const int32_t scale_factor_mult2[3][3] = { - SCALE_GEN(4.0 / 3.0), /* 3 steps */ - SCALE_GEN(4.0 / 5.0), /* 5 steps */ - SCALE_GEN(4.0 / 9.0), /* 9 steps */ -}; - -/** - * Convert region offsets to region sizes and truncate - * size to big_values. - */ -static void region_offset2size(GranuleDef *g) -{ - int i, k, j = 0; - g->region_size[2] = 576 / 2; - for (i = 0; i < 3; i++) { - k = FFMIN(g->region_size[i], g->big_values); - g->region_size[i] = k - j; - j = k; - } -} - -static void init_short_region(MPADecodeContext *s, GranuleDef *g) -{ - if (g->block_type == 2) { - if (s->sample_rate_index != 8) - g->region_size[0] = (36 / 2); - else - g->region_size[0] = (72 / 2); - } else { - if (s->sample_rate_index <= 2) - g->region_size[0] = (36 / 2); - else if (s->sample_rate_index != 8) - g->region_size[0] = (54 / 2); - else - g->region_size[0] = (108 / 2); - } - g->region_size[1] = (576 / 2); -} - -static void init_long_region(MPADecodeContext *s, GranuleDef *g, - int ra1, int ra2) -{ - int l; - g->region_size[0] = band_index_long[s->sample_rate_index][ra1 + 1] >> 1; - /* should not overflow */ - l = FFMIN(ra1 + ra2 + 2, 22); - g->region_size[1] = band_index_long[s->sample_rate_index][ l] >> 1; -} - -static void compute_band_indexes(MPADecodeContext *s, GranuleDef *g) -{ - if (g->block_type == 2) { - if (g->switch_point) { - if(s->sample_rate_index == 8) - avpriv_request_sample(s->avctx, "switch point in 8khz"); - /* if switched mode, we handle the 36 first samples as - long blocks. For 8000Hz, we handle the 72 first - exponents as long blocks */ - if (s->sample_rate_index <= 2) - g->long_end = 8; - else - g->long_end = 6; - - g->short_start = 3; - } else { - g->long_end = 0; - g->short_start = 0; - } - } else { - g->short_start = 13; - g->long_end = 22; - } -} - -/* layer 1 unscaling */ -/* n = number of bits of the mantissa minus 1 */ -static inline int l1_unscale(int n, int mant, int scale_factor) -{ - int shift, mod; - int64_t val; - - shift = scale_factor_modshift[scale_factor]; - mod = shift & 3; - shift >>= 2; - val = MUL64(mant + (-1 << n) + 1, scale_factor_mult[n-1][mod]); - shift += n; - /* NOTE: at this point, 1 <= shift >= 21 + 15 */ - return (int)((val + (1LL << (shift - 1))) >> shift); -} - -static inline int l2_unscale_group(int steps, int mant, int scale_factor) -{ - int shift, mod, val; - - shift = scale_factor_modshift[scale_factor]; - mod = shift & 3; - shift >>= 2; - - val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod]; - /* NOTE: at this point, 0 <= shift <= 21 */ - if (shift > 0) - val = (val + (1 << (shift - 1))) >> shift; - return val; -} - -/* compute value^(4/3) * 2^(exponent/4). It normalized to FRAC_BITS */ -static inline int l3_unscale(int value, int exponent) -{ - unsigned int m; - int e; - - e = table_4_3_exp [4 * value + (exponent & 3)]; - m = table_4_3_value[4 * value + (exponent & 3)]; - e -= exponent >> 2; -#ifdef DEBUG - if(e < 1) - av_log(NULL, AV_LOG_WARNING, "l3_unscale: e is %d\n", e); -#endif - if (e > 31) - return 0; - m = (m + (1 << (e - 1))) >> e; - - return m; -} - -static av_cold void decode_init_static(void) -{ - int i, j, k; - int offset; - - /* scale factors table for layer 1/2 */ - for (i = 0; i < 64; i++) { - int shift, mod; - /* 1.0 (i = 3) is normalized to 2 ^ FRAC_BITS */ - shift = i / 3; - mod = i % 3; - scale_factor_modshift[i] = mod | (shift << 2); - } - - /* scale factor multiply for layer 1 */ - for (i = 0; i < 15; i++) { - int n, norm; - n = i + 2; - norm = ((INT64_C(1) << n) * FRAC_ONE) / ((1 << n) - 1); - scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0 * 2.0), FRAC_BITS); - scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS); - scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS); - av_dlog(NULL, "%d: norm=%x s=%x %x %x\n", i, norm, - scale_factor_mult[i][0], - scale_factor_mult[i][1], - scale_factor_mult[i][2]); - } - - RENAME(ff_mpa_synth_init)(RENAME(ff_mpa_synth_window)); - - /* huffman decode tables */ - offset = 0; - for (i = 1; i < 16; i++) { - const HuffTable *h = &mpa_huff_tables[i]; - int xsize, x, y; - uint8_t tmp_bits [512] = { 0 }; - uint16_t tmp_codes[512] = { 0 }; - - xsize = h->xsize; - - j = 0; - for (x = 0; x < xsize; x++) { - for (y = 0; y < xsize; y++) { - tmp_bits [(x << 5) | y | ((x&&y)<<4)]= h->bits [j ]; - tmp_codes[(x << 5) | y | ((x&&y)<<4)]= h->codes[j++]; - } - } - - /* XXX: fail test */ - huff_vlc[i].table = huff_vlc_tables+offset; - huff_vlc[i].table_allocated = huff_vlc_tables_sizes[i]; - init_vlc(&huff_vlc[i], 7, 512, - tmp_bits, 1, 1, tmp_codes, 2, 2, - INIT_VLC_USE_NEW_STATIC); - offset += huff_vlc_tables_sizes[i]; - } - av_assert0(offset == FF_ARRAY_ELEMS(huff_vlc_tables)); - - offset = 0; - for (i = 0; i < 2; i++) { - huff_quad_vlc[i].table = huff_quad_vlc_tables+offset; - huff_quad_vlc[i].table_allocated = huff_quad_vlc_tables_sizes[i]; - init_vlc(&huff_quad_vlc[i], i == 0 ? 7 : 4, 16, - mpa_quad_bits[i], 1, 1, mpa_quad_codes[i], 1, 1, - INIT_VLC_USE_NEW_STATIC); - offset += huff_quad_vlc_tables_sizes[i]; - } - av_assert0(offset == FF_ARRAY_ELEMS(huff_quad_vlc_tables)); - - for (i = 0; i < 9; i++) { - k = 0; - for (j = 0; j < 22; j++) { - band_index_long[i][j] = k; - k += band_size_long[i][j]; - } - band_index_long[i][22] = k; - } - - /* compute n ^ (4/3) and store it in mantissa/exp format */ - - mpegaudio_tableinit(); - - for (i = 0; i < 4; i++) { - if (ff_mpa_quant_bits[i] < 0) { - for (j = 0; j < (1 << (-ff_mpa_quant_bits[i]+1)); j++) { - int val1, val2, val3, steps; - int val = j; - steps = ff_mpa_quant_steps[i]; - val1 = val % steps; - val /= steps; - val2 = val % steps; - val3 = val / steps; - division_tabs[i][j] = val1 + (val2 << 4) + (val3 << 8); - } - } - } - - - for (i = 0; i < 7; i++) { - float f; - INTFLOAT v; - if (i != 6) { - f = tan((double)i * M_PI / 12.0); - v = FIXR(f / (1.0 + f)); - } else { - v = FIXR(1.0); - } - is_table[0][ i] = v; - is_table[1][6 - i] = v; - } - /* invalid values */ - for (i = 7; i < 16; i++) - is_table[0][i] = is_table[1][i] = 0.0; - - for (i = 0; i < 16; i++) { - double f; - int e, k; - - for (j = 0; j < 2; j++) { - e = -(j + 1) * ((i + 1) >> 1); - f = exp2(e / 4.0); - k = i & 1; - is_table_lsf[j][k ^ 1][i] = FIXR(f); - is_table_lsf[j][k ][i] = FIXR(1.0); - av_dlog(NULL, "is_table_lsf %d %d: %f %f\n", - i, j, (float) is_table_lsf[j][0][i], - (float) is_table_lsf[j][1][i]); - } - } - - for (i = 0; i < 8; i++) { - float ci, cs, ca; - ci = ci_table[i]; - cs = 1.0 / sqrt(1.0 + ci * ci); - ca = cs * ci; -#if !CONFIG_FLOAT - csa_table[i][0] = FIXHR(cs/4); - csa_table[i][1] = FIXHR(ca/4); - csa_table[i][2] = FIXHR(ca/4) + FIXHR(cs/4); - csa_table[i][3] = FIXHR(ca/4) - FIXHR(cs/4); -#else - csa_table[i][0] = cs; - csa_table[i][1] = ca; - csa_table[i][2] = ca + cs; - csa_table[i][3] = ca - cs; -#endif - } -} - -static av_cold int decode_init(AVCodecContext * avctx) -{ - static int initialized_tables = 0; - MPADecodeContext *s = avctx->priv_data; - - if (!initialized_tables) { - decode_init_static(); - initialized_tables = 1; - } - - s->avctx = avctx; - - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - ff_mpadsp_init(&s->mpadsp); - - if (avctx->request_sample_fmt == OUT_FMT && - avctx->codec_id != AV_CODEC_ID_MP3ON4) - avctx->sample_fmt = OUT_FMT; - else - avctx->sample_fmt = OUT_FMT_P; - s->err_recognition = avctx->err_recognition; - - if (avctx->codec_id == AV_CODEC_ID_MP3ADU) - s->adu_mode = 1; - - return 0; -} - -#define C3 FIXHR(0.86602540378443864676/2) -#define C4 FIXHR(0.70710678118654752439/2) //0.5 / cos(pi*(9)/36) -#define C5 FIXHR(0.51763809020504152469/2) //0.5 / cos(pi*(5)/36) -#define C6 FIXHR(1.93185165257813657349/4) //0.5 / cos(pi*(15)/36) - -/* 12 points IMDCT. We compute it "by hand" by factorizing obvious - cases. */ -static void imdct12(INTFLOAT *out, INTFLOAT *in) -{ - INTFLOAT in0, in1, in2, in3, in4, in5, t1, t2; - - in0 = in[0*3]; - in1 = in[1*3] + in[0*3]; - in2 = in[2*3] + in[1*3]; - in3 = in[3*3] + in[2*3]; - in4 = in[4*3] + in[3*3]; - in5 = in[5*3] + in[4*3]; - in5 += in3; - in3 += in1; - - in2 = MULH3(in2, C3, 2); - in3 = MULH3(in3, C3, 4); - - t1 = in0 - in4; - t2 = MULH3(in1 - in5, C4, 2); - - out[ 7] = - out[10] = t1 + t2; - out[ 1] = - out[ 4] = t1 - t2; - - in0 += SHR(in4, 1); - in4 = in0 + in2; - in5 += 2*in1; - in1 = MULH3(in5 + in3, C5, 1); - out[ 8] = - out[ 9] = in4 + in1; - out[ 2] = - out[ 3] = in4 - in1; - - in0 -= in2; - in5 = MULH3(in5 - in3, C6, 2); - out[ 0] = - out[ 5] = in0 - in5; - out[ 6] = - out[11] = in0 + in5; -} - -/* return the number of decoded frames */ -static int mp_decode_layer1(MPADecodeContext *s) -{ - int bound, i, v, n, ch, j, mant; - uint8_t allocation[MPA_MAX_CHANNELS][SBLIMIT]; - uint8_t scale_factors[MPA_MAX_CHANNELS][SBLIMIT]; - - if (s->mode == MPA_JSTEREO) - bound = (s->mode_ext + 1) * 4; - else - bound = SBLIMIT; - - /* allocation bits */ - for (i = 0; i < bound; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - allocation[ch][i] = get_bits(&s->gb, 4); - } - } - for (i = bound; i < SBLIMIT; i++) - allocation[0][i] = get_bits(&s->gb, 4); - - /* scale factors */ - for (i = 0; i < bound; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - if (allocation[ch][i]) - scale_factors[ch][i] = get_bits(&s->gb, 6); - } - } - for (i = bound; i < SBLIMIT; i++) { - if (allocation[0][i]) { - scale_factors[0][i] = get_bits(&s->gb, 6); - scale_factors[1][i] = get_bits(&s->gb, 6); - } - } - - /* compute samples */ - for (j = 0; j < 12; j++) { - for (i = 0; i < bound; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - n = allocation[ch][i]; - if (n) { - mant = get_bits(&s->gb, n + 1); - v = l1_unscale(n, mant, scale_factors[ch][i]); - } else { - v = 0; - } - s->sb_samples[ch][j][i] = v; - } - } - for (i = bound; i < SBLIMIT; i++) { - n = allocation[0][i]; - if (n) { - mant = get_bits(&s->gb, n + 1); - v = l1_unscale(n, mant, scale_factors[0][i]); - s->sb_samples[0][j][i] = v; - v = l1_unscale(n, mant, scale_factors[1][i]); - s->sb_samples[1][j][i] = v; - } else { - s->sb_samples[0][j][i] = 0; - s->sb_samples[1][j][i] = 0; - } - } - } - return 12; -} - -static int mp_decode_layer2(MPADecodeContext *s) -{ - int sblimit; /* number of used subbands */ - const unsigned char *alloc_table; - int table, bit_alloc_bits, i, j, ch, bound, v; - unsigned char bit_alloc[MPA_MAX_CHANNELS][SBLIMIT]; - unsigned char scale_code[MPA_MAX_CHANNELS][SBLIMIT]; - unsigned char scale_factors[MPA_MAX_CHANNELS][SBLIMIT][3], *sf; - int scale, qindex, bits, steps, k, l, m, b; - - /* select decoding table */ - table = ff_mpa_l2_select_table(s->bit_rate / 1000, s->nb_channels, - s->sample_rate, s->lsf); - sblimit = ff_mpa_sblimit_table[table]; - alloc_table = ff_mpa_alloc_tables[table]; - - if (s->mode == MPA_JSTEREO) - bound = (s->mode_ext + 1) * 4; - else - bound = sblimit; - - av_dlog(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit); - - /* sanity check */ - if (bound > sblimit) - bound = sblimit; - - /* parse bit allocation */ - j = 0; - for (i = 0; i < bound; i++) { - bit_alloc_bits = alloc_table[j]; - for (ch = 0; ch < s->nb_channels; ch++) - bit_alloc[ch][i] = get_bits(&s->gb, bit_alloc_bits); - j += 1 << bit_alloc_bits; - } - for (i = bound; i < sblimit; i++) { - bit_alloc_bits = alloc_table[j]; - v = get_bits(&s->gb, bit_alloc_bits); - bit_alloc[0][i] = v; - bit_alloc[1][i] = v; - j += 1 << bit_alloc_bits; - } - - /* scale codes */ - for (i = 0; i < sblimit; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - if (bit_alloc[ch][i]) - scale_code[ch][i] = get_bits(&s->gb, 2); - } - } - - /* scale factors */ - for (i = 0; i < sblimit; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - if (bit_alloc[ch][i]) { - sf = scale_factors[ch][i]; - switch (scale_code[ch][i]) { - default: - case 0: - sf[0] = get_bits(&s->gb, 6); - sf[1] = get_bits(&s->gb, 6); - sf[2] = get_bits(&s->gb, 6); - break; - case 2: - sf[0] = get_bits(&s->gb, 6); - sf[1] = sf[0]; - sf[2] = sf[0]; - break; - case 1: - sf[0] = get_bits(&s->gb, 6); - sf[2] = get_bits(&s->gb, 6); - sf[1] = sf[0]; - break; - case 3: - sf[0] = get_bits(&s->gb, 6); - sf[2] = get_bits(&s->gb, 6); - sf[1] = sf[2]; - break; - } - } - } - } - - /* samples */ - for (k = 0; k < 3; k++) { - for (l = 0; l < 12; l += 3) { - j = 0; - for (i = 0; i < bound; i++) { - bit_alloc_bits = alloc_table[j]; - for (ch = 0; ch < s->nb_channels; ch++) { - b = bit_alloc[ch][i]; - if (b) { - scale = scale_factors[ch][i][k]; - qindex = alloc_table[j+b]; - bits = ff_mpa_quant_bits[qindex]; - if (bits < 0) { - int v2; - /* 3 values at the same time */ - v = get_bits(&s->gb, -bits); - v2 = division_tabs[qindex][v]; - steps = ff_mpa_quant_steps[qindex]; - - s->sb_samples[ch][k * 12 + l + 0][i] = - l2_unscale_group(steps, v2 & 15, scale); - s->sb_samples[ch][k * 12 + l + 1][i] = - l2_unscale_group(steps, (v2 >> 4) & 15, scale); - s->sb_samples[ch][k * 12 + l + 2][i] = - l2_unscale_group(steps, v2 >> 8 , scale); - } else { - for (m = 0; m < 3; m++) { - v = get_bits(&s->gb, bits); - v = l1_unscale(bits - 1, v, scale); - s->sb_samples[ch][k * 12 + l + m][i] = v; - } - } - } else { - s->sb_samples[ch][k * 12 + l + 0][i] = 0; - s->sb_samples[ch][k * 12 + l + 1][i] = 0; - s->sb_samples[ch][k * 12 + l + 2][i] = 0; - } - } - /* next subband in alloc table */ - j += 1 << bit_alloc_bits; - } - /* XXX: find a way to avoid this duplication of code */ - for (i = bound; i < sblimit; i++) { - bit_alloc_bits = alloc_table[j]; - b = bit_alloc[0][i]; - if (b) { - int mant, scale0, scale1; - scale0 = scale_factors[0][i][k]; - scale1 = scale_factors[1][i][k]; - qindex = alloc_table[j+b]; - bits = ff_mpa_quant_bits[qindex]; - if (bits < 0) { - /* 3 values at the same time */ - v = get_bits(&s->gb, -bits); - steps = ff_mpa_quant_steps[qindex]; - mant = v % steps; - v = v / steps; - s->sb_samples[0][k * 12 + l + 0][i] = - l2_unscale_group(steps, mant, scale0); - s->sb_samples[1][k * 12 + l + 0][i] = - l2_unscale_group(steps, mant, scale1); - mant = v % steps; - v = v / steps; - s->sb_samples[0][k * 12 + l + 1][i] = - l2_unscale_group(steps, mant, scale0); - s->sb_samples[1][k * 12 + l + 1][i] = - l2_unscale_group(steps, mant, scale1); - s->sb_samples[0][k * 12 + l + 2][i] = - l2_unscale_group(steps, v, scale0); - s->sb_samples[1][k * 12 + l + 2][i] = - l2_unscale_group(steps, v, scale1); - } else { - for (m = 0; m < 3; m++) { - mant = get_bits(&s->gb, bits); - s->sb_samples[0][k * 12 + l + m][i] = - l1_unscale(bits - 1, mant, scale0); - s->sb_samples[1][k * 12 + l + m][i] = - l1_unscale(bits - 1, mant, scale1); - } - } - } else { - s->sb_samples[0][k * 12 + l + 0][i] = 0; - s->sb_samples[0][k * 12 + l + 1][i] = 0; - s->sb_samples[0][k * 12 + l + 2][i] = 0; - s->sb_samples[1][k * 12 + l + 0][i] = 0; - s->sb_samples[1][k * 12 + l + 1][i] = 0; - s->sb_samples[1][k * 12 + l + 2][i] = 0; - } - /* next subband in alloc table */ - j += 1 << bit_alloc_bits; - } - /* fill remaining samples to zero */ - for (i = sblimit; i < SBLIMIT; i++) { - for (ch = 0; ch < s->nb_channels; ch++) { - s->sb_samples[ch][k * 12 + l + 0][i] = 0; - s->sb_samples[ch][k * 12 + l + 1][i] = 0; - s->sb_samples[ch][k * 12 + l + 2][i] = 0; - } - } - } - } - return 3 * 12; -} - -#define SPLIT(dst,sf,n) \ - if (n == 3) { \ - int m = (sf * 171) >> 9; \ - dst = sf - 3 * m; \ - sf = m; \ - } else if (n == 4) { \ - dst = sf & 3; \ - sf >>= 2; \ - } else if (n == 5) { \ - int m = (sf * 205) >> 10; \ - dst = sf - 5 * m; \ - sf = m; \ - } else if (n == 6) { \ - int m = (sf * 171) >> 10; \ - dst = sf - 6 * m; \ - sf = m; \ - } else { \ - dst = 0; \ - } - -static av_always_inline void lsf_sf_expand(int *slen, int sf, int n1, int n2, - int n3) -{ - SPLIT(slen[3], sf, n3) - SPLIT(slen[2], sf, n2) - SPLIT(slen[1], sf, n1) - slen[0] = sf; -} - -static void exponents_from_scale_factors(MPADecodeContext *s, GranuleDef *g, - int16_t *exponents) -{ - const uint8_t *bstab, *pretab; - int len, i, j, k, l, v0, shift, gain, gains[3]; - int16_t *exp_ptr; - - exp_ptr = exponents; - gain = g->global_gain - 210; - shift = g->scalefac_scale + 1; - - bstab = band_size_long[s->sample_rate_index]; - pretab = mpa_pretab[g->preflag]; - for (i = 0; i < g->long_end; i++) { - v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400; - len = bstab[i]; - for (j = len; j > 0; j--) - *exp_ptr++ = v0; - } - - if (g->short_start < 13) { - bstab = band_size_short[s->sample_rate_index]; - gains[0] = gain - (g->subblock_gain[0] << 3); - gains[1] = gain - (g->subblock_gain[1] << 3); - gains[2] = gain - (g->subblock_gain[2] << 3); - k = g->long_end; - for (i = g->short_start; i < 13; i++) { - len = bstab[i]; - for (l = 0; l < 3; l++) { - v0 = gains[l] - (g->scale_factors[k++] << shift) + 400; - for (j = len; j > 0; j--) - *exp_ptr++ = v0; - } - } - } -} - -/* handle n = 0 too */ -static inline int get_bitsz(GetBitContext *s, int n) -{ - return n ? get_bits(s, n) : 0; -} - - -static void switch_buffer(MPADecodeContext *s, int *pos, int *end_pos, - int *end_pos2) -{ - if (s->in_gb.buffer && *pos >= s->gb.size_in_bits) { - s->gb = s->in_gb; - s->in_gb.buffer = NULL; - av_assert2((get_bits_count(&s->gb) & 7) == 0); - skip_bits_long(&s->gb, *pos - *end_pos); - *end_pos2 = - *end_pos = *end_pos2 + get_bits_count(&s->gb) - *pos; - *pos = get_bits_count(&s->gb); - } -} - -/* Following is a optimized code for - INTFLOAT v = *src - if(get_bits1(&s->gb)) - v = -v; - *dst = v; -*/ -#if CONFIG_FLOAT -#define READ_FLIP_SIGN(dst,src) \ - v = AV_RN32A(src) ^ (get_bits1(&s->gb) << 31); \ - AV_WN32A(dst, v); -#else -#define READ_FLIP_SIGN(dst,src) \ - v = -get_bits1(&s->gb); \ - *(dst) = (*(src) ^ v) - v; -#endif - -static int huffman_decode(MPADecodeContext *s, GranuleDef *g, - int16_t *exponents, int end_pos2) -{ - int s_index; - int i; - int last_pos, bits_left; - VLC *vlc; - int end_pos = FFMIN(end_pos2, s->gb.size_in_bits); - - /* low frequencies (called big values) */ - s_index = 0; - for (i = 0; i < 3; i++) { - int j, k, l, linbits; - j = g->region_size[i]; - if (j == 0) - continue; - /* select vlc table */ - k = g->table_select[i]; - l = mpa_huff_data[k][0]; - linbits = mpa_huff_data[k][1]; - vlc = &huff_vlc[l]; - - if (!l) { - memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * 2 * j); - s_index += 2 * j; - continue; - } - - /* read huffcode and compute each couple */ - for (; j > 0; j--) { - int exponent, x, y; - int v; - int pos = get_bits_count(&s->gb); - - if (pos >= end_pos){ - switch_buffer(s, &pos, &end_pos, &end_pos2); - if (pos >= end_pos) - break; - } - y = get_vlc2(&s->gb, vlc->table, 7, 3); - - if (!y) { - g->sb_hybrid[s_index ] = - g->sb_hybrid[s_index+1] = 0; - s_index += 2; - continue; - } - - exponent= exponents[s_index]; - - av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n", - i, g->region_size[i] - j, x, y, exponent); - if (y & 16) { - x = y >> 5; - y = y & 0x0f; - if (x < 15) { - READ_FLIP_SIGN(g->sb_hybrid + s_index, RENAME(expval_table)[exponent] + x) - } else { - x += get_bitsz(&s->gb, linbits); - v = l3_unscale(x, exponent); - if (get_bits1(&s->gb)) - v = -v; - g->sb_hybrid[s_index] = v; - } - if (y < 15) { - READ_FLIP_SIGN(g->sb_hybrid + s_index + 1, RENAME(expval_table)[exponent] + y) - } else { - y += get_bitsz(&s->gb, linbits); - v = l3_unscale(y, exponent); - if (get_bits1(&s->gb)) - v = -v; - g->sb_hybrid[s_index+1] = v; - } - } else { - x = y >> 5; - y = y & 0x0f; - x += y; - if (x < 15) { - READ_FLIP_SIGN(g->sb_hybrid + s_index + !!y, RENAME(expval_table)[exponent] + x) - } else { - x += get_bitsz(&s->gb, linbits); - v = l3_unscale(x, exponent); - if (get_bits1(&s->gb)) - v = -v; - g->sb_hybrid[s_index+!!y] = v; - } - g->sb_hybrid[s_index + !y] = 0; - } - s_index += 2; - } - } - - /* high frequencies */ - vlc = &huff_quad_vlc[g->count1table_select]; - last_pos = 0; - while (s_index <= 572) { - int pos, code; - pos = get_bits_count(&s->gb); - if (pos >= end_pos) { - if (pos > end_pos2 && last_pos) { - /* some encoders generate an incorrect size for this - part. We must go back into the data */ - s_index -= 4; - skip_bits_long(&s->gb, last_pos - pos); - av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos); - if(s->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) - s_index=0; - break; - } - switch_buffer(s, &pos, &end_pos, &end_pos2); - if (pos >= end_pos) - break; - } - last_pos = pos; - - code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1); - av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code); - g->sb_hybrid[s_index+0] = - g->sb_hybrid[s_index+1] = - g->sb_hybrid[s_index+2] = - g->sb_hybrid[s_index+3] = 0; - while (code) { - static const int idxtab[16] = { 3,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0 }; - int v; - int pos = s_index + idxtab[code]; - code ^= 8 >> idxtab[code]; - READ_FLIP_SIGN(g->sb_hybrid + pos, RENAME(exp_table)+exponents[pos]) - } - s_index += 4; - } - /* skip extension bits */ - bits_left = end_pos2 - get_bits_count(&s->gb); - if (bits_left < 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_COMPLIANT))) { - av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); - s_index=0; - } else if (bits_left > 0 && (s->err_recognition & (AV_EF_BUFFER|AV_EF_AGGRESSIVE))) { - av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left); - s_index = 0; - } - memset(&g->sb_hybrid[s_index], 0, sizeof(*g->sb_hybrid) * (576 - s_index)); - skip_bits_long(&s->gb, bits_left); - - i = get_bits_count(&s->gb); - switch_buffer(s, &i, &end_pos, &end_pos2); - - return 0; -} - -/* Reorder short blocks from bitstream order to interleaved order. It - would be faster to do it in parsing, but the code would be far more - complicated */ -static void reorder_block(MPADecodeContext *s, GranuleDef *g) -{ - int i, j, len; - INTFLOAT *ptr, *dst, *ptr1; - INTFLOAT tmp[576]; - - if (g->block_type != 2) - return; - - if (g->switch_point) { - if (s->sample_rate_index != 8) - ptr = g->sb_hybrid + 36; - else - ptr = g->sb_hybrid + 72; - } else { - ptr = g->sb_hybrid; - } - - for (i = g->short_start; i < 13; i++) { - len = band_size_short[s->sample_rate_index][i]; - ptr1 = ptr; - dst = tmp; - for (j = len; j > 0; j--) { - *dst++ = ptr[0*len]; - *dst++ = ptr[1*len]; - *dst++ = ptr[2*len]; - ptr++; - } - ptr += 2 * len; - memcpy(ptr1, tmp, len * 3 * sizeof(*ptr1)); - } -} - -#define ISQRT2 FIXR(0.70710678118654752440) - -static void compute_stereo(MPADecodeContext *s, GranuleDef *g0, GranuleDef *g1) -{ - int i, j, k, l; - int sf_max, sf, len, non_zero_found; - INTFLOAT (*is_tab)[16], *tab0, *tab1, tmp0, tmp1, v1, v2; - int non_zero_found_short[3]; - - /* intensity stereo */ - if (s->mode_ext & MODE_EXT_I_STEREO) { - if (!s->lsf) { - is_tab = is_table; - sf_max = 7; - } else { - is_tab = is_table_lsf[g1->scalefac_compress & 1]; - sf_max = 16; - } - - tab0 = g0->sb_hybrid + 576; - tab1 = g1->sb_hybrid + 576; - - non_zero_found_short[0] = 0; - non_zero_found_short[1] = 0; - non_zero_found_short[2] = 0; - k = (13 - g1->short_start) * 3 + g1->long_end - 3; - for (i = 12; i >= g1->short_start; i--) { - /* for last band, use previous scale factor */ - if (i != 11) - k -= 3; - len = band_size_short[s->sample_rate_index][i]; - for (l = 2; l >= 0; l--) { - tab0 -= len; - tab1 -= len; - if (!non_zero_found_short[l]) { - /* test if non zero band. if so, stop doing i-stereo */ - for (j = 0; j < len; j++) { - if (tab1[j] != 0) { - non_zero_found_short[l] = 1; - goto found1; - } - } - sf = g1->scale_factors[k + l]; - if (sf >= sf_max) - goto found1; - - v1 = is_tab[0][sf]; - v2 = is_tab[1][sf]; - for (j = 0; j < len; j++) { - tmp0 = tab0[j]; - tab0[j] = MULLx(tmp0, v1, FRAC_BITS); - tab1[j] = MULLx(tmp0, v2, FRAC_BITS); - } - } else { -found1: - if (s->mode_ext & MODE_EXT_MS_STEREO) { - /* lower part of the spectrum : do ms stereo - if enabled */ - for (j = 0; j < len; j++) { - tmp0 = tab0[j]; - tmp1 = tab1[j]; - tab0[j] = MULLx(tmp0 + tmp1, ISQRT2, FRAC_BITS); - tab1[j] = MULLx(tmp0 - tmp1, ISQRT2, FRAC_BITS); - } - } - } - } - } - - non_zero_found = non_zero_found_short[0] | - non_zero_found_short[1] | - non_zero_found_short[2]; - - for (i = g1->long_end - 1;i >= 0;i--) { - len = band_size_long[s->sample_rate_index][i]; - tab0 -= len; - tab1 -= len; - /* test if non zero band. if so, stop doing i-stereo */ - if (!non_zero_found) { - for (j = 0; j < len; j++) { - if (tab1[j] != 0) { - non_zero_found = 1; - goto found2; - } - } - /* for last band, use previous scale factor */ - k = (i == 21) ? 20 : i; - sf = g1->scale_factors[k]; - if (sf >= sf_max) - goto found2; - v1 = is_tab[0][sf]; - v2 = is_tab[1][sf]; - for (j = 0; j < len; j++) { - tmp0 = tab0[j]; - tab0[j] = MULLx(tmp0, v1, FRAC_BITS); - tab1[j] = MULLx(tmp0, v2, FRAC_BITS); - } - } else { -found2: - if (s->mode_ext & MODE_EXT_MS_STEREO) { - /* lower part of the spectrum : do ms stereo - if enabled */ - for (j = 0; j < len; j++) { - tmp0 = tab0[j]; - tmp1 = tab1[j]; - tab0[j] = MULLx(tmp0 + tmp1, ISQRT2, FRAC_BITS); - tab1[j] = MULLx(tmp0 - tmp1, ISQRT2, FRAC_BITS); - } - } - } - } - } else if (s->mode_ext & MODE_EXT_MS_STEREO) { - /* ms stereo ONLY */ - /* NOTE: the 1/sqrt(2) normalization factor is included in the - global gain */ -#if CONFIG_FLOAT - s->fdsp.butterflies_float(g0->sb_hybrid, g1->sb_hybrid, 576); -#else - tab0 = g0->sb_hybrid; - tab1 = g1->sb_hybrid; - for (i = 0; i < 576; i++) { - tmp0 = tab0[i]; - tmp1 = tab1[i]; - tab0[i] = tmp0 + tmp1; - tab1[i] = tmp0 - tmp1; - } -#endif - } -} - -#if CONFIG_FLOAT -#if HAVE_MIPSFPU -# include "mips/compute_antialias_float.h" -#endif /* HAVE_MIPSFPU */ -#else -#if HAVE_MIPSDSPR1 -# include "mips/compute_antialias_fixed.h" -#endif /* HAVE_MIPSDSPR1 */ -#endif /* CONFIG_FLOAT */ - -#ifndef compute_antialias -#if CONFIG_FLOAT -#define AA(j) do { \ - float tmp0 = ptr[-1-j]; \ - float tmp1 = ptr[ j]; \ - ptr[-1-j] = tmp0 * csa_table[j][0] - tmp1 * csa_table[j][1]; \ - ptr[ j] = tmp0 * csa_table[j][1] + tmp1 * csa_table[j][0]; \ - } while (0) -#else -#define AA(j) do { \ - int tmp0 = ptr[-1-j]; \ - int tmp1 = ptr[ j]; \ - int tmp2 = MULH(tmp0 + tmp1, csa_table[j][0]); \ - ptr[-1-j] = 4 * (tmp2 - MULH(tmp1, csa_table[j][2])); \ - ptr[ j] = 4 * (tmp2 + MULH(tmp0, csa_table[j][3])); \ - } while (0) -#endif - -static void compute_antialias(MPADecodeContext *s, GranuleDef *g) -{ - INTFLOAT *ptr; - int n, i; - - /* we antialias only "long" bands */ - if (g->block_type == 2) { - if (!g->switch_point) - return; - /* XXX: check this for 8000Hz case */ - n = 1; - } else { - n = SBLIMIT - 1; - } - - ptr = g->sb_hybrid + 18; - for (i = n; i > 0; i--) { - AA(0); - AA(1); - AA(2); - AA(3); - AA(4); - AA(5); - AA(6); - AA(7); - - ptr += 18; - } -} -#endif /* compute_antialias */ - -static void compute_imdct(MPADecodeContext *s, GranuleDef *g, - INTFLOAT *sb_samples, INTFLOAT *mdct_buf) -{ - INTFLOAT *win, *out_ptr, *ptr, *buf, *ptr1; - INTFLOAT out2[12]; - int i, j, mdct_long_end, sblimit; - - /* find last non zero block */ - ptr = g->sb_hybrid + 576; - ptr1 = g->sb_hybrid + 2 * 18; - while (ptr >= ptr1) { - int32_t *p; - ptr -= 6; - p = (int32_t*)ptr; - if (p[0] | p[1] | p[2] | p[3] | p[4] | p[5]) - break; - } - sblimit = ((ptr - g->sb_hybrid) / 18) + 1; - - if (g->block_type == 2) { - /* XXX: check for 8000 Hz */ - if (g->switch_point) - mdct_long_end = 2; - else - mdct_long_end = 0; - } else { - mdct_long_end = sblimit; - } - - s->mpadsp.RENAME(imdct36_blocks)(sb_samples, mdct_buf, g->sb_hybrid, - mdct_long_end, g->switch_point, - g->block_type); - - buf = mdct_buf + 4*18*(mdct_long_end >> 2) + (mdct_long_end & 3); - ptr = g->sb_hybrid + 18 * mdct_long_end; - - for (j = mdct_long_end; j < sblimit; j++) { - /* select frequency inversion */ - win = RENAME(ff_mdct_win)[2 + (4 & -(j & 1))]; - out_ptr = sb_samples + j; - - for (i = 0; i < 6; i++) { - *out_ptr = buf[4*i]; - out_ptr += SBLIMIT; - } - imdct12(out2, ptr + 0); - for (i = 0; i < 6; i++) { - *out_ptr = MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*1)]; - buf[4*(i + 6*2)] = MULH3(out2[i + 6], win[i + 6], 1); - out_ptr += SBLIMIT; - } - imdct12(out2, ptr + 1); - for (i = 0; i < 6; i++) { - *out_ptr = MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*2)]; - buf[4*(i + 6*0)] = MULH3(out2[i + 6], win[i + 6], 1); - out_ptr += SBLIMIT; - } - imdct12(out2, ptr + 2); - for (i = 0; i < 6; i++) { - buf[4*(i + 6*0)] = MULH3(out2[i ], win[i ], 1) + buf[4*(i + 6*0)]; - buf[4*(i + 6*1)] = MULH3(out2[i + 6], win[i + 6], 1); - buf[4*(i + 6*2)] = 0; - } - ptr += 18; - buf += (j&3) != 3 ? 1 : (4*18-3); - } - /* zero bands */ - for (j = sblimit; j < SBLIMIT; j++) { - /* overlap */ - out_ptr = sb_samples + j; - for (i = 0; i < 18; i++) { - *out_ptr = buf[4*i]; - buf[4*i] = 0; - out_ptr += SBLIMIT; - } - buf += (j&3) != 3 ? 1 : (4*18-3); - } -} - -/* main layer3 decoding function */ -static int mp_decode_layer3(MPADecodeContext *s) -{ - int nb_granules, main_data_begin; - int gr, ch, blocksplit_flag, i, j, k, n, bits_pos; - GranuleDef *g; - int16_t exponents[576]; //FIXME try INTFLOAT - - /* read side info */ - if (s->lsf) { - main_data_begin = get_bits(&s->gb, 8); - skip_bits(&s->gb, s->nb_channels); - nb_granules = 1; - } else { - main_data_begin = get_bits(&s->gb, 9); - if (s->nb_channels == 2) - skip_bits(&s->gb, 3); - else - skip_bits(&s->gb, 5); - nb_granules = 2; - for (ch = 0; ch < s->nb_channels; ch++) { - s->granules[ch][0].scfsi = 0;/* all scale factors are transmitted */ - s->granules[ch][1].scfsi = get_bits(&s->gb, 4); - } - } - - for (gr = 0; gr < nb_granules; gr++) { - for (ch = 0; ch < s->nb_channels; ch++) { - av_dlog(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch); - g = &s->granules[ch][gr]; - g->part2_3_length = get_bits(&s->gb, 12); - g->big_values = get_bits(&s->gb, 9); - if (g->big_values > 288) { - av_log(s->avctx, AV_LOG_ERROR, "big_values too big\n"); - return AVERROR_INVALIDDATA; - } - - g->global_gain = get_bits(&s->gb, 8); - /* if MS stereo only is selected, we precompute the - 1/sqrt(2) renormalization factor */ - if ((s->mode_ext & (MODE_EXT_MS_STEREO | MODE_EXT_I_STEREO)) == - MODE_EXT_MS_STEREO) - g->global_gain -= 2; - if (s->lsf) - g->scalefac_compress = get_bits(&s->gb, 9); - else - g->scalefac_compress = get_bits(&s->gb, 4); - blocksplit_flag = get_bits1(&s->gb); - if (blocksplit_flag) { - g->block_type = get_bits(&s->gb, 2); - if (g->block_type == 0) { - av_log(s->avctx, AV_LOG_ERROR, "invalid block type\n"); - return AVERROR_INVALIDDATA; - } - g->switch_point = get_bits1(&s->gb); - for (i = 0; i < 2; i++) - g->table_select[i] = get_bits(&s->gb, 5); - for (i = 0; i < 3; i++) - g->subblock_gain[i] = get_bits(&s->gb, 3); - init_short_region(s, g); - } else { - int region_address1, region_address2; - g->block_type = 0; - g->switch_point = 0; - for (i = 0; i < 3; i++) - g->table_select[i] = get_bits(&s->gb, 5); - /* compute huffman coded region sizes */ - region_address1 = get_bits(&s->gb, 4); - region_address2 = get_bits(&s->gb, 3); - av_dlog(s->avctx, "region1=%d region2=%d\n", - region_address1, region_address2); - init_long_region(s, g, region_address1, region_address2); - } - region_offset2size(g); - compute_band_indexes(s, g); - - g->preflag = 0; - if (!s->lsf) - g->preflag = get_bits1(&s->gb); - g->scalefac_scale = get_bits1(&s->gb); - g->count1table_select = get_bits1(&s->gb); - av_dlog(s->avctx, "block_type=%d switch_point=%d\n", - g->block_type, g->switch_point); - } - } - - if (!s->adu_mode) { - int skip; - const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3); - int extrasize = av_clip(get_bits_left(&s->gb) >> 3, 0, EXTRABYTES); - av_assert1((get_bits_count(&s->gb) & 7) == 0); - /* now we get bits from the main_data_begin offset */ - av_dlog(s->avctx, "seekback:%d, lastbuf:%d\n", - main_data_begin, s->last_buf_size); - - memcpy(s->last_buf + s->last_buf_size, ptr, extrasize); - s->in_gb = s->gb; - init_get_bits(&s->gb, s->last_buf, s->last_buf_size*8); -#if !UNCHECKED_BITSTREAM_READER - s->gb.size_in_bits_plus8 += FFMAX(extrasize, LAST_BUF_SIZE - s->last_buf_size) * 8; -#endif - s->last_buf_size <<= 3; - for (gr = 0; gr < nb_granules && (s->last_buf_size >> 3) < main_data_begin; gr++) { - for (ch = 0; ch < s->nb_channels; ch++) { - g = &s->granules[ch][gr]; - s->last_buf_size += g->part2_3_length; - memset(g->sb_hybrid, 0, sizeof(g->sb_hybrid)); - compute_imdct(s, g, &s->sb_samples[ch][18 * gr][0], s->mdct_buf[ch]); - } - } - skip = s->last_buf_size - 8 * main_data_begin; - if (skip >= s->gb.size_in_bits && s->in_gb.buffer) { - skip_bits_long(&s->in_gb, skip - s->gb.size_in_bits); - s->gb = s->in_gb; - s->in_gb.buffer = NULL; - } else { - skip_bits_long(&s->gb, skip); - } - } else { - gr = 0; - } - - for (; gr < nb_granules; gr++) { - for (ch = 0; ch < s->nb_channels; ch++) { - g = &s->granules[ch][gr]; - bits_pos = get_bits_count(&s->gb); - - if (!s->lsf) { - uint8_t *sc; - int slen, slen1, slen2; - - /* MPEG1 scale factors */ - slen1 = slen_table[0][g->scalefac_compress]; - slen2 = slen_table[1][g->scalefac_compress]; - av_dlog(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2); - if (g->block_type == 2) { - n = g->switch_point ? 17 : 18; - j = 0; - if (slen1) { - for (i = 0; i < n; i++) - g->scale_factors[j++] = get_bits(&s->gb, slen1); - } else { - for (i = 0; i < n; i++) - g->scale_factors[j++] = 0; - } - if (slen2) { - for (i = 0; i < 18; i++) - g->scale_factors[j++] = get_bits(&s->gb, slen2); - for (i = 0; i < 3; i++) - g->scale_factors[j++] = 0; - } else { - for (i = 0; i < 21; i++) - g->scale_factors[j++] = 0; - } - } else { - sc = s->granules[ch][0].scale_factors; - j = 0; - for (k = 0; k < 4; k++) { - n = k == 0 ? 6 : 5; - if ((g->scfsi & (0x8 >> k)) == 0) { - slen = (k < 2) ? slen1 : slen2; - if (slen) { - for (i = 0; i < n; i++) - g->scale_factors[j++] = get_bits(&s->gb, slen); - } else { - for (i = 0; i < n; i++) - g->scale_factors[j++] = 0; - } - } else { - /* simply copy from last granule */ - for (i = 0; i < n; i++) { - g->scale_factors[j] = sc[j]; - j++; - } - } - } - g->scale_factors[j++] = 0; - } - } else { - int tindex, tindex2, slen[4], sl, sf; - - /* LSF scale factors */ - if (g->block_type == 2) - tindex = g->switch_point ? 2 : 1; - else - tindex = 0; - - sf = g->scalefac_compress; - if ((s->mode_ext & MODE_EXT_I_STEREO) && ch == 1) { - /* intensity stereo case */ - sf >>= 1; - if (sf < 180) { - lsf_sf_expand(slen, sf, 6, 6, 0); - tindex2 = 3; - } else if (sf < 244) { - lsf_sf_expand(slen, sf - 180, 4, 4, 0); - tindex2 = 4; - } else { - lsf_sf_expand(slen, sf - 244, 3, 0, 0); - tindex2 = 5; - } - } else { - /* normal case */ - if (sf < 400) { - lsf_sf_expand(slen, sf, 5, 4, 4); - tindex2 = 0; - } else if (sf < 500) { - lsf_sf_expand(slen, sf - 400, 5, 4, 0); - tindex2 = 1; - } else { - lsf_sf_expand(slen, sf - 500, 3, 0, 0); - tindex2 = 2; - g->preflag = 1; - } - } - - j = 0; - for (k = 0; k < 4; k++) { - n = lsf_nsf_table[tindex2][tindex][k]; - sl = slen[k]; - if (sl) { - for (i = 0; i < n; i++) - g->scale_factors[j++] = get_bits(&s->gb, sl); - } else { - for (i = 0; i < n; i++) - g->scale_factors[j++] = 0; - } - } - /* XXX: should compute exact size */ - for (; j < 40; j++) - g->scale_factors[j] = 0; - } - - exponents_from_scale_factors(s, g, exponents); - - /* read Huffman coded residue */ - huffman_decode(s, g, exponents, bits_pos + g->part2_3_length); - } /* ch */ - - if (s->mode == MPA_JSTEREO) - compute_stereo(s, &s->granules[0][gr], &s->granules[1][gr]); - - for (ch = 0; ch < s->nb_channels; ch++) { - g = &s->granules[ch][gr]; - - reorder_block(s, g); - compute_antialias(s, g); - compute_imdct(s, g, &s->sb_samples[ch][18 * gr][0], s->mdct_buf[ch]); - } - } /* gr */ - if (get_bits_count(&s->gb) < 0) - skip_bits_long(&s->gb, -get_bits_count(&s->gb)); - return nb_granules * 18; -} - -static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples, - const uint8_t *buf, int buf_size) -{ - int i, nb_frames, ch, ret; - OUT_INT *samples_ptr; - - init_get_bits(&s->gb, buf + HEADER_SIZE, (buf_size - HEADER_SIZE) * 8); - - /* skip error protection field */ - if (s->error_protection) - skip_bits(&s->gb, 16); - - switch(s->layer) { - case 1: - s->avctx->frame_size = 384; - nb_frames = mp_decode_layer1(s); - break; - case 2: - s->avctx->frame_size = 1152; - nb_frames = mp_decode_layer2(s); - break; - case 3: - s->avctx->frame_size = s->lsf ? 576 : 1152; - default: - nb_frames = mp_decode_layer3(s); - - s->last_buf_size=0; - if (s->in_gb.buffer) { - align_get_bits(&s->gb); - i = get_bits_left(&s->gb)>>3; - if (i >= 0 && i <= BACKSTEP_SIZE) { - memmove(s->last_buf, s->gb.buffer + (get_bits_count(&s->gb)>>3), i); - s->last_buf_size=i; - } else - av_log(s->avctx, AV_LOG_ERROR, "invalid old backstep %d\n", i); - s->gb = s->in_gb; - s->in_gb.buffer = NULL; - } - - align_get_bits(&s->gb); - av_assert1((get_bits_count(&s->gb) & 7) == 0); - i = get_bits_left(&s->gb) >> 3; - - if (i < 0 || i > BACKSTEP_SIZE || nb_frames < 0) { - if (i < 0) - av_log(s->avctx, AV_LOG_ERROR, "invalid new backstep %d\n", i); - i = FFMIN(BACKSTEP_SIZE, buf_size - HEADER_SIZE); - } - av_assert1(i <= buf_size - HEADER_SIZE && i >= 0); - memcpy(s->last_buf + s->last_buf_size, s->gb.buffer + buf_size - HEADER_SIZE - i, i); - s->last_buf_size += i; - } - - if(nb_frames < 0) - return nb_frames; - - /* get output buffer */ - if (!samples) { - av_assert0(s->frame != NULL); - s->frame->nb_samples = s->avctx->frame_size; - if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) - return ret; - samples = (OUT_INT **)s->frame->extended_data; - } - - /* apply the synthesis filter */ - for (ch = 0; ch < s->nb_channels; ch++) { - int sample_stride; - if (s->avctx->sample_fmt == OUT_FMT_P) { - samples_ptr = samples[ch]; - sample_stride = 1; - } else { - samples_ptr = samples[0] + ch; - sample_stride = s->nb_channels; - } - for (i = 0; i < nb_frames; i++) { - RENAME(ff_mpa_synth_filter)(&s->mpadsp, s->synth_buf[ch], - &(s->synth_buf_offset[ch]), - RENAME(ff_mpa_synth_window), - &s->dither_state, samples_ptr, - sample_stride, s->sb_samples[ch][i]); - samples_ptr += 32 * sample_stride; - } - } - - return nb_frames * 32 * sizeof(OUT_INT) * s->nb_channels; -} - -static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame_ptr, - AVPacket *avpkt) -{ - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - MPADecodeContext *s = avctx->priv_data; - uint32_t header; - int ret; - - while(buf_size && !*buf){ - buf++; - buf_size--; - } - - if (buf_size < HEADER_SIZE) - return AVERROR_INVALIDDATA; - - header = AV_RB32(buf); - if (header>>8 == AV_RB32("TAG")>>8) { - av_log(avctx, AV_LOG_DEBUG, "discarding ID3 tag\n"); - return buf_size; - } - if (ff_mpa_check_header(header) < 0) { - av_log(avctx, AV_LOG_ERROR, "Header missing\n"); - return AVERROR_INVALIDDATA; - } - - if (avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header) == 1) { - /* free format: prepare to compute frame size */ - s->frame_size = -1; - return AVERROR_INVALIDDATA; - } - /* update codec info */ - avctx->channels = s->nb_channels; - avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; - if (!avctx->bit_rate) - avctx->bit_rate = s->bit_rate; - - if (s->frame_size <= 0 || s->frame_size > buf_size) { - av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); - return AVERROR_INVALIDDATA; - } else if (s->frame_size < buf_size) { - av_log(avctx, AV_LOG_DEBUG, "incorrect frame size - multiple frames in buffer?\n"); - buf_size= s->frame_size; - } - - s->frame = data; - - ret = mp_decode_frame(s, NULL, buf, buf_size); - if (ret >= 0) { - s->frame->nb_samples = avctx->frame_size; - *got_frame_ptr = 1; - avctx->sample_rate = s->sample_rate; - //FIXME maybe move the other codec info stuff from above here too - } else { - av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); - /* Only return an error if the bad frame makes up the whole packet or - * the error is related to buffer management. - * If there is more data in the packet, just consume the bad frame - * instead of returning an error, which would discard the whole - * packet. */ - *got_frame_ptr = 0; - if (buf_size == avpkt->size || ret != AVERROR_INVALIDDATA) - return ret; - } - s->frame_size = 0; - return buf_size; -} - -static void mp_flush(MPADecodeContext *ctx) -{ - memset(ctx->synth_buf, 0, sizeof(ctx->synth_buf)); - ctx->last_buf_size = 0; -} - -static void flush(AVCodecContext *avctx) -{ - mp_flush(avctx->priv_data); -} - -#if CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER -static int decode_frame_adu(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - MPADecodeContext *s = avctx->priv_data; - uint32_t header; - int len, ret; - int av_unused out_size; - - len = buf_size; - - // Discard too short frames - if (buf_size < HEADER_SIZE) { - av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); - return AVERROR_INVALIDDATA; - } - - - if (len > MPA_MAX_CODED_FRAME_SIZE) - len = MPA_MAX_CODED_FRAME_SIZE; - - // Get header and restore sync word - header = AV_RB32(buf) | 0xffe00000; - - if (ff_mpa_check_header(header) < 0) { // Bad header, discard frame - av_log(avctx, AV_LOG_ERROR, "Invalid frame header\n"); - return AVERROR_INVALIDDATA; - } - - avpriv_mpegaudio_decode_header((MPADecodeHeader *)s, header); - /* update codec info */ - avctx->sample_rate = s->sample_rate; - avctx->channels = s->nb_channels; - if (!avctx->bit_rate) - avctx->bit_rate = s->bit_rate; - - s->frame_size = len; - - s->frame = data; - - ret = mp_decode_frame(s, NULL, buf, buf_size); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); - return ret; - } - - *got_frame_ptr = 1; - - return buf_size; -} -#endif /* CONFIG_MP3ADU_DECODER || CONFIG_MP3ADUFLOAT_DECODER */ - -#if CONFIG_MP3ON4_DECODER || CONFIG_MP3ON4FLOAT_DECODER - -/** - * Context for MP3On4 decoder - */ -typedef struct MP3On4DecodeContext { - int frames; ///< number of mp3 frames per block (number of mp3 decoder instances) - int syncword; ///< syncword patch - const uint8_t *coff; ///< channel offsets in output buffer - MPADecodeContext *mp3decctx[5]; ///< MPADecodeContext for every decoder instance -} MP3On4DecodeContext; - -#include "mpeg4audio.h" - -/* Next 3 arrays are indexed by channel config number (passed via codecdata) */ - -/* number of mp3 decoder instances */ -static const uint8_t mp3Frames[8] = { 0, 1, 1, 2, 3, 3, 4, 5 }; - -/* offsets into output buffer, assume output order is FL FR C LFE BL BR SL SR */ -static const uint8_t chan_offset[8][5] = { - { 0 }, - { 0 }, // C - { 0 }, // FLR - { 2, 0 }, // C FLR - { 2, 0, 3 }, // C FLR BS - { 2, 0, 3 }, // C FLR BLRS - { 2, 0, 4, 3 }, // C FLR BLRS LFE - { 2, 0, 6, 4, 3 }, // C FLR BLRS BLR LFE -}; - -/* mp3on4 channel layouts */ -static const int16_t chan_layout[8] = { - 0, - AV_CH_LAYOUT_MONO, - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_SURROUND, - AV_CH_LAYOUT_4POINT0, - AV_CH_LAYOUT_5POINT0, - AV_CH_LAYOUT_5POINT1, - AV_CH_LAYOUT_7POINT1 -}; - -static av_cold int decode_close_mp3on4(AVCodecContext * avctx) -{ - MP3On4DecodeContext *s = avctx->priv_data; - int i; - - for (i = 0; i < s->frames; i++) - av_free(s->mp3decctx[i]); - - return 0; -} - - -static av_cold int decode_init_mp3on4(AVCodecContext * avctx) -{ - MP3On4DecodeContext *s = avctx->priv_data; - MPEG4AudioConfig cfg; - int i; - - if ((avctx->extradata_size < 2) || (avctx->extradata == NULL)) { - av_log(avctx, AV_LOG_ERROR, "Codec extradata missing or too short.\n"); - return AVERROR_INVALIDDATA; - } - - avpriv_mpeg4audio_get_config(&cfg, avctx->extradata, - avctx->extradata_size * 8, 1); - if (!cfg.chan_config || cfg.chan_config > 7) { - av_log(avctx, AV_LOG_ERROR, "Invalid channel config number.\n"); - return AVERROR_INVALIDDATA; - } - s->frames = mp3Frames[cfg.chan_config]; - s->coff = chan_offset[cfg.chan_config]; - avctx->channels = ff_mpeg4audio_channels[cfg.chan_config]; - avctx->channel_layout = chan_layout[cfg.chan_config]; - - if (cfg.sample_rate < 16000) - s->syncword = 0xffe00000; - else - s->syncword = 0xfff00000; - - /* Init the first mp3 decoder in standard way, so that all tables get builded - * We replace avctx->priv_data with the context of the first decoder so that - * decode_init() does not have to be changed. - * Other decoders will be initialized here copying data from the first context - */ - // Allocate zeroed memory for the first decoder context - s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext)); - if (!s->mp3decctx[0]) - goto alloc_fail; - // Put decoder context in place to make init_decode() happy - avctx->priv_data = s->mp3decctx[0]; - decode_init(avctx); - // Restore mp3on4 context pointer - avctx->priv_data = s; - s->mp3decctx[0]->adu_mode = 1; // Set adu mode - - /* Create a separate codec/context for each frame (first is already ok). - * Each frame is 1 or 2 channels - up to 5 frames allowed - */ - for (i = 1; i < s->frames; i++) { - s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext)); - if (!s->mp3decctx[i]) - goto alloc_fail; - s->mp3decctx[i]->adu_mode = 1; - s->mp3decctx[i]->avctx = avctx; - s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp; - } - - return 0; -alloc_fail: - decode_close_mp3on4(avctx); - return AVERROR(ENOMEM); -} - - -static void flush_mp3on4(AVCodecContext *avctx) -{ - int i; - MP3On4DecodeContext *s = avctx->priv_data; - - for (i = 0; i < s->frames; i++) - mp_flush(s->mp3decctx[i]); -} - - -static int decode_frame_mp3on4(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - MP3On4DecodeContext *s = avctx->priv_data; - MPADecodeContext *m; - int fsize, len = buf_size, out_size = 0; - uint32_t header; - OUT_INT **out_samples; - OUT_INT *outptr[2]; - int fr, ch, ret; - - /* get output buffer */ - frame->nb_samples = MPA_FRAME_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - out_samples = (OUT_INT **)frame->extended_data; - - // Discard too short frames - if (buf_size < HEADER_SIZE) - return AVERROR_INVALIDDATA; - - avctx->bit_rate = 0; - - ch = 0; - for (fr = 0; fr < s->frames; fr++) { - fsize = AV_RB16(buf) >> 4; - fsize = FFMIN3(fsize, len, MPA_MAX_CODED_FRAME_SIZE); - m = s->mp3decctx[fr]; - av_assert1(m); - - if (fsize < HEADER_SIZE) { - av_log(avctx, AV_LOG_ERROR, "Frame size smaller than header size\n"); - return AVERROR_INVALIDDATA; - } - header = (AV_RB32(buf) & 0x000fffff) | s->syncword; // patch header - - if (ff_mpa_check_header(header) < 0) // Bad header, discard block - break; - - avpriv_mpegaudio_decode_header((MPADecodeHeader *)m, header); - - if (ch + m->nb_channels > avctx->channels || - s->coff[fr] + m->nb_channels > avctx->channels) { - av_log(avctx, AV_LOG_ERROR, "frame channel count exceeds codec " - "channel count\n"); - return AVERROR_INVALIDDATA; - } - ch += m->nb_channels; - - outptr[0] = out_samples[s->coff[fr]]; - if (m->nb_channels > 1) - outptr[1] = out_samples[s->coff[fr] + 1]; - - if ((ret = mp_decode_frame(m, outptr, buf, fsize)) < 0) - return ret; - - out_size += ret; - buf += fsize; - len -= fsize; - - avctx->bit_rate += m->bit_rate; - } - - /* update codec info */ - avctx->sample_rate = s->mp3decctx[0]->sample_rate; - - frame->nb_samples = out_size / (avctx->channels * sizeof(OUT_INT)); - *got_frame_ptr = 1; - - return buf_size; -} -#endif /* CONFIG_MP3ON4_DECODER || CONFIG_MP3ON4FLOAT_DECODER */ - -#if !CONFIG_FLOAT -#if CONFIG_MP1_DECODER -AVCodec ff_mp1_decoder = { - .name = "mp1", - .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP1, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP2_DECODER -AVCodec ff_mp2_decoder = { - .name = "mp2", - .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP2, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3_DECODER -AVCodec ff_mp3_decoder = { - .name = "mp3", - .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3ADU_DECODER -AVCodec ff_mp3adu_decoder = { - .name = "mp3adu", - .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3ADU, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame_adu, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3ON4_DECODER -AVCodec ff_mp3on4_decoder = { - .name = "mp3on4", - .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3ON4, - .priv_data_size = sizeof(MP3On4DecodeContext), - .init = decode_init_mp3on4, - .close = decode_close_mp3on4, - .decode = decode_frame_mp3on4, - .capabilities = CODEC_CAP_DR1, - .flush = flush_mp3on4, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec_float.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec_float.c deleted file mode 100644 index 61b332ed5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodec_float.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Float MPEG Audio decoder - * Copyright (c) 2010 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define CONFIG_FLOAT 1 -#include "mpegaudiodec.c" - -#if CONFIG_MP1FLOAT_DECODER -AVCodec ff_mp1float_decoder = { - .name = "mp1float", - .long_name = NULL_IF_CONFIG_SMALL("MP1 (MPEG audio layer 1)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP1, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP2FLOAT_DECODER -AVCodec ff_mp2float_decoder = { - .name = "mp2float", - .long_name = NULL_IF_CONFIG_SMALL("MP2 (MPEG audio layer 2)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP2, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3FLOAT_DECODER -AVCodec ff_mp3float_decoder = { - .name = "mp3float", - .long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3ADUFLOAT_DECODER -AVCodec ff_mp3adufloat_decoder = { - .name = "mp3adufloat", - .long_name = NULL_IF_CONFIG_SMALL("ADU (Application Data Unit) MP3 (MPEG audio layer 3)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3ADU, - .priv_data_size = sizeof(MPADecodeContext), - .init = decode_init, - .decode = decode_frame_adu, - .capabilities = CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_MP3ON4FLOAT_DECODER -AVCodec ff_mp3on4float_decoder = { - .name = "mp3on4float", - .long_name = NULL_IF_CONFIG_SMALL("MP3onMP4"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_MP3ON4, - .priv_data_size = sizeof(MP3On4DecodeContext), - .init = decode_init_mp3on4, - .close = decode_close_mp3on4, - .decode = decode_frame_mp3on4, - .capabilities = CODEC_CAP_DR1, - .flush = flush_mp3on4, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.c deleted file mode 100644 index 1772c2a3c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.c +++ /dev/null @@ -1,145 +0,0 @@ -/* - * MPEG Audio header decoder - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MPEG Audio header decoder. - */ - -#include "avcodec.h" -#include "mpegaudio.h" -#include "mpegaudiodata.h" -#include "mpegaudiodecheader.h" - - -int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header) -{ - int sample_rate, frame_size, mpeg25, padding; - int sample_rate_index, bitrate_index; - if (header & (1<<20)) { - s->lsf = (header & (1<<19)) ? 0 : 1; - mpeg25 = 0; - } else { - s->lsf = 1; - mpeg25 = 1; - } - - s->layer = 4 - ((header >> 17) & 3); - /* extract frequency */ - sample_rate_index = (header >> 10) & 3; - sample_rate = avpriv_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25); - sample_rate_index += 3 * (s->lsf + mpeg25); - s->sample_rate_index = sample_rate_index; - s->error_protection = ((header >> 16) & 1) ^ 1; - s->sample_rate = sample_rate; - - bitrate_index = (header >> 12) & 0xf; - padding = (header >> 9) & 1; - //extension = (header >> 8) & 1; - s->mode = (header >> 6) & 3; - s->mode_ext = (header >> 4) & 3; - //copyright = (header >> 3) & 1; - //original = (header >> 2) & 1; - //emphasis = header & 3; - - if (s->mode == MPA_MONO) - s->nb_channels = 1; - else - s->nb_channels = 2; - - if (bitrate_index != 0) { - frame_size = avpriv_mpa_bitrate_tab[s->lsf][s->layer - 1][bitrate_index]; - s->bit_rate = frame_size * 1000; - switch(s->layer) { - case 1: - frame_size = (frame_size * 12000) / sample_rate; - frame_size = (frame_size + padding) * 4; - break; - case 2: - frame_size = (frame_size * 144000) / sample_rate; - frame_size += padding; - break; - default: - case 3: - frame_size = (frame_size * 144000) / (sample_rate << s->lsf); - frame_size += padding; - break; - } - s->frame_size = frame_size; - } else { - /* if no frame size computed, signal it */ - return 1; - } - -#if defined(DEBUG) - av_dlog(NULL, "layer%d, %d Hz, %d kbits/s, ", - s->layer, s->sample_rate, s->bit_rate); - if (s->nb_channels == 2) { - if (s->layer == 3) { - if (s->mode_ext & MODE_EXT_MS_STEREO) - av_dlog(NULL, "ms-"); - if (s->mode_ext & MODE_EXT_I_STEREO) - av_dlog(NULL, "i-"); - } - av_dlog(NULL, "stereo"); - } else { - av_dlog(NULL, "mono"); - } - av_dlog(NULL, "\n"); -#endif - return 0; -} - -int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bit_rate) -{ - MPADecodeHeader s1, *s = &s1; - - if (ff_mpa_check_header(head) != 0) - return -1; - - if (avpriv_mpegaudio_decode_header(s, head) != 0) { - return -1; - } - - switch(s->layer) { - case 1: - avctx->codec_id = AV_CODEC_ID_MP1; - *frame_size = 384; - break; - case 2: - avctx->codec_id = AV_CODEC_ID_MP2; - *frame_size = 1152; - break; - default: - case 3: - avctx->codec_id = AV_CODEC_ID_MP3; - if (s->lsf) - *frame_size = 576; - else - *frame_size = 1152; - break; - } - - *sample_rate = s->sample_rate; - *channels = s->nb_channels; - *bit_rate = s->bit_rate; - return s->frame_size; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.h deleted file mode 100644 index c434d0044..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodecheader.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * MPEG Audio header decoder - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * MPEG Audio header decoder. - */ - -#ifndef AVCODEC_MPEGAUDIODECHEADER_H -#define AVCODEC_MPEGAUDIODECHEADER_H - -#include "avcodec.h" - -#define MP3_MASK 0xFFFE0CCF - -#define MPA_DECODE_HEADER \ - int frame_size; \ - int error_protection; \ - int layer; \ - int sample_rate; \ - int sample_rate_index; /* between 0 and 8 */ \ - int bit_rate; \ - int nb_channels; \ - int mode; \ - int mode_ext; \ - int lsf; - -typedef struct MPADecodeHeader { - MPA_DECODE_HEADER -} MPADecodeHeader; - -/* header decoding. MUST check the header before because no - consistency check is done there. Return 1 if free format found and - that the frame size must be computed externally */ -int avpriv_mpegaudio_decode_header(MPADecodeHeader *s, uint32_t header); - -/* useful helper to get mpeg audio stream infos. Return -1 if error in - header, otherwise the coded frame size in bytes */ -int avpriv_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate); - -/* fast header check for resync */ -static inline int ff_mpa_check_header(uint32_t header){ - /* header */ - if ((header & 0xffe00000) != 0xffe00000) - return -1; - /* layer check */ - if ((header & (3<<17)) == 0) - return -1; - /* bit rate */ - if ((header & (0xf<<12)) == 0xf<<12) - return -1; - /* frequency */ - if ((header & (3<<10)) == 3<<10) - return -1; - return 0; -} - -#endif /* AVCODEC_MPEGAUDIODECHEADER_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodectab.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodectab.h deleted file mode 100644 index accd12b8e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodectab.h +++ /dev/null @@ -1,615 +0,0 @@ -/* - * MPEG Audio decoder - * copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpeg audio layer decoder tables. - */ - -#ifndef AVCODEC_MPEGAUDIODECTAB_H -#define AVCODEC_MPEGAUDIODECTAB_H - -#include -#include - -#include "mpegaudio.h" - -/*******************************************************/ -/* layer 3 tables */ - -/* layer 3 huffman tables */ -typedef struct HuffTable { - int xsize; - const uint8_t *bits; - const uint16_t *codes; -} HuffTable; - -/* layer3 scale factor size */ -static const uint8_t slen_table[2][16] = { - { 0, 0, 0, 0, 3, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 }, - { 0, 1, 2, 3, 0, 1, 2, 3, 1, 2, 3, 1, 2, 3, 2, 3 }, -}; - -/* number of lsf scale factors for a given size */ -static const uint8_t lsf_nsf_table[6][3][4] = { - { { 6, 5, 5, 5 }, { 9, 9, 9, 9 }, { 6, 9, 9, 9 } }, - { { 6, 5, 7, 3 }, { 9, 9, 12, 6 }, { 6, 9, 12, 6 } }, - { { 11, 10, 0, 0 }, { 18, 18, 0, 0 }, { 15, 18, 0, 0 } }, - { { 7, 7, 7, 0 }, { 12, 12, 12, 0 }, { 6, 15, 12, 0 } }, - { { 6, 6, 6, 3 }, { 12, 9, 9, 6 }, { 6, 12, 9, 6 } }, - { { 8, 8, 5, 0 }, { 15, 12, 9, 0 }, { 6, 18, 9, 0 } }, -}; - -/* mpegaudio layer 3 huffman tables */ - -static const uint16_t mpa_huffcodes_1[4] = { - 0x0001, 0x0001, 0x0001, 0x0000, -}; - -static const uint8_t mpa_huffbits_1[4] = { - 1, 3, 2, 3, -}; - -static const uint16_t mpa_huffcodes_2[9] = { - 0x0001, 0x0002, 0x0001, 0x0003, 0x0001, 0x0001, 0x0003, 0x0002, - 0x0000, -}; - -static const uint8_t mpa_huffbits_2[9] = { - 1, 3, 6, 3, 3, 5, 5, 5, - 6, -}; - -static const uint16_t mpa_huffcodes_3[9] = { - 0x0003, 0x0002, 0x0001, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002, - 0x0000, -}; - -static const uint8_t mpa_huffbits_3[9] = { - 2, 2, 6, 3, 2, 5, 5, 5, - 6, -}; - -static const uint16_t mpa_huffcodes_5[16] = { - 0x0001, 0x0002, 0x0006, 0x0005, 0x0003, 0x0001, 0x0004, 0x0004, - 0x0007, 0x0005, 0x0007, 0x0001, 0x0006, 0x0001, 0x0001, 0x0000, -}; - -static const uint8_t mpa_huffbits_5[16] = { - 1, 3, 6, 7, 3, 3, 6, 7, - 6, 6, 7, 8, 7, 6, 7, 8, -}; - -static const uint16_t mpa_huffcodes_6[16] = { - 0x0007, 0x0003, 0x0005, 0x0001, 0x0006, 0x0002, 0x0003, 0x0002, - 0x0005, 0x0004, 0x0004, 0x0001, 0x0003, 0x0003, 0x0002, 0x0000, -}; - -static const uint8_t mpa_huffbits_6[16] = { - 3, 3, 5, 7, 3, 2, 4, 5, - 4, 4, 5, 6, 6, 5, 6, 7, -}; - -static const uint16_t mpa_huffcodes_7[36] = { - 0x0001, 0x0002, 0x000a, 0x0013, 0x0010, 0x000a, 0x0003, 0x0003, - 0x0007, 0x000a, 0x0005, 0x0003, 0x000b, 0x0004, 0x000d, 0x0011, - 0x0008, 0x0004, 0x000c, 0x000b, 0x0012, 0x000f, 0x000b, 0x0002, - 0x0007, 0x0006, 0x0009, 0x000e, 0x0003, 0x0001, 0x0006, 0x0004, - 0x0005, 0x0003, 0x0002, 0x0000, -}; - -static const uint8_t mpa_huffbits_7[36] = { - 1, 3, 6, 8, 8, 9, 3, 4, - 6, 7, 7, 8, 6, 5, 7, 8, - 8, 9, 7, 7, 8, 9, 9, 9, - 7, 7, 8, 9, 9, 10, 8, 8, - 9, 10, 10, 10, -}; - -static const uint16_t mpa_huffcodes_8[36] = { - 0x0003, 0x0004, 0x0006, 0x0012, 0x000c, 0x0005, 0x0005, 0x0001, - 0x0002, 0x0010, 0x0009, 0x0003, 0x0007, 0x0003, 0x0005, 0x000e, - 0x0007, 0x0003, 0x0013, 0x0011, 0x000f, 0x000d, 0x000a, 0x0004, - 0x000d, 0x0005, 0x0008, 0x000b, 0x0005, 0x0001, 0x000c, 0x0004, - 0x0004, 0x0001, 0x0001, 0x0000, -}; - -static const uint8_t mpa_huffbits_8[36] = { - 2, 3, 6, 8, 8, 9, 3, 2, - 4, 8, 8, 8, 6, 4, 6, 8, - 8, 9, 8, 8, 8, 9, 9, 10, - 8, 7, 8, 9, 10, 10, 9, 8, - 9, 9, 11, 11, -}; - -static const uint16_t mpa_huffcodes_9[36] = { - 0x0007, 0x0005, 0x0009, 0x000e, 0x000f, 0x0007, 0x0006, 0x0004, - 0x0005, 0x0005, 0x0006, 0x0007, 0x0007, 0x0006, 0x0008, 0x0008, - 0x0008, 0x0005, 0x000f, 0x0006, 0x0009, 0x000a, 0x0005, 0x0001, - 0x000b, 0x0007, 0x0009, 0x0006, 0x0004, 0x0001, 0x000e, 0x0004, - 0x0006, 0x0002, 0x0006, 0x0000, -}; - -static const uint8_t mpa_huffbits_9[36] = { - 3, 3, 5, 6, 8, 9, 3, 3, - 4, 5, 6, 8, 4, 4, 5, 6, - 7, 8, 6, 5, 6, 7, 7, 8, - 7, 6, 7, 7, 8, 9, 8, 7, - 8, 8, 9, 9, -}; - -static const uint16_t mpa_huffcodes_10[64] = { - 0x0001, 0x0002, 0x000a, 0x0017, 0x0023, 0x001e, 0x000c, 0x0011, - 0x0003, 0x0003, 0x0008, 0x000c, 0x0012, 0x0015, 0x000c, 0x0007, - 0x000b, 0x0009, 0x000f, 0x0015, 0x0020, 0x0028, 0x0013, 0x0006, - 0x000e, 0x000d, 0x0016, 0x0022, 0x002e, 0x0017, 0x0012, 0x0007, - 0x0014, 0x0013, 0x0021, 0x002f, 0x001b, 0x0016, 0x0009, 0x0003, - 0x001f, 0x0016, 0x0029, 0x001a, 0x0015, 0x0014, 0x0005, 0x0003, - 0x000e, 0x000d, 0x000a, 0x000b, 0x0010, 0x0006, 0x0005, 0x0001, - 0x0009, 0x0008, 0x0007, 0x0008, 0x0004, 0x0004, 0x0002, 0x0000, -}; - -static const uint8_t mpa_huffbits_10[64] = { - 1, 3, 6, 8, 9, 9, 9, 10, - 3, 4, 6, 7, 8, 9, 8, 8, - 6, 6, 7, 8, 9, 10, 9, 9, - 7, 7, 8, 9, 10, 10, 9, 10, - 8, 8, 9, 10, 10, 10, 10, 10, - 9, 9, 10, 10, 11, 11, 10, 11, - 8, 8, 9, 10, 10, 10, 11, 11, - 9, 8, 9, 10, 10, 11, 11, 11, -}; - -static const uint16_t mpa_huffcodes_11[64] = { - 0x0003, 0x0004, 0x000a, 0x0018, 0x0022, 0x0021, 0x0015, 0x000f, - 0x0005, 0x0003, 0x0004, 0x000a, 0x0020, 0x0011, 0x000b, 0x000a, - 0x000b, 0x0007, 0x000d, 0x0012, 0x001e, 0x001f, 0x0014, 0x0005, - 0x0019, 0x000b, 0x0013, 0x003b, 0x001b, 0x0012, 0x000c, 0x0005, - 0x0023, 0x0021, 0x001f, 0x003a, 0x001e, 0x0010, 0x0007, 0x0005, - 0x001c, 0x001a, 0x0020, 0x0013, 0x0011, 0x000f, 0x0008, 0x000e, - 0x000e, 0x000c, 0x0009, 0x000d, 0x000e, 0x0009, 0x0004, 0x0001, - 0x000b, 0x0004, 0x0006, 0x0006, 0x0006, 0x0003, 0x0002, 0x0000, -}; - -static const uint8_t mpa_huffbits_11[64] = { - 2, 3, 5, 7, 8, 9, 8, 9, - 3, 3, 4, 6, 8, 8, 7, 8, - 5, 5, 6, 7, 8, 9, 8, 8, - 7, 6, 7, 9, 8, 10, 8, 9, - 8, 8, 8, 9, 9, 10, 9, 10, - 8, 8, 9, 10, 10, 11, 10, 11, - 8, 7, 7, 8, 9, 10, 10, 10, - 8, 7, 8, 9, 10, 10, 10, 10, -}; - -static const uint16_t mpa_huffcodes_12[64] = { - 0x0009, 0x0006, 0x0010, 0x0021, 0x0029, 0x0027, 0x0026, 0x001a, - 0x0007, 0x0005, 0x0006, 0x0009, 0x0017, 0x0010, 0x001a, 0x000b, - 0x0011, 0x0007, 0x000b, 0x000e, 0x0015, 0x001e, 0x000a, 0x0007, - 0x0011, 0x000a, 0x000f, 0x000c, 0x0012, 0x001c, 0x000e, 0x0005, - 0x0020, 0x000d, 0x0016, 0x0013, 0x0012, 0x0010, 0x0009, 0x0005, - 0x0028, 0x0011, 0x001f, 0x001d, 0x0011, 0x000d, 0x0004, 0x0002, - 0x001b, 0x000c, 0x000b, 0x000f, 0x000a, 0x0007, 0x0004, 0x0001, - 0x001b, 0x000c, 0x0008, 0x000c, 0x0006, 0x0003, 0x0001, 0x0000, -}; - -static const uint8_t mpa_huffbits_12[64] = { - 4, 3, 5, 7, 8, 9, 9, 9, - 3, 3, 4, 5, 7, 7, 8, 8, - 5, 4, 5, 6, 7, 8, 7, 8, - 6, 5, 6, 6, 7, 8, 8, 8, - 7, 6, 7, 7, 8, 8, 8, 9, - 8, 7, 8, 8, 8, 9, 8, 9, - 8, 7, 7, 8, 8, 9, 9, 10, - 9, 8, 8, 9, 9, 9, 9, 10, -}; - -static const uint16_t mpa_huffcodes_13[256] = { - 0x0001, 0x0005, 0x000e, 0x0015, 0x0022, 0x0033, 0x002e, 0x0047, - 0x002a, 0x0034, 0x0044, 0x0034, 0x0043, 0x002c, 0x002b, 0x0013, - 0x0003, 0x0004, 0x000c, 0x0013, 0x001f, 0x001a, 0x002c, 0x0021, - 0x001f, 0x0018, 0x0020, 0x0018, 0x001f, 0x0023, 0x0016, 0x000e, - 0x000f, 0x000d, 0x0017, 0x0024, 0x003b, 0x0031, 0x004d, 0x0041, - 0x001d, 0x0028, 0x001e, 0x0028, 0x001b, 0x0021, 0x002a, 0x0010, - 0x0016, 0x0014, 0x0025, 0x003d, 0x0038, 0x004f, 0x0049, 0x0040, - 0x002b, 0x004c, 0x0038, 0x0025, 0x001a, 0x001f, 0x0019, 0x000e, - 0x0023, 0x0010, 0x003c, 0x0039, 0x0061, 0x004b, 0x0072, 0x005b, - 0x0036, 0x0049, 0x0037, 0x0029, 0x0030, 0x0035, 0x0017, 0x0018, - 0x003a, 0x001b, 0x0032, 0x0060, 0x004c, 0x0046, 0x005d, 0x0054, - 0x004d, 0x003a, 0x004f, 0x001d, 0x004a, 0x0031, 0x0029, 0x0011, - 0x002f, 0x002d, 0x004e, 0x004a, 0x0073, 0x005e, 0x005a, 0x004f, - 0x0045, 0x0053, 0x0047, 0x0032, 0x003b, 0x0026, 0x0024, 0x000f, - 0x0048, 0x0022, 0x0038, 0x005f, 0x005c, 0x0055, 0x005b, 0x005a, - 0x0056, 0x0049, 0x004d, 0x0041, 0x0033, 0x002c, 0x002b, 0x002a, - 0x002b, 0x0014, 0x001e, 0x002c, 0x0037, 0x004e, 0x0048, 0x0057, - 0x004e, 0x003d, 0x002e, 0x0036, 0x0025, 0x001e, 0x0014, 0x0010, - 0x0035, 0x0019, 0x0029, 0x0025, 0x002c, 0x003b, 0x0036, 0x0051, - 0x0042, 0x004c, 0x0039, 0x0036, 0x0025, 0x0012, 0x0027, 0x000b, - 0x0023, 0x0021, 0x001f, 0x0039, 0x002a, 0x0052, 0x0048, 0x0050, - 0x002f, 0x003a, 0x0037, 0x0015, 0x0016, 0x001a, 0x0026, 0x0016, - 0x0035, 0x0019, 0x0017, 0x0026, 0x0046, 0x003c, 0x0033, 0x0024, - 0x0037, 0x001a, 0x0022, 0x0017, 0x001b, 0x000e, 0x0009, 0x0007, - 0x0022, 0x0020, 0x001c, 0x0027, 0x0031, 0x004b, 0x001e, 0x0034, - 0x0030, 0x0028, 0x0034, 0x001c, 0x0012, 0x0011, 0x0009, 0x0005, - 0x002d, 0x0015, 0x0022, 0x0040, 0x0038, 0x0032, 0x0031, 0x002d, - 0x001f, 0x0013, 0x000c, 0x000f, 0x000a, 0x0007, 0x0006, 0x0003, - 0x0030, 0x0017, 0x0014, 0x0027, 0x0024, 0x0023, 0x0035, 0x0015, - 0x0010, 0x0017, 0x000d, 0x000a, 0x0006, 0x0001, 0x0004, 0x0002, - 0x0010, 0x000f, 0x0011, 0x001b, 0x0019, 0x0014, 0x001d, 0x000b, - 0x0011, 0x000c, 0x0010, 0x0008, 0x0001, 0x0001, 0x0000, 0x0001, -}; - -static const uint8_t mpa_huffbits_13[256] = { - 1, 4, 6, 7, 8, 9, 9, 10, - 9, 10, 11, 11, 12, 12, 13, 13, - 3, 4, 6, 7, 8, 8, 9, 9, - 9, 9, 10, 10, 11, 12, 12, 12, - 6, 6, 7, 8, 9, 9, 10, 10, - 9, 10, 10, 11, 11, 12, 13, 13, - 7, 7, 8, 9, 9, 10, 10, 10, - 10, 11, 11, 11, 11, 12, 13, 13, - 8, 7, 9, 9, 10, 10, 11, 11, - 10, 11, 11, 12, 12, 13, 13, 14, - 9, 8, 9, 10, 10, 10, 11, 11, - 11, 11, 12, 11, 13, 13, 14, 14, - 9, 9, 10, 10, 11, 11, 11, 11, - 11, 12, 12, 12, 13, 13, 14, 14, - 10, 9, 10, 11, 11, 11, 12, 12, - 12, 12, 13, 13, 13, 14, 16, 16, - 9, 8, 9, 10, 10, 11, 11, 12, - 12, 12, 12, 13, 13, 14, 15, 15, - 10, 9, 10, 10, 11, 11, 11, 13, - 12, 13, 13, 14, 14, 14, 16, 15, - 10, 10, 10, 11, 11, 12, 12, 13, - 12, 13, 14, 13, 14, 15, 16, 17, - 11, 10, 10, 11, 12, 12, 12, 12, - 13, 13, 13, 14, 15, 15, 15, 16, - 11, 11, 11, 12, 12, 13, 12, 13, - 14, 14, 15, 15, 15, 16, 16, 16, - 12, 11, 12, 13, 13, 13, 14, 14, - 14, 14, 14, 15, 16, 15, 16, 16, - 13, 12, 12, 13, 13, 13, 15, 14, - 14, 17, 15, 15, 15, 17, 16, 16, - 12, 12, 13, 14, 14, 14, 15, 14, - 15, 15, 16, 16, 19, 18, 19, 16, -}; - -static const uint16_t mpa_huffcodes_15[256] = { - 0x0007, 0x000c, 0x0012, 0x0035, 0x002f, 0x004c, 0x007c, 0x006c, - 0x0059, 0x007b, 0x006c, 0x0077, 0x006b, 0x0051, 0x007a, 0x003f, - 0x000d, 0x0005, 0x0010, 0x001b, 0x002e, 0x0024, 0x003d, 0x0033, - 0x002a, 0x0046, 0x0034, 0x0053, 0x0041, 0x0029, 0x003b, 0x0024, - 0x0013, 0x0011, 0x000f, 0x0018, 0x0029, 0x0022, 0x003b, 0x0030, - 0x0028, 0x0040, 0x0032, 0x004e, 0x003e, 0x0050, 0x0038, 0x0021, - 0x001d, 0x001c, 0x0019, 0x002b, 0x0027, 0x003f, 0x0037, 0x005d, - 0x004c, 0x003b, 0x005d, 0x0048, 0x0036, 0x004b, 0x0032, 0x001d, - 0x0034, 0x0016, 0x002a, 0x0028, 0x0043, 0x0039, 0x005f, 0x004f, - 0x0048, 0x0039, 0x0059, 0x0045, 0x0031, 0x0042, 0x002e, 0x001b, - 0x004d, 0x0025, 0x0023, 0x0042, 0x003a, 0x0034, 0x005b, 0x004a, - 0x003e, 0x0030, 0x004f, 0x003f, 0x005a, 0x003e, 0x0028, 0x0026, - 0x007d, 0x0020, 0x003c, 0x0038, 0x0032, 0x005c, 0x004e, 0x0041, - 0x0037, 0x0057, 0x0047, 0x0033, 0x0049, 0x0033, 0x0046, 0x001e, - 0x006d, 0x0035, 0x0031, 0x005e, 0x0058, 0x004b, 0x0042, 0x007a, - 0x005b, 0x0049, 0x0038, 0x002a, 0x0040, 0x002c, 0x0015, 0x0019, - 0x005a, 0x002b, 0x0029, 0x004d, 0x0049, 0x003f, 0x0038, 0x005c, - 0x004d, 0x0042, 0x002f, 0x0043, 0x0030, 0x0035, 0x0024, 0x0014, - 0x0047, 0x0022, 0x0043, 0x003c, 0x003a, 0x0031, 0x0058, 0x004c, - 0x0043, 0x006a, 0x0047, 0x0036, 0x0026, 0x0027, 0x0017, 0x000f, - 0x006d, 0x0035, 0x0033, 0x002f, 0x005a, 0x0052, 0x003a, 0x0039, - 0x0030, 0x0048, 0x0039, 0x0029, 0x0017, 0x001b, 0x003e, 0x0009, - 0x0056, 0x002a, 0x0028, 0x0025, 0x0046, 0x0040, 0x0034, 0x002b, - 0x0046, 0x0037, 0x002a, 0x0019, 0x001d, 0x0012, 0x000b, 0x000b, - 0x0076, 0x0044, 0x001e, 0x0037, 0x0032, 0x002e, 0x004a, 0x0041, - 0x0031, 0x0027, 0x0018, 0x0010, 0x0016, 0x000d, 0x000e, 0x0007, - 0x005b, 0x002c, 0x0027, 0x0026, 0x0022, 0x003f, 0x0034, 0x002d, - 0x001f, 0x0034, 0x001c, 0x0013, 0x000e, 0x0008, 0x0009, 0x0003, - 0x007b, 0x003c, 0x003a, 0x0035, 0x002f, 0x002b, 0x0020, 0x0016, - 0x0025, 0x0018, 0x0011, 0x000c, 0x000f, 0x000a, 0x0002, 0x0001, - 0x0047, 0x0025, 0x0022, 0x001e, 0x001c, 0x0014, 0x0011, 0x001a, - 0x0015, 0x0010, 0x000a, 0x0006, 0x0008, 0x0006, 0x0002, 0x0000, -}; - -static const uint8_t mpa_huffbits_15[256] = { - 3, 4, 5, 7, 7, 8, 9, 9, - 9, 10, 10, 11, 11, 11, 12, 13, - 4, 3, 5, 6, 7, 7, 8, 8, - 8, 9, 9, 10, 10, 10, 11, 11, - 5, 5, 5, 6, 7, 7, 8, 8, - 8, 9, 9, 10, 10, 11, 11, 11, - 6, 6, 6, 7, 7, 8, 8, 9, - 9, 9, 10, 10, 10, 11, 11, 11, - 7, 6, 7, 7, 8, 8, 9, 9, - 9, 9, 10, 10, 10, 11, 11, 11, - 8, 7, 7, 8, 8, 8, 9, 9, - 9, 9, 10, 10, 11, 11, 11, 12, - 9, 7, 8, 8, 8, 9, 9, 9, - 9, 10, 10, 10, 11, 11, 12, 12, - 9, 8, 8, 9, 9, 9, 9, 10, - 10, 10, 10, 10, 11, 11, 11, 12, - 9, 8, 8, 9, 9, 9, 9, 10, - 10, 10, 10, 11, 11, 12, 12, 12, - 9, 8, 9, 9, 9, 9, 10, 10, - 10, 11, 11, 11, 11, 12, 12, 12, - 10, 9, 9, 9, 10, 10, 10, 10, - 10, 11, 11, 11, 11, 12, 13, 12, - 10, 9, 9, 9, 10, 10, 10, 10, - 11, 11, 11, 11, 12, 12, 12, 13, - 11, 10, 9, 10, 10, 10, 11, 11, - 11, 11, 11, 11, 12, 12, 13, 13, - 11, 10, 10, 10, 10, 11, 11, 11, - 11, 12, 12, 12, 12, 12, 13, 13, - 12, 11, 11, 11, 11, 11, 11, 11, - 12, 12, 12, 12, 13, 13, 12, 13, - 12, 11, 11, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 13, 13, 13, 13, -}; - -static const uint16_t mpa_huffcodes_16[256] = { - 0x0001, 0x0005, 0x000e, 0x002c, 0x004a, 0x003f, 0x006e, 0x005d, - 0x00ac, 0x0095, 0x008a, 0x00f2, 0x00e1, 0x00c3, 0x0178, 0x0011, - 0x0003, 0x0004, 0x000c, 0x0014, 0x0023, 0x003e, 0x0035, 0x002f, - 0x0053, 0x004b, 0x0044, 0x0077, 0x00c9, 0x006b, 0x00cf, 0x0009, - 0x000f, 0x000d, 0x0017, 0x0026, 0x0043, 0x003a, 0x0067, 0x005a, - 0x00a1, 0x0048, 0x007f, 0x0075, 0x006e, 0x00d1, 0x00ce, 0x0010, - 0x002d, 0x0015, 0x0027, 0x0045, 0x0040, 0x0072, 0x0063, 0x0057, - 0x009e, 0x008c, 0x00fc, 0x00d4, 0x00c7, 0x0183, 0x016d, 0x001a, - 0x004b, 0x0024, 0x0044, 0x0041, 0x0073, 0x0065, 0x00b3, 0x00a4, - 0x009b, 0x0108, 0x00f6, 0x00e2, 0x018b, 0x017e, 0x016a, 0x0009, - 0x0042, 0x001e, 0x003b, 0x0038, 0x0066, 0x00b9, 0x00ad, 0x0109, - 0x008e, 0x00fd, 0x00e8, 0x0190, 0x0184, 0x017a, 0x01bd, 0x0010, - 0x006f, 0x0036, 0x0034, 0x0064, 0x00b8, 0x00b2, 0x00a0, 0x0085, - 0x0101, 0x00f4, 0x00e4, 0x00d9, 0x0181, 0x016e, 0x02cb, 0x000a, - 0x0062, 0x0030, 0x005b, 0x0058, 0x00a5, 0x009d, 0x0094, 0x0105, - 0x00f8, 0x0197, 0x018d, 0x0174, 0x017c, 0x0379, 0x0374, 0x0008, - 0x0055, 0x0054, 0x0051, 0x009f, 0x009c, 0x008f, 0x0104, 0x00f9, - 0x01ab, 0x0191, 0x0188, 0x017f, 0x02d7, 0x02c9, 0x02c4, 0x0007, - 0x009a, 0x004c, 0x0049, 0x008d, 0x0083, 0x0100, 0x00f5, 0x01aa, - 0x0196, 0x018a, 0x0180, 0x02df, 0x0167, 0x02c6, 0x0160, 0x000b, - 0x008b, 0x0081, 0x0043, 0x007d, 0x00f7, 0x00e9, 0x00e5, 0x00db, - 0x0189, 0x02e7, 0x02e1, 0x02d0, 0x0375, 0x0372, 0x01b7, 0x0004, - 0x00f3, 0x0078, 0x0076, 0x0073, 0x00e3, 0x00df, 0x018c, 0x02ea, - 0x02e6, 0x02e0, 0x02d1, 0x02c8, 0x02c2, 0x00df, 0x01b4, 0x0006, - 0x00ca, 0x00e0, 0x00de, 0x00da, 0x00d8, 0x0185, 0x0182, 0x017d, - 0x016c, 0x0378, 0x01bb, 0x02c3, 0x01b8, 0x01b5, 0x06c0, 0x0004, - 0x02eb, 0x00d3, 0x00d2, 0x00d0, 0x0172, 0x017b, 0x02de, 0x02d3, - 0x02ca, 0x06c7, 0x0373, 0x036d, 0x036c, 0x0d83, 0x0361, 0x0002, - 0x0179, 0x0171, 0x0066, 0x00bb, 0x02d6, 0x02d2, 0x0166, 0x02c7, - 0x02c5, 0x0362, 0x06c6, 0x0367, 0x0d82, 0x0366, 0x01b2, 0x0000, - 0x000c, 0x000a, 0x0007, 0x000b, 0x000a, 0x0011, 0x000b, 0x0009, - 0x000d, 0x000c, 0x000a, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, -}; - -static const uint8_t mpa_huffbits_16[256] = { - 1, 4, 6, 8, 9, 9, 10, 10, - 11, 11, 11, 12, 12, 12, 13, 9, - 3, 4, 6, 7, 8, 9, 9, 9, - 10, 10, 10, 11, 12, 11, 12, 8, - 6, 6, 7, 8, 9, 9, 10, 10, - 11, 10, 11, 11, 11, 12, 12, 9, - 8, 7, 8, 9, 9, 10, 10, 10, - 11, 11, 12, 12, 12, 13, 13, 10, - 9, 8, 9, 9, 10, 10, 11, 11, - 11, 12, 12, 12, 13, 13, 13, 9, - 9, 8, 9, 9, 10, 11, 11, 12, - 11, 12, 12, 13, 13, 13, 14, 10, - 10, 9, 9, 10, 11, 11, 11, 11, - 12, 12, 12, 12, 13, 13, 14, 10, - 10, 9, 10, 10, 11, 11, 11, 12, - 12, 13, 13, 13, 13, 15, 15, 10, - 10, 10, 10, 11, 11, 11, 12, 12, - 13, 13, 13, 13, 14, 14, 14, 10, - 11, 10, 10, 11, 11, 12, 12, 13, - 13, 13, 13, 14, 13, 14, 13, 11, - 11, 11, 10, 11, 12, 12, 12, 12, - 13, 14, 14, 14, 15, 15, 14, 10, - 12, 11, 11, 11, 12, 12, 13, 14, - 14, 14, 14, 14, 14, 13, 14, 11, - 12, 12, 12, 12, 12, 13, 13, 13, - 13, 15, 14, 14, 14, 14, 16, 11, - 14, 12, 12, 12, 13, 13, 14, 14, - 14, 16, 15, 15, 15, 17, 15, 11, - 13, 13, 11, 12, 14, 14, 13, 14, - 14, 15, 16, 15, 17, 15, 14, 11, - 9, 8, 8, 9, 9, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 8, -}; - -static const uint16_t mpa_huffcodes_24[256] = { - 0x000f, 0x000d, 0x002e, 0x0050, 0x0092, 0x0106, 0x00f8, 0x01b2, - 0x01aa, 0x029d, 0x028d, 0x0289, 0x026d, 0x0205, 0x0408, 0x0058, - 0x000e, 0x000c, 0x0015, 0x0026, 0x0047, 0x0082, 0x007a, 0x00d8, - 0x00d1, 0x00c6, 0x0147, 0x0159, 0x013f, 0x0129, 0x0117, 0x002a, - 0x002f, 0x0016, 0x0029, 0x004a, 0x0044, 0x0080, 0x0078, 0x00dd, - 0x00cf, 0x00c2, 0x00b6, 0x0154, 0x013b, 0x0127, 0x021d, 0x0012, - 0x0051, 0x0027, 0x004b, 0x0046, 0x0086, 0x007d, 0x0074, 0x00dc, - 0x00cc, 0x00be, 0x00b2, 0x0145, 0x0137, 0x0125, 0x010f, 0x0010, - 0x0093, 0x0048, 0x0045, 0x0087, 0x007f, 0x0076, 0x0070, 0x00d2, - 0x00c8, 0x00bc, 0x0160, 0x0143, 0x0132, 0x011d, 0x021c, 0x000e, - 0x0107, 0x0042, 0x0081, 0x007e, 0x0077, 0x0072, 0x00d6, 0x00ca, - 0x00c0, 0x00b4, 0x0155, 0x013d, 0x012d, 0x0119, 0x0106, 0x000c, - 0x00f9, 0x007b, 0x0079, 0x0075, 0x0071, 0x00d7, 0x00ce, 0x00c3, - 0x00b9, 0x015b, 0x014a, 0x0134, 0x0123, 0x0110, 0x0208, 0x000a, - 0x01b3, 0x0073, 0x006f, 0x006d, 0x00d3, 0x00cb, 0x00c4, 0x00bb, - 0x0161, 0x014c, 0x0139, 0x012a, 0x011b, 0x0213, 0x017d, 0x0011, - 0x01ab, 0x00d4, 0x00d0, 0x00cd, 0x00c9, 0x00c1, 0x00ba, 0x00b1, - 0x00a9, 0x0140, 0x012f, 0x011e, 0x010c, 0x0202, 0x0179, 0x0010, - 0x014f, 0x00c7, 0x00c5, 0x00bf, 0x00bd, 0x00b5, 0x00ae, 0x014d, - 0x0141, 0x0131, 0x0121, 0x0113, 0x0209, 0x017b, 0x0173, 0x000b, - 0x029c, 0x00b8, 0x00b7, 0x00b3, 0x00af, 0x0158, 0x014b, 0x013a, - 0x0130, 0x0122, 0x0115, 0x0212, 0x017f, 0x0175, 0x016e, 0x000a, - 0x028c, 0x015a, 0x00ab, 0x00a8, 0x00a4, 0x013e, 0x0135, 0x012b, - 0x011f, 0x0114, 0x0107, 0x0201, 0x0177, 0x0170, 0x016a, 0x0006, - 0x0288, 0x0142, 0x013c, 0x0138, 0x0133, 0x012e, 0x0124, 0x011c, - 0x010d, 0x0105, 0x0200, 0x0178, 0x0172, 0x016c, 0x0167, 0x0004, - 0x026c, 0x012c, 0x0128, 0x0126, 0x0120, 0x011a, 0x0111, 0x010a, - 0x0203, 0x017c, 0x0176, 0x0171, 0x016d, 0x0169, 0x0165, 0x0002, - 0x0409, 0x0118, 0x0116, 0x0112, 0x010b, 0x0108, 0x0103, 0x017e, - 0x017a, 0x0174, 0x016f, 0x016b, 0x0168, 0x0166, 0x0164, 0x0000, - 0x002b, 0x0014, 0x0013, 0x0011, 0x000f, 0x000d, 0x000b, 0x0009, - 0x0007, 0x0006, 0x0004, 0x0007, 0x0005, 0x0003, 0x0001, 0x0003, -}; - -static const uint8_t mpa_huffbits_24[256] = { - 4, 4, 6, 7, 8, 9, 9, 10, - 10, 11, 11, 11, 11, 11, 12, 9, - 4, 4, 5, 6, 7, 8, 8, 9, - 9, 9, 10, 10, 10, 10, 10, 8, - 6, 5, 6, 7, 7, 8, 8, 9, - 9, 9, 9, 10, 10, 10, 11, 7, - 7, 6, 7, 7, 8, 8, 8, 9, - 9, 9, 9, 10, 10, 10, 10, 7, - 8, 7, 7, 8, 8, 8, 8, 9, - 9, 9, 10, 10, 10, 10, 11, 7, - 9, 7, 8, 8, 8, 8, 9, 9, - 9, 9, 10, 10, 10, 10, 10, 7, - 9, 8, 8, 8, 8, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 11, 7, - 10, 8, 8, 8, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 11, 11, 8, - 10, 9, 9, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 11, 11, 8, - 10, 9, 9, 9, 9, 9, 9, 10, - 10, 10, 10, 10, 11, 11, 11, 8, - 11, 9, 9, 9, 9, 10, 10, 10, - 10, 10, 10, 11, 11, 11, 11, 8, - 11, 10, 9, 9, 9, 10, 10, 10, - 10, 10, 10, 11, 11, 11, 11, 8, - 11, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 11, 11, 11, 11, 11, 8, - 11, 10, 10, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 8, - 12, 10, 10, 10, 10, 10, 10, 11, - 11, 11, 11, 11, 11, 11, 11, 8, - 8, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 8, 8, 8, 8, 4, -}; - -static const HuffTable mpa_huff_tables[16] = { -{ 1, NULL, NULL }, -{ 2, mpa_huffbits_1, mpa_huffcodes_1 }, -{ 3, mpa_huffbits_2, mpa_huffcodes_2 }, -{ 3, mpa_huffbits_3, mpa_huffcodes_3 }, -{ 4, mpa_huffbits_5, mpa_huffcodes_5 }, -{ 4, mpa_huffbits_6, mpa_huffcodes_6 }, -{ 6, mpa_huffbits_7, mpa_huffcodes_7 }, -{ 6, mpa_huffbits_8, mpa_huffcodes_8 }, -{ 6, mpa_huffbits_9, mpa_huffcodes_9 }, -{ 8, mpa_huffbits_10, mpa_huffcodes_10 }, -{ 8, mpa_huffbits_11, mpa_huffcodes_11 }, -{ 8, mpa_huffbits_12, mpa_huffcodes_12 }, -{ 16, mpa_huffbits_13, mpa_huffcodes_13 }, -{ 16, mpa_huffbits_15, mpa_huffcodes_15 }, -{ 16, mpa_huffbits_16, mpa_huffcodes_16 }, -{ 16, mpa_huffbits_24, mpa_huffcodes_24 }, -}; - -static const uint8_t mpa_huff_data[32][2] = { -{ 0, 0 }, -{ 1, 0 }, -{ 2, 0 }, -{ 3, 0 }, -{ 0, 0 }, -{ 4, 0 }, -{ 5, 0 }, -{ 6, 0 }, -{ 7, 0 }, -{ 8, 0 }, -{ 9, 0 }, -{ 10, 0 }, -{ 11, 0 }, -{ 12, 0 }, -{ 0, 0 }, -{ 13, 0 }, -{ 14, 1 }, -{ 14, 2 }, -{ 14, 3 }, -{ 14, 4 }, -{ 14, 6 }, -{ 14, 8 }, -{ 14, 10 }, -{ 14, 13 }, -{ 15, 4 }, -{ 15, 5 }, -{ 15, 6 }, -{ 15, 7 }, -{ 15, 8 }, -{ 15, 9 }, -{ 15, 11 }, -{ 15, 13 }, -}; - - -/* huffman tables for quadrules */ -static const uint8_t mpa_quad_codes[2][16] = { - { 1, 5, 4, 5, 6, 5, 4, 4, 7, 3, 6, 0, 7, 2, 3, 1, }, - { 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, }, -}; - -static const uint8_t mpa_quad_bits[2][16] = { - { 1, 4, 4, 5, 4, 6, 5, 6, 4, 5, 5, 6, 5, 6, 6, 6, }, - { 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, }, -}; - -/* band size tables */ -static const uint8_t band_size_long[9][22] = { -{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10, - 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */ -{ 4, 4, 4, 4, 4, 4, 6, 6, 6, 8, 10, - 12, 16, 18, 22, 28, 34, 40, 46, 54, 54, 192, }, /* 48000 */ -{ 4, 4, 4, 4, 4, 4, 6, 6, 8, 10, 12, - 16, 20, 24, 30, 38, 46, 56, 68, 84, 102, 26, }, /* 32000 */ -{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 22050 */ -{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 18, 22, 26, 32, 38, 46, 52, 64, 70, 76, 36, }, /* 24000 */ -{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 16000 */ -{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 11025 */ -{ 6, 6, 6, 6, 6, 6, 8, 10, 12, 14, 16, - 20, 24, 28, 32, 38, 46, 52, 60, 68, 58, 54, }, /* 12000 */ -{ 12, 12, 12, 12, 12, 12, 16, 20, 24, 28, 32, - 40, 48, 56, 64, 76, 90, 2, 2, 2, 2, 2, }, /* 8000 */ -}; - -static const uint8_t band_size_short[9][13] = { -{ 4, 4, 4, 4, 6, 8, 10, 12, 14, 18, 22, 30, 56, }, /* 44100 */ -{ 4, 4, 4, 4, 6, 6, 10, 12, 14, 16, 20, 26, 66, }, /* 48000 */ -{ 4, 4, 4, 4, 6, 8, 12, 16, 20, 26, 34, 42, 12, }, /* 32000 */ -{ 4, 4, 4, 6, 6, 8, 10, 14, 18, 26, 32, 42, 18, }, /* 22050 */ -{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 32, 44, 12, }, /* 24000 */ -{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 16000 */ -{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 11025 */ -{ 4, 4, 4, 6, 8, 10, 12, 14, 18, 24, 30, 40, 18, }, /* 12000 */ -{ 8, 8, 8, 12, 16, 20, 24, 28, 36, 2, 2, 2, 26, }, /* 8000 */ -}; - -static const uint8_t mpa_pretab[2][22] = { - { 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, 0, 1, 1, 1, 1, 2, 2, 3, 3, 3, 2, 0 }, -}; - -/* table for alias reduction (XXX: store it as integer !) */ -static const float ci_table[8] = { - -0.6, -0.535, -0.33, -0.185, -0.095, -0.041, -0.0142, -0.0037, -}; - -#endif /* AVCODEC_MPEGAUDIODECTAB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.c deleted file mode 100644 index ddb742845..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2011 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "mpegaudiodsp.h" -#include "dct.h" -#include "dct32.h" - -av_cold void ff_mpadsp_init(MPADSPContext *s) -{ - DCTContext dct; - - ff_dct_init(&dct, 5, DCT_II); - ff_init_mpadsp_tabs_float(); - ff_init_mpadsp_tabs_fixed(); - - s->apply_window_float = ff_mpadsp_apply_window_float; - s->apply_window_fixed = ff_mpadsp_apply_window_fixed; - - s->dct32_float = dct.dct32; - s->dct32_fixed = ff_dct32_fixed; - - s->imdct36_blocks_float = ff_imdct36_blocks_float; - s->imdct36_blocks_fixed = ff_imdct36_blocks_fixed; - - if (ARCH_ARM) ff_mpadsp_init_arm(s); - if (ARCH_PPC) ff_mpadsp_init_ppc(s); - if (ARCH_X86) ff_mpadsp_init_x86(s); - if (HAVE_MIPSFPU) ff_mpadsp_init_mipsfpu(s); - if (HAVE_MIPSDSPR1) ff_mpadsp_init_mipsdspr1(s); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.h deleted file mode 100644 index 38c75c7fe..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MPEGAUDIODSP_H -#define AVCODEC_MPEGAUDIODSP_H - -#include -#include "libavutil/common.h" - -typedef struct MPADSPContext { - void (*apply_window_float)(float *synth_buf, float *window, - int *dither_state, float *samples, int incr); - void (*apply_window_fixed)(int32_t *synth_buf, int32_t *window, - int *dither_state, int16_t *samples, int incr); - void (*dct32_float)(float *dst, const float *src); - void (*dct32_fixed)(int *dst, const int *src); - - void (*imdct36_blocks_float)(float *out, float *buf, float *in, - int count, int switch_point, int block_type); - void (*imdct36_blocks_fixed)(int *out, int *buf, int *in, - int count, int switch_point, int block_type); -} MPADSPContext; - -void ff_mpadsp_init(MPADSPContext *s); - -extern int32_t ff_mpa_synth_window_fixed[]; -extern float ff_mpa_synth_window_float[]; - -extern const int32_t ff_mpa_enwindow[257]; - -void ff_mpa_synth_filter_fixed(MPADSPContext *s, - int32_t *synth_buf_ptr, int *synth_buf_offset, - int32_t *window, int *dither_state, - int16_t *samples, int incr, - int32_t *sb_samples); - -void ff_mpa_synth_filter_float(MPADSPContext *s, - float *synth_buf_ptr, int *synth_buf_offset, - float *window, int *dither_state, - float *samples, int incr, - float *sb_samples); - -void ff_mpadsp_init_arm(MPADSPContext *s); -void ff_mpadsp_init_ppc(MPADSPContext *s); -void ff_mpadsp_init_x86(MPADSPContext *s); -void ff_mpadsp_init_mipsfpu(MPADSPContext *s); -void ff_mpadsp_init_mipsdspr1(MPADSPContext *s); - -void ff_mpa_synth_init_float(float *window); -void ff_mpa_synth_init_fixed(int32_t *window); - -void ff_mpadsp_apply_window_float(float *synth_buf, float *window, - int *dither_state, float *samples, - int incr); -void ff_mpadsp_apply_window_fixed(int32_t *synth_buf, int32_t *window, - int *dither_state, int16_t *samples, - int incr); - -void ff_imdct36_blocks_float(float *out, float *buf, float *in, - int count, int switch_point, int block_type); - -void ff_imdct36_blocks_fixed(int *out, int *buf, int *in, - int count, int switch_point, int block_type); - -void ff_init_mpadsp_tabs_float(void); -void ff_init_mpadsp_tabs_fixed(void); - -/** For SSE implementation, MDCT_BUF_SIZE/2 should be 128-bit aligned */ -#define MDCT_BUF_SIZE FFALIGN(36, 2*4) - -extern int ff_mdct_win_fixed[8][MDCT_BUF_SIZE]; -extern float ff_mdct_win_float[8][MDCT_BUF_SIZE]; - -#endif /* AVCODEC_MPEGAUDIODSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_data.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_data.c deleted file mode 100644 index 4550de9b8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_data.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "mpegaudiodsp.h" - -/* half mpeg encoding window (full precision) */ -const int32_t ff_mpa_enwindow[257] = { - 0, -1, -1, -1, -1, -1, -1, -2, - -2, -2, -2, -3, -3, -4, -4, -5, - -5, -6, -7, -7, -8, -9, -10, -11, - -13, -14, -16, -17, -19, -21, -24, -26, - -29, -31, -35, -38, -41, -45, -49, -53, - -58, -63, -68, -73, -79, -85, -91, -97, - -104, -111, -117, -125, -132, -139, -147, -154, - -161, -169, -176, -183, -190, -196, -202, -208, - 213, 218, 222, 225, 227, 228, 228, 227, - 224, 221, 215, 208, 200, 189, 177, 163, - 146, 127, 106, 83, 57, 29, -2, -36, - -72, -111, -153, -197, -244, -294, -347, -401, - -459, -519, -581, -645, -711, -779, -848, -919, - -991, -1064, -1137, -1210, -1283, -1356, -1428, -1498, - -1567, -1634, -1698, -1759, -1817, -1870, -1919, -1962, - -2001, -2032, -2057, -2075, -2085, -2087, -2080, -2063, - 2037, 2000, 1952, 1893, 1822, 1739, 1644, 1535, - 1414, 1280, 1131, 970, 794, 605, 402, 185, - -45, -288, -545, -814, -1095, -1388, -1692, -2006, - -2330, -2663, -3004, -3351, -3705, -4063, -4425, -4788, - -5153, -5517, -5879, -6237, -6589, -6935, -7271, -7597, - -7910, -8209, -8491, -8755, -8998, -9219, -9416, -9585, - -9727, -9838, -9916, -9959, -9966, -9935, -9863, -9750, - -9592, -9389, -9139, -8840, -8492, -8092, -7640, -7134, - 6574, 5959, 5288, 4561, 3776, 2935, 2037, 1082, - 70, -998, -2122, -3300, -4533, -5818, -7154, -8540, - -9975,-11455,-12980,-14548,-16155,-17799,-19478,-21189, --22929,-24694,-26482,-28289,-30112,-31947,-33791,-35640, --37489,-39336,-41176,-43006,-44821,-46617,-48390,-50137, --51853,-53534,-55178,-56778,-58333,-59838,-61289,-62684, --64019,-65290,-66494,-67629,-68692,-69679,-70590,-71420, --72169,-72835,-73415,-73908,-74313,-74630,-74856,-74992, - 75038, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_fixed.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_fixed.c deleted file mode 100644 index 8b69cc2c6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_fixed.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define CONFIG_FLOAT 0 -#include "mpegaudiodsp_template.c" diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_float.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_float.c deleted file mode 100644 index 777cac85f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_float.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define CONFIG_FLOAT 1 -#include "mpegaudiodsp_template.c" diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_template.c deleted file mode 100644 index f79e068a7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiodsp_template.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/attributes.h" -#include "libavutil/mem.h" -#include "dct32.h" -#include "mathops.h" -#include "mpegaudiodsp.h" -#include "mpegaudio.h" - -#if CONFIG_FLOAT -#define RENAME(n) n##_float - -static inline float round_sample(float *sum) -{ - float sum1=*sum; - *sum = 0; - return sum1; -} - -#define MACS(rt, ra, rb) rt+=(ra)*(rb) -#define MULS(ra, rb) ((ra)*(rb)) -#define MULH3(x, y, s) ((s)*(y)*(x)) -#define MLSS(rt, ra, rb) rt-=(ra)*(rb) -#define MULLx(x, y, s) ((y)*(x)) -#define FIXHR(x) ((float)(x)) -#define FIXR(x) ((float)(x)) -#define SHR(a,b) ((a)*(1.0f/(1<<(b)))) - -#else - -#define RENAME(n) n##_fixed -#define OUT_SHIFT (WFRAC_BITS + FRAC_BITS - 15) - -static inline int round_sample(int64_t *sum) -{ - int sum1; - sum1 = (int)((*sum) >> OUT_SHIFT); - *sum &= (1<>(b)) -# define FIXR(a) ((int)((a) * FRAC_ONE + 0.5)) -# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) -#endif - -/** Window for MDCT. Actually only the elements in [0,17] and - [MDCT_BUF_SIZE/2, MDCT_BUF_SIZE/2 + 17] are actually used. The rest - is just to preserve alignment for SIMD implementations. -*/ -DECLARE_ALIGNED(16, INTFLOAT, RENAME(ff_mdct_win))[8][MDCT_BUF_SIZE]; - -DECLARE_ALIGNED(16, MPA_INT, RENAME(ff_mpa_synth_window))[512+256]; - -#define SUM8(op, sum, w, p) \ -{ \ - op(sum, (w)[0 * 64], (p)[0 * 64]); \ - op(sum, (w)[1 * 64], (p)[1 * 64]); \ - op(sum, (w)[2 * 64], (p)[2 * 64]); \ - op(sum, (w)[3 * 64], (p)[3 * 64]); \ - op(sum, (w)[4 * 64], (p)[4 * 64]); \ - op(sum, (w)[5 * 64], (p)[5 * 64]); \ - op(sum, (w)[6 * 64], (p)[6 * 64]); \ - op(sum, (w)[7 * 64], (p)[7 * 64]); \ -} - -#define SUM8P2(sum1, op1, sum2, op2, w1, w2, p) \ -{ \ - INTFLOAT tmp;\ - tmp = p[0 * 64];\ - op1(sum1, (w1)[0 * 64], tmp);\ - op2(sum2, (w2)[0 * 64], tmp);\ - tmp = p[1 * 64];\ - op1(sum1, (w1)[1 * 64], tmp);\ - op2(sum2, (w2)[1 * 64], tmp);\ - tmp = p[2 * 64];\ - op1(sum1, (w1)[2 * 64], tmp);\ - op2(sum2, (w2)[2 * 64], tmp);\ - tmp = p[3 * 64];\ - op1(sum1, (w1)[3 * 64], tmp);\ - op2(sum2, (w2)[3 * 64], tmp);\ - tmp = p[4 * 64];\ - op1(sum1, (w1)[4 * 64], tmp);\ - op2(sum2, (w2)[4 * 64], tmp);\ - tmp = p[5 * 64];\ - op1(sum1, (w1)[5 * 64], tmp);\ - op2(sum2, (w2)[5 * 64], tmp);\ - tmp = p[6 * 64];\ - op1(sum1, (w1)[6 * 64], tmp);\ - op2(sum2, (w2)[6 * 64], tmp);\ - tmp = p[7 * 64];\ - op1(sum1, (w1)[7 * 64], tmp);\ - op2(sum2, (w2)[7 * 64], tmp);\ -} - -void RENAME(ff_mpadsp_apply_window)(MPA_INT *synth_buf, MPA_INT *window, - int *dither_state, OUT_INT *samples, - int incr) -{ - register const MPA_INT *w, *w2, *p; - int j; - OUT_INT *samples2; -#if CONFIG_FLOAT - float sum, sum2; -#else - int64_t sum, sum2; -#endif - - /* copy to avoid wrap */ - memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf)); - - samples2 = samples + 31 * incr; - w = window; - w2 = window + 31; - - sum = *dither_state; - p = synth_buf + 16; - SUM8(MACS, sum, w, p); - p = synth_buf + 48; - SUM8(MLSS, sum, w + 32, p); - *samples = round_sample(&sum); - samples += incr; - w++; - - /* we calculate two samples at the same time to avoid one memory - access per two sample */ - for(j=1;j<16;j++) { - sum2 = 0; - p = synth_buf + 16 + j; - SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); - p = synth_buf + 48 - j; - SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); - - *samples = round_sample(&sum); - samples += incr; - sum += sum2; - *samples2 = round_sample(&sum); - samples2 -= incr; - w++; - w2--; - } - - p = synth_buf + 32; - SUM8(MLSS, sum, w + 32, p); - *samples = round_sample(&sum); - *dither_state= sum; -} - -/* 32 sub band synthesis filter. Input: 32 sub band samples, Output: - 32 samples. */ -void RENAME(ff_mpa_synth_filter)(MPADSPContext *s, MPA_INT *synth_buf_ptr, - int *synth_buf_offset, - MPA_INT *window, int *dither_state, - OUT_INT *samples, int incr, - MPA_INT *sb_samples) -{ - MPA_INT *synth_buf; - int offset; - - offset = *synth_buf_offset; - synth_buf = synth_buf_ptr + offset; - - s->RENAME(dct32)(synth_buf, sb_samples); - s->RENAME(apply_window)(synth_buf, window, dither_state, samples, incr); - - offset = (offset - 32) & 511; - *synth_buf_offset = offset; -} - -av_cold void RENAME(ff_mpa_synth_init)(MPA_INT *window) -{ - int i, j; - - /* max = 18760, max sum over all 16 coefs : 44736 */ - for(i=0;i<257;i++) { - INTFLOAT v; - v = ff_mpa_enwindow[i]; -#if CONFIG_FLOAT - v *= 1.0 / (1LL<<(16 + FRAC_BITS)); -#endif - window[i] = v; - if ((i & 63) != 0) - v = -v; - if (i != 0) - window[512 - i] = v; - } - - - // Needed for avoiding shuffles in ASM implementations - for(i=0; i < 8; i++) - for(j=0; j < 16; j++) - window[512+16*i+j] = window[64*i+32-j]; - - for(i=0; i < 8; i++) - for(j=0; j < 16; j++) - window[512+128+16*i+j] = window[64*i+48-j]; -} - -av_cold void RENAME(ff_init_mpadsp_tabs)(void) -{ - int i, j; - /* compute mdct windows */ - for (i = 0; i < 36; i++) { - for (j = 0; j < 4; j++) { - double d; - - if (j == 2 && i % 3 != 1) - continue; - - d = sin(M_PI * (i + 0.5) / 36.0); - if (j == 1) { - if (i >= 30) d = 0; - else if (i >= 24) d = sin(M_PI * (i - 18 + 0.5) / 12.0); - else if (i >= 18) d = 1; - } else if (j == 3) { - if (i < 6) d = 0; - else if (i < 12) d = sin(M_PI * (i - 6 + 0.5) / 12.0); - else if (i < 18) d = 1; - } - //merge last stage of imdct into the window coefficients - d *= 0.5 * IMDCT_SCALAR / cos(M_PI * (2 * i + 19) / 72); - - if (j == 2) - RENAME(ff_mdct_win)[j][i/3] = FIXHR((d / (1<<5))); - else { - int idx = i < 18 ? i : i + (MDCT_BUF_SIZE/2 - 18); - RENAME(ff_mdct_win)[j][idx] = FIXHR((d / (1<<5))); - } - } - } - - /* NOTE: we do frequency inversion adter the MDCT by changing - the sign of the right window coefs */ - for (j = 0; j < 4; j++) { - for (i = 0; i < MDCT_BUF_SIZE; i += 2) { - RENAME(ff_mdct_win)[j + 4][i ] = RENAME(ff_mdct_win)[j][i ]; - RENAME(ff_mdct_win)[j + 4][i + 1] = -RENAME(ff_mdct_win)[j][i + 1]; - } - } -} -/* cos(pi*i/18) */ -#define C1 FIXHR(0.98480775301220805936/2) -#define C2 FIXHR(0.93969262078590838405/2) -#define C3 FIXHR(0.86602540378443864676/2) -#define C4 FIXHR(0.76604444311897803520/2) -#define C5 FIXHR(0.64278760968653932632/2) -#define C6 FIXHR(0.5/2) -#define C7 FIXHR(0.34202014332566873304/2) -#define C8 FIXHR(0.17364817766693034885/2) - -/* 0.5 / cos(pi*(2*i+1)/36) */ -static const INTFLOAT icos36[9] = { - FIXR(0.50190991877167369479), - FIXR(0.51763809020504152469), //0 - FIXR(0.55168895948124587824), - FIXR(0.61038729438072803416), - FIXR(0.70710678118654752439), //1 - FIXR(0.87172339781054900991), - FIXR(1.18310079157624925896), - FIXR(1.93185165257813657349), //2 - FIXR(5.73685662283492756461), -}; - -/* 0.5 / cos(pi*(2*i+1)/36) */ -static const INTFLOAT icos36h[9] = { - FIXHR(0.50190991877167369479/2), - FIXHR(0.51763809020504152469/2), //0 - FIXHR(0.55168895948124587824/2), - FIXHR(0.61038729438072803416/2), - FIXHR(0.70710678118654752439/2), //1 - FIXHR(0.87172339781054900991/2), - FIXHR(1.18310079157624925896/4), - FIXHR(1.93185165257813657349/4), //2 -// FIXHR(5.73685662283492756461), -}; - -/* using Lee like decomposition followed by hand coded 9 points DCT */ -static void imdct36(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, INTFLOAT *win) -{ - int i, j; - INTFLOAT t0, t1, t2, t3, s0, s1, s2, s3; - INTFLOAT tmp[18], *tmp1, *in1; - - for (i = 17; i >= 1; i--) - in[i] += in[i-1]; - for (i = 17; i >= 3; i -= 2) - in[i] += in[i-2]; - - for (j = 0; j < 2; j++) { - tmp1 = tmp + j; - in1 = in + j; - - t2 = in1[2*4] + in1[2*8] - in1[2*2]; - - t3 = in1[2*0] + SHR(in1[2*6],1); - t1 = in1[2*0] - in1[2*6]; - tmp1[ 6] = t1 - SHR(t2,1); - tmp1[16] = t1 + t2; - - t0 = MULH3(in1[2*2] + in1[2*4] , C2, 2); - t1 = MULH3(in1[2*4] - in1[2*8] , -2*C8, 1); - t2 = MULH3(in1[2*2] + in1[2*8] , -C4, 2); - - tmp1[10] = t3 - t0 - t2; - tmp1[ 2] = t3 + t0 + t1; - tmp1[14] = t3 + t2 - t1; - - tmp1[ 4] = MULH3(in1[2*5] + in1[2*7] - in1[2*1], -C3, 2); - t2 = MULH3(in1[2*1] + in1[2*5], C1, 2); - t3 = MULH3(in1[2*5] - in1[2*7], -2*C7, 1); - t0 = MULH3(in1[2*3], C3, 2); - - t1 = MULH3(in1[2*1] + in1[2*7], -C5, 2); - - tmp1[ 0] = t2 + t3 + t0; - tmp1[12] = t2 + t1 - t0; - tmp1[ 8] = t3 - t1 - t0; - } - - i = 0; - for (j = 0; j < 4; j++) { - t0 = tmp[i]; - t1 = tmp[i + 2]; - s0 = t1 + t0; - s2 = t1 - t0; - - t2 = tmp[i + 1]; - t3 = tmp[i + 3]; - s1 = MULH3(t3 + t2, icos36h[ j], 2); - s3 = MULLx(t3 - t2, icos36 [8 - j], FRAC_BITS); - - t0 = s0 + s1; - t1 = s0 - s1; - out[(9 + j) * SBLIMIT] = MULH3(t1, win[ 9 + j], 1) + buf[4*(9 + j)]; - out[(8 - j) * SBLIMIT] = MULH3(t1, win[ 8 - j], 1) + buf[4*(8 - j)]; - buf[4 * ( 9 + j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + j], 1); - buf[4 * ( 8 - j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 8 - j], 1); - - t0 = s2 + s3; - t1 = s2 - s3; - out[(9 + 8 - j) * SBLIMIT] = MULH3(t1, win[ 9 + 8 - j], 1) + buf[4*(9 + 8 - j)]; - out[ j * SBLIMIT] = MULH3(t1, win[ j], 1) + buf[4*( j)]; - buf[4 * ( 9 + 8 - j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + 8 - j], 1); - buf[4 * ( j )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + j], 1); - i += 4; - } - - s0 = tmp[16]; - s1 = MULH3(tmp[17], icos36h[4], 2); - t0 = s0 + s1; - t1 = s0 - s1; - out[(9 + 4) * SBLIMIT] = MULH3(t1, win[ 9 + 4], 1) + buf[4*(9 + 4)]; - out[(8 - 4) * SBLIMIT] = MULH3(t1, win[ 8 - 4], 1) + buf[4*(8 - 4)]; - buf[4 * ( 9 + 4 )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 9 + 4], 1); - buf[4 * ( 8 - 4 )] = MULH3(t0, win[MDCT_BUF_SIZE/2 + 8 - 4], 1); -} - -void RENAME(ff_imdct36_blocks)(INTFLOAT *out, INTFLOAT *buf, INTFLOAT *in, - int count, int switch_point, int block_type) -{ - int j; - for (j=0 ; j < count; j++) { - /* apply window & overlap with previous buffer */ - - /* select window */ - int win_idx = (switch_point && j < 2) ? 0 : block_type; - INTFLOAT *win = RENAME(ff_mdct_win)[win_idx + (4 & -(j & 1))]; - - imdct36(out, buf, in, win); - - in += 18; - buf += ((j&3) != 3 ? 1 : (72-3)); - out++; - } -} - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiotab.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiotab.h deleted file mode 100644 index 35129e646..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegaudiotab.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * mpeg audio layer 2 tables. Most of them come from the mpeg audio - * specification. - * - * Copyright (c) 2000, 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpeg audio layer 2 tables. - * Most of them come from the mpeg audio specification. - */ - -#ifndef AVCODEC_MPEGAUDIOTAB_H -#define AVCODEC_MPEGAUDIOTAB_H - -#include -#include "mpegaudio.h" - -#define SQRT2 1.41421356237309514547 - -static const int costab32[30] = { - FIX(0.54119610014619701222), - FIX(1.3065629648763763537), - - FIX(0.50979557910415917998), - FIX(2.5629154477415054814), - FIX(0.89997622313641556513), - FIX(0.60134488693504528634), - - FIX(0.5024192861881556782), - FIX(5.1011486186891552563), - FIX(0.78815462345125020249), - FIX(0.64682178335999007679), - FIX(0.56694403481635768927), - FIX(1.0606776859903470633), - FIX(1.7224470982383341955), - FIX(0.52249861493968885462), - - FIX(10.19000812354803287), - FIX(0.674808341455005678), - FIX(1.1694399334328846596), - FIX(0.53104259108978413284), - FIX(2.0577810099534108446), - FIX(0.58293496820613388554), - FIX(0.83934964541552681272), - FIX(0.50547095989754364798), - FIX(3.4076084184687189804), - FIX(0.62250412303566482475), - FIX(0.97256823786196078263), - FIX(0.51544730992262455249), - FIX(1.4841646163141661852), - FIX(0.5531038960344445421), - FIX(0.74453627100229857749), - FIX(0.5006029982351962726), -}; - -static const int bitinv32[32] = { - 0, 16, 8, 24, 4, 20, 12, 28, - 2, 18, 10, 26, 6, 22, 14, 30, - 1, 17, 9, 25, 5, 21, 13, 29, - 3, 19, 11, 27, 7, 23, 15, 31 -}; - - -static int16_t filter_bank[512]; - -static int scale_factor_table[64]; -#ifdef USE_FLOATS -static float scale_factor_inv_table[64]; -#else -static int8_t scale_factor_shift[64]; -static unsigned short scale_factor_mult[64]; -#endif -static unsigned char scale_diff_table[128]; - -/* total number of bits per allocation group */ -static unsigned short total_quant_bits[17]; - -/* signal to noise ratio of each quantification step (could be - computed from quant_steps[]). The values are dB multiplied by 10 -*/ -static const unsigned short quant_snr[17] = { - 70, 110, 160, 208, - 253, 316, 378, 439, - 499, 559, 620, 680, - 740, 800, 861, 920, - 980 -}; - -/* fixed psycho acoustic model. Values of SNR taken from the 'toolame' - project */ -static const float fixed_smr[SBLIMIT] = { - 30, 17, 16, 10, 3, 12, 8, 2.5, - 5, 5, 6, 6, 5, 6, 10, 6, - -4, -10, -21, -30, -42, -55, -68, -75, - -75, -75, -75, -75, -91, -107, -110, -108 -}; - -static const unsigned char nb_scale_factors[4] = { 3, 2, 1, 2 }; - -#endif /* AVCODEC_MPEGAUDIOTAB_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegvideo.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegvideo.h deleted file mode 100644 index 2152af2e1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/mpegvideo.h +++ /dev/null @@ -1,961 +0,0 @@ -/* - * Generic DCT based hybrid video encoder - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * mpegvideo header. - */ - -#ifndef AVCODEC_MPEGVIDEO_H -#define AVCODEC_MPEGVIDEO_H - -#include "avcodec.h" -#include "dsputil.h" -#include "error_resilience.h" -#include "get_bits.h" -#include "h264chroma.h" -#include "hpeldsp.h" -#include "put_bits.h" -#include "ratecontrol.h" -#include "parser.h" -#include "mpeg12data.h" -#include "rl.h" -#include "thread.h" -#include "videodsp.h" - -#include "libavutil/opt.h" -#include "libavutil/timecode.h" - -#define FRAME_SKIPPED 100 ///< return value for header parsers if frame is not coded - -enum OutputFormat { - FMT_MPEG1, - FMT_H261, - FMT_H263, - FMT_MJPEG, -}; - -#define MPEG_BUF_SIZE (16 * 1024) - -#define QMAT_SHIFT_MMX 16 -#define QMAT_SHIFT 21 - -#define MAX_FCODE 7 -#define MAX_MV 4096 - -#define MAX_THREADS 32 -#define MAX_PICTURE_COUNT 36 - -#define ME_MAP_SIZE 64 -#define ME_MAP_SHIFT 3 -#define ME_MAP_MV_BITS 11 - -#define MAX_MB_BYTES (30*16*16*3/8 + 120) - -#define INPLACE_OFFSET 16 - -/* Start codes. */ -#define SEQ_END_CODE 0x000001b7 -#define SEQ_START_CODE 0x000001b3 -#define GOP_START_CODE 0x000001b8 -#define PICTURE_START_CODE 0x00000100 -#define SLICE_MIN_START_CODE 0x00000101 -#define SLICE_MAX_START_CODE 0x000001af -#define EXT_START_CODE 0x000001b5 -#define USER_START_CODE 0x000001b2 - -/** - * Value of Picture.reference when Picture is not a reference picture, but - * is held for delayed output. - */ -#define DELAYED_PIC_REF 4 - -struct MpegEncContext; - -/** - * Picture. - */ -typedef struct Picture{ - struct AVFrame f; - ThreadFrame tf; - - AVBufferRef *qscale_table_buf; - int8_t *qscale_table; - - AVBufferRef *motion_val_buf[2]; - int16_t (*motion_val[2])[2]; - - AVBufferRef *mb_type_buf; - uint32_t *mb_type; - - AVBufferRef *mbskip_table_buf; - uint8_t *mbskip_table; - - AVBufferRef *ref_index_buf[2]; - int8_t *ref_index[2]; - - AVBufferRef *mb_var_buf; - uint16_t *mb_var; ///< Table for MB variances - - AVBufferRef *mc_mb_var_buf; - uint16_t *mc_mb_var; ///< Table for motion compensated MB variances - - int alloc_mb_width; ///< mb_width used to allocate tables - int alloc_mb_height; ///< mb_height used to allocate tables - - AVBufferRef *mb_mean_buf; - uint8_t *mb_mean; ///< Table for MB luminance - - AVBufferRef *hwaccel_priv_buf; - /** - * hardware accelerator private data - */ - void *hwaccel_picture_private; - -#define MB_TYPE_INTRA MB_TYPE_INTRA4x4 //default mb_type if there is just one type -#define IS_INTRA4x4(a) ((a)&MB_TYPE_INTRA4x4) -#define IS_INTRA16x16(a) ((a)&MB_TYPE_INTRA16x16) -#define IS_PCM(a) ((a)&MB_TYPE_INTRA_PCM) -#define IS_INTRA(a) ((a)&7) -#define IS_INTER(a) ((a)&(MB_TYPE_16x16|MB_TYPE_16x8|MB_TYPE_8x16|MB_TYPE_8x8)) -#define IS_SKIP(a) ((a)&MB_TYPE_SKIP) -#define IS_INTRA_PCM(a) ((a)&MB_TYPE_INTRA_PCM) -#define IS_INTERLACED(a) ((a)&MB_TYPE_INTERLACED) -#define IS_DIRECT(a) ((a)&MB_TYPE_DIRECT2) -#define IS_GMC(a) ((a)&MB_TYPE_GMC) -#define IS_16X16(a) ((a)&MB_TYPE_16x16) -#define IS_16X8(a) ((a)&MB_TYPE_16x8) -#define IS_8X16(a) ((a)&MB_TYPE_8x16) -#define IS_8X8(a) ((a)&MB_TYPE_8x8) -#define IS_SUB_8X8(a) ((a)&MB_TYPE_16x16) //note reused -#define IS_SUB_8X4(a) ((a)&MB_TYPE_16x8) //note reused -#define IS_SUB_4X8(a) ((a)&MB_TYPE_8x16) //note reused -#define IS_SUB_4X4(a) ((a)&MB_TYPE_8x8) //note reused -#define IS_ACPRED(a) ((a)&MB_TYPE_ACPRED) -#define IS_QUANT(a) ((a)&MB_TYPE_QUANT) -#define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0<<((part)+2*(list)))) -#define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0|MB_TYPE_P1L0)<<(2*(list)))) ///< does this mb use listX, note does not work if subMBs -#define HAS_CBP(a) ((a)&MB_TYPE_CBP) - - int field_poc[2]; ///< h264 top/bottom POC - int poc; ///< h264 frame POC - int frame_num; ///< h264 frame_num (raw frame_num from slice header) - int mmco_reset; ///< h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET. - int pic_id; /**< h264 pic_num (short -> no wrap version of pic_num, - pic_num & max_pic_num; long -> long_pic_num) */ - int long_ref; ///< 1->long term reference 0->short term reference - int ref_poc[2][2][32]; ///< h264 POCs of the frames/fields used as reference (FIXME need per slice) - int ref_count[2][2]; ///< number of entries in ref_poc (FIXME need per slice) - int mbaff; ///< h264 1 -> MBAFF frame 0-> not MBAFF - int field_picture; ///< whether or not the picture was encoded in separate fields - int sync; ///< has been decoded after a keyframe - - int mb_var_sum; ///< sum of MB variance for current frame - int mc_mb_var_sum; ///< motion compensated MB variance for current frame - - int b_frame_score; - int needs_realloc; ///< Picture needs to be reallocated (eg due to a frame size change) - - int reference; - int shared; - - int crop; - int crop_left; - int crop_top; -} Picture; - -/** - * Motion estimation context. - */ -typedef struct MotionEstContext{ - AVCodecContext *avctx; - int skip; ///< set if ME is skipped for the current MB - int co_located_mv[4][2]; ///< mv from last P-frame for direct mode ME - int direct_basis_mv[4][2]; - uint8_t *scratchpad; ///< data area for the ME algo, so that the ME does not need to malloc/free - uint8_t *best_mb; - uint8_t *temp_mb[2]; - uint8_t *temp; - int best_bits; - uint32_t *map; ///< map to avoid duplicate evaluations - uint32_t *score_map; ///< map to store the scores - unsigned map_generation; - int pre_penalty_factor; - int penalty_factor; /**< an estimate of the bits required to - code a given mv value, e.g. (1,0) takes - more bits than (0,0). We have to - estimate whether any reduction in - residual is worth the extra bits. */ - int sub_penalty_factor; - int mb_penalty_factor; - int flags; - int sub_flags; - int mb_flags; - int pre_pass; ///< = 1 for the pre pass - int dia_size; - int xmin; - int xmax; - int ymin; - int ymax; - int pred_x; - int pred_y; - uint8_t *src[4][4]; - uint8_t *ref[4][4]; - int stride; - int uvstride; - /* temp variables for picture complexity calculation */ - int mc_mb_var_sum_temp; - int mb_var_sum_temp; - int scene_change_score; -/* cmp, chroma_cmp;*/ - op_pixels_func (*hpel_put)[4]; - op_pixels_func (*hpel_avg)[4]; - qpel_mc_func (*qpel_put)[16]; - qpel_mc_func (*qpel_avg)[16]; - uint8_t (*mv_penalty)[MAX_MV*2+1]; ///< amount of bits needed to encode a MV - uint8_t *current_mv_penalty; - int (*sub_motion_search)(struct MpegEncContext * s, - int *mx_ptr, int *my_ptr, int dmin, - int src_index, int ref_index, - int size, int h); -}MotionEstContext; - -/** - * MpegEncContext. - */ -typedef struct MpegEncContext { - AVClass *class; - struct AVCodecContext *avctx; - /* the following parameters must be initialized before encoding */ - int width, height;///< picture size. must be a multiple of 16 - int gop_size; - int intra_only; ///< if true, only intra pictures are generated - int bit_rate; ///< wanted bit rate - enum OutputFormat out_format; ///< output format - int h263_pred; ///< use mpeg4/h263 ac/dc predictions - int pb_frame; ///< PB frame mode (0 = none, 1 = base, 2 = improved) - -/* the following codec id fields are deprecated in favor of codec_id */ - int h263_plus; ///< h263 plus headers - int h263_flv; ///< use flv h263 header - - enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ - int fixed_qscale; ///< fixed qscale if non zero - int encoding; ///< true if we are encoding (vs decoding) - int flags; ///< AVCodecContext.flags (HQ, MV4, ...) - int flags2; ///< AVCodecContext.flags2 - int max_b_frames; ///< max number of b-frames for encoding - int luma_elim_threshold; - int chroma_elim_threshold; - int strict_std_compliance; ///< strictly follow the std (MPEG4, ...) - int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically - int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag - int stream_codec_tag; ///< internal stream_codec_tag upper case converted from avctx stream_codec_tag - /* the following fields are managed internally by the encoder */ - - /* sequence parameters */ - int context_initialized; - int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else - int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else - int picture_number; //FIXME remove, unclear definition - int picture_in_gop_number; ///< 0-> first pic in gop, ... - int mb_width, mb_height; ///< number of MBs horizontally & vertically - int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 - int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing - int b4_stride; ///< 4*mb_width+1 used for some 4x4 block arrays to allow simple addressing - int h_edge_pos, v_edge_pos;///< horizontal / vertical position of the right/bottom edge (pixel replication) - int mb_num; ///< number of MBs of a picture - ptrdiff_t linesize; ///< line size, in bytes, may be different from width - ptrdiff_t uvlinesize; ///< line size, for chroma in bytes, may be different from width - Picture *picture; ///< main picture buffer - Picture **input_picture; ///< next pictures on display order for encoding - Picture **reordered_input_picture; ///< pointer to the next pictures in codedorder for encoding - - int y_dc_scale, c_dc_scale; - int ac_pred; - int block_last_index[12]; ///< last non zero coefficient in block - int h263_aic; ///< Advanded INTRA Coding (AIC) - - /* scantables */ - ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce tha cache usage - ScanTable intra_scantable; - ScanTable intra_h_scantable; - ScanTable intra_v_scantable; - - /* WARNING: changes above this line require updates to hardcoded - * offsets used in asm. */ - - int64_t user_specified_pts; ///< last non-zero pts from AVFrame which was passed into avcodec_encode_video2() - /** - * pts difference between the first and second input frame, used for - * calculating dts of the first frame when there's a delay */ - int64_t dts_delta; - /** - * reordered pts to be used as dts for the next output frame when there's - * a delay */ - int64_t reordered_pts; - - /** bit output */ - PutBitContext pb; - - int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) - int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) - struct MpegEncContext *thread_context[MAX_THREADS]; - int slice_context_count; ///< number of used thread_contexts - - /** - * copy of the previous picture structure. - * note, linesize & data, might not match the previous picture (for field pictures) - */ - Picture last_picture; - - /** - * copy of the next picture structure. - * note, linesize & data, might not match the next picture (for field pictures) - */ - Picture next_picture; - - /** - * copy of the source picture structure for encoding. - * note, linesize & data, might not match the source picture (for field pictures) - */ - Picture new_picture; - - /** - * copy of the current picture structure. - * note, linesize & data, might not match the current picture (for field pictures) - */ - Picture current_picture; ///< buffer to store the decompressed current picture - - Picture *last_picture_ptr; ///< pointer to the previous picture. - Picture *next_picture_ptr; ///< pointer to the next picture (for bidir pred) - Picture *current_picture_ptr; ///< pointer to the current picture - int last_dc[3]; ///< last DC values for MPEG1 - int16_t *dc_val_base; - int16_t *dc_val[3]; ///< used for mpeg4 DC prediction, all 3 arrays must be continuous - const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table - const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table - const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (h263) - uint8_t *coded_block_base; - uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) - int16_t (*ac_val_base)[16]; - int16_t (*ac_val[3])[16]; ///< used for mpeg4 AC prediction, all 3 arrays must be continuous - int mb_skipped; ///< MUST BE SET only during DECODING - uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example) - and used for b-frame encoding & decoding (contains skip table of next P Frame) */ - uint8_t *mbintra_table; ///< used to avoid setting {ac, dc, cbp}-pred stuff to zero on inter MB decoding - uint8_t *cbp_table; ///< used to store cbp, ac_pred for partitioned decoding - uint8_t *pred_dir_table; ///< used to store pred_dir for partitioned decoding - uint8_t *edge_emu_buffer; ///< temporary buffer for if MVs point to out-of-frame data - uint8_t *rd_scratchpad; ///< scratchpad for rate distortion mb decision - uint8_t *obmc_scratchpad; - uint8_t *b_scratchpad; ///< scratchpad used for writing into write only buffers - - int qscale; ///< QP - int chroma_qscale; ///< chroma QP - unsigned int lambda; ///< lagrange multipler used in rate distortion - unsigned int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT - int *lambda_table; - int adaptive_quant; ///< use adaptive quantization - int dquant; ///< qscale difference to prev qscale - int closed_gop; ///< MPEG1/2 GOP is closed - int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... - int vbv_delay; - int last_pict_type; //FIXME removes - int last_non_b_pict_type; ///< used for mpeg4 gmc b-frames & ratecontrol - int droppable; - int frame_rate_index; - AVRational mpeg2_frame_rate_ext; - int last_lambda_for[5]; ///< last lambda for a specific pict type - int skipdct; ///< skip dct and code zero residual - - /* motion compensation */ - int unrestricted_mv; ///< mv can point outside of the coded picture - int h263_long_vectors; ///< use horrible h263v1 long vector mode - - DSPContext dsp; ///< pointers for accelerated dsp functions - H264ChromaContext h264chroma; - HpelDSPContext hdsp; - VideoDSPContext vdsp; - int f_code; ///< forward MV resolution - int b_code; ///< backward MV resolution for B Frames (mpeg4) - int16_t (*p_mv_table_base)[2]; - int16_t (*b_forw_mv_table_base)[2]; - int16_t (*b_back_mv_table_base)[2]; - int16_t (*b_bidir_forw_mv_table_base)[2]; - int16_t (*b_bidir_back_mv_table_base)[2]; - int16_t (*b_direct_mv_table_base)[2]; - int16_t (*p_field_mv_table_base[2][2])[2]; - int16_t (*b_field_mv_table_base[2][2][2])[2]; - int16_t (*p_mv_table)[2]; ///< MV table (1MV per MB) p-frame encoding - int16_t (*b_forw_mv_table)[2]; ///< MV table (1MV per MB) forward mode b-frame encoding - int16_t (*b_back_mv_table)[2]; ///< MV table (1MV per MB) backward mode b-frame encoding - int16_t (*b_bidir_forw_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding - int16_t (*b_bidir_back_mv_table)[2]; ///< MV table (1MV per MB) bidir mode b-frame encoding - int16_t (*b_direct_mv_table)[2]; ///< MV table (1MV per MB) direct mode b-frame encoding - int16_t (*p_field_mv_table[2][2])[2]; ///< MV table (2MV per MB) interlaced p-frame encoding - int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced b-frame encoding - uint8_t (*p_field_select_table[2]); - uint8_t (*b_field_select_table[2][2]); - int me_method; ///< ME algorithm - int mv_dir; -#define MV_DIR_FORWARD 1 -#define MV_DIR_BACKWARD 2 -#define MV_DIRECT 4 ///< bidirectional mode where the difference equals the MV of the last P/S/I-Frame (mpeg4) - int mv_type; -#define MV_TYPE_16X16 0 ///< 1 vector for the whole mb -#define MV_TYPE_8X8 1 ///< 4 vectors (h263, mpeg4 4MV) -#define MV_TYPE_16X8 2 ///< 2 vectors, one per 16x8 block -#define MV_TYPE_FIELD 3 ///< 2 vectors, one per field -#define MV_TYPE_DMV 4 ///< 2 vectors, special mpeg2 Dual Prime Vectors - /**motion vectors for a macroblock - first coordinate : 0 = forward 1 = backward - second " : depend on type - third " : 0 = x, 1 = y - */ - int mv[2][4][2]; - int field_select[2][2]; - int last_mv[2][2][2]; ///< last MV, used for MV prediction in MPEG1 & B-frame MPEG4 - uint8_t *fcode_tab; ///< smallest fcode needed for each MV - int16_t direct_scale_mv[2][64]; ///< precomputed to avoid divisions in ff_mpeg4_set_direct_mv - - MotionEstContext me; - - int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...) - for b-frames rounding mode is always 0 */ - - /* macroblock layer */ - int mb_x, mb_y; - int mb_skip_run; - int mb_intra; - uint16_t *mb_type; ///< Table for candidate MB types for encoding -#define CANDIDATE_MB_TYPE_INTRA 0x01 -#define CANDIDATE_MB_TYPE_INTER 0x02 -#define CANDIDATE_MB_TYPE_INTER4V 0x04 -#define CANDIDATE_MB_TYPE_SKIPPED 0x08 -//#define MB_TYPE_GMC 0x10 - -#define CANDIDATE_MB_TYPE_DIRECT 0x10 -#define CANDIDATE_MB_TYPE_FORWARD 0x20 -#define CANDIDATE_MB_TYPE_BACKWARD 0x40 -#define CANDIDATE_MB_TYPE_BIDIR 0x80 - -#define CANDIDATE_MB_TYPE_INTER_I 0x100 -#define CANDIDATE_MB_TYPE_FORWARD_I 0x200 -#define CANDIDATE_MB_TYPE_BACKWARD_I 0x400 -#define CANDIDATE_MB_TYPE_BIDIR_I 0x800 - -#define CANDIDATE_MB_TYPE_DIRECT0 0x1000 - - int block_index[6]; ///< index to current MB in block based arrays with edges - int block_wrap[6]; - uint8_t *dest[3]; - - int *mb_index2xy; ///< mb_index -> mb_x + mb_y*mb_stride - - /** matrix transmitted in the bitstream */ - uint16_t intra_matrix[64]; - uint16_t chroma_intra_matrix[64]; - uint16_t inter_matrix[64]; - uint16_t chroma_inter_matrix[64]; -#define QUANT_BIAS_SHIFT 8 - int intra_quant_bias; ///< bias for the quantizer - int inter_quant_bias; ///< bias for the quantizer - int min_qcoeff; ///< minimum encodable coefficient - int max_qcoeff; ///< maximum encodable coefficient - int ac_esc_length; ///< num of bits needed to encode the longest esc - uint8_t *intra_ac_vlc_length; - uint8_t *intra_ac_vlc_last_length; - uint8_t *inter_ac_vlc_length; - uint8_t *inter_ac_vlc_last_length; - uint8_t *luma_dc_vlc_length; -#define UNI_AC_ENC_INDEX(run,level) ((run)*128 + (level)) - - int coded_score[12]; - - /** precomputed matrix (combine qscale and DCT renorm) */ - int (*q_intra_matrix)[64]; - int (*q_chroma_intra_matrix)[64]; - int (*q_inter_matrix)[64]; - /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/ - uint16_t (*q_intra_matrix16)[2][64]; - uint16_t (*q_chroma_intra_matrix16)[2][64]; - uint16_t (*q_inter_matrix16)[2][64]; - - /* noise reduction */ - int (*dct_error_sum)[64]; - int dct_count[2]; - uint16_t (*dct_offset)[64]; - - void *opaque; ///< private data for the user - - /* bit rate control */ - int64_t total_bits; - int frame_bits; ///< bits used for the current frame - int stuffing_bits; ///< bits used for stuffing - int next_lambda; ///< next lambda used for retrying to encode a frame - RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c - - /* statistics, used for 2-pass encoding */ - int mv_bits; - int header_bits; - int i_tex_bits; - int p_tex_bits; - int i_count; - int f_count; - int b_count; - int skip_count; - int misc_bits; ///< cbp, mb_type - int last_bits; ///< temp var used for calculating the above vars - - /* error concealment / resync */ - int resync_mb_x; ///< x position of last resync marker - int resync_mb_y; ///< y position of last resync marker - GetBitContext last_resync_gb; ///< used to search for the next resync marker - int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) - int next_p_frame_damaged; ///< set if the next p frame is damaged, to avoid showing trashed b frames - int err_recognition; - - ParseContext parse_context; - - /* H.263 specific */ - int gob_index; - int obmc; ///< overlapped block motion compensation - int showed_packed_warning; ///< flag for having shown the warning about divxs invalid b frames - int mb_info; ///< interval for outputting info about mb offsets as side data - int prev_mb_info, last_mb_info; - uint8_t *mb_info_ptr; - int mb_info_size; - int ehc_mode; - - /* H.263+ specific */ - int umvplus; ///< == H263+ && unrestricted_mv - int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top - int h263_slice_structured; - int alt_inter_vlc; ///< alternative inter vlc - int modified_quant; - int loop_filter; - int custom_pcf; - - /* mpeg4 specific */ - int time_increment_bits; ///< number of bits to represent the fractional part of time - int last_time_base; - int time_base; ///< time in seconds of last I,P,S Frame - int64_t time; ///< time of current frame - int64_t last_non_b_time; - uint16_t pp_time; ///< time distance between the last 2 p,s,i frames - uint16_t pb_time; ///< time distance between the last b and p,s,i frame - uint16_t pp_field_time; - uint16_t pb_field_time; ///< like above, just for interlaced - int shape; - int vol_sprite_usage; - int sprite_width; - int sprite_height; - int sprite_left; - int sprite_top; - int sprite_brightness_change; - int num_sprite_warping_points; - int real_sprite_warping_points; - uint16_t sprite_traj[4][2]; ///< sprite trajectory points - int sprite_offset[2][2]; ///< sprite offset[isChroma][isMVY] - int sprite_delta[2][2]; ///< sprite_delta [isY][isMVY] - int sprite_shift[2]; ///< sprite shift [isChroma] - int mcsel; - int quant_precision; - int quarter_sample; ///< 1->qpel, 0->half pel ME/MC - int scalability; - int hierachy_type; - int enhancement_type; - int new_pred; - int reduced_res_vop; - int aspect_ratio_info; //FIXME remove - int sprite_warping_accuracy; - int low_latency_sprite; - int data_partitioning; ///< data partitioning flag from header - int partitioned_frame; ///< is current frame partitioned - int rvlc; ///< reversible vlc - int resync_marker; ///< could this stream contain resync markers - int low_delay; ///< no reordering needed / has no b-frames - int vo_type; - int vol_control_parameters; ///< does the stream contain the low_delay flag, used to workaround buggy encoders - int intra_dc_threshold; ///< QP above whch the ac VLC should be used for intra dc - int use_intra_dc_vlc; - PutBitContext tex_pb; ///< used for data partitioned VOPs - PutBitContext pb2; ///< used for data partitioned VOPs - int mpeg_quant; - int t_frame; ///< time distance of first I -> B, used for interlaced b frames - int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG4 - int cplx_estimation_trash_i; - int cplx_estimation_trash_p; - int cplx_estimation_trash_b; - - /* divx specific, used to workaround (many) bugs in divx5 */ - int divx_version; - int divx_build; - int divx_packed; - uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them - int bitstream_buffer_size; - unsigned int allocated_bitstream_buffer_size; - - int xvid_build; - - /* lavc specific stuff, used to workaround bugs in libavcodec */ - int lavc_build; - - /* RV10 specific */ - int rv10_version; ///< RV10 version: 0 or 3 - int rv10_first_dc_coded[3]; - int orig_width, orig_height; - - /* MJPEG specific */ - struct MJpegContext *mjpeg_ctx; - int mjpeg_vsample[3]; ///< vertical sampling factors, default = {2, 1, 1} - int mjpeg_hsample[3]; ///< horizontal sampling factors, default = {2, 1, 1} - int esc_pos; - - /* MSMPEG4 specific */ - int mv_table_index; - int rl_table_index; - int rl_chroma_table_index; - int dc_table_index; - int use_skip_mb_code; - int slice_height; ///< in macroblocks - int first_slice_line; ///< used in mpeg4 too to handle resync markers - int flipflop_rounding; - int msmpeg4_version; ///< 0=not msmpeg4, 1=mp41, 2=mp42, 3=mp43/divx3 4=wmv1/7 5=wmv2/8 - int per_mb_rl_table; - int esc3_level_length; - int esc3_run_length; - /** [mb_intra][isChroma][level][run][last] */ - int (*ac_stats)[2][MAX_LEVEL+1][MAX_RUN+1][2]; - int inter_intra_pred; - int mspel; - - /* decompression specific */ - GetBitContext gb; - - /* Mpeg1 specific */ - int gop_picture_number; ///< index of the first picture of a GOP based on fake_pic_num & mpeg1 specific - int last_mv_dir; ///< last mv_dir, used for b frame encoding - int broken_link; ///< no_output_of_prior_pics_flag - uint8_t *vbv_delay_ptr; ///< pointer to vbv_delay in the bitstream - - /* MPEG-2-specific - I wished not to have to support this mess. */ - int progressive_sequence; - int mpeg_f_code[2][2]; - int picture_structure; -/* picture type */ -#define PICT_TOP_FIELD 1 -#define PICT_BOTTOM_FIELD 2 -#define PICT_FRAME 3 - - int intra_dc_precision; - int frame_pred_frame_dct; - int top_field_first; - int concealment_motion_vectors; - int q_scale_type; - int intra_vlc_format; - int alternate_scan; - int repeat_first_field; - int chroma_420_type; - int chroma_format; -#define CHROMA_420 1 -#define CHROMA_422 2 -#define CHROMA_444 3 - int chroma_x_shift;//depend on pix_format, that depend on chroma_format - int chroma_y_shift; - - int progressive_frame; - int full_pel[2]; - int interlaced_dct; - int first_slice; - int first_field; ///< is 1 for the first field of a field picture 0 otherwise - int drop_frame_timecode; ///< timecode is in drop frame format. - int scan_offset; ///< reserve space for SVCD scan offset user data. - - /* RTP specific */ - int rtp_mode; - - char *tc_opt_str; ///< timecode option string - AVTimecode tc; ///< timecode context - - uint8_t *ptr_lastgob; - int swap_uv; //vcr2 codec is an MPEG-2 variant with U and V swapped - int16_t (*pblocks[12])[64]; - - int16_t (*block)[64]; ///< points to one of the following blocks - int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block - int (*decode_mb)(struct MpegEncContext *s, int16_t block[6][64]); // used by some codecs to avoid a switch() -#define SLICE_OK 0 -#define SLICE_ERROR -1 -#define SLICE_END -2 ///= old_ctx->picture && \ - pic < old_ctx->picture + MAX_PICTURE_COUNT) ? \ - &new_ctx->picture[pic - old_ctx->picture] : NULL) - -/* mpegvideo_enc common options */ -#define FF_MPV_FLAG_SKIP_RD 0x0001 -#define FF_MPV_FLAG_STRICT_GOP 0x0002 -#define FF_MPV_FLAG_QP_RD 0x0004 -#define FF_MPV_FLAG_CBP_RD 0x0008 - -#define FF_MPV_OFFSET(x) offsetof(MpegEncContext, x) -#define FF_MPV_OPT_FLAGS (AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM) -#define FF_MPV_COMMON_OPTS \ -{ "mpv_flags", "Flags common for all mpegvideo-based encoders.", FF_MPV_OFFSET(mpv_flags), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS, "mpv_flags" },\ -{ "skip_rd", "RD optimal MB level residual skipping", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_SKIP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ -{ "strict_gop", "Strictly enforce gop size", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_STRICT_GOP }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ -{ "qp_rd", "Use rate distortion optimization for qp selection", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_QP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ -{ "cbp_rd", "use rate distortion optimization for CBP", 0, AV_OPT_TYPE_CONST, { .i64 = FF_MPV_FLAG_CBP_RD }, 0, 0, FF_MPV_OPT_FLAGS, "mpv_flags" },\ -{ "luma_elim_threshold", "single coefficient elimination threshold for luminance (negative values also consider dc coefficient)",\ - FF_MPV_OFFSET(luma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ -{ "chroma_elim_threshold", "single coefficient elimination threshold for chrominance (negative values also consider dc coefficient)",\ - FF_MPV_OFFSET(chroma_elim_threshold), AV_OPT_TYPE_INT, { .i64 = 0 }, INT_MIN, INT_MAX, FF_MPV_OPT_FLAGS },\ -{ "quantizer_noise_shaping", NULL, FF_MPV_OFFSET(quantizer_noise_shaping), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, FF_MPV_OPT_FLAGS }, - -extern const AVOption ff_mpv_generic_options[]; - -#define FF_MPV_GENERIC_CLASS(name) \ -static const AVClass name ## _class = {\ - .class_name = #name " encoder",\ - .item_name = av_default_item_name,\ - .option = ff_mpv_generic_options,\ - .version = LIBAVUTIL_VERSION_INT,\ -}; - -/** - * Set the given MpegEncContext to common defaults (same for encoding - * and decoding). The changed fields will not depend upon the prior - * state of the MpegEncContext. - */ -void ff_MPV_common_defaults(MpegEncContext *s); - -void ff_MPV_decode_defaults(MpegEncContext *s); -int ff_MPV_common_init(MpegEncContext *s); -int ff_mpv_frame_size_alloc(MpegEncContext *s, int linesize); -int ff_MPV_common_frame_size_change(MpegEncContext *s); -void ff_MPV_common_end(MpegEncContext *s); -void ff_MPV_decode_mb(MpegEncContext *s, int16_t block[12][64]); -int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx); -void ff_MPV_frame_end(MpegEncContext *s); -int ff_MPV_encode_init(AVCodecContext *avctx); -int ff_MPV_encode_end(AVCodecContext *avctx); -int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt, - AVFrame *frame, int *got_packet); -void ff_dct_encode_init_x86(MpegEncContext *s); -void ff_MPV_common_init_x86(MpegEncContext *s); -void ff_MPV_common_init_axp(MpegEncContext *s); -void ff_MPV_common_init_arm(MpegEncContext *s); -void ff_MPV_common_init_bfin(MpegEncContext *s); -void ff_MPV_common_init_ppc(MpegEncContext *s); -void ff_clean_intra_table_entries(MpegEncContext *s); -void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, - Picture *last, int y, int h, int picture_structure, - int first_field, int draw_edges, int low_delay, - int v_edge_pos, int h_edge_pos); -void ff_mpeg_draw_horiz_band(MpegEncContext *s, int y, int h); -void ff_mpeg_flush(AVCodecContext *avctx); - -void ff_print_debug_info(MpegEncContext *s, Picture *p, AVFrame *pict); -void ff_print_debug_info2(AVCodecContext *avctx, Picture *p, AVFrame *pict, uint8_t *mbskip_table, - int *low_delay, - int mb_width, int mb_height, int mb_stride, int quarter_sample); - -int ff_mpv_export_qp_table(MpegEncContext *s, AVFrame *f, Picture *p, int qp_type); - -void ff_write_quant_matrix(PutBitContext *pb, uint16_t *matrix); -void ff_release_unused_pictures(MpegEncContext *s, int remove_current); -int ff_find_unused_picture(MpegEncContext *s, int shared); -void ff_denoise_dct(MpegEncContext *s, int16_t *block); -int ff_update_duplicate_context(MpegEncContext *dst, MpegEncContext *src); -int ff_MPV_lowest_referenced_row(MpegEncContext *s, int dir); -void ff_MPV_report_decode_progress(MpegEncContext *s); -int ff_mpeg_update_thread_context(AVCodecContext *dst, const AVCodecContext *src); -void ff_set_qscale(MpegEncContext * s, int qscale); - -void ff_mpeg_er_frame_start(MpegEncContext *s); - -int ff_dct_common_init(MpegEncContext *s); -int ff_dct_encode_init(MpegEncContext *s); -void ff_convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64], - const uint16_t *quant_matrix, int bias, int qmin, int qmax, int intra); -int ff_dct_quantize_c(MpegEncContext *s, int16_t *block, int n, int qscale, int *overflow); - -void ff_init_block_index(MpegEncContext *s); - -void ff_MPV_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, - uint8_t *dest_cr, int dir, - uint8_t **ref_picture, - op_pixels_func (*pix_op)[4], - qpel_mc_func (*qpix_op)[16]); - -/** - * Allocate a Picture. - * The pixels are allocated/set by calling get_buffer() if shared = 0. - */ -int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared); - -extern const enum AVPixelFormat ff_pixfmt_list_420[]; - -/** - * permute block according to permuatation. - * @param last last non zero element in scantable order - */ -void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last); - -static inline void ff_update_block_index(MpegEncContext *s){ - const int block_size= 8 >> s->avctx->lowres; - - s->block_index[0]+=2; - s->block_index[1]+=2; - s->block_index[2]+=2; - s->block_index[3]+=2; - s->block_index[4]++; - s->block_index[5]++; - s->dest[0]+= 2*block_size; - s->dest[1]+= block_size; - s->dest[2]+= block_size; -} - -static inline int get_bits_diff(MpegEncContext *s){ - const int bits= put_bits_count(&s->pb); - const int last= s->last_bits; - - s->last_bits = bits; - - return bits - last; -} - -static inline int ff_h263_round_chroma(int x){ - static const uint8_t h263_chroma_roundtab[16] = { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, - }; - return h263_chroma_roundtab[x & 0xf] + (x >> 3); -} - -/* motion_est.c */ -void ff_estimate_p_frame_motion(MpegEncContext * s, - int mb_x, int mb_y); -void ff_estimate_b_frame_motion(MpegEncContext * s, - int mb_x, int mb_y); -int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type); -void ff_fix_long_p_mvs(MpegEncContext * s); -void ff_fix_long_mvs(MpegEncContext * s, uint8_t *field_select_table, int field_select, - int16_t (*mv_table)[2], int f_code, int type, int truncate); -int ff_init_me(MpegEncContext *s); -int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y); -int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, - int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], - int ref_mv_scale, int size, int h); -int ff_get_mb_score(MpegEncContext * s, int mx, int my, int src_index, - int ref_index, int size, int h, int add_rate); - -/* mpeg12.c */ -extern const uint8_t ff_mpeg1_dc_scale_table[128]; -extern const uint8_t * const ff_mpeg2_dc_scale_table[4]; - -void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number); -void ff_mpeg1_encode_mb(MpegEncContext *s, - int16_t block[6][64], - int motion_x, int motion_y); -void ff_mpeg1_encode_init(MpegEncContext *s); -void ff_mpeg1_encode_slice_header(MpegEncContext *s); - -extern const uint8_t ff_aic_dc_scale_table[32]; -extern const uint8_t ff_h263_chroma_qscale_table[32]; -extern const uint8_t ff_h263_loop_filter_strength[32]; - -/* rv10.c */ -void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number); -int ff_rv_decode_dc(MpegEncContext *s, int n); -void ff_rv20_encode_picture_header(MpegEncContext *s, int picture_number); - - -/* msmpeg4.c */ -void ff_msmpeg4_encode_picture_header(MpegEncContext * s, int picture_number); -void ff_msmpeg4_encode_ext_header(MpegEncContext * s); -void ff_msmpeg4_encode_mb(MpegEncContext * s, - int16_t block[6][64], - int motion_x, int motion_y); -int ff_msmpeg4_decode_picture_header(MpegEncContext * s); -int ff_msmpeg4_decode_ext_header(MpegEncContext * s, int buf_size); -int ff_msmpeg4_decode_init(AVCodecContext *avctx); -void ff_msmpeg4_encode_init(MpegEncContext *s); -int ff_wmv2_decode_picture_header(MpegEncContext * s); -int ff_wmv2_decode_secondary_picture_header(MpegEncContext * s); -void ff_wmv2_add_mb(MpegEncContext *s, int16_t block[6][64], uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr); -void ff_mspel_motion(MpegEncContext *s, - uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, - uint8_t **ref_picture, op_pixels_func (*pix_op)[4], - int motion_x, int motion_y, int h); -int ff_wmv2_encode_picture_header(MpegEncContext * s, int picture_number); -void ff_wmv2_encode_mb(MpegEncContext * s, - int16_t block[6][64], - int motion_x, int motion_y); - -int ff_mpeg_ref_picture(MpegEncContext *s, Picture *dst, Picture *src); -void ff_mpeg_unref_picture(MpegEncContext *s, Picture *picture); - - -#endif /* AVCODEC_MPEGVIDEO_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.c deleted file mode 100644 index 4c4ddb46f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * gsm 06.10 decoder, Microsoft variant - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#define BITSTREAM_READER_LE -#include "avcodec.h" -#include "msgsmdec.h" -#include "gsm.h" -#include "gsmdec_template.c" - -int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, - const uint8_t *buf, int mode) -{ - int res; - GetBitContext gb; - init_get_bits(&gb, buf, GSM_MS_BLOCK_SIZE * 8); - res = gsm_decode_block(avctx, samples, &gb, mode); - if (res < 0) - return res; - return gsm_decode_block(avctx, samples + GSM_FRAME_SIZE, &gb, mode); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.h deleted file mode 100644 index b2a1a627a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/msgsmdec.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * gsm 06.10 decoder, Microsoft variant - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_MSGSMDEC_H -#define AVCODEC_MSGSMDEC_H - -#include "avcodec.h" - -int ff_msgsm_decode_block(AVCodecContext *avctx, int16_t *samples, - const uint8_t *buf, int mode); - -#endif /* AVCODEC_MSGSMDEC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options.c deleted file mode 100644 index 5ee9d6bd7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options.c +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Options definition for AVCodecContext. - */ - -#include "avcodec.h" -#include "internal.h" -#include "libavutil/avassert.h" -#include "libavutil/mem.h" -#include "libavutil/opt.h" -#include /* FLT_MIN, FLT_MAX */ -#include - -#include "options_table.h" - -static const char* context_to_name(void* ptr) { - AVCodecContext *avc= ptr; - - if(avc && avc->codec && avc->codec->name) - return avc->codec->name; - else - return "NULL"; -} - -static void *codec_child_next(void *obj, void *prev) -{ - AVCodecContext *s = obj; - if (!prev && s->codec && s->codec->priv_class && s->priv_data) - return s->priv_data; - return NULL; -} - -static const AVClass *codec_child_class_next(const AVClass *prev) -{ - AVCodec *c = NULL; - - /* find the codec that corresponds to prev */ - while (prev && (c = av_codec_next(c))) - if (c->priv_class == prev) - break; - - /* find next codec with priv options */ - while (c = av_codec_next(c)) - if (c->priv_class) - return c->priv_class; - return NULL; -} - -static AVClassCategory get_category(void *ptr) -{ - AVCodecContext* avctx = ptr; - if(avctx->codec && avctx->codec->decode) return AV_CLASS_CATEGORY_DECODER; - else return AV_CLASS_CATEGORY_ENCODER; -} - -static const AVClass av_codec_context_class = { - .class_name = "AVCodecContext", - .item_name = context_to_name, - .option = avcodec_options, - .version = LIBAVUTIL_VERSION_INT, - .log_level_offset_offset = offsetof(AVCodecContext, log_level_offset), - .child_next = codec_child_next, - .child_class_next = codec_child_class_next, - .category = AV_CLASS_CATEGORY_ENCODER, - .get_category = get_category, -}; - -int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) -{ - int flags=0; - memset(s, 0, sizeof(AVCodecContext)); - - s->av_class = &av_codec_context_class; - - s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN; - if (codec) - s->codec_id = codec->id; - - if(s->codec_type == AVMEDIA_TYPE_AUDIO) - flags= AV_OPT_FLAG_AUDIO_PARAM; - else if(s->codec_type == AVMEDIA_TYPE_VIDEO) - flags= AV_OPT_FLAG_VIDEO_PARAM; - else if(s->codec_type == AVMEDIA_TYPE_SUBTITLE) - flags= AV_OPT_FLAG_SUBTITLE_PARAM; - av_opt_set_defaults2(s, flags, flags); - - s->time_base = (AVRational){0,1}; - s->get_buffer2 = avcodec_default_get_buffer2; - s->get_format = avcodec_default_get_format; - s->execute = avcodec_default_execute; - s->execute2 = avcodec_default_execute2; - s->sample_aspect_ratio = (AVRational){0,1}; - s->pix_fmt = AV_PIX_FMT_NONE; - s->sample_fmt = AV_SAMPLE_FMT_NONE; - s->timecode_frame_start = -1; - - s->reordered_opaque = AV_NOPTS_VALUE; - if(codec && codec->priv_data_size){ - if(!s->priv_data){ - s->priv_data= av_mallocz(codec->priv_data_size); - if (!s->priv_data) { - return AVERROR(ENOMEM); - } - } - if(codec->priv_class){ - *(const AVClass**)s->priv_data = codec->priv_class; - av_opt_set_defaults(s->priv_data); - } - } - if (codec && codec->defaults) { - int ret; - const AVCodecDefault *d = codec->defaults; - while (d->key) { - ret = av_opt_set(s, d->key, d->value, 0); - av_assert0(ret >= 0); - d++; - } - } - return 0; -} - -AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) -{ - AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); - - if(avctx==NULL) return NULL; - - if(avcodec_get_context_defaults3(avctx, codec) < 0){ - av_free(avctx); - return NULL; - } - - return avctx; -} - -int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) -{ - if (avcodec_is_open(dest)) { // check that the dest context is uninitialized - av_log(dest, AV_LOG_ERROR, - "Tried to copy AVCodecContext %p into already-initialized %p\n", - src, dest); - return AVERROR(EINVAL); - } - - av_opt_free(dest); - av_free(dest->priv_data); - - memcpy(dest, src, sizeof(*dest)); - - /* set values specific to opened codecs back to their default state */ - dest->priv_data = NULL; - dest->codec = NULL; - dest->slice_offset = NULL; - dest->hwaccel = NULL; - dest->internal = NULL; - - /* reallocate values that should be allocated separately */ - dest->rc_eq = NULL; - dest->extradata = NULL; - dest->intra_matrix = NULL; - dest->inter_matrix = NULL; - dest->rc_override = NULL; - if (src->rc_eq) { - dest->rc_eq = av_strdup(src->rc_eq); - if (!dest->rc_eq) - return AVERROR(ENOMEM); - } - -#define alloc_and_copy_or_fail(obj, size, pad) \ - if (src->obj && size > 0) { \ - dest->obj = av_malloc(size + pad); \ - if (!dest->obj) \ - goto fail; \ - memcpy(dest->obj, src->obj, size); \ - if (pad) \ - memset(((uint8_t *) dest->obj) + size, 0, pad); \ - } - alloc_and_copy_or_fail(extradata, src->extradata_size, - FF_INPUT_BUFFER_PADDING_SIZE); - alloc_and_copy_or_fail(intra_matrix, 64 * sizeof(int16_t), 0); - alloc_and_copy_or_fail(inter_matrix, 64 * sizeof(int16_t), 0); - alloc_and_copy_or_fail(rc_override, src->rc_override_count * sizeof(*src->rc_override), 0); - alloc_and_copy_or_fail(subtitle_header, src->subtitle_header_size, 1); -#undef alloc_and_copy_or_fail - - return 0; - -fail: - av_freep(&dest->rc_override); - av_freep(&dest->intra_matrix); - av_freep(&dest->inter_matrix); - av_freep(&dest->extradata); - av_freep(&dest->rc_eq); - return AVERROR(ENOMEM); -} - -const AVClass *avcodec_get_class(void) -{ - return &av_codec_context_class; -} - -#define FOFFSET(x) offsetof(AVFrame,x) - -static const AVOption frame_options[]={ -{"best_effort_timestamp", "", FOFFSET(best_effort_timestamp), AV_OPT_TYPE_INT64, {.i64 = AV_NOPTS_VALUE }, INT64_MIN, INT64_MAX, 0}, -{"pkt_pos", "", FOFFSET(pkt_pos), AV_OPT_TYPE_INT64, {.i64 = -1 }, INT64_MIN, INT64_MAX, 0}, -{"pkt_size", "", FOFFSET(pkt_size), AV_OPT_TYPE_INT64, {.i64 = -1 }, INT64_MIN, INT64_MAX, 0}, -{"sample_aspect_ratio", "", FOFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0}, -{"width", "", FOFFSET(width), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"height", "", FOFFSET(height), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"format", "", FOFFSET(format), AV_OPT_TYPE_INT, {.i64 = -1 }, 0, INT_MAX, 0}, -{"channel_layout", "", FOFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, 0}, -{"sample_rate", "", FOFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{NULL}, -}; - -static const AVClass av_frame_class = { - .class_name = "AVFrame", - .item_name = NULL, - .option = frame_options, - .version = LIBAVUTIL_VERSION_INT, -}; - -const AVClass *avcodec_get_frame_class(void) -{ - return &av_frame_class; -} - -#define SROFFSET(x) offsetof(AVSubtitleRect,x) - -static const AVOption subtitle_rect_options[]={ -{"x", "", SROFFSET(x), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"y", "", SROFFSET(y), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"w", "", SROFFSET(w), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"h", "", SROFFSET(h), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"type", "", SROFFSET(type), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, 0}, -{"flags", "", SROFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, 1, 0, "flags"}, -{"forced", "", SROFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, 1, 0}, -{NULL}, -}; - -static const AVClass av_subtitle_rect_class = { - .class_name = "AVSubtitleRect", - .item_name = NULL, - .option = subtitle_rect_options, - .version = LIBAVUTIL_VERSION_INT, -}; - -const AVClass *avcodec_get_subtitle_rect_class(void) -{ - return &av_subtitle_rect_class; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options_table.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options_table.h deleted file mode 100644 index 8c025fe07..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/options_table.h +++ /dev/null @@ -1,395 +0,0 @@ -/* - * Copyright (c) 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_OPTIONS_TABLE_H -#define AVCODEC_OPTIONS_TABLE_H - -#include -#include - -#include "libavutil/opt.h" -#include "avcodec.h" -#include "version.h" - -#define OFFSET(x) offsetof(AVCodecContext,x) -#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C -//these names are too long to be readable -#define V AV_OPT_FLAG_VIDEO_PARAM -#define A AV_OPT_FLAG_AUDIO_PARAM -#define S AV_OPT_FLAG_SUBTITLE_PARAM -#define E AV_OPT_FLAG_ENCODING_PARAM -#define D AV_OPT_FLAG_DECODING_PARAM - -#define AV_CODEC_DEFAULT_BITRATE 200*1000 - -static const AVOption avcodec_options[] = { -{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT_MAX, A|V|E}, -{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = 128*1000 }, 0, INT_MAX, A|E}, -{"bt", "Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far " - "ratecontrol is willing to deviate from the target average bitrate value. This is not related " - "to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality.", - OFFSET(bit_rate_tolerance), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E}, -{"flags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, UINT_MAX, V|A|S|E|D, "flags"}, -{"unaligned", "allow decoders to produce unaligned output", 0, AV_OPT_TYPE_CONST, { .i64 = CODEC_FLAG_UNALIGNED }, INT_MIN, INT_MAX, V | D, "flags" }, -{"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"}, -{"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"}, -{"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"}, -{"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"}, -{"gmc", "use gmc", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"}, -{"mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"}, -{"input_preserved", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"}, -{"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"}, -{"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"}, -{"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"}, -{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"}, -{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"}, -{"truncated", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, 0, "flags"}, -{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"}, -{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"}, -{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"}, -{"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"}, -{"bitexact", "use only bitexact functions (except (I)DCT)", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"}, -{"aic", "H.263 advanced intra coding / MPEG-4 AC prediction", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"}, -{"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"}, -{"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"}, -{"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"ignorecrop", "ignore cropping information from sps", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_IGNORE_CROP }, INT_MIN, INT_MAX, V|D, "flags2"}, -{"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"}, -{"chunks", "Frame data might be split into multiple chunks", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, "flags2"}, -{"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"}, -{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"}, -{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"epzs", "EPZS motion estimation (default)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"esa", "esa motion estimation (alias for full)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"tesa", "tesa motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"dia", "diamond motion estimation (alias for EPZS)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"log", "log motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"phods", "phods motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" }, -{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX}, -{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E}, -{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, -{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E}, -{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E}, -{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E}, -{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. " - "Recommended range for default rc_eq: 0.0-1.0", - OFFSET(qcompress), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -FLT_MAX, FLT_MAX, V|E}, -{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -1, FLT_MAX, V|E}, -{"qmin", "minimum video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.i64 = 2 }, -1, 69, V|E}, -{"qmax", "maximum video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.i64 = 31 }, -1, 1024, V|E}, -{"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E}, -{"bf", "use 'frames' B frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, FF_MAX_B_FRAMES, V|E}, -{"b_qfactor", "QP factor between P- and B-frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E}, -{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"i_tex_bits", NULL, OFFSET(i_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"p_tex_bits", NULL, OFFSET(p_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"i_count", NULL, OFFSET(i_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"p_count", NULL, OFFSET(p_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"skip_count", NULL, OFFSET(skip_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"misc_bits", NULL, OFFSET(misc_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"frame_bits", NULL, OFFSET(frame_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, -{"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"}, -{"old_msmpeg4", "some old lavc-generated MSMPEG4v3 files (no autodetection)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"xvid_ilace", "Xvid interlacing bug (autodetected if FOURCC == XVIX)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"}, -{"amv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ac_vlc", "illegal VLC bug (autodetected per FOURCC)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"}, -{"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, -{"std_qpel", "old standard qpel (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"}, -{"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, "bug"}, -{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_DIRECT_BLOCKSIZE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"edge", "edge padding bug (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_EDGE }, INT_MIN, INT_MAX, V|D, "bug"}, -{"hpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_HPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"}, -{"dc_clip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"}, -{"ms", "work around various bugs in Microsoft's broken decoders", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"}, -{"trunc", "truncated frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"}, -{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|D|E, "strict"}, -{"very", "strictly conform to a older more strict version of the spec or reference software", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"strict", "strictly conform to all the things in the spec no matter what the consequences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"normal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"experimental", "allow non-standardized experimental things", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, V|D|E, "strict"}, -{"b_qoffset", "QP offset between P- and B-frames", OFFSET(b_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E}, -{"err_detect", "set error detection flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"careful", "consider things that violate the spec and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"aggressive", "consider things that a sane encoder should not do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, A|V|D, "err_detect"}, -{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"qsquish", "how to keep quantizer between qmin and qmax (0 = clip, 1 = use differentiable function)", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E}, -{"rc_qmod_amp", "experimental quantizer modulation", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_qmod_freq", "experimental quantizer modulation", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"rc_eq", "Set rate control equation. When computing the expression, besides the standard functions " - "defined in the section 'Expression Evaluation', the following functions are available: " - "bits2qp(bits), qp2bits(qp). Also the following constants are available: iTex pTex tex mv " - "fCode iCount mcVar var isI isP isB avgQP qComp avgIITex avgPITex avgPPTex avgBPTex avgTex.", - OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E}, -{"maxrate", "Set maximum bitrate tolerance (in bits/s). Requires bufsize to be set.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"minrate", "Set minimum bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.", - OFFSET(rc_min_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|E}, -{"rc_buf_aggressivity", "currently useless", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E}, -{"i_qfactor", "QP factor between P- and I-frames", OFFSET(i_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E}, -{"i_qoffset", "QP offset between P- and I-frames", OFFSET(i_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 0.0 }, -FLT_MAX, FLT_MAX, V|E}, -{"rc_init_cplx", "initial complexity for 1-pass encoding", OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"}, -{"auto", "autoselect a good one (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"}, -{"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"}, -{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"}, -{"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"}, -{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"}, -{"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"}, -{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"p_mask", "inter masking", OFFSET(p_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E}, -{"idct", "select IDCT implementation", OFFSET(idct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E|D, "idct"}, -{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"int", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simple", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearmv5te", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplearmv6", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simpleneon", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"simplealpha", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"xvidmmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVIDMMX }, INT_MIN, INT_MAX, V|E|D, "idct"}, -{"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"}, -{"slice_count", NULL, OFFSET(slice_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"ec", "set error concealment strategy", OFFSET(error_concealment), AV_OPT_TYPE_FLAGS, {.i64 = 3 }, INT_MIN, INT_MAX, V|D, "ec"}, -{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"}, -{"deblock", "use strong deblock filter for damaged MBs", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_DEBLOCK }, INT_MIN, INT_MAX, V|D, "ec"}, -{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"pred", "prediction method", OFFSET(prediction_method), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "pred"}, -{"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_LEFT }, INT_MIN, INT_MAX, V|E, "pred"}, -{"plane", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_PLANE }, INT_MIN, INT_MAX, V|E, "pred"}, -{"median", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_MEDIAN }, INT_MIN, INT_MAX, V|E, "pred"}, -{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10, V|E}, -{"debug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|A|S|E|D, "debug"}, -{"pict", "picture info", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PICT_INFO }, INT_MIN, INT_MAX, V|D, "debug"}, -{"rc", "rate control", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_RC }, INT_MIN, INT_MAX, V|E, "debug"}, -{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"}, -{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"}, -{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"}, -{"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"}, -{"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"}, -{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"}, -{"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"}, -{"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"}, -{"vismv", "visualize motion vectors (MVs)", OFFSET(debug_mv), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"}, -{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"}, -{"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"ildctcmp", "interlaced DCT compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"preme", "pre motion estimation", OFFSET(pre_me), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sad", "sum of absolute differences, fast (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"zero", "0", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -#if CONFIG_SNOW_ENCODER -{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -#endif -{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, -{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, -{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E}, -{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"}, -{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"}, -{"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"}, -{"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"}, -{"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"}, -{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"}, -{"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 2, V|E, "mbd"}, -{"simple", "use mbcmp (default)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"}, -{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"lmin", "minimum Lagrange factor (VBR)", OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 2*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, -{"lmax", "maximum Lagrange factor (VBR)", OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 31*FF_QP2LAMBDA }, 0, INT_MAX, V|E}, -{"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"}, -{"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"threads", NULL, OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, "threads"}, -{"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"}, -{"me_threshold", "motion estimation threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E}, -{"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, -{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D}, -{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D}, -{"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, -{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"}, -{"aac_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_ssr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_ltp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_he_v2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE_V2 }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_ld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LD }, INT_MIN, INT_MAX, A|E, "profile"}, -{"aac_eld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_ELD }, INT_MIN, INT_MAX, A|E, "profile"}, -{"mpeg2_aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"}, -{"mpeg2_aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_hd_hra", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_HRA }, INT_MIN, INT_MAX, A|E, "profile"}, -{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"}, -{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, -{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"}, -{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D}, -{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"}, -{"border_mask", "increase the quantizer for macroblocks close to borders", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E}, -{"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E}, -{"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E}, -{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, V|E}, -{"skip_loop_filter", "skip loop filtering process for the selected frames", OFFSET(skip_loop_filter), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"skip_idct" , "skip IDCT/dequantization for the selected frames", OFFSET(skip_idct), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"skip_frame" , "skip decoding for the selected frames", OFFSET(skip_frame), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"none" , "discard no frame", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"default" , "discard useless frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"noref" , "discard all non-reference frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"bidir" , "discard all bidirectional frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"nokey" , "discard all frames except keyframes", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"all" , "discard all frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_ALL }, INT_MIN, INT_MAX, V|D, "avdiscard"}, -{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 4, V|E}, -{"brd_scale", "downscale frames for dynamic B-frame decision", OFFSET(brd_scale), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 10, V|E}, -{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E}, -{"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E}, -{"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, -{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E}, -{"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.i64 = 256 }, 0, INT_MAX, V|E}, -{"b_sensitivity", "adjust sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.i64 = 40 }, 1, INT_MAX, V|E}, -{"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E}, -{"min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E}, -{"max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E}, -{"timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, INT64_MAX, V|E}, -#if FF_API_REQUEST_CHANNELS -{"request_channels", "set desired number of audio channels", OFFSET(request_channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D}, -#endif -{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX}, -{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT64_MAX, A|E|D, "channel_layout"}, -{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT64_MAX, A|D, "request_channel_layout"}, -{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E}, -{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E}, -{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, INT_MAX, A|V|E|D}, -{"color_primaries", NULL, OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64 = AVCOL_PRI_UNSPECIFIED }, 1, AVCOL_PRI_NB-1, V|E|D}, -{"color_trc", NULL, OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, AVCOL_TRC_NB-1, V|E|D}, -{"colorspace", NULL, OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = AVCOL_SPC_UNSPECIFIED }, 1, AVCOL_SPC_NB-1, V|E|D}, -{"color_range", NULL, OFFSET(color_range), AV_OPT_TYPE_INT, {.i64 = AVCOL_RANGE_UNSPECIFIED }, 0, AVCOL_RANGE_NB-1, V|E|D}, -{"chroma_sample_location", NULL, OFFSET(chroma_sample_location), AV_OPT_TYPE_INT, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, 0, AVCHROMA_LOC_NB-1, V|E|D}, -{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX }, -{"slices", "number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E}, -{"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|A|E|D, "thread_type"}, -{"slice", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, -{"frame", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, -{"audio_service_type", "audio service type", OFFSET(audio_service_type), AV_OPT_TYPE_INT, {.i64 = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"}, -{"ma", "Main Audio Service", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"ef", "Effects", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EFFECTS }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"vi", "Visually Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"hi", "Hearing Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"di", "Dialogue", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_DIALOGUE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"co", "Commentary", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_COMMENTARY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"em", "Emergency", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EMERGENCY }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"vo", "Voice Over", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VOICE_OVER }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"ka", "Karaoke", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_KARAOKE }, INT_MIN, INT_MAX, A|E, "audio_service_type"}, -{"request_sample_fmt", "sample format audio decoders should prefer", OFFSET(request_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64=AV_SAMPLE_FMT_NONE}, -1, AV_SAMPLE_FMT_NB-1, A|D, "request_sample_fmt"}, -{"pkt_timebase", NULL, OFFSET(pkt_timebase), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0}, -{"sub_charenc", "set input text subtitles character encoding", OFFSET(sub_charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, S|D}, -{"sub_charenc_mode", "set input text subtitles character encoding mode", OFFSET(sub_charenc_mode), AV_OPT_TYPE_FLAGS, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, -1, INT_MAX, S|D, "sub_charenc_mode"}, -{"do_nothing", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_DO_NOTHING}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, -{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, -{"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"}, -{"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, A|V|D }, -{"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, V|D }, -{NULL}, -}; - -#undef A -#undef V -#undef S -#undef E -#undef D -#undef DEFAULT -#undef OFFSET - -#endif /* AVCODEC_OPTIONS_TABLE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/parser.c deleted file mode 100644 index 8a825938a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/parser.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Audio and Video frame extraction - * Copyright (c) 2003 Fabrice Bellard - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "parser.h" -#include "libavutil/atomic.h" -#include "libavutil/mem.h" - -static AVCodecParser *av_first_parser = NULL; - -AVCodecParser* av_parser_next(AVCodecParser *p){ - if(p) return p->next; - else return av_first_parser; -} - -void av_register_codec_parser(AVCodecParser *parser) -{ - do { - parser->next = av_first_parser; - } while (parser->next != avpriv_atomic_ptr_cas((void * volatile *)&av_first_parser, parser->next, parser)); -} - -AVCodecParserContext *av_parser_init(int codec_id) -{ - AVCodecParserContext *s = NULL; - AVCodecParser *parser; - int ret; - - if(codec_id == AV_CODEC_ID_NONE) - return NULL; - - for(parser = av_first_parser; parser != NULL; parser = parser->next) { - if (parser->codec_ids[0] == codec_id || - parser->codec_ids[1] == codec_id || - parser->codec_ids[2] == codec_id || - parser->codec_ids[3] == codec_id || - parser->codec_ids[4] == codec_id) - goto found; - } - return NULL; - found: - s = av_mallocz(sizeof(AVCodecParserContext)); - if (!s) - goto err_out; - s->parser = parser; - s->priv_data = av_mallocz(parser->priv_data_size); - if (!s->priv_data) - goto err_out; - s->fetch_timestamp=1; - s->pict_type = AV_PICTURE_TYPE_I; - if (parser->parser_init) { - ret = parser->parser_init(s); - if (ret != 0) - goto err_out; - } - s->key_frame = -1; - s->convergence_duration = 0; - s->dts_sync_point = INT_MIN; - s->dts_ref_dts_delta = INT_MIN; - s->pts_dts_delta = INT_MIN; - return s; - -err_out: - if (s) - av_freep(&s->priv_data); - av_free(s); - return NULL; -} - -void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ - int i; - - s->dts= s->pts= AV_NOPTS_VALUE; - s->pos= -1; - s->offset= 0; - for(i = 0; i < AV_PARSER_PTS_NB; i++) { - if ( s->cur_offset + off >= s->cur_frame_offset[i] - && (s->frame_offset < s->cur_frame_offset[i] || - (!s->frame_offset && !s->next_frame_offset)) // first field/frame - // check disabled since MPEG-TS does not send complete PES packets - && /*s->next_frame_offset + off <*/ s->cur_frame_end[i]){ - s->dts= s->cur_frame_dts[i]; - s->pts= s->cur_frame_pts[i]; - s->pos= s->cur_frame_pos[i]; - s->offset = s->next_frame_offset - s->cur_frame_offset[i]; - if(remove) - s->cur_frame_offset[i]= INT64_MAX; - if(s->cur_offset + off < s->cur_frame_end[i]) - break; - } - } -} - -int av_parser_parse2(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, - int64_t pts, int64_t dts, - int64_t pos) -{ - int index, i; - uint8_t dummy_buf[FF_INPUT_BUFFER_PADDING_SIZE]; - - if(!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { - s->next_frame_offset = - s->cur_offset = pos; - s->flags |= PARSER_FLAG_FETCHED_OFFSET; - } - - if (buf_size == 0) { - /* padding is always necessary even if EOF, so we add it here */ - memset(dummy_buf, 0, sizeof(dummy_buf)); - buf = dummy_buf; - } else if (s->cur_offset + buf_size != - s->cur_frame_end[s->cur_frame_start_index]) { /* skip remainder packets */ - /* add a new packet descriptor */ - i = (s->cur_frame_start_index + 1) & (AV_PARSER_PTS_NB - 1); - s->cur_frame_start_index = i; - s->cur_frame_offset[i] = s->cur_offset; - s->cur_frame_end[i] = s->cur_offset + buf_size; - s->cur_frame_pts[i] = pts; - s->cur_frame_dts[i] = dts; - s->cur_frame_pos[i] = pos; - } - - if (s->fetch_timestamp){ - s->fetch_timestamp=0; - s->last_pts = s->pts; - s->last_dts = s->dts; - s->last_pos = s->pos; - ff_fetch_timestamp(s, 0, 0); - } - - /* WARNING: the returned index can be negative */ - index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf, poutbuf_size, buf, buf_size); - /* update the file pointer */ - if (*poutbuf_size) { - /* fill the data for the current frame */ - s->frame_offset = s->next_frame_offset; - - /* offset of the next frame */ - s->next_frame_offset = s->cur_offset + index; - s->fetch_timestamp=1; - } - if (index < 0) - index = 0; - s->cur_offset += index; - return index; -} - -int av_parser_change(AVCodecParserContext *s, - AVCodecContext *avctx, - uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size, int keyframe){ - - if(s && s->parser->split){ - if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)){ - int i= s->parser->split(avctx, buf, buf_size); - buf += i; - buf_size -= i; - } - } - - /* cast to avoid warning about discarding qualifiers */ - *poutbuf= (uint8_t *) buf; - *poutbuf_size= buf_size; - if(avctx->extradata){ - if( (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) - /*||(s->pict_type != AV_PICTURE_TYPE_I && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/ - /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){ - int size= buf_size + avctx->extradata_size; - *poutbuf_size= size; - *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); - - memcpy(*poutbuf, avctx->extradata, avctx->extradata_size); - memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); - return 1; - } - } - - return 0; -} - -void av_parser_close(AVCodecParserContext *s) -{ - if(s){ - if (s->parser->parser_close) - s->parser->parser_close(s); - av_free(s->priv_data); - av_free(s); - } -} - -/*****************************************************/ - -int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size) -{ - if(pc->overread){ - av_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n", - pc->overread, pc->state, next, pc->index, pc->overread_index); - av_dlog(NULL, "%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]); - } - - /* Copy overread bytes from last frame into buffer. */ - for(; pc->overread>0; pc->overread--){ - pc->buffer[pc->index++]= pc->buffer[pc->overread_index++]; - } - - /* flush remaining if EOF */ - if(!*buf_size && next == END_NOT_FOUND){ - next= 0; - } - - pc->last_index= pc->index; - - /* copy into buffer end return */ - if(next == END_NOT_FOUND){ - void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - - if(!new_buffer) { - pc->index = 0; - return AVERROR(ENOMEM); - } - pc->buffer = new_buffer; - memcpy(&pc->buffer[pc->index], *buf, *buf_size); - pc->index += *buf_size; - return -1; - } - - *buf_size= - pc->overread_index= pc->index + next; - - /* append to buffer */ - if(pc->index){ - void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE); - if(!new_buffer) { - pc->overread_index = - pc->index = 0; - return AVERROR(ENOMEM); - } - pc->buffer = new_buffer; - if (next > -FF_INPUT_BUFFER_PADDING_SIZE) - memcpy(&pc->buffer[pc->index], *buf, - next + FF_INPUT_BUFFER_PADDING_SIZE); - pc->index = 0; - *buf= pc->buffer; - } - - /* store overread bytes */ - for(;next < 0; next++){ - pc->state = (pc->state<<8) | pc->buffer[pc->last_index + next]; - pc->state64 = (pc->state64<<8) | pc->buffer[pc->last_index + next]; - pc->overread++; - } - - if(pc->overread){ - av_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n", - pc->overread, pc->state, next, pc->index, pc->overread_index); - av_dlog(NULL, "%X %X %X %X\n", (*buf)[0], (*buf)[1],(*buf)[2],(*buf)[3]); - } - - return 0; -} - -void ff_parse_close(AVCodecParserContext *s) -{ - ParseContext *pc = s->priv_data; - - av_freep(&pc->buffer); -} - -/*************************/ - -int ff_mpeg4video_split(AVCodecContext *avctx, - const uint8_t *buf, int buf_size) -{ - int i; - uint32_t state= -1; - - for(i=0; iframe_size = 0; - switch (avctx->codec->id) { - case AV_CODEC_ID_PCM_ALAW: - pcm_alaw_tableinit(); - break; - case AV_CODEC_ID_PCM_MULAW: - pcm_ulaw_tableinit(); - break; - default: - break; - } - - avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); - avctx->block_align = avctx->channels * avctx->bits_per_coded_sample / 8; - avctx->bit_rate = avctx->block_align * avctx->sample_rate * 8; - - return 0; -} - -/** - * Write PCM samples macro - * @param type Datatype of native machine format - * @param endian bytestream_put_xxx() suffix - * @param src Source pointer (variable name) - * @param dst Destination pointer (variable name) - * @param n Total number of samples (variable name) - * @param shift Bitshift (bits) - * @param offset Sample value offset - */ -#define ENCODE(type, endian, src, dst, n, shift, offset) \ - samples_ ## type = (const type *) src; \ - for (; n > 0; n--) { \ - register type v = (*samples_ ## type++ >> shift) + offset; \ - bytestream_put_ ## endian(&dst, v); \ - } - -#define ENCODE_PLANAR(type, endian, dst, n, shift, offset) \ - n /= avctx->channels; \ - for (c = 0; c < avctx->channels; c++) { \ - int i; \ - samples_ ## type = (const type *) frame->extended_data[c]; \ - for (i = n; i > 0; i--) { \ - register type v = (*samples_ ## type++ >> shift) + offset; \ - bytestream_put_ ## endian(&dst, v); \ - } \ - } - -static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr) -{ - int n, c, sample_size, v, ret; - const short *samples; - unsigned char *dst; - const uint8_t *samples_uint8_t; - const int16_t *samples_int16_t; - const int32_t *samples_int32_t; - const int64_t *samples_int64_t; - const uint16_t *samples_uint16_t; - const uint32_t *samples_uint32_t; - - sample_size = av_get_bits_per_sample(avctx->codec->id) / 8; - n = frame->nb_samples * avctx->channels; - samples = (const short *)frame->data[0]; - - if ((ret = ff_alloc_packet2(avctx, avpkt, n * sample_size)) < 0) - return ret; - dst = avpkt->data; - - switch (avctx->codec->id) { - case AV_CODEC_ID_PCM_U32LE: - ENCODE(uint32_t, le32, samples, dst, n, 0, 0x80000000) - break; - case AV_CODEC_ID_PCM_U32BE: - ENCODE(uint32_t, be32, samples, dst, n, 0, 0x80000000) - break; - case AV_CODEC_ID_PCM_S24LE: - ENCODE(int32_t, le24, samples, dst, n, 8, 0) - break; - case AV_CODEC_ID_PCM_S24LE_PLANAR: - ENCODE_PLANAR(int32_t, le24, dst, n, 8, 0) - break; - case AV_CODEC_ID_PCM_S24BE: - ENCODE(int32_t, be24, samples, dst, n, 8, 0) - break; - case AV_CODEC_ID_PCM_U24LE: - ENCODE(uint32_t, le24, samples, dst, n, 8, 0x800000) - break; - case AV_CODEC_ID_PCM_U24BE: - ENCODE(uint32_t, be24, samples, dst, n, 8, 0x800000) - break; - case AV_CODEC_ID_PCM_S24DAUD: - for (; n > 0; n--) { - uint32_t tmp = ff_reverse[(*samples >> 8) & 0xff] + - (ff_reverse[*samples & 0xff] << 8); - tmp <<= 4; // sync flags would go here - bytestream_put_be24(&dst, tmp); - samples++; - } - break; - case AV_CODEC_ID_PCM_U16LE: - ENCODE(uint16_t, le16, samples, dst, n, 0, 0x8000) - break; - case AV_CODEC_ID_PCM_U16BE: - ENCODE(uint16_t, be16, samples, dst, n, 0, 0x8000) - break; - case AV_CODEC_ID_PCM_S8: - ENCODE(uint8_t, byte, samples, dst, n, 0, -128) - break; - case AV_CODEC_ID_PCM_S8_PLANAR: - ENCODE_PLANAR(uint8_t, byte, dst, n, 0, -128) - break; -#if HAVE_BIGENDIAN - case AV_CODEC_ID_PCM_F64LE: - ENCODE(int64_t, le64, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S32LE: - case AV_CODEC_ID_PCM_F32LE: - ENCODE(int32_t, le32, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S32LE_PLANAR: - ENCODE_PLANAR(int32_t, le32, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16LE: - ENCODE(int16_t, le16, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16LE_PLANAR: - ENCODE_PLANAR(int16_t, le16, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_F64BE: - case AV_CODEC_ID_PCM_F32BE: - case AV_CODEC_ID_PCM_S32BE: - case AV_CODEC_ID_PCM_S16BE: -#else - case AV_CODEC_ID_PCM_F64BE: - ENCODE(int64_t, be64, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_F32BE: - case AV_CODEC_ID_PCM_S32BE: - ENCODE(int32_t, be32, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16BE: - ENCODE(int16_t, be16, samples, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16BE_PLANAR: - ENCODE_PLANAR(int16_t, be16, dst, n, 0, 0) - break; - case AV_CODEC_ID_PCM_F64LE: - case AV_CODEC_ID_PCM_F32LE: - case AV_CODEC_ID_PCM_S32LE: - case AV_CODEC_ID_PCM_S16LE: -#endif /* HAVE_BIGENDIAN */ - case AV_CODEC_ID_PCM_U8: - memcpy(dst, samples, n * sample_size); - break; -#if HAVE_BIGENDIAN - case AV_CODEC_ID_PCM_S16BE_PLANAR: -#else - case AV_CODEC_ID_PCM_S16LE_PLANAR: - case AV_CODEC_ID_PCM_S32LE_PLANAR: -#endif /* HAVE_BIGENDIAN */ - n /= avctx->channels; - for (c = 0; c < avctx->channels; c++) { - const uint8_t *src = frame->extended_data[c]; - bytestream_put_buffer(&dst, src, n * sample_size); - } - break; - case AV_CODEC_ID_PCM_ALAW: - for (; n > 0; n--) { - v = *samples++; - *dst++ = linear_to_alaw[(v + 32768) >> 2]; - } - break; - case AV_CODEC_ID_PCM_MULAW: - for (; n > 0; n--) { - v = *samples++; - *dst++ = linear_to_ulaw[(v + 32768) >> 2]; - } - break; - default: - return -1; - } - - *got_packet_ptr = 1; - return 0; -} - -typedef struct PCMDecode { - short table[256]; -} PCMDecode; - -static av_cold int pcm_decode_init(AVCodecContext *avctx) -{ - PCMDecode *s = avctx->priv_data; - int i; - - if (avctx->channels <= 0) { - av_log(avctx, AV_LOG_ERROR, "PCM channels out of bounds\n"); - return AVERROR(EINVAL); - } - - switch (avctx->codec_id) { - case AV_CODEC_ID_PCM_ALAW: - for (i = 0; i < 256; i++) - s->table[i] = alaw2linear(i); - break; - case AV_CODEC_ID_PCM_MULAW: - for (i = 0; i < 256; i++) - s->table[i] = ulaw2linear(i); - break; - default: - break; - } - - avctx->sample_fmt = avctx->codec->sample_fmts[0]; - - if (avctx->sample_fmt == AV_SAMPLE_FMT_S32) - avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec_id); - - return 0; -} - -/** - * Read PCM samples macro - * @param size Data size of native machine format - * @param endian bytestream_get_xxx() endian suffix - * @param src Source pointer (variable name) - * @param dst Destination pointer (variable name) - * @param n Total number of samples (variable name) - * @param shift Bitshift (bits) - * @param offset Sample value offset - */ -#define DECODE(size, endian, src, dst, n, shift, offset) \ - for (; n > 0; n--) { \ - uint ## size ## _t v = bytestream_get_ ## endian(&src); \ - AV_WN ## size ## A(dst, (v - offset) << shift); \ - dst += size / 8; \ - } - -#define DECODE_PLANAR(size, endian, src, dst, n, shift, offset) \ - n /= avctx->channels; \ - for (c = 0; c < avctx->channels; c++) { \ - int i; \ - dst = frame->extended_data[c]; \ - for (i = n; i > 0; i--) { \ - uint ## size ## _t v = bytestream_get_ ## endian(&src); \ - AV_WN ## size ## A(dst, (v - offset) << shift); \ - dst += size / 8; \ - } \ - } - -static int pcm_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - const uint8_t *src = avpkt->data; - int buf_size = avpkt->size; - PCMDecode *s = avctx->priv_data; - AVFrame *frame = data; - int sample_size, c, n, ret, samples_per_block; - uint8_t *samples; - int32_t *dst_int32_t; - - sample_size = av_get_bits_per_sample(avctx->codec_id) / 8; - - /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */ - samples_per_block = 1; - if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) { - /* we process 40-bit blocks per channel for LXF */ - samples_per_block = 2; - sample_size = 5; - } - - if (sample_size == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); - return AVERROR(EINVAL); - } - - if (avctx->channels == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); - return AVERROR(EINVAL); - } - - if (avctx->codec_id != avctx->codec->id) { - av_log(avctx, AV_LOG_ERROR, "codec ids mismatch\n"); - return AVERROR(EINVAL); - } - - n = avctx->channels * sample_size; - - if (n && buf_size % n) { - if (buf_size < n) { - av_log(avctx, AV_LOG_ERROR, - "Invalid PCM packet, data has size %d but at least a size of %d was expected\n", - buf_size, n); - return AVERROR_INVALIDDATA; - } else - buf_size -= buf_size % n; - } - - n = buf_size / sample_size; - - /* get output buffer */ - frame->nb_samples = n * samples_per_block / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = frame->data[0]; - - switch (avctx->codec_id) { - case AV_CODEC_ID_PCM_U32LE: - DECODE(32, le32, src, samples, n, 0, 0x80000000) - break; - case AV_CODEC_ID_PCM_U32BE: - DECODE(32, be32, src, samples, n, 0, 0x80000000) - break; - case AV_CODEC_ID_PCM_S24LE: - DECODE(32, le24, src, samples, n, 8, 0) - break; - case AV_CODEC_ID_PCM_S24LE_PLANAR: - DECODE_PLANAR(32, le24, src, samples, n, 8, 0); - break; - case AV_CODEC_ID_PCM_S24BE: - DECODE(32, be24, src, samples, n, 8, 0) - break; - case AV_CODEC_ID_PCM_U24LE: - DECODE(32, le24, src, samples, n, 8, 0x800000) - break; - case AV_CODEC_ID_PCM_U24BE: - DECODE(32, be24, src, samples, n, 8, 0x800000) - break; - case AV_CODEC_ID_PCM_S24DAUD: - for (; n > 0; n--) { - uint32_t v = bytestream_get_be24(&src); - v >>= 4; // sync flags are here - AV_WN16A(samples, ff_reverse[(v >> 8) & 0xff] + - (ff_reverse[v & 0xff] << 8)); - samples += 2; - } - break; - case AV_CODEC_ID_PCM_U16LE: - DECODE(16, le16, src, samples, n, 0, 0x8000) - break; - case AV_CODEC_ID_PCM_U16BE: - DECODE(16, be16, src, samples, n, 0, 0x8000) - break; - case AV_CODEC_ID_PCM_S8: - for (; n > 0; n--) - *samples++ = *src++ + 128; - break; - case AV_CODEC_ID_PCM_S8_PLANAR: - n /= avctx->channels; - for (c = 0; c < avctx->channels; c++) { - int i; - samples = frame->extended_data[c]; - for (i = n; i > 0; i--) - *samples++ = *src++ + 128; - } - break; -#if HAVE_BIGENDIAN - case AV_CODEC_ID_PCM_F64LE: - DECODE(64, le64, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S32LE: - case AV_CODEC_ID_PCM_F32LE: - DECODE(32, le32, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S32LE_PLANAR: - DECODE_PLANAR(32, le32, src, samples, n, 0, 0); - break; - case AV_CODEC_ID_PCM_S16LE: - DECODE(16, le16, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16LE_PLANAR: - DECODE_PLANAR(16, le16, src, samples, n, 0, 0); - break; - case AV_CODEC_ID_PCM_F64BE: - case AV_CODEC_ID_PCM_F32BE: - case AV_CODEC_ID_PCM_S32BE: - case AV_CODEC_ID_PCM_S16BE: -#else - case AV_CODEC_ID_PCM_F64BE: - DECODE(64, be64, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_F32BE: - case AV_CODEC_ID_PCM_S32BE: - DECODE(32, be32, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16BE: - DECODE(16, be16, src, samples, n, 0, 0) - break; - case AV_CODEC_ID_PCM_S16BE_PLANAR: - DECODE_PLANAR(16, be16, src, samples, n, 0, 0); - break; - case AV_CODEC_ID_PCM_F64LE: - case AV_CODEC_ID_PCM_F32LE: - case AV_CODEC_ID_PCM_S32LE: - case AV_CODEC_ID_PCM_S16LE: -#endif /* HAVE_BIGENDIAN */ - case AV_CODEC_ID_PCM_U8: - memcpy(samples, src, n * sample_size); - break; -#if HAVE_BIGENDIAN - case AV_CODEC_ID_PCM_S16BE_PLANAR: -#else - case AV_CODEC_ID_PCM_S16LE_PLANAR: - case AV_CODEC_ID_PCM_S32LE_PLANAR: -#endif /* HAVE_BIGENDIAN */ - n /= avctx->channels; - for (c = 0; c < avctx->channels; c++) { - samples = frame->extended_data[c]; - bytestream_get_buffer(&src, samples, n * sample_size); - } - break; - case AV_CODEC_ID_PCM_ZORK: - for (; n > 0; n--) { - int v = *src++; - if (v < 128) - v = 128 - v; - *samples++ = v; - } - break; - case AV_CODEC_ID_PCM_ALAW: - case AV_CODEC_ID_PCM_MULAW: - for (; n > 0; n--) { - AV_WN16A(samples, s->table[*src++]); - samples += 2; - } - break; - case AV_CODEC_ID_PCM_LXF: - { - int i; - n /= avctx->channels; - for (c = 0; c < avctx->channels; c++) { - dst_int32_t = (int32_t *)frame->extended_data[c]; - for (i = 0; i < n; i++) { - // extract low 20 bits and expand to 32 bits - *dst_int32_t++ = (src[2] << 28) | - (src[1] << 20) | - (src[0] << 12) | - ((src[2] & 0x0F) << 8) | - src[1]; - // extract high 20 bits and expand to 32 bits - *dst_int32_t++ = (src[4] << 24) | - (src[3] << 16) | - ((src[2] & 0xF0) << 8) | - (src[4] << 4) | - (src[3] >> 4); - src += 5; - } - } - break; - } - default: - return -1; - } - - *got_frame_ptr = 1; - - return buf_size; -} - -#define PCM_ENCODER_0(id_, sample_fmt_, name_, long_name_) -#define PCM_ENCODER_1(id_, sample_fmt_, name_, long_name_) \ -AVCodec ff_ ## name_ ## _encoder = { \ - .name = #name_, \ - .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ - .type = AVMEDIA_TYPE_AUDIO, \ - .id = AV_CODEC_ID_ ## id_, \ - .init = pcm_encode_init, \ - .encode2 = pcm_encode_frame, \ - .capabilities = CODEC_CAP_VARIABLE_FRAME_SIZE, \ - .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \ - AV_SAMPLE_FMT_NONE }, \ -} - -#define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \ - PCM_ENCODER_ ## cf(id, sample_fmt, name, long_name) -#define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \ - PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) -#define PCM_ENCODER(id, sample_fmt, name, long_name) \ - PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name) - -#define PCM_DECODER_0(id, sample_fmt, name, long_name) -#define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \ -AVCodec ff_ ## name_ ## _decoder = { \ - .name = #name_, \ - .long_name = NULL_IF_CONFIG_SMALL(long_name_), \ - .type = AVMEDIA_TYPE_AUDIO, \ - .id = AV_CODEC_ID_ ## id_, \ - .priv_data_size = sizeof(PCMDecode), \ - .init = pcm_decode_init, \ - .decode = pcm_decode_frame, \ - .capabilities = CODEC_CAP_DR1, \ - .sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \ - AV_SAMPLE_FMT_NONE }, \ -} - -#define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \ - PCM_DECODER_ ## cf(id, sample_fmt, name, long_name) -#define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \ - PCM_DECODER_2(cf, id, sample_fmt, name, long_name) -#define PCM_DECODER(id, sample_fmt, name, long_name) \ - PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name) - -#define PCM_CODEC(id, sample_fmt_, name, long_name_) \ - PCM_ENCODER(id, sample_fmt_, name, long_name_); \ - PCM_DECODER(id, sample_fmt_, name, long_name_) - -/* Note: Do not forget to add new entries to the Makefile as well. */ -PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law"); -PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian"); -PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); -PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); -PCM_CODEC (PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian"); -PCM_DECODER(PCM_LXF, AV_SAMPLE_FMT_S32P,pcm_lxf, "PCM signed 20-bit little-endian planar"); -PCM_CODEC (PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law"); -PCM_CODEC (PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); -PCM_CODEC (PCM_S8_PLANAR, AV_SAMPLE_FMT_U8P, pcm_s8_planar, "PCM signed 8-bit planar"); -PCM_CODEC (PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian"); -PCM_CODEC (PCM_S16BE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16be_planar, "PCM signed 16-bit big-endian planar"); -PCM_CODEC (PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian"); -PCM_CODEC (PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM signed 16-bit little-endian planar"); -PCM_CODEC (PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian"); -PCM_CODEC (PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit"); -PCM_CODEC (PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian"); -PCM_CODEC (PCM_S24LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s24le_planar, "PCM signed 24-bit little-endian planar"); -PCM_CODEC (PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian"); -PCM_CODEC (PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian"); -PCM_CODEC (PCM_S32LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s32le_planar, "PCM signed 32-bit little-endian planar"); -PCM_CODEC (PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit"); -PCM_CODEC (PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian"); -PCM_CODEC (PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian"); -PCM_CODEC (PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian"); -PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian"); -PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian"); -PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian"); -PCM_DECODER(PCM_ZORK, AV_SAMPLE_FMT_U8, pcm_zork, "PCM Zork"); - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.c deleted file mode 100644 index bf8e7fb70..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Generate a header file for hardcoded PCM tables - * - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#define CONFIG_HARDCODED_TABLES 0 -#include "pcm_tablegen.h" -#include "tableprint.h" - -int main(void) -{ - pcm_alaw_tableinit(); - pcm_ulaw_tableinit(); - - write_fileheader(); - - WRITE_ARRAY("static const", uint8_t, linear_to_alaw); - WRITE_ARRAY("static const", uint8_t, linear_to_ulaw); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.h deleted file mode 100644 index 1387210a5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/pcm_tablegen.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Header file for hardcoded PCM tables - * - * Copyright (c) 2010 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_PCM_TABLEGEN_H -#define AVCODEC_PCM_TABLEGEN_H - -#include -#include "libavutil/attributes.h" - -/* from g711.c by SUN microsystems (unrestricted use) */ - -#define SIGN_BIT (0x80) /* Sign bit for a A-law byte. */ -#define QUANT_MASK (0xf) /* Quantization field mask. */ -#define NSEGS (8) /* Number of A-law segments. */ -#define SEG_SHIFT (4) /* Left shift for segment number. */ -#define SEG_MASK (0x70) /* Segment field mask. */ - -#define BIAS (0x84) /* Bias for linear code. */ - -/* - * alaw2linear() - Convert an A-law value to 16-bit linear PCM - * - */ -static av_cold int alaw2linear(unsigned char a_val) -{ - int t; - int seg; - - a_val ^= 0x55; - - t = a_val & QUANT_MASK; - seg = ((unsigned)a_val & SEG_MASK) >> SEG_SHIFT; - if(seg) t= (t + t + 1 + 32) << (seg + 2); - else t= (t + t + 1 ) << 3; - - return (a_val & SIGN_BIT) ? t : -t; -} - -static av_cold int ulaw2linear(unsigned char u_val) -{ - int t; - - /* Complement to obtain normal u-law value. */ - u_val = ~u_val; - - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = ((u_val & QUANT_MASK) << 3) + BIAS; - t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT; - - return (u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS); -} - -#if CONFIG_HARDCODED_TABLES -#define pcm_alaw_tableinit() -#define pcm_ulaw_tableinit() -#include "libavcodec/pcm_tables.h" -#else -/* 16384 entries per table */ -static uint8_t linear_to_alaw[16384]; -static uint8_t linear_to_ulaw[16384]; - -static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw, - int (*xlaw2linear)(unsigned char), - int mask) -{ - int i, j, v, v1, v2; - - j = 0; - for(i=0;i<128;i++) { - if (i != 127) { - v1 = xlaw2linear(i ^ mask); - v2 = xlaw2linear((i + 1) ^ mask); - v = (v1 + v2 + 4) >> 3; - } else { - v = 8192; - } - for(;j 0) - linear_to_xlaw[8192 - j] = (i ^ (mask ^ 0x80)); - } - } - linear_to_xlaw[0] = linear_to_xlaw[1]; -} - -static void pcm_alaw_tableinit(void) -{ - build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); -} - -static void pcm_ulaw_tableinit(void) -{ - build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); -} -#endif /* CONFIG_HARDCODED_TABLES */ - -#endif /* AVCODEC_PCM_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/put_bits.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/put_bits.h deleted file mode 100644 index e2c4a6179..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/put_bits.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * bitstream writer API - */ - -#ifndef AVCODEC_PUT_BITS_H -#define AVCODEC_PUT_BITS_H - -#include -#include -#include - -#include "libavutil/bswap.h" -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/avassert.h" -#include "mathops.h" -#include "config.h" - -typedef struct PutBitContext { - uint32_t bit_buf; - int bit_left; - uint8_t *buf, *buf_ptr, *buf_end; - int size_in_bits; -} PutBitContext; - -/** - * Initialize the PutBitContext s. - * - * @param buffer the buffer where to put bits - * @param buffer_size the size in bytes of buffer - */ -static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, - int buffer_size) -{ - if (buffer_size < 0) { - buffer_size = 0; - buffer = NULL; - } - - s->size_in_bits = 8 * buffer_size; - s->buf = buffer; - s->buf_end = s->buf + buffer_size; - s->buf_ptr = s->buf; - s->bit_left = 32; - s->bit_buf = 0; -} - -/** - * @return the total number of bits written to the bitstream. - */ -static inline int put_bits_count(PutBitContext *s) -{ - return (s->buf_ptr - s->buf) * 8 + 32 - s->bit_left; -} - -/** - * @return the number of bits available in the bitstream. - */ -static inline int put_bits_left(PutBitContext* s) -{ - return (s->buf_end - s->buf_ptr) * 8 - 32 + s->bit_left; -} - -/** - * Pad the end of the output stream with zeros. - */ -static inline void flush_put_bits(PutBitContext *s) -{ -#ifndef BITSTREAM_WRITER_LE - if (s->bit_left < 32) - s->bit_buf <<= s->bit_left; -#endif - while (s->bit_left < 32) { - /* XXX: should test end of buffer */ -#ifdef BITSTREAM_WRITER_LE - *s->buf_ptr++ = s->bit_buf; - s->bit_buf >>= 8; -#else - *s->buf_ptr++ = s->bit_buf >> 24; - s->bit_buf <<= 8; -#endif - s->bit_left += 8; - } - s->bit_left = 32; - s->bit_buf = 0; -} - -#ifdef BITSTREAM_WRITER_LE -#define avpriv_align_put_bits align_put_bits_unsupported_here -#define avpriv_put_string ff_put_string_unsupported_here -#define avpriv_copy_bits avpriv_copy_bits_unsupported_here -#else -/** - * Pad the bitstream with zeros up to the next byte boundary. - */ -void avpriv_align_put_bits(PutBitContext *s); - -/** - * Put the string string in the bitstream. - * - * @param terminate_string 0-terminates the written string if value is 1 - */ -void avpriv_put_string(PutBitContext *pb, const char *string, - int terminate_string); - -/** - * Copy the content of src to the bitstream. - * - * @param length the number of bits of src to copy - */ -void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length); -#endif - -/** - * Write up to 31 bits into a bitstream. - * Use put_bits32 to write 32 bits. - */ -static inline void put_bits(PutBitContext *s, int n, unsigned int value) -{ - unsigned int bit_buf; - int bit_left; - - av_assert2(n <= 31 && value < (1U << n)); - - bit_buf = s->bit_buf; - bit_left = s->bit_left; - - /* XXX: optimize */ -#ifdef BITSTREAM_WRITER_LE - bit_buf |= value << (32 - bit_left); - if (n >= bit_left) { - av_assert2(s->buf_ptr+3buf_end); - AV_WL32(s->buf_ptr, bit_buf); - s->buf_ptr += 4; - bit_buf = (bit_left == 32) ? 0 : value >> bit_left; - bit_left += 32; - } - bit_left -= n; -#else - if (n < bit_left) { - bit_buf = (bit_buf << n) | value; - bit_left -= n; - } else { - bit_buf <<= bit_left; - bit_buf |= value >> (n - bit_left); - av_assert2(s->buf_ptr+3buf_end); - AV_WB32(s->buf_ptr, bit_buf); - s->buf_ptr += 4; - bit_left += 32 - n; - bit_buf = value; - } -#endif - - s->bit_buf = bit_buf; - s->bit_left = bit_left; -} - -static inline void put_sbits(PutBitContext *pb, int n, int32_t value) -{ - av_assert2(n >= 0 && n <= 31); - - put_bits(pb, n, value & ((1 << n) - 1)); -} - -/** - * Write exactly 32 bits into a bitstream. - */ -static void av_unused put_bits32(PutBitContext *s, uint32_t value) -{ - int lo = value & 0xffff; - int hi = value >> 16; -#ifdef BITSTREAM_WRITER_LE - put_bits(s, 16, lo); - put_bits(s, 16, hi); -#else - put_bits(s, 16, hi); - put_bits(s, 16, lo); -#endif -} - -/** - * Return the pointer to the byte where the bitstream writer will put - * the next bit. - */ -static inline uint8_t *put_bits_ptr(PutBitContext *s) -{ - return s->buf_ptr; -} - -/** - * Skip the given number of bytes. - * PutBitContext must be flushed & aligned to a byte boundary before calling this. - */ -static inline void skip_put_bytes(PutBitContext *s, int n) -{ - av_assert2((put_bits_count(s) & 7) == 0); - av_assert2(s->bit_left == 32); - s->buf_ptr += n; -} - -/** - * Skip the given number of bits. - * Must only be used if the actual values in the bitstream do not matter. - * If n is 0 the behavior is undefined. - */ -static inline void skip_put_bits(PutBitContext *s, int n) -{ - s->bit_left -= n; - s->buf_ptr -= 4 * (s->bit_left >> 5); - s->bit_left &= 31; -} - -/** - * Change the end of the buffer. - * - * @param size the new size in bytes of the buffer where to put bits - */ -static inline void set_put_bits_buffer_size(PutBitContext *s, int size) -{ - s->buf_end = s->buf + size; -} - -#endif /* AVCODEC_PUT_BITS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.c deleted file mode 100644 index 7db248ecf..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.c +++ /dev/null @@ -1,1066 +0,0 @@ -/* - * Rate control for video encoders - * - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Rate control for video encoders. - */ - -#include "libavutil/attributes.h" -#include "avcodec.h" -#include "ratecontrol.h" -#include "mpegvideo.h" -#include "libavutil/eval.h" - -#undef NDEBUG // Always check asserts, the speed effect is far too small to disable them. -#include - -#ifndef M_E -#define M_E 2.718281828 -#endif - -static int init_pass2(MpegEncContext *s); -static double get_qscale(MpegEncContext *s, RateControlEntry *rce, - double rate_factor, int frame_num); - -void ff_write_pass1_stats(MpegEncContext *s) -{ - snprintf(s->avctx->stats_out, 256, - "in:%d out:%d type:%d q:%d itex:%d ptex:%d mv:%d misc:%d " - "fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d;\n", - s->current_picture_ptr->f.display_picture_number, - s->current_picture_ptr->f.coded_picture_number, - s->pict_type, - s->current_picture.f.quality, - s->i_tex_bits, - s->p_tex_bits, - s->mv_bits, - s->misc_bits, - s->f_code, - s->b_code, - s->current_picture.mc_mb_var_sum, - s->current_picture.mb_var_sum, - s->i_count, s->skip_count, - s->header_bits); -} - -static double get_fps(AVCodecContext *avctx) -{ - return 1.0 / av_q2d(avctx->time_base) / FFMAX(avctx->ticks_per_frame, 1); -} - -static inline double qp2bits(RateControlEntry *rce, double qp) -{ - if (qp <= 0.0) { - av_log(NULL, AV_LOG_ERROR, "qp<=0.0\n"); - } - return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits + 1) / qp; -} - -static inline double bits2qp(RateControlEntry *rce, double bits) -{ - if (bits < 0.9) { - av_log(NULL, AV_LOG_ERROR, "bits<0.9\n"); - } - return rce->qscale * (double)(rce->i_tex_bits + rce->p_tex_bits + 1) / bits; -} - -av_cold int ff_rate_control_init(MpegEncContext *s) -{ - RateControlContext *rcc = &s->rc_context; - int i, res; - static const char * const const_names[] = { - "PI", - "E", - "iTex", - "pTex", - "tex", - "mv", - "fCode", - "iCount", - "mcVar", - "var", - "isI", - "isP", - "isB", - "avgQP", - "qComp", -#if 0 - "lastIQP", - "lastPQP", - "lastBQP", - "nextNonBQP", -#endif - "avgIITex", - "avgPITex", - "avgPPTex", - "avgBPTex", - "avgTex", - NULL - }; - static double (* const func1[])(void *, double) = { - (void *)bits2qp, - (void *)qp2bits, - NULL - }; - static const char * const func1_names[] = { - "bits2qp", - "qp2bits", - NULL - }; - emms_c(); - - if (!s->avctx->rc_max_available_vbv_use && s->avctx->rc_buffer_size) { - if (s->avctx->rc_max_rate) { - s->avctx->rc_max_available_vbv_use = av_clipf(s->avctx->rc_max_rate/(s->avctx->rc_buffer_size*get_fps(s->avctx)), 1.0/3, 1.0); - } else - s->avctx->rc_max_available_vbv_use = 1.0; - } - - res = av_expr_parse(&rcc->rc_eq_eval, - s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", - const_names, func1_names, func1, - NULL, NULL, 0, s->avctx); - if (res < 0) { - av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\"\n", s->avctx->rc_eq); - return res; - } - - for (i = 0; i < 5; i++) { - rcc->pred[i].coeff = FF_QP2LAMBDA * 7.0; - rcc->pred[i].count = 1.0; - rcc->pred[i].decay = 0.4; - - rcc->i_cplx_sum [i] = - rcc->p_cplx_sum [i] = - rcc->mv_bits_sum[i] = - rcc->qscale_sum [i] = - rcc->frame_count[i] = 1; // 1 is better because of 1/0 and such - - rcc->last_qscale_for[i] = FF_QP2LAMBDA * 5; - } - rcc->buffer_index = s->avctx->rc_initial_buffer_occupancy; - if (!rcc->buffer_index) - rcc->buffer_index = s->avctx->rc_buffer_size * 3 / 4; - - if (s->flags & CODEC_FLAG_PASS2) { - int i; - char *p; - - /* find number of pics */ - p = s->avctx->stats_in; - for (i = -1; p; i++) - p = strchr(p + 1, ';'); - i += s->max_b_frames; - if (i <= 0 || i >= INT_MAX / sizeof(RateControlEntry)) - return -1; - rcc->entry = av_mallocz(i * sizeof(RateControlEntry)); - rcc->num_entries = i; - - /* init all to skipped p frames - * (with b frames we might have a not encoded frame at the end FIXME) */ - for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - - rce->pict_type = rce->new_pict_type = AV_PICTURE_TYPE_P; - rce->qscale = rce->new_qscale = FF_QP2LAMBDA * 2; - rce->misc_bits = s->mb_num + 10; - rce->mb_var_sum = s->mb_num * 100; - } - - /* read stats */ - p = s->avctx->stats_in; - for (i = 0; i < rcc->num_entries - s->max_b_frames; i++) { - RateControlEntry *rce; - int picture_number; - int e; - char *next; - - next = strchr(p, ';'); - if (next) { - (*next) = 0; // sscanf in unbelievably slow on looong strings // FIXME copy / do not write - next++; - } - e = sscanf(p, " in:%d ", &picture_number); - - assert(picture_number >= 0); - assert(picture_number < rcc->num_entries); - rce = &rcc->entry[picture_number]; - - e += sscanf(p, " in:%*d out:%*d type:%d q:%f itex:%d ptex:%d mv:%d misc:%d fcode:%d bcode:%d mc-var:%d var:%d icount:%d skipcount:%d hbits:%d", - &rce->pict_type, &rce->qscale, &rce->i_tex_bits, &rce->p_tex_bits, - &rce->mv_bits, &rce->misc_bits, - &rce->f_code, &rce->b_code, - &rce->mc_mb_var_sum, &rce->mb_var_sum, - &rce->i_count, &rce->skip_count, &rce->header_bits); - if (e != 14) { - av_log(s->avctx, AV_LOG_ERROR, - "statistics are damaged at line %d, parser out=%d\n", - i, e); - return -1; - } - - p = next; - } - - if (init_pass2(s) < 0) - return -1; - - // FIXME maybe move to end - if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) { -#if CONFIG_LIBXVID - return ff_xvid_rate_control_init(s); -#else - av_log(s->avctx, AV_LOG_ERROR, - "Xvid ratecontrol requires libavcodec compiled with Xvid support.\n"); - return -1; -#endif - } - } - - if (!(s->flags & CODEC_FLAG_PASS2)) { - rcc->short_term_qsum = 0.001; - rcc->short_term_qcount = 0.001; - - rcc->pass1_rc_eq_output_sum = 0.001; - rcc->pass1_wanted_bits = 0.001; - - if (s->avctx->qblur > 1.0) { - av_log(s->avctx, AV_LOG_ERROR, "qblur too large\n"); - return -1; - } - /* init stuff with the user specified complexity */ - if (s->avctx->rc_initial_cplx) { - for (i = 0; i < 60 * 30; i++) { - double bits = s->avctx->rc_initial_cplx * (i / 10000.0 + 1.0) * s->mb_num; - RateControlEntry rce; - - if (i % ((s->gop_size + 3) / 4) == 0) - rce.pict_type = AV_PICTURE_TYPE_I; - else if (i % (s->max_b_frames + 1)) - rce.pict_type = AV_PICTURE_TYPE_B; - else - rce.pict_type = AV_PICTURE_TYPE_P; - - rce.new_pict_type = rce.pict_type; - rce.mc_mb_var_sum = bits * s->mb_num / 100000; - rce.mb_var_sum = s->mb_num; - - rce.qscale = FF_QP2LAMBDA * 2; - rce.f_code = 2; - rce.b_code = 1; - rce.misc_bits = 1; - - if (s->pict_type == AV_PICTURE_TYPE_I) { - rce.i_count = s->mb_num; - rce.i_tex_bits = bits; - rce.p_tex_bits = 0; - rce.mv_bits = 0; - } else { - rce.i_count = 0; // FIXME we do know this approx - rce.i_tex_bits = 0; - rce.p_tex_bits = bits * 0.9; - rce.mv_bits = bits * 0.1; - } - rcc->i_cplx_sum[rce.pict_type] += rce.i_tex_bits * rce.qscale; - rcc->p_cplx_sum[rce.pict_type] += rce.p_tex_bits * rce.qscale; - rcc->mv_bits_sum[rce.pict_type] += rce.mv_bits; - rcc->frame_count[rce.pict_type]++; - - get_qscale(s, &rce, rcc->pass1_wanted_bits / rcc->pass1_rc_eq_output_sum, i); - - // FIXME misbehaves a little for variable fps - rcc->pass1_wanted_bits += s->bit_rate / get_fps(s->avctx); - } - } - } - - return 0; -} - -av_cold void ff_rate_control_uninit(MpegEncContext *s) -{ - RateControlContext *rcc = &s->rc_context; - emms_c(); - - av_expr_free(rcc->rc_eq_eval); - av_freep(&rcc->entry); - -#if CONFIG_LIBXVID - if ((s->flags & CODEC_FLAG_PASS2) && s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) - ff_xvid_rate_control_uninit(s); -#endif -} - -int ff_vbv_update(MpegEncContext *s, int frame_size) -{ - RateControlContext *rcc = &s->rc_context; - const double fps = get_fps(s->avctx); - const int buffer_size = s->avctx->rc_buffer_size; - const double min_rate = s->avctx->rc_min_rate / fps; - const double max_rate = s->avctx->rc_max_rate / fps; - - av_dlog(s, "%d %f %d %f %f\n", - buffer_size, rcc->buffer_index, frame_size, min_rate, max_rate); - - if (buffer_size) { - int left; - - rcc->buffer_index -= frame_size; - if (rcc->buffer_index < 0) { - av_log(s->avctx, AV_LOG_ERROR, "rc buffer underflow\n"); - if (frame_size > max_rate && s->qscale == s->avctx->qmax) { - av_log(s->avctx, AV_LOG_ERROR, "max bitrate possibly too small or try trellis with large lmax or increase qmax\n"); - } - rcc->buffer_index = 0; - } - - left = buffer_size - rcc->buffer_index - 1; - rcc->buffer_index += av_clip(left, min_rate, max_rate); - - if (rcc->buffer_index > buffer_size) { - int stuffing = ceil((rcc->buffer_index - buffer_size) / 8); - - if (stuffing < 4 && s->codec_id == AV_CODEC_ID_MPEG4) - stuffing = 4; - rcc->buffer_index -= 8 * stuffing; - - if (s->avctx->debug & FF_DEBUG_RC) - av_log(s->avctx, AV_LOG_DEBUG, "stuffing %d bytes\n", stuffing); - - return stuffing; - } - } - return 0; -} - -/** - * Modify the bitrate curve from pass1 for one frame. - */ -static double get_qscale(MpegEncContext *s, RateControlEntry *rce, - double rate_factor, int frame_num) -{ - RateControlContext *rcc = &s->rc_context; - AVCodecContext *a = s->avctx; - const int pict_type = rce->new_pict_type; - const double mb_num = s->mb_num; - double q, bits; - int i; - - double const_values[] = { - M_PI, - M_E, - rce->i_tex_bits * rce->qscale, - rce->p_tex_bits * rce->qscale, - (rce->i_tex_bits + rce->p_tex_bits) * (double)rce->qscale, - rce->mv_bits / mb_num, - rce->pict_type == AV_PICTURE_TYPE_B ? (rce->f_code + rce->b_code) * 0.5 : rce->f_code, - rce->i_count / mb_num, - rce->mc_mb_var_sum / mb_num, - rce->mb_var_sum / mb_num, - rce->pict_type == AV_PICTURE_TYPE_I, - rce->pict_type == AV_PICTURE_TYPE_P, - rce->pict_type == AV_PICTURE_TYPE_B, - rcc->qscale_sum[pict_type] / (double)rcc->frame_count[pict_type], - a->qcompress, -#if 0 - rcc->last_qscale_for[AV_PICTURE_TYPE_I], - rcc->last_qscale_for[AV_PICTURE_TYPE_P], - rcc->last_qscale_for[AV_PICTURE_TYPE_B], - rcc->next_non_b_qscale, -#endif - rcc->i_cplx_sum[AV_PICTURE_TYPE_I] / (double)rcc->frame_count[AV_PICTURE_TYPE_I], - rcc->i_cplx_sum[AV_PICTURE_TYPE_P] / (double)rcc->frame_count[AV_PICTURE_TYPE_P], - rcc->p_cplx_sum[AV_PICTURE_TYPE_P] / (double)rcc->frame_count[AV_PICTURE_TYPE_P], - rcc->p_cplx_sum[AV_PICTURE_TYPE_B] / (double)rcc->frame_count[AV_PICTURE_TYPE_B], - (rcc->i_cplx_sum[pict_type] + rcc->p_cplx_sum[pict_type]) / (double)rcc->frame_count[pict_type], - 0 - }; - - bits = av_expr_eval(rcc->rc_eq_eval, const_values, rce); - if (isnan(bits)) { - av_log(s->avctx, AV_LOG_ERROR, "Error evaluating rc_eq \"%s\"\n", s->avctx->rc_eq); - return -1; - } - - rcc->pass1_rc_eq_output_sum += bits; - bits *= rate_factor; - if (bits < 0.0) - bits = 0.0; - bits += 1.0; // avoid 1/0 issues - - /* user override */ - for (i = 0; i < s->avctx->rc_override_count; i++) { - RcOverride *rco = s->avctx->rc_override; - if (rco[i].start_frame > frame_num) - continue; - if (rco[i].end_frame < frame_num) - continue; - - if (rco[i].qscale) - bits = qp2bits(rce, rco[i].qscale); // FIXME move at end to really force it? - else - bits *= rco[i].quality_factor; - } - - q = bits2qp(rce, bits); - - /* I/B difference */ - if (pict_type == AV_PICTURE_TYPE_I && s->avctx->i_quant_factor < 0.0) - q = -q * s->avctx->i_quant_factor + s->avctx->i_quant_offset; - else if (pict_type == AV_PICTURE_TYPE_B && s->avctx->b_quant_factor < 0.0) - q = -q * s->avctx->b_quant_factor + s->avctx->b_quant_offset; - if (q < 1) - q = 1; - - return q; -} - -static double get_diff_limited_q(MpegEncContext *s, RateControlEntry *rce, double q) -{ - RateControlContext *rcc = &s->rc_context; - AVCodecContext *a = s->avctx; - const int pict_type = rce->new_pict_type; - const double last_p_q = rcc->last_qscale_for[AV_PICTURE_TYPE_P]; - const double last_non_b_q = rcc->last_qscale_for[rcc->last_non_b_pict_type]; - - if (pict_type == AV_PICTURE_TYPE_I && - (a->i_quant_factor > 0.0 || rcc->last_non_b_pict_type == AV_PICTURE_TYPE_P)) - q = last_p_q * FFABS(a->i_quant_factor) + a->i_quant_offset; - else if (pict_type == AV_PICTURE_TYPE_B && - a->b_quant_factor > 0.0) - q = last_non_b_q * a->b_quant_factor + a->b_quant_offset; - if (q < 1) - q = 1; - - /* last qscale / qdiff stuff */ - if (rcc->last_non_b_pict_type == pict_type || pict_type != AV_PICTURE_TYPE_I) { - double last_q = rcc->last_qscale_for[pict_type]; - const int maxdiff = FF_QP2LAMBDA * a->max_qdiff; - - if (q > last_q + maxdiff) - q = last_q + maxdiff; - else if (q < last_q - maxdiff) - q = last_q - maxdiff; - } - - rcc->last_qscale_for[pict_type] = q; // Note we cannot do that after blurring - - if (pict_type != AV_PICTURE_TYPE_B) - rcc->last_non_b_pict_type = pict_type; - - return q; -} - -/** - * Get the qmin & qmax for pict_type. - */ -static void get_qminmax(int *qmin_ret, int *qmax_ret, MpegEncContext *s, int pict_type) -{ - int qmin = s->avctx->lmin; - int qmax = s->avctx->lmax; - - assert(qmin <= qmax); - - switch (pict_type) { - case AV_PICTURE_TYPE_B: - qmin = (int)(qmin * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset + 0.5); - qmax = (int)(qmax * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset + 0.5); - break; - case AV_PICTURE_TYPE_I: - qmin = (int)(qmin * FFABS(s->avctx->i_quant_factor) + s->avctx->i_quant_offset + 0.5); - qmax = (int)(qmax * FFABS(s->avctx->i_quant_factor) + s->avctx->i_quant_offset + 0.5); - break; - } - - qmin = av_clip(qmin, 1, FF_LAMBDA_MAX); - qmax = av_clip(qmax, 1, FF_LAMBDA_MAX); - - if (qmax < qmin) - qmax = qmin; - - *qmin_ret = qmin; - *qmax_ret = qmax; -} - -static double modify_qscale(MpegEncContext *s, RateControlEntry *rce, - double q, int frame_num) -{ - RateControlContext *rcc = &s->rc_context; - const double buffer_size = s->avctx->rc_buffer_size; - const double fps = get_fps(s->avctx); - const double min_rate = s->avctx->rc_min_rate / fps; - const double max_rate = s->avctx->rc_max_rate / fps; - const int pict_type = rce->new_pict_type; - int qmin, qmax; - - get_qminmax(&qmin, &qmax, s, pict_type); - - /* modulation */ - if (s->avctx->rc_qmod_freq && - frame_num % s->avctx->rc_qmod_freq == 0 && - pict_type == AV_PICTURE_TYPE_P) - q *= s->avctx->rc_qmod_amp; - - /* buffer overflow/underflow protection */ - if (buffer_size) { - double expected_size = rcc->buffer_index; - double q_limit; - - if (min_rate) { - double d = 2 * (buffer_size - expected_size) / buffer_size; - if (d > 1.0) - d = 1.0; - else if (d < 0.0001) - d = 0.0001; - q *= pow(d, 1.0 / s->avctx->rc_buffer_aggressivity); - - q_limit = bits2qp(rce, - FFMAX((min_rate - buffer_size + rcc->buffer_index) * - s->avctx->rc_min_vbv_overflow_use, 1)); - - if (q > q_limit) { - if (s->avctx->debug & FF_DEBUG_RC) - av_log(s->avctx, AV_LOG_DEBUG, - "limiting QP %f -> %f\n", q, q_limit); - q = q_limit; - } - } - - if (max_rate) { - double d = 2 * expected_size / buffer_size; - if (d > 1.0) - d = 1.0; - else if (d < 0.0001) - d = 0.0001; - q /= pow(d, 1.0 / s->avctx->rc_buffer_aggressivity); - - q_limit = bits2qp(rce, - FFMAX(rcc->buffer_index * - s->avctx->rc_max_available_vbv_use, - 1)); - if (q < q_limit) { - if (s->avctx->debug & FF_DEBUG_RC) - av_log(s->avctx, AV_LOG_DEBUG, - "limiting QP %f -> %f\n", q, q_limit); - q = q_limit; - } - } - } - av_dlog(s, "q:%f max:%f min:%f size:%f index:%f agr:%f\n", - q, max_rate, min_rate, buffer_size, rcc->buffer_index, - s->avctx->rc_buffer_aggressivity); - if (s->avctx->rc_qsquish == 0.0 || qmin == qmax) { - if (q < qmin) - q = qmin; - else if (q > qmax) - q = qmax; - } else { - double min2 = log(qmin); - double max2 = log(qmax); - - q = log(q); - q = (q - min2) / (max2 - min2) - 0.5; - q *= -4.0; - q = 1.0 / (1.0 + exp(q)); - q = q * (max2 - min2) + min2; - - q = exp(q); - } - - return q; -} - -// ---------------------------------- -// 1 Pass Code - -static double predict_size(Predictor *p, double q, double var) -{ - return p->coeff * var / (q * p->count); -} - -static void update_predictor(Predictor *p, double q, double var, double size) -{ - double new_coeff = size * q / (var + 1); - if (var < 10) - return; - - p->count *= p->decay; - p->coeff *= p->decay; - p->count++; - p->coeff += new_coeff; -} - -static void adaptive_quantization(MpegEncContext *s, double q) -{ - int i; - const float lumi_masking = s->avctx->lumi_masking / (128.0 * 128.0); - const float dark_masking = s->avctx->dark_masking / (128.0 * 128.0); - const float temp_cplx_masking = s->avctx->temporal_cplx_masking; - const float spatial_cplx_masking = s->avctx->spatial_cplx_masking; - const float p_masking = s->avctx->p_masking; - const float border_masking = s->avctx->border_masking; - float bits_sum = 0.0; - float cplx_sum = 0.0; - float *cplx_tab = s->cplx_tab; - float *bits_tab = s->bits_tab; - const int qmin = s->avctx->mb_lmin; - const int qmax = s->avctx->mb_lmax; - Picture *const pic = &s->current_picture; - const int mb_width = s->mb_width; - const int mb_height = s->mb_height; - - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - float temp_cplx = sqrt(pic->mc_mb_var[mb_xy]); // FIXME merge in pow() - float spat_cplx = sqrt(pic->mb_var[mb_xy]); - const int lumi = pic->mb_mean[mb_xy]; - float bits, cplx, factor; - int mb_x = mb_xy % s->mb_stride; - int mb_y = mb_xy / s->mb_stride; - int mb_distance; - float mb_factor = 0.0; - if (spat_cplx < 4) - spat_cplx = 4; // FIXME finetune - if (temp_cplx < 4) - temp_cplx = 4; // FIXME finetune - - if ((s->mb_type[mb_xy] & CANDIDATE_MB_TYPE_INTRA)) { // FIXME hq mode - cplx = spat_cplx; - factor = 1.0 + p_masking; - } else { - cplx = temp_cplx; - factor = pow(temp_cplx, -temp_cplx_masking); - } - factor *= pow(spat_cplx, -spatial_cplx_masking); - - if (lumi > 127) - factor *= (1.0 - (lumi - 128) * (lumi - 128) * lumi_masking); - else - factor *= (1.0 - (lumi - 128) * (lumi - 128) * dark_masking); - - if (mb_x < mb_width / 5) { - mb_distance = mb_width / 5 - mb_x; - mb_factor = (float)mb_distance / (float)(mb_width / 5); - } else if (mb_x > 4 * mb_width / 5) { - mb_distance = mb_x - 4 * mb_width / 5; - mb_factor = (float)mb_distance / (float)(mb_width / 5); - } - if (mb_y < mb_height / 5) { - mb_distance = mb_height / 5 - mb_y; - mb_factor = FFMAX(mb_factor, - (float)mb_distance / (float)(mb_height / 5)); - } else if (mb_y > 4 * mb_height / 5) { - mb_distance = mb_y - 4 * mb_height / 5; - mb_factor = FFMAX(mb_factor, - (float)mb_distance / (float)(mb_height / 5)); - } - - factor *= 1.0 - border_masking * mb_factor; - - if (factor < 0.00001) - factor = 0.00001; - - bits = cplx * factor; - cplx_sum += cplx; - bits_sum += bits; - cplx_tab[i] = cplx; - bits_tab[i] = bits; - } - - /* handle qmin/qmax clipping */ - if (s->flags & CODEC_FLAG_NORMALIZE_AQP) { - float factor = bits_sum / cplx_sum; - for (i = 0; i < s->mb_num; i++) { - float newq = q * cplx_tab[i] / bits_tab[i]; - newq *= factor; - - if (newq > qmax) { - bits_sum -= bits_tab[i]; - cplx_sum -= cplx_tab[i] * q / qmax; - } else if (newq < qmin) { - bits_sum -= bits_tab[i]; - cplx_sum -= cplx_tab[i] * q / qmin; - } - } - if (bits_sum < 0.001) - bits_sum = 0.001; - if (cplx_sum < 0.001) - cplx_sum = 0.001; - } - - for (i = 0; i < s->mb_num; i++) { - const int mb_xy = s->mb_index2xy[i]; - float newq = q * cplx_tab[i] / bits_tab[i]; - int intq; - - if (s->flags & CODEC_FLAG_NORMALIZE_AQP) { - newq *= bits_sum / cplx_sum; - } - - intq = (int)(newq + 0.5); - - if (intq > qmax) - intq = qmax; - else if (intq < qmin) - intq = qmin; - s->lambda_table[mb_xy] = intq; - } -} - -void ff_get_2pass_fcode(MpegEncContext *s) -{ - RateControlContext *rcc = &s->rc_context; - RateControlEntry *rce = &rcc->entry[s->picture_number]; - - s->f_code = rce->f_code; - s->b_code = rce->b_code; -} - -// FIXME rd or at least approx for dquant - -float ff_rate_estimate_qscale(MpegEncContext *s, int dry_run) -{ - float q; - int qmin, qmax; - float br_compensation; - double diff; - double short_term_q; - double fps; - int picture_number = s->picture_number; - int64_t wanted_bits; - RateControlContext *rcc = &s->rc_context; - AVCodecContext *a = s->avctx; - RateControlEntry local_rce, *rce; - double bits; - double rate_factor; - int var; - const int pict_type = s->pict_type; - Picture * const pic = &s->current_picture; - emms_c(); - -#if CONFIG_LIBXVID - if ((s->flags & CODEC_FLAG_PASS2) && - s->avctx->rc_strategy == FF_RC_STRATEGY_XVID) - return ff_xvid_rate_estimate_qscale(s, dry_run); -#endif - - get_qminmax(&qmin, &qmax, s, pict_type); - - fps = get_fps(s->avctx); - /* update predictors */ - if (picture_number > 2 && !dry_run) { - const int last_var = s->last_pict_type == AV_PICTURE_TYPE_I ? rcc->last_mb_var_sum - : rcc->last_mc_mb_var_sum; - av_assert1(s->frame_bits >= s->stuffing_bits); - update_predictor(&rcc->pred[s->last_pict_type], - rcc->last_qscale, - sqrt(last_var), - s->frame_bits - s->stuffing_bits); - } - - if (s->flags & CODEC_FLAG_PASS2) { - assert(picture_number >= 0); - if (picture_number >= rcc->num_entries) { - av_log(s, AV_LOG_ERROR, "Input is longer than 2-pass log file\n"); - return -1; - } - rce = &rcc->entry[picture_number]; - wanted_bits = rce->expected_bits; - } else { - Picture *dts_pic; - rce = &local_rce; - - /* FIXME add a dts field to AVFrame and ensure it is set and use it - * here instead of reordering but the reordering is simpler for now - * until H.264 B-pyramid must be handled. */ - if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) - dts_pic = s->current_picture_ptr; - else - dts_pic = s->last_picture_ptr; - - if (!dts_pic || dts_pic->f.pts == AV_NOPTS_VALUE) - wanted_bits = (uint64_t)(s->bit_rate * (double)picture_number / fps); - else - wanted_bits = (uint64_t)(s->bit_rate * (double)dts_pic->f.pts / fps); - } - - diff = s->total_bits - wanted_bits; - br_compensation = (a->bit_rate_tolerance - diff) / a->bit_rate_tolerance; - if (br_compensation <= 0.0) - br_compensation = 0.001; - - var = pict_type == AV_PICTURE_TYPE_I ? pic->mb_var_sum : pic->mc_mb_var_sum; - - short_term_q = 0; /* avoid warning */ - if (s->flags & CODEC_FLAG_PASS2) { - if (pict_type != AV_PICTURE_TYPE_I) - assert(pict_type == rce->new_pict_type); - - q = rce->new_qscale / br_compensation; - av_dlog(s, "%f %f %f last:%d var:%d type:%d//\n", q, rce->new_qscale, - br_compensation, s->frame_bits, var, pict_type); - } else { - rce->pict_type = - rce->new_pict_type = pict_type; - rce->mc_mb_var_sum = pic->mc_mb_var_sum; - rce->mb_var_sum = pic->mb_var_sum; - rce->qscale = FF_QP2LAMBDA * 2; - rce->f_code = s->f_code; - rce->b_code = s->b_code; - rce->misc_bits = 1; - - bits = predict_size(&rcc->pred[pict_type], rce->qscale, sqrt(var)); - if (pict_type == AV_PICTURE_TYPE_I) { - rce->i_count = s->mb_num; - rce->i_tex_bits = bits; - rce->p_tex_bits = 0; - rce->mv_bits = 0; - } else { - rce->i_count = 0; // FIXME we do know this approx - rce->i_tex_bits = 0; - rce->p_tex_bits = bits * 0.9; - rce->mv_bits = bits * 0.1; - } - rcc->i_cplx_sum[pict_type] += rce->i_tex_bits * rce->qscale; - rcc->p_cplx_sum[pict_type] += rce->p_tex_bits * rce->qscale; - rcc->mv_bits_sum[pict_type] += rce->mv_bits; - rcc->frame_count[pict_type]++; - - bits = rce->i_tex_bits + rce->p_tex_bits; - rate_factor = rcc->pass1_wanted_bits / - rcc->pass1_rc_eq_output_sum * br_compensation; - - q = get_qscale(s, rce, rate_factor, picture_number); - if (q < 0) - return -1; - - assert(q > 0.0); - q = get_diff_limited_q(s, rce, q); - assert(q > 0.0); - - // FIXME type dependent blur like in 2-pass - if (pict_type == AV_PICTURE_TYPE_P || s->intra_only) { - rcc->short_term_qsum *= a->qblur; - rcc->short_term_qcount *= a->qblur; - - rcc->short_term_qsum += q; - rcc->short_term_qcount++; - q = short_term_q = rcc->short_term_qsum / rcc->short_term_qcount; - } - assert(q > 0.0); - - q = modify_qscale(s, rce, q, picture_number); - - rcc->pass1_wanted_bits += s->bit_rate / fps; - - assert(q > 0.0); - } - - if (s->avctx->debug & FF_DEBUG_RC) { - av_log(s->avctx, AV_LOG_DEBUG, - "%c qp:%d<%2.1f<%d %d want:%d total:%d comp:%f st_q:%2.2f " - "size:%d var:%d/%d br:%d fps:%d\n", - av_get_picture_type_char(pict_type), - qmin, q, qmax, picture_number, - (int)wanted_bits / 1000, (int)s->total_bits / 1000, - br_compensation, short_term_q, s->frame_bits, - pic->mb_var_sum, pic->mc_mb_var_sum, - s->bit_rate / 1000, (int)fps); - } - - if (q < qmin) - q = qmin; - else if (q > qmax) - q = qmax; - - if (s->adaptive_quant) - adaptive_quantization(s, q); - else - q = (int)(q + 0.5); - - if (!dry_run) { - rcc->last_qscale = q; - rcc->last_mc_mb_var_sum = pic->mc_mb_var_sum; - rcc->last_mb_var_sum = pic->mb_var_sum; - } - return q; -} - -// ---------------------------------------------- -// 2-Pass code - -static int init_pass2(MpegEncContext *s) -{ - RateControlContext *rcc = &s->rc_context; - AVCodecContext *a = s->avctx; - int i, toobig; - double fps = get_fps(s->avctx); - double complexity[5] = { 0 }; // approximate bits at quant=1 - uint64_t const_bits[5] = { 0 }; // quantizer independent bits - uint64_t all_const_bits; - uint64_t all_available_bits = (uint64_t)(s->bit_rate * - (double)rcc->num_entries / fps); - double rate_factor = 0; - double step; - const int filter_size = (int)(a->qblur * 4) | 1; - double expected_bits = 0; // init to silence gcc warning - double *qscale, *blurred_qscale, qscale_sum; - - /* find complexity & const_bits & decide the pict_types */ - for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - - rce->new_pict_type = rce->pict_type; - rcc->i_cplx_sum[rce->pict_type] += rce->i_tex_bits * rce->qscale; - rcc->p_cplx_sum[rce->pict_type] += rce->p_tex_bits * rce->qscale; - rcc->mv_bits_sum[rce->pict_type] += rce->mv_bits; - rcc->frame_count[rce->pict_type]++; - - complexity[rce->new_pict_type] += (rce->i_tex_bits + rce->p_tex_bits) * - (double)rce->qscale; - const_bits[rce->new_pict_type] += rce->mv_bits + rce->misc_bits; - } - - all_const_bits = const_bits[AV_PICTURE_TYPE_I] + - const_bits[AV_PICTURE_TYPE_P] + - const_bits[AV_PICTURE_TYPE_B]; - - if (all_available_bits < all_const_bits) { - av_log(s->avctx, AV_LOG_ERROR, "requested bitrate is too low\n"); - return -1; - } - - qscale = av_malloc(sizeof(double) * rcc->num_entries); - blurred_qscale = av_malloc(sizeof(double) * rcc->num_entries); - toobig = 0; - - for (step = 256 * 256; step > 0.0000001; step *= 0.5) { - expected_bits = 0; - rate_factor += step; - - rcc->buffer_index = s->avctx->rc_buffer_size / 2; - - /* find qscale */ - for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - - qscale[i] = get_qscale(s, &rcc->entry[i], rate_factor, i); - rcc->last_qscale_for[rce->pict_type] = qscale[i]; - } - assert(filter_size % 2 == 1); - - /* fixed I/B QP relative to P mode */ - for (i = FFMAX(0, rcc->num_entries - 300); i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - - qscale[i] = get_diff_limited_q(s, rce, qscale[i]); - } - - for (i = rcc->num_entries - 1; i >= 0; i--) { - RateControlEntry *rce = &rcc->entry[i]; - - qscale[i] = get_diff_limited_q(s, rce, qscale[i]); - } - - /* smooth curve */ - for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - const int pict_type = rce->new_pict_type; - int j; - double q = 0.0, sum = 0.0; - - for (j = 0; j < filter_size; j++) { - int index = i + j - filter_size / 2; - double d = index - i; - double coeff = a->qblur == 0 ? 1.0 : exp(-d * d / (a->qblur * a->qblur)); - - if (index < 0 || index >= rcc->num_entries) - continue; - if (pict_type != rcc->entry[index].new_pict_type) - continue; - q += qscale[index] * coeff; - sum += coeff; - } - blurred_qscale[i] = q / sum; - } - - /* find expected bits */ - for (i = 0; i < rcc->num_entries; i++) { - RateControlEntry *rce = &rcc->entry[i]; - double bits; - - rce->new_qscale = modify_qscale(s, rce, blurred_qscale[i], i); - - bits = qp2bits(rce, rce->new_qscale) + rce->mv_bits + rce->misc_bits; - bits += 8 * ff_vbv_update(s, bits); - - rce->expected_bits = expected_bits; - expected_bits += bits; - } - - av_dlog(s->avctx, - "expected_bits: %f all_available_bits: %d rate_factor: %f\n", - expected_bits, (int)all_available_bits, rate_factor); - if (expected_bits > all_available_bits) { - rate_factor -= step; - ++toobig; - } - } - av_free(qscale); - av_free(blurred_qscale); - - /* check bitrate calculations and print info */ - qscale_sum = 0.0; - for (i = 0; i < rcc->num_entries; i++) { - av_dlog(s, "[lavc rc] entry[%d].new_qscale = %.3f qp = %.3f\n", - i, - rcc->entry[i].new_qscale, - rcc->entry[i].new_qscale / FF_QP2LAMBDA); - qscale_sum += av_clip(rcc->entry[i].new_qscale / FF_QP2LAMBDA, - s->avctx->qmin, s->avctx->qmax); - } - assert(toobig <= 40); - av_log(s->avctx, AV_LOG_DEBUG, - "[lavc rc] requested bitrate: %d bps expected bitrate: %d bps\n", - s->bit_rate, - (int)(expected_bits / ((double)all_available_bits / s->bit_rate))); - av_log(s->avctx, AV_LOG_DEBUG, - "[lavc rc] estimated target average qp: %.3f\n", - (float)qscale_sum / rcc->num_entries); - if (toobig == 0) { - av_log(s->avctx, AV_LOG_INFO, - "[lavc rc] Using all of requested bitrate is not " - "necessary for this video with these parameters.\n"); - } else if (toobig == 40) { - av_log(s->avctx, AV_LOG_ERROR, - "[lavc rc] Error: bitrate too low for this video " - "with these parameters.\n"); - return -1; - } else if (fabs(expected_bits / all_available_bits - 1.0) > 0.01) { - av_log(s->avctx, AV_LOG_ERROR, - "[lavc rc] Error: 2pass curve failed to converge\n"); - return -1; - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.h deleted file mode 100644 index 959b6a235..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ratecontrol.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Ratecontrol - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_RATECONTROL_H -#define AVCODEC_RATECONTROL_H - -/** - * @file - * ratecontrol header. - */ - -#include -#include -#include "libavutil/eval.h" - -typedef struct Predictor{ - double coeff; - double count; - double decay; -} Predictor; - -typedef struct RateControlEntry{ - int pict_type; - float qscale; - int mv_bits; - int i_tex_bits; - int p_tex_bits; - int misc_bits; - int header_bits; - uint64_t expected_bits; - int new_pict_type; - float new_qscale; - int mc_mb_var_sum; - int mb_var_sum; - int i_count; - int skip_count; - int f_code; - int b_code; -}RateControlEntry; - -/** - * rate control context. - */ -typedef struct RateControlContext{ - int num_entries; ///< number of RateControlEntries - RateControlEntry *entry; - double buffer_index; ///< amount of bits in the video/audio buffer - Predictor pred[5]; - double short_term_qsum; ///< sum of recent qscales - double short_term_qcount; ///< count of recent qscales - double pass1_rc_eq_output_sum;///< sum of the output of the rc equation, this is used for normalization - double pass1_wanted_bits; ///< bits which should have been outputed by the pass1 code (including complexity init) - double last_qscale; - double last_qscale_for[5]; ///< last qscale for a specific pict type, used for max_diff & ipb factor stuff - int last_mc_mb_var_sum; - int last_mb_var_sum; - uint64_t i_cplx_sum[5]; - uint64_t p_cplx_sum[5]; - uint64_t mv_bits_sum[5]; - uint64_t qscale_sum[5]; - int frame_count[5]; - int last_non_b_pict_type; - - void *non_lavc_opaque; ///< context for non lavc rc code (for example xvid) - float dry_run_qscale; ///< for xvid rc - int last_picture_number; ///< for xvid rc - AVExpr * rc_eq_eval; -}RateControlContext; - -struct MpegEncContext; - -/* rate control */ -int ff_rate_control_init(struct MpegEncContext *s); -float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); -void ff_write_pass1_stats(struct MpegEncContext *s); -void ff_rate_control_uninit(struct MpegEncContext *s); -int ff_vbv_update(struct MpegEncContext *s, int frame_size); -void ff_get_2pass_fcode(struct MpegEncContext *s); - -int ff_xvid_rate_control_init(struct MpegEncContext *s); -void ff_xvid_rate_control_uninit(struct MpegEncContext *s); -float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); - -#endif /* AVCODEC_RATECONTROL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.c deleted file mode 100644 index c3f3de169..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.c +++ /dev/null @@ -1,220 +0,0 @@ -/* - * Raw Video Codec - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Raw Video Codec - */ - -#include "avcodec.h" -#include "raw.h" -#include "libavutil/common.h" - -const PixelFormatTag ff_raw_pix_fmt_tags[] = { - { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ - { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, - { AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') }, - { AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, - { AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') }, - { AV_PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, - { AV_PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, - { AV_PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') }, - { AV_PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') }, - /* yuvjXXX formats are deprecated hacks specific to libav*, - they are identical to yuvXXX */ - { AV_PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ - { AV_PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') }, - { AV_PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') }, - { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, - { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') }, - - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */ - { AV_PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') }, - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') }, - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, - { AV_PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') }, - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') }, - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') }, - { AV_PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') }, - { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') }, - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */ - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */ - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') }, - { AV_PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */ - { AV_PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') }, - { AV_PIX_FMT_UYVY422, MKTAG('c', 'y', 'u', 'v') }, /* CYUV is also Creative YUV */ - { AV_PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') }, - { AV_PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, - { AV_PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') }, - { AV_PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') }, - - /* nut */ - { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) }, - { AV_PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) }, - { AV_PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) }, - { AV_PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) }, - { AV_PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) }, - { AV_PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) }, - { AV_PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGBA64LE, MKTAG('R', 'B', 'A', 64 ) }, - { AV_PIX_FMT_BGRA64LE, MKTAG('B', 'R', 'A', 64 ) }, - { AV_PIX_FMT_RGBA64BE, MKTAG(64 , 'R', 'B', 'A') }, - { AV_PIX_FMT_BGRA64BE, MKTAG(64 , 'B', 'R', 'A') }, - { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, - { AV_PIX_FMT_RGB0, MKTAG('R', 'G', 'B', 0 ) }, - { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, - { AV_PIX_FMT_BGR0, MKTAG('B', 'G', 'R', 0 ) }, - { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, - { AV_PIX_FMT_0BGR, MKTAG( 0 , 'B', 'G', 'R') }, - { AV_PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') }, - { AV_PIX_FMT_0RGB, MKTAG( 0 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) }, - { AV_PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) }, - { AV_PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') }, - { AV_PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') }, - { AV_PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') }, - { AV_PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') }, - { AV_PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') }, - { AV_PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') }, - { AV_PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') }, - { AV_PIX_FMT_MONOBLACK,MKTAG('B', '0', 'W', '1') }, - { AV_PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) }, - { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) }, - { AV_PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) }, - { AV_PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) }, - { AV_PIX_FMT_RGB4_BYTE,MKTAG('B', '4', 'B', 'Y') }, - { AV_PIX_FMT_BGR4_BYTE,MKTAG('R', '4', 'B', 'Y') }, - { AV_PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) }, - { AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') }, - { AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) }, - { AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') }, - { AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) }, - { AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') }, - { AV_PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) }, - { AV_PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) }, - { AV_PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) }, - { AV_PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P12LE, MKTAG('Y', '3', 11 , 12 ) }, - { AV_PIX_FMT_YUV420P12BE, MKTAG(12 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P12LE, MKTAG('Y', '3', 10 , 12 ) }, - { AV_PIX_FMT_YUV422P12BE, MKTAG(12 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P12LE, MKTAG('Y', '3', 0 , 12 ) }, - { AV_PIX_FMT_YUV444P12BE, MKTAG(12 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P14LE, MKTAG('Y', '3', 11 , 14 ) }, - { AV_PIX_FMT_YUV420P14BE, MKTAG(14 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P14LE, MKTAG('Y', '3', 10 , 14 ) }, - { AV_PIX_FMT_YUV422P14BE, MKTAG(14 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P14LE, MKTAG('Y', '3', 0 , 14 ) }, - { AV_PIX_FMT_YUV444P14BE, MKTAG(14 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) }, - { AV_PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) }, - { AV_PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) }, - { AV_PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) }, - { AV_PIX_FMT_YUVA422P, MKTAG('Y', '4', 10 , 8 ) }, - { AV_PIX_FMT_YUVA444P, MKTAG('Y', '4', 0 , 8 ) }, - { AV_PIX_FMT_GRAY8A, MKTAG('Y', '2', 0 , 8 ) }, - - { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) }, - { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) }, - { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) }, - { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) }, - { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) }, - { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) }, - { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) }, - { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) }, - { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) }, - { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') }, - - { AV_PIX_FMT_GBRP, MKTAG('G', '3', 00 , 8 ) }, - { AV_PIX_FMT_GBRP9LE, MKTAG('G', '3', 00 , 9 ) }, - { AV_PIX_FMT_GBRP9BE, MKTAG( 9 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP10LE, MKTAG('G', '3', 00 , 10 ) }, - { AV_PIX_FMT_GBRP10BE, MKTAG(10 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP12LE, MKTAG('G', '3', 00 , 12 ) }, - { AV_PIX_FMT_GBRP12BE, MKTAG(12 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP14LE, MKTAG('G', '3', 00 , 14 ) }, - { AV_PIX_FMT_GBRP14BE, MKTAG(14 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP16LE, MKTAG('G', '3', 00 , 16 ) }, - { AV_PIX_FMT_GBRP16BE, MKTAG(16 , 00 , '3', 'G') }, - - /* quicktime */ - { AV_PIX_FMT_YUV420P, MKTAG('R', '4', '2', '0') }, /* Radius DV YUV PAL */ - { AV_PIX_FMT_YUV411P, MKTAG('R', '4', '1', '1') }, /* Radius DV YUV NTSC */ - { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') }, - { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') }, - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */ - { AV_PIX_FMT_UYVY422, MKTAG('b', 'x', 'y', 'v') }, - { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') }, - { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */ - { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') }, - { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') }, - { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') }, - { AV_PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') }, - { AV_PIX_FMT_BGR24, MKTAG('b', 'x', 'b', 'g') }, - { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, - { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, - { AV_PIX_FMT_RGB24, MKTAG('b', 'x', 'r', 'g') }, - { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, - { AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') }, - { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') }, - - /* special */ - { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */ - { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */ - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'V', 'Y', 'U') }, /* YUYV, swapped UV */ - - { AV_PIX_FMT_NONE, 0 }, -}; - -unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt) -{ - const PixelFormatTag *tags = ff_raw_pix_fmt_tags; - while (tags->pix_fmt >= 0) { - if (tags->pix_fmt == fmt) - return tags->fourcc; - tags++; - } - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.h deleted file mode 100644 index 3e59f28e3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/raw.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Raw Video Codec - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Raw Video Codec - */ - -#ifndef AVCODEC_RAW_H -#define AVCODEC_RAW_H - -#include "avcodec.h" -#include "libavutil/internal.h" - -typedef struct PixelFormatTag { - enum AVPixelFormat pix_fmt; - unsigned int fourcc; -} PixelFormatTag; - -extern av_export const PixelFormatTag ff_raw_pix_fmt_tags[]; -#if LIBAVCODEC_VERSION_MAJOR < 55 -enum AVPixelFormat ff_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc); -#endif -enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc); - -#endif /* AVCODEC_RAW_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rawdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rawdec.c deleted file mode 100644 index 0423e38c1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rawdec.c +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Raw Video Decoder - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Raw Video Decoder - */ - -#include "avcodec.h" -#include "internal.h" -#include "raw.h" -#include "libavutil/avassert.h" -#include "libavutil/buffer.h" -#include "libavutil/common.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/imgutils.h" -#include "libavutil/opt.h" - -typedef struct RawVideoContext { - AVClass *av_class; - AVBufferRef *palette; - int frame_size; /* size of the frame in bytes */ - int flip; - int is_2_4_bpp; // 2 or 4 bpp raw in avi/mov - int is_yuv2; - int is_lt_16bpp; // 16bpp pixfmt and bits_per_coded_sample < 16 - int tff; -} RawVideoContext; - -static const AVOption options[]={ -{"top", "top field first", offsetof(RawVideoContext, tff), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM|AV_OPT_FLAG_VIDEO_PARAM}, -{NULL} -}; - -static const AVClass rawdec_class = { - .class_name = "rawdec", - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -static const PixelFormatTag pix_fmt_bps_avi[] = { - { AV_PIX_FMT_MONOWHITE, 1 }, - { AV_PIX_FMT_PAL8, 2 }, - { AV_PIX_FMT_PAL8, 4 }, - { AV_PIX_FMT_PAL8, 8 }, - { AV_PIX_FMT_RGB444LE, 12 }, - { AV_PIX_FMT_RGB555LE, 15 }, - { AV_PIX_FMT_RGB555LE, 16 }, - { AV_PIX_FMT_BGR24, 24 }, - { AV_PIX_FMT_BGRA, 32 }, - { AV_PIX_FMT_NONE, 0 }, -}; - -static const PixelFormatTag pix_fmt_bps_mov[] = { - { AV_PIX_FMT_MONOWHITE, 1 }, - { AV_PIX_FMT_PAL8, 2 }, - { AV_PIX_FMT_PAL8, 4 }, - { AV_PIX_FMT_PAL8, 8 }, - // FIXME swscale does not support 16 bit in .mov, sample 16bit.mov - // http://developer.apple.com/documentation/QuickTime/QTFF/QTFFChap3/qtff3.html - { AV_PIX_FMT_RGB555BE, 16 }, - { AV_PIX_FMT_RGB24, 24 }, - { AV_PIX_FMT_ARGB, 32 }, - { AV_PIX_FMT_MONOWHITE,33 }, - { AV_PIX_FMT_NONE, 0 }, -}; - -enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags, - unsigned int fourcc) -{ - while (tags->pix_fmt >= 0) { - if (tags->fourcc == fourcc) - return tags->pix_fmt; - tags++; - } - return AV_PIX_FMT_NONE; -} - -#if LIBAVCODEC_VERSION_MAJOR < 55 -enum AVPixelFormat ff_find_pix_fmt(const PixelFormatTag *tags, unsigned int fourcc) -{ - return avpriv_find_pix_fmt(tags, fourcc); -} -#endif - -static av_cold int raw_init_decoder(AVCodecContext *avctx) -{ - RawVideoContext *context = avctx->priv_data; - const AVPixFmtDescriptor *desc; - - if ( avctx->codec_tag == MKTAG('r','a','w',' ') - || avctx->codec_tag == MKTAG('N','O','1','6')) - avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_mov, - avctx->bits_per_coded_sample & 0x1f); - else if (avctx->codec_tag == MKTAG('W', 'R', 'A', 'W')) - avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi, - avctx->bits_per_coded_sample); - else if (avctx->codec_tag) - avctx->pix_fmt = avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, avctx->codec_tag); - else if (avctx->pix_fmt == AV_PIX_FMT_NONE && avctx->bits_per_coded_sample) - avctx->pix_fmt = avpriv_find_pix_fmt(pix_fmt_bps_avi, - avctx->bits_per_coded_sample); - - desc = av_pix_fmt_desc_get(avctx->pix_fmt); - if (!desc) { - av_log(avctx, AV_LOG_ERROR, "Invalid pixel format.\n"); - return AVERROR(EINVAL); - } - - if (desc->flags & (AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_PSEUDOPAL)) { - context->palette = av_buffer_alloc(AVPALETTE_SIZE); - if (!context->palette) - return AVERROR(ENOMEM); - if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) - avpriv_set_systematic_pal2((uint32_t*)context->palette->data, avctx->pix_fmt); - else - memset(context->palette->data, 0, AVPALETTE_SIZE); - } - - if (((avctx->bits_per_coded_sample & 0x1f) == 4 || (avctx->bits_per_coded_sample & 0x1f) == 2) && - avctx->pix_fmt == AV_PIX_FMT_PAL8 && - (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))) { - context->is_2_4_bpp = 1; - context->frame_size = avpicture_get_size(avctx->pix_fmt, - FFALIGN(avctx->width, 16), - avctx->height); - } else { - context->is_lt_16bpp = av_get_bits_per_pixel(desc) == 16 && avctx->bits_per_coded_sample && avctx->bits_per_coded_sample < 16; - context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width, - avctx->height); - } - - if ((avctx->extradata_size >= 9 && - !memcmp(avctx->extradata + avctx->extradata_size - 9, "BottomUp", 9)) || - avctx->codec_tag == MKTAG('c','y','u','v') || - avctx->codec_tag == MKTAG(3, 0, 0, 0) || - avctx->codec_tag == MKTAG('W','R','A','W')) - context->flip = 1; - - if (avctx->codec_tag == AV_RL32("yuv2") && - avctx->pix_fmt == AV_PIX_FMT_YUYV422) - context->is_yuv2 = 1; - - return 0; -} - -static void flip(AVCodecContext *avctx, AVPicture *picture) -{ - picture->data[0] += picture->linesize[0] * (avctx->height - 1); - picture->linesize[0] *= -1; -} - -static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame, - AVPacket *avpkt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); - RawVideoContext *context = avctx->priv_data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - int linesize_align = 4; - int res, len; - int need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp; - - AVFrame *frame = data; - AVPicture *picture = data; - - frame->pict_type = AV_PICTURE_TYPE_I; - frame->key_frame = 1; - frame->reordered_opaque = avctx->reordered_opaque; - frame->pkt_pts = avctx->internal->pkt->pts; - av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); - av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); - - if (context->tff >= 0) { - frame->interlaced_frame = 1; - frame->top_field_first = context->tff; - } - - if ((res = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0) - return res; - - if (need_copy) - frame->buf[0] = av_buffer_alloc(FFMAX(context->frame_size, buf_size)); - else - frame->buf[0] = av_buffer_ref(avpkt->buf); - if (!frame->buf[0]) - return AVERROR(ENOMEM); - - //2bpp and 4bpp raw in avi and mov (yes this is ugly ...) - if (context->is_2_4_bpp) { - int i; - uint8_t *dst = frame->buf[0]->data; - buf_size = context->frame_size - AVPALETTE_SIZE; - if ((avctx->bits_per_coded_sample & 0x1f) == 4) { - for (i = 0; 2 * i + 1 < buf_size && isize; i++) { - dst[2 * i + 0] = buf[i] >> 4; - dst[2 * i + 1] = buf[i] & 15; - } - linesize_align = 8; - } else { - av_assert0((avctx->bits_per_coded_sample & 0x1f) == 2); - for (i = 0; 4 * i + 3 < buf_size && isize; i++) { - dst[4 * i + 0] = buf[i] >> 6; - dst[4 * i + 1] = buf[i] >> 4 & 3; - dst[4 * i + 2] = buf[i] >> 2 & 3; - dst[4 * i + 3] = buf[i] & 3; - } - linesize_align = 16; - } - buf = dst; - } else if (context->is_lt_16bpp) { - int i; - uint8_t *dst = frame->buf[0]->data; - if (desc->flags & AV_PIX_FMT_FLAG_BE) { - for (i = 0; i + 1 < buf_size; i += 2) - AV_WB16(dst + i, AV_RB16(buf + i) << (16 - avctx->bits_per_coded_sample)); - } else { - for (i = 0; i + 1 < buf_size; i += 2) - AV_WL16(dst + i, AV_RL16(buf + i) << (16 - avctx->bits_per_coded_sample)); - } - buf = dst; - } else if (need_copy) { - memcpy(frame->buf[0]->data, buf, buf_size); - buf = frame->buf[0]->data; - } - - if (avctx->codec_tag == MKTAG('A', 'V', '1', 'x') || - avctx->codec_tag == MKTAG('A', 'V', 'u', 'p')) - buf += buf_size - context->frame_size; - - len = context->frame_size - (avctx->pix_fmt==AV_PIX_FMT_PAL8 ? AVPALETTE_SIZE : 0); - if (buf_size < len) { - av_log(avctx, AV_LOG_ERROR, "Invalid buffer size, packet size %d < expected frame_size %d\n", buf_size, len); - av_buffer_unref(&frame->buf[0]); - return AVERROR(EINVAL); - } - - if ((res = avpicture_fill(picture, buf, avctx->pix_fmt, - avctx->width, avctx->height)) < 0) { - av_buffer_unref(&frame->buf[0]); - return res; - } - - if (avctx->pix_fmt == AV_PIX_FMT_PAL8) { - const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, - NULL); - - if (pal) { - av_buffer_unref(&context->palette); - context->palette = av_buffer_alloc(AVPALETTE_SIZE); - if (!context->palette) { - av_buffer_unref(&frame->buf[0]); - return AVERROR(ENOMEM); - } - memcpy(context->palette->data, pal, AVPALETTE_SIZE); - frame->palette_has_changed = 1; - } - } - - if ((avctx->pix_fmt==AV_PIX_FMT_BGR24 || - avctx->pix_fmt==AV_PIX_FMT_GRAY8 || - avctx->pix_fmt==AV_PIX_FMT_RGB555LE || - avctx->pix_fmt==AV_PIX_FMT_RGB555BE || - avctx->pix_fmt==AV_PIX_FMT_RGB565LE || - avctx->pix_fmt==AV_PIX_FMT_MONOWHITE || - avctx->pix_fmt==AV_PIX_FMT_PAL8) && - FFALIGN(frame->linesize[0], linesize_align) * avctx->height <= buf_size) - frame->linesize[0] = FFALIGN(frame->linesize[0], linesize_align); - - if (avctx->pix_fmt == AV_PIX_FMT_NV12 && avctx->codec_tag == MKTAG('N', 'V', '1', '2') && - FFALIGN(frame->linesize[0], linesize_align) * avctx->height + - FFALIGN(frame->linesize[1], linesize_align) * ((avctx->height + 1) / 2) <= buf_size) { - int la0 = FFALIGN(frame->linesize[0], linesize_align); - frame->data[1] += (la0 - frame->linesize[0]) * avctx->height; - frame->linesize[0] = la0; - frame->linesize[1] = FFALIGN(frame->linesize[1], linesize_align); - } - - if ((avctx->pix_fmt == AV_PIX_FMT_PAL8 && buf_size < context->frame_size) || - (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)) { - frame->buf[1] = av_buffer_ref(context->palette); - if (!frame->buf[1]) { - av_buffer_unref(&frame->buf[0]); - return AVERROR(ENOMEM); - } - frame->data[1] = frame->buf[1]->data; - } - - if (avctx->pix_fmt == AV_PIX_FMT_BGR24 && - ((frame->linesize[0] + 3) & ~3) * avctx->height <= buf_size) - frame->linesize[0] = (frame->linesize[0] + 3) & ~3; - - if (context->flip) - flip(avctx, picture); - - if (avctx->codec_tag == MKTAG('Y', 'V', '1', '2') || - avctx->codec_tag == MKTAG('Y', 'V', '1', '6') || - avctx->codec_tag == MKTAG('Y', 'V', '2', '4') || - avctx->codec_tag == MKTAG('Y', 'V', 'U', '9')) - FFSWAP(uint8_t *, picture->data[1], picture->data[2]); - - if (avctx->codec_tag == AV_RL32("I420") && (avctx->width+1)*(avctx->height+1) * 3/2 == buf_size) { - picture->data[1] = picture->data[1] + (avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height; - picture->data[2] = picture->data[2] + ((avctx->width+1)*(avctx->height+1) -avctx->width*avctx->height)*5/4; - } - - if (avctx->codec_tag == AV_RL32("yuv2") && - avctx->pix_fmt == AV_PIX_FMT_YUYV422) { - int x, y; - uint8_t *line = picture->data[0]; - for (y = 0; y < avctx->height; y++) { - for (x = 0; x < avctx->width; x++) - line[2 * x + 1] ^= 0x80; - line += picture->linesize[0]; - } - } - if (avctx->codec_tag == AV_RL32("YVYU") && - avctx->pix_fmt == AV_PIX_FMT_YUYV422) { - int x, y; - uint8_t *line = picture->data[0]; - for(y = 0; y < avctx->height; y++) { - for(x = 0; x < avctx->width - 1; x += 2) - FFSWAP(uint8_t, line[2*x + 1], line[2*x + 3]); - line += picture->linesize[0]; - } - } - - if (avctx->field_order > AV_FIELD_PROGRESSIVE) { /* we have interlaced material flagged in container */ - frame->interlaced_frame = 1; - if (avctx->field_order == AV_FIELD_TT || avctx->field_order == AV_FIELD_TB) - frame->top_field_first = 1; - } - - *got_frame = 1; - return buf_size; -} - -static av_cold int raw_close_decoder(AVCodecContext *avctx) -{ - RawVideoContext *context = avctx->priv_data; - - av_buffer_unref(&context->palette); - return 0; -} - -AVCodec ff_rawvideo_decoder = { - .name = "rawvideo", - .type = AVMEDIA_TYPE_VIDEO, - .id = AV_CODEC_ID_RAWVIDEO, - .priv_data_size = sizeof(RawVideoContext), - .init = raw_init_decoder, - .close = raw_close_decoder, - .decode = raw_decode, - .long_name = NULL_IF_CONFIG_SMALL("raw video"), - .priv_class = &rawdec_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.c deleted file mode 100644 index 218dd4c24..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * (I)RDFT transforms - * Copyright (c) 2009 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -#include -#include "libavutil/mathematics.h" -#include "rdft.h" - -/** - * @file - * (Inverse) Real Discrete Fourier Transforms. - */ - -/* sin(2*pi*x/n) for 0<=xnbits; - const float k1 = 0.5; - const float k2 = 0.5 - s->inverse; - const FFTSample *tcos = s->tcos; - const FFTSample *tsin = s->tsin; - - if (!s->inverse) { - s->fft.fft_permute(&s->fft, (FFTComplex*)data); - s->fft.fft_calc(&s->fft, (FFTComplex*)data); - } - /* i=0 is a special case because of packing, the DC term is real, so we - are going to throw the N/2 term (also real) in with it. */ - ev.re = data[0]; - data[0] = ev.re+data[1]; - data[1] = ev.re-data[1]; - for (i = 1; i < (n>>2); i++) { - i1 = 2*i; - i2 = n-i1; - /* Separate even and odd FFTs */ - ev.re = k1*(data[i1 ]+data[i2 ]); - od.im = -k2*(data[i1 ]-data[i2 ]); - ev.im = k1*(data[i1+1]-data[i2+1]); - od.re = k2*(data[i1+1]+data[i2+1]); - /* Apply twiddle factors to the odd FFT and add to the even FFT */ - data[i1 ] = ev.re + od.re*tcos[i] - od.im*tsin[i]; - data[i1+1] = ev.im + od.im*tcos[i] + od.re*tsin[i]; - data[i2 ] = ev.re - od.re*tcos[i] + od.im*tsin[i]; - data[i2+1] = -ev.im + od.im*tcos[i] + od.re*tsin[i]; - } - data[2*i+1]=s->sign_convention*data[2*i+1]; - if (s->inverse) { - data[0] *= k1; - data[1] *= k1; - s->fft.fft_permute(&s->fft, (FFTComplex*)data); - s->fft.fft_calc(&s->fft, (FFTComplex*)data); - } -} - -av_cold int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans) -{ - int n = 1 << nbits; - int i; - const double theta = (trans == DFT_R2C || trans == DFT_C2R ? -1 : 1)*2*M_PI/n; - - s->nbits = nbits; - s->inverse = trans == IDFT_C2R || trans == DFT_C2R; - s->sign_convention = trans == IDFT_R2C || trans == DFT_C2R ? 1 : -1; - - if (nbits < 4 || nbits > 16) - return -1; - - if (ff_fft_init(&s->fft, nbits-1, trans == IDFT_C2R || trans == IDFT_R2C) < 0) - return -1; - - ff_init_ff_cos_tabs(nbits); - s->tcos = ff_cos_tabs[nbits]; - s->tsin = ff_sin_tabs[nbits]+(trans == DFT_R2C || trans == DFT_C2R)*(n>>2); -#if !CONFIG_HARDCODED_TABLES - for (i = 0; i < (n>>2); i++) { - s->tsin[i] = sin(i*theta); - } -#endif - s->rdft_calc = rdft_calc_c; - - if (ARCH_ARM) ff_rdft_init_arm(s); - - return 0; -} - -av_cold void ff_rdft_end(RDFTContext *s) -{ - ff_fft_end(&s->fft); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.h deleted file mode 100644 index 5fb03232a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rdft.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * (I)RDFT transforms - * Copyright (c) 2009 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_RDFT_H -#define AVCODEC_RDFT_H - -#include "config.h" -#include "fft.h" - -#if CONFIG_HARDCODED_TABLES -# define SINTABLE_CONST const -#else -# define SINTABLE_CONST -#endif - -#define SINTABLE(size) \ - SINTABLE_CONST DECLARE_ALIGNED(16, FFTSample, ff_sin_##size)[size/2] - -extern SINTABLE(16); -extern SINTABLE(32); -extern SINTABLE(64); -extern SINTABLE(128); -extern SINTABLE(256); -extern SINTABLE(512); -extern SINTABLE(1024); -extern SINTABLE(2048); -extern SINTABLE(4096); -extern SINTABLE(8192); -extern SINTABLE(16384); -extern SINTABLE(32768); -extern SINTABLE(65536); - -struct RDFTContext { - int nbits; - int inverse; - int sign_convention; - - /* pre/post rotation tables */ - const FFTSample *tcos; - SINTABLE_CONST FFTSample *tsin; - FFTContext fft; - void (*rdft_calc)(struct RDFTContext *s, FFTSample *z); -}; - -/** - * Set up a real FFT. - * @param nbits log2 of the length of the input array - * @param trans the type of transform - */ -int ff_rdft_init(RDFTContext *s, int nbits, enum RDFTransformType trans); -void ff_rdft_end(RDFTContext *s); - -void ff_rdft_init_arm(RDFTContext *s); - - -#endif /* AVCODEC_RDFT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rectangle.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rectangle.h deleted file mode 100644 index 594a76080..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rectangle.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * rectangle filling function - * Copyright (c) 2003 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * useful rectangle filling function - * @author Michael Niedermayer - */ - -#ifndef AVCODEC_RECTANGLE_H -#define AVCODEC_RECTANGLE_H - -#include "config.h" -#include "libavutil/common.h" -#include "libavutil/avassert.h" - -/** - * fill a rectangle. - * @param h height of the rectangle, should be a constant - * @param w width of the rectangle, should be a constant - * @param size the size of val (1, 2 or 4), should be a constant - */ -static av_always_inline void fill_rectangle(void *vp, int w, int h, int stride, uint32_t val, int size){ - uint8_t *p= (uint8_t*)vp; - av_assert2(size==1 || size==2 || size==4); - av_assert2(w<=4); - - w *= size; - stride *= size; - - av_assert2((((long)vp)&(FFMIN(w, 8<<(HAVE_NEON|ARCH_PPC|HAVE_MMX))-1)) == 0); - av_assert2((stride&(w-1))==0); - if(w==2){ - const uint16_t v= size==4 ? val : val*0x0101; - *(uint16_t*)(p + 0*stride)= v; - if(h==1) return; - *(uint16_t*)(p + 1*stride)= v; - if(h==2) return; - *(uint16_t*)(p + 2*stride)= v; - *(uint16_t*)(p + 3*stride)= v; - }else if(w==4){ - const uint32_t v= size==4 ? val : size==2 ? val*0x00010001 : val*0x01010101; - *(uint32_t*)(p + 0*stride)= v; - if(h==1) return; - *(uint32_t*)(p + 1*stride)= v; - if(h==2) return; - *(uint32_t*)(p + 2*stride)= v; - *(uint32_t*)(p + 3*stride)= v; - }else if(w==8){ - //gcc can't optimize 64bit math on x86_32 -#if HAVE_FAST_64BIT - const uint64_t v= size==2 ? val*0x0001000100010001ULL : val*0x0100000001ULL; - *(uint64_t*)(p + 0*stride)= v; - if(h==1) return; - *(uint64_t*)(p + 1*stride)= v; - if(h==2) return; - *(uint64_t*)(p + 2*stride)= v; - *(uint64_t*)(p + 3*stride)= v; - }else if(w==16){ - const uint64_t v= val*0x0100000001ULL; - *(uint64_t*)(p + 0+0*stride)= v; - *(uint64_t*)(p + 8+0*stride)= v; - *(uint64_t*)(p + 0+1*stride)= v; - *(uint64_t*)(p + 8+1*stride)= v; - if(h==2) return; - *(uint64_t*)(p + 0+2*stride)= v; - *(uint64_t*)(p + 8+2*stride)= v; - *(uint64_t*)(p + 0+3*stride)= v; - *(uint64_t*)(p + 8+3*stride)= v; -#else - const uint32_t v= size==2 ? val*0x00010001 : val; - *(uint32_t*)(p + 0+0*stride)= v; - *(uint32_t*)(p + 4+0*stride)= v; - if(h==1) return; - *(uint32_t*)(p + 0+1*stride)= v; - *(uint32_t*)(p + 4+1*stride)= v; - if(h==2) return; - *(uint32_t*)(p + 0+2*stride)= v; - *(uint32_t*)(p + 4+2*stride)= v; - *(uint32_t*)(p + 0+3*stride)= v; - *(uint32_t*)(p + 4+3*stride)= v; - }else if(w==16){ - *(uint32_t*)(p + 0+0*stride)= val; - *(uint32_t*)(p + 4+0*stride)= val; - *(uint32_t*)(p + 8+0*stride)= val; - *(uint32_t*)(p +12+0*stride)= val; - *(uint32_t*)(p + 0+1*stride)= val; - *(uint32_t*)(p + 4+1*stride)= val; - *(uint32_t*)(p + 8+1*stride)= val; - *(uint32_t*)(p +12+1*stride)= val; - if(h==2) return; - *(uint32_t*)(p + 0+2*stride)= val; - *(uint32_t*)(p + 4+2*stride)= val; - *(uint32_t*)(p + 8+2*stride)= val; - *(uint32_t*)(p +12+2*stride)= val; - *(uint32_t*)(p + 0+3*stride)= val; - *(uint32_t*)(p + 4+3*stride)= val; - *(uint32_t*)(p + 8+3*stride)= val; - *(uint32_t*)(p +12+3*stride)= val; -#endif - }else - av_assert2(0); - av_assert2(h==4); -} - -#endif /* AVCODEC_RECTANGLE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rl.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rl.h deleted file mode 100644 index c80283db7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rl.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2000-2002 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * rl header. - */ - -#ifndef AVCODEC_RL_H -#define AVCODEC_RL_H - -#include -#include "get_bits.h" - -/* run length table */ -#define MAX_RUN 64 -#define MAX_LEVEL 64 - -/** RLTable. */ -typedef struct RLTable { - int n; ///< number of entries of table_vlc minus 1 - int last; ///< number of values for last = 0 - const uint16_t (*table_vlc)[2]; - const int8_t *table_run; - const int8_t *table_level; - uint8_t *index_run[2]; ///< encoding only - int8_t *max_level[2]; ///< encoding & decoding - int8_t *max_run[2]; ///< encoding & decoding - VLC vlc; ///< decoding only deprecated FIXME remove - RL_VLC_ELEM *rl_vlc[32]; ///< decoding only -} RLTable; - -/** - * - * @param static_store static uint8_t array[2][2*MAX_RUN + MAX_LEVEL + 3] which will hold - * the level and run tables, if this is NULL av_malloc() will be used - */ -void ff_init_rl(RLTable *rl, uint8_t static_store[2][2*MAX_RUN + MAX_LEVEL + 3]); -void ff_init_vlc_rl(RLTable *rl); - -#define INIT_VLC_RL(rl, static_size)\ -{\ - int q;\ - static RL_VLC_ELEM rl_vlc_table[32][static_size];\ - INIT_VLC_STATIC(&rl.vlc, 9, rl.n + 1,\ - &rl.table_vlc[0][1], 4, 2,\ - &rl.table_vlc[0][0], 4, 2, static_size);\ -\ - if(!rl.rl_vlc[0]){\ - for(q=0; q<32; q++)\ - rl.rl_vlc[q]= rl_vlc_table[q];\ -\ - ff_init_vlc_rl(&rl);\ - }\ -} - -static inline int get_rl_index(const RLTable *rl, int last, int run, int level) -{ - int index; - index = rl->index_run[last][run]; - if (index >= rl->n) - return rl->n; - if (level > rl->max_level[last][run]) - return rl->n; - return index + level - 1; -} - -#endif /* AVCODEC_RL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rnd_avg.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rnd_avg.h deleted file mode 100644 index 50ab59a0f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/rnd_avg.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2001-2003 BERO - * Copyright (c) 2011 Oskar Arvidsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_RND_AVG_H -#define AVCODEC_RND_AVG_H - -#include -#include - -#define CALL_2X_PIXELS(a, b, n)\ -static void a(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h){\ - b(block , pixels , line_size, h);\ - b(block+n, pixels+n, line_size, h);\ -} - -#define BYTE_VEC32(c) ((c)*0x01010101UL) -#define BYTE_VEC64(c) ((c)*0x0001000100010001UL) - -static inline uint32_t rnd_avg32(uint32_t a, uint32_t b) -{ - return (a | b) - (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1); -} - -static inline uint32_t no_rnd_avg32(uint32_t a, uint32_t b) -{ - return (a & b) + (((a ^ b) & ~BYTE_VEC32(0x01)) >> 1); -} - -static inline uint64_t rnd_avg64(uint64_t a, uint64_t b) -{ - return (a | b) - (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1); -} - -static inline uint64_t no_rnd_avg64(uint64_t a, uint64_t b) -{ - return (a & b) + (((a ^ b) & ~BYTE_VEC64(0x01)) >> 1); -} - -#endif /* AVCODEC_RND_AVG_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbr.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbr.h deleted file mode 100644 index e28fccda0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbr.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Spectral Band Replication definitions and structures - * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) - * Copyright (c) 2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Spectral Band Replication definitions and structures - * @author Robert Swain ( rob opendot cl ) - */ - -#ifndef AVCODEC_SBR_H -#define AVCODEC_SBR_H - -#include -#include "fft.h" -#include "aacps.h" -#include "sbrdsp.h" - -typedef struct AACContext AACContext; - -/** - * Spectral Band Replication header - spectrum parameters that invoke a reset if they differ from the previous header. - */ -typedef struct SpectrumParameters { - uint8_t bs_start_freq; - uint8_t bs_stop_freq; - uint8_t bs_xover_band; - - /** - * @name Variables associated with bs_header_extra_1 - * @{ - */ - uint8_t bs_freq_scale; - uint8_t bs_alter_scale; - uint8_t bs_noise_bands; - /** @} */ -} SpectrumParameters; - -#define SBR_SYNTHESIS_BUF_SIZE ((1280-128)*2) - -/** - * Spectral Band Replication per channel data - */ -typedef struct SBRData { - /** - * @name Main bitstream data variables - * @{ - */ - unsigned bs_frame_class; - unsigned bs_add_harmonic_flag; - unsigned bs_num_env; - uint8_t bs_freq_res[7]; - unsigned bs_num_noise; - uint8_t bs_df_env[5]; - uint8_t bs_df_noise[2]; - uint8_t bs_invf_mode[2][5]; - uint8_t bs_add_harmonic[48]; - unsigned bs_amp_res; - /** @} */ - - /** - * @name State variables - * @{ - */ - DECLARE_ALIGNED(32, float, synthesis_filterbank_samples)[SBR_SYNTHESIS_BUF_SIZE]; - DECLARE_ALIGNED(32, float, analysis_filterbank_samples) [1312]; - int synthesis_filterbank_samples_offset; - ///l_APrev and l_A - int e_a[2]; - ///Chirp factors - float bw_array[5]; - ///QMF values of the original signal - float W[2][32][32][2]; - ///QMF output of the HF adjustor - int Ypos; - DECLARE_ALIGNED(16, float, Y)[2][38][64][2]; - DECLARE_ALIGNED(16, float, g_temp)[42][48]; - float q_temp[42][48]; - uint8_t s_indexmapped[8][48]; - ///Envelope scalefactors - float env_facs[6][48]; - ///Noise scalefactors - float noise_facs[3][5]; - ///Envelope time borders - uint8_t t_env[8]; - ///Envelope time border of the last envelope of the previous frame - uint8_t t_env_num_env_old; - ///Noise time borders - uint8_t t_q[3]; - unsigned f_indexnoise; - unsigned f_indexsine; - /** @} */ -} SBRData; - -typedef struct SpectralBandReplication SpectralBandReplication; - -/** - * aacsbr functions pointers - */ -typedef struct AACSBRContext { - int (*sbr_lf_gen)(AACContext *ac, SpectralBandReplication *sbr, - float X_low[32][40][2], const float W[2][32][32][2], - int buf_idx); - void (*sbr_hf_assemble)(float Y1[38][64][2], - const float X_high[64][40][2], - SpectralBandReplication *sbr, SBRData *ch_data, - const int e_a[2]); - int (*sbr_x_gen)(SpectralBandReplication *sbr, float X[2][38][64], - const float Y0[38][64][2], const float Y1[38][64][2], - const float X_low[32][40][2], int ch); - void (*sbr_hf_inverse_filter)(SBRDSPContext *dsp, - float (*alpha0)[2], float (*alpha1)[2], - const float X_low[32][40][2], int k0); -} AACSBRContext; - -/** - * Spectral Band Replication - */ -struct SpectralBandReplication { - int sample_rate; - int start; - int reset; - SpectrumParameters spectrum_params; - int bs_amp_res_header; - /** - * @name Variables associated with bs_header_extra_2 - * @{ - */ - unsigned bs_limiter_bands; - unsigned bs_limiter_gains; - unsigned bs_interpol_freq; - unsigned bs_smoothing_mode; - /** @} */ - unsigned bs_coupling; - unsigned k[5]; ///< k0, k1, k2 - ///kx', and kx respectively, kx is the first QMF subband where SBR is used. - ///kx' is its value from the previous frame - unsigned kx[2]; - ///M' and M respectively, M is the number of QMF subbands that use SBR. - unsigned m[2]; - unsigned kx_and_m_pushed; - ///The number of frequency bands in f_master - unsigned n_master; - SBRData data[2]; - PSContext ps; - ///N_Low and N_High respectively, the number of frequency bands for low and high resolution - unsigned n[2]; - ///Number of noise floor bands - unsigned n_q; - ///Number of limiter bands - unsigned n_lim; - ///The master QMF frequency grouping - uint16_t f_master[49]; - ///Frequency borders for low resolution SBR - uint16_t f_tablelow[25]; - ///Frequency borders for high resolution SBR - uint16_t f_tablehigh[49]; - ///Frequency borders for noise floors - uint16_t f_tablenoise[6]; - ///Frequency borders for the limiter - uint16_t f_tablelim[30]; - unsigned num_patches; - uint8_t patch_num_subbands[6]; - uint8_t patch_start_subband[6]; - ///QMF low frequency input to the HF generator - DECLARE_ALIGNED(16, float, X_low)[32][40][2]; - ///QMF output of the HF generator - DECLARE_ALIGNED(16, float, X_high)[64][40][2]; - ///QMF values of the reconstructed signal - DECLARE_ALIGNED(16, float, X)[2][2][38][64]; - ///Zeroth coefficient used to filter the subband signals - DECLARE_ALIGNED(16, float, alpha0)[64][2]; - ///First coefficient used to filter the subband signals - DECLARE_ALIGNED(16, float, alpha1)[64][2]; - ///Dequantized envelope scalefactors, remapped - float e_origmapped[7][48]; - ///Dequantized noise scalefactors, remapped - float q_mapped[7][48]; - ///Sinusoidal presence, remapped - uint8_t s_mapped[7][48]; - ///Estimated envelope - float e_curr[7][48]; - ///Amplitude adjusted noise scalefactors - float q_m[7][48]; - ///Sinusoidal levels - float s_m[7][48]; - float gain[7][48]; - DECLARE_ALIGNED(32, float, qmf_filter_scratch)[5][64]; - FFTContext mdct_ana; - FFTContext mdct; - SBRDSPContext dsp; - AACSBRContext c; -}; - -#endif /* AVCODEC_SBR_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.c deleted file mode 100644 index b4d5824e9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.c +++ /dev/null @@ -1,291 +0,0 @@ -/* - * AAC Spectral Band Replication decoding functions - * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl ) - * Copyright (c) 2009-2010 Alex Converse - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/intfloat.h" -#include "sbrdsp.h" - -static void sbr_sum64x5_c(float *z) -{ - int k; - for (k = 0; k < 64; k++) { - float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; - z[k] = f; - } -} - -static float sbr_sum_square_c(float (*x)[2], int n) -{ - float sum0 = 0.0f, sum1 = 0.0f; - int i; - - for (i = 0; i < n; i += 2) - { - sum0 += x[i + 0][0] * x[i + 0][0]; - sum1 += x[i + 0][1] * x[i + 0][1]; - sum0 += x[i + 1][0] * x[i + 1][0]; - sum1 += x[i + 1][1] * x[i + 1][1]; - } - - return sum0 + sum1; -} - -static void sbr_neg_odd_64_c(float *x) -{ - union av_intfloat32 *xi = (union av_intfloat32*) x; - int i; - for (i = 1; i < 64; i += 4) { - xi[i + 0].i ^= 1U << 31; - xi[i + 2].i ^= 1U << 31; - } -} - -static void sbr_qmf_pre_shuffle_c(float *z) -{ - union av_intfloat32 *zi = (union av_intfloat32*) z; - int k; - zi[64].i = zi[0].i; - zi[65].i = zi[1].i; - for (k = 1; k < 31; k += 2) { - zi[64 + 2 * k + 0].i = zi[64 - k].i ^ (1U << 31); - zi[64 + 2 * k + 1].i = zi[ k + 1].i; - zi[64 + 2 * k + 2].i = zi[63 - k].i ^ (1U << 31); - zi[64 + 2 * k + 3].i = zi[ k + 2].i; - } - - zi[64 + 2 * 31 + 0].i = zi[64 - 31].i ^ (1U << 31); - zi[64 + 2 * 31 + 1].i = zi[31 + 1].i; -} - -static void sbr_qmf_post_shuffle_c(float W[32][2], const float *z) -{ - const union av_intfloat32 *zi = (const union av_intfloat32*) z; - union av_intfloat32 *Wi = (union av_intfloat32*) W; - int k; - for (k = 0; k < 32; k += 2) { - Wi[2 * k + 0].i = zi[63 - k].i ^ (1U << 31); - Wi[2 * k + 1].i = zi[ k + 0].i; - Wi[2 * k + 2].i = zi[62 - k].i ^ (1U << 31); - Wi[2 * k + 3].i = zi[ k + 1].i; - } -} - -static void sbr_qmf_deint_neg_c(float *v, const float *src) -{ - const union av_intfloat32 *si = (const union av_intfloat32*)src; - union av_intfloat32 *vi = (union av_intfloat32*)v; - int i; - for (i = 0; i < 32; i++) { - vi[ i].i = si[63 - 2 * i ].i; - vi[63 - i].i = si[63 - 2 * i - 1].i ^ (1U << 31); - } -} - -static void sbr_qmf_deint_bfly_c(float *v, const float *src0, const float *src1) -{ - int i; - for (i = 0; i < 64; i++) { - v[ i] = src0[i] - src1[63 - i]; - v[127 - i] = src0[i] + src1[63 - i]; - } -} - -static av_always_inline void autocorrelate(const float x[40][2], - float phi[3][2][2], int lag) -{ - int i; - float real_sum = 0.0f; - float imag_sum = 0.0f; - if (lag) { - for (i = 1; i < 38; i++) { - real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1]; - imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0]; - } - phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1]; - phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0]; - if (lag == 1) { - phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1]; - phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0]; - } - } else { - for (i = 1; i < 38; i++) { - real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1]; - } - phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1]; - phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1]; - } -} - -static void sbr_autocorrelate_c(const float x[40][2], float phi[3][2][2]) -{ -#if 0 - /* This code is slower because it multiplies memory accesses. - * It is left for educational purposes and because it may offer - * a better reference for writing arch-specific DSP functions. */ - autocorrelate(x, phi, 0); - autocorrelate(x, phi, 1); - autocorrelate(x, phi, 2); -#else - float real_sum2 = x[0][0] * x[2][0] + x[0][1] * x[2][1]; - float imag_sum2 = x[0][0] * x[2][1] - x[0][1] * x[2][0]; - float real_sum1 = 0.0f, imag_sum1 = 0.0f, real_sum0 = 0.0f; - int i; - for (i = 1; i < 38; i++) { - real_sum0 += x[i][0] * x[i ][0] + x[i][1] * x[i ][1]; - real_sum1 += x[i][0] * x[i + 1][0] + x[i][1] * x[i + 1][1]; - imag_sum1 += x[i][0] * x[i + 1][1] - x[i][1] * x[i + 1][0]; - real_sum2 += x[i][0] * x[i + 2][0] + x[i][1] * x[i + 2][1]; - imag_sum2 += x[i][0] * x[i + 2][1] - x[i][1] * x[i + 2][0]; - } - phi[2 - 2][1][0] = real_sum2; - phi[2 - 2][1][1] = imag_sum2; - phi[2 ][1][0] = real_sum0 + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1]; - phi[1 ][0][0] = real_sum0 + x[38][0] * x[38][0] + x[38][1] * x[38][1]; - phi[2 - 1][1][0] = real_sum1 + x[ 0][0] * x[ 1][0] + x[ 0][1] * x[ 1][1]; - phi[2 - 1][1][1] = imag_sum1 + x[ 0][0] * x[ 1][1] - x[ 0][1] * x[ 1][0]; - phi[0 ][0][0] = real_sum1 + x[38][0] * x[39][0] + x[38][1] * x[39][1]; - phi[0 ][0][1] = imag_sum1 + x[38][0] * x[39][1] - x[38][1] * x[39][0]; -#endif -} - -static void sbr_hf_gen_c(float (*X_high)[2], const float (*X_low)[2], - const float alpha0[2], const float alpha1[2], - float bw, int start, int end) -{ - float alpha[4]; - int i; - - alpha[0] = alpha1[0] * bw * bw; - alpha[1] = alpha1[1] * bw * bw; - alpha[2] = alpha0[0] * bw; - alpha[3] = alpha0[1] * bw; - - for (i = start; i < end; i++) { - X_high[i][0] = - X_low[i - 2][0] * alpha[0] - - X_low[i - 2][1] * alpha[1] + - X_low[i - 1][0] * alpha[2] - - X_low[i - 1][1] * alpha[3] + - X_low[i][0]; - X_high[i][1] = - X_low[i - 2][1] * alpha[0] + - X_low[i - 2][0] * alpha[1] + - X_low[i - 1][1] * alpha[2] + - X_low[i - 1][0] * alpha[3] + - X_low[i][1]; - } -} - -static void sbr_hf_g_filt_c(float (*Y)[2], const float (*X_high)[40][2], - const float *g_filt, int m_max, intptr_t ixh) -{ - int m; - - for (m = 0; m < m_max; m++) { - Y[m][0] = X_high[m][ixh][0] * g_filt[m]; - Y[m][1] = X_high[m][ixh][1] * g_filt[m]; - } -} - -static av_always_inline void sbr_hf_apply_noise(float (*Y)[2], - const float *s_m, - const float *q_filt, - int noise, - float phi_sign0, - float phi_sign1, - int m_max) -{ - int m; - - for (m = 0; m < m_max; m++) { - float y0 = Y[m][0]; - float y1 = Y[m][1]; - noise = (noise + 1) & 0x1ff; - if (s_m[m]) { - y0 += s_m[m] * phi_sign0; - y1 += s_m[m] * phi_sign1; - } else { - y0 += q_filt[m] * ff_sbr_noise_table[noise][0]; - y1 += q_filt[m] * ff_sbr_noise_table[noise][1]; - } - Y[m][0] = y0; - Y[m][1] = y1; - phi_sign1 = -phi_sign1; - } -} - -static void sbr_hf_apply_noise_0(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max) -{ - sbr_hf_apply_noise(Y, s_m, q_filt, noise, 1.0, 0.0, m_max); -} - -static void sbr_hf_apply_noise_1(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max) -{ - float phi_sign = 1 - 2 * (kx & 1); - sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, phi_sign, m_max); -} - -static void sbr_hf_apply_noise_2(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max) -{ - sbr_hf_apply_noise(Y, s_m, q_filt, noise, -1.0, 0.0, m_max); -} - -static void sbr_hf_apply_noise_3(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max) -{ - float phi_sign = 1 - 2 * (kx & 1); - sbr_hf_apply_noise(Y, s_m, q_filt, noise, 0.0, -phi_sign, m_max); -} - -av_cold void ff_sbrdsp_init(SBRDSPContext *s) -{ - s->sum64x5 = sbr_sum64x5_c; - s->sum_square = sbr_sum_square_c; - s->neg_odd_64 = sbr_neg_odd_64_c; - s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_c; - s->qmf_post_shuffle = sbr_qmf_post_shuffle_c; - s->qmf_deint_neg = sbr_qmf_deint_neg_c; - s->qmf_deint_bfly = sbr_qmf_deint_bfly_c; - s->autocorrelate = sbr_autocorrelate_c; - s->hf_gen = sbr_hf_gen_c; - s->hf_g_filt = sbr_hf_g_filt_c; - - s->hf_apply_noise[0] = sbr_hf_apply_noise_0; - s->hf_apply_noise[1] = sbr_hf_apply_noise_1; - s->hf_apply_noise[2] = sbr_hf_apply_noise_2; - s->hf_apply_noise[3] = sbr_hf_apply_noise_3; - - if (ARCH_ARM) - ff_sbrdsp_init_arm(s); - if (ARCH_X86) - ff_sbrdsp_init_x86(s); - if (ARCH_MIPS) - ff_sbrdsp_init_mips(s); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.h deleted file mode 100644 index 1c1bcdfa9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sbrdsp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2012 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_SBRDSP_H -#define AVCODEC_SBRDSP_H - -#include - -typedef struct SBRDSPContext { - void (*sum64x5)(float *z); - float (*sum_square)(float (*x)[2], int n); - void (*neg_odd_64)(float *x); - void (*qmf_pre_shuffle)(float *z); - void (*qmf_post_shuffle)(float W[32][2], const float *z); - void (*qmf_deint_neg)(float *v, const float *src); - void (*qmf_deint_bfly)(float *v, const float *src0, const float *src1); - void (*autocorrelate)(const float x[40][2], float phi[3][2][2]); - void (*hf_gen)(float (*X_high)[2], const float (*X_low)[2], - const float alpha0[2], const float alpha1[2], - float bw, int start, int end); - void (*hf_g_filt)(float (*Y)[2], const float (*X_high)[40][2], - const float *g_filt, int m_max, intptr_t ixh); - void (*hf_apply_noise[4])(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max); -} SBRDSPContext; - -extern const float ff_sbr_noise_table[][2]; - -void ff_sbrdsp_init(SBRDSPContext *s); -void ff_sbrdsp_init_arm(SBRDSPContext *s); -void ff_sbrdsp_init_x86(SBRDSPContext *s); -void ff_sbrdsp_init_mips(SBRDSPContext *s); - -#endif /* AVCODEC_SBRDSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.c deleted file mode 100644 index 73f62b402..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Simple IDCT - * - * Copyright (c) 2001 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simpleidct in C. - */ - -#include "libavutil/intreadwrite.h" -#include "avcodec.h" -#include "mathops.h" -#include "simple_idct.h" - -#define BIT_DEPTH 8 -#include "simple_idct_template.c" -#undef BIT_DEPTH - -#define BIT_DEPTH 10 -#include "simple_idct_template.c" -#undef BIT_DEPTH - -#define BIT_DEPTH 12 -#include "simple_idct_template.c" -#undef BIT_DEPTH - -/* 2x4x8 idct */ - -#define CN_SHIFT 12 -#define C_FIX(x) ((int)((x) * (1 << CN_SHIFT) + 0.5)) -#define C1 C_FIX(0.6532814824) -#define C2 C_FIX(0.2705980501) - -/* row idct is multiple by 16 * sqrt(2.0), col idct4 is normalized, - and the butterfly must be multiplied by 0.5 * sqrt(2.0) */ -#define C_SHIFT (4+1+12) - -static inline void idct4col_put(uint8_t *dest, int line_size, const int16_t *col) -{ - int c0, c1, c2, c3, a0, a1, a2, a3; - - a0 = col[8*0]; - a1 = col[8*2]; - a2 = col[8*4]; - a3 = col[8*6]; - c0 = ((a0 + a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); - c2 = ((a0 - a2) << (CN_SHIFT - 1)) + (1 << (C_SHIFT - 1)); - c1 = a1 * C1 + a3 * C2; - c3 = a1 * C2 - a3 * C1; - dest[0] = av_clip_uint8((c0 + c1) >> C_SHIFT); - dest += line_size; - dest[0] = av_clip_uint8((c2 + c3) >> C_SHIFT); - dest += line_size; - dest[0] = av_clip_uint8((c2 - c3) >> C_SHIFT); - dest += line_size; - dest[0] = av_clip_uint8((c0 - c1) >> C_SHIFT); -} - -#define BF(k) \ -{\ - int a0, a1;\ - a0 = ptr[k];\ - a1 = ptr[8 + k];\ - ptr[k] = a0 + a1;\ - ptr[8 + k] = a0 - a1;\ -} - -/* only used by DV codec. The input must be interlaced. 128 is added - to the pixels before clamping to avoid systematic error - (1024*sqrt(2)) offset would be needed otherwise. */ -/* XXX: I think a 1.0/sqrt(2) normalization should be needed to - compensate the extra butterfly stage - I don't have the full DV - specification */ -void ff_simple_idct248_put(uint8_t *dest, int line_size, int16_t *block) -{ - int i; - int16_t *ptr; - - /* butterfly */ - ptr = block; - for(i=0;i<4;i++) { - BF(0); - BF(1); - BF(2); - BF(3); - BF(4); - BF(5); - BF(6); - BF(7); - ptr += 2 * 8; - } - - /* IDCT8 on each line */ - for(i=0; i<8; i++) { - idctRowCondDC_8(block + i*8, 0); - } - - /* IDCT4 and store */ - for(i=0;i<8;i++) { - idct4col_put(dest + i, 2 * line_size, block + i); - idct4col_put(dest + line_size + i, 2 * line_size, block + 8 + i); - } -} - -/* 8x4 & 4x8 WMV2 IDCT */ -#undef CN_SHIFT -#undef C_SHIFT -#undef C_FIX -#undef C1 -#undef C2 -#define CN_SHIFT 12 -#define C_FIX(x) ((int)((x) * 1.414213562 * (1 << CN_SHIFT) + 0.5)) -#define C1 C_FIX(0.6532814824) -#define C2 C_FIX(0.2705980501) -#define C3 C_FIX(0.5) -#define C_SHIFT (4+1+12) -static inline void idct4col_add(uint8_t *dest, int line_size, const int16_t *col) -{ - int c0, c1, c2, c3, a0, a1, a2, a3; - - a0 = col[8*0]; - a1 = col[8*1]; - a2 = col[8*2]; - a3 = col[8*3]; - c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1)); - c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1)); - c1 = a1 * C1 + a3 * C2; - c3 = a1 * C2 - a3 * C1; - dest[0] = av_clip_uint8(dest[0] + ((c0 + c1) >> C_SHIFT)); - dest += line_size; - dest[0] = av_clip_uint8(dest[0] + ((c2 + c3) >> C_SHIFT)); - dest += line_size; - dest[0] = av_clip_uint8(dest[0] + ((c2 - c3) >> C_SHIFT)); - dest += line_size; - dest[0] = av_clip_uint8(dest[0] + ((c0 - c1) >> C_SHIFT)); -} - -#define RN_SHIFT 15 -#define R_FIX(x) ((int)((x) * 1.414213562 * (1 << RN_SHIFT) + 0.5)) -#define R1 R_FIX(0.6532814824) -#define R2 R_FIX(0.2705980501) -#define R3 R_FIX(0.5) -#define R_SHIFT 11 -static inline void idct4row(int16_t *row) -{ - int c0, c1, c2, c3, a0, a1, a2, a3; - - a0 = row[0]; - a1 = row[1]; - a2 = row[2]; - a3 = row[3]; - c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); - c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1)); - c1 = a1 * R1 + a3 * R2; - c3 = a1 * R2 - a3 * R1; - row[0]= (c0 + c1) >> R_SHIFT; - row[1]= (c2 + c3) >> R_SHIFT; - row[2]= (c2 - c3) >> R_SHIFT; - row[3]= (c0 - c1) >> R_SHIFT; -} - -void ff_simple_idct84_add(uint8_t *dest, int line_size, int16_t *block) -{ - int i; - - /* IDCT8 on each line */ - for(i=0; i<4; i++) { - idctRowCondDC_8(block + i*8, 0); - } - - /* IDCT4 and store */ - for(i=0;i<8;i++) { - idct4col_add(dest + i, line_size, block + i); - } -} - -void ff_simple_idct48_add(uint8_t *dest, int line_size, int16_t *block) -{ - int i; - - /* IDCT4 on each line */ - for(i=0; i<8; i++) { - idct4row(block + i*8); - } - - /* IDCT8 and store */ - for(i=0; i<4; i++){ - idctSparseColAdd_8(dest + i, line_size, block + i); - } -} - -void ff_simple_idct44_add(uint8_t *dest, int line_size, int16_t *block) -{ - int i; - - /* IDCT4 on each line */ - for(i=0; i<4; i++) { - idct4row(block + i*8); - } - - /* IDCT4 and store */ - for(i=0; i<4; i++){ - idct4col_add(dest + i, line_size, block + i); - } -} - -void ff_prores_idct(int16_t *block, const int16_t *qmat) -{ - int i; - - for (i = 0; i < 64; i++) - block[i] *= qmat[i]; - - for (i = 0; i < 8; i++) - idctRowCondDC_10(block + i*8, 2); - - for (i = 0; i < 8; i++) - idctSparseCol_10(block + i); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.h deleted file mode 100644 index 7c0734b83..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Simple IDCT - * - * Copyright (c) 2001 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simple idct header. - */ - -#ifndef AVCODEC_SIMPLE_IDCT_H -#define AVCODEC_SIMPLE_IDCT_H - -#include - -void ff_simple_idct_put_8(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_add_8(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_8(int16_t *block); - -void ff_simple_idct_put_10(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_add_10(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_10(int16_t *block); - -void ff_simple_idct_put_12(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_add_12(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_12(int16_t *block); - -/** - * Special version of ff_simple_idct_10() which does dequantization - * and scales by a factor of 2 more between the two IDCTs to account - * for larger scale of input coefficients. - */ -void ff_prores_idct(int16_t *block, const int16_t *qmat); - -void ff_simple_idct_mmx(int16_t *block); -void ff_simple_idct_add_mmx(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct_put_mmx(uint8_t *dest, int line_size, int16_t *block); - -void ff_simple_idct248_put(uint8_t *dest, int line_size, int16_t *block); - -void ff_simple_idct84_add(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct48_add(uint8_t *dest, int line_size, int16_t *block); -void ff_simple_idct44_add(uint8_t *dest, int line_size, int16_t *block); - -#endif /* AVCODEC_SIMPLE_IDCT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct_template.c deleted file mode 100644 index 64a7be02c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/simple_idct_template.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Simple IDCT - * - * Copyright (c) 2001 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simpleidct in C. - */ - -/* - based upon some outcommented c code from mpeg2dec (idct_mmx.c - written by Aaron Holtzman ) - */ - -#include "bit_depth_template.c" - -#undef W1 -#undef W2 -#undef W3 -#undef W4 -#undef W5 -#undef W6 -#undef W7 -#undef ROW_SHIFT -#undef COL_SHIFT -#undef DC_SHIFT -#undef MUL -#undef MAC - -#if BIT_DEPTH == 8 - -#define W1 22725 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W2 21407 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W3 19266 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W4 16383 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W5 12873 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W6 8867 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 -#define W7 4520 //cos(i*M_PI/16)*sqrt(2)*(1<<14) + 0.5 - -#define ROW_SHIFT 11 -#define COL_SHIFT 20 -#define DC_SHIFT 3 - -#define MUL(a, b) MUL16(a, b) -#define MAC(a, b, c) MAC16(a, b, c) - -#elif BIT_DEPTH == 10 || BIT_DEPTH == 12 - -#if BIT_DEPTH == 10 -#define W1 90901 -#define W2 85627 -#define W3 77062 -#define W4 65535 -#define W5 51491 -#define W6 35468 -#define W7 18081 - -#define ROW_SHIFT 15 -#define COL_SHIFT 20 -#define DC_SHIFT 1 -#else -#define W1 45451 -#define W2 42813 -#define W3 38531 -#define W4 32767 -#define W5 25746 -#define W6 17734 -#define W7 9041 - -#define ROW_SHIFT 16 -#define COL_SHIFT 17 -#define DC_SHIFT -1 -#endif - -#define MUL(a, b) ((a) * (b)) -#define MAC(a, b, c) ((a) += (b) * (c)) - -#else - -#error "Unsupported bitdepth" - -#endif - -static inline void FUNC(idctRowCondDC)(int16_t *row, int extra_shift) -{ - int a0, a1, a2, a3, b0, b1, b2, b3; - -#if HAVE_FAST_64BIT -#define ROW0_MASK (0xffffLL << 48 * HAVE_BIGENDIAN) - if (((((uint64_t *)row)[0] & ~ROW0_MASK) | ((uint64_t *)row)[1]) == 0) { - uint64_t temp; - if (DC_SHIFT - extra_shift > 0) { - temp = (row[0] << (DC_SHIFT - extra_shift)) & 0xffff; - } else { - temp = (row[0] >> (extra_shift - DC_SHIFT)) & 0xffff; - } - temp += temp << 16; - temp += temp << 32; - ((uint64_t *)row)[0] = temp; - ((uint64_t *)row)[1] = temp; - return; - } -#else - if (!(((uint32_t*)row)[1] | - ((uint32_t*)row)[2] | - ((uint32_t*)row)[3] | - row[1])) { - uint32_t temp; - if (DC_SHIFT - extra_shift > 0) { - temp = (row[0] << (DC_SHIFT - extra_shift)) & 0xffff; - } else { - temp = (row[0] >> (extra_shift - DC_SHIFT)) & 0xffff; - } - temp += temp << 16; - ((uint32_t*)row)[0]=((uint32_t*)row)[1] = - ((uint32_t*)row)[2]=((uint32_t*)row)[3] = temp; - return; - } -#endif - - a0 = (W4 * row[0]) + (1 << (ROW_SHIFT - 1)); - a1 = a0; - a2 = a0; - a3 = a0; - - a0 += W2 * row[2]; - a1 += W6 * row[2]; - a2 -= W6 * row[2]; - a3 -= W2 * row[2]; - - b0 = MUL(W1, row[1]); - MAC(b0, W3, row[3]); - b1 = MUL(W3, row[1]); - MAC(b1, -W7, row[3]); - b2 = MUL(W5, row[1]); - MAC(b2, -W1, row[3]); - b3 = MUL(W7, row[1]); - MAC(b3, -W5, row[3]); - - if (AV_RN64A(row + 4)) { - a0 += W4*row[4] + W6*row[6]; - a1 += - W4*row[4] - W2*row[6]; - a2 += - W4*row[4] + W2*row[6]; - a3 += W4*row[4] - W6*row[6]; - - MAC(b0, W5, row[5]); - MAC(b0, W7, row[7]); - - MAC(b1, -W1, row[5]); - MAC(b1, -W5, row[7]); - - MAC(b2, W7, row[5]); - MAC(b2, W3, row[7]); - - MAC(b3, W3, row[5]); - MAC(b3, -W1, row[7]); - } - - row[0] = (a0 + b0) >> (ROW_SHIFT + extra_shift); - row[7] = (a0 - b0) >> (ROW_SHIFT + extra_shift); - row[1] = (a1 + b1) >> (ROW_SHIFT + extra_shift); - row[6] = (a1 - b1) >> (ROW_SHIFT + extra_shift); - row[2] = (a2 + b2) >> (ROW_SHIFT + extra_shift); - row[5] = (a2 - b2) >> (ROW_SHIFT + extra_shift); - row[3] = (a3 + b3) >> (ROW_SHIFT + extra_shift); - row[4] = (a3 - b3) >> (ROW_SHIFT + extra_shift); -} - -#define IDCT_COLS do { \ - a0 = W4 * (col[8*0] + ((1<<(COL_SHIFT-1))/W4)); \ - a1 = a0; \ - a2 = a0; \ - a3 = a0; \ - \ - a0 += W2*col[8*2]; \ - a1 += W6*col[8*2]; \ - a2 += -W6*col[8*2]; \ - a3 += -W2*col[8*2]; \ - \ - b0 = MUL(W1, col[8*1]); \ - b1 = MUL(W3, col[8*1]); \ - b2 = MUL(W5, col[8*1]); \ - b3 = MUL(W7, col[8*1]); \ - \ - MAC(b0, W3, col[8*3]); \ - MAC(b1, -W7, col[8*3]); \ - MAC(b2, -W1, col[8*3]); \ - MAC(b3, -W5, col[8*3]); \ - \ - if (col[8*4]) { \ - a0 += W4*col[8*4]; \ - a1 += -W4*col[8*4]; \ - a2 += -W4*col[8*4]; \ - a3 += W4*col[8*4]; \ - } \ - \ - if (col[8*5]) { \ - MAC(b0, W5, col[8*5]); \ - MAC(b1, -W1, col[8*5]); \ - MAC(b2, W7, col[8*5]); \ - MAC(b3, W3, col[8*5]); \ - } \ - \ - if (col[8*6]) { \ - a0 += W6*col[8*6]; \ - a1 += -W2*col[8*6]; \ - a2 += W2*col[8*6]; \ - a3 += -W6*col[8*6]; \ - } \ - \ - if (col[8*7]) { \ - MAC(b0, W7, col[8*7]); \ - MAC(b1, -W5, col[8*7]); \ - MAC(b2, W3, col[8*7]); \ - MAC(b3, -W1, col[8*7]); \ - } \ - } while (0) - -static inline void FUNC(idctSparseColPut)(pixel *dest, int line_size, - int16_t *col) -{ - int a0, a1, a2, a3, b0, b1, b2, b3; - - IDCT_COLS; - - dest[0] = av_clip_pixel((a0 + b0) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a1 + b1) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a2 + b2) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a3 + b3) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a3 - b3) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a2 - b2) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a1 - b1) >> COL_SHIFT); - dest += line_size; - dest[0] = av_clip_pixel((a0 - b0) >> COL_SHIFT); -} - -static inline void FUNC(idctSparseColAdd)(pixel *dest, int line_size, - int16_t *col) -{ - int a0, a1, a2, a3, b0, b1, b2, b3; - - IDCT_COLS; - - dest[0] = av_clip_pixel(dest[0] + ((a0 + b0) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a1 + b1) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a2 + b2) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a3 + b3) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a3 - b3) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a2 - b2) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a1 - b1) >> COL_SHIFT)); - dest += line_size; - dest[0] = av_clip_pixel(dest[0] + ((a0 - b0) >> COL_SHIFT)); -} - -static inline void FUNC(idctSparseCol)(int16_t *col) -{ - int a0, a1, a2, a3, b0, b1, b2, b3; - - IDCT_COLS; - - col[0 ] = ((a0 + b0) >> COL_SHIFT); - col[8 ] = ((a1 + b1) >> COL_SHIFT); - col[16] = ((a2 + b2) >> COL_SHIFT); - col[24] = ((a3 + b3) >> COL_SHIFT); - col[32] = ((a3 - b3) >> COL_SHIFT); - col[40] = ((a2 - b2) >> COL_SHIFT); - col[48] = ((a1 - b1) >> COL_SHIFT); - col[56] = ((a0 - b0) >> COL_SHIFT); -} - -void FUNC(ff_simple_idct_put)(uint8_t *dest_, int line_size, int16_t *block) -{ - pixel *dest = (pixel *)dest_; - int i; - - line_size /= sizeof(pixel); - - for (i = 0; i < 8; i++) - FUNC(idctRowCondDC)(block + i*8, 0); - - for (i = 0; i < 8; i++) - FUNC(idctSparseColPut)(dest + i, line_size, block + i); -} - -void FUNC(ff_simple_idct_add)(uint8_t *dest_, int line_size, int16_t *block) -{ - pixel *dest = (pixel *)dest_; - int i; - - line_size /= sizeof(pixel); - - for (i = 0; i < 8; i++) - FUNC(idctRowCondDC)(block + i*8, 0); - - for (i = 0; i < 8; i++) - FUNC(idctSparseColAdd)(dest + i, line_size, block + i); -} - -void FUNC(ff_simple_idct)(int16_t *block) -{ - int i; - - for (i = 0; i < 8; i++) - FUNC(idctRowCondDC)(block + i*8, 0); - - for (i = 0; i < 8; i++) - FUNC(idctSparseCol)(block + i); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.c deleted file mode 100644 index 1fa0e953f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "sinewin.h" -#include "sinewin_tablegen.h" diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.h deleted file mode 100644 index 2268fd52f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2008 Robert Swain - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_SINEWIN_H -#define AVCODEC_SINEWIN_H - -#include "config.h" -#include "libavutil/mem.h" - -#if CONFIG_HARDCODED_TABLES -# define SINETABLE_CONST const -#else -# define SINETABLE_CONST -#endif - -#define SINETABLE(size) \ - SINETABLE_CONST DECLARE_ALIGNED(32, float, ff_sine_##size)[size] - -/** - * Generate a sine window. - * @param window pointer to half window - * @param n size of half window - */ -void ff_sine_window_init(float *window, int n); - -/** - * initialize the specified entry of ff_sine_windows - */ -void ff_init_ff_sine_windows(int index); - -extern SINETABLE( 32); -extern SINETABLE( 64); -extern SINETABLE( 128); -extern SINETABLE( 256); -extern SINETABLE( 512); -extern SINETABLE(1024); -extern SINETABLE(2048); -extern SINETABLE(4096); -extern SINETABLE(8192); - -extern SINETABLE_CONST float * const ff_sine_windows[14]; - -#endif /* AVCODEC_SINEWIN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.c deleted file mode 100644 index 561ae3ea1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Generate a header file for hardcoded sine windows - * - * Copyright (c) 2009 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#define CONFIG_HARDCODED_TABLES 0 -#define SINETABLE_CONST -#define SINETABLE(size) \ - float ff_sine_##size[size] -#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) -#include "sinewin_tablegen.h" -#include "tableprint.h" - -int main(void) -{ - int i; - - write_fileheader(); - - for (i = 5; i <= 13; i++) { - ff_init_ff_sine_windows(i); - printf("SINETABLE(%4i) = {\n", 1 << i); - write_float_array(ff_sine_windows[i], 1 << i); - printf("};\n"); - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.h deleted file mode 100644 index 2b9c4f239..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/sinewin_tablegen.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Header file for hardcoded sine windows - * - * Copyright (c) 2009 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_SINEWIN_TABLEGEN_H -#define AVCODEC_SINEWIN_TABLEGEN_H - -#include -// do not use libavutil/libm.h since this is compiled both -// for the host and the target and config.h is only valid for the target -#include -#include "libavutil/attributes.h" -#include "libavutil/common.h" - -#if !CONFIG_HARDCODED_TABLES -SINETABLE( 32); -SINETABLE( 64); -SINETABLE( 128); -SINETABLE( 256); -SINETABLE( 512); -SINETABLE(1024); -SINETABLE(2048); -SINETABLE(4096); -SINETABLE(8192); -#else -#include "libavcodec/sinewin_tables.h" -#endif - -SINETABLE_CONST float * const ff_sine_windows[] = { - NULL, NULL, NULL, NULL, NULL, // unused - ff_sine_32 , ff_sine_64 , - ff_sine_128, ff_sine_256, ff_sine_512, ff_sine_1024, ff_sine_2048, ff_sine_4096, ff_sine_8192 -}; - -// Generate a sine window. -av_cold void ff_sine_window_init(float *window, int n) { - int i; - for(i = 0; i < n; i++) - window[i] = sinf((i + 0.5) * (M_PI / (2.0 * n))); -} - -av_cold void ff_init_ff_sine_windows(int index) { - assert(index >= 0 && index < FF_ARRAY_ELEMS(ff_sine_windows)); -#if !CONFIG_HARDCODED_TABLES - ff_sine_window_init(ff_sine_windows[index], 1 << index); -#endif -} - -#endif /* AVCODEC_SINEWIN_TABLEGEN_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.c deleted file mode 100644 index 5f1053097..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * copyright (c) 2008 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "fft.h" -#include "synth_filter.h" - -static void synth_filter_float(FFTContext *imdct, - float *synth_buf_ptr, int *synth_buf_offset, - float synth_buf2[32], const float window[512], - float out[32], const float in[32], float scale) -{ - float *synth_buf= synth_buf_ptr + *synth_buf_offset; - int i, j; - - imdct->imdct_half(imdct, synth_buf, in); - - for (i = 0; i < 16; i++){ - float a= synth_buf2[i ]; - float b= synth_buf2[i + 16]; - float c= 0; - float d= 0; - for (j = 0; j < 512 - *synth_buf_offset; j += 64){ - a += window[i + j ]*(-synth_buf[15 - i + j ]); - b += window[i + j + 16]*( synth_buf[ i + j ]); - c += window[i + j + 32]*( synth_buf[16 + i + j ]); - d += window[i + j + 48]*( synth_buf[31 - i + j ]); - } - for ( ; j < 512; j += 64){ - a += window[i + j ]*(-synth_buf[15 - i + j - 512]); - b += window[i + j + 16]*( synth_buf[ i + j - 512]); - c += window[i + j + 32]*( synth_buf[16 + i + j - 512]); - d += window[i + j + 48]*( synth_buf[31 - i + j - 512]); - } - out[i ] = a*scale; - out[i + 16] = b*scale; - synth_buf2[i ] = c; - synth_buf2[i + 16] = d; - } - *synth_buf_offset= (*synth_buf_offset - 32)&511; -} - -av_cold void ff_synth_filter_init(SynthFilterContext *c) -{ - c->synth_filter_float = synth_filter_float; - - if (ARCH_ARM) ff_synth_filter_init_arm(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.h deleted file mode 100644 index 33edcc437..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/synth_filter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * copyright (c) 2008 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_SYNTH_FILTER_H -#define AVCODEC_SYNTH_FILTER_H - -#include "fft.h" - -typedef struct SynthFilterContext { - void (*synth_filter_float)(FFTContext *imdct, - float *synth_buf_ptr, int *synth_buf_offset, - float synth_buf2[32], const float window[512], - float out[32], const float in[32], - float scale); -} SynthFilterContext; - -void ff_synth_filter_init(SynthFilterContext *c); -void ff_synth_filter_init_arm(SynthFilterContext *c); - -#endif /* AVCODEC_SYNTH_FILTER_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tableprint.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tableprint.h deleted file mode 100644 index 1b39dc6ba..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tableprint.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Generate a file for hardcoded tables - * - * Copyright (c) 2009 Reimar Döffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_TABLEPRINT_H -#define AVCODEC_TABLEPRINT_H - -#include -#include - -#include "libavutil/common.h" - -#define WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, ...)\ -void write_##type##_array(const type *data, int len)\ -{\ - int i;\ - printf(" ");\ - for (i = 0; i < len - 1; i++) {\ - printf(" "fmtstr",", __VA_ARGS__);\ - if ((i & linebrk) == linebrk) printf("\n ");\ - }\ - printf(" "fmtstr"\n", __VA_ARGS__);\ -} - -#define WRITE_1D_FUNC(type, fmtstr, linebrk)\ - WRITE_1D_FUNC_ARGV(type, linebrk, fmtstr, data[i]) - -#define WRITE_2D_FUNC(type)\ -void write_##type##_2d_array(const void *arg, int len, int len2)\ -{\ - const type *data = arg;\ - int i;\ - printf(" {\n");\ - for (i = 0; i < len; i++) {\ - write_##type##_array(data + i * len2, len2);\ - printf(i == len - 1 ? " }\n" : " }, {\n");\ - }\ -} - -/** - * @name Predefined functions for printing tables - * - * @{ - */ -void write_int8_t_array (const int8_t *, int); -void write_uint8_t_array (const uint8_t *, int); -void write_uint16_t_array (const uint16_t *, int); -void write_uint32_t_array (const uint32_t *, int); -void write_float_array (const float *, int); -void write_int8_t_2d_array (const void *, int, int); -void write_uint8_t_2d_array (const void *, int, int); -void write_uint32_t_2d_array(const void *, int, int); -void write_float_2d_array (const void *, int, int); -/** @} */ // end of printfuncs group - -#define WRITE_ARRAY(prefix, type, name) \ - do { \ - const size_t array_size = FF_ARRAY_ELEMS(name); \ - printf(prefix" "#type" "#name"[%zu] = {\n", \ - array_size); \ - write_##type##_array(name, array_size); \ - printf("};\n"); \ - } while(0) - -#define WRITE_2D_ARRAY(prefix, type, name) \ - do { \ - const size_t array_size1 = FF_ARRAY_ELEMS(name); \ - const size_t array_size2 = FF_ARRAY_ELEMS(name[0]); \ - printf(prefix" "#type" "#name"[%zu][%zu] = {\n", \ - array_size1, array_size2 ); \ - write_##type##_2d_array(name, array_size1, array_size2); \ - printf("};\n"); \ - } while(0) - - -WRITE_1D_FUNC(int8_t, "%3"PRIi8, 15) -WRITE_1D_FUNC(uint8_t, "0x%02"PRIx8, 15) -WRITE_1D_FUNC(uint16_t, "0x%08"PRIx16, 7) -WRITE_1D_FUNC(uint32_t, "0x%08"PRIx32, 7) -WRITE_1D_FUNC(float, "%.18e", 3) - -WRITE_2D_FUNC(int8_t) -WRITE_2D_FUNC(uint8_t) -WRITE_2D_FUNC(uint32_t) -WRITE_2D_FUNC(float) - -static inline void write_fileheader(void) -{ - printf("/* This file was automatically generated. */\n"); - printf("#include \n"); -} - -#endif /* AVCODEC_TABLEPRINT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.c deleted file mode 100644 index ed41ca8a2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * TAK common code - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/crc.h" -#include "libavutil/intreadwrite.h" -#include "tak.h" - -static const int64_t tak_channel_layouts[] = { - 0, - AV_CH_FRONT_LEFT, - AV_CH_FRONT_RIGHT, - AV_CH_FRONT_CENTER, - AV_CH_LOW_FREQUENCY, - AV_CH_BACK_LEFT, - AV_CH_BACK_RIGHT, - AV_CH_FRONT_LEFT_OF_CENTER, - AV_CH_FRONT_RIGHT_OF_CENTER, - AV_CH_BACK_CENTER, - AV_CH_SIDE_LEFT, - AV_CH_SIDE_RIGHT, - AV_CH_TOP_CENTER, - AV_CH_TOP_FRONT_LEFT, - AV_CH_TOP_FRONT_CENTER, - AV_CH_TOP_FRONT_RIGHT, - AV_CH_TOP_BACK_LEFT, - AV_CH_TOP_BACK_CENTER, - AV_CH_TOP_BACK_RIGHT, -}; - -static const uint16_t frame_duration_type_quants[] = { - 3, 4, 6, 8, 4096, 8192, 16384, 512, 1024, 2048, -}; - -static int tak_get_nb_samples(int sample_rate, enum TAKFrameSizeType type) -{ - int nb_samples, max_nb_samples; - - if (type <= TAK_FST_250ms) { - nb_samples = sample_rate * frame_duration_type_quants[type] >> - TAK_FRAME_DURATION_QUANT_SHIFT; - max_nb_samples = 16384; - } else if (type < FF_ARRAY_ELEMS(frame_duration_type_quants)) { - nb_samples = frame_duration_type_quants[type]; - max_nb_samples = sample_rate * - frame_duration_type_quants[TAK_FST_250ms] >> - TAK_FRAME_DURATION_QUANT_SHIFT; - } else { - return AVERROR_INVALIDDATA; - } - - if (nb_samples <= 0 || nb_samples > max_nb_samples) - return AVERROR_INVALIDDATA; - - return nb_samples; -} - -int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size) -{ - uint32_t crc, CRC; - - if (buf_size < 4) - return AVERROR_INVALIDDATA; - buf_size -= 3; - - CRC = AV_RB24(buf + buf_size); - crc = av_crc(av_crc_get_table(AV_CRC_24_IEEE), 0xCE04B7U, buf, buf_size); - if (CRC != crc) - return AVERROR_INVALIDDATA; - - return 0; -} - -void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s) -{ - uint64_t channel_mask = 0; - int frame_type, i; - - s->codec = get_bits(gb, TAK_ENCODER_CODEC_BITS); - skip_bits(gb, TAK_ENCODER_PROFILE_BITS); - - frame_type = get_bits(gb, TAK_SIZE_FRAME_DURATION_BITS); - s->samples = get_bits64(gb, TAK_SIZE_SAMPLES_NUM_BITS); - - s->data_type = get_bits(gb, TAK_FORMAT_DATA_TYPE_BITS); - s->sample_rate = get_bits(gb, TAK_FORMAT_SAMPLE_RATE_BITS) + - TAK_SAMPLE_RATE_MIN; - s->bps = get_bits(gb, TAK_FORMAT_BPS_BITS) + - TAK_BPS_MIN; - s->channels = get_bits(gb, TAK_FORMAT_CHANNEL_BITS) + - TAK_CHANNELS_MIN; - - if (get_bits1(gb)) { - skip_bits(gb, TAK_FORMAT_VALID_BITS); - if (get_bits1(gb)) { - for (i = 0; i < s->channels; i++) { - int value = get_bits(gb, TAK_FORMAT_CH_LAYOUT_BITS); - - if (value < FF_ARRAY_ELEMS(tak_channel_layouts)) - channel_mask |= tak_channel_layouts[value]; - } - } - } - - s->ch_layout = channel_mask; - s->frame_samples = tak_get_nb_samples(s->sample_rate, frame_type); -} - -int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, - TAKStreamInfo *ti, int log_level_offset) -{ - if (get_bits(gb, TAK_FRAME_HEADER_SYNC_ID_BITS) != TAK_FRAME_HEADER_SYNC_ID) { - av_log(avctx, AV_LOG_ERROR + log_level_offset, "missing sync id\n"); - return AVERROR_INVALIDDATA; - } - - ti->flags = get_bits(gb, TAK_FRAME_HEADER_FLAGS_BITS); - ti->frame_num = get_bits(gb, TAK_FRAME_HEADER_NO_BITS); - - if (ti->flags & TAK_FRAME_FLAG_IS_LAST) { - ti->last_frame_samples = get_bits(gb, TAK_FRAME_HEADER_SAMPLE_COUNT_BITS) + 1; - skip_bits(gb, 2); - } else { - ti->last_frame_samples = 0; - } - - if (ti->flags & TAK_FRAME_FLAG_HAS_INFO) { - avpriv_tak_parse_streaminfo(gb, ti); - - if (get_bits(gb, 6)) - skip_bits(gb, 25); - align_get_bits(gb); - } - - if (ti->flags & TAK_FRAME_FLAG_HAS_METADATA) - return AVERROR_INVALIDDATA; - - skip_bits(gb, 24); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.h deleted file mode 100644 index e8e2dacf7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * TAK decoder/demuxer common code - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * TAK (Tom's lossless Audio Kompressor) decoder/demuxer common functions - */ - -#ifndef AVCODEC_TAK_H -#define AVCODEC_TAK_H - -#include - -#define BITSTREAM_READER_LE -#include "get_bits.h" -#include "avcodec.h" - -#define TAK_FORMAT_DATA_TYPE_BITS 3 -#define TAK_FORMAT_SAMPLE_RATE_BITS 18 -#define TAK_FORMAT_BPS_BITS 5 -#define TAK_FORMAT_CHANNEL_BITS 4 -#define TAK_FORMAT_VALID_BITS 5 -#define TAK_FORMAT_CH_LAYOUT_BITS 6 -#define TAK_SIZE_FRAME_DURATION_BITS 4 -#define TAK_SIZE_SAMPLES_NUM_BITS 35 -#define TAK_LAST_FRAME_POS_BITS 40 -#define TAK_LAST_FRAME_SIZE_BITS 24 -#define TAK_ENCODER_CODEC_BITS 6 -#define TAK_ENCODER_PROFILE_BITS 4 -#define TAK_ENCODER_VERSION_BITS 24 -#define TAK_SAMPLE_RATE_MIN 6000 -#define TAK_CHANNELS_MIN 1 -#define TAK_BPS_MIN 8 -#define TAK_FRAME_HEADER_FLAGS_BITS 3 -#define TAK_FRAME_HEADER_SYNC_ID 0xA0FF -#define TAK_FRAME_HEADER_SYNC_ID_BITS 16 -#define TAK_FRAME_HEADER_SAMPLE_COUNT_BITS 14 -#define TAK_FRAME_HEADER_NO_BITS 21 -#define TAK_FRAME_DURATION_QUANT_SHIFT 5 -#define TAK_CRC24_BITS 24 - - -#define TAK_FRAME_FLAG_IS_LAST 0x1 -#define TAK_FRAME_FLAG_HAS_INFO 0x2 -#define TAK_FRAME_FLAG_HAS_METADATA 0x4 - -#define TAK_MAX_CHANNELS (1 << TAK_FORMAT_CHANNEL_BITS) - -#define TAK_MIN_FRAME_HEADER_BITS (TAK_FRAME_HEADER_SYNC_ID_BITS + \ - TAK_FRAME_HEADER_FLAGS_BITS + \ - TAK_FRAME_HEADER_NO_BITS + \ - TAK_CRC24_BITS) - -#define TAK_MIN_FRAME_HEADER_LAST_BITS (TAK_MIN_FRAME_HEADER_BITS + 2 + \ - TAK_FRAME_HEADER_SAMPLE_COUNT_BITS) - -#define TAK_ENCODER_BITS (TAK_ENCODER_CODEC_BITS + \ - TAK_ENCODER_PROFILE_BITS) - -#define TAK_SIZE_BITS (TAK_SIZE_SAMPLES_NUM_BITS + \ - TAK_SIZE_FRAME_DURATION_BITS) - -#define TAK_FORMAT_BITS (TAK_FORMAT_DATA_TYPE_BITS + \ - TAK_FORMAT_SAMPLE_RATE_BITS + \ - TAK_FORMAT_BPS_BITS + \ - TAK_FORMAT_CHANNEL_BITS + 1 + \ - TAK_FORMAT_VALID_BITS + 1 + \ - TAK_FORMAT_CH_LAYOUT_BITS * \ - TAK_MAX_CHANNELS) - -#define TAK_STREAMINFO_BITS (TAK_ENCODER_BITS + \ - TAK_SIZE_BITS + \ - TAK_FORMAT_BITS) - -#define TAK_MAX_FRAME_HEADER_BITS (TAK_MIN_FRAME_HEADER_LAST_BITS + \ - TAK_STREAMINFO_BITS + 31) - -#define TAK_STREAMINFO_BYTES ((TAK_STREAMINFO_BITS + 7) / 8) -#define TAK_MAX_FRAME_HEADER_BYTES ((TAK_MAX_FRAME_HEADER_BITS + 7) / 8) -#define TAK_MIN_FRAME_HEADER_BYTES ((TAK_MIN_FRAME_HEADER_BITS + 7) / 8) - -enum TAKCodecType { - TAK_CODEC_MONO_STEREO = 2, - TAK_CODEC_MULTICHANNEL = 4, -}; - -enum TAKMetaDataType { - TAK_METADATA_END = 0, - TAK_METADATA_STREAMINFO, - TAK_METADATA_SEEKTABLE, - TAK_METADATA_SIMPLE_WAVE_DATA, - TAK_METADATA_ENCODER, - TAK_METADATA_PADDING, - TAK_METADATA_MD5, - TAK_METADATA_LAST_FRAME, -}; - -enum TAKFrameSizeType { - TAK_FST_94ms = 0, - TAK_FST_125ms, - TAK_FST_188ms, - TAK_FST_250ms, - TAK_FST_4096, - TAK_FST_8192, - TAK_FST_16384, - TAK_FST_512, - TAK_FST_1024, - TAK_FST_2048, -}; - -typedef struct TAKStreamInfo { - int flags; - enum TAKCodecType codec; - int data_type; - int sample_rate; - int channels; - int bps; - int frame_num; - int frame_samples; - int last_frame_samples; - uint64_t ch_layout; - int64_t samples; -} TAKStreamInfo; - -int ff_tak_check_crc(const uint8_t *buf, unsigned int buf_size); - -/** - * Parse the Streaminfo metadata block. - * @param[in] gb pointer to GetBitContext - * @param[out] s storage for parsed information - */ -void avpriv_tak_parse_streaminfo(GetBitContext *gb, TAKStreamInfo *s); - -/** - * Validate and decode a frame header. - * @param avctx AVCodecContext to use as av_log() context - * @param[in] gb GetBitContext from which to read frame header - * @param[out] s frame information - * @param log_level_offset log level offset, can be used to silence - * error messages. - * @return non-zero on error, 0 if OK - */ -int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, - TAKStreamInfo *s, int log_level_offset); -#endif /* AVCODEC_TAK_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak_parser.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak_parser.c deleted file mode 100644 index 5d8460c90..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tak_parser.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * TAK parser - * Copyright (c) 2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * TAK parser - **/ - -#include "tak.h" -#include "parser.h" - -typedef struct TAKParseContext { - ParseContext pc; - TAKStreamInfo ti; - int index; -} TAKParseContext; - -static int tak_parse(AVCodecParserContext *s, AVCodecContext *avctx, - const uint8_t **poutbuf, int *poutbuf_size, - const uint8_t *buf, int buf_size) -{ - TAKParseContext *t = s->priv_data; - ParseContext *pc = &t->pc; - int next = END_NOT_FOUND; - GetBitContext gb; - int consumed = 0; - int needed = buf_size ? TAK_MAX_FRAME_HEADER_BYTES : 8; - - if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { - TAKStreamInfo ti; - init_get_bits(&gb, buf, buf_size); - if (!ff_tak_decode_frame_header(avctx, &gb, &ti, 127)) - s->duration = t->ti.last_frame_samples ? t->ti.last_frame_samples - : t->ti.frame_samples; - *poutbuf = buf; - *poutbuf_size = buf_size; - return buf_size; - } - - while (buf_size || t->index + needed <= pc->index) { - if (buf_size && t->index + TAK_MAX_FRAME_HEADER_BYTES > pc->index) { - int tmp_buf_size = FFMIN(2 * TAK_MAX_FRAME_HEADER_BYTES, - buf_size); - const uint8_t *tmp_buf = buf; - - if (ff_combine_frame(pc, END_NOT_FOUND, &tmp_buf, &tmp_buf_size) != -1) - return AVERROR(ENOMEM); - consumed += tmp_buf_size; - buf += tmp_buf_size; - buf_size -= tmp_buf_size; - } - - for (; t->index + needed <= pc->index; t->index++) { - if (pc->buffer[ t->index ] == 0xFF && - pc->buffer[ t->index + 1 ] == 0xA0) { - TAKStreamInfo ti; - - init_get_bits(&gb, pc->buffer + t->index, - 8 * (pc->index - t->index)); - if (!ff_tak_decode_frame_header(avctx, &gb, - pc->frame_start_found ? &ti : &t->ti, 127) && - !ff_tak_check_crc(pc->buffer + t->index, - get_bits_count(&gb) / 8)) { - if (!pc->frame_start_found) { - pc->frame_start_found = 1; - s->duration = t->ti.last_frame_samples ? - t->ti.last_frame_samples : - t->ti.frame_samples; - s->key_frame = !!(t->ti.flags & TAK_FRAME_FLAG_HAS_INFO); - } else { - pc->frame_start_found = 0; - next = t->index - pc->index; - t->index = 0; - goto found; - } - } - } - } - } -found: - - if (consumed && !buf_size && next == END_NOT_FOUND || - ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size + consumed; - } - - if (next != END_NOT_FOUND) { - next += consumed; - pc->overread = FFMAX(0, -next); - } - - *poutbuf = buf; - *poutbuf_size = buf_size; - return next; -} - -AVCodecParser ff_tak_parser = { - .codec_ids = { AV_CODEC_ID_TAK }, - .priv_data_size = sizeof(TAKParseContext), - .parser_parse = tak_parse, - .parser_close = ff_parse_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/takdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/takdec.c deleted file mode 100644 index 86ca3ac01..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/takdec.c +++ /dev/null @@ -1,948 +0,0 @@ -/* - * TAK decoder - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * TAK (Tom's lossless Audio Kompressor) decoder - * @author Paul B Mahol - */ - -#include "libavutil/internal.h" -#include "libavutil/samplefmt.h" -#include "tak.h" -#include "thread.h" -#include "avcodec.h" -#include "dsputil.h" -#include "internal.h" -#include "unary.h" - -#define MAX_SUBFRAMES 8 ///< max number of subframes per channel -#define MAX_PREDICTORS 256 - -typedef struct MCDParam { - int8_t present; ///< decorrelation parameter availability for this channel - int8_t index; ///< index into array of decorrelation types - int8_t chan1; - int8_t chan2; -} MCDParam; - -typedef struct TAKDecContext { - AVCodecContext *avctx; ///< parent AVCodecContext - DSPContext dsp; - TAKStreamInfo ti; - GetBitContext gb; ///< bitstream reader initialized to start at the current frame - - int uval; - int nb_samples; ///< number of samples in the current frame - uint8_t *decode_buffer; - unsigned int decode_buffer_size; - int32_t *decoded[TAK_MAX_CHANNELS]; ///< decoded samples for each channel - - int8_t lpc_mode[TAK_MAX_CHANNELS]; - int8_t sample_shift[TAK_MAX_CHANNELS]; ///< shift applied to every sample in the channel - int16_t predictors[MAX_PREDICTORS]; - int nb_subframes; ///< number of subframes in the current frame - int16_t subframe_len[MAX_SUBFRAMES]; ///< subframe length in samples - int subframe_scale; - - int8_t dmode; ///< channel decorrelation type in the current frame - - MCDParam mcdparams[TAK_MAX_CHANNELS]; ///< multichannel decorrelation parameters - - int8_t coding_mode[128]; - DECLARE_ALIGNED(16, int16_t, filter)[MAX_PREDICTORS]; - DECLARE_ALIGNED(16, int16_t, residues)[544]; -} TAKDecContext; - -static const int8_t mc_dmodes[] = { 1, 3, 4, 6, }; - -static const uint16_t predictor_sizes[] = { - 4, 8, 12, 16, 24, 32, 48, 64, 80, 96, 128, 160, 192, 224, 256, 0, -}; - -static const struct CParam { - int init; - int escape; - int scale; - int aescape; - int bias; -} xcodes[50] = { - { 0x01, 0x0000001, 0x0000001, 0x0000003, 0x0000008 }, - { 0x02, 0x0000003, 0x0000001, 0x0000007, 0x0000006 }, - { 0x03, 0x0000005, 0x0000002, 0x000000E, 0x000000D }, - { 0x03, 0x0000003, 0x0000003, 0x000000D, 0x0000018 }, - { 0x04, 0x000000B, 0x0000004, 0x000001C, 0x0000019 }, - { 0x04, 0x0000006, 0x0000006, 0x000001A, 0x0000030 }, - { 0x05, 0x0000016, 0x0000008, 0x0000038, 0x0000032 }, - { 0x05, 0x000000C, 0x000000C, 0x0000034, 0x0000060 }, - { 0x06, 0x000002C, 0x0000010, 0x0000070, 0x0000064 }, - { 0x06, 0x0000018, 0x0000018, 0x0000068, 0x00000C0 }, - { 0x07, 0x0000058, 0x0000020, 0x00000E0, 0x00000C8 }, - { 0x07, 0x0000030, 0x0000030, 0x00000D0, 0x0000180 }, - { 0x08, 0x00000B0, 0x0000040, 0x00001C0, 0x0000190 }, - { 0x08, 0x0000060, 0x0000060, 0x00001A0, 0x0000300 }, - { 0x09, 0x0000160, 0x0000080, 0x0000380, 0x0000320 }, - { 0x09, 0x00000C0, 0x00000C0, 0x0000340, 0x0000600 }, - { 0x0A, 0x00002C0, 0x0000100, 0x0000700, 0x0000640 }, - { 0x0A, 0x0000180, 0x0000180, 0x0000680, 0x0000C00 }, - { 0x0B, 0x0000580, 0x0000200, 0x0000E00, 0x0000C80 }, - { 0x0B, 0x0000300, 0x0000300, 0x0000D00, 0x0001800 }, - { 0x0C, 0x0000B00, 0x0000400, 0x0001C00, 0x0001900 }, - { 0x0C, 0x0000600, 0x0000600, 0x0001A00, 0x0003000 }, - { 0x0D, 0x0001600, 0x0000800, 0x0003800, 0x0003200 }, - { 0x0D, 0x0000C00, 0x0000C00, 0x0003400, 0x0006000 }, - { 0x0E, 0x0002C00, 0x0001000, 0x0007000, 0x0006400 }, - { 0x0E, 0x0001800, 0x0001800, 0x0006800, 0x000C000 }, - { 0x0F, 0x0005800, 0x0002000, 0x000E000, 0x000C800 }, - { 0x0F, 0x0003000, 0x0003000, 0x000D000, 0x0018000 }, - { 0x10, 0x000B000, 0x0004000, 0x001C000, 0x0019000 }, - { 0x10, 0x0006000, 0x0006000, 0x001A000, 0x0030000 }, - { 0x11, 0x0016000, 0x0008000, 0x0038000, 0x0032000 }, - { 0x11, 0x000C000, 0x000C000, 0x0034000, 0x0060000 }, - { 0x12, 0x002C000, 0x0010000, 0x0070000, 0x0064000 }, - { 0x12, 0x0018000, 0x0018000, 0x0068000, 0x00C0000 }, - { 0x13, 0x0058000, 0x0020000, 0x00E0000, 0x00C8000 }, - { 0x13, 0x0030000, 0x0030000, 0x00D0000, 0x0180000 }, - { 0x14, 0x00B0000, 0x0040000, 0x01C0000, 0x0190000 }, - { 0x14, 0x0060000, 0x0060000, 0x01A0000, 0x0300000 }, - { 0x15, 0x0160000, 0x0080000, 0x0380000, 0x0320000 }, - { 0x15, 0x00C0000, 0x00C0000, 0x0340000, 0x0600000 }, - { 0x16, 0x02C0000, 0x0100000, 0x0700000, 0x0640000 }, - { 0x16, 0x0180000, 0x0180000, 0x0680000, 0x0C00000 }, - { 0x17, 0x0580000, 0x0200000, 0x0E00000, 0x0C80000 }, - { 0x17, 0x0300000, 0x0300000, 0x0D00000, 0x1800000 }, - { 0x18, 0x0B00000, 0x0400000, 0x1C00000, 0x1900000 }, - { 0x18, 0x0600000, 0x0600000, 0x1A00000, 0x3000000 }, - { 0x19, 0x1600000, 0x0800000, 0x3800000, 0x3200000 }, - { 0x19, 0x0C00000, 0x0C00000, 0x3400000, 0x6000000 }, - { 0x1A, 0x2C00000, 0x1000000, 0x7000000, 0x6400000 }, - { 0x1A, 0x1800000, 0x1800000, 0x6800000, 0xC000000 }, -}; - -static int set_bps_params(AVCodecContext *avctx) -{ - switch (avctx->bits_per_raw_sample) { - case 8: - avctx->sample_fmt = AV_SAMPLE_FMT_U8P; - break; - case 16: - avctx->sample_fmt = AV_SAMPLE_FMT_S16P; - break; - case 24: - avctx->sample_fmt = AV_SAMPLE_FMT_S32P; - break; - default: - av_log(avctx, AV_LOG_ERROR, "invalid/unsupported bits per sample: %d\n", - avctx->bits_per_raw_sample); - return AVERROR_INVALIDDATA; - } - - return 0; -} - -static void set_sample_rate_params(AVCodecContext *avctx) -{ - TAKDecContext *s = avctx->priv_data; - int shift = 3 - (avctx->sample_rate / 11025); - shift = FFMAX(0, shift); - s->uval = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << shift; - s->subframe_scale = FFALIGN(avctx->sample_rate + 511 >> 9, 4) << 1; -} - -static av_cold int tak_decode_init(AVCodecContext *avctx) -{ - TAKDecContext *s = avctx->priv_data; - - ff_dsputil_init(&s->dsp, avctx); - - s->avctx = avctx; - avctx->bits_per_raw_sample = avctx->bits_per_coded_sample; - - set_sample_rate_params(avctx); - - return set_bps_params(avctx); -} - -static void decode_lpc(int32_t *coeffs, int mode, int length) -{ - int i; - - if (length < 2) - return; - - if (mode == 1) { - int a1 = *coeffs++; - for (i = 0; i < length - 1 >> 1; i++) { - *coeffs += a1; - coeffs[1] += *coeffs; - a1 = coeffs[1]; - coeffs += 2; - } - if (length - 1 & 1) - *coeffs += a1; - } else if (mode == 2) { - int a1 = coeffs[1]; - int a2 = a1 + *coeffs; - coeffs[1] = a2; - if (length > 2) { - coeffs += 2; - for (i = 0; i < length - 2 >> 1; i++) { - int a3 = *coeffs + a1; - int a4 = a3 + a2; - *coeffs = a4; - a1 = coeffs[1] + a3; - a2 = a1 + a4; - coeffs[1] = a2; - coeffs += 2; - } - if (length & 1) - *coeffs += a1 + a2; - } - } else if (mode == 3) { - int a1 = coeffs[1]; - int a2 = a1 + *coeffs; - coeffs[1] = a2; - if (length > 2) { - int a3 = coeffs[2]; - int a4 = a3 + a1; - int a5 = a4 + a2; - coeffs += 3; - for (i = 0; i < length - 3; i++) { - a3 += *coeffs; - a4 += a3; - a5 += a4; - *coeffs = a5; - coeffs++; - } - } - } -} - -static int decode_segment(TAKDecContext *s, int8_t mode, int32_t *decoded, int len) -{ - struct CParam code; - GetBitContext *gb = &s->gb; - int i; - - if (!mode) { - memset(decoded, 0, len * sizeof(*decoded)); - return 0; - } - - if (mode > FF_ARRAY_ELEMS(xcodes)) - return AVERROR_INVALIDDATA; - code = xcodes[mode - 1]; - - for (i = 0; i < len; i++) { - int x = get_bits_long(gb, code.init); - if (x >= code.escape && get_bits1(gb)) { - x |= 1 << code.init; - if (x >= code.aescape) { - int scale = get_unary(gb, 1, 9); - if (scale == 9) { - int scale_bits = get_bits(gb, 3); - if (scale_bits > 0) { - if (scale_bits == 7) { - scale_bits += get_bits(gb, 5); - if (scale_bits > 29) - return AVERROR_INVALIDDATA; - } - scale = get_bits_long(gb, scale_bits) + 1; - x += code.scale * scale; - } - x += code.bias; - } else - x += code.scale * scale - code.escape; - } else - x -= code.escape; - } - decoded[i] = (x >> 1) ^ -(x & 1); - } - - return 0; -} - -static int decode_residues(TAKDecContext *s, int32_t *decoded, int length) -{ - GetBitContext *gb = &s->gb; - int i, mode, ret; - - if (length > s->nb_samples) - return AVERROR_INVALIDDATA; - - if (get_bits1(gb)) { - int wlength, rval; - - wlength = length / s->uval; - - rval = length - (wlength * s->uval); - - if (rval < s->uval / 2) - rval += s->uval; - else - wlength++; - - if (wlength <= 1 || wlength > 128) - return AVERROR_INVALIDDATA; - - s->coding_mode[0] = mode = get_bits(gb, 6); - - for (i = 1; i < wlength; i++) { - int c = get_unary(gb, 1, 6); - - switch (c) { - case 6: - mode = get_bits(gb, 6); - break; - case 5: - case 4: - case 3: { - /* mode += sign ? (1 - c) : (c - 1) */ - int sign = get_bits1(gb); - mode += (-sign ^ (c - 1)) + sign; - break; - } - case 2: - mode++; - break; - case 1: - mode--; - break; - } - s->coding_mode[i] = mode; - } - - i = 0; - while (i < wlength) { - int len = 0; - - mode = s->coding_mode[i]; - do { - if (i >= wlength - 1) - len += rval; - else - len += s->uval; - i++; - - if (i == wlength) - break; - } while (s->coding_mode[i] == mode); - - if ((ret = decode_segment(s, mode, decoded, len)) < 0) - return ret; - decoded += len; - } - } else { - mode = get_bits(gb, 6); - if ((ret = decode_segment(s, mode, decoded, length)) < 0) - return ret; - } - - return 0; -} - -static int get_bits_esc4(GetBitContext *gb) -{ - if (get_bits1(gb)) - return get_bits(gb, 4) + 1; - else - return 0; -} - -static int decode_subframe(TAKDecContext *s, int32_t *decoded, - int subframe_size, int prev_subframe_size) -{ - GetBitContext *gb = &s->gb; - int tmp, x, y, i, j, ret = 0; - int dshift, size, filter_quant, filter_order; - int tfilter[MAX_PREDICTORS]; - - if (!get_bits1(gb)) - return decode_residues(s, decoded, subframe_size); - - filter_order = predictor_sizes[get_bits(gb, 4)]; - - if (prev_subframe_size > 0 && get_bits1(gb)) { - if (filter_order > prev_subframe_size) - return AVERROR_INVALIDDATA; - - decoded -= filter_order; - subframe_size += filter_order; - - if (filter_order > subframe_size) - return AVERROR_INVALIDDATA; - } else { - int lpc_mode; - - if (filter_order > subframe_size) - return AVERROR_INVALIDDATA; - - lpc_mode = get_bits(gb, 2); - if (lpc_mode > 2) - return AVERROR_INVALIDDATA; - - if ((ret = decode_residues(s, decoded, filter_order)) < 0) - return ret; - - if (lpc_mode) - decode_lpc(decoded, lpc_mode, filter_order); - } - - dshift = get_bits_esc4(gb); - size = get_bits1(gb) + 6; - - filter_quant = 10; - if (get_bits1(gb)) { - filter_quant -= get_bits(gb, 3) + 1; - if (filter_quant < 3) - return AVERROR_INVALIDDATA; - } - - s->predictors[0] = get_sbits(gb, 10); - s->predictors[1] = get_sbits(gb, 10); - s->predictors[2] = get_sbits(gb, size) << (10 - size); - s->predictors[3] = get_sbits(gb, size) << (10 - size); - if (filter_order > 4) { - tmp = size - get_bits1(gb); - - for (i = 4; i < filter_order; i++) { - if (!(i & 3)) - x = tmp - get_bits(gb, 2); - s->predictors[i] = get_sbits(gb, x) << (10 - size); - } - } - - tfilter[0] = s->predictors[0] << 6; - for (i = 1; i < filter_order; i++) { - int32_t *p1 = &tfilter[0]; - int32_t *p2 = &tfilter[i - 1]; - - for (j = 0; j < (i + 1) / 2; j++) { - x = *p1 + (s->predictors[i] * *p2 + 256 >> 9); - *p2 += s->predictors[i] * *p1 + 256 >> 9; - *p1++ = x; - p2--; - } - - tfilter[i] = s->predictors[i] << 6; - } - - x = 1 << (32 - (15 - filter_quant)); - y = 1 << ((15 - filter_quant) - 1); - for (i = 0, j = filter_order - 1; i < filter_order / 2; i++, j--) { - tmp = y + tfilter[j]; - s->filter[j] = x - ((tfilter[i] + y) >> (15 - filter_quant)); - s->filter[i] = x - ((tfilter[j] + y) >> (15 - filter_quant)); - } - - if ((ret = decode_residues(s, &decoded[filter_order], - subframe_size - filter_order)) < 0) - return ret; - - for (i = 0; i < filter_order; i++) - s->residues[i] = *decoded++ >> dshift; - - y = FF_ARRAY_ELEMS(s->residues) - filter_order; - x = subframe_size - filter_order; - while (x > 0) { - tmp = FFMIN(y, x); - - for (i = 0; i < tmp; i++) { - int v = 1 << (filter_quant - 1); - - if (filter_order & -16) - v += s->dsp.scalarproduct_int16(&s->residues[i], s->filter, - filter_order & -16); - for (j = filter_order & -16; j < filter_order; j += 4) { - v += s->residues[i + j + 3] * s->filter[j + 3] + - s->residues[i + j + 2] * s->filter[j + 2] + - s->residues[i + j + 1] * s->filter[j + 1] + - s->residues[i + j ] * s->filter[j ]; - } - v = (av_clip(v >> filter_quant, -8192, 8191) << dshift) - *decoded; - *decoded++ = v; - s->residues[filter_order + i] = v >> dshift; - } - - x -= tmp; - if (x > 0) - memcpy(s->residues, &s->residues[y], 2 * filter_order); - } - - emms_c(); - - return 0; -} - -static int decode_channel(TAKDecContext *s, int chan) -{ - AVCodecContext *avctx = s->avctx; - GetBitContext *gb = &s->gb; - int32_t *decoded = s->decoded[chan]; - int left = s->nb_samples - 1; - int i = 0, ret, prev = 0; - - s->sample_shift[chan] = get_bits_esc4(gb); - if (s->sample_shift[chan] >= avctx->bits_per_raw_sample) - return AVERROR_INVALIDDATA; - - *decoded++ = get_sbits(gb, avctx->bits_per_raw_sample - s->sample_shift[chan]); - s->lpc_mode[chan] = get_bits(gb, 2); - s->nb_subframes = get_bits(gb, 3) + 1; - - if (s->nb_subframes > 1) { - if (get_bits_left(gb) < (s->nb_subframes - 1) * 6) - return AVERROR_INVALIDDATA; - - for (; i < s->nb_subframes - 1; i++) { - int v = get_bits(gb, 6); - - s->subframe_len[i] = (v - prev) * s->subframe_scale; - if (s->subframe_len[i] <= 0) - return AVERROR_INVALIDDATA; - - left -= s->subframe_len[i]; - prev = v; - } - - if (left <= 0) - return AVERROR_INVALIDDATA; - } - s->subframe_len[i] = left; - - prev = 0; - for (i = 0; i < s->nb_subframes; i++) { - if ((ret = decode_subframe(s, decoded, s->subframe_len[i], prev)) < 0) - return ret; - decoded += s->subframe_len[i]; - prev = s->subframe_len[i]; - } - - return 0; -} - -static int decorrelate(TAKDecContext *s, int c1, int c2, int length) -{ - GetBitContext *gb = &s->gb; - int32_t *p1 = s->decoded[c1] + 1; - int32_t *p2 = s->decoded[c2] + 1; - int i; - int dshift, dfactor; - - switch (s->dmode) { - case 1: /* left/side */ - for (i = 0; i < length; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - p2[i] = a + b; - } - break; - case 2: /* side/right */ - for (i = 0; i < length; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - p1[i] = b - a; - } - break; - case 3: /* side/mid */ - for (i = 0; i < length; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - a -= b >> 1; - p1[i] = a; - p2[i] = a + b; - } - break; - case 4: /* side/left with scale factor */ - FFSWAP(int32_t*, p1, p2); - case 5: /* side/right with scale factor */ - dshift = get_bits_esc4(gb); - dfactor = get_sbits(gb, 10); - for (i = 0; i < length; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - b = dfactor * (b >> dshift) + 128 >> 8 << dshift; - p1[i] = b - a; - } - break; - case 6: - FFSWAP(int32_t*, p1, p2); - case 7: { - int length2, order_half, filter_order, dval1, dval2; - int tmp, x, code_size; - - if (length < 256) - return AVERROR_INVALIDDATA; - - dshift = get_bits_esc4(gb); - filter_order = 8 << get_bits1(gb); - dval1 = get_bits1(gb); - dval2 = get_bits1(gb); - - for (i = 0; i < filter_order; i++) { - if (!(i & 3)) - code_size = 14 - get_bits(gb, 3); - s->filter[i] = get_sbits(gb, code_size); - } - - order_half = filter_order / 2; - length2 = length - (filter_order - 1); - - /* decorrelate beginning samples */ - if (dval1) { - for (i = 0; i < order_half; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - p1[i] = a + b; - } - } - - /* decorrelate ending samples */ - if (dval2) { - for (i = length2 + order_half; i < length; i++) { - int32_t a = p1[i]; - int32_t b = p2[i]; - p1[i] = a + b; - } - } - - - for (i = 0; i < filter_order; i++) - s->residues[i] = *p2++ >> dshift; - - p1 += order_half; - x = FF_ARRAY_ELEMS(s->residues) - filter_order; - for (; length2 > 0; length2 -= tmp) { - tmp = FFMIN(length2, x); - - for (i = 0; i < tmp; i++) - s->residues[filter_order + i] = *p2++ >> dshift; - - for (i = 0; i < tmp; i++) { - int v = 1 << 9; - - if (filter_order == 16) { - v += s->dsp.scalarproduct_int16(&s->residues[i], s->filter, - filter_order); - } else { - v += s->residues[i + 7] * s->filter[7] + - s->residues[i + 6] * s->filter[6] + - s->residues[i + 5] * s->filter[5] + - s->residues[i + 4] * s->filter[4] + - s->residues[i + 3] * s->filter[3] + - s->residues[i + 2] * s->filter[2] + - s->residues[i + 1] * s->filter[1] + - s->residues[i ] * s->filter[0]; - } - - v = (av_clip(v >> 10, -8192, 8191) << dshift) - *p1; - *p1++ = v; - } - - memcpy(s->residues, &s->residues[tmp], 2 * filter_order); - } - - emms_c(); - break; - } - } - - return 0; -} - -static int tak_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *pkt) -{ - TAKDecContext *s = avctx->priv_data; - AVFrame *frame = data; - ThreadFrame tframe = { .f = data }; - GetBitContext *gb = &s->gb; - int chan, i, ret, hsize; - - if (pkt->size < TAK_MIN_FRAME_HEADER_BYTES) - return AVERROR_INVALIDDATA; - - if ((ret = init_get_bits8(gb, pkt->data, pkt->size)) < 0) - return ret; - - if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0) - return ret; - - if (avctx->err_recognition & (AV_EF_CRCCHECK|AV_EF_COMPLIANT)) { - hsize = get_bits_count(gb) / 8; - if (ff_tak_check_crc(pkt->data, hsize)) { - av_log(avctx, AV_LOG_ERROR, "CRC error\n"); - if (avctx->err_recognition & AV_EF_EXPLODE) - return AVERROR_INVALIDDATA; - } - } - - if (s->ti.codec != TAK_CODEC_MONO_STEREO && - s->ti.codec != TAK_CODEC_MULTICHANNEL) { - av_log(avctx, AV_LOG_ERROR, "unsupported codec: %d\n", s->ti.codec); - return AVERROR_PATCHWELCOME; - } - if (s->ti.data_type) { - av_log(avctx, AV_LOG_ERROR, - "unsupported data type: %d\n", s->ti.data_type); - return AVERROR_INVALIDDATA; - } - if (s->ti.codec == TAK_CODEC_MONO_STEREO && s->ti.channels > 2) { - av_log(avctx, AV_LOG_ERROR, - "invalid number of channels: %d\n", s->ti.channels); - return AVERROR_INVALIDDATA; - } - if (s->ti.channels > 6) { - av_log(avctx, AV_LOG_ERROR, - "unsupported number of channels: %d\n", s->ti.channels); - return AVERROR_INVALIDDATA; - } - - if (s->ti.frame_samples <= 0) { - av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of samples\n"); - return AVERROR_INVALIDDATA; - } - - avctx->bits_per_raw_sample = s->ti.bps; - if ((ret = set_bps_params(avctx)) < 0) - return ret; - if (s->ti.sample_rate != avctx->sample_rate) { - avctx->sample_rate = s->ti.sample_rate; - set_sample_rate_params(avctx); - } - if (s->ti.ch_layout) - avctx->channel_layout = s->ti.ch_layout; - avctx->channels = s->ti.channels; - - s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples - : s->ti.frame_samples; - - frame->nb_samples = s->nb_samples; - if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0) - return ret; - ff_thread_finish_setup(avctx); - - if (avctx->bits_per_raw_sample <= 16) { - int buf_size = av_samples_get_buffer_size(NULL, avctx->channels, - s->nb_samples, - AV_SAMPLE_FMT_S32P, 0); - av_fast_malloc(&s->decode_buffer, &s->decode_buffer_size, buf_size); - if (!s->decode_buffer) - return AVERROR(ENOMEM); - ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL, - s->decode_buffer, avctx->channels, - s->nb_samples, AV_SAMPLE_FMT_S32P, 0); - if (ret < 0) - return ret; - } else { - for (chan = 0; chan < avctx->channels; chan++) - s->decoded[chan] = (int32_t *)frame->extended_data[chan]; - } - - if (s->nb_samples < 16) { - for (chan = 0; chan < avctx->channels; chan++) { - int32_t *decoded = s->decoded[chan]; - for (i = 0; i < s->nb_samples; i++) - decoded[i] = get_sbits(gb, avctx->bits_per_raw_sample); - } - } else { - if (s->ti.codec == TAK_CODEC_MONO_STEREO) { - for (chan = 0; chan < avctx->channels; chan++) - if (ret = decode_channel(s, chan)) - return ret; - - if (avctx->channels == 2) { - s->nb_subframes = get_bits(gb, 1) + 1; - if (s->nb_subframes > 1) { - s->subframe_len[1] = get_bits(gb, 6); - } - - s->dmode = get_bits(gb, 3); - if (ret = decorrelate(s, 0, 1, s->nb_samples - 1)) - return ret; - } - } else if (s->ti.codec == TAK_CODEC_MULTICHANNEL) { - if (get_bits1(gb)) { - int ch_mask = 0; - - chan = get_bits(gb, 4) + 1; - if (chan > avctx->channels) - return AVERROR_INVALIDDATA; - - for (i = 0; i < chan; i++) { - int nbit = get_bits(gb, 4); - - if (nbit >= avctx->channels) - return AVERROR_INVALIDDATA; - - if (ch_mask & 1 << nbit) - return AVERROR_INVALIDDATA; - - s->mcdparams[i].present = get_bits1(gb); - if (s->mcdparams[i].present) { - s->mcdparams[i].index = get_bits(gb, 2); - s->mcdparams[i].chan2 = get_bits(gb, 4); - if (s->mcdparams[i].index == 1) { - if ((nbit == s->mcdparams[i].chan2) || - (ch_mask & 1 << s->mcdparams[i].chan2)) - return AVERROR_INVALIDDATA; - - ch_mask |= 1 << s->mcdparams[i].chan2; - } else if (!(ch_mask & 1 << s->mcdparams[i].chan2)) { - return AVERROR_INVALIDDATA; - } - } - s->mcdparams[i].chan1 = nbit; - - ch_mask |= 1 << nbit; - } - } else { - chan = avctx->channels; - for (i = 0; i < chan; i++) { - s->mcdparams[i].present = 0; - s->mcdparams[i].chan1 = i; - } - } - - for (i = 0; i < chan; i++) { - if (s->mcdparams[i].present && s->mcdparams[i].index == 1) - if (ret = decode_channel(s, s->mcdparams[i].chan2)) - return ret; - - if (ret = decode_channel(s, s->mcdparams[i].chan1)) - return ret; - - if (s->mcdparams[i].present) { - s->dmode = mc_dmodes[s->mcdparams[i].index]; - if (ret = decorrelate(s, - s->mcdparams[i].chan2, - s->mcdparams[i].chan1, - s->nb_samples - 1)) - return ret; - } - } - } - - for (chan = 0; chan < avctx->channels; chan++) { - int32_t *decoded = s->decoded[chan]; - - if (s->lpc_mode[chan]) - decode_lpc(decoded, s->lpc_mode[chan], s->nb_samples); - - if (s->sample_shift[chan] > 0) - for (i = 0; i < s->nb_samples; i++) - decoded[i] <<= s->sample_shift[chan]; - } - } - - align_get_bits(gb); - skip_bits(gb, 24); - if (get_bits_left(gb) < 0) - av_log(avctx, AV_LOG_DEBUG, "overread\n"); - else if (get_bits_left(gb) > 0) - av_log(avctx, AV_LOG_DEBUG, "underread\n"); - - if (avctx->err_recognition & (AV_EF_CRCCHECK | AV_EF_COMPLIANT)) { - if (ff_tak_check_crc(pkt->data + hsize, - get_bits_count(gb) / 8 - hsize)) { - av_log(avctx, AV_LOG_ERROR, "CRC error\n"); - if (avctx->err_recognition & AV_EF_EXPLODE) - return AVERROR_INVALIDDATA; - } - } - - /* convert to output buffer */ - switch (avctx->sample_fmt) { - case AV_SAMPLE_FMT_U8P: - for (chan = 0; chan < avctx->channels; chan++) { - uint8_t *samples = (uint8_t *)frame->extended_data[chan]; - int32_t *decoded = s->decoded[chan]; - for (i = 0; i < s->nb_samples; i++) - samples[i] = decoded[i] + 0x80; - } - break; - case AV_SAMPLE_FMT_S16P: - for (chan = 0; chan < avctx->channels; chan++) { - int16_t *samples = (int16_t *)frame->extended_data[chan]; - int32_t *decoded = s->decoded[chan]; - for (i = 0; i < s->nb_samples; i++) - samples[i] = decoded[i]; - } - break; - case AV_SAMPLE_FMT_S32P: - for (chan = 0; chan < avctx->channels; chan++) { - int32_t *samples = (int32_t *)frame->extended_data[chan]; - for (i = 0; i < s->nb_samples; i++) - samples[i] <<= 8; - } - break; - } - - *got_frame_ptr = 1; - - return pkt->size; -} - -static int init_thread_copy(AVCodecContext *avctx) -{ - TAKDecContext *s = avctx->priv_data; - s->avctx = avctx; - return 0; -} - -static int update_thread_context(AVCodecContext *dst, - const AVCodecContext *src) -{ - TAKDecContext *tsrc = src->priv_data; - TAKDecContext *tdst = dst->priv_data; - - if (dst == src) - return 0; - memcpy(&tdst->ti, &tsrc->ti, sizeof(TAKStreamInfo)); - return 0; -} - -static av_cold int tak_decode_close(AVCodecContext *avctx) -{ - TAKDecContext *s = avctx->priv_data; - - av_freep(&s->decode_buffer); - - return 0; -} - -AVCodec ff_tak_decoder = { - .name = "tak", - .long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_TAK, - .priv_data_size = sizeof(TAKDecContext), - .init = tak_decode_init, - .close = tak_decode_close, - .decode = tak_decode_frame, - .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy), - .update_thread_context = ONLY_IF_THREADS_ENABLED(update_thread_context), - .capabilities = CODEC_CAP_DR1 | CODEC_CAP_FRAME_THREADS, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_U8P, - AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S32P, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/thread.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/thread.h deleted file mode 100644 index 0dc04e070..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/thread.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2008 Alexander Strange - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Multithreading support functions - * @author Alexander Strange - */ - -#ifndef AVCODEC_THREAD_H -#define AVCODEC_THREAD_H - -#include "libavutil/buffer.h" - -#include "config.h" -#include "avcodec.h" - -typedef struct ThreadFrame { - AVFrame *f; - AVCodecContext *owner; - // progress->data is an array of 2 ints holding progress for top/bottom - // fields - AVBufferRef *progress; -} ThreadFrame; - -/** - * Wait for decoding threads to finish and reset internal state. - * Called by avcodec_flush_buffers(). - * - * @param avctx The context. - */ -void ff_thread_flush(AVCodecContext *avctx); - -/** - * Submit a new frame to a decoding thread. - * Returns the next available frame in picture. *got_picture_ptr - * will be 0 if none is available. - * The return value on success is the size of the consumed packet for - * compatibility with avcodec_decode_video2(). This means the decoder - * has to consume the full packet. - * - * Parameters are the same as avcodec_decode_video2(). - */ -int ff_thread_decode_frame(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, AVPacket *avpkt); - -/** - * If the codec defines update_thread_context(), call this - * when they are ready for the next thread to start decoding - * the next frame. After calling it, do not change any variables - * read by the update_thread_context() method, or call ff_thread_get_buffer(). - * - * @param avctx The context. - */ -void ff_thread_finish_setup(AVCodecContext *avctx); - -/** - * Notify later decoding threads when part of their reference picture is ready. - * Call this when some part of the picture is finished decoding. - * Later calls with lower values of progress have no effect. - * - * @param f The picture being decoded. - * @param progress Value, in arbitrary units, of how much of the picture has decoded. - * @param field The field being decoded, for field-picture codecs. - * 0 for top field or frame pictures, 1 for bottom field. - */ -void ff_thread_report_progress(ThreadFrame *f, int progress, int field); - -/** - * Wait for earlier decoding threads to finish reference pictures. - * Call this before accessing some part of a picture, with a given - * value for progress, and it will return after the responsible decoding - * thread calls ff_thread_report_progress() with the same or - * higher value for progress. - * - * @param f The picture being referenced. - * @param progress Value, in arbitrary units, to wait for. - * @param field The field being referenced, for field-picture codecs. - * 0 for top field or frame pictures, 1 for bottom field. - */ -void ff_thread_await_progress(ThreadFrame *f, int progress, int field); - -/** - * Wrapper around get_format() for frame-multithreaded codecs. - * Call this function instead of avctx->get_format(). - * Cannot be called after the codec has called ff_thread_finish_setup(). - * - * @param avctx The current context. - * @param fmt The list of available formats. - */ -enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt); - -/** - * Wrapper around get_buffer() for frame-multithreaded codecs. - * Call this function instead of ff_get_buffer(f). - * Cannot be called after the codec has called ff_thread_finish_setup(). - * - * @param avctx The current context. - * @param f The frame to write into. - */ -int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags); - -/** - * Wrapper around release_buffer() frame-for multithreaded codecs. - * Call this function instead of avctx->release_buffer(f). - * The AVFrame will be copied and the actual release_buffer() call - * will be performed later. The contents of data pointed to by the - * AVFrame should not be changed until ff_thread_get_buffer() is called - * on it. - * - * @param avctx The current context. - * @param f The picture being released. - */ -void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f); - -int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src); - -int ff_thread_init(AVCodecContext *s); -void ff_thread_free(AVCodecContext *s); - -#endif /* AVCODEC_THREAD_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech.c deleted file mode 100644 index d3e3b20e9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * DSP Group TrueSpeech compatible decoder - * Copyright (c) 2005 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/channel_layout.h" -#include "libavutil/intreadwrite.h" -#include "avcodec.h" -#include "dsputil.h" -#include "get_bits.h" -#include "internal.h" - -#include "truespeech_data.h" -/** - * @file - * TrueSpeech decoder. - */ - -/** - * TrueSpeech decoder context - */ -typedef struct { - DSPContext dsp; - /* input data */ - DECLARE_ALIGNED(16, uint8_t, buffer)[32]; - int16_t vector[8]; ///< input vector: 5/5/4/4/4/3/3/3 - int offset1[2]; ///< 8-bit value, used in one copying offset - int offset2[4]; ///< 7-bit value, encodes offsets for copying and for two-point filter - int pulseoff[4]; ///< 4-bit offset of pulse values block - int pulsepos[4]; ///< 27-bit variable, encodes 7 pulse positions - int pulseval[4]; ///< 7x2-bit pulse values - int flag; ///< 1-bit flag, shows how to choose filters - /* temporary data */ - int filtbuf[146]; // some big vector used for storing filters - int prevfilt[8]; // filter from previous frame - int16_t tmp1[8]; // coefficients for adding to out - int16_t tmp2[8]; // coefficients for adding to out - int16_t tmp3[8]; // coefficients for adding to out - int16_t cvector[8]; // correlated input vector - int filtval; // gain value for one function - int16_t newvec[60]; // tmp vector - int16_t filters[32]; // filters for every subframe -} TSContext; - -static av_cold int truespeech_decode_init(AVCodecContext * avctx) -{ - TSContext *c = avctx->priv_data; - - if (avctx->channels != 1) { - avpriv_request_sample(avctx, "Channel count %d", avctx->channels); - return AVERROR_PATCHWELCOME; - } - - avctx->channel_layout = AV_CH_LAYOUT_MONO; - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - - ff_dsputil_init(&c->dsp, avctx); - - return 0; -} - -static void truespeech_read_frame(TSContext *dec, const uint8_t *input) -{ - GetBitContext gb; - - dec->dsp.bswap_buf((uint32_t *)dec->buffer, (const uint32_t *)input, 8); - init_get_bits(&gb, dec->buffer, 32 * 8); - - dec->vector[7] = ts_codebook[7][get_bits(&gb, 3)]; - dec->vector[6] = ts_codebook[6][get_bits(&gb, 3)]; - dec->vector[5] = ts_codebook[5][get_bits(&gb, 3)]; - dec->vector[4] = ts_codebook[4][get_bits(&gb, 4)]; - dec->vector[3] = ts_codebook[3][get_bits(&gb, 4)]; - dec->vector[2] = ts_codebook[2][get_bits(&gb, 4)]; - dec->vector[1] = ts_codebook[1][get_bits(&gb, 5)]; - dec->vector[0] = ts_codebook[0][get_bits(&gb, 5)]; - dec->flag = get_bits1(&gb); - - dec->offset1[0] = get_bits(&gb, 4) << 4; - dec->offset2[3] = get_bits(&gb, 7); - dec->offset2[2] = get_bits(&gb, 7); - dec->offset2[1] = get_bits(&gb, 7); - dec->offset2[0] = get_bits(&gb, 7); - - dec->offset1[1] = get_bits(&gb, 4); - dec->pulseval[1] = get_bits(&gb, 14); - dec->pulseval[0] = get_bits(&gb, 14); - - dec->offset1[1] |= get_bits(&gb, 4) << 4; - dec->pulseval[3] = get_bits(&gb, 14); - dec->pulseval[2] = get_bits(&gb, 14); - - dec->offset1[0] |= get_bits1(&gb); - dec->pulsepos[0] = get_bits_long(&gb, 27); - dec->pulseoff[0] = get_bits(&gb, 4); - - dec->offset1[0] |= get_bits1(&gb) << 1; - dec->pulsepos[1] = get_bits_long(&gb, 27); - dec->pulseoff[1] = get_bits(&gb, 4); - - dec->offset1[0] |= get_bits1(&gb) << 2; - dec->pulsepos[2] = get_bits_long(&gb, 27); - dec->pulseoff[2] = get_bits(&gb, 4); - - dec->offset1[0] |= get_bits1(&gb) << 3; - dec->pulsepos[3] = get_bits_long(&gb, 27); - dec->pulseoff[3] = get_bits(&gb, 4); -} - -static void truespeech_correlate_filter(TSContext *dec) -{ - int16_t tmp[8]; - int i, j; - - for(i = 0; i < 8; i++){ - if(i > 0){ - memcpy(tmp, dec->cvector, i * sizeof(*tmp)); - for(j = 0; j < i; j++) - dec->cvector[j] = ((tmp[i - j - 1] * dec->vector[i]) + - (dec->cvector[j] << 15) + 0x4000) >> 15; - } - dec->cvector[i] = (8 - dec->vector[i]) >> 3; - } - for(i = 0; i < 8; i++) - dec->cvector[i] = (dec->cvector[i] * ts_decay_994_1000[i]) >> 15; - - dec->filtval = dec->vector[0]; -} - -static void truespeech_filters_merge(TSContext *dec) -{ - int i; - - if(!dec->flag){ - for(i = 0; i < 8; i++){ - dec->filters[i + 0] = dec->prevfilt[i]; - dec->filters[i + 8] = dec->prevfilt[i]; - } - }else{ - for(i = 0; i < 8; i++){ - dec->filters[i + 0]=(dec->cvector[i] * 21846 + dec->prevfilt[i] * 10923 + 16384) >> 15; - dec->filters[i + 8]=(dec->cvector[i] * 10923 + dec->prevfilt[i] * 21846 + 16384) >> 15; - } - } - for(i = 0; i < 8; i++){ - dec->filters[i + 16] = dec->cvector[i]; - dec->filters[i + 24] = dec->cvector[i]; - } -} - -static void truespeech_apply_twopoint_filter(TSContext *dec, int quart) -{ - int16_t tmp[146 + 60], *ptr0, *ptr1; - const int16_t *filter; - int i, t, off; - - t = dec->offset2[quart]; - if(t == 127){ - memset(dec->newvec, 0, 60 * sizeof(*dec->newvec)); - return; - } - for(i = 0; i < 146; i++) - tmp[i] = dec->filtbuf[i]; - off = (t / 25) + dec->offset1[quart >> 1] + 18; - off = av_clip(off, 0, 145); - ptr0 = tmp + 145 - off; - ptr1 = tmp + 146; - filter = ts_order2_coeffs + (t % 25) * 2; - for(i = 0; i < 60; i++){ - t = (ptr0[0] * filter[0] + ptr0[1] * filter[1] + 0x2000) >> 14; - ptr0++; - dec->newvec[i] = t; - ptr1[i] = t; - } -} - -static void truespeech_place_pulses(TSContext *dec, int16_t *out, int quart) -{ - int16_t tmp[7]; - int i, j, t; - const int16_t *ptr1; - int16_t *ptr2; - int coef; - - memset(out, 0, 60 * sizeof(*out)); - for(i = 0; i < 7; i++) { - t = dec->pulseval[quart] & 3; - dec->pulseval[quart] >>= 2; - tmp[6 - i] = ts_pulse_scales[dec->pulseoff[quart] * 4 + t]; - } - - coef = dec->pulsepos[quart] >> 15; - ptr1 = ts_pulse_values + 30; - ptr2 = tmp; - for(i = 0, j = 3; (i < 30) && (j > 0); i++){ - t = *ptr1++; - if(coef >= t) - coef -= t; - else{ - out[i] = *ptr2++; - ptr1 += 30; - j--; - } - } - coef = dec->pulsepos[quart] & 0x7FFF; - ptr1 = ts_pulse_values; - for(i = 30, j = 4; (i < 60) && (j > 0); i++){ - t = *ptr1++; - if(coef >= t) - coef -= t; - else{ - out[i] = *ptr2++; - ptr1 += 30; - j--; - } - } - -} - -static void truespeech_update_filters(TSContext *dec, int16_t *out, int quart) -{ - int i; - - memmove(dec->filtbuf, &dec->filtbuf[60], 86 * sizeof(*dec->filtbuf)); - for(i = 0; i < 60; i++){ - dec->filtbuf[i + 86] = out[i] + dec->newvec[i] - (dec->newvec[i] >> 3); - out[i] += dec->newvec[i]; - } -} - -static void truespeech_synth(TSContext *dec, int16_t *out, int quart) -{ - int i,k; - int t[8]; - int16_t *ptr0, *ptr1; - - ptr0 = dec->tmp1; - ptr1 = dec->filters + quart * 8; - for(i = 0; i < 60; i++){ - int sum = 0; - for(k = 0; k < 8; k++) - sum += ptr0[k] * ptr1[k]; - sum = (sum + (out[i] << 12) + 0x800) >> 12; - out[i] = av_clip(sum, -0x7FFE, 0x7FFE); - for(k = 7; k > 0; k--) - ptr0[k] = ptr0[k - 1]; - ptr0[0] = out[i]; - } - - for(i = 0; i < 8; i++) - t[i] = (ts_decay_35_64[i] * ptr1[i]) >> 15; - - ptr0 = dec->tmp2; - for(i = 0; i < 60; i++){ - int sum = 0; - for(k = 0; k < 8; k++) - sum += ptr0[k] * t[k]; - for(k = 7; k > 0; k--) - ptr0[k] = ptr0[k - 1]; - ptr0[0] = out[i]; - out[i] = ((out[i] << 12) - sum) >> 12; - } - - for(i = 0; i < 8; i++) - t[i] = (ts_decay_3_4[i] * ptr1[i]) >> 15; - - ptr0 = dec->tmp3; - for(i = 0; i < 60; i++){ - int sum = out[i] << 12; - for(k = 0; k < 8; k++) - sum += ptr0[k] * t[k]; - for(k = 7; k > 0; k--) - ptr0[k] = ptr0[k - 1]; - ptr0[0] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); - - sum = ((ptr0[1] * (dec->filtval - (dec->filtval >> 2))) >> 4) + sum; - sum = sum - (sum >> 3); - out[i] = av_clip((sum + 0x800) >> 12, -0x7FFE, 0x7FFE); - } -} - -static void truespeech_save_prevvec(TSContext *c) -{ - int i; - - for(i = 0; i < 8; i++) - c->prevfilt[i] = c->cvector[i]; -} - -static int truespeech_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - TSContext *c = avctx->priv_data; - - int i, j; - int16_t *samples; - int iterations, ret; - - iterations = buf_size / 32; - - if (!iterations) { - av_log(avctx, AV_LOG_ERROR, - "Too small input buffer (%d bytes), need at least 32 bytes\n", buf_size); - return -1; - } - - /* get output buffer */ - frame->nb_samples = iterations * 240; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = (int16_t *)frame->data[0]; - - memset(samples, 0, iterations * 240 * sizeof(*samples)); - - for(j = 0; j < iterations; j++) { - truespeech_read_frame(c, buf); - buf += 32; - - truespeech_correlate_filter(c); - truespeech_filters_merge(c); - - for(i = 0; i < 4; i++) { - truespeech_apply_twopoint_filter(c, i); - truespeech_place_pulses (c, samples, i); - truespeech_update_filters(c, samples, i); - truespeech_synth (c, samples, i); - samples += 60; - } - - truespeech_save_prevvec(c); - } - - *got_frame_ptr = 1; - - return buf_size; -} - -AVCodec ff_truespeech_decoder = { - .name = "truespeech", - .long_name = NULL_IF_CONFIG_SMALL("DSP Group TrueSpeech"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_TRUESPEECH, - .priv_data_size = sizeof(TSContext), - .init = truespeech_decode_init, - .decode = truespeech_decode_frame, - .capabilities = CODEC_CAP_DR1, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech_data.h deleted file mode 100644 index 73ebda5e8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/truespeech_data.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * DSP Group TrueSpeech compatible decoder - * copyright (c) 2005 Konstantin Shishkov - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_TRUESPEECH_DATA_H -#define AVCODEC_TRUESPEECH_DATA_H - -#include - -/* codebooks fo expanding input filter */ -static const int16_t ts_cb_0[32] = { - 0x8240, 0x8364, 0x84CE, 0x865D, 0x8805, 0x89DE, 0x8BD7, 0x8DF4, - 0x9051, 0x92E2, 0x95DE, 0x990F, 0x9C81, 0xA079, 0xA54C, 0xAAD2, - 0xB18A, 0xB90A, 0xC124, 0xC9CC, 0xD339, 0xDDD3, 0xE9D6, 0xF893, - 0x096F, 0x1ACA, 0x29EC, 0x381F, 0x45F9, 0x546A, 0x63C3, 0x73B5, -}; - -static const int16_t ts_cb_1[32] = { - 0x9F65, 0xB56B, 0xC583, 0xD371, 0xE018, 0xEBB4, 0xF61C, 0xFF59, - 0x085B, 0x1106, 0x1952, 0x214A, 0x28C9, 0x2FF8, 0x36E6, 0x3D92, - 0x43DF, 0x49BB, 0x4F46, 0x5467, 0x5930, 0x5DA3, 0x61EC, 0x65F9, - 0x69D4, 0x6D5A, 0x709E, 0x73AD, 0x766B, 0x78F0, 0x7B5A, 0x7DA5, -}; - -static const int16_t ts_cb_2[16] = { - 0x96F8, 0xA3B4, 0xAF45, 0xBA53, 0xC4B1, 0xCECC, 0xD86F, 0xE21E, - 0xEBF3, 0xF640, 0x00F7, 0x0C20, 0x1881, 0x269A, 0x376B, 0x4D60, -}; - -static const int16_t ts_cb_3[16] = { - 0xC654, 0xDEF2, 0xEFAA, 0xFD94, 0x096A, 0x143F, 0x1E7B, 0x282C, - 0x3176, 0x3A89, 0x439F, 0x4CA2, 0x557F, 0x5E50, 0x6718, 0x6F8D, -}; - -static const int16_t ts_cb_4[16] = { - 0xABE7, 0xBBA8, 0xC81C, 0xD326, 0xDD0E, 0xE5D4, 0xEE22, 0xF618, - 0xFE28, 0x064F, 0x0EB7, 0x17B8, 0x21AA, 0x2D8B, 0x3BA2, 0x4DF9, -}; - -static const int16_t ts_cb_5[8] = { - 0xD51B, 0xF12E, 0x042E, 0x13C7, 0x2260, 0x311B, 0x40DE, 0x5385, -}; - -static const int16_t ts_cb_6[8] = { - 0xB550, 0xC825, 0xD980, 0xE997, 0xF883, 0x0752, 0x1811, 0x2E18, -}; - -static const int16_t ts_cb_7[8] = { - 0xCEF0, 0xE4F9, 0xF6BB, 0x0646, 0x14F5, 0x23FF, 0x356F, 0x4A8D, -}; - -static const int16_t * const ts_codebook[8] = { - ts_cb_0, ts_cb_1, ts_cb_2, ts_cb_3, ts_cb_4, ts_cb_5, ts_cb_6, ts_cb_7 -}; - -/* table used for decoding pulse positions */ -static const int16_t ts_pulse_values[120] = { - 0x0E46, 0x0CCC, 0x0B6D, 0x0A28, 0x08FC, 0x07E8, 0x06EB, 0x0604, - 0x0532, 0x0474, 0x03C9, 0x0330, 0x02A8, 0x0230, 0x01C7, 0x016C, - 0x011E, 0x00DC, 0x00A5, 0x0078, 0x0054, 0x0038, 0x0023, 0x0014, - 0x000A, 0x0004, 0x0001, 0x0000, 0x0000, 0x0000, - - 0x0196, 0x017A, 0x015F, 0x0145, 0x012C, 0x0114, 0x00FD, 0x00E7, - 0x00D2, 0x00BE, 0x00AB, 0x0099, 0x0088, 0x0078, 0x0069, 0x005B, - 0x004E, 0x0042, 0x0037, 0x002D, 0x0024, 0x001C, 0x0015, 0x000F, - 0x000A, 0x0006, 0x0003, 0x0001, 0x0000, 0x0000, - - 0x001D, 0x001C, 0x001B, 0x001A, 0x0019, 0x0018, 0x0017, 0x0016, - 0x0015, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, - 0x000D, 0x000C, 0x000B, 0x000A, 0x0009, 0x0008, 0x0007, 0x0006, - 0x0005, 0x0004, 0x0003, 0x0002, 0x0001, 0x0000, - - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, - 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001 -}; - -/* filter for correlated input filter */ -static const int16_t ts_decay_994_1000[8] = - { 0x7F3B, 0x7E78, 0x7DB6, 0x7CF5, 0x7C35, 0x7B76, 0x7AB8, 0x79FC }; - -/* two-point filters table */ -static const int16_t ts_order2_coeffs[25 * 2] = { - 0xED2F, 0x5239, - 0x54F1, 0xE4A9, - 0x2620, 0xEE3E, - 0x09D6, 0x2C40, - 0xEFB5, 0x2BE0, - - 0x3FE1, 0x3339, - 0x442F, 0xE6FE, - 0x4458, 0xF9DF, - 0xF231, 0x43DB, - 0x3DB0, 0xF705, - - 0x4F7B, 0xFEFB, - 0x26AD, 0x0CDC, - 0x33C2, 0x0739, - 0x12BE, 0x43A2, - 0x1BDF, 0x1F3E, - - 0x0211, 0x0796, - 0x2AEB, 0x163F, - 0x050D, 0x3A38, - 0x0D1E, 0x0D78, - 0x150F, 0x3346, - - 0x38A4, 0x0B7D, - 0x2D5D, 0x1FDF, - 0x19B7, 0x2822, - 0x0D99, 0x1F12, - 0x194C, 0x0CE6 -}; - -/* possible pulse values */ -static const int16_t ts_pulse_scales[64] = { - 0x0002, 0x0006, 0xFFFE, 0xFFFA, - 0x0004, 0x000C, 0xFFFC, 0xFFF4, - 0x0006, 0x0012, 0xFFFA, 0xFFEE, - 0x000A, 0x001E, 0xFFF6, 0xFFE2, - 0x0010, 0x0030, 0xFFF0, 0xFFD0, - 0x0019, 0x004B, 0xFFE7, 0xFFB5, - 0x0028, 0x0078, 0xFFD8, 0xFF88, - 0x0040, 0x00C0, 0xFFC0, 0xFF40, - 0x0065, 0x012F, 0xFF9B, 0xFED1, - 0x00A1, 0x01E3, 0xFF5F, 0xFE1D, - 0x0100, 0x0300, 0xFF00, 0xFD00, - 0x0196, 0x04C2, 0xFE6A, 0xFB3E, - 0x0285, 0x078F, 0xFD7B, 0xF871, - 0x0400, 0x0C00, 0xFC00, 0xF400, - 0x0659, 0x130B, 0xF9A7, 0xECF5, - 0x0A14, 0x1E3C, 0xF5EC, 0xE1C4 -}; - -/* filters used in final output calculations */ -static const int16_t ts_decay_35_64[8] = - { 0x4666, 0x26B8, 0x154C, 0x0BB6, 0x0671, 0x038B, 0x01F3, 0x0112 }; -static const int16_t ts_decay_3_4[8] = - { 0x6000, 0x4800, 0x3600, 0x2880, 0x1E60, 0x16C8, 0x1116, 0x0CD1 }; - -#endif /* AVCODEC_TRUESPEECH_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tta.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tta.c deleted file mode 100644 index 8778541e5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/tta.c +++ /dev/null @@ -1,429 +0,0 @@ -/* - * TTA (The Lossless True Audio) decoder - * Copyright (c) 2006 Alex Beregszaszi - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * TTA (The Lossless True Audio) decoder - * @see http://www.true-audio.com/ - * @see http://tta.corecodec.org/ - * @author Alex Beregszaszi - */ - -#define BITSTREAM_READER_LE -#include -#include "ttadata.h" -#include "ttadsp.h" -#include "avcodec.h" -#include "get_bits.h" -#include "thread.h" -#include "unary.h" -#include "internal.h" -#include "libavutil/crc.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/opt.h" - -#define FORMAT_SIMPLE 1 -#define FORMAT_ENCRYPTED 2 - -typedef struct TTAContext { - AVClass *class; - AVCodecContext *avctx; - const AVCRC *crc_table; - - int format, channels, bps; - unsigned data_length; - int frame_length, last_frame_length; - - int32_t *decode_buffer; - - uint8_t crc_pass[8]; - uint8_t *pass; - TTAChannel *ch_ctx; - TTADSPContext dsp; -} TTAContext; - -static const int64_t tta_channel_layouts[7] = { - AV_CH_LAYOUT_STEREO, - AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY, - AV_CH_LAYOUT_QUAD, - 0, - AV_CH_LAYOUT_5POINT1_BACK, - AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER, - AV_CH_LAYOUT_7POINT1_WIDE -}; - -static int tta_check_crc(TTAContext *s, const uint8_t *buf, int buf_size) -{ - uint32_t crc, CRC; - - CRC = AV_RL32(buf + buf_size); - crc = av_crc(s->crc_table, 0xFFFFFFFFU, buf, buf_size); - if (CRC != (crc ^ 0xFFFFFFFFU)) { - av_log(s->avctx, AV_LOG_ERROR, "CRC error\n"); - return AVERROR_INVALIDDATA; - } - - return 0; -} - -static uint64_t tta_check_crc64(uint8_t *pass) -{ - uint64_t crc = UINT64_MAX, poly = 0x42F0E1EBA9EA3693U; - uint8_t *end = pass + strlen((const char *)pass); - int i; - - while (pass < end) { - crc ^= (uint64_t)*pass++ << 56; - for (i = 0; i < 8; i++) - crc = (crc << 1) ^ (poly & (((int64_t) crc) >> 63)); - } - - return crc ^ UINT64_MAX; -} - -static int allocate_buffers(AVCodecContext *avctx) -{ - TTAContext *s = avctx->priv_data; - - if (s->bps < 3) { - s->decode_buffer = av_mallocz(sizeof(int32_t)*s->frame_length*s->channels); - if (!s->decode_buffer) - return AVERROR(ENOMEM); - } else - s->decode_buffer = NULL; - s->ch_ctx = av_malloc(avctx->channels * sizeof(*s->ch_ctx)); - if (!s->ch_ctx) { - av_freep(&s->decode_buffer); - return AVERROR(ENOMEM); - } - - return 0; -} - -static av_cold int tta_decode_init(AVCodecContext * avctx) -{ - TTAContext *s = avctx->priv_data; - GetBitContext gb; - int total_frames; - - s->avctx = avctx; - - // 30bytes includes TTA1 header - if (avctx->extradata_size < 22) - return AVERROR_INVALIDDATA; - - s->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE); - init_get_bits8(&gb, avctx->extradata, avctx->extradata_size); - if (show_bits_long(&gb, 32) == AV_RL32("TTA1")) { - /* signature */ - skip_bits_long(&gb, 32); - - s->format = get_bits(&gb, 16); - if (s->format > 2) { - av_log(avctx, AV_LOG_ERROR, "Invalid format\n"); - return AVERROR_INVALIDDATA; - } - if (s->format == FORMAT_ENCRYPTED) { - if (!s->pass) { - av_log(avctx, AV_LOG_ERROR, "Missing password for encrypted stream. Please use the -password option\n"); - return AVERROR(EINVAL); - } - AV_WL64(s->crc_pass, tta_check_crc64(s->pass)); - } - avctx->channels = s->channels = get_bits(&gb, 16); - if (s->channels > 1 && s->channels < 9) - avctx->channel_layout = tta_channel_layouts[s->channels-2]; - avctx->bits_per_raw_sample = get_bits(&gb, 16); - s->bps = (avctx->bits_per_raw_sample + 7) / 8; - avctx->sample_rate = get_bits_long(&gb, 32); - s->data_length = get_bits_long(&gb, 32); - skip_bits_long(&gb, 32); // CRC32 of header - - if (s->channels == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); - return AVERROR_INVALIDDATA; - } else if (avctx->sample_rate == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid samplerate\n"); - return AVERROR_INVALIDDATA; - } - - switch(s->bps) { - case 1: avctx->sample_fmt = AV_SAMPLE_FMT_U8; break; - case 2: - avctx->sample_fmt = AV_SAMPLE_FMT_S16; - break; - case 3: - avctx->sample_fmt = AV_SAMPLE_FMT_S32; - break; - //case 4: avctx->sample_fmt = AV_SAMPLE_FMT_S32; break; - default: - av_log(avctx, AV_LOG_ERROR, "Invalid/unsupported sample format.\n"); - return AVERROR_INVALIDDATA; - } - - // prevent overflow - if (avctx->sample_rate > 0x7FFFFFu) { - av_log(avctx, AV_LOG_ERROR, "sample_rate too large\n"); - return AVERROR(EINVAL); - } - s->frame_length = 256 * avctx->sample_rate / 245; - - s->last_frame_length = s->data_length % s->frame_length; - total_frames = s->data_length / s->frame_length + - (s->last_frame_length ? 1 : 0); - - av_log(avctx, AV_LOG_DEBUG, "format: %d chans: %d bps: %d rate: %d block: %d\n", - s->format, avctx->channels, avctx->bits_per_coded_sample, avctx->sample_rate, - avctx->block_align); - av_log(avctx, AV_LOG_DEBUG, "data_length: %d frame_length: %d last: %d total: %d\n", - s->data_length, s->frame_length, s->last_frame_length, total_frames); - - if(s->frame_length >= UINT_MAX / (s->channels * sizeof(int32_t))){ - av_log(avctx, AV_LOG_ERROR, "frame_length too large\n"); - return AVERROR_INVALIDDATA; - } - } else { - av_log(avctx, AV_LOG_ERROR, "Wrong extradata present\n"); - return AVERROR_INVALIDDATA; - } - - ff_ttadsp_init(&s->dsp); - - return allocate_buffers(avctx); -} - -static int tta_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - ThreadFrame tframe = { .f = data }; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - TTAContext *s = avctx->priv_data; - GetBitContext gb; - int i, ret; - int cur_chan = 0, framelen = s->frame_length; - int32_t *p; - - if (avctx->err_recognition & AV_EF_CRCCHECK) { - if (buf_size < 4 || - (tta_check_crc(s, buf, buf_size - 4) && avctx->err_recognition & AV_EF_EXPLODE)) - return AVERROR_INVALIDDATA; - } - - if ((ret = init_get_bits8(&gb, avpkt->data, avpkt->size)) < 0) - return ret; - - /* get output buffer */ - frame->nb_samples = framelen; - if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0) - return ret; - - // decode directly to output buffer for 24-bit sample format - if (s->bps == 3) - s->decode_buffer = (int32_t *)frame->data[0]; - - // init per channel states - for (i = 0; i < s->channels; i++) { - TTAFilter *filter = &s->ch_ctx[i].filter; - s->ch_ctx[i].predictor = 0; - ff_tta_filter_init(filter, ff_tta_filter_configs[s->bps-1]); - if (s->format == FORMAT_ENCRYPTED) { - int i; - for (i = 0; i < 8; i++) - filter->qm[i] = sign_extend(s->crc_pass[i], 8); - } - ff_tta_rice_init(&s->ch_ctx[i].rice, 10, 10); - } - - i = 0; - for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) { - int32_t *predictor = &s->ch_ctx[cur_chan].predictor; - TTAFilter *filter = &s->ch_ctx[cur_chan].filter; - TTARice *rice = &s->ch_ctx[cur_chan].rice; - uint32_t unary, depth, k; - int32_t value; - - unary = get_unary(&gb, 0, get_bits_left(&gb)); - - if (unary == 0) { - depth = 0; - k = rice->k0; - } else { - depth = 1; - k = rice->k1; - unary--; - } - - if (get_bits_left(&gb) < k) { - ret = AVERROR_INVALIDDATA; - goto error; - } - - if (k) { - if (k > MIN_CACHE_BITS) { - ret = AVERROR_INVALIDDATA; - goto error; - } - value = (unary << k) + get_bits(&gb, k); - } else - value = unary; - - // FIXME: copy paste from original - switch (depth) { - case 1: - rice->sum1 += value - (rice->sum1 >> 4); - if (rice->k1 > 0 && rice->sum1 < ff_tta_shift_16[rice->k1]) - rice->k1--; - else if(rice->sum1 > ff_tta_shift_16[rice->k1 + 1]) - rice->k1++; - value += ff_tta_shift_1[rice->k0]; - default: - rice->sum0 += value - (rice->sum0 >> 4); - if (rice->k0 > 0 && rice->sum0 < ff_tta_shift_16[rice->k0]) - rice->k0--; - else if(rice->sum0 > ff_tta_shift_16[rice->k0 + 1]) - rice->k0++; - } - - // extract coded value - *p = 1 + ((value >> 1) ^ ((value & 1) - 1)); - - // run hybrid filter - s->dsp.ttafilter_process_dec(filter->qm, filter->dx, filter->dl, &filter->error, p, - filter->shift, filter->round); - - // fixed order prediction -#define PRED(x, k) (int32_t)((((uint64_t)x << k) - x) >> k) - switch (s->bps) { - case 1: *p += PRED(*predictor, 4); break; - case 2: - case 3: *p += PRED(*predictor, 5); break; - case 4: *p += *predictor; break; - } - *predictor = *p; - - // flip channels - if (cur_chan < (s->channels-1)) - cur_chan++; - else { - // decorrelate in case of multiple channels - if (s->channels > 1) { - int32_t *r = p - 1; - for (*p += *r / 2; r > p - s->channels; r--) - *r = *(r + 1) - *r; - } - cur_chan = 0; - i++; - // check for last frame - if (i == s->last_frame_length && get_bits_left(&gb) / 8 == 4) { - frame->nb_samples = framelen = s->last_frame_length; - break; - } - } - } - - align_get_bits(&gb); - if (get_bits_left(&gb) < 32) { - ret = AVERROR_INVALIDDATA; - goto error; - } - skip_bits_long(&gb, 32); // frame crc - - // convert to output buffer - switch (s->bps) { - case 1: { - uint8_t *samples = (uint8_t *)frame->data[0]; - for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) - *samples++ = *p + 0x80; - break; - } - case 2: { - int16_t *samples = (int16_t *)frame->data[0]; - for (p = s->decode_buffer; p < s->decode_buffer + (framelen * s->channels); p++) - *samples++ = *p; - break; - } - case 3: { - // shift samples for 24-bit sample format - int32_t *samples = (int32_t *)frame->data[0]; - for (i = 0; i < framelen * s->channels; i++) - *samples++ <<= 8; - // reset decode buffer - s->decode_buffer = NULL; - break; - } - } - - *got_frame_ptr = 1; - - return buf_size; -error: - // reset decode buffer - if (s->bps == 3) - s->decode_buffer = NULL; - return ret; -} - -static int init_thread_copy(AVCodecContext *avctx) -{ - TTAContext *s = avctx->priv_data; - s->avctx = avctx; - return allocate_buffers(avctx); -} - -static av_cold int tta_decode_close(AVCodecContext *avctx) { - TTAContext *s = avctx->priv_data; - - if (s->bps < 3) - av_free(s->decode_buffer); - s->decode_buffer = NULL; - av_freep(&s->ch_ctx); - - return 0; -} - -#define OFFSET(x) offsetof(TTAContext, x) -#define DEC (AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_AUDIO_PARAM) -static const AVOption options[] = { - { "password", "Set decoding password", OFFSET(pass), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, DEC }, - { NULL }, -}; - -static const AVClass tta_decoder_class = { - .class_name = "TTA Decoder", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -AVCodec ff_tta_decoder = { - .name = "tta", - .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_TTA, - .priv_data_size = sizeof(TTAContext), - .init = tta_decode_init, - .close = tta_decode_close, - .decode = tta_decode_frame, - .capabilities = CODEC_CAP_DR1, - .priv_class = &tta_decoder_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.c deleted file mode 100644 index bf793a4cc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * TTA (The Lossless True Audio) data - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "ttadata.h" - -const uint32_t ff_tta_shift_1[] = { - 0x00000001, 0x00000002, 0x00000004, 0x00000008, - 0x00000010, 0x00000020, 0x00000040, 0x00000080, - 0x00000100, 0x00000200, 0x00000400, 0x00000800, - 0x00001000, 0x00002000, 0x00004000, 0x00008000, - 0x00010000, 0x00020000, 0x00040000, 0x00080000, - 0x00100000, 0x00200000, 0x00400000, 0x00800000, - 0x01000000, 0x02000000, 0x04000000, 0x08000000, - 0x10000000, 0x20000000, 0x40000000, 0x80000000, - 0x80000000, 0x80000000, 0x80000000, 0x80000000, - 0x80000000, 0x80000000, 0x80000000, 0x80000000 -}; - -const uint32_t * const ff_tta_shift_16 = ff_tta_shift_1 + 4; - -const uint8_t ff_tta_filter_configs[] = { 10, 9, 10, 12 }; - -void ff_tta_rice_init(TTARice *c, uint32_t k0, uint32_t k1) -{ - c->k0 = k0; - c->k1 = k1; - c->sum0 = ff_tta_shift_16[k0]; - c->sum1 = ff_tta_shift_16[k1]; -} - -void ff_tta_filter_init(TTAFilter *c, int32_t shift) { - memset(c, 0, sizeof(TTAFilter)); - c->shift = shift; - c->round = ff_tta_shift_1[shift-1]; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.h deleted file mode 100644 index 48c4cd035..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadata.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * TTA (The Lossless True Audio) data - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_TTADATA_H -#define AVCODEC_TTADATA_H - -#include "internal.h" - -#define MAX_ORDER 16 -typedef struct TTAFilter { - int32_t shift, round, error; - int32_t qm[MAX_ORDER]; - int32_t dx[MAX_ORDER]; - int32_t dl[MAX_ORDER]; -} TTAFilter; - -typedef struct TTARice { - uint32_t k0, k1, sum0, sum1; -} TTARice; - -typedef struct TTAChannel { - int32_t predictor; - TTAFilter filter; - TTARice rice; -} TTAChannel; - -extern const uint32_t ff_tta_shift_1[]; -extern const uint32_t * const ff_tta_shift_16; -extern const uint8_t ff_tta_filter_configs[]; - -void ff_tta_rice_init(TTARice *c, uint32_t k0, uint32_t k1); -void ff_tta_filter_init(TTAFilter *c, int32_t shift); -#endif /* AVCODEC_TTADATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.c deleted file mode 100644 index 30b7ab9eb..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "ttadsp.h" - -static void ttafilter_process_dec_c(int32_t *qm, int32_t *dx, int32_t *dl, - int32_t *error, int32_t *in, int32_t shift, - int32_t round) { - if (*error < 0) { - qm[0] -= dx[0]; qm[1] -= dx[1]; qm[2] -= dx[2]; qm[3] -= dx[3]; - qm[4] -= dx[4]; qm[5] -= dx[5]; qm[6] -= dx[6]; qm[7] -= dx[7]; - } else if (*error > 0) { - qm[0] += dx[0]; qm[1] += dx[1]; qm[2] += dx[2]; qm[3] += dx[3]; - qm[4] += dx[4]; qm[5] += dx[5]; qm[6] += dx[6]; qm[7] += dx[7]; - } - - round += dl[0] * qm[0] + dl[1] * qm[1] + dl[2] * qm[2] + dl[3] * qm[3] + - dl[4] * qm[4] + dl[5] * qm[5] + dl[6] * qm[6] + dl[7] * qm[7]; - - dx[0] = dx[1]; dx[1] = dx[2]; dx[2] = dx[3]; dx[3] = dx[4]; - dl[0] = dl[1]; dl[1] = dl[2]; dl[2] = dl[3]; dl[3] = dl[4]; - - dx[4] = ((dl[4] >> 30) | 1); - dx[5] = ((dl[5] >> 30) | 2) & ~1; - dx[6] = ((dl[6] >> 30) | 2) & ~1; - dx[7] = ((dl[7] >> 30) | 4) & ~3; - - *error = *in; - *in += (round >> shift); - - dl[4] = -dl[5]; dl[5] = -dl[6]; - dl[6] = *in - dl[7]; dl[7] = *in; - dl[5] += dl[6]; dl[4] += dl[5]; -} - -av_cold void ff_ttadsp_init(TTADSPContext *c) -{ - c->ttafilter_process_dec = ttafilter_process_dec_c; - - if (ARCH_X86) - ff_ttadsp_init_x86(c); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.h deleted file mode 100644 index 56930f1c8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/ttadsp.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_TTADSP_H -#define AVCODEC_TTADSP_H - -#include -#include "ttadata.h" - -typedef struct TTADSPContext { - void (*ttafilter_process_dec)(int32_t *qm, int32_t *dx, int32_t *dl, - int32_t *error, int32_t *in, int32_t shift, - int32_t round); -} TTADSPContext; - -void ff_ttadsp_init(TTADSPContext *c); -void ff_ttadsp_init_x86(TTADSPContext *c); - -#endif /* AVCODEC_TTADSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.c deleted file mode 100644 index f38dc91f0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.c +++ /dev/null @@ -1,804 +0,0 @@ -/* - * TwinVQ decoder - * Copyright (c) 2009 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/float_dsp.h" -#include "libavutil/internal.h" -#include "avcodec.h" -#include "fft.h" -#include "internal.h" -#include "lsp.h" -#include "sinewin.h" -#include "twinvq.h" - -/** - * Evaluate a single LPC amplitude spectrum envelope coefficient from the line - * spectrum pairs. - * - * @param lsp a vector of the cosine of the LSP values - * @param cos_val cos(PI*i/N) where i is the index of the LPC amplitude - * @param order the order of the LSP (and the size of the *lsp buffer). Must - * be a multiple of four. - * @return the LPC value - * - * @todo reuse code from Vorbis decoder: vorbis_floor0_decode - */ -static float eval_lpc_spectrum(const float *lsp, float cos_val, int order) -{ - int j; - float p = 0.5f; - float q = 0.5f; - float two_cos_w = 2.0f * cos_val; - - for (j = 0; j + 1 < order; j += 2 * 2) { - // Unroll the loop once since order is a multiple of four - q *= lsp[j] - two_cos_w; - p *= lsp[j + 1] - two_cos_w; - - q *= lsp[j + 2] - two_cos_w; - p *= lsp[j + 3] - two_cos_w; - } - - p *= p * (2.0f - two_cos_w); - q *= q * (2.0f + two_cos_w); - - return 0.5 / (p + q); -} - -/** - * Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs. - */ -static void eval_lpcenv(TwinVQContext *tctx, const float *cos_vals, float *lpc) -{ - int i; - const TwinVQModeTab *mtab = tctx->mtab; - int size_s = mtab->size / mtab->fmode[TWINVQ_FT_SHORT].sub; - - for (i = 0; i < size_s / 2; i++) { - float cos_i = tctx->cos_tabs[0][i]; - lpc[i] = eval_lpc_spectrum(cos_vals, cos_i, mtab->n_lsp); - lpc[size_s - i - 1] = eval_lpc_spectrum(cos_vals, -cos_i, mtab->n_lsp); - } -} - -static void interpolate(float *out, float v1, float v2, int size) -{ - int i; - float step = (v1 - v2) / (size + 1); - - for (i = 0; i < size; i++) { - v2 += step; - out[i] = v2; - } -} - -static inline float get_cos(int idx, int part, const float *cos_tab, int size) -{ - return part ? -cos_tab[size - idx - 1] - : cos_tab[idx]; -} - -/** - * Evaluate the LPC amplitude spectrum envelope from the line spectrum pairs. - * Probably for speed reasons, the coefficients are evaluated as - * siiiibiiiisiiiibiiiisiiiibiiiisiiiibiiiis ... - * where s is an evaluated value, i is a value interpolated from the others - * and b might be either calculated or interpolated, depending on an - * unexplained condition. - * - * @param step the size of a block "siiiibiiii" - * @param in the cosine of the LSP data - * @param part is 0 for 0...PI (positive cosine values) and 1 for PI...2PI - * (negative cosine values) - * @param size the size of the whole output - */ -static inline void eval_lpcenv_or_interp(TwinVQContext *tctx, - enum TwinVQFrameType ftype, - float *out, const float *in, - int size, int step, int part) -{ - int i; - const TwinVQModeTab *mtab = tctx->mtab; - const float *cos_tab = tctx->cos_tabs[ftype]; - - // Fill the 's' - for (i = 0; i < size; i += step) - out[i] = - eval_lpc_spectrum(in, - get_cos(i, part, cos_tab, size), - mtab->n_lsp); - - // Fill the 'iiiibiiii' - for (i = step; i <= size - 2 * step; i += step) { - if (out[i + step] + out[i - step] > 1.95 * out[i] || - out[i + step] >= out[i - step]) { - interpolate(out + i - step + 1, out[i], out[i - step], step - 1); - } else { - out[i - step / 2] = - eval_lpc_spectrum(in, - get_cos(i - step / 2, part, cos_tab, size), - mtab->n_lsp); - interpolate(out + i - step + 1, out[i - step / 2], - out[i - step], step / 2 - 1); - interpolate(out + i - step / 2 + 1, out[i], - out[i - step / 2], step / 2 - 1); - } - } - - interpolate(out + size - 2 * step + 1, out[size - step], - out[size - 2 * step], step - 1); -} - -static void eval_lpcenv_2parts(TwinVQContext *tctx, enum TwinVQFrameType ftype, - const float *buf, float *lpc, - int size, int step) -{ - eval_lpcenv_or_interp(tctx, ftype, lpc, buf, size / 2, step, 0); - eval_lpcenv_or_interp(tctx, ftype, lpc + size / 2, buf, size / 2, - 2 * step, 1); - - interpolate(lpc + size / 2 - step + 1, lpc[size / 2], - lpc[size / 2 - step], step); - - twinvq_memset_float(lpc + size - 2 * step + 1, lpc[size - 2 * step], - 2 * step - 1); -} - -/** - * Inverse quantization. Read CB coefficients for cb1 and cb2 from the - * bitstream, sum the corresponding vectors and write the result to *out - * after permutation. - */ -static void dequant(TwinVQContext *tctx, const uint8_t *cb_bits, float *out, - enum TwinVQFrameType ftype, - const int16_t *cb0, const int16_t *cb1, int cb_len) -{ - int pos = 0; - int i, j; - - for (i = 0; i < tctx->n_div[ftype]; i++) { - int tmp0, tmp1; - int sign0 = 1; - int sign1 = 1; - const int16_t *tab0, *tab1; - int length = tctx->length[ftype][i >= tctx->length_change[ftype]]; - int bitstream_second_part = (i >= tctx->bits_main_spec_change[ftype]); - - int bits = tctx->bits_main_spec[0][ftype][bitstream_second_part]; - tmp0 = *cb_bits++; - if (bits == 7) { - if (tmp0 & 0x40) - sign0 = -1; - tmp0 &= 0x3F; - } - - bits = tctx->bits_main_spec[1][ftype][bitstream_second_part]; - tmp1 = *cb_bits++; - if (bits == 7) { - if (tmp1 & 0x40) - sign1 = -1; - tmp1 &= 0x3F; - } - - tab0 = cb0 + tmp0 * cb_len; - tab1 = cb1 + tmp1 * cb_len; - - for (j = 0; j < length; j++) - out[tctx->permut[ftype][pos + j]] = sign0 * tab0[j] + - sign1 * tab1[j]; - - pos += length; - } -} - -static void dec_gain(TwinVQContext *tctx, - enum TwinVQFrameType ftype, float *out) -{ - const TwinVQModeTab *mtab = tctx->mtab; - const TwinVQFrameData *bits = &tctx->bits[tctx->cur_frame]; - int i, j; - int sub = mtab->fmode[ftype].sub; - float step = TWINVQ_AMP_MAX / ((1 << TWINVQ_GAIN_BITS) - 1); - float sub_step = TWINVQ_SUB_AMP_MAX / ((1 << TWINVQ_SUB_GAIN_BITS) - 1); - - if (ftype == TWINVQ_FT_LONG) { - for (i = 0; i < tctx->avctx->channels; i++) - out[i] = (1.0 / (1 << 13)) * - twinvq_mulawinv(step * 0.5 + step * bits->gain_bits[i], - TWINVQ_AMP_MAX, TWINVQ_MULAW_MU); - } else { - for (i = 0; i < tctx->avctx->channels; i++) { - float val = (1.0 / (1 << 23)) * - twinvq_mulawinv(step * 0.5 + step * bits->gain_bits[i], - TWINVQ_AMP_MAX, TWINVQ_MULAW_MU); - - for (j = 0; j < sub; j++) - out[i * sub + j] = - val * twinvq_mulawinv(sub_step * 0.5 + - sub_step * bits->sub_gain_bits[i * sub + j], - TWINVQ_SUB_AMP_MAX, TWINVQ_MULAW_MU); - } - } -} - -/** - * Rearrange the LSP coefficients so that they have a minimum distance of - * min_dist. This function does it exactly as described in section of 3.2.4 - * of the G.729 specification (but interestingly is different from what the - * reference decoder actually does). - */ -static void rearrange_lsp(int order, float *lsp, float min_dist) -{ - int i; - float min_dist2 = min_dist * 0.5; - for (i = 1; i < order; i++) - if (lsp[i] - lsp[i - 1] < min_dist) { - float avg = (lsp[i] + lsp[i - 1]) * 0.5; - - lsp[i - 1] = avg - min_dist2; - lsp[i] = avg + min_dist2; - } -} - -static void decode_lsp(TwinVQContext *tctx, int lpc_idx1, uint8_t *lpc_idx2, - int lpc_hist_idx, float *lsp, float *hist) -{ - const TwinVQModeTab *mtab = tctx->mtab; - int i, j; - - const float *cb = mtab->lspcodebook; - const float *cb2 = cb + (1 << mtab->lsp_bit1) * mtab->n_lsp; - const float *cb3 = cb2 + (1 << mtab->lsp_bit2) * mtab->n_lsp; - - const int8_t funny_rounding[4] = { - -2, - mtab->lsp_split == 4 ? -2 : 1, - mtab->lsp_split == 4 ? -2 : 1, - 0 - }; - - j = 0; - for (i = 0; i < mtab->lsp_split; i++) { - int chunk_end = ((i + 1) * mtab->n_lsp + funny_rounding[i]) / - mtab->lsp_split; - for (; j < chunk_end; j++) - lsp[j] = cb[lpc_idx1 * mtab->n_lsp + j] + - cb2[lpc_idx2[i] * mtab->n_lsp + j]; - } - - rearrange_lsp(mtab->n_lsp, lsp, 0.0001); - - for (i = 0; i < mtab->n_lsp; i++) { - float tmp1 = 1.0 - cb3[lpc_hist_idx * mtab->n_lsp + i]; - float tmp2 = hist[i] * cb3[lpc_hist_idx * mtab->n_lsp + i]; - hist[i] = lsp[i]; - lsp[i] = lsp[i] * tmp1 + tmp2; - } - - rearrange_lsp(mtab->n_lsp, lsp, 0.0001); - rearrange_lsp(mtab->n_lsp, lsp, 0.000095); - ff_sort_nearly_sorted_floats(lsp, mtab->n_lsp); -} - -static void dec_lpc_spectrum_inv(TwinVQContext *tctx, float *lsp, - enum TwinVQFrameType ftype, float *lpc) -{ - int i; - int size = tctx->mtab->size / tctx->mtab->fmode[ftype].sub; - - for (i = 0; i < tctx->mtab->n_lsp; i++) - lsp[i] = 2 * cos(lsp[i]); - - switch (ftype) { - case TWINVQ_FT_LONG: - eval_lpcenv_2parts(tctx, ftype, lsp, lpc, size, 8); - break; - case TWINVQ_FT_MEDIUM: - eval_lpcenv_2parts(tctx, ftype, lsp, lpc, size, 2); - break; - case TWINVQ_FT_SHORT: - eval_lpcenv(tctx, lsp, lpc); - break; - } -} - -static const uint8_t wtype_to_wsize[] = { 0, 0, 2, 2, 2, 1, 0, 1, 1 }; - -static void imdct_and_window(TwinVQContext *tctx, enum TwinVQFrameType ftype, - int wtype, float *in, float *prev, int ch) -{ - FFTContext *mdct = &tctx->mdct_ctx[ftype]; - const TwinVQModeTab *mtab = tctx->mtab; - int bsize = mtab->size / mtab->fmode[ftype].sub; - int size = mtab->size; - float *buf1 = tctx->tmp_buf; - int j, first_wsize, wsize; // Window size - float *out = tctx->curr_frame + 2 * ch * mtab->size; - float *out2 = out; - float *prev_buf; - int types_sizes[] = { - mtab->size / mtab->fmode[TWINVQ_FT_LONG].sub, - mtab->size / mtab->fmode[TWINVQ_FT_MEDIUM].sub, - mtab->size / (mtab->fmode[TWINVQ_FT_SHORT].sub * 2), - }; - - wsize = types_sizes[wtype_to_wsize[wtype]]; - first_wsize = wsize; - prev_buf = prev + (size - bsize) / 2; - - for (j = 0; j < mtab->fmode[ftype].sub; j++) { - int sub_wtype = ftype == TWINVQ_FT_MEDIUM ? 8 : wtype; - - if (!j && wtype == 4) - sub_wtype = 4; - else if (j == mtab->fmode[ftype].sub - 1 && wtype == 7) - sub_wtype = 7; - - wsize = types_sizes[wtype_to_wsize[sub_wtype]]; - - mdct->imdct_half(mdct, buf1 + bsize * j, in + bsize * j); - - tctx->fdsp.vector_fmul_window(out2, prev_buf + (bsize - wsize) / 2, - buf1 + bsize * j, - ff_sine_windows[av_log2(wsize)], - wsize / 2); - out2 += wsize; - - memcpy(out2, buf1 + bsize * j + wsize / 2, - (bsize - wsize / 2) * sizeof(float)); - - out2 += ftype == TWINVQ_FT_MEDIUM ? (bsize - wsize) / 2 : bsize - wsize; - - prev_buf = buf1 + bsize * j + bsize / 2; - } - - tctx->last_block_pos[ch] = (size + first_wsize) / 2; -} - -static void imdct_output(TwinVQContext *tctx, enum TwinVQFrameType ftype, - int wtype, float **out, int offset) -{ - const TwinVQModeTab *mtab = tctx->mtab; - float *prev_buf = tctx->prev_frame + tctx->last_block_pos[0]; - int size1, size2, i; - float *out1, *out2; - - for (i = 0; i < tctx->avctx->channels; i++) - imdct_and_window(tctx, ftype, wtype, - tctx->spectrum + i * mtab->size, - prev_buf + 2 * i * mtab->size, - i); - - if (!out) - return; - - size2 = tctx->last_block_pos[0]; - size1 = mtab->size - size2; - - out1 = &out[0][0] + offset; - memcpy(out1, prev_buf, size1 * sizeof(*out1)); - memcpy(out1 + size1, tctx->curr_frame, size2 * sizeof(*out1)); - - if (tctx->avctx->channels == 2) { - out2 = &out[1][0] + offset; - memcpy(out2, &prev_buf[2 * mtab->size], - size1 * sizeof(*out2)); - memcpy(out2 + size1, &tctx->curr_frame[2 * mtab->size], - size2 * sizeof(*out2)); - tctx->fdsp.butterflies_float(out1, out2, mtab->size); - } -} - -static void read_and_decode_spectrum(TwinVQContext *tctx, float *out, - enum TwinVQFrameType ftype) -{ - const TwinVQModeTab *mtab = tctx->mtab; - TwinVQFrameData *bits = &tctx->bits[tctx->cur_frame]; - int channels = tctx->avctx->channels; - int sub = mtab->fmode[ftype].sub; - int block_size = mtab->size / sub; - float gain[TWINVQ_CHANNELS_MAX * TWINVQ_SUBBLOCKS_MAX]; - float ppc_shape[TWINVQ_PPC_SHAPE_LEN_MAX * TWINVQ_CHANNELS_MAX * 4]; - - int i, j; - - dequant(tctx, bits->main_coeffs, out, ftype, - mtab->fmode[ftype].cb0, mtab->fmode[ftype].cb1, - mtab->fmode[ftype].cb_len_read); - - dec_gain(tctx, ftype, gain); - - if (ftype == TWINVQ_FT_LONG) { - int cb_len_p = (tctx->n_div[3] + mtab->ppc_shape_len * channels - 1) / - tctx->n_div[3]; - dequant(tctx, bits->ppc_coeffs, ppc_shape, - TWINVQ_FT_PPC, mtab->ppc_shape_cb, - mtab->ppc_shape_cb + cb_len_p * TWINVQ_PPC_SHAPE_CB_SIZE, - cb_len_p); - } - - for (i = 0; i < channels; i++) { - float *chunk = out + mtab->size * i; - float lsp[TWINVQ_LSP_COEFS_MAX]; - - for (j = 0; j < sub; j++) { - tctx->dec_bark_env(tctx, bits->bark1[i][j], - bits->bark_use_hist[i][j], i, - tctx->tmp_buf, gain[sub * i + j], ftype); - - tctx->fdsp.vector_fmul(chunk + block_size * j, - chunk + block_size * j, - tctx->tmp_buf, block_size); - } - - if (ftype == TWINVQ_FT_LONG) - tctx->decode_ppc(tctx, bits->p_coef[i], bits->g_coef[i], - ppc_shape + i * mtab->ppc_shape_len, chunk); - - decode_lsp(tctx, bits->lpc_idx1[i], bits->lpc_idx2[i], - bits->lpc_hist_idx[i], lsp, tctx->lsp_hist[i]); - - dec_lpc_spectrum_inv(tctx, lsp, ftype, tctx->tmp_buf); - - for (j = 0; j < mtab->fmode[ftype].sub; j++) { - tctx->fdsp.vector_fmul(chunk, chunk, tctx->tmp_buf, block_size); - chunk += block_size; - } - } -} - -const enum TwinVQFrameType ff_twinvq_wtype_to_ftype_table[] = { - TWINVQ_FT_LONG, TWINVQ_FT_LONG, TWINVQ_FT_SHORT, TWINVQ_FT_LONG, - TWINVQ_FT_MEDIUM, TWINVQ_FT_LONG, TWINVQ_FT_LONG, TWINVQ_FT_MEDIUM, - TWINVQ_FT_MEDIUM -}; - -int ff_twinvq_decode_frame(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - TwinVQContext *tctx = avctx->priv_data; - const TwinVQModeTab *mtab = tctx->mtab; - float **out = NULL; - int ret; - - /* get output buffer */ - if (tctx->discarded_packets >= 2) { - frame->nb_samples = mtab->size * tctx->frames_per_packet; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - out = (float **)frame->extended_data; - } - - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, - "Frame too small (%d bytes). Truncated file?\n", buf_size); - return AVERROR(EINVAL); - } - - if ((ret = tctx->read_bitstream(avctx, tctx, buf, buf_size)) < 0) - return ret; - - for (tctx->cur_frame = 0; tctx->cur_frame < tctx->frames_per_packet; - tctx->cur_frame++) { - read_and_decode_spectrum(tctx, tctx->spectrum, - tctx->bits[tctx->cur_frame].ftype); - - imdct_output(tctx, tctx->bits[tctx->cur_frame].ftype, - tctx->bits[tctx->cur_frame].window_type, out, - tctx->cur_frame * mtab->size); - - FFSWAP(float *, tctx->curr_frame, tctx->prev_frame); - } - - if (tctx->discarded_packets < 2) { - tctx->discarded_packets++; - *got_frame_ptr = 0; - return buf_size; - } - - *got_frame_ptr = 1; - - // VQF can deliver packets 1 byte greater than block align - if (buf_size == avctx->block_align + 1) - return buf_size; - return avctx->block_align; -} - -/** - * Init IMDCT and windowing tables - */ -static av_cold int init_mdct_win(TwinVQContext *tctx) -{ - int i, j, ret; - const TwinVQModeTab *mtab = tctx->mtab; - int size_s = mtab->size / mtab->fmode[TWINVQ_FT_SHORT].sub; - int size_m = mtab->size / mtab->fmode[TWINVQ_FT_MEDIUM].sub; - int channels = tctx->avctx->channels; - float norm = channels == 1 ? 2.0 : 1.0; - - for (i = 0; i < 3; i++) { - int bsize = tctx->mtab->size / tctx->mtab->fmode[i].sub; - if ((ret = ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1, - -sqrt(norm / bsize) / (1 << 15)))) - return ret; - } - - FF_ALLOC_OR_GOTO(tctx->avctx, tctx->tmp_buf, - mtab->size * sizeof(*tctx->tmp_buf), alloc_fail); - - FF_ALLOC_OR_GOTO(tctx->avctx, tctx->spectrum, - 2 * mtab->size * channels * sizeof(*tctx->spectrum), - alloc_fail); - FF_ALLOC_OR_GOTO(tctx->avctx, tctx->curr_frame, - 2 * mtab->size * channels * sizeof(*tctx->curr_frame), - alloc_fail); - FF_ALLOC_OR_GOTO(tctx->avctx, tctx->prev_frame, - 2 * mtab->size * channels * sizeof(*tctx->prev_frame), - alloc_fail); - - for (i = 0; i < 3; i++) { - int m = 4 * mtab->size / mtab->fmode[i].sub; - double freq = 2 * M_PI / m; - FF_ALLOC_OR_GOTO(tctx->avctx, tctx->cos_tabs[i], - (m / 4) * sizeof(*tctx->cos_tabs[i]), alloc_fail); - - for (j = 0; j <= m / 8; j++) - tctx->cos_tabs[i][j] = cos((2 * j + 1) * freq); - for (j = 1; j < m / 8; j++) - tctx->cos_tabs[i][m / 4 - j] = tctx->cos_tabs[i][j]; - } - - ff_init_ff_sine_windows(av_log2(size_m)); - ff_init_ff_sine_windows(av_log2(size_s / 2)); - ff_init_ff_sine_windows(av_log2(mtab->size)); - - return 0; - -alloc_fail: - return AVERROR(ENOMEM); -} - -/** - * Interpret the data as if it were a num_blocks x line_len[0] matrix and for - * each line do a cyclic permutation, i.e. - * abcdefghijklm -> defghijklmabc - * where the amount to be shifted is evaluated depending on the column. - */ -static void permutate_in_line(int16_t *tab, int num_vect, int num_blocks, - int block_size, - const uint8_t line_len[2], int length_div, - enum TwinVQFrameType ftype) -{ - int i, j; - - for (i = 0; i < line_len[0]; i++) { - int shift; - - if (num_blocks == 1 || - (ftype == TWINVQ_FT_LONG && num_vect % num_blocks) || - (ftype != TWINVQ_FT_LONG && num_vect & 1) || - i == line_len[1]) { - shift = 0; - } else if (ftype == TWINVQ_FT_LONG) { - shift = i; - } else - shift = i * i; - - for (j = 0; j < num_vect && (j + num_vect * i < block_size * num_blocks); j++) - tab[i * num_vect + j] = i * num_vect + (j + shift) % num_vect; - } -} - -/** - * Interpret the input data as in the following table: - * - * @verbatim - * - * abcdefgh - * ijklmnop - * qrstuvw - * x123456 - * - * @endverbatim - * - * and transpose it, giving the output - * aiqxbjr1cks2dlt3emu4fvn5gow6hp - */ -static void transpose_perm(int16_t *out, int16_t *in, int num_vect, - const uint8_t line_len[2], int length_div) -{ - int i, j; - int cont = 0; - - for (i = 0; i < num_vect; i++) - for (j = 0; j < line_len[i >= length_div]; j++) - out[cont++] = in[j * num_vect + i]; -} - -static void linear_perm(int16_t *out, int16_t *in, int n_blocks, int size) -{ - int block_size = size / n_blocks; - int i; - - for (i = 0; i < size; i++) - out[i] = block_size * (in[i] % n_blocks) + in[i] / n_blocks; -} - -static av_cold void construct_perm_table(TwinVQContext *tctx, - enum TwinVQFrameType ftype) -{ - int block_size, size; - const TwinVQModeTab *mtab = tctx->mtab; - int16_t *tmp_perm = (int16_t *)tctx->tmp_buf; - - if (ftype == TWINVQ_FT_PPC) { - size = tctx->avctx->channels; - block_size = mtab->ppc_shape_len; - } else { - size = tctx->avctx->channels * mtab->fmode[ftype].sub; - block_size = mtab->size / mtab->fmode[ftype].sub; - } - - permutate_in_line(tmp_perm, tctx->n_div[ftype], size, - block_size, tctx->length[ftype], - tctx->length_change[ftype], ftype); - - transpose_perm(tctx->permut[ftype], tmp_perm, tctx->n_div[ftype], - tctx->length[ftype], tctx->length_change[ftype]); - - linear_perm(tctx->permut[ftype], tctx->permut[ftype], size, - size * block_size); -} - -static av_cold void init_bitstream_params(TwinVQContext *tctx) -{ - const TwinVQModeTab *mtab = tctx->mtab; - int n_ch = tctx->avctx->channels; - int total_fr_bits = tctx->avctx->bit_rate * mtab->size / - tctx->avctx->sample_rate; - - int lsp_bits_per_block = n_ch * (mtab->lsp_bit0 + mtab->lsp_bit1 + - mtab->lsp_split * mtab->lsp_bit2); - - int ppc_bits = n_ch * (mtab->pgain_bit + mtab->ppc_shape_bit + - mtab->ppc_period_bit); - - int bsize_no_main_cb[3], bse_bits[3], i; - enum TwinVQFrameType frametype; - - for (i = 0; i < 3; i++) - // +1 for history usage switch - bse_bits[i] = n_ch * - (mtab->fmode[i].bark_n_coef * - mtab->fmode[i].bark_n_bit + 1); - - bsize_no_main_cb[2] = bse_bits[2] + lsp_bits_per_block + ppc_bits + - TWINVQ_WINDOW_TYPE_BITS + n_ch * TWINVQ_GAIN_BITS; - - for (i = 0; i < 2; i++) - bsize_no_main_cb[i] = - lsp_bits_per_block + n_ch * TWINVQ_GAIN_BITS + - TWINVQ_WINDOW_TYPE_BITS + - mtab->fmode[i].sub * (bse_bits[i] + n_ch * TWINVQ_SUB_GAIN_BITS); - - if (tctx->codec == TWINVQ_CODEC_METASOUND && !tctx->is_6kbps) { - bsize_no_main_cb[1] += 2; - bsize_no_main_cb[2] += 2; - } - - // The remaining bits are all used for the main spectrum coefficients - for (i = 0; i < 4; i++) { - int bit_size, vect_size; - int rounded_up, rounded_down, num_rounded_down, num_rounded_up; - if (i == 3) { - bit_size = n_ch * mtab->ppc_shape_bit; - vect_size = n_ch * mtab->ppc_shape_len; - } else { - bit_size = total_fr_bits - bsize_no_main_cb[i]; - vect_size = n_ch * mtab->size; - } - - tctx->n_div[i] = (bit_size + 13) / 14; - - rounded_up = (bit_size + tctx->n_div[i] - 1) / - tctx->n_div[i]; - rounded_down = (bit_size) / tctx->n_div[i]; - num_rounded_down = rounded_up * tctx->n_div[i] - bit_size; - num_rounded_up = tctx->n_div[i] - num_rounded_down; - tctx->bits_main_spec[0][i][0] = (rounded_up + 1) / 2; - tctx->bits_main_spec[1][i][0] = rounded_up / 2; - tctx->bits_main_spec[0][i][1] = (rounded_down + 1) / 2; - tctx->bits_main_spec[1][i][1] = rounded_down / 2; - tctx->bits_main_spec_change[i] = num_rounded_up; - - rounded_up = (vect_size + tctx->n_div[i] - 1) / - tctx->n_div[i]; - rounded_down = (vect_size) / tctx->n_div[i]; - num_rounded_down = rounded_up * tctx->n_div[i] - vect_size; - num_rounded_up = tctx->n_div[i] - num_rounded_down; - tctx->length[i][0] = rounded_up; - tctx->length[i][1] = rounded_down; - tctx->length_change[i] = num_rounded_up; - } - - for (frametype = TWINVQ_FT_SHORT; frametype <= TWINVQ_FT_PPC; frametype++) - construct_perm_table(tctx, frametype); -} - -av_cold int ff_twinvq_decode_close(AVCodecContext *avctx) -{ - TwinVQContext *tctx = avctx->priv_data; - int i; - - for (i = 0; i < 3; i++) { - ff_mdct_end(&tctx->mdct_ctx[i]); - av_free(tctx->cos_tabs[i]); - } - - av_free(tctx->curr_frame); - av_free(tctx->spectrum); - av_free(tctx->prev_frame); - av_free(tctx->tmp_buf); - - return 0; -} - -av_cold int ff_twinvq_decode_init(AVCodecContext *avctx) -{ - int ret; - TwinVQContext *tctx = avctx->priv_data; - - tctx->avctx = avctx; - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - if (!avctx->block_align) { - avctx->block_align = tctx->frame_size + 7 >> 3; - } else if (avctx->block_align * 8 < tctx->frame_size) { - av_log(avctx, AV_LOG_ERROR, "Block align is %d bits, expected %d\n", - avctx->block_align * 8, tctx->frame_size); - return AVERROR_INVALIDDATA; - } - tctx->frames_per_packet = avctx->block_align * 8 / tctx->frame_size; - if (tctx->frames_per_packet > TWINVQ_MAX_FRAMES_PER_PACKET) { - av_log(avctx, AV_LOG_ERROR, "Too many frames per packet (%d)\n", - tctx->frames_per_packet); - return AVERROR_INVALIDDATA; - } - - avpriv_float_dsp_init(&tctx->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - if ((ret = init_mdct_win(tctx))) { - av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); - ff_twinvq_decode_close(avctx); - return ret; - } - init_bitstream_params(tctx); - - twinvq_memset_float(tctx->bark_hist[0][0], 0.1, - FF_ARRAY_ELEMS(tctx->bark_hist)); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.h deleted file mode 100644 index c4e9688d4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvq.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * TwinVQ decoder - * Copyright (c) 2009 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_TWINVQ_H -#define AVCODEC_TWINVQ_H - -#include -#include - -#include "libavutil/common.h" -#include "libavutil/float_dsp.h" -#include "avcodec.h" -#include "fft.h" -#include "internal.h" - -enum TwinVQCodec { - TWINVQ_CODEC_VQF, - TWINVQ_CODEC_METASOUND, -}; - -enum TwinVQFrameType { - TWINVQ_FT_SHORT = 0, ///< Short frame (divided in n sub-blocks) - TWINVQ_FT_MEDIUM, ///< Medium frame (divided in m -#include - -/* - * The bark_tab_* tables are constructed so that - * - * /i-1 \ - * |-- | - * bark |\ bark_tab[j] | == i - * |/ | - * |-- | - * \j=0 / - * - * - * for some slightly nonconventional bark-scale function - */ -static const uint16_t bark_tab_l08_512[] = { - 7, 8, 7, 8, 8, 8, 8, 8, 8, 9, - 9, 10, 10, 11, 11, 12, 12, 14, 15, 16, - 18, 19, 21, 24, 27, 30, 35, 40, 46, 53 -}; - -static const uint16_t bark_tab_l11_512[] = { - 6, 6, 6, 6, 6, 6, 7, 6, 7, 7, - 8, 8, 8, 9, 10, 10, 11, 13, 13, 15, - 17, 18, 21, 25, 27, 33, 38, 45, 54, 66 -}; - -static const uint16_t bark_tab_l16_1024[] = { - 9, 9, 8, 9, 10, 9, 10, 10, 10, 12, - 11, 13, 13, 14, 16, 17, 19, 20, 24, 26, - 30, 35, 40, 48, 56, 68, 83, 102, 128, 165 -}; - -static const uint16_t bark_tab_l22_1024[] = { - 6, 7, 6, 6, 7, 7, 7, 7, 7, 8, - 9, 8, 10, 10, 11, 12, 13, 15, 16, 18, - 21, 24, 27, 33, 38, 46, 55, 68, 84, 107, - 140, 191 -}; - -static const uint16_t bark_tab_l22_512[] = { - 3, 3, 3, 4, 3, 3, 4, 3, 4, 4, - 4, 5, 4, 5, 6, 6, 7, 7, 8, 9, - 10, 12, 14, 16, 20, 22, 28, 34, 42, 53, - 71, 95 -}; - -static const uint16_t bark_tab_l44_2048[] = { - 5, 6, 5, 6, 5, 6, 6, 6, 6, 6, - 7, 7, 7, 8, 8, 9, 9, 10, 11, 11, - 13, 14, 16, 17, 19, 22, 25, 29, 33, 39, - 46, 54, 64, 79, 98, 123, 161, 220, 320, 512 -}; - -static const uint16_t bark_tab_m08_256[] = { - 6, 5, 6, 6, 6, 6, 7, 7, 8, 8, - 9, 10, 11, 13, 15, 18, 20, 25, 31, 39 -}; - -static const uint16_t bark_tab_m11_256[] = { - 4, 5, 4, 5, 5, 5, 6, 5, 7, 7, - 8, 9, 10, 12, 15, 17, 22, 28, 35, 47 -}; - -static const uint16_t bark_tab_m16_512[] = { - 7, 6, 7, 7, 7, 8, 9, 9, 10, 11, - 14, 15, 18, 22, 27, 34, 44, 59, 81, 117 -}; - -static const uint16_t bark_tab_m22_256[] = { - 3, 2, 3, 2, 3, 3, 4, 3, 4, 5, - 5, 7, 8, 9, 13, 16, 22, 30, 44, 70 -}; - -static const uint16_t bark_tab_m22_512[] = { - 5, 5, 5, 6, 5, 7, 6, 7, 9, 9, - 11, 13, 15, 20, 24, 33, 43, 61, 88, 140 -}; - -static const uint16_t bark_tab_m44_512[] = { - 3, 2, 3, 3, 3, 4, 3, 5, 4, 6, - 7, 8, 10, 14, 18, 25, 36, 55, 95, 208 -}; - -static const uint16_t bark_tab_s08_64[] = { - 3, 3, 3, 3, 4, 5, 6, 8, 12, 17 -}; - -static const uint16_t bark_tab_s11_64[] = { - 2, 3, 2, 3, 3, 4, 6, 8, 12, 21 -}; - -static const uint16_t bark_tab_s16_128[] = { - 3, 4, 4, 4, 5, 7, 10, 16, 26, 49 -}; - -static const uint16_t bark_tab_s22_128[] = { - 3, 2, 3, 4, 4, 6, 9, 14, 26, 57 -}; - -static const uint16_t bark_tab_s44_128[] = { - 1, 2, 1, 2, 3, 4, 6, 10, 23, 76 -}; - -/** - * TwinVQ codebooks. They are coded in a struct so we can use code such as - * - * float val = tab.fcb0808l[get_bits(gb, 12)]; - * - * without risking a segfault on malformed files. - */ -static const struct twinvq_data { - float lsp08[504]; - int16_t fcb08l[640]; - int16_t fcb08m[320]; - int16_t fcb08s[320]; - int16_t shape08[1280]; - - int16_t cb0808l0[1088]; - int16_t cb0808l1[1088]; - int16_t cb0808s0[1152]; - int16_t cb0808s1[1152]; - int16_t cb0808m0[1024]; - int16_t cb0808m1[1024]; - - int16_t cb1108l0[1728]; - int16_t cb1108l1[1728]; - int16_t cb1108m0[1536]; - int16_t cb1108m1[1536]; - int16_t cb1108s0[1856]; - int16_t cb1108s1[1856]; - - int16_t fcb11l[640]; - int16_t fcb11m[320]; - int16_t fcb11s[320]; - int16_t shape11[1280]; - float lsp11[1312]; - - int16_t cb1110l0[1280]; - int16_t cb1110l1[1280]; - int16_t cb1110m0[1152]; - int16_t cb1110m1[1152]; - int16_t cb1110s0[1344]; - int16_t cb1110s1[1344]; - - int16_t fcb16l[640]; - int16_t fcb16m[320]; - int16_t fcb16s[320]; - int16_t shape16[1920]; - float lsp16[1400]; - - int16_t cb1616l0[1024]; - int16_t cb1616l1[1024]; - int16_t cb1616m0[960]; - int16_t cb1616m1[960]; - int16_t cb1616s0[1024]; - int16_t cb1616s1[1024]; - - int16_t cb2220l0[1152]; - int16_t cb2220l1[1152]; - int16_t cb2220m0[1088]; - int16_t cb2220m1[1088]; - int16_t cb2220s0[1152]; - int16_t cb2220s1[1152]; - - int16_t fcb22l_1[512]; - int16_t fcb22m_1[640]; - int16_t fcb22s_1[640]; - int16_t shape22_1[1152]; - float lsp22_1[1312]; - - int16_t cb2224l0[960]; - int16_t cb2224l1[960]; - int16_t cb2224m0[896]; - int16_t cb2224m1[896]; - int16_t cb2224s0[960]; - int16_t cb2224s1[960]; - - int16_t fcb22l_2[512]; - int16_t fcb22m_2[640]; - int16_t fcb22s_2[640]; - int16_t shape22_2[1152]; - float lsp22_2[1312]; - - int16_t cb2232l0[768]; - int16_t cb2232l1[768]; - int16_t cb2232m0[704]; - int16_t cb2232m1[704]; - int16_t cb2232s0[704]; - int16_t cb2232s1[704]; - - int16_t cb4440l0[1088]; - int16_t cb4440l1[1088]; - int16_t cb4440m0[1088]; - int16_t cb4440m1[1088]; - int16_t cb4440s0[1152]; - int16_t cb4440s1[1152]; - - int16_t fcb44l[640]; - int16_t fcb44m[640]; - int16_t fcb44s[640]; - int16_t shape44[1152]; - float lsp44[1640]; - - int16_t cb4448l0[896]; - int16_t cb4448l1[896]; - int16_t cb4448m0[896]; - int16_t cb4448m1[896]; - int16_t cb4448s0[960]; - int16_t cb4448s1[960]; -} tab = { -.cb0808l0 = { - 96, -12592, -12443, 425, 182, -456, -341, -843, - 615, 689, 982, 1470, -518, 231, -538, 282, - 409, -600, -303, -29, 51, -4, -115, 79, - -27, 450, -937, -461, -554, -159, 426, 710, --29106, -2148, 99, 3426, 1838, 12427, 585, -2080, - -2524, -474, 1572, 718, 578, -344, 188, 328, - 12125, 112, 654, -1232, -1644, 288, 553, 1513, - 966, 1012, 49, 631, -111, -238, -116, -182, - -21, -46, 334, 11013, -454, -261, 12, 21, - 52, -20440, -295, -502, -516, -329, -230, 465, - 59, 270, 971, -127, 505, -194, 43, -30, - 300, 38, 665, -613, 33, -172, -153, 323, - -166, 54, 399, 109, 186, -1765, -222, 138, - 16, 204, 30111, 208, -564, -612, 156, -146, - -345, 321, -138, 202, -184, 93, 710, -15945, --13401, 234, -1113, 146, -9, 56, -628, -834, - -1268, 872, 61, -1184, -126, -205, 145, -109, - -8248, 113, -146, 1288, 9142, 857, -782, -686, - -256, -650, 1061, -202, 12, -709, -88, 273, - 497, 150, -59, -8807, 240, 532, 16, 1482, - 11012, -444, 1918, -1786, 1934, 172, 598, -1324, - 5638, -3166, 492, -545, -770, 1067, 0, -356, - -421, 1684, 273, -502, 316, 1116, 807, -529, - -831, -13379, -420, 236, 470, -2590, -193, -47, - 580, -1613, 798, 27, -16, -12768, -893, 256, - 0, 1659, 1463, 544, 196, -30444, 314, -421, - 508, -276, -173, 414, -380, -371, -40, -121, - 375, 432, -438, 1, -350, -280, 1198, -373, - 452, 100, -68, 9053, 165, 770, 73, 291, - 717, 515, 596, -323, -4, -2, 803, 738, - 2605, 30, 73, 455, 11280, 1534, -283, 1502, - -9126, -4760, -570, 483, -179, -8628, -1639, 322, - -56, 6149, -3330, 114, 4598, -1976, -34, -56, - 840, 753, 12292, -7100, -492, 320, -412, 908, - 1186, 444, 6546, -788, 5394, 697, 13105, 194, - -394, 294, 2639, 12, -1009, -1426, -36, 2106, - -252, -31979, -66, 341, 996, 298, 105, 6, - 10, 106, -498, -244, -105, -574, 16, -206, - 24, -2067, -381, 10265, -103, -762, -785, -2036, --11927, 16, -710, -35, -270, -99, 4, 772, - -272, -186, -328, -14936, -57, -1357, -175, -606, - 220, 918, -11, 398, -189, -278, 138, 429, - 509, -701, -43, -42, -630, -560, 11736, -528, - 10286, -633, -870, 423, 550, -888, 297, -170, - 258, 2234, 486, 292, -446, -11858, 10008, 52, - 1203, -164, 810, -1527, -604, -883, -588, -96, - 332, 148, -180, 223, 356, 285, 434, -57, - -172, -520, -432, -72, 294, -93, -134, 316, - 30647, -351, 278, 84, -439, 589, 105, 1001, - 297, 660, 196, 171, 178, -90, -55, 1172, - 21100, 227, -288, 372, 162, 458, -555, -1329, - 380, 366, -104, 105, 674, -378, 1328, 283, - -1928, 549, 762, 454, 55, 606, 12499, 24, - 435, 23, 29, 6170, 1129, -95, 97, 569, - 132, 491, 164, -288, -1011, -134, 1234, -427, - -254, -524, 226, -14114, 328, -70, 1666, -189, - -2352, 1097, 619, 632, -981, 745, 587, -27, - -200, -871, 50, 470, -246, 2610, 581, 254, - 9893, -586, 880, -11894, 386, 1135, 117, 1072, - 116, -830, -160, -1002, -699, -66, -230, -260, - 112, 106, 221, 297, -47, 7642, 170, -330, - -599, -51, -476, 33, 475, 624, 6199, -350, - -406, 184, 906, -528, 382, 401, 348, 26, - -186, 33, -130, -62, -50, 1268, -132, -109, - 1164, -354, 675, 3, -402, -244, 644, 648, - -132, -4, 45, 20386, -136, 568, 126, 376, - 14476, -376, 267, 13518, -260, 111, 1014, 758, - 439, 551, -164, 207, 128, -416, 616, 690, - -9460, -1856, 1123, 826, -265, -762, 1596, -632, - 52, -622, -894, 367, -433, -100, 1873, 756, --17436, 168, -541, 550, 145, -5612, -1057, -1344, - -656, -194, 216, -500, -245, 246, 64, 688, - 727, 12538, -5492, 252, -908, -424, -532, -659, - -277, -230, -736, -183, 35, -228, 200, -12, - -248, -60, -493, 433, 446, 366, -644, 92, - -324, 29, 833, -21542, -977, 94, 379, 49, - -1058, 248, -178, 85, -961, -1198, -48, 467, - -242, -10202, 1556, 11263, -716, 814, -1686, 3594, - -27, 694, -802, 390, 4144, -663, 44, -546, - 312, -28, -484, 981, -307, 496, 408, 203, - 12543, 296, -1240, 159, 846, -957, -1493, -618, - 1593, 11868, 2616, 1954, 412, -922, -1320, 3325, - -254, -1892, 607, -2223, -8745, -1486, 17, 343, - -50, -562, 22011, -350, -491, -70, -60, 617, - 768, -346, 387, 660, 1409, 222, 616, 173, - -1323, 4017, -207, -525, -13243, 11, 440, -614, - -280, 549, -670, -79, 459, 560, -102, -214, - -54, -1201, 230, -526, 857, 1044, -369, 2470, --11010, -12586, 243, -205, 838, -920, 348, -738, - 1319, 86, -78, -428, -1909, -155, 2, 508, - 711, -292, 1699, 225, -101, -163, 540, 9692, - 235, -183, -38, 198, -466, -204, -8957, -914, - -299, 193, 10, 723, 643, -533, -1418, 323, - 20, 334, -886, -331, 368, 130, -30233, -152, - -14, 637, 132, -232, -149, -430, 64, -243, - -376, 370, 388, 196, -1098, 117, -794, -16, - -274, 348, 464, -28156, 184, 322, -101, 2, - -27, -183, 610, 256, -160, -573, -226, 588, - 1613, 1028, 9518, -2151, -1602, -528, -356, -116, --11511, 1828, -2206, -47, -757, -1479, -1429, -14717, - 1686, 253, 802, 462, -37, -916, -289, -401, - 13383, 353, -74, 114, -189, 636, 434, -639, - 1013, 234, 11752, 219, 1464, -132, -12838, 125, - -592, -40, -162, -1772, 506, 479, 422, 36, - 15, -960, 799, 517, 1311, -409, 748, 729, - 446, 11029, -13039, 1257, -651, -13, -742, 1416, - -388, -274, -795, 163, -572, 74, 430, -90, - -126, -74, -598, 140, 125, -20, -20332, 208, - 37, 19, -174, -209, 305, 28, -402, 28, - -315, -1, -134, 440, -832, 79, -635, -304, - 8, -32768, 625, 470, -1224, -351, 546, -1171, - -706, 652, 31, 7484, -448, 916, 1244, -379, - -300, 68, 868, 607, 247, 70, -984, 14314, - 21, -350, -82, 368, 456, -742, 472, 34, - 782, -498, -879, 700, 417, 216, 415, -161, - -181, -608, 1570, 862, -96, -114, 8095, -26, - 168, -363, -804, -36, -770, 139, -171, 6645, - -1425, 4826, -5288, 1358, -11747, -64, 650, -3206, - -1692, 789, -2047, -279, 916, -1648, 1164, 2044, - -144, -717, -392, -216, 372, 348, 1052, -175, - 668, 308, -15, 29112, -406, -774, 365, -1006, - -526, 1076, 59, -672, -87, -106, 174, 96, - 615, 462, -43, -496, 112, 149, -56, -182, - -268, -32768, -205, -676, 165, -1210, -325, 7964, - -44, 546, -699, 285, -418, 355, 238, 550, - 67, 425, 384, -950, -330, -208, -452, 212, - 11610, -190, 37, -907, -11137, -982, 585, -783, - -864, 164, -24, -514, -211, 2, -510, -580, - 595, 128, 100, -229, -55, 290, -539, 40, - -7786, -270, 295, -508, 562, -1196, 218, 33, - 3788, -8954, -1082, 297, -906, -322, 123, 1162, - -343, -11655, 88, -28, 1173, 9, -99, 36, --11987, 356, 12630, 767, -183, -983, -559, 186, - 1148, 530, -440, 1230, -456, -133, -424, 35, - -357, 418, 1457, -687, 740, -242, 17855, -368, - -1057, -262, -646, 406, -712, -1058, -84, 454 -}, - -.cb0808l1 = { - 982, -26, -721, 359, 509, 13290, 2391, 727, - 325, 328, 269, -156, 346, -242, -31, -356, - 741, 396, -98, 108, 35, -237, -29684, 196, - -69, 462, -339, 24, -1221, 352, -658, 396, - 243, -1658, -458, -1153, 5, -662, -47, 18, - -572, -567, -2084, -980, -210, 150, -396, 14836, - -210, 0, -162, -539, 588, -868, 248, -8576, - 1020, 526, 1056, 262, -149, 818, -1353, -1120, - 767, -738, -634, -14742, -105, 811, 1718, -116, - -64, 307, 920, -1244, 2388, 10213, -4505, -250, - 617, -1725, -645, 1258, 1146, -590, 707, -12, - 372, 1794, 1012, -149, 404, -978, -306, 168, - -1536, 89, 142, 938, -19891, 973, -481, -419, - -904, -455, -1821, -1617, 654, -2022, 1906, -497, --11346, -330, -11679, -14, 1, 535, -377, 1057, - -214, -213, 430, -13, -3379, -11250, 911, -716, - -240, -10, 260, 132, -611, -64, -594, -8540, - 837, -3717, -1154, 906, 10623, -502, -167, 67, - 119, 13501, -1469, 213, -1048, -1403, 432, -1079, - 45, -230, -730, -203, -595, -1150, -460, -97, - 395, -304, 27816, -300, -16, 153, -671, 551, - 436, -956, -182, 194, 113, -5504, 194, 263, - -332, -517, -244, -396, 540, 56, -371, 446, - 147, -66, 7, -306, 1440, -308, 327, 645, - 597, -6642, 72, 392, -138, -50, -144, -262, - 504, -230, 114, 2076, 8175, 1188, 290, -872, - 202, 69, 82, -281, -126, -291, -158, -152, - -45, 239, 153, -516, -422, -691, 801, 28, - 496, -298, -11118, 10430, -227, -851, 214, -801, - 538, 834, -137, 942, 573, 405, 1308, 2234, - 300, 1269, 12361, -752, 2177, -743, 60, 464, - 946, 302, -422, 116, -1200, -110, -843, 284, - -578, 732, -308, 153, -64, 156, 225, -29232, - -452, -466, -130, 888, 240, 305, -83, 236, - 208, 417, 1530, 294, 594, 351, 508, 137, - -7274, -184, 201, 44, -635, -891, -652, -596, - 380, -652, -8670, -76, -3746, -732, 262, -1860, - -1030, 1366, -279, 444, 911, 209, 330, 251, - -208, -747, 65, -10154, -204, 12960, -325, 347, - -465, -730, -727, 385, -89, -763, -427, 868, - -39, -859, 34, -29, -388, -1324, -218, 2051, - -1593, 5511, 10507, -8516, 2254, 5847, -1474, 1994, - 4704, -1876, 880, -3810, -489, -946, -1225, -1104, - 125, 139, -668, 2232, -537, 179, -215, 63, - 144, 72, 1198, 9750, 248, -709, 308, 10552, - -434, -462, 13569, 1096, -491, -262, 804, -1599, - 679, 569, 604, 1326, 213, -2026, 324, -2612, - -373, -12818, -20, 38, -171, 316, 15516, 306, - 763, 97, 91, -832, 23, -437, -390, 505, - -1226, 2518, 106, -2065, 315, 86, 523, 172, - -1012, -13851, 3358, 2610, -381, -194, 1200, -4106, - -1298, -3637, -1534, 780, 1367, -544, -770, 1690, - 1047, -54, 2136, 12502, 32, 6689, 706, -1172, - 846, -4853, 2146, 2548, -39, -465, -596, 177, - 213, 421, 28, -388, 11, 69, 31, -83, - -28, -166, -150, -19836, -323, 3, 659, 783, - 390, 139, -138, 31, -111, 453, -80, 432, - -519, -259, 686, 11431, 163, -13179, 554, 40, - -379, -120, -692, 340, 169, 120, -476, 643, - 778, 501, -128, 543, 1275, -134, 20568, 201, - 401, 512, -362, -210, -269, -812, 112, 75, - 149, -547, -494, -418, -100, -13621, -1002, 1176, - 1634, -395, -4289, -1531, -47, 850, -1102, 13558, - -403, 683, -164, -2215, -1180, -1750, 344, 630, - -968, 669, 540, 26, -594, 192, -17, -336, - 19645, 1133, 18, -56, 418, -426, -1535, 409, - 732, 186, 268, -20422, -22, 62, -621, 722, - 440, 96, -307, -128, 480, 5, 87, 668, - -361, -599, -22, 652, -176, -114, 214, -12233, - -698, 232, 608, -126, -714, -488, -228, 929, - -1582, -19845, 245, -460, 124, 57, 328, -436, - -158, 236, -196, -534, 209, 69, 229, 210, - -251, 1100, 583, 415, 210, 189, -219, 1242, - 19482, -105, 190, -374, -43, -232, 253, 561, - -297, -376, -1077, -308, 13486, -12462, 64, -190, - -298, -643, 460, 232, -987, -478, 1596, 168, - -722, 616, -873, -98, -948, 231, -1102, 11915, - 746, -495, 1248, 1203, 11067, -32, 160, -94, - -24, -153, -209, -1453, -1059, -313, -922, 1143, - -538, -1348, -323, 679, -54, -232, -470, 2075, --19135, 628, -774, 35, 247, -86, 721, 512, - 1305, 850, 9760, 248, -2404, -220, 6, -73, - -1370, 567, 1432, -2529, -1508, 14358, -992, -1111, - -940, -111, 968, -530, 576, 102, -1045, 453, - 180, -94, -7936, -310, 512, 996, -32, -1062, - -150, -26, -6687, -181, -336, -1510, 616, 70, - -332, -175, 624, -546, 171, 364, 1011, 68, - -284, -368, 711, 46, 73, -34, -419, 404, - 28270, 283, -324, 335, -131, 316, 212, -27, - -342, -1062, 470, 1269, 454, 286, -1928, -1674, - -739, -389, 1073, -6172, -317, -586, -194, -182, --13034, -848, 4596, -659, 709, -630, -310, 400, - 344, -276, 430, 876, -2047, -1012, -1672, -180, - 64, 22005, -736, 829, 266, 182, 436, -112, - -36, 131, 252, -63, 154, 368, 107, 93, - -42, -32768, 0, 200, -230, 271, -1776, 4329, - 986, -553, 481, 1888, -2770, 848, -6305, 264, - 12244, 1610, -640, 1348, -2742, -2078, 907, -1115, - 370, -16539, -1571, -176, 24, -515, 234, 954, - 605, 613, -154, 463, 535, -160, 684, 470, - 827, 10458, 150, -669, -6684, 339, -542, -730, - -351, 984, 212, 116, -7, 62, 926, 2175, - -185, -552, 489, -209, 5247, 38, 366, 53, - 16, 263, -142, -535, -224, 338, -174, -125, - 113, -12750, 400, -410, 281, -12, 744, -173, - 486, -12159, -107, -183, -484, 2, 150, 1, - -239, 7, -399, -608, -873, 698, -1623, 701, - -773, 272, -832, -94, -921, 885, 13588, 178, - 192, 148, 1346, 44, 59, -275, -14, -328, - 212, 133, -223, 300, -394, -275, -43, -76, - -47, 322, -208, 21713, 484, 329, 1860, 40, - -916, 502, 130, 477, 1754, 503, 7984, -338, - -323, -230, 354, 928, 430, -89, -94, 108, - -543, 365, -130, 70, 902, -131, 58, 469, - 580, -30949, 36, 232, -410, -451, 104, -8698, - 113, -1682, -42, -279, -92, -280, -477, -386, - -531, 832, 80, -15002, -56, 93, 164, -721, - 8388, -412, -2396, 584, 1004, -310, -2229, -304, - -383, 275, 1062, 1266, 297, -70, -909, 891, - 131, -1046, 539, 32502, 1000, -21, -229, 138, - 1528, -175, 546, 326, 168, -320, 716, -291, - -298, -227, 1094, -59, -12561, 12943, 786, 600, - -206, 889, -761, 54, 332, -1253, -597, 357, - -1124, -50, -168, 1172, 2266, 75, -174, 583, - 408, -157, 14666, 378, 302, -5, 48, 109, - 28, -21, 1044, 529, -859, -1182, -202, 1984, - 308, 402, 66, -1139, 2595, -380, 1119, 309, - 482, -10705, 100, -4591, 11646, -1364, -365, 9521, - -318, -23, 1076, -135, -2742, -833, 78, 910, - 96, -20, -599, 46, 855, -1265, 4748, 2394, - -250, -9096, -962, 191, -346, 348, 342, 1909, - 15330, 266, 540, 271, 2986, 1356, 1542, -1019, - -895, 737, 281, 684, -538, 10414, -922, 287, - 679, 204, -11142, -2321, -346, -1572, -250, -315, - -604, 1336, 311, 1317, -1111, 409, -104, -221, --14125, -1511, -990, 705, -808, 587, 676, 348 -}, - -.cb0808s0 = { - -7488, -1327, -5244, -2049, -3736, -45, 446, 1558, - -755, -6052, 6034, -4326, 740, -348, 12369, 2115, - -662, -685, -6592, 10176, 8575, -1035, -2752, -4453, - -283, 1547, 4776, -2932, 700, 3425, -3905, 1073, - 2356, -7094, -1705, -435, 4840, -1944, 1188, 780, - -3963, -6170, -1726, 4759, -4356, -2124, -1686, 321, - -901, 1414, -923, -2678, -1198, -14777, -2038, -3528, - 123, 11216, 1904, -1914, 7588, 2744, -4265, -4886, - -3530, -1495, -1709, -5857, 3829, 2196, -4842, -817, - -874, -5649, -2181, -3871, 3774, -1368, 322, -1126, - -996, -3873, 13698, -9369, -848, 3797, -667, -1083, - 2429, -3351, -1672, -3562, -1590, -3507, 552, 6610, - -4137, -10061, -5452, -6142, -1454, 1726, -1298, -4479, - 6126, 1626, -2791, 1584, 1300, 5726, 2584, 11109, - 696, -3344, -2418, 9029, 4346, -3554, 1393, 144, - 2051, 8916, 6174, 5170, 376, 9778, -2298, -4119, - 3733, -35, -2673, 2222, 1383, 2046, 2859, -16131, - 1637, -1195, -662, 2800, -2241, 3801, -5062, -978, - 5670, -5449, -79, 3479, 606, 3766, -1325, -265, - 907, -745, 1005, -14528, -4227, -3955, -7194, 3690, - 2166, -2520, 11555, -511, 5900, -388, -3854, -3440, - 2136, -868, -2986, 722, 1286, -4027, 10382, -1646, - 5193, 2539, 1239, 7819, -67, 3382, -3297, -46, - -3808, 830, 1313, -2188, -4346, 5922, -1057, -6294, - 14317, 2001, 968, 4150, -4121, 1412, -302, -8401, - -1388, 10649, -9513, 1042, 840, -4606, 2098, 1166, - 1472, -802, -2810, 420, -561, -325, 2652, -2866, - 1334, 4878, 958, 83, 456, 1203, -7594, 14590, - -1210, 2202, -1954, -1938, -3413, -1096, 6036, -1675, - -1320, -4485, -10665, 10026, -2484, -3273, 4753, -275, - -3542, 924, 1262, 7348, -2959, -749, -408, 4594, - 4876, -491, 3409, 4616, 110, 557, -1378, -1616, - -4532, 1699, 1412, 579, -494, 716, 197, -23346, - -2284, 156, 1096, -151, -1827, 688, -322, 2371, - -7909, -1324, -1683, 7861, 7074, -451, 258, 9088, - 1900, 8660, 840, 3491, -3275, 3029, -475, -2122, - -5725, -8668, -6069, -3458, 4240, -3007, -5463, 9395, - -2686, 4718, -717, 42, -1802, 3122, -3197, -5212, - -1572, -243, -451, 8213, -2199, -3372, 4110, -8176, --10525, -5551, 4312, 682, 2069, 1985, -3713, -6780, - 1193, 2831, -2228, 486, -3667, -789, -1691, 4567, - 464, -2114, -2340, -1881, 1921, 1602, 18418, 1535, - -567, 228, -9359, -6027, -267, 3628, 32767, 1423, - -74, -2817, 2112, -128, -1516, -2446, 1673, 2812, - -1582, 2125, 618, 2569, 2714, -1710, 340, 3255, - 848, 3379, -2317, -2361, -1823, 412, -2496, -18164, - -1224, 2552, -3040, 144, -597, 7716, 4916, -2867, - -2172, 2120, -2776, 675, -11985, 1692, -1384, -3588, - 4310, 1020, -4215, -251, -7090, -1916, 1914, -2804, - 6189, -6732, -1370, -3704, 450, -2652, 6553, -38, - 10348, 1244, -2246, -3729, -2158, -1340, 2357, 3118, - 9378, -1727, 3150, -3867, 1277, -15, 769, -2352, - -411, 1428, -14032, -1029, 2828, -1894, 6084, -36, - 518, 13159, 1095, -1185, -3207, -555, -3256, -76, - 3884, 3394, 1010, 1946, 160, -4863, 4714, -7087, - -3985, 5602, 3350, 7822, -5729, -7701, 9296, 3067, - 3582, 5256, 13629, -4012, -2206, -3867, -664, -104, - 4397, -7862, 36, 955, -38, -973, 3458, 5004, - 364, -9116, -2764, -2168, -1892, -7632, -4834, -5788, - -3565, -1245, -4544, 6552, 4601, 2342, 6625, 1040, - 2154, -6985, 5838, -1912, -3439, 1189, -2422, -555, - 3286, -14872, -776, 1228, 2434, 120, 13673, 904, - -1354, 645, -1550, -1377, -1888, 1416, -679, -1685, - 1731, 2404, -5786, 3285, -193, -123, 1973, 3663, - -1388, -14961, -3597, 5555, -1420, 284, 1527, -2575, - 1941, 871, 3900, -2168, -12763, 2970, -408, -3131, - -6426, 1892, 782, 6768, -284, 1034, 9785, 6029, - -3873, -4102, -4349, 2548, -3686, -5622, 4769, -351, - 8178, -7253, 3687, 624, -4386, 4028, -2780, -1938, - -4061, -1872, -1264, 7300, 760, 8530, -821, -874, --14225, -1143, -5400, -850, -2537, 478, 1668, -1244, - -362, 877, 3481, -1338, -5218, 2091, 3996, -577, - 390, 8626, 820, 181, -988, 5604, 9694, 1112, - -3064, -266, 1234, -486, 1264, -2173, -13671, 3729, - -3212, 2548, 1745, -9363, 8065, 3713, -3343, -4847, - 2808, -4716, -2175, 25, -5718, 4056, 1855, 4663, - 2324, -1166, 543, 2, 3931, -3196, 2771, -920, - -2907, -746, -1241, -306, 2793, -22, -2642, 3048, - 3256, 1804, -1310, 17876, -1816, 56, -1694, -465, - -534, -2274, 6139, -2247, -2515, -1077, 3305, 1519, - 273, 1128, -1637, 2561, -1534, 874, -22808, -1119, - -2551, -10344, -2229, -3510, 194, 2594, 1737, 4713, - 13767, 3532, -311, 8097, -1012, -841, -4360, 793, - -267, -206, 12905, -2683, -6424, 196, 7098, -1690, - -690, 1236, -2882, -2668, -2020, 8291, -2714, -4607, - -923, -2077, -2878, 1687, -10457, -1575, 2172, -3974, - 5795, 1748, -1852, -5143, 4763, -5097, -2840, -1851, - 2634, 5970, 180, -3326, -1655, 1226, 375, 5137, - -2678, -5246, 4327, -3670, 9956, -1976, 2189, 2952, - -6785, -697, 1129, -5768, -5819, 6532, 3650, -1711, - 3857, 47, -9618, -1941, 2524, -1244, 7242, 11646, - -64, 2304, 201, -3707, -700, 149, 2692, -805, - 3978, 2738, -977, -1004, -5776, 12779, 7454, -353, - -4731, -3866, 7076, 146, -3302, 3065, 1955, -343, - -1459, -426, -5906, -1318, 500, -1014, -1002, -2090, - -2924, -20521, 2610, 1581, 397, -3380, -2885, 510, - -1147, 3398, 1914, 99, -119, 144, -3128, 2445, - 1791, 397, 3734, -80, -3410, -3798, -1142, -1515, - -2615, -1540, 5193, 2187, 940, 4969, -2334, -16589, - 325, -2186, -4567, 5121, -894, -6848, -6002, 1832, - -568, 8259, 833, 3420, -4459, -748, 3442, 4358, - -3041, -10203, 9303, -1511, -4821, 1950, -966, 3573, - 453, 705, 16238, -901, -163, -2866, -104, -1767, - -1779, -1249, 3251, 1975, 1254, -838, -390, -3150, - 1020, 2526, -2025, 662, -2817, -1338, -855, -3442, --21123, 241, -134, -952, -588, 2572, 2080, 8153, - 114, 9732, -6774, -5266, -2462, 2286, -599, -426, - 1396, -7051, -1228, 312, -4495, -2525, 4649, -1305, - -1106, -2366, 2232, 4065, -18674, -1295, -3259, -1004, - -5136, 206, 1177, -5130, 2394, 2518, -1381, 2564, - -138, 4341, 16988, 2546, 6782, -3433, 850, -970, - -255, 1308, 2228, 1704, -1283, 1452, -2608, 1487, - 3106, -2267, -2998, -6814, 1654, 21195, 1555, 968, - 154, 124, -1258, 714, -407, 44, 247, 992, - 2228, 2824, 1435, -341, 1212, -1612, 6126, 1636, - -8368, 578, -5418, 217, -191, 204, -7147, 5110, - 3766, 5055, -5979, 6683, 368, -3597, -4595, 7630, - -3611, -2384, 1369, 6995, -3299, -53, 2036, -4654, - 4259, 9618, -1012, -2964, 4397, -2112, 11885, -1648, - -942, -3474, -544, -1410, -1958, -1535, 2981, -1591, --16787, 335, 4609, -1990, 3821, -645, 1842, -64, - -3485, 3202, -374, -58, -1410, 7304, -1958, -2142, --11412, -2533, 513, -6149, -6679, 2152, 3153, 5102, - 2216, -1361, 2260, 4863, -7031, 1538, -5250, -2511, - 96, 3339, -3447, -3708, 7168, -4168, 838, -3134, - 3228, -1531, -5598, 14125, 208, -2150, 819, -1085, - 12282, 6714, -2778, -9252, -5117, -6623, -1711, -4253, - -6306, -1292, -1370, -1027, -908, -2863, -1832, 4645, - -722, -284, -161, -5106, 7110, -12494, -1514, -5453, - -3308, 3520, 1101, -1096, -2325, -746, -33, 2645, - -4458, -797, -684, 1514, 1716, -6204, 6580, -3427, - -650, -10493, 4868, 5833, -2385, -274, 1530, 3892, - -1940, -1415, -2389, -11499, -2064, 937, -333, 1361, - -1583, 5458, -2296, -3263, -8344, -4236, -6357, -2372, - -3115, 1336, -2184, 194, -4262, -7838, 6946, 4535, - 749, 7332, 67, -327, 273, 3211, -1825, -357, - 7039, 3346, 6282, 488, -3940, 10196, 6463, 327, - 4407, 909, 889, -4943, -622, -4049, 2532, 1870, - 652, 1778, 663, 3063, -1012, -1390, 4162, 20486, - -86, 3166, 325, -1912, 511, -634, 1262, -4719, - -1490, 6767, -3314, -125, 4490, -10334, 5386, 9932, - 781, 290, 2198, 1695, 3790, -1878, 7760, -300, - 2021, 5508, 2200, 232, 7138, 1370, -3268, 3496, - 13934, -1230, -2303, 958, 141, 3348, -2867, -987 -}, - -.cb0808s1 = { - 9313, 734, 6610, -3629, -12020, 5317, -244, -1858, - 2, -1812, -6486, 892, 926, -236, 1016, -1249, - -469, -238, -1908, -10594, -4704, -907, -7746, 3847, - 564, -5956, 3395, 371, -5136, 4001, 1180, 769, - -555, -1872, -2943, -1744, 8620, 1485, 9901, -1392, - 3425, -7940, 151, 376, 1984, 3031, 3815, -974, - 537, -7038, 1964, -5625, 4457, -10214, -1787, -2768, - -8514, 176, -3692, 6441, 3148, 602, -2000, 13769, - -2792, 1104, -2067, -6219, 1515, -288, 3240, -5490, - 11589, 3742, -2343, -1752, 3701, 7525, -1676, 845, - 6895, 2884, 3540, 2454, 1010, 2454, -5761, 2035, - 3369, -9628, -862, -7060, 1802, 5676, 2396, 2757, - 5891, -701, -11896, -4061, 7932, -272, 2562, 83, - 560, -5180, -2223, -356, -3343, 2874, -1370, -7612, - 1773, 2006, -4258, 5312, 342, 8196, 4939, 519, - 3568, 4420, 2768, -11872, -3021, 1893, 1690, -5483, - -8129, 7540, -116, -2064, -4473, 1141, 1930, 656, - -7728, -2742, -3276, 2782, 2860, -6082, 5198, -4751, - -486, -789, -16932, -566, 5116, 1196, 832, 4282, - 78, 3088, 2768, 2125, 1027, 1712, 310, 808, - -1595, -106, 3174, 4598, -2945, 1551, -7688, 620, - -1640, 339, 4538, 3339, 532, -351, 260, 249, - -2135, -543, -18362, -648, -3871, 5514, -1782, -11301, - -374, -2078, 1610, 50, -4439, -2546, -3058, 839, - -9221, 2618, 1790, 103, -1061, -363, 285, -3542, - 503, -437, 30, 1382, 75, -2852, -1028, 3095, - 4318, -2316, 739, 801, -22765, 2162, 913, 1698, - 149, 2049, -313, -803, 3393, -1476, 4396, -4003, - 854, -1344, 1062, 10009, 6332, -8522, -2616, -9904, - -390, -3146, -2951, 4222, 5538, 495, 3776, -13684, - 4687, -2187, -905, 4997, 6209, 4775, -1234, 1956, - -4607, 3006, -370, -670, -12448, -5802, 8151, 140, - 1485, -6340, 2139, 1231, 22, -212, 2090, -676, - 2366, -701, -4113, 365, 2970, -577, 918, 7324, - -709, 2035, 5162, 7232, -13287, -3259, -908, -1900, - -4255, -2590, 318, 4891, 696, -40, -1647, 1572, - -1221, 4896, 5241, 49, -2083, -5068, 7645, 8978, - 1628, 2895, -4930, -8068, 2266, 2025, -1868, 3250, - 2642, -785, -14571, 9979, 3481, -2246, 1154, 2646, - 2616, -2033, -2936, -1300, 2490, 879, -1237, -1228, - -724, -1780, 524, -6619, -3339, -2526, 3533, 844, - 2946, 2208, -3522, -12411, -3062, 2380, 448, 604, - -4708, 2403, 1914, -58, 149, -3704, -2019, 4246, - -7020, -3197, -712, -2219, 10036, -2776, -3166, 2648, - 2947, 3386, 6445, 1587, -268, -536, 1895, -9005, - 10791, -982, 8215, 6414, 5166, 4751, 160, 3050, - -865, 6216, -1187, -7077, 1640, 5078, 4354, 1762, - -3869, 1174, -149, 1078, 1884, 5149, 15091, -432, - -2441, -1102, -1194, 1078, -1535, 8289, -2702, 4007, - 694, 72, 685, 2816, 13244, -422, -7094, 432, - 2044, -12004, -276, 2174, -908, -4784, 5725, -250, - 22, 5116, -2, 2686, 955, -8509, -7697, -3735, - 672, -1202, 4299, 4284, 12352, -2362, 5757, 1317, - 4293, 508, 3050, -524, 1097, 3346, -537, -2440, - -1596, -5659, 4188, -625, 1659, 3061, 2791, 1712, - -2991, 966, -16903, 610, -3314, 4160, -3750, 580, - -3407, -340, -11829, -520, -1625, 2905, 674, -147, - -5284, -4278, -5021, 4635, 6299, 2207, 2595, -7811, - -68, 4107, 4314, -1540, -11044, -2214, -803, 232, - -7602, -95, 1130, 4991, -361, 1675, 4487, 3607, - -6192, -130, 137, -1440, 2826, 178, -13834, -984, - 1149, 1230, 1587, 1571, 3286, 5293, -2259, 2021, - -6211, -7608, -2710, 2502, 4315, -539, -8530, -746, - -654, -4003, -5917, -3728, 4522, -10350, -1266, 210, - 5078, -2988, -3866, 3919, 969, -1063, -6300, -4584, - -2420, -2094, -884, 2338, -3150, 5461, -1145, -734, - 1644, 2183, 19114, -1144, -2313, -404, 1236, 3583, - 134, 1802, -4088, -2795, 681, 3738, 1831, 16571, - 917, -2290, -3648, -1588, -158, -528, -792, 394, - -7432, 2446, 402, -391, -73, -1398, 1286, -6503, - 5216, 1094, -939, 1673, -2038, 15842, -1971, 4160, - -1664, 7231, 642, 5770, 4209, -1839, 220, -266, - 165, 2055, 5222, -3344, -6544, 5412, 1514, 586, - 1591, -15256, -2715, 941, 1308, -9170, -2863, 4935, - -2913, -1291, 2791, 7967, 14, -1101, 3774, 3580, - 848, 1337, 1138, -2839, -3564, -5300, 12429, 14, - 1466, -7114, 1198, -3474, -237, -2577, -1305, 445, - 1069, -174, 1684, 3902, 229, 5842, -690, 978, - -754, 1182, -859, 21078, -185, 710, 797, -2155, - 367, -2168, 1002, 3805, -924, 468, -2322, -3590, - 1608, 3387, 18, 1536, -858, 642, -7964, 17689, - 9843, -4878, -3003, 7373, 5934, 4286, 10484, -63, - -4629, 974, -2227, 2602, 3810, 1905, -1668, -2130, - 2020, -2360, 2853, 612, 5070, -1248, -868, -497, - 3478, -1937, -3006, -645, 3589, 3019, -3293, 16469, - -5243, -2918, 1788, -2569, 3717, -9630, -1352, -3870, - -416, -4190, -8863, -6888, -498, -814, -783, -4625, - 5841, 1562, -2173, 481, 280, 816, 4742, -9962, - 11799, -2029, -2460, 4972, -600, -1452, -1901, -2122, - 3130, 2686, -819, -2366, 866, -2093, 1052, -58, - 284, 3830, -4738, -4114, -1321, 1307, -2820, 4915, --11701, 522, -1982, 7024, 8403, 1762, -46, 532, - 5097, 5013, -615, 3086, 2089, 6899, -1107, -4047, - -2903, 5356, -4802, -965, 6706, 3895, 9022, 1388, - 10971, 5927, -2954, -965, -3473, -5177, -2654, 3418, - -5315, -16695, -6587, -416, 404, 1230, -2586, -3292, - 1390, 14, -481, -4446, 1335, 109, 1060, 3958, - 1275, -5655, 1253, -2411, 207, -12550, 6208, -2447, - -3415, 2503, 848, 3094, 9336, 2647, 2455, 2238, - 2356, -2132, 5347, 915, 2227, -103, 5832, -2504, - 7562, 9568, -6100, 4091, 2668, -1722, 287, 6763, - 4058, -387, -2060, 5522, 3184, 4766, -158, 650, --11284, 11841, 6230, -4232, 5308, 3174, 4926, -2970, - -4761, -980, 117, 1944, -1974, -5484, 6534, -266, - -7222, 924, -2654, -588, 9609, -2337, 1892, -2110, - 5088, 1856, 7964, -4029, -940, 1429, 805, -4705, - -1362, 892, -189, -8354, 3259, 194, 767, -2877, - -4165, -990, 12185, -160, -2002, -1384, -5388, -1604, - 226, -6353, -4157, 1773, 2360, -4356, -730, -5462, - -4054, -15669, -1528, -394, 4101, -203, 2792, -787, - 3391, -299, 6384, -1630, -7186, -12765, 4618, 934, - -401, 2790, 2284, -4932, -1260, -6009, -2590, -2285, - -1289, 3366, -4192, -4462, 32767, -3135, -1888, 67, - -2874, 150, 4760, -1571, 584, -2187, 358, -1733, - -1286, -4573, -2003, 1872, 940, -1942, -255, -8856, - -1320, -3348, 4854, -509, 2836, -14, 2490, -1537, - 882, 1188, -3132, -15209, -1633, -44, -2827, 368, - -1099, -1073, -467, 6318, 5863, 2840, -5200, 569, - -2984, 6587, 9596, -4924, 457, 4879, -4449, 3528, - 1868, -3894, -3905, 15420, -2590, -599, -4975, 3892, - -1454, -616, 1890, -2700, -3268, -1386, -1065, -3078, - -2454, -1902, 4726, -34, -4218, 1619, -3074, 5540, - -6392, -3570, 2687, -8742, 333, -106, 2326, -1737, - -3775, 397, -3553, -6632, -6066, 9567, 2904, -889, - 1136, 1295, 19390, -268, -3127, -180, 1696, -814, - -775, -4914, -456, -758, -866, 1102, -3740, -374, - 469, -6902, 1440, -10243, -6221, -4797, -3074, -1142, - 297, 5069, -1547, 5474, 716, -454, 3806, 4100, - 2901, -2169, -744, 5032, -5586, -2986, 2286, 2414, - 7860, -2672, -46, -10046, 5348, -1018, 1016, 9142, - 4543, 5587, 2228, -2684, -4594, -2457, -1850, -3651, - -1806, 4826, -11686, 1940, -3529, 1078, -5234, -2420, - -83, -2322, -5134, -775, 677, -9257, -864, -915, - 4494, 411, -4820, 5999, 4472, 5823, -4597, 3121, - -1868, -1539, 2338, -4249, 1154, -13422, 791, -1235, - -1240, 364, 177, -1508, -2527, -2949, -2062, 118, - -3115, 293, -1927, 18644, -1100, 152, -2528, 1914, - -1380, -1624, 302, -831, -920, 320, -879, -1252, - 813, -11, 6960, -522, 3092, -119, 1486, 3068, - 6690, -3079, 13305, 6342, 937, 1632, -1026, 1896, - -2335, -3961, 5510, 2782, 187, -2448, -1251, 756, --15856, 3179, -1155, 808, -1748, -6593, 1494, -3122, - -98, -3808, 491, 1752, 3188, 2158, -1924, 763, - 1165, 148, -3161, -1284, 18082, -195, -1125, 845 -}, - -.cb0808m0 = { --18656, -461, 236, -1122, -796, -101, 851, -3748, - 1374, -8549, -3366, -1482, 1026, 2046, 4394, -521, - 232, -486, -1656, 32767, 1954, -1183, -130, 392, - 194, -868, 2883, -168, -1674, -910, -34, 819, - -1105, 1628, -4871, -585, -1170, -572, 451, 3911, - 10770, -35, -4126, 7124, 7110, -860, -3914, -3294, - 272, -647, 220, 11965, -3378, 2726, 1990, 1624, - -3689, 9884, 2394, 3096, -518, 5169, -4018, 3108, - 168, 1256, -410, -3851, -11176, -10479, 2042, 1421, - 1488, -992, -1562, -653, -1191, 2246, 467, 4732, - 154, 729, 7244, -18, 1313, -51, -1824, 1218, - 1473, -6763, -11270, -4295, 4118, 1043, -5782, 1370, - 46, -11027, 4086, -1501, -11, -621, 464, 781, - 13680, 257, 554, 3119, 750, -1857, 1046, -1252, - -512, 739, 14811, 12642, 3841, 2824, 163, 1620, - 39, 4766, 1411, -2197, 525, 658, 419, 5, - 92, 1544, 290, -2038, 10603, -5764, -3335, -6629, - -2579, 4020, -3107, 2779, 849, 5678, 260, 2804, - 99, 1339, 544, 1438, -450, -598, 764, 1568, - -1034, -4560, 2604, -18205, 1644, 1003, -675, 3217, - -334, -832, -1452, 322, 608, 300, -4776, -812, - -36, 627, 1654, -248, -838, 21571, -89, -1626, - 530, -1151, 9440, 522, -6138, 2213, -10095, -562, - 1000, 5037, -122, -3, 7064, 397, -2118, 362, - 15791, -1047, -15010, -1527, -1356, -2805, -560, -3148, - 266, -45, 1324, -3312, -1772, 2382, 189, 6537, - 124, -1272, 156, 588, -2678, -3106, 2828, -3684, - 689, 3884, 4650, 192, -323, -5426, -722, 11486, - -607, 3591, 4299, 2117, 362, -9114, 11700, -3391, - 2357, 7639, 2197, 4350, 2970, -2525, 169, -6112, - 91, 1520, -19, 1558, -4588, -837, -8163, 897, - -7992, 2080, -3102, 774, -10592, -314, -137, -524, - 87, -799, -111, 74, 1312, 862, 266, 243, - 199, -288, 1205, -829, 1650, 2880, -24776, 3867, --13101, 597, -9778, -2084, -3089, -1112, 548, -638, - 3727, -446, 4877, 2099, 68, -2736, -4914, -7103, - 263, -9228, -782, -2109, 1088, -1881, -1424, -30, - -1353, 586, 4085, -3573, -11921, 2366, 516, -1028, - 834, -234, 2150, -15893, 2305, -3619, -2567, -8366, - 610, 2946, -2383, 2293, 946, -3550, -6770, -1481, - -758, -864, -232, 2855, 40, -2330, 2069, -345, - 1801, -589, -1241, 647, 6988, -2625, 14308, 2801, - 759, -2740, -680, 964, 365, -506, 22268, 1766, - -202, -2751, -293, 3754, 1280, -521, -3355, 4615, - 594, -1783, -39, -46, 48, -2638, -551, 2548, - -1880, 3730, -1726, 939, -345, -7, -1630, -23405, - -1002, 5655, 2100, 440, 1682, 1020, -594, 344, - 1511, -1286, 5518, 473, -11398, -4552, 720, 4701, - 7726, 126, -1953, -484, -1648, -1766, 1589, 996, - -688, -381, 1678, 1498, -528, -860, -667, -823, - 32767, -463, -243, -1242, 1074, 2460, -1411, -459, - -1533, 1462, -2603, -784, -391, 338, 3444, 2170, - -924, 949, 1972, 1520, -3062, -671, 12908, 2636, - 2805, 722, -12016, -26, 616, 1192, 1193, -1028, - -128, -22850, 191, 408, -3105, -592, -440, 1264, - -2580, 847, 850, 2300, -278, 126, 2214, -2693, - -21, -194, -594, -533, 45, 570, 38, 636, - 1276, 171, 29846, 648, 911, -358, 300, 602, - 413, -10167, -54, -1353, 42, -1770, 491, -12154, - -1808, 26, 425, 2009, 910, -8134, 362, 2001, - -114, -2586, -1049, -249, -312, 160, 1677, 27043, - -44, 160, 834, 243, -606, -272, -979, -1605, - 105, -491, 754, -230, 2442, 24, -5139, -395, - -3562, 14436, -1208, -3232, 2555, -12980, -906, 429, - 217, -432, -1263, -244, -225, 912, -64, 780, - 1101, 854, -240, 308, -28630, 518, 32, 976, - -8642, -3041, 1801, -742, -1513, 128, -3189, 857, --14277, -1802, 1229, -68, -565, 65, 4094, 1614, - -8254, -1153, -640, 16225, 3508, -1383, -3882, -347, - 1346, 3845, 2665, 2340, -1862, -5318, 1402, -1352, --21682, -694, -1182, 286, -806, 2133, 1848, -532, - -3750, 7564, 1054, 284, -3742, 2559, 2748, 3408, - -1544, -342, -22578, 1225, 958, 2559, 267, 378, - -3608, -1404, -1669, -13, 1135, 153, -625, 1436, - 211, 556, 739, 1094, 10452, 850, 5128, 11469, - 121, 4937, -3643, 1371, -373, -6686, 229, -3256, - -75, 1304, -1023, -452, 288, 12709, 13572, -501, - 1840, -1044, -2014, -4077, -2726, -1010, -3826, -629, - -466, -923, -847, 5784, 898, -12036, 1253, -1741, - 1546, -3710, 2782, -3430, -1810, 263, -8254, 3126, - 55, -376, 202, 968, -1686, 944, -15300, -2664, - 1393, 783, -11080, 1714, -1666, -1064, -4859, -2344, - 334, 1313, -1209, 877, -1828, -2130, -3057, 340, - 8030, -3222, 11622, -5620, 1469, 3340, 2862, -3945, - -868, 351, -1314, 2277, -2346, 12384, 996, -2460, - 1810, 703, -2158, 3168, -9887, 8754, 3503, -1414, - 445, 850, -30, 2389, -617, 3271, -1606, -5633, - 2993, 10009, 5704, -11589, 4278, 1304, -2418, 479, --16596, -12349, 2915, 327, 895, 1278, 1412, -310, - -653, -1287, 880, -4294, 38, 2179, -2074, -1810, - 198, -1544, -8008, 2456, -2821, -3223, -3713, 11763, - -2081, -141, 4833, 1652, 3598, 551, -1655, -1154, - -60, -302, 739, -1494, 2595, -1006, 2665, 10834, --11270, -2996, -636, -446, 1816, -1539, 4149, -184, - -100, -55, 265, 2207, 639, -162, -2210, -626, - 605, -21149, 2163, -970, -330, -4655, 3396, -3092, - -544, -650, -304, 93, -1484, -888, -8982, 1871, - 1701, -1423, 1671, -11, -1287, -14292, 592, 1040, - -622, 13202, -660, -12745, -2836, -1832, 3481, 1546, - 235, -646, 2132, -602, 2391, 1534, 3599, -4932, - -296, -1855, -2075, -2646, -219, -10248, 1161, 5955, - 6954, 9109, 3498, -5932, -1787, 373, 1234, 1244, - -813, -76, 9083, -5120, -499, -1774, -2150, 10601, - -170, 1160, 982, -597, 95, 151, -534, 6554, - 840, -958, -720, 2066, -50, -2877, -74, -2068, --24760, -725, -357, 1273, 1941, 2525, 46, -819, - -230, 1030, 2291, -287, 1092, -2315, 427, -19, - 448, 1698, 9797, 10962, 3034, 2622, -2652, -1128, - -194, -180, -1176, -1794, -22248, 244, -3, -1856, - -1054, -2751, -459, -62, -433, -2274, -1790, -192, - -720, -421, 55, -721, 1960, 1094, 2500, -2353, - -480, -784, -1221, -505, 1738, -9960, -10772, -13657, - 122, 387, -667, -454, 988, 30780, -757, -2319, - 878, 962, 753, 1306, 716, -771, 539, -705, - 508, 1915, 2114, 937, 447, 935, -1432, -1143, - 4435, 11759, -2442, -53, -10601, 1979, 5419, -2296, - -172, -5987, -1168, -2012, 2257, -1451, 97, -1253, - 5548, 884, -14448, 3134, 2549, 172, 5404, 869, - -83, 597, -12416, 762, -1035, -805, -1369, -804, - 664, 9644, -4329, 1130, -1526, -2900, 628, 620, - -6436, -2370, 2107, -11836, 37, 864, 2105, 314, - 216, -529, 810, 3141, 3716, 7019, -2653, 1466, --14940, 13128, 1218, 2287, -145, -443, -923, 476, - 2411, 5428, -611, 2212, 1450, -3042, -4750, 3562, - 587, -15378, -15151, 600, 1029, -2353, -934, 1986, - 1444, -2171, 1020, -700, -1508, 195, -2466, -798, - 16460, -2164, 520, 2711, -13832, -2024, -871, -5268, - 3556, 117, -416, -8, 2128, -1570, 2052, -3169 -}, - -.cb0808m1 = { - 16492, -295, 2556, 1303, -440, 7584, 3305, -3422, - -1196, -1809, 2142, -1292, 1048, 314, 1945, 578, - 1080, -255, 1109, 617, 1597, 198, -29081, -243, - 54, -33, 76, -418, 1332, 475, 1495, 1554, - -782, 308, -1286, 1044, 300, 1544, 646, 9441, - 2577, -11140, 1421, 1107, -483, -590, 625, 8544, - 446, -1814, 1714, 685, 9620, -4981, -3100, -724, - 8439, -2333, 506, 3557, -1160, -2199, -659, 4107, - 8620, -1406, -3745, 1729, 10756, 868, -82, 2584, - -3140, 3632, 2617, 3880, -1175, -163, 1864, -980, - 551, 201, -433, -1464, 708, 1926, -8471, 3870, - -2376, 15567, 2112, 753, -2450, 72, 1131, 2932, - -139, 6392, 1547, 3, 625, -823, -1750, 811, - -977, -1389, 1300, 1184, 399, 4684, 196, 3679, - -1672, -218, -11023, 98, 492, 4072, 1213, -2004, - 3602, -1787, 1288, -9442, 4157, -4267, 3509, 5317, - -574, -11094, 1078, 6240, 1593, -12773, 408, 3960, - 1116, 1517, -816, -577, -696, 554, 1645, -936, - 83, -20255, -754, 1460, 1110, 1412, -757, 377, - 2373, -1608, -1414, -1028, -3152, 1534, -4145, 2274, - -286, -7058, 2286, 4013, 2515, 2681, -5602, 0, - -1740, 257, 756, 11496, 954, 4513, 3968, 4851, - 278, -511, 829, 2853, -9743, -3723, -1550, -444, - 4256, -679, -11411, -4290, -1470, -4191, -952, -239, - -198, 1361, 9527, 1481, -981, 1403, 991, -255, - 9326, 1832, -1936, -135, 1123, 2756, 1932, 2543, - 795, 12612, 2429, -498, -13185, 3812, -1628, 196, - 1822, 4333, 2760, -676, -2902, 1244, -1974, -7046, --12216, 1503, -2176, 1916, 365, 636, -11348, -5030, - -3319, -3794, -1016, 1157, -4158, 3424, 344, 4494, - 812, -3074, 4356, 293, -3463, 1232, 1746, 2696, - -8269, -961, -4316, 130, -4278, -14007, 3025, -2703, - 179, -10176, 1511, -1460, -1100, -1171, -1575, -2596, - -2026, -11400, 2689, 1480, 743, -1669, 2728, 742, - -60, 11452, 84, -662, 1424, -15103, -410, 2141, - -1664, -1378, -122, 97, -358, -820, 382, -3865, - 374, 1698, -21, -752, 595, -8771, -731, 9368, - 1698, -2586, -6790, -2507, -1776, 4993, -3867, -2807, - -190, 14465, -13938, 3095, -1198, 374, 1682, 1888, - 286, -576, -2094, 454, -690, 1396, -1139, -422, - 405, 238, 1718, 2048, 13448, -151, -247, 202, - -900, -5630, 3121, -10988, -1615, 1955, -3901, 3360, - 1429, 3928, 1951, -1099, -435, 1572, 1500, 19176, - 731, -439, 3686, -3039, 244, -4270, -34, 1289, - 296, -406, 2216, -1400, -1946, 264, 1536, 2992, - 54, 892, -181, -1545, 278, 24923, 989, 1301, - -1279, -188, -198, -661, 612, -1520, 2355, -12972, - -694, -560, 1364, -2988, -6236, 2555, -6630, 1423, - 440, -598, -1092, 304, -2529, -1698, -909, 2560, - 844, 768, -2988, -661, 18432, 1158, -639, 5070, - 11015, -14, 2313, 756, -1941, -10986, -490, -5235, - 2646, 2406, 170, -546, 337, 6499, -4450, 5598, - 299, -504, 14322, -972, 9356, -2056, 8812, -1599, - -1931, 2084, 119, -983, -305, 1437, 403, 2651, - -159, 229, 209, 1438, -1789, -1159, 1017, 416, - 408, 454, 858, -652, -1554, 1198, 18278, 122, - 433, -165, 162, -10532, 11563, 4754, -2022, 4246, - -1396, -2417, -1796, -1496, -1279, 3877, -1217, -770, - 983, -609, 1766, -184, -5664, 546, 7948, 1978, - -250, 4350, 3498, 2797, 802, 846, -12628, -1092, - -240, 781, -11252, -955, 9944, -222, 1177, 1262, - -534, 1790, -7396, 1452, 4251, 303, -3714, -2295, - -290, -227, 672, 22690, -622, -466, 1599, -496, - 326, 871, -1948, 148, 449, 214, -2175, 713, - 394, 1921, -28716, -786, 1083, -641, 1232, -246, - 1572, 1575, -879, -2962, -57, 369, 1633, -1457, - 1194, -1222, 304, -955, 104, -1249, -935, 135, - -758, 3483, -1190, 1457, 1130, -1284, -3709, 18042, - 6, 25, 1233, -328, 347, -512, 2071, 328, --18037, 4582, 3841, -434, -745, 332, -576, 3006, - 336, -11505, -646, 3509, -996, 1270, 2041, 1353, - 1193, 2976, 11569, -3165, 1450, 4351, 2522, -10022, - -6, 12602, 874, 518, 475, 1251, -3290, -2674, - 4802, -11794, -946, -426, -2846, 1619, 1105, -1022, - -1, 1759, 646, 10347, -2937, 13505, 1104, 614, - 1149, -800, 2377, -115, 792, -948, -2431, -1779, - -1142, 809, -3130, 447, -15516, 313, 11235, -1346, - -2426, -2737, -1738, 2236, 1094, 802, 1323, 3612, - -213, 1383, 2800, 10394, 1210, -2360, -10203, -1991, - -102, -2669, 2303, -2184, 1830, -1158, -5633, -4083, - -252, 311, 612, -331, -2786, -12421, 9994, -6006, - -4996, -954, 1014, -1147, 860, 1252, 1114, -2069, - 266, -230, -591, -4442, 230, 20603, 1386, 1130, - -1468, -3600, 2168, 836, -1754, -511, -542, 216, - 26, 3476, 1165, -4293, 3098, -245, -579, 1830, - 2248, 5326, -18357, 397, 5466, 734, 3920, -3678, - 319, -1062, -610, -7509, -1064, 1456, -5729, 1088, - 9099, 2266, 241, 201, -10017, -1545, -2799, 1491, - 27098, -60, -1736, 1387, 859, -1474, -79, -1122, - -971, -1302, 906, -1133, -2659, -296, 1344, -2698, - -448, -1476, -212, -1585, 1310, 14353, -2165, -2229, - -656, 5219, -3266, -1850, 7942, 4997, -2295, 519, - 608, -9498, -1700, 1770, -15308, 1286, -2914, 2252, - -717, 2136, 2478, -3747, 2362, -5, -237, 2334, - 701, -774, -672, -20, -599, 623, -700, -713, - -979, -29926, -1090, 848, -141, 1273, -711, 1782, - -221, -103, 170, -185, -1059, 3066, 1321, 1182, - 3641, -217, 1959, 11806, 2390, -10312, -2575, 1612, - 596, -352, 2197, -2041, 2385, -898, -9363, -1144, --10896, 20, -7842, -1047, 3687, 2147, 2584, -249, - -72, 32767, 1936, 446, -889, -845, -896, 1269, - 448, 327, -3411, 4, 702, -1900, -646, 799, - -770, 662, -911, -856, 287, 1667, -108, -64, - 16, 1578, -2059, -27327, 112, -188, 2504, -692, - 250, 360, 564, 868, 4147, 1340, 18080, -3584, - 445, 364, -2623, -412, -2918, -116, 2611, -2396, - -44, 10934, -1512, -1166, 239, 913, 190, -14681, - -767, 2610, 2931, -2389, 3590, -1680, 6287, -531, - -616, 1317, -1034, -900, 871, -329, 467, 1200, - -1914, 1108, 3150, -6878, 544, -14411, 2807, 5427, - 13361, 1448, -1753, 524, -5851, 1467, -1866, 6888, - -8742, 1372, -1515, 4883, -2248, -1042, 4628, 10768, - 149, -358, -1287, -1289, 32767, -1137, 941, -2112, - 451, -1436, 174, 294, 475, -3667, 1610, 1641, - -599, 626, 2058, 671, 1626, -985, -123, 2040, - 421, 1797, 18448, 2538, -359, -5042, 3096, -1136, - -320, 1823, 30, -12002, -1297, -850, -418, -1497, - -1761, 5073, 10944, 212, -4713, -1614, -1752, -2135, - 483, 1043, -1989, -293, 39, -1049, 67, -7482, - 712, -5358, 896, 12460, -1744, -1793, 1538, 3577, - -6, 418, -72, 1072, 1367, 1080, 3564, 1468, - 482, -1298, -6442, -299, -12934, -757, -4199, 3842, --11331, -1216, -206, 1598, -1135, -3240, 3294, -286, - -540, 777, 1188, -1189, 4516, 2638, 2071, 9702, - -900, 1002, 18707, -705, -1856, 1185, -4832, -1694, - -3502, -2324, -2826, -4600, 1996, -3110, 110, 117, - 405, -16854, -510, -14725, 1699, 1922, -2117, -2718, - 45, 1064, 507, -1781, 2106, -2310, 1239, 5860 -}, - -.cb1108l0 = { - 2354, 8016, 12528, -947, -348, 1760, 2054, -3960, - -2125, -3578, 3932, 1647, -3316, 6053, 392, -3128, - 3209, -2445, 463, -2835, -1555, 1259, 296, -1465, - 1839, -4811, 420, -215, 469, -1013, -272, 185, --27061, -1154, 8, 298, 259, -953, -555, 472, - 617, -1127, -673, 982, -398, -1681, 328, 882, - 614, 800, 431, 84, 880, -240, 15758, -14324, - 1301, 1578, 932, -694, -1456, 2435, -1651, 1464, - 227, 1527, 527, -128, 698, 2405, -726, 1489, - 1016, 1938, -1897, -1478, -238, 932, 2507, -519, - -1147, 557, 2334, 700, -12914, 14861, 158, 255, - 1195, -883, 3359, -1045, 2095, 520, 249, 926, - 789, 1392, -185, -1654, 902, 9, -2166, -1916, - 543, -2126, 2842, -332, 1356, -344, 436, -404, - -174, -489, 858, 258, 229, -45, 327, -316, - -1176, -454, 115, -220, -458, -194, 271, -530, - 1572, -574, -25068, 167, 601, -1027, -1705, -3144, - -4231, -1636, -1012, -1002, -519, -825, -458, 945, - 546, 193, -17909, -156, -1067, 826, 338, 1152, - 562, -506, 848, 239, 188, 656, 97, -174, - -59, 242, 1946, -67, 745, 2043, 424, -192, - 574, -524, 1553, 566, 1480, -747, 487, -20623, - 872, -1089, 1034, 1357, 919, 153, 154, 498, - 54, 555, -989, 707, -85, -21, 700, -1424, - 90, 655, -399, 123, -709, 117, 438, 330, - -720, 190, 812, -138, 460, -32768, -162, -410, - -327, -122, -1208, -554, -502, -178, -309, 373, - 4295, -945, -5502, -2752, -6615, -1241, 1278, -1315, - -7683, -986, -419, -50, 2384, -4640, -6246, -11804, - -308, -446, 3486, -4824, 1736, -590, 960, 195, - 593, 164, 3355, 1655, 1233, 66, -787, -347, --13751, 74, -1209, -812, -4098, -102, 910, -1659, - -2036, -3147, -2075, -2605, -1240, 4499, 1727, -9484, - 549, 728, 3411, 1958, -4439, -1064, 5690, -1600, - -1984, 1695, -588, 4815, -138, -3380, -512, 1553, - 1978, 4310, -730, -402, 828, 2124, 14216, -222, - 2757, -8686, 523, 2516, 1017, 790, -136, -470, - -252, -717, 808, -1113, 13766, -114, -1182, 3053, - -5238, -2231, 1720, -511, -987, 1592, -1257, -2578, - 1777, 1075, 2367, -227, 2330, -672, -2620, -1449, - 2122, 362, 1249, 1338, -327, -21631, -1540, 24, - -2356, -656, 1981, -92, -207, -2188, 34, -457, - -1291, 1231, -460, -128, -396, 593, -671, -1513, - 136, -335, 560, -1121, 490, 1008, 948, 8629, - -3344, 467, 881, -5731, 1120, -300, -1432, 1227, - 1558, 990, -1078, 214, -922, -81, 1120, -15586, - -1176, 1203, -1911, 151, 1484, 1555, -421, -420, - -428, -762, 292, -59, 1075, -649, -841, 494, - 194, 27, -768, -356, 54, 163, -73, 293, - -1717, -392, 750, 234, 751, -111, 26858, 911, - -389, 451, 442, 260, -117, 270, 19, -2429, - 618, -962, 378, 10, -1954, -1336, 525, -258, - -693, -4155, 10265, 2924, -1361, 3197, 10199, 6870, - -2608, -5792, 619, -1994, -2035, -701, 2598, 465, - -575, 311, 175, 162, -1191, 162, -157, -147, - 325, 551, 536, -188, -290, -165, 343, 14, - -268, -27113, 278, 127, -233, -68, 606, 125, - 665, 438, -442, 2510, 800, -1991, -641, -386, - -1574, 78, 946, 189, 106, -2249, -268, -1708, - -1192, 986, 3076, 1807, 21, -5884, -964, 256, --15916, -1320, -2867, -3562, 491, 3502, -337, -1542, - 496, -3182, 1676, -2371, -4264, -2053, 14342, -5674, - 1744, 1813, -3731, -3761, 1350, 1783, -438, -920, - 2366, 1438, -687, 512, -1934, 323, -3158, 1775, - 1964, -6742, 10162, 7763, 1469, 1967, 851, 2742, - 7413, -3338, 742, 1854, 310, -192, -936, -1770, - -775, -976, -1532, -1436, -670, -4032, 1194, -1336, - -4369, 332, 604, 962, -27563, -972, 842, -743, - 275, 713, -251, -799, -1190, 372, -213, -423, - 202, 1189, -31, 1084, -974, 756, -148, -1669, - 640, -549, -339, -1506, -112, -598, -870, 410, --13307, 13141, -1911, 2308, -92, -776, 221, 1503, - 1578, 803, -308, -1672, -404, -83, -3517, -1327, - -606, -2426, -61, -513, 318, -1805, 2049, 1887, - -777, 1268, -542, -116, 3550, -18840, -2986, -979, - 2653, -2875, -922, -10520, 804, 107, 3234, -1270, - -608, 1042, 3599, 965, -342, -2096, -267, 1704, - -3939, 791, 2180, -985, 816, -716, -2661, 99, - 1523, 11902, -1782, 775, -12517, 3244, -3762, 2046, - -278, 1539, 2895, -2425, -10, 990, 1484, -1377, - -3399, -984, 3171, 1513, 696, -785, 155, -1072, - 414, 2016, -1932, -3124, -1126, 68, 3855, 1360, - 4074, 17596, 1714, -596, 4000, 1656, 230, -258, - 2266, 843, -1720, 4624, -714, 854, 696, 636, - -1357, 350, -1256, -523, 168, -9933, -766, 198, - 2680, 8060, 2168, -2789, -14255, 1444, -520, 169, - 1032, 1478, 294, -644, -320, 856, 1282, -216, - -1000, -925, 2, -890, 679, -629, 1152, -1329, --13941, -16385, -1050, -1022, 106, -1151, -41, -709, - 1771, -882, -729, -1420, 1544, -120, 386, -838, - -2744, 1559, 904, 273, -4221, -1065, -312, -1046, - 234, 830, 387, 172, -956, -332, 360, 408, - 125, 90, 348, 915, -264, 911, 263, 124, - -620, -612, 220, 164, 202, 124, -30252, -159, - 1006, -320, 283, -1641, -1312, -9057, 5525, 7520, - -2884, -12194, 2771, -1164, 1842, 1261, -582, 766, - 2498, 393, 953, -617, -756, -323, -1862, 1195, - -1326, -436, -965, 366, -6727, -1226, 9014, 400, - -1258, -812, -279, -404, 1621, 86, 1622, -16, - 96, -515, -257, -39, -134, 1843, -294, -491, - -908, -120, -720, -1162, -1555, 405, -134, 528, - 23596, -77, 183, -444, 2077, 955, 649, 2246, - 3236, 735, -1202, 7954, 9440, 6134, -7267, 28, - -3398, 500, 4965, -1230, 306, 357, 2942, -906, - -4733, 903, -3945, 4447, 1046, -1125, 465, 1183, --12710, -1018, -11302, 5177, -219, -6232, 1552, 2061, - -1372, -1290, -822, 295, 814, -3003, -527, -614, - -856, 802, 167, 1178, -494, -1625, 754, -1550, - 682, -1286, -480, -694, 86, -67, -1429, -1235, - -559, -311, 322, -308, -56, 296, -158, -24, - -748, -197, 26954, 1054, 209, -226, 165, 681, - -131, 341, 341, 1510, 615, 907, -264, 1355, - 388, 198, -5, 418, -783, 28539, 82, -559, - -459, -344, 279, -114, 966, -529, -423, 286, - -418, -766, 42, 186, 461, 418, -688, 2937, - 2793, 146, 1709, -665, 2022, 293, -1522, -2740, --15926, -600, -1503, -1732, -2827, -1027, 1702, 252, - -643, 470, -815, 858, -1954, 1190, 1847, -16, - 266, 29, 486, 25985, 139, 220, 433, -330, - 168, -362, -562, 180, 906, 386, -845, 664, - 1064, -616, -1498, -335, -164, -930, -854, -869, - -101, -204, 835, 117, -16034, -4478, 2634, 1629, - -1873, -1156, -373, -526, 2537, 967, -2433, -857, - 1264, -1670, 113, 845, 7654, -1343, 5245, -1605, - 2236, -1190, -48, 3340, -1981, -1606, -1369, -227, - -727, -570, 1136, 1868, 667, 92, -144, 531, - 949, -1086, 530, 1764, 302, 190, -28036, 182, - 825, 229, -656, 585, 444, 200, -1195, -1855, - -387, -781, 1156, 692, -1164, -517, -464, -275, - -328, 218, -970, 174, -384, -561, -38, -720, - -140, 1021, -271, -57, 463, -25313, -342, -40, - 26, 159, -854, 916, -1532, -1033, 265, 105, - -719, -588, 96, -435, -296, -226, 224, 357, - 30, 576, -66, -30037, -72, 374, 32, 256, - 304, -852, -706, 248, -741, -379, 980, 629, - 1344, 3858, -2211, -153, -3914, -3775, 1570, 718, - -1042, -1338, -4409, 1338, 5118, 5186, 3619, 2142, - 9081, -2784, 4169, 3598, 6621, 4562, -170, -614, - 1196, -1174, 5024, 721, -71, 267, 4, 25598, - -369, 356, 331, 1099, 377, -356, -938, 1161, - -863, 1107, -132, 222, 148, 1410, 908, 60, - 377, 1280, 468, 690, 454, 247, -4552, 6122, - -267, 2973, -5932, -6424, -4983, -4193, -3386, 1691, - 1349, 1419, -3730, 300, 12150, -2927, 1588, -34, - -2435, -271, -961, -1744, 1881, -73, -453, -788, - -798, 9166, 2744, 858, 342, 991, -287, 822, - -37, 1156, -1493, 723, -14127, -1755, 2029, -933, - -1276, 632, -5249, 464, -272, 1149, -290, 4693, - -728, -1475, 841, 10, -283, 92, -268, -295, - 358, 160, 405, 2, -381, 679, 716, -190, - 128, 275, 255, 123, -412, -453, -273, 26, - -174, -340, 644, -376, 27584, -25, 66, 3107, - -1707, 911, 500, -1029, 1029, -1557, 9020, -398, - -2512, -582, 1131, -16696, -429, -1284, -3, 2320, - -532, -302, -174, -146, -413, 2152, 1009, 42, - 402, -1471, 157, 5742, -782, -229, 2379, 646, - 2842, -1776, -463, -2749, -3617, -1710, -12281, -566, - 263, -3174, -2337, 9590, -1150, 2465, 4577, 2064, - -648, -2175, -1877, -674, -634, -338, 343, -1492, - 878, -530, 1072, 13670, -4542, 746, 9704, -4188, - -7076, 1179, -740, -589, -876, 268, -1080, -986, - -4584, 2692, 3032, -2067, 230, -3533, 944, -4950, - -1908, 1452, -255, -698, 1460, -606, -250, -154, --22303, -945, 1626, -588, -482, -1549, -129, 978, - -631, -722, 1094, 1771, -311, 532, -508, 696, - -1128, 1270, 854, -84, 4290, 414, 3351, 1061, - 931, -2936, -9606, -35, 2514, -1095, 567, -452, - -8520, 4037, -431, 2744, -2276, 2647, -1188, -454, - -400, -3698, -315, 11558, -667, 512, 162, -395, --13015, -11, -1944, -890, -14358, -3850, -4296, 1310, - -580, -248, 1305, 402, -1049, 115, 2085, -1797, - -1172, -321, -919, -313, -512, -131, 1619, 576, - 499, -2024, 130, 14, -76, -6324, 495, 2445, --16757, -2348, -2706, -1906, 2377, -2252, -619, -2579, - 643, -661, -1276, 935, 893, 992, -2204, -2451, - -395, -508, 1163, -216, -13034, -718, -1018, -1675, - -698, 710, -257, 2658, 1178, 2046, -2270, -2588, --14442, -1142, -1026, 2247, -536, 314, 123, -1175, - -673, 1576, -2600, 5, 964, 619, -1714, -14811, - -1502, -1646, -1151, -93, -11652, -222, 343, -2203, - -351, -928, -289, 2679, 2101, 742, 747, -2245, - 146, -1828, -2728, 1058, 1048, 3046, 242, 4432, - 246, 350, -13419, 768, -805, 1819, 14332, 1316, - -370, 391, -1421, -1426, -355, -812, -64, 196, - -2917, 1097, -1550, -1246, 436, -62, -813, 1350, - 555, -2236, -1589, 980, -1483, 10122, -2434, 7236, --15225, 1513, 2090, -1224, -83, -2821, 664, 658, - -3242, -1031, 1509, 2667, -160, -1315, 1060, 891, - 432, -1311, -2503, 1304, 1295, 1745, -722, -2496, - -4409, -3360, -2776, -2793, -4921, 12616, -1031, -443, - 1495, -2416, -4640, 4508, -2944, 2608, 1323, -394, - -415, -2111, -2065, 1030, -3636, -1338, 2916, -3007, - -3680, -3152, -115, 577, 2742, 785, -4429, -1945, - -304, -4883, -133, -3136, -1927, -576, 618, 1780, - 2568, -2102, -158, -3986, -1187, 280, 655, 162, - -1352, -5730, 15372, -1314, 1553, 274, -2873, 4221, - 4610, -4143, -13699, 2760, -1255, -238, 1487, 1583, - 1422, -2272, 4734, -6368, 795, -406, 1498, 1588, - -500, -2744, -875, 2080, 1901, 960, 344, 979, - -258, 952, 2526, -11785, 893, 669, 1361, 518, - -1368, 3854, 2539, 623, -1835, -4177, 2686, -2956, - -2804, 1121, -8890, 1377, 1125, -3990, 140, 3594, - 1757, 2271, 366, 1723, 2150, 13557, -1768, -1433, - -6632, -578, 3266, 2509, 7142, 680, 1532, 1318, - -1123, 5668, 1283, -412, -5404, 2893, -2647, -2695, - -1412, 340, -650, 863, 1895, 2867, 384, 626, - 856, 508, 1365, -295, 960, -26080, 234, -4, - 239, -412, -6, -765, 736, -30, 136, 912, - 538, -792, 413, 871, -437, 305, 30, -194, - 1105, -1113, 3550, -4854, 449, -549, -7626, 3706, - -3698, 1778, 1441, 2240, 73, 513, -3383, -2346, - -1372, 3955, 2973, 1175, -6087, 5071, -2135, 8552, - 4961, -1201, -1458, -2627, -730, 515, -756, 476, - -1104, 2115, -1276, 498, 336, -451, 809, -1030, - 556, -211, -70, -93, 89, -755, 296, 872, - -282, 380, -298, 2774, 660, 1339, -545, 429 -}, - -.cb1108l1 = { --13570, -9232, -673, 267, -819, 1633, -33, 623, - -850, -4376, -1135, 999, -262, 1928, 695, -1751, - -2793, 772, 5064, -1158, 280, -2144, 1313, 888, - -2482, 469, 2996, -1406, 12525, -1200, -1202, 939, - -3, 847, 818, -924, 135, -1308, -12000, -544, - -592, -3914, 441, 3372, 3188, 1314, -1836, -706, - -844, -1319, 1029, -1754, 172, 2468, -903, -889, --14602, -2054, 11694, -1980, -730, -1661, 214, 1243, - -337, -646, -95, 1432, -854, -236, 88, -2, - 514, -1643, -84, 3561, 302, 770, -1248, 480, - 664, 738, 1728, -1783, -2227, -702, -3582, -16641, - 1713, 1506, 660, -2471, 2061, -48, -3161, 1697, - 900, -1477, 558, 287, -5515, 1023, -1972, 999, - -1856, -3022, -228, 711, 1270, 2644, -648, 1064, - 3899, -1205, -754, 1080, 1262, 18, 860, 2274, - 655, 494, -221, -15647, 1334, -473, -1648, -341, - 3541, 3109, -1671, 639, -2491, 185, 477, -388, - 5198, -5680, 812, 700, 2180, -536, -19468, -2508, - 2592, 2901, 32, -1165, 1500, -422, -790, -1914, - 971, 111, 1226, -1302, 541, -3862, -832, 642, - 305, -3870, 8921, 570, 180, 1734, -1572, -891, - 17672, -756, 702, 2740, -647, 2122, 102, -1371, - 461, 454, 204, -307, -1248, -2330, 1353, -1783, - -1939, -601, 512, 2118, -2178, 254, 1190, -1252, - 923, 1166, 360, 320, 320, 1210, -142, -416, - 1260, -205, 1403, -1025, 19252, 328, 58, 21, - -1044, 1786, 2153, 697, -436, -1617, -869, -493, - -2419, -3102, 1995, 1519, -1799, -153, 2689, -665, - -1371, -915, 18486, 941, -2612, -1057, 1076, -3351, - -48, -1478, 575, 728, 130, -168, 40, 898, - 2141, 1518, -965, -1910, 896, 838, 1220, 416, - -1494, 1404, -126, 21472, 604, 1740, 102, -812, - -796, -734, 1082, -507, -468, -1732, 1171, 252, - 359, 436, -765, 791, 726, -810, 1838, -1798, - 5662, -2362, 1275, -2829, -4041, 1398, 2681, 480, - 13740, -752, 2252, 1306, -1026, 1834, 54, 9993, - 559, 1370, 711, 1918, -1757, 646, 16, -3262, - 2676, 1751, -2595, 4782, -1050, 2401, -15131, 1100, - 386, 708, -359, 455, -25, -950, 241, -482, - 268, 2327, -2766, -142, -1992, -566, -36, 990, - -6302, 3245, -1394, -1579, 760, -757, -2115, -8542, - -2945, -800, -4027, -3102, -1319, -1989, -1787, -426, - 590, 1031, 467, 31, 2674, 1686, -14352, 1174, - -1446, -813, -1267, 2919, 2052, -1574, -753, 3369, - -1090, 3830, 2042, 11376, 1140, 895, 1130, -720, - -1284, -2277, 49, -724, 397, 13201, -985, 1599, - -365, 1517, -496, 978, 2152, 1391, 1777, 3032, - -936, 280, 1719, -4551, 4874, -941, -160, 956, - -676, -229, -548, 183, -16606, -855, -3433, 1248, - -578, 2254, -532, 3081, -1406, -1859, -605, 1809, - -1001, -114, -1222, 3890, -609, 3114, -2430, -2142, - 440, 1780, 1606, -4211, 1047, -456, 8280, 9, - 5866, -1718, -932, -13049, -562, 3097, -583, -21, - -1972, 1254, -172, 527, 2282, 5064, -5391, 1074, - 357, 1845, 24, -996, 100, -50, 1098, 2905, - -417, -937, -439, 247, 18502, -2380, -2088, -402, - -580, 83, -282, -70, 969, 540, -219, -1132, - -1701, -195, -3030, -2748, -1974, -1304, -1909, 1080, - 1042, 1124, -128, 5816, 2303, 2840, -2420, 35, - 16550, 721, -2079, -1489, 1023, -654, 2025, 1479, - -185, -2449, 500, 3034, 2663, 3911, 1203, 998, - 594, -533, -163, -262, 739, 13, -426, 182, - 394, 350, -30055, -371, 150, -430, 147, -1122, - 43, -390, 298, 831, -194, 158, -114, -257, - -1346, -585, 206, -456, 478, -502, -1710, -1719, - -581, -536, 45, -861, 825, 1093, -255, -685, - 38, -20, 419, -594, 10, -1408, -526, -19191, - 196, -1496, 255, 1844, -8759, -3565, -1009, -926, - -818, -1195, 236, 2898, -182, 14344, -1384, 1064, - 1181, -1846, 543, -583, 170, -3305, -1187, -2406, - -40, -1051, -1071, -28, 1482, -1060, -1057, 3028, - -2023, 913, 1052, 980, -5158, 4642, -14067, 3920, - 1450, -4497, -1591, 842, -2222, -392, -42, -3546, - -258, -3566, 2595, 225, -2696, 4624, 2283, 1483, - -1506, 2164, 151, 380, -3207, -1086, -10594, 2005, - 2379, -2567, -925, -363, -1261, 13174, -73, 1168, - 2215, -1721, 726, 525, 1048, 322, -827, 2117, - 3890, 1346, -3512, 2243, 638, 2259, -1371, -2260, - 10590, 851, -1247, -894, 1871, -882, -1955, 3822, - -3654, -1730, 906, 2074, -548, 885, -2501, -1316, - -3275, -10694, 2031, 1077, 3013, -1105, 2951, 1907, - 1218, 194, 1860, -1662, 178, 915, 1092, 809, - -451, -610, -728, 799, -129, -101, -905, -2, - 2470, 1292, -137, 544, -18795, -1081, -300, -59, - 282, -329, -544, -1324, 2155, 9326, 462, -388, - -303, -2940, -608, -13652, 532, -1350, -1026, 1330, - 5559, -333, 4961, 707, -1832, 1070, 2483, -2016, - -315, 2197, 849, -348, 379, -2179, -15691, 903, - 3192, 3888, 396, 4610, 3261, -2589, -4903, -643, - 3604, -1380, 1524, -2155, 469, -3528, -790, 429, - -3862, 1797, -104, 2364, -1162, -1559, 1011, 1849, - -235, -1952, -2088, 1436, 2502, -3862, -1704, -14859, - -2863, 710, 624, 4373, -6302, -616, -807, -1577, - -2492, -620, -917, 948, 4957, -848, -863, 514, - -2210, 2162, -753, -15168, -2068, 12472, -2611, -723, - 2797, -8573, -2270, 978, -2597, 2215, -684, 2535, - 3114, -261, -178, 2385, -4869, 1161, -32, -1469, - 2074, -1407, 3226, -992, 4546, -3158, 1044, 463, - -5285, 4, -1396, -1395, 1770, -1767, -860, -6, - -2242, -1548, -667, 587, -982, -2246, -1312, 1550, - -542, 5302, -716, 135, -15895, 3382, -478, 1279, - 615, 3365, 1620, -12613, -230, 3101, 3230, -1307, - 2860, 628, 647, -3595, -214, -1631, 2783, 748, - 1088, -57, -6014, 2496, 359, 719, 1476, -750, - -1644, -2125, 3913, -3788, 565, -1118, -1411, 1377, - -1020, -246, 18851, -1438, -1150, -1492, -681, -798, - -776, 960, 911, -1449, 336, -1114, -2111, -877, - -532, 668, 1018, 1098, 408, 2032, -607, -656, - -5997, 3089, 2462, -18368, -1027, 78, -4066, 439, - -845, 1476, 290, 490, -452, 1638, -3381, 80, - 1699, 458, 260, 1215, -516, 1883, -62, 35, - -2540, -1703, -1042, 1751, -422, 1222, 207, -104, - 1112, 151, -473, -522, 26426, 562, 884, -2201, - -281, 238, -839, 1037, -588, 81, -109, -2, - -32, 75, 654, 489, 524, -388, -1408, -906, - -1193, -936, -273, -40, -100, -662, -522, -145, - 119, 614, -922, -25329, -180, -668, -574, 161, - -448, 173, 750, -609, -812, -125, 814, 572, - 2602, 20372, 244, 1820, 724, 515, 932, -1290, - -712, -990, -305, -13, -763, -1157, 481, -764, - 320, 624, -620, 642, -1494, -568, -601, -655, - -790, -1348, 334, -1302, 382, 782, -1122, -641, --23549, 180, 463, -634, -666, 599, -356, -1071, - 816, -576, 1208, 912, -377, 624, 1049, 42, - -95, 370, 1932, -167, -275, 142, -159, -410, - 595, -562, -632, 748, 1192, 614, -41, -18, - -156, -61, 1280, -686, 363, 759, 756, -19362, - -614, 2151, -1185, 169, 327, 1494, 782, -1313, - -134, 841, 218, -76, -2980, 202, 80, 281, - 89, -61, -1678, 59, -125, 195, 320, -1310, - -56, 806, 47, -65, 249, 18432, -666, -506, - -204, -194, -560, -416, -3641, 330, -268, 842, - 10600, -176, 424, -1744, -3609, -1682, -844, -309, - -538, 435, 14251, -1281, 373, 2748, -702, -1358, - -766, 3480, -679, 4039, 529, -5698, -38, -813, - 1203, 4734, 318, -1044, -5109, 2187, -3474, 415, - 2436, -3021, -1628, -456, -1451, 3406, -1798, 1001, - -8648, 468, 1188, 497, 4628, -948, -4073, -11894, - -2750, -738, 1520, -4070, -810, -5755, -1370, 2978, - 4460, 917, 1221, -324, -1166, 2339, -1221, -2048, - 714, 6884, 3096, 6998, 13, -275, -3879, 790, - 104, 1383, 2056, 1957, -9216, -430, -199, 261, - 764, -109, -210, 795, 884, -334, 1546, -272, - -35, 738, -268, -13, -448, 645, 97, 76, - 1284, -343, -654, 112, 643, 22846, 634, -597, - -621, -784, -380, 951, -452, -685, 140, 688, - -770, 247, -679, -228, -26856, 311, -546, -444, - 606, 69, -195, 18, -220, -334, -42, 543, - -28, 492, 766, 208, -1206, -554, 213, -1112, - -1675, -608, 382, 2011, 5077, -17442, 1367, -702, - -856, -416, -1728, -1987, 2966, -1952, 38, 152, - 712, 210, -589, 3029, -1189, -2016, -8071, 10746, - -2143, -556, -1964, 162, -504, 995, 982, -2565, - -634, -985, -1668, 444, -2098, -411, 488, 1397, - -1134, 1888, -920, -279, 15057, -757, -1258, -3040, - -890, -105, -670, -490, -238, -2419, -1302, 915, - -784, -929, 1653, -89, 1076, 445, 2538, -1424, - 19175, -91, 437, 752, 254, 935, 854, -1666, - -86, -543, 1053, 664, -155, -485, -3994, -50, - 50, -58, -2626, 1801, -314, -16052, -1831, 1009, - 2344, -3030, -938, 1761, -1283, -150, -425, -6660, - -900, 1374, 803, 549, -2683, 837, 483, -655, - 4610, 1259, -45, 834, 1103, -3250, -3604, -2882, - -2463, -5331, 11312, -1653, -3505, -1855, -4962, 8579, - 2370, -2474, 501, -1282, 985, -924, 3452, 456, - -242, 3878, -2095, 2994, 7076, -459, 2574, 16116, - 8277, -88, 572, -38, 0, 1664, -553, 1820, - -2096, 1076, 415, -420, 1900, -1696, -130, 298, - -1555, 201, -404, -1831, -932, 844, 9606, -497, --16304, 3278, 918, -523, -1573, 2488, -813, 147, - 1540, 3795, 1390, 1061, -78, -10, 574, 2620, - -1143, -512, -582, -1496, 736, -4323, 786, -2873, - -1342, 3932, 14508, 12635, -899, 1730, -673, 386, - -676, 2787, -2780, -2960, 375, 475, -2188, 2250, - 851, 788, 268, 1264, 2973, -94, 1062, 1006, - -697, 669, -635, -986, -4848, -1486, -6, -3914, - 6267, -1560, 8, -503, 5273, -3545, 69, 15146, - 2263, -1490, -548, 1740, 1636, -892, -895, 769, - -471, 226, 6497, -2466, -2037, -1068, 1075, -902, - 13668, -1213, 12424, -3523, -124, -1090, 972, -1134, - -494, -2568, 881, -3081, 369, -254, -618, -914, - 443, -1254, 658, 1322, 546, -14, 778, -116, - -378, -802, -268, 48, 1140, 25942, 503, -637, - -871, 1050, 298, -187, 387, -406, 343, 212, - 110, 723, 695, -47, -50, -568, -66, 347, - -1588, 20, 701, -485, -98, -787, 4502, 1046, - -1628, -2526, 185, 1016, -256, -700, -403, -154, - 103, -752, -689, 2084, -1463, 2294, 360, 17590, - -698, -1262, 788, 116, 755, 751, -440, -610, - -469, 1235, -2314, 1240, -308, 553, 1065, 24442, - -733, 667, 4, -484, 93, -263, -361, -278, - -1524, 176, 1311, 1561, 435, -436, -1079, 260, - -366, 472, -1049, 647, 158, 302, -931, -36, - -990, 736, -444, 1077, -1560, -251, 148, 1000, - 1096, -300, -224, -307, -17646, 39, 206, 74, - 505, -3051, -1285, -793, -724, 718, 324, 803, - 874, 6062, -2235, -3321, -550, 9264, 3483, -4172, - -4024, -471, 858, 2682, -1078, -1922, 2088, 1135, - -878, 545, 2205, 836, -1088, 547, 12461, 2222, - -828, -3841, 4797, -2360, -2510, -4029, -2213, 13736, - 1032, -958, 1895, 264, -1499, -2066, -241, 1324, - -224, -792, 776, 2130, 2600, -2276, -4239, 3260, - 1610, -1620, -1220, -2752, 979, -2028, 19626, -2146, - 684, -729, -235, -289, 588, -600, 245, -879, - -816, 413, -87, -1158, -246, 69, 970, -111, - 500, 1097, 1087, -138, -1356, 30, -434, -452, --22802, 177, 492, 206, -257, -854, 1445, 37, - 1384, 97, -258, 811, -222, 53, 548, 1744, - 124, -1031, 1076, 186, 453, -173, 1180, -2235, - 583, -392, -1542, -726, 2937, -3635, -856, 1446, - 7796, -2779, -962, -2277, 1651, 1960, -1460, -1277, - -9794, -288, 2459, 2350, -2521, 84, 578, 2286, - 480, 1620, 6421, -200, 170, 1513, 198, -1001, - -491, -1000, 161, -482, 607, 214, 743, -292, - -394, -192, 92, 73, -415, -316, 593, -42, - -346, 456, 44, 950, 129, -189, 806, -221 -}, - -.cb1108s0 = { --32768, -828, 9569, 331, 6938, 3122, -1008, 2847, - 646, -5690, 1712, -795, -4406, 1368, 307, -526, - -2206, 26, -210, 1358, 746, 1920, 667, 3866, - -413, -720, -4328, -2475, -1189, -863, -3809, -5052, - -8567, 2859, 1915, 4895, 12440, -13002, 2757, -5969, - 4054, 1100, -9430, 4930, 10266, -1522, 7092, -8778, - -1968, 4325, 8440, 3888, -1966, -688, -2455, 2966, - -2380, 1682, 4956, -2310, -3706, 404, 6774, 17562, --12437, -2667, 4864, -9411, -6436, -9316, -903, -5526, - 3463, -1690, -5250, -12568, 2338, -1310, -3019, 776, - -641, 3483, 54, -10732, -3878, -691, -17615, 4530, - 10267, 7830, 8488, -12624, -4514, -17183, 7070, 3115, - 4176, 383, -4558, 410, 6379, 6242, 4702, 4853, - -217, 446, -3811, -2396, 244, -2120, 3275, 5122, - 180, 4523, 8680, -1868, -6164, 2636, -5056, -4039, --11618, 4014, 11349, -2616, 8240, -5119, 1988, -2552, - 6060, 3206, -662, 2686, 1116, -10447, -3004, 650, - 7811, -12148, -327, 856, -916, -397, -600, 4621, - 3011, 5539, 5417, -2374, 9667, -4714, 7821, -2819, - 573, 4492, 1882, -26770, 1486, -6963, 1103, 2515, - 8196, 1849, -7492, -5243, 2106, -5290, -11000, -1410, - -3448, -8548, -4536, -7730, 3083, 6109, -14458, -8624, - -381, 7840, 4694, -3906, 8223, 3315, 5849, 13112, --13132, 6081, 11801, -7624, -376, -6372, -6817, 6834, - 1760, -1435, 1072, 3505, -1494, -709, 5786, 454, - 1807, 2650, 7728, 1357, -1002, -5366, -2368, 2052, - 333, 6312, -336, 8274, -1653, -4309, -6630, 2841, - 2448, 8398, 5376, -7248, -1474, -1842, -4119, 838, - 501, -4206, 4052, -1250, -20943, -3338, -592, -2973, - 7057, -128, -3235, -4313, -2510, -11313, -4925, 3103, - 1448, -5186, -1322, -16815, 1956, -7950, 2641, -2890, - 4396, 2322, -1381, -1911, 448, 2543, 3535, 782, - 3719, -624, 1610, -2843, 7583, 1794, 700, 3107, - 4528, 5461, 2540, -1074, 5976, 741, 576, 4426, - 4400, -4920, 5724, -3734, -1186, 10645, 1100, 10537, - 2828, 11670, -8391, -32572, -9405, -6807, -875, 2277, - 736, -4546, -18693, 1204, -1083, 3422, -3328, 6013, - -2992, 5812, 2744, -11668, -2519, -2384, -3635, 6532, - 6874, -2820, -5222, -12261, -14266, -6663, -1150, -2032, - 2099, 4642, 1638, -4162, -644, 249, -3133, 11830, --10712, 12370, 4818, -1924, -5639, -6448, 2455, -4898, - -613, 1760, 2393, 1414, 7039, -7018, 5901, -2900, - 3786, -3230, -3718, 3514, -4040, -4676, 6367, -1449, - -2758, -2888, 4066, -7140, 408, -7656, 3156, 19919, - -1858, 6671, 352, -3355, 3074, 5524, -1429, 1954, - -6664, -10082, 4405, -1598, -806, 1779, -6913, 7062, - 5064, 6518, -1042, 3400, -5530, -1192, 590, -3298, - -772, 571, -6239, 9810, -12380, 1302, 1344, -3430, - 3830, 4106, 5792, -6196, 224, -2604, 3954, -12551, - -5539, -8306, 1801, -4521, 3578, -4349, -5716, 4960, - 3620, 1516, 5779, 5550, -3710, 3329, 10542, 4198, - 5148, -3291, 196, 6232, 6943, -1303, -10306, 1862, - 6547, -1544, -2996, 2868, -4389, -6894, 28557, -13130, - 1397, -2331, -4076, 2870, 3592, 6613, 265, -4790, - -3514, -3152, 8710, 230, 3142, -1264, 1822, -769, - 6168, -1792, 2189, 2660, -2664, 3402, -533, -3100, - -476, -1164, 6092, -2930, 3372, -5895, 8507, -918, - -4716, -1582, 23959, 1506, 2360, -117, 2029, -452, - -6575, 964, -13132, -2838, 3800, -3355, 3168, 5230, - 11116, 826, -1711, -3546, 7398, -4092, -2884, 743, - -1784, -3824, -3437, 1050, -3306, 928, -5109, -7999, - 1581, 8609, -4662, -3594, -1618, 9929, -3982, -5591, - -8789, -1444, -12011, 1304, 12668, -5138, 10837, -7951, - -4089, 3921, -5375, -2486, -2590, 11398, -80, 7734, - -4547, -11286, -7098, -7758, 5303, 7380, -11266, -11138, - -8676, 30, 6328, 597, 7852, 3144, -3933, 15142, - 3954, 12197, -507, -1667, 5517, -4187, 709, -1330, - 2094, 4739, 1341, 8276, 8544, -10107, -10151, 3641, - 771, 4798, 4839, -3254, -9246, -7304, 14850, -18155, - 3068, 4993, -4930, 10985, 6270, 8528, 5904, -13010, - -7824, 1300, -706, -156, -4228, 302, 9962, -3087, - 4472, 4541, 13179, -6576, -2541, 8284, -51, 5366, - -4369, 289, 3890, -3671, 1894, 21820, -3031, 5336, - -8412, 2487, -1211, -6759, 1292, 3749, -8904, 638, - 6863, 154, 1145, -684, 6648, -3874, 2005, 4670, - 4408, 4191, 3984, 632, 2957, -1532, -3974, -2576, - -1636, -3714, -136, -4946, 3900, 367, 27072, 1864, - 1426, -3321, 860, -1768, -2009, -3436, 2666, -9899, - -1328, -2330, -3078, -3258, -4600, 5604, -5248, 1703, - 4403, -4781, -8275, 6717, -3860, 10980, -10634, -8360, - -2291, 20311, 7602, -4028, 483, -4886, 2677, -4921, - 6065, 5393, -2145, 6201, -472, 1796, 2869, -3578, - 3053, -2342, -3193, -2589, -3215, 1322, 536, -164, - -314, 4800, -1903, -1338, -11833, -23399, 5562, 4440, - -1864, 2520, -4251, -1464, 5053, -8553, -3852, -5932, - -849, -7113, -3493, -5338, -1671, 1496, 4504, -1830, - 5716, -210, 1397, -2060, 2242, -583, 2604, 5355, - 13938, 13150, 1346, 2649, -1527, -4568, 8891, 7399, - -6492, -10371, -4885, 13056, -8262, -1267, -2959, -868, - 5941, 299, -601, 8834, 1436, 5404, 1914, -3775, - 980, 8848, -2270, -1952, 6902, 8642, -25725, 9556, - 14540, 1998, -13157, 308, -13844, -10126, -2147, 8296, - 1772, 1094, -9712, -8560, -7552, 5527, -1446, -1097, - -5798, -17270, 2860, -210, 2136, 175, 729, 11775, - -5154, -4202, 13342, 3977, 14494, -5659, 9105, -11067, - -3694, 4794, -593, 6817, 1875, -4975, 3663, 4141, - -8317, -8932, 2127, -4176, 1136, -148, 7640, 8127, - -744, 2354, 389, 1600, -6475, -4558, 10735, 11407, - 3896, 13098, 1814, 5191, -3850, 2629, 18430, 8343, - 4630, -4624, -702, -3834, -2276, -2894, -1556, 1437, - 424, 5652, -6260, 2387, -5845, 7496, 10657, -2754, - 4806, 1169, 1308, -4114, -5347, 15076, 5686, 7287, - 3004, -6254, 5186, -14096, 10323, -1974, -9355, -5544, - -986, -5998, 261, 4494, 2467, -1911, -603, -4548, - -1344, 1995, -1603, 10464, 5222, 3714, -5342, -8039, - 12530, -26465, -1813, 4044, 746, 8123, -12078, -4703, - 2971, -4487, 2556, 3904, -2518, 1504, 5774, 5431, - 1120, -934, -5202, -6826, -8774, 7156, -2392, 10643, - -2918, -4298, 3361, -3758, -894, 5828, -203, -4905, - 6480, 11771, -19830, -17545, -4920, -17263, 10066, 10125, - -8980, -19719, 23554, 27907, 2607, -7014, 6128, -23759, - -4802, -7099, 874, 13103, 21667, -8475, -12938, -13122, - -3694, -18860, -3518, -3586, 12658, -793, 10661, 6925, - -730, -11373, -7845, 94, -2627, -6044, -2213, -4381, --10198, -5816, -56, -4349, 3722, 3911, -1719, -2513, --13290, 3218, 105, 1876, -76, -1107, 2563, 4520, - 10288, 5862, -7738, 6180, 9863, 1380, 6756, 2632, --18798, 9314, 7190, -7454, 432, -15141, 8462, 2128, - -2386, -2710, 292, -751, -3125, 6147, 4941, 3146, - 3046, 120, 321, -5884, 5105, -4300, 6264, -317, - 1667, -694, 7950, 5639, -3284, 1089, -6456, -14694, - -3527, -1104, 4313, -20858, 7920, -10782, -13536, 933, - 4523, 2640, 2118, 97, -614, 9834, -9515, 232, - 5086, -6720, -1529, 568, 3139, -3665, -8567, -13771, - 6274, -4370, -5653, -8920, -7667, -9391, -6653, 12489, - -3666, -5103, -12324, 4796, -540, 10396, 3668, -3467, - 7124, -4398, 87, -12139, -204, 1213, -2190, 11948, - -2641, -2434, -5647, 2819, 3148, 3558, -6455, 3705, - 1644, -3090, -4225, -5998, 112, 17789, -7220, 2166, - 4153, 4516, -1100, -1667, -1402, -8837, 6344, -1586, - -3451, 2357, 616, -392, -8163, -11579, 6160, -2783, - 7895, 11321, -11847, 8070, 5231, -6496, -3172, -3470, - -2960, -11437, 465, -470, -2568, 11197, -9417, -4117, - -1162, -1893, -2361, 551, 14478, 3510, -1372, 3117, - -8236, -2904, 14556, 3191, 200, 2166, -13974, 2718, - 3946, 2444, 1982, 5320, 2087, -2222, 1573, 742, - -8828, -3917, -11080, -241, -8472, 6119, 290, -2364, - -3163, 1923, -1964, -582, 2564, -5566, -6411, 2069, - 7392, 9115, 25316, 1504, 2540, -814, -1746, 566, - -1580, -2290, 170, 698, 105, 9567, -6714, -584, - -4934, -379, -491, -978, 4580, 1180, -3355, 1882, - -4343, 4817, 1503, 9968, -8878, -4908, 3419, -4818, - -2254, 6694, -4368, -10849, -5093, 4510, -3129, 152, - 1926, -4490, 1510, -17764, -6699, 962, 3474, 4981, - 25, -7128, 1432, 5386, 3108, -4545, 1092, 1663, - -1363, 3076, -8916, 6158, 244, -1181, -825, -933, - -5570, 17221, -535, -2892, -5031, -1297, -3010, 5840, - 678, 748, 3944, 1630, -3648, -5457, -2618, 876, - 6655, -2834, 2597, -6667, 1330, -40, -4423, 6257, - 743, 6083, -584, -3742, -1401, 1779, -5166, 4559, - 5558, 8588, -6476, 7521, -1561, 4950, -778, 3564, - 11403, -1010, -3151, -14151, -1020, 2595, -3278, 24555, - -4859, -909, 2314, 1301, 2098, -5664, 3938, -4050, - -203, 3368, -2580, 3061, -9266, -6263, -6748, 3890, - 1950, -329, 1050, -1106, 588, 23705, -661, 6913, - 722, -5820, 2147, 3789, -1689, 661, 5389, -8519, - 1152, 3800, 7160, 5234, 1343, 3218, -2900, -391, - -4258, 5084, -4783, 7262, -10013, -811, -5252, 6474, --17338, -2388, -2596, -8715, 5836, 9523, 639, 4652, - 3071, 3114, -1648, 1563, -931, -10143, 4394, -2838, --11900, -1012, 841, -5812, -3048, -2715, -196, -5794, --20022, 1949, 3464, -770, 2200, -3564, 1975, -6242, - -1937, 3954, 5678, -2744, 1888, -3825, 5770, 3869, - 8315, -7386, 1318, 1302, -5534, -4554, 924, -3804, - -4292, -22757, -7972, -7469, -3543, 7858, -10125, -2637, - -4765, -10644, -5944, 1159, -3293, 4363, -1219, -12248, - 5060, -7232, 6947, -1609, -3037, -5084, 6580, 15873, - 5336, 7295, 2386, 2961, 4655, 9714, 5080, 11635, - 1790, 2897, 687, -914, -692, -6653, -8562, -1412, - 244, 4478, 1650, 7175, 1046, -6689, 3693, -3520, - 6046, -1336, 1976, 16822, -1176, 792, -1733, 8286, - -7359, -2402, -8536, 1392, -3271, 6580, -4939, 1562, - 595, -4237, 4872, 4266, -1798, -6589, 7457, 4207, - 9978, -3996, -2236, -3078, 1861, 10101, -2394, -3250, - -7619, -7082, -14305, 5664, -1337, -11019, -3839, 10190, - 7249, 3086, -1782, 24, -3566, 10769, -4102, -6408, - -688, -8987, 3018, -5942, 7478, -368, -7931, -3018, - 6766, -78, 5705, -3264, -1100, 4850, 4518, -28, - -6276, 4905, 7094, -4394, -2846, -88, 434, 2039, - 352, 9827, 12372, 1207, -8561, -4476, 1496, -4927, - 2087, -6730, 1134, -81, 57, -8701, -2918, 3953, - -2844, -1842, 4804, -5315, -401, 7060, -16397, -4802, - -9849, 17542, -11715, -12432, -6676, 9323, -13189, -5761, - 8054, -620, -7431, 3726, 17790, 7880, 251, 2983, - 3736, 7118, 17197, 8613, 1445, -15290, -16184, 11084, - -4971, -5922, -1893, 9067, 9321, -8139, 714, 182, - -3138, 7258, -1874, -2781, 10800, 2915, 5316, -5206, - -2581, 10219, -484, 862, 119, 6628, 1514, 3883, - -880, 7586, -2573, 3279, 3801, 4492, -3850, 9416, - -38, 7518, -574, 4052, -1136, -668, 9672, -9536, - 2551, -4223, -1074, -3616, 8446, 158, 3262, 7965, - 1311, -8634, -6786, 700, 4973, 917, -754, -1156, - 6054, 2067, 10757, 421, 1030, 11351, 2149, -4286, - 12075, 4593, 1193, -5290, -8566, -2965, 6824, -6238, - 2392, -3395, 5350, -2789, 7529, -1873, 3032, -1494, - -2703, -18535, 1583, 9539, 2556, -4422, -6079, -2699, - -7860, -4573, -8236, 4281, -1079, -17578, -2840, 7468, - 4675, -5002, -1268, -1529, -8222, 8285, -766, -4314, - 6048, 11507, 5046, -2444, 3186, 1732, 7872, 6598, - 2828, -2920, 8278, 13263, -10204, 1334, -5552, 10532, - 5412, 2554, -10076, 1128, -3959, -3210, 4091, 1824, - 4984, 5558, -2204, 2080, -3802, 6614, -7380, 3612, - -4624, 6366, -1795, 4038, 6227, -4312, -4910, -2127, - 15077, 4144, -16885, 3757, 2303, -670, 5625, -2590, - -2594, 2491, -3174, 4199, 1152, -1532, -7308, -8578, - 6431, 2975, 6032, 3037, -7451, -2643, 5503, -7856, - -2451, 5309, -3678, 8145, 1864, -8341, -15575, 7716, --10337, 8935, 12350, -10418, -4092, 734, 10400, 10934, - 5724, 1778, 5836, -3203, -10700, 2766, 4178, -18135, --16589, -5465, -5005, 7239, 25480, 7310, -6408, 6142, - -7748, -1423, -4318, -321, -2899, 3728, -3184, -3578, --11598, -1223, -8554, 656, -3945, -4084, -724, 301, - 9539, 9695, -1799, -2602, -1379, -5282, -4709, 11858, - 9562, -7508, 4886, 896, 5780, -160, -12724, -9598, - 1220, -5411, -5072, -6476, -11763, -104, 9311, 5230, - 591, 4342, 263, 13198, -17801, -1892, 2619, 18194, - -2080, 16536, 18497, -25926, 25541, 66, -6648, 1627, - 2794, -3790, 9424, 1387, 20702, 5260, 5211, 1702, - 1019, -11143, -6501, -18711, 10869, -4204, 4994, 1722, - 8569, 3670, 4386, -16874, 8876, -2297, -2743, -4562, - -9207, 8033, -346, -3586, -9451, 3242, 1552, 4278, - -6787, 7118, 3630, 4602, -7371, -12789, -10424, -14922, - -3010, 1885, 4144, -4490, 4074, 7796, -1201, -7244, - 2675, 1221, -7060, -12828, -3520, 1983, -4615, 8207, - 1606, 517, 3646, -7252, 816, -3690, -674, 13100, --16254, 4727, -8184, -968, -5366, -2288, -20260, 1174, --19384, -4199, -5292, 582, -13118, 1836, 1698, -2034, --14601, 6642, -10530, 482, -851, 9968, 7050, -13366, - -8354, 4740, -20050, -193, -1881, -1205, -4042, 7067, - 12872, 5846, -4792, -1833, 2504, -3222, -1607, 2634, - 4587, 6761, 1549, 1124, 9427, 3978, -8305, 7524, - 2507, -5744, 3238, 5238, -3664, 694, -28496, -1674 -}, - -.cb1108s1 = { --10979, 8698, -630, 4660, 3060, -7292, 10140, 11942, - 1448, -5820, -3144, 3100, 10575, 6888, 3505, 9996, - 2787, -484, 8057, 1503, 6329, 3074, 3954, 9419, - -736, 2333, -1858, 3264, -4026, 16130, -14501, -5284, - -472, 850, -7258, 1542, 1473, -2348, -7055, -9574, - -2275, -4383, 7542, -360, -2945, -3878, 28, 809, - 600, 2246, 587, -1779, -3456, -737, 3242, -2523, - -1862, 6127, 899, 1070, -15614, 10990, -3084, 9546, - 7339, 8899, -1490, -10379, -9193, -3857, 8289, 7261, - 12489, 7814, -6458, 1223, 15486, -10960, -1880, 4922, - -7819, -527, -2370, 3687, 1358, 10367, -14266, -1496, - 1060, -9325, -5582, -3947, -17536, 1470, 4878, 10793, - 2904, -2566, -4995, 6549, 6141, 11048, 3177, -494, - 9087, 797, -2575, -5616, 1197, 2966, -11287, 4658, - -504, 4571, 1814, 18830, 26254, 2399, 8750, 2656, - 8206, -12987, -9119, -1027, -457, 1228, 6137, 2322, - 1732, -5694, -892, -249, -178, -7009, -4368, 402, - -5564, -5183, 2470, -4745, 2788, -3255, -5181, -706, - 40, -4915, 8926, -3633, -2455, 15054, 5376, -867, - -7270, -979, 7053, -7433, 13749, 5039, -2234, 8474, - 7031, -3917, 5127, -7602, 580, 12067, 2252, 149, - 86, -582, -5729, 2193, 4178, -9195, -11824, 3897, - 1298, -1044, 6450, 1885, -19562, 6205, -4610, -2544, - 5192, -4885, 5021, -2373, -102, 7358, -2434, -3512, - -4048, 3070, 45, -1344, 202, -2189, 448, 1172, - 2939, -547, 1003, -6370, 3643, -1157, 3932, -6044, --12882, 1959, -1574, 2574, 14854, -16317, -6627, 505, - 1102, -9361, -8087, 7525, -1466, 284, 3756, -383, - 5147, 5060, -474, 531, -6144, -1872, -1206, 527, - -4861, -12410, 7508, -7226, 5046, -12233, -4153, 4628, --14402, -5265, 534, 1528, -13408, -62, -18757, -1280, - -9301, -10254, -8990, -6335, -7724, -3394, 1951, -13271, - -1389, -5274, -4616, -9643, -10295, 1332, -5618, -10737, - -7536, -9314, -7006, -760, 7694, 2955, -404, -2800, - 15250, -3828, 5994, 5408, 8411, 16568, -7280, -6901, - -222, -1554, -862, -1871, 939, -3678, -4348, -3200, - 3220, 1614, 8598, 8162, 1749, -7378, -1658, 931, - 3870, 9183, 1509, -5068, -17, 5733, -8121, 2769, - -3195, -3296, 8940, 2828, -2470, -2448, 7413, -2851, - -1058, -4505, -9653, -5074, 73, -3286, -4014, -1760, - 2562, 13690, -3464, 5438, -3394, 16997, -2944, 291, - 4224, 1175, -2237, -6894, -5479, -1291, 3390, 5455, - 898, 3461, -7914, -4785, 1879, 1059, -3721, -5796, - 5054, -3931, 6315, -2460, 1909, 573, -3373, 3052, - -178, 986, 572, -5976, 5781, -4928, -10539, 580, --18727, 757, 1759, -4049, 2232, 1890, 4115, 699, - -2934, 4926, 2391, 10848, 5103, 4340, -1518, 2288, - 2283, 8886, -5131, -4429, -4384, -3265, 11933, 3993, - 11474, 3721, 1532, 976, 6112, 1954, -2360, -1783, - 2080, -6356, 2482, -4646, -1992, 1590, 1790, 3290, - -2312, -564, 508, -1688, -7522, -9263, 3059, 1883, - -3005, -1303, -9146, 10282, 1333, 4692, -2083, -15792, - 2208, 1128, -11574, -7149, -1126, -4995, 18963, -6262, - 5045, 2179, -822, -1249, 10092, -338, 5744, 1635, - 2535, 6114, -1339, -8337, -4370, 4288, 2468, 3051, - 12491, -9554, -4034, 522, -1085, 5852, -2759, 4918, --10717, -194, -11376, 3059, 12075, 1037, 5260, 816, - 5918, -1987, 7924, -6022, -10374, 11607, 25035, -11598, - 16894, 2458, -5461, -2039, 385, 6002, 7574, 1229, - -834, -1032, -7453, 2694, -1447, 3632, 4215, 3541, - 2936, -3294, 1001, -6451, -4595, -11682, 7880, 2261, - 3786, -2849, 2276, -826, 3742, 7586, -334, 2837, - -2331, -12849, 1170, -1150, -5253, -997, -8996, 8124, - 2234, 904, -2294, 3144, 7352, -5452, 1536, -8800, - 1886, -18282, -9787, -8066, -12066, 1536, 4460, -1345, - 1418, 7471, 13451, -7299, 5507, 6795, -184, 8905, - -2040, -4933, 4998, 7317, -6667, -5134, 9094, -8561, - -2534, 3422, 2278, 3118, 205, 5811, 2247, 5946, - 1078, -2105, -6946, 170, -1625, -4734, -1447, -4329, - -4553, -2230, -8738, -15289, 7311, 6665, 5047, 1984, - 11896, 13922, -10490, -9313, 1424, -2991, 1408, 335, - 8914, 3773, 8814, 7917, -4560, -114, -624, 8984, - -1598, -580, 3233, 590, -2172, -3162, -3985, 5394, - 13842, -11625, 73, 12826, -1204, 5119, 10304, -10006, - -2695, 1318, 156, 84, -760, -4638, -3804, 3041, - -782, -2994, -3113, 637, -3256, -5831, 452, -1204, - 1614, -11626, -4769, 10612, -8710, -20019, 10542, -4279, - 6912, -1429, 3812, 2844, 3903, -11622, -8954, 180, - 3898, 3858, 119, 1385, 4038, -5899, -969, -5454, - 13305, -6748, 5934, 8027, -7348, -3797, -29781, -4956, - 2037, -2331, -3292, 8254, 6597, 4446, -7848, 6250, - 1400, -1182, -4966, -3490, -1410, -2286, 3334, 350, - 9271, 2987, -934, -5702, -3881, -97, -671, 5108, - -133, 1302, 11630, -8858, -3027, -42, 3682, -1507, - 3992, 5641, 2778, -8698, -2509, -1360, 77, 2116, - 98, 2853, -6334, 5915, -1214, -2721, 8921, 1380, - -4158, -4315, -4740, -21049, 7044, 866, 2094, -9442, - 9003, -5147, -4897, 3407, -11558, 4280, 4508, 6697, - 1612, 1508, 8547, -14257, -151, -9530, -7250, 11321, --14430, -4944, -2488, 1349, -248, -1490, 1749, 3970, - -5830, 20767, 4642, 3236, 36, -17079, -11099, 5996, --10759, -39, 7822, -7527, -1431, 179, -3841, 2298, - 1407, -241, -2303, 9244, -3626, 6609, 1959, -518, - 368, 1678, -5334, -5849, -4986, -2363, 607, 2809, - -1006, -7695, 10022, 2216, -8992, 4282, 807, 14707, - 9528, -11065, 3014, 3157, 5597, 1139, -1298, -3642, - 7839, 860, -4336, 2624, -4171, 1791, -2825, 5362, - -529, 1494, 337, -4487, -671, 5360, 3283, 4933, --14692, 4033, -4365, 2713, -6903, -1784, -10862, 6173, - 5278, 14859, -852, 10020, 12304, 8898, -3089, 9183, - 1841, 8276, 4929, -261, -1264, 615, 3615, 14535, - 6557, 519, 4228, 7382, -1805, -4529, 4992, 4277, - -342, -9610, -5193, -7022, -23264, 2402, -740, 2875, - -5052, 1983, 4987, 3336, -3806, 1335, -2868, 846, - 7652, 936, 3510, -4570, -3010, -8805, 6177, -4413, - 5879, -15204, -1632, 13416, -4543, 3838, -9293, 1744, - 920, 15544, 3820, -5852, 3935, 2357, -6486, 1932, - 12044, -6374, -2545, -2389, 2755, -8073, -8203, 4659, - 4286, 16128, -987, 434, -4495, -4428, -4816, -10329, - -4529, -13408, -13283, -1136, 4002, -1271, 3547, -5274, - -5577, 701, -365, -2764, 370, -369, 2611, -832, - 3862, 4604, -7786, 11170, -1453, -1568, 10758, 168, - 402, -1985, 1436, -8858, 10080, -8559, 3998, -4310, --13478, -3104, -11458, 506, -18194, -3724, -6768, 7960, - -4213, 1121, -1658, -1141, -1874, -383, -5090, 748, - -1032, -1207, 1046, -1865, -2387, 2126, -3672, 6733, - -2794, 3797, 15562, -11989, 170, 6129, 658, 929, - 4800, -4296, -955, -2189, -188, 3180, -118, -766, - -2182, -6928, -2254, 6615, -4422, 6324, -31, 3742, - -5832, -5022, 4671, 1574, -6309, 288, -2768, -2492, - -4818, -5192, -248, -3236, -429, 120, 1182, -10486, - -2964, -3713, -5978, 11817, -20052, -6525, 2054, -879, - -602, -2843, 7244, -1372, 417, -172, 3322, -6556, - -7021, 5842, 7357, -2799, 3660, 7579, 4682, -2242, - 73, -9247, 21061, -2060, -3614, 2486, 4793, -2959, - -510, -74, -5982, 2274, -4147, 3260, 1994, -1678, - -7494, -13624, 2560, -7375, -896, -4945, -2838, -11096, - -1969, 5879, 444, -3220, 14630, 4915, -2376, -8475, - 9854, 11380, 11060, 1534, -14413, 4366, -9544, -10646, - -7654, -17916, 3481, -3240, 1776, -2436, -8403, 3679, - -1914, 12537, -5540, -5294, 5995, 5968, -2609, -16882, - 789, -9506, -10075, -12142, -7580, -7090, -2046, 11065, - 7617, -3503, -2013, 3516, 6347, -195, -3119, 2444, - 14, -4998, 767, 4976, -3974, 9038, 579, 1804, - -8206, 32767, -5633, 1018, 13388, 996, -12737, -3179, - -2058, 13663, 1274, -4475, 7386, -1698, 17927, -6118, - 15942, -2922, -3434, 5903, 6333, -9149, 14140, -1488, - 2999, 1151, 2361, -1935, -10243, -11566, -5319, 965, - 5146, 3652, -441, -2173, -3484, 3685, -13595, -1703, - -78, -1408, 18517, -3788, -3266, 3162, 996, 19950, - -8560, 4989, 6593, -5329, 2950, -13896, -3524, 5590, - 4055, 6084, 2493, 12659, -5786, 4858, 7252, -7111, - -7318, 5411, 7393, -8714, -3454, -1562, 1919, -49, - -680, 7285, -398, -2956, 7100, 5563, -538, 1719, - -16, -3824, 437, -6842, 1504, 5694, 1214, 3209, --15562, -4365, 9329, -25577, 1425, -2598, -8389, -6891, - -3275, 3304, -3993, -6391, -934, 7862, 4844, -134, - 9890, -4646, 2468, -9901, -4111, -3080, -5056, 476, --13099, 1447, 205, -2424, 7098, -12075, -4646, -13725, - 8367, -2910, -8461, 1387, 3553, -10228, -2771, 4698, - -6483, 12234, -8086, 3329, 2374, 452, -1805, 5083, - 2014, 164, 7143, 81, 6062, 2838, 5318, -4982, - 1440, 2014, -3273, -6658, -798, -3204, 1398, -599, - -5834, 2070, 4644, -17238, 390, -1684, -4932, 8961, --12217, -3079, 6574, 1387, -5991, -7803, 1285, 7439, - -395, -3048, 2038, -847, -690, -5127, 2228, -4180, - -3499, 530, -584, 9884, -323, 446, -15644, -9162, - -1683, 3643, -3578, 2634, 496, 8097, 109, 1056, - 1422, 5452, 6517, -449, -2389, 302, 6827, 1507, - -3106, -7188, -4909, -441, 12955, -3933, -5322, 5155, --23171, -2780, -2655, -4048, 12844, -3709, 6555, -5700, - 3780, -6566, -4415, 11091, 11291, 6443, 9146, -796, - -1420, 5600, 12098, -5790, 6619, -10474, -12177, -5890, - 21700, 11148, 3427, 3130, -5727, 14646, 13953, -2721, - 1404, -3102, -4693, 4762, 1757, 2533, 3998, -530, - -758, 5301, -1426, 8948, -720, 6877, -3863, 2396, - 5266, -685, 890, -7188, 2742, -270, 8125, -804, - 32292, 6964, 8599, -3466, -1080, -8423, 2070, -295, - -157, -5432, 152, 2478, -3738, 1104, 1500, -5290, - -2463, -6386, -2537, -2331, -3290, -2398, 159, 6588, - -2547, -2424, -2184, 8316, 5670, -5608, -2600, 2659, - 166, 14828, 2622, -10490, -16378, 64, 434, 4576, - -3010, 2479, -6798, 3431, 360, -1067, 3421, 664, - 4029, -4050, -240, 3875, 672, 3587, 501, 2494, - -48, 9997, 3259, 8551, -7624, 17342, 10765, 4328, - -3721, 1729, -2844, -6330, 5114, 15589, -261, -7554, - 2708, 7260, 5852, -8736, 436, -6160, -588, -5919, - 5752, 3127, -4558, 540, 74, -4048, 3735, 7873, - -2869, -544, -111, 5182, 1032, 2315, -159, 5105, - 4106, -494, 678, -4756, -3865, -7389, -2492, 7193, - 5146, -7926, 12043, 11137, 1719, 2307, -5476, 12679, - 7996, 726, 933, 3222, 7515, 678, -5858, -2716, - 1503, -3014, -2125, 4982, -4984, 467, 986, 5450, - -1472, 5314, -1285, 218, -3411, 4511, 8047, 4268, - -8307, -10587, 17200, 3303, 7553, 5361, 1108, -7982, - 8240, -5856, -3376, -3952, -2884, 4401, -7252, 4078, - 7538, 3420, -13834, -1139, 10742, -2536, 636, 7758, - 4282, -3505, 1190, -7382, -8164, 5306, -408, -5005, - 2776, 7806, 4781, -7903, -2370, 13884, 542, 5643, - 6948, 6471, 2699, 815, 4454, 1882, 2290, -3856, - -3086, 8215, 3234, 4444, -1580, 2835, -3083, 6706, - 7409, 4626, 2658, 2308, 7965, -1034, -2584, 344, - 704, 12280, 10344, -8032, -4410, -6168, 6860, 7977, - -5630, -6680, -5001, -6199, -10378, -1764, -3322, -4284, - -1048, 2721, -11738, -11800, -7975, 2754, 3424, -7641, - -2245, -4945, -194, -1948, -2850, 4111, -21846, -8750, - 4306, 24494, 10428, 26998, 4976, -2701, -3283, -723, - -1539, 6758, -9730, -3517, 6401, -4546, -410, -9900, - -4947, 6996, 10983, 5110, 19948, -78, -1794, 11051, - -14, 316, 6447, -20430, 9363, 9062, -2134, 13711, - 6448, 6655, -5232, 4610, -10352, -3042, -8713, 5777, - -2438, -2602, -7293, -755, 6736, 2960, -3676, -2882, - -9806, 1342, 1242, 2122, 2749, 631, 6502, 2266, --12996, 13620, 19762, 8096, 702, -4394, -8668, -1460, - -3228, -173, -6239, 4643, -1916, 4098, -2234, 1202, - 1763, 6170, -6320, 12984, -5936, 8301, 6021, 2191, - 466, -4044, -1913, -3458, 8197, -3249, -5935, 2383, - -4241, 4977, -4415, 704, 3488, -8356, 10229, 562, - 14, -4828, -3890, -7599, -4208, -3166, 1132, -16584, - -506, 1397, 6266, 3307, 5782, 2349, 3257, -3017, - 7814, 1216, 7440, -10096, 12698, 944, 1221, -1683, - 152, 6020, -7910, 3897, -6954, -9439, -9838, -3860, - -5383, -4228, -1980, -4045, 7442, -5504, 2145, 636, - 2857, -4538, -820, 4275, -2104, 5076, 5191, -363, --23254, 1962, -66, 7550, 88, 8721, -1361, 7733, - -2661, 5282, -5112, -24, -975, -3200, -2235, 5144, - 213, -6340, -3974, 1266, -2383, 2432, -124, -233, - -3504, 10604, 806, -918, 11601, 19332, 206, 7456, - -8885, -9692, 3087, 3685, -2183, -7538, 11970, -5098, - -7364, -1173, -3099, 6532, -6850, 4622, -828, 390, - 467, -5364, 4442, -1878, 8949, -4340, -261, -2720, - 6659, 16184, -6552, -3736, -15416, 15774, -306, -4240, - -1807, -10304, 11073, 2743, 3974, -5557, -3499, 5315, --10742, -378, -4517, -5949, -7664, -2830, -6510, -6096, - 2052, 3425, 1971, -3328, 5326, -1362, 1806, -14286, --12774, 6058, -3365, -735, -2586, -18658, 6664, 9502, - -1590, 323, 6445, -17766, 14694, -9786, 3696, -4547, - 1601, 3645, -584, 910, 2516, 8197, 3898, 4306, - 631, -2020, 4309, -765, -6591, 2083, 8969, -1474, - -27, 9130, -5808, 8492, -135, 2230, 2296, -4509, - 4600, 4951, 1930, -2564, -5889, -1338, -11737, 6387, - -3649, -5447, -2462, -4751, -1012, 3523, -3504, -9510 -}, - -.cb1108m0 = { - -2417, 4623, 2916, -4257, 120, -10323, 1198, -10252, - -117, 8767, 3160, 2323, 1162, -650, 2237, -4171, - 2386, 432, 1627, -7255, 38, 124, -3658, -1558, --11711, 10, 8146, 1700, -1975, -16731, 2397, 1056, - -2502, -2660, -2731, -2477, 1488, 1220, 4880, -1156, - 1805, -3, -3009, -6233, -2216, 3440, -3082, 2124, - 70, -2461, 1125, 1919, 11949, -2506, -622, 2209, - -702, 2685, 9183, -510, -2806, -1129, -1823, -1746, - -3600, 2298, -3360, 10793, -1714, 1662, -62, 395, - 14142, -261, -144, -9896, 11481, -884, -2197, 352, - -326, -453, -1984, 2027, -1466, 3290, 94, 3481, - 2533, 4401, 5492, 3803, 247, -896, -1688, -3166, - 1130, -1125, -1973, 322, 867, -1936, 714, -880, - 8, 2313, 23418, -1682, -677, 384, -2140, -386, - 920, -2523, -495, -1494, 3027, -707, 1172, -1403, - 2177, -2137, -885, -1035, -1637, 375, 2452, -3709, - -1171, 2069, 1095, -1937, -686, -956, 2034, 3410, - -3075, -359, -598, -2084, 18550, 1781, -45, 1400, - -1580, -13180, -609, -1376, -3145, -248, 5661, 6886, - -3915, -194, 9876, 1065, 3879, -1726, -837, -660, - -7467, -3055, 3516, 283, -1604, -625, 1165, 3023, - -1531, -1825, 1430, -561, -881, 1346, -129, -1817, - 851, -32768, -294, -188, -116, -646, 1176, 630, - 903, 417, -2487, 352, -789, 571, -127, -2054, - -2112, 418, 1631, 266, -270, 362, -2765, -1198, - -182, 3586, -1272, 1470, -66, -18384, -1230, 823, - 1171, 1350, 1101, 1410, -3730, 1535, -101, -3234, - 2315, -34, -458, 1361, -16497, -990, 1438, 2542, - -1193, 586, -1708, 2689, 2741, 6010, 4209, -5974, - -628, 1556, 2238, 6134, -3040, -2937, 2188, -1660, - 1137, 1316, -2650, 905, -502, -93, -1177, -31964, - -1170, 1504, -1284, -104, 168, 55, 3478, -161, - 2818, -484, -32, -1536, 1218, -854, -351, 4465, - 16922, 681, 4198, 419, -414, 6824, -3906, 11598, - 75, 4904, 1374, 64, -2692, -3759, 3065, -1397, - -202, -347, -2466, 96, 1035, -765, -258, 3711, - 1437, -18250, 566, 976, 2483, 4, -1096, 1906, - 3745, -2621, -2756, 1864, -560, 98, 821, -4094, - 5349, 1369, -5245, -2170, 2932, -1052, 3932, -413, - -400, 31206, 1125, 1631, 43, -764, 1666, 780, - 2036, -564, 64, 1311, -202, 843, -2030, 856, - 1766, -3163, -1158, -626, 316, 127, 1783, 1918, - 3384, -2887, -5885, 1763, 4910, -248, 17100, -3022, - -1880, -2927, -1287, -3308, -1767, -2622, -1460, -250, - 3597, -4526, 946, -1533, 1059, -8, -807, -1283, - 1436, -11184, 643, 398, -1565, 1983, -60, -9862, - 1219, 322, 3132, -2043, 1138, 6258, -3540, 790, - -923, -4692, -1401, 2733, -8918, 4905, 6181, 192, - 82, -1094, 4, -634, -1323, -2865, 1036, 1484, - -2461, -937, 414, 221, 2179, -438, 1273, -2690, - 18442, 2781, 1788, 2264, -1230, 4284, -4708, 1190, - -4810, -975, 230, -3728, 2504, 3602, 3488, 88, - 1322, 487, 2965, -3731, -2341, 5937, 8545, 1716, - 7308, 9017, 6426, 727, 3992, -4584, 388, 3714, - 1164, 18, 445, 1253, 398, -1989, -824, -430, - 745, -5447, 2176, -1986, -3963, 2861, 194, 17739, - 1891, -5368, 4172, 125, 530, -2766, 1179, 401, - 1759, -1609, 31234, 910, 1100, 1036, -948, -1101, - -614, 1768, -344, 840, -696, -842, 320, -1444, - -2560, -3199, 58, -2172, 1375, -3002, -821, -863, --12096, -2484, -677, -2130, 4450, 3568, -3192, -1114, - -3218, 3121, -503, 5570, -561, 3896, 10566, -3065, - -2768, 1398, 1719, -2708, 1952, -142, 4777, -978, - 2238, -5780, -430, 1228, -1298, -2923, 4353, -1621, - -2368, -2908, -8012, 4398, -502, 518, -6964, 622, - -377, 3758, 6598, 4438, 6849, -7696, 470, 3585, - 466, -14664, 3438, 14706, -1944, -2544, -785, 3653, - 1274, 443, -694, 1968, -3499, 2855, -3930, -1210, - -528, 1931, 3849, -772, -2659, 4499, -3624, -540, - -1645, -949, -382, 979, 595, 165, 429, -80, --20468, 1040, 544, 2545, -5010, -2122, -2840, -335, - -405, 404, -50, -2996, 1226, 519, -1046, 3745, - -2317, 6211, -14500, 9754, -5802, 5230, -3112, 1506, - 3741, 664, -902, 197, 2476, -3618, 2040, -1066, - 2338, -257, -2580, -293, 2740, -576, 2050, -865, - -3666, -2090, -1831, -32056, 658, 1549, 1602, 1728, - -534, 390, -1517, -627, -4025, -797, -2351, 2759, - -102, 2574, -56, 796, -232, -886, 1639, -2773, - 1007, 830, 5880, -2220, 762, -3834, -2865, -415, - 584, -3498, -4546, -16108, 344, -4072, 551, -5435, - 2007, -1418, 3838, -1662, 1981, 3545, 1424, 769, - 2135, 1705, -15076, -636, 283, 3386, 97, -1048, - -3933, 204, -8616, -556, -2936, 4241, 5100, 1777, - 98, 719, 6202, -1496, 708, 2160, -2396, 4060, - 1513, 2253, -46, -1823, -132, 709, -756, -944, - 575, 1070, -1583, 587, -24575, -1989, 874, -568, - 1040, 1116, -4002, 3196, 2826, 117, 1590, 2456, - 938, 112, -938, -1268, 5056, -2851, 2995, 2559, --13121, -8374, 3593, -6684, 3663, 766, 747, 1016, - -921, 2241, -1942, 4269, -3312, -1012, 2340, 2781, - -3881, 2532, -1976, -1436, -3219, 420, 22088, -742, - -640, 3270, 1446, 1935, 1279, 1913, 1377, -3297, - -751, 4209, -1052, 2381, 2938, -1330, 2154, 2784, - -2420, 1270, 2334, -526, 1480, -435, 2206, 252, - -510, -1018, -1469, -1294, -950, 424, 1058, -2317, - -846, -20737, -1877, 88, -431, -1268, 116, -378, - -2326, 3115, -246, 30, -4725, 648, 2084, 14286, - -817, 2496, -1947, -4869, -9703, 1505, -2476, -2108, - 747, -449, 3002, -5464, -514, 1805, 2559, 2494, - 12782, -1232, 12091, 2118, 3996, 2592, 1058, 510, - -1384, -3050, 2533, -408, 5219, 3044, 3242, -185, - 2654, -3723, 16, -1723, 1823, 6144, -4806, 182, - 1772, 4841, 16390, -96, 2505, -7713, -5244, -3316, - -6776, 1448, -1470, 4238, 294, 889, -2372, -6281, - -2423, 5423, 2119, 2897, 1378, 817, -993, -1599, --14662, 3014, -3397, -6182, -245, 4897, 5116, 2285, - -2863, 1174, 415, -6777, 3863, -6009, -4722, -119, - 606, -2247, 4447, 1064, -1935, 2705, -2629, -1144, --11980, 3805, 882, 1634, 5446, -4300, 643, 3436, - 7632, 592, 998, 674, -2647, 4644, -6854, 1368, - -146, -3395, 10599, 1369, 3852, 1689, 2437, -3937, - 3405, 2517, 1895, -14092, -1142, 2570, 10163, 1608, - -2445, 850, -1678, 3112, -3465, 3138, 4413, -1973, - -4151, 1163, 1822, -3819, -1568, -407, -2642, 424, - 365, -3599, 164, -1448, 1062, 1536, 1590, -1982, - 200, 18572, -230, -638, -1253, 1650, 2280, 4945, - 4527, -2353, -4216, 3752, -3807, 3686, -4816, 2382, --14833, 1306, 17246, -739, 2012, 3521, 1473, -1436, - 1514, -142, -461, 1038, 2462, 971, 1354, 1272, - 1787, 2420, -922, 3364, 2250, 497, 1349, 2795, --32768, 425, 1874, -72, 2461, 389, -306, -1180, - -646, 251, 299, -2735, 577, 1055, 1826, 1620, - -1214, 1422, -901, -1273, -2367, -1241, 366, 521, - -433, 55, 4000, 3035, -1390, 2505, 1786, -15397, - 413, -5916, -234, 3559, -6776, -5068, 2251, 36, - -180, 596, 5744, -2450, -1276, -4786, -1872, 24, - 252, 464, 2833, -136, -25600, -33, 873, 2646, - 1471, -1336, -1330, -276, 1778, -242, -951, 1580, - -79, -858, -927, -4310, -604, 7568, -1713, -948, - 192, -260, -1334, -1116, -705, 638, 132, 1186, - -952, 1157, 428, 2039, 1568, 1778, 22453, -2190, - 2176, 1674, -3996, 1294, 1162, 274, 415, -2877, - 464, 505, -1842, -1066, -2241, -761, -291, 8, - -987, -104, 796, -32768, 1302, -809, 571, 1214, - 455, 686, 656, -1752, 886, -790, 644, -1114, - 2358, 11452, -4398, 1334, 13095, 3230, -1818, 4053, - -1990, -1093, 878, 3796, 2712, -1523, -1229, 1077, - 960, 1250, -75, -3233, -7734, 2783, 8430, -327, - -1428, -1687, -4092, 269, 3161, -569, -1267, 1774, - 2772, -2033, 171, -520, 1551, 3719, -3364, -220, - 1904, -1282, -2008, -818, 4261, -886, -19201, -3454, - -478, -2645, -2601, -2124, -3977, 2960, 1563, -432, - -989, 2682, 1734, -9085, 4614, -4454, 2535, -7201, - -220, -10022, -431, -7907, 889, -9658, 6653, 762, - -1827, 5886, 862, -1836, -430, -16363, 5709, 851, - 1814, 304, 5045, 1685, -1004, 5108, -5936, -3143, - 940, 1832, -270, -674, 1441, -241, 3222, -551, - -434, -69, -3584, 349, -1354, -12080, 3639, 5219, - 7583, -1023, 2078, 3263, -5807, -873, 4085, -5153, - -3623, -436, -4717, -1803, -6274, -2049, -247, 2516, - 1922, 10204, 2194, -1574, -535, 656, 1638, -3091, - 1156, 1377, -1220, 4956, -221, 4984, -1154, 4603, - -1618, -5655, -2583, 13494, -2442, -3968, 3086, 1098, - -1625, -13781, -12826, 2659, 3604, -702, -1900, -3508, - -6283, 2320, 1979, -2823, -4890, -1728, 2, -4402, - -437, 1932, -3272, 2853, -3018, 840, -632, -6691, - -484, 9579, 1008, 11677, -2814, -2029, 8048, -1170, - -7366, -2664, 3349, 1319, -1160, -1864, 606, 1568, - 5428, -4763, -2470, 2145, 1798, -502, -1538, -3736, - -1376, 1330, -3567, -78, 478, -743, 890, -800, - -44, -1832, -1761, -1022, -996, -846, 1188, -1042, - -3202, -2439, 1602, 3601, 564, 18338, -17, 1327, - -387, -1998, -1260, 3352, 849, -4780, 1932, -56, - 2625, 10753, -1676, -10536, 2980, 1542, 1177, -3113, - -859, 522, 3092, 9588, 2882, -4540, -1406, -5183, - 50, -4245, 3649, -420, -3612, -5290, -1919, 14559, - -2605, 1169, -2009, 10760, -2372, 339, -2538, 4476, - 3001, -4570, -3158, -3465, 2873, 650, -2099, 76, - 1166, -1469, -2769, -391, 4215, -630, -1448, -1796, - -1573, 5914, 807, -1580, 2072, 99, 580, -2999, - 1079, -202, 17940, -1233, -4909, 1079, 390, -891, - 1834, -2155, -2642, -1703, 1856, -14125, 2081, 3178, - -2480, -4342, -11991, -2050, 1046, 2412, 436, 1046, - -2291, -1718, -3087, 1710, -963, -1914, -3423, 6190, - -1238, -4333, 115, -10550, -2742, -919, -4849, 1502, - -3054, -3304, 2300, -1850, 2337, -6643, 1995, -1279, - -238, 738, -124, 13593, 252, -1424, -165, 2786, - -1717, -838, -11244, -10971, -902, -3330, -2580, -2735, - -171, 4041, -2149, 2502, 6726, -738, -4235, 368, - 6144, -1718, -8620, -1888, 112, -282, -19, 4126, - 10797, 610, -3097, 7783, -2974, -2058, -3558, 470, - -5914, 10322, -20, 85, -1652, 6111, -1398, 2613, - 3733, -3716, 1930, -4325, -1199, -921, -446, 1095, - 1006, 910, -2323, -351, 808, -32768, 274, 1346, - 105, 2360, -1184, 2249, -970, 153, 3180, 1307, - 2207, -962, 2209, -921, 1504, -117, -2111, -3734, - 5738, 8014, 76, 1566, 3013, -462, -3600, 3939, - 4862, 1038, 4312, -790, -426, -1656, 20, -10568, - -6389, -6597, 4230, 2910, 2504, -2962, 256, 814, - -488, 824, -355, 3574, -1890, -2657, -767, 2730, - -1087, -2538, -3522, -4067, 6249, -3354, 13923, 4070, --11004, 4703, 909, -5968, -5483, -4242, -780, -2489 -}, - -.cb1108m1 = { - 752, -4098, 7726, 592, -9487, 2004, 318, -4322, - 6989, -3350, -478, -4308, 2023, 753, -7081, -3934, - -866, 6267, -5710, 2100, -8467, 100, -4654, -6773, - 4271, 10728, 11618, 1128, 12733, 1471, -5518, -1162, - -2159, -402, -632, -4720, -28, -1412, -1037, 897, - -1242, -1735, -2632, -3460, 3389, -582, 206, 325, - -2547, 46, 1340, -4424, -13408, -4918, -2832, 1454, - 2127, 1276, 2292, -3973, -3230, -7810, 542, 4227, - 2673, -8490, -902, 1361, -1398, -1986, -991, -680, - 602, -2887, -557, 2656, 3214, 1794, 31241, 1462, - -1457, -3750, -1923, -2381, 1313, -128, -172, -647, - -574, 1045, 2438, 1662, 503, 288, 1535, -1016, - 2487, -820, 4692, 2799, -31949, 166, -1655, -2192, - -636, 1357, -2361, -459, -1752, 2782, -293, -144, - 1900, 685, 1766, 1900, -347, -4488, 590, 915, - 798, 1133, -4494, -1388, 75, 884, 13088, -2392, - 679, -315, -7520, 1086, 3873, 3297, -812, -626, - -9443, 2548, -6417, 1619, 7196, -57, 5, 3594, - -1922, 184, 2784, -261, -3310, 2779, 174, 2814, - -965, -2912, -1835, 425, -4285, 896, 2001, 3717, - 775, -1192, 22365, -175, 1522, -711, -1135, 5123, - -517, 870, 4323, 585, -437, 260, -1737, -1984, - 2522, -2539, -973, -8812, -16173, 4678, -4107, 130, - -7832, 1140, 2792, 3394, -692, -4105, -299, 1488, - 1246, 604, 2796, -3767, 579, 188, -1544, 86, - 424, 1204, 4441, -1000, 15227, 3459, -3444, -1631, - -2177, 3497, 1684, 925, 2872, -3905, 5729, 647, - 913, -758, -547, 566, 1787, 792, -1509, -1641, - -926, -1515, -116, 1266, 481, -3944, 28526, -2279, - 5577, 1026, 4082, -605, 696, 1094, -478, 5732, - 7247, 1461, 1521, -234, -42, -878, 270, -554, - 3702, -71, 1362, 7719, 305, -13654, -4985, -1072, - -2044, 6851, 438, -8435, 923, -537, 1511, -1003, - 2056, -2299, -15578, 503, 1944, 3188, 2318, 1761, - 1290, -2322, -568, -1591, -2746, -1966, -9784, 1514, - -5596, 4070, -181, -3006, -1903, -240, -1143, 393, - -1530, -822, 520, 989, -1600, -3374, 946, 678, - 86, -1957, 1947, 1188, 356, 719, -2874, -2245, --19010, 547, 9067, 439, -2384, 847, -3307, -116, - -1114, -445, -3505, -967, -1252, 4880, 625, 1478, - -2970, -2275, 1337, 422, 3870, -1906, -1033, 1724, - -532, 1734, 1011, -21848, -477, -251, -615, 770, - 7520, 1030, -4372, -446, -3156, -2314, 172, 901, - 70, 1837, 1205, -1344, 2933, 1080, -1290, 1353, - 10205, 1158, 11135, 560, -3480, -2376, 7539, -5418, --14092, 2138, -253, -9344, -1907, 2177, 687, 2772, - -2730, -546, -4180, 2021, -577, 2530, -3822, -7080, - 971, 2083, -1220, 203, 3187, 3705, -752, -2591, - -704, -17469, -1168, -214, 2518, 308, -585, 1117, - -1893, 2488, 1856, -23, 2418, -2922, 1960, 235, - -1629, -8277, 1088, 2032, 874, 2763, -1867, 60, - 1684, 834, -2676, 1574, -3098, 3250, -3723, -126, - 59, -787, 2710, 930, 1384, 475, -3915, -1162, - 1640, -16818, 2356, -70, 761, 4151, -778, 523, - -183, 19374, -4223, -1379, -1667, -1690, -512, 8742, - -34, 3816, -678, 2749, 2418, -341, -1216, 4280, - -2208, -264, -2884, 4679, -821, 1824, -6724, -1528, --12042, -9908, 935, 4338, -116, 612, 6, -161, - 1935, 1600, -442, 4059, 2510, 2186, -7678, 3600, - -2460, -1072, -122, -1817, -246, 2786, 9079, 525, - -226, 2628, -2549, 1459, 4533, 1111, -17410, 4529, - -2545, -3272, 403, -2758, -1876, 2734, 2136, -6171, - -2055, 1163, -2820, 2992, 2978, 1458, 1572, 2508, - 13576, -1545, 14861, -796, -6444, 4022, -4358, -529, - 3439, -2630, -2457, 3030, -2972, -398, 471, 2547, - 1127, 1344, 202, 420, -1858, -589, 594, 1478, - 5590, 1682, -1560, -378, -2198, 400, 2231, 566, - -80, -2042, -4557, -2309, 8743, -4258, 1291, 11770, - 718, 2342, 2912, 5170, 2470, 6832, 833, 4990, - 2009, -1258, -898, -1414, 1214, 670, -2104, -5068, - 788, -18997, -743, -864, -356, 1592, -5786, 652, - 4952, -2319, -1097, 2177, -1654, 2879, -1645, -172, - -1581, -3062, -805, -1065, -2222, 20857, -1146, 864, - 1690, -1794, 855, 307, 2320, 3618, 6184, -4129, - 187, -2423, 4946, -3072, -213, -2621, -2026, -5793, - -986, -1597, 2125, 1474, 1766, 360, -4652, -1030, - 1546, -1085, -253, 1016, -96, -1608, -7017, -4855, - 1295, -271, 3751, 341, 19804, -2006, 2322, -2298, - 353, -2077, -764, 212, 150, -1140, 564, -614, - 268, -2023, -332, -699, -937, 1684, -1617, -22863, - 1202, -144, 62, 373, -598, 184, 987, 3721, - -611, 86, 3676, 362, -652, -214, -311, -694, - -1973, 2351, -733, -1601, -1189, 28227, -154, 10, - -347, 3400, 1333, -1695, -773, 1362, -447, -2999, - -626, -1776, 2474, 2195, -1041, -797, 1828, 62, - 3397, -1779, -2924, 1740, -1694, 4083, 15100, 3871, - -7821, -108, 292, 998, 3141, 5813, -918, -1290, - -902, 895, -1336, -50, 2014, -2066, 2383, 68, - 31769, -334, 1243, 1981, -715, 125, -380, -1272, - 1068, -357, -1734, -1138, -630, 1042, 688, -438, - -558, -2460, -2894, 4196, -1004, -2177, -2291, -4701, --13990, 747, -5558, -2754, 1950, -2780, 8414, -1286, - -946, 220, -2507, -192, 3726, -1361, 1296, -2215, - 872, 8270, -2797, -6732, 1256, -1957, -2916, 107, --14847, 1868, 4638, 1292, -1006, 5285, 2947, -5028, - 942, 153, 420, -1152, -391, 3612, 4621, 172, - 762, -876, -3561, -14406, -552, -2570, -4448, -15704, - -806, -928, 3380, -686, -2604, -3895, -714, -626, - -1763, 1144, 485, 34, -1922, 1528, -213, 5050, - -804, 185, 96, 3320, -621, -329, -1444, 864, - -1684, 16583, 1872, 3327, 2146, 1132, -8216, 73, - 6524, 1623, -4147, -4985, 1450, -646, -7189, 4524, - -1596, 2120, 3913, 680, 2094, 1660, 752, -1221, - 2414, 3986, -10314, 2096, 129, -5458, 634, -5426, - -594, -9731, 2083, -2284, -5085, -4777, -1323, -1740, - 6157, -841, -126, 247, -1163, -7005, 3863, -764, - -1552, 1356, 10788, -745, -12481, -73, 5234, -3220, - 2979, 635, 3372, -540, -36, 2887, 5221, 931, - -1724, -4824, 780, -49, 120, -739, 890, 714, - -1438, -458, -1861, -16732, -1858, -13282, 2182, -6796, - -3307, 556, -2968, 542, -2358, 1463, -3536, 1866, - 2833, -1369, -1576, -2825, 3561, -1625, 1858, -1052, - -1079, 1302, -2049, 19052, -1188, -4137, 1592, -4705, - 1082, -1168, 2355, 649, -1900, -2582, 1000, -3065, - -2399, 3625, 1062, 860, 2586, -2645, 14755, 3147, - 5002, -6720, 1728, -2114, 5090, -2838, 3020, -5048, - 4182, 2237, 706, -4945, -86, -1908, -1207, 135, - 675, -200, -22134, 1492, 2490, -1324, -1135, -842, - 1457, 185, 1342, 3516, -882, 1069, 1159, -52, - 1844, -1186, 554, 3860, 1824, -2136, -881, -1281, --13259, -705, -90, 2150, 573, 2787, 1068, -1968, - 121, 805, 4382, -1033, -9220, -744, -1446, 7180, - 257, -5983, -1643, -6198, 1854, -3524, 1060, -118, - 56, -843, 2832, -98, -3493, 368, 6, -1877, - -3615, -1954, 17971, 962, 1532, -1754, 3776, 661, - -2025, -60, -1013, -1222, -3062, -69, -4933, 3064, - -1176, 213, 477, 1081, 1679, -2328, 1984, -21759, - -881, -54, -1101, -1092, 598, 1648, -3384, -213, - 379, -1318, -1972, 630, -536, -1970, -461, -356, --22416, -1855, -113, 876, -2809, -587, -2323, -56, - 2177, -797, 1649, -4069, 1350, -2075, 101, -1384, - 1703, 1085, 471, 8093, 1020, -4112, 970, 866, - -1456, -341, 1418, -12938, 379, 9787, 1814, 2337, - -1705, 9913, 1026, 1962, -744, -2900, -1690, 1534, - -959, -629, 2330, 3735, 4742, -3139, -2135, 2298, - -2765, -1389, -3634, 27139, 671, 2208, 494, 1015, - -1197, -239, -321, -1145, -679, -637, -3116, 544, - -952, 882, 396, 1087, -3163, -2684, 759, -725, - -2186, -542, 2545, 3669, 24, 1689, 10473, 1836, - -419, 322, 2475, 1908, -1346, 50, -6401, -3644, - 552, 2348, 1327, 11853, 2467, 5493, 1544, 464, - 1796, -2801, 8217, 1014, -2103, 3764, 8091, 170, --12422, 1708, -2438, -1873, 1970, 2160, -5027, -647, - -118, 2830, 2379, -1091, -5723, 124, 3017, 417, - 55, 1376, -1079, 7122, 3086, 17847, 2468, 3273, - -599, 3302, -922, -2073, -1696, 805, 2022, -1899, - 3188, 1425, -4364, -140, -3760, 437, 1393, -1298, - 17166, -1283, -2904, -692, 518, -404, 944, -1990, - -968, 1323, 2376, -11708, 2187, 3164, -559, 2212, - 1598, -1741, 360, 633, 3075, -660, -1012, 778, - 565, -2020, -123, 5, -2217, -2967, 374, 272, - 336, -1725, -408, -2270, -2645, -1044, -517, 1911, - -386, -4439, -7603, -1000, 7660, 589, 14931, 2901, - 11998, -13102, -1919, 3904, 86, 1617, 7324, 3078, - 1714, 4636, -2504, -194, -3274, -710, 33, -1965, - -2298, 2513, 726, 75, 67, 884, 2104, 4110, - 1936, 10387, 2722, -1970, -12496, 4799, 3086, -2938, - 1719, -2138, -338, -1124, 971, -4200, 480, -3361, - 6220, 5954, 1830, 1001, 2996, 4166, -2854, -437, - -1430, 1072, -312, -12949, 3113, -2479, -2034, 6956, - 2805, 2128, 856, -8803, -4709, -1274, -120, 1252, - 3898, 6526, -3914, -2276, 2754, -2604, -3038, 4136, - 2598, -2172, 4861, -2457, 2, -2693, -808, 3527, - -1184, 392, -2202, 2406, 960, -1064, -2589, 1161, - 2418, 728, -466, -4865, 211, 14720, -2093, -1977, - 85, -12618, -2073, -3028, -1067, 1734, -2491, 9506, - -422, -2718, -2966, 3883, -2852, 336, 1306, -2297, - 2009, 2589, 3071, 192, -1239, -10553, 2, -1174, - -3036, 9939, -27, -1278, 1448, 18655, 761, 931, - 445, -94, 206, 448, -1865, 232, -4353, 4596, - -260, -976, 594, 648, 796, -1376, -1186, 3056, - 3171, -5675, 6179, -1287, 16934, -1478, 1090, 577, - 8075, 1119, 2943, -3208, 1852, 1986, 6003, 901, - -962, -3196, -1907, 392, -2605, 2796, 4082, -456, - -3109, -1219, 123, 2470, 174, -1254, -1350, -4919, - 1271, 12302, -1154, -6317, -3346, -1315, -144, 1214, - -49, 3491, -1029, -2043, -8373, 4197, 4971, 9808, - 9732, 700, 2247, -2755, -2034, 3260, 839, -10554, - 1661, 11484, -3180, -1909, 1089, -813, 3116, -2103, - -3726, -4514, 663, 1152, 3902, 4862, 2739, -3828, - 707, 2712, -8009, -832, -16492, -1472, -2422, -5593, - 322, -1894, 2810, 109, -1788, 2050, 3539, -3112, - -6178, 2487, 2102, -135, 3163, 2096, 4123, -310, - -1090, -2, -2662, -17087, 1373, 1448, 162, 527, - 655, -2248, -3530, 194, 1305, 7590, -5515, 1225, - 1607, -3816, 2185, -2679, -4486, -582, 4981, -1675, - 147, 14790, 119, 11771, -1228, 1012, -6133, -2247, - -3913, 1348, -1846, -513, -6386, -749, 6726, 745, - -809, -799, 3224, 43, -2230, 2598, 2994, -1590, --11198, -14476, -256, 695, 877, -3680, -2734, -1448, - 1336, -1633, 3327, 3497, 2956, -782, 2958, -1866, - 2876, 2003, -856, 1282, 5068, 391, -10539, 1703 -}, - -.cb1110l0 = { --14944, -14950, -73, -1141, 1532, -575, -620, -816, - 1185, -1597, -2651, 1426, -1458, 1317, -1320, -19, - -209, -352, -163, 912, -85, -180, -546, -1121, - -435, -345, 229, 364, -850, 632, -426, -359, --32768, 278, -1021, 310, -31, -355, -442, -234, - 415, -202, -10393, 1645, -378, -2270, 837, -1857, - 556, -935, -1344, 3016, 3452, 1597, 1378, 466, --13740, -878, 1475, 237, -1301, 9756, -592, 23, - -192, 335, -58, 285, 376, 40, 24, 292, - 426, -1962, -798, 745, 1379, -34, 397, -14748, - -6285, 7343, -6374, 4442, -14800, 1878, -24, 1606, - -728, -476, 1754, -1052, 911, 3139, -1444, -222, - -1968, 1858, 1330, 244, 213, 935, -92, -348, - 155, 418, 29128, 236, -190, -226, -309, -178, - -690, 46, 716, -534, 147, -630, -75, -826, - 37, 4745, -1056, 2400, 1398, 1494, 460, -221, - 2908, -656, -15611, -2940, 2342, -98, 581, -3144, - -471, 3772, 2057, 1583, 13738, -139, 330, 1175, - 429, 63, -14544, -374, 1439, -1226, -422, -690, - 816, 1279, -592, 1642, 700, 1338, 0, -714, - 46, 377, -188, -366, -197, -637, -622, -262, - -69, -637, -1266, 257, 620, -1040, 324, -19064, - -602, -463, -1329, 513, 2699, -421, -1918, 2250, - -404, 403, -1514, 134, 147, 3, 426, 605, - 276, 561, -26, -294, 630, -500, -480, -133, - -712, -1144, 238, -633, 173, -29164, -1182, -274, - -138, -271, -232, 30, 706, -168, -848, 704, - -2132, -248, -108, 669, 1165, 234, 1243, -12201, - 2208, -1971, -829, 10305, -3964, -1502, -409, -3918, - 4520, -2259, -797, 2235, -5560, -1710, -2472, 280, - -1747, -980, -4529, -5208, -1813, 330, 890, -6220, - -710, -5583, -4704, -913, 2920, -12484, -4340, 334, - -1303, 283, -740, -1261, 3556, 3210, -11640, -14438, - -2557, -795, 747, 546, -2488, 1891, 485, 725, - 338, 1579, 2092, 2354, 284, 2812, 490, 1442, - 187, -2699, 1196, -1783, 1228, 2364, 13364, 258, - 2102, -6163, -200, -5475, 2804, -576, 6878, -2852, - 2246, 1186, 584, -136, 5258, 3825, 3045, -1661, - -5246, 2548, -5054, -4383, -1542, 12912, -1580, 1268, - -1415, -2012, 1021, -2106, 979, 2390, 3411, -1076, - -439, 5416, 1333, 440, 3422, -13384, 2540, 2544, - -3668, -2308, 1042, 589, 4166, 5090, 1539, -3447, - 7003, -4396, 319, -590, 481, -471, 22260, -1936, - -297, 1302, 1163, 937, -164, 847, 768, 827, - -430, 792, 472, -1557, 712, -602, -1007, -278, - -974, -3198, 10560, -2124, 335, -1206, 629, -13712, - 12, -1673, -691, -666, -2890, 826, 1792, -1547, - -2016, 807, 1810, 841, -814, 1214, 760, -1056, - 404, -94, 144, 297, -584, 106, 116, -132, - 236, -507, 86, 853, -670, 413, 32767, 730, - 10835, -502, 1297, -3857, -1035, -1602, -164, -1721, - 1468, 507, 1064, 1478, 4323, -760, -882, -4331, - 2564, -10933, 3000, 2101, -2492, -72, 12636, 2743, - -1113, -8334, 6720, 2348, 491, -23, -1065, 1506, - 2090, -1731, -1997, 675, 425, 8165, 695, 2285, - -433, 515, -465, -347, -1006, 357, -55, 57, - 481, -31494, -816, 60, 76, -439, -328, -217, - 265, 123, 839, 218, 1355, 243, -878, -12819, - 5168, 318, 1376, -2931, 12689, -83, -220, 2848, - -770, 150, 1631, 1955, 1552, -1371, -3053, 1752, - -7250, -24, -514, -5568, -1529, -112, 419, -1136, - -672, -1847, -1136, 90, 453, 4810, 13012, -2355, - -2477, 1393, 451, 3390, 12, -2228, 1840, -2543, - -2404, -2969, 186, -444, 204, -265, -11467, 2204, - 1821, 3591, 67, 8821, 4015, -183, -5902, -1468, - 11394, 3062, -128, -476, 2495, -2888, 13482, 686, - -1320, 371, -884, 1829, -1810, 337, -1124, -1442, - 432, 1950, -1203, 663, -10445, 2310, 766, 137, - 4418, 2821, 135, 116, -12164, -3592, 686, 2310, - 1229, 1930, -1756, -1309, 1439, -3741, -305, 1547, - -9940, 3198, 1333, 2403, -2847, -3892, -259, -1766, - 881, 14310, -1711, -840, 2259, 3027, -1527, 1156, - 2904, -75, -728, 1536, -127, 152, -3240, -726, --11914, 1037, -851, -1893, -748, -3294, -1114, 6072, - 103, -1539, 4573, -1637, 5242, 2705, -9890, 254, - -1565, -407, 1818, -23004, 1110, 119, 256, -707, - -451, -679, 374, -935, -669, 403, -10, -594, - -525, 1403, -1016, -553, 595, -169, 2523, -82, - 947, 11572, -1166, 11668, -4962, 842, -860, 89, - -3308, -640, 558, -851, 622, -1002, -4933, 2762, - 1991, -121, 1401, -111, -49, 868, 135, -1392, - -279, -560, 412, -241, 1414, -802, -1256, -298, - 447, 17738, -320, -1150, 1650, -398, 5626, 6076, - -8919, 455, 12716, -2094, 157, 1361, -1515, 1494, - -6210, -553, -1785, -424, -3049, -4066, -1188, -732, - 1992, -1926, 1495, 1085, -22434, 1187, 391, -1512, - 747, -313, -502, 1331, 456, -323, 246, -581, - 56, 1448, 2071, 535, 782, 520, -136, -290, --12350, -11858, -456, 2340, -310, 22, 2210, -2531, - -392, -898, 3919, 1354, -332, -4255, 169, 425, - -476, 2577, -1172, 1984, 266, 514, -516, 2481, - 81, 2103, -710, 273, 1405, -14811, 5858, 3621, - -982, 345, 2044, 158, -2050, -602, 954, 342, - 239, 157, -317, -35, -260, 307, -31972, 228, - -77, 225, -154, 643, -883, -518, 32, 372, - 208, -22488, -458, 530, 104, 254, -775, -1264, - -571, 900, -263, -323, -296, 962, 520, 548, - -2196, 42, 1408, -211, -16117, 2052, 12656, -822, - 507, 321, -772, -786, -144, -3539, 892, -3430, - 19, -1831, 1161, 1836, 988, -1134, -704, -2994, - 692, 765, 457, 1624, 502, 13, 364, 337, - 32108, 1517, -225, 189, 141, 985, -572, 262, - -146, 31, 236, 269, -278, -1686, -13968, 1247, - -1009, 1046, 13467, 1276, -268, 307, -1383, 1544, - 136, 949, 70, 446, 1391, -2188, 745, -374, --14231, -712, -15202, -533, -108, -2244, -1232, 450, - -895, 1086, -782, -1082, -718, -660, 796, -2095, - 2722, -468, -1717, 147, -23566, 377, -220, -1731, - -1416, 486, -241, 266, -802, -322, 1066, -544, - -167, 520, -1297, -100, 622, 670, -188, 711, - 32, 1155, 628, 350, -112, -154, -1048, -44, - 36, -454, 304, 32767, 356, 462, -1194, 549, - 138, 0, 1044, -119, 195, 1098, 521, 3294, - -3776, -224, 4297, -1256, -303, 2107, 300, -13283, - 2933, -3194, -1408, -4152, 4195, 287, -932, 1247, - 13453, 277, 418, -598, 87, 1132, -80, -405, --13400, 656, -1310, -1447, -3974, 1719, 313, 500, - 1078, -114, 1449, -293, -120, -4754, 5583, 235, - -5140, -865, -484, 15572, 336, -1854, -154, -454, - -1475, -726, -3718, -4048, 1575, 480, 1094, -2209, - -3202, 420, -564, -48, 964, -2667, 2172, -1666, - 112, -730, 203, 3618, -15857, -4853, 48, -1084, - 1512, -937, 3353, -453, 223, 2267, 139, 190, - 1959, -720, 4389, 681, 10383, -112, 12390, -882, - 1695, 3539, -169, 3131, -122, 3627, 252, 185, - -523, 112, -219, 214, -182, -102, 118, 230, - -60, -801, -25, 42, -279, 262, -32358, 344, - -542, 382, -223, -404, 1201, -2646, -163, -803, - 3041, -1009, 3818, 756, 5834, 14249, -1828, 139, - -218, -658, -1314, -4980, -3322, -1461, -1598, -91, - 2464, -954, -5203, -791, 1339, -13598, 594, 702, - -388, -1115, -2377, -370, -3658, -3322, 1871, 2513, - 2910, 4095, -2195, 4291, 886, -567, 1182, -302, - -672, -21, -268, -29244, -199, -1024, -1284, 485, - 1432, -1086, 119, 1030, 418, -643, -1165, 1847, - -30, -844, -909, -416, -604, -609, -289, -391, - -238, -94, -391, -810, 413, 356, 954, -1935, - 30996, 441, 138, 1381, 1130, -2313, 558, -203, - -248, -951, 408, 1815, 256, -429, -892, -695, - 1138, 439, -760, -63, 6498, 570, 15252, -3397, - 170, 935, 338, 1, -528, 524, -541, -281, - -3, 499, -333, 685, 436, 32176, 389, -153, - 572, 256, 53, 16, -902, 724, 2849, 2503, - 80, 667, -1867, 742, 15205, -8715, -2588, -476, - -450, -733, -891, 1178, -1751, -1630, -114, 144, - -138, 10145, -188, -1608, -131, -247, -544, 9774, - -610, -2868, -3472, 345, -9294, 3724, 2634, -5124, - -392, 2551, -649, 782, -18, -160, -351, 12074, - 13865, -1294, 1262, -3135, -2861, 18, 753, 167, - 620, -2432, 1998, 740, 1902, 400, -206, 3518, - -3563, -632, 72, -1810, 1520, -827, -572, 1604, - -613, 3704, -736, 11100, 12702, -3189, -792, -3552, - 1621, 1841, 1236, 1215, -457, 9542, 9278, 2633, - -8801, 862, 1741, -4840, -2620, 616, 324, 2152, - 3632, 880, -472, 1927, -3456, -2105, -965, 3426, - -1893, 3095, -1152, -3542, 182, 998, -386, 1202, - 481, -1951, -510, -931, 1688, 151, -13664, -3894, - -973, -906, 1524, 9576, 2607, 12497, -819, -5214, - 5936, -634, -610, -4148, -421, -486, -1864, -306, - 2421, 724, -219, -1304, -2106, -504, 6762, 5266 -}, - -.cb1110l1 = { - -2972, -1201, -1388, -1762, 340, 21127, -999, 126, - 111, -1224, -1738, 311, -712, -450, -114, -648, - -752, -172, 67, 375, -967, -1032, -10763, -1885, - -2223, -3258, 480, -228, -143, -1299, 13128, -3062, - 1418, 6, -649, -1816, -288, 767, 345, 876, - -491, 948, 540, -167, 1969, -1883, -455, 20584, - -656, 114, 308, 279, 1105, -594, 1332, 255, - -356, -186, -540, 1898, -873, -477, 1404, 30475, - 370, -322, -337, -206, -440, -894, -54, -466, - -640, -408, -256, -560, -1503, 626, -573, -1684, - 419, 407, 2076, 5022, 3143, -1135, -12118, -12082, - -1462, -2060, -5432, -1092, 1575, 1958, -968, 122, - 958, -5312, 677, -1952, -12276, -1594, 1211, -1094, - 1992, -11032, -2993, -834, -1297, -1139, 312, -1546, - -4253, 1191, 21, 2771, 639, -2514, 6623, 746, - 1830, 2967, 1688, -14893, 7988, 4099, -97, 1165, - -2350, 65, -1308, 1834, -2084, 1683, 5118, -1633, - -10, -5282, 403, -1489, -264, 398, -2420, 12854, - -1498, -2642, -1486, 826, 699, -2213, -2296, 11849, - 478, -2202, -561, -250, 199, -2433, -948, -402, - 433, 403, 13031, -124, -180, 1499, -643, 527, - 11368, 5833, 938, 3202, -452, 2875, -1163, -117, - -2047, -1068, 211, 3122, -236, 13548, -702, 352, - -312, -1901, -2145, 2334, -12100, -76, -419, 362, - 3501, -220, -3086, 572, 1537, 3240, -1489, -1012, - 640, -513, 930, 390, 31019, 724, -78, -706, - 183, -157, -122, -847, -1156, 301, 508, -456, - 321, 317, 1300, -512, -1743, 10190, -294, -116, - 4183, 1374, 13360, -1339, 1832, 2547, -702, -2782, - -1464, 1176, -1287, 2256, 2169, 836, 2096, -248, - 1777, 11306, -211, 265, -3834, 336, 1936, -586, - 633, 1037, -1915, 12862, 930, -273, 2333, -3239, - 429, 374, 2518, -671, 570, -2208, 385, -284, --15613, -1752, 1341, -531, -744, -1111, 290, -2302, - -1012, -2933, -366, -30, -4595, 1400, 560, 48, - 15739, -945, 411, 1876, 2441, -2144, -1222, 12448, - 54, -726, -2743, 2548, 2100, 1307, 408, -198, - -1802, -63, -1919, 933, -329, -528, -15918, 1704, - 3028, 217, 606, -2804, 2052, 9320, 592, 969, - 6836, 647, -671, 584, -1, 3564, -2575, 436, - -2195, 414, -201, 1099, -772, -220, -578, -467, - 125, -934, 271, -21476, 288, 215, 216, 476, - -560, 768, 1142, -169, -1112, -14096, -14436, 2769, - -1464, -61, 1373, -3539, -1067, 1175, -1549, -861, - -332, -1876, 3159, 340, 1711, -2453, 457, 2536, - 1114, -2278, 2464, -3253, -466, 12291, 12484, -2868, - -800, 1142, -4244, -178, 3781, 1542, -663, 1976, - 3105, 145, -100, -1774, -1039, 1627, 15540, 4194, - 5392, 741, 1816, -544, -9100, 4255, -1083, -1266, - 2580, -4200, 1934, 1721, 129, 2276, -2704, -1341, - -1310, -11926, -1478, 199, 755, 619, 4231, -478, - -1627, -1242, 1842, 13170, -2416, 778, 192, 273, - 782, 774, 2188, -838, 3139, -1532, -1639, -1073, - -596, 770, -353, -53, 82, -322, -20584, -344, - -443, 158, -144, -554, 50, 954, -145, -336, - -2050, 596, -950, -2690, 13908, -13783, 4792, 879, - 584, -2987, 967, 192, -585, -783, -1341, -3108, - -1622, 2478, -1362, -1470, -1556, -430, -110, -736, - -8097, 2073, 964, -417, 1669, -5425, -7846, 536, - 12883, -1690, 1143, -242, -438, -2274, 57, 302, - -574, 637, 2816, -1642, 2166, -172, 893, 421, - -614, -565, -338, -526, -1085, -939, -1138, -991, - 1919, 1720, -18845, -1950, -342, 1930, 321, 184, - -956, -374, -462, -216, -6, 26, 386, -50, - 603, -720, 634, -252, 261, -860, 218, 22846, - 11544, -459, -946, 452, -102, -1203, -1802, -1105, - -310, 787, -220, -1113, -2043, 650, 13767, -3638, - -296, -902, -413, 252, -816, -172, -505, -1335, - 890, 768, -523, 808, -331, 20000, -264, 1763, - 133, -1, -464, 949, -954, -147, 1780, -190, - 30, -7422, -4615, -1006, -470, -742, 500, 7509, - 1500, 1550, -3614, 810, 2595, 1506, -12926, 3588, - 402, -2547, 1505, 65, 4, 3382, -2201, -2441, - -1521, -5450, -3820, 282, 5212, 1186, -1056, -2334, - 988, 12987, 390, 4141, -2680, 1663, -8034, -1792, - -225, -674, -7147, 13254, 1631, 10163, -3332, -7, - -675, -735, 772, -2299, -326, 1641, -1174, -1911, - 82, 776, 891, -445, 18590, 238, 1417, -2372, - -9718, -2682, 600, -1401, 604, -1791, -22, 1546, - -1764, 525, -1355, 348, 3260, 1115, 204, 524, - 225, -12776, -679, -15595, -1188, 1078, 82, -859, - 28, 819, -1220, 563, 2309, 331, -1158, -2010, - -264, -383, 1732, -424, -2742, -775, -329, 132, - 391, 1261, 1033, -9812, -11829, 2433, 2690, 606, - -2724, 7216, -296, -1834, -1694, 456, -4732, -400, - -3192, 1428, -316, -13674, -2702, 2320, -6548, -2025, - 1222, 1749, 4005, 2924, -3539, -5104, -2333, -1438, - 2598, 62, -757, 760, 343, 154, -31947, -534, - 1296, 697, 88, 345, -577, -500, -174, -326, - -198, 272, 157, -815, -636, -1163, -867, -273, - 1054, 774, 1624, 989, 107, -1088, -673, 2143, --22962, -566, 151, 72, -27, 1034, -444, 501, - 1905, -1455, 21, 289, -10670, -789, -2421, -2686, - -327, 804, -3009, 907, 960, 1379, -43, -552, - 2203, -1406, -911, -11094, -529, 4458, -4152, -70, - 3162, -12546, 326, 874, 1426, 3019, 2315, 104, --12516, -1591, -2877, 772, 1982, 1160, -4491, 3417, - -1524, -2139, 130, 930, 9359, -18308, -376, 4090, - -468, 156, -216, 60, -643, -3440, 256, -835, - -2389, 1660, -542, -1628, 4270, 3574, -3136, 433, - 1069, 30024, 561, 268, 790, 294, 207, -1552, - -736, -97, -215, -98, 690, 686, -202, -736, - -453, 655, 511, -156, 1006, 361, 1424, -1254, - -361, -1253, -1419, -290, 78, 555, 565, -488, - -923, -18193, -630, -908, 188, 925, -1684, 241, - -319, -14478, 17007, -1415, 274, 592, 1344, 1784, - -731, 344, 992, 141, 290, 481, 628, 623, - -1166, -2092, 140, -1056, 13736, 754, 1980, -238, - 2132, -1372, -2216, -12057, -1662, 66, 1742, 2209, - -962, -1574, -3044, 173, -3066, 183, -4476, -1016, - 6160, 780, -1193, -3334, 179, -371, 244, 160, - -686, 669, 330, 426, 65, 159, -664, -186, - 479, -742, 54, 605, 32603, -941, 370, -91, - 856, 825, 1042, 374, 651, 313, 734, -240, - -49, -685, -1994, -604, -875, 44, -884, 886, - 13012, -1506, -4317, -1926, 3050, -1027, -482, -40, - 137, -2560, 1366, -11812, 2112, 2266, -2690, -1339, - -700, -243, 2322, -1042, 4635, -3210, 4281, 47, - 670, 9218, 1165, 814, -62, -2276, 12987, -714, - 2481, 1355, 896, 2840, -1664, 2048, -345, 2285, - 1754, -669, 2284, -288, -575, 944, -1528, 44, - 1071, -706, -543, -1347, 880, 257, 1364, 1444, --17896, 99, 1539, 1813, -611, 355, -2290, 980, - -787, 132, 300, 2353, 204, -798, -296, -594, - 895, 842, 18755, 1129, 79, -189, 515, 882, - -286, 109, 305, 374, 1323, 861, -18, -78, - 294, -320, 674, 504, -159, -549, -95, -32403, - -90, 658, 1082, 1611, -137, -74, 1160, -794, - -55, 822, 2627, 1203, -3540, 9829, -7860, -9063, - -4015, -894, -2218, 729, -879, -1869, -2446, 4050, - -488, 13211, -290, -820, 371, 14196, 866, -891, - 218, -1838, 2162, 1144, -186, 512, 1416, 546, - 3298, -1253, 128, 1202, 557, -1967, 680, 545, - -139, -3008, 18453, -3322, -137, 163, 1377, 1116, - 2572, -1577, -1846, 651, -1319, 796, -862, 331, - 4383, 2453, -1894, 3264, 14137, 842, -3087, 3740, - -1100, -2400, -1364, 2406, 417, -2393, -868, -3158, - -9712, 3480, -1403, 1896, 201, 1285, -593, -11718, - 99, -539, -186, 45, -2266, -12228, -2658, 2802, - -1198, 1022, -3840, 1401, -1918, 1655, 1725, 96, - -205, -913, 1629, 568, -1285, 1264, -1160, 594, - 223, -336, -1436, -472, -19792, 553, 1494, -195, - 570, 282, -653, -54, -1115, 153, -484, 141, - -188, -278, -173, 464, 13, -634, -42, 390, - -464, -246, 622, 1229, -692, 29175, -574, 1150, - -135, 2685, 2452, 63, -962, -918, -1657, -1978, - -172, -677, -3414, 1345, -3964, 2875, -1412, -654, - -3000, 10739, 11348, -2232, 516, 8303, -189, 2564, - -150, -373, 903, -275, 2394, -1135, 508, 424, - -1704, -2222, -3789, 1938, 216, -12702, 2488, -1364, - -2175, 1114, -819, -2756, 1564, 952, 36, 609, - -933, -1568, 110, 143, -1575, -4236, 528, 15042, - -1920, 348, -2623, 5217, 1911, -1088, 259, -590, - 364, 2081, -3585, 662, 249, -119, -111, 778, - 2167, 11, 2500, 7182, 14452, 4388, 4121, 3623, - 1598, 532, -507, 877, 3830, 372, -2184, -2810, - 11748, -2095, -1079, -3070, -768, 2901, -3587, -2572, - 10008, 563, -4588, 1026, 1117, 1879, -12004, -416, - 317, 2032, 1800, 1058, -84, -296, -1748, 2588, --11019, -1627, -3264, 2480, 96, 2146, -2672, 2418 -}, - -.cb1110s0 = { --32746, 360, -2774, -672, -1808, -14, -1037, -1327, - 1409, -2215, 172, 1557, 945, 2031, -702, 1844, - -1106, 472, 2603, -978, 2782, -5691, 1473, -5668, - 7129, 6600, -2160, 108, -1844, 2062, -2395, -740, - 1690, -45, -725, 77, 7236, -12903, -3356, -764, - 1870, 720, -2201, 790, 9950, -3694, -5340, -4031, - 4115, 6863, 2352, 1484, 3606, -4855, 714, 4104, - 6240, 7261, -6855, 4919, -2847, 6701, 7469, -616, --11442, -1935, 9157, -4072, 133, -5976, 2455, -9360, - -2898, -4353, -7721, -3098, -3505, 2568, -5432, -576, --10072, 250, 2173, -4196, -4322, 2688, 5220, -6026, - -346, 11678, 2071, -7344, -2182, -530, -180, -2568, - 1524, -1617, -8825, -4845, 2794, -2813, -2669, -2423, - -2709, -8985, 2105, -4629, 708, 2040, -5680, -2470, - -7277, 6841, 6523, 4196, -6788, -1982, 3844, -5000, - 156, 1930, 1780, -3824, -286, 3908, 1703, 7304, - 1145, 144, 1180, 7145, 3175, -13823, 6580, -3066, - -6321, -9739, 4432, -1145, 2923, -2636, 3838, -7037, - -3913, 1262, -1398, 363, -141, -886, -5667, -212, - -2118, -2717, 2724, -18802, -2098, -155, -1399, 782, - 797, 766, 2613, 5374, -3767, -1711, 624, 693, - 2544, -6153, 7179, 6835, -762, 5061, 655, 2600, - 9208, -7030, 7047, 1654, -3404, 176, -5486, 1374, --15378, -487, 7456, -1954, 2404, -2994, -1608, 2362, - -498, -7952, -6143, -3996, 1596, -3013, 1181, -1534, - -5265, 220, -2677, 1047, -4629, -15066, 3966, -446, --11713, -5694, -393, -250, -1336, -7394, 1508, 6239, - 3788, 6273, 6215, 822, 2657, 8057, 8391, -658, - -2561, -11587, -2589, -6702, -9227, -1016, -2220, -9702, - 5988, 1859, -6100, -4594, 221, 2529, 2217, 8273, - 1804, -6128, -2859, -8259, -4707, -2494, 1913, -352, - -4561, -289, -1801, -994, -4445, -1001, 5422, 10868, - -7366, 1679, -5195, -6859, 2982, -406, 2400, 4520, - -3611, -1892, 4900, -3504, 771, 2774, -772, -1929, - -7354, 375, 628, 4522, 1069, -969, 8083, -155, - 3178, -1138, 1752, -17288, 4390, -2483, -2071, -1353, - -1155, -456, -2683, 6798, -1908, 1797, -6657, -2770, - 5610, -14518, 5922, -3964, -938, -853, 1416, -1077, - -4562, -160, 5820, -3031, 5091, 1987, -2746, -3779, - 238, -264, -3074, -11718, 9370, 9806, -6302, 3979, - -2938, 4034, 393, -1399, -4466, 2181, 756, 394, - 2264, -3664, 78, 470, -3228, 3942, -1714, 708, - 4988, 1938, -2722, 4555, -5054, -1026, 19312, 354, - 107, -5357, -4364, 597, -2566, -2812, -2278, -446, - 1384, -371, -2566, -388, -3964, -8989, 9136, 3389, - 8440, -5570, -1262, -5874, 2056, -5973, -185, 4540, - -4924, 154, -3653, -1113, -3048, 7099, -2734, 2940, - -6704, 1543, -8120, 10134, -9485, -6645, 4816, -442, - -32, -2430, 4932, -6129, -5050, 6120, -2147, -6910, - -1342, 1075, -2458, 50, -4747, -3080, 1886, 1490, - 18972, 48, 787, 2441, -405, 1668, -1399, 2202, - 2175, -3592, 1548, -2728, -4864, 504, 383, 376, - -1073, 2142, 504, -3114, 6378, -5516, 13462, 196, - 1840, 7087, 792, -3583, 302, 1012, -5504, 270, - 3354, -4486, -2312, -2522, -2872, -3899, -2261, 5211, - 1417, -3075, -151, -985, -772, -1630, 164, 659, - 1496, -349, -621, -32, -2982, -1720, -3475, -7370, - -1541, 1122, 20474, 1726, 4474, -3228, 7024, 3265, - 522, -2193, -2113, 5388, 1912, 5929, 11768, -1162, - 2600, 4048, 652, 3360, -3215, 376, 10028, 6054, - -3814, -1155, 93, 4512, -3581, -4037, 7484, -1481, - 2797, 2635, -12275, -2780, -6235, 5739, 2687, 376, - 5984, -2547, -8834, 4332, 2752, 1942, 1002, -3312, - 5251, -86, -7794, 918, -2413, 3131, -3316, 2095, - -4569, -15382, -5534, 1290, 5179, 2928, 3034, 2365, - 270, -7476, -3024, 6910, 1355, -6262, -2040, 10490, - 1432, 12284, 1125, -3160, 4518, 973, -2351, -1726, - 1967, 1488, 382, 3559, -3742, -2908, -944, -1662, - 682, 902, -4360, 5026, -4252, -1212, -3269, -6024, - -3788, 9128, -2638, -1625, 315, 3087, -3265, -10441, - -7207, -4078, -3266, -7543, -5223, 5460, 2496, -9258, - -227, 4048, 860, -520, 13616, -3458, 3837, 809, - -104, -4062, -4846, -136, -1631, 13977, -1136, 3380, - 1099, -4022, 1831, 3360, -9034, -52, -516, 10144, - 5074, 4866, 8282, -972, 2496, 2336, 8766, 2881, - 2417, -5588, 3064, 3934, -4202, 627, -986, 1750, - 958, -2348, 5006, -2597, -90, 133, 23271, 2431, - -3984, 1894, -2094, -1816, 5007, -3164, 2526, -1862, - 2651, 1809, 7173, 3410, 154, 14930, 3032, -5314, - 44, 8868, -543, -2158, 5341, 258, -8188, 3772, - 2804, 7544, 8339, -3560, -63, -735, 1300, -4308, - -1085, -4986, 1564, -6744, -2605, -310, 1275, 1166, - -640, 4814, 4373, 3103, -1242, 6049, -4786, 597, - 182, 2371, 6950, -2265, 389, -14669, -1942, -2733, - -485, -865, -597, -1376, 1626, -3956, -1244, 1532, - 3918, -3311, 1574, -88, -20573, -5471, -71, -1731, - 1436, 2428, 3982, -4576, -914, 5460, -4973, 1650, - -2364, -2486, 3212, 5424, -2501, 4595, -937, 728, - -5140, -9948, 1437, 10560, -5704, -264, -2752, 949, - 5229, -1445, 430, 827, 4103, -1999, -4625, -4171, - -8769, -8927, 7161, 4539, 6968, 5975, -4626, -2793, - 10080, -10386, -2479, 1724, 2992, 354, 3650, 3328, - 4490, -1931, 7348, 7283, -3304, 4446, -1698, -1224, - -3002, 4340, 1041, 607, -454, -4261, -18071, -1199, - -3902, 570, 5808, 5582, 6710, 235, -205, -4288, - 3472, -686, -103, -3658, -436, -9680, -190, 275, - -919, 2522, -2087, 9096, 5060, -6450, 10282, 3344, - -8167, -7688, 11881, 3101, -1280, -9942, -11741, 2213, - 712, 3976, -4218, -5285, 2797, 2996, 4006, 2053, - 2344, 6200, 141, 2616, -3981, 6970, -4194, -1621, --13724, 7772, 2800, 2220, 445, -266, 4030, 444, - -228, 2642, 1617, -2511, 1699, 8740, 3438, -2063, - -2093, 1806, 950, -7112, -1513, -2886, -8789, 870, - 3456, -4126, -3330, 541, -10173, -1789, 3156, 4466, - -5965, 479, 5177, -2806, 2506, -1646, -3609, 1617, - -7373, -3146, -2389, 3601, 7850, 89, -3373, 4670, - -4180, -3186, 3056, -1691, 1314, 9234, -7799, 1323, - -4360, -9866, -1930, 8091, -13452, 8503, 1980, 11247, - 7688, -5953, -4165, -3192, 540, 1631, 131, 2250, - 5330, -146, -8724, -3148, 2834, 1148, -3886, 374, - -1836, -3898, 9649, 1119, 10221, 128, 8868, -7301, - 2601, 1252, 2340, -3789, 4682, 181, 4434, -1740, - 4368, 879, -620, 2046, 1842, 844, -925, -2506, - -3344, -8820, -722, -451, 521, 903, -1286, -3059, - -5308, -4759, -2706, -1429, 2762, 927, -1459, -7274, --12028, 8838, 3987, 2406, 8626, -3128, 6505, -4322, - -197, -2464, 2738, -46, 161, 13919, 2252, 2059, - 981, 204, 1161, 4910, 683, -4311, 2081, -1932, - 1119, -6067, -5325, 8528, -4704, -5522, -6183, 5744, - -3407, -2021, 2688, -3230, 2490, -976, -500, -7834, - 2064, 3191, 4740, 3686, 1762, 2604, -2442, -5720, - -7550, 457, -3478, -8097, -6510, -9105, 8031, -4895, - 500, -2436, 1483, -4415, -2023, -3768, -2497, -1911, - 789, 566, -969, -4204, 6128, -5076, 2664, -4222, - 6755, 1774, 6881, 64, 1205, -9243, 4782, 4432, - 5193, -2258, -4787, -7433, 1755, -794, 1297, -7535, - 12773, 9124, 806, 2348, -8112, 7874, -4348, -1410, - -350, -2528, 576, 661, 272, 4598, 691, 1913, - -3349, -1881, -1854, -779, -821, 8444, 60, 2570, - -1813, -1354, -4512, -5471, 4728, 3289, 2617, -9326, - -6670, -859, -2713, -9839, 4676, -2657, 3106, -1393, - 10278, -3069, -2253, 1015, 2246, -2227, 16, -388, - 7962, 1493, -3122, -2707, 7982, -6106, -1462, -1665, - -1302, 2347, 3640, -15122, -2211, 417, 6819, 959, - -2876, -6868, 11060, -2329, -302, 1595, -4610, 9514, - 12677, -4614, -2899, -141, -4857, 1447, 6400, -2894, - 1696, -2888, 1889, 3489, 2775, -504, -6597, -5258, - -7256, -379, -1249, -136, 3118, -3537, 3295, -3458, - 2103, -399, 15281, -222, -1809, 172, 2257, 1947, - 707, 3562, -5691, 3575, -2210, 5750, 815, 4059, - -16, 1306, -13308, -1733, -1338, -3477, 5247, -1950, - -5148, -678, 8074, 1740, 290, 2033, 4639, -4240, - -536, -5214, -1366, 2491, 501, -59, -4480, 430, - -285, -5947, -755, -14559, 5696, 6960, 4462, 2317, - 6414, -13174, 4962, -899, 5924, 11100, 5303, -970, - -2528, -6239, 2253, 2236, 553, 458, -2229, 8016, - -7082, 2869, -4209, -4460, -6536, 3557, -1766, 7815, - -655, -6029, -5250, -1627, 2646, -3466, -3584, 901, - 10305, -895, -427, 949, -2776, 3436, 769, -4131, - 9019, -4898, -3562, -7978, -359, 1358, -1528, -3095, - 5840, -6214, 2591, -2086, 9480, 640, 2858, 216, - -3625, 5740, -7008, -1097, -2091, -143, 4832, 6210, - -1358, 3998, -714, 835, -4004, 3664, 1980, 1240, - 2902, 510, -1565, 427, -2052, -4208, -1505, 1187, - -1229, 3732, -932, -1014, 4784, 18474, -5111, 3047, - -54, -1547, -3892, 8612, 274, 1446, -3548, -7689, - -423, 1192, -4508, -10403, -8735, -446, 444, -6353, - 4008, -1462, -8906, -1161, -2395, 2442, 2204, -5472, --17376, 2471, -689, 1394, -3657, -2119, -769, 2872, - 1393, -2701, -3536, 3650, -378, 859, -3338, 1412, - 3010, -3243, -335, -3619, -511, -1931, -7126, -5018, - -9332, -4440, 1906, -2265, 1386, 8072, -6576, -1300, - 5458, -4894, 630, -7146, 2263, 810, 2968, 1124, - -2219, 2292, -3914, -1836, -6683, 1511, -2755, 1396, - 2425, -23842, 2249, -53, -891, -1678, -1766, -1788, - 502, -4210, 211, 10376, -5507, 837, -6196, 2132, - -472, -10153, 7234, -1456, -148, 4886, 2427, 2371, - 1234, -962, 6298, 1016, 1735, -566, -878, -8071 -}, - -.cb1110s1 = { - 2525, 12164, 4861, 9505, -7371, -414, 3002, 576, - -347, -998, 2861, -804, 3034, 810, -788, -539, - -2092, 4970, 1828, -2869, -2802, 6649, 3673, -193, - -4034, 722, 1642, 3792, 8770, 10428, -3303, -3849, - -4520, -234, -4190, -1219, -1300, -4128, 8384, -1150, - 1578, -6174, -1072, -4871, -8180, -6698, 3806, -7386, - -2545, 1052, -550, -1148, -1308, -8834, -2654, 1982, - 8716, 6579, 1360, -2404, 1893, 2680, 3801, 11097, - 1455, 2453, -7585, -7503, -12710, -420, 2023, -656, - 1124, 2872, 9676, -4309, -202, 1458, -6526, -534, - -1535, 924, 3068, -1142, 5073, 1284, -5632, 869, - -1637, -2898, 4900, -10202, -10488, -1097, 1890, 11006, - -44, 1368, -1979, 6507, 316, 961, 8, -4085, - 2561, -2034, -1077, 2594, -465, -5134, -868, 54, - -6694, 9608, -3516, 7165, 11011, 9542, 4780, -2800, - -1130, -1714, -2684, -369, 4746, -2688, 4146, -7652, - 984, -3263, -276, -9134, -2848, -3983, 9994, 3608, - 3234, -596, 263, 3102, -178, -2264, 3820, -4293, - -5752, -3577, -3914, 1095, -1562, 22110, 4610, 69, - -2999, 254, 2178, -2901, -1203, -1292, 2642, -3254, - -1389, 2955, 1340, 542, 810, 1369, 3208, -795, - -3272, -2717, -1129, 8781, -6854, -3028, -616, 729, - 529, -6946, 1621, 9574, -14909, 5398, 854, -774, - -9978, -5417, -2516, -4683, 5715, -66, 3336, -5040, - 640, -7566, 3494, 7016, -2269, 1376, -13994, 6448, - -3948, -1697, -3988, -6559, 2376, 4231, -3131, 2045, - -2417, -5919, -7016, -1695, 9046, -7966, 5187, -2553, - 1402, -2351, -220, 5931, -1823, -2270, 584, -3784, - 2924, 6166, -3035, 2370, 4923, -1080, 682, -7899, --10827, -1824, -908, 1568, -3565, 4033, -4266, -1948, - 923, 5488, -203, -2396, -907, 2783, -3278, 1415, - 7710, -190, -5208, -2279, 1266, -1132, -3392, 10251, - -1064, 11283, 2162, 2213, -5088, 4479, -4658, -1803, - 1534, -4233, -4073, 6938, 3966, -4878, -332, 5961, - 9217, 488, 6520, 4430, 7988, 9383, -2586, 1206, - -6983, -873, 1251, 1849, 5945, -2144, -2032, -1852, - 416, 3720, 2419, 8462, 3173, 11524, -2894, -5517, - -211, 17830, 3170, 1098, -721, -2066, -1956, -3097, - -1061, 2815, 447, 701, 449, -485, 2609, 1239, - 2257, -1760, 3091, 7538, 3710, -2689, -3092, 6903, - -2457, 3271, 6355, -1486, -828, 1994, -3575, 3949, - 3185, 2606, -4912, -16039, -8833, 1831, 2580, 1993, - -1117, -3408, -7590, -7278, -141, 2696, 805, 1896, - 308, 378, 9308, 2894, -4324, 1042, 837, 4716, - -4702, 2493, -5173, 8616, -468, -14829, 3759, 3251, - -4237, -1340, 5224, 2099, -764, -8263, -1699, 76, - -1464, 2115, -582, 3286, -3653, 1017, 1696, -1414, - -668, -9748, -5730, 2413, -1270, -6070, 17002, 2164, - -5440, 1801, -2123, 800, 2135, 4801, -887, -2141, - -647, -4846, -463, -577, -1846, -555, -1929, 2046, - 8272, -8399, 3886, -5950, -4202, -12600, -2805, 477, - 65, 6140, 1089, -4737, 8967, 1952, -1968, -3660, - 6641, 850, -3304, -1775, 4010, 10819, 14365, -696, - -1331, -1724, -237, -3611, 244, 3005, 4349, -182, - -4124, 2466, 2746, -61, 3391, -1392, 3788, 1582, - 3723, 7140, -2207, -3678, -2675, -252, -7476, 9426, - -6196, 3226, 3554, -6326, -4284, 6346, -4432, 5199, - -2633, -2499, 1200, -1140, -3910, 6624, 16732, 5946, - -766, 2630, -1200, 1988, 5510, -1199, 4126, 1287, - 454, -1795, 2664, 5001, 1058, 500, -437, 2992, - -2012, -160, 796, -4846, -6572, -10088, 603, 483, - -4510, -12799, 3502, -1784, 3510, -3956, 6038, 9044, - -6029, 7170, -1608, 120, 914, -200, 3939, -6274, - 3020, 6235, -2754, 5368, -1693, -6028, 386, -2006, - 1898, -11704, -9973, -525, -2624, 1799, 4140, 3248, - -57, -3731, 3764, 5582, -3830, -2484, -2066, 1517, - -900, -8250, -8191, 2676, 1147, 6752, 6908, 1196, - -2634, 3408, 2980, -1042, 3971, 632, -4946, -5690, - 133, 2445, -446, -1294, -777, 3356, -5628, -6020, - -8042, 5069, -1421, -2701, -15117, 3074, -912, -2574, - 2643, 5252, -2118, 3849, -3793, -850, 4170, 6240, - -697, 6976, -3752, 1155, 7769, -8912, -7728, 4224, - -2362, -3760, 3688, 2402, -3411, -3165, -2550, -8, - -209, -334, -837, 5688, 3425, -4564, 9999, -4780, - 3093, 4346, -5556, 1636, 1755, -14696, 1810, 6547, - -60, 4054, 10539, 6118, -4414, 1760, 3581, -841, - 4471, -23, 180, 259, -4439, -13230, -1326, 1913, - -621, -1641, -2882, -4934, 516, -3886, -4468, -110, - -4526, -5157, 7550, -4449, 813, -4364, 1768, -8829, - 2003, -1372, 1873, -209, 1539, 1076, -12408, -1464, - -1878, 1563, 2020, 704, 1425, -275, -3718, 4618, - -1120, -5057, -3590, 4022, -1977, 620, 143, -2507, - 3697, -3263, 616, -3002, -3347, 21051, -4398, 364, - -1924, 284, -2724, -2297, 4916, 2702, 4866, 4293, - -2781, 1094, -1525, -562, 5487, -2098, 4658, 1362, - -597, -3426, 3173, -5174, 3922, -3844, 1482, 4711, - 5853, 1490, 5499, -17537, 956, 544, 268, -4782, - -504, -4003, -911, 599, 1746, -7322, 1907, 1990, - 16985, 3171, -2645, 1040, -7239, 5618, 304, 3606, - -3377, 3630, 7319, 108, -496, 1026, 3062, -392, - 2366, 1948, -530, 806, 2700, -2676, -2717, 5238, --16008, -823, -264, -1560, -1014, -760, -3684, -330, - 5644, -1668, -10239, -2583, 7411, -593, 2193, -1479, - -2892, 3834, -3625, -12234, -1103, 1868, -5121, 3879, - 2748, 1936, 2026, 4572, -6037, 3310, -8678, 11724, - 5290, -2316, 4131, 834, -3915, 869, -1734, -5752, - 1255, 9534, -3625, -115, -5912, -125, 2298, -1494, - 5910, -496, -2719, 1320, 3175, -3012, -3906, 4602, - -4760, -5918, -2568, 6632, -8802, -5876, 6358, 2349, - 207, 5191, 8369, -5932, 2710, 7950, 3673, -2592, - 1311, 8384, -4360, 8614, -5662, 1180, 2147, 1044, - 1591, -5555, -1597, 4418, 38, -1579, 4675, -1725, - -1693, -6470, 3066, -7601, -12822, 524, -2986, -3406, - 8860, -1266, -930, 4316, 1171, -2908, 199, -1785, - -2851, -3588, 3072, -3585, -2668, -1123, 1508, 460, - 6780, -19480, 2854, -1574, 1004, 5074, 1907, -1988, - 1177, 74, -1436, 2224, 1232, -3008, -3454, -862, - 604, -653, 2778, 2349, 3242, 8426, -430, 3684, - 4814, -1886, 5118, 1487, 442, -2322, -900, -2854, - -234, -10350, -7922, -745, -1490, -5638, -6014, -4079, - -2979, -351, 9493, -2274, -11362, -8166, -7364, 8261, - 1554, -1722, 4651, -831, 2276, 1502, 2600, 1266, - 4456, -4145, -3837, -3584, 4242, 4058, -2395, -6971, - 4486, 3233, 6226, 1306, -11506, -6223, -5132, 1537, - -4407, 1510, 5732, 2808, 5817, -4972, -2900, 897, - -2441, -1819, 5651, -6988, -10063, -2288, -5820, -1250, - 925, 3120, 6125, -9901, -137, 3684, -6601, 1077, - 3272, 21, 3341, -838, -3643, -1727, -4417, 660, - -6551, -184, -8125, -1780, 5232, 6077, -7968, 6423, - 3823, 3026, 4555, 464, 3318, -5504, 837, -3571, - 3853, -2277, -1864, -742, -5380, 6096, 6856, 1076, - 877, -642, 1926, -4712, -14482, -3323, -2672, 7485, - -2116, -3932, 2233, -3270, 326, 2221, 132, -1893, - -748, 453, 3597, -2308, -4371, 5632, 3609, -1033, - -444, -2591, 17359, -3120, -2604, 3157, -370, 9242, - -1606, 2675, -853, 1475, -416, -3280, -1159, 191, - -3670, 282, 4282, -957, -2978, 3564, 91, -20520, - -3046, 1248, 1277, 3368, 1118, 311, -598, 1406, - -2377, -1444, 1417, -3626, 167, -6440, 3341, 629, - -2523, 4398, -1187, 4322, -383, 1934, -3298, -8530, - 2195, 5220, 510, -1256, -6932, -1061, 5141, -16242, - -1390, -546, -3760, -2029, -929, -6044, -3503, 312, - 8478, 701, 8865, 4715, 1987, 1342, 1400, -71, - -5229, -1547, -8827, 2349, 12836, -1479, 4621, 6003, - -6749, -3184, -5667, -2930, -1074, 3204, 330, 4692, - 2872, -10808, 75, -1260, 18003, 4100, -1462, 1391, - -1667, -2039, -687, -4806, 5913, 2682, 7730, 7034, - 2703, 1666, 120, 1601, 2123, 1402, -4702, -11229, - 7875, -5591, 4634, -2274, 3015, -597, -7520, -1095, - -4814, -173, 5562, 1533, 2807, 8466, 5195, 7806, - 2585, -2877, 6938, -3942, 402, -3825, 4162, 9149, - -6423, 2447, 7041, 2932, -9813, 2124, -58, -3, --12856, -7973, 1484, 907, 180, 8042, -2124, 4356, - -4117, 1126, -9706, -2101, 3957, -1877, 1139, 7148, - 3707, -1341, 4509, -1220, 4570, -1650, -6504, 7036, --10268, -328, 4678, -12205, 5062, 6089, -496, -7740, - 2207, 4489, -205, 1386, -2695, -1442, 4730, 892, - 12061, 3818, -3305, 4431, 9300, 3470, 4608, 4315, - 892, 866, -1714, 1529, 2569, -11398, -3068, -282, - 1626, 587, -1568, -1630, -220, -2033, 7141, -2732, - -3541, 3404, 15514, 1883, -2697, -926, 5972, 6485, - -6794, 2111, 2490, 1201, 5467, -2352, 3264, -97, - 2400, -728, -3364, 3417, 1481, 2862, 462, 2855, - -5233, 5740, 7208, -10508, -3254, 1450, -1270, -293, - 3400, -6978, 10035, -1213, 4308, 2641, 8579, 8518, - -2919, -351, -459, -2069, -617, 638, -1347, 107, - 6009, 2035, -280, 2009, 3280, -1236, -14960, -5177, - -2440, 965, -2646, -2095, 5274, 1825, 3705, 3831, - -446, -4018, 7178, -2415, 4344, 1850, -509, -500, - 1056, -4374, 5709, 1336, 3352, 7915, -2302, 12209, --14362, 6429, 1423, 2912, 6474, -1599, 1116, 2280, - -1738, 3108, -5792, -3554, 623, -1110, -6114, 4488, - 8941, -3176, 13670, -3320, -327, -2657, -7349, 3782, - -1481, 5737, -200, 2968, -9474, 5752, 5056, 4688, - -5352, -432, -906, -3832, -8519, -7, 3667, 3583, - 6250, 8724, 10737, 9371, 950, -1630, -10740, 5788, - 4111, -2910, 437, -2482, 1910, 185, -2168, -3155, - -3515, -1754, 4978, 4298, -6921, 476, -2778, 546 -}, - -.cb1110m0 = { - 3666, -1078, -175, 1370, 2491, -10050, -685, -7617, - 4002, 11104, 903, 5948, 2821, 3050, -2465, 1151, - -848, -2139, 12321, -1408, -1469, 2046, -2693, 2479, - -3498, 3077, -3822, 1841, -2404, -11172, -407, -3062, - -1725, -5475, 597, 1924, -197, 434, -1648, 2678, - -2462, 1148, 599, 1284, -13171, -949, -6508, 754, - 7466, 5924, 1411, -536, 10825, 588, 297, -310, - -593, -896, 784, -242, 716, 501, -52, 4043, - -755, -690, 2630, 17762, -2159, 2126, 954, -1316, - 11129, 1570, 387, -2639, 13953, -311, 5231, -2297, - -3612, -678, -1117, 690, -279, 2403, -1541, 493, - -1692, -2048, -771, -933, 423, 700, 840, 739, - 1956, -944, 612, -2678, 101, 245, -786, 850, - 269, 1355, 21773, 463, -2589, 596, -519, 788, - -43, 1220, 10674, 4847, 1192, 335, 875, -106, - 10644, 2600, 5391, -262, 2296, -5928, -1072, -122, - 2504, 1313, 1117, -981, 350, 375, -810, 8, - 1462, -2020, -2368, 8, 22663, 1537, 87, 908, - 832, -4884, 312, 620, 1042, -4444, 660, 1582, - -2710, -2954, 10012, -9580, 8102, 5696, -1371, -3035, - -3347, 402, 218, 1096, -1924, 88, -2270, 4175, - -1083, -497, -2437, -3332, -824, 212, -2362, 4600, - -7800, -11501, 7795, 236, -1336, -12920, 705, 4532, - -1488, 11746, -3213, -2650, 2524, -2638, -128, -328, - 3402, 453, -242, -2500, 2224, 708, 450, -3014, - -132, 1251, -131, -831, -710, -21985, 222, -2132, - -3261, 490, -3020, -860, 2550, 892, -623, -3666, - -664, -131, 2018, 2817, -12005, 496, -610, -7238, - -3909, -2867, 6872, 1903, 848, 6644, 3812, -5686, - -4055, -377, -2096, -10247, -1068, 1486, 415, -253, - -2186, 1050, 771, -6856, 1044, 7466, 2953, -7514, - 1601, 7015, -1778, -1622, -3364, -1755, 2835, 176, - 2700, 991, 2560, -554, 4867, 1571, -5610, 2610, - 12438, -3751, -9964, -2753, 4856, -2595, -5423, 10025, - 812, 687, 2715, 4013, 3086, -12039, 328, -3992, - 4044, -3920, -111, -553, -1720, 2454, 1706, -1365, - 804, -32329, -471, 897, -4670, 780, -3680, -1409, - -2630, 20, 184, -157, -290, 2794, -546, -160, - 1564, 1146, 628, -4787, -239, 11233, -492, 1955, - 608, 9273, -3220, 3830, 390, -5982, -3342, -3384, - 2356, 1820, -3473, 979, -40, -20190, 47, -200, - 5106, -381, 1824, -197, 2280, 2434, -2633, -1409, - -1109, -1072, 857, 1554, 7459, 6, 12130, -1078, - 1038, -300, -13748, 3201, -762, 2670, -1051, -445, - 914, -172, -558, 2634, -1158, 3129, -74, -3415, - 1086, -8892, 118, -647, 285, 186, 3022, -5077, - 1342, 3453, -7991, -65, 4690, 944, 3717, -1909, - -9783, -367, -1699, -772, -32768, 1286, -408, 340, - -340, 430, 1274, 596, -109, -727, 276, -946, - 139, 1804, -1050, -3562, -1392, -1179, 257, 1639, - 25708, 2278, 2415, 2174, 153, 126, -60, 592, - 994, -334, -268, 1826, -306, -2241, 2774, -3188, - 758, -450, 8023, 542, 6819, -1712, 14195, -2198, - 281, -12, -590, -1153, 4568, -3676, 1973, -5221, - -1839, -603, 3324, 2492, -3070, -846, 123, -1184, - 667, -10886, -65, -2615, 971, 10219, -1245, 7378, - -2122, -2306, 571, -2298, 1958, -4356, -9210, 4321, - 2805, 1888, 11129, 1282, -5819, -2528, -873, 1123, - -5968, -2644, -5515, -2151, -944, -7712, -2007, -2260, - -1920, 2100, -325, 153, 1050, 10, 1462, 650, --12559, 3530, 754, 4493, 1528, -6991, -4842, 1483, - -2408, 2785, -1651, -830, 1433, -2464, 18899, -1891, - -3137, 996, 2485, 3056, -1061, -4015, -2282, 1356, - -2572, -490, 1209, 1137, 4, -636, -1282, 1001, - -1190, -172, -14049, -4256, -1972, 2225, -4738, -1054, - 5254, 8113, 4294, 36, 11765, -3993, -1084, 3864, - -3016, -10356, 353, 2963, -1228, 536, 609, -343, - 1246, 3617, -3667, 4794, -20360, 473, 725, -1246, - -1649, 1900, -2589, -2869, -2550, -886, -1164, -1876, - 307, 3784, -4782, -476, -700, 2118, -1860, 1533, - -5013, 2356, 3305, 3338, -14312, -1278, -322, 1950, - -954, -1990, 1438, 3358, 7479, 3046, -6677, -3078, - 1717, 3113, -12484, -1302, -221, -510, 10423, -3497, - 4170, -3606, 6983, -2902, 458, 667, 566, 2415, - -403, -2898, -44, -1832, -110, 1799, 1172, 7, - -1534, 90, 686, -26902, 1601, -822, 658, 182, - -151, 345, 1488, 1416, -272, 1560, 9774, 2084, - 16, -14344, 1428, 514, 2658, -1312, 2095, 454, - -1783, -2056, 4529, 1154, -2239, 956, 668, -1396, - -2898, 405, -12659, -12556, -650, -587, 3461, -2470, - 0, -3156, 3186, -4104, 1729, 1438, -1842, -422, - 4476, 1945, -932, -1439, -702, -1398, 3349, 1876, - -999, -2086, -17879, -432, 4036, -2299, 1133, 88, - -2221, -2730, -938, -998, -132, -426, 2084, 2060, - -1134, -313, 402, -538, -2593, 2022, 725, 1566, - -2070, 21622, 1767, -424, -32672, 205, -1239, -3253, - 198, -1257, 2342, -1918, 1505, 452, 1348, -604, - 978, 1079, -4, 2476, -1247, -146, -861, -1928, --12222, -13042, -1384, -1971, -1428, 1224, -639, -83, - 1034, 3488, -2310, -565, 74, -335, 2774, 602, - 872, -2132, -147, 2160, 244, 162, 12600, 628, --10194, -1296, 1068, -1824, -4945, 3194, 2066, -895, - -784, 2347, -1982, 73, 1030, 12589, -62, -2272, - 3827, -1776, 2546, -1417, 3310, 4726, -3078, -548, - -8522, 1632, -6667, 1008, 1128, 805, 954, 616, - 499, -31526, -1327, 790, -190, 1058, -1157, 1432, - -16, 411, -3180, 827, 327, 914, 1716, 1442, - 1052, -1635, -1805, -4145, -13678, 3597, -2273, -5920, - 3592, 1136, -211, 717, 3901, -5132, 3036, -601, - 12976, 1633, 10316, -1674, -468, 905, 2331, 841, - -247, -6053, -593, -3281, 4291, 5159, -1053, -1814, - 2613, 2221, 1146, 871, -421, -542, 923, -3567, - -1138, 10051, 10860, -6121, -661, -5677, -890, -266, - 2100, 6223, -70, -2658, -78, 3424, 714, 2138, - -1355, -981, 1990, 772, 938, 1311, -1963, 924, --22516, 260, -341, 1251, -1578, 23, 1375, 1068, - 2688, -3965, 713, -5342, -257, 37, -6034, -276, - 228, -1240, -7171, -3402, -14677, 1708, -317, -2880, - 874, 1466, 524, 2091, 565, -4220, -265, 52, - -3373, -220, -3175, 2646, 448, -1628, -1986, 2200, - 3722, -15752, 7120, -2036, -2170, -627, -1079, -4060, - 2257, -925, -3418, -13488, -1308, 3476, -783, -3924, - -820, -860, 2418, 2982, -8753, 9001, 294, -11915, - -969, 3329, -761, 1459, -5308, 1811, 379, 306, - 632, -2732, 2512, 1188, -3470, -2167, -572, -2274, - -1657, 24074, -159, -138, -1826, -2527, -3117, -906, - -1770, -1182, 1240, -3064, 2313, -790, 336, -3843, --13384, -423, 13066, -14, -1908, -32, 2607, 487, - -2426, 195, 135, 2742, 1540, -1034, 856, -2288, - -287, -774, 497, 1760, 191, 178, 298, 38, --30898, 801, -1456, 2311, 1272, -1845, 334, -933, - 183, -1614, 739, 1881, -13548, -13589, 1496, -2075, - -1281, -1510, 108, 3683, -1120, 752, -980, -277, - -1289, 2016, -290, 1838, -321, -139, -881, -12391, --14713, 1906, 990, -3202, 2320, 749, 1872, -2545, - -1457, -1727, 734, -327, -316, 1062, -3149, -2959, - 2210, 912, 952, 1926, -8918, 1098, 594, -1439, - -1402, 11097, 3482, -472, 219, -3845, -662, 9715, - 3928, 1254, -2009, 12375, -1724, 13938, 1892, -1390, - 686, 2174, 1010, -1297, -199, 1855, 463, 2601, - 4408, 1978, 1679, -1614, -3, -11965, 16220, 828, - 1497, -747, -484, 519, -1804, -3814, 3287, 2104, - 1149, 478, -3918, 1504, 2376, -316, -520, -1449, - -3918, 664, 2772, -16434, 334, -540, -778, -2812, - -6026, -4392, -2446, 3479, 3742, -624, 3895, 1145, - -344, 333, 11898, -2725, 12873, -1145, -1807, -279, - -452, -1581, 548, -5180, -2012, 3411, 1188, -1407, - -4016, -468, 1904, -1724, -11390, -30, 14402, 1610, - -2138, 1249, 346, 6097, -1433, -655, -174, 3652, - 4010, 954, -1458, -354, -1872, -2689, 880, -846, - -1304, -1725, 1750, -1186, 1520, 499, -583, 18201, - -1083, -3323, 3072, -5440, -182, 1065, -1112, -984, - 2501, -529, 613, 2054, 460, -5245, 2827, -1445, - -2403, -12898, 1504, -8428, -1035, -4620, 1704, -2586 -}, - -.cb1110m1 = { - 1442, 12425, -2072, 741, -3624, 12979, 2031, -364, - 3750, -5082, -1968, 146, 670, -3988, -831, 3962, - 397, 6213, -1178, 816, -88, -432, -9620, 11572, - 194, 289, -1958, -2115, -871, 5372, -3145, 3612, - 1644, 826, 525, -2545, -514, -537, 2485, -1014, - 1276, 541, -936, -302, -1172, 183, 827, 23939, - 1120, -346, -313, 2759, 3934, -3082, -2260, -906, - -967, 1496, 102, -2782, 323, -1109, -37, 2554, - -2920, 998, -930, -1952, -1138, 1842, -1593, 17345, - -1214, -1065, 2182, -1169, 11745, 278, 8310, 1491, - -564, 1169, 8406, 1359, -1249, -2094, -1365, 4069, - 1828, 897, 1258, 1083, 4319, 610, 766, 2273, - 4057, 621, 338, 1317, -20941, 548, -2012, 563, - 1102, -27, 3007, 1129, -1068, 1282, -2939, 2983, - 1958, 1800, 1912, 1728, -606, 1804, -4768, 5068, - -1365, 4543, 399, -14152, -6206, 6187, -2205, 1174, - -1892, -3284, -206, 2872, -2622, -43, 11268, -104, - 292, -1836, -6276, 725, 2066, -604, 11382, -448, - 742, 2854, -910, -838, -1802, 3678, -397, -530, --10647, 2356, 12161, 1506, 2649, -3335, 3128, 2169, - 5942, 2152, 14124, 428, 187, 248, 1592, -44, - -59, -2934, 1883, -923, 2673, -847, 150, -2142, - -7620, 11078, -595, 6490, -13673, 948, 219, -1314, - -3080, 1339, 11020, 1362, 247, -1863, 1069, -3786, - 1706, 1064, 320, 4535, 136, 3795, 1465, -1356, - -449, 13, -421, 1769, 20470, 2181, -371, 2444, - -744, 2263, -155, -688, -236, -4481, 1551, 2812, - 2476, -1436, -470, -272, 2276, 594, -858, -978, - 1122, 2468, -9350, -353, -1020, 494, 13167, 1770, - 1734, -70, -4630, 12358, -818, -979, -3931, 1000, - -4343, 2570, 5567, 3322, 2930, -236, -4796, 6987, - -1658, 4291, 1118, 1710, -2050, -13566, -2, -23, - 2104, 1101, -316, 1906, 1643, 340, 5940, 3180, - -837, 1978, -10514, 1466, -6936, 3600, 1205, 957, - -211, -8272, 1611, 5330, -5217, -2264, -5681, -3085, - -9201, -62, 3366, 1370, -9494, 244, -5516, 1210, - 2930, -432, -1265, 376, -1910, -1016, -845, 3228, - 1094, -3168, 634, -265, -3426, 4367, -4004, -277, --15081, 3998, 9671, 3418, 691, 9124, -2723, 1939, - 2311, 581, -4980, 3381, -1502, 878, -1037, 1496, - 3002, 904, -5388, -3300, 263, 1277, -694, 766, - 1781, 1134, 250, -32602, -285, 210, 2550, -383, - 908, 302, 292, -352, 2615, -97, -1863, 1908, - 2685, -502, -3767, 416, 990, -602, -1533, 43, - 1288, 1326, 16638, 433, -1204, 1850, -1609, 1407, - -7196, 2319, 5770, 1584, 1150, -634, -1686, 1359, - -1396, 438, 246, 186, -11262, -1194, -3790, -3267, - 2692, 755, 142, 16276, -2338, -1341, 10433, 38, - -1510, -2520, -3205, 913, 3783, -1622, -4744, 1891, - 2502, -8, -2962, 2091, 14986, 1270, 2931, 682, - 1073, -10215, 1606, -1010, -822, 1168, -1403, 254, - 1156, 3206, 3958, 1739, -402, -654, -4862, -1869, - 2643, -2858, 658, -910, -2548, 5428, -1992, -208, - 1950, -15526, 520, -4212, 3182, 4160, 1524, -2916, - 586, 3213, 675, 185, -629, 669, -838, 502, - -4065, 353, -4072, -1832, -2108, 5034, 2484, 15386, - -2102, 4988, 70, 1011, 2568, 1360, -2821, 3352, --11074, -2686, 611, 460, 1811, 3093, 34, -9140, - -1163, 26, -875, 2510, 1134, -1322, 2274, -960, - -823, -510, 1092, 1490, 1466, -1978, 32767, -2379, - -1019, -633, -1306, -242, 2050, 1336, -2668, -2195, - -442, 8, 2292, 4344, -2439, -1472, 1035, -14443, - -1820, 6309, -2096, 45, 3617, 1561, 1252, 2828, - 10682, -894, 10841, 2373, -101, 913, 2160, 2653, - 2960, -4433, 1193, 4892, -2123, -7911, 991, -2643, - -1364, -3641, -9736, 444, 869, 2990, 926, -1220, - -1676, 7492, 4376, -3742, -6964, 4531, 7522, -2686, - 164, 1070, -7305, 1863, 542, 146, -800, 18492, - -4849, -3876, 2162, 5111, 2606, 4243, -3035, -2990, - -1710, -426, -5315, -2332, -1020, -268, -1242, -39, - -1684, -32768, 1288, -726, -1768, 304, 702, -2969, - -700, 586, 1541, -1099, -348, -2816, -2181, -1260, - -1658, 2278, 323, -1548, 2513, 11816, -2416, -5837, - -118, 6770, 3360, -4097, -264, -1270, 1064, -9862, - -3669, -56, 603, -1475, 1464, -9553, 6, -3091, - 5331, -396, 892, -2774, -4674, 3667, -9982, -5160, - -1146, -4026, -2032, 2936, 1805, -1026, 1065, -420, - -572, 1756, -479, -583, 30760, -732, 750, 270, - -1541, 28, -1114, -96, -264, 1167, 548, 570, - 84, -1981, -2110, -1136, 358, -6337, -257, -14658, - 1144, -9032, 322, -3730, -3086, -1351, -3320, -4116, - -396, -129, -3202, 1403, -347, 2400, -371, 532, - 1555, -2760, 1078, 804, -1314, 21956, 2231, -2808, - -1947, 838, 12428, -14514, -384, -1554, -675, -885, - 1358, 1612, -3266, -98, 1876, -447, 2241, 3375, - -1765, 2792, 674, -1513, -1132, -3696, 11368, -1916, - -2778, -466, -377, 2090, 3897, 5422, -2550, 2360, - 3279, 8657, 990, -2128, 2592, -970, -2397, -269, - 22742, 694, 310, -2433, 920, -690, 1478, 1370, - -450, 445, -1379, -1244, 2374, 1400, -1040, -5692, - -1700, -1630, -4068, -1193, -719, -2953, -3562, 264, --13247, -4629, 5, 3245, -5724, 2449, 3190, -5375, - -3560, -3834, 1271, 1568, -762, 2938, 782, -1390, - 243, -466, 1376, 974, -1646, -1784, 249, -514, --13543, 1904, 10778, -772, -155, 7838, -30, 3634, - -473, -9100, -112, -3990, -840, 1495, -2346, -326, - 3655, 1292, -292, -10972, 3431, -262, 171, -9775, - -985, 578, 312, -2553, 3375, -8316, 1410, -1326, - 2459, -3116, 1079, 7194, 2720, 1998, 2742, 4672, - -1589, -8932, -124, -652, -72, 2409, -926, -3661, - -3762, 14832, -1350, -2234, 1258, -1604, 169, 103, - 1263, -400, -765, 144, 824, 855, -13344, -1629, - 1977, 2995, -1964, -650, -219, -11607, -6062, -792, - -1243, -1438, 1757, 1436, -3739, 812, -856, -9603, - -2428, -11372, 3273, -2318, -8263, 1551, -2054, -3646, - 3149, 2255, 594, -412, -3030, 1558, 694, -1211, - 618, 3256, 6526, -1572, -9054, 6655, -3208, 3616, - 2162, 3137, 4254, 4610, -10040, 1188, 335, -615, - 640, -1990, -314, 6014, -2392, -2174, 343, 6730, - -1320, 183, -97, -3566, 2988, -13343, -1573, -9070, - 428, 2839, 6728, -1109, -1113, -1102, 5012, 1308, - -3943, 3207, 764, -2928, 1144, -3044, 4033, 1846, - 6460, -4165, 8509, 9824, 15708, -642, 748, 124, - -406, 13033, 807, -299, 1319, 1499, -1206, -1102, - -3129, 3795, 47, -2483, -2470, 2287, 4028, 1656, - -364, -1712, -1568, -3940, -2770, -13688, 796, 3380, - 363, 1673, 1160, -3934, 2884, -5060, 832, 4799, - 364, -3030, -10596, -1805, -3256, -2492, -1831, 1088, - 11108, 3236, 5128, 3052, 4486, 84, 2078, 200, - -4071, 1713, 1539, 24597, -1019, 32, -48, 82, - 81, 1171, -1261, -1783, -1693, 2194, 1714, -225, - -1989, 402, 2611, -708, -15901, 222, -507, 12855, - 1162, -1536, -2884, 1911, -1256, -926, -1875, -1448, - -2730, 3059, -1231, 1680, 1824, 1288, -215, -9, - 40, -957, 27662, -1844, -1927, -846, -1144, -439, - -3507, -2844, -1880, 637, 1042, 237, 1007, -387, --11913, -2584, -142, 624, -494, 1439, 2225, -13017, - -1901, -1253, -1071, -7083, -2154, 814, 3867, 1130, - -2611, -2260, 1548, -12389, -1018, 102, 1178, 1058, --14863, 2020, 4094, -1259, -861, -886, -3119, 2638, - 1725, -1364, -2086, 183, 507, -978, -3086, -14966, - 759, -1341, -70, 8538, 2974, -140, 2509, -4460, - 2724, -1372, 491, -6138, -345, -2170, -1187, -330, --11090, 15657, -300, 2105, 496, -2093, -447, 2000, - 3451, 1482, 758, 4142, 562, -4042, 1491, 3183, - 1685, -2729, 1611, 11698, 14918, 25, 842, -2766, - -667, -1564, -2619, 646, 1391, 862, -909, -2141, - -589, 1468, -755, 1324, -765, 634, 195, -19622, - -1006, -1161, 2434, -1808, 4168, 4108, -2580, -635, - -2533, -2170, -3701, -1047, -363, 769, 5064, -8, - -654, 2346, 752, 13736, -4056, 7, 5492, 7326, - -4894, -3860, 3325, -3947, 4721, 5557, -3699, 194, --12957, 1052, -1317, -2642, -2931, 1050, -3951, 2392, - -9683, 2519, 2880, -3700, -1820, 831, 4370, -1177 -}, - -.cb1616l0 = { - -185, -20290, 476, -272, 31, -638, 806, -61, - 220, 176, 178, -788, -441, -333, -360, -263, - -116, -512, 9794, -727, 8904, 1192, -277, 756, - -670, 795, -311, 240, -617, -675, -970, 756, - 857, 529, -166, 674, 890, -522, 837, 79, - -618, -1308, -13832, 744, 5422, 2688, 531, 398, - 1500, -1965, -209, -346, 613, 2147, 10053, -1398, - 189, -108, 471, -1202, 999, 178, 762, -601, - 1116, 9468, -281, 763, -1204, -822, -20, -160, - -806, 14720, -269, 143, -1362, -532, -788, -1532, - -405, 85, -271, -4959, 276, -34, -28, -66, - 112, -188, -582, -678, 128, 680, 982, 596, - 12154, -10468, -167, -380, 734, -296, 282, -223, - -86, -342, -812, 514, 387, -418, -364, -1216, - 14, 373, 357, 10897, 11235, -714, 206, -618, - -607, 596, 190, 726, 496, -300, 95, 1022, - -153, 212, -540, 252, 281, 238, -234, 28, - 24, 184, 32767, -627, 569, 323, 486, 544, - -348, -589, -284, 238, 228, 475, 83, -7753, - 182, 745, 400, -633, -207, 137, 382, 90, - 78, 715, 448, 463, 937, 10203, -12047, -667, - -370, -1516, -360, 94, 832, 1027, 1013, 92, - -5446, 834, 302, 764, -94, -462, 8095, 1057, - 308, -635, 308, -877, -946, -616, 51, 1090, --13351, 490, -819, 15182, -384, 411, -546, -242, - 460, -323, 76, 277, 1582, 900, -1119, 345, - 1316, 1138, 2020, 1612, -148, 812, 1241, -10350, - -9495, -965, -69, 1967, -168, -128, 1042, 447, - 491, -133, -5083, -450, -164, 50, 326, 269, - -283, 226, -40, -334, -110, 60, -47, 169, - 9166, 1188, -942, -14, 2112, -230, 634, -741, - -214, -336, -606, 3102, 59, 216, 1805, -1176, - 211, -8, 564, 156, -261, 300, 597, -21842, - 66, -232, -506, -1126, 1057, 603, 1448, -391, - 249, -9445, -10240, 694, 167, -1158, -645, -385, - -209, 330, 519, -345, -600, 192, 78, -229, - 208, -9053, -383, 10646, -264, 84, 295, -148, - 87, 1292, 257, 1080, -564, -2395, -1200, -484, - -48, -513, -383, -11, -516, -17356, -1172, -218, - 124, -327, 31, 328, -80, 231, 58, -951, - 560, -501, -392, 30528, -56, 382, -515, -50, - -155, 338, 0, -414, -899, 95, 11, 378, - -350, 459, 673, 76, 86, 379, 32222, 143, - -48, 425, -394, -60, -348, 450, -489, 220, - 56, 1129, -125, 322, 168, -16, 322, -293, - 294, -38, 328, 141, 692, -82, -160, -32768, - -140, -1543, 1079, 1052, -924, -569, 168, -1782, - 815, 706, -1318, -3436, 2860, 10922, 236, 10311, - 882, -1911, 11, 1638, -189, 245, -858, 11060, - -826, 696, 224, 1707, 1766, 472, 10832, -265, - -161, 163, 478, -258, -284, -86, 496, 425, - -71, -10344, -141, 425, -1457, 1145, -63, -713, - -583, -327, 628, 368, -18, -1746, -525, -338, - -110, -359, 92, -233, -21328, 460, -275, -98, - -58, 51, 208, 56, -1145, -51, -242, 65, - 76, 214, 141, 28, -86, 26, 925, 193, - 9980, -326, 11342, 176, -534, -303, 130, -1575, - 189, -496, -699, 381, 411, 644, 229, -147, - 694, -1998, 523, -1576, 8028, -10385, -1924, 1174, - 608, 2402, 575, -1753, 437, -816, 1267, 147, - 1448, -614, 865, 1076, -156, 5000, 2020, 2021, - 10283, -460, -2381, -3226, -3991, 4904, -284, 105, - -268, 1049, 203, -646, 732, 6490, -128, 932, - 10, -866, 74, -64, 834, 204, 159, -162, - -170, -110, -28908, 52, -512, -72, 327, 615, - 534, -484, 131, -262, 31, -407, 284, 33, - 11118, -170, 318, 12848, -1126, -659, 500, 310, - -403, -234, 237, -544, 1232, -243, -1178, -965, - -117, 108, -1304, 11728, -2254, 1231, -1077, -136, - -632, -103, -256, -1644, -300, 1680, -1175, -956, - -43, 1718, 175, 144, 275, -802, -223, 1116, - 321, -871, -1174, -1175, 1008, 255, 31172, 28, - -621, -222, -12473, -10995, -712, 247, 1762, 418, - -181, 90, 92, -406, -435, -105, -596, 2262, - -116, -1574, -3402, 6796, 7944, 973, -2661, 2260, - 621, -6984, 382, -1375, -2604, 1550, -1453, 1133, - 966, 403, 284, -72, -36, 174, 457, -90, - 38, -437, -476, -370, 469, 32767, -267, 350, - 694, -169, -782, 2110, -620, -782, -669, -6478, - 10550, -3294, 485, 177, 553, -3232, 1628, 2335, - -870, -360, -1112, 2197, -474, -5113, 3346, 878, - 566, -3823, -1175, 357, 10509, 1077, -514, 1012, - 38, 59, 669, 654, 349, -1046, 355, 192, - 57, 95, 11869, -702, 10201, 204, 45, -608, - -444, 921, -1070, -316, 1286, -2566, 2026, -127, - -79, -954, 93, -1288, -10024, 693, 8820, -366, - -84, -6378, 1682, -627, 386, 254, 503, -152, - -336, 38, -341, 373, -85, 1088, -1707, 119, - -242, 242, -326, -162, 109, 70, -114, -831, - -279, -32768, 62, 58, 214, 136, 194, -103, --10047, -610, 91, -310, 12059, 346, -656, 986, - 478, 364, 1777, -173, -663, -103, 1011, -373, - 200, 1632, -13098, 3651, 418, 478, 68, -217, - 169, 78, -1176, -1191, -1664, -328, 152, -1053, - 547, 527, -10435, -176, 11131, -137, -36, 1062, - 33, 71, -730, 2080, 2061, -372, -637, -84, - 744, 109, -357, 550, 309, -239, -134, 135, --20461, -177, -690, -488, -36, -415, 275, 64, - 378, 11250, -802, -569, -200, 1499, 13103, -1090, - -175, 189, -162, -751, 1052, -949, -98, 1249, - 479, -1304, 3293, 771, 1642, -381, 1423, 2258, - 1184, 4806, -10950, -3873, 348, -815, -5315, -3306, - -3307, 2337, 776, -125, -48, -435, -155, -30, - 294, 116, 96, -47, 1022, -391, -183, 252, - 826, -32, 293, -1369, 18310, -146, 239, -266, - 34, -154, -704, -498, -135, 228, -563, -210, - -158, -514, -201, -571, -341, -428, 74, -152, - 297, -162, -644, -216, -252, -13810, 705, 464, - 21097, 74, -169, 792, 12, 131, 320, -398, - -446, 44, -362, 388, -22, -13, -209, 1205, - 9341, 590, -683, -351, 177, -1618, 495, 14, - -319, 755, 11352, 249, -989, 1574, -922, -364, - 366, -10348, 337, -558, -124, 12056, 102, 802, - -548, -254, 1532, 7, -282, -459, -839, 171, - -4445, -1610, -1515, -37, 970, 306, -881, -238, - -154, -58, 27, 435, 166, 571, 225, -844, - -9967, -192, -874, -459, -1283, -1431, 1552, -38, - -686, -207, 709, 11982, -383, 1922, -92, -60, - 708, -900, 867, 39, 1470, 517, -182, -456, - 90, 1026, -192, 9988, 942, 48, 789, 981, - 74, -692, -1283, 1239, 1625, -1121, -286, -1115, - 294, 13228, 980, 312, -745, 11711, 1055, 1052, - -907, 201, 688, 364, 1171, 96, -591, -981, - -246, 875, -352, 677, 881, -397, 12890, 10, - 0, 412, 76, 464, 275, -721, -28, -197, - 104, -238, -372, -272, 490, 1426, 963, -13232, - -1190, 790, 161, -321, 1138, 646, 359, -183, - -659, -129, 348, -22703, 1016, -147, 26, -80 -}, - -.cb1616l1 = { - 292, 310, -255, 305, 69, 25001, -16, -668, - 210, 17, -12, 45, -758, -76, -544, -882, - 61, 26, -1682, -8820, 154, -11775, 64, 472, - -464, 245, 478, -1560, 869, 2192, 98, 645, - -95, -9369, -594, -635, -11132, 900, 1606, -904, - 841, 2570, -1464, 961, 1056, 669, 461, 3307, - -157, -644, 121, -694, 170, 116, 393, 1507, - -233, -654, -162, 108, 98, 17471, 347, -11344, - -701, -284, -246, -337, -1903, 14, 9865, 453, --11318, -3662, 2373, 1106, -1424, -1709, -2743, -860, - 11008, 1579, -38, -1381, 467, -487, -1306, 369, - 426, -424, 128, 1078, 1085, 683, 12552, 792, - -184, -278, 186, 2006, 363, 310, -75, 862, - 377, 490, -256, -1568, -124, -10785, -1456, -524, - -1259, 517, -1844, 914, 769, 945, 739, -1053, - -691, 177, 96, -1070, -162, -707, -594, -9885, - 103, 452, -734, -6774, -753, 192, 88, -292, - 201, -532, 231, -281, -691, -1232, -1768, -753, - 369, 1556, -139, 668, 941, 264, 10372, 9740, - 976, 2519, -88, 941, 446, -130, 2131, -631, - 325, 285, 176, -236, -634, -91, 112, 32767, - -233, -726, 156, 881, -217, -497, -236, -1106, - 283, 164, -328, -629, -27442, -17, 176, -338, - -192, 538, -773, 634, -180, 872, -190, -530, - 586, 6994, 3060, -336, 736, -1268, -1142, -69, - -1359, -1047, -975, -86, 12489, 1162, -509, -478, - 717, -514, -502, -1755, 11064, 7668, 340, 230, - -127, 1490, -63, 680, -297, 125, 1700, 2505, - 3, -2043, 255, 1547, 569, -2483, 733, -896, - 881, 4780, 1544, -13442, 1328, 1937, -4448, -384, - 749, 173, 7350, 156, -144, 52, -527, -34, - -3, -173, 118, -528, -75, 39, 42, -874, --14636, 474, -413, -106, -115, -431, 54, 722, - 156, -468, 369, 149, -68, -791, 1318, 2150, - 69, 454, 19032, 3, 111, -40, 349, 88, - 385, -54, -395, -224, -519, 0, -219, 179, - -253, -11379, 11005, 1857, -126, -248, 304, -616, - 351, 324, 500, 1494, -1390, 2349, -1257, -1114, - -213, 8156, -2066, 9746, 763, -848, 349, -7, - 723, -966, 469, 91, -252, 1336, 579, 1816, - 1372, -941, 364, 276, -33, 7, -425, -433, - -21, 546, -671, -31271, -926, 101, 147, 302, - -552, 224, 568, -2386, 519, -458, 13171, -1464, - 1161, 639, -10, -877, 331, 3372, -72, 5158, - -706, 906, 2668, 1008, -2732, 3264, 105, 630, - 673, -1948, -196, -13130, 1726, 737, 4829, 93, - 654, 2175, 3858, -5, 245, -471, 369, 5435, - 356, -12934, 61, 1984, 975, 706, -2454, -642, - -93, -780, -443, -1487, -460, 1112, 385, 309, --10268, 197, -1692, -1870, 50, -1934, 5380, -1193, - 775, -493, -992, -557, 2952, 408, 4616, -1341, - 10774, 5305, 854, 3031, 67, 617, 2436, -2072, - -1469, 804, -578, 243, 264, 9150, 200, 10753, - -350, 182, -52, -406, 508, -761, -161, -1142, - 25, 484, 127, 126, 477, -341, 110, 371, - 32767, 1090, 678, 175, 146, 1020, -897, 878, - -137, -507, -534, 658, 678, 505, -753, -207, - 391, 60, -23279, -772, -1323, -1578, -3, 196, - -749, 220, -482, -785, 456, 38, 1034, -579, - -58, -1539, 421, -746, 238, 1531, 21290, 586, - -441, -276, 1512, 553, -1407, -276, 60, -1068, - 299, 650, -25, 12590, 2058, 925, -295, -1744, - 5152, 4935, -419, 272, -383, -665, -194, -255, - 574, -267, 541, 1031, -282, -648, 622, -1464, - -28, -269, -533, -80, -476, 282, -336, 125, - 104, 464, -8948, 849, 171, 1518, -296, 51, - -27, 3097, -5103, -412, -494, -194, -713, -1277, - 102, 1740, -445, 3432, 1180, 6404, -10908, -970, - 31, 142, -242, -79, -78, -76, 124, 1031, - 83, -55, 1522, -613, -32768, -394, 1306, 287, - 701, -4725, -1085, 415, -122, -538, -675, 82, - 116, -728, -99, 500, 659, -329, 292, -106, - 9243, -340, -11933, -498, 341, -825, -401, -402, - 142, -13, -309, -722, 141, 0, -681, 494, - 671, -1210, 1466, -1335, 11743, -280, 1616, -11481, - 52, 317, 902, -653, -967, -494, -162, -685, - -438, 756, 81, -207, 577, -7476, -353, 918, - -31, -107, 181, 523, -46, -752, 373, -908, - -1808, -916, 632, 1508, -35, -6943, 64, 13072, - -655, 163, 1221, -1655, -2568, -446, -401, 470, - -622, -944, 3744, -458, 203, 125, 238, 5196, - 21, 12193, 1095, 1091, -787, -1157, -980, -1154, - 7707, -29, 106, 1226, 696, -974, -379, -537, - 56, 95, -477, -528, -11245, -1014, 140, 380, - 89, 540, 84, -619, -322, -572, -240, -26, - 727, 310, 43, -790, -31, -24318, 110, 618, - 44, -108, 89, -191, -33, -201, -490, 43, - -136, 1366, -2, 162, -832, 469, -140, -278, - 600, -15775, -1699, 184, 1825, 728, -1803, -876, - 152, 60, -813, 3063, -929, 972, -282, 718, - 8426, -888, 1383, -664, 571, 958, 982, 236, - -548, 66, 1898, -274, 10715, -1693, 79, -1254, - 296, 609, 682, -1074, 272, 157, -18972, 377, - -12, 438, 536, -672, 292, 719, -464, 1106, - -296, -812, 6, -334, 67, 678, 382, 678, - 301, -22165, 184, 80, -671, -86, 139, -298, - 416, -610, 1057, 15, -230, 376, -768, 643, - 58, 27, 178, -742, 60, -500, 485, -19923, - -1016, 717, 1126, 287, 2171, -388, 1453, -21, - -268, -1555, -263, 713, 1709, -1103, -10699, 1788, - -8, -501, -892, 11476, -2006, 466, 8070, -286, - 163, 35, 494, 76, 1428, -2249, 100, -1542, - 319, -214, -701, 10130, -294, -11962, -656, 227, - -512, -1014, 213, -600, -720, 63, -180, 1286, - 1063, -9671, -1056, 1269, 1484, 20, 790, 29, - -9906, -373, 608, 361, -659, 43, -1034, -96, - -219, -65, 392, -19615, -464, 212, 820, -182, - -227, 463, 301, 642, -219, 386, -1170, 108, - -5583, 422, -507, 530, -1058, -131, 20, -14487, - 101, -14, -415, 32, -1133, -917, 944, -832, - 580, 2509, -959, 470, 1184, 432, -1238, 193, --13382, 2329, 1993, 1035, 80, 3139, -553, 1683, - 390, 1480, 642, 564, -11173, 422, -984, -559, - -686, 168, -777, -810, -1278, -427, -96, 1691, - 29172, -435, -50, -968, 221, 685, 52, -373, - 525, -563, 350, 528, 305, 705, 313, 612, - -254, -220, -1638, -156, 24, 109, -893, -697, - 245, 2579, 667, -142, 12315, -694, 3799, 5, - -438, -473, -426, 59, -5381, -56, 200, -280, - -276, 96, 435, 729, 336, 123, -714, -372, --12609, -12053, -238, 223, -242, 230, 663, -645, - 98, 515, 3, 724, 510, -48, 1090, -173, - -5024, 536, 635, -143, 702, 172, -196, 164, - 190, -152, -180, 238, -142, -329, 191, -296, - -416, 11775, -496, -95, 392, 994, -584, -925, - -963, 286, -458, 3104, -1990, 968, -1430, 998, - -407, 28485, 436, 42, 378, -210, 148, -149, - -532, 94, -628, 186, -186, -274, 250, -316 -}, - -.cb1616s0 = { - 5604, 1491, -2064, 1321, -2846, -3007, -1899, -896, - 556, 1969, -2225, 18515, 4156, 1333, 3489, -2168, - 1897, -1440, -1514, -13837, 1017, 4797, 453, -2101, - -6822, 923, 185, 754, -201, -4151, 126, -793, - -437, 2474, 4286, -6405, 4007, -1644, -757, -13106, - 2460, -1874, -1867, -1099, -5146, 2945, 2162, -4427, - 1692, 763, 1756, -821, 66, -348, 2001, 702, - 1046, -1365, -570, 1073, 32655, -9, 450, -761, - 908, -200, -572, -1306, 2589, 2406, 1926, 1772, - 11042, -1989, 3914, -1192, 1817, -11710, 2985, -2942, - 15684, 1919, -667, -1267, 5212, 444, 864, -3844, - 438, -2382, 974, 983, -887, -822, 185, 245, - -3192, 1030, 1441, -28152, -2616, -380, 300, 1990, - -94, -999, 285, 553, 2107, 960, -859, 1001, - -1632, 2208, -1302, 1331, -3956, 10593, -1931, -4486, - 9376, -6587, -463, -3605, 2460, 1306, 2, 1987, - 1643, -552, 1327, 1124, -581, 1347, 650, -29514, - 278, 1062, 1459, 951, 2416, 396, -594, 930, - 434, 3308, -2816, 5466, 4831, -2869, -68, -894, - 58, -13036, 210, -1940, -2524, 1139, 2044, -32, - 969, 2187, 516, 581, 8185, 2080, 176, -708, - 1529, 1132, -675, -1384, -10949, 1174, -5245, 580, - 7490, 3258, 4314, 2706, -13676, -1735, 1937, 577, - -108, 2676, 612, -966, -966, 3255, 1401, 1443, - -1850, -252, 9270, 5037, -1492, -1957, -2134, 1198, - 3470, 10482, -468, -671, -1655, -955, 3248, 3360, - 448, -1854, -25145, -2771, -3318, 561, -672, 1791, - 2194, -598, 1673, -420, 547, 122, -160, -172, - 1686, -397, 1187, 11, -879, -58, 323, 180, - -2588, -2139, -1794, -2924, 999, -26969, -1280, -1401, - -770, 6159, -4449, -4174, 5270, -4813, 4139, -2023, - 2694, 2884, 3418, -5948, 3118, -1176, 4691, 8566, --32768, -681, -553, -216, -216, -931, -507, 579, - -932, -740, 349, 81, 2120, -1222, 564, -1576, - 1241, 159, 2579, 3236, 19205, -744, -1727, -1803, - 1247, -575, -261, 261, 540, -255, -60, -1428, --14184, -5194, 863, 997, 1043, -828, 466, -12553, - 2106, 56, -566, 1142, 401, 1360, 2322, 629, - 937, 2954, -10086, -12, 2554, -5760, 523, -15184, - 636, 156, 165, -2638, 1134, 658, 4398, -1385, - -1924, 1179, 3222, -908, -1153, 18082, 1011, 1948, - -1007, 352, -172, -6446, -22, -228, -264, 73, - 76, 2229, -1349, 6103, -11588, 576, 3374, -1616, - 7904, 3146, 984, 1056, -1626, 3113, -3674, 203, - -452, -938, 2074, 2409, -1228, -8186, -2766, 11098, - 1598, -8658, -735, 556, 1610, -7419, -5267, 1158, - 2841, 4497, 7551, -2066, 1105, 761, 2549, -1764, - 2870, 3889, -1478, 1912, 2504, -1417, 963, -14602, - 579, 28, -2953, 1589, 3962, -1372, -3304, 566, - 2687, 9700, -2464, -13110, 3005, -772, -3775, -138, - -4244, 5031, 2523, -2883, 582, -446, -274, 3311, - -157, -784, -948, -292, 3085, -781, 954, -2133, - -6693, 13909, -2236, 416, -2589, -3194, 668, -1988, - -2234, 2365, 1034, 1201, -100, 1688, 372, 156, - -254, 931, 576, -4680, 566, -1823, 294, 1645, - 27678, -1353, -1230, 1744, 570, 1679, 608, -35, - -7150, -4383, -11992, -2910, -2096, 512, 1838, 3129, - -410, -2306, -551, -3904, 4140, -12782, -1743, -106, - -4190, -5554, 12975, -573, -3532, -4050, 15, 1307, - 62, 1643, -1988, 5774, 2064, 4734, 1009, 2038, - -2794, -2704, 2275, -279, -1588, -910, 31315, 1249, - -1642, 78, 164, -260, -878, 698, 1189, 159, - -6137, -1994, 775, 3484, 1635, 1121, 4391, -5883, --11300, 3722, -422, -2180, -3206, -3181, -1490, 291, - 1326, 399, 1952, -8405, 2240, 175, 3541, 4258, - 1518, -781, 1105, 498, -348, 771, 15918, 120, - 379, -2036, -3723, 10948, -1827, 3220, 40, 210, - -294, -813, -2349, -707, 967, 953, 2625, -13614, - -1519, 9454, 11606, -903, 817, 6237, -8878, -160, - -1768, 444, -2812, -1697, -1010, -964, 1846, 2997, - 2633, -1924, 501, -1464, 2402, -986, -1143, 527, - 1187, -929, 20923, -563, 785, -486, -940, 1625, - -796, -697, 348, -428, 1451, 1087, -2252, -2481, - 939, 890, -2508, -1357, -1868, 1395, -6386, -21986, - 2574, -384, -324, 7752, 2996, -641, -7903, -5745, - -4226, -4178, -4394, 9307, 3906, -227, -496, 4556, - 1099, -838, -2546, 1190, 9937, 11057, 3846, -156, - 433, -2873, -1769, 36, 3188, 4490, 4369, 4714, - -4681, -2804, -1525, -947, -5064, -4180, -1348, -1404, - -1097, -3922, -1088, -444, -13636, -1547, 1685, -1625, - -8494, 2492, -72, 9893, 2470, 705, 105, 5609, - -5403, 846, 90, -688, 1184, 6286, -253, -1610, - 3348, -2082, 8838, -2453, -1315, -1235, -719, -4607, - -2138, -5522, -10466, 1900, 1541, -2688, 729, 368, - -8845, 1282, 438, -2532, -2328, 4833, -6145, 4037, - 3584, 7965, -1495, 6999, -5037, -1364, 7095, 4253, - 2711, -8336, 3946, -1347, 192, -820, -328, -1152, - 1554, 869, 5053, 9707, -5888, -4294, -3858, -3344, - 8344, -644, 1750, -1796, -149, -3706, -14823, 656, - -1487, -2466, 640, -2286, -2902, 2906, 44, 211, - -336, 29976, -298, 2092, -688, 1857, 1807, -1705, - 3211, 425, -1046, 128, 1191, -1966, -726, -3040, - -3632, 1212, 2986, 5266, 1086, 3624, 3068, 422, - 989, 24479, 3791, -2229, -3713, -2379, -1370, -1799, - 2742, -3259, -4973, -626, 2287, 5655, 663, -918, - 13266, 7762, -1131, 2490, -3123, 2869, -846, -2828, - 119, 14540, 4588, -2784, -3713, -2547, 3698, 3189, - 3372, -5436, 856, 4382, 4124, 3406, -336, -911, - -137, 4268, -4436, 1566, 1169, -3020, 13980, -162, - -7226, -2550, -946, -2408, -1056, -587, -273, -932, - -219, -8021, -1086, -2587, 3852, 1235, -22, 222, - -1100, -1594, 137, -1985, 10225, 4998, -348, -450, - 6651, -2217, -7705, 2508, 10061, -4512, -2262, 6156, - 2962, 150, -2456, 1089, -927, -609, -3130, -1682, - -1215, -9251, -130, -3776, -309, -13872, -276, -6922, - -82, 2660, -1255, -6562, 2640, 2646, 422, -84, - -6020, -11551, -1710, -3462, -2666, 12510, 3145, -218, - 2956, 447, 30, 2268, -2410, -1400, 660, 431, - 3068, 258, -2862, 3919, 2693, -744, 3070, -2179, - -1192, -932, -2095, -279, 2045, -8205, 15263, -4415, - 2116, 4047, 10308, 3110, 1368, -1547, 10919, 988, - -81, -907, -1728, -1052, -3539, -4769, -2576, -1038, - 9255, 152, 431, 2455, -1544, 1880, -312, 2724, --13336, -4197, -1199, 709, -695, -1687, 442, -2564, - -1626, -1888, 1870, 3539, -2922, -3506, -7890, -5486, - -1640, 2178, 2173, -3200, -4626, 1116, 13161, -5221, - -852, -1047, -3328, -3975, -4441, 2870, -1458, 5664, - -28, 3853, 1809, 2721, 658, -15262, 3611, 3223, - 595, 44, -5327, -2486, -1806, 606, -2474, -1236, - 983, 1741, -8390, 1948, 1875, -1806, -6294, -814, - -747, 2209, -1332, 2058, -1326, 5808, 1113, -10765, - -584, 4038, 1412, -3356, 24, -12826, -4322, -2287, --10793, 3008, -6903, -1273, 1590, -608, -514, -309, - -144, -2024, 1822, 4375, 1122, -631, -76, -595, - 192, -11323, 8168, 10180, -646, 2478, 4516, 1095, - 94, 6, 1251, -658, 2620, 626, 3078, 727, - 7769, 966, -3593, -6990, -2358, 1022, 1288, 2733, - -259, -291, 2482, 297, -1268, 10338, 739, -1862 -}, - -.cb1616s1 = { --12873, -2429, 6659, 4401, -2250, 1684, 1508, 1780, - -1081, -10, -6012, 895, -2373, -1263, 125, 1448, - 4744, 1556, -7267, 2354, -11368, 1155, -7699, -1424, - -914, -591, 2472, 538, 1431, 953, 5, -3066, - -1063, 3, 406, 979, 922, -668, 1633, 2, - 649, -139, 964, 860, -18807, 1944, 2183, -1358, - 1395, -1167, 5369, -3525, 735, -2698, 10556, -1137, - -3979, 1383, -1997, 5995, 6465, 2310, 1781, -311, - 3376, 7199, -2745, -1656, -5702, 3180, 3017, -5673, - -712, -8902, 2058, -570, 170, 2276, 3869, -9332, - -7965, 1130, 2111, 5638, -1507, 2944, 1574, -919, - -1459, -970, 11093, 544, -2952, -146, -4684, -303, - -528, -1199, -890, -2720, -1665, -10952, 373, 1657, - 1960, -1386, 299, -4356, -4527, 8948, 7378, 1580, - 1301, -6057, 7650, -7399, 4646, -1768, 2756, -263, - -286, -334, 1369, -786, -3760, 824, -13524, -5099, - -1693, -347, -1821, 1992, 3462, 1421, 4900, -462, --13331, -1617, -2350, 4083, -8721, -5880, 4900, 2912, - 235, 10369, -1340, 776, -2598, 14344, -3805, -568, - -3788, 3591, -394, -1077, 3908, 6080, 1953, -1454, - -1013, 507, 10097, 3396, -4662, -763, 2506, 1486, - 3088, 580, -86, 1117, 1606, -3454, -10782, 4870, - 6170, 4020, -5675, 6848, 439, -8765, 3877, 6250, - 734, 3245, -874, -4312, -879, -4368, -1287, 3212, - -2130, -1435, 1619, -280, -3082, -1070, -18921, 940, - -2428, -1548, -1142, -271, 193, -240, -890, 918, - -4350, -5042, -8994, 5060, -6495, 3455, -259, 892, - -1290, 1348, -1049, -12681, -49, 18286, 75, 791, - 1830, -4116, 10240, -12, -459, 2477, -2582, -3344, - -1598, 982, -324, -48, -4229, -8476, 11120, 100, - -6238, 1164, 2369, -2052, 247, 626, 2213, 2279, - -2627, 289, -471, -1136, -1818, 15413, 579, 1034, - -6835, -8645, -12667, 758, -932, -4398, 565, 458, - -2024, -4050, -3100, 1897, 1324, 3191, 1876, 7660, - 385, -1066, -1539, -1317, -2632, 766, 63, 389, - -189, 1136, -653, 802, 755, 70, -29812, 640, --11953, 10901, 2078, -529, 10373, 2509, -2776, -104, - -2232, 174, -837, 158, 1507, 1963, -273, 1534, - 1084, 8469, 2568, 12662, -2276, 2808, 2052, -7430, - 434, 3777, 991, 664, 2724, 1631, -3632, 2099, - -582, 4140, 757, 11248, 540, -1425, -10204, 1604, - 600, -2034, -1060, 977, 1843, 3831, -933, -816, - 2975, -6413, 1589, -915, -696, 2155, -556, -17893, - 3348, -1239, 1014, -2539, 1588, -320, 2402, -1485, - -8062, -1046, -1458, 200, 1323, 357, -3752, 2836, - 5774, -11638, -913, -648, 1676, 246, -1277, -1065, - 2334, 14911, 228, 880, -2172, 3072, -2520, 1445, - 1442, 2568, -1254, 730, -1950, -192, 12003, -1587, - 2558, 714, 33, 4324, -4642, -231, -279, -255, - 17824, 1292, 3530, -766, -64, 245, 1677, 1716, - 2507, -3594, -3532, 3000, 1996, -5342, -1868, -5642, - -21, 1132, -1202, 1104, -6543, 1242, 457, -1711, --32768, 49, -458, 295, 858, 2043, 1268, -1257, - -346, 793, 554, 1260, -1082, 985, -1453, 1704, - 2431, -2858, 1466, -5424, -8870, 4714, -1539, 5767, - 110, -2568, -1482, -348, -11580, -2838, 1213, -599, - -1591, -3472, -6907, 6191, 3928, 4708, 1326, -1510, - 6322, 3849, -4112, 7689, 5976, -3298, 372, -5450, - -2208, 6564, -6915, 911, 4216, 1682, -739, -2146, - 203, 350, -816, 351, -3386, -3016, -15045, -10824, - -553, -4969, 138, 256, 1672, -1840, 2851, 15838, - 2934, 1871, -600, -3293, -845, -2696, 1463, -1075, - 720, -1177, -1538, 2415, 7315, -484, 1082, 962, - 766, -845, -10687, -5932, -4410, 3840, 362, 194, - -4576, 10209, -3548, -127, -1202, 246, -734, 770, - 311, -3126, 772, -2422, -1141, -12330, 960, 1567, - 2816, 80, -4414, -778, 665, 2308, -420, -180, - -1242, -423, 12138, 113, -1477, 2899, 214, 348, - -927, -764, 26, -1127, -2288, -32768, 1302, 394, - 646, -453, -946, -838, 1649, -2292, 1182, -1558, - -6413, -265, -1942, -3467, 1863, -3526, 3446, -863, - 886, 202, -202, 15706, 2226, 1763, 894, 936, - 16191, -693, 1682, 6678, 1742, 1365, 700, -1765, - -803, 299, -2194, 1259, 689, 1670, -635, 28, - 11890, -14, -878, -5439, 103, 11124, 528, 1179, - -62, 868, -664, 749, -1128, 1429, -485, 1920, - -866, 1176, 1051, 379, -29470, 2354, -252, -1648, - -412, -804, 1339, -383, -812, 959, 893, -1741, - 1462, -1868, 470, 2112, -1889, -2236, -1668, -755, - -2562, 1354, 6183, -10964, 5651, -1062, 2550, -6225, - -194, 1687, -782, 1568, -85, 10, -8, 1128, - -521, -1090, -1933, -3441, -2698, 3049, -5822, 20847, - 710, 789, -1872, 1082, -1242, 4152, 1624, 10795, - -2149, -134, 1087, 900, -7943, 5178, -3429, -11622, - -3617, -7444, -824, 3462, -579, -830, 1010, -3301, - 12202, -5446, -1763, 340, -744, -509, 554, 1140, - 12266, -1328, 4652, 992, -1931, -708, 1074, 2762, - 2931, -414, -217, 10166, -4167, -903, 660, 1000, - 27, -1037, -1532, 1308, 8655, 9087, -2998, 9928, - -3722, -556, 4812, 3062, 600, 1281, 3879, 114, - -5404, 1869, 2174, 2083, -11631, -301, -3609, 2443, - 2300, 4863, -838, -29, 2166, 1319, 2110, 1387, - -741, -1225, -1729, -13536, -7376, -1520, 619, -4919, - 2517, -4338, -1650, 475, 456, 4372, 792, 3224, - 1963, -547, -2071, 2142, -254, 1549, -6846, 2430, - -96, 19844, 595, 1197, -1367, 2019, 2014, -1547, - -3775, -1186, -9690, -394, -4106, -1728, -1036, 2945, - 509, 14242, -1893, -2494, -3004, 458, -1753, 2628, - 9790, 3450, -1652, -322, 8263, 3952, -2156, -2110, - -442, 1256, 1561, -4913, -3452, 74, 3051, 8907, - -3376, -96, 16654, 557, 520, -446, -2520, -1712, - 2151, -2423, 3761, -3507, 487, 2103, 777, -416, - 509, 468, 3629, -3155, 11460, 2106, -2191, -1014, - 1154, 9317, 704, -282, 3098, 2722, 84, 150, - -5922, 3063, 8373, -11896, -1157, -2286, -1781, 7331, - 1331, -334, -974, -1653, 752, -1970, -89, -3470, - 2418, -1334, 3615, 12770, -116, 1965, -1643, 1480, - -2225, -10686, -1174, 530, -972, -933, 719, 722, - 1530, -317, 105, -14155, 2569, 4506, -8502, -681, - -1544, -542, -2814, -1161, -629, -1776, -3540, -1366, - -3681, 1838, -1630, -703, 12613, -12335, -2020, 2173, - 27, 315, 4766, 4590, -1603, -68, 1154, -2940, - 1198, 7884, 2502, -586, 440, -5124, -2454, -2597, - -826, 7401, 2803, 4552, -3212, 2966, -5567, 588, - 2216, 7444, -2633, -5922, 434, 3423, 4084, 2296, - 13258, 2070, -4624, -1226, 166, -367, -527, 1110, - -1407, -150, 140, 584, -373, -2649, 862, 500, - 3292, -3506, -679, -20109, 1775, -726, 3378, 754, - -1962, -5764, -1338, -3628, -691, 4554, -1890, -6021, - -6566, 2590, 262, 2509, 257, -4386, -2480, 6352, - -2026, 1234, -399, 22808, -2221, -626, -714, -339, - -1196, -455, -80, 713, 1662, 474, -2324, -527, - 4101, -10526, -4617, 10492, -1143, 805, 1360, 3796, - 942, 684, 2596, 1313, 1589, -570, 5476, -27, - 9220, -1493, 2631, -6726, -2976, -14295, 137, -734, - -2015, 658, 323, 83, 2539, -1230, 1714, -2080, - 658, -18803, 2978, 996, -3374, -28, -1335, 150, - 2154, 1069, -852, 293, 535, -1004, -993, -3692 -}, - -.cb1616m0 = { --16476, -11442, -305, -196, -767, -2167, -1, 378, - -2200, 22, 2405, 944, -1786, -806, 669, 952, - 10435, -2752, -1625, 1060, -12314, 1283, 234, -2405, - 627, 798, -1058, 311, -2794, -2715, 73, -214, - 813, -2749, 10732, -445, -12147, -2507, -1972, 1652, - -1920, 215, 298, 1106, 826, -7445, 69, -1679, - -675, 1249, 1444, -1109, -48, -1452, -2368, 3034, - -492, 13068, 311, -3446, 326, -1426, 2384, -2146, - 2916, 8957, -196, 2212, 447, 1775, 2607, -11962, - -278, 4335, -1743, 135, 212, -41, -92, 164, - -11, -504, 828, -519, -834, 251, 1919, 762, - 24917, -180, -132, -330, 138, 225, 1038, 3, - 32138, -388, 208, -638, -1338, -165, 200, -230, - 225, -777, -2270, 8198, 583, 3946, -1534, 1666, - -1032, 11384, 202, 30, 2758, -505, -2815, 1265, - 64, -17, -360, 636, 134, 502, 259, 872, --28148, -1046, -348, -86, -739, 55, 448, 168, - -656, 1094, -1074, 4552, -834, 2296, 2356, -572, - -1917, 10979, 3127, -52, -9969, -527, 1994, -1626, - 1041, 3310, -2319, 2232, -11444, -2400, -1788, -1254, - 5265, 3198, 7088, 4522, 1292, -191, -15886, 2787, - 22, -1610, 184, 380, 521, 336, -158, 877, - 468, 6515, -756, -5484, 100, -464, 9244, -2726, - -1644, -2741, -5362, -1635, 894, -1849, 10118, -3264, - -4472, 1255, -3571, -437, -1050, 1505, -11178, -193, --11513, -24, 719, 212, -1999, -725, 502, -1164, - -1060, -618, -91, -738, 740, -2254, -4635, 2700, - 95, -853, 1093, -11620, -968, 9492, -25, -664, - 367, 1105, 5501, -112, 7516, 10286, 821, -484, - 204, 1425, -3491, -1234, -4240, 3807, 2877, 1824, - 423, 466, -428, -845, -86, 13276, 8436, -690, - -688, 574, -2874, -552, 4540, 926, -5443, 629, - -395, 2090, -17468, 335, 2419, 1275, -3750, -1589, - 470, -1735, 330, 2532, 1094, -6218, -884, -236, - -9678, -9945, -447, 542, -728, -1922, 108, -2193, - -946, 3270, 2121, 2624, 1010, -10742, -102, 2813, --13070, 1523, -1532, -1291, 420, -1999, 262, -1194, - -4226, -1450, -275, 83, 1168, 1590, -1517, -426, - -1424, 152, 676, 11463, 824, -2092, -1106, -11502, - -2327, -278, 2597, -11, 793, -118, 393, 580, - -499, -743, -77, -427, -408, -692, -29195, -247, - -2014, -922, 97, 581, 5469, -1419, -698, 1490, - -3814, -2818, -13816, 680, 3595, 1544, 2366, -3018, - 2479, 323, 346, -260, 337, 2730, 12214, -1118, --11301, -3028, 212, -41, 1764, -580, 553, 5454, - -8, -366, -1202, 901, -796, -8350, 4380, -1452, - -300, 1152, 3058, -3476, -27, 13046, 34, -11438, - -1321, -1528, 13237, 114, 2514, 976, -571, -1192, - -2050, -1635, -964, 416, -23, -1083, -9, 32767, - -548, 556, -1217, -56, 325, 1048, -145, 202, - 1520, 44, 402, 400, -611, 8667, -1083, 1068, - 1224, -12031, 2318, -1109, 1266, 1306, 4673, 285, - -5603, 1555, -100, -1059, 403, -213, -680, -904, - 11443, 581, 12160, -638, 309, -65, 933, -2280, - 1958, 2642, 1808, 7945, -2088, 850, -428, 785, - -989, 1234, -1413, 745, -10756, 1943, -184, 3252, - -96, 932, -664, 13222, 11326, -1374, -327, 1901, - 1069, -1540, 104, -139, -904, 106, 1664, 925, - 46, 353, -835, -554, 1618, -956, -437, -727, - -3403, 1038, 968, 436, 46, -4385, 340, -16903, - -498, 47, -554, -399, -2418, -347, 358, 23280, - 234, -172, -338, 1058, -2172, -1, 1710, -64, - -583, -2224, -780, -637, 3500, 108, 1045, 828, - -728, 9466, -2487, -12773, 1924, -1158, 208, 49, - 136, 12055, 42, -1381, -375, -11534, -249, 1602, - 996, 204, -710, 4761, -511, -15761, 166, -1184, - -192, 50, -105, 890, -9566, 2062, -1536, 133, - -185, -643, -172, -894, -355, -16, -1395, 542, - 2160, -481, -1104, -793, 517, -20454, 698, -181, - -135, -434, 1677, -181, -415, -738, -1574, 1664, --14058, 597, -12354, -460, -313, 1724, -686, 85, - -1162, -648, 865, 165, -225, -1947, 2818, -778, - -4010, 402, 686, 11170, -332, 10336, -757, 4794, - 2204, -477, -292, -366, 8412, -2476, 494, 510, - 10514, 769, 642, -441, 1079, 6954, 4246, -2272, - -290, -224, 1312, 398, 1536, -692, 330, 157, - -946, -100, -1830, 214, -25652, 1382, -1836, -440, - 110, -506, -438, -2370, 126, 562, -3515, 1014, - 8526, -1641, -2493, 4411, -9210, 2110, 625, 114, - 323, 2450, 2407, 682, 1999, -9424, 2480, 69, - -2091, -11845, -3684, -429, -1622, -919, -518, 70, - 1450, -3523, 5126, 5706, -1451, 2633, 820, -204, - 11338, -8014, 753, -103, 290, -923, 1408, 298, - -1962, -887, 9691, -1366, -11048, -55, -223, -1040, - -163, 132, 676, -760, 4990, -310, -9286, -2427, - 14442, -418, -802, -359, -323, 2877, -210, -1436, - 1574, -1206, 265, -155, -225, -32768, 347, 222, - -1165, 200, 924, 1135, -843, -66, -343, -334, - -113, 209, 14, -203, 1214, -896, 910, -1496, - 1831, -7833, -841, -10453, 1605, -8514, -477, -48, - -241, -58, -32768, 213, 108, 450, 1155, -30, - 89, 240, -768, 1332, 290, -1377, 951, 586, - -8939, 1298, 496, 705, -1661, 1798, -1906, -2233, - -1716, -986, -2204, -1149, 2686, 8578, 32767, 645, - -661, -135, 770, -432, -550, -385, -272, 625, - 1234, -729, 19, 1753, -284, -106, -655, 750, - -442, 23143, -328, -520, -506, 790, -1048, -730, - -471, -438, 483, -374, 939, -226, -397, -849, --12054, -772, -40, -11776, 232, -540, -2497, -679, - 337, 1357, 458, -341, -7542, 1001, 492, -416, - -1496, -8966, 9814, -1752, -674, 2526, -544, -2900, - -1318, -1578, -238, 75, 11181, 1750, -3182, 564, - -570, 528, 1004, 146, 1144, 7430, 158, 9524, - -36, -340, -441, 596, -1659, 1420, -686, -36, - -596, 2215, -1295, -19722, -2149, -1046, -2339, -1166, - 3057, -370, -556, -33, -322, 260, -23, -106, - -323, 147, -57, 179, 458, 684, -1283, 1251, - 1231, -18548, -513, -480, -695, 593, 3072, 1960, - 322, -702, -1043, -544, 6005, 1378, 100, -225, - -848, -1294, -3346, 828, -2610, -3010, 9623, -1329, - 1956, -1098, -3730, 1137, 12413, -1260, 2457, -10844, - 6824, -4289, -653, -302, -4415, 650, -1684, 6129, - -370, -652, -3245, -473, -150, -3018, 1864, -1258, - 928, -2379, 14451, -119, 2282, -248, 3139, 6502, - 4318, 2214, -1627, 126, -422, 326, -622, -302, - 32252, -268, 456, -260, -260, -968, 391, -497, - 152, 1764, -10580, -369, 277, 70, -13137, -1114, - -1111, 464, 2266, -2968, 728, -1216, 1726, 1044, - 344, -16436, 1558, 3178, -551, 604, 442, -891, - 9570, 1596, -541, -2182, 730, -906, 242, 935 -}, - -.cb1616m1 = { - -116, -53, -24868, -544, -783, 97, -912, -1202, - -622, -147, -215, -362, -16, -522, -1694, -358, - -724, 2628, 439, -18106, -1566, 3048, 4133, -1238, - -3233, -1130, -2884, -2762, 1031, -1037, 63, -2219, - 10701, -1518, -10322, 1425, 792, -1820, 380, -777, - -3017, 1531, -1052, -3491, 1085, -428, -765, -113, - 42, -265, 365, 99, -859, 35, 610, 44, - -495, 262, 1689, 2082, 21605, 412, -717, -1163, - -3285, -5062, -1583, 599, -277, -62, 615, 6014, - -1781, 465, -544, -14114, 11277, -20, 696, 663, - 1156, -240, 631, -2802, 333, -2544, -1628, 775, - -960, -553, 496, -378, 526, -421, -426, 290, - 555, 403, 390, -31714, 25, 449, 654, -334, - -1317, 165, 496, 1554, -88, -777, 626, -1511, - -9020, -1725, 12705, -798, -1240, 195, 1932, -833, - -939, 43, 182, 2547, 4879, 9234, 370, 2058, - -7757, 544, 1106, -660, 546, 9983, 225, 124, - 952, -2153, -1732, 2760, -1270, -176, 3334, -6735, - -526, 10475, -627, 7835, -2263, 475, 731, 908, - 8264, 1605, -192, 5026, 2414, 5223, 595, 1093, - 2345, -796, 8663, 1028, 8188, -185, -1506, -3044, - -100, -1818, -6369, -170, 1728, -9249, 886, -2111, - -349, -1146, 2127, 11622, -8043, 2880, 2215, 1693, - -2303, 1698, 1121, -3575, -927, -716, 1940, 2514, --11672, 1619, 916, -7, -585, 508, -1316, -972, - 778, 9774, -2126, 2368, -56, 6716, 1169, -3656, - -1330, 9530, -12158, 1188, -11426, -353, 945, -1941, - 1750, 962, -1133, 1793, 2318, -2641, 1109, 933, - 804, 505, 60, -1642, -2238, -2328, -1558, -1568, - -27, 952, 4, 1376, -862, -18404, -1828, 4107, - -454, 52, -1202, 1150, 686, -1950, -497, -10883, - 400, -422, 1734, -54, 11165, -3309, 6402, -877, --19967, -400, 1642, 1305, -2432, -3115, 375, 3898, - 1812, -5305, -946, 1717, -757, 3322, 126, 747, - 1836, 9957, 1904, 658, 13043, -1779, 675, 716, - -453, 670, -1572, 210, -1533, -133, 294, 546, --24084, -1036, -485, -117, -184, -624, 273, -901, - 866, 609, -1119, 28, 250, 13, 70, 1178, - 882, -632, -21624, -1339, 926, -1814, -1279, 1868, - -181, 383, -679, -1070, 5091, 1148, 1034, 2144, - -2779, -3810, 4536, 1713, 1003, 13322, 2866, -3217, - 2508, 4395, 480, 14, 167, 763, -34, 1034, - -1342, -1349, -100, -225, 464, -914, -1403, -1851, - 23767, 770, -457, -257, -1072, 1201, 583, -59, - 2627, 1469, -7, -11642, 3352, -1003, -6, 11588, - -311, -2435, -2180, -2352, 1952, 5532, 1945, 7281, - 504, 11882, -603, 45, 42, -1396, -1115, -1041, - -1061, 566, -2733, -765, 687, 118, -1174, -20412, - -244, -986, -151, 2888, 1102, -1303, -135, 529, - 1186, 13220, -183, 906, -4209, -4455, 2247, 246, - -6474, 2794, 1450, -6495, -1819, 598, -438, 244, - -1064, -673, -672, -1563, 543, -2278, -3087, -811, - 1866, 80, -18987, -682, 569, -551, 514, 6876, - 7582, 839, -4031, 823, 2342, -1300, 1180, 702, --10168, -1957, 485, -374, -151, -11066, -461, -12824, - -1221, 1281, -718, 2012, 330, -289, -487, -207, - -722, 394, 156, -2023, -11006, -373, -4, -238, - 10581, 991, -1236, -814, 553, 1295, -2269, 2783, - -1973, 681, 9759, 3674, -1680, -12118, -1340, -2372, - -288, 2143, -328, 809, 312, 2038, 736, -10, - 908, -11319, 74, 6362, -1122, 1546, -184, 1630, - -1851, -2143, 1048, 8858, -462, -6458, -1540, 811, - 130, -3542, -10424, 9353, 388, 1168, -1797, 1796, - -4151, -2329, 1, -272, 846, -642, 248, -1144, - -9863, -1684, -190, 7611, -4147, -692, 5354, -2363, - 609, -4926, 3166, 2094, 857, -369, 118, 725, - -899, -601, -6, 556, -32540, 950, -478, 757, - 136, -560, -754, 562, -448, 223, -704, 616, - 365, 22610, 1191, -1264, -94, 927, -294, -1270, - -16, -2520, -2026, 420, -6621, -504, 9666, 452, - -379, -1888, 536, 1161, -3021, 609, -4890, -231, - 3926, -943, 32767, -615, 300, 870, -742, 429, - -42, 155, 1060, -900, -347, 34, 491, -3625, - -1529, 10175, 178, -7938, -406, 1628, -362, -7340, - -433, 489, 568, 674, 536, -2886, -6118, -16, - -531, 182, 1498, -4194, -306, 63, -1429, 1109, - 631, -10386, -16, -5938, -52, 10638, -793, 35, - -874, 1633, -252, 709, -286, -780, 17172, -32, - 912, 137, -1684, 2781, -5637, 338, 10961, 1401, - 176, 1890, 563, -371, 578, -235, -882, -616, - -591, -672, -821, 12194, 917, 778, -427, 358, - -1411, 2032, -1372, 1891, -1784, 1830, -1808, -464, - 13973, 2016, 8606, -914, -7329, -1853, -2627, 2219, - 2628, 2161, 2185, 2414, 8857, -273, 1016, 2253, - 1070, 907, 367, -430, 574, 1039, 93, 170, - 255, -267, 550, -668, 287, 1827, 19833, 244, - -3731, 4, 21365, -127, 356, 643, 2016, 3290, - 1242, 46, -734, -2298, -316, -6618, -296, -1465, - 657, -1451, 469, 212, 2823, -2803, -11862, 931, - 44, 660, 1576, 1848, -10529, 2813, -1163, -260, - -195, 16320, -3447, -262, -76, -439, -3487, 1292, - 3330, -616, 1477, 1900, 8843, 81, -846, 6845, - -95, -112, -231, 129, 6982, 165, -3115, 2456, - 2032, 12201, 2747, 1691, -728, -1935, -239, 968, - 15578, -2260, -1813, 440, 2188, -3845, 1278, -136, - -1388, -7850, -462, 2921, -1740, -136, 164, 103, - -206, 32767, -459, 1249, 736, -590, -797, 628, - 612, 327, 396, 552, -128, -76, -258, -557, - 429, 170, 532, -347, 169, -593, 28319, -633, - -1339, -997, -258, 324, 628, 3254, -1118, 8902, - -63, 4762, -2820, 2429, 820, -46, -5366, -2193, - -9005, -1304, -597, -10143, 555, -3000, 294, -1577, - -871, -140, 726, 3700, -2226, 903, -253, 10330, - -2946, 656, 725, -668, -920, 1653, 1312, 1623, - -1150, -11970, 2157, 4532, -340, -8648, -616, -1429, - -980, -30, 647, -474, 442, 5098, 188, -1258, - -8172, -10927, -4207, -112, 2501, -3241, -1949, 159, - -525, 1090, 420, 10418, -11897, 1072, -78, -1028, - 3367, -2647, 3421, 2021, 2358, -973, 272, 27911, - 472, -402, 1397, -927, -1032, -1274, 848, 221, - -2745, -710, -692, -409, 1922, 142, 594, 1053, --11350, -791, 3767, 1569, 541, 11921, 134, 368, - -948, -2689, 896, -1193, 1190, 8514, 1436, 1017, - 599, -3358, 4002, 12936, -675, 1044, -1210, 296, - -1109, 1992, 1282, 774, -13102, -608, -11145, 134, - 278, 944, -888, 350, -1574, 189, -2542, 3476, - -3018, 3368, -9304, -1839, 533, -2, 1057, 686, --11819, -1146, -973, 1594, 3526, -2890, -1528, 3489, - -475, -259, -9610, -475, -984, -3559, -742, 408, - -130, -2291, 899, 12177, -1934, -162, -3238, 1610 -}, - -.cb2220l0 = { --12528, 350, 1782, -474, 1439, -14269, -8, -1782, - -753, -1720, 167, -440, -2706, 222, -1629, -288, - 671, -111, 10270, 878, 152, 330, -1000, 639, - -1280, 1111, -2072, 1439, -476, 553, -2974, -614, - 1666, -466, 11811, -1393, 154, 624, -697, 176, - 1108, 504, 250, 572, -6, 704, 16, 647, - -1143, -1407, -411, 23745, 319, -189, -404, -641, - -86, -707, -770, -302, 13, -398, 76, -681, - -525, 354, -1225, -757, -23170, -484, -965, -430, - 13477, 898, 505, -17, 13812, -890, 357, 662, - 1000, -935, -60, 944, 400, -432, -221, 1047, - 307, -180, 5260, 16509, 650, -269, 1563, -6002, - -3082, 186, -3334, -5770, 1010, -394, 128, -699, - 537, -27, 1014, -531, -50, -163, -1664, -1026, - 732, -1296, 21856, 574, 416, -745, -443, -1382, - 272, 791, 1308, -308, -1636, 168, -10922, 119, - -1190, 1123, 1492, 1706, 1076, -2016, 3270, -994, - 876, -2316, -2992, 12625, -412, -159, 5249, 1424, - -304, 557, -431, -360, -340, -561, -292, 1748, - -224, 1789, -352, 386, 136, 76, 1309, -270, --24204, -515, 1142, 2119, 1144, -173, 1008, -693, - -430, -1052, 1890, -12483, -11416, 2918, 1591, -1202, - -1782, -1335, 1354, 1703, -510, 4287, -854, 1153, - 2018, -518, -960, 11825, 1295, -563, 11252, 190, - 4078, 222, -3115, 3306, 747, 2638, 1015, -1674, - 8032, -2386, 573, -349, -832, 96, 9564, 11708, - -483, 1326, 1804, -2903, -2024, -234, 1009, 3229, - -232, 803, 275, 444, -629, -192, 381, -1289, - -109, -29019, 270, -420, -408, -466, 113, -537, - -266, 296, 180, 506, 1015, -565, -517, 1494, --11053, 3968, -1735, 3474, -1991, -8326, 8075, 1740, - -3995, -1287, -2558, 1030, 3742, -618, -2600, -1783, - 2696, 1480, 1054, 341, 3762, 4225, -1742, -11582, - 4348, -8756, 493, -404, 3840, -1049, -683, -962, - 163, 10997, -97, -848, -4632, 2794, 2684, 2540, - 739, 8534, 3688, -878, 3138, 2576, 6444, 3674, - -2371, -218, 2864, 12270, 2866, 189, 4549, 4894, - -6378, -1050, -3166, -5897, 2245, 2803, -70, -1909, - 2783, 3951, 153, 11221, -658, 12780, -238, 3418, - -2235, 754, 311, -739, -2414, 702, 1076, 303, - -320, 47, -3288, -234, -1376, 3022, -103, -1780, - 716, 11886, 10942, -5402, -5431, 1196, -624, -885, - -652, -3248, 74, -435, -686, 154, 8675, 3325, - -1779, -341, 564, -901, 1335, -639, 3494, -1820, - 290, -92, -3088, 4775, -2140, 2334, 710, 10536, --15042, 14823, -1082, -1045, 1008, 734, 241, -1048, - -933, 245, 913, 114, 322, -1798, 246, 1067, - 348, 408, -183, -728, -12915, 685, 1525, 1694, - 183, -168, 12703, -1268, 1613, -2072, 1546, 743, - 2356, 2135, -550, -153, 1327, 2, 12487, -3111, - 2347, -1722, -300, -193, 2222, -1928, -658, -384, - -5738, -1141, 3634, 10312, -69, -1549, 10879, 1795, - -361, -1838, 143, 1202, 327, -15549, -1268, -194, - 3284, -12, -344, -2042, 1663, 334, -798, -873, - 1736, -324, 195, -417, -382, -22936, 812, -478, - -962, -451, 730, 382, -135, 1311, -290, 122, - 148, -775, -305, -32218, -84, 98, 374, 369, - -44, 923, -432, 156, -1471, 236, -39, 143, - -146, 835, 135, 229, -297, 1690, 6786, -12169, - 815, -176, 1868, -9, -3052, 108, 114, 260, - 11337, -2689, -132, 765, -239, 54, 691, -9737, - -627, -474, 12212, 2222, -7595, -239, 1793, 2115, - 563, -2390, -1991, 2906, 675, 923, 146, -3605, - 981, -1725, 92, -562, -21192, 304, -450, -323, - -889, -726, 688, -1186, 2590, 466, 326, -734, - 308, -782, -3219, 963, 454, 1348, -513, 953, - -1414, -320, 1012, -1148, 1185, -17356, -15, 1546, - 1346, 2182, -2457, 1426, -1690, 155, 8793, 1394, - 510, 2608, -203, 2697, 608, 2612, -13542, 177, - 4642, -824, 1877, -1864, 1681, -1033, 1487, -749, - 356, -11, -1, -366, -215, 1531, -38, -922, - -378, -296, 1245, 19967, -2389, -459, -3729, -163, - 6578, 354, -1471, 195, 353, 1831, -605, -2291, - -359, 947, 8409, 3454, 12416, 2434, 3485, 40, - 350, 1640, 738, -9827, 935, -171, -944, 1407, - -399, 571, 2805, -13108, 784, 678, 2405, 328, - -417, 1188, -1596, -649, -1358, -1130, 341, 202, - -2459, 11307, -2250, -3518, -1812, 3338, -924, 10027, - 3004, 703, -184, -666, 223, -1644, -7221, 3507, - 10108, 1324, -412, -371, -92, 2496, 3182, 10, - 10269, -998, -1010, 610, 3296, -1842, 407, 406, - -1609, -181, 2202, -662, -1450, 1360, 1488, -212, - 1501, -214, -555, 168, 275, 301, -950, 3272, - -323, 20632, -21, -1729, 11013, 2149, -9278, 6735, - -593, -7374, -430, -2776, 2343, -1374, 519, -4876, - 827, -2477, -1971, 1249, -23380, -1810, 199, -761, - 2182, 1654, 447, -488, -1219, 364, -53, -382, - -989, 154, -545, -872, 776, -211, 7706, -767, - 8006, -138, 1989, -180, 306, 486, 1112, -648, - -12, 1538, -300, 2458, -5833, -1181, -7680, -6700, - -621, -308, -29995, 602, -24, 94, 752, 517, - 86, -249, 1058, 704, -404, -387, 106, -632, - -159, 1275, -197, -1263, -1210, -1689, -10488, 1950, - -2037, 5974, -3960, 38, 1284, 2851, -2813, -1613, - -1646, 10164, 138, -2956, 196, -118, -484, 860, - 124, -262, 30, -1448, 128, 287, 327, 590, - 27272, 391, -738, -1631, -481, -1511, 82, -574, - -737, -614, -447, -80, 292, -19, 252, -2, --28117, 332, 141, 1485, -154, 1382, -1755, -422, - -1692, -2144, 910, 1004, 1894, -1537, 897, -458, - 19483, -1321, 2280, 622, 288, -2253, -1001, -976, - -408, -394, 132, -250, -428, -22, 140, 287, - -141, 30981, -293, 631, 729, -2, -231, -127, - 377, -879, -294, -107, 253, -964, 1258, 570, - 71, 9421, 8358, 9295, 8354, -546, 1153, -1807, - 1577, 2911, -1808, 1808, -1631, -1348, -6977, -382, - 1625, -2793, 10633, 1977, -1793, -12480, 1, 2010, - 23, 423, 1102, -1920, -478, 1845, 1016, 465, - 758, 800, -1540, 5448, -10472, -2749, -989, -6362, - 9283, 373, -2560, -5478, -1618, 20, -564, -1074, - 4075, -471, -515, 409, -2069, 359, -788, -11618, - 2524, 917, 2757, 243, -3261, 6922, 6268, -3148, - -2804, -3412, -4262, -1903, 1043, -12255, -162, 1598, - 496, 454, 1401, -1635, -12711, -673, 3392, 1255, - 1602, -1206, -297, -2066, 3009, 1149, 1285, -1307, - 412, 27971, 183, 569, 1304, -706, 824, -635, - -358, -340, -28, -1344, 955, 14, 676, -243, - -20, -11947, 1350, 8122, 196, -10161, 4925, -3764, - 1661, -401, 145, 253, 680, 718, -614, -613, - 498, -293, -4257, -684, -14853, -10522, 698, 1537, - -2016, 1162, -2684, -1578, 8, -238, -3214, -2749, - -1577, -1187, 113, -1457, 1068, 590, 25, -644, - 1000, 2430, -1612, 13246, -2684, -1642, -4648, 816, - -1103, -7556, 5753, -3998, -1338, -776, -1958, -9652, - -1288, -290, -4240, -2788, -8191, 1625, 2558, 1238, - -1824, -39, -3129, -8916, -3302, -5632, -1768, 866, - 708, 684, 3530, -8772, 1485, 677, -10398, 686, - -852, -6974, 5286, -2658, 612, 1180, -3367, 4285, - 5708, 1416, 166, 2787, -3697, 1431, 1648, 7942, - -544, -1064, -514, -840, -870, 1246, -3582, -9310, - -3802, 4025, -8251, 5978, 132, -619, 2792, 9786, - 1244, 242, -1948, -4701, -5904, 951, 7486, -3494, - 48, -4468, -2403, 6090, -2343, -4175, 1336, -2546, - -281, -736, -1758, -1720, 11066, -918, -1354, 3885, - -33, -4116, 1246, -218, -8082, -766, 7796, 1505, - 1559, -964, 1741, -454, -1628, -762, 3034, -804, - -888, -9682, 9603, -2556, 2874, -5456, 3066, -7747, - 956, -660, -1538, -381, -760, 1747, 547, -517, - -697, -1411, 410, -514, -3988, -219, 13358, -2393, - -280, 11230, 2640, 795, 2534, -8094, -1838, 71, - 16, -203, 4224, -96, -2829, 2010, 1961, -1312, - -1266, 3952, 6894, 6996, -8062, 4708, 1193, -3439, - 1549, 935, 170, 614, -868, 43, -246, -188, - -940, 130, 126, -736, 697, -510, -56, 1596 -}, - -.cb2220l1 = { --13582, 1049, 15596, -101, 707, 2677, 542, -522, - -636, 194, -2361, -1252, 524, -32, 227, -419, - -652, -601, 84, -10428, -1417, 13117, -573, 3774, - -3632, 2025, -1237, -692, -1486, 192, 1221, 452, - 436, -764, -2636, -153, -685, 118, -424, -635, - -458, 209, -577, -12042, 4240, -10861, 49, -1534, - -991, -2416, -280, 2095, -1841, 1278, -94, -423, - -572, -949, 734, -1087, 12449, 6514, -4582, -7845, - -3722, 1446, 2531, -1238, -2070, 1515, -1331, 2382, - 1066, -1298, -1189, 6811, -1868, -1082, -1732, 356, - -2622, 493, -3345, 1367, 1737, 4497, -14734, -1350, - -354, -1340, 8478, -1152, 1832, 1793, 830, 974, --13918, 522, -1472, -2502, -2625, -157, -360, -17, - -830, 673, 36, -1339, -14860, 522, -13377, 851, - 937, -1103, -44, 408, -364, -953, -392, 1837, - 2342, 1236, 111, -218, -919, 985, 10077, -1065, - 1840, -124, 3780, -11015, 204, 437, -830, 6712, - -1720, 288, -991, 1094, 5647, -1296, -2284, 1642, - 1000, -35, -115, 208, -244, -1099, -832, -2092, - 802, -163, 3343, -964, 314, 126, -1204, 754, --17838, -826, 4414, 8331, -770, 1246, -3500, 1680, - 833, -108, 494, -910, -6314, -2832, 2553, -6230, - 1165, 3631, -1717, 2404, -32768, 520, -38, 1228, - -708, 58, 260, 771, 588, -448, 389, 156, - 606, -830, 400, -488, -188, 536, -1428, 11982, - -156, -1407, 1796, 1036, 905, 1371, -1472, 325, - 3098, -1436, 6449, 2105, -11183, 1632, -1848, 1019, - 1247, 1308, -1351, -823, 1679, -651, 978, 296, - 1088, 3965, -1414, -11838, 139, 8664, -3452, -1804, - 3088, -2044, -221, -1347, 1232, -909, -1323, -1409, - 1399, 2557, 14552, 1535, -5088, 1699, 1012, 3333, - 3940, 2294, 1189, -2256, -484, -3307, -1333, 464, - -305, -744, -24, -20464, 332, 2968, 308, -649, - 292, -402, 1226, -2575, -1505, -100, 1413, 733, - -1024, 616, -121, -322, 67, -161, -708, 251, - 462, -26697, -1112, -1381, -324, -286, 1091, 662, - 15830, 13124, -1049, -1816, -355, 1848, -801, -1710, - 2513, 458, -798, 386, -726, -356, -1240, -1133, - -388, 631, 91, 1867, 2511, -306, 3097, 14399, - -571, 2191, -2916, 2850, 761, -2442, 698, -2193, - -2739, -1914, -4077, -4631, 12702, 333, 1162, -6248, --12466, -310, -107, -2465, -163, 1970, -998, -1253, - 2007, 79, -426, -276, 365, 568, -520, 23642, - 276, 1059, 184, 1081, 650, 2286, -191, 883, - -1946, 246, 64, -225, 800, 910, -136, 1187, - 955, -15604, 12847, -747, 874, 506, -646, 1920, - -449, -321, 1152, 1341, 1653, 341, -32, 907, - 673, 1045, 1245, -499, -10331, 4683, -1121, -3164, - 3382, 6397, -1341, -769, 1186, 229, -1354, -7370, - 155, 1858, 5617, -3487, -247, -783, 724, 508, - 14029, -528, 1853, 1572, 580, -708, 528, -1394, - 8922, 2284, 550, 3084, -1726, -3235, -700, 7132, - -3540, -200, 3288, -815, -2189, 1232, 2412, 2088, - -1101, 12592, 806, 1508, 1741, 13, 1124, -3883, - -687, -8180, -3094, -3346, 1781, 11836, -657, -3469, - 1429, -1822, -3433, 87, 3871, 651, -965, -1757, - 6778, 109, 112, -131, 710, 11943, -12107, -3460, - -726, 1002, -3803, 580, 2756, -1293, 116, 457, - 581, 3834, -1678, -977, 1242, -2040, 232, -10034, - 1644, -2290, 1368, 172, -3012, 1423, -2620, 3608, --10831, -303, -1610, 3246, 562, 5212, 448, -877, - 954, 688, -8981, 579, 717, 1315, -952, 6817, - 662, 3218, 7213, -2116, 10446, 1012, 2270, -858, - 10, -1066, 10618, 6108, -547, 3221, -893, 3888, - -1088, -10085, -247, 1064, -3500, 3123, -2480, -2128, - 2788, -2253, -9756, -472, -166, -680, 727, 74, --14151, -189, -1734, 610, -1169, 845, 94, -786, - 394, -581, 500, 1981, -10940, 354, 500, 399, - -1952, -373, 2197, -4712, -2582, 2751, 654, 613, - -1254, 1406, 2056, -12518, 1583, -582, 4834, -1541, - 508, -20580, 270, 1214, 515, -1082, 5, 7, - -533, -28, 1270, -1307, 497, -57, -331, 933, - 92, -856, -10458, -4576, -9991, 2426, 6552, -3022, - 279, -562, -192, 1878, -2237, 4978, -1753, 332, - -1462, -853, 238, 478, 9746, -7385, -10290, -8278, - 457, 3121, 841, 48, -3745, -1298, -637, -1820, - -468, -248, 1400, 394, -125, -950, 11524, -1860, - 426, -773, 12669, -1620, -158, 1625, 1045, 768, - -66, -12, 1625, -770, 559, 54, 593, 14468, - 14994, 490, 543, -811, 700, -277, 900, -178, - -2000, 475, 241, 950, 106, -1260, 874, -862, - 18907, -1947, -844, 205, 1253, -83, 1966, 2300, - -2694, 852, 2450, 661, -334, -518, -1136, -2377, - 325, 1152, 511, 881, -22205, 898, 574, -582, - -265, -1362, -253, -40, -780, -1967, 469, 1484, - -818, -926, 958, -415, -7934, -330, 330, 1439, - 1643, 77, 1034, -156, -12094, 3782, -5725, -520, - -598, 2345, 3506, 5333, -322, 99, -48, 1490, - 20, 11393, 3468, -1144, 7013, -3728, 7145, 1432, - 1810, 26, -912, -6530, -1079, 1771, 95, 4007, --11346, -43, 249, -14616, -249, 1, -725, 244, - 1053, 1815, -626, 408, -344, 1972, 2222, 2288, - -2324, -411, -3993, 494, -706, -5078, -11695, -3645, - -2090, 2465, 5893, -5096, 6815, -537, 5003, 1258, - 185, -1555, -875, -2047, -170, -433, -194, -1020, - 349, -724, -31811, 197, 251, -418, -222, -618, - 278, 554, 363, 183, -898, 14, 350, 745, - -2054, -1623, 806, -770, -1246, 1594, -54, -18501, - 1516, 840, -86, 484, 514, 1209, 978, 564, - -537, 34, -431, 128, 938, -1807, 832, -90, --29509, -642, 1397, -52, 523, -393, 216, 908, - 9, -63, 710, -949, 3, -184, 175, 613, - -687, -408, 27, -855, 18258, 1282, -948, -219, - 2374, 1668, -4567, 1063, -2045, 12026, 461, 3074, - 1050, -1788, 169, -13442, 612, 19, -2019, 685, - 452, -152, 299, 310, -2327, 348, -215, 1634, - -201, 2162, -10300, 12452, -3733, -420, 2388, 518, - -2308, -160, 1552, 3347, 1650, 3293, -1108, 2065, --12618, 20, -42, -643, 202, -1298, 251, 2489, - 1322, 2362, 3698, -190, 592, -12484, -937, 2072, - 1531, 302, -409, -899, -1016, -388, 1103, 30006, - 789, -1609, -548, -1002, 1055, 605, -955, 1557, - 452, -623, 810, 597, -696, 10628, -1174, 606, - 2628, -553, -2297, 6668, -2600, 787, 3504, -3606, - 4087, 1052, 6276, -7619, 337, 2565, -13, 1205, - -124, 1222, -28082, -79, -553, 628, 542, 1315, - -609, 322, -895, -377, -694, 610, 239, -152, - -2901, 9890, 716, 1030, -3306, 988, -738, 562, - -2209, -1676, 4507, 1165, -12924, 866, -154, 3664, - -367, -2580, -7286, -572, 2167, 118, 508, -4429, - -480, 842, 2489, -1636, -2042, 1125, 1847, 2586, - -5639, 3361, -760, 11189, 623, -282, 1353, -279, - 515, -816, 713, 322, 417, -2820, -1114, -1563, - 401, -21604, -1300, -972, -2298, -483, 2176, -830, - 2135, -4084, 1095, 1950, -1937, 539, -374, 3197, - 682, 472, -1368, -8095, -12026, 4833, 5586, 467, - 2400, 148, 381, -138, 954, -459, -724, 970, - 156, -1955, -1363, 560, -761, -1708, -1599, -17408, - -1064, -1372, -500, 1160, 735, 441, -773, -228, - 420, -1128, 260, 930, 12879, -926, -231, 1355, - -850, 559, 11377, -1729, 2478, 961, 336, 1056, - 5081, 9788, -555, 4067, 8664, -2720, -1462, 3012, - -7280, 965, 1462, -4703, 3649, 2084, -699, -262, - 408, -188, 2193, -2216, -4509, -736, -1039, -4848, - -8243, -7958, -172, -1318, 9566, 4665, 3363, -3672, - 1581, -551, -2024, 1630, 1543, 90, -1728, -792, - -1799, 2571, 80, -412, -301, -2870, 1796, -5327, - 111, 17342, 592, -2108, 477, 1541, 1266, -1062, - -215, -2210, 223, 1215, -197, 87, -18340, -67, - 804, -398, -118, -3457, -741, -1935, -704, -274, - 566, -872, -1821, 12874, 5057, 2069, 1742, -6205, - -6115, -1614, -294, 187, -5210, 1734, -1466, -2162, - -2266, -642, -148, 440, 2, 233, -319, -637, - -734, -230, 301, 508, -433, 311, -313, -1206 -}, - -.cb2220s0 = { --15119, 7508, 1337, 4182, -2914, -3733, 2686, -470, - 2249, -3901, 1444, 3805, 99, -1771, -354, -903, - -2755, -709, -4980, 214, -2750, -652, -1042, 1434, - -1090, -612, -2574, 1274, 1310, -760, 1420, -112, - 2776, -4843, 15060, -4929, -3942, -5721, -1628, -1142, - 3023, -1435, 1402, 1010, 623, -3527, 2624, 184, - 988, 98, 340, 16676, -1262, -1162, 3183, -4816, - -592, 1019, -1406, -2478, 2371, -1004, 3944, 803, - 5665, -2261, 16427, 349, 3113, -916, 442, -1754, - -3551, -1351, 1563, -1316, 532, 343, -392, 1509, - -717, -122, 2462, -929, -185, -683, -18780, 2682, - -123, 518, -379, -5160, 245, 1940, 13964, -12311, - 590, -30, 159, -1558, -1940, 36, -1528, -515, - -1178, 856, -395, 29, -5854, -12943, 13286, -2572, - 1049, 768, 3292, -3921, -52, -462, 1968, 4933, - 630, 930, 1026, 2606, 319, -277, 6333, -2119, - -4700, 2164, 1583, 154, 2107, -1467, 339, 634, --17240, -595, -3525, -2690, -1788, -476, -41, 165, - -1016, -1456, -348, 11289, -2920, -3804, 2357, 12012, - 3848, 1796, 2164, -5555, 4527, -201, 965, -4893, - 3419, 6441, 1691, -77, 348, -769, 27319, -345, - -336, -541, -320, 972, 926, -1026, 1052, 702, - 224, 76, 742, 220, 6292, 8625, -3742, 4139, - -5989, -5615, -641, -231, -837, 6156, 4141, 3792, - 4746, 9972, 1800, -397, -2237, -2218, -7595, -2761, - -496, -1451, 1178, -970, -1226, 2527, -2105, 1778, - 1446, 1986, 9970, -13107, -985, -1142, -1367, -329, - -4498, 590, 36, 2073, -1069, 862, 133, 2516, - -27, 4494, -11602, -1638, 2524, 1449, 5684, -611, - -9452, -2618, 5006, 3481, -639, 379, -2333, -498, - -713, 382, 784, 269, -5692, -350, 524, -18705, - -1042, -1349, 1210, 1770, 3964, 4908, -1131, 17535, - -788, -1896, 30, -2682, 1044, 1604, -3740, 18, - 1771, 331, 4279, 2634, -368, -447, -6995, -1224, - -688, -5368, -236, -8872, 2449, -12189, 4465, 1895, - 2484, 1315, -5446, -457, -575, 101, 2356, -1585, - 3204, -104, -7244, -1678, -801, -2620, -4603, -11876, - -1787, 2962, -1796, -3385, -411, 5796, 2900, -562, - 835, 293, 7127, 4939, 721, -2972, -482, 121, - -2694, -2277, 412, 12770, -342, 718, 3306, 502, - -7281, -307, 552, 7158, 3289, -5051, 5230, -1185, - 3024, -942, -1347, -283, -13937, -208, 2576, -906, - 1848, 5692, -2434, 175, 7837, 1872, -4536, -3341, - -957, 14787, -1598, 9058, 3776, 407, -1734, 1259, - -3011, -131, -3589, -614, 272, -2968, -1611, 3645, - -8126, 2120, 4868, -5462, -13235, -3452, -6077, 5064, - -1593, -1395, -2427, -1139, -958, 1585, -1330, 2178, - -778, 3545, 2836, 7712, 5993, -432, 3575, 929, - -7951, 115, 2180, 3904, -193, 1556, -252, -913, - 2574, 11948, -4525, 1391, -8513, 4540, -12815, -3379, - -4676, 1838, -5676, 1321, -6168, 1397, 1020, 438, - -141, 3424, 392, -512, -1614, -1396, -318, -2451, - 1545, -7132, -1763, -424, 3575, -828, 19216, 1978, - 1624, -1969, -1667, -772, -2031, -781, 1732, 244, - -212, 416, 900, -8960, 1002, -1077, 4667, -3527, - 1586, -13109, -2442, 3829, 4358, 1056, 2960, -1087, - -662, 4775, -6316, 6157, -3736, -2040, -187, 904, - 1254, -636, 2032, -734, -1271, -2691, 3376, 564, - -7769, -5482, 840, 14171, -5828, -966, 1685, -10192, - -388, -434, 3706, 594, 2188, 365, 209, 298, - 1825, -236, 12762, 1644, 3199, -468, 12876, 130, - -2169, -3406, -3571, -4655, 2339, 10757, 1292, 2920, - 289, -314, -591, -1631, -1778, -1296, -254, 469, - -9408, 1154, 334, -4, -1922, 2787, 317, 416, - -1703, 14075, 1601, 638, -2260, -973, -824, 2816, - -2954, 3282, -3716, -882, -3447, 3058, -6701, 1233, - 177, 3579, 3508, -3539, -10511, 7507, 7608, -1928, - 2482, -719, 2278, 5167, 9828, 10572, -3635, -2750, - 3407, -116, 3343, -3432, -3375, 982, 903, -3239, - -444, -1574, -333, 9613, -1914, -532, 1879, -78, --17944, -7029, 1586, -3122, 360, -401, 1219, -2086, - 3066, 878, 5780, -948, 102, 1952, 418, -416, - 1002, 1380, 1297, -92, -640, -555, -1159, -28517, - -1757, -696, 124, -618, 1590, 300, -598, 924, - -190, -1734, -4196, -5345, -14068, 5971, 8293, -3878, - -1448, -1777, -174, 921, -1555, -866, 560, 232, - -1914, -4002, -772, 1960, -4945, 3424, 6492, 3675, - -800, 5346, 4404, -639, 10697, 1631, -1446, -4469, - -7804, 3721, 4824, -620, 1099, -2956, 5175, -2453, - -4894, 2562, -1842, 4940, 1391, 2818, 1095, -4285, - 6469, -1966, -14564, -2232, 592, 5570, -2682, 2651, - 4678, -7444, -2387, 6812, -12757, -5664, -42, 134, - -2861, -1780, -158, 1410, -4990, 673, 2083, -2639, - 3019, -2, 8305, -1981, -2114, -54, 2892, 1659, --14913, -74, -1092, -1187, 2465, -2218, 791, -608, - 3077, 26, -1096, -1692, 3234, -7116, -1835, -5244, - 398, 10137, 698, 2298, 498, 7060, 6430, 1393, - 2540, 487, -1534, -1926, -5139, 3425, 4533, 5067, - -535, -924, 938, -1799, 16120, 2037, -3727, -821, - 2986, 2314, -223, 1358, 9, 2697, -1806, -940, - -3630, -1843, -2776, -2246, 580, -1678, 2427, 2126, - -1935, 2956, 849, 18234, 638, 342, 1036, 249, - -24, 2713, -1973, -134, -4469, -2014, -6162, -19776, - 703, -50, 2295, -2294, 1971, 1179, 1014, 2374, - -1480, 1513, 630, 1542, 24716, 3534, 2926, 662, - -2886, -521, -348, 402, 1112, -371, 1587, 1822, - 1880, 1284, 302, 1873, 1284, -924, 6420, 4650, - 7986, 427, 361, -8276, 304, -11911, -1305, -2018, - 189, 258, 839, -942, 479, -3162, -1195, -1138, - 1560, -1850, -5304, -10132, -10533, -1301, -3147, -680, - 56, 4260, -6867, -1350, -1094, -1385, 1831, -2, - -941, 3740, 7701, -855, 3304, 3444, -4467, 269, - -4092, 588, 13957, -1566, -3561, 1936, 2816, 2982, - 1804, 2710, 419, 685, 4468, 488, -9520, -2738, - 3974, -9978, -1681, -2418, 2340, -717, -899, -2855, --10470, 1030, -2346, -5555, 2559, 2180, -5324, 1832, - 10294, 342, 11318, -2376, -3904, -1524, -3806, 1078, - -1896, 7199, -3522, 1364, 2291, -911, -156, -4327, - -778, -30451, -577, -158, 560, 2749, 799, 2689, - 337, -301, -1218, 1243, 687, -880, -419, 40, - -280, 4, 1834, 9908, 1953, 408, 1080, 8777, - 3861, 552, -6906, -3546, -6666, 35, -1903, 4788, - 5080, 2865, -233, 1031, -4519, -13752, -2417, -1742, - -7389, 3191, -626, -411, -7351, 3063, -1801, -4377, - -2974, -124, 2778, 2733, 349, -1191, -6528, -1699, - 6907, 239, -2765, -5706, 3627, 2096, -20, 2285, - 7164, 3523, -11582, 3616, -614, 6266, -285, 3643, - 1506, 3665, 1261, -2338, 418, -5062, 4893, 2945, - 1923, -2990, -4531, -8858, 2769, -5029, 2202, 3337, - 10703, 716, 5614, -14982, -2366, -5415, 25, -1665, - 4353, 3060, -2159, 1005, -1587, -368, -949, -2788, - 1063, 1307, -59, -46, -6337, 500, -1194, 2914, - 2372, -1393, -1914, 3820, -1160, -135, 3777, -14151, - 5208, -2290, 5738, 1018, 385, 1883, -2626, -9289, - 1082, 1558, -1756, 2720, -519, -13050, -3672, 1759, - -13, 3471, 4071, -5977, 167, -4210, 2219, 1344, - -2412, 4497, -6946, 660, 8774, -3141, 6080, -4478, - 2520, -609, -3080, -741, 7864, 7428, -333, 1154, - -1849, 1478, 460, -338, -6651, -2480, 1692, 2104, - 1642, 2720, 1017, 2759, -1822, -2668, -2265, -1019, - -8926, 1487, 733, -15128, 5543, -4214, -7044, 666, - 7108, 2222, -2454, 4995, 5108, 1481, 2242, 5743, - -487, 9669, 295, 3539, 4836, 487, -1541, 824, - -5946, 6692, -368, -1390, -6103, 4545, 2671, -12272, - 3160, 760, -2080, 3523, -2752, -2940, -718, 2202, - -5523, 2346, -5580, -5007, 6212, -5406, -11348, 1272, - 5389, 2331, 3691, -1184, -3585, -4500, -603, -38, - -5285, -531, 4844, -3850, 3944, -6525, -5723, -2313, - -985, 879, 578, -3217, -3600, -2814, 1432, 11568, - -1461, -1761, -4110, -4104, -103, -1803, 5195, -1477, - 1348, 107, 3902, 1215, 3522, -3404, 9098, -237, - 68, 34, -2524, -12040, -6183, 2122, 470, -1257, - 346, -232, -1725, 5913, -1525, -5873, 1846, -11368, - 1043, -1027, 4201, -3864, -4294, 7756, 1847, -3688 -}, - -.cb2220s1 = { - 32767, -2256, 16, 2156, 267, 1128, 1394, -1936, - -488, -405, -345, 1068, 578, 1504, -1192, -405, - 292, 1149, 4243, 152, 1036, 1782, 2655, -23349, - -1100, -1933, 354, 966, -1554, 1173, -1186, 495, - 618, 1009, -2715, 461, 5974, 939, 3552, 1325, - 3385, -956, 2177, 2101, -145, -1000, 2326, 2466, - 2822, 15822, -581, -713, 4398, 828, -3249, -3942, - 1990, -862, 2272, 348, -2972, 241, -2678, -1881, --22307, 417, -587, 312, 280, -2524, 2380, 299, - 3931, 178, 2910, -2544, -356, -786, 546, -73, - -862, 240, -1653, 1286, -3875, -2072, -1477, 16800, - -1148, 2099, 3216, 5174, 2177, 3042, -796, 414, - -506, 883, 1837, 1451, 2864, 850, 2395, -414, - 3254, -1937, -16379, -3976, 2178, -1473, 4759, -832, - 8890, 3324, -3053, -407, -1530, -431, -1220, 128, - -3472, 980, 52, -14716, 1732, 1931, -6518, -1784, --11113, 4466, -24, -8559, 105, 5478, -4116, -2213, - -3006, 1738, -4189, 3310, -753, 1869, 580, -885, - 3089, 8146, -4990, -1825, -524, 3620, -6920, 621, - -1064, 4633, -1509, 80, -10949, -2752, 476, -3684, - 3547, -1967, 3364, 2887, -729, 7921, -4216, -3681, --14417, -3978, 261, -1146, -1124, -901, 777, 783, - -2, -989, -1582, 3988, 7785, -6371, -2258, 3344, - 354, 13289, 3339, 316, -3186, -2088, -1951, 310, - -545, -704, -40, 4416, -392, -1033, 5650, 99, - -3008, -3716, 2448, -3758, 9463, -1793, -130, 1705, - 6501, -2214, 2970, -10476, 564, -5952, -541, 2077, - -90, 6588, -2858, -1733, -9247, -345, -3170, 4986, - 3353, -4868, 8873, 113, -5223, 1562, -163, -2446, - -4459, -8052, 1106, -10883, 1185, -1756, -152, 3109, - 181, -1427, 8291, 11419, -6265, 2116, -469, 5150, - 1355, 182, -740, 779, -7754, 1868, 144, 3936, - -60, -784, -231, 879, 17032, -2273, 1886, -538, - 1015, 1798, -633, 1090, 1910, 128, -6094, -1946, - -1570, -727, -18457, 498, 784, -4419, 1656, -21, - 154, 2430, 3815, -41, -2708, -1594, 228, -784, - 7284, -452, -7634, -12868, 3564, 5473, -1244, 2231, - 28, 4321, -1464, 1402, -1358, 2241, 656, -1128, - 1160, -2352, 3641, -680, 1816, 6864, -42, 1269, - -280, -1265, -2048, 238, -653, 13571, 3874, -269, - 7977, 2238, -1246, -2066, 4741, 1706, 3498, 595, - 2559, 55, 593, 1681, 1612, 43, -2756, 2702, - 2439, -2471, -809, 1890, 17032, -787, -4280, 1167, - -1926, -4973, -1181, -2764, -4151, 2962, 3444, 844, - 2446, 14013, 3326, -1195, -1829, 1588, 1765, -3140, - 8562, -14425, 4040, 2003, -738, -1032, -3314, -2236, - 548, 768, -2348, 436, 1755, 31, -4616, 1259, - 269, 1543, -1393, 5338, -16463, 2900, -2480, 1659, - 217, -5864, 3878, 5268, 1244, -520, -1202, 1238, - 182, -1049, -695, -320, -6832, -5904, 2914, -2616, - 2586, -10958, -3258, -1846, -4633, 2371, 3251, -3583, - 2631, -4162, 3035, 2718, 616, 2890, 206, 16128, - 979, 3551, -6864, -3221, 5881, 3692, 1718, 234, - -2844, 1668, 102, 2687, -838, 988, 1116, 533, - 4026, -7235, 5972, -13781, -3394, -3518, -294, -6383, - 1675, 4507, 5444, 385, -1931, 930, 699, 1639, - 415, 6720, 7854, 1514, 3192, -2253, -14786, -1307, - 871, 1329, 1881, 6628, 2851, -85, -2284, -4538, - -837, -2232, 269, -2227, 13930, -2063, -7540, 8978, - 1195, 2717, -1282, -972, 1305, 3864, 2412, 2308, - -4824, -3282, -864, -489, -1458, 2192, 15903, 2460, - 2792, -4137, 1034, -359, 5, 2297, -6, -3859, - 478, -1535, 2080, -741, 2030, -603, -2640, -1902, - -8208, 3818, -1273, -8138, 2015, 9169, -3440, -1779, - 4076, -576, -93, -1718, 744, 2563, 6744, -3841, - 1355, 1590, -4196, -13924, 356, 13381, 2552, -2862, - 2790, -578, 3562, 2711, -686, -3783, -489, 1230, - 896, 1208, -1101, -3482, -2478, 772, 1254, 320, - -1825, -327, 1070, -1712, 295, -18141, -2618, 1537, - -603, 3782, -1272, -1901, 414, 169, -6574, -6966, - 2711, -3292, 13204, -1324, 3620, 4962, 2835, 4177, - 4861, -2378, -5534, 3701, -4224, -631, -3199, -653, - 4785, -1045, -2097, 580, 2190, -140, 48, 3075, - -1346, -810, 2016, 566, -2543, 235, -5930, 1956, - 481, 19003, -3938, 6489, 2697, 4796, 3435, 7102, - 3062, 1460, -5814, 2723, 4181, -4979, -2534, -2058, - -136, 3554, -2684, 15252, 4112, -3146, 2812, 7182, - -2642, 5443, -1043, -803, 2786, -1622, 1988, -780, - 1482, -13015, -1762, -1377, -4005, 161, -9568, 8166, - 1832, 330, -6484, 945, -4388, 1090, -524, 1556, - -582, 320, 770, -938, -8757, 977, 1084, -7062, - 3552, 775, -4708, -2281, -552, -10027, 4263, 1197, - -672, -93, 5716, -3825, -4526, 1781, 9799, 4450, - 1981, -3149, -9664, 3119, 3794, -91, 6710, 840, - -1098, 11310, -2933, 785, -2573, 748, 1803, -1401, - -1547, -4118, 849, -580, -1404, 1536, -9382, -1610, - 2335, 403, -2939, -3015, -3753, -7593, 1640, 3346, - -2594, -8028, 5485, 2189, -3369, 2106, 5369, -2573, - -515, 1459, 6996, 1344, -389, -7009, 10332, -840, - -3869, 901, -6449, -2348, -2461, -4103, -810, -2060, - 1040, 117, 32241, -231, 945, 999, -1183, 180, - 1443, 188, 855, -1634, 774, -202, 99, 1714, - 286, -849, 1968, -9743, -15458, -859, -3726, 2257, - 355, -167, -1674, 1808, -488, 1118, -1416, -1685, - 2928, 1471, -1145, -536, 2307, -972, -1191, 1625, - -1436, 378, 20178, -638, 1826, 472, -300, -845, - -1045, 1074, -1041, -510, -39, 516, 4548, 2741, --10197, -2336, 3828, 2093, -4148, -9138, 4239, 2520, - -3536, -3807, 2998, -2226, -6898, 4838, 2552, -2024, - -5579, 1370, 11706, -7626, 1566, 989, -4934, -1345, - -5962, 4259, 1158, -3712, -2710, -1037, 105, -2733, - 1068, 3682, 3904, 2044, 184, 537, -3438, -1376, - 332, 17812, -3170, 2386, -2090, 3481, -1352, 431, - -1016, -1062, -564, -1752, -2602, 1299, 6720, 789, - 1275, -9801, 5320, 2327, -4048, 4443, -7820, 1112, - 1232, -1139, -920, -744, -845, -3754, 5958, -5388, - 3336, -3578, -4027, 688, -7043, -136, -163, -1395, - 13400, 1729, -1862, 2612, 321, -3874, 947, -990, - -3164, 11487, 46, -1978, -2139, 1222, 3897, -9664, - 3692, 5431, -3364, -3706, 180, -4009, 2563, -313, - 3228, -1631, -9763, -9184, -6058, -4594, 1040, -3323, - 321, -3233, 5035, -1919, -5525, 1899, 1196, -1834, - -391, 549, -2114, -1436, -2624, 2441, 618, -27606, - -841, -936, 1067, 1157, 230, 784, -755, 1798, - -219, -1026, -1119, 320, -2611, -1382, 8776, 1151, - 3739, -607, 2997, -7704, -5870, 1800, 1357, 4973, - -9674, -5182, -50, -886, 2056, -802, -1909, 574, - -1716, -6388, -2882, -3526, -3188, -543, 244, 9648, - 5129, -5069, 598, -9049, 1834, -3375, 1369, 1461, - -1295, -380, -274, 7258, -9353, -2401, 11915, -5087, - 1505, 4211, -719, -902, 1762, -168, 642, 699, - -2067, -933, 1092, -958, 715, -1978, -1968, -1613, - -1263, -777, 1170, -9652, -9570, 612, -3935, 237, - 386, 4237, -1468, -10172, -4964, 2919, -6428, -7184, - 119, 3610, 59, 3168, -5474, -853, -5735, -1765, - 3063, -1352, 944, -1934, -3500, 9282, 5920, 784, - 90, 275, 3211, 2418, -8570, -10498, -2026, -1020, - -2989, 1511, -41, -11462, -1980, 5296, 2614, -21, - 770, -156, -2817, -4748, -8672, 3447, -7231, 4598, - -1347, -689, -3198, 434, 56, -2065, 1798, 13761, - -533, -1280, -796, 2481, 56, 1377, -5473, 9116, - -1185, -602, 2547, -3693, -8880, 2978, 9093, 1829, - 4844, -649, 316, -162, 1520, -5814, 4860, 199, - -1330, -5182, -6269, 2642, 1220, 2816, -4098, -3981, --13264, -398, 361, 2768, -4786, 1023, -97, 655, - -397, 2403, -1576, -386, -1112, 792, -1195, -759, - 742, 729, -2916, -1020, 21350, -26, -3577, 659, - -1263, 1378, -4339, 1880, 4842, -669, -1203, 5936, - 816, -8356, 3660, 1673, -677, -2370, 1652, 8710, - -1254, 6171, -6868, -891, -6752, -169, -5678, -7588, - -3247, 2982, 5281, -4941, -359, -3354, 851, -1609, --11194, 610, 261, -1936, 2715, -3540, -2488, 2086, - 6110, 914, -3224, 1777, -1558, 937, 3736, -3109, - 1903, 4250, -4478, 2636, 2292, -1451, 10231, 7600 -}, - -.cb2220m0 = { --26430, -533, 1599, 208, -293, 2303, 704, 1586, - -1064, -1630, 690, 1697, 623, 1786, 332, 682, - 199, 12695, 475, 1288, -2471, -797, -68, 9659, - -816, -2465, 546, -1421, 1596, -926, 4471, 2360, - 5551, -900, 297, 96, 400, 936, 1548, -1066, - -1625, 652, 1416, -118, -525, 683, 1545, 1340, - 20684, 936, -1033, -773, 8416, 954, -4822, 4223, --10815, -312, -896, 531, 3140, -1649, 508, 10294, - -315, -2078, 584, 1523, 118, 997, -11837, -605, - -262, -1732, -613, 12220, -2666, -1802, -507, -4410, - -100, 2127, -114, -886, -2806, 500, 1034, -2811, - 12642, 1015, -9193, -4201, 238, 1096, -1159, 1619, - 2534, 1644, -3465, 4797, 639, 2583, -1316, -9884, - 948, 1479, 1186, -1760, -343, -1286, -1653, 678, - -7439, 4542, -6295, -1600, -6978, 48, 448, 369, - 1597, -3696, -2121, 1002, 2428, -11368, 5385, 827, --10674, -2252, 2240, 1230, -3074, -1894, 296, -2216, - 571, 114, -497, -1675, 1311, -2297, 1843, -350, - -856, 2067, 1198, -588, 270, -470, 2640, 274, - 19586, -762, -11471, -623, -506, 4236, -10981, -214, - -1856, 409, -1276, -935, -1681, 5116, 774, 3008, - 4388, -112, -9493, -1108, 1454, 1385, 1065, 519, - -486, 308, -1141, 289, 1424, -3672, -15989, -3738, - -1592, -258, 3304, 62, 1441, 45, -686, -1070, - -1616, -701, 2313, 1918, 4843, 654, -16902, 263, - 1837, -4062, 2727, -709, 1524, -1628, 2025, -281, - 264, 1238, -1023, -11981, -2990, -1293, 801, -9606, - -604, -210, 1248, 4014, 3652, -11286, -2094, -470, - -1330, 14523, -2388, 1413, -3968, 641, 2936, 161, - -1687, -1260, 1722, -1968, 364, -854, -14386, 10146, - 792, 133, 1746, 261, 3345, -408, 2036, 272, - 1412, 720, -3302, -1495, -4334, 2210, 799, 17546, - 2600, 1314, 764, 1327, 3433, -377, 4296, 2402, - -1074, 470, 7220, -2556, 3326, -4338, -2086, -1945, - 11865, 3525, 1513, 1520, -1814, -13020, -929, -2001, - -1496, 580, -3293, -3146, -2185, 1442, 390, -2026, - -2141, -192, -18700, -2039, -4330, 1691, -250, 1451, - -2913, 2832, -3284, 2899, 1529, -888, 486, -2381, - -1459, -2663, 530, -717, -248, -1714, 12662, 1820, --11488, -1044, 3035, 3872, -2430, 679, 1075, 475, - -593, 930, -1751, 405, -2308, 2148, 510, -2798, - 445, -240, -6865, 2106, -11323, 670, 4342, 154, - -7748, -1805, 5381, -842, -697, -709, 688, -498, - 5525, 15212, -2006, -4146, -2452, 2392, -3522, -2023, - 1306, 5522, 916, -3616, -287, -653, 333, -330, - 4, -24886, 635, 119, -1949, 899, -36, -37, - 2658, -133, 2064, -534, -549, -1745, -70, 32767, - 1089, -869, 150, -599, -1146, -574, -424, 377, - -648, -303, 590, 453, 1910, -351, 553, 304, - -752, -752, -502, -42, -31211, -634, 449, 638, - 1086, -1406, 1220, 802, -924, -1874, -212, 86, - -200, -1140, 618, -621, -605, -10976, 1699, -603, - 2056, -4448, -1519, 2564, -743, 12304, 1482, 547, - -1589, -817, -217, -1633, -1089, -2270, 181, -634, - 3890, 734, -1319, -2035, 3304, 13144, -9076, -4067, - 70, 1309, 1067, -354, 1529, 1379, -1002, -3324, - -525, -817, -1438, 10834, 1036, 12441, 1242, 2461, - 2858, 2257, 430, -1177, 1142, -870, 844, 1102, - 1208, -1482, 830, 17622, -2753, 6, 174, 4385, - -339, 2157, -155, -68, -190, -1181, 29, -2046, - -2140, 27, 949, 1889, 446, -54, 16696, -49, - -3304, -1929, 1833, 3735, -495, -1225, -11743, -2259, - 891, -1954, 2848, -504, 1164, -2489, 861, 579, --11547, 976, -42, 1477, -2428, -1561, 112, 74, - -2721, 12046, 632, 1283, -1900, 1990, -1193, 1606, - -1370, -2812, -1309, -1419, -12526, 3391, -4213, -2710, - 269, 90, 14575, -345, 820, 6118, 892, 6302, - -2825, 332, -3071, 2279, 3756, 185, -3029, 2402, - 245, 1010, -273, -32751, -140, -600, 482, 1516, - -462, 1931, 1941, 272, -310, 544, -422, -815, - -1116, 803, -617, -1640, -4336, -11735, 3656, -1176, - 1170, -6209, 2139, -1571, 2067, 1011, 9842, 790, - 1702, -191, 911, 2771, -253, 794, -3862, -1885, - -494, 2070, -2682, 772, 763, 4304, -15657, -2194, - -1998, -963, -5222, -175, 238, 32, 10067, -692, - 2824, -474, 3016, -11994, -51, 713, 2423, 2864, - -338, 4838, -1095, 215, -13471, -2, 704, 752, --14654, 1396, 484, 564, -886, -775, -1099, 775, - -1035, 1661, -1013, -1118, 449, 822, 14253, -13238, - -1084, -1107, -1672, 996, 472, 2237, -440, 1186, - 1200, -2112, -1388, -1093, -1902, 555, -328, -1493, - -2034, 426, -2144, -388, -20028, 1285, 1122, 730, - 1661, -1576, -2084, 2930, 337, -66, 1591, 8685, - 2361, 146, 1370, 22, 1371, -105, -4190, 371, --13252, 328, 1301, -995, 3689, 6422, -79, -1407, - -384, 828, 840, 854, 266, 1222, 796, -550, - -729, -1213, -87, 524, 1070, 22334, -2333, 574, - 680, -624, 463, 4047, -236, 114, 1020, -692, - 1575, -320, -3229, 222, 520, 996, 2104, -5404, --18197, -1105, -184, -1057, 10712, -2509, -7140, -2307, - 1333, 3041, 183, 1241, -7861, -3060, 1432, 9, - -1431, -2605, 2663, 273, 250, 770, -740, 6699, --10929, -7227, 105, -2983, -1203, 1637, -6072, -6630, - 933, -1526, 658, 2612, 5377, -91, -66, 4944, - 3025, 2723, -869, 142, 10532, 9858, -207, 3072, - -2610, 0, 81, 1078, 2136, -266, 223, 931, - -385, 983, 1029, 108, 2290, -491, 26685, 565, - -140, -662, 680, -2206, -803, -777, -250, -467, - 98, 2944, -12296, -4190, -2254, -748, -2076, 4780, - -510, -221, 1428, -6162, 2693, 6238, -4030, 266, - 6540, 2502, 5147, -4649, 1804, -10514, -3413, 2503, - 2143, -1924, -3811, 3674, 4341, -1054, -3130, -1260, - -576, 887, 25908, -773, 1186, 548, -606, -744, - -995, 1320, -507, 279, 1803, -2451, 880, -31, - -5, 1615, 770, -11818, 1062, -1126, 472, -297, --12126, -1197, 1912, -962, 1241, 2348, 2332, -3047, - 1561, 3844, 720, -387, 371, 2942, 1174, -2347, - 1244, 10148, -1620, -11788, 1315, -31, -1867, 3450, - -1589, 5180, 3184, -2614, -13, 130, 107, 297, - 113, -1407, 29190, -544, -173, 990, 913, -1848, - -990, 1230, 264, 1896, -6974, -102, -2232, 3826, - -2269, -5027, 94, -12612, 436, -5979, 1757, 1757, - -724, 2378, 2584, 728, -1022, -7274, 668, 744, - -516, 420, -11866, 246, -1357, 2406, 3674, -2594, - 1638, -3037, -2402, 1525, -7304, -1078, 1772, 9264, - 12366, 202, 2, -728, 684, -437, 1446, -3546, - 828, -2106, -2736, 964, -180, 6524, 2250, 514, - -782, 675, 1418, -11225, 2760, -3970, -545, 9128, - -6601, -556, -1966, -4625, -149, -198, -3330, -1575, - -6198, 656, 674, 367, 1809, 155, -5126, 6109, - -572, 4927, 1448, -1855, 1636, 8648, 2010, 8973, - 3087, 10172, 34, -1183, -12, -1057, 192, -2955, - 1034, -374, 2500, 9318, -4090, -5220, -404, -1022, - -1458, -1367, 765, -1193, 1542, 302, -1337, -34, - 1449, 1434, 2210, 404, -3277, -8024, 1363, -7591, - 9096, -9179, 1176, -7311, 544, -8942, -713, -56, - 2623, -35, 1623, 2212, 1733, -712, -1327, -320, - -1966, 11352, -1276, -3804, -550, 520, -4848, 550, - 1488, 944, 10756, -782, 5643, -2647, -6513, -3500, - -2877, 1880, -6634, 2349, 256, 440, 188, -8428, - -4580, 2479, 4763, -1807, -513, -4292, -1729, -6878, - 448, -6706, -1162, 4938, -721, 5465, 1409, -8759, - -898, -4254, -5230, -3886, -7969, 1730, 3656, 1198, - 3537, 33, 4091, -2088, -7646, 1160, 2922, 855, - -1254, -2616, -770, -685, -100, -577, -4927, -792, - -2107, 9613, 2563, 5096, 6143, -3404, -8630, 4164 -}, - -.cb2220m1 = { - 32524, -324, 411, -34, -697, 818, -71, 2326, - -142, -989, -1512, 358, -260, 3791, -575, 93, - 224, 208, -1101, 32767, 1147, -203, 2015, 461, - 668, -296, -3340, -38, 720, -993, 1765, -1344, - 1323, 648, -997, 729, 581, 349, 861, -2035, - 1791, -2142, -822, -1425, 820, -6555, -811, -15708, - -912, 4835, 1500, -604, 527, -937, -640, -1240, - 4692, 1259, 174, -12040, 450, 8196, 2796, -5123, - 1595, 538, -101, -218, 5581, 367, -2700, 277, - 2111, 2718, 1458, 155, -100, 3284, -498, 9961, - -1505, -10336, -1170, 5337, 1032, -14947, 1154, -578, --11773, -945, -660, 669, 2340, -1038, 1520, 713, - 2663, 422, -1242, 1918, -234, -1793, -1580, -271, - -5628, -2010, -12209, -1784, -4417, -2804, -3123, -4316, - 126, 6353, -2391, -2088, 836, -2550, 521, -1258, - 918, 4471, -528, 4243, -615, 3453, -6683, 1784, - 790, 13200, 700, 322, -815, 6049, -290, 928, - -1121, -1531, -878, -1150, 1404, 325, -530, -435, - -254, -804, -2536, 589, 8439, -1087, -16248, -637, - -1528, 305, -1577, 642, -22699, -139, 1319, 588, - -3079, 800, -597, -1408, -1150, 3145, -868, 3244, - -1004, 1004, -1459, -11618, -4557, -3643, -914, 4238, - -626, 4025, 3227, 537, -4285, 2010, 747, 1595, - 1599, 5994, -797, -911, 2854, -3426, -8488, -1899, - -301, -2146, -111, -522, -1852, 3075, -3864, -1531, - 654, 193, -11264, 5561, 304, 525, 346, -2761, - -1124, 1134, 8354, -12460, -1023, -7634, -2750, -1518, - 5001, 1480, -1039, -502, 1455, 586, 1012, -1270, - 12435, 895, 1169, 466, -10696, -3861, 4381, 1790, - 767, -1808, -537, -1057, -2374, -2058, 9992, -858, - -1568, -678, -3812, -1520, 1521, 230, -1716, 13418, - -1930, -979, 3272, 1116, -4555, -559, -320, 12080, - 13696, -286, 652, 2420, 1725, -277, 213, -1046, - 1642, -576, -1514, -973, -1501, 77, 537, -606, - 1144, -680, -568, 1104, 2176, -969, 1657, -784, - 1107, -1056, -59, -5607, 64, 11913, -178, 8703, - 3744, 276, -50, -12807, 1122, -6138, 1901, -439, - 733, 6829, 3001, -61, -1005, 3816, 3987, -3588, - -778, 2257, 12101, 196, 13796, 355, 1407, 989, - 101, 1041, 988, 1274, -1478, -1127, 1320, -442, - 3452, -1717, 1244, -466, -868, -323, 502, 1243, - -70, 897, 958, 2781, -2492, 788, 744, -12324, - 1111, -11704, -452, -734, 19574, -45, -584, -2387, - -830, 603, 380, 787, -2962, 2046, 2524, -2403, - 699, -4144, 1587, 573, 588, 238, -88, 31, - -278, -32768, -1173, -745, 667, -188, 1221, -369, - -261, 322, -2054, 651, 100, -2092, 315, 1558, - 596, -407, -146, -1234, -30970, -71, 633, 536, - -1345, 1819, 655, 680, -1453, 492, -1265, -1292, - 1780, -68, 1008, 215, -19980, -521, -3148, -256, - 193, 916, 453, 86, 116, 108, 1518, -1420, - -1501, 688, 669, 1196, -1579, -942, 868, 804, - 110, 1126, 202, 1086, 23516, 1070, -1623, 747, - -38, -116, 1176, 554, -2361, 1008, 1085, 1972, - -1794, -96, 464, -20910, -1208, -3857, -466, -2173, - 2461, 2364, -931, -684, 3056, -719, -936, 887, - -3149, 1004, 7085, -2985, -9393, 5142, -9621, 150, - 174, 572, -2232, -390, 1356, 160, -10796, 2256, - 2238, 242, 1663, 485, 12378, 1236, 688, -2908, - 1084, 1047, 4850, -72, -642, 1604, 152, -850, - 670, 968, -3207, 1690, 105, -2516, 11539, 390, - -1117, -588, -10771, 2879, 4742, -8351, 1571, -850, - -605, -1959, 395, 12324, 1750, 2290, -92, 774, - -2897, 1025, -1841, 546, 3904, 3908, 11494, 9, - 1340, -11976, -525, 1522, -43, -43, -1860, -6160, - -199, 2479, 4593, -2876, -2985, 1044, -62, -812, - 10424, -2489, -1098, 796, -1292, -2070, 1096, -1944, - -2145, -4374, 1041, -1014, 9036, -2142, 328, -8232, - 152, -13336, -2225, 13716, -367, -558, -1942, 161, - -472, 2224, -748, 3550, -809, -493, 2121, 1234, - 772, 5146, 2485, -2282, 7546, -1441, 1595, 9176, - 6208, 1292, 1704, 3968, -1500, -1974, -3519, -2826, - 149, -903, 504, -187, -940, 121, -215, -615, - -257, -1954, 958, 2057, -191, 21258, -726, 2081, - 1278, 1670, -854, 2730, -8132, -530, 1004, 2574, - 1430, -2536, -10851, 1389, 155, -140, 2158, 2762, - 3807, 3850, -3728, -954, -11366, 709, 14727, 514, - 694, -87, 857, -249, -419, 617, -418, -1144, - -32, -2182, -839, 1449, -1072, -785, -246, 13634, - 12488, 358, -447, -2262, 926, 1023, -901, -345, - 2260, -1530, -1466, -2973, -2170, 2090, 44, -23476, - 603, -1740, -345, -438, -3004, 1322, -3088, 1274, - 341, -348, -534, 1055, 3026, -932, 514, 8958, --15489, -374, 1077, 1166, 48, 1016, -918, -27, - -410, -266, -1401, -3888, -2918, -2146, 2815, 1834, - -875, 162, -678, 1876, -2033, 1999, -12854, -1563, - 192, 414, 782, -3109, 1432, -4197, 2358, 8517, - 784, 1256, -1362, 2938, -11355, -5184, -10314, -39, - -2182, -1686, 241, -195, -232, -6169, 206, 181, - -470, 1008, -599, -284, 733, -836, 648, -138, - 2078, 313, 24432, 548, -441, 1446, -1628, -1218, - -64, -716, -2456, 1987, -352, -1025, -1951, 1320, - 350, 744, 2598, -984, -18328, 622, -4, -1572, - 893, -3043, -4365, 127, -1, -226, -1696, 1332, - -1360, 6756, 2596, 12059, 370, -3690, 497, 585, - 1619, -778, 9174, -2046, 2214, 2004, 1133, 1069, - 132, -250, -1555, -906, 561, -12904, -1039, -8006, - 1876, 2300, -1116, 1895, 1782, 3734, -1108, 1338, - -1409, -248, 16117, -1458, 156, -2626, 64, -1199, - -3544, 4283, -3390, -404, 1426, -907, -2768, -780, - -34, -18656, 2003, 515, 3171, -653, 762, -3352, - -154, -1171, -452, -1590, -5936, 519, 1210, 502, - -409, 2262, 695, 1028, 8652, 2532, -2636, 3472, - -1186, 1350, -651, -639, 8382, -3234, 630, -10323, - -2285, -1916, 826, -1449, -738, -344, 1022, -3248, --20921, -200, 568, -84, 777, -1570, -2756, 2834, - 26, 3878, -1709, 101, 1433, -2238, 305, 61, - -1041, 2399, 628, -1509, -388, 946, 733, -1538, - -650, 19935, 478, -10696, 850, -682, 447, 2311, - 35, -1258, 2332, -11417, 1743, -834, 660, 3170, - 2378, -2734, -762, -1151, -1802, -9324, 4625, 2304, - -1186, 1180, 4894, 662, -7067, 869, 613, 1802, - 4839, 3412, -5460, -862, -4202, 7876, -1057, 2872, - -1336, 1731, -10788, 1088, 3433, 42, -939, 2479, - 6425, 991, -1621, 3222, -2464, 2988, -29, 481, - 11606, -2800, -8315, 7660, -3385, 1217, -728, -3670, - 684, -2295, -724, -567, -2150, -106, -1920, -2143, - 3465, 1968, -1089, -11953, -2704, 3049, -1351, 7225, - 5727, -525, 2639, 1955, 2259, 6489, -1867, 1544, - -3199, -4992, 2420, 4119, -2860, -9505, -2152, 10204, - -1133, -1201, -1468, -2989, 4658, 578, 1115, 368, - 1570, -776, -503, 1554, 1329, -696, -760, 575, - -1527, -3865, 8372, -3378, -8137, -8392, -3471, -1854, - -4852, 5270, -634, 608, 1289, -7660, 4983, -1266, - -2070, -906, 3291, 2459, 4807, -4241, 5773, -2258, - -4500, 2634, -13176, 6412, 282, -5849, 294, -626, - 888, -1088, 656, 192, -630, -3405, -12469, 2882, - 2184, 3920, 2715, -6852, -1111, 869, -161, 341, - 1856, -9450, 2719, -579, -3840, -8763, 1153, -3532, - -571, -766, 8301, 2936, -10501, -1073, 10068, -2930, - 6308, -2747, 3093, -1710, -3865, -1464, -4447, 446, - 898, 5386, -1074, -4651, 6205, 455, -1773, -1270, - 6986, -2493, 4076, 10605, -2522, 977, 4098, 1153, - -434, 4071, -2890, 2920, 9175, 2276, 4699, 642, - -1067, -968, 508, -1752, 728, 3260, -500, 1414, - 5554, 2761, 1973, -4704, 2127, 1397, -1070, -14536 -}, - -.cb2224l0 = { --12451, 389, 917, 1238, -626, -904, -1877, 2328, --12808, -1345, 406, 80, 383, -3841, 1188, -907, - 2369, -13409, 11191, -2547, -532, 762, -1627, 680, - -2305, -811, -1118, 3232, 3413, -2010, -453, -6816, - -4100, 1643, 11209, 933, -2272, 1440, -2465, -6862, - 186, 1563, -8468, -1832, -1166, -596, -326, 105, - -115, -352, -624, 31621, 129, -301, -615, -313, - -176, 620, -5, -1354, -3563, 678, -301, 621, - 904, -769, -1314, -956, -2294, -362, 381, -2398, - 17085, 100, 3962, -830, 18705, 237, -1296, 3534, - 1452, 259, 1690, -3106, -3624, -316, -16, 5900, - 2195, -1008, 14335, 14173, -1637, 1130, 1110, 499, - -1516, 500, -720, -494, -1010, -1264, -773, 1389, - 212, 8036, 780, 608, -415, 931, -301, -2186, - 2256, -706, 12972, -3461, -3695, 2073, -2768, -1525, - -7539, -441, -753, 4558, -8171, -1751, -6885, 4077, - 6714, 53, 1090, -3006, 3688, -1162, -59, 302, - 928, -450, 238, 10809, 353, 698, -476, 172, - -2198, -4377, -7518, 1605, 6348, 5147, -165, 165, - -463, -93, 1251, 671, 587, -402, -227, -462, --27960, 215, -56, -958, -657, 508, 98, -2811, - -1443, 3076, 6218, -9760, -10465, -770, 345, 3076, - -116, -2884, 2215, -2652, 1306, 2638, -124, -317, - 366, 1461, -295, 5073, 460, 1920, 12216, -7032, - 6816, 3037, -2630, -1087, -1315, 123, -582, -2137, - 5061, 291, 1740, -214, 1920, -3470, 10895, 9491, - 3558, -1256, -448, -10304, -2391, 1890, 484, 11057, - 6636, 422, 2316, -1663, -348, 633, 1200, 1788, - -1124, -24435, 140, 869, 738, 223, -1429, 602, - 433, -196, -1127, -1937, -879, -310, -564, 1022, - -4380, 7247, -3938, 4461, 2219, -8465, 9266, -4564, - -3169, -3463, -477, 749, 2460, -776, 294, -171, - 1072, 1748, 1000, -208, 1908, -998, -1898, -10485, - 2360, -11950, -2412, -2609, 3885, -2738, 1348, -559, - -1342, 9366, 1560, -816, 1178, 342, -175, 1286, - 3014, 10641, 246, 3128, 6618, -305, 10906, 6359, - -4395, 1415, 196, 11136, 1772, -3047, 3313, -1231, - -1974, -3021, -1480, -1345, -830, 1551, 2521, -506, - 7821, 7715, 5078, 8215, 2102, 1552, 2247, 3766, - -3158, -1811, 631, 3980, -397, 9030, -1267, -1974, - 1539, -360, -315, 796, -4749, 2076, -1017, 717, - 2290, 11212, 9365, 1626, 379, 2060, 1329, 4, - -25, -1348, 566, -1266, 1670, 2166, 13123, 42, - 2416, -2170, -6380, 172, 316, 40, 300, -487, - 402, -220, 846, -894, -1413, -2227, 1962, 19478, --14756, 14377, -582, -770, -186, -1008, -1520, -722, - -885, 2622, 311, -753, 480, 539, -1011, -1748, - -832, -603, -2015, 869, -14860, -600, 2110, 484, - -5874, 1532, 3290, -222, -4670, -33, -794, -2061, - -1185, -96, 337, 515, -1887, 26, 20283, -455, - -799, -62, -1083, 236, -1721, -569, -1259, 361, - 1090, -226, 1480, 13367, -638, 940, 3736, 6419, - -5995, 830, -6599, 4549, 1583, -9001, 1104, -1281, - -1270, -94, 1104, -2076, 652, 2263, 1465, -25, - 9046, -8139, -2646, -13200, -534, -15244, -1448, -1390, - 452, 584, -314, -1192, 951, 885, 396, 776, - 1303, 1298, -448, -32641, -234, -62, 31, -164, - -1042, -82, -26, -272, -559, -164, 669, -500, - 516, 1347, 9615, 1123, -1346, -1898, 8341, -10583, - 2286, -5233, 1503, 454, -2024, 4248, -2298, -2117, - 13390, -849, 2078, 1096, -651, -12232, -374, -812, - -3729, -829, -144, 1213, -469, 1112, 1146, 816, - 818, -912, -967, 907, 12, 2443, -759, -1833, - -174, -838, 488, -1560, -18242, -558, 5510, -1316, - 1758, 3957, -7130, -1394, 4962, 3870, -1907, -9247, - 2217, -3880, -4413, 1893, -3085, -202, 599, 1307, - 1574, -1070, -2593, -2722, 9506, -10170, 1105, 4879, - 2208, 38, 5596, -5990, -3205, 35, 9405, -219, - 618, 1308, 353, 3457, 1712, 717, -12937, 25, - 2176, -2590, -1223, 528, 1318, 4588, 7678, 5743, - -8430, -4487, 1364, 8082, -1727, -387, 469, 3172, - 401, -2771, 694, 14554, -2278, 3640, -11084, 924, - -593, -3841, -4338, 227, 750, 2974, -2834, -1765, - 2133, -1181, 5149, 11758, 11949, 3538, 2442, 2801, - 1457, -822, -3419, -2468, 191, -646, -975, -1271, - 832, 3088, -495, -10022, 1817, 1319, -880, 1342, - -1448, -3597, -3310, 8753, -161, -6550, 1422, -640, - -508, 11542, -277, -165, 837, 7389, -942, 11009, - -97, 1548, 1418, -445, 2105, -946, -8676, 5274, - 8842, 576, -1392, -1737, -1276, 5491, 312, 3624, - 2806, 2157, -537, 1656, 1982, -1300, -146, 463, - 496, 16792, -140, -1755, -832, -2123, -399, 5811, - -702, 2891, -3630, -1843, 346, 508, -364, -498, - -558, 32048, -744, 90, -372, 430, 704, 871, - 139, 772, 696, -108, -18, 310, -411, -798, - 465, -165, -321, 745, -27861, -752, 499, -215, - 172, 35, -196, -770, 274, -546, -96, -470, - -8976, 9156, 581, 904, -4644, -7801, 3525, -607, - 6444, 4058, -696, -1107, -632, 1475, 196, -933, - 883, 1101, 278, 433, 544, -497, 4, -1882, - 1504, 594, -30386, 218, 211, 850, -989, 319, - -867, -42, 754, 498, -70, -562, 660, -11561, - 54, 803, 425, 966, -1017, -1224, -12630, 1834, - -41, 98, -1083, 3508, 1750, -1751, 72, -503, - -38, 22211, 252, 88, 221, 690, 82, -1340, - 508, 638, 832, 482, 51, 7954, 2702, -1176, - 8830, -311, 2536, -6072, -4147, 5234, 494, -157, - -1289, -5678, -1617, 1508, -140, -55, 713, 440, --32583, 105, -394, -613, -972, 578, 1122, -32, - 114, -228, 342, -1237, 1123, 1126, -188, -106, - 11308, -3787, 563, 3423, -9926, 1623, -2551, -1448, - -4125, 918, -1366, -476, -66, 4, 761, 164, - -61, 20445, 238, 296, 492, -1126, -98, -1201, - 14, -1840, -865, 1178, -869, 105, 907, 248, - 1538, 2990, 11691, 7783, 1566, -6704, 2397, 594, - -1825, -383, 4264, 1911, 468, 1018, -676, -2676, - -7756, -2623, 10705, 2710, -8078, -5256, 1699, -2100, - -355, -2086, 10828, 611, 18, -830, 978, -4181, - 1324, -5262, -327, 1796, -9777, 1306, -1934, -8930, - 9520, -2364, -3997, -10209, -6326, 1394, -1758, 868, - 1192, -2916, -23, -1586, -296, 438, -279, -14171, - -1554, -206, 2383, 506, 1181, 8298, -491, -2771, - -4286, -7116, -1680, 506, 1729, -12965, -925, -985, - 420, -1746, -267, -478, -11763, -1030, 187, -3878, - 1516, 2472, -371, 29, 809, -1700, -152, 560, - 1833, 14397, 968, -96, -3242, -2497, -76, 2096, - 9593, -1200, 446, 1505, 8058, 1722, 501, 923, - -1171, -9516, -2536, 7368, -2, -5304, -2440, -352, - 510, 320, 301, 120, 687, -942, 137, 824, - -316, 1312, 510, -1133, -27448, -404, 1041, 272 -}, - -.cb2224l1 = { --14840, -1361, 12733, 798, -496, 1691, -1668, -1730, - 928, -3233, 338, -578, 156, 784, -787, -242, - -618, -853, -1282, -11766, 3970, 12178, -2034, 244, - -3411, 300, 159, 3494, -3060, -1459, -2484, -10680, - 752, 227, -1612, -922, -549, 158, 2260, -7640, - -4479, -4075, -2412, -7707, 600, -12358, 93, -1666, - -795, -13060, 61, 511, -2102, -2122, 364, -157, - 2310, -1552, 1260, 158, 9503, 7050, 7, -5902, - -7098, 444, 3736, -1836, 3109, -2328, 457, -871, - -327, -780, 661, 8684, 2530, -268, 954, 1380, - -1029, 418, -136, -3515, 1953, -1688, -8623, -3292, - 7758, 2796, 11643, -931, -501, -873, -444, -1342, --13900, -246, -283, -1779, 998, -1318, 408, 1505, - -462, 10667, -1813, 78, -16514, 360, -2029, 942, - 1674, 171, 317, 244, 1183, 724, 760, 1634, - 863, 793, 126, -326, 980, -629, 22219, -649, - 1274, 717, 1355, -1853, -1792, -1017, -2104, -768, - -1708, 2302, 2353, 11167, 10734, -3412, -2266, 75, - -104, 425, -880, 2072, 2934, -930, 270, -2414, - -925, 1023, -746, -236, -1620, 825, 1324, -101, --19348, -1291, 585, 2165, 2891, 3662, -577, 1800, - 408, -1486, 107, 351, -319, 1104, 956, 403, - 628, -277, -57, 938, -32768, -71, -441, -208, - -32, 191, 314, -171, 613, 749, 844, -472, - -444, 952, 42, -8026, 2720, 1911, -2780, 12311, - -122, 3569, -91, 6048, -776, 1694, -63, -1272, - 3581, 1622, 2538, 190, -13108, -820, -3056, 1189, - -1428, -244, -752, -6187, -3473, -697, 1368, 1043, - 7702, 352, -140, -12999, -80, 12672, -1473, 3113, - 1505, 667, 2392, 1767, 537, 1949, 657, -130, - 980, 1743, 8269, 2380, -2311, 197, -651, 2531, - 553, -1117, -396, 472, 4565, -12672, 2322, -360, --12766, 2205, -2651, -10690, -218, 586, 5229, 34, - 59, 1730, 1226, 2106, 4008, -1878, -9520, -1366, - -1174, -290, -1037, 1642, 1234, 305, -1279, -642, - 1126, -13199, -29, 642, 2928, 1936, -260, 588, - 11690, 9282, -3362, 7732, 1073, 2738, 4688, -1507, - -1461, -2271, -1131, 1969, -2152, 1637, -774, 66, - -1190, -206, -491, -1080, 644, -378, 367, 17980, - -1583, 2162, 918, -121, -432, 115, 5, 791, - 1968, -2287, -1574, -9545, 11146, 3540, -4700, -515, - -4548, 881, 591, 1044, -259, -978, 2, 232, - 778, -198, -1161, -378, -83, 421, 282, 26564, - -801, -1628, -1983, -301, 931, 886, 2196, 1453, - 752, 2956, -3478, 490, -1420, 13303, 1293, -9466, - 462, -12829, 11130, 8061, 593, 3697, -611, -534, - -698, -1148, 1598, 293, -726, -698, 289, 180, - 876, -369, -43, 234, -21629, -1448, -753, -480, - 956, 994, 531, -916, 630, 720, -2300, -9544, - -1418, 993, 2130, -2359, 2460, -339, -277, 1577, - 12206, -3507, -1280, 1938, 871, -1850, -809, -3364, - 6918, 1134, 5010, 8772, 2103, -9775, -1404, 5148, - -1494, 1549, 1761, -812, 654, -611, 822, -229, - -384, 10466, -337, 2207, 131, 2818, -2925, -3374, - -8786, -8552, -2282, 88, -1058, 8571, 2900, -529, - -1569, 1882, -981, 204, 2955, -4227, 4196, -3041, - 10804, 1822, 82, 1936, 2380, 12992, -5659, -3449, - 1329, -1668, 1291, -1726, 8328, 314, 2737, -677, - 2384, -910, -878, 687, 640, -721, -912, -12772, - -2079, -398, -1788, -2516, -8711, -1038, -985, -7151, - -9057, 890, 459, -298, 918, -10061, 848, -716, - 1822, 836, -9516, -985, -1379, -409, -2237, 1036, - -1082, -1704, 1333, -1432, 11463, -2355, -5975, -1674, - -640, -554, 8352, 2732, -5251, 4243, -354, 3662, - -592, -9317, -1205, -1084, -995, 11288, -2098, -1620, - 2367, -1286, -5312, -64, 540, -2327, -2703, -2013, - -8649, -1306, -948, 1443, 664, 2400, 4706, 4061, - 387, -20, 1859, 9283, -18175, 806, -1401, 1253, - 596, 2176, -1682, 2209, 733, 1404, -6652, 2754, - 950, 2346, 3629, -6875, 5069, -9302, 1472, 942, - 1184, -10432, 960, 3987, 1985, 421, 300, -716, - 938, 500, -160, 226, -87, -1648, -1857, -1977, - -323, 2305, -13843, -4148, -2978, 5430, -3422, -1138, - -2146, 1548, -1430, 734, -339, 8598, -4568, -496, - 477, 4969, 2593, 2842, 8645, -2365, -7455, -2687, - 249, 7516, -53, 219, 1139, -668, 566, -522, - 1289, 33, -141, -920, 2526, -2797, 16456, -2000, - -758, -194, 10984, 187, 1686, -4799, 9671, 1838, - -1224, 1325, 656, -5434, 3207, 1813, 1833, 14375, - 12259, -95, -536, -1746, -3568, -442, 964, -1472, - 1345, 2692, -589, 520, 616, 357, 326, -1363, - 28603, 700, 473, -908, -1129, 1046, 1106, -471, - -472, -980, 29, 574, -350, -545, -585, -1936, - 279, 882, -880, -52, -30552, 371, -154, -1275, - -1914, 104, -110, 1122, -719, 729, -743, 360, - 766, 198, -11674, 612, -10602, 1157, 186, -3132, - 3070, 1535, 155, 774, -9432, 4966, -6717, 320, - 5167, 112, 2727, 11228, 1368, 1864, 1197, -1519, - 1504, 17863, 49, 2212, 611, -1788, 2932, 395, - 32, -566, 2425, -9457, 673, 670, -247, 1617, --12578, 1408, 462, -14935, 1438, -808, -1850, -784, - 1856, -1648, 767, -1452, -1652, -1621, 1016, 1428, --11203, 4217, -6410, 2570, -1016, -1720, -9036, -390, - 62, -1245, 3027, -255, 1646, 1358, -907, -864, - -118, 874, 268, 252, 104, -926, -552, -1206, - 965, -208, -24472, 890, -1516, -630, -885, -804, - -374, -22520, -1143, -777, 532, 185, 603, 1775, - -1887, 413, -458, -1036, -211, 2693, 6976, -9498, - 1437, 10163, 2450, -1574, 4941, 884, -470, -3366, - 4664, 420, -568, 5703, 10, -1692, 143, 1592, --10966, 2891, -2961, 3938, 1990, 1726, -5247, 3326, - -6575, 584, -277, -441, 1679, -520, 1339, 1077, --11462, -267, -351, 201, 10939, 4150, 3890, 1484, - 2615, -676, -448, 2316, -1278, 9734, -3039, 2841, - 964, -7557, 156, -7228, -120, 5533, -4322, 1796, - 2555, -9912, -3038, 2236, 1190, 222, -1684, 3273, - -1768, 6233, -6442, 8545, -49, -45, 2366, 293, - 308, -689, 308, 368, -452, 1125, 2326, -2335, --17793, 2027, -779, 734, -2032, 1246, -2898, 4174, - -74, -40, -3105, -2135, 996, -12714, 3614, 4936, - -1928, 1528, -4158, -1791, -2318, 907, -326, 22513, - -660, 1022, 434, -564, 28, -112, 252, 372, - -842, -2, 648, 2323, -614, 23377, -263, 486, - -408, -362, -821, -724, 972, 1248, 444, -1741, - -420, -1371, 1088, -565, 22, -394, -64, -292, - -103, -501, -30510, -294, -266, 433, -700, 742, - -756, -407, -961, -148, -1416, -1041, -481, 121, - 346, 10240, 12629, 1476, -2647, 1350, -2012, -262, - -5621, 714, 4398, -2732, -10473, 9834, -5165, -991, - -557, -2733, -3460, 5779, 659, 1472, 2029, -2339 -}, - -.cb2224s0 = { --27522, 2628, -2486, 277, 874, -2351, 2725, 915, - 994, -1209, -439, 2936, 46, 1014, -1816, -3561, --14386, 3113, -10400, -1025, 2114, 1328, -278, 1182, - -1820, 3928, -1062, -282, -1327, -1468, 5975, 2342, - -630, -4217, 10116, -1254, -2646, -5210, -9942, 1904, - 21, 504, 2325, 1443, 6470, 2598, 8130, 810, - 304, -1059, -645, 14634, -3198, 4277, -669, -7170, - 1554, -2321, 2386, -1072, 2483, -4141, 2841, 3414, - 8014, -3141, 10857, 6634, 3138, 3199, -320, 36, - -1366, -4129, 3157, 2602, 4273, -2435, 2645, 2986, - -3712, -3995, -5476, -4693, -1664, 6384, -11201, 1320, - 2184, -5102, -2984, -1569, -2116, -1513, 14284, -11182, - -2925, -731, -1321, -6363, 1483, 3463, 1292, -2065, - -357, 9108, 6371, 3840, -6905, -8918, 2906, -1658, - 757, 1998, -580, -708, 2198, 1867, 960, 4522, - 1896, -1674, -4943, 2695, -2465, -2078, 9755, -4853, - -2602, 3466, 3897, -3633, 4918, -2049, 3730, -1982, --10085, -3458, -1866, 32, -1706, 3648, -308, -942, - -1630, 1730, 512, 14612, 3415, 974, 3079, 765, - 897, -270, -1813, -1533, 1118, -2805, -2764, 1130, - -1798, 4594, -3134, 964, -20082, 2574, 32450, -1379, - 52, 358, -226, 1902, 257, -1071, -650, -399, - -381, 2073, 2310, 2164, 8221, 1433, -629, 1440, - 1120, -3362, -4642, 2000, 378, 1208, -2648, 4534, - 3307, 13200, 2780, 3100, -3194, -10606, -11563, -4491, - 2218, -4500, 622, 1313, 2682, 3003, -1387, -3886, - -1567, -4864, 10899, -20606, -1606, -60, 602, 125, - -730, -1112, 979, 325, -13, -185, 1241, -288, - -552, 6042, -7049, -7359, -1456, 493, 11204, -65, - -2170, -5248, 2248, -1046, 591, 2085, -2844, 244, - -3454, 581, 1315, 3043, 304, -620, 405, -19944, - 769, 1076, -1456, -694, 2560, -1046, 2514, 14552, - 1586, -7027, -4710, 1366, 1552, 4354, 3296, 462, - 600, 500, 3225, 5083, -792, 3199, -698, -3589, - -2596, -3350, 2758, -3019, 5664, -9387, 4716, -3125, - 3306, 6268, -592, -622, -4144, -6290, 4990, -748, - 1854, -1042, -2996, -4279, 338, -1864, -8639, -11208, - 932, -722, 1788, -1927, 450, 2191, 11828, -6400, - 5364, -2236, 3212, 8340, -3229, -2846, -4676, -1825, - 2628, -303, -589, 7728, -4216, -3866, -4400, -194, --11316, 5646, 3716, 4827, 232, -583, 308, -1833, - 2153, -2508, -46, 857, -9587, 2768, 5136, 1462, - 5142, 7990, -3424, 1067, 7462, 4944, 98, 1014, - -4750, 13824, 1130, 2334, 9393, 2416, -4519, 27, - 2000, 929, -204, 481, -2780, -3720, 1267, 269, - -5383, -1999, 1249, -4238, -9351, -7440, -5964, 6154, - -6827, 3112, -2613, -164, 1604, 1245, -50, 8619, - -4044, 4652, 2846, 8359, 5345, -2902, 2295, 4801, - -5016, -6270, 2893, 2732, -3510, -2613, 4548, -6376, - 4510, 10566, 1859, 1038, -8381, 2782, -1622, 159, - -1035, -3232, -3766, 1580, -720, -4476, -3863, -920, - -2135, -458, 352, -2645, 3029, 301, -1145, -478, - 3696, -11700, 9930, 6649, 7290, 2362, 17226, 3238, - 1786, 662, 971, -736, -647, 1745, -506, -777, - 1458, 2406, -1417, -7933, -846, -2654, 1104, 618, - -2783, -10168, -3322, 9498, -939, -2342, -1876, -1914, - 84, 3468, -6533, 7796, -3797, -1318, -2183, 1310, - -895, 4943, 1062, -4468, 142, -244, 884, 613, --13963, -5853, -947, 18703, -964, 1090, 1070, 1388, - -1572, -1110, 671, 1706, 620, -262, -2421, -2277, - -5665, -5212, 4994, 2379, -593, 2048, 14489, 1165, - -1775, -2093, 2466, 419, 404, 5429, 3089, -1350, - 1975, 2281, 60, 599, -1600, 2286, 2358, 6698, --16423, 3760, 666, -1309, -1346, 2786, 2364, 1448, - 1114, 17956, -5301, 2430, 1178, -164, 2195, 3927, - -122, -737, 1468, 307, -1863, 1592, -7714, -2428, - 958, 220, 59, 4124, -1945, 11151, 8604, -2077, - -4787, -4578, 1096, 2685, 6478, 8314, -6221, -3842, - 2173, -43, 104, -2510, 3109, -2324, -4238, -4709, - -3233, 3228, 11454, 2428, 578, 780, -1096, 72, --22624, -1421, -4104, 226, 464, -1726, -1971, 2068, - 1142, 1412, 1412, 798, -2605, -3451, -1104, -2224, - -2250, -3470, -572, -1420, -1292, -58, -217, -21417, - -172, -6368, 30, -2170, 95, 378, -2926, -2180, - 2820, -683, 2018, -4313, -13469, 5396, 1808, -592, - 4732, -6602, -5602, -983, -4130, -477, -1236, -2263, - 3992, -12962, -1778, -2631, -2421, -746, 1964, 1754, - -760, 2753, -116, -3860, 10246, -448, -1318, -100, --10372, 1420, -210, 2768, 48, -2373, 7721, -3217, - -328, 1543, -2527, 3709, 4024, -916, -4588, -726, - -4302, -982, -14714, 3615, -1190, 9051, 199, 2252, - 1348, -4204, 693, 1241, -14160, -2460, -2017, 2997, - 766, -360, -450, -2919, -7976, 3210, -179, 8935, - 670, 1155, 6888, -2249, 2729, 1810, 6283, 684, - -9717, -1763, -921, -4578, 3941, -6408, 1431, -2742, - -91, -2094, -2118, -9752, 2801, -2497, 147, -5901, - -5270, 13170, 2810, 1576, -3191, 10253, 4226, -1340, - 2456, 1079, 12541, -5124, -8356, -1000, -558, 180, - -2070, -1880, -5718, -687, 10549, 1066, 220, -4147, - -695, 3648, -3460, -3143, -1623, 2150, -11222, -2566, - -6395, 3552, -4176, -698, 1248, 112, -4628, -960, - -724, 1191, 2084, 15207, -346, 371, 190, 5345, - -4283, -7482, 1354, -4424, -3775, -4143, 1444, -14876, - -589, 2498, 1305, -486, 1628, -867, 1584, 1094, - -10, -1260, -1046, 2528, 27472, 910, -1069, 829, - -117, -1097, 770, 252, -1412, 2353, 2200, -11, - 624, 8459, 6320, -9465, 1225, 2532, 5415, 9252, - -1441, -1378, 1081, -1997, -3904, -14740, -5220, 3627, - 5725, 6180, -5336, 72, 4638, 915, -496, 628, - 1880, -420, 2800, -7143, -7578, 3180, -4210, -1111, - 2979, -442, -182, 2778, 2398, -13878, 2209, -282, - -888, 180, 3584, -1005, 2, 999, -3074, 1205, - -4605, 5250, 17255, 2839, 2718, -678, -2651, 160, - 1596, 4685, 2324, 3100, 3744, -1954, -11674, 621, - -678, -6242, -3449, -1890, 3134, -289, -7162, 2268, - -8437, -624, 4999, -5946, 13013, 244, -200, -1494, - -1108, 3768, 445, 2429, -1264, 786, -2993, 3482, - 2448, -968, -1184, 213, -772, 4931, 42, -3850, - 2020, -17970, 84, 3016, -602, 1805, 731, 3522, - -2606, -637, 25535, 680, 1083, 4138, 1602, 190, - -1854, -962, -379, -2499, 2453, -362, -4552, 4689, - 2168, -5930, -10552, -5585, -4694, 2447, 2047, 5420, - 3908, -1449, -90, -68, 496, -12713, -2127, 1406, --10766, 2438, 2278, 2962, -6411, -22, -1966, 2814, - -1746, -383, -2381, -5981, 10920, -12354, -656, 2260, - 5200, -1908, -2275, 4276, 1174, -932, -532, 2832, - 601, 1551, -8434, -4170, -6411, 9099, -6886, 2243, - 561, 2026, -3598, -1125, 646, -5188, 6017, -632, - 772, -2919, -3776, -9938, 2461, -122, 128, -1416, - -1533, 343, 1318, -13738, -1528, -6418, -1196, 832 -}, - -.cb2224s1 = { - 32767, -749, -1885, -806, 739, -1858, 3902, 1029, - 332, -2122, 1240, 2705, 1362, 190, 1058, -1404, - 1224, 1122, 1208, 190, 1984, -1355, 1694, -21000, - -1012, 2418, -1269, -1154, 1113, 2291, -2317, 315, - 12872, -2296, -1510, 1104, 11324, -1146, -1018, 1326, - -902, 168, 647, -1828, -3838, -5682, 2732, -238, - -134, 13450, 1570, 2424, 996, -3494, -3720, 4897, - 5875, 149, -6367, 6659, -2329, 6916, 1134, 425, --19014, -479, -1900, 3470, -1777, -811, 1723, -46, - -2103, -1298, 2929, -4279, -639, -2443, 7231, -1187, - -2145, -777, -3287, 4895, 8878, -9318, 289, 4015, - -3148, -598, 2226, 11700, 114, 3237, 9586, -4570, - 2592, 3614, -2272, -2829, -3356, -1095, -5290, 4709, - -1867, -1930, -20722, 937, 892, 1415, 1544, 2950, - 5090, 937, -1411, 123, -31, -1568, 338, -938, - 5465, 5796, 480, -2782, 3351, -2489, -383, 1529, - -5686, 2446, -693, -12796, -599, 1894, -1576, -2244, - -4686, 10165, -1085, 10050, 2681, 1138, 2544, -1809, - -806, 5278, -8730, -3740, -2343, 971, -3254, -165, - -212, -4164, 850, 233, -13694, 442, 1073, 3854, --12926, -2001, 3468, -765, 829, 2174, 1531, -6036, --10848, -11009, 803, 1713, 2884, 1992, 75, -2989, - 268, 346, 1998, 4798, 8976, -4632, 1863, -4127, - -612, 4790, 10946, -1296, 8009, -1351, 356, -1711, - 313, 2301, 1318, 8050, 700, 1218, 2270, -2156, - 67, 1537, 1941, 3442, 13321, 691, 2344, 2594, - 1551, 3853, 7279, -10441, 1006, -11862, 5532, -611, - -582, 2257, -2873, 3993, -5133, -2264, -2478, 1576, - 1834, -4931, 10264, -1429, -10404, 393, -3715, -1470, - -2003, 384, 4869, -6780, -1297, 1572, 1043, 6980, - -4382, -3005, 3698, 4176, -1348, -4972, 1574, 9815, - -5995, -979, 3609, 3702, -8503, 668, 3354, 2552, - 9183, -1175, 1224, -2859, 11176, 6088, -1355, 84, - 1271, -380, 5336, 299, -690, -365, -8047, -3679, - -3204, 1334, -13451, -1392, 2200, -3646, -1046, -4292, - 741, -1701, 1722, 2061, -1358, 7266, -6356, 963, - 2190, -1349, -1882, -14128, -4662, 3552, 565, -1109, - 5413, 1239, -2618, 794, -2064, 11805, 9004, -2134, - 2804, 946, 80, -2387, -1205, 11, 1642, -1825, - -2324, -5018, 4208, 5285, 661, 12430, 1907, 784, - 10864, 340, 18, -138, 2885, -2247, 17, 334, - -3172, 2977, 970, 536, -1540, -516, -488, -512, - -1334, -1930, -2418, 1078, 24837, 12, 2060, -252, - -2536, -2206, -3179, -6785, -8842, 8736, 1393, 119, - 1652, 10126, 856, 855, -742, -289, -2208, 3831, - 6909, -6556, 2472, -245, -1729, 1460, -3014, 59, - -58, 132, 3903, -3762, -1419, 13273, 2708, -7752, - 84, 3525, -1305, -334, -13421, 5931, -4845, -2697, - 666, 558, -1102, 632, -2946, 4153, -4018, 4516, - 4875, 4460, -1567, 2233, 386, -754, 1256, 2145, - -1692, -13046, 1581, -518, 4397, 1215, -723, 3413, - -640, -5088, 1711, -714, 2536, 2433, -691, 10758, - -8764, 5541, -2071, -1662, 12955, 12998, 1252, -94, - 802, 2573, -2557, -66, -832, 106, -728, 1050, - -811, -2684, 629, -16524, 1531, -1617, 1348, 204, - 1722, 368, 554, -1752, 114, 1349, 1952, -1007, - 2626, 2035, 8148, -2539, -4296, -4460, -8542, -3089, - -1543, -857, -2617, -1765, 6642, 2167, -1531, -6881, - 86, -414, -5896, -5152, 17445, 1129, -5006, 2936, - -3432, -2226, 1176, 972, 1170, 530, 3390, 260, - -2909, -3550, -5255, 1771, -382, -1690, 17070, 2688, - 566, 2430, -1768, 3373, 1460, -3464, -629, 3119, - 430, -3554, 8357, 7075, 293, 2955, -61, -6919, - -4939, 3678, -6852, 652, 2206, 5918, -2768, -3022, - 5721, -770, -1102, -1057, -2760, 3086, 5611, -160, - 2714, -1042, 2569, -14248, 3846, 8212, 5392, 144, --11896, 618, 1212, 3283, -3777, -715, -3870, 2528, - -2900, 1645, -1786, -1852, 2776, -1348, -586, 234, - -4, -1666, 46, 2095, -1987, -18728, -2980, 2501, - 4042, 79, -1849, -2013, 8047, -1898, -108, 340, - -4760, 2134, 9000, 347, 10365, 4779, 6660, 1694, - -3253, -2282, -1488, 10406, -8054, -3414, -2934, -1611, - 3172, -2195, 4973, 1249, 2888, -4054, -5738, -2995, - -2282, 1977, -353, -516, 5322, 3225, -4907, 1303, - -4656, 9947, -236, 9382, 2332, 2076, 1470, 3173, - 4712, 2645, 559, 4904, 1511, -1715, -4856, 5750, - -1276, -306, -5980, 14393, 1443, 85, 156, 7718, - 793, 4199, 2122, 1098, 128, -1996, -1397, -20, - -534, -13296, -1518, -2970, -1001, -6474, -6146, 8337, - 5476, 3058, -526, -1295, 1623, -8791, 1257, 2006, - -5725, 3035, -2917, 1280, -8479, 5934, 9870, -13131, - 14, 1088, -9, 1969, 366, -3214, 192, 2764, - 1499, 346, -2031, -2900, -2529, 1072, 11717, 5206, - -44, -2514, -8900, 2892, 2132, 3635, 3735, 2726, - 1398, 6035, -2830, -4568, 424, -8696, 1368, -3860, - 1823, -2620, 4546, -2210, 1660, -1672, -10524, -484, - 950, 11, -4494, -6220, -5653, -13332, 2868, 460, - -4120, -4030, -3277, 522, -3403, 1126, -170, -1892, - -4366, 1304, 3477, -1507, 1111, -594, 1670, -8416, - -1690, 2492, -7109, 2531, 4131, -8123, -4884, 16505, - -240, -63, 32099, 974, -1360, -2395, -2005, -1156, - -877, -416, -922, 1857, 766, 71, 1380, -259, - -272, -1924, 2498, -3290, -16045, -2064, 2966, 2936, - -1265, 2121, 488, 3781, 1484, -1193, 4776, -1001, - -669, 1569, -379, -604, -5, -1943, 757, 359, - -560, 118, 17941, 2323, 215, 7621, -3582, -8130, - -698, 9893, -2752, -417, -1262, -1504, 3319, 1186, - -2192, 3014, 781, -3602, -6190, -7725, 3169, 2038, - 1175, 612, 2477, -4136, -12152, 4538, 567, -116, - -3222, -470, -118, -9257, -635, 3078, -11596, 93, - -4178, 4150, 5985, 4414, -2110, 542, -1125, -1242, - -234, 807, -1385, -2448, 824, 109, -1826, 3032, - 269, 14188, 3468, 908, -12, 2290, 5758, 1685, - 680, 5963, -2763, -173, -34, 3135, 1230, 2226, - 2471, -9546, 2266, -1583, 729, 3506, -10664, -652, - 2212, -620, 2762, -751, -6337, -4339, 4131, -1234, - 5423, -2279, -2884, -929, -12582, 416, 2046, -3854, - 11130, -2738, -670, -202, 6216, -7266, 9726, 1308, - -1761, 4696, -1061, -144, 482, -1586, 4377, -5016, - -3894, 2296, 4340, -555, -3003, -2117, -962, 100, - 4548, -1870, -13885, 1351, -3226, -8114, 377, -391, - -1344, -2148, 4756, -3518, -14429, -670, -238, 400, - 1234, 4389, 1181, 1046, 425, -32, 840, -29846, - 1580, -992, 1844, 1961, -1305, 1055, 418, 52, - -641, 2430, -1773, -5323, 3341, -5367, 14027, 3051, - 3864, 404, 4186, -1875, -5822, -4321, 112, 395, - -177, 1080, -3008, 520, 8, 226, 1430, -1635, - 8, -2632, -3249, -3595, 622, 564, 8404, 14463, - 160, -7828, -4113, -16547, 848, 6320, 2311, 4074, - -2050, 668, 1463, -2322, 1790, 864, 317, -594 -}, - -.cb2224m0 = { --17338, 5737, -912, 5906, -5315, 920, 2743, -2232, - 1943, -753, 1696, -1818, -2272, -564, -1306, -527, - -156, 9952, 36, 2524, 2053, 1841, -1670, 10622, - 2532, -5616, -324, -1132, -1148, 1920, 10232, -75, - -630, -10796, 1618, 1104, -2557, -603, 2115, 966, - -3763, -3183, -851, 4502, -1565, 10062, 313, -709, - 10707, 867, 3820, -2747, 3470, -1942, -486, 4092, - -6289, -2363, 556, 3190, 5046, -1869, 2886, 10572, - -948, -4191, 1544, -1727, 721, -3153, -712, 934, - 1610, 1070, 1248, 10645, 2340, -11102, -2744, -353, - -65, -4973, -1782, -1037, 1210, 1192, 1138, 1106, - 9422, 652, -9595, -1663, 460, 9107, -2827, 775, - 1131, 4732, 93, 476, 387, 32767, -161, 266, - -406, 604, 675, 83, -589, -639, 220, -830, - 2200, -142, -2000, -128, 902, 823, 287, 717, - 1857, -1626, 208, 2784, -72, -19310, 6190, -2063, - -9101, 3419, 1721, -2092, 332, -6533, -7594, 1138, - 807, -2582, -668, 410, -497, 1526, 96, 944, - 3319, 1294, -335, 1964, -380, -618, 3069, 101, - 18964, -2298, -10304, -1190, -998, -1384, -11466, -256, - -4475, 4027, -3532, 1828, -1311, -3417, -3925, -221, - 27688, 2277, -1227, 1043, -399, -3327, 515, 1665, - -616, 2724, -546, 4608, -576, -103, -9064, -1281, - -563, -3588, 2174, -824, 3379, -2360, 354, 844, - -7044, -2295, -2613, -11152, 1006, -1064, -17007, 1180, - 387, -8448, 836, -578, 2621, -356, -1476, 2362, - 822, 4547, 118, -11628, 352, 367, -958, -12423, - -65, -1591, -2304, -2880, 1684, 1708, -1693, -781, - -71, 10012, -534, -3672, 417, -2048, -1955, 10491, - -1257, 861, -414, -4058, 3042, 1529, -5823, 6877, - -3918, 993, 221, 2576, -7780, 170, -648, -139, - -3410, 7974, -756, 2657, -596, 12527, -199, 13752, - 2198, -938, -2265, 1736, 257, 1517, -676, -1165, - -2874, -2433, 123, -829, 2605, -10270, -3158, 3624, - 2072, 6960, 1490, 4634, 455, -8175, 1139, -4545, - -1491, 3727, -8738, -1951, 593, 14, 2897, 2490, - -2273, -1436, -10992, 3005, -4392, -3434, -4561, -1014, - -9506, -1609, -1248, -1593, -190, -10472, 3264, -2274, - 5097, -633, 473, 427, 725, 1577, 11032, 318, --12228, 78, -1116, 441, 1930, 4041, -648, -4324, - -224, 2738, 8826, -40, 327, 1761, 2371, 171, - 4039, -3411, -2495, 1150, -12181, -1704, 35, 528, - 417, 626, 1866, -472, 466, 905, -854, -875, - 1194, 24371, 488, 26, 695, 1777, 798, -169, - -16, -1252, 395, 871, 1170, -635, -1637, 2094, - -5427, -16393, -384, 3872, 33, -687, -1777, -4160, - 3020, -1906, 3868, 699, -400, 6755, -3253, 12699, - 1474, 7312, 991, -646, 26770, 2524, 2144, -500, - 1096, -1869, 1036, -1707, 521, -2091, 1445, 2335, - 107, 238, -227, -120, -32768, 591, -257, 867, - -1231, 650, -465, 356, 431, 762, -516, -594, - 512, 242, 2298, 1012, -1538, -11748, 3551, -5608, - -2174, -2428, 10557, 625, 1002, 27865, -589, -1527, - -1552, 156, 1905, 1041, -4190, 2300, 1603, -980, - -1764, 484, 1555, -2664, 381, 11676, -8848, -3060, - 675, -646, 736, -1279, -1261, -1988, 543, -1880, - 1917, -2165, 2846, 11863, 2076, 10381, -307, 4354, - 73, -2788, -2464, 964, -218, 1552, 1846, 1470, - 577, -594, 725, 30798, 43, 13, -1474, 260, - 1218, 1433, -114, 1020, -648, -678, -1879, -65, - 791, 366, 8547, 931, 1091, 1018, 16312, -1116, - -777, -1098, 404, 180, -899, -2865, -10089, -751, - 40, -2358, -2980, 3574, 7905, -190, 9207, -18, --18766, -270, -5300, -2023, 2422, -1189, 1267, -1085, - -704, 6823, 2164, 2, 125, -2319, 411, 591, - -488, -566, -3394, 304, -12375, -268, 11098, -150, - -2392, -1255, 3172, 162, 1295, 5897, 7944, 6019, - 3329, -2014, 2957, -4933, 4805, 2780, -5453, 2680, - 3220, 2784, -549, -19908, -1222, 550, -3540, 1822, - 4082, 2399, -6844, 2145, 938, -597, 122, -20, --14986, -1620, 1575, 561, 408, -6305, 760, 1634, - 2652, -8301, -2988, 1864, 2524, 3228, 7466, -2620, - 410, 1364, 1740, 2204, 1999, 1704, -2601, -351, - -104, 10688, -7166, 134, -346, 11852, -13322, -3171, - -1230, 1109, -2336, -962, -563, 1030, 2832, -969, - -1997, 3233, -414, -8246, -2074, 2737, 3557, 1625, - 1036, 845, 1848, 1710, -10388, -4586, 6915, 2734, - -8693, -667, 1568, 1758, 2396, -3262, -2497, -1472, --11848, -689, 3379, 1692, 1449, 2844, 8524, -15598, - 337, 590, 3303, -1594, -2548, 4529, 433, -1921, - 920, 1061, -1693, 191, 44, 957, -2397, -1126, - 41, 2164, -1587, 568, -17290, 4687, -1028, -403, - 1169, -1282, -1602, 242, -1234, 1870, 1067, 2444, - 1752, -2552, 8775, 1384, 5683, -4770, -12436, -680, --13344, -196, -276, -299, 734, 12378, 2364, 327, - -1494, 560, -90, 3394, 496, 2357, 629, -17, - 1040, -706, 589, 294, -1135, 25012, 444, 1206, - -298, 1424, 1524, -2188, -64, -1101, -1998, 374, - 1377, -1382, -11349, 1456, -171, -2369, 6966, -2808, - -8987, 3390, -811, 671, 3032, -3396, -9815, 2246, - 4418, -678, 1851, -1592, -11038, -1194, -3612, 2589, - -250, -495, 1203, 1348, -805, 1853, -345, -555, - -8755, -9695, -3768, -1506, -8172, -322, -7163, -6319, - 2052, 116, -4459, -2328, 4857, -2569, 1419, 959, - 1138, 7034, 4836, 3449, 6826, 13411, -893, 981, - -2060, -3710, 3177, -761, -1128, 4386, -127, 6698, - 3426, -2922, -61, 408, 1426, -1238, 15468, 94, - 373, 3597, -2432, -1989, -859, -8976, 2938, -777, - 409, -206, -7758, 3384, 295, -466, 29, 7925, - 2048, 930, 2296, -10030, 330, 7864, -1004, -385, - 2130, 388, 3587, -4480, 1560, -12768, -2606, 8178, - 771, -3519, -1590, -592, 2192, -1126, -77, -3947, - 1868, -1304, 11107, 781, 6240, 4134, -3314, 407, - -6125, 5168, -503, 2155, -990, 143, 219, -9950, - -1186, -1446, 1930, -8963, -4084, -6141, -976, 153, --13665, 564, 13631, 138, -269, 379, 1333, -1710, - -940, -511, 1214, -2190, 1347, -1397, -1321, 94, - -1802, 6627, 1306, -12347, 2780, -1091, -4362, 5047, - -446, -3472, 6064, 1075, 478, 769, 58, 802, - 562, -1581, 28580, 194, 1338, 573, -555, 617, - -409, -1249, -8, 1133, 952, -120, 2502, 5313, - 969, -1664, 1769, -12199, 5551, -402, 4862, 3270 -}, - -.cb2224m1 = { - 32767, -54, 1385, -206, 19, 522, -1176, -667, - -260, -1388, -1751, -2234, 228, -343, -893, -898, - -1004, 2517, -232, 20996, 507, -1857, 2574, 840, - -615, -1922, 660, 844, 52, 1272, 609, -692, - 21805, 938, 678, -399, -22, -1839, -996, 1560, - 218, 3973, -6547, -1151, -3914, -789, 938, -11509, - -2282, -606, -327, 3088, 797, -1540, -7598, 1378, - -100, 2108, -1907, -11671, 1538, 11136, 310, -2096, - -3037, 3181, 1731, 2043, 3424, -1098, 2046, 545, - -1778, 605, 932, 832, -2356, -1498, 1129, 11542, - 119, -10994, -3720, 4316, 346, -9141, 3921, -918, - -5476, 372, -318, 9254, -681, 4896, 1587, 1620, - 1850, 4057, -1507, -362, -1074, -328, -1502, -3092, - 2735, -378, -11572, -1292, -2575, -3397, -7566, -8977, - 1670, 8659, -655, 884, 1815, -9348, 570, 394, - 1670, 1942, -195, 386, 553, 8885, -9206, -624, - -2312, 15852, 782, 562, -1497, 720, 1804, 1415, - -3809, 3783, -1918, -3496, -637, 581, 1161, 961, - -960, -930, -1673, 904, 11510, -2286, -9964, 2964, - -5752, 2229, 786, -1479, -18882, 1517, 128, 3282, - 157, -2178, -564, -6029, 766, -4599, 3620, -4380, --20114, -677, 2134, -93, 1486, 648, -4790, 1862, - -1476, -56, -3443, -2622, -2806, -1185, 122, 1801, - -1547, 12241, -2785, 2386, 56, -4075, -10964, -832, - -4744, -1350, 2849, -255, -1375, 163, 1306, 37, - 2304, -1396, -11234, 9712, 1732, -2262, 3632, -431, - -579, -4045, 806, -12168, -1309, 840, -1474, 918, - -1240, -1601, 48, -4137, 6934, 3968, 7370, 4088, - 8648, 2351, 1466, 615, -12314, -2347, 4382, 862, - -4288, -3138, 1886, -4357, 375, 1949, 73, 287, - 135, -60, -1498, -2427, 1263, 3322, -582, 17508, - -1202, 1558, 3351, 484, -439, -571, -370, 11952, - 11656, -1407, -1410, -2976, -459, 397, 1980, -1374, - 1237, 5044, -2074, 405, -10650, -174, -12556, -1962, - 4569, -1293, -200, 3106, 343, 748, 1918, 1084, - -670, 3, -1070, -397, 3965, 9966, -609, 9691, - -900, 137, 2305, -5944, -944, -1500, 638, -703, - -582, 10098, -523, 776, 1266, 4860, 6213, 1181, - -5634, 518, 9116, -4740, 10683, -547, -1295, -91, - 104, -3115, -1724, -17, 1953, -745, 694, -474, - 12248, -596, -674, 765, 674, 4494, 1205, 5883, - -1638, -3996, -664, 8694, -5620, 3968, -717, -10425, - -285, -12605, 368, -3904, 12363, -1288, 1242, -1497, - -3117, 2396, -220, 1700, -2788, 250, 107, -150, - 345, 681, -44, -2466, -389, 2098, 312, 54, - 2734, -22225, -1232, -1778, 1063, -1586, -6658, 344, - -2889, -4348, -3685, -2100, 12, -1755, -6401, -149, - 8150, -10689, -748, 1443, -32768, 1698, 1461, 216, - 1373, -2814, 1014, 1135, -227, -1309, -616, 1566, - 395, -724, 852, 1579, -9647, -1214, 728, 329, - 9244, 179, 7204, -836, -3954, 168, -5722, 152, - -2886, 472, -651, 5114, 8734, -71, 11406, 1098, - -1452, 1190, 598, -880, 14611, 12540, -1523, 1340, - 1015, 1510, -208, 206, 1314, -1532, -246, -3210, - -1637, -197, 197, -32768, 1448, -191, -1720, -217, - 1021, 973, -2099, 56, 606, 39, -1569, -1205, - -2375, -2156, 4798, 2504, -11914, 933, -6015, 2657, - -2911, -5173, -1964, 1576, 5268, 1190, 675, 856, - -1718, -4332, 166, 1556, 19005, 2040, 1198, -2170, - 1824, -3409, 121, 830, -252, -525, 289, -1701, - 292, 854, -1150, -1108, 171, 511, 22114, 662, - -1263, -540, -2306, -2332, 869, -5191, 186, 536, - 410, -7576, 590, 13625, 3519, 3858, -2787, -376, - -6506, 891, 5025, -2054, 8316, -2115, 7668, -5808, - -2464, -2422, 1541, -3851, 1578, 420, -617, -6507, - -858, 160, 3876, -2830, -5970, -3295, 9829, 1099, - 1617, 3502, -3124, -4116, 138, 287, 914, -548, - 1056, -1546, 1218, -227, 11632, -574, -996, -9894, - 808, -5868, -1457, 8374, -2086, -280, 1038, 528, - 1862, 284, 3926, -144, 7168, 1224, 11628, -221, - 1018, 1683, 922, 561, 6910, 1895, 3044, 12613, - -74, -1424, 1654, 8872, 2255, -990, -2039, 269, - 9558, 10122, 958, 466, -1948, -1242, 1042, 886, - -1143, -3444, -8720, 1918, -300, 19074, -1629, 991, - 908, -896, 1207, 3602, -4802, -2912, 4100, 2936, - -1344, 459, -6904, -714, 524, 171, -1430, 1454, - -2725, 1130, -757, 2861, -11174, -2768, 5466, 3662, - 110, -1999, 12376, -2173, -2508, -2838, -2025, -4378, - 134, -9856, 1738, 1027, 1428, 38, -1560, 12824, - 13932, 549, 586, 720, 923, -1040, -2827, -3272, - 1902, -2113, 2624, 3296, -34, 12291, 1449, -12138, - -796, 186, 2777, -1007, 3276, -587, -1917, -130, - 2120, -564, -364, 1005, -615, 1504, -2412, 9219, --11412, -2490, 1262, -2720, 1608, -3276, 1294, 1882, - -188, 7090, 6029, -4207, -2739, 72, -10035, -1672, - 1509, -124, -1649, 420, -3623, -1069, -11225, -754, - -388, 790, -3209, -330, -2632, -11920, 3178, -1788, - 2585, 4146, 1944, -2757, -10616, 220, -14136, 2158, - -274, 2010, -362, 1107, -348, -1990, 96, -985, - 1599, 1566, 1393, 304, -1380, -924, -285, 620, - -30, -902, 26210, 1485, 1042, -1160, 352, -177, - 1245, 1879, -18, 727, -421, 223, -1298, 1066, - 962, 1306, 3866, 870, -18780, -3873, 107, -1408, - -1261, 808, -818, 1738, 1439, -2156, -1499, -2108, - -4626, 4039, -964, 16682, -1169, 266, 9373, 1238, - -2728, 2381, 12159, 2155, -472, -2293, -513, 3808, - -690, -2190, -1139, -6, 1379, -22803, 1380, -612, - 308, 1394, -902, -1454, -2620, -1080, -2864, -3301, - 108, 218, 8718, -617, -1098, 1436, -2005, -3966, - -2658, 6152, -874, -4636, 8705, -3382, -12072, 418, - -1837, -12582, 270, -788, -1174, 2156, 461, -297, - 478, -632, -356, 5796, -12024, 416, 2602, 3544, - -1240, -970, 4874, 7221, 704, 8940, 2316, 1174, - 2537, 5380, -5, -1818, 3020, -4120, 7042, -9618, - -1622, 3576, 2455, -298, 451, -5298, 7371, -1570, --12956, 9758, -216, 889, 5395, -2779, -4036, 1736, - -1871, -2036, -1119, 1847, 912, 2292, 850, 220, - 1300, 2228, 399, -2885, -2696, 2399, 3179, 6266, - 1629, 13091, -232, -5322, 1397, -724, 1666, -2012, - 3643, 1400, -2724, -18007, -506, -103, 1318, 2473, - 965, -587, 1135, -904, -510, -10767, 1937, -585, - -73, -1662, 3021, 340, -12475, -1618, -1, -1914 -}, - -.cb2232l0 = { - -9947, -673, 522, -36, 396, -433, 949, -442, --12495, -2186, 4280, -997, -1715, -7385, -379, 3498, - -572, -9897, 6686, -4736, 577, 1866, 659, -123, - -1682, 420, -866, 4458, 5821, 3155, 7929, -5562, - -1798, 3086, 8556, -65, -8943, 2354, -4187, -3798, - 627, -1859, -9760, -1811, -1724, -45, -1838, 1638, - 499, 148, -335, 20916, -264, -556, -269, -1014, - -1531, 711, -519, 462, -5117, 3944, -950, 8277, - 878, -4803, -5003, -4402, -4722, 2988, -144, -6887, - 10661, -909, 700, -2287, 12126, -101, -761, 1836, - 827, -609, 538, 442, -4504, 1812, 3818, 7359, - 96, -555, 1598, 10040, -554, 924, 3426, -1786, - 2620, -2132, 867, -519, -2299, -672, -508, 201, - -2457, 10872, -5003, 5422, -8890, -104, 2579, 940, - 401, 871, 11167, 1216, 1054, -2876, -1523, -3950, - -1229, -3410, -428, 3648, -9389, -3025, -1752, 7583, - 3953, 1938, 3899, 1435, 8170, 1019, -2320, 1299, - -1152, 226, 394, 11328, -1471, 604, -184, 567, - -3704, -5723, -5938, 423, 9362, 4546, -3318, -3395, - 5084, -4341, -1781, -2619, 1078, -365, 151, -413, --21591, -968, -202, -183, 849, -481, 407, -11, - -2708, 2472, 2689, -9232, -9482, -1776, 645, -1510, - -1410, -6115, -114, -2550, 1922, 1668, 288, -1302, - 948, 1967, 52, 2393, -1975, 374, 17358, -1332, - 5303, 3195, -2674, 4784, -1418, -1359, -57, -2126, - 4618, 8890, 6455, 1181, 76, 374, 9585, 8762, - 672, -642, 666, -6485, 1751, 3255, -934, 6196, - 892, 171, -102, -44, -326, 1330, -320, -480, - -842, -22376, -561, -141, 635, -6528, 5711, 2400, - 838, 2846, -3212, -5341, -5479, 4961, 2110, -7480, - -4215, 7964, -1308, 1219, 1541, -4418, 6293, -4522, - -4887, -5760, 2790, 1441, 6135, -1133, -1627, 1235, - 914, 572, -1043, -1473, -519, -4618, -1228, -12212, - 1101, -10794, -4292, -4355, 6431, -588, -992, 612, - -1771, 6751, 4871, 581, 620, -352, 277, 727, - 2226, 8552, -43, 2295, 9409, 1122, 7618, 1885, - 1192, -1432, -1103, 8666, -2078, -403, -1787, 1572, - -2200, -7705, -6743, -1277, -1228, 955, 7613, -1536, - 8530, 5703, 5446, 4251, -853, 4910, 1578, 2832, - 1274, -2610, 243, 2820, 951, 9240, 1617, 605, - -6755, -2728, -5658, 3866, -157, 1215, -8470, -2038, - -189, 10411, 7444, -376, 407, -1128, 770, -410, - 503, 1707, 786, -529, 82, -27, 21512, -282, - 81, -1129, -686, -555, 2674, -99, 1284, 2216, - 1238, 404, -3398, 1010, 3966, -1134, -2682, 14222, - -1581, 9779, -1114, 848, 1905, 2129, -3937, -4742, - 1229, 8051, -4344, 3914, 4273, -659, 159, -1188, - -1844, 912, -1256, -478, -16158, -2869, 959, -2096, - -2166, 2360, 7861, -2718, -6358, 7653, 6639, -3239, - -1690, -1242, 3439, 1254, -954, 604, 17512, -288, - 2412, 211, -298, 2656, -5217, -1770, 892, 1979, - -1482, 3498, -40, 10424, -1038, -1862, 9905, 298, - 77, 2179, -4444, 2580, -2069, -6473, 61, 84, - 1035, -645, -662, -824, -743, -104, -1962, -124, - 4976, -5378, -1254, -7055, -3474, -10695, -1254, 2547, - -694, 3194, -82, -2634, 230, 358, -12, 1594, - -90, 598, -76, -21136, -1278, 846, -84, 259, - -2536, -4442, 2337, -1606, -3264, -3126, -591, -1295, - -2440, -2592, 10888, 5821, -862, -5070, 10402, -10633, - 159, -2660, 894, -2112, -1774, 3732, -1020, 422, - 9487, 1608, -992, 2046, 275, -10676, 2606, -999, - 477, -1868, -1690, 4764, -6419, -7550, 8159, 529, - 2308, -394, -2394, 2826, 6680, 496, 3628, -646, - 3186, -657, -2260, -1416, -9202, 496, 6624, 2441, - 1554, -2195, -8458, -3459, 466, 6706, 1056, -8777, - 5436, -4000, -3130, 4794, -6127, 2008, 1602, 195, - 558, -1362, -880, -2662, 9726, -9793, 2989, -3182, - -2378, -1338, 1086, -4682, 372, -399, 11129, -601, - -666, 5206, -1106, 362, 3155, 328, -9862, 719, - 1602, 998, -2342, 857, 1510, 476, 7256, 4652, - -5750, -4991, 4611, 8718, -4434, -4119, -351, -1606, - -1033, -3717, 3585, 9381, -1594, 5052, -7414, -205, - 2356, -5949, -8738, 1526, -1838, 4760, -5444, 623, - 112, -2863, 5710, 4920, 9497, 3759, 10748, -201, - 716, 747, -2559, -4077, -449, -741, -136, -1303, - -572, 1886, -986, -10529, -51, 1360, 2418, 116, - -1490, 1928, -9977, 4720, 227, -11212, 3730, -2996, - 1300, 9935, 356, -4618, -384, 972, 3174, 3732, - -803, 2666, 790, 2067, 2343, -1209, -10147, 21, - 9066, -4564, 2508, -176, 264, 9834, 3360, 7278, - 9386, -1274, 522, -50, 4150, -884, 592, -688, - 309, 20750, 672, -1326, -346, 366, 2058, -607, - 633, 620, -677, 330, 69, 432, 319, 436, - -300, 21845, -318, -676, 320, -386, 889, -724, - -1394, -2664, -431, 2046, -136, 5520, 6700, 1192, - 5779, 9386, -3541, -5638, -16125, -259, 545, -267, - 1972, -2366, -43, 615, 251, 1003, -980, 2262, --10519, 12166, 2007, -884, -1560, -1250, -491, -438, - 820, 1212, 3512, 354, -1066, -46, 98, 315, - 8532, 944, -1297, 8011, 1029, -383, -1606, -8381, - -1650, 2852, -958, 1757, -4270, 2160, -9283, 2918, - -3718, -224, 6154, -5671, 3764, -554, 5214, -2526, - -31, 547, 6, 1633, -4562, 1424, 1177, -866, - 1648, 653, 6056, -1845, -1271, -350, 596, -2286, - 9893, -6594, 1099, 630, -537, 230, 972, -134, - -491, 79, 306, -74, 253, 208, -1804, 73 -}, - -.cb2232l1 = { --11397, 378, 12845, -1813, 342, 329, 1165, 550, - 556, -115, 755, 117, 2511, 260, -1189, -1406, - -1528, 1866, 3300, -9678, 1025, 10413, 199, 2878, - -3572, 8701, -1895, -1189, -576, -3384, -162, -10866, - 3253, -1267, 91, 2277, -86, -3394, 6576, -2475, - -1136, -4295, -1610, -8064, 297, -8908, -4433, -2954, - -82, -11426, -4610, 2063, 1522, -7972, -495, 1799, - 2922, -5179, -865, 4739, 11072, 3927, -483, -11111, - -2375, -1432, 1210, -1342, 2418, 1688, 852, -64, - 133, -4582, -7136, 10558, -3417, -3162, 2033, 3149, - -3050, 2532, 568, -2444, 4082, -2859, -10350, -4983, - 6633, 230, 5954, -1140, -657, -998, 1156, 736, - -8894, 64, 939, -260, -1704, -526, -1330, -869, - -2427, 12377, 1296, -120, -10560, 1794, -9090, 1487, - 7162, 519, -382, -3234, -66, 1294, 2363, 1482, - 498, -4053, -752, -154, -587, -293, 16533, 65, - -1211, 1666, 291, 2820, 2222, 2, 865, 344, - -1206, -1214, -2162, 8842, 11063, -2093, 1896, -857, - -144, 321, -9548, 4464, 5038, -282, 1160, -194, - 823, 3479, -8234, 5834, -320, 7114, -184, -2663, --11670, 472, -2013, -1282, 4390, 4453, -2126, -2483, - -900, -6262, -2237, -539, -1134, 164, 426, -8969, - -1746, -1960, 8172, -2127, -19948, 657, -712, 344, - -443, 458, -564, 56, 756, -157, 274, -1324, - -3372, 2981, 635, -9454, -4916, 2884, 2316, 8200, - -1452, 2135, 1785, -1054, 82, 5007, -4164, 642, - 9241, 5091, 1002, 2467, -8409, -854, -861, -2317, - 405, -1810, -793, -7907, 496, -1005, 3373, -1016, - 9527, -542, 1672, -9105, 280, 11170, 273, 908, - 89, -233, 10850, 870, 436, 1630, 3328, -499, - 5091, 1224, 9135, -480, -1134, 2428, -2904, 5077, - 2014, 2859, 4277, 7763, 8719, -11474, 1619, 1167, - -3188, -1063, -433, -4291, 2646, 1024, 2008, 317, - 746, 327, 6824, 1174, 8978, 5254, -8948, -136, - -2602, -1442, -698, -950, 1800, 296, -1016, 1653, - 3771, -9326, 4536, 7033, 4729, 6630, 1042, 167, - 11485, 12338, -147, 2834, 611, 1844, -313, 486, - -916, -887, -1423, 642, 242, 75, -1875, -645, - -1239, -2118, 1458, -272, -1703, 949, 778, 21826, - 214, -1320, 310, 2680, -1542, -2202, 1072, -132, - -2067, -3593, -8293, -10331, 9030, 402, -2702, 2984, --12068, 3170, -1098, -1175, -1188, 2998, 1159, -1712, - -904, 236, 42, 823, 548, -546, -1954, 15989, - -2212, 1886, 2300, 2293, 2606, 2905, 2365, -1214, - 1592, 1362, -2210, 1674, -1892, 15049, -1012, -2824, - -792, -11447, 11144, 4853, -357, -1230, 748, 1212, - -294, -424, -2720, 78, -2149, 966, 7794, 1645, - 138, -709, 464, 3614, -10308, 310, -4726, -3694, - 1088, -576, 690, 68, -145, -3282, -9280, -9537, - -1274, 3202, 588, 1790, 1437, 3880, -1803, -1154, - 15082, -2388, -1746, -885, 2267, 1813, 1688, -1039, - 9775, 350, 3218, 10550, 1048, -3731, -3748, 3517, - -910, -663, -413, -1045, -1236, -248, -132, -1196, - 12, 15815, 653, 1429, -371, 4094, -3050, 567, - -5524, -11128, -4261, 1929, -1719, 8236, 686, 1309, - -1057, -715, -2586, 1327, -38, -6180, 3499, -2080, - 8980, -1890, 62, -1004, 3308, 5809, -5778, -3865, - -610, 180, -519, 3129, 9000, 1607, 8484, -4056, - 4741, -4491, -355, -1324, 1203, -1864, -811, -15995, - -121, 1325, -817, -2170, -5753, 731, -1875, -2286, - -9193, -307, 247, 2469, -1738, -12290, 31, 1028, - 670, -66, -1856, 570, -3542, -3401, 144, -320, - -524, 184, -928, -1606, 10978, -3114, -8861, 1467, - 1156, 872, 8276, 5655, -695, 2788, 3733, 2155, - -2044, -10260, 1683, 1859, -263, 17966, -19, 1621, - 50, -261, -4143, 1245, -22, -1564, 809, 2462, - -8005, 1247, -1471, -763, -1686, -698, 2868, 796, - 4036, -3672, 11209, 1102, -9369, -1008, 1273, -906, - -4458, 1642, -3254, 3563, -94, -6267, -604, 8687, - 2388, 2214, 1759, -7788, 4296, -7467, 3547, 3248, - 845, -7784, -2195, -42, 5327, -1002, -3915, -4581, - -1215, -919, -3444, 5142, -1874, -3020, -2627, 1129, - -4456, 1840, -11472, -914, -6366, 3495, -2775, 484, - -5859, 980, -1967, 1350, 929, 6856, -3952, -3365, - 1514, 7423, -675, -2260, 6027, -3072, -6388, -3716, - -2398, 5564, 1447, -86, 1180, -1239, -1372, -435, - -1314, -1978, 942, -2018, 1027, 704, 20417, -94, - -1239, 252, -171, -1100, 1684, 1401, 623, -354, - -2674, -5042, -734, -6631, 7587, 4901, -1596, 6806, - 4230, -859, -867, 1266, -3869, -3972, 1548, -4889, - 2811, 2263, 2468, 354, -6197, -1278, 1947, 5675, - 10612, -1730, 2056, -70, 3034, -583, 879, -3719, - -8623, -1241, 822, 5832, 163, -1075, -784, 398, - 1170, -717, -374, 856, -21602, 89, -513, 260, - 854, 1152, 762, -601, 523, -107, 1033, 1877, - -1456, 226, -20758, 365, -8943, 1305, 193, 948, - 295, 2696, -3165, -1982, -2439, 1067, -12266, -1018, - 3400, -178, 1995, 11745, 1833, 9785, 1171, 582, - -1844, 157, -1242, -4080, 864, -1771, -4257, 721, - -4010, 7990, 142, 730, 1976, -6623, 4637, -7394, - -1143, -835, 3341, 1732, -7266, -448, 5379, 290, - 1855, 6977, 6637, -6561, -1370, -1767, -2769, -1189, - 3872, -4895, -4679, 3906, -1664, 1514, 7908, -7960, - -4147, -1235, -1706, 3314, 144, 1668, -9505, 2268, - 4147, 2515, -1451, 6475, 1675, 106, 981, 201, - 309, 60, -133, -472, 561, -380, 1130, 91 -}, - -.cb2232s0 = { --26218, 1606, -390, -696, 266, -947, 561, -1526, - -8, 1080, -187, 5671, 2249, -30, -4129, -768, --10908, 3826, -10422, -144, -1259, -1372, -3553, 1287, - -5151, 6442, -5101, 1386, 791, -1593, 12942, -764, - 424, -6212, 9733, 702, -9721, 524, -4818, -1232, - 6, -484, -818, 955, 6425, 3594, 5156, -286, - 1514, 4466, -1756, 11321, -679, -1481, -477, -8015, - -3059, 4476, 679, -1143, 2877, 2581, 3230, 239, - 12018, -1597, 13431, 11852, 260, 3306, -714, 1299, - -4375, -778, 170, -565, -3510, -6632, 3354, 5901, - -1070, -5912, -3430, -4970, -4712, 2648, -9113, 1561, - 1002, -5659, -3177, 638, 2289, -1050, 12310, -10364, - 2830, -961, -194, -6442, 2206, 3454, -2087, 4327, - 1080, 10257, 8107, 4904, -3141, -2339, 7568, -363, - 3765, 7960, 7067, 1496, -3842, 1805, 2415, 913, - -1641, -5411, -7583, 4597, -1324, 2882, 11310, -2570, - -2877, 3544, 4642, -2249, 7110, -307, -3413, -2871, - -8974, -6358, -5703, 4046, 83, 1887, -3476, -4346, - -2995, -346, -46, 22143, -576, 2597, 696, 1520, - 140, 2937, -3356, -988, 4090, -1246, -3347, 1387, - 2264, 1282, 7040, -806, -12810, -1105, 32767, -4266, - 108, -1998, -680, -1279, -467, -110, 462, 768, - 1678, 1408, -1888, -1115, 9430, 5852, -3578, 5367, - -1096, -4310, -9588, 4350, 6048, 2516, 3214, 4468, - -276, 15175, -848, -2875, -314, -6002, -11743, 448, - 9238, -3026, -3934, 2840, -2070, 1850, 444, 511, - -542, -7382, 6002, -14447, -1498, 176, 812, -2632, - -2291, -3312, 3953, 370, -2154, 1678, -1186, -6382, - 1544, 3534, -3767, -7459, 7265, -3272, 10669, -1677, - -7046, -1679, -132, 2108, -1948, -2938, -5393, -6222, --11293, 2066, 981, -731, 1869, -2211, 3558, -21513, - -678, -493, -2087, 245, 635, -2011, -3316, 13445, - 2089, -10186, 1114, -1241, 2121, -2305, 3316, -1282, - 2733, 318, 3534, 4844, -1439, 8932, -7649, -556, - -7519, -3442, 5068, -3546, 8586, -8425, 7146, -683, - 665, 3052, -2581, 248, -8320, 2270, 7045, -800, - 5890, 2187, -251, -2552, -3867, 3665, -1643, -11757, - -5542, 1806, 3669, -508, -3436, 600, 10412, -5426, - 1680, -4545, 11536, -1859, -5446, -4594, -4300, -1173, - 282, 2100, -2556, 9486, -7325, -7252, -3155, -775, --13674, 4272, 3066, 9352, 1647, 1136, 794, -520, - -654, 1539, -2244, 3155, -12039, 731, 3379, -1904, - 6866, 9669, -2384, 2099, -2426, 1633, -3358, -5662, - 2164, 10679, -5330, 7066, 5826, -187, -4840, -1174, - -3694, 976, -2548, 2292, -3517, -1007, -4041, 684, --14986, -4789, -4135, -4376, -10678, -1482, -10466, 3575, - -1960, 3185, 1198, -196, -892, -5424, 4802, 13608, - -7772, 3952, 4404, -52, 1097, 3182, -2699, 900, - -1258, -8055, -3102, 784, -2574, 1556, 1060, -5417, - 537, 11991, -650, -487, -10250, 6766, -3716, 1062, - 2525, 1039, -3002, 5742, -502, -4583, -144, -144, - -5896, -978, 1786, -1420, 1944, -130, -5202, -1578, - 7821, -11675, 9980, 5065, 5942, -362, 16344, -801, - 1932, 1242, -10, 791, -170, -2468, -479, 3297, - 4328, 11473, -1549, -12316, 209, 1739, 1875, 1305, - -4310, -13049, -4913, 9208, -966, 2570, -138, 890, - 1373, -1324, -965, 8563, -7560, 490, -1392, 5695, - -5656, 5431, 3974, -1131, -1246, -1334, -3859, -3150, --12976, -6929, 665, 9393, 490, 2212, 18, 542, - 229, -3925, 1836, 4223, 5268, 1200, 471, 20, - -9914, -5774, 8362, 5929, -7087, 2005, 15624, 1626, - 5419, -1492, -1536, -417, 1957, 2585, -404, -1125, - 2296, 596, 836, -356, 745, -2810, 2879, -2354, --21682, -108, 726, -862, 593, -42, 266, -1356, - -2119, 19613, 814, 2462, -2940, 222, 3595, 5634, - -807, 1219, 2446, 5666, -1839, 7092, -10581, -5136, - -2408, 5726, -1116, -2348, -6318, 8991, 6750, -5321, - -7344, -2194, -5544, 1705, 12500, 9069, -1966, -4914, - 2225, 3537, -1485, -5141, 434, -1620, -5383, -710, - -5443, 3930, 7082, 667, -3289, -3202, -2097, 1970, --11647, -2927, -2098, -1345, 3449, -2075, 262, -756, - 1829, -271, -1292, 1079, -5746, -344, 3660, -4456, - 3593, -7652, -1367, -828, -2290, 1063, 4234, -17596, - -911, -6068, 1040, -2956, 2704, 1763, 974, 3132, - 697, 1267, 240, -5520, -12368, 10830, -633, -5939, - 2307, 1868, -2216, -1261, 597, -6302, -5145, 3550, - 7519, -6963, 3752, 876, -1912, 30, -9192, 1075, - -4632, 9108, 1139, 911, 9290, 1268, -1006, -1718, - -6668, 3294, -1510, 6527, 456, -1400, 11424, -4168, - -3940, 4738, -4863, 2990, 3202, -441, -4744, 4623, - -4351, 3997, -11016, -737, 136, 7978, -3801, 4170, - 3602, -2217, 849, -2552, -22232, 323, 193, -4, - -1030, 590, 1625, 3208, -10595, 2624, -741, 13121, - -1044, 1601, 5175, 2199, -3833, 1804, -2314, 793, --11486, -655, -3320, -2975, 4065, -3124, -706, -7264, - -1038, -3082, -5503, -7147, 8367, 1205, -1092, -1694, - -1078, 11584, 8, -1237, -2077, 9732, 4963, 2780, - 674, 581, 8226, -1231, -9252, 644, -3284, -744 -}, - -.cb2232s1 = { - 32767, -45, 422, -1139, -1052, -2085, -695, -612, - 1451, -288, 58, -878, 53, 2912, -1891, -7148, - 1893, 3028, 165, 963, 2260, -7904, 5857, -18824, - -2617, -1030, -872, 1500, 1118, -745, 143, -436, - 1239, -3840, 1785, -2506, 20237, -1026, -1556, -1371, - -660, -1185, 939, 1315, -3658, -5428, 587, -4105, - 1596, 12612, 5781, 1172, -3490, -1182, -333, 6258, - -2594, 2144, -4830, -190, 1972, 2687, 1327, -987, --15046, 4659, -71, 6890, 1588, -4787, 4318, -3704, - 496, -5601, 1954, -1250, -3389, -5156, 9238, 2298, - -4945, 183, -2036, 114, 12250, -2330, 71, -3395, - -1402, 3668, 531, 10915, 1162, 7738, 9089, -1250, - 1500, 6357, 1155, -5094, -2641, 1657, 470, 2022, - 535, -306, -18031, -903, 2913, -5486, 1769, -1419, - 9082, 2149, 3516, 6960, 833, 1123, 1266, 1672, - -690, 9634, -2986, -4675, 1006, -2205, -2919, -3205, - -2759, 107, -931, -9694, 2340, -862, -2782, -3636, - -9414, 9564, 1057, 8664, 1326, 3928, 1452, -4692, - -3437, 8610, -10466, -6638, -2879, 3408, 861, -3057, - -823, 164, 3153, -3698, -15693, -886, 1456, 3278, - -6160, -57, 1110, 22, -2985, 7299, -1082, -7921, --12212, 480, -7645, -211, 1586, 3874, 3242, -883, - 6730, -1597, -506, 3744, 7552, -7607, -65, -1442, - 266, 10012, 1594, -2628, 6988, -1049, -516, -691, - 672, 4913, 1788, 14973, 342, 962, 7212, 1124, - 500, 1135, -311, 3886, 12548, 5432, 6219, 3341, - -122, 5636, 6871, -10831, 4010, -10084, 1456, 5216, - -1013, 1102, 4164, -1490, -5186, -242, -4498, 3322, - 3584, -2176, 5704, 515, -11556, 1446, 4303, -3928, - -4227, -7268, 6069, -11330, 822, -2054, -3035, -2516, - -1816, -3796, 8408, 8849, -3030, -8201, 1149, 7388, - 1036, 2586, 5618, -2274, -5037, -1497, 384, 1454, - 8154, 1672, -2409, 3347, 13258, -979, 513, 7826, - 2662, 1818, 5537, -1104, 2645, -10632, -8767, -5667, - -1029, 806, -9040, -4684, 792, -5008, -5807, -3924, - 964, 313, -2521, 1106, -5728, 13534, -8078, 4216, - -1388, -2588, 986, -14536, -1410, 3461, 1360, -1348, - -104, 1493, -2858, -2860, 2045, 18330, 4814, -3628, - -705, -3228, -660, -2664, 2616, 4548, 3753, 1574, - -1319, -1110, 556, 3304, -2803, 13052, 4592, 2922, - 13667, -2322, -3056, -2717, 174, -4222, -4296, -7695, - 1366, 1786, 1041, -110, -1997, 4102, -1855, -900, - 203, 1311, 3412, 4107, 22609, -4112, 427, -2488, - 257, -1267, -1277, -6430, -7193, 10667, 4495, -4317, - 6846, 13213, 7335, -972, -3137, 335, -609, 3131, - 2406, -3762, 2151, -5188, -7675, 2068, -2027, 3722, - -773, -3276, 1539, -7886, 1005, 13693, 4601, -8386, - -508, 5662, -4889, 93, -10603, 4051, -2, 1094, - -4897, -2274, -2377, 2228, -5507, -464, -3455, -227, - 9433, 8093, -2245, 3701, -1047, -6827, 2037, 1926, - -3610, -15420, -581, -6127, -2075, 2501, -2216, 5385, - -2297, -2660, 1563, 3244, 1418, -2012, 2964, 12235, - -8595, 2728, -3541, -6511, 11038, 11326, -183, -1102, - 1038, 1224, 20, 1441, -349, 1240, -7737, -930, - 1411, 6945, 4130, -13544, -2625, 3550, 3149, -730, - 7658, 3098, 673, -2259, 2556, 1543, 1478, -951, - -8128, 4951, 11919, 4588, -8448, 784, -11498, -1908, - 2578, 2936, -7496, -5834, 1987, 3407, -4133, -4924, - -1348, -1300, 916, 899, 20257, 2027, 1450, 4388, - -3748, 3846, 2187, -1158, 4720, -3613, 5312, 4055, - 448, -6383, -8794, -2232, 1920, 834, 27087, -754, - 90, 1410, -985, -1381, -61, 650, 1080, 7035, - -2772, -1233, 13410, 4494, -472, -2896, -5083, -2217, - -5778, 437, -6853, 4996, 3442, 6092, -6497, -3871, - 4024, -898, -73, -3067, -2793, 5640, 6076, -2454, - 3598, -277, 1672, -6858, 2419, 9753, 6292, 8835, - -9909, -4724, -618, 7266, -416, 1965, -4968, 2421, - 1155, 3815, -116, -3725, 7872, -4901, 2383, 1612, - -2186, -2302, 2791, -2226, 1144, -13379, -6602, -806, - 7099, -2098, 4194, -2128, 8663, -4275, 452, -135, - -6053, 1280, 12815, 3278, 8452, 4479, -1648, 1453, - 1407, -966, -1016, 3173, -7333, -4552, -13176, -1744, - 577, -1572, 611, 1202, -146, -5773, 3012, -3016, - -1581, 3162, 3818, -1970, 6195, 1946, -9656, 2861, - -7875, 3133, -7840, 10951, -1684, -306, -227, 9776, - -82, 1736, 1180, 3457, -2874, 5365, -7428, 7604, - 2623, -2998, -2270, 10410, 1252, -2725, -4433, 1758, - -5225, 6522, 6698, 712, 4694, -2392, 240, 423, - -3030, -12708, -3136, -5176, 480, -1624, -12900, 7537, - 4371, 1186, -1828, -757, -1850, -974, -3755, 1415, - -6302, 2642, -3823, -1570, -8090, 8251, 1945, -9213, - 1147, 4128, -4301, 806, -1745, 704, -2496, 1375, - -802, 9, -808, -252, -5453, 3857, 10353, -536, - 1875, -2896, -10792, 3358, 1063, -890, 7200, 3660, - 406, 2840, -6973, -4469, 4638, -8091, 2772, -8035, - 1728, -5315, 7234, -2718, 3707, -1226, -11858, -2397, - 772, 3285, -4089, -1400, 1113, -16680, 1885, -435, - -959, 242, -817, 259, -2010, -1857, -557, -914 -}, - -.cb2232m0 = { --13394, 14382, -488, -1088, -817, 100, 305, 2267, - 2527, -1584, 995, -5781, -3585, -1826, 803, -4108, - -3137, 12111, -211, 838, 4879, -1964, -1728, 13830, - 2084, -11535, 664, -2499, -3421, -703, 4528, 968, - 1008, -12010, 984, 2658, 422, 1412, 10772, 2216, - -4291, 1329, -2324, 2392, -2029, 12322, 1053, 169, - 12635, -902, -62, -670, -3007, -3322, -2948, 1817, --10688, -1264, 1949, 2734, 1072, -1429, 2085, 10312, - -1685, -4433, -1287, -9620, -1132, 20, 614, 2470, - 2821, 5934, 3526, 11292, 50, -12970, -11948, 1114, - 1980, -945, -713, -5357, 3766, -447, 969, 2247, - 11854, 2148, -12393, 1518, 610, 4527, 1164, 1347, - -1422, 649, 653, 855, -24, 30152, 20, -564, - -2825, -11, -1408, -80, 239, 305, -3163, -854, - 568, -18, -4212, -403, 288, -3009, 229, -1152, - 16390, -877, -458, 316, -128, -12165, 1088, -828, --10886, -269, 747, -1026, 1716, -10920, -9204, -3123, - 958, -6128, -260, -851, -1524, -2386, -6472, 228, - 2667, 3158, -140, 1719, 2330, -2730, 3080, 44, - 15743, -2167, -11637, -607, 476, 408, -12505, -1862, - -1892, -440, -3785, -2348, 1229, -338, -438, -797, - 29933, -715, 366, -197, 576, -188, 484, 240, - -4844, 1168, -1054, 863, 875, -295, -16091, -1972, - 3976, 3833, 3056, -770, 1011, -3098, 165, 3973, - -9367, -18, -299, -11254, 1005, 8644, -14788, -2268, - 2644, -8410, 578, 2169, -766, 2764, 2378, 3282, - -2710, 7612, -542, -12062, -2437, -414, -506, -10332, - 2732, 839, -2593, 923, 1159, -1057, -7333, -86, - 2832, 11328, -1616, -302, 4399, -547, 6107, 9983, - -6901, -85, -544, -4916, 366, 4878, -8662, 7313, - -3056, -1027, 2381, 8906, -7270, 509, -1124, -2512, - -1636, 5830, -5868, 2369, -3236, 12557, -2713, 12793, - -2957, 1688, -852, 4723, -122, -2336, -4698, -1306, - -7399, -2090, -1953, -1505, 3335, -10906, -2598, 1322, - 2556, 7210, -1553, 1262, 1878, -10719, 1746, -2736, - 1448, 8734, -9602, 828, 1752, -1632, 8037, 2728, - 562, -1879, -10572, -544, -2254, -1997, -6384, -87, - -5878, -473, 498, -2960, -5698, -11500, 1815, 2050, - 7388, 5230, 2782, 5602, 514, -306, 13022, 523, --10776, -846, 716, 270, 3350, -6021, 1420, -6175, - -1978, 3967, 11612, 3320, -4100, -2468, 4595, -5338, - 65, 3478, 19, 3501, -15896, -1335, -1861, -1944, - 3935, 3630, 4627, -5892, -458, 383, -211, -594, - -165, 24865, -656, 2300, -404, 257, 214, -643, - 2298, -180, 35, 4974, 834, -998, -1738, 5449, - -9222, -10858, 4188, 9147, -5639, -1691, 990, -1945, - 3421, -3527, 9005, -2038, -2369, 5098, 967, 15840, - 196, -3204, -1079, -776, 11806, -1352, -2053, 2011, - 309, 642, 1541, -1466, -4465, 6679, 5756, 7474, - -58, -1864, 5908, -1576, -30374, -904, -571, -1136, - 425, -22, 666, 1150, -734, 82, 1254, -226, - -437, -890, 1464, -3368, 987, -11885, 1127, -7224, - 1872, -8198, 8775, -2695, 1457, 15102, -899, -1384, - -1975, 1891, 3128, 1465, -1649, -1363, 1483, 303, - -534, -7, -1710, -1377, 769, 12698, -8987, -802, - 4636, 572, 2004, -3513, 442, -9863, 3215, -4550, - 2138, -4346, 5682, 11053, 7220, 9842, 797, -1399, - -2679, -5857, -2143, 3241, 2330, 248, -630, 1044, - 639, -3432, 125, 22083, 1976, -1003, 813, 552, - -571, 4358, -6200, 3635, 5439, -636, 233, -4856, - -3519, -460, 6956, -4215, 1537, 7895, 13910, -7637, - 1392, 1572, 648, 3690, -1988, -2463, -3302, 677, - -924, -535, -6025, 4126, 7178, -4145, 4960, -1860, --10926, -1470, -9506, -226, -258, 32, -479, 2222, - 94, 11358, 3984, -2732, 2111, -590, -2444, -344, - -425, 598, -1382, -1213, -17632, 1566, 1387, -3521, - -57, -1829, 4788, 574, -206, 7962, 9157, 6459, - -1594, -1355, 4874, 1066, 2006, 1793, -7569, 2369, - 1108, 1305, -3046, -14052, -1736, -4045, -4328, 7497, - 3304, 1518, -5666, -529, 4256, 4667, 932, -1495, --10414, -414, -2110, -3150, -1250, -8799, -419, 5162, - 8497, -8720, -746, -3015, 6403, 3855, 7350, 165, - -59, -958, 5780, 6044, 1736, 3016, 31, 1012, - 3422, 7598, -6837, -2092, 2262, 6171, -10362, -2108, - -1352, 1798, -4872, -6369, 2507, 2640, 6074, 1835, - 2948, 388, 398, -9295, -5384, -2088, 2096, 742, - 3286, 441, 7135, -2112, -9958, -5612, 2479, 5427, --10114, -674, 308, -1037, 770, 514, 1868, -252, --11901, -984, 670, 2506, 5396, -1047, 9113, -10865, - 4872, 1720, 2226, 947, -2336, 2649, 173, -1464, - -2874, 4463, -1270, 3429, 6242, -5380, -7772, -4550, - -8451, 2045, -2855, 5336, -15066, -418, -4886, -648, - 3736, 945, -956, -4825, -116, 130, 1889, 9642, - 3790, -4371, 7180, -1556, 6562, -2207, -7910, 506, --21594, 662, -338, -943, -1022, 6453, 301, -464, - -457, 840, 3313, 10946, -294, 8156, 138, -1425, - 2397, -792, 6468, 4615, -511, 15938, 494, 274, - -5976, -660, 3894, -2140, 1424, 2003, 4101, 2823 -}, - -.cb2232m1 = { - 20456, -1952, -1581, 869, 628, 76, 1404, 4060, - 508, -3177, -946, -2992, 2422, 1139, -1931, -240, - 1011, 365, -1106, 20973, -1438, 372, 137, -1058, - 1171, -1252, 2794, 1434, 1814, 482, 3948, -2704, - 20422, -241, 441, -1121, 499, 1036, -918, 9708, - -3166, -488, -10379, -3201, -5254, -1871, 5665, -12622, - -7591, 127, 1469, -2267, 1813, -4197, 2065, -602, - -395, -652, 333, -19114, -1092, 4310, 1590, 1688, - -1453, 177, 4402, 1168, 5972, -1295, -3258, 1542, - -4832, 3377, -5545, -3622, -4944, 2064, -2846, 8118, - -845, -6778, -3640, 5729, -907, -11007, -5, 2634, --11118, 2108, 144, 13299, 251, 336, 563, -75, - 3004, 169, -3892, 1477, 1066, -1571, -1113, -1088, - 517, 465, -21841, -1541, -1094, 1841, -9213, -17478, - 1662, 8, 1192, 1174, 1014, -5659, -695, 316, - -5161, 1803, -1056, -2369, -2919, 2941, -9712, 1975, - 426, 11214, 2288, 6186, -7348, -3062, 3341, 3252, - -4102, -346, -876, -7088, -3330, 4507, 310, -1632, - 299, -2636, -2740, -752, 10159, -7201, -9568, 3134, - -4002, -41, 2479, -1816, -14099, 3575, 1161, 6427, - -2466, 390, -1883, -6265, -1266, -263, 1474, -592, --21234, 94, 4187, 1, 3227, -3273, 1950, 406, - 543, 1661, -2648, -9252, -2048, -5987, -722, 4932, - -4410, 12504, -1572, 2244, 5610, 307, -9710, -3642, - -6436, 4368, 2956, -2269, -6196, 4069, -766, -3695, - 3416, -5786, -9668, 11677, 1208, -965, 1516, 1132, - 1018, -6168, 1970, -10357, 1379, -725, -8789, 3730, - -65, -4758, -1818, -1050, 9641, 4519, 2886, 2667, - 6348, 2436, -438, 1978, -9374, -1286, 3893, -2073, --11199, -2081, 3345, -3444, -9480, 2410, 1986, -1869, - 3252, 5949, -2119, -401, -214, 3416, -1067, 18510, - -2986, 3510, 508, -357, -837, -1205, 2884, 11587, - 11565, -555, -2664, -873, 3642, -2068, 1734, -4408, - 330, -181, -1358, 1407, -9739, 809, -10203, -2066, - 3440, -2063, 3238, 3734, 1671, 750, 6890, 4068, - 1238, 493, -1330, 76, 8918, 10855, 85, 12236, - 3570, -1074, 3008, -9424, -3186, 1271, -380, -157, - -4974, 10575, -1378, -219, 1354, -1589, 10936, 2268, - -3787, -1040, 7567, 924, 10490, -806, -1318, -1576, - -209, 93, -3745, -3820, 439, -9828, -6265, -864, - 31342, 35, 1332, 443, -590, 846, 104, 868, - -863, 1526, -1088, 11494, -7055, 3564, 109, -3072, - -2234, -4530, 1866, -3425, 9940, 3158, -1821, -680, - -1124, 2884, 1191, -61, -9698, 7596, -558, -9019, - -1181, 208, -1342, -68, -312, 294, -1468, 1410, - 39, -21081, 724, -2137, 935, -8, -10297, 3509, - -6510, -6558, -6906, -1905, 1915, 5920, -8983, 3416, - 7300, -1372, -1422, 1822, -10433, -2530, 1669, 554, - -3008, -3351, -922, 8279, -5184, 5520, 4785, 683, - -506, -4558, 1938, 8442, -12639, -54, -2907, -820, - 10004, 1780, 485, 1401, -3786, 786, -5937, 2632, - -1540, 972, -3342, 2294, 8076, -1006, 11731, -1825, - 3036, 1085, 1160, -9680, 11111, 7838, -2504, -2112, - 2376, 2534, 3624, 555, 3610, -520, -831, -15, - -498, 167, 711, -22685, -999, -1466, -1643, -394, - 5404, -4247, -2307, 4052, -1156, -1240, -490, -1598, - -4365, -8382, 10493, 464, -16592, 3723, -7709, -821, - -4218, -922, 398, 5635, 2184, 5090, -7144, 2420, - 792, -324, -1278, 3172, 13101, 1608, -3996, -2219, - 2995, -6924, 816, -2482, -406, 3458, 503, -8154, - 3460, 2542, -3703, 8524, -61, -430, 23212, 1203, - 2335, 5556, -476, 923, -565, 593, -1611, 1814, - -1614, -7067, -1957, 10166, -4306, -421, -4026, 1854, - -9881, 667, 7720, -2906, 7003, -1823, 6344, -8614, - -2965, -2720, -62, -802, 1945, 4574, -4604, -8341, - 518, -3543, 95, -4262, -5220, -133, 10270, 1999, - 3234, 8900, -4866, -3708, -4465, 4542, 2545, 1770, - 6995, 3559, 1133, -1152, 14680, 1002, 634, -12913, - 1686, -1645, -1796, -50, 112, -1108, 1070, 686, - 1068, 1555, 896, 3498, 10458, -32, 12017, -737, - 650, -432, 404, 170, 10873, 1864, -1718, 11061, - -1556, -3766, 225, 6999, 1730, -6919, -1895, -2919, - 8250, 10050, -4631, -1488, -4801, -1504, -2736, -110, - -3630, -2752, -11162, 1128, -2580, 11692, -678, 1338, - 2175, -6030, 616, 1651, -7034, -3057, 2420, 1998, - 4383, -1721, -10762, -428, 2902, -906, -4298, 2141, - -1242, 5464, -607, 5389, -8946, -3890, 10884, 1544, - 628, -1969, 13902, -1570, -1080, -689, -4676, -3642, - 753, -11351, -110, -744, 4286, 1163, 3105, 9752, - 11143, 4296, -1698, 1012, 2284, -989, -958, -9481, - 738, 24, 426, 1638, 3898, 8885, 2938, -8826, - 2982, -1679, 8466, -651, 5144, 2736, 751, -84, - 7710, 3077, 2885, 146, -1102, -2569, -2039, 11059, - -9950, -1048, -1031, -33, -5118, -1096, -1986, 2306, - 2400, 9320, 6188, 500, 2090, 61, -11357, 118, - 1505, 1032, -1920, -164, -9744, -4670, -11029, -102, - -960, -1023, -2570, 4102, -3989, -11478, 772, -1515, - -1102, -2194, 1722, -1195, -8144, 746, -9534, 3250 -}, - -.cb4440l0 = { --14497, -1982, 631, -984, -2115, -3252, 2755, 2017, - -2110, -8864, -792, -1291, -2761, -2365, 698, 1047, - 972, -14703, 10590, -3945, 663, 972, 1204, -2801, - 1295, -1296, 50, 1448, 888, -1879, 122, 78, - -183, -588, 16202, -388, -2240, 1136, 1266, -6445, - 2619, -1664, -6329, -2700, 1557, -497, 598, -110, - 1298, -334, 191, 29897, 387, 419, 76, 152, - 533, 78, 112, 101, 158, 136, -236, 88, - 43, 107, 84, 21, -6385, -1711, 1757, 1411, - 9152, -72, 1428, -1098, 10328, -506, -360, 285, - -36, -2816, 819, 88, 176, -481, -172, 2067, - 3268, 5479, 8605, 11272, -1880, 361, 1582, -4973, - -1379, 3835, 74, -3, 493, -431, 1390, 101, - -550, 59, 476, -469, -583, 568, 732, -1015, - -1104, -698, 23922, 1130, -1268, 280, 204, -59, - -9789, -317, 935, 2944, -10402, -2564, -4648, 1506, - 3834, -1002, 2805, -158, -409, 814, -150, -97, - -3573, -1550, 1356, 5350, -365, -2622, -3454, 310, - 1194, 911, -10928, 937, 7980, -5286, -554, 1999, - -1263, -562, 10, -321, 744, 44, 64, -274, --30136, 340, -1051, 756, -30, -6, -269, -273, - 12, 95, 1565, -13194, -11810, -485, -1574, 414, - -240, -452, 564, 740, -476, 959, 1079, -1568, - -422, 37, -154, 10117, -68, 1412, 11862, -3420, - 4169, 5178, 527, -1027, -1030, -1985, 448, -716, - 1696, 1942, -254, 308, 1100, -790, 8102, 6630, - 3653, -1018, -587, -6990, -19, 1671, 1425, 8089, - 3708, -1182, 774, 659, 113, 437, 50, 835, - -532, -11209, 1682, -7490, -2592, 1234, -4689, -7301, - -143, 3361, 1121, 177, -473, 513, 136, 965, - -4020, 4639, -1212, 1271, 2905, -6865, 10499, -3800, - -3354, -5029, -3606, -950, 4490, 526, 1006, 2, - 1760, 5819, -55, -1098, -1843, 348, -2062, -9196, - 3712, -11466, -3218, -858, 2720, 589, 320, 861, - 59, 5357, 564, -380, 538, -142, 490, 212, - 1716, 670, 1904, -181, 2979, 943, 16916, 1271, - 988, -802, -1490, 9154, 643, 1725, 1347, -2827, - -4096, 485, -7091, -3180, -4747, -1604, 1576, -5724, - 6104, -139, 1726, 11715, 360, 7519, 2513, 5192, - -2208, -1993, 829, -387, -5724, 4418, 116, -2955, - -226, 249, 377, 2149, -2929, 5021, -3064, 800, - -1459, 11384, 8556, 1740, 368, -2839, -2049, 1438, - -1357, 4084, 1896, -528, 1621, -1760, 13741, 302, - -1018, -9774, -3521, 1302, 1374, 1139, 918, -1724, - -764, 858, 804, -1772, 372, -322, -526, 11924, --11944, 4012, 1749, 1737, -1545, 68, 889, 280, - 690, -2200, 1068, -484, -171, 455, -44, -3178, - 2243, -590, 749, -792, -19876, 198, 236, 2695, - -3413, 652, 284, -820, -1134, -199, -112, -5650, - -418, 1047, 1090, 2260, -3297, -2164, 13524, 1720, - -326, 910, -1706, 3912, -1175, 1687, -2152, 50, - 35, 1718, 721, 9316, -2256, -4330, 6961, 4432, - -8043, 45, 1370, 3472, 2892, -3224, 1368, 1355, - -562, -694, 746, 198, 1188, 2819, 3131, -2371, - 6438, 847, 2111, -10187, -3451, -9826, -3502, 655, - 649, 1460, 270, 118, 45, 192, 188, -1139, - -258, 663, -84, -27519, -765, -905, 357, -4, - 89, -372, -24, 178, 1127, 209, 1177, -2762, - -587, 1488, 8989, 3217, -2550, 215, 9540, -7196, - 1259, -3716, 2767, -261, -216, 872, -3008, -2076, - 8682, 709, 3629, 87, -3114, -10624, 246, -1670, - -1738, 1229, 7624, -1120, 784, 305, 233, -185, - 280, -1466, -268, 198, 499, 308, -2187, -1149, - -388, -38, -338, -1084, -19424, 40, 1958, -2240, - -86, 264, -9876, -1287, 4086, 3742, 2502, -10078, - 4574, -1493, 1078, 3218, 2410, -364, 1049, 2638, - 35, -1295, 200, -2847, 10818, -12064, 2375, 348, - -353, 2788, -821, -3196, -511, 146, 2015, 235, - -1094, 2622, 2688, -79, 5176, -884, -11814, 794, - 2696, -6704, 3452, 1295, 3872, 2924, 4498, -166, - -598, -1213, 891, 5478, -266, -777, -5, -776, - 1003, -1837, -156, 17910, 453, -297, -1545, 857, - -288, -308, -6373, 2045, -1846, 3007, -2236, -1904, - 815, -2889, 4200, 8320, 9872, -614, -834, 3856, - 414, -234, 1559, -7451, 3641, -1230, 837, -127, - 2652, 411, -532, -12548, -1692, 1034, -2418, -968, - 558, -1564, -1952, 307, -1064, -6776, 1588, -2636, - 949, 8272, -12, -3468, 3481, 6588, 2580, 7393, - 272, 1528, 1818, -2206, -349, -396, -11704, 1487, - 9753, -4665, -24, 2084, -780, 5036, -647, 3668, - 561, 1099, -1094, 534, 1270, -99, 1006, -476, - -528, 12481, 1589, 1593, -1682, 7022, 2664, 8702, - -563, 1082, -206, 87, -1978, -144, 228, 1232, - 889, 14340, 65, -1061, 10510, -95, 649, 53, - -962, -383, 2479, 1322, -1798, 2840, -492, -419, - 90, -680, 79, 1026, -20912, 1593, -742, 1086, - 516, 699, 2393, -64, -2010, 46, -859, 111, - -440, 14281, 272, 797, -10141, -3734, 3126, -3050, - 1300, 73, -1754, -1278, 1890, -2710, 704, 1160, - 1, 269, -24, -622, 124, 138, -522, -510, - 95, -402, -27306, -470, -214, -159, 396, -201, - -372, 122, 136, -1005, 744, 1949, -810, -2648, - -726, -384, 955, 1232, 1354, -345, -19485, 1056, - -193, 1257, -263, 398, -752, 602, 98, 793, - 17, 20186, -189, -2615, -174, 166, 436, 411, - -1046, 374, -471, -253, 233, 8352, 1342, -1279, - 9305, 2190, -3239, -5262, -3454, 1844, 684, 303, - -4434, -6041, -3495, -2482, 389, 353, 159, -14, --29179, -511, -158, 92, -401, -36, -297, 447, - -605, 269, 85, 212, 8, -118, -130, 207, - 13150, -8712, 2504, 1355, -3268, 1396, -4748, -2200, - -1560, 228, -162, 1179, 3024, 742, -860, 69, - 10, 30006, -538, -489, -125, -214, 364, -682, - -283, 532, -134, 227, -448, -20, -266, 70, - 2, 9310, 14858, 856, -493, -3357, 36, -248, - 214, 281, -73, 3268, 745, -245, -1007, 146, - 392, 36, 8042, 2953, -6603, -7697, 4425, -2498, - 571, -2194, 3388, -794, -561, -2763, 1912, -3030, - 225, 214, -27, 834, -10661, 437, -506, -535, - 8397, 1332, -2406, -8868, -2972, 1385, 296, 865, - 2318, 890, 244, -121, 226, 375, 896, -10381, - -2266, -3404, 983, 1255, 259, 11427, 455, -3041, - 307, -2446, 476, 723, 18, -10224, 510, 552, - -654, -876, -465, 628, -12572, 786, -393, -4162, - 938, -1327, -1695, -608, -1352, -131, -880, 830, - 1016, 21875, -408, -1560, -500, -1682, 453, -930, - 1316, -136, 434, -683, 412, 202, 233, 382, - -2002, -9267, -1034, 8710, 434, -8121, 3035, -3121, - 1792, 2712, -1537, -1082, 854, 1337, -1084, 91, - -4485, 2545, -4412, -1930, -12234, -4802, 4641, 437, - -928, 2163, -3154, 521, -665, -1200, 2654, 931, - -388, -118, -1144, 133, 5089, -1194, -1528, -967, - -795, 188, 1918, 897, -7046, -7617, 7118, 5755, - -2724, -7894, -472, -360, -591, 990, -3032, 7742, - 726, 5490, 9383, 479, -3032, -1904, 7158, 4706, - 2442, -1576, -58, -156, -3977, -2696, 4195, -166, - 3342, -1566, 3767, -4159, -5750, 5505, -7663, 4516, - -4073, -2612, 5136, -290, -666, 1282, 776, -566, - -602, -310, 1003, -648, 2928, -3159, 427, -1168, - -2702, -16990, -205, -343, -1196, -1980, 1653, -512, - -1820, -418, -3368, 3522, -1966, 4964, -5728, -5185, - -210, -1721, 10131, -7060, 3351, 334, -96, -3193, - -1713, -614, -2633, 147, -1552, -2363, -3724, -1731, - -7350, 5453, -2732, -2867, 12458, 416, 0, 4414, - 833, 590, 1617, 405, 73, 868, 232, 195, - 15, -196, -782, 749, -955, -84, 1176, -553 -}, - -.cb4440l1 = { --12227, -3413, 12848, -1336, 20, 894, 254, -1001, - -1381, -406, -1157, -458, 300, -395, 825, -34, - 74, 382, -1018, -10266, 1338, 11091, 544, 797, - -4304, 1389, -747, 1924, -257, 2615, -37, -4375, - 782, 158, -378, 19, 652, -539, 1012, -4211, - 1263, -925, 96, -9226, 5921, -8209, -71, -1838, - -2201, -7441, -60, 393, -5626, -264, -1002, 85, - 1989, -1616, -216, -914, 9907, 8044, -578, -7830, - -1705, -3624, 2430, 59, 5813, 870, -317, -2545, - -4020, -1330, 1215, 9352, 5425, 324, -4803, -681, - -506, -4710, -6574, -4184, 65, 729, -1310, -1387, - 1385, 2364, 1672, 2493, -438, -1367, -907, 38, --20220, -1644, 512, -413, 348, -112, -532, 785, - 1332, 7140, -1916, -1766, -11570, 1811, -9167, -76, - -1531, -175, -1739, -771, 2014, 519, 15, 576, - 8736, -979, -28, 1830, 329, -302, 12206, -1501, - 5195, -305, 1456, -581, 1488, 142, 235, -157, - 192, 1540, -922, 11056, 11823, -2964, -1488, 1712, - -2018, -880, -3282, -190, -198, 2436, -248, 222, - 22, 863, 1504, 2078, -2047, 216, -1270, -732, --18252, 1186, 3178, -730, 432, 934, 1617, 873, - -491, -70, -768, 679, 1398, 537, -364, 172, - -541, -94, -24, -129, -26725, 201, -554, -357, - -71, 60, 96, -1665, 1425, 1244, 332, -1068, - 326, 834, -620, -1473, 1585, 1432, 928, 18782, - -1388, 2897, 448, 40, 1323, 1433, 787, 215, - 3297, 2586, -856, 451, -17700, 735, -43, 405, - -1252, 744, 1012, 677, 312, 206, -279, -432, - 6677, -87, -72, -10400, -106, 11224, 1152, -422, - 2024, 704, 2462, -1197, 232, -119, 4, -879, - 1600, -708, 3496, 279, -143, -1096, -555, 4594, - 1486, 161, 942, 2018, 2474, -16010, -380, -193, --11415, 457, -276, -11220, -1604, -38, 813, -4044, - 1888, -4265, 1647, -882, 981, -734, -110, 140, - -3050, 1248, -549, -1167, -967, 3586, 688, -1380, - 424, -17959, 2022, 2274, -44, -1406, -432, 1335, - -659, 9555, -3581, 11045, 1870, 806, 599, -2065, - 156, -4420, 16, 2349, -609, -3058, -738, -60, - -548, -119, -49, 26, 1528, -1842, 6306, 14078, - -692, 5480, 321, 1996, 1376, -3086, 490, -54, - 1151, 932, 445, -9887, 15808, 3085, 866, -2020, - -1785, 2126, -920, 414, -290, 138, 244, 994, - -702, 1410, 330, 202, 675, -389, -241, 31306, - 380, 300, -53, 804, -109, 413, -44, 6, - 14, 486, -293, -112, 26, 11632, -836, -3948, - -518, -1364, 11360, 3558, -588, -2084, 490, 381, - -955, 2207, -2953, 1115, -265, 2, 65, 464, - -180, -111, -174, -152, -30508, 121, -207, -835, - 1126, -185, 91, -96, 222, -99, -93, -10138, - -430, -184, -372, -194, 953, -100, 382, -1422, - 13931, -1835, -1657, 821, 408, 808, -601, -463, - 7142, 5596, 3171, 2174, 2740, -11350, 1019, 1449, - -386, 1642, 3703, 4271, 1664, 2232, -674, 983, - 551, 8543, 154, -383, -2419, 1117, -520, -10966, - -4406, -3742, -79, -909, 1813, 5043, 412, 1099, - 1434, 173, 788, -92, -1004, 1288, -87, 931, - 10241, -855, 6, -405, 2580, 11455, 1150, -1916, - 3614, -262, 292, 897, 9673, -381, 1711, -2713, - -1111, 282, -2180, -2282, -2266, -724, -849, -11787, - 888, 3120, -1459, 495, -10812, -792, -274, -984, --12223, -737, -2394, -299, -578, -2758, 1521, 774, - 1938, 857, -1935, 217, 654, 1452, -3695, 6734, - 804, 134, 946, -2156, 9495, -600, -1962, -5252, - -246, 1269, 8492, 1261, -2205, -106, -1314, 828, - 1013, -12059, 663, 436, -2648, 9863, -630, -2961, - 3004, 1015, -3153, -1475, -25, 399, -846, 430, - -1237, -156, -187, 1115, -502, -363, 386, -2820, - 942, -926, 727, 1130, -20388, -274, 1140, 198, - 199, 2548, 442, 157, -1546, 3693, 892, 460, - 6552, 4858, -2560, -8673, 1930, -8913, 3427, 686, - 61, -8830, -358, 1338, -74, 1180, 2871, -3822, - 104, 2414, -1742, 11425, -4522, 393, -3016, 972, - 34, 117, -16113, -6900, -6964, 1726, -843, -242, - -2141, 803, -1093, 442, 1776, 2429, -1000, 489, - 393, 635, 389, 1126, 12285, -1648, -11396, -2885, - -56, 3840, -174, 3177, -1708, 1189, 1914, 1514, - -189, -88, 276, -240, -120, -2929, 9823, 678, - 568, 26, 10080, -2575, -806, -64, 6406, -82, - -1171, 2169, -1804, -667, -37, 54, 4208, 10829, - 11920, -468, 1916, -809, -370, 144, 3616, -263, - -4352, -124, 300, -246, -440, -115, 447, -407, - 20869, -340, 54, -764, -807, -699, -283, 727, - -922, 1098, 577, -6, -809, -50, -115, -75, - 280, 156, 182, 225, -30432, -212, -417, -245, - 177, 94, 4, -627, 167, 47, 152, 148, - 1325, -2436, -10063, -696, -9966, 1032, -1024, -3702, - 3933, 400, 333, 692, -3858, 2599, -1215, -389, - 393, -666, 2135, 10280, -2443, 1972, 410, -392, - 590, 12322, -523, 1141, 52, -1468, 819, -213, - 162, 116, -614, -10630, -204, -1247, 535, 199, - -6058, 2538, 1644, -11539, -1562, 1462, -1493, -218, - -296, -605, 321, 607, -366, -257, -837, 4536, --11683, 1266, -3805, 4496, 2854, 8, -8848, 124, - 656, -1041, 411, 144, 916, 445, -91, -260, - -149, -882, -433, -121, 345, 68, 349, 821, - 652, 251, -23053, 1015, 712, -73, 7038, -1520, - 5810, -12604, 2841, 425, 265, 1546, 938, 1851, - -1180, 2751, -498, 1289, -774, 327, 4047, -8132, - -2622, 5449, 3221, -2990, 10107, 1880, 173, -4006, - 399, -332, 642, 297, -4513, -1230, -330, -788, --21881, 903, -1308, 547, -522, 1885, -1730, -63, - 973, 897, 670, -657, -232, 498, 92, -8, --11010, 1072, -368, -1864, 11505, 3497, 730, 2158, - -1629, -1351, -1583, 2247, -1506, 2144, -902, 639, - 175, -6006, -986, -4246, -1510, 1785, -9792, -495, - 1995, -9189, -1414, -2550, 1578, 2390, -2989, 1673, - -1980, 21, -4054, 8552, 1155, -301, 1204, 3776, - 262, -1828, -1837, -1014, -9, 2711, 1467, 463, --11605, 1743, -956, -1213, -3892, 1534, -10298, 22, - -902, -658, -1759, 2507, 1552, -12298, -1050, 623, - -3221, 1522, -36, -446, -5925, 2144, -2844, 15080, - -1984, 3631, 1931, 1894, 1193, -1694, -3172, -813, - -1336, 534, -365, 833, -293, 21759, -1266, -1216, - 996, -2, -393, -858, 759, 969, -230, -151, - 977, -874, 119, -896, 262, -118, 89, 95, - 94, -437, -30375, -462, 360, -588, -334, 86, - -1027, -208, 536, -196, 367, -467, 119, -32, - -2544, 6204, 8830, -264, -7847, 848, 2267, 3877, - -6378, -2249, 1420, -1868, -3443, 3747, -590, 58, - -274, -6065, -8472, 5906, 3109, 5834, 3905, 2086, - 1300, 3828, -518, -528, -3672, 1794, 4353, 408, - 566, -2577, -1137, 2749, -2662, -528, -7479, 5550, - 2932, -336, 3681, -2034, 212, -8733, 1017, 2258, - 8225, 387, 227, 877, 2752, -1375, 2636, 8131, - 3850, -6870, -1158, -3736, -8478, 228, -5809, 97, - -2555, -2956, -928, 678, 112, 1434, -1250, 1240, - -412, -4267, -3811, 4322, -3430, 7705, 5456, -6876, - -3452, 7329, 3142, 220, 662, 1531, -5492, -1388, - 6842, -3631, 362, 5029, 8052, -2367, -5346, 5724, - -358, 2469, 2196, -1426, -272, 534, -192, -531, - -705, -70, -259, 93, 335, -94, -145, -17, - 920, 1186, -818, -599, 343, -19859, 2968, 161, - 128, -4282, 598, 152, 1210, -1317, -1545, -229, - 181, -6488, 5699, 7270, 6271, 8809, 27, -4770, - -804, -168, -247, -680, -129, -470, -152, 915, - 176, -904, 622, 280, 2986, 1034, -1046, -482 -}, - -.cb4440s0 = { --12085, 8192, -1802, 4587, 5947, -3183, -2629, 1837, - 2434, 252, -612, -4697, -576, 150, -704, -640, - 174, -126, -10309, 350, -3187, 4714, -2829, 12618, - -2172, 3502, 465, -159, -601, 1306, 1174, -448, - -292, -136, 242, 31, -9005, -6203, -10027, 25, - -209, -20, -1292, -1252, 4304, 3681, 4462, -4401, - 4412, 1240, -576, 3618, 595, -237, 2544, -6032, - -1511, 1523, -3668, -3472, 5552, -4901, -272, 5963, - 2740, -878, 13010, 191, -2017, 768, 455, -45, - -6873, -3664, 2639, -961, 3068, -4242, 1327, 2362, - -1909, -1114, 100, -5940, 220, 865, -12952, -76, - -1279, -591, 1092, -3502, 88, -2118, 13053, -10141, - -3024, -533, -1923, -4097, 135, 1672, -1661, 1646, - -370, -361, 644, -197, -6796, -10948, 11692, -974, - 488, 349, 3936, -1506, -149, 513, 1401, -1776, - -391, -210, 57, -56, -344, 1018, 7989, -4957, - 167, 987, -60, 62, 1622, 1207, -69, 338, --16133, -46, 1018, -1460, -821, -646, 1316, 126, - -4631, -842, -1505, 15833, -6404, -4514, 2946, 2923, - 1198, -3141, -3109, -1613, 1853, -906, -436, -1110, - -282, -214, -3424, -3141, -3988, 284, 22262, 1269, - 1787, -1116, -1429, 1017, 371, -187, -825, 534, - 350, 1088, 26, 176, 8914, 6662, 935, 2074, - -7986, -4780, 2194, 1796, 697, -4040, 2486, 1700, - 9150, -37, -1560, 2449, -162, 128, -7469, -2690, - -281, -4698, 424, 535, 1416, 243, -575, -1160, - 326, -2417, 808, -15816, 994, -302, 26, 894, - -7376, 395, -586, 823, -1341, 972, 100, 241, - 743, 470, 267, -550, 474, 182, 18252, 178, - -182, -7, 3496, 2132, 863, -151, 741, -2158, - -763, -652, -503, -434, -736, 770, -156, -19071, - 443, -354, -243, 66, 4258, 6714, 3577, 17338, - 556, -3570, 1269, -1406, 1668, -349, -90, 781, - 82, 558, 936, -788, -1072, -21, -6472, -3022, - -475, -6997, -2816, -3774, 1683, -13950, 3482, -1872, - 2624, 1064, -318, 1300, -1214, 179, -11, -124, - 4560, -2827, -6314, -5736, 1159, 1309, -5462, -11652, - 4192, 151, -543, -3484, -2288, -119, 745, 1373, - -121, -629, 5204, 7650, -2062, -3370, -2894, -338, - -1361, 1080, -3674, 12852, -6119, -1578, -736, -241, - -1564, -109, -441, 335, 416, 1678, 4802, -3239, - 6182, 154, -3656, -1337, -17027, 1707, -381, -1704, - -377, 1022, -592, 983, -321, 37, -1846, -4500, - 2575, 14162, -560, 9385, 4179, -1340, -3466, 3235, - 1727, 1545, -23, 636, 280, -39, 871, 173, - -8915, -2427, 2146, -3698, -12153, -3773, -3873, 5042, - 112, 788, -1139, 245, 546, 278, -8, -1005, - 443, -76, -1256, 8255, 3841, 6116, 4226, 3705, - -1278, -6470, 5220, 5892, -3468, 2736, 5427, -3336, - -264, 1906, 294, -60, -7078, 7699, -9792, -7108, - -2030, 1055, -6962, 702, -2074, -232, 127, -430, - 658, -272, 757, 138, 159, -340, -4606, 1021, - 146, -7690, 6001, 5660, 3363, -367, 13222, -441, - 13, -874, 668, 2293, 875, 1238, 110, 778, - 1434, -976, 2151, -8169, 1421, 2622, 206, -795, - -816, -14443, -1583, 3356, 2971, -964, -321, -841, - -404, 111, -5595, 4248, -3819, 214, -2520, -712, - -1505, 849, 947, -876, 188, 3221, 863, 105, --17336, 1818, 14, 17, -6349, 379, 4746, -12405, - -560, -3448, 3664, 8251, 845, 383, 1348, -739, - -780, 1695, 4828, -123, -647, 823, 9940, -183, - -1804, -7112, -161, 578, -619, 11534, 3214, 1586, - 4784, -2540, 1188, -304, -485, -648, -824, -595, - -8817, 4138, 927, -3259, -198, 4022, 2213, -1627, - 645, 14602, -1058, 1481, -1670, -113, 564, -710, - -451, -360, -1261, 2504, 247, 5566, -7262, 1344, - -5106, -1608, 1946, -4240, -7393, 10440, 3306, 1940, - -999, 155, 832, 55, 10218, 11475, -3252, -8295, - 1347, 2405, 3421, -2619, 2262, -2829, 754, -307, - 548, -2040, -1130, 317, 170, 292, 248, 2601, --18930, -1942, 1417, 1678, 3310, -2578, -1969, 1550, - 3010, 70, 8, 3064, -848, 504, -172, 180, - 1787, -1133, 2427, 1002, -664, -40, 192, -23400, - -1004, 513, -818, -382, 360, 360, 268, 98, - -202, -192, -668, -12924, -11702, 7325, 797, 1937, - 674, -2458, -541, -1497, -1673, -955, -356, -486, - 182, 299, -46, 65, -4232, 1418, 6532, 2356, - -4894, 4870, 3369, -4585, 8743, 1497, -1451, 862, - -8612, -1718, 1716, -2389, 371, 592, 7397, -3188, - -649, 126, -1300, 1374, -1292, 645, -1494, 2736, - -1468, -1808, -17223, -352, 111, -222, -236, 171, - -198, -7994, -3822, 5324, -16856, -517, 119, 314, - -360, -515, 435, 520, -638, 1635, 420, 1191, - 830, 710, 6897, 2925, 3091, 510, 3268, -1702, --16186, 718, -3127, -463, 763, -1035, 725, -122, - 646, 172, -164, -277, 5853, -7074, -10, -1770, - -2544, 5978, -874, -494, -232, 14465, 1815, -1902, - 987, -1533, 1216, 741, 620, 161, 4414, 4184, - -32, -2944, -4619, -462, 15701, -1026, -140, -2396, - -1747, -538, -1024, 219, 854, -351, 860, -226, - -4390, 732, -2003, -2430, -540, 592, 1622, 1180, - 385, -2052, 4050, 17401, -650, -243, 1709, 1261, - 95, -307, -5110, -666, -7094, -533, -1293, -17357, - 2929, 2389, -119, -413, 317, -962, 709, -1552, - 26, 175, 700, -570, 20120, 1107, 232, 169, - -889, -533, -1276, 22, 959, 866, -954, -792, - 873, -172, 1757, 195, 148, 423, 4490, 8782, - 631, 682, 1832, -3728, -1742, -11130, -1201, 1776, - 9268, -586, -1358, -646, 626, -866, 5, 263, - 3950, -760, -2914, -12751, -12669, 1513, -4, 631, - 1835, 312, -167, 1546, -532, 619, 1176, 1436, - -116, 312, 7054, 3120, 4075, -1320, 715, -206, - -1572, 1350, 17688, -1182, -1568, 680, 6, 207, - 1010, 600, -766, 554, -1483, 644, -8810, 624, - 148, -4015, -1536, -1863, 92, 730, -14806, 386, - -5174, -1420, -331, -254, -104, 275, -7268, 2563, - 11983, -65, 8043, -1623, -2589, -2610, 1328, 3154, - 1935, 3672, -1761, 4984, 661, 209, -1038, 122, - -1019, -28948, 55, 358, -539, 488, 55, 618, - 20, -314, 446, -1016, 618, -93, -94, -331, - -36, 194, -1706, 6628, 396, -146, -765, 10500, - 2619, -82, -10894, -3908, -888, -192, 620, 163, - 78, 774, -293, -104, -4826, -14066, -1883, -3258, - -4577, -1484, 5412, -4274, -4951, 3316, -907, 1948, - -1187, -404, 3654, 400, -70, 459, -3224, -3194, - 2338, 4390, -5, -3167, 3273, 116, -1026, -1668, - 3767, 272, -16662, 137, -1634, -1007, 220, -310, - 982, 8220, -16, -1251, -2644, -3344, 2236, -1573, - 8174, 612, 1142, -10799, 393, -707, 4804, 397, - 1232, -292, 5762, -15608, 2921, -6440, 3544, -2395, - -504, 1890, 172, -1010, 178, 380, -1163, 404, - -1230, 1034, -596, 105, -2038, 1991, 5613, -312, - -4156, -10205, 3092, -4704, -6101, -1620, -1037, -1130, - 1590, 8321, -797, 247, 954, -103, 3838, 2330, - 10064, 3197, -8508, 1300, -1012, -6607, -3861, 5651, - 31, -475, 1582, -1370, 1107, 2164, 743, -567, - 4842, -2930, 3191, -190, -2230, -47, 254, 2147, - 591, -512, 1312, 1159, 811, 1444, -1312, -257, - 16016, 789, -2562, 3983, -373, -9255, 302, -3655, - 5750, -3856, -6941, 3934, -2314, 5556, -4099, -265, - -479, -4843, -130, 20, -4859, 3083, 6482, -3738, - -3936, 590, -6368, -1784, 75, -3903, -6834, -4452, - -871, 764, -1118, 8731, 38, -148, -3368, -6330, - -370, 2234, 907, -2809, -1458, -2306, -402, 2679, - -1222, 1138, 192, -1317, 1012, 15514, 624, 279, - -4032, 2565, 6162, -938, 5760, 1685, 4350, 2939, - -825, -331, 1840, -556, 427, -4642, -23, 8346, - 7577, -467, 3848, 454, -3962, 373, -116, 2314, - 4868, -208, -1367, -1803, 2681, 806, -4279, 3348, - -528, 14027, -238, -457, -2764, 832, -4680, 4354, - 1219, -801, 2414, -5204, -3768, -6524, 5163, -10909, - 1656, 321, 3260, -1773, 214, -135, -4563, 5206, - -4794, 1486, 406, -1026, 281, 1799, -218, 320, - -908, 872, 1056, 2955, -208, -799, 15492, 334 -}, - -.cb4440s1 = { - 27498, -414, -266, 646, 229, 94, -15, 302, - -489, -401, 125, 752, -476, -200, -976, 195, - 4, -402, 2220, 1012, 1731, 2530, -652, -21380, - -679, -867, -195, -114, 1326, 2531, -348, -185, - -114, 178, -694, -298, 8752, 1735, 2640, -2374, - 6191, 1516, 5771, 6705, -253, -8502, 986, 2134, - -1854, 3490, -678, -48, 133, 844, -1635, 1630, - 6056, -756, -1109, 1563, -1445, -139, 580, -1448, --18675, 846, -390, -259, 1548, -324, 281, 142, - 1792, 1211, 1328, -4308, -1032, -5412, 4742, -201, - -47, -297, -8403, 9715, 7268, -3756, 1573, 677, - -88, -145, 4877, 12946, 3264, 1809, 7230, -2583, - 1627, -1786, -7113, -1480, -2111, -508, 415, 1664, - -483, -538, -249, 80, 7005, -2562, -887, 3801, - 6411, 2222, 36, 875, -5089, 10897, 4014, 4948, - -1580, 1425, -1814, -391, -96, 322, -6484, 1896, - -7790, -950, -4235, -8362, 3118, 4843, 3754, 1070, - -1648, 7692, -1675, 3405, 918, 2270, 573, 193, - 6024, 8912, -4905, -1810, 985, 1877, 2158, -2150, - -386, 3908, 2030, 419, -12599, -570, -150, 1580, - 36, -152, 2, -538, -1565, 6809, -715, -6266, --12725, -6718, 810, -603, 1547, 1001, 2250, 810, - 1773, -672, 327, 246, 6414, -7511, 916, -327, - 830, 11862, 4373, 1003, 6370, -1730, -2127, 613, - 1627, 626, 763, -864, 207, -233, 3738, -8644, - -1634, -2050, 3906, -451, 12986, -4828, -2973, -4714, - 545, 822, 735, -3539, -256, 65, -93, -94, - 2923, 7075, -3763, 6172, -9544, -2675, -3833, 930, - 418, -4496, 3790, 386, -7797, 234, -609, -259, - 454, 330, 1546, -7634, -1966, 515, -2496, 374, - 2633, -3014, 4126, 9920, -7103, 1441, -150, 7695, - 670, -48, -41, -512, -6849, -1785, 3755, 1860, - 2418, -2346, -1194, -1574, 15510, 444, -1515, 585, - 742, -199, -1115, -122, -11, 140, -7763, 1438, - -317, -444, -17149, -24, 2685, -856, -3166, 1109, - 308, 233, 30, 63, 530, 645, 84, 133, - 6139, -1183, -10673, -12790, -112, -1544, 4623, 576, - -804, 1023, -1646, 1192, 269, 2681, 44, -909, - -14, -414, 48, -4002, 4768, 3440, 3252, 1441, - 101, 372, 3166, -1398, 325, 16184, -711, 486, - 1328, 114, -450, -31, 1152, 2154, -69, -252, - 32, 922, 219, -2055, 421, -1377, 1006, -614, - 234, -40, -84, 204, 27171, 182, 1034, 1536, - 834, -8038, 1243, -3074, -7829, 11165, -1854, -1173, - -871, 4105, 3588, -3191, 188, -2102, 124, -166, - 8070, -11066, 6632, 2739, -7787, 184, -5872, 1360, - -1089, 1273, 84, -1683, -1584, 975, -206, 1160, - 180, 12, -6121, 5436, -14726, 5949, -6756, 834, - 1750, -3142, -878, 7, -220, -1933, -141, 160, - 26, 756, -800, 6, -8104, -6989, 3353, -3518, - 4510, -12430, 736, -2685, -1042, 32, 1184, -519, - -312, -1073, -402, 71, -422, -35, 1791, 12735, - -2281, 2623, -1502, -3878, 6727, 10541, -1110, 2308, - 870, 1124, 874, -1406, 123, 254, 405, 328, - 3828, -7541, 3096, -14145, -672, -1725, -423, -1918, - 4164, -411, 3094, -568, 3575, -2895, -378, -3065, - -232, 449, 8110, 2264, -1383, -557, -10683, -7628, - 4155, 754, -134, 6759, 1051, -2054, -900, -948, - 579, -1277, 151, 462, 11562, -310, -8260, 10238, - -1309, -3052, 345, -689, -1133, -588, 548, 980, - -1332, 881, 368, 776, -704, 422, 12433, 1314, - -1487, -4753, 2679, 3092, -939, 136, -586, 3504, - -1034, -6318, 3506, 420, 2326, 1034, -252, -398, - -6232, 4488, -6166, -1754, 908, 4884, -5188, -2985, - 10793, -116, 4674, 3980, -9, 805, 1568, -1620, - -88, -146, 3027, -16154, 2899, 7839, 5912, -427, - 270, -1467, -387, -351, 615, -322, -2, -1061, - -654, 56, -438, 132, 2388, 460, 2172, 1874, - -3028, 3302, 2035, -704, -1222, -19835, -472, -1858, - -1686, -286, 5, -748, 491, -350, -4344, 103, - 1473, 2440, 13575, -1350, 1456, 10377, 1962, 3036, - -1238, 1580, 607, 1352, 997, 1212, -489, 251, - 4075, -3457, 6186, 786, 300, -2532, -373, -2522, - 3108, -294, 4938, -2980, 1509, 12450, -695, -1128, - -96, 354, -3678, 8494, 2480, 2264, 5162, 11907, - 4721, 1111, 752, 2999, 3924, -1429, 321, 276, - 309, -603, 601, -62, 3337, -3570, 3273, 6618, - -2001, 950, 532, 972, 1619, 956, 65, -609, - -281, -14769, -438, 580, 230, -228, -10108, 12289, - 8904, 872, -3296, 1535, -384, 477, -913, -777, - 546, 445, -1004, -435, -716, -138, 572, 435, - 4626, -864, -5716, -2810, 1291, -4796, -241, 2527, - -2342, -1360, 4161, 1886, -128, -1521, 13726, 1818, - -554, -157, -9665, 2607, -1013, 579, 1122, 1571, - -2684, 11364, -6464, -184, -1542, -5670, -1091, -670, - 1273, -1051, -7, -278, -2551, -548, -10673, -1434, - -343, 317, -3108, -1615, -2239, -14132, 490, -454, - 2467, 1990, 470, -1072, 440, 290, 3006, -4420, - -2083, 3050, 2779, -2349, -590, -4941, 7464, -9000, - -2686, -2045, -8712, -3281, -2476, 648, -148, 408, - -1367, -1113, 27347, -1113, 739, 39, 1443, -208, - -686, 986, 735, -702, 76, 665, -194, -165, - 366, -606, -4908, -3932, -15941, -2810, 4572, 816, - -2092, 4213, -2492, 4006, 926, 210, -1110, -1635, - -270, -226, -362, -187, 1790, 3016, 2216, 3890, - 2018, -1325, 19784, -771, 356, 2118, -98, -688, - 1016, 978, 559, -39, 160, -310, 6622, -1754, --11104, 204, -2212, 2370, -11610, 1119, 3216, 3102, - 524, 278, -829, 524, 28, 838, 374, -76, - -4593, -2933, 10697, -6510, -4970, -2025, -9383, -3428, - -4112, 2665, 1459, -1411, 421, 481, 842, -341, - 147, -158, 4108, 45, 4935, -21, -7905, 2058, - 1158, 15260, -567, -752, -992, -1094, -1059, 2370, - 820, 655, -261, 280, -3969, 6342, 8521, 3114, - 369, -12269, 1684, 4, 4686, 1985, -3668, -3040, - 677, -254, 57, -161, -989, -379, 7075, -580, - 2846, -3177, -2285, 958, -7096, -154, -515, -3345, - 13487, 3548, -1804, 290, -430, 726, 399, 54, - -2814, 10235, 1958, -3356, -1330, 536, 3218, -14194, - 200, -796, -862, -1480, 1811, -346, 604, -391, - -231, 513, -10495, -6029, -6492, -8746, -357, -221, - -1890, -2669, 8, -1756, -5812, -1048, 2258, 223, - -474, 1154, -226, 348, -1590, 2915, 158, -24059, - 875, -846, 1150, -1000, -844, -116, -246, -219, - -482, -367, 120, 517, -489, 442, 8148, 5040, - 3770, -1006, -51, -3175, -10278, -4468, 1188, 1497, - -6515, -5, -1628, -2387, -1297, -717, 1630, 232, - -3608, -6688, 2444, -792, -246, 411, 1464, 3661, - 3244, -1121, -1602, -15398, -443, 882, 1412, 926, - 16, -73, 2693, 7168, -9399, 528, 7916, -9270, - -1669, -2756, 1304, 3074, -1510, -2089, 1491, -1556, - -422, -414, 132, -192, 5988, 4500, 7572, -10978, - -4875, 3685, 1888, -660, -1750, -515, -2728, -3133, - -2742, 666, -2861, 626, 256, 243, 4587, -3567, - -288, 2314, 4765, -11036, 7322, 7581, 2651, 3264, - -394, -246, -891, -1464, -1717, 123, -517, -486, - -1019, 7215, 554, 722, -4253, 2393, 3053, 2881, - 1538, -2104, 573, 321, 673, 3902, -2855, 944, --12816, 370, 3496, 952, -1435, 6379, 766, 2273, - -729, 80, -2432, -1150, 2408, -895, 15497, -1231, - -282, -3306, -435, -167, -3528, -5683, -6413, 2501, - -4825, 124, 3128, -425, -2800, -986, -2283, -495, - -3392, -1560, -2093, -11613, -37, 157, -438, -794, - 1988, -45, 1508, 20, 98, -458, -245, 1130, - 110, -525, -771, 1120, 710, -21758, 174, -210, - -4839, -2468, -648, -4388, -11, 2990, -181, -4790, - -4232, 3634, 6427, 2772, 166, -2996, -12005, 1630, - -249, 179, 856, -1250, -4216, 1993, 5164, 4757, - -5071, 4331, -3029, -1276, -11184, -2864, 1238, 6332, - -2431, 1276, -338, -476, -5659, -2410, 2510, 1853, - -4853, -3175, -1896, 10728, 3724, 960, 9963, 305, - -938, -646, -2760, 1436, 113, -74, -3098, -4090, - 2950, 2701, 992, 206, -1393, -2179, -10862, -2396, - -1008, 2639, -1547, -416, 9264, 1824, -360, 401 -}, - -.cb4440m0 = { --25793, -238, 1193, -2635, -238, 1315, -2277, 1588, - -896, 512, -864, 611, -398, 1277, -212, -358, - 202, 13250, 16, -860, 1618, -1024, 310, 11560, - -746, -3876, 780, -4087, -475, 857, 1017, -1439, - -890, 155, 8556, 362, -1158, 2116, -291, -66, - -1272, 510, -1394, 2259, -4761, 808, -740, -937, - 13993, 191, 273, -7670, 6776, 846, -1907, 955, --13206, -1956, 1697, 1670, -329, -244, 2395, 6119, - -802, -1007, 649, -974, 170, -2136, -10780, 1020, - 1270, 1954, 1118, 13348, 983, -1394, -594, -514, - -586, 1026, -1821, 548, -298, 3342, 837, -1395, - 13977, 1021, -7792, -2930, 1466, 5494, -843, 2432, - 1378, -68, 174, 407, 76, -877, 691, -9445, - 522, -3448, 2549, -412, -2358, 875, -5044, -952, --10113, 6574, -6347, -2760, -662, 29, -227, 4884, - 1304, 411, -3320, 2434, 785, -14822, 4412, 2272, - -6407, 2172, -613, -1665, 296, 742, 624, 135, - 5316, -3191, -855, -2061, 485, -3188, 2998, 1382, - 2516, -2438, -3506, -238, 737, -629, 1001, 773, - 17540, 1478, -724, -764, -1231, -1254, -1582, -692, - -351, -1551, -171, 183, 38, -668, 756, -770, - 24344, -905, -7182, 502, -3766, -1690, 1588, 1522, - 1844, 1276, 1458, -777, 1731, 4856, -14860, -1097, - 36, -1310, 846, -1500, 521, -3669, -252, 4480, - -2602, -845, 597, -4512, 1062, -292, -18518, 1972, - -334, -80, -1256, -366, 3640, -436, -12, -1670, - -435, 1496, 1429, -11092, 1012, -936, -1224, -12240, - -3048, 210, 1905, -1197, -357, -9759, -2632, -332, - -3417, 15078, 1496, 2206, 1800, 205, 1384, 3546, - -1853, 755, 1016, 726, 58, -150, -13053, 10375, - -2589, -330, 1616, 3081, 2763, -2617, -1204, 324, - -53, 2968, 1485, 214, 124, -334, -237, 16784, - 2612, 1023, -4298, -2156, 4336, -4307, 4952, 1036, - 81, -762, 3416, 714, -187, -4100, -757, 1124, - 10224, 7059, 424, -316, 1281, -12262, 912, -1999, - 2, -731, -184, 879, -934, -202, -391, -1046, - -338, -101, -17511, -1712, -5580, -2327, -2478, 1770, - -5825, 1499, 578, -130, 1424, -1818, 110, 542, - 22, 988, -4227, 2836, -1447, 1170, 12335, 2179, --11216, -2500, 64, -912, -954, 654, -802, -455, - -597, 234, -296, 811, 1083, 1848, 4148, 637, - -6608, -2362, -3382, -664, -13088, 2839, 3090, 3294, - -4554, 2518, -55, 837, 1392, 5905, 1287, -1484, - 965, 16533, -3507, -1903, -1562, 2408, 5037, -4816, - 1409, 361, -1890, 170, -610, -1755, -524, -867, - -6238, -20117, -745, -956, -176, 2998, 130, -668, - -843, -267, -364, -573, 495, 127, -66, 32767, - 271, -408, 654, -123, 1831, 151, 996, 82, - 628, -251, 144, 198, -88, 357, 37, 612, - 184, 238, -584, -52, -30025, -415, 404, -566, - 100, 659, -336, 877, 211, -730, -377, 184, - -5256, -1484, -1191, -2108, 24, -7821, 209, -2856, - -1844, 697, 5798, -1191, 427, 11858, 1000, -261, - 184, -686, 1182, -3142, -3138, 139, 144, 117, - 3658, -3566, -1562, 672, 2036, 15051, -5069, -551, - 529, 1696, -214, -2678, -5966, -3707, 2847, -2554, - -1760, -1196, 2088, 6372, 1778, 12935, 2189, 1992, - 1761, 578, -542, -753, -1182, 4321, 1871, 309, - 704, -1259, 884, 19136, -2665, 1096, 3048, -167, - 872, -344, -1092, 464, 3255, -86, 1608, -1062, - -1569, -1699, 4504, -274, 568, 1428, 20571, 1452, - -894, -791, 459, -882, -1048, -2944, -11095, -783, - -832, -2450, 650, 2784, 3156, 529, 457, 483, --12553, 655, 686, -757, 929, 212, 1242, -201, - -1627, 4826, -1895, 997, -3225, 84, 80, 287, - -2136, 405, -188, -890, -18272, -511, -118, -3642, - -1018, 420, 12650, -474, -540, 6978, 6977, 4418, - 1162, -1332, -1112, -1765, 2640, 562, -1164, 1256, - 595, 567, -483, -31511, -960, -816, 756, 1505, - 12, -518, 234, 184, 679, 328, -600, -137, - 267, -440, 2540, 593, 1023, -11756, 626, -2034, - 5756, -9882, 3175, -1190, 1628, 3920, 3219, 1394, - 834, -140, 4036, 4722, -455, 3105, -1355, -3106, - 1000, 7806, -2227, 687, -1580, 3180, -12302, -1394, - -425, 488, -187, -36, 219, 158, 12006, 1683, - 2151, -2, -1110, -12250, -59, 672, 1844, 2084, - -2101, 1652, -783, 634, -13257, -339, 3932, 2260, --12452, 152, 316, -688, 79, -912, -2081, 1384, - 188, 1942, -706, 204, 700, 1776, 13901, -13666, - -324, 472, 1055, -646, 82, -769, -877, -443, - -227, -900, 636, -870, 470, -112, -598, -4402, - -2726, 1775, -216, -43, -18675, -863, -4604, 3433, - 674, -155, 208, 1546, 294, -157, -616, 11070, - 1229, -528, 2124, 699, 3624, 54, -516, 194, --13556, 1902, -506, -1317, 1916, 471, -342, 836, - 18, 906, 614, -8, -951, 1052, -97, 2212, - -924, 310, 6, -733, 122, 23731, 468, 345, - 1545, 1434, 611, 403, -3136, -2214, -54, 1023, - -1390, -5243, -3744, -258, 6871, -1778, 673, -2362, --13007, -776, -974, -1077, 8386, -3978, -4325, 1236, - 4011, 1161, -263, 1224, -12957, -100, 2801, 1458, - -3081, 578, 17, 1037, -742, 5972, -632, 2904, --12721, -6733, -478, 182, -1973, -820, -6911, -4904, - -942, -348, -353, -350, 7864, 34, 568, 1985, - 956, 3310, 118, -2067, 12600, 9063, 1609, -1261, - 296, -1248, -1656, -65, 1832, 1525, 1503, 5149, - 4370, -1638, -3868, 320, 1527, -424, 17676, 1780, - 1172, -1132, 1128, 1294, -322, -101, 462, -6668, - -3024, 7573, -11088, 1581, 13, -1398, 550, 4376, - 1623, 1727, 857, -5310, 2528, -529, -401, 539, - 6508, 4246, 4105, -5363, 96, -13407, -694, 5061, - 3445, -3283, -348, -1470, 1114, 602, -404, -129, - 642, 1547, 23110, -2255, 1969, 333, 1297, 116, - -1691, 364, -528, 758, -1239, -1826, -249, -395, - 684, -856, -638, -10000, -2773, -6151, -1244, -3138, - -9688, -1994, 7124, 1368, -1870, -312, 1863, -1006, - 963, 789, 743, -4158, -760, 1384, -7525, -959, - -262, 5752, 4005, -12037, -210, 886, -1961, 4895, - -251, -158, 212, 677, 518, 342, -226, -360, - 466, 17, 28392, -20, 246, -686, -258, 640, - -378, -120, -443, 1078, -2612, 2084, -1706, 4334, - -4675, -4634, 2336, -9998, 9975, -1285, 2778, 3292, - -1717, 138, 2114, -1120, -180, -1146, 11988, 829, - -2530, -8827, 6833, -1191, -1653, 2691, -4067, 1166, - 1971, 303, -544, -1459, -261, 1065, 3410, 2050, - 3163, -515, 5456, -4261, 5483, 1531, -2098, 2020, - 3773, 588, 915, 158, -11876, 282, -1180, 265, - 11036, -66, -1741, -1894, -4234, 3048, 218, -1030, - 2240, -12666, -2290, -1673, -1911, 1480, 287, -81, - 1182, 216, -10734, 2201, -58, -619, 8585, -574, - -4576, 1852, -468, -6759, -7667, 167, 995, -1114, - -1276, -2053, 2178, -8133, -1270, -7822, -10582, 5380, - 3037, 1071, 827, 4972, 1024, -129, -180, -3002, - -846, -736, 9587, 1890, 10287, -1954, 1042, 1558, - -950, 2406, -1852, 2275, 6694, -703, -910, 3854, - 812, 521, -1075, -761, 5357, -3911, 3892, 7944, - 4580, 5031, 1088, 7116, -1746, -5223, 2607, 3227, - 2296, 5603, 211, -731, 6450, -3312, -12378, -326, - 4245, 4168, -799, -3563, -505, 725, -5297, 2196, - 2221, -16, -3472, 315, 626, -6131, 71, 920, - -4383, -1340, -2675, -664, 7412, -1240, -1361, 997, - -3817, -2377, -11717, 1661, 22, 540, -5261, -950, - 7472, 3148, 7647, -4400, 4558, -4412, -869, -1528, - -2618, 8311, 2110, 534, -460, -223, -162, -828, - 274, 1844, 1861, -1583, 6899, 5222, -1772, -2880, - -6400, 4703, 2606, -3990, -1224, -4160, 9032, -299 -}, - -.cb4440m1 = { - 32767, 383, 857, -1579, -423, 1164, -1606, 1218, - -410, 777, -292, 122, 282, -74, -1394, 259, - -734, 102, -82, 32616, 427, -545, -146, -141, - 340, 506, -808, 171, -778, 900, -204, -277, - -228, -426, 566, -481, -1138, -907, 112, 2722, - 871, 115, -7202, 1953, -826, -1812, -396, -14722, - -840, 155, 1114, 5624, 1112, -147, -6383, 926, - 1505, 360, 937, -13391, 969, 7062, 2218, -3531, - 471, 458, 191, -465, 8664, -1168, 546, 2109, - -944, -74, 1644, -81, -760, -1920, 2659, 13330, - 1511, -1148, 1346, 796, -20, -15616, 1246, -1190, --10882, -774, -70, 3643, -896, 1830, -192, 1018, - 1085, -95, -309, 659, 91, 727, -4486, 486, - -2078, 1235, -14415, -4053, -1619, -2589, -582, -4650, - 4076, -762, -1111, 277, 1448, -742, -314, -979, - 1889, 2679, -1972, 2480, 302, 2869, -9183, -445, - -1817, 12894, 106, 187, -1406, -615, -1174, 746, - -371, 382, 350, -1811, -527, 36, 500, -835, - -106, 1134, -2207, 1021, 348, 908, -21780, 448, - 688, -60, -1790, 1901, -22990, 1467, 596, -912, - -3190, 1484, 269, -409, -474, -1670, 1328, 152, - -402, 359, -734, -13208, 62, -4197, -6242, 5195, - -2841, 5030, 2794, 1264, -1130, 3821, 961, 729, - 1075, 49, -148, 7267, 2596, -5093, -8284, -6875, - -3059, 3909, -4635, 1402, -6334, -342, -3083, -861, - 490, 1257, -630, 128, 2240, 832, 1060, -1802, - -1652, 128, 7816, -14391, -6722, -3328, -2586, 3044, - 1088, 1577, 852, -142, -176, 1371, 1236, 976, - 12165, -1596, -199, -504, -11020, -582, 972, -1468, - -2402, -666, -3327, -2148, 1078, -194, 9675, -2102, - -1236, -70, -942, 291, 1364, 1403, -3362, 12963, - -375, -1728, 1615, -2354, 633, -506, -194, 13037, - 14172, 534, -1026, -425, 2488, -180, -678, -436, - 272, 1507, -334, 840, -1000, -1068, 1029, -306, - 24, -4435, -5994, -1307, 4251, 3968, 2527, -981, - -2626, -4400, -242, -1823, -679, 12831, -22, 51, - -381, 2422, -2376, -8156, -1477, -6974, 1102, -373, - 467, 11314, -554, -432, 824, 7277, 393, -178, - 179, -653, 11848, -1593, 14143, -731, -1036, -2322, - 261, -1992, -1152, -1430, -1354, -51, -285, -1637, - 144, -59, -2182, 5731, 538, -880, 397, 3010, - 707, -1822, -1006, 4686, -5096, 4246, -3096, -3997, - -254, -11025, 394, -345, 18780, -686, -517, -3422, - 104, -2173, 2439, -5400, -10, 1084, 1821, -602, - 1431, 405, 2143, 499, 405, 351, -62, -47, - 1954, -29915, 440, 1054, 559, -1210, 442, 928, - -1, 59, 279, -112, -110, -440, -396, 805, - 311, 858, -431, -1070, -30192, 135, 1246, -345, - 790, 498, 319, -302, -469, -10, 512, -829, - -526, -2052, 2456, 134, -19375, -1210, -1292, 640, - 3232, 2580, 973, -2412, 271, -282, 632, -523, - -847, -138, -990, 2501, 536, -166, 2100, -357, - 122, 466, -4, 2034, 20083, 1578, 444, -344, - -689, 5733, -456, -503, -592, -1350, -1038, 932, - -1916, 1098, -990, -22687, 1544, -442, -396, -570, - -683, -616, -1431, 118, 4113, -312, 2300, 2093, - -2344, -2955, 6343, 4306, -10078, 6286, -5794, -806, - 664, -217, 548, 5072, 4626, -1643, -11619, 779, - 1956, -2960, 614, 2087, 9104, -2418, 775, -4447, - 768, 1599, -1084, 999, 1652, 1090, 630, -1197, - -3495, -912, -9817, 648, 3278, 1828, 13605, 2757, - -831, -1191, -1846, -1441, -278, -8530, -455, -495, - 323, -911, 2500, 14100, 3635, 1016, -936, 5265, - -3092, 2125, -121, -64, -656, -337, 9438, -7600, - 1403, -11917, 2180, 2612, 1664, 1091, -318, -3300, - -427, 282, 1979, 894, -703, 514, 160, 1697, - 6508, 828, 187, -34, -1094, -2861, 240, -5013, - 6004, -4796, -991, 158, 11437, -1730, 354, 1195, - 3790, -10432, -3584, 13872, 336, 2043, 221, 604, - 2930, 1080, -1417, 1878, -878, -459, -419, 364, - -1037, 7764, 3100, 48, 11057, 1936, 2229, 9150, - -472, 1178, -129, 2876, -249, -258, -1181, -329, - -581, -1140, -1967, 347, -539, -394, 775, -1151, - -31, 1052, -1900, -213, -1552, 22484, 164, -113, - 135, -1294, 550, 7738, -7223, -739, 1362, 5518, - 193, -2170, -11861, -1357, 351, 2215, 165, 16, - -606, 727, -158, -772, -13420, -1248, 12422, -812, - 1768, -442, 1269, -1076, 899, 124, -249, -1110, - 653, -3064, -1632, 839, -230, 512, 642, 13230, - 13285, -552, -1113, -595, 864, 537, -1012, -539, - -615, -491, 1014, 800, -10, 534, -1227, -25011, - 1239, -26, 3834, 104, 762, 1259, 2112, -300, - -920, -812, 612, -1061, -378, -246, -7, 11042, --18492, -1411, -77, 407, -556, 218, 1751, 1069, - -294, 1789, 904, 285, -76, 300, -160, -128, - -3398, -2001, 1689, 4946, -2750, 1427, -12632, -1873, - -1802, -1115, -2777, -4436, 2937, -6408, -467, 487, - 1043, 3914, -81, 1540, -11718, 1368, -12656, -583, - 1009, -416, 249, 1874, 1157, 994, -858, -154, - 294, 333, -26, 73, -1576, -20, -560, -1068, - 1325, -588, 26161, 1580, -411, -587, -1083, -79, - 762, 292, -622, 788, 284, 2014, 78, 554, - -516, 1340, 835, 300, -24827, 558, -705, -22, - 139, -159, -246, -585, 4318, 234, 1308, -198, - -3370, 5724, 2381, 13843, 4, 569, 8002, 1188, - -63, -1698, 4624, -405, -218, 4238, -888, -1180, - 3750, -4848, -9497, 293, -1087, -13274, -33, -2870, - 457, -618, 338, -34, 286, 345, -5321, 904, - -5656, -2082, 12644, -7423, 532, 958, -1997, -1483, - -2982, 3115, -1851, -2025, 1853, -918, -903, 1554, - 540, -16549, 1441, 2939, -1272, 3106, 2374, 3906, - -697, 1144, 750, -379, -6502, 980, 386, 36, - 1109, 1195, 6272, 4264, 1501, 5369, -1560, 3535, - 1084, 739, -1031, -4400, 8452, -430, -1787, -7669, - -231, -115, 4324, -1820, -2098, -786, 7478, -2709, --14255, 5771, 115, -1700, -111, -1482, -1369, -112, - 122, -472, 233, 2427, 1816, 180, -481, 928, - 82, 84, -700, -448, -946, 1968, 1644, 168, - -167, 16164, 155, -10316, 941, -584, 488, 96, - 5205, 491, -1844, -13055, 1266, -352, -836, 558, - 1546, -1720, 313, 2033, 597, -14351, 4426, 3281, - -559, 2614, 3248, -2265, -10312, -1614, -288, 480, - 1419, -546, -485, 835, 960, 462, 923, 6518, - 834, -711, -12639, 8811, -207, 1806, 337, -1240, - -4796, 2383, 277, 1141, 969, 59, 197, 1365, - -614, -9144, 4824, -436, 4191, -2588, 4509, 391, - -5055, -3231, 6978, -6388, 51, 105, -863, 1050, - 13103, 12769, -420, -1562, -123, 2702, 292, 1061, - 123, 405, 1917, -275, 493, -95, -195, 130, - -2613, 9010, 196, -1382, 5903, 7281, 1585, 2557, - -876, 3166, 6910, 590, -3060, -559, 4722, 393, - 613, -392, -3022, 9892, 1808, 923, 8123, 9873, - -1665, 2349, 2894, 591, 2000, -3734, -917, 220, - 408, 296, -656, 2608, -1700, 400, -10734, 5434, - 6504, -1399, 2175, -1203, -6358, -1221, -5062, 45, - 970, -500, -1322, 1176, 5882, -11687, 6324, -2183, - 2327, 922, -5628, -3507, 2406, 874, 1399, 4518, - -343, 857, -224, 802, -725, -8561, 4432, 1974, - 1825, -2168, -451, -3408, 6587, 7589, 3361, -4711, - -1474, 3151, 1950, 1022, 1466, 9192, 4666, -822, - 1024, 2342, -2220, 1169, 10460, 2993, -988, -4407, - -6727, 902, 1659, 80, 106, 400, 34, 1746, - -6982, 10484, 6333, -845, -3333, 1764, 217, -4730, - -3306, -3664, -2830, 2254, -927, -55, 587, 1812, - 281, 4375, -3614, -1349, 1802, -6184, -2648, -4189, - -9381, -3243, -4147, 384, 2241, 5524, -478, -1534 -}, - -.cb4448l0 = { --15402, -5156, -1798, -144, -4711, -4700, 2819, -389, - 148, -2600, 1706, -1906, -578, 495, 24, 829, - -383, -12581, 11667, -1039, 1395, 2670, -288, 23, - 628, -248, -512, 79, -326, -5428, -2830, -2476, - -1253, -915, 12042, -674, -110, 2950, 3885, -5799, - 983, 616, -652, -60, -372, 22, -141, -167, - 98, 125, -100, 27211, 133, -127, -271, -272, - -176, 1268, 173, -422, 2431, -3998, -2797, 2328, - 182, 6526, 3318, -6282, -10580, 3966, 8504, 527, - 9507, 6203, 990, -989, 6030, -136, 647, -1100, - -324, -2618, -2499, 500, -132, -842, 1237, 3599, - 2285, 2906, 10766, 11284, -2794, 242, 184, -1934, - 55, -839, -1181, 406, 855, 902, 10490, -327, - -1561, 5742, 428, 2218, 1523, 5229, 9130, -760, - 108, -140, 22229, 1132, 411, 720, 414, -356, - -745, -1276, -899, -562, 369, 5, -7770, 4101, - 3626, 126, -13, -4356, 728, -3197, 1930, -1470, - -6936, -410, 6720, 1897, -530, -4267, -2181, -876, - -472, -2540, -10234, 4008, 10217, -2561, -2021, 716, - -1378, -325, 427, -245, 314, -48, -118, -150, --30295, -368, 256, 369, -656, -78, -246, -140, - -1250, -635, 1332, -13604, -10383, -1375, 353, 2417, - 2140, -349, 1460, -51, -309, 523, 509, 2352, - 1208, -377, -2023, 9708, 397, 1216, 10610, -4416, - 5520, 3902, -2119, -480, -420, 1170, 36, -3304, - 1550, -266, 1682, -808, 2420, 2700, 16239, 3910, - 572, -375, 85, -9775, -120, 2214, 2779, 11510, - 2628, -416, -1740, -1305, 1226, 78, 78, 635, - 422, -13892, 1302, -4117, -1218, 2681, -8436, -1723, - 2290, 2815, 1172, -181, -675, -475, -763, 2394, - -3639, 7903, -659, 2323, 4837, -6758, 9460, -1480, - -2403, -2783, 1496, 806, -458, -246, 12, -254, - 121, 1477, -633, -513, 791, 208, -390, -177, - -1292, -20471, -4401, -2678, 9026, 128, -265, 822, - 260, 11202, 3132, -1879, -3891, 1884, -842, -107, - 7516, 1208, -1552, -995, 1203, 2150, 11044, 1285, - 2282, 80, 1348, 5342, 2089, 924, 1472, -1454, - -8259, -226, -10259, -2335, -2442, 224, 3257, -1528, - 6685, 1630, 1969, 48, 4802, 6051, 987, 8662, - -2368, -4984, -1974, -4049, -5320, 5003, 299, -400, - 727, 208, -187, 2838, -4547, 9682, -2238, 1065, - -3206, 10091, 4915, 2945, -1635, -198, 1074, -698, - -716, -96, 1390, -2644, 1006, -4154, 10587, 1132, - 2912, -7399, -8350, 785, 156, -290, -142, -374, - -2161, 1066, 1358, -1798, 3050, -19, 452, 10470, --10948, 4190, -984, -2089, -728, 1503, 4273, 812, - 4950, -3750, 844, -1231, -1582, -2517, 2385, -10537, - 5807, -4621, 332, -357, -12484, 1676, 160, 10762, - -1225, -1374, 14, -1389, -2900, -467, -1260, 459, - -861, 102, 1715, 4295, -7324, -7400, 10435, 287, - 1866, 765, 1730, 3430, -744, -2, -1773, -96, - 2001, 2165, 118, 9296, -4640, -4612, 7134, 5128, - -7967, 404, -433, -433, 2222, -8050, 2023, 2766, - -260, -2440, 1607, 2442, 7763, -486, 3766, 2355, - 7515, 230, 1248, -8873, -8224, -9135, -1402, -1812, - 1223, 152, -2316, -739, -405, -784, -598, 625, - 503, -175, -573, -31693, 502, -478, -554, -934, - 387, -80, -484, -701, -34, -51, -494, -1461, - 1005, 2920, 11532, 2667, -1674, -832, 8680, -5767, - 786, -1558, -2062, 1009, -392, 2099, -7277, -2587, - 6302, 3070, 4496, -1713, -4042, -8109, 1642, -1894, - 3450, 840, 3632, 160, 578, 149, 767, 754, - 208, -870, -672, 252, -30, -213, -482, 50, - -578, -2, -148, 246, -31918, -568, 130, 472, - 761, -27, -51, 454, 144, 124, 5844, -8354, - 9562, -3755, -262, 3286, 1120, 983, -628, -734, - -1732, -1424, 353, -403, 15877, -13552, -335, 337, - 519, 140, 297, 150, 725, -780, 876, -116, - -91, -128, 275, 2499, 9313, -768, -10469, 1148, - 2172, -6417, 3292, -2187, -1108, 3055, 1105, 625, - 794, 68, 337, 1384, -106, -516, 574, 868, - 849, -997, 81, 25796, 28, 206, -3556, -351, - 1058, 1126, -7826, 5310, -4102, 5352, -6835, -4032, - 1487, 230, 5617, 937, 10484, -71, 2653, 1203, - -1, 667, -1489, -10136, 7782, -763, 792, 1434, - -170, 367, 96, -21992, -252, 756, 145, -1476, - 1408, 1523, -819, -576, -476, -1068, -241, -39, - 1547, 9553, -622, -1799, 1861, 6115, -864, 10690, - -586, 470, 200, 1162, 586, 44, -11650, 3453, - 8734, -2754, -178, 236, -2650, 2654, 2699, 1180, - 5325, -458, -40, -218, -6, 126, 6794, 506, - 860, 11863, 652, 1665, -4213, 4863, 1424, 5712, - -663, -688, -10, -1421, -676, -1325, -378, -311, - -490, 19501, 1242, 268, 4581, 1587, -1153, 848, - -1378, -1159, 505, 63, 704, 1942, 2204, -2106, - 44, 479, -1098, 333, -21595, -617, -6444, 3547, - 1282, -1784, 4664, -1330, 2607, 1241, -3579, 247, - -875, 11359, -3013, -136, -12813, -14400, 1857, -998, - 1342, 1187, -338, 1263, 575, 1226, -995, 596, - 446, 293, 767, -356, 70, 786, 466, 202, - 149, 849, -28991, 652, 124, -209, -124, -406, - -5463, -1413, -1300, -5339, -1761, 4770, 2680, -10542, - 3486, 5601, 2932, 1581, 489, 521, -16583, 1, - -1529, 5942, 1234, 4714, -1647, 1150, 2802, 642, - 586, 3836, 240, 307, -490, 67, 771, 816, - -906, 1554, 1090, -2353, -629, 11291, 2941, -2982, - 9473, 1434, -4351, -8017, -5173, 8071, 1931, 1281, - -4055, -3224, -1918, -271, -204, 670, 3491, 107, --31624, 227, 75, -91, 108, 171, -53, -201, - 373, 63, 118, 126, -104, 127, -88, 1810, - 11688, -10240, 550, 3692, -4978, -1619, 40, 911, - -1080, 580, -767, 333, 192, 403, 308, -904, - 142, 31169, 503, -1101, -146, -144, 35, 181, - -355, 54, 590, 499, 95, -1767, 444, -49, - 2160, 7176, 12032, 6478, -741, -5576, -644, -101, - -1251, -1268, 2365, 10029, 537, -1476, 307, 2108, - -2478, -944, 10725, 349, -4242, -135, 7577, -4492, - 1492, -2512, 7736, -5118, -6756, -2436, -1890, -2390, - 1620, 914, 1658, 47, -11692, -134, -1740, -196, - 9521, -136, -1376, -8682, -1136, 1096, 903, -1148, - -334, -228, -4, -675, -199, 1914, 2827, -11098, - -2129, -2559, -978, 175, 1832, 10075, -2358, -1888 -}, - -.cb4448l1 = { --11514, -2858, 12392, -305, -206, 929, 473, -3120, - -2766, -1068, -1237, 420, -718, -21, -336, -45, - -478, -1517, 1830, -12644, 259, 11978, 257, 1494, - -1759, 247, -733, 112, -2242, 290, 234, -10260, - 1781, -1806, -4104, 1747, 38, -692, 4971, -9113, - -1925, -1580, -615, -9608, 3779, -11158, 469, -4736, - 299, -2815, 2108, 1910, -2356, 66, 523, -440, - 2298, -4219, -2512, -1110, 11192, 5932, -2629, -7985, - -992, 775, -1134, 3287, 900, -681, -39, -1206, - -1708, -6800, -361, 11024, 8496, -198, -3855, 1486, - -2547, 1773, 50, -276, -286, 785, -7884, 438, - 4590, 2794, 5333, 5476, 2108, 660, 3610, 2308, - -8538, 224, -132, 134, 731, 988, -1368, 3894, - 4318, 9911, -104, 320, -9506, 1721, -5690, 1712, - -8747, -1876, -5122, -1304, -162, 752, 3646, 1621, - 11089, 1117, -1971, 1058, 3070, 180, 23112, 175, - 483, -1028, -538, 497, 1053, 61, 788, -455, - 22, -55, -32, -326, 15956, -2045, 788, 9784, - -1170, -819, -3677, 647, -484, 578, -160, 286, - -421, 289, 8140, 3838, -578, -1866, -2074, 667, --11951, 1684, 3439, 1280, 158, -1784, 1276, 638, - 562, 2045, -220, 852, -594, -2109, -2665, 2748, - 38, 91, 1377, -624, -18586, -498, -882, 36, - 536, -99, 62, -5275, 3051, 231, -6343, -1751, - 1206, -1646, -1347, -13590, 1431, -271, -442, 21934, - -143, -1824, -378, -463, 816, 379, 336, -291, - -652, 275, -758, 257, -14866, -1304, 7260, -3373, - 1249, -1992, 2734, -2565, -3064, -416, 2424, 279, - 10518, 206, -681, -14338, 666, 1843, -648, 526, - 1982, 366, 684, 1019, 192, 8, -482, -4785, - 2134, -1722, 10674, -1613, 33, 1148, -1566, 10226, - 3397, 667, -1100, -738, 2420, -14282, 451, 90, --10346, 2673, 1175, -3639, 266, -566, 0, 1672, - 1082, 298, 359, -497, 1784, -570, -2538, 2522, - -3825, 6265, 99, -7927, 3160, 11079, 131, -2080, - 92, -29951, 268, -293, 240, 254, -182, -145, - 303, 12, 86, 596, 246, 136, 1020, -1521, - -1134, -10125, -5691, 6028, -3703, -4295, -3718, -5719, - -564, 660, -321, -1073, 83, -3068, 6167, 12788, - -762, 8057, -1215, 2379, 2142, -3625, -503, -1418, - -304, -649, -501, -12558, 12787, 3737, 1465, -3692, - -1321, 1106, -1136, -651, -50, 1608, 59, -583, - 82, 331, 443, 782, 93, 285, 310, 29149, - -698, -52, -909, -238, -222, -114, 4, 650, - -200, 235, 2541, 598, 378, 11000, 3101, -8228, - 1690, -4313, 6996, -11, -2620, -1458, -1428, 579, - -304, 20, -372, 897, 602, 432, -138, 690, - 593, -1485, 136, 191, -32147, 260, 199, 412, - -168, -41, -384, -362, -14, 242, 366, -318, - -304, 1544, 458, -7790, 3332, -5117, -1937, 868, - 12622, 906, 1941, 4763, 1698, 351, -234, -973, - 9166, 6726, 2686, 248, 3597, -9812, -400, 4155, - 2852, -415, 2218, 876, 1423, 3852, 2965, -410, - 1820, 8268, -1296, 686, 114, 3087, 3007, -9402, - -5751, -3459, -6674, 418, 4137, 4778, 56, -1399, - -1698, -2590, 8343, -2130, 2535, 6148, -134, -2393, - 11551, -338, 735, 630, -658, 13358, 949, -1136, - -217, -985, 182, -1014, 1459, 221, 7713, -1386, - -1427, 1326, 555, 66, 2694, -1535, -268, -13596, - 658, 305, 858, 548, -12748, -582, -1055, -659, --12155, 940, -2164, -2518, -126, -132, -842, 641, - -483, -446, -5184, -186, -511, 1169, -6092, 6161, - 3082, -664, -2037, 847, 11032, -1306, -1673, -1219, - -36, 1862, 10053, 780, -282, -837, -263, 509, - -588, -12646, -769, -2164, -2219, 524, -3433, -6437, - 3890, -623, -7509, 241, 4042, 264, -1394, 3646, - -6925, -5184, 1218, -1476, -2240, 1882, 182, -3450, - -497, -148, 160, -1579, -19545, -80, 886, 913, - 708, 728, 393, -603, -778, 3414, -778, -1495, - 1205, 2342, 232, -3634, -76, -16792, -684, 1322, - 192, -13248, -658, 7650, 4731, -169, 5148, -1413, - 3026, 2480, -2190, 1004, -2082, 237, 171, -717, - -766, -525, -11802, -3776, -9914, 1374, -3250, 415, - -2787, -175, -1081, 792, 980, 11464, 834, 714, - -993, 150, 77, 2306, 11249, -3058, -3418, -1758, - -239, -119, -1408, 6083, -4276, 1827, 1660, 2287, - -2997, -576, 400, 2062, -3174, -6215, 10026, -1082, - 41, 249, 10026, -6199, -301, 280, 10120, 2249, - 527, -564, 1002, 622, 3341, 408, 2870, 12902, - 13307, 689, 336, -819, -43, 832, -1242, 657, - -106, 42, 1123, 149, -2072, 78, -303, 329, - 21745, -2172, -1204, 448, 1437, -560, -376, 311, - -73, 153, -785, -368, 54, -445, -92, 120, - -59, -377, 402, 567, -25820, 1284, 1288, 200, - -865, -1286, -41, -1862, 402, 179, -2338, -3876, - 4992, -1824, -10092, -3407, -8516, -3556, 130, -5695, - 5846, 2333, 2995, 2110, -6946, 5049, -2377, 1655, - -859, -4737, 1648, 7031, -7344, 4992, 1760, -711, - 3134, 14363, -907, 171, -1971, -3062, -1079, 600, - 603, -224, -440, -11328, -291, -663, 1878, -715, - -2724, 284, -456, -10970, -3225, -2240, 252, -977, - -360, 729, -572, 3981, 1615, -52, -5372, 6095, - -9888, 6873, -3830, 4916, 1834, -1581, -11268, -2316, - -398, 1361, 6151, 2736, -1968, 4624, -180, -260, - -1221, -5633, -1300, -1081, -1433, -509, 366, -388, - 1660, 340, -18997, 694, -1184, -813, 1324, 1261, - 735, -186, 5258, -583, -221, 1707, 149, 1022, - -835, 1089, 2939, 2025, 421, 411, 3609, -13797, - 464, 9214, 2462, -6257, 6032, 1911, 1282, -9673, - 974, -703, -128, 950, 369, 1160, -674, -312, --13858, 1078, -7606, 8, 2786, 367, -6441, -824, - -195, 714, 484, 108, 475, 289, -1012, -1591, --10880, -324, -647, -2199, 10378, 5781, 995, -416, - 871, -1240, -380, 70, -1893, 7632, 1727, -908, - -672, -10901, -962, -7322, 794, 1748, -5568, 1215, - 5845, -9575, -2413, -2159, 3077, 1359, -416, 6277, - -85, 1352, -3498, 6130, 1125, -236, 1950, 8481, - 716, -560, -1311, -228, 250, -440, -5320, -1941, - -9710, 4637, 1420, -102, -8222, 616, -2254, -528, - 196, -1315, -749, -97, -285, -15880, 1105, 630, - 368, -809, 29, -1688, -2314, 745, -1627, 19840, - -2380, 4108, 1670, 2763, 275, 530, 492, -589 -}, - -.cb4448s0 = { --10720, 9997, -1313, 8849, 5152, -226, -2908, 303, - -842, -870, 165, -1372, -105, -154, 170, 2424, - -2476, -2126, -8329, 349, -4509, 5128, -92, 9086, - -7263, 416, -124, 341, -88, 239, 5172, 553, - 1526, 1728, 1955, -1489, -6595, -11237, -10224, -394, - -927, -932, 674, 743, 317, 4628, 8453, -3768, - 2545, 3506, -2406, 9108, 5643, 4660, 4116, -2452, - -1391, -154, -74, 180, 5270, -7922, 46, 11046, - 6076, 735, 7922, -196, -1080, 1445, -687, -2403, - -784, 742, -269, -498, 6010, -4045, 1053, 891, - -1538, 613, -84, -4254, -957, 4682, -14004, 2050, - -647, -718, 557, -2720, 2437, -7675, 11874, -9284, - -734, 775, -2231, 105, 366, 1360, -98, -126, - 508, 2647, 729, 762, -8806, -10413, 9008, -2093, - 1107, 201, 1421, 1181, -259, 1420, 828, 327, - -1956, -573, -874, 354, 2662, -1437, 10864, -9240, - -7648, 1670, 1598, 173, 438, -373, -566, 246, --11999, 1817, -611, 1, -1652, 1876, 1354, 1270, - -789, 300, -321, 11577, -516, 329, 5723, 4732, - 1717, -6224, -5356, -6292, -370, -3644, -922, -50, - -14, -581, -1554, -1675, -20, -965, 28479, 658, - -498, -488, 504, -601, 437, -585, -245, -196, - 186, 281, -174, 159, 7469, 5890, -5112, 4918, - -9023, -360, 40, -2975, 4784, -437, 1609, 1032, - 2759, -297, 106, 5176, -4315, 568, -9536, -1297, - -6783, -10965, 1285, 264, 330, -508, -522, 624, - 662, 539, 7248, -13780, 40, 2140, -2188, 1925, - -8972, 1147, -1340, 870, 779, -4, -101, -374, - 781, 5733, -5712, -5777, 2080, 875, 13450, -1551, - -3229, -1818, -114, 1265, 501, 636, -576, -623, - -1269, 3006, 1023, 862, 1359, 1950, 588, -22648, - 218, -438, 1547, -408, -844, -263, -106, 14754, - -689, -9466, -978, -21, 1412, 43, 2012, 352, - 908, 277, -960, -747, -230, -1557, -7132, -5707, - 79, -2474, 2177, -5349, 2510, -12720, 2833, -2152, - -1693, 458, 197, -643, 735, -2728, -893, 2758, - 5196, -3566, -4294, -4914, -1222, 188, -8884, -6234, - 2391, -1518, 663, 572, -1465, 1147, 8486, 2037, - 2516, 941, 6092, 11602, -2559, -1702, -1848, -924, - -210, -108, -1052, 8360, -7567, -4588, -169, 3464, - -9206, 1842, -4329, -2499, -341, 592, 918, -102, - 340, 214, 1037, -324, -16289, 10308, -47, -29, - 1340, -603, -2763, -548, 392, 1489, -149, -769, - -67, 13270, -2233, 8257, 1582, 1034, -4270, 916, - 4486, 1191, -102, 159, 109, -536, -664, -987, - -8041, -1759, 4264, -5600, -13815, -1158, 1712, 2516, - -634, 504, 515, 732, -46, -685, -481, 1685, - -1782, 262, -3600, 14721, 6334, 7941, 101, 914, - -2141, -2, 182, 829, -215, -122, 6325, -3752, - -2812, 1618, 3512, -1591, -4276, 6994, -10349, -5675, - -1501, -1766, -1949, 436, 82, -5596, 2592, -1086, - -2804, 2540, 458, -550, -1834, -2401, -7563, 2340, - 1678, -7666, 4538, 27, 6337, 3642, 17068, 5310, - 1115, 1579, -142, -397, -670, 2010, 863, -504, - 845, 848, 770, -8821, 1963, 2782, 162, 1130, - 2597, -13699, -3996, 800, 2499, -1045, -1512, -186, - -59, -119, -5048, 6800, -8766, 784, -7091, -1002, - 335, 1993, -1045, 601, 1804, 166, 1343, 110, - -224, 2247, -344, -5, -4292, 5846, 8591, -11846, - -1303, -1027, 1759, -168, -194, -1281, 489, 378, - -5069, -3321, 11238, -375, -806, 3962, 9660, -2960, - -664, -1067, -627, 271, 1205, 1160, 261, 3725, - 7877, -679, 22, 598, -1086, -420, 2168, -46, --15552, 420, 1220, 1332, -58, -156, 7777, -4657, - 352, 15316, -4760, -2140, -2577, -1321, 2037, -371, - -1254, -912, -1177, -1367, -103, 4572, -9482, -1599, - 294, 403, -272, -2331, -4365, 13467, 4585, -2554, - -1743, 545, 162, -369, 6074, 11273, -8856, -8175, - 2543, -7, 314, -2033, 2704, -1755, -1431, -791, - -276, 1085, 236, 6553, 1872, 387, 1056, -31, --20610, -609, 608, 1007, 1604, -1501, -68, -527, - 204, 252, 2533, -721, 1468, 444, -72, 61, - -209, 512, -216, 42, 385, -490, -104, -29030, - -166, -4883, -2754, 788, -430, -867, 565, -1155, - 562, 1076, 1757, -2990, -14971, 8392, 902, 550, - 102, -6579, -6939, -319, 172, -863, 979, 2178, - 630, 160, 952, 946, -3955, 1515, 352, 2557, - -5339, 6166, 4588, -2040, 4031, -535, -2504, 2782, --12136, 1338, -2758, 458, -671, 155, 6998, -2598, - -931, -396, -922, 2060, 447, -42, -649, -532, - -552, -1945, -16548, 815, -408, 3469, -4118, 875, - -1017, -11150, -511, 3846, -11349, -1928, -781, 2765, - -681, -713, 655, -218, -8032, -465, 295, 1591, - -383, -1889, 1627, 108, 1149, 2513, 388, -5702, --15693, 24, 470, -4322, 3721, 1584, 1808, 350, - -1765, -620, -2953, 4354, 8512, -12533, -86, -2490, - -192, -507, 2024, 3942, -801, 13444, 738, -2086, - 162, 2013, 837, 56, -384, 3164, 5052, 1158, - -403, -6913, -4290, -2068, 16622, -2738, 856, -2884, - -2432, -410, -1179, -456, 504, -1359, 436, 352, - -6351, 327, -2196, -1502, 302, 338, -839, 235, - -520, 1283, 2710, 18814, 2256, -2, 400, 1300, - -1185, 1024, -3744, -3542, -4350, -763, 1902, -14737, - 5437, 48, -1589, -280, -67, 232, 2276, 1413, - 3284, -308, 1013, 610, 22787, -685, 724, 12, - -359, -1651, -1060, 569, 248, 3836, 605, -413, - 3380, -1360, -1120, -2933, -2368, -977, 10135, 12356, - 3739, -1571, -418, 580, -2662, -11460, -6128, 2867, - 11468, 825, -3201, -501, -138, -755, -554, 168, - 757, -564, 428, -12118, -15179, -1978, 432, -597, - 1528, 3038, -568, 1349, -3377, 914, 498, 928, - -91, -5, 9192, 3000, 2542, -1411, 626, 2705, - -763, 3247, 13736, 3034, 2170, -67, -852, -378, - 1264, -2771, -2415, -4236, 126, -1984, -13336, -1088, - -416, -1979, -520, 2506, -1505, 294, -2398, 218, - -8740, -3873, 2069, -1374, 86, -998, -3851, 1070, - 13357, 955, 3085, -536, 166, 926, 299, 6532, - 1324, -502, -1658, 1829, -1263, 445, -1902, 1452, - -2747, -16422, 1875, 1773, 452, 288, 5992, 1626, - 3659, -917, 2255, -1508, 356, 547, 158, 9, - -117, -1665, -595, 14392, -1013, 49, -4060, 12064, - 3666, -2903, -9145, -396, -4341, -953, 2758, -178, - -204, -462, 98, 222, -3622, -12200, -4484, -94, - -8642, -5694, 4034, -720, -1695, 751, -1668, -266, - -343, 296, -112, -900, -3750, -360, 1002, -7402, - 7758, 7370, 3332, -7517, -769, -1272, 412, -1451, - -89, -227, -11332, -472, -1108, -394, -339, -1981, - -3494, 12110, -564, -5958, -690, -1066, -130, 762, - -50, -1456, -1521, -8428, 994, -867, 2650, -2335, - 354, -2253, 4612, -12364, -2626, 1853, 577, -103 -}, - -.cb4448s1 = { - 25901, -239, 648, 167, -284, 198, -340, -1112, - -55, -242, -214, 528, 112, -259, -284, -250, - 23, 475, 780, -558, 111, 148, -2411, -19826, - -1158, 2799, -964, 44, -1204, 1187, -4036, 1872, - 3541, 768, 159, 1979, 3382, -113, 804, -1021, - 3708, -2577, 9697, 11527, -326, -7058, 4306, 1260, - 3782, 3370, 1595, 705, 2268, 2182, 1509, 1131, - 9877, -7260, -258, 49, 1686, -1472, -2556, -1973, --22425, 338, 486, 963, 1069, -34, -1027, -90, - -881, -473, 554, -6326, -873, -9744, 10157, -1079, - 584, -1047, -1954, 6204, 2416, -899, 1452, 938, - -439, -664, 4231, 9370, 7800, 170, 9448, -4756, - 1967, 686, -1186, 636, -1719, -1244, -540, -728, - 306, -1778, -7980, -3418, 8318, -1828, 1556, 3487, - 10195, 3741, -510, 2077, -1496, 1241, 384, 477, - -1051, 7922, -4077, -2513, 849, -693, -9170, 4264, - -7940, -1703, 460, -2986, 586, 13, 377, 781, - -7047, 6852, -1350, 7537, -493, -1919, 379, 3108, - 4293, 8467, -3875, 63, 44, 493, 1496, -1577, - -5676, 3318, 6628, 5177, -11082, 1146, 3251, -1159, - -461, 442, 1250, 212, 176, 3586, 137, -9153, --13772, -8211, 393, 1170, 1717, -671, 298, -233, - 883, -1533, 401, 254, 7700, -4827, 794, 377, - -376, 12240, 7298, 2445, 1168, -562, 1528, 563, - 421, -606, 0, 5792, -1069, 824, 3728, -2729, - 1005, -730, 4318, 644, 17336, -1588, 2100, -365, - 509, -415, 3684, -9128, -1096, -4278, 1549, -1247, - 5519, 11075, -2216, 6004, -3683, 409, -730, -414, - -263, -6623, 8194, 489, -9085, 334, -1104, -814, - 1412, 1522, -1657, -7029, -4142, -1274, -520, -40, - 650, -1886, 9701, 11456, -7567, 1176, 3268, 3016, - 1109, -117, -858, -155, -1249, -230, -216, 3945, - 9142, -2297, 134, -2563, 15131, 857, -1597, -618, - 150, -590, -166, -357, 388, -69, -8767, 2914, - 1087, 4673, -14373, 600, 382, -1893, 844, -242, - 544, -106, 568, -1141, 371, 2663, -1860, -725, - 8066, -1353, -8743, -10433, -1796, 427, -73, 178, - 96, 980, -478, 978, 1767, 6034, 633, 966, - 677, -65, -884, 417, 461, 62, -868, 93, - -100, 519, 16304, 2646, -1260, 12271, -140, 142, - 11138, -892, -2114, -629, 172, 744, -2056, -960, - 61, -980, 2082, -439, -3126, -2564, 1174, -78, - 254, -178, 1599, -436, 19023, 5335, -1686, -782, - 520, -8727, 256, -3588, -5694, 12323, -2091, 1511, - -656, 3872, 2370, -770, 282, 455, -573, -39, - 7845, -12566, 12690, -156, -442, -227, 575, -274, - -1717, 120, -40, 1866, 635, 161, 270, 1039, - 3256, -673, -3343, 4292, -14247, 7142, -4821, -591, - -418, 376, 21, 572, 551, 70, -5536, 79, - 2540, -505, -283, -350, -1279, -1630, 2234, -604, - 5246, -17580, -3022, -1052, -307, 6626, 2794, 1702, - 1875, -1876, 1011, -320, 1268, -282, 1072, 14370, - -8206, 1218, 630, 173, 7486, 15176, -6146, 4903, - -636, -1341, 1360, -1541, -1012, -778, 84, 426, - -124, -746, -252, -11085, 1783, -2833, 809, -744, - 2194, 3328, 7029, -5097, 4934, -3025, -641, 303, - -328, 258, 8674, 53, -3395, 975, -9944, -8550, - 3376, -714, 1078, 1186, 598, 808, -166, -752, - 484, -5088, 1484, -1278, 11394, -1876, -8236, 5159, - -1830, -1520, 2761, 592, -204, -1360, 454, 230, - -5038, -1582, -5617, 1346, -2045, 2306, 17764, 494, - 572, -1930, 339, 550, 784, 151, -753, 4708, - -3058, -8267, 3281, -1054, 870, -1201, -2005, -920, --10115, 5395, -6423, -798, 367, -221, -5296, -2808, - 8313, -5077, 1655, -200, 114, 46, 350, -2374, - 868, -327, 377, -9570, 1231, 9258, 8752, 3074, - -4411, -308, 2315, 6824, -3303, -896, -1186, 579, - -2561, 2280, 586, -798, 4747, -3487, 1306, -1241, - -487, -90, -52, 3231, -555, -17702, -2681, 1649, - -17, -278, -647, -4225, 2740, -1248, -3826, 1356, - 3572, -1010, 16160, -422, 304, 3970, 1124, -317, - -554, 673, -1191, 3180, -4429, 1581, 1543, -2097, - 4208, -9363, 10146, 1896, 2904, -4112, -1428, -207, - 459, -35, 5395, -8960, 3141, 11004, 308, 3687, - 1540, -2156, -592, 1640, 1003, -280, 797, 204, - 6910, -824, 4724, 4729, 5553, -3165, 483, -12, - 33, -588, -379, 402, 3543, -9646, 74, 9603, - -465, 2872, -2367, -885, 2894, -133, 2758, -721, - 3473, -13322, 1506, -1344, 512, 1066, -8300, 11391, - 11976, -1201, 13, -612, 165, -1823, 154, -123, - 1234, -423, -367, -58, 384, 2687, 2536, 826, - 6223, 1750, -8589, 1126, 9772, -6646, 2043, 1826, - -1037, -2018, 692, -818, -3431, -467, 11006, 3407, - 880, -2047, -10303, 6168, 1428, -307, -18, 661, - -252, 754, 1207, -2797, -3057, -6235, 99, -931, - 1618, 692, 2790, -294, -1200, -5768, -11691, -5305, - -100, 390, -783, -11660, -4675, -13570, 2764, 1414, - -786, 385, 163, 718, 794, 1118, 827, -634, - -75, 6224, 3965, -2092, -1120, -6395, 5474, -12986, - -3985, 635, -544, -1877, -191, 0, 121, 379, - -3059, 132, 26320, -721, 1262, -706, 421, -85, - -38, 665, 590, -208, -196, 168, 10, 1271, - -218, -365, -5843, -5897, -12346, -3026, 5916, -115, - -2671, -1022, -203, 962, 995, -850, 527, -516, - -1641, 452, 68, 1204, 740, 385, 38, 752, - 150, -3088, 20608, -54, -39, 6109, 3224, -92, - -315, 4407, -306, 1317, -395, -1617, 9104, -3493, --10724, -3059, 283, 81, -9791, -3210, 7307, 4459, - -639, -61, 1152, -184, 2290, 398, -2902, -2776, - -1624, 1153, 242, -8865, -3617, 309, -11933, -3847, - -5750, 3235, -153, -315, 382, 209, -923, 2072, - 458, 164, 3631, 3121, 3220, -828, -8644, 2215, - 3873, 12445, 533, -631, -53, -136, -728, -240, - 420, 2870, -4981, 906, -3272, 4735, 3613, 2412, - -3951, -10587, 7389, 564, 3266, -1348, 524, 1570, - 6611, 3354, -1042, 1862, 1860, -1187, 5761, -1722, - 8231, -7428, -5662, 1239, -2887, -218, 810, -1063, - 15078, 686, -2374, -293, -2031, -245, 4441, 5045, - 1100, 6722, 1787, -587, -380, 132, 5124, -12478, - 95, -1230, 1464, -1871, 929, 1430, 2666, -3768, - 2784, -3697, -8238, -247, 603, -8406, 1330, 1033, - -743, -2546, 2739, 856, -12698, -4970, 2290, -1104, - 34, -1048, -80, 634, -695, -84, 2374, -24793, - -1064, -1080, -254, -812, 252, -1582, -401, 765, - 847, 340, 479, -3163, 150, -187, 8432, 2607, - 2075, 1384, 423, -7361, -10262, -2254, 54, 1065, - 40, 857, 2014, -5076, 198, 657, 482, -422, - -2185, -850, -318, 164, -684, 2698, -1008, 17493, - -64, -6788, -5966, -14352, -2349, 2492, 266, 1077, - 1935, -99, 4270, 2319, -2391, 779, 187, -70 -}, - -.cb4448m0 = { --20455, 663, -3140, 2540, -2110, -406, 1078, 1968, - -741, -2458, 490, -496, 338, 581, 1079, -616, - 154, 10097, 231, -228, 477, 20, 1372, 11492, - -1112, -3148, 547, 248, -676, 8197, 5902, -1299, - 519, -2808, 11529, -76, 1239, -1032, -542, 353, - -1071, 278, 274, 2781, -7741, 3260, 2711, 175, - 12340, 1110, -2348, -5303, 1440, 581, -70, 262, - -9902, -2375, 530, 1433, 1624, -1475, -947, 13450, - 1318, -1696, 207, 198, 1162, -944, -9329, -1046, - 195, -106, 682, 14624, -854, -2410, 1054, 242, - -348, 581, 463, 716, 760, 2714, 1356, -1359, - 13089, 2565, -10523, 1934, 637, 1218, 1160, 830, - 905, 272, 408, -581, -1426, 613, 2586, -8186, - 3748, -6663, 4372, -114, -4644, 2998, -9440, 685, - -8741, 3363, -5623, -4229, -7058, -1201, -822, 1806, - 8671, -856, -612, 1165, -426, 317, 6867, -80, - -7084, 1143, -1862, 2742, 669, 550, 22, 173, - 4301, -10406, 1042, -346, -1334, -2897, 647, 744, - 14, -1338, -1648, -1235, 3550, -455, 2125, 1188, - 17136, 1188, -6782, -849, 298, -1054, -9254, 409, - -1736, 1410, -7254, -1889, 457, -740, 22, 262, - 32242, 1657, -2308, 2688, -607, 609, 4, 150, - -264, 192, -140, 246, -393, -76, -15050, 390, - 969, 457, 1436, -649, 460, -12150, 1359, 1014, - -2103, -576, 55, -590, 113, -1410, -23431, 182, - -2386, -1568, 904, -218, -281, -188, -178, 63, - 211, 549, 687, -12069, -88, -654, -1070, -13155, - -124, -697, 438, 3174, 1700, 270, 234, -289, - -625, 15749, -2340, 8466, 397, -4460, -1030, 3206, - 1081, -1317, -1030, -72, 487, -1477, -8782, 6984, - -1221, 2395, 3198, 2995, 5862, -1195, -6075, -1020, - -934, 868, -470, -1024, 1202, -998, -1306, 22118, - 344, 540, -3137, -547, 2440, -28, 222, 372, - -424, -199, 1068, -917, -105, -4278, 52, -299, - 6933, 11715, -520, -2853, 58, -8575, 416, -1272, - 1128, -32, -1140, -1873, -495, 235, 2079, -314, - -1328, -2615, -20194, 848, -1553, 387, -6091, 906, --10180, 8634, -506, 4078, 318, -2657, 1612, -126, - -1424, -4, -1745, -343, 302, 2439, 12190, 941, --12534, -4756, -176, -90, -1295, 1041, 1875, -450, - 89, 212, 2098, 1708, 1876, 4065, 1682, 1972, - -4916, -951, -10683, 1443, -10978, 772, -1013, -235, - 59, 213, -230, 142, -576, 506, 101, 44, - -137, 26238, -47, -322, -289, 281, 2614, -4538, - 634, 1116, 1191, 2985, -759, -5527, 550, 2107, - -6018, -11013, -425, -221, 901, 217, 546, 213, - 2026, 695, 1074, -2132, -173, -1664, -783, 25065, - -326, 86, -632, 1398, 4708, -2911, 2376, 135, - -1471, -904, -2338, 987, 3216, -4564, 314, 15692, - -214, 1238, 230, -181, -30537, -294, 155, -607, - 218, -309, -180, -246, -102, -988, -644, 111, --10517, -1604, -1180, -2748, 1191, -12959, -2, -1004, - 28, -196, 1974, -790, 809, 8802, -1204, 332, - 180, -3857, 1025, -5998, -9578, 94, -1069, -2398, - 185, 643, -1479, 322, 2544, 12584, -8308, -3856, - 1286, 1600, -2539, -2752, -2520, -367, -942, 417, - -309, -2162, 2044, 10886, 1764, 11028, 3810, 2955, - -1028, -1017, -1752, -487, -605, 48, 2312, -368, - -1758, -252, 371, 19882, -1994, 1675, 5494, -660, - -1669, 256, -54, -941, 4318, -306, 2143, 273, - -3367, -3088, 6509, -1884, -5400, -576, 11394, 875, - 455, 271, -218, 1401, -44, -5336, -12170, 4664, - -589, -3562, -1934, 5842, 1357, 3232, 1449, -402, --11228, -96, -1509, 2073, -1751, 776, -439, 775, - -3302, 13521, -325, -118, -172, 411, -396, 6154, - -2455, -52, -4616, 783, -12488, -2085, 5817, -1278, - 635, -1713, 2888, -830, 649, 7482, 10134, 9147, - 3784, 1046, -1934, -2580, 102, -679, -124, 68, - 657, 417, -175, -32768, -80, 375, -941, 224, - 271, -232, 1519, -99, -680, 67, 66, -618, - 252, 1907, 5121, 2456, -2117, -9388, -1441, 636, - 7868, -8340, 1939, 1340, 1511, 711, 6530, -1748, - -183, 90, 2561, 5860, -364, 5117, -4101, -4028, - -944, 10526, -1028, 1047, 707, 12116, -12596, -4006, - 922, -1047, 348, -971, -272, -2388, 435, 246, - -1055, 148, -1852, -12418, -2531, 3524, 4103, -344, - 1667, 2818, -4576, -273, -8337, 183, 497, -144, - -9845, -292, -503, -1212, 4316, -1434, -11058, -3043, - -5817, -981, 813, 0, -718, -467, 10285, -19005, - -82, 776, 1192, 1030, 1560, 1080, -144, 729, - 606, -225, -389, -187, 552, -930, -444, -5959, - -1960, -1315, 2650, -1282, -18790, 1772, 263, 1410, - 812, -458, -476, 744, 2595, -426, -19, 9119, - 4529, -1502, 4673, 3675, 7430, 1084, -6966, -518, --13552, 1054, 2474, -9499, 1041, 5114, 442, 2927, - 511, -1492, 217, -726, 398, -522, 35, 119, - -332, 106, 816, 437, -1223, 27612, 521, -29, - -462, 367, -966, 476, -2559, -3485, -160, 1487, - -272, -586, -6014, -232, 3679, -1864, 1244, 575, --14591, -483, -1428, 20, 7874, -2948, -5965, 2383, - 3270, 490, 2750, -547, -9658, -1473, 943, 285, - -2388, -772, -1582, 3181, 3419, 2628, -197, 3376, --13282, -7684, 3383, 70, -1174, -70, -6703, -7305, - -553, 3588, -826, -12, 7350, -3604, 345, 1098, - 3856, 918, 2038, -39, 11514, 15798, 1327, 1158, - 436, -918, 71, 953, 975, 1147, 174, 411, - 1467, 83, -4536, -1511, 5350, -3314, 13999, 18, - 4107, 1901, 834, 2614, 2356, -369, 943, -341, - -460, 4380, -10014, 3308, -3541, -3225, -621, 8449, - -1383, 4481, -1399, -3646, -936, 923, 221, 346, - 7828, 2406, 3021, -4993, 3012, -10903, -1925, 8153, - 382, -1453, 1238, 601, 1195, -2245, -2792, -4118, - 473, 4898, 12961, -6094, 5905, 1368, -2754, -303, - 768, -31, -1275, 1400, 596, -1326, 619, -1744, - 1145, -3977, 639, -10785, -1693, -11192, -541, -434, --11384, -1017, 14361, 1398, 521, -3239, 1851, -491, - 237, -1024, 1002, -3002, -303, -33, -6532, 601, - -3726, 7832, 6090, -10107, 957, -1149, 689, 1327, - -51, 1945, 990, -106, 595, 234, 518, 1060, - 77, 837, 28880, -91, -395, -275, -265, -279, - -217, -300, 240, -1055, -406, 4314, -2139, 6349, - -2227, -5996, 963, -10386, 4629, -560, 1080, 134 -}, - -.cb4448m1 = { - 31577, -1322, 1533, -2224, 253, -1485, -92, 294, - 183, -580, 420, 172, -794, -206, -342, -338, - 53, -85, -920, 29517, 1073, -972, -1839, 1004, - 290, 46, 460, -71, -988, 1731, -362, -2070, - 3848, -2, -3842, 734, -1221, -8012, 1104, 6782, - 9673, 1082, -8561, -860, -2135, -1557, -1613, -13999, - 1664, 2268, -1570, -732, 1010, -402, -1139, -428, - 400, 1123, -2108, -11776, -345, 10608, 1245, -3142, - -3244, -1132, 1700, -308, 1573, 543, 678, 5160, - -3062, 433, 2703, -852, -4903, -1880, 1706, 13995, - 2465, -4844, -904, -148, 350, -11168, 1406, 312, --11900, 397, 769, 5558, -1354, 187, -30, 231, - -1020, 202, 884, -198, -3151, -830, -8490, -670, - -2767, 1517, -12957, -3861, -2794, -1854, -180, 135, - 7140, 4103, -4427, 450, 494, -1033, -1110, -2857, - 11056, -711, -800, 3628, -180, -852, -10300, -2120, - -450, 14464, -511, 303, -1464, -542, -89, -204, - 500, -400, -318, 569, 216, 428, 350, 1973, - -137, -885, -1794, -974, 3977, 3382, -18624, -420, - -1947, 165, -449, 1395, -17313, -286, 2054, -447, - -2740, -1881, -550, -2166, 1360, -6021, -94, 148, - 676, -1619, -1737, -11977, -169, -1664, -7709, 6202, - -5954, 1681, 715, -263, 56, 369, 589, 564, - 1989, 1617, -1648, 9205, 1343, -11508, -7379, -3791, - -3136, 1049, -844, 24, -6714, -1736, -5734, -2907, - 5016, 2167, -5722, -1210, 6232, 428, 2467, -3334, - -1477, -711, 6728, -10274, -4930, -6224, -349, -710, - 1598, -713, -1708, -497, -254, 567, -884, 131, - 11520, -908, -1425, -1862, -13449, -1590, -669, 657, - 505, 236, -4, 21, 846, 100, 8248, -1847, - -131, -186, 181, -806, 3293, -1072, -1208, 14492, - 1555, 1527, 544, -120, -258, 6, -2401, 12455, - 10880, 1091, -2350, -939, -1252, -564, 150, -114, - 1419, 737, -1732, -440, -2303, -226, 536, -2492, - -1085, -10117, -11013, 3786, 5275, -10, 2479, 143, - -1647, -7945, 884, -1618, 2056, 12890, -424, 5986, - -1471, -666, -570, -1466, -499, 64, 566, -1738, - -639, 11380, -612, 1879, 1550, 12469, -299, -1501, - 2634, 1036, 3020, -13, 14974, -2066, -5786, -2667, - 5487, -6768, 468, -385, 778, -805, -536, -304, - 718, 386, 285, 7546, 643, 1462, 913, 4707, - 941, -3338, -194, 6669, -4493, 8869, -837, 400, - -877, -11113, 326, -2318, 13683, -1304, -1966, -933, - 312, 128, 470, -296, -322, 340, -1126, 1811, - 1999, 2885, 3201, 331, -2494, 3999, 660, -80, - -2063, -16771, -1337, 426, 4884, -6026, -40, 2093, - 342, -176, 83, 134, 796, -425, -8934, 2100, - 8550, 160, -221, -252, -32714, 1306, 1332, -609, - -109, 547, 848, 518, -40, 303, -246, -451, - -2177, -716, -750, 1, -21232, 1287, -1303, 2051, - 1659, 1501, -369, -1415, 274, 308, 260, 371, - -1409, -662, -7347, 7161, 3656, -1104, 8862, -5671, - 1370, 1122, 16, 1132, 17593, 6778, -993, 613, - -665, 3004, 3288, -1625, -1823, -1003, 740, -1002, - -888, -677, -1065, -25294, 997, -160, -180, -811, - 188, -333, -2483, -696, 1309, 120, 456, -116, - -2020, -896, 7216, 6328, -9170, 8407, -2986, -1684, - 680, 1752, -684, 613, 337, -629, -11750, -493, - -324, -907, -391, 1053, 14125, 142, 420, -1917, - -378, -1428, -90, -497, 1116, -464, 2170, 805, - -1572, -904, -9020, -534, 6450, -490, 10750, 279, - 765, 961, -3985, -2702, 2423, -4981, -1222, 1654, - -1089, -2157, 1940, 14331, -895, 1726, 1555, 122, - -3552, 1274, -598, -910, 3056, -1704, 6430, -10626, - 1014, -8773, 1009, 1936, -360, -468, -1029, -8841, - -625, 2212, 2234, 2720, 1190, -64, -2078, 4688, - 8690, 5150, -450, 744, -796, -5661, -332, -7938, - 2670, -4054, 1377, -1594, 11554, -4702, -3631, 745, - 742, -90, -1311, 12528, -4664, 834, -853, 1542, - 8560, 2209, 4091, 2876, 2117, -678, 1684, 785, - 304, 7980, 2126, -302, 8239, -2105, 1584, 11894, - -1055, -1391, 596, 2343, 86, 388, -1348, -1007, - 1428, 413, -9231, -10312, -7346, -1108, 1385, -1255, - -3954, 738, -1258, 410, 226, 15115, -1059, -4117, - -50, -504, -1726, 1425, -9974, -346, 688, 464, - 244, -586, -8880, 845, -659, 932, -1309, 290, - -29, -417, -2184, 1011, -9622, 1443, 9009, 1945, - 2698, -708, 10572, 2410, 1200, 4492, -2569, 1444, - 2735, -8604, 2274, -4057, 478, -199, 1285, 12695, - 12321, -2933, -1708, 1198, 675, -492, -560, -52, - -1261, 85, -480, -96, 696, -764, -1402, -31368, - -580, -675, -1678, -58, 600, -522, -292, 647, - -36, 154, -1148, 437, 1561, 588, 603, 7629, --16973, 29, -828, -589, -919, -1372, -470, -445, - 428, 528, 5828, -353, -32, -1781, -702, -690, - -7196, -3253, 1942, 4600, -12102, -674, -10480, -2336, - 711, -2174, -7474, -1436, -451, -7133, 856, -2652, - 1892, 3464, -546, 676, -13296, -516, -13618, -997, - 938, 1686, 1006, 1358, -1371, 922, 534, -170, - 126, 255, -835, 50, 945, -1066, -1676, 3, - 1038, -437, 26030, 418, 27, -1092, -493, -428, - -606, -1097, -628, 298, 295, -806, 183, 146, - 1352, -84, -722, 833, -25667, 3176, 1001, -322, - -2339, 15, -475, -1257, 2116, 876, 637, -529, - -1108, 302, -2452, 19734, 58, 851, 9845, 1142, - 2168, 706, 11070, 1556, 544, 3002, 2238, -3974, - 2738, -48, -8324, -2186, -355, -14933, 2192, -2481, - 2700, 473, -486, 761, -208, 76, -78, 102, - -4896, 1378, 12377, -8269, 28, 1092, -5071, -1500, - -1190, -804, 1085, -766, 493, 22, -1041, 9136, - -1234, -12247, 967, 2672, -883, 4582, 4871, 1891, - -532, 329, 226, 446, -6710, 312, -914, 1416, - -1852, 3052, 6512, 8971, 5544, 6519, -579, 1021, - -241, 911, 782, -3456, 10158, -1865, 3941, -12300, - 8, 472, 882, -1580, -1799, -1025, -631, -127, --15316, 8047, -200, -1860, 582, -4363, -1274, 1085, - -48, 2383, 638, 480, 369, -838, -1341, 414, - -114, 2757, 1222, -2194, -3394, 6469, 2418, 738, - -1656, 15594, -1090, 202, 727, -769, 484, 2462, - 4875, 1656, -3835, -16877, 5276, 239, 982, -1872, - -130, 901, 1352, -155, 4939, -8317, 9000, 2503, - 485, 1184, -548, -1356, -7482, -188, -1587, 496 -}, - -.fcb08l = { - -2539, -3275, -2699, -3345, -2843, 5501, 426, 7127, - -149, 3111, -2991, -2297, -2345, 2702, -969, -946, - 2837, 1114, 1800, 1271, 12249, -2282, -2309, 1566, - -2889, -3020, -2083, 3586, 8919, 2651, 4111, -1842, - -1588, -1428, 3251, -102, 156, -320, 722, 1711, - 20565, -3068, -2211, -3164, -3410, -3396, -2882, -2002, - 1730, 4077, -2696, -1694, -2839, 2948, -2739, -2380, - -2252, -1311, -269, 1900, -2796, -444, -2996, -2525, - 5194, 1459, 5042, -1089, 914, 4116, 7644, -3137, - -3156, 4028, -3435, -3240, -2585, 5542, 5119, 9885, - -2995, -3153, -3449, -3101, -3551, -3469, -2196, -1271, - 3869, 5413, -2800, -1990, 3371, -2286, -1022, 3190, - -550, 1723, 968, 1916, -2749, -1530, -2211, -2987, - -3357, -3262, -1042, 10277, 107, 2662, 9819, -2753, - 4269, -3277, 3125, -3131, -2974, -3251, 6466, 9484, - -2034, -2707, -2424, -3170, -2619, -2278, -143, -1641, - 11856, 5975, -1282, -2629, -2396, -2364, -2012, -1085, - -2576, -2422, -2206, 13731, -2261, 2751, -1768, 2482, - -1065, -347, -137, 31, 619, 385, -2257, -2215, - -1698, -2686, 4468, -2563, -1071, -1359, 7757, 3732, - -2856, 9018, -2046, -1494, -2234, -2209, -67, 1340, - 2433, 2965, -2722, -2151, -2966, -2780, -2732, -1509, - -2085, -1532, 6934, -1248, -1936, -2203, -787, -1781, - -895, -1990, 4693, -1818, -1569, 1954, -2283, -2403, - 10514, -3105, -1074, -2838, -1, 1192, 1113, 3309, - -2249, -2451, -1660, 2535, -1439, 3582, -1093, -594, - 1956, 758, 5349, -2524, -2320, -1903, -2055, 5075, - -941, -721, -536, 2197, -2309, -3027, -1460, -2911, - 11344, -2474, -1601, -1749, 3260, 2547, 3819, -1247, - -1449, 2835, -1118, -652, -516, -379, 531, 440, - -569, -2606, -2545, -2447, -1685, 8678, -1868, -2003, - -992, 5888, 8591, -1848, -2010, -2196, -2049, -658, - 3473, 214, 905, 317, -2050, -1083, -2593, 8754, - -2234, -2449, -1688, 2194, 2244, 2502, -1659, -2748, - 4584, -3011, 3702, -2307, -1887, -1960, -1068, 2889, - -3022, -2989, -2295, -2794, 3071, -1588, -43, 2627, - 1278, 2031, -2145, -2551, -2333, -3205, -3237, -2760, - 9082, -454, 4339, 1776, -2738, 4785, -2176, -1896, - 2148, 1350, 768, 249, 1001, 1499, 797, -2182, - -1443, -229, -32, 827, 401, 270, 581, 380, - -2370, -2376, -2679, -3099, -1742, -1149, 4666, -693, - 1109, 7547, -2496, -3063, -2818, -2621, -2016, 5722, - 4932, 1217, 2161, 2449, -2207, -2954, 3769, -2824, - -1809, -2946, -1693, -377, 1565, 4100, -2947, 3063, - -3062, -2919, -3093, -2520, -1712, 2383, 1305, 1867, - 10145, -2912, -3307, 7519, -3502, -1063, -2782, 8595, - -750, -1503, -3141, -2486, 2923, -2574, -1826, -1244, - 3537, 2494, 2583, 1560, -2722, 3284, 2245, -1258, - -658, -394, 483, 719, 1121, 1073, -2949, -1013, - -3048, 597, -3103, -2510, -1970, 7207, 8635, 1917, - -1772, -483, -2318, -1860, -2500, 2981, -1651, 550, - 696, 615, -2121, -2055, -1619, -2126, 3108, 3417, - -485, -47, 848, 1608, -2636, -1707, 3142, 3798, - 479, -1112, 597, -323, 1555, 1531, -2930, 2106, - -2398, -2314, -1835, 0, 2920, 896, 2356, 1259, - -2911, -3184, 593, -3570, -3389, -3263, 7340, 7640, - 6874, 6549, -1912, -1334, -1749, -568, -1718, -405, - -1375, 3456, -1024, -1903, 9384, -2721, -2485, -2377, - -3026, -899, -3133, -3032, -2452, 7715, 2492, -2450, - -1721, -2138, -1497, -55, 760, 2382, 1183, 1105, - -2782, 389, -1528, -927, 664, -531, 1405, 363, - 582, -292, -1678, -2718, -2763, -3140, -2799, -2178, - -2715, -2592, -972, -1226, 3278, -1173, 2916, -1548, - -446, -1241, -209, 379, 689, 538, 3110, 2857, - -1735, -1244, -589, -413, 65, 471, 522, 323, - -2043, -212, 1309, -471, -564, -16, 378, -320, - -437, 228, -2194, -2637, -2513, -2670, -1863, -954, - -2082, -2398, -2270, 5563, -2959, -2444, -2794, -1736, - -1631, -1324, 1482, -481, 2317, 1470, -2871, -2007, - 702, -1980, -491, -146, -695, -145, 2817, 1268, - -3395, -3456, -3069, -3433, -2874, -205, 806, 3038, - 3806, 2623, -2954, -1861, -712, 1017, -326, 44, - -93, 910, 775, 346, -2625, -2570, -2974, -2344, - -2712, -1930, -2213, 3521, -1341, 4327, -141, 835, - -1119, -1336, -1092, -1891, -860, -727, 315, 2562, - 4119, -2638, -2584, -1951, -2710, -2499, -1561, -952, - 2821, 2505, -2388, -1855, -2926, 1742, -2563, -2655, - -1802, 3082, 3063, 2456, -3304, -2670, -2147, -1504, - -309, 1421, 1661, 1546, 560, 615, -2590, -1593, - -1523, 2025, 3167, -841, -356, -648, 309, 1165 -}, - -.fcb08m = { - -2962, -2140, -2166, -1454, -1638, -1100, -835, 686, - 978, 550, -1630, -1021, -1424, -1867, -1118, -474, - 66, 6104, 904, 603, -829, -475, -1368, -1199, - 7255, -890, -465, 114, 118, 224, -2453, -1279, - 8192, -1289, -452, -47, 180, 324, 627, 209, - -2770, 11214, -857, -1720, -895, -531, -291, -264, - 232, -402, -2699, -2561, -2433, -2093, -1315, 86, - 2666, 1663, 1351, 2349, -2788, 4576, 3680, -1365, - -995, -513, 46, 44, 522, 142, -2739, -1654, - -1950, 4573, -659, -536, 285, 72, 875, 627, - 3142, 105, -941, 1245, -489, -495, -229, 44, - -236, -1083, -2336, -1193, -1620, -1859, -1339, -655, - 205, 1032, 5581, 1195, -2635, -1740, 2656, 1976, - -52, 784, -96, -165, 419, -486, 8850, -624, - -792, -1531, -765, -674, -730, -829, -150, -27, - 2255, -1177, 2727, -1430, 737, -902, -780, -729, - 169, 278, 3729, 3763, -32, -1581, -563, -573, - 77, -372, -64, -477, -2500, 526, -1682, 1464, - -830, -124, -548, 561, 202, 1115, -1682, -1552, - -2014, -2127, -1374, -749, -720, 64, 2097, 6944, - -2771, 4929, -1680, -2212, -1430, -801, 114, 891, - 1176, 855, 3571, -2187, -1566, -1694, 84, -46, - 932, 786, 765, 856, -1038, -498, -117, -1582, - -1379, -1162, 6293, -367, 594, 132, -2487, 2119, - -2153, -1749, 833, 1089, 507, 133, 337, 423, - -2777, 2507, 277, -1455, -1019, 1811, 639, -595, - 136, -1050, -2941, 4474, -176, 1095, 1113, -479, - 182, -295, -229, -605, -2035, -1649, -1171, 51, - 0, 125, 2844, -310, -82, -640, -2251, -2138, - -2270, -1567, 2260, 92, 368, 95, 1433, 1346, - 820, -2339, -1822, -895, -69, 158, 190, 911, - 1008, 764, 684, -1756, -1013, -1625, -1610, 6062, - -499, -1036, -139, 1129, 488, 524, -665, -870, - -347, -76, 123, 91, -12, 14, -2867, -2019, - 2858, -1903, -1165, 309, 287, 1250, 767, 776, - -2784, -2446, -1157, 460, 2589, 437, -285, 711, - -299, 402, -2683, -2271, -1714, -1535, -547, 4118, - 510, 1158, 700, 631, -2084, -1236, 509, -1009, - -510, -193, -1075, -793, 727, 2150, -2722, 968, - 1077, -1579, -1410, -894, 401, 1043, 427, 182 -}, - -.fcb08s = { - -2368, -2340, -1735, -1897, -1493, 984, 3062, 2826, - 1049, 164, 1181, -1990, -1833, -1720, -1360, 24, - 1485, 1923, 460, 511, 69, 78, -353, -3, - 3761, -480, -1538, -1063, 540, -64, -1546, -988, - 1514, -1167, -1354, -563, 1435, 880, 1123, 182, - -2243, -2109, -2378, -2201, -1491, -836, -124, 605, - 6159, 3636, -2770, -2959, -2956, -3019, -2154, -648, - 1805, 4698, 2929, 2078, -975, -360, -895, -623, - -593, -879, -345, 4333, 492, -56, -2102, -781, - -476, 1268, 606, -670, 1686, -105, 370, 461, - -221, -868, -1381, 297, 128, -578, -809, -938, - 3896, 490, 4032, 2675, -684, -1108, -1235, -915, - -874, -919, -802, -1040, -1324, -16, 2156, 1943, - -652, -666, -47, -1499, 168, -210, 4213, -1895, - -1734, -1767, -1412, -867, -71, 329, 855, 1294, - -1849, 4393, -1312, -1597, -564, 434, -454, 269, - 892, -31, -1170, 67, 370, -1144, -320, 3706, - -811, -190, -123, -166, -659, -1033, -789, -902, - -347, -280, -108, -313, 452, 3701, -1505, -2610, - -2758, -2550, -2034, -1361, -676, 713, 2263, 8286, - -2241, -2508, -2540, -1721, 182, 1947, 306, 1773, - 1220, 2909, -60, 73, -235, -1631, -1302, -692, - 4171, -830, 49, -188, -471, -2208, -2265, -1518, - -196, 2995, 2571, -579, -68, 805, -1294, 1274, - 4294, -1356, -702, -532, -465, -123, -400, -719, - 336, 3093, 1634, -906, -71, -502, -938, -982, - -742, -1187, -1757, 2890, -1591, 1303, 216, -311, - -404, -29, 501, -543, -1466, 1587, 309, -578, - -173, 34, 1116, 1286, -1184, -1174, -175, -732, - -619, 3508, -80, 191, -1059, -174, -429, -470, - 10000, -933, -1511, -1601, -1571, -1445, -1065, -1407, - -1053, -932, 1183, 7875, -460, -1609, -1618, -1398, - -1154, -1227, -1012, -1450, 20, 28, -235, -110, - 203, 105, 252, -154, -51, -58, 2940, -490, - 17, -51, 131, -106, -526, -566, -822, -1177, - -1335, 2749, 608, -1575, -1322, -1351, 111, 641, - 1441, -9, 733, -207, -273, -665, -630, -588, - -78, 254, 304, 762, -2661, -2677, -1238, -82, - 2569, 3001, 932, -1032, 211, -324, 40, 1395, - -836, -1119, -635, -1425, -1514, -1135, 1509, 2963 -}, - -.fcb11l = { - -3004, -2927, -2672, -2356, -735, 179, 950, 1734, - 1101, 1641, -1610, -1161, -1606, -179, -1634, 3383, - -610, 240, 73, 1128, 818, -1052, -1641, 724, - -1938, -1741, -1211, 3967, 1988, 1445, 3010, 2203, - -1685, -1698, -1838, -759, -144, 515, 999, 1215, - 3239, -1912, -2048, -1739, -1488, -148, 1590, 1370, - 1066, 1270, -2721, -1637, 99, -1964, 224, -946, - -1437, -954, 755, 1420, -2800, -2211, -2304, -2048, - 4853, -714, -383, 2159, 1823, 2328, -1619, -1584, - -1839, 5462, -1703, -802, -227, 485, 1017, 1695, - -2459, 2399, -1820, 2254, -1373, -767, 53, 705, - 1074, 1293, -1582, -2486, -2208, -2341, -2264, -2132, - -1578, -1043, 322, 7685, -2198, -1768, -2106, 16, - -2207, -1495, -1106, -961, -482, 1642, 6785, -1540, - -1540, -1449, -1177, -854, -307, 853, 1279, 1449, - 3253, -1427, 2314, -1473, -985, -1025, -321, 923, - 1140, 1166, -2704, 2664, -2444, -2717, 481, 3083, - -1449, 1225, 3168, 2389, -2124, -1981, -1342, -1939, - -1904, 4736, -885, -826, 3866, 2046, -290, -567, - -1986, -1880, 1966, -465, 1638, 683, 1005, 1099, - -2842, -2537, -2559, -2427, -1243, 4039, 1371, 3897, - 2529, 2400, -2586, -1328, 785, -1697, 1733, 2382, - -442, 190, 901, 1281, -2669, 2198, -1502, -1404, - 2593, -694, -186, 466, 1065, 1199, -1905, -1389, - 6171, -1817, -513, -989, -356, 246, 1619, 1883, - 36, -2178, -1602, 608, -1523, 23, 1265, 578, - 953, 1038, -483, -2278, -2138, -1740, 584, 244, - -54, -192, 915, 1097, -213, -1569, 1861, -1401, - 3686, -1625, -1234, -614, 860, 1311, -1397, 2315, - 1896, -1608, -1326, -1487, -99, 2241, 697, 1156, - 1711, -2099, -1507, -135, 1422, -695, -57, 1390, - 823, 937, -122, 479, 47, -2144, -1514, 955, - -1317, -726, 480, 1153, -2959, -2558, -2573, -1355, - -1879, -1446, 6435, 677, 3124, 3134, 1850, 1834, - -1396, -1417, 1290, -896, -561, 1428, 1007, 1105, - -2101, -2044, 1779, -1913, -1868, 1410, 916, 1232, - 1112, 1335, -2663, -104, -513, -96, -470, 480, - 1516, -150, 298, 714, -2558, 3076, 468, -745, - -945, -443, -849, -989, 341, 1102, 433, 588, - -1772, 462, -527, 670, -128, -108, 583, 701, - -2281, -2149, -2398, -2749, -2557, -1691, -1095, 1336, - 9088, 3844, -1799, -1861, -1908, -2242, -2184, 2313, - 3779, -809, 519, 2229, -1914, -1673, 1764, -634, - -1955, -1721, 405, -499, 243, 1632, -2377, 7289, - -1659, -1752, -1341, -948, -323, 841, 1703, 1774, - -2029, 2384, -1877, -1918, -1729, 1483, 483, 1916, - 576, 1258, -2310, -1796, 2208, -1579, 57, -1735, - -1161, 5177, 1674, 2468, -1907, -1499, 1868, 2275, - -620, -356, -228, 489, 1064, 849, -683, -1204, - -1761, -2211, -606, -764, -1056, 3888, 253, 1518, - -2555, -2075, 119, -1567, 971, -1178, 2683, 1476, - 978, 1419, -2947, -2418, -2164, 1178, 1582, 1470, - 896, 645, 1671, 1462, -2234, -1363, -1184, 1408, - 1042, -1091, -208, -49, 527, 917, 1266, -1444, - -2174, -2447, -2300, -1732, 3076, 5631, 248, 2195, - -2477, -1724, -2434, -2477, -2524, -1828, 2331, 845, - 1423, 1767, -2393, -1946, -857, -462, 344, 17, - -896, 2391, 892, 882, -828, -280, -752, -1136, - -1563, -1040, 1222, -1173, 1763, 1179, -1448, 1946, - -1815, -1588, -1638, -1282, 3302, 132, 509, 1408, - -2760, -2338, -1935, 1353, -1531, -1074, 1156, 3086, - 1374, 1667, 2302, -1623, -1897, -1991, -494, 2603, - -754, 524, 1265, 1304, 3062, -1359, -1365, 1987, - -1334, -916, -146, -40, 635, 1033, 1724, -1057, - 49, -1159, -774, 106, 1053, -153, 134, 691, - -119, -1226, 332, -363, -197, -69, -133, 573, - 190, 216, -2236, -294, 1288, -2110, -1537, -1005, - -1175, 56, 4227, 1623, -2440, -1894, -1623, -2377, - 2287, -1220, -1506, 177, 5689, 2849, -2857, -2166, - -2546, 2174, -2414, -2343, 559, -1020, 4650, 3514, - -2875, 1309, -2557, -2534, -2235, -1901, 1559, 4412, - 2301, 2204, -2969, -2018, -2399, -2834, -2431, 1316, - -1474, 1269, 2533, 3485, -2892, -2387, -2716, -2317, - -2031, -1992, -1311, 8071, 3933, 3807, -2139, 1909, - -2200, -2344, -2060, -1638, -1154, -210, 2781, 2139, - 1119, -1828, -2069, -2306, -1975, -1165, -444, 789, - 2409, 1551, -2929, -103, -1920, -2010, -904, 694, - -188, 4, 1051, 1190, -2649, -2454, -2205, -1651, - -1856, -1552, -1165, 352, 3351, 1266, -1719, 57, - -1828, -420, -938, -1251, -461, 1294, 1158, 893 -}, - -.fcb11m = { - -2704, -2459, -2349, -1535, 2807, 365, 1064, 892, - 830, 1222, -2190, -1542, -2285, 6443, -1607, -1362, - -605, 637, 883, 877, -2378, 2292, 3106, -1057, - 1776, -1094, -859, 249, 199, 256, -1537, 2098, - -1126, 2243, -1186, -193, -211, 211, 502, 308, - 3369, 3197, -1271, -1370, -355, -423, -537, 468, - -237, -99, -1439, -1748, -2185, -1972, -1357, -814, - -470, 815, 1306, 6390, 1983, -1169, -1749, -29, - -1368, 5929, -1539, -900, 576, 701, 1708, -1608, - -1148, 3522, -822, -120, -461, -158, -43, 39, - -2543, 8872, -1347, -1580, 222, -488, -162, 295, - 382, 291, 11143, -1223, -1270, -1399, -392, -563, - -500, -604, -544, -135, -1787, -1313, -1490, -1395, - -1100, -1278, -818, 6172, 768, 1597, -623, -681, - -1128, -1575, 7257, -665, -1021, -439, 932, 703, - -1496, -2168, -1945, -1454, -808, -1261, -354, 875, - 6706, 1956, -1773, -1503, -1536, -1162, -1386, -1885, - -1607, -318, -72, -7, -1932, -1349, 6150, -1852, - -345, -18, -81, 223, 339, 425, 362, -1623, - -1432, -1973, -1042, -1373, 7830, 38, -116, 1000, - 421, -2375, -1808, -1832, -1046, 2077, 955, 1576, - 581, 824, -2021, -1582, -1402, -1420, 69, 3549, - -513, 192, 262, 483, -2503, 4173, -11, -1532, - -893, 282, 187, 320, 176, 259, -2308, 2342, - -2385, -2147, -784, -375, 413, 833, 889, 1297, - 1415, -1085, -1009, -1501, -1246, -1298, 1553, 1384, - 332, 662, 2226, -2399, -1752, -857, 1899, 131, - 501, 209, 217, 346, 4294, -1811, -1694, -1080, - -752, -263, -228, 249, 628, 971, 2508, -1031, - 2871, -1054, 42, -202, -738, -170, -239, -290, - -2751, -2379, -2379, -1999, -1448, -380, 1594, 1279, - 1399, 1633, -2376, -1839, 1367, 1685, 356, -126, - -50, 143, 31, 33, 314, 160, -663, -687, - 25, 388, -267, -188, -188, -129, -2614, 1063, - -1835, -285, 2549, 205, -30, 370, 319, 297, - -87, -2208, -1164, -839, 894, -266, -410, 375, - 1263, 924, -2606, -2325, -1854, 1792, 407, 328, - -110, 575, 1090, 971, -2517, -1583, 1355, -1892, - -490, -203, 846, 724, 597, 779, -1650, -1281, - -1294, 549, -146, -548, 2947, -28, 265, 339 -}, - -.fcb11s = { - -1536, -2360, -2378, -2138, -1380, -346, 1575, 2779, - 3247, 1689, -340, -1788, -1839, 103, 31, 853, - -653, 3159, 365, 154, 404, -835, -716, -35, - 4309, -155, -1214, -1180, -750, -522, -753, 350, - -1660, -1603, -1159, -582, -489, 1067, 2615, 1747, - -1755, -2351, -2314, -1453, 922, 3458, 867, 439, - 493, 1212, -1584, -1655, 1300, 1783, 1641, 1442, - 816, -1283, -1456, -1417, 4998, 1923, -200, -1086, - -1060, -1016, -1074, -1217, -1285, -1245, 633, 390, - -1443, -1099, -507, 3041, 343, -163, -745, -667, - 2333, -2144, -2460, -2247, -2063, -1736, -742, 418, - 3124, 3504, 227, -735, 799, -1326, -20, -543, - 1900, 237, -671, -545, -1727, 121, -1750, 3700, - -485, -553, -77, -212, 942, 62, 1647, -688, - -1506, -1429, -619, -839, 172, 3209, -500, -371, - -1680, -1408, -1122, -563, 3627, -115, 510, 534, - -65, 199, 800, 5040, 631, -744, -612, -1023, - -1099, -1319, -1520, -1460, -1120, -274, -1220, 349, - 1848, -620, -1411, -616, 1771, 1024, -1223, -2195, - -2345, -2144, -1517, -1055, -385, 557, 1482, 6797, - -2274, 818, -460, -707, -274, 646, 654, 731, - 268, 347, 4583, -1289, -1452, -1193, -1072, -681, - -178, -131, -108, 547, -1521, -781, -1298, 239, - -486, -445, 3453, -226, 90, 653, -1237, 624, - 4692, -482, -798, -799, -766, -645, -890, -915, - 3748, -909, -1012, 85, 963, 375, -100, -1010, - -1269, -1508, 2106, -1194, 2632, 595, -826, -221, - -411, -1104, -1365, -1050, -2112, -863, 1943, -727, - -1079, -733, 78, 1990, 363, 953, 1325, 459, - -891, 3364, -410, -362, -547, -994, -1371, -1258, - 12270, -43, -1668, -1868, -2004, -2133, -1863, -1949, - -1805, -1288, -1640, 3783, -1414, -578, -505, -464, - -158, 252, 71, 76, 22, -20, -72, -13, - -19, -95, -14, 2, 23, -5, 1289, 630, - 291, -707, -794, -857, -715, -122, 551, 219, - -2358, -1905, -1397, 277, 572, 343, 789, 526, - 1629, 991, -980, 222, 740, 1199, 19, 1200, - -864, -467, -656, -138, 820, -2005, -924, 154, - 195, 393, 267, -183, 1024, 100, 1243, -872, - -705, -781, -422, -377, -910, -637, 89, 2849 -}, - -.fcb16l = { - -2676, -2246, -3119, -2904, -2707, -1946, 7718, 2292, - 2451, 4206, -1214, -362, 1116, -860, 30, -993, - -888, -1046, -3732, -2268, -2541, 6060, -2220, -1597, - -1650, -1320, 88, 1229, 2118, 2348, 1430, -1865, - -2190, -2122, -1844, -2069, -1746, 15, -1746, 1321, - -2671, -2993, -3247, -2811, -2141, -1360, 1886, 270, - -381, 5676, -2070, -444, -674, -1082, -1144, -346, - -823, 4630, -224, 1940, -2441, -2072, -2194, -295, - 2175, 1209, -734, 168, 923, 1359, -2667, 389, - -2585, -2279, -2195, -1141, -1016, -218, 109, 1926, - 5184, -2226, -1888, -1273, -1044, 25, 461, 886, - 1125, 1249, -2215, -2381, 3109, -1963, 3015, -2027, - -790, 1192, 1646, 2188, -2906, -2598, 484, -2372, - -1372, -1082, 1718, 664, 1391, 2396, -2518, 1937, - -2362, -2510, -1504, 2947, 446, 684, 1947, 2059, - -3263, -3001, -3240, -3034, -2598, 3367, 4407, 2327, - 2450, 2994, -2379, -1875, -1862, 6387, -1956, -1417, - -525, 1098, 1836, 2932, 1408, -1130, -1417, 1693, - -262, -645, -515, 443, 735, 619, -2834, -2246, - -2646, -2521, -811, 6608, -421, 1572, 2015, 3234, - -2086, -1435, 89, 1648, 838, -986, -1159, -1208, - -32, 1354, -2135, -2159, 7796, -2424, -949, -2040, - -1179, 228, 1187, 3008, -2963, -2500, -2074, -2025, - -1439, 1692, -378, -596, -62, 2419, -3522, -3132, - -2899, -3290, -2929, 2844, 49, 4307, 2754, 3897, - -2960, 1305, -1858, -831, -1379, -773, 3257, 979, - 975, 1513, -2849, -1610, 2483, 456, -1395, -634, - 847, 1320, 1116, 1175, 2497, -1554, 2176, -1697, - -997, -799, -120, 339, 996, 1379, 11359, -1557, - -2219, -2237, -1792, -2084, -1009, 781, 3341, 939, - 1954, -1860, -2347, -2117, -2000, -1394, 3825, 106, - 2595, 2162, -2938, -2488, -2112, 772, -1059, 1822, - 159, 1017, 2452, 1506, 1313, -2615, -2479, -2941, - -2220, -2510, -726, 4703, 1778, 3375, -3133, -2664, - -2821, -2771, 1559, -1000, -434, 1874, 4130, 2987, - -2998, -2692, -2326, 1580, -2231, -1347, 4166, 2021, - 1177, 2531, -2880, -2337, -2589, 1505, -2843, -2468, - -339, -1059, 3212, 4264, -3112, -2885, -2889, 975, - -2522, -2278, 721, 5057, 3989, 3373, -3098, -2947, - -1128, -2251, 1935, 2981, 3007, 975, 1983, 2048, - -2861, -2302, -2431, -1460, -1492, -1524, -944, 1556, - 1778, 1549, -2658, -2259, 2768, -2460, -1447, 2957, - 759, 324, 2533, 2477, -2935, -1687, -2554, -2647, - -1431, 118, -365, 10280, 1526, 3447, -2570, 2268, - -2351, -2115, 2588, -9, -834, 1115, 1878, 2365, - 79, 1132, -1619, -1406, -1568, -1766, -224, 825, - 2113, 1382, -548, -2669, -1797, -2691, -2139, -2495, - -210, 1276, 13623, 2315, 1965, -1713, -1610, -2187, - 2534, -1495, -1301, 622, 563, 2154, 2743, 3230, - -1784, -1774, -792, -493, -131, 156, 944, 1211, - -1886, 357, -1018, 225, -285, 1025, -134, 218, - 290, 153, 5869, -2407, -2856, -3051, -2540, -3238, - -2260, -370, -451, 6314, -500, -2554, -2110, -879, - -323, -537, 570, 1228, 1556, 1342, -2486, 3366, - 1838, -937, -959, -683, 63, 937, 652, 1212, - -2164, -1448, 166, -799, -550, -1317, 481, 299, - 5494, 1360, -3147, -2574, -989, 1550, 1952, -1502, - -96, 3517, 1304, 2311, -2931, -2146, -2174, -2052, - 579, 680, 896, 2697, 703, 1365, 4130, -2367, - -2627, -3125, -934, -3093, -2155, -955, 6025, 5024, - -3121, -3064, -2883, -2458, 1723, -842, 3032, 4391, - 2327, 2837, -2536, -2208, -1610, -2189, 6509, -1424, - -1116, 1427, 2830, 3370, 1084, -1562, -1655, -1628, - -491, 2260, -321, 421, 774, 1237, -3267, 977, - -3170, -3144, -2698, -1324, 1424, 3034, 3323, 3347, - -3021, -3061, 2027, -2345, 852, -2832, -1714, 5926, - 4517, 3839, -1490, -2416, -1726, -1268, -1458, -2137, - -1715, -580, 1403, 13408, -3005, -2706, -3063, -2745, - -2777, -2136, 2786, 202, 5141, 3407, -3104, -3001, - -3176, -3388, -3507, -2863, -2097, 2325, 2618, 6146, - -1997, -3152, -1036, -2694, -2587, -2986, -2750, -2219, - -1607, 5944, -2893, -2633, -2229, -2811, -2482, -2115, - -2219, -1180, 5246, 3252, -3111, -2052, -2693, -2934, - -1805, 2583, 353, 1262, 8588, 3900, -2468, -2726, - -1861, -2352, -2237, -2750, -2345, -1936, 9793, 8392, - -3490, -3124, -3596, -3630, -3154, -2390, 743, 6652, - 6366, 6143, -2852, -3547, -3124, -2718, -1094, -494, - 49, -1053, -3005, 32767, -1721, -1229, -1715, -1590, - 1587, -1233, 3384, -252, 312, 1120, -3287, -2926, - -3048, -2828, -2502, -1185, 2028, 3778, 487, 2083 -}, - -.fcb16m = { - 616, -1065, -1622, -1949, -1283, -863, 6819, 517, - 1135, 1282, 2631, -1447, -1477, -1004, 286, 1358, - -135, -340, 147, -130, 5435, -1609, -1916, -1758, - -1066, -1126, 478, 995, 1098, 1437, -1737, -1339, - -1864, -2009, -1038, -1004, -573, 810, 5974, 2840, - 349, -1559, -1496, -1151, -307, -82, 681, 827, - 550, 776, 1930, 166, -1100, -1489, -1185, -1182, - -1210, -326, 858, 1688, -2561, 3514, -736, 1555, - -59, -906, -123, 87, 102, 274, 1902, -459, - 3008, -984, -707, -334, -571, -317, -190, -371, - -2862, 607, 1346, -1517, -1220, -617, 2494, 697, - 190, 64, 3264, 3926, -1249, -1542, -933, -302, - -246, -248, 69, -283, -1766, -750, -1898, -1259, - 6841, -1546, -785, -64, 1208, 1294, -1522, -1742, - -1873, -1898, -1455, 7128, -752, 1718, 1398, 1123, - -2742, 4733, -1552, -2483, -2210, -495, 355, 864, - 830, 759, -2721, -2115, -1891, -1696, -1137, -1559, - -1265, -658, -591, 850, -699, 1262, -551, -1055, - 877, 96, -388, -192, -479, -1091, -2763, -1379, - 3290, 2331, -874, -307, -386, 615, 366, 133, - -2671, 5181, 4339, -894, -871, -634, -165, 409, - 91, -291, -2649, -411, 8039, -1947, -1156, 57, - 351, 1014, 472, -198, -1816, -590, 2887, -1702, - -1113, 3414, -556, 117, 483, -377, -1707, -1146, - -1155, 2518, 2014, -382, 3, -6, 206, -98, - 10770, 274, -1415, -1670, -1020, -1036, -786, -782, - -463, -552, -2500, 10460, -1624, -1787, -707, -1327, - -59, 375, 91, 22, -2776, -2343, -2104, 825, - -759, -823, 482, 1149, 1265, 570, -1676, -1826, - -1848, 6125, -1391, -820, -449, 844, 586, 535, - -2873, -2475, -2607, -2611, -1830, -487, 1643, 1680, - 2088, 2570, -2357, -993, 3189, -1473, 3506, -1203, - -793, 662, 464, 98, -2507, 1617, -1793, -1935, - -1307, -169, 9, 885, 728, 1178, -2010, -1346, - -1375, -187, -548, 2753, -464, -105, 799, 511, - -2170, -2428, -2177, -1497, 2072, 828, 441, 1020, - 873, 1000, -1297, -1531, -1863, -1967, -1516, -1088, - -758, -230, 1561, 6655, -2173, -1787, -1548, -1763, - -1366, -24, -645, 6836, 1480, 1923, -2728, -1859, - 1798, -2010, -1585, -677, -371, 1405, 1254, 1278 -}, - -.fcb16s = { - -2250, -2771, -2879, -2775, -2240, -1363, -272, 1233, - 6172, 5074, -2882, -2419, -2054, -2420, -1252, 347, - 1325, 1799, 1723, 4361, 774, 2066, 1874, 280, - -707, -605, -581, -662, -1104, -2038, 7111, -137, - -883, -1079, -1001, -54, -847, -1013, -1045, -832, - 4696, 3781, -624, -1485, -1360, -1359, -1307, -1219, - -866, -945, 5419, -1512, -2307, -2134, -2056, -1724, - -1653, -630, 157, 3399, -727, -860, -1381, -380, - -716, -1335, 3819, 78, -2, 277, -3185, -3118, - -2715, -3110, -1500, 1626, 3352, 3075, 1956, -539, - 16640, -1204, -2281, -2307, -2272, -2349, -2009, -2184, - -2777, -2375, -1015, 6208, -402, -1331, -1182, -763, - -730, -81, -591, -1184, -1927, 543, 4464, -1095, - -131, -542, -129, 486, -366, -1097, -1594, -554, - -15, -337, 3152, -723, 71, -40, 385, -309, - -769, 290, -853, -1058, -1196, -1557, -595, 3695, - 1129, 438, 1729, -1309, -971, -871, 90, 1418, - 1261, -23, -1382, -223, -1551, -713, -1044, 4495, - -160, -867, -1242, 1188, 159, 120, -1657, -951, - 1536, -159, -1310, 1101, -404, 155, 1717, -24, - -1607, 2347, 2056, -1943, -1313, -1297, -81, 34, - 1441, 354, -2110, -1873, -516, 1102, 2174, 2131, - 0, -946, -729, 61, 107, -14, -108, -50, - 42, -164, -177, -92, -29, 162, 1349, -2380, - -2099, -1692, -980, -49, -94, 331, 1317, 3819, - -482, -782, -775, -909, -640, -1099, -615, -225, - 1556, 2973, -630, 70, -186, -1599, -1076, 4440, - -890, 78, -76, -517, -855, -1886, -1521, -1206, - -1152, -900, 753, 1338, 1758, 2431, -2433, -1569, - -1294, -583, 552, 2040, -154, 250, 513, 2333, - -820, -1987, -2291, -2238, -1880, -1651, -1120, -262, - 2013, 9756, -2803, -2574, -2634, -2789, 356, -1838, - 325, 4584, 3584, 2486, -1524, 1874, -337, -1800, - -1659, 406, 2450, 1252, -245, -1030, 1985, -397, - -1565, -51, 148, 2039, -1212, -729, -700, -11, - 904, 649, 531, -2287, -1640, 766, -725, 171, - -1596, 1387, 3189, -672, -459, -794, -422, -714, - -195, -231, 185, 99, -952, -2248, -2170, -1190, - -457, 1458, 34, 1179, 2427, 1683, -1658, 3749, - -1816, -2000, 2823, -1243, -1415, 713, 875, 75 -}, - -.fcb22l_1 = { - 2198, -2215, -2251, -1966, -1540, -467, 403, 1647, - -2867, -2589, -34, -2314, -602, 2371, 2614, 2218, - -2494, 3659, 2708, -1076, -914, 233, 1149, 1425, - 319, -979, 1023, -682, 110, 239, 427, 703, - -2979, -2513, -2649, -2265, 7420, 526, 2174, 2932, - -2868, -2056, -2232, 1651, -1325, -856, -218, 2091, - 458, 1508, -1208, -845, 244, -441, 558, 752, - -700, -1370, -395, 980, -321, -232, -241, 293, - 10391, -1792, -1948, -1518, -1049, 43, 1524, 2033, - -2434, 303, 1730, -1205, -1432, -1183, -694, 1185, - -2531, -2656, -2751, -1756, -1321, -1100, 287, 8605, - -2868, -2554, 721, -2065, -1671, -771, 675, 2223, - -2690, -2501, -2313, 1829, 3189, 45, 1825, 2024, - -3153, -2824, -2729, -2308, 1686, -370, 482, 2606, - -2972, -2324, 2492, -1762, -1662, 28, 4976, 3214, - -2769, -316, -1146, -1954, 86, -60, -370, 1144, - 5519, -1785, -1538, -1044, -580, -89, 704, 1151, - -2586, -1094, 7473, -1220, -1076, -50, 1029, 1850, - 3546, 3279, -1806, -1191, -528, 682, 1160, 1341, - -2852, 1541, -2358, -1841, -2317, -1351, 993, 2417, - -2675, 2482, -2061, -2089, 3681, 626, 1619, 1818, - -2916, 2821, -2482, -2166, -1084, 1137, 5537, 2864, - -2499, -1782, 2156, 2558, -1117, 127, 1147, 1556, - -2572, 3865, -2008, -1805, -679, 119, 35, 1319, - -2704, -1872, -1756, 6843, -911, 322, 1641, 2461, - -2652, -1957, 1972, -1582, 3082, 84, 1086, 1487, - -2983, -2325, -2780, -2532, -1858, -279, 10092, 4519, - -2364, 2718, -1907, 2678, -1005, 246, 1499, 1679, - -2570, 8779, -2004, -1627, -844, 89, 1712, 2145, - 3316, -1763, -1642, 2819, -599, 9, 906, 1401, - -2289, -2224, 2462, -1580, -843, 2501, -24, 1310, - 3091, -1745, 2398, -1264, -731, 113, 831, 1328, - -2803, -2380, -2808, -2379, -2290, -1376, -234, 2242, - 3537, -2137, -2050, -1260, 2881, 177, 1158, 1424, - -3303, -3123, -3130, -2861, -2075, 2528, -43, 3890, - -3106, -2672, -2554, 1833, -826, 55, 4910, 3324, - 3993, -2176, -2446, -1848, -786, 3346, 1590, 2034, - -2725, -265, 303, 1076, -1985, 3661, 1556, 1983, - -3182, -2712, -2988, -2841, -1332, 4816, 6422, 4184, - -2230, -1248, -2176, -1806, -1617, -878, 3764, 1309, - -2280, 509, -211, 426, 773, 99, 513, 628, - 167, 196, -2256, -1802, -1157, 724, 1405, 1383, - 2384, -409, -672, -453, -205, -89, -12, 240, - 114, -2220, -807, -1302, -1612, -405, 1134, 1381, - 699, -1816, -2151, -1883, 2975, 928, 1527, 1565, - 775, -2141, -1981, -1532, -591, 3338, 683, 1763, - 466, -2028, -2086, 1448, -622, 589, 1294, 1150, - 145, -2382, -1093, -367, 986, 323, 404, 931, - -371, -2868, -2737, -2103, 129, 771, 1498, 1974, - -1481, -1060, -2398, -1125, 285, 2777, 2975, 1431, - -2720, 1748, -2375, -1847, -912, 3829, 808, 2034, - -2492, -2447, -1248, -991, 1449, 1304, 867, 1171, - -2999, -2556, -2763, -2298, 3359, 4277, 1991, 2850, - -2692, -2640, -2593, 1813, -458, 3068, 1012, 2049, - -3258, -2820, -2845, -2395, 2787, -45, 5457, 3568, - -2491, -2114, -1884, 6, -332, -232, 1680, 1139, - 2032, -2383, -2183, -1725, -914, 192, 4175, 2059, - -2922, -2972, -2920, -2210, -1143, 1850, 2468, 1871, - -3138, -99, -2651, -2510, -129, 631, 1677, 1925, - -3302, -3124, -3214, -3143, -2616, -761, 3978, 4234, - -1698, -824, -1975, -742, 2449, -610, 21, 998, - -3047, -2697, -2747, -1919, -1545, 7534, 1243, 3548, - -1863, -1257, 339, -1027, 122, -613, 1989, 953, - -2232, -1759, -1751, -969, -1591, 1917, -325, 889 -}, - -.fcb22m_1 = { - 13531, -1278, -2217, -1956, -1360, -892, -650, -866, - -255, 192, -1139, -1242, -2101, -1682, -1601, 2950, - 2340, 121, 662, 446, -2636, 1711, 615, -1864, - -1297, -1098, -296, 1070, 1284, 891, 7332, -2292, - -2334, -1889, -1170, 1884, -570, 52, 1146, 944, - -2083, -2192, -2420, -2165, -1542, -1474, -278, 4147, - 1506, 1666, 1014, -1657, -2225, -2261, 8568, -1445, - -523, -115, 999, 602, -2762, -2261, 271, -1797, - -1633, -790, 391, 907, 1302, 1076, -1907, -2219, - -2443, -1963, -1495, -1294, 4722, 935, 1691, 1370, - -2355, -1585, -2510, -2297, 2690, -1491, -647, 360, - 1460, 1479, -2041, 368, 10454, -1277, -716, -172, - -538, -287, 169, -232, 960, -1087, -2459, -2196, - -1189, -1967, -1586, -783, 5275, 2811, -1523, -1733, - -2373, -1946, -1586, -1280, -442, -205, 2330, 6319, - -2483, -2115, -2645, -2016, -1464, 89, 529, 1338, - 5291, 3186, 5770, -2311, -2696, -2420, -619, -2322, - 8434, -129, 1661, 1232, -1377, -1277, -1193, 406, - -1332, -1246, -999, -497, 1024, 1500, -2791, -1417, - -2173, 2419, -1492, -734, 2795, 559, 750, 519, - -2714, -509, 4622, 3679, -294, 73, -805, 602, - -99, 94, -2658, -1984, 6907, -1780, -1244, 272, - 874, 140, 1326, 693, -2679, -2274, -2551, 13351, - -2619, 4570, -1739, 2309, 1280, 1235, -1011, -2084, - -1968, -1404, 2568, 3147, -336, 270, 499, 506, - -1567, -2240, -2685, -1951, -2254, 2783, -1411, 8878, - 2321, 1691, -2567, -2450, -2572, -2286, -2038, -1803, - -1316, -315, 464, 1223, -1988, -927, -2035, 2165, - 3663, -919, -328, 229, -2, 217, -2773, -2160, - -2637, -2183, 5081, -1434, 1526, 2830, 1698, 1153, - -2810, -1132, 5408, -1992, 4267, -1357, 809, 563, - 9, -64, -2949, 7061, 4604, -1424, -1839, -610, - -251, 370, 901, 147, -2264, 3135, 3241, -1102, - -397, -1292, 39, 17, 380, 383, -1483, -1458, - 820, 2135, -646, -479, 173, 23, -274, -442, - -978, -1216, -1928, 7260, -1249, -956, -24, 250, - 438, 128, 4080, 152, 2677, -587, -667, -672, - -662, -492, -722, -688, -1907, -787, 3101, -1404, - -1234, -508, 3817, 424, 657, -86, -2179, -599, - 2141, -1446, -1847, 4341, -801, -26, -57, 216, - -1625, -802, 1752, -1301, 2617, -1545, -513, -401, - 234, 658, 1299, -1279, 874, -1408, -1135, -40, - -423, 394, 660, 684, 3341, -937, -1842, -1177, - 1945, -621, 19, -93, 141, -59, -2626, 3368, - -1588, -1959, -1506, 3729, -347, 218, 497, 585, - -2495, -2452, -2118, 578, -225, 378, 40, 1080, - 908, 761, -2070, -1607, 2534, -1535, 1493, 2664, - 215, 634, 317, -233, 4188, -1446, -2129, -1812, - -1428, -1579, -1038, 97, 989, 2038, 3671, -2707, - -2608, -2198, -1119, 1601, 1042, 1325, 1230, 1149, - -2566, -1054, 3659, -2173, -1772, -713, -1080, -101, - 987, 805, -1555, -749, -1510, 3443, -1402, 4172, - -696, 437, 276, 219, -2735, -2453, -2082, 3898, - -867, -582, -726, 1134, 1227, 1121, 2333, -963, - -1474, 2386, -959, -327, -138, 4, 268, 479, - -2889, -2896, -2701, -1975, -593, 1212, 1511, 1087, - 1482, 1612, -1703, 4874, 46, -1364, -1342, -544, - -879, -455, -488, -396, -2616, 849, -2424, -1976, - -1491, -739, 325, 1284, 1831, 1223, -48, -1457, - -2123, -1318, 1617, -1064, 2484, -467, 533, 707, - 351, 422, -525, -657, 202, -476, 133, -679, - -945, -832, 1906, -2981, -2605, -1911, -2541, 11553, - -1585, 1555, 2196, 1616, -2669, -2345, -2423, -1848, - -1756, 4918, -711, 1186, 1873, 1399, -672, -1401, - -1524, -1138, -674, 1285, 195, 884, -377, -1067, - -2125, 377, -1747, -1604, 837, -334, -115, -59, - 160, 483, -2220, 12861, -1633, -1616, -926, -1203, - -113, -90, 378, 148, 5740, 88, -2246, -1598, - -1546, -1694, 2790, -72, 590, 28, -2608, 4312, - -1068, 3091, -632, -651, 366, 63, 744, 375, - 1746, 2753, -2075, -1621, -1033, -471, 972, 199, - 575, 655, -2148, 2407, -2180, -1764, -1030, -1089, - 4083, -80, 417, 384, 1196, -2284, -2549, -1771, - -773, 213, 1188, 788, 1343, 1358, -2584, 7723, - -2171, -2301, -1497, -438, 1001, 110, 671, 939, - 6435, 5777, -1765, -1287, -1181, -1014, 87, -919, - -422, -444, -1930, 4906, -1660, -1558, 3617, -1177, - 261, 9, 261, -47, -2539, 2749, -2476, -2298, - -1047, -1319, -341, -604, 2111, 2779, -2935, 5011, - -1860, -2363, -1686, -1033, 800, 1774, 1700, 1478 -}, - -.fcb22s_1 = { - 11523, -796, -1488, -1897, -1888, -1691, -1767, -1794, - -1622, -1210, -2284, -2777, -2382, -1371, -238, 2997, - 3182, 588, 1129, 704, 248, 1703, -264, -1306, - -1147, -560, -1513, -956, 1667, 1340, 5220, -2276, - -2215, -2049, -1479, -1294, -774, 66, 1270, 2075, - -1435, -1981, -2322, -1896, -1321, -462, 138, 5022, - 2549, 1683, -100, -1744, -1528, -423, 6093, -61, - -288, -623, -650, -828, -1521, 134, 1240, -1399, - -1450, 612, -969, 2585, 945, -312, -1138, -2488, - -2513, -1988, -1607, -773, 3384, 1192, 2651, 2580, - -984, -2015, -1465, -1576, 2273, -1221, 91, 2615, - 840, 1299, -1069, -2151, -1899, -735, 440, 888, - -241, 502, 953, 3613, 1806, -1855, -2303, -1758, - -1318, -1484, -10, 597, 3723, 1992, -488, -2063, - -2284, -2172, -1905, -1547, -937, -18, 3276, 7184, - -1942, -2302, -2399, -1972, -1378, -635, 302, 1081, - 5454, 3358, -447, -807, 205, -1805, -1546, -446, - 6364, -916, 151, -377, -582, -856, -204, -731, - -884, -674, -257, -67, 1564, 2486, 1003, -1508, - -1692, 1515, -889, -622, 2366, 9, -17, -245, - 3733, -1057, -284, 3197, -31, -440, -1115, -1609, - -1834, -1930, 230, 262, 7344, -39, -1746, -562, - -1554, -1838, -1648, -1310, 2157, 80, -102, 238, - -823, -622, -720, -115, -274, 16, -1562, -1785, - -1535, -334, 2604, 3388, -410, -103, -348, -142, - 1676, -441, -2267, -1988, -1421, -680, 1302, 2682, - 383, -10, 1487, -1086, -251, -1134, 141, -84, - -1003, -898, 95, 2304, 802, -1549, -1562, 2650, - 2180, 64, -512, -832, -705, -429, 1826, -2283, - -1976, -1277, 2699, 504, 249, -9, 178, -33, - -1357, -1138, 3005, 293, 229, 1633, -197, -540, - -1245, -1617, -1269, 6639, 2437, -647, -1501, -1097, - -1051, -1150, -1183, -1461, 71, 1529, 2847, 1149, - -705, -1345, -1605, -629, -617, -60, -2081, -1435, - 938, 844, -1055, -841, 1179, 392, 1112, 946, - -1252, -1728, -266, 7063, -1335, -920, -1048, 206, - 48, -619, 4764, 274, 2394, -799, -798, -1003, - -1278, -1800, -1626, -1415, -498, 1439, 1643, -1978, - -1258, -1136, 1285, -9, 596, 141, -2211, 908, - 802, -470, -1125, 3216, -234, -412, 3, -980, - 15, -1047, 1530, 660, 1986, -480, -499, -550, - -733, -531, 1326, -1607, 787, -1136, -1002, -65, - 358, 743, 253, -294, 3498, -1033, -1270, -790, - 537, 1788, 309, -72, -1241, -1999, 609, 2981, - -1025, -1642, -958, 3845, -1221, -962, -965, -1612, - -1993, -33, -1136, 1086, -46, 1178, -229, 139, - 644, 718, -1696, 2411, 1019, -1056, 52, 224, - -487, -395, -40, 125, 3001, -1955, -1950, -784, - -1111, 897, -514, 159, 785, 1095, 2944, -2554, - -2407, -1975, -632, 1030, 1712, 366, 463, 125, - -2354, -796, 5663, -1055, -1151, -870, 348, -676, - 1447, 215, -1005, -1531, -910, 2249, -438, 2889, - 107, -404, -271, -534, -1022, -2117, -1738, 2261, - -257, -788, 32, 1747, 1196, 910, 33, 1, - -23, 28, -25, 19, 13, -29, -23, -48, - -907, -2113, -1978, -1426, -535, 1589, 1908, 2724, - 1646, -897, 758, 2326, 674, -1449, 111, 220, - 475, -162, -1465, -2036, -528, 1308, -2087, -2031, - -1308, 183, 35, 1097, 1008, 1864, -2116, -2303, - -1928, -261, 2342, -292, 1480, 268, 1582, 1079, - -1183, -1154, -777, 309, 1218, 683, 1314, 1677, - -758, -1745, 1422, -1331, -1638, -1100, -303, 5003, - -57, -379, -511, -756, -727, -2315, -1860, -1775, - -676, 3854, -67, -52, 2018, 1532, -160, -197, - -75, -1934, -1134, 2025, 1810, -491, 83, 646, - 390, -297, -441, -342, -479, -486, -296, -30, - 443, 1151, 3508, 6119, -493, -1427, -1393, -1273, - -1280, -1687, -1683, -1511, 5109, -1008, -1137, -638, - -649, -342, -590, -478, -577, -349, -579, 2548, - -463, 2107, -568, -678, -788, -454, -608, -452, - 1934, 1485, -1746, -1007, -1174, -573, 239, -119, - 679, -76, -1687, 1956, -898, -477, 456, -156, - 1460, 13, 92, -987, 554, -2772, -2578, -1694, - -235, 753, 1527, 1106, 1539, 1342, -1305, 6560, - -1526, -1765, -793, -600, 248, -542, -63, -421, - 4828, 1288, -1580, -1826, -1163, -1014, -221, -818, - -109, -61, 1265, 1939, -1265, -414, 1912, -190, - -1157, -675, -756, -935, 2529, 136, -1709, -1727, - -1819, -1504, -1232, -959, 1128, 4142, -1945, 2958, - -900, -1432, -1720, -1380, 381, 1473, 1235, 1062 -}, - -.fcb22l_2 = { - 2441, -2086, -2129, -2146, -1839, -1035, 295, 2465, - -2785, -2597, -81, -2162, -991, 3060, 3056, 2985, - -2415, 4009, 3058, -1165, -1281, -322, 629, 2232, - 481, -2255, 1165, -1455, -621, -29, 923, 1371, - -2822, -2421, -2596, -1908, 6338, 279, 1845, 3532, - -2955, -2571, -2554, 744, -1785, -909, 775, 3156, - 738, 1760, -458, -590, -73, 22, -91, 326, - -1098, -1511, -1000, 1741, -1024, -562, -399, 736, - 9669, -2109, -1872, -1539, -1208, -265, 994, 2364, - -2121, -98, 1523, -1427, -1450, -1157, -294, 1375, - -3007, -2669, -2847, -1777, -1196, -1257, 1065, 9128, - -2948, -2509, 470, -2521, -1947, -728, 503, 3810, - -2538, -2469, -2217, 1957, 2580, -229, 1212, 2263, - -3174, -2660, -2792, -2692, 1226, -512, 555, 3960, - -2979, -2426, 1978, -2182, -1868, -455, 4681, 4580, - -2514, -1642, -1029, -1712, 416, -838, -362, 1208, - 5211, -2128, -1867, -1337, -549, -70, 828, 1508, - -2272, -1611, 7307, -1612, -1244, -461, 749, 2510, - 3669, 3236, -1845, -1333, -866, 268, 850, 1686, - -2805, 1079, -2258, -2075, -2017, -1115, 214, 2735, - -2719, 2676, -2154, -1976, 2884, 393, 1247, 2382, - -3043, 2188, -2703, -2353, -1861, -208, 4419, 4511, - -2187, -1630, 2246, 2331, -1105, -198, 818, 1721, - -2180, 3571, -1841, -1738, -1020, 14, 407, 1028, - -2536, -2171, -2115, 6630, -968, -306, 1438, 3574, - -2411, -1857, 1911, -1546, 2709, 57, 910, 1727, - -3159, -2565, -2675, -2746, -2017, -534, 8461, 6103, - -2299, 2912, -1851, 2660, -1479, -97, 1148, 2204, - -2510, 8781, -2194, -1790, -1114, -110, 1140, 2885, - 3261, -1921, -1633, 2766, -788, -403, 610, 1651, - -2515, -2021, 2415, -1606, -1149, 2479, 297, 1693, - 3823, -1538, 2514, -1261, -904, -236, 550, 1581, - -2903, -2440, -2922, -2749, -2480, -1849, -423, 3613, - 3420, -1876, -1929, -1537, 2955, 58, 1014, 1950, - -3295, -3009, -3161, -2926, -2353, 2355, 351, 5502, - -3140, -2745, -2781, 1247, -1037, 538, 4939, 4382, - 3584, -2284, -2321, -1844, -743, 3156, 1546, 2358, - -562, -101, -497, -1196, -1023, 1972, 1255, 1374, - -3146, -2824, -3057, -2757, -1736, 3746, 5609, 5118, - -2155, -1665, -1701, -1780, -1975, -1127, 3185, 2036, - -2540, 324, -481, 311, 624, 719, 543, 1030, - 550, 513, -2430, -1817, -1129, 62, 1526, 1809, - 2172, -1314, -1035, -586, -292, 233, 209, 543, - -252, -2372, -1961, -1629, -1306, -408, 451, 1339, - 792, -2619, -2316, -1624, 1941, 678, 977, 1710, - 428, -2499, -2369, -2101, -1448, 2988, 874, 2497, - 451, -2263, -2204, 1403, -631, 694, 1424, 1658, - -243, -2104, -378, 355, 1446, 373, 377, 973, - -756, -2802, -2508, -2081, 177, 352, 2428, 2359, - -1533, -2710, -2544, -1102, 419, 3132, 1222, 1942, - -2756, 1844, -2429, -1854, -1283, 3960, 1633, 2917, - -2858, -2784, -2106, -1025, 1588, 905, 1092, 1657, - -3028, -2715, -2782, -2218, 2852, 4006, 2534, 3726, - -2783, -2355, -2146, 2113, -1201, 3361, 1178, 2670, - -3199, -2796, -2682, -2489, 1905, -471, 5097, 4436, - -2197, -1078, -2327, 420, -637, 10, 1647, 1362, - 1815, -2519, -2363, -2174, -1454, -31, 4125, 3446, - -3054, -2953, -2738, -2328, -1636, 1086, 2238, 2132, - -3089, -432, -2674, -2515, -168, 745, 2236, 2305, - -3214, -2953, -3159, -3086, -2748, -1200, 3346, 5127, - -1150, -501, -2109, -1662, 2301, -401, 651, 1320, - -3072, -2608, -2833, -2249, -1387, 7704, 1811, 4960, - -2474, -2589, 83, -499, -785, 194, 1312, 1442, - -2716, -1663, -2088, -1812, -1396, 1862, -369, 1397 -}, - -.fcb22m_2 = { - 8809, -2291, -2452, -1982, -1356, -423, 419, 588, - 897, 1086, 79, -2155, -1957, 367, 1080, 233, - 718, 441, 515, 642, 730, 2454, 774, -2299, - -1526, -784, -359, 96, 385, 482, 4905, -2501, - -2431, -2047, -1139, 131, 743, 999, 1243, 1294, - -2154, -433, -2461, -2201, -1552, -163, -200, 4009, - 1731, 1652, -2381, 5295, -1457, -895, 3480, -1230, - -94, 471, 554, 669, -2458, -1271, 278, -2238, - -1852, -813, 888, 1032, 801, 1008, -258, -538, - -1744, -2087, -1651, -1239, 2222, -4, 783, 882, - 478, 782, -1335, -1453, 1728, -627, -387, -205, - 221, 193, -2282, -518, 7464, -1808, -1134, -199, - 340, 321, 410, 617, 2278, -436, -2082, -1958, - -1493, -885, 628, 794, 855, 989, 232, -1115, - -2617, -2152, -1290, -1299, -458, 222, 3936, 3349, - -2240, -2787, -2689, -2255, -1241, 816, 2307, 1566, - 1685, 1723, 2960, -2134, -2532, -1798, -1128, -1073, - 5380, 1013, 1525, 1415, -1976, 456, -538, -1433, - -1347, 22, -496, 284, 387, 465, -2214, -1863, - -2261, 1049, -1487, -1222, 1610, 621, 1000, 1116, - -2393, -731, 4075, 2375, -1178, -908, -383, 327, - 543, 572, -2071, -2039, 3310, -1903, -1502, -72, - 123, 693, 721, 918, -1866, -1251, -1065, 5630, - -1574, -541, 1, 1014, 813, 887, -2145, -2421, - -2176, -1756, 1856, 408, -1, 759, 1109, 1276, - 3053, -2705, -2467, -2068, -1160, 1405, 459, 1167, - 1219, 1318, -2198, -2037, -2005, -2204, -2039, -1473, - -1529, 264, 1333, 1822, -2121, -1434, -472, 1901, - 2448, -589, -424, 248, 376, 602, -1571, -1032, - -1243, -1619, 5682, -1162, 362, 570, 865, 852, - -1875, -805, 4258, -1569, 2992, -1175, 51, 164, - 314, 648, -2083, 5574, 2553, -1866, -1156, -642, - -198, 330, 446, 602, -2365, 1601, 2873, -2043, - -1510, -1142, -20, 588, 535, 676, -2207, -1637, - 626, 745, -1548, -590, 745, 540, 505, 618, - 749, -1389, 857, 1387, -398, -606, -75, -86, - 11, 78, 3322, -1347, 1978, -1431, -745, -280, - -42, 135, 350, 376, -508, -1349, 2961, -1184, - -647, -1257, 3009, -374, 523, 616, -1848, -41, - 2652, -1609, -1603, 3284, -24, 502, 122, 448, - -2337, -1029, 734, -1533, 1523, -1312, -754, 335, - 510, 774, 769, -117, 139, -1254, -1468, -965, - -375, 2, 227, 518, 3187, -1524, -776, -1253, - 2977, -530, 319, -61, 244, 413, -2290, 3085, - -1763, -1480, -1374, 3272, -87, 323, 421, 652, - -2317, -2182, -1604, -1, -801, 1320, -156, 907, - 799, 918, -1494, -2205, 1137, 69, 1249, 3437, - 925, 29, 419, 448, 3574, -1564, -1713, 2374, - -941, -252, 123, 263, 366, 539, 1059, -1856, - -1753, 766, -1704, 106, 262, 596, 684, 820, - -2503, -1878, 1835, -594, -1024, -2105, -1567, 488, - 794, 883, -1626, -613, -1410, 2846, -1413, 3557, - -348, 460, 332, 577, -907, 700, -1680, 1130, - -1637, -793, -160, -38, 473, 630, 1487, 1872, - -1526, 1379, -806, 121, -383, 149, 259, 413, - 759, -2817, -2758, -2290, -1348, 460, 1782, 1536, - 1513, 1503, -2265, 3193, 117, -1704, -1367, -487, - 125, 365, 594, 651, -2287, 1272, -2537, -2038, - -1515, -578, 2994, 582, 941, 1058, -1556, -1583, - -720, -1584, 956, -1032, 1861, 146, 402, 429, - -2184, 1667, 1241, 289, 52, -232, -265, 210, - 248, 331, 1133, -1813, -1869, -1429, -1484, 5620, - -400, 1316, 1146, 1150, -1975, -818, -1921, -2054, - -1768, 2953, -544, 426, 856, 1107, 493, -2019, - 176, -1915, -1040, 717, -91, 728, 647, 776, - -2360, 739, -2136, 30, 636, -447, -116, 498, - 531, 775, -2250, 8607, -2075, -1928, -1072, -450, - 38, 439, 558, 778, 4484, 1056, -1830, -1716, - -988, -412, 260, 56, 425, 579, -2243, 4094, - -1267, 2172, -990, -562, 97, 304, 533, 609, - 790, 780, -2029, -1947, -1327, 1224, 255, 344, - 516, 660, -591, 1702, -118, -1402, 396, -1387, - 2268, -247, 177, 355, 1393, -2318, -1975, -1563, - 863, -939, -365, 411, 800, 1019, -2370, 4656, - -2301, -2111, -1679, -698, 458, 788, 1004, 1138, - 2285, 4924, -1940, -1955, -1159, -436, 237, 5, - 300, 364, -2492, 2165, -2021, -2072, 1504, -612, - -93, 249, 676, 799, -2411, 1952, -1752, -2418, - -2285, -1323, -621, 837, 1043, 1266, 76, 3160, - -2176, -2176, -1717, -1105, 1045, 410, 728, 940 -}, - -.fcb22s_2 = { - 6946, -1850, -1986, -1590, -1276, -1063, -1026, -1017, - -805, -346, 9, -2911, -2843, -1899, -198, 2193, - 3325, 1315, 37, -528, -371, 599, -751, -2157, - -1912, -855, 988, 1222, 1085, 953, 3212, -2793, - -2564, -1707, -657, 683, 1109, 683, 647, 446, - -1906, -2315, -2569, -2428, -1698, -600, 1100, 3790, - 3368, 2172, 2017, -895, -1354, -734, 2552, -403, - -68, -402, -752, -932, -1205, -1937, 572, -1434, - -500, -579, 291, 1723, 1312, 1695, -238, -1715, - -2029, -1525, -816, -363, 2816, 167, 2196, 1793, - 897, -1081, -262, -1338, 1052, -1231, -94, 1296, - 503, 184, 588, -2057, -911, -1933, -1769, 167, - 1013, 1774, 1414, 1289, 2406, -1906, -2055, -1952, - -1726, -1618, -451, 575, 3021, 2569, -776, -1649, - -2111, -1930, -1499, -1349, -595, 329, 3090, 5458, - -1954, -1309, -1554, -1159, -1132, 329, 714, 760, - 2529, 2417, 1046, -1025, -1114, -1325, -154, -1501, - 4160, -696, 230, 398, -2010, 385, -1344, 36, - -1269, -987, 1009, 1453, 1163, 1591, 916, -1534, - -508, 221, -1596, -1130, 1394, 539, 676, 676, - 1263, 2029, 284, 1592, 161, -124, -572, -1362, - -1946, -2148, -1488, -222, 4967, -1202, -939, -375, - -80, -593, -445, -418, -781, -1560, 31, 4757, - -1417, -954, -402, 193, -316, -278, -926, -895, - -1024, -436, 2673, 1991, 254, 28, -861, -1291, - 1475, -2708, -2689, -2118, -703, 290, 1841, 2048, - 1213, 594, 132, -2598, -2427, -988, -1111, -158, - 478, 2118, 2571, 830, -1430, -678, -773, 1340, - 2473, -798, -751, 215, 274, -65, 335, -1947, - -1796, -1436, 3862, -611, 105, -31, 775, 669, - 1439, -1266, 1670, -739, -1259, -572, -17, -107, - 176, 130, 3899, 3478, -548, -1429, -1176, -1104, - -1147, -1503, -1277, -1068, -258, 2645, 1753, -333, - -827, -1306, -827, -502, -306, -119, -1602, -1644, - 1922, 1127, -628, -1073, 348, 195, 616, 685, - 1750, -898, -1852, 1813, -700, 254, 598, -234, - -433, -1035, 2502, 94, 467, -1672, -905, 776, - 679, -11, -1071, -1845, -1083, -320, 690, 110, - -708, -1077, 2514, 70, -412, -300, -371, -717, - 1700, -1625, -1346, 1954, 14, -64, -121, 181, - -673, -909, 2274, -1389, 2058, -1503, 306, -187, - -209, -69, 1523, -632, -695, -1283, -988, -569, - -798, -521, 398, 2834, 1953, -2215, -1626, 106, - 6, -498, -57, 173, 731, 1002, -1706, 1701, - -328, -1745, -1398, 2176, -19, 311, 492, 667, - -1073, -1803, -1684, 703, -1316, 1803, 659, 913, - 906, 1033, -1982, -102, 945, -1620, 718, 555, - 613, 38, 394, 421, 2738, -1159, -2248, -1852, - -1568, 33, 363, 1490, 935, 561, 1464, -2466, - -1209, -1204, -692, 2009, 129, 354, 372, 380, - -2053, 1122, 2272, -824, -1355, -926, -122, 567, - 526, 923, -1320, 59, -226, 1674, -1512, 1498, - -631, 221, 26, -247, -40, -1615, -1597, 2111, - 34, -813, 200, 219, 758, 1000, 306, 394, - -430, -117, -409, -81, -207, 16, 36, 176, - -1737, -2898, -3005, -2214, -568, 2140, 4132, 2592, - 504, -521, -1509, 3610, 1070, -1890, -1319, -11, - 174, -148, -212, -347, -464, -1068, -2568, -2532, - -1973, -519, 2104, 3713, 1882, -145, -1319, -2375, - -1862, -843, 2061, -266, 1465, 866, 912, 1183, - -1784, 2072, 205, -375, 1112, -374, -534, -430, - -162, -204, 375, 82, -823, -1148, -752, 4681, - -339, -247, -790, -1088, -494, -2302, -2310, -1603, - 46, 3367, -50, 393, 1383, 1457, -1377, -2005, - 643, 326, 312, 1189, -225, 563, 261, -70, - -667, -1191, -2255, -470, 1000, 142, -525, 2285, - 756, 2061, -953, 5888, -1339, -1534, -1252, -16, - -116, -305, -375, -596, 3611, -889, -511, 43, - -809, -659, -737, -510, -258, -108, -1515, 2806, - -1555, 1025, -932, -601, 146, 164, 207, 71, - 1606, 93, -2420, -2311, -1641, -244, 1785, 804, - 1040, 427, -1510, 38, -2490, -1987, 44, 699, - 1407, 988, 1061, 411, 1162, -1382, -2669, -1635, - -905, 1503, 674, 1357, 869, 244, 411, 2612, - -1792, -2147, -1693, 1434, 281, 38, 228, 424, - 2291, 1354, -2128, -1377, -1014, -609, 131, -151, - 418, 602, 111, 2200, -1547, -1153, 1435, -1282, - 6, -111, -1, 92, 238, 613, -2271, -1181, - -1455, -919, -182, 1066, 1932, 1679, -1715, 2825, - -1764, -1759, -741, -829, 501, 746, 1056, 1416 -}, - -.fcb44l = { - 4868, -1851, -2031, -2019, -1751, -552, 756, 929, - 1389, 1590, -2090, -1202, -1317, 516, -1798, -1020, - -694, 4322, 1388, 1904, -2605, -1239, 1005, -757, - -1248, -358, 699, -201, 409, 1093, -2901, -2254, - -2605, -2595, -2104, -1681, 6854, 2692, 3155, 3446, - -2535, -1421, -1745, 898, -2046, -1457, -1044, -269, - 1748, 1873, -2268, -1098, 407, -1865, -2103, 1510, - -1217, -399, 1718, 2017, 3638, -1685, -1547, -1480, - 1637, -744, 580, 586, 1313, 1409, 617, -2020, - -1919, -2179, 932, -937, 559, 1795, 1528, 1596, - -2867, -2553, -2507, -2653, -2365, -1985, -170, 8679, - 4271, 4273, 2263, -1835, -1934, -1719, -1778, 2357, - 125, 1319, 1543, 1765, 3689, -1215, 2369, -1533, - -1611, -771, -123, 1005, 1297, 1465, -2491, 2631, - -1636, -1655, 1244, -1178, 386, 961, 1300, 1553, - -2357, -2404, -2305, -2177, -1714, -383, -98, 258, - 3902, 2475, -2923, -2580, -2685, -2803, -2678, -2428, - -1247, 450, 8174, 5035, -2302, -1629, -1495, 1832, - 1616, -577, 639, 872, 1122, 1437, 785, -1947, - -1976, 823, -1909, -1005, 430, 1244, 1713, 1664, - -2537, 8025, -1705, -2005, -2030, -1155, 64, 1106, - 1975, 2277, -2410, -2639, -2292, -1858, 162, 744, - 555, 1559, 1719, 1806, -2282, -1982, -1914, 1415, - -1785, 2197, 254, 763, 1338, 1741, -2509, -1991, - -2328, -1853, -2299, 5145, -34, 1495, 2913, 3018, - -2009, -1736, 2411, -1595, 1877, -1316, 693, 1042, - 1565, 1744, -2657, -2161, -2222, -2135, 4454, -1784, - 1331, 3208, 2852, 2955, 3738, -1338, -1425, 2090, - -1601, -279, -2, 712, 1220, 1436, -2385, -1265, - 7093, -1561, -1742, -1003, 283, 1009, 1843, 2055, - -2251, -2175, 2310, -1321, -1976, 1874, 164, 2781, - 2721, 2487, 2519, -1101, -1539, -1575, -1487, -724, - -25, 355, 643, 1011, -2296, -1799, -1895, -1700, - 2743, -924, -254, 32, 1504, 1910, -2811, 898, - -2363, -2518, -2408, -1737, -936, 221, 2588, 2527, - -2535, -2360, -2477, -1861, -1882, 1833, 3587, 1307, - 2141, 2274, -433, -1994, -1692, -1318, -1398, -350, - 1518, 1923, 835, 1262, -2246, 3383, 2458, -1464, - -1874, -983, -157, 531, 1490, 1729, 9543, -1713, - -2011, -2015, -1870, -969, -34, 1160, 1724, 1919, - -2530, 140, -1923, -1730, -1720, -605, 629, 1577, - 974, 1373, -2268, -1582, -933, 1124, -1624, -514, - 4156, -118, 1515, 1907, -2267, -574, -1311, -954, - -47, -1259, 15, 364, 854, 1009, -2221, 629, - 994, -1646, -1324, -1509, 2359, 3453, 1393, 1912, - 3586, -2286, -2537, -2560, -2415, -1748, -368, 3093, - 2881, 2611, -2556, 2792, -1558, 1117, -1681, -65, - -36, 516, 1233, 1514, 531, -1814, 998, -1795, - -1693, -871, 725, 868, 1504, 1465, 907, 300, - -2060, -2366, -2392, -1881, -596, 1754, 2169, 2104, - -2755, 2709, -2298, -2627, -2423, -1875, -733, 3886, - 2648, 2821, 623, -541, -163, -319, 85, 84, - 15, 716, 511, 572, 3948, 2773, -1504, -1746, - -1832, -934, -78, 988, 1277, 1518, -2678, 2216, - -2162, -2331, -2076, -968, 3445, 1070, 2077, 2206, - -2892, -2425, -2674, -2905, -2844, -2584, -1381, 3269, - 2696, 3281, -2090, -369, -1515, -1367, -200, 2089, - 739, 700, 866, 1169, -2276, -1057, 2851, 2589, - -1686, -515, -65, 579, 1278, 1593, -2837, -2458, - -2565, -2783, -2843, -2468, -1704, -1531, 1475, 4153, - -2209, -1857, -1873, -2177, 758, -1531, 3207, 1163, - 1506, 1851, -2383, -1683, -1839, 5772, -1815, -465, - 361, 1086, 1912, 2140, -2629, -1688, 1608, -2190, - -2419, -2064, -1253, 1397, 2099, 2306, 513, 1664, - -1683, -1629, -1682, -109, 269, 695, 1072, 1317, - 208, -1602, -1918, -1038, -813, 312, 24, 26, - 761, 990, -2288, -2225, -1948, -1932, -1832, -949, - -450, 920, 805, 1468, -2897, -2633, -2557, 464, - -2174, -1157, 1170, 2230, 2550, 2522, -2643, -1928, - -2255, -2578, 82, -2206, -63, 2663, 2007, 2292, - 226, -2541, -2687, -2753, -2229, -1556, 785, 3837, - 2331, 2492, -2496, -1740, -2465, -2295, -2151, 1142, - 363, 3967, 1943, 2432, -2619, -2400, 520, -2274, - -1900, -1486, 2135, 1407, 2300, 2288, -2811, -3066, - -3128, -3098, -2529, -1475, 2172, 3413, 3613, 3571, - 564, -2347, -2257, -2377, -1944, -1771, -582, 509, - 1683, 1975, -285, -2136, -2529, -2464, -2117, 278, - 1094, 1042, 2192, 1976, 1781, -1874, -2042, -2103, - -1744, -1044, 3373, 1252, 1861, 1873, -2688, -1849, - -2462, -2494, -2105, -1903, 2221, 250, 1653, 2233 -}, - -.fcb44m = { - 13151, -1763, -2583, -2518, -2181, -1036, -537, -112, - 214, 590, -608, -2270, -2228, -1301, -1018, 3687, - -471, -282, 909, 1665, -2426, 1713, -808, -1240, - -1366, -976, -140, 1730, 683, 191, 7253, -2076, - -2733, -2698, -2253, -1116, 376, 687, 1314, 1532, - -820, -1471, -2092, -2047, -1796, -1347, -732, 6348, - 2529, 1441, -1460, -1845, -1046, -1643, 8086, -928, - 90, 660, 428, -188, 604, -2022, 556, -1680, - -1641, -902, 834, 941, 1480, 1906, -2439, -2573, - -3091, -2853, -2419, -1606, 2312, 2624, 2659, 2659, - -1286, -2273, -2400, -1826, 2443, -1391, 685, 1822, - 1810, 1625, -1993, -731, 9737, -1476, -1183, -1244, - 34, -85, 0, 201, 4171, -2430, -2869, -2866, - -2488, -1154, -1253, 282, 2715, 3643, -2130, -2522, - -3259, -3051, -2977, -2204, -1264, 1103, 7113, 7948, - -1271, -1694, -2011, -1294, -1607, 247, -303, 715, - 4276, 1908, -2337, -2111, -2232, -2123, -1648, -1302, - 7686, 1213, 982, 984, -2594, -2127, -1981, -2104, - -2405, -1966, -936, -95, 326, 672, -2263, -893, - -1367, 1288, -1321, -1351, 2503, 747, 390, -247, - -2220, -860, 3641, 3766, -1724, -1487, -531, 239, - 134, -82, -2563, -1537, 3883, -1911, -2109, -1713, - 1056, 726, 977, 1091, -1874, -1366, -1628, 11069, - -1653, -696, 118, -78, 337, 29, 2449, -1438, - -601, -1533, -816, 1262, 540, 79, -460, -1403, - 3204, -1918, -1892, -1911, -1468, -976, -42, 2785, - 1088, 564, -236, -2267, -2324, -2130, -1880, -427, - -258, -543, 903, 5142, -1791, -1611, -1073, 2911, - 2993, -1295, -400, 229, 192, -85, 4461, -1711, - -1431, -1640, 3525, -1398, -101, -219, 327, 415, - -669, -1520, 6595, -1291, 5123, 155, -480, -518, - -552, -890, -2609, 7074, 3220, -1054, -1852, -1165, - -25, 89, -361, -140, -1610, 2214, 2903, -1737, - -1704, -1178, -708, -171, 177, 674, -1075, -890, - 82, 463, -1432, -1048, -703, -759, -247, 344, - 2448, -656, -1135, 4366, -583, -705, 40, -314, - -676, -1271, 4389, -952, 3249, -1606, -1524, -1172, - -490, 97, 128, -91, -66, -1293, 1696, -1114, - -1455, -519, 2620, 479, -257, -1512, -2037, -1281, - 1752, -1285, -1812, 2789, -52, 676, 409, 296, - -1977, -1043, 270, -1615, 2131, -1051, -161, -498, - 767, 1673, 1044, 27, -1107, -1730, -1856, -1264, - -275, -167, 893, 443, 3850, 97, -1244, -1691, - -1566, -1088, -1062, -837, -159, 1830, -1424, 2494, - -1878, -1532, -1991, 2919, 62, 399, 524, 381, - -1340, -2415, -2028, 218, -1342, 410, 815, 533, - 948, 1998, -1213, -1847, 3691, -2123, 1822, -1548, - 537, 987, 356, 123, 3876, -2476, -2021, -2195, - -1562, -737, 2250, 709, 797, 1102, 2065, -2258, - -2394, -1816, -1536, 1059, 4653, 1457, 456, -27, - -2226, -736, 765, -1879, -2188, -1793, -928, 892, - 1793, 2257, -1182, -1646, -1789, 6105, -1936, 4316, - -307, -143, 223, 236, -2213, -1862, -1823, 3326, - -1810, -1384, -453, 1007, 1331, 1405, 4135, -2298, - -1657, 1981, -1702, -853, -318, 298, 760, 1025, - -2537, -2782, -2985, -2687, -2839, 4493, -448, 4249, - 3048, 2678, 1045, 3227, -690, -1390, -976, -652, - 587, 194, -749, -1358, -730, 250, -2404, -2548, - -2157, -1027, 32, 2091, 1059, 1360, 262, -2135, - -2061, -1777, -1614, -246, 2004, 2605, 1516, -948, - -1060, -1076, -1643, -748, 144, 1595, 1730, 531, - -1086, -2182, -483, -2191, -2411, -1983, -2345, 10051, - -841, 1456, 924, 207, 4652, -1831, -2026, -1710, - -2235, 4036, -755, -70, 533, 887, -1899, -2326, - -2129, -2115, -1606, 1443, 2557, 941, 618, 527, - 949, -1547, -2067, -1785, 455, -60, 79, 202, - 912, 954, -2527, 14551, -1893, -2315, -2609, -1844, - 497, 287, -197, 626, 6839, -804, -1299, -1259, - -1109, -97, 976, 144, -343, -1375, -2334, 3740, - -1049, 2980, -1739, -474, 223, 137, 155, -171, - 2962, 1814, -2378, -2643, -2249, -1109, 858, 643, - 1630, 1399, -2098, 974, -1718, -2193, -2146, -1488, - 3353, -147, 1187, 1266, 1559, -2532, -2941, -2759, - -2101, -1098, 1562, 1049, 2045, 2159, -2298, 7439, - -2129, -2361, -2318, -1552, -422, 482, 985, 1111, - 6050, 5657, -1698, -2267, -2127, -1135, -140, -286, - -352, -124, -1230, 3492, -1370, -1221, 2958, -1239, - -472, -722, -169, -89, -2310, 2988, -2367, -2421, - -2589, -2034, -662, 421, 1863, 2736, -2612, 5429, - -2104, -2257, -2440, -1817, 4819, 883, 622, 636 -}, - -.fcb44s = { - 11239, -328, -2011, -1713, -1662, -1290, -1225, -1520, - -1541, -912, 400, -1103, -2698, -162, 263, -964, - 668, 405, 732, 2493, -2491, 1000, -2910, -793, - -1351, -515, 1051, 2002, 1757, 2150, -2010, -2021, - -2254, -1896, -1953, 664, 7067, 2632, 531, -1367, - -2228, 2113, -2019, 2309, -1458, -426, 1242, 338, - 205, -222, -1317, -1806, -2477, -2427, -2477, -1852, - -1472, -911, 2261, 10280, -2369, 382, 3180, -1210, - -1601, -748, -732, 504, 1440, 1142, -13, 610, - -2457, -739, -1318, -1013, -52, -470, 627, 4734, - 1248, 2947, -631, 1560, 2096, -833, -1173, -1475, - -2060, -2189, 967, -1451, -1544, -758, -538, -31, - 1395, 3550, -3, -1999, -1975, -1734, -2680, -2512, - -2037, -1306, -252, 1288, 6012, 4834, -1087, 3259, - 3115, -1369, -1136, -948, -264, -582, -677, -643, - -2500, 1284, -317, -1872, -1150, -1150, 310, 832, - 1597, 2842, 6295, 3806, -671, -1536, -1460, -1256, - -1223, -1504, -1672, -1471, 1358, 1004, -1893, 1114, - -1643, -103, -513, 189, 303, 140, -1618, -648, - -720, 7274, 573, -180, -731, -1226, -1564, -1742, - 151, 2103, -1562, -974, 94, 546, 3536, -205, - -1657, -2534, -2187, 2840, -1248, 451, 2615, 171, - 479, -305, -1299, -1708, -2144, -1593, -1289, 2766, - 2287, -400, 188, -51, 141, 105, -2128, 4976, - -1690, -1216, -1175, 297, 1454, 449, -478, -970, - -1914, -1459, 3036, 2668, -950, -634, -507, -374, - 4, 34, -1664, 2901, 847, 2817, -1154, -1651, - -1262, -1160, -624, 629, 1578, 765, -2002, -2121, - -1527, 1938, -272, 113, 287, 955, -1473, 60, - 8047, 137, -534, -841, -1077, -1504, -1788, -1758, - -1871, 119, 931, 1775, -704, 2792, 354, -501, - -1370, -2038, -1031, -1631, -1914, -879, 377, 7589, - 173, -196, -491, -1658, 3790, -773, -1731, 3028, - 49, -1013, -563, -1232, -953, -730, -2568, -1926, - -679, -267, -324, -962, 51, 461, 2728, 3631, - 3533, -1690, -2846, -2370, -1945, -917, -551, 276, - 2634, 3558, -2592, -1750, -2422, -1586, -1204, -1001, - 4603, 1802, 2673, 1685, 2710, -853, -2321, -1919, - -1603, -868, 3706, 290, 570, 338, -2245, -1704, - -1915, 545, -787, 1635, 1725, 526, 666, 1604, - 642, -1154, 3231, -1232, -1772, -623, 217, 27, - 3, 641, -2411, 1924, -967, -1583, -1499, 2316, - 1354, -115, 333, 559, -1721, 2475, -1942, -2114, - -1196, -571, 1769, 2350, 1315, -607, 4510, -1414, - -2228, -1312, 1439, 469, -248, -399, -270, -721, - -1517, -1247, -771, -36, 6488, 942, -279, -572, - -1041, -1908, -2388, -2281, -2595, -2275, -1529, 51, - 471, 4435, 3002, 2738, 4049, 1562, -2706, -1672, - -1649, -1204, -518, -280, 774, 1344, 6, -1950, - -1521, -1768, -972, 1420, 3011, -191, 644, 1478, - 3220, -313, 3030, -153, -841, -739, -378, -1013, - -1410, -1815, -2104, -1033, -2097, -1992, -943, 2391, - 424, 369, 1601, 3331, 1494, -2060, -2027, 1579, - -1407, 1120, -280, -197, 761, 1048, -710, 4094, - -1533, -1984, -1620, -1132, -515, -485, 971, 2644, - 3979, -661, -1891, -1120, -897, 2484, 1623, 21, - -1534, -2438, 3201, -1510, 858, -1459, -711, -1332, - -833, -240, 763, 1096, -1435, -29, 3174, -1773, - -19, 708, 1680, 403, -910, -2224, -2670, -619, - 1320, -751, -1323, -1022, 2875, 1080, 985, 1, - 191, 7823, -475, -604, -1126, -967, -1139, -1600, - -1767, -1161, -1342, -1960, -2112, -1793, -1596, 3103, - 535, 2001, 3235, 151, -2266, -807, -1977, -1661, - -1255, 2328, 2632, 3189, 621, -1130, -2183, -1127, - 2391, -884, 2173, -690, -354, -516, 352, 954, - 1847, -74, -1260, -1839, 2557, -1221, 228, -630, - -162, 386, 1462, -1889, -2596, -2216, -1869, -518, - 1281, 2329, 2653, 1117, -1535, -1038, -1752, -1862, - -1635, -1067, 994, 5212, 2719, -264, -2021, 1824, - -2110, -619, 1538, -397, -332, -153, 860, 1281, - 6568, -1790, -2459, -1707, -1708, -799, 294, 89, - 475, 992, -1668, -1819, -2010, -1623, 2079, 3255, - -388, 591, 1477, 581, -1544, 476, -1825, -959, - -1296, -1037, -453, 1146, 4693, 839, 2027, 3021, - -1731, -1746, -1964, -1115, 1197, 102, 164, -162, - -2301, -1281, -2022, 3983, -1122, -281, 85, 352, - 1042, 1599, 6463, -93, -2010, -1988, -2282, -2189, - -1915, -1721, 17, 4694, 424, -998, -111, -1995, - -1246, -1176, 78, -116, 1951, 3059, -1974, -1783, - -2243, -1238, 3935, -928, -15, 1265, 1536, 1907 -}, - -.shape08 = { - 5279, 1101, 12974, 5624, 2029, 3853, 5918, 1516, - -2905, -224, -92, -819, 803, 1091, 3091, -3355, - 152, -1214, -7317, -738, -8973, 546, 12035, -937, - 2216, 2113, 1214, -6577, 2006, -1661, -673, -5880, - 496, 454, 3400, 676, -322, 11388, 634, -1169, - 12556, -5804, -7724, 588, -6801, 1080, 354, -1681, - -942, 1926, -487, -580, 156, 79, 15253, 667, - 1155, 655, -719, 1999, -785, 214, 2822, 1020, - -1967, 73, -387, -137, -15225, -1552, -357, 2830, - 2140, 3070, -2552, 2410, 1230, 4131, 999, 248, - 531, -909, 3948, 12858, -8056, 2205, -2837, -171, - -1633, -129, -93, 1852, -1920, 157, 9647, -84, - -150, -1365, -1522, -13197, 6168, -3195, 5890, -1724, - -6407, -1340, -7435, -621, -5732, -2895, 145, 3974, - 728, 9840, -494, 7357, -394, -13614, -256, -1930, - 468, -266, 8001, -153, -365, 7652, 135, 1400, - -3869, 1091, -4935, -2884, 1259, 6819, 1025, -6667, - 1079, -9794, 6827, -4166, 1108, 1149, 18861, 593, - -177, -1067, -644, -2164, 4727, 85, -101, -10805, - -247, 8918, 2261, 5475, 756, 3018, -6535, 1941, - 359, -4229, 1206, 958, -878, 554, -18780, 2289, - 4906, -7412, -7685, 7932, 965, 2460, 4423, -563, - -3668, -3482, 3307, -1737, 971, -7480, 10742, 1978, - 2365, 20, -3625, 466, 2056, -6602, 9396, 3145, - 3162, 1857, -630, -6905, 1660, -3024, -2159, 1109, - 1282, 2767, 210, -2203, 3099, -7889, 1805, -13115, - 988, -6235, 1566, -1399, -9612, 1821, -519, -57, - 3428, -14024, 1141, -2542, -9396, -17, 440, -8591, - 2271, -7811, 1891, -935, -4330, -1303, 362, 426, - 319, 1176, 3176, 2202, -14308, -619, -2942, -2271, - -531, -652, 345, 17681, 1453, -1561, 341, -2077, - 933, 433, 1529, 463, -1095, 4912, -840, 16266, - 973, 1732, -718, 6702, -3659, 4037, -704, -2707, - 1423, 1291, 2300, 149, -933, -1338, 2019, 6173, - 481, 14937, -364, 3896, -443, 992, -896, 378, - -226, -1505, 268, -428, -2622, -289, -2069, 10472, - -3880, -5330, 385, 3053, -4642, 1525, -1557, 716, - 2504, 848, -450, -2018, -458, -705, -7120, -543, - -2138, 2548, -351, 737, 12906, -1012, 63, 15357, - 332, -837, -225, -1299, 2843, 1334, -669, 2083, - -707, 1171, 8219, 2190, 10567, 1370, -1376, -2919, - 2108, 10098, -388, 4442, 164, 490, 7580, 26, - -1848, -2919, 640, 4758, -108, 8194, -1325, -2314, - 447, 5178, -1095, 9902, -693, -3624, -223, 690, - 10495, 776, -919, -1621, 2046, 469, 1454, 3681, - -1090, -1776, 1457, 212, 2054, -994, 698, -496, - 22347, -623, 254, 960, -4073, 531, -2572, -14393, - -1022, 258, -3667, 994, 15242, 5078, -3618, 1925, - -1229, -1754, 1715, 4358, 1286, -2360, -4590, 1824, - 7864, 1423, -2146, -2763, -10635, 474, -829, 1159, - -157, -54, -158, -29, 202, -383, 285, -2, - 862, -364, 415, -123, -145, -9733, 1167, 10199, - -1408, -2992, 2131, -412, 4743, 2992, 3555, -617, - 9606, -2831, 2357, 5300, 625, -678, -500, -128, - -56, -6327, -1122, -2567, 1904, -1804, 709, 3194, - -148, -1371, -6534, -1748, -1490, 14159, 1466, 1395, - 1101, -2725, 503, 68, -1486, 0, 211, -1218, - -3, 20920, 1709, -208, -839, 4574, -6084, -6557, - -103, -984, -375, 8409, 1715, -2170, -5003, -3296, - 13482, 1211, -4159, 3496, 1040, 6925, 213, -1398, - 441, -1231, -814, 842, 1574, 1145, 1359, 437, - -1777, 20566, 259, -4573, -1412, -158, 10144, 1269, - 1405, -12631, -1104, -615, -15892, 355, -3795, -1158, - 3241, 252, 232, -179, -617, -2038, 285, -1014, - -1248, 1835, -1558, 1266, -10207, 629, -312, 11376, - 154, -288, 5915, -353, 60, 2695, -853, -103, - 15659, 2403, -1184, 3, 9236, -10953, 4434, 829, - 2563, -164, -848, -646, 7247, 895, 1726, -752, - -979, 1053, -971, 318, 2180, 927, 804, -262, - 446, 3261, -4926, -4523, 1247, 2039, 12770, -1191, - -1310, -5574, 4763, 657, -4139, 10821, -805, -1109, - -3189, -1721, 167, -10022, -1877, 2123, 328, -7048, - -2130, 2431, 1522, 3209, -8448, 1810, -5412, 9815, - -3677, 6575, -6237, -929, -434, -2375, -13586, 3497, - -1140, 1227, -6354, -507, 329, -1690, 1079, -880, - -3743, -4021, -4645, -6053, 958, 4594, -1122, -11628, - 1537, -3418, -1242, 133, -9335, 1611, -432, 10733, - -885, -468, -13466, 690, 214, 8968, 3441, 5451, - -219, 5492, -377, 409, 3812, 2450, 508, 6542, - 3824, -3705, -514, -8262, 1537, 7969, 946, -2869, - 8762, 417, 5094, 2104, 6694, -342, 1259, -4779, - -1445, -1519, 333, 4385, 652, -386, -580, -1892, - -873, 1862, 2704, 13837, -5415, -1975, 5881, 7150, - 8272, -6412, 704, 1854, 257, -3746, -9789, -9634, - -924, 1393, -3237, 259, -56, 4390, 4902, 1172, - 5114, -2616, -4409, -1180, 4691, 7400, -625, 8873, - 6846, -1224, -213, -5296, -3504, -147, 17828, -1347, - 3251, 1702, 1440, -2364, -491, -227, 1765, -446, - -9746, -2019, 11287, -195, -9559, -312, 888, 5789, - -1753, -11069, 2537, -265, -1762, -779, -8501, -308, - -89, 1973, 3640, 17344, 1326, -689, -398, -3820, - 2167, 229, -636, 2142, -6587, -751, 13243, 465, - -5946, -202, -968, -1060, -240, -10626, 3405, 1302, - -1263, 972, 11351, 100, 2266, -930, -2108, 5350, - -3186, 11130, 2073, -5616, 650, 2000, 1048, 5628, - -531, 674, 8453, 1030, 1152, 12095, 352, 409, - -1029, -1236, -190, -5724, -589, 3550, 1958, -14081, - -339, 1672, -1659, 4518, -75, -638, 5501, 277, - -578, -2185, 157, 2066, 8634, -2403, 1617, -12487, - -1881, 8273, 179, -2152, -1294, -512, -415, 456, - -141, -125, -405, 132, 49, -1978, -19085, -451, - -1480, 324, -5397, 235, -1217, 346, -1258, 3540, - 10075, 10291, 5060, -2057, 6156, -992, 9344, -3718, - 4296, 895, -8464, 341, 1426, 648, 1494, 2895, - -3760, 10139, 15531, -984, -1550, -1319, -1542, -119, - -517, -185, -3368, -9279, -3455, -4257, 1092, -10120, - 5072, 3099, 986, -2562, -12068, 1932, 6489, 950, - -2417, 1362, -567, 591, -715, -515, 3506, -726, - 6319, 214, -364, 3611, 1895, -2005, -273, 1513, - 2379, 475, -4855, -527, -11493, 27, 4343, -2394, - -639, -744, -2601, 10917, 1910, 2449, 1238, -2175, - 5322, -4054, -40, 4274, 684, 8152, 966, 10882, - -13, 4253, -287, -3192, 548, 2020, 189, -6894, - 797, 2160, 579, 4084, 1767, -4011, -640, 7697, - 791, 945, 1230, 6491, 1508, -3762, -433, 11340, - -129, -1131, -5121, 3148, 1544, -7648, 1866, 9660, - 2365, -2110, 782, -82, 3666, -701, 303, 298, - -1934, -125, -1427, -17589, -1188, 175, -7046, -488, - 1121, -6594, 489, -1551, 14349, 1499, -544, 17132, - 198, 2516, 2479, -978, -214, -3399, -1223, 2094, - 130, -1020, 1049, -710, 12801, -498, 297, -1365, - -187, -3169, -123, 9019, 958, 221, 14234, -590, - 961, 3092, 8, 255, -4586, 1789, 2522, -12577, - -91, -822, -805, -714, 5298, 1299, 3306, -1288, - 13176, 235, 1754, -67, 1912, -604, 3240, -2048, - -200, 772, -173, -996, 1368, 2380, 294, 763, - 19665, -196, 528, 182, -2394, 923, 749, -13578, - 855, 589, -9553, 0, 5737, 10399, 9147, -1655, - -3735, 1246, -2429, -1147, -2199, -2953, 614, -1404, - -449, -8524, -2271, 5001, -9517, 2940, -204, 3625, - -258, 32, 1521, -299, -1786, -2836, 1523, 2427, - -835, 3139, -197, 3351, -279, -14766, -1267, 5169, - -1039, -10967, 58, 641, -767, -1193, -591, -716, - -834, 8109, -915, -711, -10427, -1680, -638, 2643, - -850, -258, 10452, 362, -5394, -349, -14727, -655, - 1040, 1722, -10265, 551, -283, 9888, 408, -400, - 5980, 1878, 781, -923, -667, -789, -348, 624, - -260, 14515, -804, 1721, -2, 5356, 1802, 1218, - 498, 1871, -988, 16295, 4163, -2342, -4290, 3121, - 3269, 112, -3492, 1124, -1496, 1863, -1426, -1090, - 1598, -197, 1160, -1660, -1094, 477, -4104, -396, - 1605, 26134, 746, -12876, 2320, -1690, 8626, 39, - 1341, -1254, -1890, 2555, -13996, -1218, 3827, 1216, - -909, -180, 1720, -87, -143, 989, 340, -1426, - -4029, 3141, -9424, 466, -8227, 422, -7379, 2038, - 401, 98, 3602, -1223, -946, 2469, 1159, 727, - -268, 467, 203, -11079, 3850, -3469, -1965, -1857, - -1415, -2477, 3173, 7352, 9483, -5541, 6212, 1886, - -3868, 2728, 577, -5057, 321, 972, -77, 47, - 227, -38, -1037, -222, -347, -341, 1179, -948, - 592, -7485, 2218, -5955, 2698, 11798, 197, 6260, - 1711, 998, 8, -6223, -1184, 1145, -1781, 1376, - 1394, 388, -689, 2279, 6511, 2542, -4903, 3917, - -790, 535, -1903, -4448, 4216, -22, -6715, 5204, - 4807, 3193, -1064, 5403, 4503, -2434, -4296, 1383, - -1514, -4103, 747, 3928, 2987, 9513, 2492, -8691, - -993, -2667, -40, -170, -3116, 611, 2367, 16297, - -1256, -1404, -3462, 466, -524, 5464, 491, 706, - -7491, 2027, 373, -4086, 1620, -7789, 704, 5002, - 1706, 8325, -851, -9883, -3072, 4475, 2696, -8549 -}, - -.shape11 = { - 44, -10592, -832, -413, 612, 530, 379, 753, - 1442, -3006, -858, -1077, -12018, -196, -771, -1142, - -628, -2938, -439, -3323, 20, 12513, -2462, -1270, - -57, -8417, -690, 790, 276, 2349, -341, -1644, - 230, -2176, -202, -14725, 170, 1725, 3030, 683, - -231, 641, -242, -3252, 110, -1440, 2886, -1467, - -1155, 14395, 297, 52, 240, 3938, 9880, -7555, - -1214, 3351, 129, -1269, -168, 669, 13765, -1289, - -465, 10017, -632, -328, -276, -33, 31, 18883, - -148, -131, 525, 1669, 2288, -203, 868, -660, - 248, -409, -91, 295, -9174, -1484, 929, 2824, - 1097, -3205, -113, 2712, -1544, 527, 1419, -963, - -388, 691, -16791, -84, 72, -3802, -357, 1633, --15182, 62, -6024, -742, -5396, 4470, -198, 1, - 1428, -1691, 18715, 1402, -2539, -375, -8455, -901, - -147, -3274, 9359, -277, -8941, 714, 2834, 2924, - -6326, 907, -123, 10487, -484, -4772, 877, 9840, - -505, -7562, 301, 671, 116, -371, 3740, 359, - 385, -5145, -908, 156, 9639, 3782, -9688, -4214, - -945, -7685, 334, 2185, -1342, 388, -1741, 278, - -231, -912, 905, -1039, 598, 2049, 662, -198, - 22378, 166, 116, -1699, 335, -8380, 1279, 1536, - 14955, 1254, 190, -2519, -608, 364, -561, 5748, - -1178, -923, 3183, -59, 13880, -2530, 241, -564, - -319, -7510, -9, -124, -20346, 305, -25, -400, - 222, -16943, -488, 802, -1685, 3323, -6198, 1000, - -903, -846, -387, 462, 847, 526, 10024, 2020, - 2090, -9563, 1416, 169, -12182, -428, 10388, 869, - 1068, 2201, -1041, -3180, 152, -646, 4, 4017, - -1069, 307, 5283, 3021, -13662, -493, 9, 542, - 152, -2617, -3870, -514, 13497, 1180, -603, 1255, - 2396, 7418, 8902, -11165, -2626, -5719, 1764, 858, - 1105, 1476, -1764, 1969, 977, -1738, -928, -13940, - 1444, -4157, 836, -12243, -369, -256, -15681, 5320, - -5170, -509, 353, -1581, -1455, 965, 716, 209, - -883, -317, -1961, 9128, -8197, 2173, -2434, -1126, - 4066, 1025, -16663, -7013, -147, 1617, -745, -3205, - 1496, 1822, -1199, -2999, 117, 619, -20002, -232, - 142, 3207, 561, -292, -1635, 1035, 37, 2712, - -243, -8269, 305, -2601, 495, 14516, 831, 260, - -54, 4217, 675, -1632, 4962, 793, 1066, 133, - -344, -12428, 95, 6164, -1298, -1860, 3622, -467, - -867, -1178, 11053, 118, -36, -6997, -763, 16019, - 16, 2459, 306, -820, -1135, 847, -709, 928, - -164, -293, -5736, 543, -11548, 5389, -2012, 300, - -228, -1043, 5107, -558, 1187, -140, -13034, -1571, - 740, -4967, -432, -6289, -1778, 3449, -337, -12607, - 344, -3790, -1598, -274, -346, -1494, -108, 325, - -1215, 819, 404, -568, -286, -21364, 15495, -2297, - 606, 117, 10, -193, -972, -292, -573, -1155, - -1289, -1025, 472, 1154, 843, 187, 586, 20569, - -5, -236, -1181, -1092, 700, 891, -603, -601, - 21648, -449, -193, -1103, -298, 2084, -251, 449, - -1414, 17168, -391, 104, -5465, 401, 8839, 781, - 1741, 201, -369, 466, 12358, -636, -945, 3928, - -605, -17445, 5020, -1289, 977, -6202, 1783, -507, - -76, 267, -31, -2731, -1560, -1225, 1348, 11176, - 1669, 754, 1671, -4038, 151, -371, 7283, 243, - 1387, 126, 1007, 1292, -15, 696, 282, -2623, - 1065, -1026, 191, -632, -132, -12957, -32, -1697, - -422, -240, 1352, 10252, 1067, 8296, -1244, -9, - -301, -3014, -249, -372, 10731, 535, 2147, -8959, - 346, -408, -8329, -1905, -48, -8176, 2782, 412, - 1425, -946, -748, 1095, -1370, 9086, -99, -143, - 68, -544, 264, 494, -377, 13, -618, 237, - 193, 3549, 317, -168, -7148, 2351, -244, -13240, - -3355, -2322, -533, 9554, 6906, 124, -694, -901, - -2762, 207, -915, -2520, -143, 8544, -678, -2788, - 12926, 791, 1296, 4861, -1470, 889, 3675, 806, - 290, -11146, 422, 9217, -31, 1608, 140, 3939, - -6903, -276, -704, 2353, -344, -1038, -230, -177, - 670, -617, -129, -857, -8231, 638, -411, -252, --15709, -1218, 210, 288, 542, 533, -9087, -10493, - -624, 1175, 611, -230, 746, 1455, -590, 830, - 1756, -15800, 823, -1077, 788, 1071, 468, -1654, - 660, 983, -9697, -1300, 662, 2053, -281, 12949, - 389, -915, 197, -1742, -4587, 1746, 707, 1625, - 9021, 2204, 759, 1303, -428, -220, 41, -5499, --16080, -193, 443, 443, -78, 889, -561, 5629, - -1073, 7019, 222, 1661, 1190, 1108, 94, 5624, - -3796, 407, -706, -122, 744, 363, 1648, -10896, - 595, 953, 85, -267, 195, 851, 17173, -636, - 243, 907, 2029, -700, 351, 1495, -157, -575, --11664, 1252, 8341, -616, 3708, 5693, -6, -1753, - 1072, 863, -823, -4278, -12043, 750, 597, 3145, - 38, -8140, 3136, 290, 7, 11084, -876, 1842, - 175, 3458, 460, 1615, 11698, -827, 16, -12482, - 428, 411, 2625, -1352, 142, 529, 229, -48, - -965, -145, -592, 655, 499, 22095, 22141, 37, - -1875, 701, 45, 724, 1111, 1631, 262, -252, - -9092, 5325, 408, -637, -612, 647, 1268, 834, - -510, 603, 199, 816, -9904, 9533, -1580, 2669, - 1824, -2092, -701, -271, 7489, 46, -3295, -844, - -304, -226, -260, -692, -5, -527, 37, -49, - -1542, -69, -1087, 20519, 367, 1, 3487, 2535, - -5110, 642, 1223, -2130, -2894, 1752, -1618, 9732, - -1633, 6904, 137, 654, -358, 355, -21, -277, - -68, -188, 132, 530, 372, -315, -11498, 221, - 815, 2480, -1398, -123, 353, 3114, -12025, -1212, - -1111, 916, 6452, -1880, 1867, 307, -66, 1857, - 138, -980, -3088, -174, -41, -393, -656, 847, - 15824, -379, 358, 672, -389, 920, -21145, -393, - 350, -574, 1005, -2083, 26, 79, -203, -7967, - -3302, -5805, 772, -302, 2104, -1240, 13710, 6816, - 2282, -3709, -1512, -81, -2216, -3005, 444, -795, - 751, 2163, 20751, 780, 542, -480, 624, -425, - 769, 2474, -5903, 399, 10564, -112, 69, -1409, - 1885, 2339, 67, -620, 196, -2432, 6046, -1673, - 6512, 809, 7904, -516, 4278, 223, 359, 16512, - 1224, -480, -505, -735, -502, -593, -4565, 1914, - 122, -531, 1442, 464, 69, 292, 410, -581, --19848, 1059, 132, 1392, 5917, 705, -7706, 2496, - -1487, -791, 11939, 185, -265, -2412, 630, -8028, - 1434, 10315, -1541, -3756, -2403, -1918, 1050, 8057, - 234, 13546, -92, -2172, -671, 11631, 103, 116, - -171, -4604, -267, -602, 15, 454, 6859, -2151, - -8707, -1664, 61, 2518, -969, 903, 1209, -1435, - 13531, 590, 236, -821, 598, 1186, -7690, 134, - -1005, -18177, -148, 519, 900, 951, 406, -3584, - 47, 9439, 1418, -797, -3353, -703, -1798, -1244, - 291, -2784, 14612, 2029, -161, 1040, -4130, 3064, - 1721, -2898, 269, 3367, 1379, 14359, -690, -655, - 2010, -4935, -681, -2606, 11651, 748, 101, 13593, - 629, 28, -540, -854, 1405, 558, -8785, -1016, --13043, 121, -556, 4959, 1694, -720, -138, -3897, - 182, 1938, 844, 919, -683, 12042, -1101, -155, - -1375, -1509, 11, 220, 821, 21721, -367, -634, - -1468, -174, 1002, -1203, 318, 11672, -2114, 2472, - -1701, 5932, -661, 1094, 2500, -5609, 254, 437, - -911, -1611, -8005, 217, -1139, 1321, -10713, -2183, - 1163, -890, -622, 12820, 1021, -13578, 1040, 3216, - 592, 686, 737, -2881, -1693, 3995, -455, 4666, - -4124, -9316, 2061, 10645, 271, 264, -6829, 641, - 2061, -6683, -512, -747, -9131, 2445, 343, -9944, - -2888, 607, -10855, 871, 418, 504, 936, 1079, - 273, 400, -17752, -391, -1543, -6193, 1482, 737, - 2096, -982, 167, 972, 336, 1063, -1272, -1602, - -1907, 9, -191, -15207, -119, 4047, 1479, -1405, - 526, -18462, -627, -1996, -1022, -1544, 312, 7972, - -227, 797, -5204, -2160, 391, -423, 257, 3836, - 442, -1931, 22, 143, -203, 362, -73, 15679, - -289, -1445, 577, 858, 11408, -1970, -1022, 1550, - 882, -3699, -2697, 3978, 600, 86, 3858, 8683, - -7681, -4856, 4051, -1321, -587, 46, -499, -354, - -655, -15717, 67, 490, -2670, 474, -1374, 5601, - 60, -17615, -808, 87, 367, 579, 1057, 1020, - -394, 1181, -189, -10846, 763, 2635, 282, -3279, - -866, -15257, -449, 112, -15577, 227, 269, 13964, - -1273, 1513, -1487, 195, 319, 2527, -286, -5883, - -5360, -959, 2791, -3335, -945, -1985, -903, -11418, - 8525, 669, 6106, 153, -1169, -1198, -553, 7037, - 528, -4237, 717, -214, 1824, 10108, 961, 9077, - 1899, 10407, -207, -29, 355, -6794, 111, -13627, - 1361, -3577, 291, 4534, 2209, -1579, 109, 523, - 456, 10990, 31, -448, 385, 1481, 2, 15266, - 798, 5759, 860, -16424, -1315, 1631, -456, -977, - -180, -2593, 1191, 5959, -32, 8112, -506, -7766, - -1871, -15310, 662, 196, -20401, 925, 446, -2035, - -620, -686, -249, -2517, 423, 703, 633, 828, - -182, -37, -406, -149, 821, -22255, 652, 522 -}, - -.shape16 = { - -786, 193, -15441, 200, 1050, -16545, -41, 329, - -869, -170, -858, 2725, 217, 447, 2107, -23, - -387, -10280, -383, -320, 387, 16012, -79, -967, - 3528, -2123, -537, -636, -1761, 949, 100, -17, - -446, 261, 22527, 331, 26, -87, -206, -2292, - -1178, -164, 598, 147, 889, -14487, -2823, -1280, - -1892, 33, -1763, 993, 4807, -953, 2181, -588, - 59, -296, 218, 291, -104, 495, -1092, 2232, --14904, -983, -2919, 795, -17207, -2045, 2988, 597, --10312, -718, -2196, -5822, 847, 1304, -757, -4714, - -148, 831, -734, 806, 4348, -308, 244, 566, - 2706, 604, -748, -864, -568, -219, -128, -688, - -218, 110, -29289, 482, 76, -1447, -142, -417, - -253, 8124, -19775, 990, 4546, -1012, -8082, 133, - -1612, -2243, -3788, 1568, -2892, 852, -1642, -3479, - -23, 1300, -564, -1037, 249, -14533, -43, 321, - -680, 10, -417, 23426, 397, -108, 1843, 180, - 11976, -9613, 353, 3768, 130, -1035, 4340, 218, - 596, -224, -779, -1680, 1326, 152, -971, -9725, - -355, 5328, -459, 16242, -438, 926, 6210, 1912, - 769, 2621, -148, -1008, 517, 341, -3594, -965, - 11383, -874, -16949, 1167, -3371, -1655, 586, -132, - 3990, -770, 211, 246, 514, -166, -734, 30408, - -258, -521, -20, 339, 499, -2572, 2110, 272, - 1357, 123, 2841, -320, -31, -444, -501, 215, - -42, 595, 108, 484, -223, 937, 475, -72, - -319, 75, -205, -978, -9155, 145, 2020, -3, - 2438, 4046, -1281, -875, 1532, -598, 12288, 369, - -2046, 343, -778, 1769, -2589, -641, 17437, 1793, - -592, -1954, -1607, 6184, 3440, -512, -2710, -1330, - -127, 8765, 83, -243, -315, 709, 256, 1176, - -1198, -463, 970, -302, -568, -997, -1022, 159, - 11008, 27, 13074, 1523, -3239, 2330, -4808, 6115, - -9933, 1449, 2153, -3111, 1780, -731, 121, -881, --14289, -265, 566, -611, -253, -2965, 250, -105, - -66, 2570, -1922, 2712, 1907, -2025, -454, 173, - 1463, -29, -31955, -113, -1751, -3353, 254, 1001, - 6781, -29, -639, -1289, 288, 498, -21505, 48, - 109, -2151, -223, 1360, -3430, 658, -4185, -1706, - 1244, 1899, 124, 12, -35, 289, 382, 433, - 261, -131, 54, -646, -280, 86, 180, 153, - -169, -20242, -95, 734, -524, 77, 102, 8468, - -421, 29, -3, 51, 1526, -600, -264, 355, - 1949, -985, -291, -86, 10212, -789, -393, -182, - -51, 946, -16716, -954, 1179, -2745, -509, -4774, - -587, -608, 7657, -509, -388, 987, 109, -218, --17579, -524, -467, -1643, -444, 1430, 2541, -124, - 1785, 27, 7905, -73, -3135, -1241, -254, -2114, - 1175, 780, -50, 4055, 535, 438, 32, -113, - -260, 81, 1102, -59, 29188, -48, 212, -29, - -344, 559, 856, -483, 608, -40, -1498, 112, - 10374, 1198, -434, 4053, 1286, 236, 1823, 16046, - 592, 1583, 78, -5243, 1311, 456, -1342, -546, - -353, 13289, -333, -529, -20859, 183, -167, -1368, - -338, -690, 4248, -205, -666, -634, -1653, 1174, - 234, -18622, 891, 284, -2632, -1516, 289, 11242, - 727, 133, 284, -323, -1370, 908, -13169, -412, - 1155, 410, 610, -3072, -8220, -637, 242, -647, - -2072, 16041, 2292, -8009, 351, -3137, -3075, -1051, - 4569, 125, 23, 1281, 2487, 520, -209, -688, - 205, -1248, 246, -601, 533, -12209, -2298, 826, - -2762, 45, 15123, 721, 1128, 798, -676, 349, - -153, 263, 89, -854, -24, -350, -227, 157, - 587, -240, -185, 663, -32328, -148, -204, -2396, - -597, -344, 8104, -280, -375, 264, 648, 741, - -290, -321, 263, -569, -381, 167, 1757, -29636, - 30, 393, 398, 590, -242, 81, 1601, 3683, - 787, -336, 675, -1080, -713, 261, 18420, 1760, - 609, -4610, -551, 2790, 19807, 1347, -125, -9412, - -261, 548, 1056, 179, -917, -181, 12637, -267, - 621, -11908, 1366, 76, 5875, -742, 394, 155, - -370, 2481, 46, -15392, -344, -9750, -1353, -2242, - -1685, -1286, 2320, -2176, -1729, 705, -1582, 1590, - 1603, 21129, -3555, 2192, -883, 3438, 233, 1965, - -537, 399, -4818, -4085, 559, -292, 1290, -2700, - 10, -301, -1865, 226, 52, -1346, 306, 316, --12281, -525, 285, 9631, -2, -849, 1620, 128, - 176, -1021, -473, 7929, -133, 2459, -33, -1517, --22047, -2300, 98, -3513, 334, 4617, -193, -1309, - -1279, 738, -443, 95, 406, 660, -705, -54, - -39, 26396, -766, 249, -2423, 7759, -689, -3909, --17404, 65, 1849, 945, 15907, 1386, -433, -831, - -6349, -3919, 1870, 8096, 311, 15043, 1709, -315, - 1288, 7522, -215, -5072, 1246, -1486, 3762, 4526, - 1517, -1936, -543, -263, 771, -10215, -425, -5098, - 59, -266, -1012, -380, -2131, 630, 405, 665, - -4550, 1403, 8, -46, -879, 398, -532, -185, - -286, 921, -65, 378, 669, 174, -15280, 91, - -776, 8480, 2463, 184, 2065, -666, -561, 4122, - 594, 732, 4007, -852, -71, 194, -126, 1765, - -1570, 968, -257, -288, 950, 27482, -333, 370, - -1429, 285, 558, 11245, -135, 565, 1296, -261, - -62, 600, 1455, 1457, 820, 357, -1203, 169, - 16611, -893, 359, 231, 418, -547, -95, 3866, - -511, -6344, -205, 923, -239, -16205, -1619, 217, - -3362, -6342, -1551, 649, -492, 264, -55, 170, - 16992, -91, 306, 43, -2770, 582, -1740, 77, - -882, 268, -515, -45, -6093, 24, -5596, 9034, - 284, 3211, 846, 1158, -1118, -604, -514, 1402, - -493, -938, -3892, 242, 643, 1421, -434, -406, - -102, -88, -11733, 161, 518, 978, 1508, 248, - -1036, 1407, -396, 293, 1154, -1435, 495, 8243, - 20, -845, -5373, 659, 2366, 29148, 145, 603, - 4088, -251, -2841, -2526, 20682, -1357, -2454, 660, - -125, 347, 11772, -113, -357, -2181, -1234, 1908, - -432, 16555, -248, 822, 15516, -158, -653, 1573, - 93, -2730, -1111, 958, -1550, -1153, 17, 610, - 781, -372, -1640, 144, -135, -1171, 22140, -427, - -26, 690, -800, -1497, -300, 5438, 390, 11304, - 9253, 1098, 5564, -9, 3856, 965, 2016, -12797, - 1687, 915, 3687, 539, 2496, 702, -1324, -71, --12955, 7456, 4626, -848, -1815, 831, 2151, 7921, - -3000, 123, 1189, -1489, 222, 4973, 1936, 54, --10527, -1238, -1157, 628, 14112, -2164, 1478, -985, - -4102, 635, 225, -311, -609, -1015, 301, 507, - -85, 443, 186, -552, -711, -16988, -1327, 220, - 565, -1673, -543, 18633, 331, 127, -342, 22, - -77, -360, -439, -501, -1848, -1147, -483, 1133, - -351, 41, 908, 502, -658, 474, -430, -11348, - -1, -531, 451, 709, 227, -978, 348, -265, - 269, -376, 2511, -188, -111, -387, 809, 1009, - 1570, -755, -11463, 667, -895, 446, 276, 145, - -513, -117, -462, -340, 1457, -963, 191, -788, - -150, -979, -507, -27540, 122, 368, -73, 10051, - -465, 642, 507, -6828, 241, -5025, 1598, -1174, - 2373, -2272, -1910, -108, 15, 166, 2, 10518, - 933, -12716, 510, 778, -424, 414, 4899, 759, - 862, -438, -886, 457, 304, 23639, 136, -203, - 478, -565, 244, -541, 2419, -773, 1107, -217, - 1579, -1037, 476, -97, 995, 17973, 161, 16466, - -178, -718, -1606, 947, 1991, 2266, 1249, 2708, - -611, 1424, -142, -53, 36, 509, 26159, -144, - 357, -37, -234, 587, 311, -509, -1639, -332, - -1618, -382, 302, -8657, -68, -30, 545, -12834, - 158, 158, 135, 621, -354, -871, 451, 1220, - -31, 2, -13414, 60, 3, -380, 541, -44, - 552, -366, 155, -462, 61, -232, -15426, 317, - 688, 1121, 2933, 7151, -168, -9167, -2521, 745, - 2792, -10448, 569, -3823, 630, -4626, -95, -416, - 828, 259, 72, 171, 635, -250, -128, -426, - -153, 260, -771, 314, 235, 26, 32281, -343, - 751, -1443, 324, -684, 1900, -1334, 2022, 30, - 1073, -2406, 2080, -485, -320, 15328, -860, -529, --16444, -219, 1736, -149, -160, -828, 1089, 413, - 241, 3720, -90, 146, 1109, 243, -321, -256, - -68, 88, -50, 571, 1179, -25030, 104, 929, - 35, 529, 117, -13724, 734, -1344, 456, 5586, - 1566, -12573, -840, -1617, -2494, 1791, 1901, 3066, - -2159, -414, -3856, -9894, -1608, -657, 15355, -773, - -9217, -658, -972, 4730, -2986, -3478, -757, -1416, - -3702, 18089, 629, 7061, 124, 5843, 158, 19017, - -2204, -6976, 1629, -5657, 1101, -1859, -1425, -548, - -1132, -5043, 1074, -592, -196, 1902, 22705, -1228, - 214, -685, -2036, -2368, -315, -914, 533, 218, - 1091, -627, 2031, 13922, 104, -450, 4494, -498, - -361, 24734, 623, 1029, 2437, -1123, -5092, -6551, - 438, 16562, 375, -13102, -193, -2004, 3556, 179, - 1832, 2086, 798, -534, -195, -7105, 796, 3969, --12269, 1570, 4273, -2692, 1240, -2901, -2045, -2453, - 372, 613, -548, -245, 687, 258, -8964, -1500, - -1519, -993, 17571, -357, 916, -1202, 1752, 2081, - -536, -3185, -1062, 19335, 721, -9958, 1052, -872, - 248, -3133, 456, 1641, 149, -11, 2955, 310, - -3178, -18823, 497, -971, -6587, -1380, 351, 106, - -43, 607, -4754, 213, 1030, 5377, -804, -2557, - 850, 1081, -706, 1325, -14922, -794, -14060, -1953, - 891, -3296, 329, -510, -1126, 1113, 1753, -411, - 1769, 429, -185, -1020, 194, -106, 11470, -591, - -272, 422, 337, 524, -150, 822, 51, -120, - 7193, 802, 640, -140, -42, 28125, -1020, 285, - -465, 3195, 69, 482, -953, 262, -7672, -373, - 5158, 5625, -3003, 550, 5371, 5619, -2200, 5392, - -804, 135, 1300, -3610, -23, -433, 13503, 224, - 911, -14421, -502, -2151, -1667, -1933, 2888, -277, - 547, -989, 3115, -32, -680, -164, 804, 412, - 62, -154, -190, 156, -10938, -360, -88, 843, - 328, -773, -267, -12668, 856, 1496, -243, -586, - 736, -2175, -677, -3069, 7480, -1764, -4024, -2569, - 1805, 194, -6814, -1135, -237, 2682, -156, -890, - 1285, 368, 1802, -683, -163, 1191, -13063, -496, - -335, 17482, 746, 818, 48, 21419, -598, -1753, - -1169, -2135, 40, -9114, 592, -3912, 1980, -264, - -304, 8138, -185, 286, -3024, 48, -1630, 909, - 661, -662, 18085, 240, -201, 69, 192, 305, --22167, 692, -1135, -996, 398, -74, 18553, -958, - 1223, -5578, 508, -352, 1234, -450, 497, 780, - 79, 51, -221, 255, -26, 13352, -170, 231, - 590, 169, -733, -812, -65, -219, -20939, 200, - 35, -177, -454, 632, -267, -407, -120, 623, - -176, -664, 715, -23, 318, 148, 1125, 16, - 709, -21687, -230, -413, 1398, -1235, -283, 1615, - 175, -299, 349, 400, -112, 21762, -665, 364, - 1089, 1303, -54, 523, -381, -1312, 48, -886, - -1260, 408, 415, -8349, 7115, 180, -774, 3508, - -971, -255, -195, 81, -2674, -977, -355, -1500, - 178, -2081, -4432, -1014, 340, 5818, 138, -106, - 16917, 1203, 349, 3271, 961, 363, 6008, -6043, - 3736, -730, -4201, -514, -6131, -68, -14935, -1781, - -3898, -40, -18944, -461, -1694, -1269, -755, -81, - 2369, 484, 531, 14114, 85, 32, -10142, -142, - 600, -2374, 375, 675, -2663, 155, -947, 6427, - 11476, 1253, 5049, 1063, 2003, -1608, 2463, -2168, - -1128, 1079, 383, -996, 368, 1208, -3554, -959, - 4596, -1209, -4154, 1270, 9365, -2775, -1751, 998, --20023, -347, 1505, 218, -142, 342, -128, -523, - -159, 75, -467, 257, -133, -142, 712, -621, - 428, -29584, 13, 402, -455, 119, -483, 1121, - -461, 960, 807, -46, 297, 14856, 221, -356, - 221, 15037, -4744, -2555, 447, -1418, 1464, 1391, - -1404, -5812, 512, -2321, 9882, 242, -2298, -137, - -849, -3182, 9394, 1412, 1052, 1369, -904, -494, - -231, 1113, 1087, -13317, 768, -1178, -3011, 24, - 229, 164, -10170, 328, 308, -591, 213, -543, - -82, -790, -875, 794, -558, -7651, -573, 1266, - -2084, 2275, -187, 97, 384, -11830, -185, -472, - 1365, 11636, -1405, 360, -487, -440, -1820, -349, - -293, 285, 25, -139, -415, -540, -108, 1136, - -673, 230, 19202, -545, -542, 919, 1221, -518, - 196, -21900, 795, 115, -16, 459, 3339, -347, - -346, -186, -695, -267, -714, 185, 266, -1218, - 120, -249, 233, -110, -30412, 285, 219, 2256, - 536, -442, 673, -1487, -477, -60, -1806, 183, - -7195, -577, 2230, -7594, -3230, 65, 22963, 111, - 390, 7134, -3716, -5123, -475, -32, -98, -466, - -118, -43, 74, -1071, -902, 1714, 4004, 26, - 97, 1680, 423, 252, 9667, 550, 354, -222, - 19, -224, -807, 365, 593, 363, -851, -28, - 553, 238, -481, 769, 279, 18367, -462, 286, - 4825, -141, 500, 20383, 1618, -31, -514, -2484, - -327, -8506, -705, -872, 530, -9997, -36, -431, - 2824, 3185, 1712, -318, 9513, -10065, 614, -503, - 389, 12830, -113, -15, -1007, -523, -1293, -2102, - -543, -1157, -583, 1228, 262, -674, -1847, -242, - 299, -12025, 547, -591, -9173, 275, 412, 2493, - 997, 1229, 1982, 27554, 245, 106, -1320, -153, - -423, -955, -449, 392, 824, 796, -1181, 1640, - -884, -70, 8789, 10021, -1806, 1019, 90, 1494, - 2071, -911, -1159, 212, 2207, -994, -2500, -497, - 92, -11544, -398, -774, 1474, 32, -671, -171, - -1250, -249, 1161, -654, -205, -36, 1733, 763 -}, - -.shape22_1 = { - 987, -6, -621, -220, -2438, -387, -535, -23, - -934, -68, -4985, 575, 483, 7243, -1075, 917, - 1739, -1832, -580, 1564, 131, -180, -1271, 3672, - 161, 1040, 1737, 2719, 1101, -185, -1410, 221, - -422, -8675, -753, -401, -5388, 13, 762, 1378, - 1113, 1768, -177, 3397, 2162, 267, 2261, -156, - 1708, -848, -79, -1819, -3159, -5548, -745, 7208, - -1039, 7555, -134, 2661, -2112, 2270, -1991, 441, - -6248, 246, 166, 2092, -1402, -242, -13600, -539, - 391, 2395, 11001, -981, 10906, -403, 823, 1647, - -294, 93, 504, -5448, 1213, -1849, -3077, 790, - -841, 12812, -11266, -1882, -805, -274, 1968, -49, - 1189, -80, -281, -40, 409, 2423, 581, -1362, - 207, -869, -589, 3294, -318, -4592, -476, 1014, - -135, -17999, -194, 807, -2946, -222, 44, -514, - -4407, -1201, 1155, -235, 98, 4432, -342, 2386, - 1402, -956, 3357, 1959, 4790, -139, -3494, -4280, - -589, -8422, 363, -746, 640, -360, -1007, -1100, - -7989, -12630, 1006, -1608, -864, -226, -915, -2032, - 1274, 596, 1864, 1067, 1597, 460, -2003, -5560, - -8020, 2354, 379, -3151, 44, 7024, -698, -2901, - 4976, 927, 1223, -93, 172, 189, 6639, -6082, - -726, -524, -3068, -3802, 16, -1039, -105, 2333, - -350, -306, -379, -832, 1282, 56, 3529, 562, - -603, 5954, 294, -1265, 8045, -3990, -169, -123, - -3267, 572, -879, 1562, -1185, 799, -9589, 407, - -590, 65, -2848, 433, -5547, -19, 7180, -7904, - -392, 323, -448, -4481, -3773, -5286, 1957, 226, - -2040, 3292, 2987, -1704, 2835, -149, 1435, 823, - 1775, -2769, 146, 234, -131, -15, 268, 37, - 139, 22, -196, 91, -3503, -5421, 24, -280, - 58, 370, 655, 1412, 113, 306, 16404, -234, - 315, -957, 72, -1129, 1993, -18719, -1415, 1349, - 2340, 541, 313, -1360, 31, 1441, -78, -9905, - -393, 367, -712, -2009, 372, -297, -123, 303, - -458, -323, 46, 8701, -1301, -8768, -43, 1818, - 212, -543, -5077, -8037, -2536, 702, 792, -381, - -272, 1941, 6320, -1871, -13938, -262, -2063, 108, - -861, 485, -440, 768, 5665, -302, 305, -13784, - 2889, -127, -94, 145, 1308, 7911, -8376, -643, - -596, 1357, -943, 1329, -84, -62, 1651, 391, - -2295, -5456, -357, -4611, 1361, 3961, -295, 642, - -698, 8614, 1613, -526, -120, -205, 17, -20171, - 1252, -261, 535, -1244, 92, -315, 878, 380, - 157, 3217, -493, -773, 513, -510, 11304, -899, - -27, 398, -6386, 659, -1001, -2737, -13295, 1219, - -1014, -193, 445, -2393, 344, -25, -599, -2848, - 884, 94, -11, -564, -36, 9939, -3530, 462, - -942, 10089, 824, 2994, -293, 71, 10167, -457, - 711, -964, -2128, 2530, 160, -2558, 2451, 1654, - -3828, 1560, 879, -1023, -8354, 851, -77, -112, - 19572, 2010, -1077, -1329, -1282, 1277, 252, -5622, - 4617, 58, -2315, -459, -1249, 92, 708, -737, - -3323, 182, 1557, -657, 546, -447, 19117, 1645, - -336, -26, -2041, 5926, 4746, -1866, 3922, 2798, - 5320, 7, 470, 842, 229, -567, 742, -3306, - 659, -871, -226, -2593, -1003, -1373, 595, -768, - 20658, 944, 1228, 279, -1531, -618, 361, -4019, - -343, -351, 7143, 293, 92, -2713, -269, -30, - -332, 4093, 216, 239, -563, 1943, -944, -2268, - 70, -209, 440, 1493, -446, 491, -362, 25, - -331, 433, -1585, 173, 1126, -3614, -234, -2649, - 1181, -641, -160, 3727, -841, -2134, -1396, -5758, - -14, 364, -4651, 1151, 194, -5234, 5878, -1348, - -1388, -233, 3810, -860, 9479, -24, -6616, 1387, - -455, 447, -224, -2997, 12, 3502, -73, 470, - -9170, 1677, -740, -592, -1638, 675, -93, -17842, - 1750, -847, 993, -2393, -49, -2029, 1940, 588, - 475, -3467, 55, 5087, 2989, 380, 915, -2782, - 2418, 11303, 1098, 1009, 1372, -5780, -303, 1451, - 972, -7433, -571, 1661, 64, 10265, 1541, -50, - -964, -738, -253, -3105, -695, -546, -775, -18971, - -3094, -2379, 738, 1625, 623, 1073, 782, 723, - -3417, -578, -189, 4108, 1115, -1222, -9102, -4736, - 347, 946, 322, -3699, 193, -15139, 367, 969, - -788, -694, -620, -26, -16, 4, -478, 20792, - -1175, -231, 2566, -1270, 162, 181, -1451, -5370, - -2429, -8910, -3794, -5807, -1655, 248, 4432, 1393, - -2451, -2706, -744, 687, 842, -1281, 2960, -2348, - 153, -1671, -1433, -1250, -1096, 2501, -5393, 4266, - -1098, 880, -1215, 817, -443, 10053, 705, -689, - -2679, -1205, -3302, -809, -918, -1005, 124, -329, - 108, -52, -5305, -419, 128, -8137, 1427, 387, - -235, -2582, 190, -173, -1031, 2672, -985, 3309, - -5927, 7327, -8463, -2, 6035, 743, 552, -14, - -580, -68, -11886, 476, 61, 1172, -529, -988, - 871, -776, -332, 20870, 384, 7795, -10830, 723, - 1690, -519, 962, 663, 1300, -465, 47, -3578, - 56, -8131, 2041, -8524, -1303, 6349, 1903, -6726, - 1156, -224, 1286, -2355, -3415, 985, -502, -2474, - 49, -2789, -3616, -1707, 3363, -140, 1702, -1919, --11518, -404, 62, -6933, -1187, 10830, 132, 284, - -639, 1349, 2367, -311, -626, 745, 5660, -152, - -121, -5236, -481, 5889, -1263, -8443, -33, 936, - 423, -117, 111, -1055, -103, -321, 1286, -611, - 777, 827, 422, -162, -6767, -241, 289, -441, - -1344, 2706, -1260, -4649, -847, -16107, -263, -1826, - -521, -760, 942, 309, -2692, -4835, -853, -806, - -276, -322, 5647, 1219, -433, -346, -1171, -1028, - 191, -406, 444, 33, 272, 3502, 475, -2178, - 1915, -290, -1037, 833, -695, -121, 415, 556, - 1025, -2268, 334, 2847, -1768, -389, -14034, -3878, - 836, 4605, -1985, -359, 1478, -149, 823, -926, - -828, 135, 469, -645, -328, -94, -178, 2820, - 781, -2361, -5778, 1312, 3918, -1, -3654, -942, - -2495, 615, 210, -17006, -396, -445, 382, 563, - -1738, 95, -9107, 4869, 348, 527, 5688, -145, - -1195, -2367, -749, -187, 6697, 27, 347, 12571, - -64, -427, 3765, 824, -1216, -1126, 5997, 586, - 110, -294, -240, 1646, -186, 1360, 413, -6459, - -1535, -3208, -520, -621, 8613, 1098, -19, -199, --11446, -657, -353, 906, 678, -19375, -126, 1688, - 644, 1231, -2151, -742, 320, -68, -12426, -2750, - 1483, -1603, -2639, 3028, 2662, -140, 5405, -917, - -407, 207, 9392, -569, 931, -124, -82, 6370, - 477, -12264, 1093, 3427, -732, -50, 232, -67, - 609, 1615, -463, 583, 1808, 1499, -509, -24431, - 231, -72, -192, -333, -7554, -342, -9036, -304, - 136, -15450, 1333, -1147, -1488, -1440, 75, 63, - 747, 297, -251, 30, -301, -1810, -86, 544, --10446, 1300, 10468, 218, -2471, 1982, 423, 3046, - -1112, -657, -104, 10671, -46, -10953, -6205, -1275, - 1972, 937, -75, -330, -529, -2581, 1510, -1881, - -1372, -1725, 14541, -560, -884, 946, -307, -5031, - 7798, -190, 720, 1525, 29, 868, 1238, 372, - -462, 2467, -2661, 2721, -1514, 723, -2782, -494, - 240, -7147, 587, 751, 1613, 11054, 1074, 275, - 972, -970, 27, -75, 24, -9, 163, 88, - 21, 87, -78, -743, -128, -2336, -235, -743, - -3918, -333, 1088, -195, -166, 782, -119, -3263, - 604, 2155, -258, -1282, -129, 43, -5124, -472, - 685, -14243, -1294, -99, -1922, -284, -422, -1112, - -3194, -1977, 1448, -419, -7172, 20, -70, 2102, - 0, 278, 1882, -10005, 1612, 6020, 71, -141, - 1027, -43, -864, -448, -21257, -336, -2090, 5207, - 674, 722, 1030, 1367, 1963, 6057, 984, -1087, - -3690, 47, -61, 104, -81, 895, 22, 728, - -191, 3219, 5228, -27, -802, 1438, -9026, -1352, - -581, 912, -664, -23, -522, -912, 178, -603, - 571, 574, 406, 564, 175, -405, -2965, -1072, - 1749, -957, -402, 9431, 1649, -409, 291, 5765, - 808, 6754, 727, -37, -254, 1530, 213, 3253, - 357, 371, 45, -1276, -12432, 2799, -1924, -176, - -1107, -183, 198, 3662, 20, -1166, 2507, -3484 -}, - -.shape22_2 = { - 1688, -307, -590, 971, -3616, -1632, -218, 1861, - -1479, -367, -6584, 487, -951, 10808, -232, 444, - 89, -1216, -1577, 1283, 249, -3, -3646, 2205, - -1116, 2630, 2110, 3193, 270, -189, 78, -826, - 1010, -10520, -370, 1234, -5604, -262, 1277, 1440, - 2225, 2466, 305, 2469, -740, 120, 3184, 2125, - 1185, -3230, 1597, -1670, -8283, -9857, -129, 8932, - -1355, 8755, 707, -256, -135, 423, 1543, 1782, - -4875, 403, 373, 1570, -183, 782, -9617, -2539, - 1090, 523, 6929, -1226, 10329, -278, -999, -260, - -1810, 666, -463, -6100, 2040, 256, 532, -1475, - 383, 13137, -10953, -2226, -1243, 1584, -2348, -809, - 3602, -816, 194, 480, 84, 2297, 344, -5181, - -6243, -2616, 2093, 7112, -2373, -1346, 291, -372, - -863, -16911, -1878, 378, -826, 579, 737, -468, - -2288, 264, 634, 108, -254, 4717, -1286, 2885, - 986, -4944, -98, 2007, 991, -2252, -2887, -6141, - -605, -10474, 896, 6, 235, -407, -70, 478, - -8392, -10870, 575, -672, 103, 320, -179, -229, - 445, -380, 1124, 3271, -1327, -275, -239, -10381, - -9102, 1361, 96, -1255, -277, 9316, -415, -2258, - 8992, -117, 1625, -704, -980, 752, 9133, -8792, - -423, -272, -865, -2285, 443, -2014, -2592, 3180, - 1198, 2570, 3360, -7090, 3311, 697, 2229, 46, - -472, 6984, -140, -780, 10391, -1078, 48, -564, - -5073, 1576, -826, -483, 952, 1099, -11536, -652, - 375, 440, -7319, 2646, -2089, 2804, 3795, -6704, - 251, 811, -1224, -1976, -4943, -6671, 780, -2856, - -7907, 2447, 3755, -135, 1127, 328, 553, 3450, - 351, -5054, -5, 1077, 109, -254, -391, -511, - 404, -61, 510, 395, -6044, -7454, 364, -575, - 65, -410, -1921, -248, 128, 311, 17131, -2135, - -563, -884, 2356, -3951, -1176, -16695, -1534, 1977, - 626, 2478, 1554, -1070, 38, -551, 370, -11053, - -331, 1062, -1385, -1681, 1028, 3350, 239, -76, - -156, 49, 397, 7060, -2834, -6527, 22, 1920, - -951, 356, -7674, -8903, -120, 317, -303, 160, - 530, 4611, 1083, 514, -12207, -283, 1413, -848, - -645, -432, 0, -192, 4780, -3485, -1192, -10574, - 1274, -3057, 475, -188, 183, 7865, -11214, -268, - 491, 1422, -28, 149, 515, -1651, 670, -450, - -958, -4288, 567, -182, 668, 4069, -213, -1176, - 148, 8854, -151, 474, 599, 1297, 237, -19186, - 2993, -482, -591, -1322, 25, -628, -828, -203, - -1500, 5519, -84, 723, -1137, 1217, 13045, -707, - -372, -200, -4142, -790, 188, -6760, -8288, 766, - 366, 444, -517, -2679, -1470, -61, 161, -3734, - 3053, 2012, 439, 627, 524, 5538, 549, -473, - -2244, 8399, -6395, 5811, 851, 58, 11376, -6, - -337, -689, -1510, -690, -388, -3587, 2665, 3371, - -1850, -953, -513, 581, -10296, 548, 1092, 565, - 18045, 215, -1486, -1270, 450, -880, 407, -6547, - 8393, 206, -515, -1565, -219, -1872, 1479, 382, - -569, -5002, -1247, -45, -740, -1791, 17177, -1210, - 761, 132, -1627, 4970, 5563, 722, 5614, 430, - 5659, 139, 1193, 1513, 1144, -1319, 561, -5145, - 1010, 199, 656, -3958, 3544, -1758, 810, -1578, - 15976, -139, -1035, -416, -543, -418, 2824, -6541, - 94, -673, 11741, 426, -15, -5280, 780, 1795, - -4616, 8192, -297, -206, 883, 2369, -395, -4266, - -3120, -199, 985, 1240, 352, 232, -170, 176, - 413, -495, -1399, 754, 618, -6103, -179, -2546, - 965, -1362, -806, 838, -3912, -1346, -3135, -937, - 219, 307, -3509, 1210, 2381, -7923, 6358, -885, - 2902, 284, 2560, 1789, 6878, 6, -4418, -2206, - -1091, 1840, -118, -2659, 1008, 2192, 1651, 1363, - -7772, 1252, -1200, 133, -757, 501, -98, -17197, - 98, -543, 1743, 621, -809, -1950, -793, 1168, - -743, -7124, 166, 7875, -4466, 356, -1430, -467, - 8589, 9931, 520, -866, 1945, -599, -434, 113, - 589, -3456, 597, 6076, 1114, 9660, 1532, 2073, - -138, -721, -1030, -1309, 625, -4040, 1211, -18836, - -3963, -4468, 197, 600, -1004, -816, -560, -476, - -2160, -2, 26, 8162, 1057, -178, -11739, -1882, - 1000, -227, 109, -1852, -1163, -17143, 140, -718, - -1150, 33, 1397, -45, -205, 153, -1494, 20509, - -51, -904, -599, 1915, 884, 504, -1819, -4487, - 1252, -1259, -2200, -5601, -448, -686, 5778, 873, - -4282, -533, 295, -450, 1422, 2393, 3267, -3911, - 249, -3605, -3190, -1096, -2422, 274, -1918, 4070, - -206, -432, 1919, -645, -275, 12954, 311, 1479, - -2664, -852, -4809, 1102, -375, 20, 1659, -1179, - 1199, 44, -5590, -1112, -566, -11369, -125, -871, - 158, 1208, 265, -519, -405, 2439, -1129, 1827, - -9461, 8548, -1606, 380, 4924, 662, 1314, -391, - -2024, 827, -13381, -198, -142, 1600, 3329, 125, - -672, -220, 557, 18642, 60, 7296, -10472, -712, - 1188, 808, 64, 479, 555, 264, 394, -611, - -810, -7943, -235, -6889, -1575, 1320, -381, -7414, - 1740, -744, 369, -626, -6899, -2144, -593, 668, - -351, -3756, -5143, -1814, 806, -475, 588, -507, - -9088, -629, 154, -6945, -1105, 10658, -435, 384, - -757, 1183, 3806, -747, -378, 535, 10224, 626, - -866, -1931, -1484, 5818, -750, -9628, -250, 589, - -653, -198, 104, -934, 1207, 46, 960, -1032, - 4236, 4471, -2896, 1551, -7714, -1921, 746, -671, - 5114, 5482, -522, -3344, -1905, -9220, -663, -1355, - -611, 65, 1368, 628, -1276, -6780, -2623, -661, - -117, -437, 5507, 3205, 928, 537, -9487, 80, - -102, -538, -277, 863, -1421, 6054, 1227, 696, - 3582, -508, -1757, 145, -1705, -1201, 4157, -3314, - 2291, -834, 821, 552, -724, 513, -9730, -8944, - 1913, 501, -216, 716, 2766, -823, 2535, 314, - 1774, -3372, 235, 244, -1216, -710, 689, 6736, - -52, 218, -8382, -444, 920, 569, -4890, -2050, - -612, 1708, -481, -15500, -2878, -691, 538, -125, - -81, -862, -10094, 12050, -1392, -326, 133, 61, - -50, 715, -6662, -673, 10745, -596, 44, 3906, - 247, -745, 4950, -210, 497, -1875, 8197, 2141, - 1454, -23, -1480, 2184, -804, 5515, -1311, -8893, - -2880, -3606, -282, -116, 8084, 618, -403, 1106, --14405, 1159, 229, 742, -184, -19445, -329, -747, - -1240, 1487, -1670, -839, -77, -882, -10986, -2851, - -24, -747, -3615, 1939, 1389, 132, 5367, 1355, - 408, -1272, 11388, 153, 2708, -1503, 169, 7357, - 51, -13586, -404, -304, 626, 163, -1814, -515, - 445, 589, -1194, 770, 555, 246, -165, -21192, - 184, -265, -1116, -485, -8107, -1992, -10805, -880, - -1455, -15154, 2312, -1712, -11, -1899, -400, -2, - 314, -318, -280, -658, -1066, -2584, 1027, 801, --11960, 1519, 8873, 465, -3229, 1801, -348, 749, - 7, 1079, -2051, 11521, -831, -13425, -6315, -1135, - 1088, 1056, -46, -1006, 374, -5065, 1163, -402, - -50, -1459, 9586, 514, -1439, -638, -155, -5289, - 8043, -612, 739, 1084, -60, 891, 786, -6, - -1078, 2097, -5333, 3497, 23, -913, 1303, 957, - -35, -6418, -146, -971, 2738, 9695, -1722, -2002, - 905, -1749, -917, 122, 379, -325, -455, 230, - 825, -137, -335, -96, -160, 390, 731, -2621, - -5889, -3949, 5138, 839, -1190, -66, 961, -4600, - 2345, 1607, -2448, -6653, -592, -106, -7619, -794, - -1186, -12587, -11, -2224, -225, -2903, 534, 1355, - -7002, 314, 494, 1950, -8545, -2531, -2438, -77, - 886, -1851, 944, -10156, 3003, 1846, 1919, 2019, - 471, 451, -436, -1012, -20121, 275, 98, 1776, - 578, 96, -16, 1156, 3689, 7, -207, 920, - 105, -58, -175, 163, 697, -407, -61, 1261, - 1297, 5061, 5326, -1126, 516, 1208, -11108, 441, - 7, -899, -19, -368, 438, -1911, 602, 716, - 313, 853, 1448, -817, -1453, 1384, -4371, 1043, - 1884, 1619, 2196, 10075, -1548, -1201, -796, 5228, - 2657, 8244, -605, 422, -693, 3171, 657, 5438, - -171, 633, 1579, -1718, -12265, 1083, -976, -293, - -3802, -306, -668, 7818, -1340, -402, 2231, -4472 -}, - -.shape44 = { - -40, -282, 1366, -1173, -3484, 355, -1078, 3800, - 4386, -35, -4192, 523, 1291, 678, 156, 2272, - -1043, 1075, -1849, -314, -522, 392, 2098, -79, - 473, -275, 2, 6398, 451, 94, 173, -431, - 1115, -10788, 35, 1823, -3380, -97, -98, -350, - -23, -1264, -308, 8948, -695, -79, 3520, 308, - 340, -362, -547, 1207, -1182, -10392, -148, 3580, - 481, -425, 862, 4894, 736, -152, -626, 23, - -5853, 39, -143, 418, -103, -1457, -12826, -122, - 283, -225, 10561, -153, 8872, -806, -51, 93, - 420, -209, 345, -7661, -732, -48, 479, -225, - 276, 13385, -12578, -1440, -265, -274, 1105, -3376, - -691, -579, -972, 300, 349, 362, 722, -472, - 185, 814, 14, 4746, 761, -336, 1691, 888, - -1669, -18717, 827, -2605, 921, 155, 68, 112, - -3032, -287, 414, -86, -62, -213, -106, 807, - -619, 598, -178, 3104, -481, -1553, 1250, -8363, - -686, -9608, 116, -47, 321, -89, 939, -35, - -7995, -10159, -526, 145, 363, 2170, 1077, -1223, - -738, 120, -408, -390, -80, -404, -1607, -10187, - -6432, 961, 94, -1459, 489, 6641, 372, 1007, - 5958, -834, 222, 51, 282, -1005, 4473, -8841, - -73, -477, -557, 121, -165, -1195, 438, 139, - -190, -4205, -4278, -4617, -7592, 40, -422, -459, - 594, 7331, 164, 297, 2631, -9075, -78, 372, - -6213, -1053, 182, -71, -386, -604, -11720, 552, - -617, 413, 1292, 4, -485, 1162, 6051, -5168, - -181, 1024, -630, -275, -4067, -8627, 1386, 970, - -423, 2973, 2360, 363, -274, 410, 48, 768, - 2958, -427, 86, 64, -128, -273, -182, -292, - 868, 463, 73, -116, -6509, -5295, -37, 691, - 344, -120, 168, 419, 494, -1175, 18896, -135, - -376, -218, -453, -916, -1040, -22179, -846, -1005, - 264, 159, 597, -952, -825, 393, -328, -14694, - 371, -263, 740, 38, -1001, 1289, -668, 187, - -155, 143, 683, 7133, -563, -8383, -291, 176, - 75, 613, -6965, -11480, 324, -490, 586, 416, - 762, 5777, 64, -47, -4124, -1196, -113, 701, - -211, 2335, 130, 684, 7278, -158, -213, 297, - 10845, -1439, -465, 17, -792, 6499, -10187, -444, - -1416, 482, 636, 1472, 752, 157, -334, -3230, - -19, -6747, 660, -3082, 4057, 6801, -19, 635, - 19, 9807, 526, 126, 444, -190, -418, -26754, - -202, 243, 597, 10, 345, 814, -330, 160, - 344, 3986, 470, 459, 2387, -549, 11889, -1837, - -30, 2608, 615, 2301, -771, -1589, -6935, 1321, - 4287, 295, -558, -1503, -611, 2104, 411, -218, - 1145, -426, 58, -102, 13, 7499, 476, -4032, - -2237, -2658, -1943, 5268, 1039, 389, 7091, -22, - 156, -186, 2432, -878, 305, -1726, 3209, 361, - -1030, 505, 618, -262, -1877, 268, 757, 24, - 24306, 102, 973, 142, -953, -1199, 116, -255, - 5370, -347, -365, 937, -6939, -1189, -760, 531, - -1759, -705, -557, -620, 1151, 250, 21629, -1532, - -128, 1421, -211, 592, 5126, 197, -716, 1113, - 5844, -266, -12, -813, 85, 994, -2106, -3915, - 1402, 533, 521, -883, 87, -386, -2, -4350, - 19790, -180, -363, 60, 101, -1717, 119, -381, - 100, -565, 3264, 3052, 200, -7319, 26, 347, - -482, 10609, -766, 526, -623, 3495, 339, -4406, - -59, -213, 686, -603, 133, 99, 48, 1716, - -1214, 1397, -2396, -384, -901, -3750, -660, -4314, - 313, 192, 292, 259, -644, 176, 2099, 7961, - -29, 642, -2970, 1792, -61, -4348, 578, 1867, - -1868, 32, 5262, 137, 6109, 443, -176, 351, - 400, 1874, -175, -4065, 697, 292, -744, 121, - -5134, 6996, -198, 628, 1073, -599, -116, -17900, - 647, -1049, -663, 1427, -94, 721, 311, 337, - 1376, -2784, 3947, 1342, 1577, -406, -260, -10228, - 109, 2358, 2437, 346, 1261, -308, -2094, 1682, - 144, -675, 183, 428, -950, 1249, -1546, 33, - -254, 681, -1264, -964, -310, 838, 100, -21952, - -1484, -1564, 339, 298, 67, -338, 89, 709, - 53, 258, -359, 2803, 1553, -312, -7993, -1627, - 1189, 476, -123, 336, -767, -18522, 589, 942, - -645, -381, -1913, -582, 55, -876, -509, 25143, - 690, -787, -1136, 114, 162, 342, -231, -8742, - 99, -646, -474, -1384, -110, -98, 8634, -14, - -9676, -312, 358, 496, -676, -97, 1904, -2124, - -66, -1868, 502, -513, -3244, 2079, -1476, 5440, - -40, -381, 500, -238, -471, 12160, 248, -1005, - -2886, 173, -3369, -355, -256, -117, -474, -1282, - -355, 130, -4833, 31, -232, -12931, -826, 322, - 839, 1537, 73, 226, -1888, -483, -2848, -190, - 1271, 3597, -4514, -38, 6093, 347, -68, -415, - -105, -1664, -11461, -110, -399, 389, -511, 935, - -424, -1708, -1026, 23239, 298, 7363, -9206, -566, - 259, -412, -1213, 335, 614, 928, 972, -1919, - -407, 509, 303, -13762, -524, 10360, 1318, -2758, - 2350, -106, -119, -68, -6155, -255, -448, -34, - -64, -4382, 47, 635, -339, 406, -447, -445, --10592, 233, 160, -5515, -1333, 6755, -952, 172, - -1260, -294, 3480, -352, -231, 415, 482, -498, - -191, -2034, 7934, 7997, -688, -9503, 376, -228, - -500, 222, -1021, -407, 261, 179, 622, 1217, - -443, -763, -508, -719, -4509, 91, 449, -283, - 91, -39, 961, -10148, 1596, -9161, -327, 221, - -470, 676, 12, 1416, 984, -10988, -5500, -189, - -727, 226, 4691, 688, 759, 930, -6444, -114, - -539, -526, -21, -1218, 650, 6088, 419, 6185, - -1200, 84, -1232, -34, -107, 60, 2248, 450, - 1187, 1264, -181, 857, 2235, -2859, -13483, -192, - -586, -207, -5569, 503, 3376, 1243, -700, 2119, - -2186, -296, 896, 299, 177, 184, 1375, 2498, - 161, 579, -3683, 443, -21, -186, -3474, 238, - 274, 277, -325, -8325, -223, 125, 191, 333, - -345, -1391, -7372, 11389, -1055, 4066, -1098, 87, - -203, 443, 363, -959, 15395, 4016, -254, 1611, - -168, -1070, 2709, -768, 506, -1245, 5821, 2499, - 1564, 27, 85, 1989, -1092, 150, -972, 660, - -33, 687, 545, -1564, 720, -196, -52, -1751, --25380, -1246, -615, 391, -512, -23289, 460, 360, - -85, -723, -250, -163, -48, -921, -3988, 425, - -1268, -1695, 3233, -1093, -1166, 198, 7602, 21, - 354, 733, 12213, -347, 532, -427, 22, 2218, - -578, -3382, -474, -625, 78, -4546, 863, -53, - -357, -1529, 1014, 710, 1356, -430, -1633, -24823, - 95, 26, 590, -591, -7833, -1355, -9771, -502, - -907, -15433, 957, 463, 35, -496, 294, 2129, - 1274, -160, -83, 531, -767, 285, 232, 5983, - -6122, 1620, 4112, -239, -1733, -46, -1321, 467, - 613, -3747, -2284, 13991, 373, -17357, -219, -80, - -210, 1462, 37, -1692, 548, -5845, 420, 54, - -350, -285, 1981, 262, -874, 2844, -435, -6305, - 6449, 72, 631, -94, 96, -442, 1137, 89, - 364, 3392, -3512, -387, 1055, 318, -1111, -6971, - 344, -9105, -96, -9362, 190, -225, 370, 161, - -73, -1830, 174, 48, -518, -3486, 137, -235, - 810, 23, 80, -642, -35, -316, -269, -373, - -2413, -933, 2525, 267, -508, -200, 422, -3470, - -1273, 640, -1956, 139, 394, -1043, -11008, -158, - -1089, -2023, 202, -979, -744, -159, -392, -37, - -1679, 2183, 1365, -2883, -4752, -2255, 109, 1660, - -613, -511, 1284, -7331, 947, 7009, -2072, -321, - -936, -551, -875, 160, -27027, 654, 265, 164, - 376, 726, -149, 2813, -94, 5728, 702, -1118, - -2555, 217, -186, -107, 146, -83, -62, -196, - 708, 146, 3729, -416, 212, -163, -7861, 347, - 83, -1079, -994, 271, -1054, -1647, 139, -20, - 354, 1298, -3420, 1130, 161, 475, -3913, 468, - 23, 285, -1699, 8234, -947, 222, 260, 4276, - -341, 6387, 21, 490, -1908, -1654, -60, 2471, - 733, -135, 109, -1136, -14756, 4922, 1165, 149, - -3976, -66, -594, 6181, -110, 292, 1129, -591 -}, - -.lsp08 = { - 0.2702, 0.5096, 0.6437, 0.7672, 0.9639, 1.0696, 1.2625, 1.5789, - 1.9285, 2.2383, 2.5129, 2.8470, 0.1740, 0.3677, 0.6082, 0.8387, - 1.1084, 1.3721, 1.6362, 1.8733, 2.0640, 2.3442, 2.6087, 2.8548, - 0.1536, 0.3279, 0.5143, 0.6859, 0.9763, 1.2744, 1.5605, 1.8566, - 2.1007, 2.3450, 2.6075, 2.8850, 0.2075, 0.4533, 0.7709, 1.0377, - 1.2953, 1.5132, 1.7826, 2.0351, 2.2590, 2.4996, 2.6795, 2.8748, - 0.1393, 0.2453, 0.3754, 0.5453, 0.8148, 1.1289, 1.4389, 1.7592, - 2.0353, 2.3215, 2.5934, 2.8588, 0.1250, 0.3627, 0.7613, 1.1380, - 1.4163, 1.5565, 1.6920, 1.8130, 1.8678, 2.0427, 2.4318, 2.8544, - 0.2256, 0.4223, 0.6452, 0.8599, 1.0673, 1.3118, 1.5486, 1.8366, - 2.0759, 2.3026, 2.5284, 2.8030, 0.2304, 0.4404, 0.6891, 0.8964, - 1.1510, 1.4202, 1.6483, 1.8580, 2.1181, 2.3686, 2.6078, 2.9128, - 0.2230, 0.3816, 0.5520, 0.6062, 0.7909, 1.0988, 1.4330, 1.7846, - 2.0713, 2.3457, 2.6048, 2.8708, 0.2447, 0.5800, 0.8249, 0.9905, - 1.1721, 1.3990, 1.6694, 1.9064, 2.1307, 2.4255, 2.6815, 2.9117, - 0.1974, 0.3812, 0.5802, 0.7759, 0.9280, 1.1547, 1.4170, 1.6369, - 1.8890, 2.2587, 2.5626, 2.8239, 0.1209, 0.2510, 0.4841, 0.8048, - 1.1197, 1.3563, 1.6073, 1.8926, 2.1350, 2.3669, 2.6291, 2.8985, - 0.2352, 0.4347, 0.6582, 0.8178, 0.9548, 1.1654, 1.4942, 1.8812, - 2.1703, 2.3779, 2.6412, 2.8871, 0.2091, 0.4084, 0.6730, 0.9151, - 1.1259, 1.3262, 1.5937, 1.8129, 2.0237, 2.3317, 2.5778, 2.8620, - 0.1167, 0.2406, 0.4520, 0.7298, 0.9848, 1.2448, 1.5137, 1.7874, - 2.0280, 2.3020, 2.5914, 2.8794, 0.3003, 0.4966, 0.6520, 0.8505, - 1.1600, 1.3981, 1.5805, 1.8346, 2.0757, 2.3102, 2.5760, 2.8499, - 0.2451, 0.4163, 0.5960, 0.7805, 0.9507, 1.2438, 1.5587, 1.8581, - 2.0735, 2.3198, 2.5704, 2.8220, 0.3112, 0.5517, 0.7032, 0.8528, - 1.1489, 1.4257, 1.6848, 1.9388, 2.1577, 2.4265, 2.6678, 2.9051, - 0.2249, 0.3897, 0.5559, 0.7473, 1.0158, 1.3581, 1.6914, 1.9930, - 2.1843, 2.3534, 2.5512, 2.8065, 0.2600, 0.4574, 0.7349, 0.9691, - 1.1696, 1.3848, 1.6335, 1.9021, 2.1174, 2.3481, 2.5902, 2.8390, - 0.2246, 0.3372, 0.4560, 0.5249, 0.7056, 1.0273, 1.3810, 1.7132, - 1.9819, 2.2574, 2.5410, 2.8491, 0.1419, 0.4834, 0.8835, 1.1453, - 1.2839, 1.4224, 1.5593, 1.7877, 2.1285, 2.4070, 2.6043, 2.8511, - 0.1886, 0.3677, 0.5617, 0.8099, 1.1277, 1.3841, 1.5804, 1.8136, - 2.0307, 2.2805, 2.5399, 2.8322, 0.2351, 0.4151, 0.6675, 0.8713, - 1.0464, 1.3292, 1.6586, 1.9281, 2.1355, 2.3495, 2.6222, 2.8782, - 0.2700, 0.4489, 0.6206, 0.7121, 0.7737, 0.9848, 1.3658, 1.7433, - 2.0139, 2.2243, 2.4806, 2.8175, 0.2479, 0.4425, 0.6490, 0.8745, - 1.1161, 1.3849, 1.6773, 1.9566, 2.1491, 2.3624, 2.5685, 2.8114, - 0.2035, 0.3701, 0.5567, 0.7953, 1.0082, 1.2758, 1.5373, 1.7822, - 2.0175, 2.2601, 2.4759, 2.7771, 0.1856, 0.3461, 0.5998, 0.9041, - 1.2383, 1.4612, 1.6667, 1.9305, 2.1617, 2.4107, 2.6477, 2.8656, - 0.2107, 0.3715, 0.5289, 0.6651, 0.8420, 1.1168, 1.4401, 1.7230, - 1.9901, 2.2687, 2.5452, 2.8655, 0.1218, 0.2999, 0.6348, 0.9482, - 1.2745, 1.5876, 1.9129, 2.2348, 2.4020, 2.4922, 2.6351, 2.8357, - 0.1617, 0.3483, 0.5869, 0.8163, 1.0366, 1.2344, 1.4609, 1.7029, - 1.9476, 2.2337, 2.5258, 2.8442, 0.2505, 0.4894, 0.7510, 0.9152, - 1.0845, 1.3657, 1.6528, 1.8346, 2.0160, 2.2811, 2.5338, 2.8136, - 0.0947, 0.1158, 0.0578, -0.0337, -0.0066, 0.0104, -0.0447, -0.0505, --0.0778, -0.0293, 0.0251, -0.0143, 0.0349, -0.0227, -0.0909, 0.0523, - 0.0325, -0.0410, -0.1045, -0.0899, -0.0009, 0.0075, -0.0575, -0.0855, --0.0129, 0.0575, 0.0597, 0.0391, 0.0371, -0.0184, -0.0083, 0.0287, - 0.0143, 0.0167, 0.0120, -0.0168, 0.0452, 0.0223, -0.0352, 0.0119, --0.0496, -0.0965, -0.0661, -0.0072, 0.1099, 0.0843, -0.0087, -0.0478, --0.0128, -0.0120, -0.0004, 0.0731, 0.1047, 0.0630, 0.0196, -0.0103, --0.0399, -0.0986, -0.0912, -0.0390, -0.0247, -0.0694, -0.0749, -0.0066, - 0.0223, 0.0634, 0.0343, -0.0134, 0.0727, 0.0241, 0.0066, 0.0437, - 0.0610, 0.0364, 0.0248, -0.0358, -0.0686, -0.0104, 0.0426, 0.0088, --0.0137, -0.0165, 0.0671, 0.0815, -0.0863, -0.0644, -0.0088, 0.0023, - 0.0482, 0.1174, 0.1270, 0.0594, 0.0165, 0.0949, 0.1098, 0.0137, - 0.4951, 0.4999, 0.4958, 0.4907, 0.4984, 0.4965, 0.4958, 0.4996, - 0.4987, 0.4958, 0.4986, 0.4977, 0.2841, 0.2186, 0.1474, 0.1687, - 0.2217, 0.2632, 0.2706, 0.2624, 0.2162, 0.2453, 0.2460, 0.2531 -}, - -.lsp11 = { - 0.1103, 0.3862, 0.6863, 0.8447, 0.9231, 1.0261, 1.1248, 1.4057, - 1.6621, 1.8010, 1.8692, 2.0704, 2.3490, 2.6060, 2.7539, 2.8977, - 0.1273, 0.2407, 0.3812, 0.6004, 0.7767, 0.9383, 1.1344, 1.3351, - 1.5233, 1.7262, 1.9466, 2.1739, 2.3495, 2.5162, 2.7164, 2.9202, - 0.2010, 0.3330, 0.4488, 0.6465, 0.8046, 0.9889, 1.1479, 1.2964, - 1.4770, 1.6606, 1.8789, 2.1155, 2.3287, 2.5199, 2.7101, 2.9119, - 0.1168, 0.2197, 0.3279, 0.4691, 0.6268, 0.8251, 1.0533, 1.2714, - 1.4712, 1.6762, 1.8831, 2.1114, 2.3230, 2.5297, 2.7365, 2.9270, - 0.1405, 0.3109, 0.4986, 0.6891, 0.8634, 1.0583, 1.2594, 1.4349, - 1.6232, 1.8116, 1.9905, 2.1935, 2.3799, 2.5656, 2.7661, 2.9486, - 0.1703, 0.3057, 0.4403, 0.5225, 0.5969, 0.8110, 1.0729, 1.3215, - 1.5407, 1.7381, 1.9477, 2.1680, 2.3586, 2.5612, 2.7630, 2.9410, - 0.1128, 0.2628, 0.4523, 0.6495, 0.8176, 0.9816, 1.1746, 1.3710, - 1.5568, 1.7518, 1.9497, 2.1452, 2.3346, 2.5389, 2.7362, 2.9264, - 0.1809, 0.3287, 0.5205, 0.7264, 0.9298, 1.1217, 1.2970, 1.4894, - 1.6874, 1.8493, 2.0576, 2.2382, 2.4097, 2.6041, 2.7796, 2.9389, - 0.2502, 0.4709, 0.6892, 0.8346, 0.9209, 1.0455, 1.2399, 1.4616, - 1.6463, 1.8380, 2.0475, 2.2397, 2.4665, 2.6550, 2.7701, 2.8895, - 0.1040, 0.2340, 0.3964, 0.5740, 0.7764, 0.9941, 1.2000, 1.4014, - 1.6024, 1.7974, 1.9939, 2.1959, 2.3783, 2.5663, 2.7613, 2.9484, - 0.1912, 0.3393, 0.4743, 0.6313, 0.8014, 0.9879, 1.1855, 1.3922, - 1.5678, 1.7289, 1.9271, 2.1165, 2.3089, 2.5414, 2.7448, 2.9269, - 0.0965, 0.2025, 0.3398, 0.4990, 0.6934, 0.9386, 1.1730, 1.3766, - 1.5783, 1.7783, 1.9790, 2.1831, 2.3670, 2.5578, 2.7641, 2.9516, - 0.2126, 0.3652, 0.5545, 0.7170, 0.8674, 1.0640, 1.2558, 1.4061, - 1.5904, 1.8095, 1.9760, 2.1505, 2.3549, 2.5575, 2.7023, 2.8877, - 0.1827, 0.3426, 0.4894, 0.6488, 0.7960, 0.9535, 1.1217, 1.2798, - 1.4566, 1.6453, 1.8044, 2.0042, 2.2379, 2.4611, 2.6697, 2.8966, - 0.2034, 0.3822, 0.5231, 0.6960, 0.9200, 1.0394, 1.1616, 1.3772, - 1.5493, 1.7330, 1.9646, 2.1233, 2.3334, 2.5361, 2.7087, 2.9470, - 0.1050, 0.2060, 0.3705, 0.5998, 0.8337, 1.0577, 1.2559, 1.4327, - 1.6334, 1.8165, 1.9853, 2.2058, 2.4063, 2.5818, 2.7625, 2.9458, - 0.1419, 0.4053, 0.6660, 0.8911, 1.0405, 1.1547, 1.2506, 1.3926, - 1.5669, 1.7527, 1.9694, 2.2054, 2.3889, 2.5743, 2.7586, 2.9174, - 0.1514, 0.2825, 0.4309, 0.5772, 0.7470, 0.9703, 1.1462, 1.3316, - 1.5321, 1.7259, 1.9282, 2.1266, 2.3106, 2.5064, 2.7067, 2.9094, - 0.1693, 0.3156, 0.4878, 0.6635, 0.8206, 0.9569, 1.1154, 1.3064, - 1.5109, 1.7184, 1.9179, 2.1036, 2.2763, 2.4820, 2.6949, 2.9105, - 0.1432, 0.2718, 0.4241, 0.5564, 0.6939, 0.9011, 1.1582, 1.3948, - 1.6181, 1.8024, 1.9814, 2.1740, 2.3459, 2.5456, 2.7491, 2.9307, - 0.2294, 0.3857, 0.5590, 0.7434, 0.9189, 1.0941, 1.2740, 1.4456, - 1.6178, 1.7994, 1.9689, 2.1644, 2.3525, 2.5385, 2.7468, 2.9405, - 0.1667, 0.3109, 0.4612, 0.6032, 0.7375, 0.8866, 1.0840, 1.3053, - 1.4982, 1.7044, 1.9146, 2.1117, 2.2942, 2.4983, 2.7084, 2.9132, - 0.1810, 0.3205, 0.4696, 0.6231, 0.7641, 0.9959, 1.2427, 1.4361, - 1.5889, 1.7544, 1.9083, 2.0733, 2.2457, 2.4461, 2.6793, 2.9098, - 0.1164, 0.3753, 0.6068, 0.7503, 1.0100, 1.2131, 1.3793, 1.5302, - 1.6300, 1.7950, 1.9057, 2.1031, 2.3830, 2.5745, 2.6949, 2.8779, - 0.1571, 0.4378, 0.6735, 0.8312, 0.8944, 0.9818, 1.1622, 1.4094, - 1.6423, 1.8066, 1.9258, 2.1838, 2.4363, 2.6279, 2.7358, 2.8790, - 0.1398, 0.2686, 0.4248, 0.6156, 0.7870, 1.0035, 1.2012, 1.3689, - 1.5363, 1.7398, 1.9604, 2.1619, 2.3345, 2.5097, 2.7271, 2.9368, - 0.1913, 0.3338, 0.4987, 0.6446, 0.7852, 1.0163, 1.1886, 1.3610, - 1.5379, 1.7230, 1.8880, 2.0862, 2.2960, 2.4928, 2.7122, 2.9151, - 0.0908, 0.1752, 0.2899, 0.5365, 0.7761, 1.0100, 1.2124, 1.4060, - 1.6019, 1.8010, 1.9774, 2.1905, 2.3733, 2.5623, 2.7660, 2.9565, - 0.1773, 0.3179, 0.4925, 0.6864, 0.8452, 0.9897, 1.1860, 1.3722, - 1.5515, 1.7658, 1.9802, 2.1819, 2.3620, 2.5442, 2.7250, 2.9220, - 0.1286, 0.2341, 0.3689, 0.5364, 0.7176, 0.9350, 1.1083, 1.2943, - 1.4974, 1.7059, 1.9047, 2.1145, 2.3242, 2.5361, 2.7453, 2.9329, - 0.2273, 0.3834, 0.5565, 0.7192, 0.8431, 0.9962, 1.1763, 1.3571, - 1.5774, 1.7419, 1.9202, 2.1131, 2.2919, 2.4898, 2.6895, 2.9180, - 0.1775, 0.3058, 0.4274, 0.6023, 0.8151, 1.0734, 1.3211, 1.5178, - 1.6706, 1.8154, 1.9686, 2.1537, 2.3461, 2.5276, 2.7181, 2.9121, - 0.1653, 0.4304, 0.6361, 0.7824, 0.9183, 1.0452, 1.2071, 1.4077, - 1.6206, 1.8299, 2.0089, 2.1948, 2.3900, 2.5982, 2.7844, 2.9487, - 0.1492, 0.2609, 0.3820, 0.5485, 0.7243, 0.9319, 1.1538, 1.3579, - 1.5266, 1.7002, 1.8873, 2.1016, 2.3175, 2.5221, 2.7241, 2.9243, - 0.2074, 0.3781, 0.5209, 0.6869, 0.8577, 0.9875, 1.1849, 1.3568, - 1.4907, 1.7335, 1.8902, 2.1224, 2.3099, 2.4918, 2.7023, 2.8765, - 0.1359, 0.2254, 0.3286, 0.4432, 0.6586, 0.8964, 1.1125, 1.3523, - 1.5626, 1.7579, 1.9846, 2.1905, 2.3548, 2.5542, 2.7663, 2.9346, - 0.1430, 0.2966, 0.4685, 0.6493, 0.8315, 1.0304, 1.2220, 1.4082, - 1.5995, 1.7888, 1.9774, 2.1737, 2.3607, 2.5577, 2.7558, 2.9405, - 0.1477, 0.2694, 0.4056, 0.5626, 0.7051, 0.8647, 1.0491, 1.2488, - 1.4814, 1.7072, 1.9150, 2.1147, 2.3038, 2.5144, 2.7184, 2.9202, - 0.1690, 0.3033, 0.4580, 0.6686, 0.8536, 1.0293, 1.2124, 1.3998, - 1.5718, 1.7607, 1.9580, 2.1245, 2.2971, 2.4762, 2.6896, 2.9177, - 0.1092, 0.2779, 0.4853, 0.6880, 0.9011, 1.0953, 1.2752, 1.4618, - 1.6623, 1.8484, 2.0264, 2.2152, 2.4017, 2.5835, 2.7671, 2.9436, - 0.1497, 0.3637, 0.6014, 0.8032, 0.9963, 1.1835, 1.3741, 1.5698, - 1.7382, 1.9094, 2.0710, 2.2392, 2.4082, 2.5926, 2.7762, 2.9536, - 0.1434, 0.2492, 0.3966, 0.5934, 0.8033, 1.0657, 1.2796, 1.4276, - 1.5745, 1.7833, 1.9288, 2.1247, 2.3543, 2.5412, 2.7049, 2.8872, - 0.1612, 0.2926, 0.4574, 0.6387, 0.8265, 1.0180, 1.1808, 1.3526, - 1.5564, 1.7536, 1.9187, 2.1192, 2.3149, 2.5006, 2.7101, 2.9217, - 0.0828, 0.1863, 0.3235, 0.5050, 0.7250, 0.9867, 1.2093, 1.3941, - 1.5980, 1.7932, 1.9809, 2.1894, 2.3918, 2.5773, 2.7540, 2.9329, - 0.2001, 0.3655, 0.5290, 0.6761, 0.8027, 0.9972, 1.2090, 1.4255, - 1.6085, 1.7825, 1.9804, 2.1681, 2.3457, 2.5325, 2.7319, 2.9196, - 0.1505, 0.2767, 0.4254, 0.6054, 0.7821, 0.9567, 1.1294, 1.3080, - 1.4984, 1.6954, 1.8666, 2.0736, 2.2875, 2.4969, 2.7072, 2.9163, - 0.1589, 0.4151, 0.5749, 0.6651, 0.8061, 1.0470, 1.2616, 1.3690, - 1.4985, 1.7808, 1.9825, 2.1068, 2.2751, 2.5448, 2.7133, 2.8689, - 0.0916, 0.1846, 0.3788, 0.6329, 0.8774, 1.0687, 1.2653, 1.4561, - 1.6573, 1.8449, 2.0402, 2.2254, 2.3968, 2.5861, 2.7792, 2.9508, - 0.2282, 0.4159, 0.5834, 0.6899, 0.8108, 1.0321, 1.2795, 1.5262, - 1.6936, 1.8469, 2.0922, 2.2607, 2.3795, 2.5301, 2.7386, 2.9530, - 0.1651, 0.3004, 0.4555, 0.6179, 0.7891, 0.9584, 1.1372, 1.3707, - 1.5951, 1.7880, 1.9434, 2.1465, 2.3311, 2.5081, 2.6977, 2.8970, - 0.1279, 0.3828, 0.6330, 0.8323, 0.9652, 1.1175, 1.2319, 1.3511, - 1.5115, 1.6392, 1.7835, 1.9558, 2.2008, 2.4635, 2.6910, 2.9058, - 0.1193, 0.2185, 0.3521, 0.5311, 0.7378, 0.9239, 1.1105, 1.3217, - 1.5362, 1.7504, 1.9536, 2.1627, 2.3560, 2.5506, 2.7548, 2.9453, - 0.1806, 0.3432, 0.4981, 0.6948, 0.8928, 1.0527, 1.2467, 1.4140, - 1.6326, 1.7950, 1.9935, 2.1969, 2.3512, 2.5682, 2.7445, 2.9277, - 0.1846, 0.3112, 0.4568, 0.5891, 0.7317, 0.8493, 1.0204, 1.2022, - 1.3688, 1.6020, 1.8428, 2.0710, 2.2725, 2.4879, 2.7057, 2.9160, - 0.0880, 0.2514, 0.5332, 0.7272, 0.8906, 1.1354, 1.3199, 1.4941, - 1.6010, 1.7151, 1.8712, 2.0643, 2.2755, 2.5375, 2.7054, 2.8891, - 0.1382, 0.2833, 0.4658, 0.6897, 0.9071, 1.0716, 1.2469, 1.4143, - 1.5910, 1.7947, 1.9805, 2.1581, 2.3338, 2.5215, 2.7292, 2.9211, - 0.1061, 0.3494, 0.6327, 0.8570, 0.9748, 1.0560, 1.1529, 1.3250, - 1.6032, 1.8340, 1.9711, 2.1157, 2.3011, 2.5464, 2.8078, 2.9803, - 0.1603, 0.2839, 0.4307, 0.5980, 0.7980, 1.0399, 1.1971, 1.3524, - 1.5715, 1.7838, 1.9468, 2.1498, 2.3627, 2.5514, 2.7327, 2.9148, - 0.1691, 0.3117, 0.4796, 0.6895, 0.8732, 1.0164, 1.1916, 1.3707, - 1.5384, 1.7202, 1.8857, 2.0672, 2.2487, 2.4593, 2.6789, 2.8940, - 0.0965, 0.1702, 0.3191, 0.5721, 0.8100, 1.0241, 1.2272, 1.4196, - 1.6093, 1.8057, 1.9884, 2.2037, 2.3925, 2.5805, 2.7578, 2.9366, - 0.1950, 0.3519, 0.5272, 0.6973, 0.8732, 1.0656, 1.2112, 1.3959, - 1.6116, 1.7821, 1.9445, 2.1592, 2.3348, 2.5142, 2.7440, 2.9297, - 0.1388, 0.2557, 0.4120, 0.5727, 0.7354, 0.9196, 1.0985, 1.2805, - 1.4643, 1.6535, 1.8340, 2.0546, 2.2758, 2.4778, 2.6921, 2.9122, - 0.1823, 0.3336, 0.4957, 0.6771, 0.8563, 1.0137, 1.2299, 1.3849, - 1.5718, 1.7667, 1.9193, 2.1326, 2.3135, 2.5268, 2.7133, 2.8998, - 0.0790, 0.1901, 0.4083, 0.6456, 0.8463, 1.0285, 1.2297, 1.4181, - 1.6159, 1.8056, 1.9971, 2.1912, 2.3816, 2.5746, 2.7692, 2.9497, - 0.0049, 0.0116, 0.0045, 0.0039, -0.0010, -0.0122, -0.0205, -0.0034, --0.0140, -0.0041, 0.0191, -0.0322, 0.0002, -0.0124, -0.0269, 0.0059, - 0.0586, 0.0339, -0.0389, -0.0319, -0.0079, -0.0205, -0.0363, -0.0211, - 0.0241, 0.0595, 0.0469, 0.0283, 0.0176, -0.0183, -0.0173, -0.0004, - 0.0024, 0.0145, 0.0534, 0.0197, -0.0065, -0.0067, 0.0133, 0.0358, --0.0104, -0.0386, -0.0109, -0.0078, 0.0275, 0.0565, 0.0251, -0.0027, --0.0053, 0.0171, 0.0088, 0.0495, 0.0141, 0.0039, -0.0445, -0.0426, --0.0184, -0.0280, -0.0223, 0.0039, -0.0171, -0.0606, -0.0786, -0.0430, - 0.0544, 0.0595, 0.0320, -0.0012, 0.0108, 0.0185, 0.0066, 0.0408, - 0.0552, -0.0073, -0.0247, -0.0480, -0.0288, 0.0186, 0.0212, -0.0013, - 0.0403, 0.0598, 0.0690, 0.0516, -0.0298, -0.0177, 0.0278, 0.0168, --0.0106, 0.0251, 0.0386, 0.0331, -0.0052, 0.0133, 0.0291, -0.0158, --0.0329, -0.0367, 0.0287, 0.0462, -0.0176, 0.0049, 0.0242, -0.0034, - 0.0135, 0.0086, -0.0149, 0.0241, 0.0504, 0.0246, -0.0273, -0.0369, --0.0108, -0.0449, -0.0625, -0.0414, -0.0292, -0.0571, -0.0440, -0.0088, - 0.0098, 0.0009, -0.0004, 0.0007, -0.0314, -0.0208, -0.0138, -0.0277, --0.0044, 0.0522, 0.0315, -0.0270, -0.0277, -0.0256, -0.0103, -0.0201, --0.0287, -0.0279, -0.0182, 0.0472, 0.0613, 0.0450, 0.0413, 0.0333, - 0.0444, 0.0223, 0.0061, 0.0316, 0.0321, 0.0501, 0.0460, 0.0250, - 0.0227, 0.0235, 0.0099, 0.0185, -0.0347, -0.0684, -0.0189, 0.0242, --0.0190, -0.0273, -0.0012, -0.0253, 0.0293, -0.0231, -0.0219, -0.0010, - 0.0153, 0.0128, -0.0166, -0.0435, -0.0417, -0.0121, -0.0351, -0.0390, - 0.0077, -0.0278, -0.0355, 0.0092, -0.0063, 0.0005, 0.0216, 0.0461, - 0.0538, 0.0451, 0.0298, -0.0130, 0.0058, 0.0206, 0.0471, 0.0499, - 0.0280, 0.0086, -0.0007, -0.0317, 0.0259, 0.0176, 0.0043, 0.0212, - 0.0138, 0.0106, 0.0220, -0.0025, 0.0050, 0.0122, -0.0051, -0.0086, --0.0472, -0.0005, 0.0193, 0.0032, 0.0246, 0.0222, 0.0090, -0.0320, --0.0713, -0.0526, -0.0151, -0.0440, -0.0648, -0.0466, -0.0092, 0.0115, --0.0129, 0.0053, -0.0344, -0.0385, 0.0392, 0.0599, 0.0414, 0.0165, --0.0098, -0.0320, -0.0261, -0.0055, -0.0139, -0.0110, 0.0084, 0.0172, --0.0492, -0.0537, -0.0320, -0.0036, 0.0265, 0.0385, 0.0064, -0.0280, --0.0230, 0.0134, 0.0241, 0.0106, 0.0387, 0.0105, 0.0068, 0.0260, - 0.4940, 0.4911, 0.4849, 0.4820, 0.4837, 0.4839, 0.4824, 0.4799, - 0.4812, 0.4782, 0.4788, 0.4711, 0.4706, 0.4671, 0.4601, 0.4578, - 0.2954, 0.2121, 0.1859, 0.1958, 0.1474, 0.1086, 0.1351, 0.1362, - 0.1486, 0.1342, 0.1215, 0.1423, 0.1634, 0.1588, 0.1539, 0.1857 -}, - -.lsp16 = { - 0.1813, 0.3911, 0.6301, 0.8012, 1.0057, 1.2041, 1.4271, 1.6943, - 1.9402, 2.1733, 2.3521, 2.4989, 2.5839, 2.6846, 2.7634, 2.8950, - 0.1311, 0.3183, 0.4659, 0.5601, 0.6658, 0.7828, 1.0065, 1.2717, - 1.5185, 1.7339, 1.9530, 2.2189, 2.3739, 2.4991, 2.6984, 2.9256, - 0.1627, 0.4519, 0.6323, 0.7012, 0.7848, 0.9801, 1.1810, 1.3222, - 1.5413, 1.8129, 1.9338, 2.0809, 2.3180, 2.5189, 2.7066, 2.9514, - 0.1475, 0.2447, 0.4240, 0.5669, 0.7872, 0.9838, 1.1823, 1.3814, - 1.5358, 1.6820, 1.8794, 2.1419, 2.4132, 2.6112, 2.7911, 2.9511, - 0.1224, 0.2876, 0.5013, 0.6985, 0.8902, 1.0901, 1.2835, 1.4768, - 1.6596, 1.8538, 2.0467, 2.2304, 2.4124, 2.5942, 2.7729, 2.9531, - 0.1741, 0.3034, 0.4677, 0.5879, 0.7258, 0.9648, 1.1417, 1.3220, - 1.5081, 1.7151, 1.9212, 2.1286, 2.3208, 2.4938, 2.6765, 2.8891, - 0.1657, 0.3174, 0.4907, 0.6559, 0.8295, 1.0254, 1.2071, 1.3880, - 1.5737, 1.7845, 1.9027, 2.1139, 2.3323, 2.5157, 2.7323, 2.9015, - 0.1592, 0.2758, 0.4417, 0.6315, 0.8257, 0.9873, 1.1277, 1.2830, - 1.4337, 1.6315, 1.8899, 2.1356, 2.3572, 2.5632, 2.7468, 2.9420, - 0.1524, 0.4325, 0.5931, 0.7036, 0.7696, 0.8923, 1.1739, 1.4773, - 1.6609, 1.7911, 1.9666, 2.1972, 2.3754, 2.5045, 2.6613, 2.8882, - 0.2130, 0.3013, 0.3721, 0.4257, 0.5079, 0.7015, 0.9815, 1.2554, - 1.4648, 1.6966, 1.9138, 2.1075, 2.3318, 2.5292, 2.7453, 2.9347, - 0.1142, 0.3748, 0.6205, 0.7642, 0.8121, 0.9022, 0.9843, 1.1558, - 1.4467, 1.7422, 1.9574, 2.1302, 2.3812, 2.5898, 2.7720, 2.9583, - 0.1255, 0.2339, 0.3570, 0.5323, 0.7458, 1.0003, 1.1729, 1.3567, - 1.5217, 1.6977, 1.8924, 2.0942, 2.3145, 2.5408, 2.7553, 2.9337, - 0.1316, 0.2289, 0.4327, 0.6663, 0.8509, 0.9994, 1.1697, 1.3804, - 1.5609, 1.6903, 1.8572, 2.1019, 2.3687, 2.5789, 2.7715, 2.9472, - 0.1502, 0.2546, 0.3883, 0.5333, 0.6976, 0.9163, 1.1071, 1.3364, - 1.5420, 1.7525, 1.8948, 2.0839, 2.2819, 2.4651, 2.6875, 2.8987, - 0.1593, 0.3014, 0.4573, 0.6354, 0.8157, 0.9805, 1.1783, 1.3747, - 1.5678, 1.7326, 1.9286, 2.1340, 2.3253, 2.5280, 2.7180, 2.9298, - 0.1811, 0.3167, 0.4655, 0.6507, 0.8198, 1.0075, 1.1892, 1.3743, - 1.5227, 1.7090, 1.8849, 2.0743, 2.2750, 2.4830, 2.6896, 2.8953, - 0.1846, 0.3577, 0.5315, 0.7290, 0.9176, 1.1016, 1.2654, 1.4525, - 1.6315, 1.8268, 2.0238, 2.1934, 2.3868, 2.5753, 2.7682, 2.9469, - 0.0876, 0.1439, 0.2048, 0.3654, 0.6281, 0.8853, 1.0907, 1.2992, - 1.5227, 1.7373, 1.9395, 2.1419, 2.3488, 2.5486, 2.7466, 2.9348, - 0.1391, 0.4170, 0.6561, 0.7953, 0.8734, 0.9986, 1.1870, 1.4520, - 1.6042, 1.7910, 2.0135, 2.1870, 2.3358, 2.5066, 2.7409, 2.9955, - 0.0804, 0.1355, 0.2599, 0.4998, 0.7408, 0.9474, 1.1276, 1.3428, - 1.5556, 1.7712, 1.9699, 2.1535, 2.3605, 2.5548, 2.7489, 2.9325, - 0.1304, 0.3087, 0.4979, 0.6584, 0.8414, 1.0329, 1.2244, 1.4189, - 1.6118, 1.8200, 1.9985, 2.1893, 2.3915, 2.5794, 2.7647, 2.9344, - 0.1895, 0.2849, 0.3705, 0.4126, 0.6265, 0.9207, 1.1774, 1.3762, - 1.5757, 1.7728, 1.9568, 2.1662, 2.3615, 2.5575, 2.7561, 2.9416, - 0.1800, 0.3078, 0.4805, 0.6796, 0.8503, 1.0046, 1.1703, 1.3269, - 1.4862, 1.6502, 1.8454, 2.0873, 2.3175, 2.5356, 2.7516, 2.9469, - 0.1950, 0.3233, 0.4568, 0.5940, 0.7589, 0.9978, 1.1701, 1.3383, - 1.5017, 1.6565, 1.8243, 2.0605, 2.2938, 2.5147, 2.7419, 2.9396, - 0.2531, 0.4391, 0.5790, 0.7170, 0.8998, 1.1430, 1.3577, 1.5326, - 1.6328, 1.7627, 1.9726, 2.1762, 2.3563, 2.5478, 2.7385, 2.9067, - 0.1805, 0.2788, 0.3591, 0.3881, 0.5441, 0.8055, 1.0766, 1.3165, - 1.5316, 1.7508, 1.9477, 2.1374, 2.3438, 2.5484, 2.7501, 2.9410, - 0.2044, 0.3671, 0.5396, 0.7042, 0.8582, 0.9831, 1.1261, 1.3194, - 1.4769, 1.6979, 1.8717, 2.0463, 2.2620, 2.4739, 2.7054, 2.9208, - 0.1048, 0.2175, 0.4206, 0.5923, 0.7483, 0.9400, 1.1356, 1.3799, - 1.5958, 1.7320, 1.8984, 2.1296, 2.3594, 2.5492, 2.7387, 2.9305, - 0.0842, 0.1729, 0.3951, 0.6447, 0.8688, 1.0605, 1.2472, 1.4330, - 1.6232, 1.8144, 2.0216, 2.1915, 2.3878, 2.5763, 2.7685, 2.9464, - 0.1461, 0.2593, 0.4105, 0.5677, 0.7328, 0.8919, 1.0484, 1.2302, - 1.4386, 1.6635, 1.8873, 2.1024, 2.3116, 2.5268, 2.7273, 2.9269, - 0.1503, 0.3108, 0.4756, 0.6731, 0.8600, 1.0233, 1.2115, 1.3971, - 1.5915, 1.7892, 1.9517, 2.1603, 2.3487, 2.5460, 2.7308, 2.8998, - 0.2163, 0.3669, 0.5125, 0.6709, 0.8143, 0.9930, 1.2095, 1.4205, - 1.6176, 1.7112, 1.8398, 2.0896, 2.3513, 2.5290, 2.6667, 2.8960, - 0.2133, 0.4382, 0.6287, 0.8702, 1.1088, 1.3749, 1.6062, 1.7446, - 1.8333, 1.9122, 1.9614, 2.0669, 2.1789, 2.3449, 2.6038, 2.8849, - 0.1598, 0.2719, 0.3877, 0.4815, 0.5926, 0.7795, 1.0449, 1.3045, - 1.5210, 1.7391, 1.9462, 2.1397, 2.3553, 2.5458, 2.7540, 2.9392, - 0.2918, 0.5607, 0.6801, 0.7404, 0.8285, 0.9431, 1.1579, 1.4080, - 1.6332, 1.8472, 1.9738, 2.0771, 2.2890, 2.5178, 2.7445, 2.9830, - 0.1664, 0.2842, 0.3965, 0.5463, 0.8162, 1.0346, 1.1849, 1.3446, - 1.5122, 1.7563, 1.9960, 2.2002, 2.3796, 2.5689, 2.7712, 2.9550, - 0.0911, 0.2397, 0.5052, 0.7868, 1.0299, 1.1311, 1.2244, 1.3333, - 1.4395, 1.6790, 1.9369, 2.1717, 2.3689, 2.5538, 2.7340, 2.9326, - 0.1647, 0.2931, 0.3836, 0.4978, 0.6255, 0.9243, 1.1339, 1.3001, - 1.5269, 1.8010, 1.9715, 2.1419, 2.3784, 2.5503, 2.6719, 2.8745, - 0.2440, 0.3802, 0.4756, 0.6613, 0.8627, 1.0292, 1.2291, 1.4060, - 1.5198, 1.7354, 1.9044, 2.1010, 2.3147, 2.4996, 2.7171, 2.9041, - 0.1590, 0.2876, 0.4572, 0.5996, 0.7713, 0.9490, 1.1205, 1.2815, - 1.4516, 1.6385, 1.8179, 2.0457, 2.2759, 2.4785, 2.6861, 2.9080, - 0.2297, 0.4309, 0.5712, 0.6717, 0.8138, 1.0463, 1.2492, 1.4560, - 1.6796, 1.8458, 1.9642, 2.1452, 2.3636, 2.5395, 2.7456, 2.9495, - 0.2975, 0.4678, 0.4996, 0.5809, 0.6279, 0.6884, 0.8606, 1.1386, - 1.4412, 1.6876, 1.8760, 2.0932, 2.3178, 2.5166, 2.7345, 2.9280, - 0.1278, 0.3737, 0.6004, 0.7069, 0.8147, 1.0180, 1.2581, 1.3812, - 1.4855, 1.7268, 1.9970, 2.1258, 2.2936, 2.5702, 2.7563, 2.8983, - 0.1314, 0.2508, 0.3999, 0.5680, 0.7424, 0.9367, 1.1286, 1.3175, - 1.5336, 1.7404, 1.9317, 2.1404, 2.3514, 2.5562, 2.7510, 2.9402, - 0.1043, 0.2367, 0.4293, 0.6376, 0.8160, 0.9836, 1.1779, 1.3850, - 1.5835, 1.7875, 1.9765, 2.1593, 2.3654, 2.5577, 2.7465, 2.9398, - 0.1529, 0.2515, 0.3454, 0.4374, 0.7011, 0.9015, 1.0744, 1.3532, - 1.5699, 1.7545, 2.0021, 2.1259, 2.2278, 2.4546, 2.7264, 2.9425, - 0.1429, 0.2808, 0.4395, 0.6334, 0.8069, 0.9705, 1.1520, 1.3250, - 1.5109, 1.7285, 1.9356, 2.1469, 2.3479, 2.5554, 2.7512, 2.9348, - 0.1625, 0.3022, 0.4756, 0.6315, 0.8032, 0.9924, 1.1596, 1.3204, - 1.4994, 1.6929, 1.8955, 2.1090, 2.3025, 2.5018, 2.6908, 2.8980, - 0.1692, 0.3427, 0.5228, 0.7756, 0.9688, 1.0950, 1.3056, 1.4360, - 1.5675, 1.8049, 1.9376, 2.1151, 2.3407, 2.5012, 2.7192, 2.9258, - 0.0474, 0.1251, 0.1939, 0.3841, 0.6501, 0.9231, 1.1153, 1.3240, - 1.5478, 1.7599, 1.9651, 2.1510, 2.3645, 2.5552, 2.7542, 2.9393, - 0.2196, 0.4656, 0.7492, 0.9922, 1.1678, 1.2489, 1.3112, 1.3657, - 1.4223, 1.5302, 1.7212, 1.9996, 2.2523, 2.4844, 2.7036, 2.9145, - 0.1128, 0.2368, 0.3704, 0.5476, 0.7723, 0.9968, 1.1930, 1.3992, - 1.6013, 1.7957, 1.9888, 2.1857, 2.3825, 2.5705, 2.7616, 2.9434, - 0.1341, 0.2768, 0.4510, 0.6359, 0.8332, 1.0335, 1.2004, 1.3952, - 1.5762, 1.7681, 1.9815, 2.1735, 2.3657, 2.5552, 2.7514, 2.9498, - 0.1247, 0.2559, 0.3516, 0.4726, 0.6861, 0.9483, 1.1852, 1.3858, - 1.5851, 1.7815, 1.9778, 2.1737, 2.3729, 2.5664, 2.7620, 2.9429, - 0.1988, 0.3320, 0.4777, 0.6737, 0.8425, 1.0265, 1.1694, 1.3655, - 1.5463, 1.7135, 1.9385, 2.1650, 2.3529, 2.5367, 2.7545, 2.9585, - 0.1376, 0.2620, 0.4273, 0.6169, 0.7755, 0.9441, 1.1169, 1.3157, - 1.5179, 1.7020, 1.8931, 2.1059, 2.3112, 2.5136, 2.7169, 2.9198, - 0.2112, 0.4385, 0.6091, 0.7618, 0.9553, 1.1543, 1.3445, 1.5396, - 1.7153, 1.9192, 2.1263, 2.3593, 2.5958, 2.8171, 2.9394, 3.0409, - 0.1347, 0.2099, 0.2646, 0.3453, 0.5266, 0.7869, 1.0513, 1.2795, - 1.4880, 1.7181, 1.9294, 2.1332, 2.3362, 2.5442, 2.7433, 2.9362, - 0.3141, 0.5935, 0.7517, 0.8313, 0.8568, 0.9570, 1.0250, 1.1275, - 1.3422, 1.6303, 1.8577, 2.0705, 2.2957, 2.5095, 2.7244, 2.9262, - 0.0962, 0.2116, 0.3961, 0.5641, 0.7122, 0.8883, 1.1023, 1.3481, - 1.5623, 1.7554, 1.9618, 2.1675, 2.3706, 2.5556, 2.7430, 2.9337, - 0.0898, 0.1510, 0.3060, 0.5820, 0.8221, 1.0388, 1.2261, 1.4289, - 1.6054, 1.8103, 1.9941, 2.1844, 2.3742, 2.5711, 2.7632, 2.9474, - 0.1326, 0.2316, 0.3761, 0.5177, 0.6782, 0.8761, 1.0952, 1.3175, - 1.5078, 1.7034, 1.9051, 2.1245, 2.3424, 2.5484, 2.7444, 2.9389, - 0.1740, 0.3293, 0.5174, 0.6824, 0.8394, 1.0372, 1.2046, 1.3723, - 1.5656, 1.7444, 1.9442, 2.1386, 2.3139, 2.4960, 2.7071, 2.9297, - 0.2304, 0.3775, 0.4865, 0.6182, 0.7842, 0.9208, 1.1151, 1.2843, - 1.4641, 1.6988, 1.9209, 2.1260, 2.3099, 2.5229, 2.7414, 2.9276, - 0.0094, 0.0261, -0.0037, 0.0041, -0.0092, -0.0044, -0.0232, -0.0073, --0.0047, -0.0021, 0.0250, -0.0580, -0.0140, -0.0342, -0.0586, 0.0020, - 0.0449, 0.0155, -0.0523, -0.0279, 0.0299, -0.0183, -0.0736, -0.0639, --0.0017, 0.0336, 0.0209, 0.0046, 0.0077, -0.0148, -0.0114, -0.0120, - 0.0115, -0.0050, 0.0445, 0.0048, 0.0188, -0.0137, -0.0080, 0.0239, --0.0184, -0.0524, -0.0195, -0.0126, 0.0284, 0.0632, 0.0141, -0.0093, --0.0096, 0.0196, 0.0230, 0.0379, 0.0308, 0.0237, -0.0224, -0.0600, --0.0755, -0.1074, -0.0988, -0.0606, -0.1038, -0.1552, -0.1480, -0.0672, - 0.0504, 0.0676, 0.0336, -0.0042, 0.0729, 0.1013, 0.0868, 0.0846, - 0.0954, 0.0515, -0.0066, -0.0851, -0.0485, 0.0294, 0.0395, 0.0087, - 0.0078, 0.0446, 0.0881, 0.0672, -0.0384, -0.0025, 0.0415, 0.0353, - 0.0080, 0.0052, 0.0190, 0.0182, 0.0069, 0.0168, 0.0374, 0.0037, --0.0292, -0.0429, 0.0302, 0.0681, -0.0233, -0.0238, -0.0003, -0.0043, - 0.0054, -0.0029, -0.0149, 0.0642, 0.0622, 0.0341, -0.0232, -0.0461, --0.0082, -0.0469, -0.0618, -0.0326, -0.0452, -0.0649, -0.0597, -0.0398, --0.0318, -0.0116, 0.0011, 0.0009, -0.0384, -0.0384, -0.0156, -0.0260, --0.0007, 0.0473, 0.0111, -0.0358, -0.0484, -0.0204, -0.0029, -0.0090, --0.0285, -0.0495, -0.0376, 0.0917, 0.1192, 0.1026, 0.0745, 0.0397, - 0.0463, 0.0253, 0.0025, 0.0465, 0.0100, 0.0488, 0.0416, 0.0223, - 0.0263, 0.0072, -0.0053, 0.0595, 0.0060, -0.0518, -0.0316, -0.0043, --0.0133, -0.0233, -0.0075, -0.0251, 0.0277, -0.0067, -0.0136, -0.0004, - 0.0235, 0.0112, -0.0182, -0.0324, -0.0210, -0.0035, -0.0395, -0.0384, - 0.0005, -0.0150, -0.0356, 0.0127, -0.0033, -0.0034, 0.0205, 0.0747, - 0.1138, 0.1015, 0.0995, -0.0161, -0.0045, 0.0129, 0.0472, 0.0575, - 0.0222, 0.0091, 0.0037, -0.0471, 0.0371, 0.0132, 0.0208, 0.0247, - 0.0117, 0.0164, 0.0225, 0.0124, -0.0023, 0.0088, -0.0046, 0.0047, --0.0393, 0.0018, 0.0148, 0.0020, 0.0044, 0.0165, 0.0229, -0.0208, --0.0477, -0.0310, -0.0164, -0.0390, -0.0764, -0.0525, -0.0094, 0.0075, --0.0102, -0.0045, -0.0504, -0.0709, 0.0822, 0.0710, 0.0426, 0.0014, --0.0371, -0.0400, -0.0157, -0.0155, -0.0173, -0.0138, -0.0015, 0.0134, --0.0418, -0.0682, -0.0256, 0.0050, 0.0360, 0.0354, 0.0074, -0.0396, --0.0235, 0.0284, 0.0494, 0.0153, 0.0448, 0.0025, -0.0061, 0.0252, - 0.1000, 0.2260, 0.2158, 0.2116, 0.2198, 0.2055, 0.2110, 0.1873, - 0.1907, 0.2071, 0.2164, 0.2009, 0.2059, 0.2124, 0.2141, 0.2093, - 0.0875, 0.0981, 0.1177, 0.1071, 0.1033, 0.1248, 0.1048, 0.1238, - 0.1166, 0.1008, 0.1062, 0.0992, 0.0994, 0.1067, 0.0999, 0.1187, - 0.0750, 0.0794, 0.0828, 0.0854, 0.0859, 0.0801, 0.0891, 0.0933, - 0.0969, 0.0920, 0.0915, 0.0862, 0.0868, 0.0891, 0.0842, 0.0824, - 0.0625, 0.0930, 0.0815, 0.0853, 0.0898, 0.0828, 0.0822, 0.0910, - 0.0873, 0.0906, 0.0856, 0.0840, 0.0774, 0.0785, 0.0684, 0.0711, - 0.3319, 0.4219, 0.4588, 0.4090, 0.4092, 0.4014, 0.3548, 0.3353, - 0.3708, 0.3352, 0.3720, 0.3538, 0.4084, 0.4289, 0.4060, 0.4210, - 0.0588, 0.0209, -0.0082, -0.0115, -0.0343, -0.0621, -0.0541, -0.0346, --0.0346, -0.0366, -0.0220, -0.0265, -0.0102, 0.0374, 0.0306, 0.0404, - 0.0306, 0.0090, -0.0054, 0.0333, 0.0047, 0.0238, 0.0141, 0.0165, - 0.0306, 0.0420, 0.0159, 0.0124, 0.0414, 0.0158, -0.0237, 0.0141, - 0.0765, 0.0057, -0.0260, -0.0426, -0.0395, -0.0126, -0.0579, -0.0417 -}, - -.lsp22_1 = { - 0.0664, 0.1875, 0.4300, 0.6730, 0.8793, 1.0640, 1.2563, 1.4433, - 1.6394, 1.8176, 2.0029, 2.1921, 2.3796, 2.5671, 2.7595, 2.9536, - 0.2128, 0.4052, 0.5311, 0.6404, 0.7875, 0.8775, 1.0974, 1.3261, - 1.5563, 1.6790, 1.8339, 2.1195, 2.3226, 2.4609, 2.6440, 2.8947, - 0.2024, 0.3362, 0.4834, 0.6784, 0.9088, 1.0850, 1.2188, 1.4054, - 1.6102, 1.7767, 1.9679, 2.1436, 2.3445, 2.5467, 2.7429, 2.9320, - 0.1181, 0.2279, 0.4413, 0.6114, 0.7710, 0.9427, 1.1142, 1.2707, - 1.4892, 1.7416, 1.9526, 2.1466, 2.3629, 2.5445, 2.7293, 2.9205, - 0.1155, 0.2720, 0.4886, 0.6812, 0.8594, 1.0422, 1.2315, 1.4116, - 1.6137, 1.8020, 1.9758, 2.1743, 2.3602, 2.5568, 2.7472, 2.9374, - 0.1110, 0.3312, 0.4735, 0.5612, 0.7129, 0.8146, 1.0233, 1.3155, - 1.5765, 1.7746, 1.9574, 2.1416, 2.3220, 2.5384, 2.7334, 2.9318, - 0.1656, 0.3350, 0.4215, 0.5609, 0.6759, 0.8503, 1.1405, 1.4094, - 1.6057, 1.6860, 1.7639, 2.0031, 2.2680, 2.5076, 2.7263, 2.9368, - 0.1466, 0.3638, 0.4587, 0.5674, 0.7381, 0.8669, 0.9619, 1.1658, - 1.4667, 1.7440, 1.9335, 2.1018, 2.3022, 2.5281, 2.7359, 2.9261, - 0.1061, 0.2566, 0.4739, 0.6751, 0.8711, 1.0704, 1.2720, 1.4655, - 1.6605, 1.8494, 2.0290, 2.2197, 2.4008, 2.5912, 2.7772, 2.9513, - 0.1116, 0.2364, 0.3971, 0.6316, 0.8583, 1.0335, 1.1686, 1.3302, - 1.5612, 1.7877, 1.9829, 2.2052, 2.3596, 2.5460, 2.7341, 2.9290, - 0.2661, 0.4186, 0.5126, 0.6477, 0.8818, 1.1045, 1.2852, 1.4128, - 1.5851, 1.7593, 1.9399, 2.1757, 2.3684, 2.5136, 2.6927, 2.9064, - 0.1495, 0.2749, 0.4391, 0.6304, 0.8239, 1.0181, 1.1995, 1.3759, - 1.5669, 1.7722, 1.9671, 2.1635, 2.3586, 2.5528, 2.7445, 2.9311, - 0.0912, 0.1759, 0.3066, 0.5660, 0.8005, 0.9568, 1.1832, 1.4504, - 1.6259, 1.7948, 2.0113, 2.2002, 2.3654, 2.5583, 2.7929, 2.9735, - 0.1353, 0.2747, 0.4078, 0.5977, 0.7658, 0.9124, 1.1081, 1.3630, - 1.5875, 1.7847, 1.9323, 2.1181, 2.3321, 2.5046, 2.7183, 2.9225, - 0.1938, 0.4063, 0.4982, 0.6002, 0.7702, 0.9071, 1.1631, 1.3885, - 1.6043, 1.8118, 1.9306, 2.0893, 2.2724, 2.4609, 2.6283, 2.8802, - 0.1857, 0.3351, 0.4381, 0.6101, 0.7561, 0.8555, 1.0384, 1.3171, - 1.5667, 1.6904, 1.7552, 1.9689, 2.2597, 2.5260, 2.7272, 2.9337, - 0.1037, 0.2159, 0.4188, 0.6174, 0.8035, 1.0285, 1.2256, 1.4230, - 1.6400, 1.8322, 2.0144, 2.1988, 2.3810, 2.5682, 2.7613, 2.9438, - 0.1625, 0.2776, 0.4225, 0.6001, 0.7879, 0.9087, 1.0801, 1.2759, - 1.4899, 1.7448, 1.9911, 2.1770, 2.3723, 2.5777, 2.7971, 2.9444, - 0.2111, 0.3640, 0.5839, 0.7290, 0.8051, 1.0023, 1.2315, 1.4143, - 1.5878, 1.7755, 1.9804, 2.1498, 2.3312, 2.5350, 2.7613, 2.9472, - 0.1423, 0.2646, 0.4136, 0.6350, 0.8070, 0.9514, 1.1168, 1.3213, - 1.5776, 1.7721, 1.9404, 2.1545, 2.3385, 2.5137, 2.7396, 2.9553, - 0.1132, 0.2386, 0.4103, 0.5931, 0.7808, 0.9881, 1.1840, 1.3860, - 1.6021, 1.7990, 1.9922, 2.1885, 2.3852, 2.5717, 2.7640, 2.9510, - 0.1267, 0.2602, 0.3913, 0.5944, 0.7598, 0.9198, 1.0781, 1.2715, - 1.5299, 1.7573, 1.9308, 2.1346, 2.3267, 2.5419, 2.7466, 2.9320, - 0.2023, 0.3417, 0.4392, 0.6141, 0.7439, 0.8593, 1.1096, 1.3543, - 1.5185, 1.6553, 1.7862, 2.0341, 2.2718, 2.4834, 2.7103, 2.9466, - 0.1113, 0.2470, 0.3677, 0.5686, 0.7700, 0.9356, 1.0806, 1.2452, - 1.4830, 1.7344, 1.9268, 2.1404, 2.3371, 2.5169, 2.7329, 2.9012, - 0.1664, 0.3554, 0.5573, 0.7471, 0.9245, 1.0998, 1.2787, 1.4655, - 1.6654, 1.8346, 2.0179, 2.2159, 2.4096, 2.5946, 2.7790, 2.9530, - 0.1313, 0.2625, 0.4731, 0.6444, 0.8110, 0.9878, 1.1493, 1.3212, - 1.5719, 1.8138, 1.9861, 2.1943, 2.3714, 2.5578, 2.7346, 2.9296, - 0.1186, 0.3035, 0.5049, 0.6860, 0.8670, 0.9975, 1.1364, 1.3471, - 1.5695, 1.7412, 1.9346, 2.1506, 2.3413, 2.5531, 2.7794, 2.9627, - 0.1108, 0.2697, 0.4787, 0.6344, 0.7909, 0.9586, 1.1440, 1.3511, - 1.5686, 1.7601, 1.9246, 2.1241, 2.3293, 2.5390, 2.7315, 2.9333, - 0.0985, 0.2302, 0.3544, 0.5759, 0.7620, 0.9651, 1.1497, 1.3080, - 1.5500, 1.7845, 1.9518, 2.1734, 2.3565, 2.5665, 2.7605, 2.9102, - 0.1208, 0.2727, 0.4381, 0.5736, 0.7382, 0.8390, 1.0102, 1.2648, - 1.5100, 1.7440, 1.9619, 2.1430, 2.3307, 2.5159, 2.7264, 2.9211, - 0.1582, 0.2777, 0.4475, 0.6551, 0.8591, 1.0084, 1.1414, 1.3291, - 1.5902, 1.7826, 1.9543, 2.1659, 2.3233, 2.5044, 2.6935, 2.9199, - 0.1360, 0.2873, 0.4585, 0.6295, 0.7592, 0.9089, 1.0492, 1.2733, - 1.5391, 1.7768, 1.9372, 2.1329, 2.3168, 2.5015, 2.6857, 2.8837, - 0.0886, 0.1829, 0.3696, 0.6126, 0.8334, 1.0135, 1.2303, 1.4674, - 1.6743, 1.8564, 2.0530, 2.2370, 2.3960, 2.5787, 2.7756, 2.9377, - 0.2005, 0.3537, 0.4700, 0.6249, 0.7385, 0.9097, 1.1759, 1.3811, - 1.5314, 1.6705, 1.8546, 2.1229, 2.3292, 2.5251, 2.7951, 2.9646, - 0.1999, 0.3112, 0.4722, 0.7146, 0.8908, 1.0028, 1.1831, 1.3903, - 1.6125, 1.7514, 1.9083, 2.1248, 2.3271, 2.5339, 2.6945, 2.8918, - 0.1243, 0.2606, 0.4382, 0.5850, 0.7705, 0.9727, 1.1214, 1.3059, - 1.5218, 1.7406, 1.9137, 2.1353, 2.3354, 2.5299, 2.7287, 2.9068, - 0.1039, 0.2426, 0.4265, 0.6284, 0.8152, 0.9941, 1.2004, 1.4038, - 1.5912, 1.7763, 1.9650, 2.1598, 2.3474, 2.5488, 2.7419, 2.9322, - 0.1364, 0.2420, 0.3886, 0.5864, 0.7663, 0.8844, 1.0860, 1.3242, - 1.5518, 1.7893, 2.0004, 2.1562, 2.3619, 2.5516, 2.7687, 2.9181, - 0.1483, 0.2851, 0.4479, 0.6312, 0.7924, 0.9821, 1.1705, 1.3386, - 1.5375, 1.7226, 1.9053, 2.0991, 2.2898, 2.4953, 2.7000, 2.9146, - 0.2332, 0.4561, 0.5407, 0.6212, 0.7524, 0.8215, 0.9522, 1.1685, - 1.5216, 1.7132, 1.8291, 2.0647, 2.2811, 2.4857, 2.7071, 2.9281, - 0.1348, 0.3126, 0.5179, 0.7192, 0.9227, 1.1363, 1.3223, 1.4756, - 1.6509, 1.8191, 1.9991, 2.1976, 2.3877, 2.5768, 2.7590, 2.9386, - 0.1093, 0.2211, 0.4763, 0.6703, 0.8282, 0.9536, 1.1202, 1.3796, - 1.6043, 1.8031, 1.9832, 2.1604, 2.3578, 2.5856, 2.7650, 2.9291, - 0.1865, 0.3027, 0.4580, 0.6719, 0.8400, 1.0082, 1.1901, 1.3782, - 1.5448, 1.6885, 1.9477, 2.1381, 2.2797, 2.5113, 2.7465, 2.9414, - 0.1575, 0.3124, 0.4649, 0.6262, 0.8095, 0.9858, 1.1676, 1.3602, - 1.5646, 1.7582, 1.9550, 2.1671, 2.3628, 2.5734, 2.7670, 2.9519, - 0.1174, 0.2777, 0.4663, 0.6333, 0.8169, 1.0096, 1.1885, 1.3847, - 1.5803, 1.7571, 1.9380, 2.1398, 2.3414, 2.5407, 2.7360, 2.9375, - 0.1073, 0.2264, 0.4083, 0.5973, 0.7474, 0.9514, 1.1349, 1.3337, - 1.5433, 1.7348, 1.9380, 2.1436, 2.3441, 2.5438, 2.7457, 2.9383, - 0.1472, 0.2880, 0.4793, 0.6268, 0.8015, 1.0063, 1.1715, 1.3644, - 1.5525, 1.7410, 1.9258, 2.1227, 2.3214, 2.5149, 2.7148, 2.9196, - 0.1414, 0.2565, 0.4349, 0.6111, 0.7695, 0.9496, 1.1212, 1.3265, - 1.5218, 1.7209, 1.9015, 2.0887, 2.3158, 2.5077, 2.7233, 2.9421, - 0.1252, 0.2667, 0.4454, 0.6431, 0.8371, 1.0124, 1.2110, 1.4160, - 1.6240, 1.8242, 2.0047, 2.1974, 2.3902, 2.5778, 2.7637, 2.9481, - 0.1321, 0.2565, 0.3846, 0.5847, 0.7578, 0.9259, 1.0637, 1.2239, - 1.4690, 1.7346, 1.9750, 2.1882, 2.3712, 2.5509, 2.7280, 2.8885, - 0.1437, 0.2930, 0.4428, 0.6156, 0.8045, 0.9638, 1.1450, 1.3138, - 1.5144, 1.7355, 1.9469, 2.1534, 2.3414, 2.5452, 2.7353, 2.9334, - 0.1692, 0.2770, 0.3831, 0.6100, 0.7825, 0.9302, 1.0690, 1.2481, - 1.4615, 1.6799, 1.9165, 2.1739, 2.3435, 2.5349, 2.7520, 2.9163, - 0.1235, 0.2489, 0.4354, 0.6343, 0.8236, 1.0066, 1.1908, 1.3474, - 1.5656, 1.8275, 2.0620, 2.2548, 2.4135, 2.5913, 2.7639, 2.9334, - 0.1090, 0.1961, 0.3854, 0.5701, 0.7024, 0.8843, 1.1393, 1.3785, - 1.5940, 1.7797, 1.9442, 2.1740, 2.3853, 2.5773, 2.7727, 2.9406, - 0.1560, 0.3477, 0.5011, 0.6287, 0.7612, 0.9896, 1.1510, 1.3420, - 1.5435, 1.6816, 1.8731, 2.0651, 2.2613, 2.4999, 2.7027, 2.8971, - 0.1459, 0.2416, 0.3833, 0.5450, 0.7916, 0.9223, 1.0662, 1.1953, - 1.4029, 1.6616, 1.9320, 2.1459, 2.3386, 2.5081, 2.6799, 2.9195, - 0.1546, 0.3854, 0.6184, 0.8460, 1.0599, 1.2428, 1.3906, 1.5550, - 1.7388, 1.8945, 2.0757, 2.2386, 2.4014, 2.5705, 2.7574, 2.9400, - 0.1080, 0.2307, 0.4112, 0.6067, 0.7725, 0.9467, 1.1285, 1.3205, - 1.5348, 1.7609, 1.9937, 2.1878, 2.3583, 2.5515, 2.7199, 2.9049, - 0.1482, 0.3178, 0.4983, 0.6342, 0.7783, 0.9880, 1.2019, 1.3404, - 1.5223, 1.7296, 1.9211, 2.0943, 2.2928, 2.5008, 2.7136, 2.9224, - 0.1145, 0.2910, 0.4891, 0.6492, 0.8126, 0.9530, 1.1180, 1.3155, - 1.5054, 1.6893, 1.8899, 2.1188, 2.3389, 2.5512, 2.7313, 2.9224, - 0.0939, 0.1689, 0.3250, 0.5792, 0.7698, 0.9245, 1.1574, 1.3865, - 1.5959, 1.7977, 1.9821, 2.1528, 2.3326, 2.5540, 2.7553, 2.9179, - 0.1243, 0.2474, 0.3923, 0.6199, 0.7908, 0.9379, 1.1497, 1.3734, - 1.5582, 1.7420, 1.9539, 2.1385, 2.3240, 2.5277, 2.7311, 2.9178, - 0.1961, 0.3748, 0.5176, 0.6387, 0.8169, 1.0477, 1.2124, 1.3869, - 1.5604, 1.7225, 1.8770, 2.0837, 2.2960, 2.5103, 2.6945, 2.8862, - 0.1295, 0.2403, 0.4149, 0.6189, 0.7913, 0.9130, 1.0832, 1.2787, - 1.4860, 1.7112, 1.9502, 2.1348, 2.2776, 2.4982, 2.7431, 2.9522, - 0.0160, 0.0362, 0.0097, 0.0057, -0.0014, -0.0073, -0.0046, -0.0064, --0.0121, 0.0019, 0.0149, -0.0440, -0.0479, -0.0382, -0.0480, -0.0182, - 0.0170, 0.0114, -0.0298, -0.0175, -0.0033, -0.0354, -0.0510, -0.0025, - 0.0307, 0.0351, 0.0338, 0.0420, 0.0138, -0.0175, -0.0102, 0.0053, - 0.0084, -0.0003, 0.0412, -0.0027, 0.0145, -0.0039, 0.0083, 0.0400, - 0.0001, -0.0262, 0.0055, -0.0082, 0.0348, 0.0433, 0.0137, -0.0024, --0.0055, 0.0262, 0.0521, 0.0349, 0.0185, 0.0076, -0.0319, -0.0561, --0.0460, -0.0253, -0.0097, 0.0163, 0.0184, -0.0037, -0.0480, -0.0371, - 0.0628, 0.0665, 0.0296, -0.0057, 0.0253, 0.0227, 0.0350, 0.0692, - 0.0545, 0.0218, 0.0094, -0.0449, -0.0372, 0.0005, 0.0258, 0.0118, - 0.0285, 0.0760, 0.0822, 0.0527, -0.0299, -0.0049, 0.0170, 0.0195, - 0.0136, 0.0286, 0.0289, 0.0139, 0.0054, 0.0152, 0.0244, 0.0028, --0.0056, -0.0260, 0.0307, 0.0572, -0.0087, 0.0088, 0.0062, 0.0000, - 0.0125, 0.0000, -0.0292, 0.0820, 0.0872, 0.0646, 0.0346, 0.0076, --0.0022, -0.0253, -0.0567, -0.0188, -0.0336, -0.0673, -0.0549, -0.0166, --0.0259, -0.0140, 0.0040, -0.0029, -0.0430, -0.0531, -0.0253, -0.0019, --0.0071, 0.0393, 0.0072, -0.0327, -0.0236, -0.0235, -0.0177, -0.0186, --0.0280, -0.0201, -0.0077, 0.0383, 0.0418, 0.0321, 0.0294, 0.0169, - 0.0468, 0.0301, 0.0133, 0.0363, 0.0516, 0.0937, 0.1240, 0.1404, - 0.1325, 0.1178, 0.0999, 0.0251, -0.0037, -0.0495, -0.0703, -0.0219, --0.0261, -0.0304, -0.0204, -0.0372, 0.0355, 0.0131, -0.0093, -0.0099, --0.0069, -0.0034, -0.0065, -0.0208, -0.0231, -0.0117, -0.0211, -0.0243, - 0.0046, -0.0107, -0.0070, 0.0123, 0.0230, 0.0152, 0.0164, 0.0412, - 0.0619, 0.0858, 0.0862, -0.0056, 0.0125, 0.0182, 0.0347, 0.0388, - 0.0456, 0.0407, -0.0249, -0.0460, 0.0206, 0.0299, 0.0253, 0.0207, - 0.0177, 0.0238, 0.0253, 0.0030, 0.0042, 0.0020, -0.0081, -0.0136, --0.0290, -0.0042, 0.0122, 0.0051, 0.0107, 0.0228, 0.0211, -0.0068, --0.0436, -0.0299, -0.0078, -0.0779, -0.1157, -0.0679, 0.0172, 0.0150, --0.0051, 0.0081, -0.0512, -0.0616, 0.0576, 0.0799, 0.0803, 0.0336, - 0.0001, -0.0298, -0.0747, -0.0115, -0.0101, -0.0170, -0.0050, 0.0174, --0.0290, -0.0601, -0.0150, 0.0121, 0.0165, 0.0230, 0.0028, -0.0317, --0.0165, 0.0356, 0.0451, 0.0120, 0.0321, 0.0084, -0.0058, 0.0122, - 0.1935, 0.1802, 0.2195, 0.2410, 0.2201, 0.1915, 0.1840, 0.1935, - 0.2213, 0.2079, 0.1858, 0.1974, 0.2239, 0.2173, 0.1840, 0.2120, - 0.4912, 0.4777, 0.4607, 0.4395, 0.4426, 0.4388, 0.4416, 0.4345, - 0.4239, 0.4331, 0.4522, 0.4423, 0.4475, 0.4387, 0.4525, 0.4446 -}, - -.lsp22_2 = { - 0.0712, 0.1830, 0.4167, 0.6669, 0.8738, 1.0696, 1.2555, 1.4426, - 1.6427, 1.8138, 1.9966, 2.1925, 2.3872, 2.5748, 2.7713, 2.9597, - 0.1894, 0.3942, 0.5418, 0.6747, 0.7517, 0.8763, 1.1189, 1.3072, - 1.5011, 1.6790, 1.8342, 2.0781, 2.2929, 2.4566, 2.6613, 2.9204, - 0.1767, 0.3403, 0.5173, 0.7055, 0.8899, 1.0696, 1.2302, 1.4111, - 1.5989, 1.7751, 1.9618, 2.1544, 2.3454, 2.5356, 2.7362, 2.9315, - 0.1240, 0.2361, 0.4423, 0.6326, 0.7729, 0.9387, 1.1142, 1.2847, - 1.4746, 1.7126, 1.9482, 2.1642, 2.3536, 2.5506, 2.7593, 2.9197, - 0.1213, 0.2782, 0.5011, 0.6910, 0.8564, 1.0462, 1.2315, 1.4232, - 1.6178, 1.8028, 1.9813, 2.1766, 2.3670, 2.5591, 2.7475, 2.9403, - 0.1382, 0.2995, 0.4693, 0.5874, 0.6929, 0.8102, 1.0094, 1.2960, - 1.5511, 1.7607, 1.9699, 2.1680, 2.3367, 2.5459, 2.7370, 2.9105, - 0.1428, 0.2690, 0.3713, 0.4757, 0.6664, 0.9019, 1.1276, 1.3674, - 1.5471, 1.6695, 1.8261, 2.0572, 2.2753, 2.4963, 2.7187, 2.9114, - 0.1669, 0.3085, 0.4489, 0.5724, 0.6934, 0.8465, 0.9680, 1.1641, - 1.4320, 1.6841, 1.8977, 2.1061, 2.3118, 2.5152, 2.7329, 2.9274, - 0.1128, 0.2709, 0.4803, 0.6878, 0.8673, 1.0693, 1.2749, 1.4657, - 1.6650, 1.8434, 2.0339, 2.2300, 2.4003, 2.5951, 2.7762, 2.9465, - 0.1201, 0.2345, 0.4021, 0.6379, 0.8651, 1.0256, 1.1630, 1.3250, - 1.5395, 1.7808, 2.0011, 2.1997, 2.3618, 2.5505, 2.7561, 2.9351, - 0.2575, 0.4163, 0.5081, 0.6484, 0.8570, 1.0832, 1.2732, 1.3933, - 1.5497, 1.7725, 1.9945, 2.2098, 2.3514, 2.5216, 2.7146, 2.8969, - 0.1367, 0.2656, 0.4470, 0.6398, 0.8146, 1.0125, 1.2142, 1.3960, - 1.5558, 1.7338, 1.9465, 2.1769, 2.4031, 2.5746, 2.7335, 2.9046, - 0.0868, 0.1723, 0.2785, 0.5071, 0.7732, 1.0024, 1.1924, 1.4220, - 1.6149, 1.8064, 1.9951, 2.1935, 2.3777, 2.5748, 2.7661, 2.9488, - 0.1428, 0.2592, 0.3875, 0.5810, 0.7513, 0.9334, 1.1096, 1.3565, - 1.5869, 1.7788, 1.9036, 2.0893, 2.3332, 2.5289, 2.7204, 2.9053, - 0.2313, 0.4066, 0.4960, 0.5853, 0.7799, 0.9201, 1.1365, 1.3499, - 1.5119, 1.7641, 1.9095, 2.0911, 2.2653, 2.4587, 2.7010, 2.8900, - 0.1927, 0.3424, 0.4682, 0.6035, 0.7330, 0.8492, 1.0477, 1.3083, - 1.5602, 1.6945, 1.7806, 2.0066, 2.2566, 2.4864, 2.7021, 2.9180, - 0.0962, 0.1933, 0.3968, 0.6077, 0.8083, 1.0224, 1.2307, 1.4344, - 1.6350, 1.8173, 2.0024, 2.1894, 2.3812, 2.5648, 2.7535, 2.9483, - 0.1469, 0.2679, 0.4272, 0.6080, 0.7949, 0.9247, 1.0741, 1.2722, - 1.5144, 1.7679, 2.0030, 2.1944, 2.3890, 2.5928, 2.8116, 2.9555, - 0.1618, 0.3917, 0.6111, 0.7511, 0.8325, 1.0010, 1.2397, 1.4147, - 1.5764, 1.7359, 1.9300, 2.1325, 2.3096, 2.5480, 2.7725, 2.9697, - 0.1561, 0.2634, 0.4062, 0.6139, 0.8059, 0.9618, 1.0948, 1.3179, - 1.5846, 1.7622, 1.9399, 2.1476, 2.3330, 2.5232, 2.7412, 2.9554, - 0.1076, 0.2320, 0.3977, 0.5798, 0.7707, 0.9975, 1.1884, 1.3793, - 1.6059, 1.8038, 1.9928, 2.1942, 2.3881, 2.5742, 2.7717, 2.9547, - 0.1360, 0.2493, 0.3827, 0.5644, 0.7384, 0.9087, 1.0865, 1.2902, - 1.5185, 1.7246, 1.9170, 2.1175, 2.3324, 2.5442, 2.7441, 2.9437, - 0.1684, 0.2990, 0.4406, 0.5834, 0.7305, 0.9028, 1.0801, 1.2756, - 1.4646, 1.6514, 1.8346, 2.0493, 2.2594, 2.4765, 2.6985, 2.9089, - 0.1145, 0.2295, 0.3421, 0.5032, 0.7007, 0.9057, 1.0830, 1.2733, - 1.4885, 1.6897, 1.8933, 2.1128, 2.3188, 2.5271, 2.7284, 2.9266, - 0.1705, 0.3815, 0.6120, 0.7964, 0.9342, 1.0926, 1.2741, 1.4645, - 1.6552, 1.8040, 1.9778, 2.1931, 2.3836, 2.5827, 2.7905, 2.9494, - 0.1284, 0.2622, 0.4714, 0.6559, 0.8004, 1.0005, 1.1416, 1.3163, - 1.5773, 1.8144, 1.9947, 2.2001, 2.3836, 2.5710, 2.7447, 2.9262, - 0.1164, 0.2882, 0.5349, 0.7310, 0.8483, 0.9729, 1.1331, 1.3350, - 1.5307, 1.7306, 1.9409, 2.1275, 2.3229, 2.5358, 2.7455, 2.9447, - 0.1159, 0.2646, 0.4677, 0.6375, 0.7771, 0.9557, 1.1398, 1.3514, - 1.5717, 1.7512, 1.9337, 2.1323, 2.3272, 2.5409, 2.7377, 2.9212, - 0.1080, 0.2143, 0.3475, 0.5307, 0.7358, 0.9681, 1.1489, 1.3289, - 1.5553, 1.7664, 1.9696, 2.1780, 2.3676, 2.5568, 2.7493, 2.9347, - 0.1331, 0.2430, 0.3879, 0.5092, 0.6324, 0.8119, 1.0327, 1.2657, - 1.4999, 1.7107, 1.9178, 2.1272, 2.3296, 2.5340, 2.7372, 2.9353, - 0.1557, 0.2873, 0.4558, 0.6548, 0.8472, 1.0106, 1.1480, 1.3281, - 1.5856, 1.7740, 1.9564, 2.1651, 2.3295, 2.5207, 2.7005, 2.9151, - 0.1397, 0.2761, 0.4533, 0.6374, 0.7510, 0.8767, 1.0408, 1.2909, - 1.5368, 1.7560, 1.9424, 2.1332, 2.3210, 2.5116, 2.6924, 2.8886, - 0.0945, 0.1653, 0.3601, 0.6129, 0.8378, 1.0333, 1.2417, 1.4539, - 1.6507, 1.8304, 2.0286, 2.2157, 2.3975, 2.5865, 2.7721, 2.9426, - 0.1892, 0.3863, 0.4896, 0.5909, 0.7294, 0.9483, 1.1575, 1.3542, - 1.4796, 1.6535, 1.9070, 2.1435, 2.3281, 2.4967, 2.7039, 2.9222, - 0.1614, 0.3129, 0.5086, 0.7048, 0.8730, 1.0239, 1.1905, 1.3799, - 1.5697, 1.7503, 1.9103, 2.1115, 2.3235, 2.5234, 2.6973, 2.8957, - 0.1199, 0.2590, 0.4273, 0.5935, 0.7542, 0.9625, 1.1225, 1.2998, - 1.5361, 1.7102, 1.9097, 2.1269, 2.3157, 2.5304, 2.7212, 2.9175, - 0.1087, 0.2373, 0.4261, 0.6277, 0.8092, 0.9884, 1.1954, 1.4077, - 1.6048, 1.7799, 1.9693, 2.1662, 2.3426, 2.5501, 2.7459, 2.9257, - 0.1262, 0.2216, 0.3857, 0.5799, 0.7148, 0.8610, 1.0752, 1.3306, - 1.5549, 1.7605, 1.9727, 2.1580, 2.3612, 2.5602, 2.7554, 2.9372, - 0.1445, 0.2832, 0.4469, 0.6283, 0.7991, 0.9796, 1.1504, 1.3323, - 1.5313, 1.7140, 1.8968, 2.0990, 2.2826, 2.4903, 2.7003, 2.9031, - 0.1647, 0.4068, 0.5428, 0.6539, 0.7682, 0.8479, 0.9372, 1.1691, - 1.4776, 1.7314, 1.9071, 2.0918, 2.2774, 2.5029, 2.7152, 2.9221, - 0.1274, 0.3052, 0.5238, 0.7280, 0.9229, 1.1211, 1.3071, 1.4784, - 1.6564, 1.8235, 2.0028, 2.1999, 2.3763, 2.5608, 2.7510, 2.9356, - 0.1076, 0.2195, 0.4815, 0.6873, 0.8241, 0.9443, 1.1066, 1.3687, - 1.6087, 1.8105, 1.9857, 2.1486, 2.3505, 2.5854, 2.7785, 2.9376, - 0.1755, 0.3089, 0.4695, 0.6648, 0.8315, 1.0202, 1.1774, 1.3554, - 1.5393, 1.7141, 1.9247, 2.1284, 2.2983, 2.4975, 2.7296, 2.9401, - 0.1636, 0.3166, 0.4594, 0.6199, 0.8161, 0.9879, 1.1738, 1.3642, - 1.5680, 1.7633, 1.9598, 2.1695, 2.3692, 2.5846, 2.7809, 2.9563, - 0.1219, 0.2662, 0.4620, 0.6491, 0.8353, 1.0150, 1.2065, 1.3944, - 1.5785, 1.7631, 1.9389, 2.1434, 2.3400, 2.5316, 2.7359, 2.9513, - 0.1072, 0.2258, 0.3968, 0.5642, 0.7222, 0.9367, 1.1458, 1.3347, - 1.5424, 1.7373, 1.9303, 2.1432, 2.3451, 2.5415, 2.7444, 2.9394, - 0.1393, 0.2950, 0.4724, 0.6407, 0.8034, 1.0031, 1.1712, 1.3552, - 1.5519, 1.7411, 1.9198, 2.1160, 2.3238, 2.5119, 2.7134, 2.9205, - 0.1358, 0.2613, 0.4239, 0.5991, 0.7643, 0.9379, 1.1213, 1.3115, - 1.5067, 1.7031, 1.8768, 2.0836, 2.3092, 2.5134, 2.7237, 2.9286, - 0.1267, 0.2695, 0.4524, 0.6591, 0.8396, 1.0173, 1.2183, 1.4205, - 1.6306, 1.8162, 2.0106, 2.2082, 2.3773, 2.5787, 2.7551, 2.9387, - 0.1314, 0.2529, 0.3837, 0.5494, 0.7446, 0.9097, 1.0489, 1.2385, - 1.4691, 1.7170, 1.9600, 2.1770, 2.3594, 2.5356, 2.7215, 2.9088, - 0.1538, 0.2931, 0.4449, 0.6041, 0.7959, 0.9666, 1.1355, 1.3214, - 1.5150, 1.7230, 1.9433, 2.1408, 2.3459, 2.5476, 2.7273, 2.9330, - 0.1771, 0.2834, 0.4136, 0.5856, 0.7516, 0.9363, 1.0596, 1.2462, - 1.4737, 1.6627, 1.8810, 2.1150, 2.3202, 2.5274, 2.7403, 2.9490, - 0.1248, 0.2494, 0.4397, 0.6352, 0.8226, 1.0015, 1.1799, 1.3458, - 1.5654, 1.8228, 2.0646, 2.2550, 2.4161, 2.5964, 2.7675, 2.9383, - 0.0933, 0.1993, 0.3105, 0.4371, 0.6417, 0.8935, 1.1244, 1.3508, - 1.5649, 1.7595, 1.9581, 2.1648, 2.3639, 2.5569, 2.7573, 2.9468, - 0.1794, 0.3229, 0.4758, 0.6238, 0.7821, 0.9640, 1.1205, 1.3116, - 1.5054, 1.6803, 1.8658, 2.0651, 2.2793, 2.4856, 2.6867, 2.9105, - 0.1252, 0.2397, 0.3844, 0.5398, 0.7044, 0.8799, 1.0526, 1.2270, - 1.4269, 1.6412, 1.8532, 2.0784, 2.2957, 2.5051, 2.7139, 2.9210, - 0.1391, 0.3494, 0.5738, 0.8024, 1.0098, 1.2094, 1.3830, 1.5509, - 1.7222, 1.8782, 2.0604, 2.2479, 2.4154, 2.5968, 2.7767, 2.9450, - 0.1122, 0.2180, 0.4175, 0.6074, 0.7559, 0.9465, 1.1513, 1.3340, - 1.5215, 1.7491, 1.9911, 2.1894, 2.3433, 2.5377, 2.7380, 2.9183, - 0.1595, 0.3029, 0.4842, 0.6324, 0.7874, 0.9814, 1.1992, 1.3554, - 1.5017, 1.7274, 1.9168, 2.0853, 2.2964, 2.5300, 2.7187, 2.9041, - 0.1350, 0.2747, 0.4791, 0.6638, 0.8050, 0.9644, 1.1238, 1.2987, - 1.4844, 1.6754, 1.8778, 2.0987, 2.3279, 2.5424, 2.7410, 2.9356, - 0.0914, 0.1727, 0.3143, 0.5124, 0.7123, 0.9323, 1.1706, 1.3821, - 1.5864, 1.7828, 1.9701, 2.1560, 2.3445, 2.5486, 2.7433, 2.9372, - 0.1222, 0.2359, 0.3931, 0.5912, 0.7776, 0.9505, 1.1623, 1.3723, - 1.5484, 1.7316, 1.9321, 2.1283, 2.3148, 2.5269, 2.7299, 2.9213, - 0.2089, 0.3872, 0.5090, 0.6413, 0.7967, 1.0226, 1.1897, 1.3908, - 1.5954, 1.7202, 1.8614, 2.1030, 2.2973, 2.5079, 2.7491, 2.8944, - 0.1288, 0.2423, 0.4108, 0.6062, 0.7688, 0.9188, 1.0876, 1.2866, - 1.4897, 1.6910, 1.9219, 2.1076, 2.2805, 2.5023, 2.7155, 2.9203, - 0.0192, 0.0462, 0.0128, 0.0054, -0.0156, -0.0118, -0.0135, 0.0030, --0.0120, 0.0031, 0.0240, -0.0451, -0.0439, -0.0432, -0.0527, -0.0207, - 0.0253, 0.0084, -0.0305, -0.0144, 0.0046, -0.0378, -0.0467, -0.0102, - 0.0280, 0.0540, 0.0151, 0.0437, 0.0141, -0.0257, -0.0058, 0.0073, - 0.0107, 0.0054, 0.0371, -0.0105, 0.0165, -0.0143, 0.0148, 0.0382, --0.0054, -0.0284, 0.0001, -0.0218, 0.0258, 0.0517, 0.0157, -0.0032, --0.0190, 0.0343, 0.0576, 0.0346, 0.0392, -0.0158, -0.0323, -0.0578, --0.0617, -0.0242, -0.0144, 0.0188, 0.0249, 0.0021, -0.0422, -0.0420, - 0.0750, 0.0762, 0.0325, -0.0066, 0.0332, 0.0376, 0.0388, 0.0630, - 0.0525, 0.0196, 0.0051, -0.0484, -0.0322, 0.0059, 0.0132, 0.0079, - 0.0237, 0.0774, 0.0697, 0.0184, -0.0321, -0.0327, 0.0274, 0.0284, - 0.0057, 0.0289, 0.0478, 0.0142, -0.0053, 0.0114, 0.0292, -0.0032, --0.0111, -0.0389, 0.0282, 0.0613, 0.0200, -0.0006, 0.0111, 0.0048, - 0.0273, 0.0017, -0.0369, 0.0655, 0.0758, 0.0555, 0.0238, -0.0024, --0.0100, -0.0419, -0.0696, -0.0158, -0.0479, -0.0744, -0.0356, -0.0245, --0.0400, -0.0112, 0.0134, 0.0001, -0.0422, -0.0514, -0.0081, 0.0083, --0.0151, 0.0323, -0.0001, -0.0444, -0.0406, -0.0214, -0.0050, -0.0235, --0.0205, -0.0264, -0.0324, 0.0334, 0.0392, 0.0265, 0.0289, 0.0180, - 0.0493, 0.0227, 0.0194, 0.0365, 0.0544, 0.0674, 0.0559, 0.0732, - 0.0911, 0.0942, 0.0735, 0.0174, -0.0113, -0.0553, -0.0665, -0.0227, --0.0259, -0.0266, -0.0239, -0.0379, 0.0329, 0.0173, -0.0210, -0.0114, --0.0063, 0.0060, -0.0089, -0.0198, -0.0282, -0.0080, -0.0179, -0.0290, - 0.0046, -0.0126, -0.0066, 0.0350, 0.0532, 0.0235, 0.0198, 0.0212, - 0.0449, 0.0681, 0.0677, -0.0049, 0.0086, 0.0120, 0.0356, 0.0454, - 0.0592, 0.0449, -0.0271, -0.0510, -0.0110, 0.0234, 0.0203, 0.0243, - 0.0242, 0.0133, 0.0098, 0.0040, 0.0024, -0.0005, -0.0075, -0.0126, --0.0393, -0.0052, 0.0165, 0.0016, -0.0193, 0.0239, 0.0336, 0.0029, --0.0586, -0.0539, -0.0094, -0.0664, -0.0898, -0.0540, -0.0066, 0.0134, --0.0074, 0.0067, -0.0521, -0.0431, 0.0104, 0.0690, 0.0663, 0.0197, --0.0017, -0.0518, -0.0597, -0.0171, -0.0054, -0.0140, -0.0080, 0.0172, --0.0362, -0.0713, -0.0310, 0.0096, 0.0243, 0.0381, -0.0062, -0.0392, --0.0281, 0.0386, 0.0461, 0.0069, 0.0384, 0.0080, -0.0141, 0.0171, - 0.3368, 0.3128, 0.3304, 0.3392, 0.3185, 0.3037, 0.2789, 0.2692, - 0.2779, 0.2796, 0.2891, 0.2643, 0.2647, 0.2593, 0.2927, 0.3283, - 0.4978, 0.4988, 0.4969, 0.4997, 0.4957, 0.4985, 0.4970, 0.4978, - 0.4938, 0.4951, 0.4994, 0.4971, 0.4981, 0.4983, 0.4967, 0.4789 -}, - -.lsp44 = { - 0.0927, 0.2291, 0.4059, 0.5779, 0.7288, 0.8821, 1.0377, 1.1915, - 1.3433, 1.4931, 1.6475, 1.7989, 1.9381, 2.0858, 2.2321, 2.3765, - 2.5187, 2.6530, 2.7895, 2.9354, 0.0944, 0.1974, 0.3046, 0.4714, - 0.6116, 0.7829, 0.9027, 1.0375, 1.1869, 1.3488, 1.5036, 1.6781, - 1.8276, 1.9983, 2.1449, 2.3089, 2.4534, 2.6113, 2.7553, 2.9062, - 0.1168, 0.2843, 0.4907, 0.6706, 0.8100, 0.9417, 1.0753, 1.2014, - 1.3151, 1.4496, 1.5832, 1.7379, 1.8642, 2.0230, 2.1681, 2.3250, - 2.4676, 2.6242, 2.7602, 2.9066, 0.1353, 0.2335, 0.3370, 0.4380, - 0.5819, 0.7353, 0.8671, 1.0160, 1.1435, 1.2977, 1.4860, 1.6739, - 1.8412, 2.0028, 2.1537, 2.3124, 2.4741, 2.6272, 2.7862, 2.9536, - 0.1003, 0.2226, 0.3584, 0.4971, 0.6291, 0.7710, 0.9157, 1.0669, - 1.2143, 1.3624, 1.5104, 1.6681, 1.8164, 1.9823, 2.1394, 2.3082, - 2.4677, 2.6306, 2.7909, 2.9382, 0.1056, 0.2027, 0.2956, 0.4005, - 0.5215, 0.6708, 0.8545, 1.0557, 1.2344, 1.4023, 1.5676, 1.7278, - 1.8808, 2.0381, 2.1846, 2.3376, 2.4887, 2.6377, 2.7878, 2.9504, - 0.1015, 0.2462, 0.4122, 0.5783, 0.7233, 0.8833, 1.0377, 1.1903, - 1.3341, 1.4727, 1.6138, 1.7582, 1.8912, 2.0370, 2.1701, 2.3125, - 2.4500, 2.6006, 2.7507, 2.9166, 0.1787, 0.2418, 0.3265, 0.5379, - 0.6584, 0.7681, 0.9545, 1.1050, 1.2125, 1.3528, 1.4763, 1.6705, - 1.8136, 1.9594, 2.0936, 2.2724, 2.4394, 2.5919, 2.7037, 2.8747, - 0.0859, 0.1600, 0.2980, 0.4933, 0.6696, 0.8285, 0.9958, 1.1545, - 1.3107, 1.4591, 1.6127, 1.7652, 1.9143, 2.0680, 2.2171, 2.3643, - 2.5141, 2.6611, 2.8143, 2.9691, 0.0910, 0.2110, 0.3364, 0.4718, - 0.5856, 0.7298, 0.8910, 1.0514, 1.1988, 1.3572, 1.5178, 1.6861, - 1.8399, 2.0099, 2.1639, 2.3225, 2.4774, 2.6321, 2.7863, 2.9412, - 0.1904, 0.2874, 0.3681, 0.4981, 0.6248, 0.7880, 0.9121, 1.0750, - 1.2185, 1.3809, 1.5296, 1.7007, 1.8592, 2.0470, 2.1913, 2.3250, - 2.4519, 2.5984, 2.7408, 2.9023, 0.0917, 0.2067, 0.3246, 0.4961, - 0.6310, 0.8024, 0.9438, 1.1008, 1.2362, 1.3892, 1.5407, 1.7033, - 1.8427, 2.0061, 2.1498, 2.3117, 2.4550, 2.6053, 2.7462, 2.9029, - 0.0989, 0.2193, 0.3756, 0.5410, 0.6929, 0.8368, 0.9801, 1.1250, - 1.2677, 1.4184, 1.5677, 1.7292, 1.8770, 2.0311, 2.1803, 2.3306, - 2.4836, 2.6339, 2.7943, 2.9549, 0.0861, 0.1943, 0.3057, 0.4867, - 0.6194, 0.7592, 0.9184, 1.1052, 1.2486, 1.4064, 1.5609, 1.7273, - 1.8703, 2.0291, 2.1686, 2.3225, 2.4628, 2.6115, 2.7471, 2.9005, - 0.0932, 0.2110, 0.3737, 0.5479, 0.7120, 0.8570, 0.9975, 1.1364, - 1.2772, 1.4220, 1.5612, 1.7089, 1.8410, 1.9827, 2.1263, 2.2859, - 2.4459, 2.6172, 2.7788, 2.9395, 0.1193, 0.2341, 0.3523, 0.5029, - 0.6437, 0.7803, 0.9367, 1.1007, 1.2392, 1.3869, 1.5425, 1.7168, - 1.8709, 2.0248, 2.1584, 2.2949, 2.4308, 2.5823, 2.7235, 2.9034, - 0.0834, 0.1988, 0.3557, 0.5261, 0.6767, 0.8427, 1.0029, 1.1683, - 1.3138, 1.4527, 1.6046, 1.7583, 1.9011, 2.0517, 2.1928, 2.3397, - 2.4839, 2.6291, 2.7771, 2.9329, 0.0938, 0.1967, 0.3213, 0.4675, - 0.6068, 0.7664, 0.9418, 1.1120, 1.2535, 1.3932, 1.5243, 1.6801, - 1.8346, 1.9931, 2.1376, 2.3035, 2.4636, 2.6244, 2.7829, 2.9371, - 0.1017, 0.2552, 0.4327, 0.6017, 0.7467, 0.8797, 1.0097, 1.1442, - 1.2628, 1.4049, 1.5541, 1.7090, 1.8461, 1.9982, 2.1486, 2.3029, - 2.4513, 2.6075, 2.7594, 2.9209, 0.1031, 0.2295, 0.3747, 0.5122, - 0.6596, 0.7935, 0.9345, 1.1050, 1.2384, 1.3543, 1.4739, 1.6136, - 1.7447, 1.8914, 2.0434, 2.1916, 2.3557, 2.5396, 2.7419, 2.9401, - 0.1007, 0.2374, 0.3715, 0.5173, 0.6465, 0.8069, 0.9553, 1.1145, - 1.2594, 1.4143, 1.5617, 1.7166, 1.8457, 2.0012, 2.1462, 2.2864, - 2.4258, 2.5910, 2.7372, 2.9018, 0.0808, 0.1726, 0.2849, 0.4592, - 0.6118, 0.7853, 0.9588, 1.1256, 1.2751, 1.4392, 1.5898, 1.7514, - 1.8977, 2.0554, 2.1937, 2.3430, 2.4831, 2.6249, 2.7601, 2.9155, - 0.1669, 0.2574, 0.3694, 0.5569, 0.6773, 0.8061, 1.0160, 1.1667, - 1.2791, 1.4041, 1.5452, 1.7207, 1.8524, 2.0038, 2.1414, 2.3338, - 2.4747, 2.6157, 2.7303, 2.8848, 0.1598, 0.2521, 0.3416, 0.5149, - 0.6703, 0.7941, 0.9408, 1.1164, 1.2017, 1.3293, 1.4908, 1.6783, - 1.8438, 1.9927, 2.1149, 2.2698, 2.4420, 2.6193, 2.7583, 2.9103, - 0.0902, 0.1978, 0.3265, 0.4578, 0.5878, 0.7439, 0.9110, 1.0906, - 1.2556, 1.4125, 1.5688, 1.7295, 1.8829, 2.0472, 2.2058, 2.3537, - 2.5075, 2.6548, 2.8058, 2.9538, 0.0818, 0.1695, 0.2794, 0.4470, - 0.6069, 0.7641, 0.9313, 1.0946, 1.2411, 1.4072, 1.5640, 1.7186, - 1.8651, 2.0254, 2.1726, 2.3286, 2.4784, 2.6287, 2.7750, 2.9339, - 0.1980, 0.3134, 0.4099, 0.4975, 0.6491, 0.8376, 0.9441, 1.0298, - 1.1795, 1.3866, 1.5784, 1.7209, 1.8137, 1.9271, 2.0863, 2.2930, - 2.4696, 2.6184, 2.7587, 2.9251, 0.1338, 0.2341, 0.3566, 0.4797, - 0.6129, 0.7580, 0.9093, 1.0491, 1.1911, 1.3313, 1.4841, 1.6503, - 1.8035, 1.9685, 2.1128, 2.2694, 2.4093, 2.5728, 2.7206, 2.8994, - 0.0937, 0.2034, 0.3447, 0.5032, 0.6370, 0.7993, 0.9674, 1.1323, - 1.2830, 1.4199, 1.5492, 1.7010, 1.8513, 2.0087, 2.1550, 2.3115, - 2.4643, 2.6237, 2.7812, 2.9392, 0.1085, 0.2152, 0.3126, 0.4569, - 0.5718, 0.7213, 0.8837, 1.0604, 1.2053, 1.3755, 1.5397, 1.7001, - 1.8409, 2.0039, 2.1498, 2.3080, 2.4535, 2.6063, 2.7505, 2.9110, - 0.0562, 0.2066, 0.4034, 0.5490, 0.6682, 0.7924, 0.9495, 1.0800, - 1.1869, 1.3156, 1.4834, 1.6619, 1.8404, 2.0199, 2.1509, 2.2755, - 2.4072, 2.5580, 2.6993, 2.8913, 0.0939, 0.2303, 0.3742, 0.5260, - 0.6662, 0.8294, 0.9769, 1.1315, 1.2792, 1.4153, 1.5436, 1.6701, - 1.8215, 1.9920, 2.1310, 2.3005, 2.4534, 2.5786, 2.7204, 2.9068, - 0.1005, 0.2442, 0.3898, 0.5398, 0.6958, 0.8474, 1.0008, 1.1556, - 1.3020, 1.4456, 1.5954, 1.7470, 1.8922, 2.0500, 2.2019, 2.3492, - 2.4963, 2.6412, 2.7890, 2.9423, 0.1022, 0.2031, 0.3213, 0.4402, - 0.5637, 0.7117, 0.8673, 1.0242, 1.1727, 1.3206, 1.4846, 1.6465, - 1.8015, 1.9655, 2.1233, 2.2873, 2.4464, 2.6074, 2.7685, 2.9409, - 0.1985, 0.3497, 0.4622, 0.5982, 0.7489, 0.8752, 0.9925, 1.1679, - 1.3288, 1.4606, 1.5820, 1.7492, 1.8922, 2.0511, 2.1780, 2.3373, - 2.4760, 2.6233, 2.7466, 2.8978, 0.1284, 0.2433, 0.3630, 0.4852, - 0.6117, 0.7460, 0.8904, 1.0360, 1.1738, 1.3142, 1.4696, 1.6185, - 1.7719, 1.9318, 2.0961, 2.2697, 2.4408, 2.6046, 2.7681, 2.9451, - 0.1042, 0.2286, 0.3598, 0.5064, 0.6438, 0.7899, 0.9350, 1.0891, - 1.2323, 1.3807, 1.5225, 1.6747, 1.8153, 1.9669, 2.1145, 2.2832, - 2.4430, 2.6085, 2.7748, 2.9346, 0.0780, 0.1724, 0.2440, 0.3489, - 0.5280, 0.7426, 0.9272, 1.0914, 1.2562, 1.4188, 1.5804, 1.7376, - 1.8909, 2.0473, 2.1946, 2.3457, 2.4950, 2.6424, 2.7926, 2.9549, - 0.1103, 0.2608, 0.4087, 0.5538, 0.6923, 0.8418, 0.9940, 1.1507, - 1.2919, 1.4406, 1.5802, 1.7262, 1.8638, 2.0085, 2.1572, 2.2975, - 2.4329, 2.5866, 2.7380, 2.9107, 0.1297, 0.2532, 0.4003, 0.5329, - 0.6733, 0.7950, 0.9557, 1.0859, 1.2235, 1.3538, 1.5037, 1.6389, - 1.7964, 1.9285, 2.0898, 2.2541, 2.4231, 2.5711, 2.6875, 2.8947, - 0.0871, 0.1968, 0.3425, 0.4949, 0.6424, 0.7959, 0.9534, 1.1132, - 1.2656, 1.4229, 1.5785, 1.7271, 1.8729, 2.0355, 2.1998, 2.3562, - 2.5151, 2.6663, 2.8145, 2.9534, 0.1038, 0.2204, 0.3248, 0.4566, - 0.5947, 0.7443, 0.8811, 1.0379, 1.2031, 1.3772, 1.5430, 1.7092, - 1.8625, 2.0322, 2.1904, 2.3417, 2.4960, 2.6458, 2.7979, 2.9485, - 0.1329, 0.2763, 0.3943, 0.5147, 0.6512, 0.8071, 0.9410, 1.0879, - 1.2298, 1.3850, 1.5282, 1.6674, 1.8137, 1.9993, 2.1344, 2.2749, - 2.4257, 2.5863, 2.7410, 2.9184, 0.1052, 0.2142, 0.3584, 0.5033, - 0.6387, 0.7804, 0.9320, 1.0780, 1.2172, 1.3764, 1.5421, 1.6887, - 1.8246, 1.9833, 2.1245, 2.2797, 2.4237, 2.5779, 2.7257, 2.9097, - 0.1092, 0.2676, 0.4071, 0.5355, 0.6661, 0.8142, 0.9621, 1.1173, - 1.2628, 1.4185, 1.5696, 1.7220, 1.8595, 2.0178, 2.1720, 2.3221, - 2.4718, 2.6259, 2.7775, 2.9334, 0.0929, 0.2017, 0.3073, 0.4570, - 0.5775, 0.7635, 0.9299, 1.0832, 1.2334, 1.3935, 1.5420, 1.7112, - 1.8601, 2.0309, 2.1735, 2.3230, 2.4543, 2.6034, 2.7418, 2.8988, - 0.0775, 0.2005, 0.3490, 0.5200, 0.6747, 0.8383, 0.9885, 1.1738, - 1.3141, 1.4236, 1.5892, 1.7402, 1.8474, 2.0210, 2.1593, 2.2730, - 2.4235, 2.5604, 2.7128, 2.9005, 0.1104, 0.2292, 0.3353, 0.4732, - 0.6152, 0.7675, 0.9164, 1.0907, 1.2594, 1.4064, 1.5218, 1.6426, - 1.8018, 1.9937, 2.1362, 2.2961, 2.4523, 2.6083, 2.7613, 2.9202, - 0.0826, 0.2000, 0.3384, 0.5144, 0.6694, 0.8377, 0.9870, 1.1461, - 1.2950, 1.4495, 1.5872, 1.7387, 1.8793, 2.0329, 2.1723, 2.3114, - 2.4415, 2.5908, 2.7354, 2.9028, 0.1063, 0.2268, 0.3442, 0.4735, - 0.6116, 0.7507, 0.9028, 1.0768, 1.2426, 1.4052, 1.5566, 1.7015, - 1.8243, 1.9742, 2.1276, 2.2824, 2.4262, 2.5953, 2.7627, 2.9290, - 0.1150, 0.2814, 0.4543, 0.6095, 0.7373, 0.8592, 0.9908, 1.1108, - 1.2339, 1.3590, 1.4864, 1.6168, 1.7392, 1.8752, 2.0212, 2.1688, - 2.3128, 2.4869, 2.7019, 2.9239, 0.0948, 0.2074, 0.3433, 0.4943, - 0.6346, 0.7645, 0.8809, 1.0610, 1.2307, 1.3487, 1.4655, 1.6186, - 1.7534, 1.8859, 2.0486, 2.2200, 2.3835, 2.5581, 2.7565, 2.9502, - 0.1062, 0.2239, 0.3683, 0.5197, 0.6704, 0.8184, 0.9642, 1.1127, - 1.2556, 1.3976, 1.5405, 1.6940, 1.8375, 1.9888, 2.1377, 2.2980, - 2.4555, 2.6184, 2.7849, 2.9452, 0.0888, 0.2005, 0.2847, 0.4322, - 0.5763, 0.7577, 0.9262, 1.1095, 1.2719, 1.4331, 1.5843, 1.7452, - 1.8845, 2.0385, 2.1805, 2.3345, 2.4750, 2.6217, 2.7555, 2.9013, - 0.1713, 0.2617, 0.3868, 0.5859, 0.7073, 0.8535, 1.0593, 1.1778, - 1.3109, 1.4508, 1.5910, 1.7463, 1.8911, 2.0651, 2.2035, 2.3355, - 2.4947, 2.6440, 2.7424, 2.8943, 0.1346, 0.2549, 0.4089, 0.5488, - 0.6949, 0.8394, 0.9810, 1.1145, 1.2528, 1.4044, 1.5423, 1.6872, - 1.8274, 1.9726, 2.1403, 2.2809, 2.4128, 2.5564, 2.6887, 2.8895, - 0.0776, 0.1621, 0.2553, 0.4191, 0.5988, 0.7921, 0.9651, 1.1350, - 1.2930, 1.4475, 1.6011, 1.7585, 1.9068, 2.0638, 2.2102, 2.3594, - 2.5096, 2.6581, 2.8099, 2.9654, 0.0864, 0.1778, 0.2854, 0.4235, - 0.5568, 0.7220, 0.8963, 1.0609, 1.2217, 1.3830, 1.5422, 1.7018, - 1.8551, 2.0206, 2.1783, 2.3328, 2.4869, 2.6366, 2.7923, 2.9539, - 0.1144, 0.2576, 0.4186, 0.5594, 0.6875, 0.8221, 0.9598, 1.0944, - 1.2273, 1.3713, 1.5152, 1.6628, 1.8070, 1.9525, 2.0965, 2.2535, - 2.4132, 2.5725, 2.7250, 2.9150, 0.1079, 0.2221, 0.3334, 0.4845, - 0.6083, 0.7516, 0.9018, 1.0594, 1.2060, 1.3673, 1.5212, 1.6880, - 1.8208, 1.9831, 2.1269, 2.2909, 2.4366, 2.6027, 2.7339, 2.8924, - 0.0994, 0.2233, 0.3634, 0.5145, 0.6568, 0.8131, 0.9746, 1.1296, - 1.2666, 1.4116, 1.5748, 1.7264, 1.8649, 2.0217, 2.1716, 2.3293, - 2.4900, 2.6455, 2.7818, 2.9362, 0.1120, 0.2079, 0.3128, 0.4124, - 0.5291, 0.6816, 0.8478, 1.0150, 1.1772, 1.3456, 1.5208, 1.6882, - 1.8458, 2.0078, 2.1627, 2.3198, 2.4733, 2.6251, 2.7796, 2.9489, - 0.0853, 0.2030, 0.3669, 0.5326, 0.6678, 0.8086, 0.9526, 1.1142, - 1.2551, 1.4158, 1.5694, 1.7073, 1.8431, 1.9686, 2.1153, 2.2376, - 2.3686, 2.5591, 2.7320, 2.9104, 0.0905, 0.2166, 0.3539, 0.5201, - 0.6700, 0.8346, 0.9883, 1.1457, 1.2714, 1.3845, 1.5172, 1.6688, - 1.8008, 1.9535, 2.1019, 2.2708, 2.4135, 2.5974, 2.7486, 2.9033, - 0.0084, 0.0374, 0.0164, -0.0153, 0.0288, 0.0107, -0.0255, -0.0242, - 0.0000, -0.0055, -0.0081, -0.0075, -0.0022, -0.0052, -0.0069, -0.0017, - 0.0003, 0.0091, 0.0028, -0.0027, 0.0085, 0.0043, -0.0235, -0.0411, - 0.0202, 0.0359, 0.0376, 0.0321, 0.0306, -0.0358, -0.0276, -0.0090, - 0.0032, 0.0048, 0.0309, 0.0332, 0.0284, 0.0237, 0.0051, -0.0101, --0.0233, -0.0428, -0.0585, -0.0387, 0.0039, 0.0081, 0.0029, -0.0017, --0.0006, -0.0068, 0.0044, 0.0182, 0.0376, 0.0387, -0.0334, -0.0269, --0.0182, -0.0069, -0.0026, 0.0035, -0.0049, -0.0212, -0.0408, -0.0245, - 0.0186, 0.0189, 0.0153, 0.0120, 0.0157, 0.0055, -0.0046, 0.0179, - 0.0284, -0.0032, -0.0261, -0.0205, -0.0039, 0.0174, 0.0299, 0.0207, - 0.0012, -0.0056, 0.0010, 0.0141, -0.0119, 0.0190, 0.0315, 0.0033, --0.0128, 0.0300, 0.0328, 0.0308, 0.0353, 0.0266, 0.0066, -0.0328, --0.0273, 0.0054, 0.0145, 0.0175, 0.0015, -0.0171, 0.0062, -0.0164, - 0.0045, -0.0071, 0.0025, 0.0278, 0.0283, 0.0117, -0.0026, -0.0285, --0.0408, -0.0366, -0.0059, -0.0208, -0.0354, -0.0334, -0.0263, -0.0064, - 0.0072, -0.0006, -0.0235, -0.0037, -0.0307, -0.0294, -0.0163, -0.0197, --0.0235, 0.0192, 0.0013, -0.0219, -0.0123, -0.0004, -0.0081, -0.0096, --0.0123, -0.0101, 0.0021, 0.0151, 0.0106, 0.0151, 0.0292, 0.0033, - 0.0283, 0.0124, 0.0058, -0.0017, -0.0038, 0.0152, 0.0141, 0.0132, - 0.0178, 0.0157, 0.0073, 0.0176, 0.0141, 0.0097, -0.0092, -0.0163, --0.0230, -0.0134, -0.0099, -0.0147, 0.0040, -0.0183, -0.0175, -0.0080, --0.0083, -0.0290, -0.0417, -0.0398, -0.0269, -0.0199, -0.0143, -0.0053, --0.0099, -0.0054, -0.0199, -0.0219, -0.0170, 0.0107, 0.0194, 0.0035, - 0.0437, 0.0406, 0.0215, 0.0120, 0.0053, -0.0028, 0.0238, 0.0337, - 0.0217, 0.0011, 0.0227, 0.0244, 0.0327, 0.0378, 0.0437, 0.0356, --0.0033, 0.0113, 0.0407, 0.0334, -0.0125, -0.0003, -0.0141, -0.0273, --0.0137, -0.0079, -0.0145, -0.0071, 0.0114, 0.0181, 0.0150, 0.0085, --0.0077, -0.0038, -0.0219, -0.0263, -0.0187, -0.0233, 0.0133, 0.0265, --0.0156, -0.0091, -0.0110, -0.0016, 0.0143, 0.0177, 0.0240, 0.0082, --0.0143, -0.0257, -0.0014, 0.0002, 0.0082, 0.0180, 0.0325, 0.0340, --0.0153, -0.0389, -0.0240, 0.0082, 0.0140, 0.0046, -0.0138, -0.0378, --0.0366, 0.0297, 0.0252, 0.0078, 0.0063, 0.0006, 0.0044, 0.0074, - 0.0094, 0.0113, 0.0105, 0.0137, 0.0438, 0.0262, -0.0078, -0.0185, --0.0215, -0.0407, -0.0435, -0.0208, -0.0004, -0.0144, -0.0205, -0.0248, --0.0159, -0.0069, -0.0153, 0.0132, 0.0355, 0.0298, 0.0120, 0.0072, - 0.0236, 0.0526, 0.0479, 0.0233, -0.0133, -0.0283, -0.0468, -0.0549, --0.0370, 0.0032, 0.0056, 0.0023, 0.0050, 0.0024, 0.0279, 0.0116, --0.0045, -0.0012, 0.0107, 0.0190, 0.0253, 0.0191, 0.0043, 0.0193, --0.0348, -0.0246, 0.0123, 0.0210, 0.0135, -0.0096, -0.0109, -0.0076, --0.0156, -0.0290, 0.0160, 0.0194, 0.0219, 0.0259, 0.0250, 0.0195, - 0.4948, 0.4961, 0.4940, 0.4878, 0.4849, 0.4727, 0.4571, 0.4551, - 0.4534, 0.4468, 0.4412, 0.4354, 0.4298, 0.4272, 0.4498, 0.4506, - 0.4560, 0.4592, 0.4758, 0.4941, 0.2476, 0.1771, 0.1974, 0.1881, - 0.1667, 0.1826, 0.2067, 0.2031, 0.1734, 0.1534, 0.1415, 0.1761, - 0.1897, 0.1772, 0.1651, 0.1247, 0.1041, 0.1231, 0.1809, 0.2234 - }, -}; - -static const uint8_t tab7[][35] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0 }, - { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0 }, - { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 }, - { 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, - 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, - 1, 0, 1 }, - { 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, 1, 0, 0, 0, 0, 0, - 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0 } -}; - -static const uint8_t tab8[][5] = { - { 0, 0, 0, 1, 1 }, - { 0, 1, 0, 0, 1 }, - { 1, 1, 0, 0, 0 }, - { 1, 0, 0, 1, 0 }, - { 0, 0, 0, 1, 1 }, - { 0, 1, 0, 0, 1 }, - { 1, 1, 0, 0, 0 }, - { 1, 0, 0, 1, 0 }, - { 0, 0, 0, 1, 1 }, - { 0, 1, 0, 0, 1 }, - { 1, 1, 0, 0, 0 }, - { 0, 0, 0, 0, 0 }, - { 0, 1, 0, 1, 0 } -}; - -static const uint8_t tab9[][45] = { - { 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 1, 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, 1, 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, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, - 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -static const uint8_t tab10[][25] = { - { 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, - 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1, 0 }, - { 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, - 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0 }, - { 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0 }, - { 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, - { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, - 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 }, - { 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, - 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1 }, - { 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0 }, - { 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, - 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1 } -}; - -static const uint8_t tab11[][55] = { - { 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, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, 1, 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, 1, 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, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 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, 0, 0, 0, 0, 0, 0, }, - { 0, 0, 0, 0, 0, 1, 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, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }, - { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, } -}; - -static const uint8_t tab12[][15] = { - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, - { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, - { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1 }, -}; - -static const struct { - int size; - const uint8_t *tab; -} tabs[] = { - { 0, NULL }, - { 5, &tab8[0][0] }, { 5, &tab8[0][0] }, { 15, &tab12[0][0] }, - { 5, &tab8[0][0] }, { 25, &tab10[0][0] }, { 15, &tab12[0][0] }, - { 35, &tab7[0][0] }, { 5, &tab8[0][0] }, { 45, &tab9[0][0] }, - { 25, &tab10[0][0] }, { 55, &tab11[0][0] }, { 15, &tab12[0][0] } -}; - -#endif /* AVCODEC_TWINVQ_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvqdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvqdec.c deleted file mode 100644 index 67ce03139..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/twinvqdec.c +++ /dev/null @@ -1,427 +0,0 @@ -/* - * TwinVQ decoder - * Copyright (c) 2009 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "libavutil/channel_layout.h" -#include "avcodec.h" -#include "get_bits.h" -#include "internal.h" -#include "twinvq.h" -#include "twinvq_data.h" - -static const TwinVQModeTab mode_08_08 = { - { - { 8, bark_tab_s08_64, 10, tab.fcb08s, 1, 5, tab.cb0808s0, tab.cb0808s1, 18 }, - { 2, bark_tab_m08_256, 20, tab.fcb08m, 2, 5, tab.cb0808m0, tab.cb0808m1, 16 }, - { 1, bark_tab_l08_512, 30, tab.fcb08l, 3, 6, tab.cb0808l0, tab.cb0808l1, 17 } - }, - 512, 12, tab.lsp08, 1, 5, 3, 3, tab.shape08, 8, 28, 20, 6, 40 -}; - -static const TwinVQModeTab mode_11_08 = { - { - { 8, bark_tab_s11_64, 10, tab.fcb11s, 1, 5, tab.cb1108s0, tab.cb1108s1, 29 }, - { 2, bark_tab_m11_256, 20, tab.fcb11m, 2, 5, tab.cb1108m0, tab.cb1108m1, 24 }, - { 1, bark_tab_l11_512, 30, tab.fcb11l, 3, 6, tab.cb1108l0, tab.cb1108l1, 27 } - }, - 512, 16, tab.lsp11, 1, 6, 4, 3, tab.shape11, 9, 36, 30, 7, 90 -}; - -static const TwinVQModeTab mode_11_10 = { - { - { 8, bark_tab_s11_64, 10, tab.fcb11s, 1, 5, tab.cb1110s0, tab.cb1110s1, 21 }, - { 2, bark_tab_m11_256, 20, tab.fcb11m, 2, 5, tab.cb1110m0, tab.cb1110m1, 18 }, - { 1, bark_tab_l11_512, 30, tab.fcb11l, 3, 6, tab.cb1110l0, tab.cb1110l1, 20 } - }, - 512, 16, tab.lsp11, 1, 6, 4, 3, tab.shape11, 9, 36, 30, 7, 90 -}; - -static const TwinVQModeTab mode_16_16 = { - { - { 8, bark_tab_s16_128, 10, tab.fcb16s, 1, 5, tab.cb1616s0, tab.cb1616s1, 16 }, - { 2, bark_tab_m16_512, 20, tab.fcb16m, 2, 5, tab.cb1616m0, tab.cb1616m1, 15 }, - { 1, bark_tab_l16_1024, 30, tab.fcb16l, 3, 6, tab.cb1616l0, tab.cb1616l1, 16 } - }, - 1024, 16, tab.lsp16, 1, 6, 4, 3, tab.shape16, 9, 56, 60, 7, 180 -}; - -static const TwinVQModeTab mode_22_20 = { - { - { 8, bark_tab_s22_128, 10, tab.fcb22s_1, 1, 6, tab.cb2220s0, tab.cb2220s1, 18 }, - { 2, bark_tab_m22_512, 20, tab.fcb22m_1, 2, 6, tab.cb2220m0, tab.cb2220m1, 17 }, - { 1, bark_tab_l22_1024, 32, tab.fcb22l_1, 4, 6, tab.cb2220l0, tab.cb2220l1, 18 } - }, - 1024, 16, tab.lsp22_1, 1, 6, 4, 3, tab.shape22_1, 9, 56, 36, 7, 144 -}; - -static const TwinVQModeTab mode_22_24 = { - { - { 8, bark_tab_s22_128, 10, tab.fcb22s_1, 1, 6, tab.cb2224s0, tab.cb2224s1, 15 }, - { 2, bark_tab_m22_512, 20, tab.fcb22m_1, 2, 6, tab.cb2224m0, tab.cb2224m1, 14 }, - { 1, bark_tab_l22_1024, 32, tab.fcb22l_1, 4, 6, tab.cb2224l0, tab.cb2224l1, 15 } - }, - 1024, 16, tab.lsp22_1, 1, 6, 4, 3, tab.shape22_1, 9, 56, 36, 7, 144 -}; - -static const TwinVQModeTab mode_22_32 = { - { - { 4, bark_tab_s22_128, 10, tab.fcb22s_2, 1, 6, tab.cb2232s0, tab.cb2232s1, 11 }, - { 2, bark_tab_m22_256, 20, tab.fcb22m_2, 2, 6, tab.cb2232m0, tab.cb2232m1, 11 }, - { 1, bark_tab_l22_512, 32, tab.fcb22l_2, 4, 6, tab.cb2232l0, tab.cb2232l1, 12 } - }, - 512, 16, tab.lsp22_2, 1, 6, 4, 4, tab.shape22_2, 9, 56, 36, 7, 72 -}; - -static const TwinVQModeTab mode_44_40 = { - { - { 16, bark_tab_s44_128, 10, tab.fcb44s, 1, 6, tab.cb4440s0, tab.cb4440s1, 18 }, - { 4, bark_tab_m44_512, 20, tab.fcb44m, 2, 6, tab.cb4440m0, tab.cb4440m1, 17 }, - { 1, bark_tab_l44_2048, 40, tab.fcb44l, 4, 6, tab.cb4440l0, tab.cb4440l1, 17 } - }, - 2048, 20, tab.lsp44, 1, 6, 4, 4, tab.shape44, 9, 84, 54, 7, 432 -}; - -static const TwinVQModeTab mode_44_48 = { - { - { 16, bark_tab_s44_128, 10, tab.fcb44s, 1, 6, tab.cb4448s0, tab.cb4448s1, 15 }, - { 4, bark_tab_m44_512, 20, tab.fcb44m, 2, 6, tab.cb4448m0, tab.cb4448m1, 14 }, - { 1, bark_tab_l44_2048, 40, tab.fcb44l, 4, 6, tab.cb4448l0, tab.cb4448l1, 14 } - }, - 2048, 20, tab.lsp44, 1, 6, 4, 4, tab.shape44, 9, 84, 54, 7, 432 -}; - -/** - * Evaluate a * b / 400 rounded to the nearest integer. When, for example, - * a * b == 200 and the nearest integer is ill-defined, use a table to emulate - * the following broken float-based implementation used by the binary decoder: - * - * @code - * static int very_broken_op(int a, int b) - * { - * static float test; // Ugh, force gcc to do the division first... - * - * test = a / 400.0; - * return b * test + 0.5; - * } - * @endcode - * - * @note if this function is replaced by just ROUNDED_DIV(a * b, 400.0), the - * stddev between the original file (before encoding with Yamaha encoder) and - * the decoded output increases, which leads one to believe that the encoder - * expects exactly this broken calculation. - */ -static int very_broken_op(int a, int b) -{ - int x = a * b + 200; - int size; - const uint8_t *rtab; - - if (x % 400 || b % 5) - return x / 400; - - x /= 400; - - size = tabs[b / 5].size; - rtab = tabs[b / 5].tab; - return x - rtab[size * av_log2(2 * (x - 1) / size) + (x - 1) % size]; -} - -/** - * Sum to data a periodic peak of a given period, width and shape. - * - * @param period the period of the peak divised by 400.0 - */ -static void add_peak(int period, int width, const float *shape, - float ppc_gain, float *speech, int len) -{ - int i, j; - - const float *shape_end = shape + len; - int center; - - // First peak centered around zero - for (i = 0; i < width / 2; i++) - speech[i] += ppc_gain * *shape++; - - for (i = 1; i < ROUNDED_DIV(len, width); i++) { - center = very_broken_op(period, i); - for (j = -width / 2; j < (width + 1) / 2; j++) - speech[j + center] += ppc_gain * *shape++; - } - - // For the last block, be careful not to go beyond the end of the buffer - center = very_broken_op(period, i); - for (j = -width / 2; j < (width + 1) / 2 && shape < shape_end; j++) - speech[j + center] += ppc_gain * *shape++; -} - -static void decode_ppc(TwinVQContext *tctx, int period_coef, int g_coef, - const float *shape, float *speech) -{ - const TwinVQModeTab *mtab = tctx->mtab; - int isampf = tctx->avctx->sample_rate / 1000; - int ibps = tctx->avctx->bit_rate / (1000 * tctx->avctx->channels); - int min_period = ROUNDED_DIV(40 * 2 * mtab->size, isampf); - int max_period = ROUNDED_DIV(40 * 2 * mtab->size * 6, isampf); - int period_range = max_period - min_period; - float pgain_step = 25000.0 / ((1 << mtab->pgain_bit) - 1); - float ppc_gain = 1.0 / 8192 * - twinvq_mulawinv(pgain_step * g_coef + - pgain_step / 2, - 25000.0, TWINVQ_PGAIN_MU); - - // This is actually the period multiplied by 400. It is just linearly coded - // between its maximum and minimum value. - int period = min_period + - ROUNDED_DIV(period_coef * period_range, - (1 << mtab->ppc_period_bit) - 1); - int width; - - if (isampf == 22 && ibps == 32) { - // For some unknown reason, NTT decided to code this case differently... - width = ROUNDED_DIV((period + 800) * mtab->peak_per2wid, - 400 * mtab->size); - } else - width = period * mtab->peak_per2wid / (400 * mtab->size); - - add_peak(period, width, shape, ppc_gain, speech, mtab->ppc_shape_len); -} - -static void dec_bark_env(TwinVQContext *tctx, const uint8_t *in, int use_hist, - int ch, float *out, float gain, - enum TwinVQFrameType ftype) -{ - const TwinVQModeTab *mtab = tctx->mtab; - int i, j; - float *hist = tctx->bark_hist[ftype][ch]; - float val = ((const float []) { 0.4, 0.35, 0.28 })[ftype]; - int bark_n_coef = mtab->fmode[ftype].bark_n_coef; - int fw_cb_len = mtab->fmode[ftype].bark_env_size / bark_n_coef; - int idx = 0; - - for (i = 0; i < fw_cb_len; i++) - for (j = 0; j < bark_n_coef; j++, idx++) { - float tmp2 = mtab->fmode[ftype].bark_cb[fw_cb_len * in[j] + i] * - (1.0 / 4096); - float st = use_hist ? (1.0 - val) * tmp2 + val * hist[idx] + 1.0 - : tmp2 + 1.0; - - hist[idx] = tmp2; - if (st < -1.0) - st = 1.0; - - twinvq_memset_float(out, st * gain, mtab->fmode[ftype].bark_tab[idx]); - out += mtab->fmode[ftype].bark_tab[idx]; - } -} - -static void read_cb_data(TwinVQContext *tctx, GetBitContext *gb, - uint8_t *dst, enum TwinVQFrameType ftype) -{ - int i; - - for (i = 0; i < tctx->n_div[ftype]; i++) { - int bs_second_part = (i >= tctx->bits_main_spec_change[ftype]); - - *dst++ = get_bits(gb, tctx->bits_main_spec[0][ftype][bs_second_part]); - *dst++ = get_bits(gb, tctx->bits_main_spec[1][ftype][bs_second_part]); - } -} - -static int twinvq_read_bitstream(AVCodecContext *avctx, TwinVQContext *tctx, - const uint8_t *buf, int buf_size) -{ - TwinVQFrameData *bits = &tctx->bits[0]; - const TwinVQModeTab *mtab = tctx->mtab; - int channels = tctx->avctx->channels; - int sub; - GetBitContext gb; - int i, j, k; - - init_get_bits(&gb, buf, buf_size * 8); - skip_bits(&gb, get_bits(&gb, 8)); - - bits->window_type = get_bits(&gb, TWINVQ_WINDOW_TYPE_BITS); - - if (bits->window_type > 8) { - av_log(avctx, AV_LOG_ERROR, "Invalid window type, broken sample?\n"); - return AVERROR_INVALIDDATA; - } - - bits->ftype = ff_twinvq_wtype_to_ftype_table[tctx->bits[0].window_type]; - - sub = mtab->fmode[bits->ftype].sub; - - read_cb_data(tctx, &gb, bits->main_coeffs, bits->ftype); - - for (i = 0; i < channels; i++) - for (j = 0; j < sub; j++) - for (k = 0; k < mtab->fmode[bits->ftype].bark_n_coef; k++) - bits->bark1[i][j][k] = - get_bits(&gb, mtab->fmode[bits->ftype].bark_n_bit); - - for (i = 0; i < channels; i++) - for (j = 0; j < sub; j++) - bits->bark_use_hist[i][j] = get_bits1(&gb); - - if (bits->ftype == TWINVQ_FT_LONG) { - for (i = 0; i < channels; i++) - bits->gain_bits[i] = get_bits(&gb, TWINVQ_GAIN_BITS); - } else { - for (i = 0; i < channels; i++) { - bits->gain_bits[i] = get_bits(&gb, TWINVQ_GAIN_BITS); - for (j = 0; j < sub; j++) - bits->sub_gain_bits[i * sub + j] = get_bits(&gb, - TWINVQ_SUB_GAIN_BITS); - } - } - - for (i = 0; i < channels; i++) { - bits->lpc_hist_idx[i] = get_bits(&gb, mtab->lsp_bit0); - bits->lpc_idx1[i] = get_bits(&gb, mtab->lsp_bit1); - - for (j = 0; j < mtab->lsp_split; j++) - bits->lpc_idx2[i][j] = get_bits(&gb, mtab->lsp_bit2); - } - - if (bits->ftype == TWINVQ_FT_LONG) { - read_cb_data(tctx, &gb, bits->ppc_coeffs, 3); - for (i = 0; i < channels; i++) { - bits->p_coef[i] = get_bits(&gb, mtab->ppc_period_bit); - bits->g_coef[i] = get_bits(&gb, mtab->pgain_bit); - } - } - - return (get_bits_count(&gb) + 7) / 8; -} - -static av_cold int twinvq_decode_init(AVCodecContext *avctx) -{ - int isampf, ibps; - TwinVQContext *tctx = avctx->priv_data; - - if (!avctx->extradata || avctx->extradata_size < 12) { - av_log(avctx, AV_LOG_ERROR, "Missing or incomplete extradata\n"); - return AVERROR_INVALIDDATA; - } - avctx->channels = AV_RB32(avctx->extradata) + 1; - avctx->bit_rate = AV_RB32(avctx->extradata + 4) * 1000; - isampf = AV_RB32(avctx->extradata + 8); - - if (isampf < 8 || isampf > 44) { - av_log(avctx, AV_LOG_ERROR, "Unsupported sample rate\n"); - return AVERROR_INVALIDDATA; - } - switch (isampf) { - case 44: - avctx->sample_rate = 44100; - break; - case 22: - avctx->sample_rate = 22050; - break; - case 11: - avctx->sample_rate = 11025; - break; - default: - avctx->sample_rate = isampf * 1000; - break; - } - - if (avctx->channels <= 0 || avctx->channels > TWINVQ_CHANNELS_MAX) { - av_log(avctx, AV_LOG_ERROR, "Unsupported number of channels: %i\n", - avctx->channels); - return -1; - } - avctx->channel_layout = avctx->channels == 1 ? AV_CH_LAYOUT_MONO - : AV_CH_LAYOUT_STEREO; - - ibps = avctx->bit_rate / (1000 * avctx->channels); - if (ibps < 8 || ibps > 48) { - av_log(avctx, AV_LOG_ERROR, "Bad bitrate per channel value %d\n", ibps); - return AVERROR_INVALIDDATA; - } - - switch ((isampf << 8) + ibps) { - case (8 << 8) + 8: - tctx->mtab = &mode_08_08; - break; - case (11 << 8) + 8: - tctx->mtab = &mode_11_08; - break; - case (11 << 8) + 10: - tctx->mtab = &mode_11_10; - break; - case (16 << 8) + 16: - tctx->mtab = &mode_16_16; - break; - case (22 << 8) + 20: - tctx->mtab = &mode_22_20; - break; - case (22 << 8) + 24: - tctx->mtab = &mode_22_24; - break; - case (22 << 8) + 32: - tctx->mtab = &mode_22_32; - break; - case (44 << 8) + 40: - tctx->mtab = &mode_44_40; - break; - case (44 << 8) + 48: - tctx->mtab = &mode_44_48; - break; - default: - av_log(avctx, AV_LOG_ERROR, - "This version does not support %d kHz - %d kbit/s/ch mode.\n", - isampf, isampf); - return -1; - } - - tctx->codec = TWINVQ_CODEC_VQF; - tctx->read_bitstream = twinvq_read_bitstream; - tctx->dec_bark_env = dec_bark_env; - tctx->decode_ppc = decode_ppc; - tctx->frame_size = avctx->bit_rate * tctx->mtab->size - / avctx->sample_rate + 8; - tctx->is_6kbps = 0; - if (avctx->block_align && avctx->block_align * 8 / tctx->frame_size > 1) { - av_log(avctx, AV_LOG_ERROR, - "VQF TwinVQ should have only one frame per packet\n"); - return AVERROR_INVALIDDATA; - } - - return ff_twinvq_decode_init(avctx); -} - -AVCodec ff_twinvq_decoder = { - .name = "twinvq", - .long_name = NULL_IF_CONFIG_SMALL("VQF TwinVQ"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_TWINVQ, - .priv_data_size = sizeof(TwinVQContext), - .init = twinvq_decode_init, - .close = ff_twinvq_decode_close, - .decode = ff_twinvq_decode_frame, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/unary.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/unary.h deleted file mode 100644 index 908dc9350..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/unary.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_UNARY_H -#define AVCODEC_UNARY_H - -#include "get_bits.h" - -/** - * Get unary code of limited length - * @param gb GetBitContext - * @param[in] stop The bitstop value (unary code of 1's or 0's) - * @param[in] len Maximum length - * @return Unary length/index - */ -static inline int get_unary(GetBitContext *gb, int stop, int len) -{ - int i; - - for(i = 0; i < len && get_bits1(gb) != stop; i++); - return i; -} - -/** - * Get unary code terminated by a 0 with a maximum length of 33 - * @param gb GetBitContext - * @return Unary length/index - */ -static inline int get_unary_0_33(GetBitContext *gb) -{ - return get_unary(gb, 0, 33); -} - -static inline int get_unary_0_9(GetBitContext *gb) -{ - return get_unary(gb, 0, 9); -} - -#endif /* AVCODEC_UNARY_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/utils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/utils.c deleted file mode 100644 index 63abe234a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/utils.c +++ /dev/null @@ -1,3512 +0,0 @@ -/* - * utils for libavcodec - * Copyright (c) 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * utils. - */ - -#include "config.h" -#include "libavutil/atomic.h" -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/bprint.h" -#include "libavutil/channel_layout.h" -#include "libavutil/crc.h" -#include "libavutil/frame.h" -#include "libavutil/internal.h" -#include "libavutil/mathematics.h" -#include "libavutil/pixdesc.h" -#include "libavutil/imgutils.h" -#include "libavutil/samplefmt.h" -#include "libavutil/dict.h" -#include "avcodec.h" -#include "dsputil.h" -#include "libavutil/opt.h" -#include "thread.h" -#include "frame_thread_encoder.h" -#include "internal.h" -#include "bytestream.h" -#include "version.h" -#include -#include -#include -#include -#if CONFIG_ICONV -# include -#endif - -#if HAVE_PTHREADS -#include -#elif HAVE_W32THREADS -#include "compat/w32pthreads.h" -#elif HAVE_OS2THREADS -#include "compat/os2threads.h" -#endif - -#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS -static int default_lockmgr_cb(void **arg, enum AVLockOp op) -{ - void * volatile * mutex = arg; - int err; - - switch (op) { - case AV_LOCK_CREATE: - return 0; - case AV_LOCK_OBTAIN: - if (!*mutex) { - pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t)); - if (!tmp) - return AVERROR(ENOMEM); - if ((err = pthread_mutex_init(tmp, NULL))) { - av_free(tmp); - return AVERROR(err); - } - if (avpriv_atomic_ptr_cas(mutex, NULL, tmp)) { - pthread_mutex_destroy(tmp); - av_free(tmp); - } - } - - if ((err = pthread_mutex_lock(*mutex))) - return AVERROR(err); - - return 0; - case AV_LOCK_RELEASE: - if ((err = pthread_mutex_unlock(*mutex))) - return AVERROR(err); - - return 0; - case AV_LOCK_DESTROY: - if (*mutex) - pthread_mutex_destroy(*mutex); - av_free(*mutex); - avpriv_atomic_ptr_cas(mutex, *mutex, NULL); - return 0; - } - return 1; -} -static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) = default_lockmgr_cb; -#else -static int (*lockmgr_cb)(void **mutex, enum AVLockOp op) = NULL; -#endif - - -volatile int ff_avcodec_locked; -static int volatile entangled_thread_counter = 0; -static void *codec_mutex; -static void *avformat_mutex; - -#if CONFIG_RAISE_MAJOR -# define LIBNAME "LIBAVCODEC_155" -#else -# define LIBNAME "LIBAVCODEC_55" -#endif - -#if FF_API_FAST_MALLOC && CONFIG_SHARED && HAVE_SYMVER -FF_SYMVER(void*, av_fast_realloc, (void *ptr, unsigned int *size, size_t min_size), LIBNAME) -{ - return av_fast_realloc(ptr, size, min_size); -} - -FF_SYMVER(void, av_fast_malloc, (void *ptr, unsigned int *size, size_t min_size), LIBNAME) -{ - av_fast_malloc(ptr, size, min_size); -} -#endif - -static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc) -{ - void **p = ptr; - if (min_size < *size) - return 0; - min_size = FFMAX(17 * min_size / 16 + 32, min_size); - av_free(*p); - *p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size); - if (!*p) - min_size = 0; - *size = min_size; - return 1; -} - -void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) -{ - uint8_t **p = ptr; - if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { - av_freep(p); - *size = 0; - return; - } - if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1)) - memset(*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); -} - -void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size) -{ - uint8_t **p = ptr; - if (min_size > SIZE_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { - av_freep(p); - *size = 0; - return; - } - if (!ff_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE, 1)) - memset(*p, 0, min_size + FF_INPUT_BUFFER_PADDING_SIZE); -} - -/* encoder management */ -static AVCodec *first_avcodec = NULL; -static AVCodec **last_avcodec = &first_avcodec; - -const AVCodec *av_codec_next(const AVCodec *c) -{ - if (c) - return c->next; - else - return first_avcodec; -} - -static av_cold void avcodec_init(void) -{ - static int initialized = 0; - - if (initialized != 0) - return; - initialized = 1; - - if (CONFIG_DSPUTIL) - ff_dsputil_static_init(); -} - -int av_codec_is_encoder(const AVCodec *codec) -{ - return codec && (codec->encode_sub || codec->encode2); -} - -int av_codec_is_decoder(const AVCodec *codec) -{ - return codec && codec->decode; -} - -av_cold void avcodec_register(AVCodec *codec) -{ - AVCodec **p; - avcodec_init(); - p = last_avcodec; - codec->next = NULL; - - while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, codec)) - p = &(*p)->next; - last_avcodec = &codec->next; - - if (codec->init_static_data) - codec->init_static_data(codec); -} - -#if FF_API_EMU_EDGE -unsigned avcodec_get_edge_width(void) -{ - return EDGE_WIDTH; -} -#endif - -#if FF_API_SET_DIMENSIONS -void avcodec_set_dimensions(AVCodecContext *s, int width, int height) -{ - int ret = ff_set_dimensions(s, width, height); - if (ret < 0) { - av_log(s, AV_LOG_WARNING, "Failed to set dimensions %d %d\n", width, height); - } -} -#endif - -int ff_set_dimensions(AVCodecContext *s, int width, int height) -{ - int ret = av_image_check_size(width, height, 0, s); - - if (ret < 0) - width = height = 0; - - s->coded_width = width; - s->coded_height = height; - s->width = FF_CEIL_RSHIFT(width, s->lowres); - s->height = FF_CEIL_RSHIFT(height, s->lowres); - - return ret; -} - -int ff_side_data_update_matrix_encoding(AVFrame *frame, - enum AVMatrixEncoding matrix_encoding) -{ - AVFrameSideData *side_data; - enum AVMatrixEncoding *data; - - side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_MATRIXENCODING); - if (!side_data) - side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_MATRIXENCODING, - sizeof(enum AVMatrixEncoding)); - - if (!side_data) - return AVERROR(ENOMEM); - - data = (enum AVMatrixEncoding*)side_data->data; - *data = matrix_encoding; - - return 0; -} - -#if HAVE_NEON || ARCH_PPC || HAVE_MMX -# define STRIDE_ALIGN 16 -#else -# define STRIDE_ALIGN 8 -#endif - -void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, - int linesize_align[AV_NUM_DATA_POINTERS]) -{ - int i; - int w_align = 1; - int h_align = 1; - - switch (s->pix_fmt) { - case AV_PIX_FMT_YUV420P: - case AV_PIX_FMT_YUYV422: - case AV_PIX_FMT_UYVY422: - case AV_PIX_FMT_YUV422P: - case AV_PIX_FMT_YUV440P: - case AV_PIX_FMT_YUV444P: - case AV_PIX_FMT_GBRAP: - case AV_PIX_FMT_GBRP: - case AV_PIX_FMT_GRAY8: - case AV_PIX_FMT_GRAY16BE: - case AV_PIX_FMT_GRAY16LE: - case AV_PIX_FMT_YUVJ420P: - case AV_PIX_FMT_YUVJ422P: - case AV_PIX_FMT_YUVJ440P: - case AV_PIX_FMT_YUVJ444P: - case AV_PIX_FMT_YUVA420P: - case AV_PIX_FMT_YUVA422P: - case AV_PIX_FMT_YUVA444P: - case AV_PIX_FMT_YUV420P9LE: - case AV_PIX_FMT_YUV420P9BE: - case AV_PIX_FMT_YUV420P10LE: - case AV_PIX_FMT_YUV420P10BE: - case AV_PIX_FMT_YUV420P12LE: - case AV_PIX_FMT_YUV420P12BE: - case AV_PIX_FMT_YUV420P14LE: - case AV_PIX_FMT_YUV420P14BE: - case AV_PIX_FMT_YUV420P16LE: - case AV_PIX_FMT_YUV420P16BE: - case AV_PIX_FMT_YUVA420P9LE: - case AV_PIX_FMT_YUVA420P9BE: - case AV_PIX_FMT_YUVA420P10LE: - case AV_PIX_FMT_YUVA420P10BE: - case AV_PIX_FMT_YUVA420P16LE: - case AV_PIX_FMT_YUVA420P16BE: - case AV_PIX_FMT_YUV422P9LE: - case AV_PIX_FMT_YUV422P9BE: - case AV_PIX_FMT_YUV422P10LE: - case AV_PIX_FMT_YUV422P10BE: - case AV_PIX_FMT_YUV422P12LE: - case AV_PIX_FMT_YUV422P12BE: - case AV_PIX_FMT_YUV422P14LE: - case AV_PIX_FMT_YUV422P14BE: - case AV_PIX_FMT_YUV422P16LE: - case AV_PIX_FMT_YUV422P16BE: - case AV_PIX_FMT_YUVA422P9LE: - case AV_PIX_FMT_YUVA422P9BE: - case AV_PIX_FMT_YUVA422P10LE: - case AV_PIX_FMT_YUVA422P10BE: - case AV_PIX_FMT_YUVA422P16LE: - case AV_PIX_FMT_YUVA422P16BE: - case AV_PIX_FMT_YUV444P9LE: - case AV_PIX_FMT_YUV444P9BE: - case AV_PIX_FMT_YUV444P10LE: - case AV_PIX_FMT_YUV444P10BE: - case AV_PIX_FMT_YUV444P12LE: - case AV_PIX_FMT_YUV444P12BE: - case AV_PIX_FMT_YUV444P14LE: - case AV_PIX_FMT_YUV444P14BE: - case AV_PIX_FMT_YUV444P16LE: - case AV_PIX_FMT_YUV444P16BE: - case AV_PIX_FMT_YUVA444P9LE: - case AV_PIX_FMT_YUVA444P9BE: - case AV_PIX_FMT_YUVA444P10LE: - case AV_PIX_FMT_YUVA444P10BE: - case AV_PIX_FMT_YUVA444P16LE: - case AV_PIX_FMT_YUVA444P16BE: - case AV_PIX_FMT_GBRP9LE: - case AV_PIX_FMT_GBRP9BE: - case AV_PIX_FMT_GBRP10LE: - case AV_PIX_FMT_GBRP10BE: - case AV_PIX_FMT_GBRP12LE: - case AV_PIX_FMT_GBRP12BE: - case AV_PIX_FMT_GBRP14LE: - case AV_PIX_FMT_GBRP14BE: - w_align = 16; //FIXME assume 16 pixel per macroblock - h_align = 16 * 2; // interlaced needs 2 macroblocks height - break; - case AV_PIX_FMT_YUV411P: - case AV_PIX_FMT_YUVJ411P: - case AV_PIX_FMT_UYYVYY411: - w_align = 32; - h_align = 8; - break; - case AV_PIX_FMT_YUV410P: - if (s->codec_id == AV_CODEC_ID_SVQ1) { - w_align = 64; - h_align = 64; - } - break; - case AV_PIX_FMT_RGB555: - if (s->codec_id == AV_CODEC_ID_RPZA) { - w_align = 4; - h_align = 4; - } - break; - case AV_PIX_FMT_PAL8: - case AV_PIX_FMT_BGR8: - case AV_PIX_FMT_RGB8: - if (s->codec_id == AV_CODEC_ID_SMC || - s->codec_id == AV_CODEC_ID_CINEPAK) { - w_align = 4; - h_align = 4; - } - break; - case AV_PIX_FMT_BGR24: - if ((s->codec_id == AV_CODEC_ID_MSZH) || - (s->codec_id == AV_CODEC_ID_ZLIB)) { - w_align = 4; - h_align = 4; - } - break; - case AV_PIX_FMT_RGB24: - if (s->codec_id == AV_CODEC_ID_CINEPAK) { - w_align = 4; - h_align = 4; - } - break; - default: - w_align = 1; - h_align = 1; - break; - } - - if (s->codec_id == AV_CODEC_ID_IFF_ILBM || s->codec_id == AV_CODEC_ID_IFF_BYTERUN1) { - w_align = FFMAX(w_align, 8); - } - - *width = FFALIGN(*width, w_align); - *height = FFALIGN(*height, h_align); - if (s->codec_id == AV_CODEC_ID_H264 || s->lowres) - // some of the optimized chroma MC reads one line too much - // which is also done in mpeg decoders with lowres > 0 - *height += 2; - - for (i = 0; i < 4; i++) - linesize_align[i] = STRIDE_ALIGN; -} - -void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt); - int chroma_shift = desc->log2_chroma_w; - int linesize_align[AV_NUM_DATA_POINTERS]; - int align; - - avcodec_align_dimensions2(s, width, height, linesize_align); - align = FFMAX(linesize_align[0], linesize_align[3]); - linesize_align[1] <<= chroma_shift; - linesize_align[2] <<= chroma_shift; - align = FFMAX3(align, linesize_align[1], linesize_align[2]); - *width = FFALIGN(*width, align); -} - -int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos) -{ - if (pos <= AVCHROMA_LOC_UNSPECIFIED || pos >= AVCHROMA_LOC_NB) - return AVERROR(EINVAL); - pos--; - - *xpos = (pos&1) * 128; - *ypos = ((pos>>1)^(pos<4)) * 128; - - return 0; -} - -enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos) -{ - int pos, xout, yout; - - for (pos = AVCHROMA_LOC_UNSPECIFIED + 1; pos < AVCHROMA_LOC_NB; pos++) { - if (avcodec_enum_to_chroma_pos(&xout, &yout, pos) == 0 && xout == xpos && yout == ypos) - return pos; - } - return AVCHROMA_LOC_UNSPECIFIED; -} - -int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, - enum AVSampleFormat sample_fmt, const uint8_t *buf, - int buf_size, int align) -{ - int ch, planar, needed_size, ret = 0; - - needed_size = av_samples_get_buffer_size(NULL, nb_channels, - frame->nb_samples, sample_fmt, - align); - if (buf_size < needed_size) - return AVERROR(EINVAL); - - planar = av_sample_fmt_is_planar(sample_fmt); - if (planar && nb_channels > AV_NUM_DATA_POINTERS) { - if (!(frame->extended_data = av_mallocz(nb_channels * - sizeof(*frame->extended_data)))) - return AVERROR(ENOMEM); - } else { - frame->extended_data = frame->data; - } - - if ((ret = av_samples_fill_arrays(frame->extended_data, &frame->linesize[0], - (uint8_t *)(intptr_t)buf, nb_channels, frame->nb_samples, - sample_fmt, align)) < 0) { - if (frame->extended_data != frame->data) - av_freep(&frame->extended_data); - return ret; - } - if (frame->extended_data != frame->data) { - for (ch = 0; ch < AV_NUM_DATA_POINTERS; ch++) - frame->data[ch] = frame->extended_data[ch]; - } - - return ret; -} - -static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) -{ - FramePool *pool = avctx->internal->pool; - int i, ret; - - switch (avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: { - AVPicture picture; - int size[4] = { 0 }; - int w = frame->width; - int h = frame->height; - int tmpsize, unaligned; - - if (pool->format == frame->format && - pool->width == frame->width && pool->height == frame->height) - return 0; - - avcodec_align_dimensions2(avctx, &w, &h, pool->stride_align); - - if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { - w += EDGE_WIDTH * 2; - h += EDGE_WIDTH * 2; - } - - do { - // NOTE: do not align linesizes individually, this breaks e.g. assumptions - // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2 - av_image_fill_linesizes(picture.linesize, avctx->pix_fmt, w); - // increase alignment of w for next try (rhs gives the lowest bit set in w) - w += w & ~(w - 1); - - unaligned = 0; - for (i = 0; i < 4; i++) - unaligned |= picture.linesize[i] % pool->stride_align[i]; - } while (unaligned); - - tmpsize = av_image_fill_pointers(picture.data, avctx->pix_fmt, h, - NULL, picture.linesize); - if (tmpsize < 0) - return -1; - - for (i = 0; i < 3 && picture.data[i + 1]; i++) - size[i] = picture.data[i + 1] - picture.data[i]; - size[i] = tmpsize - (picture.data[i] - picture.data[0]); - - for (i = 0; i < 4; i++) { - av_buffer_pool_uninit(&pool->pools[i]); - pool->linesize[i] = picture.linesize[i]; - if (size[i]) { - pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1, - CONFIG_MEMORY_POISONING ? - NULL : - av_buffer_allocz); - if (!pool->pools[i]) { - ret = AVERROR(ENOMEM); - goto fail; - } - } - } - pool->format = frame->format; - pool->width = frame->width; - pool->height = frame->height; - - break; - } - case AVMEDIA_TYPE_AUDIO: { - int ch = av_frame_get_channels(frame); //av_get_channel_layout_nb_channels(frame->channel_layout); - int planar = av_sample_fmt_is_planar(frame->format); - int planes = planar ? ch : 1; - - if (pool->format == frame->format && pool->planes == planes && - pool->channels == ch && frame->nb_samples == pool->samples) - return 0; - - av_buffer_pool_uninit(&pool->pools[0]); - ret = av_samples_get_buffer_size(&pool->linesize[0], ch, - frame->nb_samples, frame->format, 0); - if (ret < 0) - goto fail; - - pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL); - if (!pool->pools[0]) { - ret = AVERROR(ENOMEM); - goto fail; - } - - pool->format = frame->format; - pool->planes = planes; - pool->channels = ch; - pool->samples = frame->nb_samples; - break; - } - default: av_assert0(0); - } - return 0; -fail: - for (i = 0; i < 4; i++) - av_buffer_pool_uninit(&pool->pools[i]); - pool->format = -1; - pool->planes = pool->channels = pool->samples = 0; - pool->width = pool->height = 0; - return ret; -} - -static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) -{ - FramePool *pool = avctx->internal->pool; - int planes = pool->planes; - int i; - - frame->linesize[0] = pool->linesize[0]; - - if (planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz(planes * sizeof(*frame->extended_data)); - frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS; - frame->extended_buf = av_mallocz(frame->nb_extended_buf * - sizeof(*frame->extended_buf)); - if (!frame->extended_data || !frame->extended_buf) { - av_freep(&frame->extended_data); - av_freep(&frame->extended_buf); - return AVERROR(ENOMEM); - } - } else { - frame->extended_data = frame->data; - av_assert0(frame->nb_extended_buf == 0); - } - - for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) { - frame->buf[i] = av_buffer_pool_get(pool->pools[0]); - if (!frame->buf[i]) - goto fail; - frame->extended_data[i] = frame->data[i] = frame->buf[i]->data; - } - for (i = 0; i < frame->nb_extended_buf; i++) { - frame->extended_buf[i] = av_buffer_pool_get(pool->pools[0]); - if (!frame->extended_buf[i]) - goto fail; - frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data; - } - - if (avctx->debug & FF_DEBUG_BUFFERS) - av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p", frame); - - return 0; -fail: - av_frame_unref(frame); - return AVERROR(ENOMEM); -} - -static int video_get_buffer(AVCodecContext *s, AVFrame *pic) -{ - FramePool *pool = s->internal->pool; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format); - int pixel_size = desc->comp[0].step_minus1 + 1; - int h_chroma_shift, v_chroma_shift; - int i; - - if (pic->data[0] != NULL) { - av_log(s, AV_LOG_ERROR, "pic->data[0]!=NULL in avcodec_default_get_buffer\n"); - return -1; - } - - memset(pic->data, 0, sizeof(pic->data)); - pic->extended_data = pic->data; - - av_pix_fmt_get_chroma_sub_sample(s->pix_fmt, &h_chroma_shift, &v_chroma_shift); - - for (i = 0; i < 4 && pool->pools[i]; i++) { - const int h_shift = i == 0 ? 0 : h_chroma_shift; - const int v_shift = i == 0 ? 0 : v_chroma_shift; - int is_planar = pool->pools[2] || (i==0 && s->pix_fmt == AV_PIX_FMT_GRAY8); - - pic->linesize[i] = pool->linesize[i]; - - pic->buf[i] = av_buffer_pool_get(pool->pools[i]); - if (!pic->buf[i]) - goto fail; - - // no edge if EDGE EMU or not planar YUV - if ((s->flags & CODEC_FLAG_EMU_EDGE) || !is_planar) - pic->data[i] = pic->buf[i]->data; - else { - pic->data[i] = pic->buf[i]->data + - FFALIGN((pic->linesize[i] * EDGE_WIDTH >> v_shift) + - (pixel_size * EDGE_WIDTH >> h_shift), pool->stride_align[i]); - } - } - for (; i < AV_NUM_DATA_POINTERS; i++) { - pic->data[i] = NULL; - pic->linesize[i] = 0; - } - if (pic->data[1] && !pic->data[2]) - avpriv_set_systematic_pal2((uint32_t *)pic->data[1], s->pix_fmt); - - if (s->debug & FF_DEBUG_BUFFERS) - av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic); - - return 0; -fail: - av_frame_unref(pic); - return AVERROR(ENOMEM); -} - -void avpriv_color_frame(AVFrame *frame, const int c[4]) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); - int p, y, x; - - av_assert0(desc->flags & AV_PIX_FMT_FLAG_PLANAR); - - for (p = 0; pnb_components; p++) { - uint8_t *dst = frame->data[p]; - int is_chroma = p == 1 || p == 2; - int bytes = is_chroma ? FF_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width; - int height = is_chroma ? FF_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height; - for (y = 0; y < height; y++) { - if (desc->comp[0].depth_minus1 >= 8) { - for (x = 0; xlinesize[p]; - } - } -} - -int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) -{ - int ret; - - if ((ret = update_frame_pool(avctx, frame)) < 0) - return ret; - -#if FF_API_GET_BUFFER -FF_DISABLE_DEPRECATION_WARNINGS - frame->type = FF_BUFFER_TYPE_INTERNAL; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - switch (avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - return video_get_buffer(avctx, frame); - case AVMEDIA_TYPE_AUDIO: - return audio_get_buffer(avctx, frame); - default: - return -1; - } -} - -int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) -{ - if (avctx->internal->pkt) { - frame->pkt_pts = avctx->internal->pkt->pts; - av_frame_set_pkt_pos (frame, avctx->internal->pkt->pos); - av_frame_set_pkt_duration(frame, avctx->internal->pkt->duration); - av_frame_set_pkt_size (frame, avctx->internal->pkt->size); - } else { - frame->pkt_pts = AV_NOPTS_VALUE; - av_frame_set_pkt_pos (frame, -1); - av_frame_set_pkt_duration(frame, 0); - av_frame_set_pkt_size (frame, -1); - } - frame->reordered_opaque = avctx->reordered_opaque; - - switch (avctx->codec->type) { - case AVMEDIA_TYPE_VIDEO: - frame->format = avctx->pix_fmt; - if (!frame->sample_aspect_ratio.num) - frame->sample_aspect_ratio = avctx->sample_aspect_ratio; - if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) - av_frame_set_colorspace(frame, avctx->colorspace); - if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) - av_frame_set_color_range(frame, avctx->color_range); - break; - case AVMEDIA_TYPE_AUDIO: - if (!frame->sample_rate) - frame->sample_rate = avctx->sample_rate; - if (frame->format < 0) - frame->format = avctx->sample_fmt; - if (!frame->channel_layout) { - if (avctx->channel_layout) { - if (av_get_channel_layout_nb_channels(avctx->channel_layout) != - avctx->channels) { - av_log(avctx, AV_LOG_ERROR, "Inconsistent channel " - "configuration.\n"); - return AVERROR(EINVAL); - } - - frame->channel_layout = avctx->channel_layout; - } else { - if (avctx->channels > FF_SANE_NB_CHANNELS) { - av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n", - avctx->channels); - return AVERROR(ENOSYS); - } - } - } - av_frame_set_channels(frame, avctx->channels); - break; - default: break; - } - return 0; -} - -#if FF_API_GET_BUFFER -FF_DISABLE_DEPRECATION_WARNINGS -int avcodec_default_get_buffer(AVCodecContext *avctx, AVFrame *frame) -{ - return avcodec_default_get_buffer2(avctx, frame, 0); -} - -typedef struct CompatReleaseBufPriv { - AVCodecContext avctx; - AVFrame frame; -} CompatReleaseBufPriv; - -static void compat_free_buffer(void *opaque, uint8_t *data) -{ - CompatReleaseBufPriv *priv = opaque; - if (priv->avctx.release_buffer) - priv->avctx.release_buffer(&priv->avctx, &priv->frame); - av_freep(&priv); -} - -static void compat_release_buffer(void *opaque, uint8_t *data) -{ - AVBufferRef *buf = opaque; - av_buffer_unref(&buf); -} -FF_ENABLE_DEPRECATION_WARNINGS -#endif - -static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) -{ - int override_dimensions = 1; - int ret; - - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { - if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0 || avctx->pix_fmt<0) { - av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n"); - return AVERROR(EINVAL); - } - } - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { - if (frame->width <= 0 || frame->height <= 0) { - frame->width = FFMAX(avctx->width, FF_CEIL_RSHIFT(avctx->coded_width, avctx->lowres)); - frame->height = FFMAX(avctx->height, FF_CEIL_RSHIFT(avctx->coded_height, avctx->lowres)); - override_dimensions = 0; - } - } - if ((ret = ff_init_buffer_info(avctx, frame)) < 0) - return ret; - -#if FF_API_GET_BUFFER -FF_DISABLE_DEPRECATION_WARNINGS - /* - * Wrap an old get_buffer()-allocated buffer in a bunch of AVBuffers. - * We wrap each plane in its own AVBuffer. Each of those has a reference to - * a dummy AVBuffer as its private data, unreffing it on free. - * When all the planes are freed, the dummy buffer's free callback calls - * release_buffer(). - */ - if (avctx->get_buffer) { - CompatReleaseBufPriv *priv = NULL; - AVBufferRef *dummy_buf = NULL; - int planes, i, ret; - - if (flags & AV_GET_BUFFER_FLAG_REF) - frame->reference = 1; - - ret = avctx->get_buffer(avctx, frame); - if (ret < 0) - return ret; - - /* return if the buffers are already set up - * this would happen e.g. when a custom get_buffer() calls - * avcodec_default_get_buffer - */ - if (frame->buf[0]) - goto end; - - priv = av_mallocz(sizeof(*priv)); - if (!priv) { - ret = AVERROR(ENOMEM); - goto fail; - } - priv->avctx = *avctx; - priv->frame = *frame; - - dummy_buf = av_buffer_create(NULL, 0, compat_free_buffer, priv, 0); - if (!dummy_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - -#define WRAP_PLANE(ref_out, data, data_size) \ -do { \ - AVBufferRef *dummy_ref = av_buffer_ref(dummy_buf); \ - if (!dummy_ref) { \ - ret = AVERROR(ENOMEM); \ - goto fail; \ - } \ - ref_out = av_buffer_create(data, data_size, compat_release_buffer, \ - dummy_ref, 0); \ - if (!ref_out) { \ - av_frame_unref(frame); \ - ret = AVERROR(ENOMEM); \ - goto fail; \ - } \ -} while (0) - - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); - - planes = av_pix_fmt_count_planes(frame->format); - /* workaround for AVHWAccel plane count of 0, buf[0] is used as - check for allocated buffers: make libavcodec happy */ - if (desc && desc->flags & AV_PIX_FMT_FLAG_HWACCEL) - planes = 1; - if (!desc || planes <= 0) { - ret = AVERROR(EINVAL); - goto fail; - } - - for (i = 0; i < planes; i++) { - int v_shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; - int plane_size = (frame->height >> v_shift) * frame->linesize[i]; - - WRAP_PLANE(frame->buf[i], frame->data[i], plane_size); - } - } else { - int planar = av_sample_fmt_is_planar(frame->format); - planes = planar ? avctx->channels : 1; - - if (planes > FF_ARRAY_ELEMS(frame->buf)) { - frame->nb_extended_buf = planes - FF_ARRAY_ELEMS(frame->buf); - frame->extended_buf = av_malloc(sizeof(*frame->extended_buf) * - frame->nb_extended_buf); - if (!frame->extended_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - } - - for (i = 0; i < FFMIN(planes, FF_ARRAY_ELEMS(frame->buf)); i++) - WRAP_PLANE(frame->buf[i], frame->extended_data[i], frame->linesize[0]); - - for (i = 0; i < frame->nb_extended_buf; i++) - WRAP_PLANE(frame->extended_buf[i], - frame->extended_data[i + FF_ARRAY_ELEMS(frame->buf)], - frame->linesize[0]); - } - - av_buffer_unref(&dummy_buf); - -end: - frame->width = avctx->width; - frame->height = avctx->height; - - return 0; - -fail: - avctx->release_buffer(avctx, frame); - av_freep(&priv); - av_buffer_unref(&dummy_buf); - return ret; - } -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - ret = avctx->get_buffer2(avctx, frame, flags); - - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) { - frame->width = avctx->width; - frame->height = avctx->height; - } - - return ret; -} - -int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) -{ - int ret = get_buffer_internal(avctx, frame, flags); - if (ret < 0) - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return ret; -} - -static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) -{ - AVFrame *tmp; - int ret; - - av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO); - - if (frame->data[0] && (frame->width != avctx->width || frame->height != avctx->height || frame->format != avctx->pix_fmt)) { - av_log(avctx, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n", - frame->width, frame->height, av_get_pix_fmt_name(frame->format), avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt)); - av_frame_unref(frame); - } - - ff_init_buffer_info(avctx, frame); - - if (!frame->data[0]) - return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); - - if (av_frame_is_writable(frame)) { - frame->pkt_pts = avctx->internal->pkt ? avctx->internal->pkt->pts : AV_NOPTS_VALUE; - frame->reordered_opaque = avctx->reordered_opaque; - return 0; - } - - tmp = av_frame_alloc(); - if (!tmp) - return AVERROR(ENOMEM); - - av_frame_move_ref(tmp, frame); - - ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); - if (ret < 0) { - av_frame_free(&tmp); - return ret; - } - - av_frame_copy(frame, tmp); - av_frame_free(&tmp); - - return 0; -} - -int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) -{ - int ret = reget_buffer_internal(avctx, frame); - if (ret < 0) - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return ret; -} - -#if FF_API_GET_BUFFER -void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) -{ - av_assert0(s->codec_type == AVMEDIA_TYPE_VIDEO); - - av_frame_unref(pic); -} - -int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic) -{ - av_assert0(0); - return AVERROR_BUG; -} -#endif - -int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size) -{ - int i; - - for (i = 0; i < count; i++) { - int r = func(c, (char *)arg + i * size); - if (ret) - ret[i] = r; - } - return 0; -} - -int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int jobnr, int threadnr), void *arg, int *ret, int count) -{ - int i; - - for (i = 0; i < count; i++) { - int r = func(c, arg, i, 0); - if (ret) - ret[i] = r; - } - return 0; -} - -static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - return desc->flags & AV_PIX_FMT_FLAG_HWACCEL; -} - -enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt) -{ - while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt)) - ++fmt; - return fmt[0]; -} - -#if FF_API_AVFRAME_LAVC -void avcodec_get_frame_defaults(AVFrame *frame) -{ -#if LIBAVCODEC_VERSION_MAJOR >= 55 - // extended_data should explicitly be freed when needed, this code is unsafe currently - // also this is not compatible to the <55 ABI/API - if (frame->extended_data != frame->data && 0) - av_freep(&frame->extended_data); -#endif - - memset(frame, 0, sizeof(AVFrame)); - av_frame_unref(frame); -} - -AVFrame *avcodec_alloc_frame(void) -{ - return av_frame_alloc(); -} - -void avcodec_free_frame(AVFrame **frame) -{ - av_frame_free(frame); -} -#endif - -MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase) -MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor) -MAKE_ACCESSORS(AVCodecContext, codec, int, lowres) -MAKE_ACCESSORS(AVCodecContext, codec, int, seek_preroll) -MAKE_ACCESSORS(AVCodecContext, codec, uint16_t*, chroma_intra_matrix) - -int av_codec_get_max_lowres(const AVCodec *codec) -{ - return codec->max_lowres; -} - -static void avcodec_get_subtitle_defaults(AVSubtitle *sub) -{ - memset(sub, 0, sizeof(*sub)); - sub->pts = AV_NOPTS_VALUE; -} - -static int get_bit_rate(AVCodecContext *ctx) -{ - int bit_rate; - int bits_per_sample; - - switch (ctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - case AVMEDIA_TYPE_DATA: - case AVMEDIA_TYPE_SUBTITLE: - case AVMEDIA_TYPE_ATTACHMENT: - bit_rate = ctx->bit_rate; - break; - case AVMEDIA_TYPE_AUDIO: - bits_per_sample = av_get_bits_per_sample(ctx->codec_id); - bit_rate = bits_per_sample ? ctx->sample_rate * ctx->channels * bits_per_sample : ctx->bit_rate; - break; - default: - bit_rate = 0; - break; - } - return bit_rate; -} - -int attribute_align_arg ff_codec_open2_recursive(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) -{ - int ret = 0; - - ff_unlock_avcodec(); - - ret = avcodec_open2(avctx, codec, options); - - ff_lock_avcodec(avctx); - return ret; -} - -int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options) -{ - int ret = 0; - AVDictionary *tmp = NULL; - - if (avcodec_is_open(avctx)) - return 0; - - if ((!codec && !avctx->codec)) { - av_log(avctx, AV_LOG_ERROR, "No codec provided to avcodec_open2()\n"); - return AVERROR(EINVAL); - } - if ((codec && avctx->codec && codec != avctx->codec)) { - av_log(avctx, AV_LOG_ERROR, "This AVCodecContext was allocated for %s, " - "but %s passed to avcodec_open2()\n", avctx->codec->name, codec->name); - return AVERROR(EINVAL); - } - if (!codec) - codec = avctx->codec; - - if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE) - return AVERROR(EINVAL); - - if (options) - av_dict_copy(&tmp, *options, 0); - - ret = ff_lock_avcodec(avctx); - if (ret < 0) - return ret; - - avctx->internal = av_mallocz(sizeof(AVCodecInternal)); - if (!avctx->internal) { - ret = AVERROR(ENOMEM); - goto end; - } - - avctx->internal->pool = av_mallocz(sizeof(*avctx->internal->pool)); - if (!avctx->internal->pool) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - - avctx->internal->to_free = av_frame_alloc(); - if (!avctx->internal->to_free) { - ret = AVERROR(ENOMEM); - goto free_and_end; - } - - if (codec->priv_data_size > 0) { - if (!avctx->priv_data) { - avctx->priv_data = av_mallocz(codec->priv_data_size); - if (!avctx->priv_data) { - ret = AVERROR(ENOMEM); - goto end; - } - if (codec->priv_class) { - *(const AVClass **)avctx->priv_data = codec->priv_class; - av_opt_set_defaults(avctx->priv_data); - } - } - if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp)) < 0) - goto free_and_end; - } else { - avctx->priv_data = NULL; - } - if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) - goto free_and_end; - - // only call ff_set_dimensions() for non H.264/VP6F codecs so as not to overwrite previously setup dimensions - if (!(avctx->coded_width && avctx->coded_height && avctx->width && avctx->height && - (avctx->codec_id == AV_CODEC_ID_H264 || avctx->codec_id == AV_CODEC_ID_VP6F))) { - if (avctx->coded_width && avctx->coded_height) - ret = ff_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); - else if (avctx->width && avctx->height) - ret = ff_set_dimensions(avctx, avctx->width, avctx->height); - if (ret < 0) - goto free_and_end; - } - - if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height) - && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0 - || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) { - av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n"); - ff_set_dimensions(avctx, 0, 0); - } - - /* if the decoder init function was already called previously, - * free the already allocated subtitle_header before overwriting it */ - if (av_codec_is_decoder(codec)) - av_freep(&avctx->subtitle_header); - - if (avctx->channels > FF_SANE_NB_CHANNELS) { - ret = AVERROR(EINVAL); - goto free_and_end; - } - - avctx->codec = codec; - if ((avctx->codec_type == AVMEDIA_TYPE_UNKNOWN || avctx->codec_type == codec->type) && - avctx->codec_id == AV_CODEC_ID_NONE) { - avctx->codec_type = codec->type; - avctx->codec_id = codec->id; - } - if (avctx->codec_id != codec->id || (avctx->codec_type != codec->type - && avctx->codec_type != AVMEDIA_TYPE_ATTACHMENT)) { - av_log(avctx, AV_LOG_ERROR, "Codec type or id mismatches\n"); - ret = AVERROR(EINVAL); - goto free_and_end; - } - avctx->frame_number = 0; - avctx->codec_descriptor = avcodec_descriptor_get(avctx->codec_id); - - if (avctx->codec->capabilities & CODEC_CAP_EXPERIMENTAL && - avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { - const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; - AVCodec *codec2; - av_log(avctx, AV_LOG_ERROR, - "The %s '%s' is experimental but experimental codecs are not enabled, " - "add '-strict %d' if you want to use it.\n", - codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); - codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); - if (!(codec2->capabilities & CODEC_CAP_EXPERIMENTAL)) - av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", - codec_string, codec2->name); - ret = AVERROR_EXPERIMENTAL; - goto free_and_end; - } - - if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && - (!avctx->time_base.num || !avctx->time_base.den)) { - avctx->time_base.num = 1; - avctx->time_base.den = avctx->sample_rate; - } - - if (!HAVE_THREADS) - av_log(avctx, AV_LOG_WARNING, "Warning: not compiled with thread support, using thread emulation\n"); - - if (CONFIG_FRAME_THREAD_ENCODER) { - ff_unlock_avcodec(); //we will instanciate a few encoders thus kick the counter to prevent false detection of a problem - ret = ff_frame_thread_encoder_init(avctx, options ? *options : NULL); - ff_lock_avcodec(avctx); - if (ret < 0) - goto free_and_end; - } - - if (HAVE_THREADS - && !(avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))) { - ret = ff_thread_init(avctx); - if (ret < 0) { - goto free_and_end; - } - } - if (!HAVE_THREADS && !(codec->capabilities & CODEC_CAP_AUTO_THREADS)) - avctx->thread_count = 1; - - if (avctx->codec->max_lowres < avctx->lowres || avctx->lowres < 0) { - av_log(avctx, AV_LOG_ERROR, "The maximum value for lowres supported by the decoder is %d\n", - avctx->codec->max_lowres); - ret = AVERROR(EINVAL); - goto free_and_end; - } - - if (av_codec_is_encoder(avctx->codec)) { - int i; - if (avctx->codec->sample_fmts) { - for (i = 0; avctx->codec->sample_fmts[i] != AV_SAMPLE_FMT_NONE; i++) { - if (avctx->sample_fmt == avctx->codec->sample_fmts[i]) - break; - if (avctx->channels == 1 && - av_get_planar_sample_fmt(avctx->sample_fmt) == - av_get_planar_sample_fmt(avctx->codec->sample_fmts[i])) { - avctx->sample_fmt = avctx->codec->sample_fmts[i]; - break; - } - } - if (avctx->codec->sample_fmts[i] == AV_SAMPLE_FMT_NONE) { - char buf[128]; - snprintf(buf, sizeof(buf), "%d", avctx->sample_fmt); - av_log(avctx, AV_LOG_ERROR, "Specified sample format %s is invalid or not supported\n", - (char *)av_x_if_null(av_get_sample_fmt_name(avctx->sample_fmt), buf)); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } - if (avctx->codec->pix_fmts) { - for (i = 0; avctx->codec->pix_fmts[i] != AV_PIX_FMT_NONE; i++) - if (avctx->pix_fmt == avctx->codec->pix_fmts[i]) - break; - if (avctx->codec->pix_fmts[i] == AV_PIX_FMT_NONE - && !((avctx->codec_id == AV_CODEC_ID_MJPEG || avctx->codec_id == AV_CODEC_ID_LJPEG) - && avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL)) { - char buf[128]; - snprintf(buf, sizeof(buf), "%d", avctx->pix_fmt); - av_log(avctx, AV_LOG_ERROR, "Specified pixel format %s is invalid or not supported\n", - (char *)av_x_if_null(av_get_pix_fmt_name(avctx->pix_fmt), buf)); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } - if (avctx->codec->supported_samplerates) { - for (i = 0; avctx->codec->supported_samplerates[i] != 0; i++) - if (avctx->sample_rate == avctx->codec->supported_samplerates[i]) - break; - if (avctx->codec->supported_samplerates[i] == 0) { - av_log(avctx, AV_LOG_ERROR, "Specified sample rate %d is not supported\n", - avctx->sample_rate); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } - if (avctx->codec->channel_layouts) { - if (!avctx->channel_layout) { - av_log(avctx, AV_LOG_WARNING, "Channel layout not specified\n"); - } else { - for (i = 0; avctx->codec->channel_layouts[i] != 0; i++) - if (avctx->channel_layout == avctx->codec->channel_layouts[i]) - break; - if (avctx->codec->channel_layouts[i] == 0) { - char buf[512]; - av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); - av_log(avctx, AV_LOG_ERROR, "Specified channel layout '%s' is not supported\n", buf); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } - } - if (avctx->channel_layout && avctx->channels) { - int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); - if (channels != avctx->channels) { - char buf[512]; - av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); - av_log(avctx, AV_LOG_ERROR, - "Channel layout '%s' with %d channels does not match number of specified channels %d\n", - buf, channels, avctx->channels); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } else if (avctx->channel_layout) { - avctx->channels = av_get_channel_layout_nb_channels(avctx->channel_layout); - } - if(avctx->codec_type == AVMEDIA_TYPE_VIDEO && - avctx->codec_id != AV_CODEC_ID_PNG // For mplayer - ) { - if (avctx->width <= 0 || avctx->height <= 0) { - av_log(avctx, AV_LOG_ERROR, "dimensions not set\n"); - ret = AVERROR(EINVAL); - goto free_and_end; - } - } - if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO) - && avctx->bit_rate>0 && avctx->bit_rate<1000) { - av_log(avctx, AV_LOG_WARNING, "Bitrate %d is extremely low, maybe you mean %dk\n", avctx->bit_rate, avctx->bit_rate); - } - - if (!avctx->rc_initial_buffer_occupancy) - avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; - } - - avctx->pts_correction_num_faulty_pts = - avctx->pts_correction_num_faulty_dts = 0; - avctx->pts_correction_last_pts = - avctx->pts_correction_last_dts = INT64_MIN; - - if ( avctx->codec->init && (!(avctx->active_thread_type&FF_THREAD_FRAME) - || avctx->internal->frame_thread_encoder)) { - ret = avctx->codec->init(avctx); - if (ret < 0) { - goto free_and_end; - } - } - - ret=0; - - if (av_codec_is_decoder(avctx->codec)) { - if (!avctx->bit_rate) - avctx->bit_rate = get_bit_rate(avctx); - /* validate channel layout from the decoder */ - if (avctx->channel_layout) { - int channels = av_get_channel_layout_nb_channels(avctx->channel_layout); - if (!avctx->channels) - avctx->channels = channels; - else if (channels != avctx->channels) { - char buf[512]; - av_get_channel_layout_string(buf, sizeof(buf), -1, avctx->channel_layout); - av_log(avctx, AV_LOG_WARNING, - "Channel layout '%s' with %d channels does not match specified number of channels %d: " - "ignoring specified channel layout\n", - buf, channels, avctx->channels); - avctx->channel_layout = 0; - } - } - if (avctx->channels && (avctx->channels < 0 || - avctx->channels > FF_SANE_NB_CHANNELS)) { - ret = AVERROR(EINVAL); - goto free_and_end; - } - if (avctx->sub_charenc) { - if (avctx->codec_type != AVMEDIA_TYPE_SUBTITLE) { - av_log(avctx, AV_LOG_ERROR, "Character encoding is only " - "supported with subtitles codecs\n"); - ret = AVERROR(EINVAL); - goto free_and_end; - } else if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) { - av_log(avctx, AV_LOG_WARNING, "Codec '%s' is bitmap-based, " - "subtitles character encoding will be ignored\n", - avctx->codec_descriptor->name); - avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_DO_NOTHING; - } else { - /* input character encoding is set for a text based subtitle - * codec at this point */ - if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_AUTOMATIC) - avctx->sub_charenc_mode = FF_SUB_CHARENC_MODE_PRE_DECODER; - - if (avctx->sub_charenc_mode == FF_SUB_CHARENC_MODE_PRE_DECODER) { -#if CONFIG_ICONV - iconv_t cd = iconv_open("UTF-8", avctx->sub_charenc); - if (cd == (iconv_t)-1) { - av_log(avctx, AV_LOG_ERROR, "Unable to open iconv context " - "with input character encoding \"%s\"\n", avctx->sub_charenc); - ret = AVERROR(errno); - goto free_and_end; - } - iconv_close(cd); -#else - av_log(avctx, AV_LOG_ERROR, "Character encoding subtitles " - "conversion needs a libavcodec built with iconv support " - "for this codec\n"); - ret = AVERROR(ENOSYS); - goto free_and_end; -#endif - } - } - } - } -end: - ff_unlock_avcodec(); - if (options) { - av_dict_free(options); - *options = tmp; - } - - return ret; -free_and_end: - av_dict_free(&tmp); - av_freep(&avctx->priv_data); - if (avctx->internal) { - av_frame_free(&avctx->internal->to_free); - av_freep(&avctx->internal->pool); - } - av_freep(&avctx->internal); - avctx->codec = NULL; - goto end; -} - -int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size) -{ - if (avpkt->size < 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size); - return AVERROR(EINVAL); - } - if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { - av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n", - size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE); - return AVERROR(EINVAL); - } - - if (avctx) { - av_assert0(!avpkt->data || avpkt->data != avctx->internal->byte_buffer); - if (!avpkt->data || avpkt->size < size) { - av_fast_padded_malloc(&avctx->internal->byte_buffer, &avctx->internal->byte_buffer_size, size); - avpkt->data = avctx->internal->byte_buffer; - avpkt->size = avctx->internal->byte_buffer_size; -FF_DISABLE_DEPRECATION_WARNINGS - avpkt->destruct = NULL; -FF_ENABLE_DEPRECATION_WARNINGS - } - } - - if (avpkt->data) { - AVBufferRef *buf = avpkt->buf; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - void *destruct = avpkt->destruct; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - - if (avpkt->size < size) { - av_log(avctx, AV_LOG_ERROR, "User packet is too small (%d < %"PRId64")\n", avpkt->size, size); - return AVERROR(EINVAL); - } - - av_init_packet(avpkt); -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - avpkt->destruct = destruct; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - avpkt->buf = buf; - avpkt->size = size; - return 0; - } else { - int ret = av_new_packet(avpkt, size); - if (ret < 0) - av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size); - return ret; - } -} - -int ff_alloc_packet(AVPacket *avpkt, int size) -{ - return ff_alloc_packet2(NULL, avpkt, size); -} - -/** - * Pad last frame with silence. - */ -static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src) -{ - AVFrame *frame = NULL; - int ret; - - if (!(frame = av_frame_alloc())) - return AVERROR(ENOMEM); - - frame->format = src->format; - frame->channel_layout = src->channel_layout; - av_frame_set_channels(frame, av_frame_get_channels(src)); - frame->nb_samples = s->frame_size; - ret = av_frame_get_buffer(frame, 32); - if (ret < 0) - goto fail; - - ret = av_frame_copy_props(frame, src); - if (ret < 0) - goto fail; - - if ((ret = av_samples_copy(frame->extended_data, src->extended_data, 0, 0, - src->nb_samples, s->channels, s->sample_fmt)) < 0) - goto fail; - if ((ret = av_samples_set_silence(frame->extended_data, src->nb_samples, - frame->nb_samples - src->nb_samples, - s->channels, s->sample_fmt)) < 0) - goto fail; - - *dst = frame; - - return 0; - -fail: - av_frame_free(&frame); - return ret; -} - -int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx, - AVPacket *avpkt, - const AVFrame *frame, - int *got_packet_ptr) -{ - AVFrame tmp; - AVFrame *padded_frame = NULL; - int ret; - AVPacket user_pkt = *avpkt; - int needs_realloc = !user_pkt.data; - - *got_packet_ptr = 0; - - if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { - av_free_packet(avpkt); - av_init_packet(avpkt); - return 0; - } - - /* ensure that extended_data is properly set */ - if (frame && !frame->extended_data) { - if (av_sample_fmt_is_planar(avctx->sample_fmt) && - avctx->channels > AV_NUM_DATA_POINTERS) { - av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, " - "with more than %d channels, but extended_data is not set.\n", - AV_NUM_DATA_POINTERS); - return AVERROR(EINVAL); - } - av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n"); - - tmp = *frame; - tmp.extended_data = tmp.data; - frame = &tmp; - } - - /* check for valid frame size */ - if (frame) { - if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) { - if (frame->nb_samples > avctx->frame_size) { - av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n"); - return AVERROR(EINVAL); - } - } else if (!(avctx->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE)) { - if (frame->nb_samples < avctx->frame_size && - !avctx->internal->last_audio_frame) { - ret = pad_last_frame(avctx, &padded_frame, frame); - if (ret < 0) - return ret; - - frame = padded_frame; - avctx->internal->last_audio_frame = 1; - } - - if (frame->nb_samples != avctx->frame_size) { - av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\n", frame->nb_samples, avctx->frame_size); - ret = AVERROR(EINVAL); - goto end; - } - } - } - - ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); - if (!ret) { - if (*got_packet_ptr) { - if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) { - if (avpkt->pts == AV_NOPTS_VALUE) - avpkt->pts = frame->pts; - if (!avpkt->duration) - avpkt->duration = ff_samples_to_time_base(avctx, - frame->nb_samples); - } - avpkt->dts = avpkt->pts; - } else { - avpkt->size = 0; - } - } - if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { - needs_realloc = 0; - if (user_pkt.data) { - if (user_pkt.size >= avpkt->size) { - memcpy(user_pkt.data, avpkt->data, avpkt->size); - } else { - av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); - avpkt->size = user_pkt.size; - ret = -1; - } - avpkt->buf = user_pkt.buf; - avpkt->data = user_pkt.data; -FF_DISABLE_DEPRECATION_WARNINGS - avpkt->destruct = user_pkt.destruct; -FF_ENABLE_DEPRECATION_WARNINGS - } else { - if (av_dup_packet(avpkt) < 0) { - ret = AVERROR(ENOMEM); - } - } - } - - if (!ret) { - if (needs_realloc && avpkt->data) { - ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); - if (ret >= 0) - avpkt->data = avpkt->buf->data; - } - - avctx->frame_number++; - } - - if (ret < 0 || !*got_packet_ptr) { - av_free_packet(avpkt); - av_init_packet(avpkt); - goto end; - } - - /* NOTE: if we add any audio encoders which output non-keyframe packets, - * this needs to be moved to the encoders, but for now we can do it - * here to simplify things */ - avpkt->flags |= AV_PKT_FLAG_KEY; - -end: - av_frame_free(&padded_frame); - - return ret; -} - -#if FF_API_OLD_ENCODE_AUDIO -int attribute_align_arg avcodec_encode_audio(AVCodecContext *avctx, - uint8_t *buf, int buf_size, - const short *samples) -{ - AVPacket pkt; - AVFrame *frame; - int ret, samples_size, got_packet; - - av_init_packet(&pkt); - pkt.data = buf; - pkt.size = buf_size; - - if (samples) { - frame = av_frame_alloc(); - if (!frame) - return AVERROR(ENOMEM); - - if (avctx->frame_size) { - frame->nb_samples = avctx->frame_size; - } else { - /* if frame_size is not set, the number of samples must be - * calculated from the buffer size */ - int64_t nb_samples; - if (!av_get_bits_per_sample(avctx->codec_id)) { - av_log(avctx, AV_LOG_ERROR, "avcodec_encode_audio() does not " - "support this codec\n"); - av_frame_free(&frame); - return AVERROR(EINVAL); - } - nb_samples = (int64_t)buf_size * 8 / - (av_get_bits_per_sample(avctx->codec_id) * - avctx->channels); - if (nb_samples >= INT_MAX) { - av_frame_free(&frame); - return AVERROR(EINVAL); - } - frame->nb_samples = nb_samples; - } - - /* it is assumed that the samples buffer is large enough based on the - * relevant parameters */ - samples_size = av_samples_get_buffer_size(NULL, avctx->channels, - frame->nb_samples, - avctx->sample_fmt, 1); - if ((ret = avcodec_fill_audio_frame(frame, avctx->channels, - avctx->sample_fmt, - (const uint8_t *)samples, - samples_size, 1)) < 0) { - av_frame_free(&frame); - return ret; - } - - /* fabricate frame pts from sample count. - * this is needed because the avcodec_encode_audio() API does not have - * a way for the user to provide pts */ - if (avctx->sample_rate && avctx->time_base.num) - frame->pts = ff_samples_to_time_base(avctx, - avctx->internal->sample_count); - else - frame->pts = AV_NOPTS_VALUE; - avctx->internal->sample_count += frame->nb_samples; - } else { - frame = NULL; - } - - got_packet = 0; - ret = avcodec_encode_audio2(avctx, &pkt, frame, &got_packet); - if (!ret && got_packet && avctx->coded_frame) { - avctx->coded_frame->pts = pkt.pts; - avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY); - } - /* free any side data since we cannot return it */ - av_packet_free_side_data(&pkt); - - if (frame && frame->extended_data != frame->data) - av_freep(&frame->extended_data); - - av_frame_free(&frame); - return ret ? ret : pkt.size; -} - -#endif - -#if FF_API_OLD_ENCODE_VIDEO -int attribute_align_arg avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict) -{ - AVPacket pkt; - int ret, got_packet = 0; - - if (buf_size < FF_MIN_BUFFER_SIZE) { - av_log(avctx, AV_LOG_ERROR, "buffer smaller than minimum size\n"); - return -1; - } - - av_init_packet(&pkt); - pkt.data = buf; - pkt.size = buf_size; - - ret = avcodec_encode_video2(avctx, &pkt, pict, &got_packet); - if (!ret && got_packet && avctx->coded_frame) { - avctx->coded_frame->pts = pkt.pts; - avctx->coded_frame->key_frame = !!(pkt.flags & AV_PKT_FLAG_KEY); - } - - /* free any side data since we cannot return it */ - if (pkt.side_data_elems > 0) { - int i; - for (i = 0; i < pkt.side_data_elems; i++) - av_free(pkt.side_data[i].data); - av_freep(&pkt.side_data); - pkt.side_data_elems = 0; - } - - return ret ? ret : pkt.size; -} - -#endif - -int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, - AVPacket *avpkt, - const AVFrame *frame, - int *got_packet_ptr) -{ - int ret; - AVPacket user_pkt = *avpkt; - int needs_realloc = !user_pkt.data; - - *got_packet_ptr = 0; - - if(CONFIG_FRAME_THREAD_ENCODER && - avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME)) - return ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr); - - if ((avctx->flags&CODEC_FLAG_PASS1) && avctx->stats_out) - avctx->stats_out[0] = '\0'; - - if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { - av_free_packet(avpkt); - av_init_packet(avpkt); - avpkt->size = 0; - return 0; - } - - if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) - return AVERROR(EINVAL); - - av_assert0(avctx->codec->encode2); - - ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); - av_assert0(ret <= 0); - - if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) { - needs_realloc = 0; - if (user_pkt.data) { - if (user_pkt.size >= avpkt->size) { - memcpy(user_pkt.data, avpkt->data, avpkt->size); - } else { - av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size); - avpkt->size = user_pkt.size; - ret = -1; - } - avpkt->buf = user_pkt.buf; - avpkt->data = user_pkt.data; -FF_DISABLE_DEPRECATION_WARNINGS - avpkt->destruct = user_pkt.destruct; -FF_ENABLE_DEPRECATION_WARNINGS - } else { - if (av_dup_packet(avpkt) < 0) { - ret = AVERROR(ENOMEM); - } - } - } - - if (!ret) { - if (!*got_packet_ptr) - avpkt->size = 0; - else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) - avpkt->pts = avpkt->dts = frame->pts; - - if (needs_realloc && avpkt->data) { - ret = av_buffer_realloc(&avpkt->buf, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); - if (ret >= 0) - avpkt->data = avpkt->buf->data; - } - - avctx->frame_number++; - } - - if (ret < 0 || !*got_packet_ptr) - av_free_packet(avpkt); - else - av_packet_merge_side_data(avpkt); - - emms_c(); - return ret; -} - -int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVSubtitle *sub) -{ - int ret; - if (sub->start_display_time) { - av_log(avctx, AV_LOG_ERROR, "start_display_time must be 0.\n"); - return -1; - } - - ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub); - avctx->frame_number++; - return ret; -} - -/** - * Attempt to guess proper monotonic timestamps for decoded video frames - * which might have incorrect times. Input timestamps may wrap around, in - * which case the output will as well. - * - * @param pts the pts field of the decoded AVPacket, as passed through - * AVFrame.pkt_pts - * @param dts the dts field of the decoded AVPacket - * @return one of the input values, may be AV_NOPTS_VALUE - */ -static int64_t guess_correct_pts(AVCodecContext *ctx, - int64_t reordered_pts, int64_t dts) -{ - int64_t pts = AV_NOPTS_VALUE; - - if (dts != AV_NOPTS_VALUE) { - ctx->pts_correction_num_faulty_dts += dts <= ctx->pts_correction_last_dts; - ctx->pts_correction_last_dts = dts; - } else if (reordered_pts != AV_NOPTS_VALUE) - ctx->pts_correction_last_dts = reordered_pts; - - if (reordered_pts != AV_NOPTS_VALUE) { - ctx->pts_correction_num_faulty_pts += reordered_pts <= ctx->pts_correction_last_pts; - ctx->pts_correction_last_pts = reordered_pts; - } else if(dts != AV_NOPTS_VALUE) - ctx->pts_correction_last_pts = dts; - - if ((ctx->pts_correction_num_faulty_pts<=ctx->pts_correction_num_faulty_dts || dts == AV_NOPTS_VALUE) - && reordered_pts != AV_NOPTS_VALUE) - pts = reordered_pts; - else - pts = dts; - - return pts; -} - -static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt) -{ - int size = 0, ret; - const uint8_t *data; - uint32_t flags; - - data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size); - if (!data) - return 0; - - if (!(avctx->codec->capabilities & CODEC_CAP_PARAM_CHANGE)) { - av_log(avctx, AV_LOG_ERROR, "This decoder does not support parameter " - "changes, but PARAM_CHANGE side data was sent to it.\n"); - return AVERROR(EINVAL); - } - - if (size < 4) - goto fail; - - flags = bytestream_get_le32(&data); - size -= 4; - - if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) { - if (size < 4) - goto fail; - avctx->channels = bytestream_get_le32(&data); - size -= 4; - } - if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) { - if (size < 8) - goto fail; - avctx->channel_layout = bytestream_get_le64(&data); - size -= 8; - } - if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) { - if (size < 4) - goto fail; - avctx->sample_rate = bytestream_get_le32(&data); - size -= 4; - } - if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) { - if (size < 8) - goto fail; - avctx->width = bytestream_get_le32(&data); - avctx->height = bytestream_get_le32(&data); - size -= 8; - ret = ff_set_dimensions(avctx, avctx->width, avctx->height); - if (ret < 0) - return ret; - } - - return 0; -fail: - av_log(avctx, AV_LOG_ERROR, "PARAM_CHANGE side data too small.\n"); - return AVERROR_INVALIDDATA; -} - -static int add_metadata_from_side_data(AVCodecContext *avctx, AVFrame *frame) -{ - int size; - const uint8_t *side_metadata; - - AVDictionary **frame_md = avpriv_frame_get_metadatap(frame); - - side_metadata = av_packet_get_side_data(avctx->internal->pkt, - AV_PKT_DATA_STRINGS_METADATA, &size); - return av_packet_unpack_dictionary(side_metadata, size, frame_md); -} - -static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame) -{ - int ret; - - /* move the original frame to our backup */ - av_frame_unref(avci->to_free); - av_frame_move_ref(avci->to_free, frame); - - /* now copy everything except the AVBufferRefs back - * note that we make a COPY of the side data, so calling av_frame_free() on - * the caller's frame will work properly */ - ret = av_frame_copy_props(frame, avci->to_free); - if (ret < 0) - return ret; - - memcpy(frame->data, avci->to_free->data, sizeof(frame->data)); - memcpy(frame->linesize, avci->to_free->linesize, sizeof(frame->linesize)); - if (avci->to_free->extended_data != avci->to_free->data) { - int planes = av_frame_get_channels(avci->to_free); - int size = planes * sizeof(*frame->extended_data); - - if (!size) { - av_frame_unref(frame); - return AVERROR_BUG; - } - - frame->extended_data = av_malloc(size); - if (!frame->extended_data) { - av_frame_unref(frame); - return AVERROR(ENOMEM); - } - memcpy(frame->extended_data, avci->to_free->extended_data, - size); - } else - frame->extended_data = frame->data; - - frame->format = avci->to_free->format; - frame->width = avci->to_free->width; - frame->height = avci->to_free->height; - frame->channel_layout = avci->to_free->channel_layout; - frame->nb_samples = avci->to_free->nb_samples; - av_frame_set_channels(frame, av_frame_get_channels(avci->to_free)); - - return 0; -} - -int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, - int *got_picture_ptr, - const AVPacket *avpkt) -{ - AVCodecInternal *avci = avctx->internal; - int ret; - // copy to ensure we do not change avpkt - AVPacket tmp = *avpkt; - - if (!avctx->codec) - return AVERROR(EINVAL); - if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) { - av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n"); - return AVERROR(EINVAL); - } - - *got_picture_ptr = 0; - if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx)) - return AVERROR(EINVAL); - - av_frame_unref(picture); - - if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) { - int did_split = av_packet_split_side_data(&tmp); - ret = apply_param_change(avctx, &tmp); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n"); - if (avctx->err_recognition & AV_EF_EXPLODE) - goto fail; - } - - avctx->internal->pkt = &tmp; - if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) - ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr, - &tmp); - else { - ret = avctx->codec->decode(avctx, picture, got_picture_ptr, - &tmp); - picture->pkt_dts = avpkt->dts; - - if(!avctx->has_b_frames){ - av_frame_set_pkt_pos(picture, avpkt->pos); - } - //FIXME these should be under if(!avctx->has_b_frames) - /* get_buffer is supposed to set frame parameters */ - if (!(avctx->codec->capabilities & CODEC_CAP_DR1)) { - if (!picture->sample_aspect_ratio.num) picture->sample_aspect_ratio = avctx->sample_aspect_ratio; - if (!picture->width) picture->width = avctx->width; - if (!picture->height) picture->height = avctx->height; - if (picture->format == AV_PIX_FMT_NONE) picture->format = avctx->pix_fmt; - } - } - add_metadata_from_side_data(avctx, picture); - -fail: - emms_c(); //needed to avoid an emms_c() call before every return; - - avctx->internal->pkt = NULL; - if (did_split) { - av_packet_free_side_data(&tmp); - if(ret == tmp.size) - ret = avpkt->size; - } - - if (*got_picture_ptr) { - if (!avctx->refcounted_frames) { - int err = unrefcount_frame(avci, picture); - if (err < 0) - return err; - } - - avctx->frame_number++; - av_frame_set_best_effort_timestamp(picture, - guess_correct_pts(avctx, - picture->pkt_pts, - picture->pkt_dts)); - } else - av_frame_unref(picture); - } else - ret = 0; - - /* many decoders assign whole AVFrames, thus overwriting extended_data; - * make sure it's set correctly */ - av_assert0(!picture->extended_data || picture->extended_data == picture->data); - - return ret; -} - -#if FF_API_OLD_DECODE_AUDIO -int attribute_align_arg avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - AVPacket *avpkt) -{ - AVFrame *frame = av_frame_alloc(); - int ret, got_frame = 0; - - if (!frame) - return AVERROR(ENOMEM); - if (avctx->get_buffer != avcodec_default_get_buffer) { - av_log(avctx, AV_LOG_ERROR, "Custom get_buffer() for use with" - "avcodec_decode_audio3() detected. Overriding with avcodec_default_get_buffer\n"); - av_log(avctx, AV_LOG_ERROR, "Please port your application to " - "avcodec_decode_audio4()\n"); - avctx->get_buffer = avcodec_default_get_buffer; - avctx->release_buffer = avcodec_default_release_buffer; - } - - ret = avcodec_decode_audio4(avctx, frame, &got_frame, avpkt); - - if (ret >= 0 && got_frame) { - int ch, plane_size; - int planar = av_sample_fmt_is_planar(avctx->sample_fmt); - int data_size = av_samples_get_buffer_size(&plane_size, avctx->channels, - frame->nb_samples, - avctx->sample_fmt, 1); - if (*frame_size_ptr < data_size) { - av_log(avctx, AV_LOG_ERROR, "output buffer size is too small for " - "the current frame (%d < %d)\n", *frame_size_ptr, data_size); - av_frame_free(&frame); - return AVERROR(EINVAL); - } - - memcpy(samples, frame->extended_data[0], plane_size); - - if (planar && avctx->channels > 1) { - uint8_t *out = ((uint8_t *)samples) + plane_size; - for (ch = 1; ch < avctx->channels; ch++) { - memcpy(out, frame->extended_data[ch], plane_size); - out += plane_size; - } - } - *frame_size_ptr = data_size; - } else { - *frame_size_ptr = 0; - } - av_frame_free(&frame); - return ret; -} - -#endif - -int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, - AVFrame *frame, - int *got_frame_ptr, - const AVPacket *avpkt) -{ - AVCodecInternal *avci = avctx->internal; - int ret = 0; - - *got_frame_ptr = 0; - - if (!avpkt->data && avpkt->size) { - av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); - return AVERROR(EINVAL); - } - if (!avctx->codec) - return AVERROR(EINVAL); - if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) { - av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n"); - return AVERROR(EINVAL); - } - - av_frame_unref(frame); - - if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) { - uint8_t *side; - int side_size; - uint32_t discard_padding = 0; - // copy to ensure we do not change avpkt - AVPacket tmp = *avpkt; - int did_split = av_packet_split_side_data(&tmp); - ret = apply_param_change(avctx, &tmp); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n"); - if (avctx->err_recognition & AV_EF_EXPLODE) - goto fail; - } - - avctx->internal->pkt = &tmp; - if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) - ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp); - else { - ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp); - frame->pkt_dts = avpkt->dts; - } - if (ret >= 0 && *got_frame_ptr) { - add_metadata_from_side_data(avctx, frame); - avctx->frame_number++; - av_frame_set_best_effort_timestamp(frame, - guess_correct_pts(avctx, - frame->pkt_pts, - frame->pkt_dts)); - if (frame->format == AV_SAMPLE_FMT_NONE) - frame->format = avctx->sample_fmt; - if (!frame->channel_layout) - frame->channel_layout = avctx->channel_layout; - if (!av_frame_get_channels(frame)) - av_frame_set_channels(frame, avctx->channels); - if (!frame->sample_rate) - frame->sample_rate = avctx->sample_rate; - } - - side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size); - if(side && side_size>=10) { - avctx->internal->skip_samples = AV_RL32(side); - av_log(avctx, AV_LOG_DEBUG, "skip %d samples due to side data\n", - avctx->internal->skip_samples); - discard_padding = AV_RL32(side + 4); - } - if (avctx->internal->skip_samples && *got_frame_ptr) { - if(frame->nb_samples <= avctx->internal->skip_samples){ - *got_frame_ptr = 0; - avctx->internal->skip_samples -= frame->nb_samples; - av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n", - avctx->internal->skip_samples); - } else { - av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples, - frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format); - if(avctx->pkt_timebase.num && avctx->sample_rate) { - int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples, - (AVRational){1, avctx->sample_rate}, - avctx->pkt_timebase); - if(frame->pkt_pts!=AV_NOPTS_VALUE) - frame->pkt_pts += diff_ts; - if(frame->pkt_dts!=AV_NOPTS_VALUE) - frame->pkt_dts += diff_ts; - if (av_frame_get_pkt_duration(frame) >= diff_ts) - av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts); - } else { - av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n"); - } - av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n", - avctx->internal->skip_samples, frame->nb_samples); - frame->nb_samples -= avctx->internal->skip_samples; - avctx->internal->skip_samples = 0; - } - } - - if (discard_padding > 0 && discard_padding <= frame->nb_samples && *got_frame_ptr) { - if (discard_padding == frame->nb_samples) { - *got_frame_ptr = 0; - } else { - if(avctx->pkt_timebase.num && avctx->sample_rate) { - int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding, - (AVRational){1, avctx->sample_rate}, - avctx->pkt_timebase); - if (av_frame_get_pkt_duration(frame) >= diff_ts) - av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts); - } else { - av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for discarded samples.\n"); - } - av_log(avctx, AV_LOG_DEBUG, "discard %d/%d samples\n", - discard_padding, frame->nb_samples); - frame->nb_samples -= discard_padding; - } - } -fail: - avctx->internal->pkt = NULL; - if (did_split) { - av_packet_free_side_data(&tmp); - if(ret == tmp.size) - ret = avpkt->size; - } - - if (ret >= 0 && *got_frame_ptr) { - if (!avctx->refcounted_frames) { - int err = unrefcount_frame(avci, frame); - if (err < 0) - return err; - } - } else - av_frame_unref(frame); - } - - return ret; -} - -#define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */ -static int recode_subtitle(AVCodecContext *avctx, - AVPacket *outpkt, const AVPacket *inpkt) -{ -#if CONFIG_ICONV - iconv_t cd = (iconv_t)-1; - int ret = 0; - char *inb, *outb; - size_t inl, outl; - AVPacket tmp; -#endif - - if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_PRE_DECODER || inpkt->size == 0) - return 0; - -#if CONFIG_ICONV - cd = iconv_open("UTF-8", avctx->sub_charenc); - av_assert0(cd != (iconv_t)-1); - - inb = inpkt->data; - inl = inpkt->size; - - if (inl >= INT_MAX / UTF8_MAX_BYTES - FF_INPUT_BUFFER_PADDING_SIZE) { - av_log(avctx, AV_LOG_ERROR, "Subtitles packet is too big for recoding\n"); - ret = AVERROR(ENOMEM); - goto end; - } - - ret = av_new_packet(&tmp, inl * UTF8_MAX_BYTES); - if (ret < 0) - goto end; - outpkt->buf = tmp.buf; - outpkt->data = tmp.data; - outpkt->size = tmp.size; - outb = outpkt->data; - outl = outpkt->size; - - if (iconv(cd, &inb, &inl, &outb, &outl) == (size_t)-1 || - iconv(cd, NULL, NULL, &outb, &outl) == (size_t)-1 || - outl >= outpkt->size || inl != 0) { - av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" " - "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc); - av_free_packet(&tmp); - ret = AVERROR(errno); - goto end; - } - outpkt->size -= outl; - memset(outpkt->data + outpkt->size, 0, outl); - -end: - if (cd != (iconv_t)-1) - iconv_close(cd); - return ret; -#else - av_assert0(!"requesting subtitles recoding without iconv"); -#endif -} - -static int utf8_check(const uint8_t *str) -{ - const uint8_t *byte; - uint32_t codepoint, min; - - while (*str) { - byte = str; - GET_UTF8(codepoint, *(byte++), return 0;); - min = byte - str == 1 ? 0 : byte - str == 2 ? 0x80 : - 1 << (5 * (byte - str) - 4); - if (codepoint < min || codepoint >= 0x110000 || - codepoint == 0xFFFE /* BOM */ || - (codepoint >= 0xD800 && codepoint <= 0xDFFF) /* surrogates */) - return 0; - str = byte; - } - return 1; -} - -int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, - int *got_sub_ptr, - AVPacket *avpkt) -{ - int i, ret = 0; - - if (!avpkt->data && avpkt->size) { - av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n"); - return AVERROR(EINVAL); - } - if (!avctx->codec) - return AVERROR(EINVAL); - if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) { - av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n"); - return AVERROR(EINVAL); - } - - *got_sub_ptr = 0; - avcodec_get_subtitle_defaults(sub); - - if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size) { - AVPacket pkt_recoded; - AVPacket tmp = *avpkt; - int did_split = av_packet_split_side_data(&tmp); - //apply_param_change(avctx, &tmp); - - if (did_split) { - /* FFMIN() prevents overflow in case the packet wasn't allocated with - * proper padding. - * If the side data is smaller than the buffer padding size, the - * remaining bytes should have already been filled with zeros by the - * original packet allocation anyway. */ - memset(tmp.data + tmp.size, 0, - FFMIN(avpkt->size - tmp.size, FF_INPUT_BUFFER_PADDING_SIZE)); - } - - pkt_recoded = tmp; - ret = recode_subtitle(avctx, &pkt_recoded, &tmp); - if (ret < 0) { - *got_sub_ptr = 0; - } else { - avctx->internal->pkt = &pkt_recoded; - - if (avctx->pkt_timebase.den && avpkt->pts != AV_NOPTS_VALUE) - sub->pts = av_rescale_q(avpkt->pts, - avctx->pkt_timebase, AV_TIME_BASE_Q); - ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded); - av_assert1((ret >= 0) >= !!*got_sub_ptr && - !!*got_sub_ptr >= !!sub->num_rects); - - if (sub->num_rects && !sub->end_display_time && avpkt->duration && - avctx->pkt_timebase.num) { - AVRational ms = { 1, 1000 }; - sub->end_display_time = av_rescale_q(avpkt->duration, - avctx->pkt_timebase, ms); - } - - for (i = 0; i < sub->num_rects; i++) { - if (sub->rects[i]->ass && !utf8_check((const uint8_t *)sub->rects[i]->ass)) { - av_log(avctx, AV_LOG_ERROR, - "Invalid UTF-8 in decoded subtitles text; " - "maybe missing -sub_charenc option\n"); - avsubtitle_free(sub); - return AVERROR_INVALIDDATA; - } - } - - if (tmp.data != pkt_recoded.data) { // did we recode? - /* prevent from destroying side data from original packet */ - pkt_recoded.side_data = NULL; - pkt_recoded.side_data_elems = 0; - - av_free_packet(&pkt_recoded); - } - if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB) - sub->format = 0; - else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB) - sub->format = 1; - avctx->internal->pkt = NULL; - } - - if (did_split) { - av_packet_free_side_data(&tmp); - if(ret == tmp.size) - ret = avpkt->size; - } - - if (*got_sub_ptr) - avctx->frame_number++; - } - - return ret; -} - -void avsubtitle_free(AVSubtitle *sub) -{ - int i; - - for (i = 0; i < sub->num_rects; i++) { - av_freep(&sub->rects[i]->pict.data[0]); - av_freep(&sub->rects[i]->pict.data[1]); - av_freep(&sub->rects[i]->pict.data[2]); - av_freep(&sub->rects[i]->pict.data[3]); - av_freep(&sub->rects[i]->text); - av_freep(&sub->rects[i]->ass); - av_freep(&sub->rects[i]); - } - - av_freep(&sub->rects); - - memset(sub, 0, sizeof(AVSubtitle)); -} - -av_cold int ff_codec_close_recursive(AVCodecContext *avctx) -{ - int ret = 0; - - ff_unlock_avcodec(); - - ret = avcodec_close(avctx); - - ff_lock_avcodec(NULL); - return ret; -} - -av_cold int avcodec_close(AVCodecContext *avctx) -{ - int ret; - - if (!avctx) - return 0; - - ret = ff_lock_avcodec(avctx); - if (ret < 0) - return ret; - - if (avcodec_is_open(avctx)) { - FramePool *pool = avctx->internal->pool; - int i; - if (CONFIG_FRAME_THREAD_ENCODER && - avctx->internal->frame_thread_encoder && avctx->thread_count > 1) { - ff_unlock_avcodec(); - ff_frame_thread_encoder_free(avctx); - ff_lock_avcodec(avctx); - } - if (HAVE_THREADS && avctx->internal->thread_ctx) - ff_thread_free(avctx); - if (avctx->codec && avctx->codec->close) - avctx->codec->close(avctx); - avctx->coded_frame = NULL; - avctx->internal->byte_buffer_size = 0; - av_freep(&avctx->internal->byte_buffer); - av_frame_free(&avctx->internal->to_free); - for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++) - av_buffer_pool_uninit(&pool->pools[i]); - av_freep(&avctx->internal->pool); - av_freep(&avctx->internal); - } - - if (avctx->priv_data && avctx->codec && avctx->codec->priv_class) - av_opt_free(avctx->priv_data); - av_opt_free(avctx); - av_freep(&avctx->priv_data); - if (av_codec_is_encoder(avctx->codec)) - av_freep(&avctx->extradata); - avctx->codec = NULL; - avctx->active_thread_type = 0; - - ff_unlock_avcodec(); - return 0; -} - -static enum AVCodecID remap_deprecated_codec_id(enum AVCodecID id) -{ - switch(id){ - //This is for future deprecatec codec ids, its empty since - //last major bump but will fill up again over time, please don't remove it -// case AV_CODEC_ID_UTVIDEO_DEPRECATED: return AV_CODEC_ID_UTVIDEO; - case AV_CODEC_ID_OPUS_DEPRECATED: return AV_CODEC_ID_OPUS; - case AV_CODEC_ID_TAK_DEPRECATED : return AV_CODEC_ID_TAK; - case AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S24LE_PLANAR; - case AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED : return AV_CODEC_ID_PCM_S32LE_PLANAR; - case AV_CODEC_ID_ESCAPE130_DEPRECATED : return AV_CODEC_ID_ESCAPE130; - case AV_CODEC_ID_G2M_DEPRECATED : return AV_CODEC_ID_G2M; - case AV_CODEC_ID_WEBP_DEPRECATED: return AV_CODEC_ID_WEBP; - case AV_CODEC_ID_HEVC_DEPRECATED: return AV_CODEC_ID_HEVC; - default : return id; - } -} - -static AVCodec *find_encdec(enum AVCodecID id, int encoder) -{ - AVCodec *p, *experimental = NULL; - p = first_avcodec; - id= remap_deprecated_codec_id(id); - while (p) { - if ((encoder ? av_codec_is_encoder(p) : av_codec_is_decoder(p)) && - p->id == id) { - if (p->capabilities & CODEC_CAP_EXPERIMENTAL && !experimental) { - experimental = p; - } else - return p; - } - p = p->next; - } - return experimental; -} - -AVCodec *avcodec_find_encoder(enum AVCodecID id) -{ - return find_encdec(id, 1); -} - -AVCodec *avcodec_find_encoder_by_name(const char *name) -{ - AVCodec *p; - if (!name) - return NULL; - p = first_avcodec; - while (p) { - if (av_codec_is_encoder(p) && strcmp(name, p->name) == 0) - return p; - p = p->next; - } - return NULL; -} - -AVCodec *avcodec_find_decoder(enum AVCodecID id) -{ - return find_encdec(id, 0); -} - -AVCodec *avcodec_find_decoder_by_name(const char *name) -{ - AVCodec *p; - if (!name) - return NULL; - p = first_avcodec; - while (p) { - if (av_codec_is_decoder(p) && strcmp(name, p->name) == 0) - return p; - p = p->next; - } - return NULL; -} - -const char *avcodec_get_name(enum AVCodecID id) -{ - const AVCodecDescriptor *cd; - AVCodec *codec; - - if (id == AV_CODEC_ID_NONE) - return "none"; - cd = avcodec_descriptor_get(id); - if (cd) - return cd->name; - av_log(NULL, AV_LOG_WARNING, "Codec 0x%x is not in the full list.\n", id); - codec = avcodec_find_decoder(id); - if (codec) - return codec->name; - codec = avcodec_find_encoder(id); - if (codec) - return codec->name; - return "unknown_codec"; -} - -size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag) -{ - int i, len, ret = 0; - -#define TAG_PRINT(x) \ - (((x) >= '0' && (x) <= '9') || \ - ((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z') || \ - ((x) == '.' || (x) == ' ' || (x) == '-' || (x) == '_')) - - for (i = 0; i < 4; i++) { - len = snprintf(buf, buf_size, - TAG_PRINT(codec_tag & 0xFF) ? "%c" : "[%d]", codec_tag & 0xFF); - buf += len; - buf_size = buf_size > len ? buf_size - len : 0; - ret += len; - codec_tag >>= 8; - } - return ret; -} - -void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) -{ - const char *codec_type; - const char *codec_name; - const char *profile = NULL; - const AVCodec *p; - int bitrate; - AVRational display_aspect_ratio; - - if (!buf || buf_size <= 0) - return; - codec_type = av_get_media_type_string(enc->codec_type); - codec_name = avcodec_get_name(enc->codec_id); - if (enc->profile != FF_PROFILE_UNKNOWN) { - if (enc->codec) - p = enc->codec; - else - p = encode ? avcodec_find_encoder(enc->codec_id) : - avcodec_find_decoder(enc->codec_id); - if (p) - profile = av_get_profile_name(p, enc->profile); - } - - snprintf(buf, buf_size, "%s: %s", codec_type ? codec_type : "unknown", - codec_name); - buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */ - - if (enc->codec && strcmp(enc->codec->name, codec_name)) - snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", enc->codec->name); - - if (profile) - snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", profile); - if (enc->codec_tag) { - char tag_buf[32]; - av_get_codec_tag_string(tag_buf, sizeof(tag_buf), enc->codec_tag); - snprintf(buf + strlen(buf), buf_size - strlen(buf), - " (%s / 0x%04X)", tag_buf, enc->codec_tag); - } - - switch (enc->codec_type) { - case AVMEDIA_TYPE_VIDEO: - if (enc->pix_fmt != AV_PIX_FMT_NONE) { - char detail[256] = "("; - const char *colorspace_name; - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %s", - av_get_pix_fmt_name(enc->pix_fmt)); - if (enc->bits_per_raw_sample && - enc->bits_per_raw_sample <= av_pix_fmt_desc_get(enc->pix_fmt)->comp[0].depth_minus1) - av_strlcatf(detail, sizeof(detail), "%d bpc, ", enc->bits_per_raw_sample); - if (enc->color_range != AVCOL_RANGE_UNSPECIFIED) - av_strlcatf(detail, sizeof(detail), - enc->color_range == AVCOL_RANGE_MPEG ? "tv, ": "pc, "); - - colorspace_name = av_get_colorspace_name(enc->colorspace); - if (colorspace_name) - av_strlcatf(detail, sizeof(detail), "%s, ", colorspace_name); - - if (strlen(detail) > 1) { - detail[strlen(detail) - 2] = 0; - av_strlcatf(buf, buf_size, "%s)", detail); - } - } - if (enc->width) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %dx%d", - enc->width, enc->height); - if (enc->sample_aspect_ratio.num) { - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, - enc->width * enc->sample_aspect_ratio.num, - enc->height * enc->sample_aspect_ratio.den, - 1024 * 1024); - snprintf(buf + strlen(buf), buf_size - strlen(buf), - " [SAR %d:%d DAR %d:%d]", - enc->sample_aspect_ratio.num, enc->sample_aspect_ratio.den, - display_aspect_ratio.num, display_aspect_ratio.den); - } - if (av_log_get_level() >= AV_LOG_DEBUG) { - int g = av_gcd(enc->time_base.num, enc->time_base.den); - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %d/%d", - enc->time_base.num / g, enc->time_base.den / g); - } - } - if (encode) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", q=%d-%d", enc->qmin, enc->qmax); - } - break; - case AVMEDIA_TYPE_AUDIO: - if (enc->sample_rate) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %d Hz", enc->sample_rate); - } - av_strlcat(buf, ", ", buf_size); - av_get_channel_layout_string(buf + strlen(buf), buf_size - strlen(buf), enc->channels, enc->channel_layout); - if (enc->sample_fmt != AV_SAMPLE_FMT_NONE) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %s", av_get_sample_fmt_name(enc->sample_fmt)); - } - break; - case AVMEDIA_TYPE_DATA: - if (av_log_get_level() >= AV_LOG_DEBUG) { - int g = av_gcd(enc->time_base.num, enc->time_base.den); - if (g) - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %d/%d", - enc->time_base.num / g, enc->time_base.den / g); - } - break; - case AVMEDIA_TYPE_SUBTITLE: - if (enc->width) - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %dx%d", enc->width, enc->height); - break; - default: - return; - } - if (encode) { - if (enc->flags & CODEC_FLAG_PASS1) - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", pass 1"); - if (enc->flags & CODEC_FLAG_PASS2) - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", pass 2"); - } - bitrate = get_bit_rate(enc); - if (bitrate != 0) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", %d kb/s", bitrate / 1000); - } else if (enc->rc_max_rate > 0) { - snprintf(buf + strlen(buf), buf_size - strlen(buf), - ", max. %d kb/s", enc->rc_max_rate / 1000); - } -} - -const char *av_get_profile_name(const AVCodec *codec, int profile) -{ - const AVProfile *p; - if (profile == FF_PROFILE_UNKNOWN || !codec->profiles) - return NULL; - - for (p = codec->profiles; p->profile != FF_PROFILE_UNKNOWN; p++) - if (p->profile == profile) - return p->name; - - return NULL; -} - -unsigned avcodec_version(void) -{ -// av_assert0(AV_CODEC_ID_V410==164); - av_assert0(AV_CODEC_ID_PCM_S8_PLANAR==65563); - av_assert0(AV_CODEC_ID_ADPCM_G722==69660); -// av_assert0(AV_CODEC_ID_BMV_AUDIO==86071); - av_assert0(AV_CODEC_ID_SRT==94216); - av_assert0(LIBAVCODEC_VERSION_MICRO >= 100); - - av_assert0(CODEC_ID_CLLC == AV_CODEC_ID_CLLC); - av_assert0(CODEC_ID_PCM_S8_PLANAR == AV_CODEC_ID_PCM_S8_PLANAR); - av_assert0(CODEC_ID_ADPCM_IMA_APC == AV_CODEC_ID_ADPCM_IMA_APC); - av_assert0(CODEC_ID_ILBC == AV_CODEC_ID_ILBC); - av_assert0(CODEC_ID_SRT == AV_CODEC_ID_SRT); - return LIBAVCODEC_VERSION_INT; -} - -const char *avcodec_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char *avcodec_license(void) -{ -#define LICENSE_PREFIX "libavcodec license: " - return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; -} - -void avcodec_flush_buffers(AVCodecContext *avctx) -{ - if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) - ff_thread_flush(avctx); - else if (avctx->codec->flush) - avctx->codec->flush(avctx); - - avctx->pts_correction_last_pts = - avctx->pts_correction_last_dts = INT64_MIN; - - if (!avctx->refcounted_frames) - av_frame_unref(avctx->internal->to_free); -} - -int av_get_exact_bits_per_sample(enum AVCodecID codec_id) -{ - switch (codec_id) { - case AV_CODEC_ID_8SVX_EXP: - case AV_CODEC_ID_8SVX_FIB: - case AV_CODEC_ID_ADPCM_CT: - case AV_CODEC_ID_ADPCM_IMA_APC: - case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: - case AV_CODEC_ID_ADPCM_IMA_OKI: - case AV_CODEC_ID_ADPCM_IMA_WS: - case AV_CODEC_ID_ADPCM_G722: - case AV_CODEC_ID_ADPCM_YAMAHA: - return 4; - case AV_CODEC_ID_PCM_ALAW: - case AV_CODEC_ID_PCM_MULAW: - case AV_CODEC_ID_PCM_S8: - case AV_CODEC_ID_PCM_S8_PLANAR: - case AV_CODEC_ID_PCM_U8: - case AV_CODEC_ID_PCM_ZORK: - return 8; - case AV_CODEC_ID_PCM_S16BE: - case AV_CODEC_ID_PCM_S16BE_PLANAR: - case AV_CODEC_ID_PCM_S16LE: - case AV_CODEC_ID_PCM_S16LE_PLANAR: - case AV_CODEC_ID_PCM_U16BE: - case AV_CODEC_ID_PCM_U16LE: - return 16; - case AV_CODEC_ID_PCM_S24DAUD: - case AV_CODEC_ID_PCM_S24BE: - case AV_CODEC_ID_PCM_S24LE: - case AV_CODEC_ID_PCM_S24LE_PLANAR: - case AV_CODEC_ID_PCM_U24BE: - case AV_CODEC_ID_PCM_U24LE: - return 24; - case AV_CODEC_ID_PCM_S32BE: - case AV_CODEC_ID_PCM_S32LE: - case AV_CODEC_ID_PCM_S32LE_PLANAR: - case AV_CODEC_ID_PCM_U32BE: - case AV_CODEC_ID_PCM_U32LE: - case AV_CODEC_ID_PCM_F32BE: - case AV_CODEC_ID_PCM_F32LE: - return 32; - case AV_CODEC_ID_PCM_F64BE: - case AV_CODEC_ID_PCM_F64LE: - return 64; - default: - return 0; - } -} - -enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be) -{ - static const enum AVCodecID map[AV_SAMPLE_FMT_NB][2] = { - [AV_SAMPLE_FMT_U8 ] = { AV_CODEC_ID_PCM_U8, AV_CODEC_ID_PCM_U8 }, - [AV_SAMPLE_FMT_S16 ] = { AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_PCM_S16BE }, - [AV_SAMPLE_FMT_S32 ] = { AV_CODEC_ID_PCM_S32LE, AV_CODEC_ID_PCM_S32BE }, - [AV_SAMPLE_FMT_FLT ] = { AV_CODEC_ID_PCM_F32LE, AV_CODEC_ID_PCM_F32BE }, - [AV_SAMPLE_FMT_DBL ] = { AV_CODEC_ID_PCM_F64LE, AV_CODEC_ID_PCM_F64BE }, - [AV_SAMPLE_FMT_U8P ] = { AV_CODEC_ID_PCM_U8, AV_CODEC_ID_PCM_U8 }, - [AV_SAMPLE_FMT_S16P] = { AV_CODEC_ID_PCM_S16LE, AV_CODEC_ID_PCM_S16BE }, - [AV_SAMPLE_FMT_S32P] = { AV_CODEC_ID_PCM_S32LE, AV_CODEC_ID_PCM_S32BE }, - [AV_SAMPLE_FMT_FLTP] = { AV_CODEC_ID_PCM_F32LE, AV_CODEC_ID_PCM_F32BE }, - [AV_SAMPLE_FMT_DBLP] = { AV_CODEC_ID_PCM_F64LE, AV_CODEC_ID_PCM_F64BE }, - }; - if (fmt < 0 || fmt >= AV_SAMPLE_FMT_NB) - return AV_CODEC_ID_NONE; - if (be < 0 || be > 1) - be = AV_NE(1, 0); - return map[fmt][be]; -} - -int av_get_bits_per_sample(enum AVCodecID codec_id) -{ - switch (codec_id) { - case AV_CODEC_ID_ADPCM_SBPRO_2: - return 2; - case AV_CODEC_ID_ADPCM_SBPRO_3: - return 3; - case AV_CODEC_ID_ADPCM_SBPRO_4: - case AV_CODEC_ID_ADPCM_IMA_WAV: - case AV_CODEC_ID_ADPCM_IMA_QT: - case AV_CODEC_ID_ADPCM_SWF: - case AV_CODEC_ID_ADPCM_MS: - return 4; - default: - return av_get_exact_bits_per_sample(codec_id); - } -} - -int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) -{ - int id, sr, ch, ba, tag, bps; - - id = avctx->codec_id; - sr = avctx->sample_rate; - ch = avctx->channels; - ba = avctx->block_align; - tag = avctx->codec_tag; - bps = av_get_exact_bits_per_sample(avctx->codec_id); - - /* codecs with an exact constant bits per sample */ - if (bps > 0 && ch > 0 && frame_bytes > 0 && ch < 32768 && bps < 32768) - return (frame_bytes * 8LL) / (bps * ch); - bps = avctx->bits_per_coded_sample; - - /* codecs with a fixed packet duration */ - switch (id) { - case AV_CODEC_ID_ADPCM_ADX: return 32; - case AV_CODEC_ID_ADPCM_IMA_QT: return 64; - case AV_CODEC_ID_ADPCM_EA_XAS: return 128; - case AV_CODEC_ID_AMR_NB: - case AV_CODEC_ID_EVRC: - case AV_CODEC_ID_GSM: - case AV_CODEC_ID_QCELP: - case AV_CODEC_ID_RA_288: return 160; - case AV_CODEC_ID_AMR_WB: - case AV_CODEC_ID_GSM_MS: return 320; - case AV_CODEC_ID_MP1: return 384; - case AV_CODEC_ID_ATRAC1: return 512; - case AV_CODEC_ID_ATRAC3: return 1024; - case AV_CODEC_ID_MP2: - case AV_CODEC_ID_MUSEPACK7: return 1152; - case AV_CODEC_ID_AC3: return 1536; - } - - if (sr > 0) { - /* calc from sample rate */ - if (id == AV_CODEC_ID_TTA) - return 256 * sr / 245; - - if (ch > 0) { - /* calc from sample rate and channels */ - if (id == AV_CODEC_ID_BINKAUDIO_DCT) - return (480 << (sr / 22050)) / ch; - } - } - - if (ba > 0) { - /* calc from block_align */ - if (id == AV_CODEC_ID_SIPR) { - switch (ba) { - case 20: return 160; - case 19: return 144; - case 29: return 288; - case 37: return 480; - } - } else if (id == AV_CODEC_ID_ILBC) { - switch (ba) { - case 38: return 160; - case 50: return 240; - } - } - } - - if (frame_bytes > 0) { - /* calc from frame_bytes only */ - if (id == AV_CODEC_ID_TRUESPEECH) - return 240 * (frame_bytes / 32); - if (id == AV_CODEC_ID_NELLYMOSER) - return 256 * (frame_bytes / 64); - if (id == AV_CODEC_ID_RA_144) - return 160 * (frame_bytes / 20); - if (id == AV_CODEC_ID_G723_1) - return 240 * (frame_bytes / 24); - - if (bps > 0) { - /* calc from frame_bytes and bits_per_coded_sample */ - if (id == AV_CODEC_ID_ADPCM_G726) - return frame_bytes * 8 / bps; - } - - if (ch > 0) { - /* calc from frame_bytes and channels */ - switch (id) { - case AV_CODEC_ID_ADPCM_AFC: - return frame_bytes / (9 * ch) * 16; - case AV_CODEC_ID_ADPCM_DTK: - return frame_bytes / (16 * ch) * 28; - case AV_CODEC_ID_ADPCM_4XM: - case AV_CODEC_ID_ADPCM_IMA_ISS: - return (frame_bytes - 4 * ch) * 2 / ch; - case AV_CODEC_ID_ADPCM_IMA_SMJPEG: - return (frame_bytes - 4) * 2 / ch; - case AV_CODEC_ID_ADPCM_IMA_AMV: - return (frame_bytes - 8) * 2 / ch; - case AV_CODEC_ID_ADPCM_XA: - return (frame_bytes / 128) * 224 / ch; - case AV_CODEC_ID_INTERPLAY_DPCM: - return (frame_bytes - 6 - ch) / ch; - case AV_CODEC_ID_ROQ_DPCM: - return (frame_bytes - 8) / ch; - case AV_CODEC_ID_XAN_DPCM: - return (frame_bytes - 2 * ch) / ch; - case AV_CODEC_ID_MACE3: - return 3 * frame_bytes / ch; - case AV_CODEC_ID_MACE6: - return 6 * frame_bytes / ch; - case AV_CODEC_ID_PCM_LXF: - return 2 * (frame_bytes / (5 * ch)); - case AV_CODEC_ID_IAC: - case AV_CODEC_ID_IMC: - return 4 * frame_bytes / ch; - } - - if (tag) { - /* calc from frame_bytes, channels, and codec_tag */ - if (id == AV_CODEC_ID_SOL_DPCM) { - if (tag == 3) - return frame_bytes / ch; - else - return frame_bytes * 2 / ch; - } - } - - if (ba > 0) { - /* calc from frame_bytes, channels, and block_align */ - int blocks = frame_bytes / ba; - switch (avctx->codec_id) { - case AV_CODEC_ID_ADPCM_IMA_WAV: - if (bps < 2 || bps > 5) - return 0; - return blocks * (1 + (ba - 4 * ch) / (bps * ch) * 8); - case AV_CODEC_ID_ADPCM_IMA_DK3: - return blocks * (((ba - 16) * 2 / 3 * 4) / ch); - case AV_CODEC_ID_ADPCM_IMA_DK4: - return blocks * (1 + (ba - 4 * ch) * 2 / ch); - case AV_CODEC_ID_ADPCM_IMA_RAD: - return blocks * ((ba - 4 * ch) * 2 / ch); - case AV_CODEC_ID_ADPCM_MS: - return blocks * (2 + (ba - 7 * ch) * 2 / ch); - default: break; - } - } - - if (bps > 0) { - /* calc from frame_bytes, channels, and bits_per_coded_sample */ - switch (avctx->codec_id) { - case AV_CODEC_ID_PCM_DVD: - if(bps<4) - return 0; - return 2 * (frame_bytes / ((bps * 2 / 8) * ch)); - case AV_CODEC_ID_PCM_BLURAY: - if(bps<4) - return 0; - return frame_bytes / ((FFALIGN(ch, 2) * bps) / 8); - case AV_CODEC_ID_S302M: - return 2 * (frame_bytes / ((bps + 4) / 4)) / ch; - default: break; - } - } - } - } - - return 0; -} - -#if !HAVE_THREADS -int ff_thread_init(AVCodecContext *s) -{ - return -1; -} - -#endif - -unsigned int av_xiphlacing(unsigned char *s, unsigned int v) -{ - unsigned int n = 0; - - while (v >= 0xff) { - *s++ = 0xff; - v -= 0xff; - n++; - } - *s = v; - n++; - return n; -} - -int ff_match_2uint16(const uint16_t(*tab)[2], int size, int a, int b) -{ - int i; - for (i = 0; i < size && !(tab[i][0] == a && tab[i][1] == b); i++) ; - return i; -} - -#if FF_API_MISSING_SAMPLE -FF_DISABLE_DEPRECATION_WARNINGS -void av_log_missing_feature(void *avc, const char *feature, int want_sample) -{ - av_log(avc, AV_LOG_WARNING, "%s is not implemented. Update your FFmpeg " - "version to the newest one from Git. If the problem still " - "occurs, it means that your file has a feature which has not " - "been implemented.\n", feature); - if(want_sample) - av_log_ask_for_sample(avc, NULL); -} - -void av_log_ask_for_sample(void *avc, const char *msg, ...) -{ - va_list argument_list; - - va_start(argument_list, msg); - - if (msg) - av_vlog(avc, AV_LOG_WARNING, msg, argument_list); - av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample " - "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ " - "and contact the ffmpeg-devel mailing list.\n"); - - va_end(argument_list); -} -FF_ENABLE_DEPRECATION_WARNINGS -#endif /* FF_API_MISSING_SAMPLE */ - -static AVHWAccel *first_hwaccel = NULL; -static AVHWAccel **last_hwaccel = &first_hwaccel; - -void av_register_hwaccel(AVHWAccel *hwaccel) -{ - AVHWAccel **p = last_hwaccel; - hwaccel->next = NULL; - while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, hwaccel)) - p = &(*p)->next; - last_hwaccel = &hwaccel->next; -} - -AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel) -{ - return hwaccel ? hwaccel->next : first_hwaccel; -} - -AVHWAccel *ff_find_hwaccel(AVCodecContext *avctx) -{ - enum AVCodecID codec_id = avctx->codec->id; - enum AVPixelFormat pix_fmt = avctx->pix_fmt; - - AVHWAccel *hwaccel = NULL; - - while ((hwaccel = av_hwaccel_next(hwaccel))) - if (hwaccel->id == codec_id - && hwaccel->pix_fmt == pix_fmt) - return hwaccel; - return NULL; -} - -int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) -{ - if (lockmgr_cb) { - if (lockmgr_cb(&codec_mutex, AV_LOCK_DESTROY)) - return -1; - if (lockmgr_cb(&avformat_mutex, AV_LOCK_DESTROY)) - return -1; - } - - lockmgr_cb = cb; - - if (lockmgr_cb) { - if (lockmgr_cb(&codec_mutex, AV_LOCK_CREATE)) - return -1; - if (lockmgr_cb(&avformat_mutex, AV_LOCK_CREATE)) - return -1; - } - return 0; -} - -int ff_lock_avcodec(AVCodecContext *log_ctx) -{ - if (lockmgr_cb) { - if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_OBTAIN)) - return -1; - } - entangled_thread_counter++; - if (entangled_thread_counter != 1) { - av_log(log_ctx, AV_LOG_ERROR, "Insufficient thread locking around avcodec_open/close()\n"); - if (!lockmgr_cb) - av_log(log_ctx, AV_LOG_ERROR, "No lock manager is set, please see av_lockmgr_register()\n"); - ff_avcodec_locked = 1; - ff_unlock_avcodec(); - return AVERROR(EINVAL); - } - av_assert0(!ff_avcodec_locked); - ff_avcodec_locked = 1; - return 0; -} - -int ff_unlock_avcodec(void) -{ - av_assert0(ff_avcodec_locked); - ff_avcodec_locked = 0; - entangled_thread_counter--; - if (lockmgr_cb) { - if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) - return -1; - } - return 0; -} - -int avpriv_lock_avformat(void) -{ - if (lockmgr_cb) { - if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_OBTAIN)) - return -1; - } - return 0; -} - -int avpriv_unlock_avformat(void) -{ - if (lockmgr_cb) { - if ((*lockmgr_cb)(&avformat_mutex, AV_LOCK_RELEASE)) - return -1; - } - return 0; -} - -unsigned int avpriv_toupper4(unsigned int x) -{ - return av_toupper(x & 0xFF) + - (av_toupper((x >> 8) & 0xFF) << 8) + - (av_toupper((x >> 16) & 0xFF) << 16) + - (av_toupper((x >> 24) & 0xFF) << 24); -} - -int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src) -{ - int ret; - - dst->owner = src->owner; - - ret = av_frame_ref(dst->f, src->f); - if (ret < 0) - return ret; - - if (src->progress && - !(dst->progress = av_buffer_ref(src->progress))) { - ff_thread_release_buffer(dst->owner, dst); - return AVERROR(ENOMEM); - } - - return 0; -} - -#if !HAVE_THREADS - -enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt) -{ - return avctx->get_format(avctx, fmt); -} - -int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) -{ - f->owner = avctx; - return ff_get_buffer(avctx, f->f, flags); -} - -void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f) -{ - av_frame_unref(f->f); -} - -void ff_thread_finish_setup(AVCodecContext *avctx) -{ -} - -void ff_thread_report_progress(ThreadFrame *f, int progress, int field) -{ -} - -void ff_thread_await_progress(ThreadFrame *f, int progress, int field) -{ -} - -int ff_thread_can_start_frame(AVCodecContext *avctx) -{ - return 1; -} - -int ff_alloc_entries(AVCodecContext *avctx, int count) -{ - return 0; -} - -void ff_reset_entries(AVCodecContext *avctx) -{ -} - -void ff_thread_await_progress2(AVCodecContext *avctx, int field, int thread, int shift) -{ -} - -void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n) -{ -} - -#endif - -enum AVMediaType avcodec_get_type(enum AVCodecID codec_id) -{ - AVCodec *c= avcodec_find_decoder(codec_id); - if(!c) - c= avcodec_find_encoder(codec_id); - if(c) - return c->type; - - if (codec_id <= AV_CODEC_ID_NONE) - return AVMEDIA_TYPE_UNKNOWN; - else if (codec_id < AV_CODEC_ID_FIRST_AUDIO) - return AVMEDIA_TYPE_VIDEO; - else if (codec_id < AV_CODEC_ID_FIRST_SUBTITLE) - return AVMEDIA_TYPE_AUDIO; - else if (codec_id < AV_CODEC_ID_FIRST_UNKNOWN) - return AVMEDIA_TYPE_SUBTITLE; - - return AVMEDIA_TYPE_UNKNOWN; -} - -int avcodec_is_open(AVCodecContext *s) -{ - return !!s->internal; -} - -int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf) -{ - int ret; - char *str; - - ret = av_bprint_finalize(buf, &str); - if (ret < 0) - return ret; - avctx->extradata = (uint8_t *)str; - /* Note: the string is NUL terminated (so extradata can be read as a - * string), but the ending character is not accounted in the size (in - * binary formats you are likely not supposed to mux that character). When - * extradata is copied, it is also padded with FF_INPUT_BUFFER_PADDING_SIZE - * zeros. */ - avctx->extradata_size = buf->len; - return 0; -} - -const uint8_t *avpriv_find_start_code(const uint8_t *av_restrict p, - const uint8_t *end, - uint32_t *av_restrict state) -{ - int i; - - av_assert0(p <= end); - if (p >= end) - return end; - - for (i = 0; i < 3; i++) { - uint32_t tmp = *state << 8; - *state = tmp + *(p++); - if (tmp == 0x100 || p == end) - return p; - } - - while (p < end) { - if (p[-1] > 1 ) p += 3; - else if (p[-2] ) p += 2; - else if (p[-3]|(p[-1]-1)) p++; - else { - p++; - break; - } - } - - p = FFMIN(p, end) - 4; - *state = AV_RB32(p); - - return p + 4; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/version.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/version.h deleted file mode 100644 index 0c3afc417..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/version.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_VERSION_H -#define AVCODEC_VERSION_H - -/** - * @file - * @ingroup libavc - * Libavcodec version macros. - */ - -#ifdef __FRAMEWORK__ -#include "version.h" -#else -#include "libavutil/version.h" -#endif - -#define LIBAVCODEC_VERSION_MAJOR 55 -#define LIBAVCODEC_VERSION_MINOR 52 -#define LIBAVCODEC_VERSION_MICRO 102 - -#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ - LIBAVCODEC_VERSION_MINOR, \ - LIBAVCODEC_VERSION_MICRO) -#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT - -#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) - -/** - * FF_API_* defines may be placed below to indicate public API that will be - * dropped at a future version bump. The defines themselves are not part of - * the public API and may change, break or disappear at any time. - */ - -#ifndef FF_API_REQUEST_CHANNELS -#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_OLD_DECODE_AUDIO -#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_OLD_ENCODE_AUDIO -#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_OLD_ENCODE_VIDEO -#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_CODEC_ID -#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_AUDIO_CONVERT -#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_AVCODEC_RESAMPLE -#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT -#endif -#ifndef FF_API_DEINTERLACE -#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_DESTRUCT_PACKET -#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_GET_BUFFER -#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_MISSING_SAMPLE -#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_LOWRES -#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_CAP_VDPAU -#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_BUFS_VDPAU -#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_VOXWARE -#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_SET_DIMENSIONS -#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_DEBUG_MV -#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_AC_VLC -#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_OLD_MSMPEG4 -#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_ASPECT_EXTENDED -#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_THREAD_OPAQUE -#define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_CODEC_PKT -#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_ARCH_ALPHA -#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_ERROR_RATE -#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_QSCALE_TYPE -#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_MB_TYPE -#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_MAX_BFRAMES -#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_FAST_MALLOC -#define FF_API_FAST_MALLOC (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_NEG_LINESIZES -#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_EMU_EDGE -#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 56) -#endif - -#endif /* AVCODEC_VERSION_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.c deleted file mode 100644 index 287557666..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "videodsp.h" - -#define BIT_DEPTH 8 -#include "videodsp_template.c" -#undef BIT_DEPTH - -#define BIT_DEPTH 16 -#include "videodsp_template.c" -#undef BIT_DEPTH - -static void just_return(uint8_t *buf, ptrdiff_t stride, int h) -{ -} - -av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc) -{ - ctx->prefetch = just_return; - if (bpc <= 8) { - ctx->emulated_edge_mc = ff_emulated_edge_mc_8; - } else { - ctx->emulated_edge_mc = ff_emulated_edge_mc_16; - } - - if (ARCH_ARM) - ff_videodsp_init_arm(ctx, bpc); - if (ARCH_PPC) - ff_videodsp_init_ppc(ctx, bpc); - if (ARCH_X86) - ff_videodsp_init_x86(ctx, bpc); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.h deleted file mode 100644 index 4721efda9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Core video DSP helper functions - */ - -#ifndef AVCODEC_VIDEODSP_H -#define AVCODEC_VIDEODSP_H - -#include -#include - -#define EMULATED_EDGE(depth) \ -void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \ - ptrdiff_t dst_stride, ptrdiff_t src_stride, \ - int block_w, int block_h,\ - int src_x, int src_y, int w, int h); - -EMULATED_EDGE(8) -EMULATED_EDGE(16) - -typedef struct VideoDSPContext { - /** - * Copy a rectangular area of samples to a temporary buffer and replicate - * the border samples. - * - * @param dst destination buffer - * @param dst_stride number of bytes between 2 vertically adjacent samples - * in destination buffer - * @param src source buffer - * @param dst_linesize number of bytes between 2 vertically adjacent - * samples in the destination buffer - * @param src_linesize number of bytes between 2 vertically adjacent - * samples in both the source buffer - * @param block_w width of block - * @param block_h height of block - * @param src_x x coordinate of the top left sample of the block in the - * source buffer - * @param src_y y coordinate of the top left sample of the block in the - * source buffer - * @param w width of the source buffer - * @param h height of the source buffer - */ - void (*emulated_edge_mc)(uint8_t *dst, const uint8_t *src, - ptrdiff_t dst_linesize, - ptrdiff_t src_linesize, - int block_w, int block_h, - int src_x, int src_y, int w, int h); - - /** - * Prefetch memory into cache (if supported by hardware). - * - * @buf pointer to buffer to prefetch memory from - * @stride distance between two lines of buf (in bytes) - * @h number of lines to prefetch - */ - void (*prefetch)(uint8_t *buf, ptrdiff_t stride, int h); -} VideoDSPContext; - -void ff_videodsp_init(VideoDSPContext *ctx, int bpc); - -/* for internal use only (i.e. called by ff_videodsp_init() */ -void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc); -void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc); -void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc); - -#endif /* AVCODEC_VIDEODSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp_template.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp_template.c deleted file mode 100644 index c569c30d6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/videodsp_template.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002-2012 Michael Niedermayer - * Copyright (C) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "bit_depth_template.c" -void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, - ptrdiff_t buf_linesize, - ptrdiff_t src_linesize, - int block_w, int block_h, - int src_x, int src_y, int w, int h) -{ - int x, y; - int start_y, start_x, end_y, end_x; - - if (!w || !h) - return; - - if (src_y >= h) { - src -= src_y * src_linesize; - src += (h - 1) * src_linesize; - src_y = h - 1; - } else if (src_y <= -block_h) { - src -= src_y * src_linesize; - src += (1 - block_h) * src_linesize; - src_y = 1 - block_h; - } - if (src_x >= w) { - src += (w - 1 - src_x) * sizeof(pixel); - src_x = w - 1; - } else if (src_x <= -block_w) { - src += (1 - block_w - src_x) * sizeof(pixel); - src_x = 1 - block_w; - } - - start_y = FFMAX(0, -src_y); - start_x = FFMAX(0, -src_x); - end_y = FFMIN(block_h, h-src_y); - end_x = FFMIN(block_w, w-src_x); - av_assert2(start_y < end_y && block_h); - av_assert2(start_x < end_x && block_w); - - w = end_x - start_x; - src += start_y * src_linesize + start_x * sizeof(pixel); - buf += start_x * sizeof(pixel); - - // top - for (y = 0; y < start_y; y++) { - memcpy(buf, src, w * sizeof(pixel)); - buf += buf_linesize; - } - - // copy existing part - for (; y < end_y; y++) { - memcpy(buf, src, w * sizeof(pixel)); - src += src_linesize; - buf += buf_linesize; - } - - // bottom - src -= src_linesize; - for (; y < block_h; y++) { - memcpy(buf, src, w * sizeof(pixel)); - buf += buf_linesize; - } - - buf -= block_h * buf_linesize + start_x * sizeof(pixel); - while (block_h--) { - pixel *bufp = (pixel *) buf; - - // left - for(x = 0; x < start_x; x++) { - bufp[x] = bufp[start_x]; - } - - // right - for (x = end_x; x < block_w; x++) { - bufp[x] = bufp[end_x - 1]; - } - buf += buf_linesize; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.c deleted file mode 100644 index 0122ee6fe..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.c +++ /dev/null @@ -1,489 +0,0 @@ -/* - * WMA compatible codec - * Copyright (c) 2002-2007 The FFmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "avcodec.h" -#include "sinewin.h" -#include "wma.h" -#include "wma_common.h" -#include "wmadata.h" - -#undef NDEBUG -#include - -/* XXX: use same run/length optimization as mpeg decoders */ -//FIXME maybe split decode / encode or pass flag -static av_cold void init_coef_vlc(VLC *vlc, uint16_t **prun_table, - float **plevel_table, uint16_t **pint_table, - const CoefVLCTable *vlc_table) -{ - int n = vlc_table->n; - const uint8_t *table_bits = vlc_table->huffbits; - const uint32_t *table_codes = vlc_table->huffcodes; - const uint16_t *levels_table = vlc_table->levels; - uint16_t *run_table, *level_table, *int_table; - float *flevel_table; - int i, l, j, k, level; - - init_vlc(vlc, VLCBITS, n, table_bits, 1, 1, table_codes, 4, 4, 0); - - run_table = av_malloc(n * sizeof(uint16_t)); - level_table = av_malloc(n * sizeof(uint16_t)); - flevel_table= av_malloc(n * sizeof(*flevel_table)); - int_table = av_malloc(n * sizeof(uint16_t)); - i = 2; - level = 1; - k = 0; - while (i < n) { - int_table[k] = i; - l = levels_table[k++]; - for (j = 0; j < l; j++) { - run_table[i] = j; - level_table[i] = level; - flevel_table[i]= level; - i++; - } - level++; - } - *prun_table = run_table; - *plevel_table = flevel_table; - *pint_table = int_table; - av_free(level_table); -} - -av_cold int ff_wma_init(AVCodecContext *avctx, int flags2) -{ - WMACodecContext *s = avctx->priv_data; - int i; - float bps1, high_freq; - volatile float bps; - int sample_rate1; - int coef_vlc_table; - - if ( avctx->sample_rate <= 0 || avctx->sample_rate > 50000 - || avctx->channels <= 0 || avctx->channels > 2 - || avctx->bit_rate <= 0) - return -1; - - ff_fmt_convert_init(&s->fmt_conv, avctx); - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - - if (avctx->codec->id == AV_CODEC_ID_WMAV1) { - s->version = 1; - } else { - s->version = 2; - } - - /* compute MDCT block size */ - s->frame_len_bits = ff_wma_get_frame_len_bits(avctx->sample_rate, - s->version, 0); - s->next_block_len_bits = s->frame_len_bits; - s->prev_block_len_bits = s->frame_len_bits; - s->block_len_bits = s->frame_len_bits; - - s->frame_len = 1 << s->frame_len_bits; - if (s->use_variable_block_len) { - int nb_max, nb; - nb = ((flags2 >> 3) & 3) + 1; - if ((avctx->bit_rate / avctx->channels) >= 32000) - nb += 2; - nb_max = s->frame_len_bits - BLOCK_MIN_BITS; - if (nb > nb_max) - nb = nb_max; - s->nb_block_sizes = nb + 1; - } else { - s->nb_block_sizes = 1; - } - - /* init rate dependent parameters */ - s->use_noise_coding = 1; - high_freq = avctx->sample_rate * 0.5; - - /* if version 2, then the rates are normalized */ - sample_rate1 = avctx->sample_rate; - if (s->version == 2) { - if (sample_rate1 >= 44100) { - sample_rate1 = 44100; - } else if (sample_rate1 >= 22050) { - sample_rate1 = 22050; - } else if (sample_rate1 >= 16000) { - sample_rate1 = 16000; - } else if (sample_rate1 >= 11025) { - sample_rate1 = 11025; - } else if (sample_rate1 >= 8000) { - sample_rate1 = 8000; - } - } - - bps = (float)avctx->bit_rate / (float)(avctx->channels * avctx->sample_rate); - s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2; - if (s->byte_offset_bits + 3 > MIN_CACHE_BITS) { - av_log(avctx, AV_LOG_ERROR, "byte_offset_bits %d is too large\n", s->byte_offset_bits); - return AVERROR_PATCHWELCOME; - } - - /* compute high frequency value and choose if noise coding should - be activated */ - bps1 = bps; - if (avctx->channels == 2) - bps1 = bps * 1.6; - if (sample_rate1 == 44100) { - if (bps1 >= 0.61) { - s->use_noise_coding = 0; - } else { - high_freq = high_freq * 0.4; - } - } else if (sample_rate1 == 22050) { - if (bps1 >= 1.16) { - s->use_noise_coding = 0; - } else if (bps1 >= 0.72) { - high_freq = high_freq * 0.7; - } else { - high_freq = high_freq * 0.6; - } - } else if (sample_rate1 == 16000) { - if (bps > 0.5) { - high_freq = high_freq * 0.5; - } else { - high_freq = high_freq * 0.3; - } - } else if (sample_rate1 == 11025) { - high_freq = high_freq * 0.7; - } else if (sample_rate1 == 8000) { - if (bps <= 0.625) { - high_freq = high_freq * 0.5; - } else if (bps > 0.75) { - s->use_noise_coding = 0; - } else { - high_freq = high_freq * 0.65; - } - } else { - if (bps >= 0.8) { - high_freq = high_freq * 0.75; - } else if (bps >= 0.6) { - high_freq = high_freq * 0.6; - } else { - high_freq = high_freq * 0.5; - } - } - av_dlog(s->avctx, "flags2=0x%x\n", flags2); - av_dlog(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", - s->version, avctx->channels, avctx->sample_rate, avctx->bit_rate, - avctx->block_align); - av_dlog(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", - bps, bps1, high_freq, s->byte_offset_bits); - av_dlog(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", - s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); - - /* compute the scale factor band sizes for each MDCT block size */ - { - int a, b, pos, lpos, k, block_len, i, j, n; - const uint8_t *table; - - if (s->version == 1) { - s->coefs_start = 3; - } else { - s->coefs_start = 0; - } - for (k = 0; k < s->nb_block_sizes; k++) { - block_len = s->frame_len >> k; - - if (s->version == 1) { - lpos = 0; - for (i = 0; i < 25; i++) { - a = ff_wma_critical_freqs[i]; - b = avctx->sample_rate; - pos = ((block_len * 2 * a) + (b >> 1)) / b; - if (pos > block_len) - pos = block_len; - s->exponent_bands[0][i] = pos - lpos; - if (pos >= block_len) { - i++; - break; - } - lpos = pos; - } - s->exponent_sizes[0] = i; - } else { - /* hardcoded tables */ - table = NULL; - a = s->frame_len_bits - BLOCK_MIN_BITS - k; - if (a < 3) { - if (avctx->sample_rate >= 44100) { - table = exponent_band_44100[a]; - } else if (avctx->sample_rate >= 32000) { - table = exponent_band_32000[a]; - } else if (avctx->sample_rate >= 22050) { - table = exponent_band_22050[a]; - } - } - if (table) { - n = *table++; - for (i = 0; i < n; i++) - s->exponent_bands[k][i] = table[i]; - s->exponent_sizes[k] = n; - } else { - j = 0; - lpos = 0; - for (i = 0; i < 25; i++) { - a = ff_wma_critical_freqs[i]; - b = avctx->sample_rate; - pos = ((block_len * 2 * a) + (b << 1)) / (4 * b); - pos <<= 2; - if (pos > block_len) - pos = block_len; - if (pos > lpos) - s->exponent_bands[k][j++] = pos - lpos; - if (pos >= block_len) - break; - lpos = pos; - } - s->exponent_sizes[k] = j; - } - } - - /* max number of coefs */ - s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; - /* high freq computation */ - s->high_band_start[k] = (int)((block_len * 2 * high_freq) / - avctx->sample_rate + 0.5); - n = s->exponent_sizes[k]; - j = 0; - pos = 0; - for (i = 0; i < n; i++) { - int start, end; - start = pos; - pos += s->exponent_bands[k][i]; - end = pos; - if (start < s->high_band_start[k]) - start = s->high_band_start[k]; - if (end > s->coefs_end[k]) - end = s->coefs_end[k]; - if (end > start) - s->exponent_high_bands[k][j++] = end - start; - } - s->exponent_high_sizes[k] = j; -#if 0 - tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", - s->frame_len >> k, - s->coefs_end[k], - s->high_band_start[k], - s->exponent_high_sizes[k]); - for (j = 0; j < s->exponent_high_sizes[k]; j++) - tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]); - tprintf(s->avctx, "\n"); -#endif - } - } - -#ifdef TRACE - { - int i, j; - for (i = 0; i < s->nb_block_sizes; i++) { - tprintf(s->avctx, "%5d: n=%2d:", - s->frame_len >> i, - s->exponent_sizes[i]); - for (j = 0; j < s->exponent_sizes[i]; j++) - tprintf(s->avctx, " %d", s->exponent_bands[i][j]); - tprintf(s->avctx, "\n"); - } - } -#endif - - /* init MDCT windows : simple sine window */ - for (i = 0; i < s->nb_block_sizes; i++) { - ff_init_ff_sine_windows(s->frame_len_bits - i); - s->windows[i] = ff_sine_windows[s->frame_len_bits - i]; - } - - s->reset_block_lengths = 1; - - if (s->use_noise_coding) { - - /* init the noise generator */ - if (s->use_exp_vlc) { - s->noise_mult = 0.02; - } else { - s->noise_mult = 0.04; - } - -#ifdef TRACE - for (i = 0; i < NOISE_TAB_SIZE; i++) - s->noise_table[i] = 1.0 * s->noise_mult; -#else - { - unsigned int seed; - float norm; - seed = 1; - norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult; - for (i = 0; i < NOISE_TAB_SIZE; i++) { - seed = seed * 314159 + 1; - s->noise_table[i] = (float)((int)seed) * norm; - } - } -#endif - } - - /* choose the VLC tables for the coefficients */ - coef_vlc_table = 2; - if (avctx->sample_rate >= 32000) { - if (bps1 < 0.72) { - coef_vlc_table = 0; - } else if (bps1 < 1.16) { - coef_vlc_table = 1; - } - } - s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2 ]; - s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1]; - init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0], - s->coef_vlcs[0]); - init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1], - s->coef_vlcs[1]); - - return 0; -} - -int ff_wma_total_gain_to_bits(int total_gain) -{ - if (total_gain < 15) return 13; - else if (total_gain < 32) return 12; - else if (total_gain < 40) return 11; - else if (total_gain < 45) return 10; - else return 9; -} - -int ff_wma_end(AVCodecContext *avctx) -{ - WMACodecContext *s = avctx->priv_data; - int i; - - for (i = 0; i < s->nb_block_sizes; i++) - ff_mdct_end(&s->mdct_ctx[i]); - - if (s->use_exp_vlc) { - ff_free_vlc(&s->exp_vlc); - } - if (s->use_noise_coding) { - ff_free_vlc(&s->hgain_vlc); - } - for (i = 0; i < 2; i++) { - ff_free_vlc(&s->coef_vlc[i]); - av_free(s->run_table[i]); - av_free(s->level_table[i]); - av_free(s->int_table[i]); - } - - return 0; -} - -/** - * Decode an uncompressed coefficient. - * @param gb GetBitContext - * @return the decoded coefficient - */ -unsigned int ff_wma_get_large_val(GetBitContext* gb) -{ - /** consumes up to 34 bits */ - int n_bits = 8; - /** decode length */ - if (get_bits1(gb)) { - n_bits += 8; - if (get_bits1(gb)) { - n_bits += 8; - if (get_bits1(gb)) { - n_bits += 7; - } - } - } - return get_bits_long(gb, n_bits); -} - -/** - * Decode run level compressed coefficients. - * @param avctx codec context - * @param gb bitstream reader context - * @param vlc vlc table for get_vlc2 - * @param level_table level codes - * @param run_table run codes - * @param version 0 for wma1,2 1 for wmapro - * @param ptr output buffer - * @param offset offset in the output buffer - * @param num_coefs number of input coefficents - * @param block_len input buffer length (2^n) - * @param frame_len_bits number of bits for escaped run codes - * @param coef_nb_bits number of bits for escaped level codes - * @return 0 on success, -1 otherwise - */ -int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, - VLC *vlc, - const float *level_table, const uint16_t *run_table, - int version, WMACoef *ptr, int offset, - int num_coefs, int block_len, int frame_len_bits, - int coef_nb_bits) -{ - int code, level, sign; - const uint32_t *ilvl = (const uint32_t*)level_table; - uint32_t *iptr = (uint32_t*)ptr; - const unsigned int coef_mask = block_len - 1; - for (; offset < num_coefs; offset++) { - code = get_vlc2(gb, vlc->table, VLCBITS, VLCMAX); - if (code > 1) { - /** normal code */ - offset += run_table[code]; - sign = get_bits1(gb) - 1; - iptr[offset & coef_mask] = ilvl[code] ^ sign<<31; - } else if (code == 1) { - /** EOB */ - break; - } else { - /** escape */ - if (!version) { - level = get_bits(gb, coef_nb_bits); - /** NOTE: this is rather suboptimal. reading - block_len_bits would be better */ - offset += get_bits(gb, frame_len_bits); - } else { - level = ff_wma_get_large_val(gb); - /** escape decode */ - if (get_bits1(gb)) { - if (get_bits1(gb)) { - if (get_bits1(gb)) { - av_log(avctx,AV_LOG_ERROR, - "broken escape sequence\n"); - return -1; - } else - offset += get_bits(gb, frame_len_bits) + 4; - } else - offset += get_bits(gb, 2) + 1; - } - } - sign = get_bits1(gb) - 1; - ptr[offset & coef_mask] = (level^sign) - sign; - } - } - /** NOTE: EOB can be omitted */ - if (offset > num_coefs) { - av_log(avctx, AV_LOG_ERROR, "overflow in spectral RLE, ignoring\n"); - return -1; - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.h deleted file mode 100644 index c4056ecef..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma.h +++ /dev/null @@ -1,159 +0,0 @@ -/* - * WMA compatible codec - * Copyright (c) 2002-2007 The FFmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_WMA_H -#define AVCODEC_WMA_H - -#include "libavutil/float_dsp.h" -#include "get_bits.h" -#include "put_bits.h" -#include "fft.h" -#include "fmtconvert.h" - -/* size of blocks */ -#define BLOCK_MIN_BITS 7 -#define BLOCK_MAX_BITS 11 -#define BLOCK_MAX_SIZE (1 << BLOCK_MAX_BITS) - -#define BLOCK_NB_SIZES (BLOCK_MAX_BITS - BLOCK_MIN_BITS + 1) - -/* XXX: find exact max size */ -#define HIGH_BAND_MAX_SIZE 16 - -#define NB_LSP_COEFS 10 - -/* XXX: is it a suitable value ? */ -#define MAX_CODED_SUPERFRAME_SIZE 16384 - -#define MAX_CHANNELS 2 - -#define NOISE_TAB_SIZE 8192 - -#define LSP_POW_BITS 7 - -//FIXME should be in wmadec -#define VLCBITS 9 -#define VLCMAX ((22+VLCBITS-1)/VLCBITS) - -typedef float WMACoef; ///< type for decoded coefficients, int16_t would be enough for wma 1/2 - -typedef struct CoefVLCTable { - int n; ///< total number of codes - int max_level; - const uint32_t *huffcodes; ///< VLC bit values - const uint8_t *huffbits; ///< VLC bit size - const uint16_t *levels; ///< table to build run/level tables -} CoefVLCTable; - -typedef struct WMACodecContext { - AVCodecContext* avctx; - GetBitContext gb; - PutBitContext pb; - int version; ///< 1 = 0x160 (WMAV1), 2 = 0x161 (WMAV2) - int use_bit_reservoir; - int use_variable_block_len; - int use_exp_vlc; ///< exponent coding: 0 = lsp, 1 = vlc + delta - int use_noise_coding; ///< true if perceptual noise is added - int byte_offset_bits; - VLC exp_vlc; - int exponent_sizes[BLOCK_NB_SIZES]; - uint16_t exponent_bands[BLOCK_NB_SIZES][25]; - int high_band_start[BLOCK_NB_SIZES]; ///< index of first coef in high band - int coefs_start; ///< first coded coef - int coefs_end[BLOCK_NB_SIZES]; ///< max number of coded coefficients - int exponent_high_sizes[BLOCK_NB_SIZES]; - int exponent_high_bands[BLOCK_NB_SIZES][HIGH_BAND_MAX_SIZE]; - VLC hgain_vlc; - - /* coded values in high bands */ - int high_band_coded[MAX_CHANNELS][HIGH_BAND_MAX_SIZE]; - int high_band_values[MAX_CHANNELS][HIGH_BAND_MAX_SIZE]; - - /* there are two possible tables for spectral coefficients */ -//FIXME the following 3 tables should be shared between decoders - VLC coef_vlc[2]; - uint16_t *run_table[2]; - float *level_table[2]; - uint16_t *int_table[2]; - const CoefVLCTable *coef_vlcs[2]; - /* frame info */ - int frame_len; ///< frame length in samples - int frame_len_bits; ///< frame_len = 1 << frame_len_bits - int nb_block_sizes; ///< number of block sizes - /* block info */ - int reset_block_lengths; - int block_len_bits; ///< log2 of current block length - int next_block_len_bits; ///< log2 of next block length - int prev_block_len_bits; ///< log2 of prev block length - int block_len; ///< block length in samples - int block_num; ///< block number in current frame - int block_pos; ///< current position in frame - uint8_t ms_stereo; ///< true if mid/side stereo mode - uint8_t channel_coded[MAX_CHANNELS]; ///< true if channel is coded - int exponents_bsize[MAX_CHANNELS]; ///< log2 ratio frame/exp. length - DECLARE_ALIGNED(32, float, exponents)[MAX_CHANNELS][BLOCK_MAX_SIZE]; - float max_exponent[MAX_CHANNELS]; - WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE]; - DECLARE_ALIGNED(32, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE]; - DECLARE_ALIGNED(32, FFTSample, output)[BLOCK_MAX_SIZE * 2]; - FFTContext mdct_ctx[BLOCK_NB_SIZES]; - float *windows[BLOCK_NB_SIZES]; - /* output buffer for one frame and the last for IMDCT windowing */ - DECLARE_ALIGNED(32, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2]; - /* last frame info */ - uint8_t last_superframe[MAX_CODED_SUPERFRAME_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; /* padding added */ - int last_bitoffset; - int last_superframe_len; - float noise_table[NOISE_TAB_SIZE]; - int noise_index; - float noise_mult; /* XXX: suppress that and integrate it in the noise array */ - /* lsp_to_curve tables */ - float lsp_cos_table[BLOCK_MAX_SIZE]; - float lsp_pow_e_table[256]; - float lsp_pow_m_table1[(1 << LSP_POW_BITS)]; - float lsp_pow_m_table2[(1 << LSP_POW_BITS)]; - FmtConvertContext fmt_conv; - AVFloatDSPContext fdsp; - -#ifdef TRACE - int frame_count; -#endif -} WMACodecContext; - -extern const uint16_t ff_wma_critical_freqs[25]; -extern const uint16_t ff_wma_hgain_huffcodes[37]; -extern const uint8_t ff_wma_hgain_huffbits[37]; -extern const float ff_wma_lsp_codebook[NB_LSP_COEFS][16]; -extern const uint32_t ff_aac_scalefactor_code[121]; -extern const uint8_t ff_aac_scalefactor_bits[121]; - -int ff_wma_init(AVCodecContext * avctx, int flags2); -int ff_wma_total_gain_to_bits(int total_gain); -int ff_wma_end(AVCodecContext *avctx); -unsigned int ff_wma_get_large_val(GetBitContext* gb); -int ff_wma_run_level_decode(AVCodecContext* avctx, GetBitContext* gb, - VLC *vlc, - const float *level_table, const uint16_t *run_table, - int version, WMACoef *ptr, int offset, - int num_coefs, int block_len, int frame_len_bits, - int coef_nb_bits); - -#endif /* AVCODEC_WMA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.c deleted file mode 100644 index 51467b203..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * common code shared by all WMA variants - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "wma_common.h" - -/** - *@brief Get the samples per frame for this stream. - *@param sample_rate output sample_rate - *@param version wma version - *@param decode_flags codec compression features - *@return log2 of the number of output samples per frame - */ -av_cold int ff_wma_get_frame_len_bits(int sample_rate, int version, - unsigned int decode_flags) -{ - - int frame_len_bits; - - if (sample_rate <= 16000) { - frame_len_bits = 9; - } else if (sample_rate <= 22050 || - (sample_rate <= 32000 && version == 1)) { - frame_len_bits = 10; - } else if (sample_rate <= 48000 || version < 3) { - frame_len_bits = 11; - } else if (sample_rate <= 96000) { - frame_len_bits = 12; - } else { - frame_len_bits = 13; - } - - if (version == 3) { - int tmp = decode_flags & 0x6; - if (tmp == 0x2) { - ++frame_len_bits; - } else if (tmp == 0x4) { - --frame_len_bits; - } else if (tmp == 0x6) { - frame_len_bits -= 2; - } - } - - return frame_len_bits; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.h deleted file mode 100644 index 55404afc4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wma_common.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * common code shared by all WMA variants - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_WMA_COMMON_H -#define AVCODEC_WMA_COMMON_H - -int ff_wma_get_frame_len_bits(int sample_rate, int version, - unsigned int decode_flags); - -#endif /* AVCODEC_WMA_COMMON_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadata.h deleted file mode 100644 index 381f182fa..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadata.h +++ /dev/null @@ -1,1403 +0,0 @@ -/* - * WMA compatible decoder - * copyright (c) 2002 The FFmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Various WMA tables. - */ - -#ifndef AVCODEC_WMADATA_H -#define AVCODEC_WMADATA_H - -#include -#include "wma.h" - -const uint16_t ff_wma_critical_freqs[25] = { - 100, 200, 300, 400, 510, 630, 770, 920, - 1080, 1270, 1480, 1720, 2000, 2320, 2700, 3150, - 3700, 4400, 5300, 6400, 7700, 9500, 12000, 15500, - 24500, -}; - -/* first value is number of bands */ -static const uint8_t exponent_band_22050[3][25] = { - { 10, 4, 8, 4, 8, 8, 12, 20, 24, 24, 16, }, - { 14, 4, 8, 8, 4, 12, 12, 16, 24, 16, 20, 24, 32, 40, 36, }, - { 23, 4, 4, 4, 8, 4, 4, 8, 8, 8, 8, 8, 12, 12, 16, 16, 24, 24, 32, 44, 48, 60, 84, 72, }, -}; - -static const uint8_t exponent_band_32000[3][25] = { - { 11, 4, 4, 8, 4, 4, 12, 16, 24, 20, 28, 4, }, - { 15, 4, 8, 4, 4, 8, 8, 16, 20, 12, 20, 20, 28, 40, 56, 8, }, - { 16, 8, 4, 8, 8, 12, 16, 20, 24, 40, 32, 32, 44, 56, 80, 112, 16, }, -}; - -static const uint8_t exponent_band_44100[3][25] = { - { 12, 4, 4, 4, 4, 4, 8, 8, 8, 12, 16, 20, 36, }, - { 15, 4, 8, 4, 8, 8, 4, 8, 8, 12, 12, 12, 24, 28, 40, 76, }, - { 17, 4, 8, 8, 4, 12, 12, 8, 8, 24, 16, 20, 24, 32, 40, 60, 80, 152, }, -}; - -const uint16_t ff_wma_hgain_huffcodes[37] = { - 0x00003, 0x002e7, 0x00001, 0x005cd, 0x0005d, 0x005c9, 0x0005e, 0x00003, - 0x00016, 0x0000b, 0x00001, 0x00006, 0x00001, 0x00006, 0x00004, 0x00005, - 0x00004, 0x00007, 0x00003, 0x00007, 0x00004, 0x0000a, 0x0000a, 0x00002, - 0x00003, 0x00000, 0x00005, 0x00002, 0x0005f, 0x00004, 0x00003, 0x00002, - 0x005c8, 0x000b8, 0x005ca, 0x005cb, 0x005cc, -}; - -const uint8_t ff_wma_hgain_huffbits[37] = { - 10, 12, 10, 13, 9, 13, 9, 8, - 7, 5, 5, 4, 4, 3, 3, 3, - 4, 3, 4, 4, 5, 5, 6, 8, - 7, 10, 8, 10, 9, 8, 9, 9, - 13, 10, 13, 13, 13, -}; - -const float ff_wma_lsp_codebook[NB_LSP_COEFS][16] = { - { 1.98732877, 1.97944528, 1.97179088, 1.96260549, 1.95038374, 1.93336114, 1.90719232, 1.86191415, }, - { 1.97260000, 1.96083160, 1.94982586, 1.93806164, 1.92516608, 1.91010199, 1.89232331, 1.87149812, - 1.84564818, 1.81358067, 1.77620070, 1.73265264, 1.67907855, 1.60959081, 1.50829650, 1.33120330, }, - { 1.90109110, 1.86482426, 1.83419671, 1.80168452, 1.76650116, 1.72816320, 1.68502700, 1.63738256, - 1.58501580, 1.51795181, 1.43679906, 1.33950585, 1.24176208, 1.12260729, 0.96749668, 0.74048265, }, - { 1.76943864, 1.67822463, 1.59946365, 1.53560582, 1.47470796, 1.41210167, 1.34509536, 1.27339507, - 1.19303814, 1.09765169, 0.98818722, 0.87239446, 0.74369172, 0.59768184, 0.43168630, 0.17977021, }, - { 1.43428349, 1.32038354, 1.21074086, 1.10577988, 1.00561746, 0.90335924, 0.80437489, 0.70709671, - 0.60427395, 0.49814048, 0.38509539, 0.27106800, 0.14407416, 0.00219910, -0.16725141, -0.36936085, }, - { 0.99895687, 0.84188166, 0.70753739, 0.57906595, 0.47055563, 0.36966965, 0.26826648, 0.17163380, - 0.07208392, -0.03062936, -1.40037388, -0.25128968, -0.37213937, -0.51075646, -0.64887512, -0.80308031, }, - { 0.26515280, 0.06313551, -0.08872080, -0.21103548, -0.31069678, -0.39680323, -0.47223474, -0.54167135, - -0.61444740, -0.68943343, -0.76580211, -0.85170082, -0.95289061, -1.06514703, -1.20510707, -1.37617746, }, - { -0.53940301, -0.73770929, -0.88424876, -1.01117930, -1.13389091, -1.26830073, -1.42041987, -1.62033919, - -1.10158808, -1.16512566, -1.23337128, -1.30414401, -1.37663312, -1.46853845, -1.57625798, -1.66893638, }, - { -0.38601997, -0.56009350, -0.66978483, -0.76028471, -0.83846064, -0.90868087, -0.97408881, -1.03694962, }, - { -1.56144989, -1.65944032, -1.72689685, -1.77857740, -1.82203011, -1.86220079, -1.90283983, -1.94820479, }, -}; - -static const uint32_t coef0_huffcodes[666] = { - 0x00258, 0x0003d, 0x00000, 0x00005, 0x00008, 0x00008, 0x0000c, 0x0001b, - 0x0001f, 0x00015, 0x00024, 0x00032, 0x0003a, 0x00026, 0x0002c, 0x0002f, - 0x0004a, 0x0004d, 0x00061, 0x00070, 0x00073, 0x00048, 0x00052, 0x0005a, - 0x0005d, 0x0006e, 0x00099, 0x0009e, 0x000c1, 0x000ce, 0x000e4, 0x000f0, - 0x00093, 0x0009e, 0x000a2, 0x000a1, 0x000b8, 0x000d2, 0x000d3, 0x0012e, - 0x00130, 0x000de, 0x0012d, 0x0019b, 0x001e4, 0x00139, 0x0013a, 0x0013f, - 0x0014f, 0x0016d, 0x001a2, 0x0027c, 0x0027e, 0x00332, 0x0033c, 0x0033f, - 0x0038b, 0x00396, 0x003c5, 0x00270, 0x0027c, 0x0025a, 0x00395, 0x00248, - 0x004bd, 0x004fb, 0x00662, 0x00661, 0x0071b, 0x004e6, 0x004ff, 0x00666, - 0x0071c, 0x0071a, 0x0071f, 0x00794, 0x00536, 0x004e2, 0x0078e, 0x004ee, - 0x00518, 0x00535, 0x004fb, 0x0078d, 0x00530, 0x00680, 0x0068f, 0x005cb, - 0x00965, 0x006a6, 0x00967, 0x0097f, 0x00682, 0x006ae, 0x00cd0, 0x00e28, - 0x00f13, 0x00f1f, 0x009f5, 0x00cd3, 0x00f11, 0x00926, 0x00964, 0x00f32, - 0x00f12, 0x00f30, 0x00966, 0x00d0b, 0x00a68, 0x00b91, 0x009c7, 0x00b73, - 0x012fa, 0x0131d, 0x013f9, 0x01ca0, 0x0199c, 0x01c7a, 0x0198c, 0x01248, - 0x01c74, 0x01c64, 0x0139e, 0x012fd, 0x00a77, 0x012fc, 0x01c7b, 0x012ca, - 0x014cc, 0x014d2, 0x014e3, 0x014dc, 0x012dc, 0x03344, 0x02598, 0x0263c, - 0x0333b, 0x025e6, 0x01a1c, 0x01e3c, 0x014e2, 0x033d4, 0x01a11, 0x03349, - 0x03cce, 0x014e1, 0x01a34, 0x0273e, 0x02627, 0x0273f, 0x038ee, 0x03971, - 0x03c67, 0x03c61, 0x0333d, 0x038c2, 0x0263f, 0x038cd, 0x02638, 0x02e41, - 0x0351f, 0x03348, 0x03c66, 0x03562, 0x02989, 0x027d5, 0x0333c, 0x02e4f, - 0x0343b, 0x02ddf, 0x04bc8, 0x029c0, 0x02e57, 0x04c72, 0x025b7, 0x03547, - 0x03540, 0x029d3, 0x04c45, 0x025bb, 0x06600, 0x04c73, 0x04bce, 0x0357b, - 0x029a6, 0x029d2, 0x0263e, 0x0298a, 0x07183, 0x06602, 0x07958, 0x04b66, - 0x0537d, 0x05375, 0x04fe9, 0x04b67, 0x0799f, 0x04bc9, 0x051fe, 0x06a3b, - 0x05bb6, 0x04fa8, 0x0728f, 0x05376, 0x0492c, 0x0537e, 0x0795a, 0x06a3c, - 0x0e515, 0x07887, 0x0683a, 0x051f9, 0x051fd, 0x0cc6a, 0x06a8a, 0x0cc6d, - 0x05bb3, 0x0683b, 0x051fc, 0x05378, 0x0728e, 0x07886, 0x05bb7, 0x0f2a4, - 0x0795b, 0x0683c, 0x09fc1, 0x0683d, 0x0b752, 0x09678, 0x0a3e8, 0x06ac7, - 0x051f0, 0x0b759, 0x06af3, 0x04b6b, 0x0f2a0, 0x0f2ad, 0x096c3, 0x0e518, - 0x0b75c, 0x0d458, 0x0cc6b, 0x0537c, 0x067aa, 0x04fea, 0x0343a, 0x0cc71, - 0x0967f, 0x09fc4, 0x096c2, 0x0e516, 0x0f2a1, 0x0d45c, 0x0d45d, 0x0d45e, - 0x12fb9, 0x0967e, 0x1982f, 0x09883, 0x096c4, 0x0b753, 0x12fb8, 0x0f2a8, - 0x1ca21, 0x096c5, 0x0e51a, 0x1ca27, 0x12f3c, 0x0d471, 0x0f2aa, 0x0b75b, - 0x12fbb, 0x0f2a9, 0x0f2ac, 0x0d45a, 0x0b74f, 0x096c8, 0x16e91, 0x096ca, - 0x12fbf, 0x0d0a7, 0x13103, 0x0d516, 0x16e99, 0x12cbd, 0x0a3ea, 0x19829, - 0x0b755, 0x29ba7, 0x1ca28, 0x29ba5, 0x16e93, 0x1982c, 0x19828, 0x25994, - 0x0a3eb, 0x1ca29, 0x16e90, 0x1ca25, 0x1982d, 0x1ca26, 0x16e9b, 0x0b756, - 0x0967c, 0x25997, 0x0b75f, 0x198d3, 0x0b757, 0x19a2a, 0x0d45b, 0x0e517, - 0x1ca24, 0x1ca23, 0x1ca22, 0x0b758, 0x16e97, 0x0cd14, 0x13100, 0x00007, - 0x0003b, 0x0006b, 0x00097, 0x00138, 0x00125, 0x00173, 0x00258, 0x00335, - 0x0028e, 0x004c6, 0x00715, 0x00729, 0x004ef, 0x00519, 0x004ed, 0x00532, - 0x0068c, 0x00686, 0x00978, 0x00e5d, 0x00e31, 0x009f4, 0x00b92, 0x012f8, - 0x00d06, 0x00a67, 0x00d44, 0x00a76, 0x00d59, 0x012cd, 0x01c78, 0x01c75, - 0x0199f, 0x0198f, 0x01c67, 0x014c6, 0x01c79, 0x01c76, 0x00b94, 0x00d1b, - 0x01e32, 0x01e31, 0x01ab0, 0x01a05, 0x01aa1, 0x0333a, 0x025e5, 0x02626, - 0x03541, 0x03544, 0x03421, 0x03546, 0x02e55, 0x02e56, 0x0492d, 0x02dde, - 0x0299b, 0x02ddc, 0x0357a, 0x0249c, 0x0668b, 0x1c77f, 0x1ca20, 0x0d45f, - 0x09886, 0x16e9a, 0x0f2a7, 0x0b751, 0x0a3ee, 0x0cf59, 0x0cf57, 0x0b754, - 0x0d0a6, 0x16e98, 0x0b760, 0x06ac6, 0x0a3f0, 0x12fbe, 0x13104, 0x0f2a5, - 0x0a3ef, 0x0d472, 0x12cba, 0x1982e, 0x16e9c, 0x1c77e, 0x198d0, 0x13105, - 0x16e92, 0x0b75d, 0x0d459, 0x0001a, 0x000c0, 0x0016c, 0x003cd, 0x00350, - 0x0067b, 0x0051e, 0x006a9, 0x009f4, 0x00b72, 0x00d09, 0x01249, 0x01e3d, - 0x01ca1, 0x01a1f, 0x01721, 0x01a8a, 0x016e8, 0x03347, 0x01a35, 0x0249d, - 0x0299a, 0x02596, 0x02e4e, 0x0298b, 0x07182, 0x04c46, 0x025ba, 0x02e40, - 0x027d6, 0x04fe8, 0x06607, 0x05310, 0x09884, 0x072e1, 0x06a3d, 0x04b6a, - 0x04c7a, 0x06603, 0x04c7b, 0x03428, 0x06605, 0x09664, 0x09fc0, 0x071de, - 0x06601, 0x05bb2, 0x09885, 0x0a3e2, 0x1c61f, 0x12cbb, 0x0b750, 0x0cf58, - 0x0967d, 0x25995, 0x668ad, 0x0b75a, 0x09fc2, 0x0537f, 0x0b75e, 0x13fae, - 0x12fbc, 0x00031, 0x001c4, 0x004c5, 0x005b8, 0x00cf4, 0x0096f, 0x00d46, - 0x01e57, 0x01a04, 0x02625, 0x03346, 0x028f9, 0x04c47, 0x072e0, 0x04b69, - 0x03420, 0x07957, 0x06639, 0x0799e, 0x07959, 0x07881, 0x04b68, 0x09fc3, - 0x09fd6, 0x0cc70, 0x0a3f1, 0x12cbe, 0x0e30e, 0x0e51b, 0x06af2, 0x12cbc, - 0x1c77d, 0x0f2ab, 0x12fbd, 0x1aa2f, 0x0a3ec, 0x0d473, 0x05377, 0x0a3e9, - 0x1982b, 0x0e300, 0x12f3f, 0x0cf5f, 0x096c0, 0x38c3c, 0x16e94, 0x16e95, - 0x12f3d, 0x29ba4, 0x29ba6, 0x1c77c, 0x6a8ba, 0x3545c, 0x33457, 0x668ac, - 0x6a8bb, 0x16e9d, 0x0e519, 0x25996, 0x12f3e, 0x00036, 0x0033e, 0x006ad, - 0x00d03, 0x012c8, 0x0124a, 0x03c42, 0x03ccd, 0x06606, 0x07880, 0x06852, - 0x06a3a, 0x05bb4, 0x0f2a2, 0x09fc7, 0x12cb9, 0x0cc6c, 0x0a6e8, 0x096c1, - 0x0004a, 0x00355, 0x012f9, 0x014e8, 0x01abe, 0x025b6, 0x0492e, 0x09fc6, - 0x051ff, 0x0cc6f, 0x096cb, 0x0d071, 0x198d1, 0x12cb8, 0x38c3d, 0x13faf, - 0x096c9, 0x0009d, 0x00539, 0x012ce, 0x0341f, 0x029c1, 0x04b33, 0x0a3e3, - 0x0d070, 0x16e96, 0x0b763, 0x000a0, 0x009ce, 0x038cc, 0x0343d, 0x051fa, - 0x09888, 0x12fba, 0x000df, 0x00a75, 0x029a7, 0x09fc5, 0x0e301, 0x0967b, - 0x001e7, 0x012c9, 0x051fb, 0x09889, 0x0f2a6, 0x0016f, 0x01cb9, 0x0cf5a, - 0x12cbf, 0x09679, 0x00272, 0x01a15, 0x0967a, 0x003cb, 0x025f6, 0x0b762, - 0x0028d, 0x03c60, 0x0cf5e, 0x00352, 0x03ccc, 0x0072f, 0x07186, 0x004ec, - 0x05379, 0x0068e, 0x09887, 0x006a7, 0x06af1, 0x00e29, 0x0cf5b, 0x00f31, - 0x0d470, 0x009c6, 0x013fb, 0x13102, 0x019a5, 0x13101, 0x01983, 0x01c65, - 0x0124f, 0x014c7, 0x01726, 0x01abf, 0x03304, 0x02624, 0x03c41, 0x027d7, - 0x02ddd, 0x02e54, 0x0343c, 0x06604, 0x07181, 0x0663a, 0x04fa9, 0x0663b, - 0x05311, 0x0537a, 0x06839, 0x05bb5, 0x0492f, 0x06af0, 0x096c7, 0x0cc6e, - 0x0537b, 0x0cf5c, 0x0cf56, 0x198d2, 0x0cf5d, 0x0a3ed, 0x0f2a3, 0x1982a, - 0x0b761, 0x096c6, -}; - -static const uint8_t coef0_huffbits[666] = { - 11, 6, 2, 3, 4, 5, 5, 5, - 5, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 7, 7, 7, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 9, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 11, 11, 11, 10, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 12, 12, 11, 12, - 12, 12, 12, 11, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 13, 13, 12, - 12, 12, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 14, - 13, 13, 13, 13, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 13, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 15, - 15, 14, 14, 15, 15, 15, 14, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 14, 15, 15, 15, 15, 16, - 16, 16, 15, 16, 15, 15, 16, 16, - 16, 16, 15, 16, 16, 16, 15, 16, - 16, 15, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 15, 15, 16, 16, - 15, 16, 16, 16, 17, 17, 17, 16, - 16, 17, 16, 16, 16, 16, 17, 16, - 17, 17, 16, 16, 15, 15, 15, 16, - 17, 16, 17, 16, 16, 17, 17, 17, - 17, 17, 17, 16, 17, 17, 17, 16, - 17, 17, 16, 17, 17, 17, 16, 17, - 17, 16, 16, 17, 17, 17, 18, 17, - 17, 17, 17, 17, 18, 18, 17, 17, - 17, 19, 17, 19, 18, 17, 17, 18, - 17, 17, 18, 17, 17, 17, 18, 17, - 17, 18, 17, 17, 17, 17, 17, 16, - 17, 17, 17, 17, 18, 16, 17, 4, - 6, 8, 9, 9, 10, 10, 10, 10, - 11, 11, 11, 11, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 14, 13, 13, 13, 13, - 13, 13, 14, 14, 14, 14, 14, 14, - 15, 15, 15, 15, 15, 15, 16, 15, - 15, 15, 15, 15, 15, 17, 17, 17, - 16, 18, 16, 17, 17, 16, 16, 17, - 17, 18, 17, 16, 17, 17, 17, 16, - 17, 17, 18, 17, 18, 17, 17, 17, - 18, 17, 17, 5, 8, 10, 10, 11, - 11, 12, 12, 12, 13, 13, 14, 13, - 13, 14, 14, 14, 14, 14, 14, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 16, 16, 15, 16, 16, - 15, 15, 15, 15, 15, 16, 16, 15, - 15, 16, 16, 17, 17, 18, 17, 16, - 17, 18, 19, 17, 16, 16, 17, 17, - 17, 6, 9, 11, 12, 12, 13, 13, - 13, 14, 14, 14, 15, 15, 15, 16, - 15, 15, 15, 15, 15, 15, 16, 16, - 16, 16, 17, 18, 16, 16, 16, 18, - 17, 16, 17, 18, 17, 17, 16, 17, - 17, 16, 17, 16, 17, 18, 18, 18, - 17, 19, 19, 17, 20, 19, 18, 19, - 20, 18, 16, 18, 17, 7, 10, 12, - 13, 13, 14, 14, 14, 15, 15, 16, - 16, 16, 16, 16, 18, 16, 17, 17, - 8, 11, 13, 14, 14, 15, 16, 16, - 16, 16, 17, 17, 17, 18, 18, 17, - 17, 8, 12, 14, 15, 15, 15, 17, - 17, 18, 17, 9, 12, 14, 15, 16, - 16, 17, 9, 13, 15, 16, 16, 17, - 9, 13, 16, 16, 16, 10, 13, 16, - 18, 17, 10, 14, 17, 10, 14, 17, - 11, 14, 16, 11, 14, 11, 15, 12, - 16, 12, 16, 12, 16, 12, 16, 12, - 17, 13, 13, 17, 13, 17, 13, 13, - 14, 14, 14, 14, 14, 14, 14, 15, - 15, 15, 15, 15, 15, 15, 16, 15, - 16, 16, 16, 16, 16, 16, 17, 16, - 16, 16, 16, 17, 16, 17, 16, 17, - 17, 17, -}; - -static const uint32_t coef1_huffcodes[555] = { - 0x00115, 0x00002, 0x00001, 0x00000, 0x0000d, 0x00007, 0x00013, 0x0001d, - 0x00008, 0x0000c, 0x00023, 0x0002b, 0x0003f, 0x00017, 0x0001b, 0x00043, - 0x00049, 0x00050, 0x00055, 0x00054, 0x00067, 0x00064, 0x0007b, 0x0002d, - 0x00028, 0x0002a, 0x00085, 0x00089, 0x0002b, 0x00035, 0x00090, 0x00091, - 0x00094, 0x00088, 0x000c1, 0x000c6, 0x000f2, 0x000e3, 0x000c5, 0x000e2, - 0x00036, 0x000f0, 0x000a7, 0x000cd, 0x000fb, 0x00059, 0x00116, 0x00103, - 0x00108, 0x0012b, 0x0012d, 0x00188, 0x0012e, 0x0014c, 0x001c3, 0x00187, - 0x001e7, 0x0006f, 0x00094, 0x00069, 0x001e6, 0x001ca, 0x00147, 0x00195, - 0x000a7, 0x00213, 0x00209, 0x00303, 0x00295, 0x00289, 0x0028c, 0x0028d, - 0x00312, 0x00330, 0x0029b, 0x00308, 0x00328, 0x0029a, 0x0025e, 0x003c5, - 0x00384, 0x0039f, 0x00397, 0x00296, 0x0032e, 0x00332, 0x003c6, 0x003e6, - 0x0012d, 0x000d1, 0x00402, 0x000dd, 0x00161, 0x0012b, 0x00127, 0x0045d, - 0x00601, 0x004ab, 0x0045f, 0x00410, 0x004bf, 0x00528, 0x0045c, 0x00424, - 0x00400, 0x00511, 0x00618, 0x0073d, 0x0063a, 0x00614, 0x0073c, 0x007c0, - 0x007cf, 0x00802, 0x00966, 0x00964, 0x00951, 0x008a0, 0x00346, 0x00803, - 0x00a52, 0x0024a, 0x007c1, 0x0063f, 0x00126, 0x00406, 0x00789, 0x008a2, - 0x00960, 0x00967, 0x00c05, 0x00c70, 0x00c79, 0x00a5d, 0x00c26, 0x00c4d, - 0x00372, 0x008a5, 0x00c08, 0x002c5, 0x00f11, 0x00cc4, 0x00f8e, 0x00e16, - 0x00496, 0x00e77, 0x00f9c, 0x00c25, 0x00f1e, 0x00c27, 0x00f1f, 0x00e17, - 0x00ccd, 0x00355, 0x00c09, 0x00c78, 0x00f90, 0x00521, 0x00357, 0x00356, - 0x0068e, 0x00f9d, 0x00c04, 0x00e58, 0x00a20, 0x00a2c, 0x00c4c, 0x0052f, - 0x00f8d, 0x01178, 0x01053, 0x01097, 0x0180f, 0x0180d, 0x012fb, 0x012aa, - 0x0202a, 0x00a40, 0x018ed, 0x01ceb, 0x01455, 0x018e3, 0x012a1, 0x00354, - 0x00353, 0x00f1c, 0x00c7b, 0x00c37, 0x0101d, 0x012cb, 0x01142, 0x0197d, - 0x01095, 0x01e3b, 0x0186b, 0x00588, 0x01c2a, 0x014b8, 0x01e3a, 0x018ec, - 0x01f46, 0x012fa, 0x00a53, 0x01ce8, 0x00a55, 0x01c29, 0x0117b, 0x01052, - 0x012a0, 0x00589, 0x00950, 0x01c2b, 0x00a50, 0x0208b, 0x0180e, 0x02027, - 0x02556, 0x01e20, 0x006e7, 0x01c28, 0x0197a, 0x00684, 0x020a2, 0x01f22, - 0x03018, 0x039cf, 0x03e25, 0x02557, 0x0294c, 0x028a6, 0x00d11, 0x028a9, - 0x02979, 0x00d46, 0x00a56, 0x039ce, 0x030cc, 0x0329a, 0x0149d, 0x0510f, - 0x0451c, 0x02028, 0x03299, 0x01ced, 0x014b9, 0x00f85, 0x00c7a, 0x01800, - 0x00341, 0x012ca, 0x039c8, 0x0329d, 0x00d0d, 0x03e20, 0x05144, 0x00d45, - 0x030d0, 0x0186d, 0x030d5, 0x00d0f, 0x00d40, 0x04114, 0x020a1, 0x0297f, - 0x03e24, 0x032f1, 0x04047, 0x030d4, 0x028a8, 0x00d0e, 0x0451d, 0x04044, - 0x0297e, 0x04042, 0x030d2, 0x030cf, 0x03e21, 0x03e26, 0x028a5, 0x0451a, - 0x00d48, 0x01a16, 0x00d44, 0x04518, 0x0149b, 0x039ca, 0x01498, 0x0403d, - 0x0451b, 0x0149c, 0x032f3, 0x030cb, 0x08073, 0x03e22, 0x0529a, 0x020aa, - 0x039cc, 0x0738a, 0x06530, 0x07389, 0x06193, 0x08071, 0x04043, 0x030ce, - 0x05147, 0x07388, 0x05145, 0x08072, 0x04521, 0x00d47, 0x0297c, 0x030cd, - 0x030ca, 0x0000b, 0x0000c, 0x00083, 0x000e4, 0x00048, 0x00102, 0x001cc, - 0x001f5, 0x00097, 0x0020b, 0x00124, 0x00453, 0x00627, 0x00639, 0x00605, - 0x00517, 0x001b8, 0x00663, 0x00667, 0x007c3, 0x00823, 0x00961, 0x00963, - 0x00e5a, 0x00e59, 0x00a2b, 0x00cbf, 0x00292, 0x00a2d, 0x007d0, 0x00953, - 0x00cc5, 0x00f84, 0x004ab, 0x014a7, 0x0068a, 0x0117a, 0x0052e, 0x01442, - 0x0052c, 0x00c77, 0x00f8f, 0x004aa, 0x01094, 0x01801, 0x012c4, 0x0297b, - 0x00952, 0x01f19, 0x006a5, 0x01149, 0x012c5, 0x01803, 0x022f2, 0x0329b, - 0x04520, 0x0149e, 0x00d13, 0x01f16, 0x01ce9, 0x0101c, 0x006e6, 0x039c9, - 0x06191, 0x07c8e, 0x06192, 0x0ca63, 0x039cd, 0x06190, 0x06884, 0x06885, - 0x07382, 0x00d49, 0x00d41, 0x0450c, 0x0149a, 0x030d1, 0x08077, 0x03e23, - 0x01a15, 0x0e701, 0x0e702, 0x08079, 0x0822a, 0x0a218, 0x07887, 0x0403f, - 0x0520b, 0x0529b, 0x0e700, 0x04519, 0x00007, 0x000e0, 0x000d0, 0x0039b, - 0x003e5, 0x00163, 0x0063e, 0x007c9, 0x00806, 0x00954, 0x01044, 0x01f44, - 0x0197c, 0x01f45, 0x00a51, 0x01f47, 0x00951, 0x0052d, 0x02291, 0x0092f, - 0x00a54, 0x00d12, 0x0297d, 0x00d0c, 0x01499, 0x0329e, 0x032f0, 0x02025, - 0x039c6, 0x00a57, 0x03e46, 0x00d42, 0x0738b, 0x05146, 0x04046, 0x08078, - 0x0510e, 0x07886, 0x02904, 0x04156, 0x04157, 0x06032, 0x030d3, 0x08bce, - 0x04040, 0x0403e, 0x0a414, 0x10457, 0x08075, 0x06887, 0x07c8f, 0x039c7, - 0x07387, 0x08070, 0x08bcf, 0x1482a, 0x10456, 0x1482b, 0x01a17, 0x06886, - 0x0450d, 0x00013, 0x0006b, 0x00615, 0x0080b, 0x0082b, 0x00952, 0x00e5b, - 0x018e2, 0x0186c, 0x01f18, 0x0329f, 0x00d43, 0x03e29, 0x05140, 0x05141, - 0x0ca62, 0x06033, 0x03c42, 0x03e28, 0x0450f, 0x0a21a, 0x07384, 0x0a219, - 0x0e703, 0x0a21b, 0x01a14, 0x07383, 0x045e6, 0x0007a, 0x0012c, 0x00ccc, - 0x0068f, 0x01802, 0x00a52, 0x00953, 0x04045, 0x01a20, 0x0451f, 0x000a4, - 0x00735, 0x01cec, 0x02029, 0x020a3, 0x0451e, 0x00069, 0x00c24, 0x02024, - 0x032f2, 0x05142, 0x00196, 0x00523, 0x000a6, 0x0197b, 0x0030b, 0x0092e, - 0x003e9, 0x03e27, 0x00160, 0x05143, 0x00652, 0x04041, 0x00734, 0x028a7, - 0x0080f, 0x01483, 0x0097c, 0x00340, 0x0068b, 0x00522, 0x01054, 0x01096, - 0x01f17, 0x0202b, 0x01cea, 0x020a0, 0x02978, 0x02026, 0x0297a, 0x039cb, - 0x03e2b, 0x0149f, 0x0329c, 0x07385, 0x08074, 0x0450e, 0x03e2a, 0x05149, - 0x08076, 0x07386, 0x05148, -}; - -static const uint8_t coef1_huffbits[555] = { - 9, 5, 2, 4, 4, 5, 5, 5, - 6, 6, 6, 6, 6, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, - 9, 8, 8, 8, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 11, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 13, 12, 12, 12, 12, 12, 12, 12, - 13, 12, 12, 12, 12, 12, 12, 12, - 12, 13, 12, 12, 12, 13, 13, 13, - 13, 12, 12, 12, 12, 12, 12, 13, - 12, 13, 13, 13, 13, 13, 13, 13, - 14, 14, 13, 13, 13, 13, 13, 13, - 13, 12, 12, 12, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 14, 13, 14, 13, 13, 13, - 13, 13, 14, 13, 14, 14, 13, 14, - 14, 13, 14, 13, 13, 14, 14, 13, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 15, 14, 14, 14, 14, 15, 15, - 15, 14, 14, 13, 13, 12, 12, 13, - 13, 13, 14, 14, 15, 14, 15, 15, - 14, 13, 14, 15, 15, 15, 14, 14, - 14, 14, 15, 14, 14, 15, 15, 15, - 14, 15, 14, 14, 14, 14, 14, 15, - 15, 16, 15, 15, 15, 14, 15, 15, - 15, 15, 14, 14, 16, 14, 15, 14, - 14, 15, 15, 15, 15, 16, 15, 14, - 15, 15, 15, 16, 15, 15, 14, 14, - 14, 4, 7, 8, 8, 9, 9, 9, - 9, 10, 10, 11, 11, 11, 11, 11, - 11, 12, 11, 11, 11, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 11, 12, - 12, 12, 13, 13, 13, 13, 13, 13, - 13, 12, 12, 13, 13, 13, 13, 14, - 14, 13, 14, 13, 13, 13, 14, 14, - 15, 15, 14, 13, 13, 13, 14, 14, - 15, 15, 15, 16, 14, 15, 17, 17, - 15, 15, 15, 15, 15, 14, 16, 14, - 16, 16, 16, 16, 16, 16, 15, 15, - 17, 15, 16, 15, 6, 8, 10, 10, - 10, 11, 11, 11, 12, 12, 13, 13, - 13, 13, 14, 13, 14, 13, 14, 14, - 14, 14, 14, 15, 15, 14, 14, 14, - 14, 14, 14, 15, 15, 15, 15, 16, - 15, 15, 16, 15, 15, 15, 14, 16, - 15, 15, 18, 17, 16, 17, 15, 14, - 15, 16, 16, 19, 17, 19, 16, 17, - 15, 7, 10, 11, 12, 12, 12, 12, - 13, 13, 13, 14, 15, 14, 15, 15, - 16, 15, 14, 14, 15, 16, 15, 16, - 16, 16, 16, 15, 15, 7, 11, 12, - 13, 13, 14, 14, 15, 15, 15, 8, - 11, 13, 14, 14, 15, 9, 12, 14, - 14, 15, 9, 13, 10, 13, 10, 14, - 10, 14, 11, 15, 11, 15, 11, 14, - 12, 15, 12, 13, 13, 13, 13, 13, - 13, 14, 13, 14, 14, 14, 14, 14, - 14, 15, 14, 15, 16, 15, 14, 15, - 16, 15, 15, -}; - -static const uint32_t coef2_huffcodes[1336] = { - 0x003e6, 0x000f6, 0x00000, 0x00002, 0x00006, 0x0000f, 0x0001b, 0x00028, - 0x00039, 0x0003f, 0x0006b, 0x00076, 0x000b7, 0x000e8, 0x000ef, 0x00169, - 0x001a7, 0x001d4, 0x001dc, 0x002c4, 0x00349, 0x00355, 0x00391, 0x003dc, - 0x00581, 0x005b2, 0x00698, 0x0070c, 0x00755, 0x0073a, 0x00774, 0x007cf, - 0x00b0a, 0x00b66, 0x00d2e, 0x00d5e, 0x00e1b, 0x00eac, 0x00e5a, 0x00f7e, - 0x00fa1, 0x0163e, 0x01a37, 0x01a52, 0x01c39, 0x01ab3, 0x01d5f, 0x01cb6, - 0x01f52, 0x01dd9, 0x02c04, 0x02c2e, 0x02c2d, 0x02c23, 0x03467, 0x034a3, - 0x0351b, 0x03501, 0x03a5d, 0x0351c, 0x03875, 0x03dea, 0x0397b, 0x039db, - 0x03df1, 0x039d8, 0x03bb4, 0x0580a, 0x0584d, 0x05842, 0x05b13, 0x058ea, - 0x0697d, 0x06a06, 0x068cc, 0x06ac7, 0x06a96, 0x072f4, 0x07543, 0x072b4, - 0x07d20, 0x0b003, 0x073b5, 0x07be6, 0x0d180, 0x07bd1, 0x07cb8, 0x07d06, - 0x07d25, 0x0d2f2, 0x0d19a, 0x0d334, 0x0e1dc, 0x0d529, 0x0d584, 0x0e1d2, - 0x0e5e3, 0x0eec4, 0x0e564, 0x0fa49, 0x16001, 0x0eedc, 0x0f7fa, 0x1a32c, - 0x16131, 0x16003, 0x0f9c8, 0x1ef80, 0x1d2a0, 0x1aa4b, 0x0f7ce, 0x1abfe, - 0x1aa50, 0x1a458, 0x1a816, 0x1cae4, 0x1d2fe, 0x1d52e, 0x1aa4c, 0x2c245, - 0x1d2a1, 0x1a35d, 0x1ca1b, 0x1d5d8, 0x1f531, 0x1ca1c, 0x1f389, 0x1f4af, - 0x3a5e7, 0x351fb, 0x2c24b, 0x34bce, 0x2c24d, 0x2c249, 0x2c24a, 0x72dfc, - 0x357ef, 0x35002, 0x3a5e6, 0x39431, 0x5843b, 0x34a77, 0x58431, 0x3a5f3, - 0x3a5dd, 0x3e5e5, 0x356bd, 0x3976e, 0x6a3d2, 0x3500d, 0x694c4, 0x580bd, - 0x3e5e8, 0x74b95, 0x34a6e, 0x3977c, 0x39432, 0x5b0d2, 0x6a3d8, 0x580b8, - 0x5b0cb, 0x5b0d7, 0x72dee, 0x72ded, 0x72dec, 0x74b9c, 0x3977f, 0x72dea, - 0x74b9e, 0x7be7d, 0x580bf, 0x5b0d5, 0x7cba8, 0x74b91, 0x3e5dd, 0xb6171, - 0xd46b3, 0xd46b9, 0x7cba1, 0x74b9f, 0x72de1, 0xe59f5, 0x3e5eb, 0x00004, - 0x00015, 0x00038, 0x00075, 0x000e8, 0x001d3, 0x00347, 0x0039c, 0x00690, - 0x0074a, 0x00b60, 0x00e93, 0x00f74, 0x0163d, 0x01a5a, 0x01d24, 0x01cbe, - 0x01f4b, 0x03468, 0x03562, 0x03947, 0x03e82, 0x05804, 0x05b12, 0x05803, - 0x0696d, 0x06a9e, 0x0697c, 0x06978, 0x06afb, 0x074b2, 0x072f5, 0x073c0, - 0x07541, 0x06944, 0x074b7, 0x070d3, 0x07ba9, 0x0b0b1, 0x0d1af, 0x0e1dd, - 0x0e5e2, 0x0e1a3, 0x0eec3, 0x1612f, 0x0e961, 0x0eeda, 0x0e78e, 0x0fa48, - 0x1612c, 0x0e511, 0x0e565, 0x0e953, 0x1aa4a, 0x0e59d, 0x1d52c, 0x1a811, - 0x1cae7, 0x1abfc, 0x1d52d, 0x1cacf, 0x1cf05, 0x2c254, 0x34a72, 0x1f4ac, - 0x3976b, 0x34a71, 0x2c6d9, 0x2d873, 0x34a6a, 0x357e7, 0x3464c, 0x3e5f5, - 0x58433, 0x1f53a, 0x3500a, 0x357ea, 0x34a73, 0x3942f, 0x357e5, 0x39775, - 0x694cd, 0x39772, 0x7cba5, 0x6a3ef, 0x35483, 0x74b98, 0x5b0c1, 0x39770, - 0x3a5d7, 0x39433, 0x39434, 0x694ce, 0x580be, 0x3e5ff, 0x6a3ec, 0xb616f, - 0xd46b1, 0x6a3d1, 0x72de5, 0x74b6e, 0x72de9, 0x3e700, 0xd46b6, 0x6a3e9, - 0x74b69, 0xe5675, 0xd46b8, 0x7cbaa, 0x3a5d1, 0x0000c, 0x0003c, 0x000eb, - 0x001f1, 0x003a4, 0x006a8, 0x007d5, 0x00d43, 0x00e77, 0x016c5, 0x01cb1, - 0x02c5d, 0x03a55, 0x03a56, 0x03e51, 0x03bb5, 0x05b0a, 0x06a9f, 0x074b8, - 0x07d28, 0x0d187, 0x0d40e, 0x0d52e, 0x0d425, 0x0eae3, 0x0e1d3, 0x1612e, - 0x0e59e, 0x0eec2, 0x0e578, 0x0e51a, 0x0e579, 0x0e515, 0x0e960, 0x0d183, - 0x0d220, 0x0d2cb, 0x0e512, 0x16c3e, 0x16002, 0x16c42, 0x1cae9, 0x3461a, - 0x1d2fa, 0x1a308, 0x1a849, 0x1cf07, 0x1f38f, 0x34b65, 0x2c253, 0x1ef9e, - 0x1cbc3, 0x1cbc1, 0x2c255, 0x1f384, 0x58435, 0x2c5cd, 0x3a5f7, 0x2c252, - 0x3959c, 0x2c6d8, 0x3a5d3, 0x6ad78, 0x6a3f2, 0x7cba9, 0xb6176, 0x72deb, - 0x39764, 0x3e5f6, 0x3a5d8, 0x74a8c, 0x6a3e6, 0x694d1, 0x6ad79, 0x1a4592, - 0xe59fb, 0x7cbb3, 0x5b0cd, 0x00017, 0x000b5, 0x002c3, 0x005b7, 0x00b1c, - 0x00e5c, 0x0163f, 0x01ab2, 0x01efa, 0x0348a, 0x0396e, 0x058da, 0x06963, - 0x06a30, 0x072cd, 0x073cf, 0x07ce7, 0x0d2ca, 0x0d2d8, 0x0e764, 0x0e794, - 0x16008, 0x16167, 0x1617e, 0x1aa49, 0x1a30b, 0x1a813, 0x2c6da, 0x1a580, - 0x1cbc2, 0x0f9ca, 0x1617f, 0x1d2fe, 0x0f7fc, 0x16c40, 0x0e513, 0x0eec5, - 0x0f7c3, 0x1d508, 0x1a81e, 0x1d2fd, 0x39430, 0x35486, 0x3e5fd, 0x2c24c, - 0x2c75a, 0x34a74, 0x3a5f4, 0x3464d, 0x694ca, 0x3a5f1, 0x1d509, 0x1d5c0, - 0x34648, 0x3464e, 0x6a3d5, 0x6a3e8, 0x6a3e7, 0x5b0c3, 0x2c248, 0x1f38a, - 0x3a5f2, 0x6a3e5, 0x00029, 0x00168, 0x0058c, 0x00b67, 0x00f9d, 0x01c3d, - 0x01cbf, 0x02c20, 0x0351d, 0x03df6, 0x06af9, 0x072b5, 0x0b1d7, 0x0b0b2, - 0x0d40a, 0x0d52b, 0x0e952, 0x0e797, 0x163c3, 0x1c3a0, 0x1f386, 0x1ca21, - 0x34655, 0x2c247, 0x1f53b, 0x2c250, 0x2c24f, 0x1f385, 0x1ef5d, 0x1cf15, - 0x1caea, 0x1ab0a, 0x1cf19, 0x1f53d, 0x1d5c2, 0x1d2fb, 0x1ef58, 0x34a78, - 0x357ec, 0x1f533, 0x3a5e1, 0x694d2, 0x58482, 0x3a5ee, 0x2c6dc, 0x357eb, - 0x5b0c4, 0x39778, 0x6a3e1, 0x7cbb4, 0x3a5e1, 0x74b68, 0x3a5ef, 0x3a5d2, - 0x39424, 0x72de2, 0xe59f6, 0xe59f7, 0x3e702, 0x3e5ec, 0x1f38b, 0x0003b, - 0x001f0, 0x00777, 0x00fa8, 0x01cb2, 0x02d84, 0x03a57, 0x03dd6, 0x06917, - 0x06a11, 0x07d07, 0x0eae2, 0x0e796, 0x0f9c9, 0x0f7fb, 0x16166, 0x16160, - 0x1ab1b, 0x1abfa, 0x2d87b, 0x1d2f7, 0x39768, 0x1f38c, 0x34653, 0x34651, - 0x6a3d9, 0x35001, 0x3abbd, 0x38742, 0x39426, 0x34a76, 0x3a5ec, 0x34a75, - 0x35000, 0x35488, 0x1cf10, 0x2c6db, 0x357ed, 0x357e8, 0x357e9, 0x3a5f0, - 0x694c2, 0xb6178, 0x72df5, 0x39425, 0x3942b, 0x74b6d, 0x74b6f, 0xb6177, - 0xb6179, 0x74b6a, 0xb6172, 0x58487, 0x3e5ee, 0x3e5ed, 0x72df2, 0x72df4, - 0x7cbae, 0x6a3ca, 0x70e86, 0x34bcf, 0x6a3c8, 0x00059, 0x00384, 0x00d5b, - 0x01c38, 0x03560, 0x0395b, 0x0584e, 0x06964, 0x073cd, 0x0b1e7, 0x0e798, - 0x0e78d, 0x0fa43, 0x1a848, 0x1a32f, 0x1aa4e, 0x3464a, 0x1f4ab, 0x1f38d, - 0x3a5eb, 0x3a5d4, 0x3548a, 0x6a3c7, 0x5b0d0, 0x6a3c5, 0x7cbb0, 0x694cb, - 0x3a5e5, 0x3e5e2, 0x3942c, 0x2d872, 0x1f4ae, 0x3a5d5, 0x694d3, 0x58481, - 0x35009, 0x39774, 0x58432, 0xb616c, 0x5b0db, 0x3548b, 0xb6174, 0x1d5d95, - 0xb004c, 0x7cbb2, 0x3a5e5, 0x74a8f, 0xe59f9, 0x72df6, 0xe59fd, 0x7cbad, - 0xd427d, 0x72cff, 0x3977a, 0x5b0d9, 0xb616d, 0xb616b, 0x1a4593, 0x7cbaf, - 0x5b0da, 0x00071, 0x003eb, 0x01603, 0x02c6c, 0x03961, 0x068c8, 0x06a31, - 0x072bd, 0x0d2c2, 0x0e51b, 0x0e5e6, 0x1abfb, 0x1d2ff, 0x1cae5, 0x1ef5c, - 0x1ef5e, 0x1cf13, 0x34a6d, 0x3976d, 0xb616a, 0x3e5f2, 0x6a3c4, 0xb6169, - 0x3e5dc, 0x580b9, 0x74b99, 0x75764, 0x58434, 0x3a5d9, 0x6945a, 0x69459, - 0x3548c, 0x3a5e9, 0x69457, 0x72df1, 0x6945e, 0x6a35e, 0x3e701, 0xb6168, - 0x5b0dd, 0x3a5de, 0x6a3c2, 0xd4278, 0x6a3cc, 0x72dfd, 0xb6165, 0x16009a, - 0x7cbb1, 0xd427c, 0xb6162, 0xe765e, 0x1cecbe, 0x7cbb6, 0x69454, 0xb6160, - 0xd427a, 0x1d5d96, 0xb1d6d, 0xe59f4, 0x72de8, 0x3a5db, 0x0007a, 0x006ae, - 0x01c3c, 0x03aba, 0x058e9, 0x072cc, 0x0d2dd, 0x0d22d, 0x0eec1, 0x0eedb, - 0x1d2a2, 0x1ef5b, 0x357e2, 0x3abbf, 0x1d2f9, 0x35004, 0x3a5dc, 0x351fc, - 0x3976c, 0x6a3c6, 0x6a3cb, 0x3e5ea, 0xe59f3, 0x6a3ce, 0x69452, 0xe59f0, - 0x74b90, 0xd4279, 0xd427b, 0x7cbb5, 0x5b0c5, 0x3a5e3, 0x3a5e2, 0x000d0, - 0x00775, 0x01efe, 0x03dd5, 0x0728c, 0x07cb9, 0x0e1a2, 0x0ea85, 0x0eed8, - 0x1a30a, 0x1aa4f, 0x3a5df, 0x35008, 0x3a5e0, 0x3e5f4, 0x3e5f7, 0xb1d6c, - 0x5843e, 0x34a70, 0x72df8, 0x74b6b, 0xd427f, 0x72df0, 0x5b0bf, 0x5b0c0, - 0xd46b0, 0x72def, 0xe59f8, 0x162e64, 0xb1d6f, 0x3a5e0, 0x39427, 0x69166, - 0x6a3e2, 0x6a3e3, 0x74a8d, 0xd427e, 0x1d5d97, 0xd46b4, 0x5b0d8, 0x6a3d3, - 0x000e0, 0x00b63, 0x034cc, 0x06a33, 0x073c9, 0x0e1a0, 0x0f7fd, 0x0f9cc, - 0x1617d, 0x1caeb, 0x1f4a9, 0x3abb3, 0x69450, 0x39420, 0x39777, 0x3e5e0, - 0x6a3d4, 0x6a3ed, 0xb6166, 0xe59f1, 0xb1d6e, 0xe5676, 0x6a3ea, 0xe5674, - 0xb6163, 0xd46b7, 0x7cba6, 0xd46ba, 0x1d5d94, 0xb6164, 0x6a3f1, 0x7cba2, - 0x69451, 0x72dfa, 0xd46bb, 0x72df7, 0x74b94, 0x1cecbf, 0xe59fa, 0x16009b, - 0x6a3e4, 0x000e6, 0x00e94, 0x03876, 0x070ef, 0x0d52a, 0x16015, 0x16014, - 0x1abf9, 0x1cf17, 0x34a79, 0x34650, 0x3e705, 0x6a3d0, 0x58430, 0x74b9d, - 0x7be7e, 0x5b0be, 0x39773, 0x6a3de, 0x000fb, 0x00f7b, 0x03dd7, 0x07bd0, - 0x0e59c, 0x0f9cd, 0x1cf18, 0x1d2ff, 0x34a7a, 0x39429, 0x3500c, 0x72de0, - 0x69456, 0x7be7c, 0xd46b5, 0xd46b2, 0x6a3dd, 0x001a2, 0x0163b, 0x06913, - 0x0b016, 0x0fa42, 0x1a32d, 0x1cf06, 0x34a7c, 0x34a7d, 0xb6161, 0x35481, - 0x3e5fa, 0x7cba0, 0x7be7f, 0x7cba3, 0x7cba7, 0x5b0d3, 0x72de6, 0x6a3dc, - 0x001a9, 0x01ab4, 0x06a34, 0x0d46a, 0x16130, 0x1ef5f, 0x1f532, 0x1f536, - 0x3942e, 0x58436, 0x6a3db, 0x6945b, 0x001c9, 0x01ca0, 0x0728b, 0x0eed9, - 0x1f539, 0x1ca1d, 0x39765, 0x39766, 0x58439, 0x6945d, 0x39767, 0x001d3, - 0x01f2c, 0x07bfc, 0x16161, 0x34652, 0x3a5ed, 0x3548d, 0x58438, 0x6a3da, - 0x002c1, 0x02c5e, 0x0d335, 0x1ab1a, 0x2d874, 0x35006, 0x35484, 0x5b0cc, - 0x74b9a, 0x72df3, 0x6a3d6, 0x002da, 0x034b3, 0x0d5ae, 0x1caee, 0x2d871, - 0x357e3, 0x74b97, 0x72df9, 0x580ba, 0x5b0d4, 0x0034d, 0x0354e, 0x0f750, - 0x1cbc0, 0x3a5e7, 0x3a5e4, 0x00385, 0x03a58, 0x16c41, 0x2c5cf, 0x3e5e1, - 0x74b6c, 0xe5677, 0x6a3df, 0x00390, 0x03e50, 0x163c2, 0x2d876, 0x35482, - 0x5b0d6, 0x5843a, 0x0039f, 0x0585e, 0x1a583, 0x3500f, 0x74b93, 0x39771, - 0x003e4, 0x06912, 0x16c43, 0x357e1, 0x0058a, 0x0696f, 0x1f538, 0x5b0c9, - 0x6a3cf, 0x005b6, 0x06af8, 0x1f534, 0x58483, 0x6a3e0, 0x00695, 0x07d02, - 0x1cae8, 0x58485, 0x006a2, 0x0754a, 0x357ee, 0x3977b, 0x00748, 0x074b2, - 0x34a7b, 0x00729, 0x0b1e0, 0x34649, 0x3e5e3, 0x0073d, 0x0d2c4, 0x3e5e6, - 0x007bb, 0x0b099, 0x39762, 0x5b0ce, 0x6945f, 0x007d1, 0x0d5ab, 0x39779, - 0x007d3, 0x0d52f, 0x39763, 0x6945c, 0x00b1a, 0x0d2c5, 0x35489, 0x00d23, - 0x0eaed, 0x3e5f8, 0x00d32, 0x16016, 0x3e5fb, 0x00d41, 0x0e768, 0x3a5ed, - 0x00e1f, 0x16017, 0x58027, 0x00ead, 0x0fa07, 0x69455, 0x00e54, 0x1612b, - 0x00e55, 0x1a581, 0x00f78, 0x1a32b, 0x580bc, 0x6a3ee, 0x00f79, 0x1abfd, - 0x00f95, 0x1ab18, 0x6a3f0, 0x01637, 0x1aa4d, 0x0162d, 0x1f53c, 0x6a3f3, - 0x01a31, 0x1a810, 0x39769, 0x01a50, 0x1caef, 0x01a36, 0x1a32e, 0x01a67, - 0x1f38e, 0x01a85, 0x1ef59, 0x01aa6, 0x1ef83, 0x01d51, 0x2c012, 0x01d53, - 0x2d879, 0x01d5e, 0x35005, 0x01cba, 0x1cf04, 0x69453, 0x01d2d, 0x351ff, - 0x01f2d, 0x2d86f, 0x01f29, 0x35007, 0x02c22, 0x351fa, 0x02c03, 0x3a5ec, - 0x02c5f, 0x3a5eb, 0x02c58, 0x34a6b, 0x03469, 0x356be, 0x02c59, 0x34a6c, - 0x0346a, 0x3a5ea, 0x034bd, 0x034bf, 0x356bf, 0x0386a, 0x03ab9, 0x5843f, - 0x0386b, 0x3a5f5, 0x03a4b, 0x39421, 0x03aa4, 0x3a5e9, 0x03a5a, 0x03960, - 0x3977e, 0x03de9, 0x03958, 0x03df7, 0x039e1, 0x3e5e4, 0x0395f, 0x69458, - 0x03e91, 0x03df2, 0x39428, 0x058f2, 0x03e80, 0x6a3c3, 0x03e93, 0x694c0, - 0x058b8, 0x5b0ca, 0x0584f, 0x694c1, 0x058f1, 0x068d6, 0x06a10, 0x06ac3, - 0x06a32, 0x070d2, 0x06911, 0x074b1, 0x07494, 0x06ad4, 0x06ad6, 0x072b8, - 0x06afa, 0x074b3, 0x07540, 0x073ce, 0x0b005, 0x074b3, 0x07495, 0x074b9, - 0x0d336, 0x07bff, 0x07763, 0x073c8, 0x07d29, 0x0b622, 0x0d221, 0x0d181, - 0x0b1d1, 0x074b8, 0x0b1d0, 0x0d19b, 0x0d2c3, 0x0b172, 0x0d2dc, 0x0b623, - 0x0d5aa, 0x0d426, 0x0d182, 0x0e795, 0x0e1d1, 0x0d337, 0x0e96c, 0x0e5e4, - 0x0e514, 0x0eaee, 0x16000, 0x0e767, 0x0e1a1, 0x0e78f, 0x16004, 0x0f7c2, - 0x0e799, 0x0e5e7, 0x0e566, 0x0e769, 0x0f751, 0x0eede, 0x0fa06, 0x16005, - 0x0fa9f, 0x1a5e6, 0x0e766, 0x1636f, 0x0eedd, 0x0eec0, 0x1a309, 0x1ceca, - 0x163cd, 0x0f9cb, 0x0eedf, 0x1a582, 0x1612d, 0x0e5e5, 0x1abf8, 0x1a30c, - 0x1ca1f, 0x163cc, 0x1a35c, 0x1ca1e, 0x1aa51, 0x163ac, 0x1a84e, 0x1a53f, - 0x1cf16, 0x1d2fc, 0x1a5b3, 0x1ab19, 0x1a81f, 0x1d5c3, 0x16c3f, 0x1d5c1, - 0x1d2fc, 0x1f4aa, 0x1a812, 0x1f535, 0x1cf12, 0x1a817, 0x1617c, 0x1ab0b, - 0x1d2f8, 0x1ef82, 0x2d87a, 0x1d52f, 0x1f530, 0x1aa48, 0x35487, 0x1d2fd, - 0x1f4ad, 0x1cf11, 0x3461b, 0x35485, 0x1ca20, 0x1caed, 0x1cae6, 0x1abff, - 0x3464f, 0x34a6f, 0x1ef81, 0x3464b, 0x39d96, 0x1f383, 0x1f537, 0x1cf14, - 0x2c5ce, 0x3500e, 0x2c251, 0x1caec, 0x1f387, 0x34654, 0x357e4, 0x2d878, - 0x3500b, 0x35480, 0x3a5e8, 0x3548e, 0x34b64, 0x1f4a8, 0x35003, 0x3e5df, - 0x2d870, 0x357e6, 0x3e5f0, 0x1ef5a, 0x3a5ea, 0x1f388, 0x3e703, 0x2c24e, - 0x3a5e2, 0x351fd, 0x2c6dd, 0x3e704, 0x351fe, 0x2d875, 0x5b0c7, 0x3976a, - 0x3a5e6, 0x39423, 0x58480, 0x2c246, 0x3a5e3, 0x2d877, 0x3e5f1, 0x3abbe, - 0x58489, 0x3e5f9, 0x357e0, 0x3abbc, 0x5b0c6, 0x69167, 0x69165, 0x3e5e9, - 0x39422, 0x3976f, 0x3977d, 0x3e5de, 0x6a3c9, 0x58b98, 0x3a5f6, 0x3a5d0, - 0x58486, 0x6a3c1, 0x3e5fc, 0x5b0dc, 0x3548f, 0x3942d, 0x694c9, 0x58484, - 0x3a5e8, 0x74b9b, 0x74b96, 0x694d0, 0x58488, 0x3a5e4, 0x3942a, 0x72ec2, - 0x39776, 0x5b0d1, 0x5b0cf, 0x3a5d6, 0xe59fc, 0x5b0c8, 0x3e5e7, 0x7cbb7, - 0x70e87, 0x7cbab, 0x5b0c2, 0x694c3, 0x74a8e, 0x3e5f3, 0x6a3cd, 0x72dfe, - 0x73b2e, 0x72ec0, 0x694c5, 0x58437, 0x694c8, 0x72dff, 0x39435, 0x5843d, - 0x6a3d7, 0x72ec1, 0xd22c8, 0x694cf, 0xb6173, 0x3e5fe, 0x580bb, 0xe59f2, - 0xb616e, 0xb6175, 0x3a5da, 0x5b0bd, 0x694cc, 0x5843c, 0x694c7, 0x74b92, - 0x72ec3, 0x694c6, 0xb6170, 0x7cbac, 0xb1733, 0x7cba4, 0xb6167, 0x72de7, - 0x72de4, 0x6a3c0, 0x3e5ef, 0x162e65, 0x72de3, 0x72dfb, 0x6a35f, 0x6a3eb, -}; - -static const uint8_t coef2_huffbits[1336] = { - 11, 9, 2, 3, 4, 4, 5, 6, - 6, 7, 7, 8, 8, 8, 9, 9, - 9, 9, 10, 10, 10, 10, 11, 11, - 11, 11, 11, 11, 11, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 16, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 18, 17, 17, 17, 17, - 17, 17, 17, 18, 18, 17, 17, 18, - 17, 17, 18, 17, 18, 18, 18, 18, - 19, 18, 18, 18, 18, 18, 18, 20, - 18, 18, 18, 19, 19, 18, 19, 18, - 19, 19, 18, 19, 19, 18, 19, 19, - 19, 19, 18, 19, 19, 19, 19, 19, - 19, 19, 20, 20, 20, 19, 19, 20, - 19, 20, 19, 19, 20, 19, 19, 20, - 20, 20, 20, 19, 20, 21, 19, 3, - 5, 7, 8, 9, 9, 10, 11, 11, - 12, 12, 12, 13, 13, 13, 13, 14, - 14, 14, 14, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 16, 16, - 15, 15, 15, 15, 16, 16, 16, 16, - 17, 16, 17, 17, 16, 17, 17, 17, - 17, 17, 17, 16, 17, 17, 17, 17, - 18, 17, 17, 18, 18, 18, 18, 18, - 19, 18, 18, 18, 18, 18, 18, 19, - 19, 18, 18, 18, 18, 19, 18, 19, - 19, 19, 20, 19, 18, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 20, - 20, 19, 20, 19, 20, 19, 20, 19, - 19, 21, 20, 20, 19, 4, 7, 8, - 10, 11, 11, 12, 12, 13, 13, 14, - 14, 14, 14, 15, 15, 15, 15, 15, - 16, 16, 16, 16, 16, 16, 16, 17, - 17, 17, 17, 17, 17, 17, 16, 16, - 16, 16, 17, 17, 17, 17, 18, 18, - 18, 17, 17, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 19, 18, 18, 18, - 19, 18, 19, 19, 19, 20, 20, 20, - 19, 19, 19, 19, 19, 19, 19, 21, - 21, 20, 19, 5, 8, 10, 11, 12, - 13, 13, 13, 14, 14, 15, 15, 15, - 15, 16, 16, 16, 16, 16, 17, 17, - 17, 17, 17, 17, 17, 17, 18, 17, - 18, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 19, 18, 19, 18, - 18, 18, 18, 18, 19, 18, 17, 17, - 18, 18, 19, 19, 19, 19, 18, 18, - 18, 19, 6, 9, 11, 12, 13, 13, - 14, 14, 14, 15, 15, 16, 16, 16, - 16, 16, 16, 17, 17, 17, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 17, 18, 18, 17, 18, 18, 18, - 18, 18, 18, 19, 19, 18, 18, 18, - 19, 19, 19, 20, 19, 19, 18, 19, - 19, 20, 21, 21, 19, 19, 18, 6, - 10, 12, 13, 14, 14, 14, 15, 15, - 15, 16, 16, 17, 17, 17, 17, 17, - 17, 17, 18, 18, 19, 18, 18, 18, - 19, 18, 18, 18, 19, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 19, 20, 20, 19, 19, 19, 19, 20, - 20, 19, 20, 19, 19, 19, 20, 20, - 20, 19, 19, 18, 19, 7, 10, 12, - 13, 14, 15, 15, 15, 16, 16, 17, - 17, 17, 17, 17, 17, 18, 18, 18, - 18, 19, 18, 19, 19, 19, 20, 19, - 18, 19, 19, 18, 18, 19, 19, 19, - 18, 19, 19, 20, 19, 18, 20, 21, - 20, 20, 19, 19, 21, 20, 21, 20, - 20, 20, 19, 19, 20, 20, 21, 20, - 19, 7, 11, 13, 14, 15, 15, 15, - 16, 16, 17, 17, 17, 17, 18, 18, - 18, 18, 18, 19, 20, 19, 19, 20, - 19, 19, 19, 19, 19, 19, 19, 19, - 18, 18, 19, 20, 19, 19, 19, 20, - 19, 19, 19, 20, 19, 20, 20, 21, - 20, 20, 20, 21, 22, 20, 19, 20, - 20, 21, 20, 21, 20, 19, 8, 11, - 13, 14, 15, 16, 16, 16, 17, 17, - 17, 18, 18, 18, 18, 18, 19, 18, - 19, 19, 19, 19, 21, 19, 19, 21, - 19, 20, 20, 20, 19, 18, 18, 8, - 12, 14, 15, 16, 16, 16, 16, 17, - 17, 17, 19, 18, 18, 19, 19, 20, - 19, 18, 20, 19, 20, 20, 19, 19, - 20, 20, 21, 21, 20, 19, 19, 19, - 19, 19, 19, 20, 21, 20, 19, 19, - 8, 12, 14, 15, 16, 16, 17, 17, - 17, 18, 18, 18, 19, 19, 19, 19, - 19, 19, 20, 21, 20, 21, 19, 21, - 20, 20, 20, 20, 21, 20, 19, 20, - 19, 20, 20, 20, 19, 22, 21, 21, - 19, 9, 12, 14, 15, 16, 17, 17, - 17, 18, 18, 18, 19, 19, 19, 19, - 20, 19, 19, 19, 9, 13, 15, 16, - 17, 17, 18, 18, 18, 19, 18, 20, - 19, 20, 20, 20, 19, 9, 13, 15, - 16, 17, 17, 18, 18, 18, 20, 18, - 19, 20, 20, 20, 20, 19, 20, 19, - 9, 13, 15, 16, 17, 18, 18, 18, - 19, 19, 19, 19, 10, 14, 16, 17, - 18, 18, 19, 19, 19, 19, 19, 10, - 14, 16, 17, 18, 18, 18, 19, 19, - 10, 14, 16, 17, 18, 18, 18, 19, - 19, 20, 19, 10, 14, 16, 18, 18, - 18, 19, 20, 19, 19, 10, 14, 17, - 18, 18, 18, 10, 15, 17, 18, 19, - 19, 21, 19, 11, 15, 17, 18, 18, - 19, 19, 11, 15, 17, 18, 19, 19, - 11, 15, 17, 18, 11, 15, 18, 19, - 19, 11, 15, 18, 19, 19, 11, 16, - 18, 19, 11, 15, 18, 19, 11, 16, - 18, 12, 16, 18, 19, 12, 16, 19, - 12, 16, 19, 19, 19, 12, 16, 19, - 12, 16, 19, 19, 12, 16, 18, 12, - 16, 19, 12, 17, 19, 12, 17, 19, - 12, 17, 19, 12, 17, 19, 13, 17, - 13, 17, 13, 17, 19, 19, 13, 17, - 13, 17, 19, 13, 17, 13, 18, 19, - 13, 17, 19, 13, 18, 13, 17, 13, - 18, 13, 18, 13, 18, 13, 18, 13, - 18, 13, 18, 14, 18, 19, 14, 18, - 14, 18, 14, 18, 14, 18, 14, 19, - 14, 19, 14, 18, 14, 18, 14, 18, - 14, 19, 14, 14, 18, 14, 14, 19, - 14, 18, 14, 19, 14, 19, 14, 15, - 19, 15, 15, 15, 15, 19, 15, 19, - 15, 15, 19, 15, 15, 19, 15, 19, - 15, 19, 15, 19, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 16, - 15, 15, 15, 16, 16, 16, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 17, 16, 16, 16, 17, - 17, 16, 17, 17, 16, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, - 17, 17, 17, 17, 17, 17, 17, 17, - 18, 17, 17, 18, 17, 17, 17, 17, - 18, 18, 17, 17, 17, 17, 17, 17, - 17, 18, 17, 18, 18, 17, 17, 17, - 18, 18, 18, 17, 18, 17, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 17, - 18, 18, 18, 18, 19, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 18, 18, 18, 18, 18, 19, - 18, 18, 19, 18, 18, 18, 19, 18, - 19, 18, 18, 19, 18, 18, 19, 19, - 19, 19, 19, 18, 19, 18, 19, 18, - 19, 19, 18, 18, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 18, 19, - 19, 19, 19, 19, 18, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 20, - 19, 19, 19, 19, 21, 19, 19, 20, - 19, 20, 19, 19, 19, 19, 19, 20, - 20, 20, 19, 19, 19, 20, 19, 19, - 19, 20, 20, 19, 20, 19, 19, 21, - 20, 20, 19, 19, 19, 19, 19, 19, - 20, 19, 20, 20, 20, 20, 20, 20, - 20, 19, 19, 21, 20, 20, 19, 19, -}; - -static const uint32_t coef3_huffcodes[1072] = { - 0x001b2, 0x00069, 0x00000, 0x00004, 0x00006, 0x0000e, 0x00014, 0x00019, - 0x00016, 0x0002b, 0x00030, 0x0003d, 0x0003c, 0x0005a, 0x0005f, 0x0006d, - 0x0007e, 0x0005f, 0x0007f, 0x000b6, 0x000bc, 0x000d8, 0x000f2, 0x000fe, - 0x000bc, 0x000fc, 0x00161, 0x0016e, 0x00174, 0x00176, 0x001a2, 0x001e3, - 0x001f3, 0x00174, 0x0017a, 0x001ea, 0x002a8, 0x002c4, 0x002e6, 0x00314, - 0x00346, 0x00367, 0x003e9, 0x002e5, 0x002ee, 0x003d6, 0x00555, 0x00554, - 0x00557, 0x005c3, 0x005d6, 0x006e0, 0x0062f, 0x006e2, 0x00799, 0x00789, - 0x007fa, 0x005ce, 0x007fe, 0x005ec, 0x007cc, 0x007af, 0x00aa7, 0x00b19, - 0x00b94, 0x00b85, 0x00b9f, 0x00c48, 0x00c45, 0x00dd8, 0x00c4c, 0x00c4b, - 0x00d99, 0x00d1f, 0x00dc2, 0x00f95, 0x00fa2, 0x00bb5, 0x00b9f, 0x00f5d, - 0x00bbf, 0x00f47, 0x0154a, 0x00fd5, 0x00f45, 0x00f7f, 0x0160d, 0x01889, - 0x01757, 0x01722, 0x018b3, 0x0172d, 0x01a39, 0x01a18, 0x01bb3, 0x01b30, - 0x01e63, 0x0173c, 0x01b35, 0x01723, 0x01e80, 0x01fee, 0x01761, 0x01ffc, - 0x01f7f, 0x02c7c, 0x01fa1, 0x0177b, 0x01755, 0x0175a, 0x01fa6, 0x02eab, - 0x0310a, 0x02c69, 0x03669, 0x03127, 0x03103, 0x02e43, 0x03662, 0x03165, - 0x03124, 0x0313b, 0x03111, 0x03668, 0x0343b, 0x03c52, 0x03efc, 0x02e6c, - 0x03fda, 0x03ef8, 0x02e7b, 0x03ee2, 0x03cc5, 0x03d72, 0x058c0, 0x03df8, - 0x02ea9, 0x03e7e, 0x0556d, 0x05c82, 0x03d71, 0x03e7b, 0x03c42, 0x058d7, - 0x03f4e, 0x06200, 0x03d70, 0x05cb2, 0x05c96, 0x05cb0, 0x03f45, 0x05cb1, - 0x02e6d, 0x03110, 0x02f68, 0x05c90, 0x07ca6, 0x07c88, 0x06204, 0x062c8, - 0x078a6, 0x07986, 0x079d5, 0x0b1ad, 0x07989, 0x0b079, 0x05cdd, 0x0aad4, - 0x05de8, 0x07dcd, 0x07987, 0x05d67, 0x05d99, 0x0b91d, 0x07cf1, 0x05d9b, - 0x079d7, 0x0b07b, 0x05c85, 0x05d9a, 0x07dcc, 0x07ebf, 0x07dce, 0x07dfb, - 0x07ec0, 0x07d1a, 0x07a07, 0x05c84, 0x0c471, 0x07cf2, 0x0baef, 0x0b9d2, - 0x05deb, 0x07bd6, 0x0b845, 0x05d98, 0x0b91a, 0x0bae8, 0x0c4e0, 0x0dc31, - 0x0f93d, 0x0bbce, 0x0d1d2, 0x0f7a9, 0x0d9b9, 0x0bbcb, 0x0b900, 0x0aad7, - 0x0babd, 0x0c4e1, 0x0f46f, 0x0c588, 0x0c58b, 0x160e6, 0x0bbcf, 0x0bac3, - 0x0f945, 0x0f7a3, 0x0d1c1, 0x0fb8e, 0x0f7a4, 0x0fb8c, 0x0f40c, 0x0c473, - 0x0fd72, 0x0bbcd, 0x0fffa, 0x0f940, 0x0bbc9, 0x0f7a8, 0x1a1ed, 0x0bbc5, - 0x1f26f, 0x163fd, 0x160c7, 0x1a1f5, 0x0f947, 0x163fc, 0x154b3, 0x0fff6, - 0x163f6, 0x160e9, 0x1a1f0, 0x0bab9, 0x0baba, 0x17086, 0x0b903, 0x0fd75, - 0x0f308, 0x176f3, 0x163ff, 0x0fd7d, 0x1bb78, 0x163fb, 0x188db, 0x1a1f7, - 0x154b2, 0x172fd, 0x163f4, 0x1bb73, 0x172ff, 0x0babc, 0x0f97d, 0x1a1f3, - 0x1bb6d, 0x1ffd5, 0x1a1f4, 0x1f272, 0x17380, 0x17382, 0x1ffe7, 0x0bac8, - 0x0bbc4, 0x188d3, 0x160e0, 0x0fd7b, 0x1725f, 0x172f5, 0x1bb79, 0x1fad9, - 0x1f269, 0x188d0, 0x0bac4, 0x0bac5, 0x31185, 0x188d2, 0x188cc, 0x31187, - 0x3e7fe, 0x188d1, 0x1bb6c, 0x1f268, 0x1fad2, 0x1ffd9, 0x1a1ea, 0x1bb68, - 0x1facb, 0x3fdb2, 0x1e81a, 0x188ce, 0x172fb, 0x1a1ef, 0x1face, 0x1bb70, - 0x0bac1, 0x1bb6b, 0x172f8, 0x1bb66, 0x1ffdf, 0x1bb6a, 0x1ffd7, 0x1f266, - 0x176f8, 0x37653, 0x1fa7e, 0x31182, 0x1fac8, 0x2c7e3, 0x370ee, 0x176ec, - 0x176e9, 0x2e4bc, 0x160c5, 0x3765a, 0x3ce9c, 0x17373, 0x176e8, 0x188d4, - 0x176f1, 0x176ef, 0x37659, 0x1bb7c, 0x1ffde, 0x176f2, 0x3118b, 0x2c7d4, - 0x37651, 0x5ce9f, 0x37650, 0x31191, 0x3f4f6, 0x3f4f5, 0x7a06c, 0x1fac1, - 0x5c97b, 0x2c7e0, 0x79d3a, 0x3e7fd, 0x2c7df, 0x3f4f0, 0x7a06d, 0x376c1, - 0x79d3b, 0x00004, 0x00014, 0x00059, 0x000ab, 0x000b8, 0x00177, 0x001f5, - 0x001f2, 0x00315, 0x003fc, 0x005bd, 0x0062d, 0x006e8, 0x007dd, 0x00b04, - 0x007cd, 0x00b1e, 0x00d1e, 0x00f15, 0x00f3b, 0x00f41, 0x01548, 0x018b0, - 0x0173b, 0x01884, 0x01a1c, 0x01bb4, 0x01f25, 0x017b5, 0x0176d, 0x01ef8, - 0x02e73, 0x03107, 0x03125, 0x03105, 0x02e49, 0x03ce8, 0x03ef9, 0x03e5e, - 0x02e72, 0x03471, 0x03fd9, 0x0623f, 0x078a0, 0x06867, 0x05cb3, 0x06272, - 0x068ec, 0x06e9a, 0x079d4, 0x06e98, 0x0b1aa, 0x06e1a, 0x07985, 0x068ee, - 0x06e9b, 0x05c88, 0x0b1ac, 0x07dfa, 0x05d65, 0x07cf0, 0x07cbf, 0x0c475, - 0x160eb, 0x1bb7e, 0x0f7a6, 0x1fedd, 0x160e3, 0x0fffb, 0x0fb8d, 0x0fff9, - 0x0d1c0, 0x0c58c, 0x1a1e9, 0x0bab8, 0x0f5cf, 0x0fff5, 0x376c5, 0x1a1ec, - 0x160ed, 0x1fede, 0x1fac9, 0x1a1eb, 0x1f224, 0x176ee, 0x0fd79, 0x17080, - 0x17387, 0x1bb7a, 0x1ffe9, 0x176f7, 0x17385, 0x17781, 0x2c7d5, 0x17785, - 0x1ffe3, 0x163f5, 0x1fac2, 0x3e7f9, 0x3118d, 0x3fdb1, 0x1ffe2, 0x1f226, - 0x3118a, 0x2c7d9, 0x31190, 0x3118c, 0x3f4f3, 0x1bb7f, 0x1bb72, 0x31184, - 0xb92f4, 0x3e7fb, 0x6e1d9, 0x1faca, 0x62300, 0x3fdb8, 0x3d037, 0x3e7fc, - 0x62301, 0x3f4f2, 0x1f26a, 0x0000e, 0x00063, 0x000f8, 0x001ee, 0x00377, - 0x003f7, 0x006e3, 0x005cc, 0x00b05, 0x00dd2, 0x00fd4, 0x0172e, 0x0172a, - 0x01e23, 0x01f2d, 0x01763, 0x01769, 0x0176c, 0x02e75, 0x03104, 0x02ec1, - 0x03e58, 0x0583f, 0x03f62, 0x03f44, 0x058c5, 0x0623c, 0x05cf4, 0x07bd7, - 0x05d9d, 0x0aad2, 0x05d66, 0x0b1a9, 0x0b078, 0x07cfe, 0x0b918, 0x0c46f, - 0x0b919, 0x0b847, 0x06e1b, 0x0b84b, 0x0aad8, 0x0fd74, 0x172f4, 0x17081, - 0x0f97c, 0x1f273, 0x0f7a0, 0x0fd7c, 0x172f7, 0x0fd7a, 0x1bb77, 0x172fe, - 0x1f270, 0x0fd73, 0x1bb7b, 0x1a1bc, 0x1bb7d, 0x0bbc3, 0x172f6, 0x0baeb, - 0x0fb8f, 0x3f4f4, 0x3fdb4, 0x376c8, 0x3e7fa, 0x1ffd0, 0x62303, 0xb92f5, - 0x1f261, 0x31189, 0x3fdb5, 0x2c7db, 0x376c9, 0x1fad6, 0x1fad1, 0x00015, - 0x000f0, 0x002e0, 0x0058e, 0x005d7, 0x00c4d, 0x00fa1, 0x00bdb, 0x01756, - 0x01f70, 0x02c19, 0x0313c, 0x0370f, 0x03cc0, 0x02ea8, 0x058c6, 0x058c7, - 0x02eb7, 0x058d0, 0x07d18, 0x0aa58, 0x0b848, 0x05d9e, 0x05d6c, 0x0b84c, - 0x0c589, 0x0b901, 0x163f8, 0x0bac9, 0x0b9c5, 0x0f93c, 0x188d8, 0x0bbc7, - 0x160ec, 0x0fd6f, 0x188d9, 0x160ea, 0x0f7a7, 0x0f944, 0x0baab, 0x0dc3a, - 0x188cf, 0x176fb, 0x2c7d8, 0x2c7d7, 0x1bb75, 0x5ce9e, 0x62302, 0x370ed, - 0x176f4, 0x1ffd1, 0x370ef, 0x3f4f8, 0x376c7, 0x1ffe1, 0x376c6, 0x176ff, - 0x6e1d8, 0x176f6, 0x17087, 0x0f5cd, 0x00035, 0x001a0, 0x0058b, 0x00aac, - 0x00b9a, 0x0175f, 0x01e22, 0x01e8c, 0x01fb2, 0x0310b, 0x058d1, 0x0552e, - 0x05c27, 0x0686e, 0x07ca7, 0x0c474, 0x0dc33, 0x07bf2, 0x05de9, 0x07a35, - 0x0baaa, 0x0b9eb, 0x0fb95, 0x0b9b8, 0x17381, 0x1f262, 0x188cd, 0x17088, - 0x172fa, 0x0f7a2, 0x1fad3, 0x0bac0, 0x3765c, 0x1fedf, 0x1f225, 0x1fad4, - 0x2c7da, 0x5ce9d, 0x3e7f8, 0x1e203, 0x188d7, 0x00054, 0x002c0, 0x007a1, - 0x00f78, 0x01b36, 0x01fa3, 0x0313a, 0x03436, 0x0343a, 0x07d1d, 0x07bd8, - 0x05cdf, 0x0b846, 0x0b189, 0x0d9b8, 0x0fff8, 0x0d9be, 0x0c58a, 0x05dea, - 0x0d1d3, 0x160e4, 0x1f26b, 0x188da, 0x1e202, 0x2c7d2, 0x163fe, 0x31193, - 0x17782, 0x376c2, 0x2c7d1, 0x3fdb0, 0x3765d, 0x2c7d0, 0x1fad0, 0x1e201, - 0x188dd, 0x2c7e2, 0x37657, 0x37655, 0x376c4, 0x376c0, 0x176ea, 0x0006f, - 0x003cf, 0x00dd5, 0x01f23, 0x02c61, 0x02ed0, 0x05d54, 0x0552d, 0x07883, - 0x0b1a8, 0x0b91c, 0x0babf, 0x0b902, 0x0f7aa, 0x0f7a5, 0x1a1e8, 0x1ffd6, - 0x0babe, 0x1a1bf, 0x163f3, 0x1ffd8, 0x1fad7, 0x1f275, 0x1ffdc, 0x0007d, - 0x005bc, 0x01549, 0x02a99, 0x03def, 0x06273, 0x079d6, 0x07d1b, 0x0aad3, - 0x0d0fc, 0x2c7dd, 0x188d6, 0x0bac2, 0x2c7e1, 0x1bb76, 0x1a1bd, 0x31186, - 0x0fd78, 0x1a1be, 0x31183, 0x3fdb6, 0x3f4f1, 0x37652, 0x1fad5, 0x3f4f9, - 0x3e7ff, 0x5ce9c, 0x3765b, 0x31188, 0x17372, 0x000bd, 0x0078b, 0x01f21, - 0x03c43, 0x03ded, 0x0aad6, 0x07ec1, 0x0f942, 0x05c86, 0x17089, 0x0babb, - 0x1ffe8, 0x2c7de, 0x1f26e, 0x1fac4, 0x3f4f7, 0x37656, 0x1fa7d, 0x376c3, - 0x3fdb3, 0x3118f, 0x1fac6, 0x000f8, 0x007ed, 0x01efd, 0x03e7a, 0x05c91, - 0x0aad9, 0x0baec, 0x0dc32, 0x0f46e, 0x1e200, 0x176fa, 0x3765e, 0x3fdb7, - 0x2c7d6, 0x3fdb9, 0x37654, 0x37658, 0x3118e, 0x1ffdb, 0x000f6, 0x00c43, - 0x03106, 0x068ef, 0x0b84d, 0x0b188, 0x0bbcc, 0x1f264, 0x1bb69, 0x17386, - 0x1fac0, 0x00171, 0x00f39, 0x03e41, 0x068ed, 0x0d9bc, 0x0f7a1, 0x1bb67, - 0x1ffdd, 0x176f9, 0x001b9, 0x00f7d, 0x03f63, 0x0d0fd, 0x0b9ea, 0x188dc, - 0x1fac3, 0x1a1f2, 0x31192, 0x1ffe4, 0x001f6, 0x01754, 0x06865, 0x0f309, - 0x160e5, 0x176f5, 0x3765f, 0x1facc, 0x001e9, 0x01a1a, 0x06201, 0x0f105, - 0x176f0, 0x002df, 0x01756, 0x05d6d, 0x163fa, 0x176ed, 0x00342, 0x02e40, - 0x0d0ff, 0x17082, 0x003cd, 0x02a98, 0x0fffc, 0x2c7dc, 0x1fa7f, 0x003fe, - 0x03764, 0x0fffd, 0x176fc, 0x1fac5, 0x002f7, 0x02ed1, 0x0fb97, 0x0058a, - 0x02edc, 0x0bbc8, 0x005d4, 0x0623d, 0x160e8, 0x0062e, 0x05830, 0x163f9, - 0x006eb, 0x06205, 0x1f274, 0x007de, 0x062c9, 0x1f265, 0x005c9, 0x05cde, - 0x1ffd3, 0x005d4, 0x07988, 0x007ce, 0x0b849, 0x00b1b, 0x05c89, 0x1fac7, - 0x00b93, 0x05c83, 0x00b9e, 0x0f14f, 0x00c4a, 0x0b9c7, 0x00dd4, 0x0c470, - 0x1f271, 0x00f38, 0x0fb96, 0x176eb, 0x00fa0, 0x163f7, 0x00bb2, 0x0b91b, - 0x00bbe, 0x0f102, 0x00f44, 0x0f946, 0x1facd, 0x00f79, 0x0d9bd, 0x0154d, - 0x0bbc6, 0x00fd2, 0x160e7, 0x0172b, 0x188cb, 0x0175e, 0x0fd76, 0x0175c, - 0x1bb71, 0x0189f, 0x1a1ee, 0x01f24, 0x1a1f6, 0x01ba7, 0x0bbca, 0x01f7d, - 0x0ffff, 0x01f2e, 0x1bb65, 0x01bb5, 0x172f9, 0x01fef, 0x1f26c, 0x01f3e, - 0x0fd77, 0x01762, 0x1bb6e, 0x01ef9, 0x172fc, 0x01fa0, 0x02ab7, 0x02e4a, - 0x1f267, 0x01fb3, 0x1ffda, 0x02e42, 0x03101, 0x17780, 0x0313d, 0x03475, - 0x17784, 0x03126, 0x1facf, 0x03c51, 0x17783, 0x03e40, 0x1ffe5, 0x03663, - 0x1ffe0, 0x03e8f, 0x1f26d, 0x0343c, 0x03cc1, 0x176fd, 0x03e45, 0x02ec0, - 0x03f61, 0x03dee, 0x03fd8, 0x0583e, 0x02e45, 0x03e59, 0x03d02, 0x05ce8, - 0x05568, 0x176fe, 0x02f69, 0x1fad8, 0x058c1, 0x05c83, 0x1ffe6, 0x06271, - 0x06e1c, 0x062c7, 0x068e1, 0x0552f, 0x06864, 0x06866, 0x06e99, 0x05cbc, - 0x07ca5, 0x078a1, 0x05c82, 0x07dcf, 0x0623b, 0x0623e, 0x068e8, 0x07a36, - 0x05d9c, 0x0b077, 0x07cf3, 0x07a34, 0x07ca4, 0x07d19, 0x079d2, 0x07d1c, - 0x07bd9, 0x0b84a, 0x0fb94, 0x0aad5, 0x0dc30, 0x07bf3, 0x0baee, 0x0b07a, - 0x0c472, 0x0b91e, 0x0d9ba, 0x05d9f, 0x0d0fe, 0x0b9c6, 0x05c87, 0x0f14e, - 0x0baed, 0x0b92e, 0x0f103, 0x0b9c4, 0x0fb91, 0x0d9bb, 0x0b1ab, 0x0c58d, - 0x0fffe, 0x0f93b, 0x0f941, 0x0baea, 0x0b91f, 0x0f5cc, 0x0d9bf, 0x0f943, - 0x0f104, 0x1f260, 0x0fb92, 0x0f93f, 0x0f3a6, 0x0bac7, 0x0f7ab, 0x0bac6, - 0x17383, 0x0fd6d, 0x0bae9, 0x0fd6e, 0x1e74f, 0x188ca, 0x1f227, 0x0fb93, - 0x0fb90, 0x0fff7, 0x17085, 0x17083, 0x160e1, 0x17084, 0x0f93e, 0x160e2, - 0x160c6, 0x1a1f1, 0x1bb6f, 0x17384, 0x0fd70, 0x1f263, 0x188d5, 0x173a6, - 0x0f5ce, 0x163f2, 0x0fd71, 0x1ffd2, 0x160c4, 0x1ffd4, 0x2c7d3, 0x1bb74, -}; - -static const uint8_t coef3_huffbits[1072] = { - 9, 7, 2, 3, 4, 4, 5, 5, - 6, 6, 6, 6, 7, 7, 7, 7, - 7, 8, 8, 8, 8, 8, 8, 8, - 9, 9, 9, 9, 9, 9, 9, 9, - 9, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 12, 11, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, - 13, 14, 13, 14, 14, 13, 14, 13, - 13, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 15, - 14, 14, 15, 14, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 14, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 16, 15, 16, 16, 16, - 16, 15, 15, 16, 16, 16, 16, 16, - 15, 16, 16, 16, 15, 16, 15, 15, - 16, 15, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 17, 16, 17, 16, 17, 17, 16, - 17, 16, 17, 16, 16, 17, 17, 17, - 16, 17, 16, 16, 17, 16, 17, 16, - 17, 17, 16, 16, 17, 17, 17, 17, - 17, 17, 17, 17, 16, 17, 17, 16, - 17, 17, 17, 17, 17, 17, 17, 17, - 16, 18, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 16, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 18, - 17, 17, 17, 17, 18, 17, 17, 18, - 19, 17, 17, 17, 18, 17, 17, 17, - 18, 18, 18, 17, 17, 17, 18, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 18, 18, 18, 18, 18, 18, 18, 18, - 18, 18, 17, 18, 18, 18, 18, 17, - 18, 18, 18, 17, 17, 18, 18, 18, - 18, 19, 18, 18, 19, 19, 20, 18, - 19, 18, 19, 19, 18, 19, 20, 18, - 19, 4, 6, 7, 8, 9, 9, 9, - 10, 10, 10, 11, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 16, 15, 15, 15, - 15, 16, 16, 15, 16, 16, 15, 16, - 17, 17, 17, 17, 17, 16, 16, 16, - 16, 16, 17, 17, 17, 16, 18, 17, - 17, 17, 18, 17, 17, 18, 17, 17, - 17, 17, 17, 18, 17, 18, 18, 18, - 17, 17, 18, 19, 18, 18, 17, 17, - 18, 18, 18, 18, 19, 17, 17, 18, - 20, 19, 19, 18, 19, 18, 19, 19, - 19, 19, 17, 5, 7, 9, 10, 10, - 11, 11, 12, 12, 12, 13, 13, 13, - 13, 13, 14, 14, 14, 14, 14, 15, - 14, 15, 15, 15, 15, 15, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 15, 16, 16, 17, 17, 17, - 16, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 16, - 16, 19, 18, 18, 19, 17, 19, 20, - 17, 18, 18, 18, 18, 18, 18, 6, - 8, 10, 11, 12, 12, 12, 13, 13, - 13, 14, 14, 14, 14, 15, 15, 15, - 15, 15, 15, 16, 16, 16, 16, 16, - 16, 17, 17, 17, 16, 16, 17, 17, - 17, 17, 17, 17, 17, 16, 16, 16, - 17, 18, 18, 18, 17, 19, 19, 18, - 18, 17, 18, 19, 18, 17, 18, 18, - 19, 18, 17, 17, 6, 9, 11, 12, - 13, 13, 13, 14, 14, 14, 15, 15, - 15, 15, 15, 16, 16, 16, 16, 16, - 16, 17, 16, 17, 17, 17, 17, 17, - 17, 17, 18, 17, 18, 17, 17, 18, - 18, 19, 19, 17, 17, 7, 10, 12, - 13, 13, 14, 14, 14, 14, 15, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 17, 17, 17, 17, 18, 17, 18, - 18, 18, 18, 18, 18, 18, 18, 17, - 17, 18, 18, 18, 18, 18, 18, 7, - 10, 12, 13, 14, 15, 15, 15, 15, - 16, 16, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 18, 17, 17, 8, - 11, 13, 14, 15, 15, 15, 15, 16, - 16, 18, 17, 17, 18, 17, 17, 18, - 17, 17, 18, 18, 19, 18, 18, 19, - 19, 19, 18, 18, 18, 8, 11, 13, - 14, 15, 16, 16, 16, 16, 17, 17, - 17, 18, 17, 18, 19, 18, 18, 18, - 18, 18, 18, 8, 12, 14, 15, 15, - 16, 16, 16, 17, 17, 18, 18, 18, - 18, 18, 18, 18, 18, 17, 9, 12, - 14, 15, 16, 16, 17, 17, 17, 17, - 18, 9, 12, 14, 15, 16, 17, 17, - 17, 18, 9, 13, 15, 16, 17, 17, - 18, 17, 18, 17, 9, 13, 15, 16, - 17, 18, 18, 18, 10, 13, 15, 16, - 18, 10, 14, 16, 17, 18, 10, 14, - 16, 17, 10, 14, 16, 18, 18, 10, - 14, 16, 18, 18, 11, 15, 16, 11, - 15, 17, 11, 15, 17, 11, 15, 17, - 11, 15, 17, 11, 15, 17, 12, 16, - 17, 12, 15, 12, 16, 12, 16, 18, - 12, 16, 12, 16, 12, 16, 12, 16, - 17, 12, 16, 18, 12, 17, 13, 16, - 13, 16, 13, 16, 18, 13, 16, 13, - 17, 13, 17, 13, 17, 13, 17, 13, - 17, 13, 17, 13, 17, 13, 17, 13, - 16, 13, 17, 13, 17, 13, 17, 14, - 17, 14, 17, 14, 17, 14, 14, 14, - 17, 14, 17, 14, 14, 18, 14, 14, - 18, 14, 18, 14, 18, 14, 17, 14, - 17, 14, 17, 14, 14, 18, 14, 15, - 15, 15, 14, 15, 15, 14, 15, 15, - 15, 18, 15, 18, 15, 15, 17, 15, - 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 16, 15, 15, 15, 15, 16, - 16, 16, 16, 16, 15, 15, 15, 15, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 16, 16, - 16, 17, 16, 16, 16, 17, 17, 17, - 17, 17, 16, 17, 17, 17, 17, 16, - 16, 16, 17, 17, 17, 17, 16, 17, - 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 18, 17, -}; - -static const uint32_t coef4_huffcodes[476] = { - 0x00f01, 0x0001e, 0x00000, 0x00004, 0x00006, 0x0000d, 0x0000a, 0x00017, - 0x0001d, 0x00017, 0x0002c, 0x00031, 0x00039, 0x0003e, 0x00039, 0x0005a, - 0x00066, 0x00070, 0x0007b, 0x00070, 0x00077, 0x000af, 0x000c9, 0x000f2, - 0x000f4, 0x000b2, 0x000e3, 0x0015b, 0x0015d, 0x00181, 0x0019d, 0x001e3, - 0x001c5, 0x002b5, 0x002db, 0x00338, 0x003c3, 0x003cc, 0x003f0, 0x002cd, - 0x003fa, 0x003a1, 0x005b4, 0x00657, 0x007ab, 0x0074d, 0x0074c, 0x00ac1, - 0x00ac5, 0x0076b, 0x00ca8, 0x00f04, 0x00f00, 0x00fe3, 0x00f3c, 0x00f10, - 0x00f39, 0x00fe6, 0x00e26, 0x00e90, 0x016c5, 0x01827, 0x01954, 0x015c5, - 0x01958, 0x01f8a, 0x01c4a, 0x02b0f, 0x02b41, 0x02b0e, 0x033c6, 0x03050, - 0x01c4f, 0x02d88, 0x0305c, 0x03c18, 0x02b4f, 0x02cc2, 0x03a47, 0x05680, - 0x0569d, 0x06442, 0x06443, 0x06446, 0x0656e, 0x06444, 0x07120, 0x0748a, - 0x0c1ba, 0x07e22, 0x07aa6, 0x07f25, 0x07aa7, 0x07e20, 0x0c11b, 0x0c118, - 0x07aa5, 0x0ad0a, 0x0f389, 0x19ebb, 0x0caad, 0x0fe42, 0x0fe40, 0x16c34, - 0x2b4e5, 0x33d65, 0x16c30, 0x1e7ae, 0x1e25c, 0x18370, 0x1e703, 0x19eba, - 0x16c37, 0x0e234, 0x16c6e, 0x00004, 0x0002a, 0x00061, 0x00075, 0x000cb, - 0x000ff, 0x00190, 0x001eb, 0x001d1, 0x002b9, 0x00307, 0x00339, 0x0033f, - 0x003fb, 0x003b4, 0x0060c, 0x00679, 0x00645, 0x0067d, 0x0078a, 0x007e3, - 0x00749, 0x00ac4, 0x00ad2, 0x00ae3, 0x00c10, 0x00c16, 0x00ad1, 0x00cf4, - 0x00fe2, 0x01586, 0x00e9d, 0x019f1, 0x01664, 0x01e26, 0x01d38, 0x02b4d, - 0x033c5, 0x01fc2, 0x01fc3, 0x01d28, 0x03c1d, 0x0598e, 0x0f094, 0x07aa4, - 0x0ad38, 0x0ac0c, 0x0c11a, 0x079ea, 0x0c881, 0x0fe44, 0x0b635, 0x0ac0d, - 0x0b61e, 0x05987, 0x07121, 0x0f382, 0x0f387, 0x0e237, 0x0fe47, 0x0f383, - 0x0f091, 0x0f385, 0x0e233, 0x182ee, 0x19eb8, 0x1663e, 0x0f093, 0x00014, - 0x00058, 0x00159, 0x00167, 0x00300, 0x003d4, 0x005b5, 0x0079d, 0x0076a, - 0x00b67, 0x00b60, 0x00f05, 0x00cf0, 0x00f17, 0x00e95, 0x01822, 0x01913, - 0x016c2, 0x0182f, 0x01959, 0x01fcb, 0x01e27, 0x01c40, 0x033c7, 0x01e7b, - 0x01c49, 0x02d89, 0x01e23, 0x01660, 0x03f12, 0x02cc6, 0x033e1, 0x05b34, - 0x0609a, 0x06569, 0x07488, 0x07e21, 0x0cf5f, 0x0712c, 0x0389d, 0x067cf, - 0x07f28, 0x1663f, 0x33d67, 0x1663d, 0x1e25d, 0x3c1ab, 0x15c44, 0x16c36, - 0x0001f, 0x000ec, 0x00323, 0x005b2, 0x0079f, 0x00ac2, 0x00f16, 0x00e9e, - 0x01956, 0x01e0f, 0x019ea, 0x01666, 0x02b89, 0x02b02, 0x02d8c, 0x03c1b, - 0x03c19, 0x032b5, 0x03f9c, 0x02ccf, 0x03897, 0x05b35, 0x0ad02, 0x07f29, - 0x06441, 0x03884, 0x07888, 0x0784e, 0x06568, 0x0c1bb, 0x05986, 0x067cc, - 0x0fe49, 0x0fe48, 0x0c1bc, 0x0fe41, 0x18371, 0x1663c, 0x0e231, 0x0711e, - 0x0ad09, 0x0f092, 0x0002d, 0x001db, 0x00781, 0x00c1a, 0x00f55, 0x01580, - 0x01ea8, 0x02d9b, 0x032af, 0x03f16, 0x03c1c, 0x07834, 0x03c45, 0x0389c, - 0x067ce, 0x06445, 0x0c1b9, 0x07889, 0x07f3a, 0x0784f, 0x07f2b, 0x0ad0b, - 0x0f090, 0x0c11d, 0x0e94e, 0x0711f, 0x0e9f1, 0x0f38e, 0x079e9, 0x0ad03, - 0x0f09b, 0x0caae, 0x0fe46, 0x2b4e6, 0x0e9f0, 0x19eb6, 0x67ac1, 0x67ac0, - 0x33d66, 0x0f388, 0x00071, 0x003a0, 0x00ca9, 0x01829, 0x01d39, 0x02b43, - 0x02cc4, 0x06554, 0x0f09a, 0x0b61f, 0x067cd, 0x0711c, 0x0b636, 0x07f2a, - 0x0b634, 0x0c11f, 0x0cf5e, 0x0b61d, 0x0f06b, 0x0caab, 0x0c1be, 0x0e94c, - 0x0f099, 0x182ed, 0x0e94f, 0x0c119, 0x0e232, 0x2b4e4, 0x0f38a, 0x19eb4, - 0x1e25f, 0x0e94d, 0x000b7, 0x00785, 0x016cc, 0x03051, 0x033c4, 0x0656f, - 0x03891, 0x0711d, 0x0caaf, 0x0f097, 0x07489, 0x0f098, 0x0c880, 0x0caaa, - 0x0f386, 0x19eb7, 0x16c6f, 0x0f384, 0x182e8, 0x182e9, 0x0e230, 0x1e700, - 0x33d62, 0x33d63, 0x33d64, 0x16c33, 0x0e216, 0x000fd, 0x00c15, 0x01665, - 0x03c4a, 0x07f3b, 0x07896, 0x0c11c, 0x0e215, 0x16c32, 0x0f38b, 0x0f38d, - 0x182ea, 0x1e701, 0x712df, 0x15c46, 0x00194, 0x00fe0, 0x03f13, 0x0748b, - 0x0f096, 0x0cf80, 0x1e25e, 0xe25bd, 0x33d61, 0x16c31, 0x001f9, 0x01912, - 0x05710, 0x0f3d0, 0x0c1bf, 0x00301, 0x01e24, 0x0ad08, 0x003cd, 0x01c41, - 0x0c1bd, 0x00563, 0x03a52, 0x0f3d1, 0x00570, 0x02cce, 0x0e217, 0x0067b, - 0x0655d, 0x0074b, 0x06447, 0x00c12, 0x074fb, 0x00f08, 0x0b61c, 0x00e22, - 0x0fe43, 0x016c7, 0x01836, 0x019f2, 0x01c43, 0x01d3f, 0x01fcf, 0x02b4c, - 0x0304c, 0x032b6, 0x03a46, 0x05607, 0x03f17, 0x02cc5, 0x0609b, 0x0655c, - 0x07e23, 0x067c1, 0x07f26, 0x07f27, 0x0f095, 0x0e9f3, 0x0cf81, 0x0c11e, - 0x0caac, 0x0f38f, 0x0e9f2, 0x074fa, 0x0e236, 0x0fe45, 0x1c428, 0x0e235, - 0x182ef, 0x19eb5, 0x0f3d6, 0x182ec, 0x16c35, 0x0f38c, 0x2b4e7, 0x15c47, - 0xe25bc, 0x1e702, 0x1c4b6, 0x0e25a, 0x3c1aa, 0x15c45, 0x1c429, 0x19eb9, - 0x1e7af, 0x182eb, 0x1e0d4, 0x3896e, -}; - -static const uint8_t coef4_huffbits[476] = { - 12, 6, 2, 3, 4, 4, 5, 5, - 5, 6, 6, 6, 6, 6, 7, 7, - 7, 7, 7, 8, 8, 8, 8, 8, - 8, 9, 9, 9, 9, 9, 9, 9, - 10, 10, 10, 10, 10, 10, 10, 11, - 10, 11, 11, 11, 11, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 13, 13, 13, 13, 13, 13, - 13, 13, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 16, 16, - 16, 15, 15, 15, 15, 15, 16, 16, - 15, 16, 16, 17, 16, 16, 16, 17, - 18, 18, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 4, 6, 7, 8, 8, - 8, 9, 9, 10, 10, 10, 10, 10, - 10, 11, 11, 11, 11, 11, 11, 11, - 12, 12, 12, 12, 12, 12, 12, 12, - 12, 13, 13, 13, 14, 13, 14, 14, - 14, 13, 13, 14, 14, 16, 16, 15, - 16, 16, 16, 15, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 17, 16, 16, - 16, 16, 17, 17, 17, 18, 16, 5, - 8, 9, 10, 10, 10, 11, 11, 12, - 12, 12, 12, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 14, 14, 13, - 14, 14, 13, 14, 14, 15, 14, 15, - 15, 15, 16, 15, 16, 16, 15, 15, - 15, 18, 18, 18, 17, 18, 17, 17, - 6, 9, 10, 11, 11, 12, 12, 13, - 13, 13, 13, 14, 14, 14, 14, 14, - 14, 14, 14, 15, 15, 15, 16, 15, - 15, 15, 15, 15, 15, 16, 16, 15, - 16, 16, 16, 16, 17, 18, 17, 16, - 16, 16, 7, 10, 11, 12, 12, 13, - 13, 14, 14, 14, 14, 15, 14, 15, - 15, 15, 16, 15, 15, 15, 15, 16, - 16, 16, 17, 16, 17, 16, 15, 16, - 16, 16, 16, 18, 17, 17, 19, 19, - 18, 16, 7, 11, 12, 13, 14, 14, - 15, 15, 16, 16, 15, 16, 16, 15, - 16, 16, 16, 16, 16, 16, 16, 17, - 16, 17, 17, 16, 17, 18, 16, 17, - 17, 17, 8, 11, 13, 14, 14, 15, - 15, 16, 16, 16, 16, 16, 16, 16, - 16, 17, 17, 16, 17, 17, 17, 17, - 18, 18, 18, 17, 17, 8, 12, 14, - 14, 15, 15, 16, 17, 17, 16, 16, - 17, 17, 20, 17, 9, 12, 14, 16, - 16, 16, 17, 21, 18, 17, 9, 13, - 15, 16, 16, 10, 13, 16, 10, 14, - 16, 11, 15, 16, 11, 15, 17, 11, - 15, 12, 15, 12, 16, 12, 16, 13, - 16, 13, 13, 13, 14, 14, 13, 14, - 14, 14, 15, 15, 14, 15, 15, 15, - 15, 15, 15, 15, 16, 17, 16, 16, - 16, 16, 17, 16, 17, 16, 18, 17, - 17, 17, 16, 17, 17, 16, 18, 17, - 21, 17, 18, 17, 18, 17, 18, 17, - 17, 17, 17, 19, -}; - -static const uint32_t coef5_huffcodes[435] = { - 0x00347, 0x0000b, 0x00001, 0x00001, 0x0000c, 0x00004, 0x00010, 0x00015, - 0x0001f, 0x0000b, 0x00023, 0x00026, 0x00029, 0x00035, 0x00037, 0x00001, - 0x00015, 0x0001a, 0x0001d, 0x0001c, 0x0001e, 0x0004e, 0x00049, 0x00051, - 0x00078, 0x00004, 0x00000, 0x00008, 0x0000d, 0x0007b, 0x00005, 0x00032, - 0x00095, 0x00091, 0x00096, 0x000a1, 0x000d9, 0x00003, 0x00019, 0x00061, - 0x00066, 0x00060, 0x00017, 0x0000e, 0x00063, 0x001a0, 0x001b7, 0x001e6, - 0x001e7, 0x001b6, 0x00018, 0x001e8, 0x00038, 0x00031, 0x00005, 0x0003d, - 0x00027, 0x001ea, 0x0001a, 0x000c5, 0x000f9, 0x000ff, 0x000db, 0x00250, - 0x000fc, 0x0025c, 0x00008, 0x00075, 0x003d7, 0x003d3, 0x001b0, 0x0007c, - 0x003ca, 0x00036, 0x00189, 0x004a6, 0x004a2, 0x004fb, 0x000c0, 0x0007f, - 0x0009a, 0x00311, 0x0006e, 0x0009b, 0x0068c, 0x006c0, 0x00484, 0x00012, - 0x000c3, 0x0094f, 0x00979, 0x009f9, 0x00d09, 0x00da6, 0x00da8, 0x00901, - 0x000c1, 0x00373, 0x00d08, 0x009fa, 0x00d8b, 0x00d85, 0x00d86, 0x000df, - 0x006e2, 0x000ce, 0x00f24, 0x009fe, 0x001f7, 0x007c1, 0x000cf, 0x009fc, - 0x009ff, 0x00d89, 0x00da9, 0x009fd, 0x001f8, 0x01a36, 0x0128c, 0x0129d, - 0x01a37, 0x00196, 0x003ea, 0x00f8b, 0x00d93, 0x01e45, 0x01e58, 0x01e4b, - 0x01e59, 0x013f1, 0x00309, 0x00265, 0x00308, 0x0243a, 0x027e1, 0x00f89, - 0x00324, 0x03cbc, 0x03c86, 0x03695, 0x0243c, 0x0243b, 0x0243e, 0x01e4a, - 0x003a5, 0x03468, 0x03428, 0x03c84, 0x027e0, 0x025e2, 0x01880, 0x00197, - 0x00325, 0x03cb7, 0x0791e, 0x007ec, 0x06c75, 0x004c8, 0x04bc7, 0x004c6, - 0x00983, 0x0481e, 0x01b53, 0x0251b, 0x01b58, 0x00984, 0x04fa8, 0x03cbb, - 0x00f8a, 0x00322, 0x0346a, 0x0243d, 0x00326, 0x03469, 0x0481f, 0x0481d, - 0x00746, 0x09032, 0x01b50, 0x01d13, 0x0d8e4, 0x0481b, 0x06c74, 0x0796b, - 0x07969, 0x00985, 0x0d8e3, 0x00986, 0x00fa2, 0x01301, 0x06c7c, 0x00987, - 0x03cb8, 0x0f4af, 0x00e88, 0x1b1c0, 0x00fce, 0x033eb, 0x03f6a, 0x03f69, - 0x00fcf, 0x0791f, 0x004c9, 0x04871, 0x00fcd, 0x00982, 0x00fcc, 0x00fa3, - 0x01d12, 0x0796c, 0x01b47, 0x00321, 0x0796a, 0x0d8e2, 0x04872, 0x04873, - 0x0000e, 0x00014, 0x0000a, 0x000a0, 0x00012, 0x0007d, 0x001a2, 0x0003b, - 0x0025f, 0x000dd, 0x0027c, 0x00343, 0x00368, 0x0036b, 0x0003e, 0x001fa, - 0x00485, 0x001b3, 0x0007f, 0x001b1, 0x0019e, 0x004ba, 0x007ad, 0x00339, - 0x00066, 0x007a4, 0x00793, 0x006c6, 0x0007e, 0x000f1, 0x00372, 0x009fb, - 0x00d83, 0x00d8a, 0x00947, 0x009f4, 0x001d0, 0x01b09, 0x01b4b, 0x007ec, - 0x003e1, 0x000ca, 0x003ec, 0x02539, 0x04fa9, 0x01b57, 0x03429, 0x03d2a, - 0x00d97, 0x003a7, 0x00dc0, 0x00d96, 0x00dc1, 0x007eb, 0x03cba, 0x00c43, - 0x00c41, 0x01b52, 0x007ef, 0x00323, 0x03cb9, 0x03c83, 0x007d0, 0x007ed, - 0x06c7f, 0x09033, 0x03f6c, 0x36383, 0x1e95d, 0x06c78, 0x00747, 0x01b51, - 0x00022, 0x00016, 0x00039, 0x00252, 0x00079, 0x00486, 0x00338, 0x00369, - 0x00d88, 0x00026, 0x00d87, 0x00f4b, 0x00d82, 0x00027, 0x001e1, 0x01a15, - 0x007c7, 0x012f0, 0x001e0, 0x006d0, 0x01a16, 0x01e44, 0x01e5f, 0x03690, - 0x00d90, 0x00c42, 0x00daf, 0x00d92, 0x00f80, 0x00cfb, 0x0342f, 0x0487f, - 0x01b46, 0x07968, 0x00d95, 0x00d91, 0x01b55, 0x03f68, 0x04bc6, 0x03cbd, - 0x00f81, 0x00320, 0x00069, 0x000fe, 0x006d5, 0x0033f, 0x000de, 0x007c6, - 0x01e40, 0x00d94, 0x00f88, 0x03c8e, 0x03694, 0x00dae, 0x00dad, 0x00267, - 0x003a6, 0x00327, 0x0487e, 0x007ee, 0x00749, 0x004c7, 0x03692, 0x01b56, - 0x00fd1, 0x07a56, 0x06c77, 0x09031, 0x00748, 0x06c7a, 0x0796d, 0x033ea, - 0x06c76, 0x00fd0, 0x36382, 0x1e417, 0x00745, 0x04faf, 0x0d8e1, 0x03f6b, - 0x1e95c, 0x04fad, 0x0009e, 0x004bd, 0x0067c, 0x01b08, 0x003eb, 0x01b45, - 0x03691, 0x0d8e5, 0x07904, 0x00981, 0x007ea, 0x019f4, 0x06c7d, 0x04fab, - 0x04fac, 0x06c7e, 0x01300, 0x06c7b, 0x0006f, 0x003f7, 0x03c85, 0x004c4, - 0x0001e, 0x006e1, 0x03693, 0x01b44, 0x00241, 0x01e46, 0x0019d, 0x00266, - 0x004bb, 0x02538, 0x007ac, 0x01b54, 0x00902, 0x04870, 0x00da7, 0x00900, - 0x00185, 0x06c79, 0x006e3, 0x003e9, 0x01e94, 0x003ed, 0x003f2, 0x0342e, - 0x0346b, 0x0251a, 0x004c5, 0x01881, 0x0481c, 0x01b59, 0x03c87, 0x04fae, - 0x007e9, 0x03f6d, 0x0f20a, 0x09030, 0x04faa, 0x0d8e6, 0x03f6f, 0x0481a, - 0x03f6e, 0x1e416, 0x0d8e7, -}; - -static const uint8_t coef5_huffbits[435] = { - 10, 4, 2, 4, 4, 5, 5, 5, - 5, 6, 6, 6, 6, 6, 6, 7, - 7, 7, 7, 7, 7, 7, 7, 7, - 7, 8, 8, 8, 8, 7, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 10, 9, 10, 10, 10, 10, - 10, 9, 10, 10, 10, 10, 10, 10, - 10, 10, 11, 11, 10, 10, 11, 11, - 10, 11, 11, 11, 11, 11, 12, 12, - 12, 12, 12, 12, 11, 11, 11, 12, - 12, 12, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 13, - 13, 13, 12, 12, 13, 13, 13, 12, - 12, 12, 12, 12, 13, 13, 13, 13, - 13, 14, 14, 14, 14, 13, 13, 13, - 13, 13, 14, 14, 14, 14, 14, 14, - 15, 14, 14, 14, 14, 14, 14, 13, - 14, 14, 14, 14, 14, 14, 15, 14, - 15, 14, 15, 15, 15, 15, 15, 15, - 16, 15, 15, 14, 15, 16, 15, 14, - 14, 15, 14, 14, 15, 14, 15, 15, - 15, 16, 15, 17, 16, 15, 15, 15, - 15, 16, 16, 16, 16, 17, 15, 16, - 14, 16, 16, 17, 16, 16, 16, 16, - 16, 15, 15, 15, 16, 16, 16, 16, - 17, 15, 15, 15, 15, 16, 15, 15, - 4, 7, 8, 8, 9, 9, 9, 10, - 10, 10, 10, 10, 10, 10, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 12, - 12, 11, 11, 11, 12, 12, 12, 12, - 12, 12, 12, 12, 13, 13, 13, 13, - 12, 13, 14, 14, 15, 15, 14, 14, - 14, 14, 14, 14, 14, 15, 14, 14, - 14, 15, 15, 15, 14, 14, 15, 15, - 15, 16, 16, 18, 17, 15, 15, 15, - 6, 9, 10, 10, 11, 11, 12, 12, - 12, 13, 12, 12, 12, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 14, 14, 15, - 15, 15, 14, 14, 15, 16, 15, 14, - 14, 15, 7, 10, 11, 12, 13, 13, - 13, 14, 14, 14, 14, 14, 14, 14, - 14, 15, 15, 15, 15, 15, 14, 15, - 16, 15, 15, 16, 15, 15, 15, 16, - 15, 16, 18, 17, 15, 15, 16, 16, - 17, 15, 8, 11, 13, 13, 14, 15, - 14, 16, 15, 16, 15, 15, 15, 15, - 15, 15, 17, 15, 9, 12, 14, 15, - 10, 13, 14, 15, 10, 13, 11, 14, - 11, 14, 11, 15, 12, 15, 12, 12, - 13, 15, 13, 14, 13, 14, 14, 14, - 14, 14, 15, 15, 15, 15, 14, 15, - 15, 16, 16, 16, 15, 16, 16, 15, - 16, 17, 16, -}; - -static const uint16_t levels0[60] = { -317, 92, 62, 60, 19, 17, 10, 7, - 6, 5, 5, 3, 3, 3, 2, 2, - 2, 2, 2, 2, 2, 1, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, -}; - -static const uint16_t levels1[40] = { -311, 91, 61, 28, 10, 6, 5, 2, - 2, 2, 2, 2, 2, 2, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -}; - -static const uint16_t levels2[340] = { -181,110, 78, 63, 61, 62, 60, 61, - 33, 41, 41, 19, 17, 19, 12, 11, - 9, 11, 10, 6, 8, 7, 6, 4, - 5, 5, 4, 4, 3, 4, 3, 5, - 3, 4, 3, 3, 3, 3, 3, 3, - 2, 2, 4, 2, 3, 2, 3, 3, - 2, 2, 2, 2, 2, 2, 2, 2, - 3, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 2, 1, 2, 2, - 2, 2, 1, 2, 1, 1, 1, 2, - 2, 1, 2, 1, 2, 2, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, -}; - -static const uint16_t levels3[180] = { -351,122, 76, 61, 41, 42, 24, 30, - 22, 19, 11, 9, 10, 8, 5, 5, - 4, 5, 5, 3, 3, 3, 3, 3, - 3, 3, 2, 2, 3, 2, 2, 2, - 3, 3, 2, 2, 2, 3, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 1, - 2, 2, 1, 2, 1, 2, 2, 2, - 2, 2, 2, 1, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, - 2, 1, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, -}; - -static const uint16_t levels4[70] = { -113, 68, 49, 42, 40, 32, 27, 15, - 10, 5, 3, 3, 3, 3, 2, 2, - 2, 2, 2, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, -}; - -static const uint16_t levels5[40] = { -214, 72, 42, 40, 18, 4, 4, 2, - 2, 2, 2, 2, 1, 1, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, -}; - -static const CoefVLCTable coef_vlcs[6] = { - { - sizeof(coef0_huffbits), sizeof(levels0)/2, coef0_huffcodes, coef0_huffbits, levels0, - }, - { - sizeof(coef1_huffbits), sizeof(levels1)/2, coef1_huffcodes, coef1_huffbits, levels1, - }, - { - sizeof(coef2_huffbits), sizeof(levels2)/2, coef2_huffcodes, coef2_huffbits, levels2, - }, - { - sizeof(coef3_huffbits), sizeof(levels3)/2, coef3_huffcodes, coef3_huffbits, levels3, - }, - { - sizeof(coef4_huffbits), sizeof(levels4)/2, coef4_huffcodes, coef4_huffbits, levels4, - }, - { - sizeof(coef5_huffbits), sizeof(levels5)/2, coef5_huffcodes, coef5_huffbits, levels5, - }, -}; - -#endif /* AVCODEC_WMADATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadec.c deleted file mode 100644 index b1816b4ee..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmadec.c +++ /dev/null @@ -1,982 +0,0 @@ -/* - * WMA compatible decoder - * Copyright (c) 2002 The FFmpeg Project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * WMA compatible decoder. - * This decoder handles Microsoft Windows Media Audio data, versions 1 & 2. - * WMA v1 is identified by audio format 0x160 in Microsoft media files - * (ASF/AVI/WAV). WMA v2 is identified by audio format 0x161. - * - * To use this decoder, a calling application must supply the extra data - * bytes provided with the WMA data. These are the extra, codec-specific - * bytes at the end of a WAVEFORMATEX data structure. Transmit these bytes - * to the decoder using the extradata[_size] fields in AVCodecContext. There - * should be 4 extra bytes for v1 data and 6 extra bytes for v2 data. - */ - -#include "libavutil/attributes.h" -#include "avcodec.h" -#include "internal.h" -#include "wma.h" - -#undef NDEBUG -#include - -#define EXPVLCBITS 8 -#define EXPMAX ((19+EXPVLCBITS-1)/EXPVLCBITS) - -#define HGAINVLCBITS 9 -#define HGAINMAX ((13+HGAINVLCBITS-1)/HGAINVLCBITS) - -static void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len); - -#ifdef TRACE -static void dump_floats(WMACodecContext *s, const char *name, int prec, const float *tab, int n) -{ - int i; - - tprintf(s->avctx, "%s[%d]:\n", name, n); - for(i=0;iavctx, "%4d: ", i); - tprintf(s->avctx, " %8.*f", prec, tab[i]); - if ((i & 7) == 7) - tprintf(s->avctx, "\n"); - } - if ((i & 7) != 0) - tprintf(s->avctx, "\n"); -} -#endif - -static av_cold int wma_decode_init(AVCodecContext * avctx) -{ - WMACodecContext *s = avctx->priv_data; - int i, flags2; - uint8_t *extradata; - - if (!avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); - return AVERROR(EINVAL); - } - - s->avctx = avctx; - - /* extract flag infos */ - flags2 = 0; - extradata = avctx->extradata; - if (avctx->codec->id == AV_CODEC_ID_WMAV1 && avctx->extradata_size >= 4) { - flags2 = AV_RL16(extradata+2); - } else if (avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 6) { - flags2 = AV_RL16(extradata+4); - } - - s->use_exp_vlc = flags2 & 0x0001; - s->use_bit_reservoir = flags2 & 0x0002; - s->use_variable_block_len = flags2 & 0x0004; - - if(avctx->codec->id == AV_CODEC_ID_WMAV2 && avctx->extradata_size >= 8){ - if(AV_RL16(extradata+4)==0xd && s->use_variable_block_len){ - av_log(avctx, AV_LOG_WARNING, "Disabling use_variable_block_len, if this fails contact the ffmpeg developers and send us the file\n"); - s->use_variable_block_len= 0; // this fixes issue1503 - } - } - - for (i=0; imax_exponent[i] = 1.0; - - if(ff_wma_init(avctx, flags2)<0) - return -1; - - /* init MDCT */ - for(i = 0; i < s->nb_block_sizes; i++) - ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 1, 1.0 / 32768.0); - - if (s->use_noise_coding) { - init_vlc(&s->hgain_vlc, HGAINVLCBITS, sizeof(ff_wma_hgain_huffbits), - ff_wma_hgain_huffbits, 1, 1, - ff_wma_hgain_huffcodes, 2, 2, 0); - } - - if (s->use_exp_vlc) { - init_vlc(&s->exp_vlc, EXPVLCBITS, sizeof(ff_aac_scalefactor_bits), //FIXME move out of context - ff_aac_scalefactor_bits, 1, 1, - ff_aac_scalefactor_code, 4, 4, 0); - } else { - wma_lsp_to_curve_init(s, s->frame_len); - } - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - return 0; -} - -/** - * compute x^-0.25 with an exponent and mantissa table. We use linear - * interpolation to reduce the mantissa table size at a small speed - * expense (linear interpolation approximately doubles the number of - * bits of precision). - */ -static inline float pow_m1_4(WMACodecContext *s, float x) -{ - union { - float f; - unsigned int v; - } u, t; - unsigned int e, m; - float a, b; - - u.f = x; - e = u.v >> 23; - m = (u.v >> (23 - LSP_POW_BITS)) & ((1 << LSP_POW_BITS) - 1); - /* build interpolation scale: 1 <= t < 2. */ - t.v = ((u.v << LSP_POW_BITS) & ((1 << 23) - 1)) | (127 << 23); - a = s->lsp_pow_m_table1[m]; - b = s->lsp_pow_m_table2[m]; - return s->lsp_pow_e_table[e] * (a + b * t.f); -} - -static av_cold void wma_lsp_to_curve_init(WMACodecContext *s, int frame_len) -{ - float wdel, a, b; - int i, e, m; - - wdel = M_PI / frame_len; - for(i=0;ilsp_cos_table[i] = 2.0f * cos(wdel * i); - - /* tables for x^-0.25 computation */ - for(i=0;i<256;i++) { - e = i - 126; - s->lsp_pow_e_table[i] = pow(2.0, e * -0.25); - } - - /* NOTE: these two tables are needed to avoid two operations in - pow_m1_4 */ - b = 1.0; - for(i=(1 << LSP_POW_BITS) - 1;i>=0;i--) { - m = (1 << LSP_POW_BITS) + i; - a = (float)m * (0.5 / (1 << LSP_POW_BITS)); - a = pow(a, -0.25); - s->lsp_pow_m_table1[i] = 2 * a - b; - s->lsp_pow_m_table2[i] = b - a; - b = a; - } -} - -/** - * NOTE: We use the same code as Vorbis here - * @todo optimize it further with SSE/3Dnow - */ -static void wma_lsp_to_curve(WMACodecContext *s, - float *out, float *val_max_ptr, - int n, float *lsp) -{ - int i, j; - float p, q, w, v, val_max; - - val_max = 0; - for(i=0;ilsp_cos_table[i]; - for(j=1;j val_max) - val_max = v; - out[i] = v; - } - *val_max_ptr = val_max; -} - -/** - * decode exponents coded with LSP coefficients (same idea as Vorbis) - */ -static void decode_exp_lsp(WMACodecContext *s, int ch) -{ - float lsp_coefs[NB_LSP_COEFS]; - int val, i; - - for(i = 0; i < NB_LSP_COEFS; i++) { - if (i == 0 || i >= 8) - val = get_bits(&s->gb, 3); - else - val = get_bits(&s->gb, 4); - lsp_coefs[i] = ff_wma_lsp_codebook[i][val]; - } - - wma_lsp_to_curve(s, s->exponents[ch], &s->max_exponent[ch], - s->block_len, lsp_coefs); -} - -/** pow(10, i / 16.0) for i in -60..95 */ -static const float pow_tab[] = { - 1.7782794100389e-04, 2.0535250264571e-04, - 2.3713737056617e-04, 2.7384196342644e-04, - 3.1622776601684e-04, 3.6517412725484e-04, - 4.2169650342858e-04, 4.8696752516586e-04, - 5.6234132519035e-04, 6.4938163157621e-04, - 7.4989420933246e-04, 8.6596432336006e-04, - 1.0000000000000e-03, 1.1547819846895e-03, - 1.3335214321633e-03, 1.5399265260595e-03, - 1.7782794100389e-03, 2.0535250264571e-03, - 2.3713737056617e-03, 2.7384196342644e-03, - 3.1622776601684e-03, 3.6517412725484e-03, - 4.2169650342858e-03, 4.8696752516586e-03, - 5.6234132519035e-03, 6.4938163157621e-03, - 7.4989420933246e-03, 8.6596432336006e-03, - 1.0000000000000e-02, 1.1547819846895e-02, - 1.3335214321633e-02, 1.5399265260595e-02, - 1.7782794100389e-02, 2.0535250264571e-02, - 2.3713737056617e-02, 2.7384196342644e-02, - 3.1622776601684e-02, 3.6517412725484e-02, - 4.2169650342858e-02, 4.8696752516586e-02, - 5.6234132519035e-02, 6.4938163157621e-02, - 7.4989420933246e-02, 8.6596432336007e-02, - 1.0000000000000e-01, 1.1547819846895e-01, - 1.3335214321633e-01, 1.5399265260595e-01, - 1.7782794100389e-01, 2.0535250264571e-01, - 2.3713737056617e-01, 2.7384196342644e-01, - 3.1622776601684e-01, 3.6517412725484e-01, - 4.2169650342858e-01, 4.8696752516586e-01, - 5.6234132519035e-01, 6.4938163157621e-01, - 7.4989420933246e-01, 8.6596432336007e-01, - 1.0000000000000e+00, 1.1547819846895e+00, - 1.3335214321633e+00, 1.5399265260595e+00, - 1.7782794100389e+00, 2.0535250264571e+00, - 2.3713737056617e+00, 2.7384196342644e+00, - 3.1622776601684e+00, 3.6517412725484e+00, - 4.2169650342858e+00, 4.8696752516586e+00, - 5.6234132519035e+00, 6.4938163157621e+00, - 7.4989420933246e+00, 8.6596432336007e+00, - 1.0000000000000e+01, 1.1547819846895e+01, - 1.3335214321633e+01, 1.5399265260595e+01, - 1.7782794100389e+01, 2.0535250264571e+01, - 2.3713737056617e+01, 2.7384196342644e+01, - 3.1622776601684e+01, 3.6517412725484e+01, - 4.2169650342858e+01, 4.8696752516586e+01, - 5.6234132519035e+01, 6.4938163157621e+01, - 7.4989420933246e+01, 8.6596432336007e+01, - 1.0000000000000e+02, 1.1547819846895e+02, - 1.3335214321633e+02, 1.5399265260595e+02, - 1.7782794100389e+02, 2.0535250264571e+02, - 2.3713737056617e+02, 2.7384196342644e+02, - 3.1622776601684e+02, 3.6517412725484e+02, - 4.2169650342858e+02, 4.8696752516586e+02, - 5.6234132519035e+02, 6.4938163157621e+02, - 7.4989420933246e+02, 8.6596432336007e+02, - 1.0000000000000e+03, 1.1547819846895e+03, - 1.3335214321633e+03, 1.5399265260595e+03, - 1.7782794100389e+03, 2.0535250264571e+03, - 2.3713737056617e+03, 2.7384196342644e+03, - 3.1622776601684e+03, 3.6517412725484e+03, - 4.2169650342858e+03, 4.8696752516586e+03, - 5.6234132519035e+03, 6.4938163157621e+03, - 7.4989420933246e+03, 8.6596432336007e+03, - 1.0000000000000e+04, 1.1547819846895e+04, - 1.3335214321633e+04, 1.5399265260595e+04, - 1.7782794100389e+04, 2.0535250264571e+04, - 2.3713737056617e+04, 2.7384196342644e+04, - 3.1622776601684e+04, 3.6517412725484e+04, - 4.2169650342858e+04, 4.8696752516586e+04, - 5.6234132519035e+04, 6.4938163157621e+04, - 7.4989420933246e+04, 8.6596432336007e+04, - 1.0000000000000e+05, 1.1547819846895e+05, - 1.3335214321633e+05, 1.5399265260595e+05, - 1.7782794100389e+05, 2.0535250264571e+05, - 2.3713737056617e+05, 2.7384196342644e+05, - 3.1622776601684e+05, 3.6517412725484e+05, - 4.2169650342858e+05, 4.8696752516586e+05, - 5.6234132519035e+05, 6.4938163157621e+05, - 7.4989420933246e+05, 8.6596432336007e+05, -}; - -/** - * decode exponents coded with VLC codes - */ -static int decode_exp_vlc(WMACodecContext *s, int ch) -{ - int last_exp, n, code; - const uint16_t *ptr; - float v, max_scale; - uint32_t *q, *q_end, iv; - const float *ptab = pow_tab + 60; - const uint32_t *iptab = (const uint32_t*)ptab; - - ptr = s->exponent_bands[s->frame_len_bits - s->block_len_bits]; - q = (uint32_t *)s->exponents[ch]; - q_end = q + s->block_len; - max_scale = 0; - if (s->version == 1) { - last_exp = get_bits(&s->gb, 5) + 10; - v = ptab[last_exp]; - iv = iptab[last_exp]; - max_scale = v; - n = *ptr++; - switch (n & 3) do { - case 0: *q++ = iv; - case 3: *q++ = iv; - case 2: *q++ = iv; - case 1: *q++ = iv; - } while ((n -= 4) > 0); - }else - last_exp = 36; - - while (q < q_end) { - code = get_vlc2(&s->gb, s->exp_vlc.table, EXPVLCBITS, EXPMAX); - if (code < 0){ - av_log(s->avctx, AV_LOG_ERROR, "Exponent vlc invalid\n"); - return -1; - } - /* NOTE: this offset is the same as MPEG4 AAC ! */ - last_exp += code - 60; - if ((unsigned)last_exp + 60 >= FF_ARRAY_ELEMS(pow_tab)) { - av_log(s->avctx, AV_LOG_ERROR, "Exponent out of range: %d\n", - last_exp); - return -1; - } - v = ptab[last_exp]; - iv = iptab[last_exp]; - if (v > max_scale) - max_scale = v; - n = *ptr++; - switch (n & 3) do { - case 0: *q++ = iv; - case 3: *q++ = iv; - case 2: *q++ = iv; - case 1: *q++ = iv; - } while ((n -= 4) > 0); - } - s->max_exponent[ch] = max_scale; - return 0; -} - - -/** - * Apply MDCT window and add into output. - * - * We ensure that when the windows overlap their squared sum - * is always 1 (MDCT reconstruction rule). - */ -static void wma_window(WMACodecContext *s, float *out) -{ - float *in = s->output; - int block_len, bsize, n; - - /* left part */ - if (s->block_len_bits <= s->prev_block_len_bits) { - block_len = s->block_len; - bsize = s->frame_len_bits - s->block_len_bits; - - s->fdsp.vector_fmul_add(out, in, s->windows[bsize], - out, block_len); - - } else { - block_len = 1 << s->prev_block_len_bits; - n = (s->block_len - block_len) / 2; - bsize = s->frame_len_bits - s->prev_block_len_bits; - - s->fdsp.vector_fmul_add(out+n, in+n, s->windows[bsize], - out+n, block_len); - - memcpy(out+n+block_len, in+n+block_len, n*sizeof(float)); - } - - out += s->block_len; - in += s->block_len; - - /* right part */ - if (s->block_len_bits <= s->next_block_len_bits) { - block_len = s->block_len; - bsize = s->frame_len_bits - s->block_len_bits; - - s->fdsp.vector_fmul_reverse(out, in, s->windows[bsize], block_len); - - } else { - block_len = 1 << s->next_block_len_bits; - n = (s->block_len - block_len) / 2; - bsize = s->frame_len_bits - s->next_block_len_bits; - - memcpy(out, in, n*sizeof(float)); - - s->fdsp.vector_fmul_reverse(out+n, in+n, s->windows[bsize], block_len); - - memset(out+n+block_len, 0, n*sizeof(float)); - } -} - - -/** - * @return 0 if OK. 1 if last block of frame. return -1 if - * unrecorrable error. - */ -static int wma_decode_block(WMACodecContext *s) -{ - int n, v, a, ch, bsize; - int coef_nb_bits, total_gain; - int nb_coefs[MAX_CHANNELS]; - float mdct_norm; - FFTContext *mdct; - -#ifdef TRACE - tprintf(s->avctx, "***decode_block: %d:%d\n", s->frame_count - 1, s->block_num); -#endif - - /* compute current block length */ - if (s->use_variable_block_len) { - n = av_log2(s->nb_block_sizes - 1) + 1; - - if (s->reset_block_lengths) { - s->reset_block_lengths = 0; - v = get_bits(&s->gb, n); - if (v >= s->nb_block_sizes){ - av_log(s->avctx, AV_LOG_ERROR, "prev_block_len_bits %d out of range\n", s->frame_len_bits - v); - return -1; - } - s->prev_block_len_bits = s->frame_len_bits - v; - v = get_bits(&s->gb, n); - if (v >= s->nb_block_sizes){ - av_log(s->avctx, AV_LOG_ERROR, "block_len_bits %d out of range\n", s->frame_len_bits - v); - return -1; - } - s->block_len_bits = s->frame_len_bits - v; - } else { - /* update block lengths */ - s->prev_block_len_bits = s->block_len_bits; - s->block_len_bits = s->next_block_len_bits; - } - v = get_bits(&s->gb, n); - if (v >= s->nb_block_sizes){ - av_log(s->avctx, AV_LOG_ERROR, "next_block_len_bits %d out of range\n", s->frame_len_bits - v); - return -1; - } - s->next_block_len_bits = s->frame_len_bits - v; - } else { - /* fixed block len */ - s->next_block_len_bits = s->frame_len_bits; - s->prev_block_len_bits = s->frame_len_bits; - s->block_len_bits = s->frame_len_bits; - } - - if (s->frame_len_bits - s->block_len_bits >= s->nb_block_sizes){ - av_log(s->avctx, AV_LOG_ERROR, "block_len_bits not initialized to a valid value\n"); - return -1; - } - - /* now check if the block length is coherent with the frame length */ - s->block_len = 1 << s->block_len_bits; - if ((s->block_pos + s->block_len) > s->frame_len){ - av_log(s->avctx, AV_LOG_ERROR, "frame_len overflow\n"); - return -1; - } - - if (s->avctx->channels == 2) { - s->ms_stereo = get_bits1(&s->gb); - } - v = 0; - for(ch = 0; ch < s->avctx->channels; ch++) { - a = get_bits1(&s->gb); - s->channel_coded[ch] = a; - v |= a; - } - - bsize = s->frame_len_bits - s->block_len_bits; - - /* if no channel coded, no need to go further */ - /* XXX: fix potential framing problems */ - if (!v) - goto next; - - /* read total gain and extract corresponding number of bits for - coef escape coding */ - total_gain = 1; - for(;;) { - if (get_bits_left(&s->gb) < 7) { - av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n"); - return AVERROR_INVALIDDATA; - } - a = get_bits(&s->gb, 7); - total_gain += a; - if (a != 127) - break; - } - - coef_nb_bits= ff_wma_total_gain_to_bits(total_gain); - - /* compute number of coefficients */ - n = s->coefs_end[bsize] - s->coefs_start; - for(ch = 0; ch < s->avctx->channels; ch++) - nb_coefs[ch] = n; - - /* complex coding */ - if (s->use_noise_coding) { - - for(ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - int i, n, a; - n = s->exponent_high_sizes[bsize]; - for(i=0;igb); - s->high_band_coded[ch][i] = a; - /* if noise coding, the coefficients are not transmitted */ - if (a) - nb_coefs[ch] -= s->exponent_high_bands[bsize][i]; - } - } - } - for(ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - int i, n, val, code; - - n = s->exponent_high_sizes[bsize]; - val = (int)0x80000000; - for(i=0;ihigh_band_coded[ch][i]) { - if (val == (int)0x80000000) { - val = get_bits(&s->gb, 7) - 19; - } else { - code = get_vlc2(&s->gb, s->hgain_vlc.table, HGAINVLCBITS, HGAINMAX); - if (code < 0){ - av_log(s->avctx, AV_LOG_ERROR, "hgain vlc invalid\n"); - return -1; - } - val += code - 18; - } - s->high_band_values[ch][i] = val; - } - } - } - } - } - - /* exponents can be reused in short blocks. */ - if ((s->block_len_bits == s->frame_len_bits) || - get_bits1(&s->gb)) { - for(ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - if (s->use_exp_vlc) { - if (decode_exp_vlc(s, ch) < 0) - return -1; - } else { - decode_exp_lsp(s, ch); - } - s->exponents_bsize[ch] = bsize; - } - } - } - - /* parse spectral coefficients : just RLE encoding */ - for (ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - int tindex; - WMACoef* ptr = &s->coefs1[ch][0]; - - /* special VLC tables are used for ms stereo because - there is potentially less energy there */ - tindex = (ch == 1 && s->ms_stereo); - memset(ptr, 0, s->block_len * sizeof(WMACoef)); - ff_wma_run_level_decode(s->avctx, &s->gb, &s->coef_vlc[tindex], - s->level_table[tindex], s->run_table[tindex], - 0, ptr, 0, nb_coefs[ch], - s->block_len, s->frame_len_bits, coef_nb_bits); - } - if (s->version == 1 && s->avctx->channels >= 2) { - align_get_bits(&s->gb); - } - } - - /* normalize */ - { - int n4 = s->block_len / 2; - mdct_norm = 1.0 / (float)n4; - if (s->version == 1) { - mdct_norm *= sqrt(n4); - } - } - - /* finally compute the MDCT coefficients */ - for (ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - WMACoef *coefs1; - float *coefs, *exponents, mult, mult1, noise; - int i, j, n, n1, last_high_band, esize; - float exp_power[HIGH_BAND_MAX_SIZE]; - - coefs1 = s->coefs1[ch]; - exponents = s->exponents[ch]; - esize = s->exponents_bsize[ch]; - mult = pow(10, total_gain * 0.05) / s->max_exponent[ch]; - mult *= mdct_norm; - coefs = s->coefs[ch]; - if (s->use_noise_coding) { - mult1 = mult; - /* very low freqs : noise */ - for(i = 0;i < s->coefs_start; i++) { - *coefs++ = s->noise_table[s->noise_index] * - exponents[i<>esize] * mult1; - s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1); - } - - n1 = s->exponent_high_sizes[bsize]; - - /* compute power of high bands */ - exponents = s->exponents[ch] + - (s->high_band_start[bsize]<>esize); - last_high_band = 0; /* avoid warning */ - for(j=0;jexponent_high_bands[s->frame_len_bits - - s->block_len_bits][j]; - if (s->high_band_coded[ch][j]) { - float e2, v; - e2 = 0; - for(i = 0;i < n; i++) { - v = exponents[i<>esize]; - e2 += v * v; - } - exp_power[j] = e2 / n; - last_high_band = j; - tprintf(s->avctx, "%d: power=%f (%d)\n", j, exp_power[j], n); - } - exponents += n<>esize; - } - - /* main freqs and high freqs */ - exponents = s->exponents[ch] + (s->coefs_start<>esize); - for(j=-1;jhigh_band_start[bsize] - - s->coefs_start; - } else { - n = s->exponent_high_bands[s->frame_len_bits - - s->block_len_bits][j]; - } - if (j >= 0 && s->high_band_coded[ch][j]) { - /* use noise with specified power */ - mult1 = sqrt(exp_power[j] / exp_power[last_high_band]); - /* XXX: use a table */ - mult1 = mult1 * pow(10, s->high_band_values[ch][j] * 0.05); - mult1 = mult1 / (s->max_exponent[ch] * s->noise_mult); - mult1 *= mdct_norm; - for(i = 0;i < n; i++) { - noise = s->noise_table[s->noise_index]; - s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1); - *coefs++ = noise * - exponents[i<>esize] * mult1; - } - exponents += n<>esize; - } else { - /* coded values + small noise */ - for(i = 0;i < n; i++) { - noise = s->noise_table[s->noise_index]; - s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1); - *coefs++ = ((*coefs1++) + noise) * - exponents[i<>esize] * mult; - } - exponents += n<>esize; - } - } - - /* very high freqs : noise */ - n = s->block_len - s->coefs_end[bsize]; - mult1 = mult * exponents[((-1<>esize]; - for(i = 0; i < n; i++) { - *coefs++ = s->noise_table[s->noise_index] * mult1; - s->noise_index = (s->noise_index + 1) & (NOISE_TAB_SIZE - 1); - } - } else { - /* XXX: optimize more */ - for(i = 0;i < s->coefs_start; i++) - *coefs++ = 0.0; - n = nb_coefs[ch]; - for(i = 0;i < n; i++) { - *coefs++ = coefs1[i] * exponents[i<>esize] * mult; - } - n = s->block_len - s->coefs_end[bsize]; - for(i = 0;i < n; i++) - *coefs++ = 0.0; - } - } - } - -#ifdef TRACE - for (ch = 0; ch < s->avctx->channels; ch++) { - if (s->channel_coded[ch]) { - dump_floats(s, "exponents", 3, s->exponents[ch], s->block_len); - dump_floats(s, "coefs", 1, s->coefs[ch], s->block_len); - } - } -#endif - - if (s->ms_stereo && s->channel_coded[1]) { - /* nominal case for ms stereo: we do it before mdct */ - /* no need to optimize this case because it should almost - never happen */ - if (!s->channel_coded[0]) { - tprintf(s->avctx, "rare ms-stereo case happened\n"); - memset(s->coefs[0], 0, sizeof(float) * s->block_len); - s->channel_coded[0] = 1; - } - - s->fdsp.butterflies_float(s->coefs[0], s->coefs[1], s->block_len); - } - -next: - mdct = &s->mdct_ctx[bsize]; - - for (ch = 0; ch < s->avctx->channels; ch++) { - int n4, index; - - n4 = s->block_len / 2; - if(s->channel_coded[ch]){ - mdct->imdct_calc(mdct, s->output, s->coefs[ch]); - }else if(!(s->ms_stereo && ch==1)) - memset(s->output, 0, sizeof(s->output)); - - /* multiply by the window and add in the frame */ - index = (s->frame_len / 2) + s->block_pos - n4; - wma_window(s, &s->frame_out[ch][index]); - } - - /* update block number */ - s->block_num++; - s->block_pos += s->block_len; - if (s->block_pos >= s->frame_len) - return 1; - else - return 0; -} - -/* decode a frame of frame_len samples */ -static int wma_decode_frame(WMACodecContext *s, float **samples, - int samples_offset) -{ - int ret, ch; - -#ifdef TRACE - tprintf(s->avctx, "***decode_frame: %d size=%d\n", s->frame_count++, s->frame_len); -#endif - - /* read each block */ - s->block_num = 0; - s->block_pos = 0; - for(;;) { - ret = wma_decode_block(s); - if (ret < 0) - return -1; - if (ret) - break; - } - - for (ch = 0; ch < s->avctx->channels; ch++) { - /* copy current block to output */ - memcpy(samples[ch] + samples_offset, s->frame_out[ch], - s->frame_len * sizeof(*s->frame_out[ch])); - /* prepare for next block */ - memmove(&s->frame_out[ch][0], &s->frame_out[ch][s->frame_len], - s->frame_len * sizeof(*s->frame_out[ch])); - -#ifdef TRACE - dump_floats(s, "samples", 6, samples[ch] + samples_offset, s->frame_len); -#endif - } - - return 0; -} - -static int wma_decode_superframe(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - AVFrame *frame = data; - const uint8_t *buf = avpkt->data; - int buf_size = avpkt->size; - WMACodecContext *s = avctx->priv_data; - int nb_frames, bit_offset, i, pos, len, ret; - uint8_t *q; - float **samples; - int samples_offset; - - tprintf(avctx, "***decode_superframe:\n"); - - if(buf_size==0){ - s->last_superframe_len = 0; - return 0; - } - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, - "Input packet size too small (%d < %d)\n", - buf_size, avctx->block_align); - return AVERROR_INVALIDDATA; - } - if(avctx->block_align) - buf_size = avctx->block_align; - - init_get_bits(&s->gb, buf, buf_size*8); - - if (s->use_bit_reservoir) { - /* read super frame header */ - skip_bits(&s->gb, 4); /* super frame index */ - nb_frames = get_bits(&s->gb, 4) - (s->last_superframe_len <= 0); - if (nb_frames <= 0) { - av_log(avctx, AV_LOG_ERROR, "nb_frames is %d\n", nb_frames); - return AVERROR_INVALIDDATA; - } - } else { - nb_frames = 1; - } - - /* get output buffer */ - frame->nb_samples = nb_frames * s->frame_len; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples = (float **)frame->extended_data; - samples_offset = 0; - - if (s->use_bit_reservoir) { - bit_offset = get_bits(&s->gb, s->byte_offset_bits + 3); - if (bit_offset > get_bits_left(&s->gb)) { - av_log(avctx, AV_LOG_ERROR, - "Invalid last frame bit offset %d > buf size %d (%d)\n", - bit_offset, get_bits_left(&s->gb), buf_size); - goto fail; - } - - if (s->last_superframe_len > 0) { - /* add bit_offset bits to last frame */ - if ((s->last_superframe_len + ((bit_offset + 7) >> 3)) > - MAX_CODED_SUPERFRAME_SIZE) - goto fail; - q = s->last_superframe + s->last_superframe_len; - len = bit_offset; - while (len > 7) { - *q++ = (get_bits)(&s->gb, 8); - len -= 8; - } - if (len > 0) { - *q++ = (get_bits)(&s->gb, len) << (8 - len); - } - memset(q, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - /* XXX: bit_offset bits into last frame */ - init_get_bits(&s->gb, s->last_superframe, s->last_superframe_len * 8 + bit_offset); - /* skip unused bits */ - if (s->last_bitoffset > 0) - skip_bits(&s->gb, s->last_bitoffset); - /* this frame is stored in the last superframe and in the - current one */ - if (wma_decode_frame(s, samples, samples_offset) < 0) - goto fail; - samples_offset += s->frame_len; - nb_frames--; - } - - /* read each frame starting from bit_offset */ - pos = bit_offset + 4 + 4 + s->byte_offset_bits + 3; - if (pos >= MAX_CODED_SUPERFRAME_SIZE * 8 || pos > buf_size * 8) - return AVERROR_INVALIDDATA; - init_get_bits(&s->gb, buf + (pos >> 3), (buf_size - (pos >> 3))*8); - len = pos & 7; - if (len > 0) - skip_bits(&s->gb, len); - - s->reset_block_lengths = 1; - for(i=0;iframe_len; - } - - /* we copy the end of the frame in the last frame buffer */ - pos = get_bits_count(&s->gb) + ((bit_offset + 4 + 4 + s->byte_offset_bits + 3) & ~7); - s->last_bitoffset = pos & 7; - pos >>= 3; - len = buf_size - pos; - if (len > MAX_CODED_SUPERFRAME_SIZE || len < 0) { - av_log(s->avctx, AV_LOG_ERROR, "len %d invalid\n", len); - goto fail; - } - s->last_superframe_len = len; - memcpy(s->last_superframe, buf + pos, len); - } else { - /* single frame decode */ - if (wma_decode_frame(s, samples, samples_offset) < 0) - goto fail; - samples_offset += s->frame_len; - } - - av_dlog(s->avctx, "%d %d %d %d outbytes:%td eaten:%d\n", - s->frame_len_bits, s->block_len_bits, s->frame_len, s->block_len, - (int8_t *)samples - (int8_t *)data, avctx->block_align); - - *got_frame_ptr = 1; - - return buf_size; - fail: - /* when error, we reset the bit reservoir */ - s->last_superframe_len = 0; - return -1; -} - -static av_cold void flush(AVCodecContext *avctx) -{ - WMACodecContext *s = avctx->priv_data; - - s->last_bitoffset= - s->last_superframe_len= 0; -} - -#if CONFIG_WMAV1_DECODER -AVCodec ff_wmav1_decoder = { - .name = "wmav1", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 1"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_WMAV1, - .priv_data_size = sizeof(WMACodecContext), - .init = wma_decode_init, - .close = ff_wma_end, - .decode = wma_decode_superframe, - .flush = flush, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; -#endif -#if CONFIG_WMAV2_DECODER -AVCodec ff_wmav2_decoder = { - .name = "wmav2", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 2"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_WMAV2, - .priv_data_size = sizeof(WMACodecContext), - .init = wma_decode_init, - .close = ff_wma_end, - .decode = wma_decode_superframe, - .flush = flush, - .capabilities = CODEC_CAP_DR1, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmalosslessdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmalosslessdec.c deleted file mode 100644 index f83ba9daa..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmalosslessdec.c +++ /dev/null @@ -1,1325 +0,0 @@ -/* - * Windows Media Audio Lossless decoder - * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion - * Copyright (c) 2008 - 2011 Sascha Sommer, Benjamin Larsson - * Copyright (c) 2011 Andreas Öman - * Copyright (c) 2011 - 2012 Mashiat Sarker Shakkhar - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" - -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "put_bits.h" -#include "wma.h" -#include "wma_common.h" - -/** current decoder limitations */ -#define WMALL_MAX_CHANNELS 8 ///< max number of handled channels -#define MAX_SUBFRAMES 32 ///< max number of subframes per channel -#define MAX_BANDS 29 ///< max number of scale factor bands -#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size -#define MAX_ORDER 256 - -#define WMALL_BLOCK_MIN_BITS 6 ///< log2 of min block size -#define WMALL_BLOCK_MAX_BITS 14 ///< log2 of max block size -#define WMALL_BLOCK_MAX_SIZE (1 << WMALL_BLOCK_MAX_BITS) ///< maximum block size -#define WMALL_BLOCK_SIZES (WMALL_BLOCK_MAX_BITS - WMALL_BLOCK_MIN_BITS + 1) ///< possible block sizes - - -/** - * @brief frame-specific decoder context for a single channel - */ -typedef struct { - int16_t prev_block_len; ///< length of the previous block - uint8_t transmit_coefs; - uint8_t num_subframes; - uint16_t subframe_len[MAX_SUBFRAMES]; ///< subframe length in samples - uint16_t subframe_offsets[MAX_SUBFRAMES]; ///< subframe positions in the current frame - uint8_t cur_subframe; ///< current subframe number - uint16_t decoded_samples; ///< number of already processed samples - int quant_step; ///< quantization step for the current subframe - int transient_counter; ///< number of transient samples from the beginning of the transient zone -} WmallChannelCtx; - -/** - * @brief main decoder context - */ -typedef struct WmallDecodeCtx { - /* generic decoder variables */ - AVCodecContext *avctx; - AVFrame *frame; - uint8_t frame_data[MAX_FRAMESIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< compressed frame data - PutBitContext pb; ///< context for filling the frame_data buffer - - /* frame size dependent frame information (set during initialization) */ - uint32_t decode_flags; ///< used compression features - int len_prefix; ///< frame is prefixed with its length - int dynamic_range_compression; ///< frame contains DRC data - uint8_t bits_per_sample; ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0]) - uint16_t samples_per_frame; ///< number of samples to output - uint16_t log2_frame_size; - int8_t num_channels; ///< number of channels in the stream (same as AVCodecContext.num_channels) - int8_t lfe_channel; ///< lfe channel index - uint8_t max_num_subframes; - uint8_t subframe_len_bits; ///< number of bits used for the subframe length - uint8_t max_subframe_len_bit; ///< flag indicating that the subframe is of maximum size when the first subframe length bit is 1 - uint16_t min_samples_per_subframe; - - /* packet decode state */ - GetBitContext pgb; ///< bitstream reader context for the packet - int next_packet_start; ///< start offset of the next WMA packet in the demuxer packet - uint8_t packet_offset; ///< offset to the frame in the packet - uint8_t packet_sequence_number; ///< current packet number - int num_saved_bits; ///< saved number of bits - int frame_offset; ///< frame offset in the bit reservoir - int subframe_offset; ///< subframe offset in the bit reservoir - uint8_t packet_loss; ///< set in case of bitstream error - uint8_t packet_done; ///< set when a packet is fully decoded - - /* frame decode state */ - uint32_t frame_num; ///< current frame number (not used for decoding) - GetBitContext gb; ///< bitstream reader context - int buf_bit_size; ///< buffer size in bits - int16_t *samples_16[WMALL_MAX_CHANNELS]; ///< current samplebuffer pointer (16-bit) - int32_t *samples_32[WMALL_MAX_CHANNELS]; ///< current samplebuffer pointer (24-bit) - uint8_t drc_gain; ///< gain for the DRC tool - int8_t skip_frame; ///< skip output step - int8_t parsed_all_subframes; ///< all subframes decoded? - - /* subframe/block decode state */ - int16_t subframe_len; ///< current subframe length - int8_t channels_for_cur_subframe; ///< number of channels that contain the subframe - int8_t channel_indexes_for_cur_subframe[WMALL_MAX_CHANNELS]; - - WmallChannelCtx channel[WMALL_MAX_CHANNELS]; ///< per channel data - - // WMA Lossless-specific - - uint8_t do_arith_coding; - uint8_t do_ac_filter; - uint8_t do_inter_ch_decorr; - uint8_t do_mclms; - uint8_t do_lpc; - - int8_t acfilter_order; - int8_t acfilter_scaling; - int64_t acfilter_coeffs[16]; - int acfilter_prevvalues[WMALL_MAX_CHANNELS][16]; - - int8_t mclms_order; - int8_t mclms_scaling; - int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32]; - int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS]; - int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32]; - int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32]; - int mclms_recent; - - int movave_scaling; - int quant_stepsize; - - struct { - int order; - int scaling; - int coefsend; - int bitsend; - int16_t coefs[MAX_ORDER]; - int16_t lms_prevvalues[MAX_ORDER * 2]; - int16_t lms_updates[MAX_ORDER * 2]; - int recent; - } cdlms[WMALL_MAX_CHANNELS][9]; - - int cdlms_ttl[WMALL_MAX_CHANNELS]; - - int bV3RTM; - - int is_channel_coded[WMALL_MAX_CHANNELS]; - int update_speed[WMALL_MAX_CHANNELS]; - - int transient[WMALL_MAX_CHANNELS]; - int transient_pos[WMALL_MAX_CHANNELS]; - int seekable_tile; - - int ave_sum[WMALL_MAX_CHANNELS]; - - int channel_residues[WMALL_MAX_CHANNELS][WMALL_BLOCK_MAX_SIZE]; - - int lpc_coefs[WMALL_MAX_CHANNELS][40]; - int lpc_order; - int lpc_scaling; - int lpc_intbits; - - int channel_coeffs[WMALL_MAX_CHANNELS][WMALL_BLOCK_MAX_SIZE]; -} WmallDecodeCtx; - - -static av_cold int decode_init(AVCodecContext *avctx) -{ - WmallDecodeCtx *s = avctx->priv_data; - uint8_t *edata_ptr = avctx->extradata; - unsigned int channel_mask; - int i, log2_max_num_subframes; - - if (!avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); - return AVERROR(EINVAL); - } - - s->avctx = avctx; - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); - - if (avctx->extradata_size >= 18) { - s->decode_flags = AV_RL16(edata_ptr + 14); - channel_mask = AV_RL32(edata_ptr + 2); - s->bits_per_sample = AV_RL16(edata_ptr); - if (s->bits_per_sample == 16) - avctx->sample_fmt = AV_SAMPLE_FMT_S16P; - else if (s->bits_per_sample == 24) { - avctx->sample_fmt = AV_SAMPLE_FMT_S32P; - avpriv_report_missing_feature(avctx, "Bit-depth higher than 16"); - return AVERROR_PATCHWELCOME; - } else { - av_log(avctx, AV_LOG_ERROR, "Unknown bit-depth: %d\n", - s->bits_per_sample); - return AVERROR_INVALIDDATA; - } - /* dump the extradata */ - for (i = 0; i < avctx->extradata_size; i++) - av_dlog(avctx, "[%x] ", avctx->extradata[i]); - av_dlog(avctx, "\n"); - - } else { - avpriv_request_sample(avctx, "Unsupported extradata size"); - return AVERROR_PATCHWELCOME; - } - - /* generic init */ - s->log2_frame_size = av_log2(avctx->block_align) + 4; - - /* frame info */ - s->skip_frame = 1; /* skip first frame */ - s->packet_loss = 1; - s->len_prefix = s->decode_flags & 0x40; - - /* get frame len */ - s->samples_per_frame = 1 << ff_wma_get_frame_len_bits(avctx->sample_rate, - 3, s->decode_flags); - av_assert0(s->samples_per_frame <= WMALL_BLOCK_MAX_SIZE); - - /* init previous block len */ - for (i = 0; i < avctx->channels; i++) - s->channel[i].prev_block_len = s->samples_per_frame; - - /* subframe info */ - log2_max_num_subframes = (s->decode_flags & 0x38) >> 3; - s->max_num_subframes = 1 << log2_max_num_subframes; - s->max_subframe_len_bit = 0; - s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1; - - s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes; - s->dynamic_range_compression = s->decode_flags & 0x80; - s->bV3RTM = s->decode_flags & 0x100; - - if (s->max_num_subframes > MAX_SUBFRAMES) { - av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %i\n", - s->max_num_subframes); - return AVERROR_INVALIDDATA; - } - - s->num_channels = avctx->channels; - - /* extract lfe channel position */ - s->lfe_channel = -1; - - if (channel_mask & 8) { - unsigned int mask; - for (mask = 1; mask < 16; mask <<= 1) - if (channel_mask & mask) - ++s->lfe_channel; - } - - if (s->num_channels < 0) { - av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", - s->num_channels); - return AVERROR_INVALIDDATA; - } else if (s->num_channels > WMALL_MAX_CHANNELS) { - avpriv_request_sample(avctx, - "More than %d channels", WMALL_MAX_CHANNELS); - return AVERROR_PATCHWELCOME; - } - - s->frame = av_frame_alloc(); - if (!s->frame) - return AVERROR(ENOMEM); - - avctx->channel_layout = channel_mask; - return 0; -} - -/** - * @brief Decode the subframe length. - * @param s context - * @param offset sample offset in the frame - * @return decoded subframe length on success, < 0 in case of an error - */ -static int decode_subframe_length(WmallDecodeCtx *s, int offset) -{ - int frame_len_ratio, subframe_len, len; - - /* no need to read from the bitstream when only one length is possible */ - if (offset == s->samples_per_frame - s->min_samples_per_subframe) - return s->min_samples_per_subframe; - - len = av_log2(s->max_num_subframes - 1) + 1; - frame_len_ratio = get_bits(&s->gb, len); - subframe_len = s->min_samples_per_subframe * (frame_len_ratio + 1); - - /* sanity check the length */ - if (subframe_len < s->min_samples_per_subframe || - subframe_len > s->samples_per_frame) { - av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n", - subframe_len); - return AVERROR_INVALIDDATA; - } - return subframe_len; -} - -/** - * @brief Decode how the data in the frame is split into subframes. - * Every WMA frame contains the encoded data for a fixed number of - * samples per channel. The data for every channel might be split - * into several subframes. This function will reconstruct the list of - * subframes for every channel. - * - * If the subframes are not evenly split, the algorithm estimates the - * channels with the lowest number of total samples. - * Afterwards, for each of these channels a bit is read from the - * bitstream that indicates if the channel contains a subframe with the - * next subframe size that is going to be read from the bitstream or not. - * If a channel contains such a subframe, the subframe size gets added to - * the channel's subframe list. - * The algorithm repeats these steps until the frame is properly divided - * between the individual channels. - * - * @param s context - * @return 0 on success, < 0 in case of an error - */ -static int decode_tilehdr(WmallDecodeCtx *s) -{ - uint16_t num_samples[WMALL_MAX_CHANNELS] = { 0 }; /* sum of samples for all currently known subframes of a channel */ - uint8_t contains_subframe[WMALL_MAX_CHANNELS]; /* flag indicating if a channel contains the current subframe */ - int channels_for_cur_subframe = s->num_channels; /* number of channels that contain the current subframe */ - int fixed_channel_layout = 0; /* flag indicating that all channels use the same subfra2me offsets and sizes */ - int min_channel_len = 0; /* smallest sum of samples (channels with this length will be processed first) */ - int c, tile_aligned; - - /* reset tiling information */ - for (c = 0; c < s->num_channels; c++) - s->channel[c].num_subframes = 0; - - tile_aligned = get_bits1(&s->gb); - if (s->max_num_subframes == 1 || tile_aligned) - fixed_channel_layout = 1; - - /* loop until the frame data is split between the subframes */ - do { - int subframe_len, in_use = 0; - - /* check which channels contain the subframe */ - for (c = 0; c < s->num_channels; c++) { - if (num_samples[c] == min_channel_len) { - if (fixed_channel_layout || channels_for_cur_subframe == 1 || - (min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) { - contains_subframe[c] = 1; - } else { - contains_subframe[c] = get_bits1(&s->gb); - } - in_use |= contains_subframe[c]; - } else - contains_subframe[c] = 0; - } - - if (!in_use) { - av_log(s->avctx, AV_LOG_ERROR, - "Found empty subframe\n"); - return AVERROR_INVALIDDATA; - } - - /* get subframe length, subframe_len == 0 is not allowed */ - if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0) - return AVERROR_INVALIDDATA; - /* add subframes to the individual channels and find new min_channel_len */ - min_channel_len += subframe_len; - for (c = 0; c < s->num_channels; c++) { - WmallChannelCtx *chan = &s->channel[c]; - - if (contains_subframe[c]) { - if (chan->num_subframes >= MAX_SUBFRAMES) { - av_log(s->avctx, AV_LOG_ERROR, - "broken frame: num subframes > 31\n"); - return AVERROR_INVALIDDATA; - } - chan->subframe_len[chan->num_subframes] = subframe_len; - num_samples[c] += subframe_len; - ++chan->num_subframes; - if (num_samples[c] > s->samples_per_frame) { - av_log(s->avctx, AV_LOG_ERROR, "broken frame: " - "channel len(%d) > samples_per_frame(%d)\n", - num_samples[c], s->samples_per_frame); - return AVERROR_INVALIDDATA; - } - } else if (num_samples[c] <= min_channel_len) { - if (num_samples[c] < min_channel_len) { - channels_for_cur_subframe = 0; - min_channel_len = num_samples[c]; - } - ++channels_for_cur_subframe; - } - } - } while (min_channel_len < s->samples_per_frame); - - for (c = 0; c < s->num_channels; c++) { - int i, offset = 0; - for (i = 0; i < s->channel[c].num_subframes; i++) { - s->channel[c].subframe_offsets[i] = offset; - offset += s->channel[c].subframe_len[i]; - } - } - - return 0; -} - -static void decode_ac_filter(WmallDecodeCtx *s) -{ - int i; - s->acfilter_order = get_bits(&s->gb, 4) + 1; - s->acfilter_scaling = get_bits(&s->gb, 4); - - for (i = 0; i < s->acfilter_order; i++) - s->acfilter_coeffs[i] = (s->acfilter_scaling ? - get_bits(&s->gb, s->acfilter_scaling) : 0) + 1; -} - -static void decode_mclms(WmallDecodeCtx *s) -{ - s->mclms_order = (get_bits(&s->gb, 4) + 1) * 2; - s->mclms_scaling = get_bits(&s->gb, 4); - if (get_bits1(&s->gb)) { - int i, send_coef_bits; - int cbits = av_log2(s->mclms_scaling + 1); - if (1 << cbits < s->mclms_scaling + 1) - cbits++; - - send_coef_bits = (cbits ? get_bits(&s->gb, cbits) : 0) + 2; - - for (i = 0; i < s->mclms_order * s->num_channels * s->num_channels; i++) - s->mclms_coeffs[i] = get_bits(&s->gb, send_coef_bits); - - for (i = 0; i < s->num_channels; i++) { - int c; - for (c = 0; c < i; c++) - s->mclms_coeffs_cur[i * s->num_channels + c] = get_bits(&s->gb, send_coef_bits); - } - } -} - -static int decode_cdlms(WmallDecodeCtx *s) -{ - int c, i; - int cdlms_send_coef = get_bits1(&s->gb); - - for (c = 0; c < s->num_channels; c++) { - s->cdlms_ttl[c] = get_bits(&s->gb, 3) + 1; - for (i = 0; i < s->cdlms_ttl[c]; i++) { - s->cdlms[c][i].order = (get_bits(&s->gb, 7) + 1) * 8; - if (s->cdlms[c][i].order > MAX_ORDER) { - av_log(s->avctx, AV_LOG_ERROR, - "Order[%d][%d] %d > max (%d), not supported\n", - c, i, s->cdlms[c][i].order, MAX_ORDER); - s->cdlms[0][0].order = 0; - return AVERROR_INVALIDDATA; - } - } - - for (i = 0; i < s->cdlms_ttl[c]; i++) - s->cdlms[c][i].scaling = get_bits(&s->gb, 4); - - if (cdlms_send_coef) { - for (i = 0; i < s->cdlms_ttl[c]; i++) { - int cbits, shift_l, shift_r, j; - cbits = av_log2(s->cdlms[c][i].order); - if ((1 << cbits) < s->cdlms[c][i].order) - cbits++; - s->cdlms[c][i].coefsend = get_bits(&s->gb, cbits) + 1; - - cbits = av_log2(s->cdlms[c][i].scaling + 1); - if ((1 << cbits) < s->cdlms[c][i].scaling + 1) - cbits++; - - s->cdlms[c][i].bitsend = get_bits(&s->gb, cbits) + 2; - shift_l = 32 - s->cdlms[c][i].bitsend; - shift_r = 32 - s->cdlms[c][i].scaling - 2; - for (j = 0; j < s->cdlms[c][i].coefsend; j++) - s->cdlms[c][i].coefs[j] = - (get_bits(&s->gb, s->cdlms[c][i].bitsend) << shift_l) >> shift_r; - } - } - } - - return 0; -} - -static int decode_channel_residues(WmallDecodeCtx *s, int ch, int tile_size) -{ - int i = 0; - unsigned int ave_mean; - s->transient[ch] = get_bits1(&s->gb); - if (s->transient[ch]) { - s->transient_pos[ch] = get_bits(&s->gb, av_log2(tile_size)); - if (s->transient_pos[ch]) - s->transient[ch] = 0; - s->channel[ch].transient_counter = - FFMAX(s->channel[ch].transient_counter, s->samples_per_frame / 2); - } else if (s->channel[ch].transient_counter) - s->transient[ch] = 1; - - if (s->seekable_tile) { - ave_mean = get_bits(&s->gb, s->bits_per_sample); - s->ave_sum[ch] = ave_mean << (s->movave_scaling + 1); - } - - if (s->seekable_tile) { - if (s->do_inter_ch_decorr) - s->channel_residues[ch][0] = get_sbits_long(&s->gb, s->bits_per_sample + 1); - else - s->channel_residues[ch][0] = get_sbits_long(&s->gb, s->bits_per_sample); - i++; - } - for (; i < tile_size; i++) { - int quo = 0, rem, rem_bits, residue; - while(get_bits1(&s->gb)) { - quo++; - if (get_bits_left(&s->gb) <= 0) - return -1; - } - if (quo >= 32) - quo += get_bits_long(&s->gb, get_bits(&s->gb, 5) + 1); - - ave_mean = (s->ave_sum[ch] + (1 << s->movave_scaling)) >> (s->movave_scaling + 1); - if (ave_mean <= 1) - residue = quo; - else { - rem_bits = av_ceil_log2(ave_mean); - rem = get_bits_long(&s->gb, rem_bits); - residue = (quo << rem_bits) + rem; - } - - s->ave_sum[ch] = residue + s->ave_sum[ch] - - (s->ave_sum[ch] >> s->movave_scaling); - - if (residue & 1) - residue = -(residue >> 1) - 1; - else - residue = residue >> 1; - s->channel_residues[ch][i] = residue; - } - - return 0; - -} - -static void decode_lpc(WmallDecodeCtx *s) -{ - int ch, i, cbits; - s->lpc_order = get_bits(&s->gb, 5) + 1; - s->lpc_scaling = get_bits(&s->gb, 4); - s->lpc_intbits = get_bits(&s->gb, 3) + 1; - cbits = s->lpc_scaling + s->lpc_intbits; - for (ch = 0; ch < s->num_channels; ch++) - for (i = 0; i < s->lpc_order; i++) - s->lpc_coefs[ch][i] = get_sbits(&s->gb, cbits); -} - -static void clear_codec_buffers(WmallDecodeCtx *s) -{ - int ich, ilms; - - memset(s->acfilter_coeffs, 0, sizeof(s->acfilter_coeffs)); - memset(s->acfilter_prevvalues, 0, sizeof(s->acfilter_prevvalues)); - memset(s->lpc_coefs, 0, sizeof(s->lpc_coefs)); - - memset(s->mclms_coeffs, 0, sizeof(s->mclms_coeffs)); - memset(s->mclms_coeffs_cur, 0, sizeof(s->mclms_coeffs_cur)); - memset(s->mclms_prevvalues, 0, sizeof(s->mclms_prevvalues)); - memset(s->mclms_updates, 0, sizeof(s->mclms_updates)); - - for (ich = 0; ich < s->num_channels; ich++) { - for (ilms = 0; ilms < s->cdlms_ttl[ich]; ilms++) { - memset(s->cdlms[ich][ilms].coefs, 0, - sizeof(s->cdlms[ich][ilms].coefs)); - memset(s->cdlms[ich][ilms].lms_prevvalues, 0, - sizeof(s->cdlms[ich][ilms].lms_prevvalues)); - memset(s->cdlms[ich][ilms].lms_updates, 0, - sizeof(s->cdlms[ich][ilms].lms_updates)); - } - s->ave_sum[ich] = 0; - } -} - -/** - * @brief Reset filter parameters and transient area at new seekable tile. - */ -static void reset_codec(WmallDecodeCtx *s) -{ - int ich, ilms; - s->mclms_recent = s->mclms_order * s->num_channels; - for (ich = 0; ich < s->num_channels; ich++) { - for (ilms = 0; ilms < s->cdlms_ttl[ich]; ilms++) - s->cdlms[ich][ilms].recent = s->cdlms[ich][ilms].order; - /* first sample of a seekable subframe is considered as the starting of - a transient area which is samples_per_frame samples long */ - s->channel[ich].transient_counter = s->samples_per_frame; - s->transient[ich] = 1; - s->transient_pos[ich] = 0; - } -} - -static void mclms_update(WmallDecodeCtx *s, int icoef, int *pred) -{ - int i, j, ich, pred_error; - int order = s->mclms_order; - int num_channels = s->num_channels; - int range = 1 << (s->bits_per_sample - 1); - - for (ich = 0; ich < num_channels; ich++) { - pred_error = s->channel_residues[ich][icoef] - pred[ich]; - if (pred_error > 0) { - for (i = 0; i < order * num_channels; i++) - s->mclms_coeffs[i + ich * order * num_channels] += - s->mclms_updates[s->mclms_recent + i]; - for (j = 0; j < ich; j++) { - if (s->channel_residues[j][icoef] > 0) - s->mclms_coeffs_cur[ich * num_channels + j] += 1; - else if (s->channel_residues[j][icoef] < 0) - s->mclms_coeffs_cur[ich * num_channels + j] -= 1; - } - } else if (pred_error < 0) { - for (i = 0; i < order * num_channels; i++) - s->mclms_coeffs[i + ich * order * num_channels] -= - s->mclms_updates[s->mclms_recent + i]; - for (j = 0; j < ich; j++) { - if (s->channel_residues[j][icoef] > 0) - s->mclms_coeffs_cur[ich * num_channels + j] -= 1; - else if (s->channel_residues[j][icoef] < 0) - s->mclms_coeffs_cur[ich * num_channels + j] += 1; - } - } - } - - for (ich = num_channels - 1; ich >= 0; ich--) { - s->mclms_recent--; - s->mclms_prevvalues[s->mclms_recent] = s->channel_residues[ich][icoef]; - if (s->channel_residues[ich][icoef] > range - 1) - s->mclms_prevvalues[s->mclms_recent] = range - 1; - else if (s->channel_residues[ich][icoef] < -range) - s->mclms_prevvalues[s->mclms_recent] = -range; - - s->mclms_updates[s->mclms_recent] = 0; - if (s->channel_residues[ich][icoef] > 0) - s->mclms_updates[s->mclms_recent] = 1; - else if (s->channel_residues[ich][icoef] < 0) - s->mclms_updates[s->mclms_recent] = -1; - } - - if (s->mclms_recent == 0) { - memcpy(&s->mclms_prevvalues[order * num_channels], - s->mclms_prevvalues, - sizeof(int16_t) * order * num_channels); - memcpy(&s->mclms_updates[order * num_channels], - s->mclms_updates, - sizeof(int16_t) * order * num_channels); - s->mclms_recent = num_channels * order; - } -} - -static void mclms_predict(WmallDecodeCtx *s, int icoef, int *pred) -{ - int ich, i; - int order = s->mclms_order; - int num_channels = s->num_channels; - - for (ich = 0; ich < num_channels; ich++) { - pred[ich] = 0; - if (!s->is_channel_coded[ich]) - continue; - for (i = 0; i < order * num_channels; i++) - pred[ich] += s->mclms_prevvalues[i + s->mclms_recent] * - s->mclms_coeffs[i + order * num_channels * ich]; - for (i = 0; i < ich; i++) - pred[ich] += s->channel_residues[i][icoef] * - s->mclms_coeffs_cur[i + num_channels * ich]; - pred[ich] += 1 << s->mclms_scaling - 1; - pred[ich] >>= s->mclms_scaling; - s->channel_residues[ich][icoef] += pred[ich]; - } -} - -static void revert_mclms(WmallDecodeCtx *s, int tile_size) -{ - int icoef, pred[WMALL_MAX_CHANNELS] = { 0 }; - for (icoef = 0; icoef < tile_size; icoef++) { - mclms_predict(s, icoef, pred); - mclms_update(s, icoef, pred); - } -} - -static int lms_predict(WmallDecodeCtx *s, int ich, int ilms) -{ - int pred = 0, icoef; - int recent = s->cdlms[ich][ilms].recent; - - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - pred += s->cdlms[ich][ilms].coefs[icoef] * - s->cdlms[ich][ilms].lms_prevvalues[icoef + recent]; - - return pred; -} - -static void lms_update(WmallDecodeCtx *s, int ich, int ilms, - int input, int residue) -{ - int icoef; - int recent = s->cdlms[ich][ilms].recent; - int range = 1 << s->bits_per_sample - 1; - - if (residue < 0) { - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].coefs[icoef] -= - s->cdlms[ich][ilms].lms_updates[icoef + recent]; - } else if (residue > 0) { - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].coefs[icoef] += - s->cdlms[ich][ilms].lms_updates[icoef + recent]; - } - - if (recent) - recent--; - else { - memcpy(&s->cdlms[ich][ilms].lms_prevvalues[s->cdlms[ich][ilms].order], - s->cdlms[ich][ilms].lms_prevvalues, - 2 * s->cdlms[ich][ilms].order); - memcpy(&s->cdlms[ich][ilms].lms_updates[s->cdlms[ich][ilms].order], - s->cdlms[ich][ilms].lms_updates, - 2 * s->cdlms[ich][ilms].order); - recent = s->cdlms[ich][ilms].order - 1; - } - - s->cdlms[ich][ilms].lms_prevvalues[recent] = av_clip(input, -range, range - 1); - if (!input) - s->cdlms[ich][ilms].lms_updates[recent] = 0; - else if (input < 0) - s->cdlms[ich][ilms].lms_updates[recent] = -s->update_speed[ich]; - else - s->cdlms[ich][ilms].lms_updates[recent] = s->update_speed[ich]; - - s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 4)] >>= 2; - s->cdlms[ich][ilms].lms_updates[recent + (s->cdlms[ich][ilms].order >> 3)] >>= 1; - s->cdlms[ich][ilms].recent = recent; -} - -static void use_high_update_speed(WmallDecodeCtx *s, int ich) -{ - int ilms, recent, icoef; - for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) { - recent = s->cdlms[ich][ilms].recent; - if (s->update_speed[ich] == 16) - continue; - if (s->bV3RTM) { - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].lms_updates[icoef + recent] *= 2; - } else { - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].lms_updates[icoef] *= 2; - } - } - s->update_speed[ich] = 16; -} - -static void use_normal_update_speed(WmallDecodeCtx *s, int ich) -{ - int ilms, recent, icoef; - for (ilms = s->cdlms_ttl[ich] - 1; ilms >= 0; ilms--) { - recent = s->cdlms[ich][ilms].recent; - if (s->update_speed[ich] == 8) - continue; - if (s->bV3RTM) - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].lms_updates[icoef + recent] /= 2; - else - for (icoef = 0; icoef < s->cdlms[ich][ilms].order; icoef++) - s->cdlms[ich][ilms].lms_updates[icoef] /= 2; - } - s->update_speed[ich] = 8; -} - -static void revert_cdlms(WmallDecodeCtx *s, int ch, - int coef_begin, int coef_end) -{ - int icoef, pred, ilms, num_lms, residue, input; - - num_lms = s->cdlms_ttl[ch]; - for (ilms = num_lms - 1; ilms >= 0; ilms--) { - for (icoef = coef_begin; icoef < coef_end; icoef++) { - pred = 1 << (s->cdlms[ch][ilms].scaling - 1); - residue = s->channel_residues[ch][icoef]; - pred += lms_predict(s, ch, ilms); - input = residue + (pred >> s->cdlms[ch][ilms].scaling); - lms_update(s, ch, ilms, input, residue); - s->channel_residues[ch][icoef] = input; - } - } -} - -static void revert_inter_ch_decorr(WmallDecodeCtx *s, int tile_size) -{ - if (s->num_channels != 2) - return; - else if (s->is_channel_coded[0] || s->is_channel_coded[1]) { - int icoef; - for (icoef = 0; icoef < tile_size; icoef++) { - s->channel_residues[0][icoef] -= s->channel_residues[1][icoef] >> 1; - s->channel_residues[1][icoef] += s->channel_residues[0][icoef]; - } - } -} - -static void revert_acfilter(WmallDecodeCtx *s, int tile_size) -{ - int ich, pred, i, j; - int64_t *filter_coeffs = s->acfilter_coeffs; - int scaling = s->acfilter_scaling; - int order = s->acfilter_order; - - for (ich = 0; ich < s->num_channels; ich++) { - int *prevvalues = s->acfilter_prevvalues[ich]; - for (i = 0; i < order; i++) { - pred = 0; - for (j = 0; j < order; j++) { - if (i <= j) - pred += filter_coeffs[j] * prevvalues[j - i]; - else - pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j]; - } - pred >>= scaling; - s->channel_residues[ich][i] += pred; - } - for (i = order; i < tile_size; i++) { - pred = 0; - for (j = 0; j < order; j++) - pred += s->channel_residues[ich][i - j - 1] * filter_coeffs[j]; - pred >>= scaling; - s->channel_residues[ich][i] += pred; - } - for (j = 0; j < order; j++) - prevvalues[j] = s->channel_residues[ich][tile_size - j - 1]; - } -} - -static int decode_subframe(WmallDecodeCtx *s) -{ - int offset = s->samples_per_frame; - int subframe_len = s->samples_per_frame; - int total_samples = s->samples_per_frame * s->num_channels; - int i, j, rawpcm_tile, padding_zeroes, res; - - s->subframe_offset = get_bits_count(&s->gb); - - /* reset channel context and find the next block offset and size - == the next block of the channel with the smallest number of - decoded samples */ - for (i = 0; i < s->num_channels; i++) { - if (offset > s->channel[i].decoded_samples) { - offset = s->channel[i].decoded_samples; - subframe_len = - s->channel[i].subframe_len[s->channel[i].cur_subframe]; - } - } - - /* get a list of all channels that contain the estimated block */ - s->channels_for_cur_subframe = 0; - for (i = 0; i < s->num_channels; i++) { - const int cur_subframe = s->channel[i].cur_subframe; - /* subtract already processed samples */ - total_samples -= s->channel[i].decoded_samples; - - /* and count if there are multiple subframes that match our profile */ - if (offset == s->channel[i].decoded_samples && - subframe_len == s->channel[i].subframe_len[cur_subframe]) { - total_samples -= s->channel[i].subframe_len[cur_subframe]; - s->channel[i].decoded_samples += - s->channel[i].subframe_len[cur_subframe]; - s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i; - ++s->channels_for_cur_subframe; - } - } - - /* check if the frame will be complete after processing the - estimated block */ - if (!total_samples) - s->parsed_all_subframes = 1; - - - s->seekable_tile = get_bits1(&s->gb); - if (s->seekable_tile) { - clear_codec_buffers(s); - - s->do_arith_coding = get_bits1(&s->gb); - if (s->do_arith_coding) { - avpriv_request_sample(s->avctx, "Arithmetic coding"); - return AVERROR_PATCHWELCOME; - } - s->do_ac_filter = get_bits1(&s->gb); - s->do_inter_ch_decorr = get_bits1(&s->gb); - s->do_mclms = get_bits1(&s->gb); - - if (s->do_ac_filter) - decode_ac_filter(s); - - if (s->do_mclms) - decode_mclms(s); - - if ((res = decode_cdlms(s)) < 0) - return res; - s->movave_scaling = get_bits(&s->gb, 3); - s->quant_stepsize = get_bits(&s->gb, 8) + 1; - - reset_codec(s); - } else if (!s->cdlms[0][0].order) { - av_log(s->avctx, AV_LOG_DEBUG, - "Waiting for seekable tile\n"); - av_frame_unref(s->frame); - return -1; - } - - rawpcm_tile = get_bits1(&s->gb); - - for (i = 0; i < s->num_channels; i++) - s->is_channel_coded[i] = 1; - - if (!rawpcm_tile) { - for (i = 0; i < s->num_channels; i++) - s->is_channel_coded[i] = get_bits1(&s->gb); - - if (s->bV3RTM) { - // LPC - s->do_lpc = get_bits1(&s->gb); - if (s->do_lpc) { - decode_lpc(s); - avpriv_request_sample(s->avctx, "Expect wrong output since " - "inverse LPC filter"); - } - } else - s->do_lpc = 0; - } - - - if (get_bits1(&s->gb)) - padding_zeroes = get_bits(&s->gb, 5); - else - padding_zeroes = 0; - - if (rawpcm_tile) { - int bits = s->bits_per_sample - padding_zeroes; - if (bits <= 0) { - av_log(s->avctx, AV_LOG_ERROR, - "Invalid number of padding bits in raw PCM tile\n"); - return AVERROR_INVALIDDATA; - } - av_dlog(s->avctx, "RAWPCM %d bits per sample. " - "total %d bits, remain=%d\n", bits, - bits * s->num_channels * subframe_len, get_bits_count(&s->gb)); - for (i = 0; i < s->num_channels; i++) - for (j = 0; j < subframe_len; j++) - s->channel_coeffs[i][j] = get_sbits_long(&s->gb, bits); - } else { - for (i = 0; i < s->num_channels; i++) - if (s->is_channel_coded[i]) { - decode_channel_residues(s, i, subframe_len); - if (s->seekable_tile) - use_high_update_speed(s, i); - else - use_normal_update_speed(s, i); - revert_cdlms(s, i, 0, subframe_len); - } else { - memset(s->channel_residues[i], 0, sizeof(**s->channel_residues) * subframe_len); - } - } - if (s->do_mclms) - revert_mclms(s, subframe_len); - if (s->do_inter_ch_decorr) - revert_inter_ch_decorr(s, subframe_len); - if (s->do_ac_filter) - revert_acfilter(s, subframe_len); - - /* Dequantize */ - if (s->quant_stepsize != 1) - for (i = 0; i < s->num_channels; i++) - for (j = 0; j < subframe_len; j++) - s->channel_residues[i][j] *= s->quant_stepsize; - - /* Write to proper output buffer depending on bit-depth */ - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - int subframe_len = s->channel[c].subframe_len[s->channel[c].cur_subframe]; - - for (j = 0; j < subframe_len; j++) { - if (s->bits_per_sample == 16) { - *s->samples_16[c]++ = (int16_t) s->channel_residues[c][j] << padding_zeroes; - } else { - *s->samples_32[c]++ = s->channel_residues[c][j] << padding_zeroes; - } - } - } - - /* handled one subframe */ - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { - av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n"); - return AVERROR_INVALIDDATA; - } - ++s->channel[c].cur_subframe; - } - return 0; -} - -/** - * @brief Decode one WMA frame. - * @param s codec context - * @return 0 if the trailer bit indicates that this is the last frame, - * 1 if there are additional frames - */ -static int decode_frame(WmallDecodeCtx *s) -{ - GetBitContext* gb = &s->gb; - int more_frames = 0, len = 0, i, ret; - - s->frame->nb_samples = s->samples_per_frame; - if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) { - /* return an error if no frame could be decoded at all */ - s->packet_loss = 1; - return ret; - } - for (i = 0; i < s->num_channels; i++) { - s->samples_16[i] = (int16_t *)s->frame->extended_data[i]; - s->samples_32[i] = (int32_t *)s->frame->extended_data[i]; - } - - /* get frame length */ - if (s->len_prefix) - len = get_bits(gb, s->log2_frame_size); - - /* decode tile information */ - if ((ret = decode_tilehdr(s))) { - s->packet_loss = 1; - av_frame_unref(s->frame); - return ret; - } - - /* read drc info */ - if (s->dynamic_range_compression) - s->drc_gain = get_bits(gb, 8); - - /* no idea what these are for, might be the number of samples - that need to be skipped at the beginning or end of a stream */ - if (get_bits1(gb)) { - int av_unused skip; - - /* usually true for the first frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - av_dlog(s->avctx, "start skip: %i\n", skip); - } - - /* sometimes true for the last frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - av_dlog(s->avctx, "end skip: %i\n", skip); - } - - } - - /* reset subframe states */ - s->parsed_all_subframes = 0; - for (i = 0; i < s->num_channels; i++) { - s->channel[i].decoded_samples = 0; - s->channel[i].cur_subframe = 0; - } - - /* decode all subframes */ - while (!s->parsed_all_subframes) { - int decoded_samples = s->channel[0].decoded_samples; - if (decode_subframe(s) < 0) { - s->packet_loss = 1; - if (s->frame->nb_samples) - s->frame->nb_samples = decoded_samples; - return 0; - } - } - - av_dlog(s->avctx, "Frame done\n"); - - if (s->skip_frame) - s->skip_frame = 0; - - if (s->len_prefix) { - if (len != (get_bits_count(gb) - s->frame_offset) + 2) { - /* FIXME: not sure if this is always an error */ - av_log(s->avctx, AV_LOG_ERROR, - "frame[%i] would have to skip %i bits\n", s->frame_num, - len - (get_bits_count(gb) - s->frame_offset) - 1); - s->packet_loss = 1; - return 0; - } - - /* skip the rest of the frame data */ - skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1); - } - - /* decode trailer bit */ - more_frames = get_bits1(gb); - ++s->frame_num; - return more_frames; -} - -/** - * @brief Calculate remaining input buffer length. - * @param s codec context - * @param gb bitstream reader context - * @return remaining size in bits - */ -static int remaining_bits(WmallDecodeCtx *s, GetBitContext *gb) -{ - return s->buf_bit_size - get_bits_count(gb); -} - -/** - * @brief Fill the bit reservoir with a (partial) frame. - * @param s codec context - * @param gb bitstream reader context - * @param len length of the partial frame - * @param append decides whether to reset the buffer or not - */ -static void save_bits(WmallDecodeCtx *s, GetBitContext* gb, int len, - int append) -{ - int buflen; - PutBitContext tmp; - - /* when the frame data does not need to be concatenated, the input buffer - is reset and additional bits from the previous frame are copied - and skipped later so that a fast byte copy is possible */ - - if (!append) { - s->frame_offset = get_bits_count(gb) & 7; - s->num_saved_bits = s->frame_offset; - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); - } - - buflen = (s->num_saved_bits + len + 8) >> 3; - - if (len <= 0 || buflen > MAX_FRAMESIZE) { - avpriv_request_sample(s->avctx, "Too small input buffer"); - s->packet_loss = 1; - return; - } - - s->num_saved_bits += len; - if (!append) { - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), - s->num_saved_bits); - } else { - int align = 8 - (get_bits_count(gb) & 7); - align = FFMIN(align, len); - put_bits(&s->pb, align, get_bits(gb, align)); - len -= align; - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); - } - skip_bits_long(gb, len); - - tmp = s->pb; - flush_put_bits(&tmp); - - init_get_bits(&s->gb, s->frame_data, s->num_saved_bits); - skip_bits(&s->gb, s->frame_offset); -} - -static int decode_packet(AVCodecContext *avctx, void *data, int *got_frame_ptr, - AVPacket* avpkt) -{ - WmallDecodeCtx *s = avctx->priv_data; - GetBitContext* gb = &s->pgb; - const uint8_t* buf = avpkt->data; - int buf_size = avpkt->size; - int num_bits_prev_frame, packet_sequence_number, spliced_packet; - - s->frame->nb_samples = 0; - - if (s->packet_done || s->packet_loss) { - s->packet_done = 0; - - if (!buf_size) - return 0; - /* sanity check for the buffer length */ - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "buf size %d invalid\n", buf_size); - return AVERROR_INVALIDDATA; - } - - s->next_packet_start = buf_size - avctx->block_align; - buf_size = avctx->block_align; - s->buf_bit_size = buf_size << 3; - - /* parse packet header */ - init_get_bits(gb, buf, s->buf_bit_size); - packet_sequence_number = get_bits(gb, 4); - skip_bits(gb, 1); // Skip seekable_frame_in_packet, currently ununused - spliced_packet = get_bits1(gb); - if (spliced_packet) - avpriv_request_sample(avctx, "Bitstream splicing"); - - /* get number of bits that need to be added to the previous frame */ - num_bits_prev_frame = get_bits(gb, s->log2_frame_size); - - /* check for packet loss */ - if (!s->packet_loss && - ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { - s->packet_loss = 1; - av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", - s->packet_sequence_number, packet_sequence_number); - } - s->packet_sequence_number = packet_sequence_number; - - if (num_bits_prev_frame > 0) { - int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); - if (num_bits_prev_frame >= remaining_packet_bits) { - num_bits_prev_frame = remaining_packet_bits; - s->packet_done = 1; - } - - /* Append the previous frame data to the remaining data from the - * previous packet to create a full frame. */ - save_bits(s, gb, num_bits_prev_frame, 1); - - /* decode the cross packet frame if it is valid */ - if (num_bits_prev_frame < remaining_packet_bits && !s->packet_loss) - decode_frame(s); - } else if (s->num_saved_bits - s->frame_offset) { - av_dlog(avctx, "ignoring %x previously saved bits\n", - s->num_saved_bits - s->frame_offset); - } - - if (s->packet_loss) { - /* Reset number of saved bits so that the decoder does not start - * to decode incomplete frames in the s->len_prefix == 0 case. */ - s->num_saved_bits = 0; - s->packet_loss = 0; - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); - } - - } else { - int frame_size; - - s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; - init_get_bits(gb, avpkt->data, s->buf_bit_size); - skip_bits(gb, s->packet_offset); - - if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && - (frame_size = show_bits(gb, s->log2_frame_size)) && - frame_size <= remaining_bits(s, gb)) { - save_bits(s, gb, frame_size, 0); - s->packet_done = !decode_frame(s); - } else if (!s->len_prefix - && s->num_saved_bits > get_bits_count(&s->gb)) { - /* when the frames do not have a length prefix, we don't know the - * compressed length of the individual frames however, we know what - * part of a new packet belongs to the previous frame therefore we - * save the incoming packet first, then we append the "previous - * frame" data from the next packet so that we get a buffer that - * only contains full frames */ - s->packet_done = !decode_frame(s); - } else { - s->packet_done = 1; - } - } - - if (s->packet_done && !s->packet_loss && - remaining_bits(s, gb) > 0) { - /* save the rest of the data so that it can be decoded - * with the next packet */ - save_bits(s, gb, remaining_bits(s, gb), 0); - } - - *got_frame_ptr = s->frame->nb_samples > 0; - av_frame_move_ref(data, s->frame); - - s->packet_offset = get_bits_count(gb) & 7; - - return (s->packet_loss) ? AVERROR_INVALIDDATA : get_bits_count(gb) >> 3; -} - -static void flush(AVCodecContext *avctx) -{ - WmallDecodeCtx *s = avctx->priv_data; - s->packet_loss = 1; - s->packet_done = 0; - s->num_saved_bits = 0; - s->frame_offset = 0; - s->next_packet_start = 0; - s->cdlms[0][0].order = 0; - s->frame->nb_samples = 0; - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); -} - -static av_cold int decode_close(AVCodecContext *avctx) -{ - WmallDecodeCtx *s = avctx->priv_data; - - av_frame_free(&s->frame); - - return 0; -} - -AVCodec ff_wmalossless_decoder = { - .name = "wmalossless", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Lossless"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_WMALOSSLESS, - .priv_data_size = sizeof(WmallDecodeCtx), - .init = decode_init, - .close = decode_close, - .decode = decode_packet, - .flush = flush, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1 | CODEC_CAP_DELAY, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S32P, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodata.h deleted file mode 100644 index 53824799d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodata.h +++ /dev/null @@ -1,604 +0,0 @@ -/* - * WMA 9/3/PRO compatible decoder - * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion - * Copyright (c) 2008 - 2009 Sascha Sommer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief tables for wmapro decoding - */ - -#ifndef AVCODEC_WMAPRODATA_H -#define AVCODEC_WMAPRODATA_H - -#include -#include - -/** - * @brief frequencies to divide the frequency spectrum into scale factor bands - */ -static const uint16_t critical_freq[] = { - 100, 200, 300, 400, 510, 630, 770, - 920, 1080, 1270, 1480, 1720, 2000, 2320, - 2700, 3150, 3700, 4400, 5300, 6400, 7700, - 9500, 12000, 15500, 20675, 28575, 41375, 63875, -}; - - -/** - * @name Huffman tables for DPCM-coded scale factors - * @{ - */ -#define HUFF_SCALE_SIZE 121 -#define HUFF_SCALE_MAXBITS 19 -static const uint16_t scale_huffcodes[HUFF_SCALE_SIZE] = { - 0xE639, 0xE6C2, 0xE6C1, 0xE6C0, 0xE63F, 0xE63E, 0xE63D, 0xE63C, - 0xE63B, 0xE63A, 0xE638, 0xE637, 0xE636, 0xE635, 0xE634, 0xE632, - 0xE633, 0xE620, 0x737B, 0xE610, 0xE611, 0xE612, 0xE613, 0xE614, - 0xE615, 0xE616, 0xE617, 0xE618, 0xE619, 0xE61A, 0xE61B, 0xE61C, - 0xE61D, 0xE61E, 0xE61F, 0xE6C3, 0xE621, 0xE622, 0xE623, 0xE624, - 0xE625, 0xE626, 0xE627, 0xE628, 0xE629, 0xE62A, 0xE62B, 0xE62C, - 0xE62D, 0xE62E, 0xE62F, 0xE630, 0xE631, 0x1CDF, 0x0E60, 0x0399, - 0x00E7, 0x001D, 0x0000, 0x0001, 0x0001, 0x0001, 0x0002, 0x0006, - 0x0002, 0x0007, 0x0006, 0x000F, 0x0038, 0x0072, 0x039A, 0xE6C4, - 0xE6C5, 0xE6C6, 0xE6C7, 0xE6C8, 0xE6C9, 0xE6CA, 0xE6CB, 0xE6CC, - 0xE6CD, 0xE6CE, 0xE6CF, 0xE6D0, 0xE6D1, 0xE6D2, 0xE6D3, 0xE6D4, - 0xE6D5, 0xE6D6, 0xE6D7, 0xE6D8, 0xE6D9, 0xE6DA, 0xE6DB, 0xE6DC, - 0xE6DD, 0xE6DE, 0xE6DF, 0xE6E0, 0xE6E1, 0xE6E2, 0xE6E3, 0xE6E4, - 0xE6E5, 0xE6E6, 0xE6E7, 0xE6E8, 0xE6E9, 0xE6EA, 0xE6EB, 0xE6EC, - 0xE6ED, 0xE6EE, 0xE6EF, 0xE6F0, 0xE6F1, 0xE6F2, 0xE6F3, 0xE6F4, - 0xE6F5, -}; - -static const uint8_t scale_huffbits[HUFF_SCALE_SIZE] = { - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 18, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 16, 15, 13, - 11, 8, 5, 2, 1, 3, 5, 6, - 6, 7, 7, 7, 9, 10, 13, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19, - 19, -}; -/** @} */ - - -/** - * @name Huffman, run and level tables for runlevel-coded scale factors - * @{ - */ -#define HUFF_SCALE_RL_SIZE 120 -#define HUFF_SCALE_RL_MAXBITS 21 -static const uint32_t scale_rl_huffcodes[HUFF_SCALE_RL_SIZE] = { - 0x00010C, 0x000001, 0x10FE2A, 0x000003, 0x000003, 0x000001, 0x000013, - 0x000020, 0x000029, 0x000014, 0x000016, 0x000045, 0x000049, 0x00002F, - 0x000042, 0x00008E, 0x00008F, 0x000129, 0x000009, 0x00000D, 0x0004AC, - 0x00002C, 0x000561, 0x0002E6, 0x00087C, 0x0002E2, 0x00095C, 0x000018, - 0x000001, 0x000016, 0x000044, 0x00002A, 0x000007, 0x000159, 0x000143, - 0x000128, 0x00015A, 0x00012D, 0x00002B, 0x0000A0, 0x000142, 0x00012A, - 0x0002EF, 0x0004AF, 0x00087D, 0x004AE9, 0x0043F9, 0x000067, 0x000199, - 0x002B05, 0x001583, 0x0021FE, 0x10FE2C, 0x000004, 0x00002E, 0x00010D, - 0x00000A, 0x000244, 0x000017, 0x000245, 0x000011, 0x00010E, 0x00012C, - 0x00002A, 0x00002F, 0x000121, 0x000046, 0x00087E, 0x0000BA, 0x000032, - 0x0087F0, 0x0056DC, 0x0002EC, 0x0043FA, 0x002B6F, 0x004AE8, 0x0002B7, - 0x10FE2B, 0x000001, 0x000051, 0x000010, 0x0002EE, 0x000B9C, 0x002576, - 0x000198, 0x0056DD, 0x0000CD, 0x000AC0, 0x000170, 0x004AEF, 0x00002D, - 0x0004AD, 0x0021FF, 0x0005CF, 0x002B04, 0x10FE29, 0x10FE28, 0x0002ED, - 0x002E74, 0x021FC4, 0x004AEE, 0x010FE3, 0x087F17, 0x000000, 0x000097, - 0x0002E3, 0x000ADA, 0x002575, 0x00173B, 0x0043FB, 0x002E75, 0x10FE2D, - 0x0015B6, 0x00056C, 0x000057, 0x000123, 0x000120, 0x00021E, 0x000172, - 0x0002B1, -}; - -static const uint8_t scale_rl_huffbits[HUFF_SCALE_RL_SIZE] = { - 9, 2, 21, 2, 4, 5, 5, - 6, 6, 7, 7, 7, 7, 6, - 7, 8, 8, 9, 10, 10, 11, - 12, 11, 12, 12, 12, 12, 11, - 4, 5, 7, 8, 9, 9, 9, - 9, 9, 9, 8, 8, 9, 9, - 12, 11, 12, 15, 15, 13, 15, - 14, 13, 14, 21, 5, 6, 9, - 10, 10, 11, 10, 11, 9, 9, - 6, 8, 9, 7, 12, 10, 12, - 16, 15, 12, 15, 14, 15, 10, - 21, 6, 7, 11, 12, 14, 14, - 15, 15, 14, 12, 11, 15, 12, - 11, 14, 13, 14, 21, 21, 12, - 16, 18, 15, 17, 20, 7, 8, - 12, 12, 14, 15, 15, 16, 21, - 13, 11, 7, 9, 9, 10, 11, - 10, -}; - - -static const uint8_t scale_rl_run[HUFF_SCALE_RL_SIZE] = { - 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 0, 1, 0, 1, 0, 1, -}; - -static const uint8_t scale_rl_level[HUFF_SCALE_RL_SIZE] = { - 0, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 8, 8, 9, 9, -}; -/** @} */ - - -/** - * @name Huffman, run and level codes for runlevel-coded coefficients - * @{ - */ -#define HUFF_COEF0_SIZE 272 -#define HUFF_COEF0_MAXBITS 21 -static const uint32_t coef0_huffcodes[HUFF_COEF0_SIZE] = { - 0x00004A, 0x00002B, 0x000000, 0x000003, 0x000006, 0x000009, 0x00000F, - 0x000010, 0x000016, 0x000011, 0x000016, 0x000028, 0x00002F, 0x000026, - 0x000029, 0x000045, 0x000055, 0x00005D, 0x000042, 0x00004E, 0x000051, - 0x00005E, 0x00008D, 0x0000A8, 0x0000AD, 0x000080, 0x000096, 0x00009F, - 0x0000AA, 0x0000BE, 0x00011C, 0x000153, 0x000158, 0x000170, 0x000104, - 0x00010D, 0x000105, 0x000103, 0x00012F, 0x000177, 0x000175, 0x000157, - 0x000174, 0x000225, 0x00023B, 0x00020D, 0x00021F, 0x000281, 0x00027B, - 0x000282, 0x0002AC, 0x0002FD, 0x00044F, 0x000478, 0x00044D, 0x0002EC, - 0x00044E, 0x000564, 0x000409, 0x00040B, 0x000501, 0x000545, 0x0004F3, - 0x000541, 0x00043B, 0x0004F1, 0x0004F4, 0x0008FD, 0x000A94, 0x000811, - 0x000B88, 0x000B91, 0x000B93, 0x0008EA, 0x000899, 0x000B8A, 0x000972, - 0x0009E5, 0x000A8F, 0x000A84, 0x000A8E, 0x000A00, 0x000830, 0x0008E8, - 0x000B95, 0x000871, 0x00083A, 0x000814, 0x000873, 0x000BFE, 0x001728, - 0x001595, 0x001712, 0x00102A, 0x001021, 0x001729, 0x00152E, 0x0013C3, - 0x001721, 0x001597, 0x00151B, 0x0010F2, 0x001403, 0x001703, 0x001503, - 0x001708, 0x0013C1, 0x00170E, 0x00170C, 0x0010E1, 0x0011EA, 0x001020, - 0x001500, 0x0017FA, 0x001704, 0x001705, 0x0017F0, 0x0017FB, 0x0021E6, - 0x002B2D, 0x0020C6, 0x002B29, 0x002E4A, 0x0023AC, 0x001519, 0x0023F3, - 0x002B2C, 0x0021C0, 0x0017FE, 0x0023D7, 0x0017F9, 0x0012E7, 0x0013C0, - 0x002261, 0x0023D3, 0x002057, 0x002056, 0x0021D2, 0x0020C7, 0x0023D2, - 0x0020EC, 0x0044C0, 0x002FE2, 0x00475B, 0x002A03, 0x002FE3, 0x0021E2, - 0x0021D0, 0x002A31, 0x002E13, 0x002E05, 0x0047E5, 0x00000E, 0x000024, - 0x000088, 0x0000B9, 0x00010C, 0x000224, 0x0002B3, 0x000283, 0x0002ED, - 0x00047B, 0x00041E, 0x00043D, 0x0004F5, 0x0005FD, 0x000A92, 0x000B96, - 0x000838, 0x000971, 0x000B83, 0x000B80, 0x000BF9, 0x0011D3, 0x0011E8, - 0x0011D7, 0x001527, 0x0011F8, 0x001073, 0x0010F0, 0x0010E4, 0x0017F8, - 0x001062, 0x001402, 0x0017E3, 0x00151A, 0x001077, 0x00152B, 0x00170D, - 0x0021D3, 0x002E41, 0x0013C2, 0x000029, 0x0000A9, 0x00025D, 0x000419, - 0x000544, 0x000B8B, 0x0009E4, 0x0011D2, 0x001526, 0x001724, 0x0012E6, - 0x00150B, 0x0017FF, 0x002E26, 0x002E4B, 0x002B28, 0x0021E3, 0x002A14, - 0x00475A, 0x002E12, 0x000057, 0x00023E, 0x000A90, 0x000BF0, 0x001072, - 0x001502, 0x0023D6, 0x0020ED, 0x002A30, 0x0044C7, 0x00008C, 0x00047F, - 0x00152A, 0x002262, 0x002E04, 0x0000A1, 0x0005F9, 0x000173, 0x000875, - 0x000171, 0x00152D, 0x0002E3, 0x0017E2, 0x0002AD, 0x0021C1, 0x000479, - 0x0021E7, 0x00041F, 0x005C4E, 0x000543, 0x005C4F, 0x000A91, 0x00898D, - 0x000B97, 0x008746, 0x000970, 0x008745, 0x000B85, 0x00A856, 0x00152F, - 0x010E8E, 0x0010E5, 0x00A857, 0x00170F, 0x021D11, 0x002A58, 0x010E8F, - 0x002E40, 0x021D13, 0x002A59, 0x043A25, 0x002A02, 0x043A21, 0x0044C1, - 0x087448, 0x0047E4, 0x043A20, 0x00542A, 0x087449, 0x00898C, -}; - -static const uint8_t coef0_huffbits[HUFF_COEF0_SIZE] = { - 8, 7, 2, 3, 3, 4, 4, - 5, 5, 6, 6, 6, 6, 7, - 7, 7, 7, 7, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 10, - 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, - 11, 11, 12, 12, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 13, - 12, 12, 12, 12, 12, 12, 13, - 13, 13, 13, 13, 13, 13, 12, - 12, 13, 13, 13, 13, 13, 13, - 13, 13, 14, 14, 13, 13, 14, - 13, 13, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 13, 14, - 14, 14, 14, 14, 14, 14, 15, - 14, 15, 14, 14, 14, 14, 14, - 14, 15, 14, 14, 14, 14, 14, - 14, 14, 15, 15, 15, 15, 14, - 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 4, 7, - 8, 9, 10, 10, 10, 11, 11, - 11, 12, 12, 12, 12, 12, 12, - 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 13, 14, - 15, 14, 14, 6, 9, 11, 12, - 12, 12, 13, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 15, 15, - 15, 15, 7, 10, 12, 13, 14, - 14, 14, 15, 15, 15, 8, 11, - 13, 14, 15, 9, 12, 9, 13, - 10, 13, 10, 14, 11, 15, 11, - 15, 12, 15, 12, 15, 12, 16, - 12, 17, 13, 17, 13, 17, 13, - 18, 14, 17, 14, 19, 14, 18, - 14, 19, 14, 20, 15, 20, 15, - 21, 15, 20, 16, 21, 16, -}; - - -#define HUFF_COEF1_SIZE 244 -#define HUFF_COEF1_MAXBITS 22 -static const uint32_t coef1_huffcodes[HUFF_COEF1_SIZE] = { - 0x0001E2, 0x00007F, 0x000000, 0x000002, 0x000008, 0x00000E, 0x000019, - 0x00002F, 0x000037, 0x000060, 0x00006C, 0x000095, 0x0000C6, 0x0000F0, - 0x00012E, 0x000189, 0x0001A5, 0x0001F8, 0x000253, 0x00030A, 0x000344, - 0x00034D, 0x0003F2, 0x0004BD, 0x0005D7, 0x00062A, 0x00068B, 0x000693, - 0x000797, 0x00097D, 0x000BAB, 0x000C52, 0x000C5E, 0x000D21, 0x000D20, - 0x000F1A, 0x000FCE, 0x000FD1, 0x0012F1, 0x001759, 0x0018AC, 0x0018A7, - 0x0018BF, 0x001A2B, 0x001E52, 0x001E50, 0x001E31, 0x001FB8, 0x0025E6, - 0x0025E7, 0x002EB4, 0x002EB7, 0x003169, 0x00315B, 0x00317C, 0x00316C, - 0x0034CA, 0x00348D, 0x003F40, 0x003CA2, 0x003F76, 0x004BC3, 0x004BE5, - 0x003F73, 0x004BF8, 0x004BF9, 0x006131, 0x00628B, 0x006289, 0x0062DA, - 0x00628A, 0x0062D4, 0x006997, 0x0062B4, 0x006918, 0x00794D, 0x007E7B, - 0x007E87, 0x007EEA, 0x00794E, 0x00699D, 0x007967, 0x00699F, 0x0062DB, - 0x007E7A, 0x007EEB, 0x00BAC0, 0x0097C9, 0x00C537, 0x00C5AB, 0x00D233, - 0x00D338, 0x00BAC1, 0x00D23D, 0x012F91, 0x00D339, 0x00FDC8, 0x00D23C, - 0x00FDDC, 0x00FDC9, 0x00FDDD, 0x00D33C, 0x000003, 0x000016, 0x00003E, - 0x0000C3, 0x0001A1, 0x000347, 0x00062E, 0x000BAA, 0x000F2D, 0x001A2A, - 0x001E58, 0x00309B, 0x003CA3, 0x005D6A, 0x00629A, 0x006996, 0x00794F, - 0x007EE5, 0x00BAD7, 0x00C5AA, 0x00C5F4, 0x00FDDF, 0x00FDDE, 0x018A20, - 0x018A6D, 0x01A67B, 0x01A464, 0x025F21, 0x01F9E2, 0x01F9E3, 0x00000A, - 0x00003D, 0x000128, 0x0003C7, 0x000C24, 0x0018A3, 0x002EB1, 0x003CB2, - 0x00691F, 0x007E79, 0x000013, 0x0000BB, 0x00034E, 0x000D14, 0x0025FD, - 0x004BE7, 0x000024, 0x000188, 0x0007EF, 0x000035, 0x000308, 0x0012F2, - 0x00005C, 0x0003F6, 0x0025E0, 0x00006D, 0x000698, 0x000096, 0x000C25, - 0x0000C7, 0x000F1B, 0x0000F3, 0x0012FF, 0x000174, 0x001A66, 0x0001A0, - 0x003099, 0x0001E4, 0x00316B, 0x000252, 0x003F31, 0x00030B, 0x004BE6, - 0x000346, 0x0062FB, 0x00034F, 0x007966, 0x0003F5, 0x007E86, 0x0005D4, - 0x00C511, 0x00062C, 0x00C5F5, 0x000692, 0x00F299, 0x000795, 0x00F298, - 0x0007E9, 0x018A21, 0x00097E, 0x0175AD, 0x000C27, 0x01A67A, 0x000C57, - 0x02EB59, 0x000D22, 0x0314D9, 0x000F19, 0x03F3C2, 0x000FCD, 0x0348CB, - 0x0012F8, 0x04BE41, 0x0018A0, 0x03F3C1, 0x0018A1, 0x04BE40, 0x0018B7, - 0x0629B0, 0x001A64, 0x0D2329, 0x001E30, 0x03F3C3, 0x001F9F, 0x0BAD62, - 0x001F99, 0x0FCF00, 0x00309A, 0x0629B1, 0x002EB6, 0x175AC3, 0x00314C, - 0x069195, 0x003168, 0x0BAD63, 0x00348E, 0x175AC1, 0x003F30, 0x07E781, - 0x003F41, 0x0D2328, 0x003F42, 0x1F9E03, 0x004BC2, 0x175AC2, 0x003F74, - 0x175AC0, 0x005D61, 0x3F3C05, 0x006130, 0x3F3C04, 0x0062B5, -}; - -static const uint8_t coef1_huffbits[HUFF_COEF1_SIZE] = { - 9, 7, 2, 3, 4, 4, 5, - 6, 6, 7, 7, 8, 8, 8, - 9, 9, 9, 9, 10, 10, 10, - 10, 10, 11, 11, 11, 11, 11, - 11, 12, 12, 12, 12, 12, 12, - 12, 12, 12, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 14, - 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 15, 15, - 14, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, - 15, 15, 16, 16, 16, 16, 16, - 16, 16, 16, 17, 16, 16, 16, - 16, 16, 16, 16, 3, 5, 6, - 8, 9, 10, 11, 12, 12, 13, - 13, 14, 14, 15, 15, 15, 15, - 15, 16, 16, 16, 16, 16, 17, - 17, 17, 17, 18, 17, 17, 4, - 6, 9, 10, 12, 13, 14, 14, - 15, 15, 5, 8, 10, 12, 14, - 15, 6, 9, 11, 6, 10, 13, - 7, 10, 14, 7, 11, 8, 12, - 8, 12, 8, 13, 9, 13, 9, - 14, 9, 14, 10, 14, 10, 15, - 10, 15, 10, 15, 10, 15, 11, - 16, 11, 16, 11, 16, 11, 16, - 11, 17, 12, 17, 12, 17, 12, - 18, 12, 18, 12, 18, 12, 18, - 13, 19, 13, 18, 13, 19, 13, - 19, 13, 20, 13, 18, 13, 20, - 13, 20, 14, 19, 14, 21, 14, - 19, 14, 20, 14, 21, 14, 19, - 14, 20, 14, 21, 15, 21, 14, - 21, 15, 22, 15, 22, 15, -}; - - -static const uint16_t coef0_run[HUFF_COEF0_SIZE] = { - 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 0, 1, - 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, - 2, 3, 4, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, -}; - -static const float coef0_level[HUFF_COEF0_SIZE] = { - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, - 5, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, - 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, - 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, - 25, 26, 26, 27, 27, 28, -}; - - -static const uint16_t coef1_run[HUFF_COEF1_SIZE] = { - 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, - 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 0, 1, 2, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, - 2, 3, 4, 5, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, - 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, -}; - -static const float coef1_level[HUFF_COEF1_SIZE] = { - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, - 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 9, 9, 10, - 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, - 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, - 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, - 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, - 46, 47, 47, 48, 48, 49, 49, 50, 51, 52, -}; -/** @} */ - - -/** - * @name Huffman and vector lookup tables for vector-coded coefficients - * @{ - */ -#define HUFF_VEC4_SIZE 127 -#define HUFF_VEC4_MAXBITS 14 -static const uint16_t vec4_huffcodes[HUFF_VEC4_SIZE] = { - 0x0019, 0x0027, 0x00F2, 0x03BA, 0x0930, 0x1267, 0x0031, 0x0030, - 0x0097, 0x0221, 0x058B, 0x0124, 0x00EB, 0x01D4, 0x03D8, 0x0584, - 0x0364, 0x045F, 0x0F66, 0x0931, 0x24CD, 0x002F, 0x0039, 0x00E8, - 0x02C3, 0x078A, 0x0037, 0x0029, 0x0084, 0x01B1, 0x00ED, 0x0086, - 0x00F9, 0x03AB, 0x01EB, 0x08BC, 0x011E, 0x00F3, 0x0220, 0x058A, - 0x00EC, 0x008E, 0x012B, 0x01EA, 0x0119, 0x04B0, 0x04B1, 0x03B8, - 0x0691, 0x0365, 0x01ED, 0x049A, 0x0EA9, 0x0EA8, 0x08BD, 0x24CC, - 0x0026, 0x0035, 0x00DB, 0x02C4, 0x07B2, 0x0038, 0x002B, 0x007F, - 0x01B3, 0x00F4, 0x0091, 0x0116, 0x03BB, 0x0215, 0x0932, 0x002D, - 0x002A, 0x008A, 0x01DE, 0x0028, 0x0020, 0x005C, 0x0090, 0x0068, - 0x01EE, 0x00E9, 0x008D, 0x012A, 0x0087, 0x005D, 0x0118, 0x0349, - 0x01EF, 0x01E3, 0x08B9, 0x00F0, 0x00D3, 0x0214, 0x049B, 0x00DA, - 0x0089, 0x0125, 0x0217, 0x012D, 0x0690, 0x0094, 0x007D, 0x011F, - 0x007E, 0x0059, 0x0127, 0x01A5, 0x0111, 0x00F8, 0x045D, 0x03B9, - 0x0259, 0x0580, 0x02C1, 0x01DF, 0x0585, 0x0216, 0x0163, 0x01B0, - 0x03C4, 0x08B8, 0x078B, 0x0755, 0x0581, 0x0F67, 0x0000, -}; - -static const uint8_t vec4_huffbits[HUFF_VEC4_SIZE] = { - 5, 6, 8, 10, 12, 13, 6, 6, - 8, 10, 11, 9, 8, 9, 10, 11, - 10, 11, 12, 12, 14, 6, 6, 8, - 10, 11, 6, 6, 8, 9, 8, 8, - 8, 10, 9, 12, 9, 8, 10, 11, - 8, 8, 9, 9, 9, 11, 11, 10, - 11, 10, 9, 11, 12, 12, 12, 14, - 6, 6, 8, 10, 11, 6, 6, 7, - 9, 8, 8, 9, 10, 10, 12, 6, - 6, 8, 9, 6, 6, 7, 8, 7, - 9, 8, 8, 9, 8, 7, 9, 10, - 9, 9, 12, 8, 8, 10, 11, 8, - 8, 9, 10, 9, 11, 8, 7, 9, - 7, 7, 9, 9, 9, 8, 11, 10, - 10, 11, 10, 9, 11, 10, 9, 9, - 10, 12, 11, 11, 11, 12, 1, -}; - - -#define HUFF_VEC2_SIZE 137 -#define HUFF_VEC2_MAXBITS 12 -static const uint16_t vec2_huffcodes[HUFF_VEC2_SIZE] = { - 0x055, 0x01C, 0x01A, 0x02B, 0x028, 0x067, 0x08B, 0x039, - 0x170, 0x10D, 0x2A5, 0x047, 0x464, 0x697, 0x523, 0x8CB, - 0x01B, 0x00E, 0x000, 0x010, 0x012, 0x036, 0x048, 0x04C, - 0x0C2, 0x09B, 0x171, 0x03B, 0x224, 0x34A, 0x2D6, 0x019, - 0x00F, 0x002, 0x014, 0x017, 0x006, 0x05D, 0x054, 0x0C7, - 0x0B4, 0x192, 0x10E, 0x233, 0x043, 0x02C, 0x00F, 0x013, - 0x006, 0x02F, 0x02C, 0x068, 0x077, 0x0DF, 0x111, 0x1A4, - 0x16A, 0x2A4, 0x027, 0x011, 0x018, 0x02D, 0x00F, 0x04A, - 0x040, 0x097, 0x01F, 0x11B, 0x022, 0x16D, 0x066, 0x035, - 0x005, 0x02B, 0x049, 0x009, 0x075, 0x0CB, 0x0AA, 0x187, - 0x106, 0x08A, 0x047, 0x060, 0x06E, 0x01D, 0x074, 0x0C4, - 0x01E, 0x118, 0x1A7, 0x038, 0x042, 0x053, 0x076, 0x0A8, - 0x0CA, 0x082, 0x110, 0x18D, 0x12D, 0x0B9, 0x0C8, 0x0DE, - 0x01C, 0x0AB, 0x113, 0x18C, 0x10F, 0x09A, 0x0A5, 0x0B7, - 0x11A, 0x186, 0x1A6, 0x259, 0x153, 0x18A, 0x193, 0x020, - 0x10C, 0x046, 0x03A, 0x107, 0x149, 0x16C, 0x2D7, 0x225, - 0x258, 0x316, 0x696, 0x317, 0x042, 0x522, 0x290, 0x8CA, - 0x001, -}; - -static const uint8_t vec2_huffbits[HUFF_VEC2_SIZE] = { - 7, 6, 6, 6, 7, 7, 8, 9, - 9, 10, 10, 11, 11, 11, 12, 12, - 6, 4, 5, 5, 6, 6, 7, 8, - 8, 9, 9, 10, 10, 10, 11, 6, - 4, 5, 5, 6, 7, 7, 8, 8, - 9, 9, 10, 10, 11, 6, 5, 5, - 6, 6, 7, 7, 8, 8, 9, 9, - 10, 10, 7, 6, 6, 6, 7, 7, - 8, 8, 9, 9, 10, 10, 7, 6, - 7, 7, 7, 8, 8, 8, 9, 9, - 10, 8, 7, 7, 7, 8, 8, 8, - 9, 9, 9, 9, 8, 8, 8, 8, - 8, 9, 9, 9, 9, 8, 8, 8, - 9, 9, 9, 9, 10, 9, 9, 9, - 9, 9, 9, 10, 9, 9, 9, 10, - 10, 11, 10, 10, 10, 10, 11, 10, - 10, 10, 11, 10, 11, 12, 11, 12, - 3, -}; - - -#define HUFF_VEC1_SIZE 101 -#define HUFF_VEC1_MAXBITS 11 -static const uint16_t vec1_huffcodes[HUFF_VEC1_SIZE] = { - 0x01A, 0x003, 0x017, 0x010, 0x00C, 0x009, 0x005, 0x000, - 0x00D, 0x00A, 0x009, 0x00C, 0x00F, 0x002, 0x004, 0x007, - 0x00B, 0x00F, 0x01C, 0x006, 0x010, 0x015, 0x01C, 0x022, - 0x03B, 0x00E, 0x019, 0x023, 0x034, 0x036, 0x03A, 0x047, - 0x008, 0x00A, 0x01E, 0x031, 0x037, 0x050, 0x053, 0x06B, - 0x06F, 0x08C, 0x0E8, 0x0EA, 0x0EB, 0x016, 0x03E, 0x03F, - 0x06C, 0x089, 0x08A, 0x0A3, 0x0A4, 0x0D4, 0x0DD, 0x0EC, - 0x0EE, 0x11A, 0x1D2, 0x024, 0x025, 0x02E, 0x027, 0x0C2, - 0x0C0, 0x0DA, 0x0DB, 0x111, 0x144, 0x116, 0x14A, 0x145, - 0x1B8, 0x1AB, 0x1DA, 0x1DE, 0x1DB, 0x1DF, 0x236, 0x237, - 0x3A6, 0x3A7, 0x04D, 0x04C, 0x05E, 0x05F, 0x183, 0x182, - 0x186, 0x221, 0x187, 0x220, 0x22E, 0x22F, 0x296, 0x354, - 0x297, 0x355, 0x372, 0x373, 0x016, -}; - -static const uint8_t vec1_huffbits[HUFF_VEC1_SIZE] = { - 7, 6, 5, 5, 5, 5, 5, 5, - 4, 4, 4, 4, 4, 5, 5, 5, - 5, 5, 5, 6, 6, 6, 6, 6, - 6, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 9, 9, - 9, 9, 9, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 5, -}; - - -static const uint16_t symbol_to_vec4[HUFF_VEC4_SIZE] = { - 0, 1, 2, 3, 4, 5, 16, 17, 18, 19, - 20, 32, 33, 34, 35, 48, 49, 50, 64, 65, - 80, 256, 257, 258, 259, 260, 272, 273, 274, 275, - 288, 289, 290, 304, 305, 320, 512, 513, 514, 515, - 528, 529, 530, 544, 545, 560, 768, 769, 770, 784, - 785, 800, 1024, 1025, 1040, 1280, 4096, 4097, 4098, 4099, - 4100, 4112, 4113, 4114, 4115, 4128, 4129, 4130, 4144, 4145, - 4160, 4352, 4353, 4354, 4355, 4368, 4369, 4370, 4384, 4385, - 4400, 4608, 4609, 4610, 4624, 4625, 4640, 4864, 4865, 4880, - 5120, 8192, 8193, 8194, 8195, 8208, 8209, 8210, 8224, 8225, - 8240, 8448, 8449, 8450, 8464, 8465, 8480, 8704, 8705, 8720, - 8960, 12288, 12289, 12290, 12304, 12305, 12320, 12544, 12545, 12560, - 12800, 16384, 16385, 16400, 16640, 20480, 0, -}; - - -static const uint8_t symbol_to_vec2[HUFF_VEC2_SIZE] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 64, 65, - 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 128, 129, 130, 131, 132, - 133, 134, 135, 144, 145, 146, 147, 148, 149, 150, 160, 161, 162, 163, 164, - 165, 176, 177, 178, 179, 180, 192, 193, 194, 195, 208, 209, 210, 224, 225, - 240, 0, -}; -/** @} */ - - -/** - * @brief decorrelation matrix for multichannel streams - **/ -static const float default_decorrelation_matrices[] = { - 1.000000, 0.707031, -0.707031, 0.707031, 0.707031, 0.578125, 0.707031, - 0.410156, 0.578125, -0.707031, 0.410156, 0.578125, 0.000000, -0.816406, - 0.500000, 0.652344, 0.500000, 0.269531, 0.500000, 0.269531, -0.500000, - -0.652344, 0.500000, -0.269531, -0.500000, 0.652344, 0.500000, -0.652344, - 0.500000, -0.269531, 0.445312, 0.601562, 0.511719, 0.371094, 0.195312, - 0.445312, 0.371094, -0.195312, -0.601562, -0.511719, 0.445312, 0.000000, - -0.632812, 0.000000, 0.632812, 0.445312, -0.371094, -0.195312, 0.601562, - -0.511719, 0.445312, -0.601562, 0.511719, -0.371094, 0.195312, 0.410156, - 0.558594, 0.500000, 0.410156, 0.289062, 0.148438, 0.410156, 0.410156, - 0.000000, -0.410156, -0.578125, -0.410156, 0.410156, 0.148438, -0.500000, - -0.410156, 0.289062, 0.558594, 0.410156, -0.148438, -0.500000, 0.410156, - 0.289062, -0.558594, 0.410156, -0.410156, 0.000000, 0.410156, -0.578125, - 0.410156, 0.410156, -0.558594, 0.500000, -0.410156, 0.289062, -0.148438, -}; - -/** - * @brief default decorrelation matrix offsets - */ -static const float * const default_decorrelation[] = { - NULL, - &default_decorrelation_matrices[0], - &default_decorrelation_matrices[1], - &default_decorrelation_matrices[5], - &default_decorrelation_matrices[14], - &default_decorrelation_matrices[30], - &default_decorrelation_matrices[55] -}; - -#endif /* AVCODEC_WMAPRODATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodec.c deleted file mode 100644 index d57c24ddd..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmaprodec.c +++ /dev/null @@ -1,1662 +0,0 @@ -/* - * Wmapro compatible decoder - * Copyright (c) 2007 Baptiste Coudurier, Benjamin Larsson, Ulion - * Copyright (c) 2008 - 2011 Sascha Sommer, Benjamin Larsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief wmapro decoder implementation - * Wmapro is an MDCT based codec comparable to wma standard or AAC. - * The decoding therefore consists of the following steps: - * - bitstream decoding - * - reconstruction of per-channel data - * - rescaling and inverse quantization - * - IMDCT - * - windowing and overlapp-add - * - * The compressed wmapro bitstream is split into individual packets. - * Every such packet contains one or more wma frames. - * The compressed frames may have a variable length and frames may - * cross packet boundaries. - * Common to all wmapro frames is the number of samples that are stored in - * a frame. - * The number of samples and a few other decode flags are stored - * as extradata that has to be passed to the decoder. - * - * The wmapro frames themselves are again split into a variable number of - * subframes. Every subframe contains the data for 2^N time domain samples - * where N varies between 7 and 12. - * - * Example wmapro bitstream (in samples): - * - * || packet 0 || packet 1 || packet 2 packets - * --------------------------------------------------- - * || frame 0 || frame 1 || frame 2 || frames - * --------------------------------------------------- - * || | | || | | | || || subframes of channel 0 - * --------------------------------------------------- - * || | | || | | | || || subframes of channel 1 - * --------------------------------------------------- - * - * The frame layouts for the individual channels of a wma frame does not need - * to be the same. - * - * However, if the offsets and lengths of several subframes of a frame are the - * same, the subframes of the channels can be grouped. - * Every group may then use special coding techniques like M/S stereo coding - * to improve the compression ratio. These channel transformations do not - * need to be applied to a whole subframe. Instead, they can also work on - * individual scale factor bands (see below). - * The coefficients that carry the audio signal in the frequency domain - * are transmitted as huffman-coded vectors with 4, 2 and 1 elements. - * In addition to that, the encoder can switch to a runlevel coding scheme - * by transmitting subframe_length / 128 zero coefficients. - * - * Before the audio signal can be converted to the time domain, the - * coefficients have to be rescaled and inverse quantized. - * A subframe is therefore split into several scale factor bands that get - * scaled individually. - * Scale factors are submitted for every frame but they might be shared - * between the subframes of a channel. Scale factors are initially DPCM-coded. - * Once scale factors are shared, the differences are transmitted as runlevel - * codes. - * Every subframe length and offset combination in the frame layout shares a - * common quantization factor that can be adjusted for every channel by a - * modifier. - * After the inverse quantization, the coefficients get processed by an IMDCT. - * The resulting values are then windowed with a sine window and the first half - * of the values are added to the second half of the output from the previous - * subframe in order to reconstruct the output samples. - */ - -#include "libavutil/float_dsp.h" -#include "libavutil/intfloat.h" -#include "libavutil/intreadwrite.h" -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "put_bits.h" -#include "wmaprodata.h" -#include "sinewin.h" -#include "wma.h" -#include "wma_common.h" - -/** current decoder limitations */ -#define WMAPRO_MAX_CHANNELS 8 ///< max number of handled channels -#define MAX_SUBFRAMES 32 ///< max number of subframes per channel -#define MAX_BANDS 29 ///< max number of scale factor bands -#define MAX_FRAMESIZE 32768 ///< maximum compressed frame size - -#define WMAPRO_BLOCK_MIN_BITS 6 ///< log2 of min block size -#define WMAPRO_BLOCK_MAX_BITS 13 ///< log2 of max block size -#define WMAPRO_BLOCK_MIN_SIZE (1 << WMAPRO_BLOCK_MIN_BITS) ///< minimum block size -#define WMAPRO_BLOCK_MAX_SIZE (1 << WMAPRO_BLOCK_MAX_BITS) ///< maximum block size -#define WMAPRO_BLOCK_SIZES (WMAPRO_BLOCK_MAX_BITS - WMAPRO_BLOCK_MIN_BITS + 1) ///< possible block sizes - - -#define VLCBITS 9 -#define SCALEVLCBITS 8 -#define VEC4MAXDEPTH ((HUFF_VEC4_MAXBITS+VLCBITS-1)/VLCBITS) -#define VEC2MAXDEPTH ((HUFF_VEC2_MAXBITS+VLCBITS-1)/VLCBITS) -#define VEC1MAXDEPTH ((HUFF_VEC1_MAXBITS+VLCBITS-1)/VLCBITS) -#define SCALEMAXDEPTH ((HUFF_SCALE_MAXBITS+SCALEVLCBITS-1)/SCALEVLCBITS) -#define SCALERLMAXDEPTH ((HUFF_SCALE_RL_MAXBITS+VLCBITS-1)/VLCBITS) - -static VLC sf_vlc; ///< scale factor DPCM vlc -static VLC sf_rl_vlc; ///< scale factor run length vlc -static VLC vec4_vlc; ///< 4 coefficients per symbol -static VLC vec2_vlc; ///< 2 coefficients per symbol -static VLC vec1_vlc; ///< 1 coefficient per symbol -static VLC coef_vlc[2]; ///< coefficient run length vlc codes -static float sin64[33]; ///< sine table for decorrelation - -/** - * @brief frame specific decoder context for a single channel - */ -typedef struct { - int16_t prev_block_len; ///< length of the previous block - uint8_t transmit_coefs; - uint8_t num_subframes; - uint16_t subframe_len[MAX_SUBFRAMES]; ///< subframe length in samples - uint16_t subframe_offset[MAX_SUBFRAMES]; ///< subframe positions in the current frame - uint8_t cur_subframe; ///< current subframe number - uint16_t decoded_samples; ///< number of already processed samples - uint8_t grouped; ///< channel is part of a group - int quant_step; ///< quantization step for the current subframe - int8_t reuse_sf; ///< share scale factors between subframes - int8_t scale_factor_step; ///< scaling step for the current subframe - int max_scale_factor; ///< maximum scale factor for the current subframe - int saved_scale_factors[2][MAX_BANDS]; ///< resampled and (previously) transmitted scale factor values - int8_t scale_factor_idx; ///< index for the transmitted scale factor values (used for resampling) - int* scale_factors; ///< pointer to the scale factor values used for decoding - uint8_t table_idx; ///< index in sf_offsets for the scale factor reference block - float* coeffs; ///< pointer to the subframe decode buffer - uint16_t num_vec_coeffs; ///< number of vector coded coefficients - DECLARE_ALIGNED(32, float, out)[WMAPRO_BLOCK_MAX_SIZE + WMAPRO_BLOCK_MAX_SIZE / 2]; ///< output buffer -} WMAProChannelCtx; - -/** - * @brief channel group for channel transformations - */ -typedef struct { - uint8_t num_channels; ///< number of channels in the group - int8_t transform; ///< transform on / off - int8_t transform_band[MAX_BANDS]; ///< controls if the transform is enabled for a certain band - float decorrelation_matrix[WMAPRO_MAX_CHANNELS*WMAPRO_MAX_CHANNELS]; - float* channel_data[WMAPRO_MAX_CHANNELS]; ///< transformation coefficients -} WMAProChannelGrp; - -/** - * @brief main decoder context - */ -typedef struct WMAProDecodeCtx { - /* generic decoder variables */ - AVCodecContext* avctx; ///< codec context for av_log - AVFloatDSPContext fdsp; - uint8_t frame_data[MAX_FRAMESIZE + - FF_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data - PutBitContext pb; ///< context for filling the frame_data buffer - FFTContext mdct_ctx[WMAPRO_BLOCK_SIZES]; ///< MDCT context per block size - DECLARE_ALIGNED(32, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer - float* windows[WMAPRO_BLOCK_SIZES]; ///< windows for the different block sizes - - /* frame size dependent frame information (set during initialization) */ - uint32_t decode_flags; ///< used compression features - uint8_t len_prefix; ///< frame is prefixed with its length - uint8_t dynamic_range_compression; ///< frame contains DRC data - uint8_t bits_per_sample; ///< integer audio sample size for the unscaled IMDCT output (used to scale to [-1.0, 1.0]) - uint16_t samples_per_frame; ///< number of samples to output - uint16_t log2_frame_size; - int8_t lfe_channel; ///< lfe channel index - uint8_t max_num_subframes; - uint8_t subframe_len_bits; ///< number of bits used for the subframe length - uint8_t max_subframe_len_bit; ///< flag indicating that the subframe is of maximum size when the first subframe length bit is 1 - uint16_t min_samples_per_subframe; - int8_t num_sfb[WMAPRO_BLOCK_SIZES]; ///< scale factor bands per block size - int16_t sfb_offsets[WMAPRO_BLOCK_SIZES][MAX_BANDS]; ///< scale factor band offsets (multiples of 4) - int8_t sf_offsets[WMAPRO_BLOCK_SIZES][WMAPRO_BLOCK_SIZES][MAX_BANDS]; ///< scale factor resample matrix - int16_t subwoofer_cutoffs[WMAPRO_BLOCK_SIZES]; ///< subwoofer cutoff values - - /* packet decode state */ - GetBitContext pgb; ///< bitstream reader context for the packet - int next_packet_start; ///< start offset of the next wma packet in the demuxer packet - uint8_t packet_offset; ///< frame offset in the packet - uint8_t packet_sequence_number; ///< current packet number - int num_saved_bits; ///< saved number of bits - int frame_offset; ///< frame offset in the bit reservoir - int subframe_offset; ///< subframe offset in the bit reservoir - uint8_t packet_loss; ///< set in case of bitstream error - uint8_t packet_done; ///< set when a packet is fully decoded - - /* frame decode state */ - uint32_t frame_num; ///< current frame number (not used for decoding) - GetBitContext gb; ///< bitstream reader context - int buf_bit_size; ///< buffer size in bits - uint8_t drc_gain; ///< gain for the DRC tool - int8_t skip_frame; ///< skip output step - int8_t parsed_all_subframes; ///< all subframes decoded? - - /* subframe/block decode state */ - int16_t subframe_len; ///< current subframe length - int8_t channels_for_cur_subframe; ///< number of channels that contain the subframe - int8_t channel_indexes_for_cur_subframe[WMAPRO_MAX_CHANNELS]; - int8_t num_bands; ///< number of scale factor bands - int8_t transmit_num_vec_coeffs; ///< number of vector coded coefficients is part of the bitstream - int16_t* cur_sfb_offsets; ///< sfb offsets for the current block - uint8_t table_idx; ///< index for the num_sfb, sfb_offsets, sf_offsets and subwoofer_cutoffs tables - int8_t esc_len; ///< length of escaped coefficients - - uint8_t num_chgroups; ///< number of channel groups - WMAProChannelGrp chgroup[WMAPRO_MAX_CHANNELS]; ///< channel group information - - WMAProChannelCtx channel[WMAPRO_MAX_CHANNELS]; ///< per channel data -} WMAProDecodeCtx; - - -/** - *@brief helper function to print the most important members of the context - *@param s context - */ -static av_cold void dump_context(WMAProDecodeCtx *s) -{ -#define PRINT(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %d\n", a, b); -#define PRINT_HEX(a, b) av_log(s->avctx, AV_LOG_DEBUG, " %s = %x\n", a, b); - - PRINT("ed sample bit depth", s->bits_per_sample); - PRINT_HEX("ed decode flags", s->decode_flags); - PRINT("samples per frame", s->samples_per_frame); - PRINT("log2 frame size", s->log2_frame_size); - PRINT("max num subframes", s->max_num_subframes); - PRINT("len prefix", s->len_prefix); - PRINT("num channels", s->avctx->channels); -} - -/** - *@brief Uninitialize the decoder and free all resources. - *@param avctx codec context - *@return 0 on success, < 0 otherwise - */ -static av_cold int decode_end(AVCodecContext *avctx) -{ - WMAProDecodeCtx *s = avctx->priv_data; - int i; - - for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) - ff_mdct_end(&s->mdct_ctx[i]); - - return 0; -} - -/** - *@brief Initialize the decoder. - *@param avctx codec context - *@return 0 on success, -1 otherwise - */ -static av_cold int decode_init(AVCodecContext *avctx) -{ - WMAProDecodeCtx *s = avctx->priv_data; - uint8_t *edata_ptr = avctx->extradata; - unsigned int channel_mask; - int i, bits; - int log2_max_num_subframes; - int num_possible_block_sizes; - - if (!avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "block_align is not set\n"); - return AVERROR(EINVAL); - } - - s->avctx = avctx; - avpriv_float_dsp_init(&s->fdsp, avctx->flags & CODEC_FLAG_BITEXACT); - - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); - - avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; - - if (avctx->extradata_size >= 18) { - s->decode_flags = AV_RL16(edata_ptr+14); - channel_mask = AV_RL32(edata_ptr+2); - s->bits_per_sample = AV_RL16(edata_ptr); - /** dump the extradata */ - for (i = 0; i < avctx->extradata_size; i++) - av_dlog(avctx, "[%x] ", avctx->extradata[i]); - av_dlog(avctx, "\n"); - - } else { - avpriv_request_sample(avctx, "Unknown extradata size"); - return AVERROR_PATCHWELCOME; - } - - /** generic init */ - s->log2_frame_size = av_log2(avctx->block_align) + 4; - if (s->log2_frame_size > 25) { - avpriv_request_sample(avctx, "Large block align"); - return AVERROR_PATCHWELCOME; - } - - /** frame info */ - s->skip_frame = 1; /* skip first frame */ - s->packet_loss = 1; - s->len_prefix = (s->decode_flags & 0x40); - - /** get frame len */ - bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags); - if (bits > WMAPRO_BLOCK_MAX_BITS) { - avpriv_request_sample(avctx, "14-bit block sizes"); - return AVERROR_PATCHWELCOME; - } - s->samples_per_frame = 1 << bits; - - /** subframe info */ - log2_max_num_subframes = ((s->decode_flags & 0x38) >> 3); - s->max_num_subframes = 1 << log2_max_num_subframes; - if (s->max_num_subframes == 16 || s->max_num_subframes == 4) - s->max_subframe_len_bit = 1; - s->subframe_len_bits = av_log2(log2_max_num_subframes) + 1; - - num_possible_block_sizes = log2_max_num_subframes + 1; - s->min_samples_per_subframe = s->samples_per_frame / s->max_num_subframes; - s->dynamic_range_compression = (s->decode_flags & 0x80); - - if (s->max_num_subframes > MAX_SUBFRAMES) { - av_log(avctx, AV_LOG_ERROR, "invalid number of subframes %i\n", - s->max_num_subframes); - return AVERROR_INVALIDDATA; - } - - if (s->min_samples_per_subframe < WMAPRO_BLOCK_MIN_SIZE) { - av_log(avctx, AV_LOG_ERROR, "min_samples_per_subframe of %d too small\n", - s->min_samples_per_subframe); - return AVERROR_INVALIDDATA; - } - - if (s->avctx->sample_rate <= 0) { - av_log(avctx, AV_LOG_ERROR, "invalid sample rate\n"); - return AVERROR_INVALIDDATA; - } - - if (avctx->channels < 0) { - av_log(avctx, AV_LOG_ERROR, "invalid number of channels %d\n", - avctx->channels); - return AVERROR_INVALIDDATA; - } else if (avctx->channels > WMAPRO_MAX_CHANNELS) { - avpriv_request_sample(avctx, - "More than %d channels", WMAPRO_MAX_CHANNELS); - return AVERROR_PATCHWELCOME; - } - - /** init previous block len */ - for (i = 0; i < avctx->channels; i++) - s->channel[i].prev_block_len = s->samples_per_frame; - - /** extract lfe channel position */ - s->lfe_channel = -1; - - if (channel_mask & 8) { - unsigned int mask; - for (mask = 1; mask < 16; mask <<= 1) { - if (channel_mask & mask) - ++s->lfe_channel; - } - } - - INIT_VLC_STATIC(&sf_vlc, SCALEVLCBITS, HUFF_SCALE_SIZE, - scale_huffbits, 1, 1, - scale_huffcodes, 2, 2, 616); - - INIT_VLC_STATIC(&sf_rl_vlc, VLCBITS, HUFF_SCALE_RL_SIZE, - scale_rl_huffbits, 1, 1, - scale_rl_huffcodes, 4, 4, 1406); - - INIT_VLC_STATIC(&coef_vlc[0], VLCBITS, HUFF_COEF0_SIZE, - coef0_huffbits, 1, 1, - coef0_huffcodes, 4, 4, 2108); - - INIT_VLC_STATIC(&coef_vlc[1], VLCBITS, HUFF_COEF1_SIZE, - coef1_huffbits, 1, 1, - coef1_huffcodes, 4, 4, 3912); - - INIT_VLC_STATIC(&vec4_vlc, VLCBITS, HUFF_VEC4_SIZE, - vec4_huffbits, 1, 1, - vec4_huffcodes, 2, 2, 604); - - INIT_VLC_STATIC(&vec2_vlc, VLCBITS, HUFF_VEC2_SIZE, - vec2_huffbits, 1, 1, - vec2_huffcodes, 2, 2, 562); - - INIT_VLC_STATIC(&vec1_vlc, VLCBITS, HUFF_VEC1_SIZE, - vec1_huffbits, 1, 1, - vec1_huffcodes, 2, 2, 562); - - /** calculate number of scale factor bands and their offsets - for every possible block size */ - for (i = 0; i < num_possible_block_sizes; i++) { - int subframe_len = s->samples_per_frame >> i; - int x; - int band = 1; - - s->sfb_offsets[i][0] = 0; - - for (x = 0; x < MAX_BANDS-1 && s->sfb_offsets[i][band - 1] < subframe_len; x++) { - int offset = (subframe_len * 2 * critical_freq[x]) - / s->avctx->sample_rate + 2; - offset &= ~3; - if (offset > s->sfb_offsets[i][band - 1]) - s->sfb_offsets[i][band++] = offset; - } - s->sfb_offsets[i][band - 1] = subframe_len; - s->num_sfb[i] = band - 1; - if (s->num_sfb[i] <= 0) { - av_log(avctx, AV_LOG_ERROR, "num_sfb invalid\n"); - return AVERROR_INVALIDDATA; - } - } - - - /** Scale factors can be shared between blocks of different size - as every block has a different scale factor band layout. - The matrix sf_offsets is needed to find the correct scale factor. - */ - - for (i = 0; i < num_possible_block_sizes; i++) { - int b; - for (b = 0; b < s->num_sfb[i]; b++) { - int x; - int offset = ((s->sfb_offsets[i][b] - + s->sfb_offsets[i][b + 1] - 1) << i) >> 1; - for (x = 0; x < num_possible_block_sizes; x++) { - int v = 0; - while (s->sfb_offsets[x][v + 1] << x < offset) { - v++; - av_assert0(v < MAX_BANDS); - } - s->sf_offsets[i][x][b] = v; - } - } - } - - /** init MDCT, FIXME: only init needed sizes */ - for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) - ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS+1+i, 1, - 1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1)) - / (1 << (s->bits_per_sample - 1))); - - /** init MDCT windows: simple sine window */ - for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) { - const int win_idx = WMAPRO_BLOCK_MAX_BITS - i; - ff_init_ff_sine_windows(win_idx); - s->windows[WMAPRO_BLOCK_SIZES - i - 1] = ff_sine_windows[win_idx]; - } - - /** calculate subwoofer cutoff values */ - for (i = 0; i < num_possible_block_sizes; i++) { - int block_size = s->samples_per_frame >> i; - int cutoff = (440*block_size + 3 * (s->avctx->sample_rate >> 1) - 1) - / s->avctx->sample_rate; - s->subwoofer_cutoffs[i] = av_clip(cutoff, 4, block_size); - } - - /** calculate sine values for the decorrelation matrix */ - for (i = 0; i < 33; i++) - sin64[i] = sin(i*M_PI / 64.0); - - if (avctx->debug & FF_DEBUG_BITSTREAM) - dump_context(s); - - avctx->channel_layout = channel_mask; - - return 0; -} - -/** - *@brief Decode the subframe length. - *@param s context - *@param offset sample offset in the frame - *@return decoded subframe length on success, < 0 in case of an error - */ -static int decode_subframe_length(WMAProDecodeCtx *s, int offset) -{ - int frame_len_shift = 0; - int subframe_len; - - /** no need to read from the bitstream when only one length is possible */ - if (offset == s->samples_per_frame - s->min_samples_per_subframe) - return s->min_samples_per_subframe; - - if (get_bits_left(&s->gb) < 1) - return AVERROR_INVALIDDATA; - - /** 1 bit indicates if the subframe is of maximum length */ - if (s->max_subframe_len_bit) { - if (get_bits1(&s->gb)) - frame_len_shift = 1 + get_bits(&s->gb, s->subframe_len_bits-1); - } else - frame_len_shift = get_bits(&s->gb, s->subframe_len_bits); - - subframe_len = s->samples_per_frame >> frame_len_shift; - - /** sanity check the length */ - if (subframe_len < s->min_samples_per_subframe || - subframe_len > s->samples_per_frame) { - av_log(s->avctx, AV_LOG_ERROR, "broken frame: subframe_len %i\n", - subframe_len); - return AVERROR_INVALIDDATA; - } - return subframe_len; -} - -/** - *@brief Decode how the data in the frame is split into subframes. - * Every WMA frame contains the encoded data for a fixed number of - * samples per channel. The data for every channel might be split - * into several subframes. This function will reconstruct the list of - * subframes for every channel. - * - * If the subframes are not evenly split, the algorithm estimates the - * channels with the lowest number of total samples. - * Afterwards, for each of these channels a bit is read from the - * bitstream that indicates if the channel contains a subframe with the - * next subframe size that is going to be read from the bitstream or not. - * If a channel contains such a subframe, the subframe size gets added to - * the channel's subframe list. - * The algorithm repeats these steps until the frame is properly divided - * between the individual channels. - * - *@param s context - *@return 0 on success, < 0 in case of an error - */ -static int decode_tilehdr(WMAProDecodeCtx *s) -{ - uint16_t num_samples[WMAPRO_MAX_CHANNELS] = { 0 };/**< sum of samples for all currently known subframes of a channel */ - uint8_t contains_subframe[WMAPRO_MAX_CHANNELS]; /**< flag indicating if a channel contains the current subframe */ - int channels_for_cur_subframe = s->avctx->channels; /**< number of channels that contain the current subframe */ - int fixed_channel_layout = 0; /**< flag indicating that all channels use the same subframe offsets and sizes */ - int min_channel_len = 0; /**< smallest sum of samples (channels with this length will be processed first) */ - int c; - - /* Should never consume more than 3073 bits (256 iterations for the - * while loop when always the minimum amount of 128 samples is subtracted - * from missing samples in the 8 channel case). - * 1 + BLOCK_MAX_SIZE * MAX_CHANNELS / BLOCK_MIN_SIZE * (MAX_CHANNELS + 4) - */ - - /** reset tiling information */ - for (c = 0; c < s->avctx->channels; c++) - s->channel[c].num_subframes = 0; - - if (s->max_num_subframes == 1 || get_bits1(&s->gb)) - fixed_channel_layout = 1; - - /** loop until the frame data is split between the subframes */ - do { - int subframe_len; - - /** check which channels contain the subframe */ - for (c = 0; c < s->avctx->channels; c++) { - if (num_samples[c] == min_channel_len) { - if (fixed_channel_layout || channels_for_cur_subframe == 1 || - (min_channel_len == s->samples_per_frame - s->min_samples_per_subframe)) - contains_subframe[c] = 1; - else - contains_subframe[c] = get_bits1(&s->gb); - } else - contains_subframe[c] = 0; - } - - /** get subframe length, subframe_len == 0 is not allowed */ - if ((subframe_len = decode_subframe_length(s, min_channel_len)) <= 0) - return AVERROR_INVALIDDATA; - - /** add subframes to the individual channels and find new min_channel_len */ - min_channel_len += subframe_len; - for (c = 0; c < s->avctx->channels; c++) { - WMAProChannelCtx* chan = &s->channel[c]; - - if (contains_subframe[c]) { - if (chan->num_subframes >= MAX_SUBFRAMES) { - av_log(s->avctx, AV_LOG_ERROR, - "broken frame: num subframes > 31\n"); - return AVERROR_INVALIDDATA; - } - chan->subframe_len[chan->num_subframes] = subframe_len; - num_samples[c] += subframe_len; - ++chan->num_subframes; - if (num_samples[c] > s->samples_per_frame) { - av_log(s->avctx, AV_LOG_ERROR, "broken frame: " - "channel len > samples_per_frame\n"); - return AVERROR_INVALIDDATA; - } - } else if (num_samples[c] <= min_channel_len) { - if (num_samples[c] < min_channel_len) { - channels_for_cur_subframe = 0; - min_channel_len = num_samples[c]; - } - ++channels_for_cur_subframe; - } - } - } while (min_channel_len < s->samples_per_frame); - - for (c = 0; c < s->avctx->channels; c++) { - int i; - int offset = 0; - for (i = 0; i < s->channel[c].num_subframes; i++) { - av_dlog(s->avctx, "frame[%i] channel[%i] subframe[%i]" - " len %i\n", s->frame_num, c, i, - s->channel[c].subframe_len[i]); - s->channel[c].subframe_offset[i] = offset; - offset += s->channel[c].subframe_len[i]; - } - } - - return 0; -} - -/** - *@brief Calculate a decorrelation matrix from the bitstream parameters. - *@param s codec context - *@param chgroup channel group for which the matrix needs to be calculated - */ -static void decode_decorrelation_matrix(WMAProDecodeCtx *s, - WMAProChannelGrp *chgroup) -{ - int i; - int offset = 0; - int8_t rotation_offset[WMAPRO_MAX_CHANNELS * WMAPRO_MAX_CHANNELS]; - memset(chgroup->decorrelation_matrix, 0, s->avctx->channels * - s->avctx->channels * sizeof(*chgroup->decorrelation_matrix)); - - for (i = 0; i < chgroup->num_channels * (chgroup->num_channels - 1) >> 1; i++) - rotation_offset[i] = get_bits(&s->gb, 6); - - for (i = 0; i < chgroup->num_channels; i++) - chgroup->decorrelation_matrix[chgroup->num_channels * i + i] = - get_bits1(&s->gb) ? 1.0 : -1.0; - - for (i = 1; i < chgroup->num_channels; i++) { - int x; - for (x = 0; x < i; x++) { - int y; - for (y = 0; y < i + 1; y++) { - float v1 = chgroup->decorrelation_matrix[x * chgroup->num_channels + y]; - float v2 = chgroup->decorrelation_matrix[i * chgroup->num_channels + y]; - int n = rotation_offset[offset + x]; - float sinv; - float cosv; - - if (n < 32) { - sinv = sin64[n]; - cosv = sin64[32 - n]; - } else { - sinv = sin64[64 - n]; - cosv = -sin64[n - 32]; - } - - chgroup->decorrelation_matrix[y + x * chgroup->num_channels] = - (v1 * sinv) - (v2 * cosv); - chgroup->decorrelation_matrix[y + i * chgroup->num_channels] = - (v1 * cosv) + (v2 * sinv); - } - } - offset += i; - } -} - -/** - *@brief Decode channel transformation parameters - *@param s codec context - *@return >= 0 in case of success, < 0 in case of bitstream errors - */ -static int decode_channel_transform(WMAProDecodeCtx* s) -{ - int i; - /* should never consume more than 1921 bits for the 8 channel case - * 1 + MAX_CHANNELS * (MAX_CHANNELS + 2 + 3 * MAX_CHANNELS * MAX_CHANNELS - * + MAX_CHANNELS + MAX_BANDS + 1) - */ - - /** in the one channel case channel transforms are pointless */ - s->num_chgroups = 0; - if (s->avctx->channels > 1) { - int remaining_channels = s->channels_for_cur_subframe; - - if (get_bits1(&s->gb)) { - avpriv_request_sample(s->avctx, - "Channel transform bit"); - return AVERROR_PATCHWELCOME; - } - - for (s->num_chgroups = 0; remaining_channels && - s->num_chgroups < s->channels_for_cur_subframe; s->num_chgroups++) { - WMAProChannelGrp* chgroup = &s->chgroup[s->num_chgroups]; - float** channel_data = chgroup->channel_data; - chgroup->num_channels = 0; - chgroup->transform = 0; - - /** decode channel mask */ - if (remaining_channels > 2) { - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int channel_idx = s->channel_indexes_for_cur_subframe[i]; - if (!s->channel[channel_idx].grouped - && get_bits1(&s->gb)) { - ++chgroup->num_channels; - s->channel[channel_idx].grouped = 1; - *channel_data++ = s->channel[channel_idx].coeffs; - } - } - } else { - chgroup->num_channels = remaining_channels; - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int channel_idx = s->channel_indexes_for_cur_subframe[i]; - if (!s->channel[channel_idx].grouped) - *channel_data++ = s->channel[channel_idx].coeffs; - s->channel[channel_idx].grouped = 1; - } - } - - /** decode transform type */ - if (chgroup->num_channels == 2) { - if (get_bits1(&s->gb)) { - if (get_bits1(&s->gb)) { - avpriv_request_sample(s->avctx, - "Unknown channel transform type"); - return AVERROR_PATCHWELCOME; - } - } else { - chgroup->transform = 1; - if (s->avctx->channels == 2) { - chgroup->decorrelation_matrix[0] = 1.0; - chgroup->decorrelation_matrix[1] = -1.0; - chgroup->decorrelation_matrix[2] = 1.0; - chgroup->decorrelation_matrix[3] = 1.0; - } else { - /** cos(pi/4) */ - chgroup->decorrelation_matrix[0] = 0.70703125; - chgroup->decorrelation_matrix[1] = -0.70703125; - chgroup->decorrelation_matrix[2] = 0.70703125; - chgroup->decorrelation_matrix[3] = 0.70703125; - } - } - } else if (chgroup->num_channels > 2) { - if (get_bits1(&s->gb)) { - chgroup->transform = 1; - if (get_bits1(&s->gb)) { - decode_decorrelation_matrix(s, chgroup); - } else { - /** FIXME: more than 6 coupled channels not supported */ - if (chgroup->num_channels > 6) { - avpriv_request_sample(s->avctx, - "Coupled channels > 6"); - } else { - memcpy(chgroup->decorrelation_matrix, - default_decorrelation[chgroup->num_channels], - chgroup->num_channels * chgroup->num_channels * - sizeof(*chgroup->decorrelation_matrix)); - } - } - } - } - - /** decode transform on / off */ - if (chgroup->transform) { - if (!get_bits1(&s->gb)) { - int i; - /** transform can be enabled for individual bands */ - for (i = 0; i < s->num_bands; i++) { - chgroup->transform_band[i] = get_bits1(&s->gb); - } - } else { - memset(chgroup->transform_band, 1, s->num_bands); - } - } - remaining_channels -= chgroup->num_channels; - } - } - return 0; -} - -/** - *@brief Extract the coefficients from the bitstream. - *@param s codec context - *@param c current channel number - *@return 0 on success, < 0 in case of bitstream errors - */ -static int decode_coeffs(WMAProDecodeCtx *s, int c) -{ - /* Integers 0..15 as single-precision floats. The table saves a - costly int to float conversion, and storing the values as - integers allows fast sign-flipping. */ - static const uint32_t fval_tab[16] = { - 0x00000000, 0x3f800000, 0x40000000, 0x40400000, - 0x40800000, 0x40a00000, 0x40c00000, 0x40e00000, - 0x41000000, 0x41100000, 0x41200000, 0x41300000, - 0x41400000, 0x41500000, 0x41600000, 0x41700000, - }; - int vlctable; - VLC* vlc; - WMAProChannelCtx* ci = &s->channel[c]; - int rl_mode = 0; - int cur_coeff = 0; - int num_zeros = 0; - const uint16_t* run; - const float* level; - - av_dlog(s->avctx, "decode coefficients for channel %i\n", c); - - vlctable = get_bits1(&s->gb); - vlc = &coef_vlc[vlctable]; - - if (vlctable) { - run = coef1_run; - level = coef1_level; - } else { - run = coef0_run; - level = coef0_level; - } - - /** decode vector coefficients (consumes up to 167 bits per iteration for - 4 vector coded large values) */ - while ((s->transmit_num_vec_coeffs || !rl_mode) && - (cur_coeff + 3 < ci->num_vec_coeffs)) { - uint32_t vals[4]; - int i; - unsigned int idx; - - idx = get_vlc2(&s->gb, vec4_vlc.table, VLCBITS, VEC4MAXDEPTH); - - if (idx == HUFF_VEC4_SIZE - 1) { - for (i = 0; i < 4; i += 2) { - idx = get_vlc2(&s->gb, vec2_vlc.table, VLCBITS, VEC2MAXDEPTH); - if (idx == HUFF_VEC2_SIZE - 1) { - uint32_t v0, v1; - v0 = get_vlc2(&s->gb, vec1_vlc.table, VLCBITS, VEC1MAXDEPTH); - if (v0 == HUFF_VEC1_SIZE - 1) - v0 += ff_wma_get_large_val(&s->gb); - v1 = get_vlc2(&s->gb, vec1_vlc.table, VLCBITS, VEC1MAXDEPTH); - if (v1 == HUFF_VEC1_SIZE - 1) - v1 += ff_wma_get_large_val(&s->gb); - vals[i ] = av_float2int(v0); - vals[i+1] = av_float2int(v1); - } else { - vals[i] = fval_tab[symbol_to_vec2[idx] >> 4 ]; - vals[i+1] = fval_tab[symbol_to_vec2[idx] & 0xF]; - } - } - } else { - vals[0] = fval_tab[ symbol_to_vec4[idx] >> 12 ]; - vals[1] = fval_tab[(symbol_to_vec4[idx] >> 8) & 0xF]; - vals[2] = fval_tab[(symbol_to_vec4[idx] >> 4) & 0xF]; - vals[3] = fval_tab[ symbol_to_vec4[idx] & 0xF]; - } - - /** decode sign */ - for (i = 0; i < 4; i++) { - if (vals[i]) { - uint32_t sign = get_bits1(&s->gb) - 1; - AV_WN32A(&ci->coeffs[cur_coeff], vals[i] ^ sign << 31); - num_zeros = 0; - } else { - ci->coeffs[cur_coeff] = 0; - /** switch to run level mode when subframe_len / 128 zeros - were found in a row */ - rl_mode |= (++num_zeros > s->subframe_len >> 8); - } - ++cur_coeff; - } - } - - /** decode run level coded coefficients */ - if (cur_coeff < s->subframe_len) { - memset(&ci->coeffs[cur_coeff], 0, - sizeof(*ci->coeffs) * (s->subframe_len - cur_coeff)); - if (ff_wma_run_level_decode(s->avctx, &s->gb, vlc, - level, run, 1, ci->coeffs, - cur_coeff, s->subframe_len, - s->subframe_len, s->esc_len, 0)) - return AVERROR_INVALIDDATA; - } - - return 0; -} - -/** - *@brief Extract scale factors from the bitstream. - *@param s codec context - *@return 0 on success, < 0 in case of bitstream errors - */ -static int decode_scale_factors(WMAProDecodeCtx* s) -{ - int i; - - /** should never consume more than 5344 bits - * MAX_CHANNELS * (1 + MAX_BANDS * 23) - */ - - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - int* sf; - int* sf_end; - s->channel[c].scale_factors = s->channel[c].saved_scale_factors[!s->channel[c].scale_factor_idx]; - sf_end = s->channel[c].scale_factors + s->num_bands; - - /** resample scale factors for the new block size - * as the scale factors might need to be resampled several times - * before some new values are transmitted, a backup of the last - * transmitted scale factors is kept in saved_scale_factors - */ - if (s->channel[c].reuse_sf) { - const int8_t* sf_offsets = s->sf_offsets[s->table_idx][s->channel[c].table_idx]; - int b; - for (b = 0; b < s->num_bands; b++) - s->channel[c].scale_factors[b] = - s->channel[c].saved_scale_factors[s->channel[c].scale_factor_idx][*sf_offsets++]; - } - - if (!s->channel[c].cur_subframe || get_bits1(&s->gb)) { - - if (!s->channel[c].reuse_sf) { - int val; - /** decode DPCM coded scale factors */ - s->channel[c].scale_factor_step = get_bits(&s->gb, 2) + 1; - val = 45 / s->channel[c].scale_factor_step; - for (sf = s->channel[c].scale_factors; sf < sf_end; sf++) { - val += get_vlc2(&s->gb, sf_vlc.table, SCALEVLCBITS, SCALEMAXDEPTH) - 60; - *sf = val; - } - } else { - int i; - /** run level decode differences to the resampled factors */ - for (i = 0; i < s->num_bands; i++) { - int idx; - int skip; - int val; - int sign; - - idx = get_vlc2(&s->gb, sf_rl_vlc.table, VLCBITS, SCALERLMAXDEPTH); - - if (!idx) { - uint32_t code = get_bits(&s->gb, 14); - val = code >> 6; - sign = (code & 1) - 1; - skip = (code & 0x3f) >> 1; - } else if (idx == 1) { - break; - } else { - skip = scale_rl_run[idx]; - val = scale_rl_level[idx]; - sign = get_bits1(&s->gb)-1; - } - - i += skip; - if (i >= s->num_bands) { - av_log(s->avctx, AV_LOG_ERROR, - "invalid scale factor coding\n"); - return AVERROR_INVALIDDATA; - } - s->channel[c].scale_factors[i] += (val ^ sign) - sign; - } - } - /** swap buffers */ - s->channel[c].scale_factor_idx = !s->channel[c].scale_factor_idx; - s->channel[c].table_idx = s->table_idx; - s->channel[c].reuse_sf = 1; - } - - /** calculate new scale factor maximum */ - s->channel[c].max_scale_factor = s->channel[c].scale_factors[0]; - for (sf = s->channel[c].scale_factors + 1; sf < sf_end; sf++) { - s->channel[c].max_scale_factor = - FFMAX(s->channel[c].max_scale_factor, *sf); - } - - } - return 0; -} - -/** - *@brief Reconstruct the individual channel data. - *@param s codec context - */ -static void inverse_channel_transform(WMAProDecodeCtx *s) -{ - int i; - - for (i = 0; i < s->num_chgroups; i++) { - if (s->chgroup[i].transform) { - float data[WMAPRO_MAX_CHANNELS]; - const int num_channels = s->chgroup[i].num_channels; - float** ch_data = s->chgroup[i].channel_data; - float** ch_end = ch_data + num_channels; - const int8_t* tb = s->chgroup[i].transform_band; - int16_t* sfb; - - /** multichannel decorrelation */ - for (sfb = s->cur_sfb_offsets; - sfb < s->cur_sfb_offsets + s->num_bands; sfb++) { - int y; - if (*tb++ == 1) { - /** multiply values with the decorrelation_matrix */ - for (y = sfb[0]; y < FFMIN(sfb[1], s->subframe_len); y++) { - const float* mat = s->chgroup[i].decorrelation_matrix; - const float* data_end = data + num_channels; - float* data_ptr = data; - float** ch; - - for (ch = ch_data; ch < ch_end; ch++) - *data_ptr++ = (*ch)[y]; - - for (ch = ch_data; ch < ch_end; ch++) { - float sum = 0; - data_ptr = data; - while (data_ptr < data_end) - sum += *data_ptr++ * *mat++; - - (*ch)[y] = sum; - } - } - } else if (s->avctx->channels == 2) { - int len = FFMIN(sfb[1], s->subframe_len) - sfb[0]; - s->fdsp.vector_fmul_scalar(ch_data[0] + sfb[0], - ch_data[0] + sfb[0], - 181.0 / 128, len); - s->fdsp.vector_fmul_scalar(ch_data[1] + sfb[0], - ch_data[1] + sfb[0], - 181.0 / 128, len); - } - } - } - } -} - -/** - *@brief Apply sine window and reconstruct the output buffer. - *@param s codec context - */ -static void wmapro_window(WMAProDecodeCtx *s) -{ - int i; - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - float* window; - int winlen = s->channel[c].prev_block_len; - float* start = s->channel[c].coeffs - (winlen >> 1); - - if (s->subframe_len < winlen) { - start += (winlen - s->subframe_len) >> 1; - winlen = s->subframe_len; - } - - window = s->windows[av_log2(winlen) - WMAPRO_BLOCK_MIN_BITS]; - - winlen >>= 1; - - s->fdsp.vector_fmul_window(start, start, start + winlen, - window, winlen); - - s->channel[c].prev_block_len = s->subframe_len; - } -} - -/** - *@brief Decode a single subframe (block). - *@param s codec context - *@return 0 on success, < 0 when decoding failed - */ -static int decode_subframe(WMAProDecodeCtx *s) -{ - int offset = s->samples_per_frame; - int subframe_len = s->samples_per_frame; - int i; - int total_samples = s->samples_per_frame * s->avctx->channels; - int transmit_coeffs = 0; - int cur_subwoofer_cutoff; - - s->subframe_offset = get_bits_count(&s->gb); - - /** reset channel context and find the next block offset and size - == the next block of the channel with the smallest number of - decoded samples - */ - for (i = 0; i < s->avctx->channels; i++) { - s->channel[i].grouped = 0; - if (offset > s->channel[i].decoded_samples) { - offset = s->channel[i].decoded_samples; - subframe_len = - s->channel[i].subframe_len[s->channel[i].cur_subframe]; - } - } - - av_dlog(s->avctx, - "processing subframe with offset %i len %i\n", offset, subframe_len); - - /** get a list of all channels that contain the estimated block */ - s->channels_for_cur_subframe = 0; - for (i = 0; i < s->avctx->channels; i++) { - const int cur_subframe = s->channel[i].cur_subframe; - /** subtract already processed samples */ - total_samples -= s->channel[i].decoded_samples; - - /** and count if there are multiple subframes that match our profile */ - if (offset == s->channel[i].decoded_samples && - subframe_len == s->channel[i].subframe_len[cur_subframe]) { - total_samples -= s->channel[i].subframe_len[cur_subframe]; - s->channel[i].decoded_samples += - s->channel[i].subframe_len[cur_subframe]; - s->channel_indexes_for_cur_subframe[s->channels_for_cur_subframe] = i; - ++s->channels_for_cur_subframe; - } - } - - /** check if the frame will be complete after processing the - estimated block */ - if (!total_samples) - s->parsed_all_subframes = 1; - - - av_dlog(s->avctx, "subframe is part of %i channels\n", - s->channels_for_cur_subframe); - - /** calculate number of scale factor bands and their offsets */ - s->table_idx = av_log2(s->samples_per_frame/subframe_len); - s->num_bands = s->num_sfb[s->table_idx]; - s->cur_sfb_offsets = s->sfb_offsets[s->table_idx]; - cur_subwoofer_cutoff = s->subwoofer_cutoffs[s->table_idx]; - - /** configure the decoder for the current subframe */ - offset += s->samples_per_frame >> 1; - - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - - s->channel[c].coeffs = &s->channel[c].out[offset]; - } - - s->subframe_len = subframe_len; - s->esc_len = av_log2(s->subframe_len - 1) + 1; - - /** skip extended header if any */ - if (get_bits1(&s->gb)) { - int num_fill_bits; - if (!(num_fill_bits = get_bits(&s->gb, 2))) { - int len = get_bits(&s->gb, 4); - num_fill_bits = (len ? get_bits(&s->gb, len) : 0) + 1; - } - - if (num_fill_bits >= 0) { - if (get_bits_count(&s->gb) + num_fill_bits > s->num_saved_bits) { - av_log(s->avctx, AV_LOG_ERROR, "invalid number of fill bits\n"); - return AVERROR_INVALIDDATA; - } - - skip_bits_long(&s->gb, num_fill_bits); - } - } - - /** no idea for what the following bit is used */ - if (get_bits1(&s->gb)) { - avpriv_request_sample(s->avctx, "Reserved bit"); - return AVERROR_PATCHWELCOME; - } - - - if (decode_channel_transform(s) < 0) - return AVERROR_INVALIDDATA; - - - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - if ((s->channel[c].transmit_coefs = get_bits1(&s->gb))) - transmit_coeffs = 1; - } - - av_assert0(s->subframe_len <= WMAPRO_BLOCK_MAX_SIZE); - if (transmit_coeffs) { - int step; - int quant_step = 90 * s->bits_per_sample >> 4; - - /** decode number of vector coded coefficients */ - if ((s->transmit_num_vec_coeffs = get_bits1(&s->gb))) { - int num_bits = av_log2((s->subframe_len + 3)/4) + 1; - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - int num_vec_coeffs = get_bits(&s->gb, num_bits) << 2; - if (num_vec_coeffs > s->subframe_len) { - av_log(s->avctx, AV_LOG_ERROR, "num_vec_coeffs %d is too large\n", num_vec_coeffs); - return AVERROR_INVALIDDATA; - } - av_assert0(num_vec_coeffs + offset <= FF_ARRAY_ELEMS(s->channel[c].out)); - s->channel[c].num_vec_coeffs = num_vec_coeffs; - } - } else { - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - s->channel[c].num_vec_coeffs = s->subframe_len; - } - } - /** decode quantization step */ - step = get_sbits(&s->gb, 6); - quant_step += step; - if (step == -32 || step == 31) { - const int sign = (step == 31) - 1; - int quant = 0; - while (get_bits_count(&s->gb) + 5 < s->num_saved_bits && - (step = get_bits(&s->gb, 5)) == 31) { - quant += 31; - } - quant_step += ((quant + step) ^ sign) - sign; - } - if (quant_step < 0) { - av_log(s->avctx, AV_LOG_DEBUG, "negative quant step\n"); - } - - /** decode quantization step modifiers for every channel */ - - if (s->channels_for_cur_subframe == 1) { - s->channel[s->channel_indexes_for_cur_subframe[0]].quant_step = quant_step; - } else { - int modifier_len = get_bits(&s->gb, 3); - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - s->channel[c].quant_step = quant_step; - if (get_bits1(&s->gb)) { - if (modifier_len) { - s->channel[c].quant_step += get_bits(&s->gb, modifier_len) + 1; - } else - ++s->channel[c].quant_step; - } - } - } - - /** decode scale factors */ - if (decode_scale_factors(s) < 0) - return AVERROR_INVALIDDATA; - } - - av_dlog(s->avctx, "BITSTREAM: subframe header length was %i\n", - get_bits_count(&s->gb) - s->subframe_offset); - - /** parse coefficients */ - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - if (s->channel[c].transmit_coefs && - get_bits_count(&s->gb) < s->num_saved_bits) { - decode_coeffs(s, c); - } else - memset(s->channel[c].coeffs, 0, - sizeof(*s->channel[c].coeffs) * subframe_len); - } - - av_dlog(s->avctx, "BITSTREAM: subframe length was %i\n", - get_bits_count(&s->gb) - s->subframe_offset); - - if (transmit_coeffs) { - FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS]; - /** reconstruct the per channel data */ - inverse_channel_transform(s); - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - const int* sf = s->channel[c].scale_factors; - int b; - - if (c == s->lfe_channel) - memset(&s->tmp[cur_subwoofer_cutoff], 0, sizeof(*s->tmp) * - (subframe_len - cur_subwoofer_cutoff)); - - /** inverse quantization and rescaling */ - for (b = 0; b < s->num_bands; b++) { - const int end = FFMIN(s->cur_sfb_offsets[b+1], s->subframe_len); - const int exp = s->channel[c].quant_step - - (s->channel[c].max_scale_factor - *sf++) * - s->channel[c].scale_factor_step; - const float quant = pow(10.0, exp / 20.0); - int start = s->cur_sfb_offsets[b]; - s->fdsp.vector_fmul_scalar(s->tmp + start, - s->channel[c].coeffs + start, - quant, end - start); - } - - /** apply imdct (imdct_half == DCTIV with reverse) */ - mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp); - } - } - - /** window and overlapp-add */ - wmapro_window(s); - - /** handled one subframe */ - for (i = 0; i < s->channels_for_cur_subframe; i++) { - int c = s->channel_indexes_for_cur_subframe[i]; - if (s->channel[c].cur_subframe >= s->channel[c].num_subframes) { - av_log(s->avctx, AV_LOG_ERROR, "broken subframe\n"); - return AVERROR_INVALIDDATA; - } - ++s->channel[c].cur_subframe; - } - - return 0; -} - -/** - *@brief Decode one WMA frame. - *@param s codec context - *@return 0 if the trailer bit indicates that this is the last frame, - * 1 if there are additional frames - */ -static int decode_frame(WMAProDecodeCtx *s, AVFrame *frame, int *got_frame_ptr) -{ - AVCodecContext *avctx = s->avctx; - GetBitContext* gb = &s->gb; - int more_frames = 0; - int len = 0; - int i, ret; - - /** get frame length */ - if (s->len_prefix) - len = get_bits(gb, s->log2_frame_size); - - av_dlog(s->avctx, "decoding frame with length %x\n", len); - - /** decode tile information */ - if (decode_tilehdr(s)) { - s->packet_loss = 1; - return 0; - } - - /** read postproc transform */ - if (s->avctx->channels > 1 && get_bits1(gb)) { - if (get_bits1(gb)) { - for (i = 0; i < avctx->channels * avctx->channels; i++) - skip_bits(gb, 4); - } - } - - /** read drc info */ - if (s->dynamic_range_compression) { - s->drc_gain = get_bits(gb, 8); - av_dlog(s->avctx, "drc_gain %i\n", s->drc_gain); - } - - /** no idea what these are for, might be the number of samples - that need to be skipped at the beginning or end of a stream */ - if (get_bits1(gb)) { - int av_unused skip; - - /** usually true for the first frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - av_dlog(s->avctx, "start skip: %i\n", skip); - } - - /** sometimes true for the last frame */ - if (get_bits1(gb)) { - skip = get_bits(gb, av_log2(s->samples_per_frame * 2)); - av_dlog(s->avctx, "end skip: %i\n", skip); - } - - } - - av_dlog(s->avctx, "BITSTREAM: frame header length was %i\n", - get_bits_count(gb) - s->frame_offset); - - /** reset subframe states */ - s->parsed_all_subframes = 0; - for (i = 0; i < avctx->channels; i++) { - s->channel[i].decoded_samples = 0; - s->channel[i].cur_subframe = 0; - s->channel[i].reuse_sf = 0; - } - - /** decode all subframes */ - while (!s->parsed_all_subframes) { - if (decode_subframe(s) < 0) { - s->packet_loss = 1; - return 0; - } - } - - /* get output buffer */ - frame->nb_samples = s->samples_per_frame; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - s->packet_loss = 1; - return 0; - } - - /** copy samples to the output buffer */ - for (i = 0; i < avctx->channels; i++) - memcpy(frame->extended_data[i], s->channel[i].out, - s->samples_per_frame * sizeof(*s->channel[i].out)); - - for (i = 0; i < avctx->channels; i++) { - /** reuse second half of the IMDCT output for the next frame */ - memcpy(&s->channel[i].out[0], - &s->channel[i].out[s->samples_per_frame], - s->samples_per_frame * sizeof(*s->channel[i].out) >> 1); - } - - if (s->skip_frame) { - s->skip_frame = 0; - *got_frame_ptr = 0; - av_frame_unref(frame); - } else { - *got_frame_ptr = 1; - } - - if (s->len_prefix) { - if (len != (get_bits_count(gb) - s->frame_offset) + 2) { - /** FIXME: not sure if this is always an error */ - av_log(s->avctx, AV_LOG_ERROR, - "frame[%i] would have to skip %i bits\n", s->frame_num, - len - (get_bits_count(gb) - s->frame_offset) - 1); - s->packet_loss = 1; - return 0; - } - - /** skip the rest of the frame data */ - skip_bits_long(gb, len - (get_bits_count(gb) - s->frame_offset) - 1); - } else { - while (get_bits_count(gb) < s->num_saved_bits && get_bits1(gb) == 0) { - } - } - - /** decode trailer bit */ - more_frames = get_bits1(gb); - - ++s->frame_num; - return more_frames; -} - -/** - *@brief Calculate remaining input buffer length. - *@param s codec context - *@param gb bitstream reader context - *@return remaining size in bits - */ -static int remaining_bits(WMAProDecodeCtx *s, GetBitContext *gb) -{ - return s->buf_bit_size - get_bits_count(gb); -} - -/** - *@brief Fill the bit reservoir with a (partial) frame. - *@param s codec context - *@param gb bitstream reader context - *@param len length of the partial frame - *@param append decides whether to reset the buffer or not - */ -static void save_bits(WMAProDecodeCtx *s, GetBitContext* gb, int len, - int append) -{ - int buflen; - - /** when the frame data does not need to be concatenated, the input buffer - is reset and additional bits from the previous frame are copied - and skipped later so that a fast byte copy is possible */ - - if (!append) { - s->frame_offset = get_bits_count(gb) & 7; - s->num_saved_bits = s->frame_offset; - init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE); - } - - buflen = (put_bits_count(&s->pb) + len + 8) >> 3; - - if (len <= 0 || buflen > MAX_FRAMESIZE) { - avpriv_request_sample(s->avctx, "Too small input buffer"); - s->packet_loss = 1; - return; - } - - av_assert0(len <= put_bits_left(&s->pb)); - - s->num_saved_bits += len; - if (!append) { - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), - s->num_saved_bits); - } else { - int align = 8 - (get_bits_count(gb) & 7); - align = FFMIN(align, len); - put_bits(&s->pb, align, get_bits(gb, align)); - len -= align; - avpriv_copy_bits(&s->pb, gb->buffer + (get_bits_count(gb) >> 3), len); - } - skip_bits_long(gb, len); - - { - PutBitContext tmp = s->pb; - flush_put_bits(&tmp); - } - - init_get_bits(&s->gb, s->frame_data, s->num_saved_bits); - skip_bits(&s->gb, s->frame_offset); -} - -/** - *@brief Decode a single WMA packet. - *@param avctx codec context - *@param data the output buffer - *@param avpkt input packet - *@return number of bytes that were read from the input buffer - */ -static int decode_packet(AVCodecContext *avctx, void *data, - int *got_frame_ptr, AVPacket* avpkt) -{ - WMAProDecodeCtx *s = avctx->priv_data; - GetBitContext* gb = &s->pgb; - const uint8_t* buf = avpkt->data; - int buf_size = avpkt->size; - int num_bits_prev_frame; - int packet_sequence_number; - - *got_frame_ptr = 0; - - if (s->packet_done || s->packet_loss) { - s->packet_done = 0; - - /** sanity check for the buffer length */ - if (buf_size < avctx->block_align) { - av_log(avctx, AV_LOG_ERROR, "Input packet too small (%d < %d)\n", - buf_size, avctx->block_align); - return AVERROR_INVALIDDATA; - } - - s->next_packet_start = buf_size - avctx->block_align; - buf_size = avctx->block_align; - s->buf_bit_size = buf_size << 3; - - /** parse packet header */ - init_get_bits(gb, buf, s->buf_bit_size); - packet_sequence_number = get_bits(gb, 4); - skip_bits(gb, 2); - - /** get number of bits that need to be added to the previous frame */ - num_bits_prev_frame = get_bits(gb, s->log2_frame_size); - av_dlog(avctx, "packet[%d]: nbpf %x\n", avctx->frame_number, - num_bits_prev_frame); - - /** check for packet loss */ - if (!s->packet_loss && - ((s->packet_sequence_number + 1) & 0xF) != packet_sequence_number) { - s->packet_loss = 1; - av_log(avctx, AV_LOG_ERROR, "Packet loss detected! seq %x vs %x\n", - s->packet_sequence_number, packet_sequence_number); - } - s->packet_sequence_number = packet_sequence_number; - - if (num_bits_prev_frame > 0) { - int remaining_packet_bits = s->buf_bit_size - get_bits_count(gb); - if (num_bits_prev_frame >= remaining_packet_bits) { - num_bits_prev_frame = remaining_packet_bits; - s->packet_done = 1; - } - - /** append the previous frame data to the remaining data from the - previous packet to create a full frame */ - save_bits(s, gb, num_bits_prev_frame, 1); - av_dlog(avctx, "accumulated %x bits of frame data\n", - s->num_saved_bits - s->frame_offset); - - /** decode the cross packet frame if it is valid */ - if (!s->packet_loss) - decode_frame(s, data, got_frame_ptr); - } else if (s->num_saved_bits - s->frame_offset) { - av_dlog(avctx, "ignoring %x previously saved bits\n", - s->num_saved_bits - s->frame_offset); - } - - if (s->packet_loss) { - /** reset number of saved bits so that the decoder - does not start to decode incomplete frames in the - s->len_prefix == 0 case */ - s->num_saved_bits = 0; - s->packet_loss = 0; - } - - } else { - int frame_size; - s->buf_bit_size = (avpkt->size - s->next_packet_start) << 3; - init_get_bits(gb, avpkt->data, s->buf_bit_size); - skip_bits(gb, s->packet_offset); - if (s->len_prefix && remaining_bits(s, gb) > s->log2_frame_size && - (frame_size = show_bits(gb, s->log2_frame_size)) && - frame_size <= remaining_bits(s, gb)) { - save_bits(s, gb, frame_size, 0); - if (!s->packet_loss) - s->packet_done = !decode_frame(s, data, got_frame_ptr); - } else if (!s->len_prefix - && s->num_saved_bits > get_bits_count(&s->gb)) { - /** when the frames do not have a length prefix, we don't know - the compressed length of the individual frames - however, we know what part of a new packet belongs to the - previous frame - therefore we save the incoming packet first, then we append - the "previous frame" data from the next packet so that - we get a buffer that only contains full frames */ - s->packet_done = !decode_frame(s, data, got_frame_ptr); - } else - s->packet_done = 1; - } - - if (s->packet_done && !s->packet_loss && - remaining_bits(s, gb) > 0) { - /** save the rest of the data so that it can be decoded - with the next packet */ - save_bits(s, gb, remaining_bits(s, gb), 0); - } - - s->packet_offset = get_bits_count(gb) & 7; - if (s->packet_loss) - return AVERROR_INVALIDDATA; - - return get_bits_count(gb) >> 3; -} - -/** - *@brief Clear decoder buffers (for seeking). - *@param avctx codec context - */ -static void flush(AVCodecContext *avctx) -{ - WMAProDecodeCtx *s = avctx->priv_data; - int i; - /** reset output buffer as a part of it is used during the windowing of a - new frame */ - for (i = 0; i < avctx->channels; i++) - memset(s->channel[i].out, 0, s->samples_per_frame * - sizeof(*s->channel[i].out)); - s->packet_loss = 1; -} - - -/** - *@brief wmapro decoder - */ -AVCodec ff_wmapro_decoder = { - .name = "wmapro", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio 9 Professional"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_WMAPRO, - .priv_data_size = sizeof(WMAProDecodeCtx), - .init = decode_init, - .close = decode_end, - .decode = decode_packet, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, - .flush = flush, - .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice.c deleted file mode 100644 index c2737abd4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice.c +++ /dev/null @@ -1,2075 +0,0 @@ -/* - * Windows Media Audio Voice decoder. - * Copyright (c) 2009 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief Windows Media Audio Voice compatible decoder - * @author Ronald S. Bultje - */ - -#include - -#include "libavutil/channel_layout.h" -#include "libavutil/float_dsp.h" -#include "libavutil/mem.h" -#include "avcodec.h" -#include "internal.h" -#include "get_bits.h" -#include "put_bits.h" -#include "wmavoice_data.h" -#include "celp_filters.h" -#include "acelp_vectors.h" -#include "acelp_filters.h" -#include "lsp.h" -#include "dct.h" -#include "rdft.h" -#include "sinewin.h" - -#define MAX_BLOCKS 8 ///< maximum number of blocks per frame -#define MAX_LSPS 16 ///< maximum filter order -#define MAX_LSPS_ALIGN16 16 ///< same as #MAX_LSPS; needs to be multiple - ///< of 16 for ASM input buffer alignment -#define MAX_FRAMES 3 ///< maximum number of frames per superframe -#define MAX_FRAMESIZE 160 ///< maximum number of samples per frame -#define MAX_SIGNAL_HISTORY 416 ///< maximum excitation signal history -#define MAX_SFRAMESIZE (MAX_FRAMESIZE * MAX_FRAMES) - ///< maximum number of samples per superframe -#define SFRAME_CACHE_MAXSIZE 256 ///< maximum cache size for frame data that - ///< was split over two packets -#define VLC_NBITS 6 ///< number of bits to read per VLC iteration - -/** - * Frame type VLC coding. - */ -static VLC frame_type_vlc; - -/** - * Adaptive codebook types. - */ -enum { - ACB_TYPE_NONE = 0, ///< no adaptive codebook (only hardcoded fixed) - ACB_TYPE_ASYMMETRIC = 1, ///< adaptive codebook with per-frame pitch, which - ///< we interpolate to get a per-sample pitch. - ///< Signal is generated using an asymmetric sinc - ///< window function - ///< @note see #wmavoice_ipol1_coeffs - ACB_TYPE_HAMMING = 2 ///< Per-block pitch with signal generation using - ///< a Hamming sinc window function - ///< @note see #wmavoice_ipol2_coeffs -}; - -/** - * Fixed codebook types. - */ -enum { - FCB_TYPE_SILENCE = 0, ///< comfort noise during silence - ///< generated from a hardcoded (fixed) codebook - ///< with per-frame (low) gain values - FCB_TYPE_HARDCODED = 1, ///< hardcoded (fixed) codebook with per-block - ///< gain values - FCB_TYPE_AW_PULSES = 2, ///< Pitch-adaptive window (AW) pulse signals, - ///< used in particular for low-bitrate streams - FCB_TYPE_EXC_PULSES = 3, ///< Innovation (fixed) codebook pulse sets in - ///< combinations of either single pulses or - ///< pulse pairs -}; - -/** - * Description of frame types. - */ -static const struct frame_type_desc { - uint8_t n_blocks; ///< amount of blocks per frame (each block - ///< (contains 160/#n_blocks samples) - uint8_t log_n_blocks; ///< log2(#n_blocks) - uint8_t acb_type; ///< Adaptive codebook type (ACB_TYPE_*) - uint8_t fcb_type; ///< Fixed codebook type (FCB_TYPE_*) - uint8_t dbl_pulses; ///< how many pulse vectors have pulse pairs - ///< (rather than just one single pulse) - ///< only if #fcb_type == #FCB_TYPE_EXC_PULSES - uint16_t frame_size; ///< the amount of bits that make up the block - ///< data (per frame) -} frame_descs[17] = { - { 1, 0, ACB_TYPE_NONE, FCB_TYPE_SILENCE, 0, 0 }, - { 2, 1, ACB_TYPE_NONE, FCB_TYPE_HARDCODED, 0, 28 }, - { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_AW_PULSES, 0, 46 }, - { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 2, 80 }, - { 2, 1, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 5, 104 }, - { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 0, 108 }, - { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 2, 132 }, - { 4, 2, ACB_TYPE_ASYMMETRIC, FCB_TYPE_EXC_PULSES, 5, 168 }, - { 2, 1, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 0, 64 }, - { 2, 1, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 2, 80 }, - { 2, 1, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 5, 104 }, - { 4, 2, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 0, 108 }, - { 4, 2, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 2, 132 }, - { 4, 2, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 5, 168 }, - { 8, 3, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 0, 176 }, - { 8, 3, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 2, 208 }, - { 8, 3, ACB_TYPE_HAMMING, FCB_TYPE_EXC_PULSES, 5, 256 } -}; - -/** - * WMA Voice decoding context. - */ -typedef struct { - /** - * @name Global values specified in the stream header / extradata or used all over. - * @{ - */ - GetBitContext gb; ///< packet bitreader. During decoder init, - ///< it contains the extradata from the - ///< demuxer. During decoding, it contains - ///< packet data. - int8_t vbm_tree[25]; ///< converts VLC codes to frame type - - int spillover_bitsize; ///< number of bits used to specify - ///< #spillover_nbits in the packet header - ///< = ceil(log2(ctx->block_align << 3)) - int history_nsamples; ///< number of samples in history for signal - ///< prediction (through ACB) - - /* postfilter specific values */ - int do_apf; ///< whether to apply the averaged - ///< projection filter (APF) - int denoise_strength; ///< strength of denoising in Wiener filter - ///< [0-11] - int denoise_tilt_corr; ///< Whether to apply tilt correction to the - ///< Wiener filter coefficients (postfilter) - int dc_level; ///< Predicted amount of DC noise, based - ///< on which a DC removal filter is used - - int lsps; ///< number of LSPs per frame [10 or 16] - int lsp_q_mode; ///< defines quantizer defaults [0, 1] - int lsp_def_mode; ///< defines different sets of LSP defaults - ///< [0, 1] - int frame_lsp_bitsize; ///< size (in bits) of LSPs, when encoded - ///< per-frame (independent coding) - int sframe_lsp_bitsize; ///< size (in bits) of LSPs, when encoded - ///< per superframe (residual coding) - - int min_pitch_val; ///< base value for pitch parsing code - int max_pitch_val; ///< max value + 1 for pitch parsing - int pitch_nbits; ///< number of bits used to specify the - ///< pitch value in the frame header - int block_pitch_nbits; ///< number of bits used to specify the - ///< first block's pitch value - int block_pitch_range; ///< range of the block pitch - int block_delta_pitch_nbits; ///< number of bits used to specify the - ///< delta pitch between this and the last - ///< block's pitch value, used in all but - ///< first block - int block_delta_pitch_hrange; ///< 1/2 range of the delta (full range is - ///< from -this to +this-1) - uint16_t block_conv_table[4]; ///< boundaries for block pitch unit/scale - ///< conversion - - /** - * @} - * - * @name Packet values specified in the packet header or related to a packet. - * - * A packet is considered to be a single unit of data provided to this - * decoder by the demuxer. - * @{ - */ - int spillover_nbits; ///< number of bits of the previous packet's - ///< last superframe preceding this - ///< packet's first full superframe (useful - ///< for re-synchronization also) - int has_residual_lsps; ///< if set, superframes contain one set of - ///< LSPs that cover all frames, encoded as - ///< independent and residual LSPs; if not - ///< set, each frame contains its own, fully - ///< independent, LSPs - int skip_bits_next; ///< number of bits to skip at the next call - ///< to #wmavoice_decode_packet() (since - ///< they're part of the previous superframe) - - uint8_t sframe_cache[SFRAME_CACHE_MAXSIZE + FF_INPUT_BUFFER_PADDING_SIZE]; - ///< cache for superframe data split over - ///< multiple packets - int sframe_cache_size; ///< set to >0 if we have data from an - ///< (incomplete) superframe from a previous - ///< packet that spilled over in the current - ///< packet; specifies the amount of bits in - ///< #sframe_cache - PutBitContext pb; ///< bitstream writer for #sframe_cache - - /** - * @} - * - * @name Frame and superframe values - * Superframe and frame data - these can change from frame to frame, - * although some of them do in that case serve as a cache / history for - * the next frame or superframe. - * @{ - */ - double prev_lsps[MAX_LSPS]; ///< LSPs of the last frame of the previous - ///< superframe - int last_pitch_val; ///< pitch value of the previous frame - int last_acb_type; ///< frame type [0-2] of the previous frame - int pitch_diff_sh16; ///< ((cur_pitch_val - #last_pitch_val) - ///< << 16) / #MAX_FRAMESIZE - float silence_gain; ///< set for use in blocks if #ACB_TYPE_NONE - - int aw_idx_is_ext; ///< whether the AW index was encoded in - ///< 8 bits (instead of 6) - int aw_pulse_range; ///< the range over which #aw_pulse_set1() - ///< can apply the pulse, relative to the - ///< value in aw_first_pulse_off. The exact - ///< position of the first AW-pulse is within - ///< [pulse_off, pulse_off + this], and - ///< depends on bitstream values; [16 or 24] - int aw_n_pulses[2]; ///< number of AW-pulses in each block; note - ///< that this number can be negative (in - ///< which case it basically means "zero") - int aw_first_pulse_off[2]; ///< index of first sample to which to - ///< apply AW-pulses, or -0xff if unset - int aw_next_pulse_off_cache; ///< the position (relative to start of the - ///< second block) at which pulses should - ///< start to be positioned, serves as a - ///< cache for pitch-adaptive window pulses - ///< between blocks - - int frame_cntr; ///< current frame index [0 - 0xFFFE]; is - ///< only used for comfort noise in #pRNG() - float gain_pred_err[6]; ///< cache for gain prediction - float excitation_history[MAX_SIGNAL_HISTORY]; - ///< cache of the signal of previous - ///< superframes, used as a history for - ///< signal generation - float synth_history[MAX_LSPS]; ///< see #excitation_history - /** - * @} - * - * @name Postfilter values - * - * Variables used for postfilter implementation, mostly history for - * smoothing and so on, and context variables for FFT/iFFT. - * @{ - */ - RDFTContext rdft, irdft; ///< contexts for FFT-calculation in the - ///< postfilter (for denoise filter) - DCTContext dct, dst; ///< contexts for phase shift (in Hilbert - ///< transform, part of postfilter) - float sin[511], cos[511]; ///< 8-bit cosine/sine windows over [-pi,pi] - ///< range - float postfilter_agc; ///< gain control memory, used in - ///< #adaptive_gain_control() - float dcf_mem[2]; ///< DC filter history - float zero_exc_pf[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE]; - ///< zero filter output (i.e. excitation) - ///< by postfilter - float denoise_filter_cache[MAX_FRAMESIZE]; - int denoise_filter_cache_size; ///< samples in #denoise_filter_cache - DECLARE_ALIGNED(32, float, tilted_lpcs_pf)[0x80]; - ///< aligned buffer for LPC tilting - DECLARE_ALIGNED(32, float, denoise_coeffs_pf)[0x80]; - ///< aligned buffer for denoise coefficients - DECLARE_ALIGNED(32, float, synth_filter_out_buf)[0x80 + MAX_LSPS_ALIGN16]; - ///< aligned buffer for postfilter speech - ///< synthesis - /** - * @} - */ -} WMAVoiceContext; - -/** - * Set up the variable bit mode (VBM) tree from container extradata. - * @param gb bit I/O context. - * The bit context (s->gb) should be loaded with byte 23-46 of the - * container extradata (i.e. the ones containing the VBM tree). - * @param vbm_tree pointer to array to which the decoded VBM tree will be - * written. - * @return 0 on success, <0 on error. - */ -static av_cold int decode_vbmtree(GetBitContext *gb, int8_t vbm_tree[25]) -{ - int cntr[8] = { 0 }, n, res; - - memset(vbm_tree, 0xff, sizeof(vbm_tree[0]) * 25); - for (n = 0; n < 17; n++) { - res = get_bits(gb, 3); - if (cntr[res] > 3) // should be >= 3 + (res == 7)) - return -1; - vbm_tree[res * 3 + cntr[res]++] = n; - } - return 0; -} - -static av_cold void wmavoice_init_static_data(AVCodec *codec) -{ - static const uint8_t bits[] = { - 2, 2, 2, 4, 4, 4, - 6, 6, 6, 8, 8, 8, - 10, 10, 10, 12, 12, 12, - 14, 14, 14, 14 - }; - static const uint16_t codes[] = { - 0x0000, 0x0001, 0x0002, // 00/01/10 - 0x000c, 0x000d, 0x000e, // 11+00/01/10 - 0x003c, 0x003d, 0x003e, // 1111+00/01/10 - 0x00fc, 0x00fd, 0x00fe, // 111111+00/01/10 - 0x03fc, 0x03fd, 0x03fe, // 11111111+00/01/10 - 0x0ffc, 0x0ffd, 0x0ffe, // 1111111111+00/01/10 - 0x3ffc, 0x3ffd, 0x3ffe, 0x3fff // 111111111111+xx - }; - - INIT_VLC_STATIC(&frame_type_vlc, VLC_NBITS, sizeof(bits), - bits, 1, 1, codes, 2, 2, 132); -} - -/** - * Set up decoder with parameters from demuxer (extradata etc.). - */ -static av_cold int wmavoice_decode_init(AVCodecContext *ctx) -{ - int n, flags, pitch_range, lsp16_flag; - WMAVoiceContext *s = ctx->priv_data; - - /** - * Extradata layout: - * - byte 0-18: WMAPro-in-WMAVoice extradata (see wmaprodec.c), - * - byte 19-22: flags field (annoyingly in LE; see below for known - * values), - * - byte 23-46: variable bitmode tree (really just 17 * 3 bits, - * rest is 0). - */ - if (ctx->extradata_size != 46) { - av_log(ctx, AV_LOG_ERROR, - "Invalid extradata size %d (should be 46)\n", - ctx->extradata_size); - return AVERROR_INVALIDDATA; - } - flags = AV_RL32(ctx->extradata + 18); - s->spillover_bitsize = 3 + av_ceil_log2(ctx->block_align); - s->do_apf = flags & 0x1; - if (s->do_apf) { - ff_rdft_init(&s->rdft, 7, DFT_R2C); - ff_rdft_init(&s->irdft, 7, IDFT_C2R); - ff_dct_init(&s->dct, 6, DCT_I); - ff_dct_init(&s->dst, 6, DST_I); - - ff_sine_window_init(s->cos, 256); - memcpy(&s->sin[255], s->cos, 256 * sizeof(s->cos[0])); - for (n = 0; n < 255; n++) { - s->sin[n] = -s->sin[510 - n]; - s->cos[510 - n] = s->cos[n]; - } - } - s->denoise_strength = (flags >> 2) & 0xF; - if (s->denoise_strength >= 12) { - av_log(ctx, AV_LOG_ERROR, - "Invalid denoise filter strength %d (max=11)\n", - s->denoise_strength); - return AVERROR_INVALIDDATA; - } - s->denoise_tilt_corr = !!(flags & 0x40); - s->dc_level = (flags >> 7) & 0xF; - s->lsp_q_mode = !!(flags & 0x2000); - s->lsp_def_mode = !!(flags & 0x4000); - lsp16_flag = flags & 0x1000; - if (lsp16_flag) { - s->lsps = 16; - s->frame_lsp_bitsize = 34; - s->sframe_lsp_bitsize = 60; - } else { - s->lsps = 10; - s->frame_lsp_bitsize = 24; - s->sframe_lsp_bitsize = 48; - } - for (n = 0; n < s->lsps; n++) - s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0); - - init_get_bits(&s->gb, ctx->extradata + 22, (ctx->extradata_size - 22) << 3); - if (decode_vbmtree(&s->gb, s->vbm_tree) < 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid VBM tree; broken extradata?\n"); - return AVERROR_INVALIDDATA; - } - - s->min_pitch_val = ((ctx->sample_rate << 8) / 400 + 50) >> 8; - s->max_pitch_val = ((ctx->sample_rate << 8) * 37 / 2000 + 50) >> 8; - pitch_range = s->max_pitch_val - s->min_pitch_val; - if (pitch_range <= 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid pitch range; broken extradata?\n"); - return AVERROR_INVALIDDATA; - } - s->pitch_nbits = av_ceil_log2(pitch_range); - s->last_pitch_val = 40; - s->last_acb_type = ACB_TYPE_NONE; - s->history_nsamples = s->max_pitch_val + 8; - - if (s->min_pitch_val < 1 || s->history_nsamples > MAX_SIGNAL_HISTORY) { - int min_sr = ((((1 << 8) - 50) * 400) + 0xFF) >> 8, - max_sr = ((((MAX_SIGNAL_HISTORY - 8) << 8) + 205) * 2000 / 37) >> 8; - - av_log(ctx, AV_LOG_ERROR, - "Unsupported samplerate %d (min=%d, max=%d)\n", - ctx->sample_rate, min_sr, max_sr); // 322-22097 Hz - - return AVERROR(ENOSYS); - } - - s->block_conv_table[0] = s->min_pitch_val; - s->block_conv_table[1] = (pitch_range * 25) >> 6; - s->block_conv_table[2] = (pitch_range * 44) >> 6; - s->block_conv_table[3] = s->max_pitch_val - 1; - s->block_delta_pitch_hrange = (pitch_range >> 3) & ~0xF; - if (s->block_delta_pitch_hrange <= 0) { - av_log(ctx, AV_LOG_ERROR, "Invalid delta pitch hrange; broken extradata?\n"); - return AVERROR_INVALIDDATA; - } - s->block_delta_pitch_nbits = 1 + av_ceil_log2(s->block_delta_pitch_hrange); - s->block_pitch_range = s->block_conv_table[2] + - s->block_conv_table[3] + 1 + - 2 * (s->block_conv_table[1] - 2 * s->min_pitch_val); - s->block_pitch_nbits = av_ceil_log2(s->block_pitch_range); - - ctx->channels = 1; - ctx->channel_layout = AV_CH_LAYOUT_MONO; - ctx->sample_fmt = AV_SAMPLE_FMT_FLT; - - return 0; -} - -/** - * @name Postfilter functions - * Postfilter functions (gain control, wiener denoise filter, DC filter, - * kalman smoothening, plus surrounding code to wrap it) - * @{ - */ -/** - * Adaptive gain control (as used in postfilter). - * - * Identical to #ff_adaptive_gain_control() in acelp_vectors.c, except - * that the energy here is calculated using sum(abs(...)), whereas the - * other codecs (e.g. AMR-NB, SIPRO) use sqrt(dotproduct(...)). - * - * @param out output buffer for filtered samples - * @param in input buffer containing the samples as they are after the - * postfilter steps so far - * @param speech_synth input buffer containing speech synth before postfilter - * @param size input buffer size - * @param alpha exponential filter factor - * @param gain_mem pointer to filter memory (single float) - */ -static void adaptive_gain_control(float *out, const float *in, - const float *speech_synth, - int size, float alpha, float *gain_mem) -{ - int i; - float speech_energy = 0.0, postfilter_energy = 0.0, gain_scale_factor; - float mem = *gain_mem; - - for (i = 0; i < size; i++) { - speech_energy += fabsf(speech_synth[i]); - postfilter_energy += fabsf(in[i]); - } - gain_scale_factor = (1.0 - alpha) * speech_energy / postfilter_energy; - - for (i = 0; i < size; i++) { - mem = alpha * mem + gain_scale_factor; - out[i] = in[i] * mem; - } - - *gain_mem = mem; -} - -/** - * Kalman smoothing function. - * - * This function looks back pitch +/- 3 samples back into history to find - * the best fitting curve (that one giving the optimal gain of the two - * signals, i.e. the highest dot product between the two), and then - * uses that signal history to smoothen the output of the speech synthesis - * filter. - * - * @param s WMA Voice decoding context - * @param pitch pitch of the speech signal - * @param in input speech signal - * @param out output pointer for smoothened signal - * @param size input/output buffer size - * - * @returns -1 if no smoothening took place, e.g. because no optimal - * fit could be found, or 0 on success. - */ -static int kalman_smoothen(WMAVoiceContext *s, int pitch, - const float *in, float *out, int size) -{ - int n; - float optimal_gain = 0, dot; - const float *ptr = &in[-FFMAX(s->min_pitch_val, pitch - 3)], - *end = &in[-FFMIN(s->max_pitch_val, pitch + 3)], - *best_hist_ptr = NULL; - - /* find best fitting point in history */ - do { - dot = avpriv_scalarproduct_float_c(in, ptr, size); - if (dot > optimal_gain) { - optimal_gain = dot; - best_hist_ptr = ptr; - } - } while (--ptr >= end); - - if (optimal_gain <= 0) - return -1; - dot = avpriv_scalarproduct_float_c(best_hist_ptr, best_hist_ptr, size); - if (dot <= 0) // would be 1.0 - return -1; - - if (optimal_gain <= dot) { - dot = dot / (dot + 0.6 * optimal_gain); // 0.625-1.000 - } else - dot = 0.625; - - /* actual smoothing */ - for (n = 0; n < size; n++) - out[n] = best_hist_ptr[n] + dot * (in[n] - best_hist_ptr[n]); - - return 0; -} - -/** - * Get the tilt factor of a formant filter from its transfer function - * @see #tilt_factor() in amrnbdec.c, which does essentially the same, - * but somehow (??) it does a speech synthesis filter in the - * middle, which is missing here - * - * @param lpcs LPC coefficients - * @param n_lpcs Size of LPC buffer - * @returns the tilt factor - */ -static float tilt_factor(const float *lpcs, int n_lpcs) -{ - float rh0, rh1; - - rh0 = 1.0 + avpriv_scalarproduct_float_c(lpcs, lpcs, n_lpcs); - rh1 = lpcs[0] + avpriv_scalarproduct_float_c(lpcs, &lpcs[1], n_lpcs - 1); - - return rh1 / rh0; -} - -/** - * Derive denoise filter coefficients (in real domain) from the LPCs. - */ -static void calc_input_response(WMAVoiceContext *s, float *lpcs, - int fcb_type, float *coeffs, int remainder) -{ - float last_coeff, min = 15.0, max = -15.0; - float irange, angle_mul, gain_mul, range, sq; - int n, idx; - - /* Create frequency power spectrum of speech input (i.e. RDFT of LPCs) */ - s->rdft.rdft_calc(&s->rdft, lpcs); -#define log_range(var, assign) do { \ - float tmp = log10f(assign); var = tmp; \ - max = FFMAX(max, tmp); min = FFMIN(min, tmp); \ - } while (0) - log_range(last_coeff, lpcs[1] * lpcs[1]); - for (n = 1; n < 64; n++) - log_range(lpcs[n], lpcs[n * 2] * lpcs[n * 2] + - lpcs[n * 2 + 1] * lpcs[n * 2 + 1]); - log_range(lpcs[0], lpcs[0] * lpcs[0]); -#undef log_range - range = max - min; - lpcs[64] = last_coeff; - - /* Now, use this spectrum to pick out these frequencies with higher - * (relative) power/energy (which we then take to be "not noise"), - * and set up a table (still in lpc[]) of (relative) gains per frequency. - * These frequencies will be maintained, while others ("noise") will be - * decreased in the filter output. */ - irange = 64.0 / range; // so irange*(max-value) is in the range [0, 63] - gain_mul = range * (fcb_type == FCB_TYPE_HARDCODED ? (5.0 / 13.0) : - (5.0 / 14.7)); - angle_mul = gain_mul * (8.0 * M_LN10 / M_PI); - for (n = 0; n <= 64; n++) { - float pwr; - - idx = FFMAX(0, lrint((max - lpcs[n]) * irange) - 1); - pwr = wmavoice_denoise_power_table[s->denoise_strength][idx]; - lpcs[n] = angle_mul * pwr; - - /* 70.57 =~ 1/log10(1.0331663) */ - idx = (pwr * gain_mul - 0.0295) * 70.570526123; - if (idx > 127) { // fall back if index falls outside table range - coeffs[n] = wmavoice_energy_table[127] * - powf(1.0331663, idx - 127); - } else - coeffs[n] = wmavoice_energy_table[FFMAX(0, idx)]; - } - - /* calculate the Hilbert transform of the gains, which we do (since this - * is a sine input) by doing a phase shift (in theory, H(sin())=cos()). - * Hilbert_Transform(RDFT(x)) = Laplace_Transform(x), which calculates the - * "moment" of the LPCs in this filter. */ - s->dct.dct_calc(&s->dct, lpcs); - s->dst.dct_calc(&s->dst, lpcs); - - /* Split out the coefficient indexes into phase/magnitude pairs */ - idx = 255 + av_clip(lpcs[64], -255, 255); - coeffs[0] = coeffs[0] * s->cos[idx]; - idx = 255 + av_clip(lpcs[64] - 2 * lpcs[63], -255, 255); - last_coeff = coeffs[64] * s->cos[idx]; - for (n = 63;; n--) { - idx = 255 + av_clip(-lpcs[64] - 2 * lpcs[n - 1], -255, 255); - coeffs[n * 2 + 1] = coeffs[n] * s->sin[idx]; - coeffs[n * 2] = coeffs[n] * s->cos[idx]; - - if (!--n) break; - - idx = 255 + av_clip( lpcs[64] - 2 * lpcs[n - 1], -255, 255); - coeffs[n * 2 + 1] = coeffs[n] * s->sin[idx]; - coeffs[n * 2] = coeffs[n] * s->cos[idx]; - } - coeffs[1] = last_coeff; - - /* move into real domain */ - s->irdft.rdft_calc(&s->irdft, coeffs); - - /* tilt correction and normalize scale */ - memset(&coeffs[remainder], 0, sizeof(coeffs[0]) * (128 - remainder)); - if (s->denoise_tilt_corr) { - float tilt_mem = 0; - - coeffs[remainder - 1] = 0; - ff_tilt_compensation(&tilt_mem, - -1.8 * tilt_factor(coeffs, remainder - 1), - coeffs, remainder); - } - sq = (1.0 / 64.0) * sqrtf(1 / avpriv_scalarproduct_float_c(coeffs, coeffs, - remainder)); - for (n = 0; n < remainder; n++) - coeffs[n] *= sq; -} - -/** - * This function applies a Wiener filter on the (noisy) speech signal as - * a means to denoise it. - * - * - take RDFT of LPCs to get the power spectrum of the noise + speech; - * - using this power spectrum, calculate (for each frequency) the Wiener - * filter gain, which depends on the frequency power and desired level - * of noise subtraction (when set too high, this leads to artifacts) - * We can do this symmetrically over the X-axis (so 0-4kHz is the inverse - * of 4-8kHz); - * - by doing a phase shift, calculate the Hilbert transform of this array - * of per-frequency filter-gains to get the filtering coefficients; - * - smoothen/normalize/de-tilt these filter coefficients as desired; - * - take RDFT of noisy sound, apply the coefficients and take its IRDFT - * to get the denoised speech signal; - * - the leftover (i.e. output of the IRDFT on denoised speech data beyond - * the frame boundary) are saved and applied to subsequent frames by an - * overlap-add method (otherwise you get clicking-artifacts). - * - * @param s WMA Voice decoding context - * @param fcb_type Frame (codebook) type - * @param synth_pf input: the noisy speech signal, output: denoised speech - * data; should be 16-byte aligned (for ASM purposes) - * @param size size of the speech data - * @param lpcs LPCs used to synthesize this frame's speech data - */ -static void wiener_denoise(WMAVoiceContext *s, int fcb_type, - float *synth_pf, int size, - const float *lpcs) -{ - int remainder, lim, n; - - if (fcb_type != FCB_TYPE_SILENCE) { - float *tilted_lpcs = s->tilted_lpcs_pf, - *coeffs = s->denoise_coeffs_pf, tilt_mem = 0; - - tilted_lpcs[0] = 1.0; - memcpy(&tilted_lpcs[1], lpcs, sizeof(lpcs[0]) * s->lsps); - memset(&tilted_lpcs[s->lsps + 1], 0, - sizeof(tilted_lpcs[0]) * (128 - s->lsps - 1)); - ff_tilt_compensation(&tilt_mem, 0.7 * tilt_factor(lpcs, s->lsps), - tilted_lpcs, s->lsps + 2); - - /* The IRDFT output (127 samples for 7-bit filter) beyond the frame - * size is applied to the next frame. All input beyond this is zero, - * and thus all output beyond this will go towards zero, hence we can - * limit to min(size-1, 127-size) as a performance consideration. */ - remainder = FFMIN(127 - size, size - 1); - calc_input_response(s, tilted_lpcs, fcb_type, coeffs, remainder); - - /* apply coefficients (in frequency spectrum domain), i.e. complex - * number multiplication */ - memset(&synth_pf[size], 0, sizeof(synth_pf[0]) * (128 - size)); - s->rdft.rdft_calc(&s->rdft, synth_pf); - s->rdft.rdft_calc(&s->rdft, coeffs); - synth_pf[0] *= coeffs[0]; - synth_pf[1] *= coeffs[1]; - for (n = 1; n < 64; n++) { - float v1 = synth_pf[n * 2], v2 = synth_pf[n * 2 + 1]; - synth_pf[n * 2] = v1 * coeffs[n * 2] - v2 * coeffs[n * 2 + 1]; - synth_pf[n * 2 + 1] = v2 * coeffs[n * 2] + v1 * coeffs[n * 2 + 1]; - } - s->irdft.rdft_calc(&s->irdft, synth_pf); - } - - /* merge filter output with the history of previous runs */ - if (s->denoise_filter_cache_size) { - lim = FFMIN(s->denoise_filter_cache_size, size); - for (n = 0; n < lim; n++) - synth_pf[n] += s->denoise_filter_cache[n]; - s->denoise_filter_cache_size -= lim; - memmove(s->denoise_filter_cache, &s->denoise_filter_cache[size], - sizeof(s->denoise_filter_cache[0]) * s->denoise_filter_cache_size); - } - - /* move remainder of filter output into a cache for future runs */ - if (fcb_type != FCB_TYPE_SILENCE) { - lim = FFMIN(remainder, s->denoise_filter_cache_size); - for (n = 0; n < lim; n++) - s->denoise_filter_cache[n] += synth_pf[size + n]; - if (lim < remainder) { - memcpy(&s->denoise_filter_cache[lim], &synth_pf[size + lim], - sizeof(s->denoise_filter_cache[0]) * (remainder - lim)); - s->denoise_filter_cache_size = remainder; - } - } -} - -/** - * Averaging projection filter, the postfilter used in WMAVoice. - * - * This uses the following steps: - * - A zero-synthesis filter (generate excitation from synth signal) - * - Kalman smoothing on excitation, based on pitch - * - Re-synthesized smoothened output - * - Iterative Wiener denoise filter - * - Adaptive gain filter - * - DC filter - * - * @param s WMAVoice decoding context - * @param synth Speech synthesis output (before postfilter) - * @param samples Output buffer for filtered samples - * @param size Buffer size of synth & samples - * @param lpcs Generated LPCs used for speech synthesis - * @param zero_exc_pf destination for zero synthesis filter (16-byte aligned) - * @param fcb_type Frame type (silence, hardcoded, AW-pulses or FCB-pulses) - * @param pitch Pitch of the input signal - */ -static void postfilter(WMAVoiceContext *s, const float *synth, - float *samples, int size, - const float *lpcs, float *zero_exc_pf, - int fcb_type, int pitch) -{ - float synth_filter_in_buf[MAX_FRAMESIZE / 2], - *synth_pf = &s->synth_filter_out_buf[MAX_LSPS_ALIGN16], - *synth_filter_in = zero_exc_pf; - - av_assert0(size <= MAX_FRAMESIZE / 2); - - /* generate excitation from input signal */ - ff_celp_lp_zero_synthesis_filterf(zero_exc_pf, lpcs, synth, size, s->lsps); - - if (fcb_type >= FCB_TYPE_AW_PULSES && - !kalman_smoothen(s, pitch, zero_exc_pf, synth_filter_in_buf, size)) - synth_filter_in = synth_filter_in_buf; - - /* re-synthesize speech after smoothening, and keep history */ - ff_celp_lp_synthesis_filterf(synth_pf, lpcs, - synth_filter_in, size, s->lsps); - memcpy(&synth_pf[-s->lsps], &synth_pf[size - s->lsps], - sizeof(synth_pf[0]) * s->lsps); - - wiener_denoise(s, fcb_type, synth_pf, size, lpcs); - - adaptive_gain_control(samples, synth_pf, synth, size, 0.99, - &s->postfilter_agc); - - if (s->dc_level > 8) { - /* remove ultra-low frequency DC noise / highpass filter; - * coefficients are identical to those used in SIPR decoding, - * and very closely resemble those used in AMR-NB decoding. */ - ff_acelp_apply_order_2_transfer_function(samples, samples, - (const float[2]) { -1.99997, 1.0 }, - (const float[2]) { -1.9330735188, 0.93589198496 }, - 0.93980580475, s->dcf_mem, size); - } -} -/** - * @} - */ - -/** - * Dequantize LSPs - * @param lsps output pointer to the array that will hold the LSPs - * @param num number of LSPs to be dequantized - * @param values quantized values, contains n_stages values - * @param sizes range (i.e. max value) of each quantized value - * @param n_stages number of dequantization runs - * @param table dequantization table to be used - * @param mul_q LSF multiplier - * @param base_q base (lowest) LSF values - */ -static void dequant_lsps(double *lsps, int num, - const uint16_t *values, - const uint16_t *sizes, - int n_stages, const uint8_t *table, - const double *mul_q, - const double *base_q) -{ - int n, m; - - memset(lsps, 0, num * sizeof(*lsps)); - for (n = 0; n < n_stages; n++) { - const uint8_t *t_off = &table[values[n] * num]; - double base = base_q[n], mul = mul_q[n]; - - for (m = 0; m < num; m++) - lsps[m] += base + mul * t_off[m]; - - table += sizes[n] * num; - } -} - -/** - * @name LSP dequantization routines - * LSP dequantization routines, for 10/16LSPs and independent/residual coding. - * @note we assume enough bits are available, caller should check. - * lsp10i() consumes 24 bits; lsp10r() consumes an additional 24 bits; - * lsp16i() consumes 34 bits; lsp16r() consumes an additional 26 bits. - * @{ - */ -/** - * Parse 10 independently-coded LSPs. - */ -static void dequant_lsp10i(GetBitContext *gb, double *lsps) -{ - static const uint16_t vec_sizes[4] = { 256, 64, 32, 32 }; - static const double mul_lsf[4] = { - 5.2187144800e-3, 1.4626986422e-3, - 9.6179549166e-4, 1.1325736225e-3 - }; - static const double base_lsf[4] = { - M_PI * -2.15522e-1, M_PI * -6.1646e-2, - M_PI * -3.3486e-2, M_PI * -5.7408e-2 - }; - uint16_t v[4]; - - v[0] = get_bits(gb, 8); - v[1] = get_bits(gb, 6); - v[2] = get_bits(gb, 5); - v[3] = get_bits(gb, 5); - - dequant_lsps(lsps, 10, v, vec_sizes, 4, wmavoice_dq_lsp10i, - mul_lsf, base_lsf); -} - -/** - * Parse 10 independently-coded LSPs, and then derive the tables to - * generate LSPs for the other frames from them (residual coding). - */ -static void dequant_lsp10r(GetBitContext *gb, - double *i_lsps, const double *old, - double *a1, double *a2, int q_mode) -{ - static const uint16_t vec_sizes[3] = { 128, 64, 64 }; - static const double mul_lsf[3] = { - 2.5807601174e-3, 1.2354460219e-3, 1.1763821673e-3 - }; - static const double base_lsf[3] = { - M_PI * -1.07448e-1, M_PI * -5.2706e-2, M_PI * -5.1634e-2 - }; - const float (*ipol_tab)[2][10] = q_mode ? - wmavoice_lsp10_intercoeff_b : wmavoice_lsp10_intercoeff_a; - uint16_t interpol, v[3]; - int n; - - dequant_lsp10i(gb, i_lsps); - - interpol = get_bits(gb, 5); - v[0] = get_bits(gb, 7); - v[1] = get_bits(gb, 6); - v[2] = get_bits(gb, 6); - - for (n = 0; n < 10; n++) { - double delta = old[n] - i_lsps[n]; - a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; - a1[10 + n] = ipol_tab[interpol][1][n] * delta + i_lsps[n]; - } - - dequant_lsps(a2, 20, v, vec_sizes, 3, wmavoice_dq_lsp10r, - mul_lsf, base_lsf); -} - -/** - * Parse 16 independently-coded LSPs. - */ -static void dequant_lsp16i(GetBitContext *gb, double *lsps) -{ - static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 }; - static const double mul_lsf[5] = { - 3.3439586280e-3, 6.9908173703e-4, - 3.3216608306e-3, 1.0334960326e-3, - 3.1899104283e-3 - }; - static const double base_lsf[5] = { - M_PI * -1.27576e-1, M_PI * -2.4292e-2, - M_PI * -1.28094e-1, M_PI * -3.2128e-2, - M_PI * -1.29816e-1 - }; - uint16_t v[5]; - - v[0] = get_bits(gb, 8); - v[1] = get_bits(gb, 6); - v[2] = get_bits(gb, 7); - v[3] = get_bits(gb, 6); - v[4] = get_bits(gb, 7); - - dequant_lsps( lsps, 5, v, vec_sizes, 2, - wmavoice_dq_lsp16i1, mul_lsf, base_lsf); - dequant_lsps(&lsps[5], 5, &v[2], &vec_sizes[2], 2, - wmavoice_dq_lsp16i2, &mul_lsf[2], &base_lsf[2]); - dequant_lsps(&lsps[10], 6, &v[4], &vec_sizes[4], 1, - wmavoice_dq_lsp16i3, &mul_lsf[4], &base_lsf[4]); -} - -/** - * Parse 16 independently-coded LSPs, and then derive the tables to - * generate LSPs for the other frames from them (residual coding). - */ -static void dequant_lsp16r(GetBitContext *gb, - double *i_lsps, const double *old, - double *a1, double *a2, int q_mode) -{ - static const uint16_t vec_sizes[3] = { 128, 128, 128 }; - static const double mul_lsf[3] = { - 1.2232979501e-3, 1.4062241527e-3, 1.6114744851e-3 - }; - static const double base_lsf[3] = { - M_PI * -5.5830e-2, M_PI * -5.2908e-2, M_PI * -5.4776e-2 - }; - const float (*ipol_tab)[2][16] = q_mode ? - wmavoice_lsp16_intercoeff_b : wmavoice_lsp16_intercoeff_a; - uint16_t interpol, v[3]; - int n; - - dequant_lsp16i(gb, i_lsps); - - interpol = get_bits(gb, 5); - v[0] = get_bits(gb, 7); - v[1] = get_bits(gb, 7); - v[2] = get_bits(gb, 7); - - for (n = 0; n < 16; n++) { - double delta = old[n] - i_lsps[n]; - a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; - a1[16 + n] = ipol_tab[interpol][1][n] * delta + i_lsps[n]; - } - - dequant_lsps( a2, 10, v, vec_sizes, 1, - wmavoice_dq_lsp16r1, mul_lsf, base_lsf); - dequant_lsps(&a2[10], 10, &v[1], &vec_sizes[1], 1, - wmavoice_dq_lsp16r2, &mul_lsf[1], &base_lsf[1]); - dequant_lsps(&a2[20], 12, &v[2], &vec_sizes[2], 1, - wmavoice_dq_lsp16r3, &mul_lsf[2], &base_lsf[2]); -} - -/** - * @} - * @name Pitch-adaptive window coding functions - * The next few functions are for pitch-adaptive window coding. - * @{ - */ -/** - * Parse the offset of the first pitch-adaptive window pulses, and - * the distribution of pulses between the two blocks in this frame. - * @param s WMA Voice decoding context private data - * @param gb bit I/O context - * @param pitch pitch for each block in this frame - */ -static void aw_parse_coords(WMAVoiceContext *s, GetBitContext *gb, - const int *pitch) -{ - static const int16_t start_offset[94] = { - -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11, - 13, 15, 18, 17, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 35, 37, 39, 41, 43, - 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, - 69, 71, 73, 75, 77, 79, 81, 83, 85, 87, 89, 91, - 93, 95, 97, 99, 101, 103, 105, 107, 109, 111, 113, 115, - 117, 119, 121, 123, 125, 127, 129, 131, 133, 135, 137, 139, - 141, 143, 145, 147, 149, 151, 153, 155, 157, 159 - }; - int bits, offset; - - /* position of pulse */ - s->aw_idx_is_ext = 0; - if ((bits = get_bits(gb, 6)) >= 54) { - s->aw_idx_is_ext = 1; - bits += (bits - 54) * 3 + get_bits(gb, 2); - } - - /* for a repeated pulse at pulse_off with a pitch_lag of pitch[], count - * the distribution of the pulses in each block contained in this frame. */ - s->aw_pulse_range = FFMIN(pitch[0], pitch[1]) > 32 ? 24 : 16; - for (offset = start_offset[bits]; offset < 0; offset += pitch[0]) ; - s->aw_n_pulses[0] = (pitch[0] - 1 + MAX_FRAMESIZE / 2 - offset) / pitch[0]; - s->aw_first_pulse_off[0] = offset - s->aw_pulse_range / 2; - offset += s->aw_n_pulses[0] * pitch[0]; - s->aw_n_pulses[1] = (pitch[1] - 1 + MAX_FRAMESIZE - offset) / pitch[1]; - s->aw_first_pulse_off[1] = offset - (MAX_FRAMESIZE + s->aw_pulse_range) / 2; - - /* if continuing from a position before the block, reset position to - * start of block (when corrected for the range over which it can be - * spread in aw_pulse_set1()). */ - if (start_offset[bits] < MAX_FRAMESIZE / 2) { - while (s->aw_first_pulse_off[1] - pitch[1] + s->aw_pulse_range > 0) - s->aw_first_pulse_off[1] -= pitch[1]; - if (start_offset[bits] < 0) - while (s->aw_first_pulse_off[0] - pitch[0] + s->aw_pulse_range > 0) - s->aw_first_pulse_off[0] -= pitch[0]; - } -} - -/** - * Apply second set of pitch-adaptive window pulses. - * @param s WMA Voice decoding context private data - * @param gb bit I/O context - * @param block_idx block index in frame [0, 1] - * @param fcb structure containing fixed codebook vector info - * @return -1 on error, 0 otherwise - */ -static int aw_pulse_set2(WMAVoiceContext *s, GetBitContext *gb, - int block_idx, AMRFixed *fcb) -{ - uint16_t use_mask_mem[9]; // only 5 are used, rest is padding - uint16_t *use_mask = use_mask_mem + 2; - /* in this function, idx is the index in the 80-bit (+ padding) use_mask - * bit-array. Since use_mask consists of 16-bit values, the lower 4 bits - * of idx are the position of the bit within a particular item in the - * array (0 being the most significant bit, and 15 being the least - * significant bit), and the remainder (>> 4) is the index in the - * use_mask[]-array. This is faster and uses less memory than using a - * 80-byte/80-int array. */ - int pulse_off = s->aw_first_pulse_off[block_idx], - pulse_start, n, idx, range, aidx, start_off = 0; - - /* set offset of first pulse to within this block */ - if (s->aw_n_pulses[block_idx] > 0) - while (pulse_off + s->aw_pulse_range < 1) - pulse_off += fcb->pitch_lag; - - /* find range per pulse */ - if (s->aw_n_pulses[0] > 0) { - if (block_idx == 0) { - range = 32; - } else /* block_idx = 1 */ { - range = 8; - if (s->aw_n_pulses[block_idx] > 0) - pulse_off = s->aw_next_pulse_off_cache; - } - } else - range = 16; - pulse_start = s->aw_n_pulses[block_idx] > 0 ? pulse_off - range / 2 : 0; - - /* aw_pulse_set1() already applies pulses around pulse_off (to be exactly, - * in the range of [pulse_off, pulse_off + s->aw_pulse_range], and thus - * we exclude that range from being pulsed again in this function. */ - memset(&use_mask[-2], 0, 2 * sizeof(use_mask[0])); - memset( use_mask, -1, 5 * sizeof(use_mask[0])); - memset(&use_mask[5], 0, 2 * sizeof(use_mask[0])); - if (s->aw_n_pulses[block_idx] > 0) - for (idx = pulse_off; idx < MAX_FRAMESIZE / 2; idx += fcb->pitch_lag) { - int excl_range = s->aw_pulse_range; // always 16 or 24 - uint16_t *use_mask_ptr = &use_mask[idx >> 4]; - int first_sh = 16 - (idx & 15); - *use_mask_ptr++ &= 0xFFFFu << first_sh; - excl_range -= first_sh; - if (excl_range >= 16) { - *use_mask_ptr++ = 0; - *use_mask_ptr &= 0xFFFF >> (excl_range - 16); - } else - *use_mask_ptr &= 0xFFFF >> excl_range; - } - - /* find the 'aidx'th offset that is not excluded */ - aidx = get_bits(gb, s->aw_n_pulses[0] > 0 ? 5 - 2 * block_idx : 4); - for (n = 0; n <= aidx; pulse_start++) { - for (idx = pulse_start; idx < 0; idx += fcb->pitch_lag) ; - if (idx >= MAX_FRAMESIZE / 2) { // find from zero - if (use_mask[0]) idx = 0x0F; - else if (use_mask[1]) idx = 0x1F; - else if (use_mask[2]) idx = 0x2F; - else if (use_mask[3]) idx = 0x3F; - else if (use_mask[4]) idx = 0x4F; - else return -1; - idx -= av_log2_16bit(use_mask[idx >> 4]); - } - if (use_mask[idx >> 4] & (0x8000 >> (idx & 15))) { - use_mask[idx >> 4] &= ~(0x8000 >> (idx & 15)); - n++; - start_off = idx; - } - } - - fcb->x[fcb->n] = start_off; - fcb->y[fcb->n] = get_bits1(gb) ? -1.0 : 1.0; - fcb->n++; - - /* set offset for next block, relative to start of that block */ - n = (MAX_FRAMESIZE / 2 - start_off) % fcb->pitch_lag; - s->aw_next_pulse_off_cache = n ? fcb->pitch_lag - n : 0; - return 0; -} - -/** - * Apply first set of pitch-adaptive window pulses. - * @param s WMA Voice decoding context private data - * @param gb bit I/O context - * @param block_idx block index in frame [0, 1] - * @param fcb storage location for fixed codebook pulse info - */ -static void aw_pulse_set1(WMAVoiceContext *s, GetBitContext *gb, - int block_idx, AMRFixed *fcb) -{ - int val = get_bits(gb, 12 - 2 * (s->aw_idx_is_ext && !block_idx)); - float v; - - if (s->aw_n_pulses[block_idx] > 0) { - int n, v_mask, i_mask, sh, n_pulses; - - if (s->aw_pulse_range == 24) { // 3 pulses, 1:sign + 3:index each - n_pulses = 3; - v_mask = 8; - i_mask = 7; - sh = 4; - } else { // 4 pulses, 1:sign + 2:index each - n_pulses = 4; - v_mask = 4; - i_mask = 3; - sh = 3; - } - - for (n = n_pulses - 1; n >= 0; n--, val >>= sh) { - fcb->y[fcb->n] = (val & v_mask) ? -1.0 : 1.0; - fcb->x[fcb->n] = (val & i_mask) * n_pulses + n + - s->aw_first_pulse_off[block_idx]; - while (fcb->x[fcb->n] < 0) - fcb->x[fcb->n] += fcb->pitch_lag; - if (fcb->x[fcb->n] < MAX_FRAMESIZE / 2) - fcb->n++; - } - } else { - int num2 = (val & 0x1FF) >> 1, delta, idx; - - if (num2 < 1 * 79) { delta = 1; idx = num2 + 1; } - else if (num2 < 2 * 78) { delta = 3; idx = num2 + 1 - 1 * 77; } - else if (num2 < 3 * 77) { delta = 5; idx = num2 + 1 - 2 * 76; } - else { delta = 7; idx = num2 + 1 - 3 * 75; } - v = (val & 0x200) ? -1.0 : 1.0; - - fcb->no_repeat_mask |= 3 << fcb->n; - fcb->x[fcb->n] = idx - delta; - fcb->y[fcb->n] = v; - fcb->x[fcb->n + 1] = idx; - fcb->y[fcb->n + 1] = (val & 1) ? -v : v; - fcb->n += 2; - } -} - -/** - * @} - * - * Generate a random number from frame_cntr and block_idx, which will lief - * in the range [0, 1000 - block_size] (so it can be used as an index in a - * table of size 1000 of which you want to read block_size entries). - * - * @param frame_cntr current frame number - * @param block_num current block index - * @param block_size amount of entries we want to read from a table - * that has 1000 entries - * @return a (non-)random number in the [0, 1000 - block_size] range. - */ -static int pRNG(int frame_cntr, int block_num, int block_size) -{ - /* array to simplify the calculation of z: - * y = (x % 9) * 5 + 6; - * z = (49995 * x) / y; - * Since y only has 9 values, we can remove the division by using a - * LUT and using FASTDIV-style divisions. For each of the 9 values - * of y, we can rewrite z as: - * z = x * (49995 / y) + x * ((49995 % y) / y) - * In this table, each col represents one possible value of y, the - * first number is 49995 / y, and the second is the FASTDIV variant - * of 49995 % y / y. */ - static const unsigned int div_tbl[9][2] = { - { 8332, 3 * 715827883U }, // y = 6 - { 4545, 0 * 390451573U }, // y = 11 - { 3124, 11 * 268435456U }, // y = 16 - { 2380, 15 * 204522253U }, // y = 21 - { 1922, 23 * 165191050U }, // y = 26 - { 1612, 23 * 138547333U }, // y = 31 - { 1388, 27 * 119304648U }, // y = 36 - { 1219, 16 * 104755300U }, // y = 41 - { 1086, 39 * 93368855U } // y = 46 - }; - unsigned int z, y, x = MUL16(block_num, 1877) + frame_cntr; - if (x >= 0xFFFF) x -= 0xFFFF; // max value of x is 8*1877+0xFFFE=0x13AA6, - // so this is effectively a modulo (%) - y = x - 9 * MULH(477218589, x); // x % 9 - z = (uint16_t) (x * div_tbl[y][0] + UMULH(x, div_tbl[y][1])); - // z = x * 49995 / (y * 5 + 6) - return z % (1000 - block_size); -} - -/** - * Parse hardcoded signal for a single block. - * @note see #synth_block(). - */ -static void synth_block_hardcoded(WMAVoiceContext *s, GetBitContext *gb, - int block_idx, int size, - const struct frame_type_desc *frame_desc, - float *excitation) -{ - float gain; - int n, r_idx; - - av_assert0(size <= MAX_FRAMESIZE); - - /* Set the offset from which we start reading wmavoice_std_codebook */ - if (frame_desc->fcb_type == FCB_TYPE_SILENCE) { - r_idx = pRNG(s->frame_cntr, block_idx, size); - gain = s->silence_gain; - } else /* FCB_TYPE_HARDCODED */ { - r_idx = get_bits(gb, 8); - gain = wmavoice_gain_universal[get_bits(gb, 6)]; - } - - /* Clear gain prediction parameters */ - memset(s->gain_pred_err, 0, sizeof(s->gain_pred_err)); - - /* Apply gain to hardcoded codebook and use that as excitation signal */ - for (n = 0; n < size; n++) - excitation[n] = wmavoice_std_codebook[r_idx + n] * gain; -} - -/** - * Parse FCB/ACB signal for a single block. - * @note see #synth_block(). - */ -static void synth_block_fcb_acb(WMAVoiceContext *s, GetBitContext *gb, - int block_idx, int size, - int block_pitch_sh2, - const struct frame_type_desc *frame_desc, - float *excitation) -{ - static const float gain_coeff[6] = { - 0.8169, -0.06545, 0.1726, 0.0185, -0.0359, 0.0458 - }; - float pulses[MAX_FRAMESIZE / 2], pred_err, acb_gain, fcb_gain; - int n, idx, gain_weight; - AMRFixed fcb; - - av_assert0(size <= MAX_FRAMESIZE / 2); - memset(pulses, 0, sizeof(*pulses) * size); - - fcb.pitch_lag = block_pitch_sh2 >> 2; - fcb.pitch_fac = 1.0; - fcb.no_repeat_mask = 0; - fcb.n = 0; - - /* For the other frame types, this is where we apply the innovation - * (fixed) codebook pulses of the speech signal. */ - if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) { - aw_pulse_set1(s, gb, block_idx, &fcb); - if (aw_pulse_set2(s, gb, block_idx, &fcb)) { - /* Conceal the block with silence and return. - * Skip the correct amount of bits to read the next - * block from the correct offset. */ - int r_idx = pRNG(s->frame_cntr, block_idx, size); - - for (n = 0; n < size; n++) - excitation[n] = - wmavoice_std_codebook[r_idx + n] * s->silence_gain; - skip_bits(gb, 7 + 1); - return; - } - } else /* FCB_TYPE_EXC_PULSES */ { - int offset_nbits = 5 - frame_desc->log_n_blocks; - - fcb.no_repeat_mask = -1; - /* similar to ff_decode_10_pulses_35bits(), but with single pulses - * (instead of double) for a subset of pulses */ - for (n = 0; n < 5; n++) { - float sign; - int pos1, pos2; - - sign = get_bits1(gb) ? 1.0 : -1.0; - pos1 = get_bits(gb, offset_nbits); - fcb.x[fcb.n] = n + 5 * pos1; - fcb.y[fcb.n++] = sign; - if (n < frame_desc->dbl_pulses) { - pos2 = get_bits(gb, offset_nbits); - fcb.x[fcb.n] = n + 5 * pos2; - fcb.y[fcb.n++] = (pos1 < pos2) ? -sign : sign; - } - } - } - ff_set_fixed_vector(pulses, &fcb, 1.0, size); - - /* Calculate gain for adaptive & fixed codebook signal. - * see ff_amr_set_fixed_gain(). */ - idx = get_bits(gb, 7); - fcb_gain = expf(avpriv_scalarproduct_float_c(s->gain_pred_err, - gain_coeff, 6) - - 5.2409161640 + wmavoice_gain_codebook_fcb[idx]); - acb_gain = wmavoice_gain_codebook_acb[idx]; - pred_err = av_clipf(wmavoice_gain_codebook_fcb[idx], - -2.9957322736 /* log(0.05) */, - 1.6094379124 /* log(5.0) */); - - gain_weight = 8 >> frame_desc->log_n_blocks; - memmove(&s->gain_pred_err[gain_weight], s->gain_pred_err, - sizeof(*s->gain_pred_err) * (6 - gain_weight)); - for (n = 0; n < gain_weight; n++) - s->gain_pred_err[n] = pred_err; - - /* Calculation of adaptive codebook */ - if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) { - int len; - for (n = 0; n < size; n += len) { - int next_idx_sh16; - int abs_idx = block_idx * size + n; - int pitch_sh16 = (s->last_pitch_val << 16) + - s->pitch_diff_sh16 * abs_idx; - int pitch = (pitch_sh16 + 0x6FFF) >> 16; - int idx_sh16 = ((pitch << 16) - pitch_sh16) * 8 + 0x58000; - idx = idx_sh16 >> 16; - if (s->pitch_diff_sh16) { - if (s->pitch_diff_sh16 > 0) { - next_idx_sh16 = (idx_sh16) &~ 0xFFFF; - } else - next_idx_sh16 = (idx_sh16 + 0x10000) &~ 0xFFFF; - len = av_clip((idx_sh16 - next_idx_sh16) / s->pitch_diff_sh16 / 8, - 1, size - n); - } else - len = size; - - ff_acelp_interpolatef(&excitation[n], &excitation[n - pitch], - wmavoice_ipol1_coeffs, 17, - idx, 9, len); - } - } else /* ACB_TYPE_HAMMING */ { - int block_pitch = block_pitch_sh2 >> 2; - idx = block_pitch_sh2 & 3; - if (idx) { - ff_acelp_interpolatef(excitation, &excitation[-block_pitch], - wmavoice_ipol2_coeffs, 4, - idx, 8, size); - } else - av_memcpy_backptr((uint8_t *) excitation, sizeof(float) * block_pitch, - sizeof(float) * size); - } - - /* Interpolate ACB/FCB and use as excitation signal */ - ff_weighted_vector_sumf(excitation, excitation, pulses, - acb_gain, fcb_gain, size); -} - -/** - * Parse data in a single block. - * @note we assume enough bits are available, caller should check. - * - * @param s WMA Voice decoding context private data - * @param gb bit I/O context - * @param block_idx index of the to-be-read block - * @param size amount of samples to be read in this block - * @param block_pitch_sh2 pitch for this block << 2 - * @param lsps LSPs for (the end of) this frame - * @param prev_lsps LSPs for the last frame - * @param frame_desc frame type descriptor - * @param excitation target memory for the ACB+FCB interpolated signal - * @param synth target memory for the speech synthesis filter output - * @return 0 on success, <0 on error. - */ -static void synth_block(WMAVoiceContext *s, GetBitContext *gb, - int block_idx, int size, - int block_pitch_sh2, - const double *lsps, const double *prev_lsps, - const struct frame_type_desc *frame_desc, - float *excitation, float *synth) -{ - double i_lsps[MAX_LSPS]; - float lpcs[MAX_LSPS]; - float fac; - int n; - - if (frame_desc->acb_type == ACB_TYPE_NONE) - synth_block_hardcoded(s, gb, block_idx, size, frame_desc, excitation); - else - synth_block_fcb_acb(s, gb, block_idx, size, block_pitch_sh2, - frame_desc, excitation); - - /* convert interpolated LSPs to LPCs */ - fac = (block_idx + 0.5) / frame_desc->n_blocks; - for (n = 0; n < s->lsps; n++) // LSF -> LSP - i_lsps[n] = cos(prev_lsps[n] + fac * (lsps[n] - prev_lsps[n])); - ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1); - - /* Speech synthesis */ - ff_celp_lp_synthesis_filterf(synth, lpcs, excitation, size, s->lsps); -} - -/** - * Synthesize output samples for a single frame. - * @note we assume enough bits are available, caller should check. - * - * @param ctx WMA Voice decoder context - * @param gb bit I/O context (s->gb or one for cross-packet superframes) - * @param frame_idx Frame number within superframe [0-2] - * @param samples pointer to output sample buffer, has space for at least 160 - * samples - * @param lsps LSP array - * @param prev_lsps array of previous frame's LSPs - * @param excitation target buffer for excitation signal - * @param synth target buffer for synthesized speech data - * @return 0 on success, <0 on error. - */ -static int synth_frame(AVCodecContext *ctx, GetBitContext *gb, int frame_idx, - float *samples, - const double *lsps, const double *prev_lsps, - float *excitation, float *synth) -{ - WMAVoiceContext *s = ctx->priv_data; - int n, n_blocks_x2, log_n_blocks_x2, av_uninit(cur_pitch_val); - int pitch[MAX_BLOCKS], av_uninit(last_block_pitch); - - /* Parse frame type ("frame header"), see frame_descs */ - int bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)], block_nsamples; - - if (bd_idx < 0) { - av_log(ctx, AV_LOG_ERROR, - "Invalid frame type VLC code, skipping\n"); - return AVERROR_INVALIDDATA; - } - - block_nsamples = MAX_FRAMESIZE / frame_descs[bd_idx].n_blocks; - - /* Pitch calculation for ACB_TYPE_ASYMMETRIC ("pitch-per-frame") */ - if (frame_descs[bd_idx].acb_type == ACB_TYPE_ASYMMETRIC) { - /* Pitch is provided per frame, which is interpreted as the pitch of - * the last sample of the last block of this frame. We can interpolate - * the pitch of other blocks (and even pitch-per-sample) by gradually - * incrementing/decrementing prev_frame_pitch to cur_pitch_val. */ - n_blocks_x2 = frame_descs[bd_idx].n_blocks << 1; - log_n_blocks_x2 = frame_descs[bd_idx].log_n_blocks + 1; - cur_pitch_val = s->min_pitch_val + get_bits(gb, s->pitch_nbits); - cur_pitch_val = FFMIN(cur_pitch_val, s->max_pitch_val - 1); - if (s->last_acb_type == ACB_TYPE_NONE || - 20 * abs(cur_pitch_val - s->last_pitch_val) > - (cur_pitch_val + s->last_pitch_val)) - s->last_pitch_val = cur_pitch_val; - - /* pitch per block */ - for (n = 0; n < frame_descs[bd_idx].n_blocks; n++) { - int fac = n * 2 + 1; - - pitch[n] = (MUL16(fac, cur_pitch_val) + - MUL16((n_blocks_x2 - fac), s->last_pitch_val) + - frame_descs[bd_idx].n_blocks) >> log_n_blocks_x2; - } - - /* "pitch-diff-per-sample" for calculation of pitch per sample */ - s->pitch_diff_sh16 = - ((cur_pitch_val - s->last_pitch_val) << 16) / MAX_FRAMESIZE; - } - - /* Global gain (if silence) and pitch-adaptive window coordinates */ - switch (frame_descs[bd_idx].fcb_type) { - case FCB_TYPE_SILENCE: - s->silence_gain = wmavoice_gain_silence[get_bits(gb, 8)]; - break; - case FCB_TYPE_AW_PULSES: - aw_parse_coords(s, gb, pitch); - break; - } - - for (n = 0; n < frame_descs[bd_idx].n_blocks; n++) { - int bl_pitch_sh2; - - /* Pitch calculation for ACB_TYPE_HAMMING ("pitch-per-block") */ - switch (frame_descs[bd_idx].acb_type) { - case ACB_TYPE_HAMMING: { - /* Pitch is given per block. Per-block pitches are encoded as an - * absolute value for the first block, and then delta values - * relative to this value) for all subsequent blocks. The scale of - * this pitch value is semi-logaritmic compared to its use in the - * decoder, so we convert it to normal scale also. */ - int block_pitch, - t1 = (s->block_conv_table[1] - s->block_conv_table[0]) << 2, - t2 = (s->block_conv_table[2] - s->block_conv_table[1]) << 1, - t3 = s->block_conv_table[3] - s->block_conv_table[2] + 1; - - if (n == 0) { - block_pitch = get_bits(gb, s->block_pitch_nbits); - } else - block_pitch = last_block_pitch - s->block_delta_pitch_hrange + - get_bits(gb, s->block_delta_pitch_nbits); - /* Convert last_ so that any next delta is within _range */ - last_block_pitch = av_clip(block_pitch, - s->block_delta_pitch_hrange, - s->block_pitch_range - - s->block_delta_pitch_hrange); - - /* Convert semi-log-style scale back to normal scale */ - if (block_pitch < t1) { - bl_pitch_sh2 = (s->block_conv_table[0] << 2) + block_pitch; - } else { - block_pitch -= t1; - if (block_pitch < t2) { - bl_pitch_sh2 = - (s->block_conv_table[1] << 2) + (block_pitch << 1); - } else { - block_pitch -= t2; - if (block_pitch < t3) { - bl_pitch_sh2 = - (s->block_conv_table[2] + block_pitch) << 2; - } else - bl_pitch_sh2 = s->block_conv_table[3] << 2; - } - } - pitch[n] = bl_pitch_sh2 >> 2; - break; - } - - case ACB_TYPE_ASYMMETRIC: { - bl_pitch_sh2 = pitch[n] << 2; - break; - } - - default: // ACB_TYPE_NONE has no pitch - bl_pitch_sh2 = 0; - break; - } - - synth_block(s, gb, n, block_nsamples, bl_pitch_sh2, - lsps, prev_lsps, &frame_descs[bd_idx], - &excitation[n * block_nsamples], - &synth[n * block_nsamples]); - } - - /* Averaging projection filter, if applicable. Else, just copy samples - * from synthesis buffer */ - if (s->do_apf) { - double i_lsps[MAX_LSPS]; - float lpcs[MAX_LSPS]; - - for (n = 0; n < s->lsps; n++) // LSF -> LSP - i_lsps[n] = cos(0.5 * (prev_lsps[n] + lsps[n])); - ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1); - postfilter(s, synth, samples, 80, lpcs, - &s->zero_exc_pf[s->history_nsamples + MAX_FRAMESIZE * frame_idx], - frame_descs[bd_idx].fcb_type, pitch[0]); - - for (n = 0; n < s->lsps; n++) // LSF -> LSP - i_lsps[n] = cos(lsps[n]); - ff_acelp_lspd2lpc(i_lsps, lpcs, s->lsps >> 1); - postfilter(s, &synth[80], &samples[80], 80, lpcs, - &s->zero_exc_pf[s->history_nsamples + MAX_FRAMESIZE * frame_idx + 80], - frame_descs[bd_idx].fcb_type, pitch[0]); - } else - memcpy(samples, synth, 160 * sizeof(synth[0])); - - /* Cache values for next frame */ - s->frame_cntr++; - if (s->frame_cntr >= 0xFFFF) s->frame_cntr -= 0xFFFF; // i.e. modulo (%) - s->last_acb_type = frame_descs[bd_idx].acb_type; - switch (frame_descs[bd_idx].acb_type) { - case ACB_TYPE_NONE: - s->last_pitch_val = 0; - break; - case ACB_TYPE_ASYMMETRIC: - s->last_pitch_val = cur_pitch_val; - break; - case ACB_TYPE_HAMMING: - s->last_pitch_val = pitch[frame_descs[bd_idx].n_blocks - 1]; - break; - } - - return 0; -} - -/** - * Ensure minimum value for first item, maximum value for last value, - * proper spacing between each value and proper ordering. - * - * @param lsps array of LSPs - * @param num size of LSP array - * - * @note basically a double version of #ff_acelp_reorder_lsf(), might be - * useful to put in a generic location later on. Parts are also - * present in #ff_set_min_dist_lsf() + #ff_sort_nearly_sorted_floats(), - * which is in float. - */ -static void stabilize_lsps(double *lsps, int num) -{ - int n, m, l; - - /* set minimum value for first, maximum value for last and minimum - * spacing between LSF values. - * Very similar to ff_set_min_dist_lsf(), but in double. */ - lsps[0] = FFMAX(lsps[0], 0.0015 * M_PI); - for (n = 1; n < num; n++) - lsps[n] = FFMAX(lsps[n], lsps[n - 1] + 0.0125 * M_PI); - lsps[num - 1] = FFMIN(lsps[num - 1], 0.9985 * M_PI); - - /* reorder (looks like one-time / non-recursed bubblesort). - * Very similar to ff_sort_nearly_sorted_floats(), but in double. */ - for (n = 1; n < num; n++) { - if (lsps[n] < lsps[n - 1]) { - for (m = 1; m < num; m++) { - double tmp = lsps[m]; - for (l = m - 1; l >= 0; l--) { - if (lsps[l] <= tmp) break; - lsps[l + 1] = lsps[l]; - } - lsps[l + 1] = tmp; - } - break; - } - } -} - -/** - * Test if there's enough bits to read 1 superframe. - * - * @param orig_gb bit I/O context used for reading. This function - * does not modify the state of the bitreader; it - * only uses it to copy the current stream position - * @param s WMA Voice decoding context private data - * @return < 0 on error, 1 on not enough bits or 0 if OK. - */ -static int check_bits_for_superframe(GetBitContext *orig_gb, - WMAVoiceContext *s) -{ - GetBitContext s_gb, *gb = &s_gb; - int n, need_bits, bd_idx; - const struct frame_type_desc *frame_desc; - - /* initialize a copy */ - init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits); - skip_bits_long(gb, get_bits_count(orig_gb)); - av_assert1(get_bits_left(gb) == get_bits_left(orig_gb)); - - /* superframe header */ - if (get_bits_left(gb) < 14) - return 1; - if (!get_bits1(gb)) - return AVERROR(ENOSYS); // WMAPro-in-WMAVoice superframe - if (get_bits1(gb)) skip_bits(gb, 12); // number of samples in superframe - if (s->has_residual_lsps) { // residual LSPs (for all frames) - if (get_bits_left(gb) < s->sframe_lsp_bitsize) - return 1; - skip_bits_long(gb, s->sframe_lsp_bitsize); - } - - /* frames */ - for (n = 0; n < MAX_FRAMES; n++) { - int aw_idx_is_ext = 0; - - if (!s->has_residual_lsps) { // independent LSPs (per-frame) - if (get_bits_left(gb) < s->frame_lsp_bitsize) return 1; - skip_bits_long(gb, s->frame_lsp_bitsize); - } - bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)]; - if (bd_idx < 0) - return AVERROR_INVALIDDATA; // invalid frame type VLC code - frame_desc = &frame_descs[bd_idx]; - if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) { - if (get_bits_left(gb) < s->pitch_nbits) - return 1; - skip_bits_long(gb, s->pitch_nbits); - } - if (frame_desc->fcb_type == FCB_TYPE_SILENCE) { - skip_bits(gb, 8); - } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) { - int tmp = get_bits(gb, 6); - if (tmp >= 0x36) { - skip_bits(gb, 2); - aw_idx_is_ext = 1; - } - } - - /* blocks */ - if (frame_desc->acb_type == ACB_TYPE_HAMMING) { - need_bits = s->block_pitch_nbits + - (frame_desc->n_blocks - 1) * s->block_delta_pitch_nbits; - } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) { - need_bits = 2 * !aw_idx_is_ext; - } else - need_bits = 0; - need_bits += frame_desc->frame_size; - if (get_bits_left(gb) < need_bits) - return 1; - skip_bits_long(gb, need_bits); - } - - return 0; -} - -/** - * Synthesize output samples for a single superframe. If we have any data - * cached in s->sframe_cache, that will be used instead of whatever is loaded - * in s->gb. - * - * WMA Voice superframes contain 3 frames, each containing 160 audio samples, - * to give a total of 480 samples per frame. See #synth_frame() for frame - * parsing. In addition to 3 frames, superframes can also contain the LSPs - * (if these are globally specified for all frames (residually); they can - * also be specified individually per-frame. See the s->has_residual_lsps - * option), and can specify the number of samples encoded in this superframe - * (if less than 480), usually used to prevent blanks at track boundaries. - * - * @param ctx WMA Voice decoder context - * @return 0 on success, <0 on error or 1 if there was not enough data to - * fully parse the superframe - */ -static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, - int *got_frame_ptr) -{ - WMAVoiceContext *s = ctx->priv_data; - GetBitContext *gb = &s->gb, s_gb; - int n, res, n_samples = 480; - double lsps[MAX_FRAMES][MAX_LSPS]; - const double *mean_lsf = s->lsps == 16 ? - wmavoice_mean_lsf16[s->lsp_def_mode] : wmavoice_mean_lsf10[s->lsp_def_mode]; - float excitation[MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12]; - float synth[MAX_LSPS + MAX_SFRAMESIZE]; - float *samples; - - memcpy(synth, s->synth_history, - s->lsps * sizeof(*synth)); - memcpy(excitation, s->excitation_history, - s->history_nsamples * sizeof(*excitation)); - - if (s->sframe_cache_size > 0) { - gb = &s_gb; - init_get_bits(gb, s->sframe_cache, s->sframe_cache_size); - s->sframe_cache_size = 0; - } - - if ((res = check_bits_for_superframe(gb, s)) == 1) { - *got_frame_ptr = 0; - return 1; - } else if (res < 0) - return res; - - /* First bit is speech/music bit, it differentiates between WMAVoice - * speech samples (the actual codec) and WMAVoice music samples, which - * are really WMAPro-in-WMAVoice-superframes. I've never seen those in - * the wild yet. */ - if (!get_bits1(gb)) { - avpriv_request_sample(ctx, "WMAPro-in-WMAVoice"); - return AVERROR_PATCHWELCOME; - } - - /* (optional) nr. of samples in superframe; always <= 480 and >= 0 */ - if (get_bits1(gb)) { - if ((n_samples = get_bits(gb, 12)) > 480) { - av_log(ctx, AV_LOG_ERROR, - "Superframe encodes >480 samples (%d), not allowed\n", - n_samples); - return AVERROR_INVALIDDATA; - } - } - /* Parse LSPs, if global for the superframe (can also be per-frame). */ - if (s->has_residual_lsps) { - double prev_lsps[MAX_LSPS], a1[MAX_LSPS * 2], a2[MAX_LSPS * 2]; - - for (n = 0; n < s->lsps; n++) - prev_lsps[n] = s->prev_lsps[n] - mean_lsf[n]; - - if (s->lsps == 10) { - dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); - } else /* s->lsps == 16 */ - dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); - - for (n = 0; n < s->lsps; n++) { - lsps[0][n] = mean_lsf[n] + (a1[n] - a2[n * 2]); - lsps[1][n] = mean_lsf[n] + (a1[s->lsps + n] - a2[n * 2 + 1]); - lsps[2][n] += mean_lsf[n]; - } - for (n = 0; n < 3; n++) - stabilize_lsps(lsps[n], s->lsps); - } - - /* get output buffer */ - frame->nb_samples = 480; - if ((res = ff_get_buffer(ctx, frame, 0)) < 0) - return res; - frame->nb_samples = n_samples; - samples = (float *)frame->data[0]; - - /* Parse frames, optionally preceded by per-frame (independent) LSPs. */ - for (n = 0; n < 3; n++) { - if (!s->has_residual_lsps) { - int m; - - if (s->lsps == 10) { - dequant_lsp10i(gb, lsps[n]); - } else /* s->lsps == 16 */ - dequant_lsp16i(gb, lsps[n]); - - for (m = 0; m < s->lsps; m++) - lsps[n][m] += mean_lsf[m]; - stabilize_lsps(lsps[n], s->lsps); - } - - if ((res = synth_frame(ctx, gb, n, - &samples[n * MAX_FRAMESIZE], - lsps[n], n == 0 ? s->prev_lsps : lsps[n - 1], - &excitation[s->history_nsamples + n * MAX_FRAMESIZE], - &synth[s->lsps + n * MAX_FRAMESIZE]))) { - *got_frame_ptr = 0; - return res; - } - } - - /* Statistics? FIXME - we don't check for length, a slight overrun - * will be caught by internal buffer padding, and anything else - * will be skipped, not read. */ - if (get_bits1(gb)) { - res = get_bits(gb, 4); - skip_bits(gb, 10 * (res + 1)); - } - - *got_frame_ptr = 1; - - /* Update history */ - memcpy(s->prev_lsps, lsps[2], - s->lsps * sizeof(*s->prev_lsps)); - memcpy(s->synth_history, &synth[MAX_SFRAMESIZE], - s->lsps * sizeof(*synth)); - memcpy(s->excitation_history, &excitation[MAX_SFRAMESIZE], - s->history_nsamples * sizeof(*excitation)); - if (s->do_apf) - memmove(s->zero_exc_pf, &s->zero_exc_pf[MAX_SFRAMESIZE], - s->history_nsamples * sizeof(*s->zero_exc_pf)); - - return 0; -} - -/** - * Parse the packet header at the start of each packet (input data to this - * decoder). - * - * @param s WMA Voice decoding context private data - * @return 1 if not enough bits were available, or 0 on success. - */ -static int parse_packet_header(WMAVoiceContext *s) -{ - GetBitContext *gb = &s->gb; - unsigned int res; - - if (get_bits_left(gb) < 11) - return 1; - skip_bits(gb, 4); // packet sequence number - s->has_residual_lsps = get_bits1(gb); - do { - res = get_bits(gb, 6); // number of superframes per packet - // (minus first one if there is spillover) - if (get_bits_left(gb) < 6 * (res == 0x3F) + s->spillover_bitsize) - return 1; - } while (res == 0x3F); - s->spillover_nbits = get_bits(gb, s->spillover_bitsize); - - return 0; -} - -/** - * Copy (unaligned) bits from gb/data/size to pb. - * - * @param pb target buffer to copy bits into - * @param data source buffer to copy bits from - * @param size size of the source data, in bytes - * @param gb bit I/O context specifying the current position in the source. - * data. This function might use this to align the bit position to - * a whole-byte boundary before calling #avpriv_copy_bits() on aligned - * source data - * @param nbits the amount of bits to copy from source to target - * - * @note after calling this function, the current position in the input bit - * I/O context is undefined. - */ -static void copy_bits(PutBitContext *pb, - const uint8_t *data, int size, - GetBitContext *gb, int nbits) -{ - int rmn_bytes, rmn_bits; - - rmn_bits = rmn_bytes = get_bits_left(gb); - if (rmn_bits < nbits) - return; - if (nbits > pb->size_in_bits - put_bits_count(pb)) - return; - rmn_bits &= 7; rmn_bytes >>= 3; - if ((rmn_bits = FFMIN(rmn_bits, nbits)) > 0) - put_bits(pb, rmn_bits, get_bits(gb, rmn_bits)); - avpriv_copy_bits(pb, data + size - rmn_bytes, - FFMIN(nbits - rmn_bits, rmn_bytes << 3)); -} - -/** - * Packet decoding: a packet is anything that the (ASF) demuxer contains, - * and we expect that the demuxer / application provides it to us as such - * (else you'll probably get garbage as output). Every packet has a size of - * ctx->block_align bytes, starts with a packet header (see - * #parse_packet_header()), and then a series of superframes. Superframe - * boundaries may exceed packets, i.e. superframes can split data over - * multiple (two) packets. - * - * For more information about frames, see #synth_superframe(). - */ -static int wmavoice_decode_packet(AVCodecContext *ctx, void *data, - int *got_frame_ptr, AVPacket *avpkt) -{ - WMAVoiceContext *s = ctx->priv_data; - GetBitContext *gb = &s->gb; - int size, res, pos; - - /* Packets are sometimes a multiple of ctx->block_align, with a packet - * header at each ctx->block_align bytes. However, FFmpeg's ASF demuxer - * feeds us ASF packets, which may concatenate multiple "codec" packets - * in a single "muxer" packet, so we artificially emulate that by - * capping the packet size at ctx->block_align. */ - for (size = avpkt->size; size > ctx->block_align; size -= ctx->block_align); - if (!size) { - *got_frame_ptr = 0; - return 0; - } - init_get_bits(&s->gb, avpkt->data, size << 3); - - /* size == ctx->block_align is used to indicate whether we are dealing with - * a new packet or a packet of which we already read the packet header - * previously. */ - if (size == ctx->block_align) { // new packet header - if ((res = parse_packet_header(s)) < 0) - return res; - - /* If the packet header specifies a s->spillover_nbits, then we want - * to push out all data of the previous packet (+ spillover) before - * continuing to parse new superframes in the current packet. */ - if (s->spillover_nbits > 0) { - if (s->sframe_cache_size > 0) { - int cnt = get_bits_count(gb); - copy_bits(&s->pb, avpkt->data, size, gb, s->spillover_nbits); - flush_put_bits(&s->pb); - s->sframe_cache_size += s->spillover_nbits; - if ((res = synth_superframe(ctx, data, got_frame_ptr)) == 0 && - *got_frame_ptr) { - cnt += s->spillover_nbits; - s->skip_bits_next = cnt & 7; - return cnt >> 3; - } else - skip_bits_long (gb, s->spillover_nbits - cnt + - get_bits_count(gb)); // resync - } else - skip_bits_long(gb, s->spillover_nbits); // resync - } - } else if (s->skip_bits_next) - skip_bits(gb, s->skip_bits_next); - - /* Try parsing superframes in current packet */ - s->sframe_cache_size = 0; - s->skip_bits_next = 0; - pos = get_bits_left(gb); - if ((res = synth_superframe(ctx, data, got_frame_ptr)) < 0) { - return res; - } else if (*got_frame_ptr) { - int cnt = get_bits_count(gb); - s->skip_bits_next = cnt & 7; - return cnt >> 3; - } else if ((s->sframe_cache_size = pos) > 0) { - /* rewind bit reader to start of last (incomplete) superframe... */ - init_get_bits(gb, avpkt->data, size << 3); - skip_bits_long(gb, (size << 3) - pos); - av_assert1(get_bits_left(gb) == pos); - - /* ...and cache it for spillover in next packet */ - init_put_bits(&s->pb, s->sframe_cache, SFRAME_CACHE_MAXSIZE); - copy_bits(&s->pb, avpkt->data, size, gb, s->sframe_cache_size); - // FIXME bad - just copy bytes as whole and add use the - // skip_bits_next field - } - - return size; -} - -static av_cold int wmavoice_decode_end(AVCodecContext *ctx) -{ - WMAVoiceContext *s = ctx->priv_data; - - if (s->do_apf) { - ff_rdft_end(&s->rdft); - ff_rdft_end(&s->irdft); - ff_dct_end(&s->dct); - ff_dct_end(&s->dst); - } - - return 0; -} - -static av_cold void wmavoice_flush(AVCodecContext *ctx) -{ - WMAVoiceContext *s = ctx->priv_data; - int n; - - s->postfilter_agc = 0; - s->sframe_cache_size = 0; - s->skip_bits_next = 0; - for (n = 0; n < s->lsps; n++) - s->prev_lsps[n] = M_PI * (n + 1.0) / (s->lsps + 1.0); - memset(s->excitation_history, 0, - sizeof(*s->excitation_history) * MAX_SIGNAL_HISTORY); - memset(s->synth_history, 0, - sizeof(*s->synth_history) * MAX_LSPS); - memset(s->gain_pred_err, 0, - sizeof(s->gain_pred_err)); - - if (s->do_apf) { - memset(&s->synth_filter_out_buf[MAX_LSPS_ALIGN16 - s->lsps], 0, - sizeof(*s->synth_filter_out_buf) * s->lsps); - memset(s->dcf_mem, 0, - sizeof(*s->dcf_mem) * 2); - memset(s->zero_exc_pf, 0, - sizeof(*s->zero_exc_pf) * s->history_nsamples); - memset(s->denoise_filter_cache, 0, sizeof(s->denoise_filter_cache)); - } -} - -AVCodec ff_wmavoice_decoder = { - .name = "wmavoice", - .long_name = NULL_IF_CONFIG_SMALL("Windows Media Audio Voice"), - .type = AVMEDIA_TYPE_AUDIO, - .id = AV_CODEC_ID_WMAVOICE, - .priv_data_size = sizeof(WMAVoiceContext), - .init = wmavoice_decode_init, - .init_static_data = wmavoice_init_static_data, - .close = wmavoice_decode_end, - .decode = wmavoice_decode_packet, - .capabilities = CODEC_CAP_SUBFRAMES | CODEC_CAP_DR1, - .flush = wmavoice_flush, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice_data.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice_data.h deleted file mode 100644 index cbf65b043..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/wmavoice_data.h +++ /dev/null @@ -1,3259 +0,0 @@ -/* - * Windows Media Voice (WMAVoice) tables. - * Copyright (c) 2009 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * @brief Windows Media Voice (WMAVoice) tables - * @author Ronald S. Bultje - */ - -#ifndef AVCODEC_WMAVOICE_DATA_H -#define AVCODEC_WMAVOICE_DATA_H - -#include - -static const uint8_t wmavoice_dq_lsp10i[0xf00] = { - 125, 109, 84, 55, 34, 51, 109, 112, 118, 132, - 122, 102, 78, 80, 132, 119, 132, 132, 125, 131, - 109, 91, 131, 131, 136, 136, 137, 137, 140, 145, - 140, 143, 117, 136, 122, 106, 109, 91, 115, 119, - 133, 117, 103, 80, 55, 117, 123, 102, 93, 80, - 139, 116, 70, 39, 95, 89, 103, 113, 112, 122, - 135, 244, 229, 215, 199, 181, 163, 150, 146, 144, - 143, 173, 171, 154, 155, 154, 151, 148, 145, 143, - 132, 138, 116, 85, 117, 94, 108, 117, 107, 116, - 132, 118, 123, 119, 88, 67, 49, 95, 84, 95, - 121, 103, 74, 70, 179, 164, 141, 126, 107, 112, - 119, 95, 103, 149, 139, 148, 144, 147, 148, 141, - 151, 133, 142, 129, 111, 131, 108, 128, 122, 108, - 121, 96, 115, 138, 116, 93, 105, 115, 115, 123, - 129, 106, 136, 180, 147, 130, 108, 141, 131, 118, - 136, 155, 176, 156, 135, 129, 140, 146, 142, 134, - 141, 130, 109, 80, 52, 38, 18, 47, 118, 134, - 155, 141, 100, 78, 72, 89, 79, 96, 92, 98, - 133, 111, 83, 91, 72, 58, 105, 115, 112, 120, - 145, 127, 135, 113, 113, 105, 105, 85, 69, 61, - 115, 96, 116, 145, 159, 170, 175, 175, 168, 155, - 140, 120, 84, 52, 80, 145, 125, 127, 116, 126, - 128, 108, 101, 198, 227, 200, 178, 159, 147, 148, - 121, 88, 46, 109, 124, 126, 126, 137, 147, 147, - 129, 107, 164, 148, 127, 117, 134, 120, 111, 116, - 120, 103, 98, 73, 66, 61, 70, 115, 116, 125, - 126, 100, 77, 188, 162, 140, 114, 128, 139, 123, - 145, 165, 164, 134, 109, 100, 108, 118, 127, 130, - 156, 182, 190, 173, 167, 165, 162, 157, 152, 147, - 150, 164, 179, 183, 173, 155, 140, 136, 134, 135, - 122, 92, 69, 140, 132, 118, 108, 128, 138, 132, - 123, 127, 148, 137, 150, 149, 139, 127, 124, 130, - 136, 138, 112, 70, 41, 37, 132, 140, 129, 125, - 130, 111, 78, 33, 51, 161, 141, 136, 120, 122, - 126, 110, 87, 106, 85, 68, 48, 81, 112, 113, - 135, 125, 98, 85, 102, 80, 100, 87, 86, 116, - 142, 133, 110, 66, 48, 152, 139, 135, 136, 123, - 128, 116, 89, 102, 128, 99, 83, 61, 105, 124, - 120, 94, 73, 83, 78, 100, 122, 124, 128, 132, - 144, 137, 116, 102, 75, 144, 136, 127, 140, 127, - 154, 144, 118, 99, 90, 90, 89, 75, 68, 83, - 123, 103, 89, 198, 180, 154, 138, 122, 136, 120, - 138, 118, 121, 136, 110, 105, 85, 111, 101, 104, - 121, 126, 139, 115, 99, 101, 107, 110, 123, 126, - 127, 115, 88, 109, 164, 134, 138, 138, 120, 121, - 130, 202, 195, 202, 199, 201, 181, 164, 159, 148, - 120, 116, 194, 199, 186, 171, 154, 142, 137, 133, - 137, 129, 112, 149, 134, 112, 149, 138, 120, 134, - 119, 102, 107, 83, 79, 114, 119, 127, 128, 128, - 144, 148, 165, 155, 161, 150, 135, 122, 116, 115, - 120, 99, 80, 120, 123, 124, 111, 89, 70, 108, - 118, 95, 66, 53, 105, 126, 125, 105, 83, 111, - 129, 197, 191, 197, 206, 213, 216, 208, 196, 169, - 133, 109, 127, 164, 134, 121, 99, 92, 82, 71, - 131, 121, 93, 91, 136, 105, 115, 140, 120, 110, - 150, 164, 139, 108, 87, 81, 93, 92, 104, 116, - 133, 114, 125, 126, 111, 136, 110, 156, 147, 133, - 113, 94, 118, 120, 115, 125, 124, 126, 127, 134, - 116, 131, 161, 158, 166, 157, 150, 150, 144, 141, - 125, 185, 169, 142, 140, 143, 139, 131, 134, 138, - 179, 188, 170, 150, 134, 140, 144, 133, 127, 127, - 150, 177, 204, 184, 192, 194, 190, 193, 177, 158, - 114, 113, 138, 116, 137, 135, 132, 131, 127, 134, - 120, 147, 163, 135, 133, 137, 136, 136, 133, 135, - 137, 120, 95, 73, 46, 48, 111, 97, 97, 123, - 139, 130, 109, 76, 52, 72, 61, 61, 125, 127, - 132, 119, 119, 90, 66, 41, 64, 156, 143, 129, - 131, 106, 58, 25, 99, 115, 122, 136, 129, 132, - 134, 123, 97, 53, 27, 114, 125, 114, 120, 123, - 122, 107, 93, 57, 47, 133, 128, 138, 141, 131, - 145, 132, 122, 110, 79, 57, 30, 73, 153, 144, - 150, 132, 85, 59, 133, 125, 130, 115, 100, 96, - 148, 127, 111, 86, 61, 38, 110, 121, 108, 99, - 157, 143, 105, 77, 116, 118, 115, 131, 122, 122, - 133, 119, 134, 108, 86, 61, 129, 165, 143, 127, - 125, 105, 89, 111, 97, 85, 113, 99, 98, 117, - 149, 131, 101, 106, 88, 95, 79, 119, 123, 120, - 125, 109, 81, 100, 201, 183, 156, 138, 115, 116, - 141, 119, 129, 105, 76, 60, 110, 99, 92, 82, - 150, 156, 129, 95, 69, 115, 115, 113, 134, 125, - 118, 97, 67, 96, 203, 197, 171, 151, 133, 125, - 143, 131, 120, 134, 105, 80, 51, 60, 139, 134, - 129, 160, 223, 219, 219, 212, 197, 173, 157, 146, - 132, 112, 164, 144, 119, 102, 92, 76, 73, 94, - 132, 112, 124, 114, 93, 92, 83, 73, 69, 99, - 129, 103, 188, 163, 142, 132, 127, 101, 82, 59, - 140, 141, 111, 74, 46, 105, 113, 99, 127, 122, - 125, 94, 63, 112, 116, 101, 81, 120, 136, 134, - 133, 190, 224, 193, 179, 158, 146, 143, 140, 136, - 152, 161, 132, 120, 112, 94, 114, 102, 92, 116, - 129, 194, 196, 202, 211, 212, 210, 190, 169, 152, - 166, 166, 145, 111, 91, 132, 133, 128, 136, 130, - 118, 94, 72, 74, 92, 86, 89, 92, 106, 123, - 126, 100, 86, 137, 117, 92, 76, 104, 106, 114, - 133, 109, 204, 192, 166, 148, 138, 128, 111, 81, - 118, 99, 79, 146, 169, 141, 123, 102, 131, 120, - 127, 105, 136, 204, 170, 154, 131, 145, 135, 119, - 117, 95, 64, 83, 141, 136, 118, 96, 99, 126, - 115, 93, 98, 102, 95, 105, 106, 114, 119, 128, - 131, 121, 98, 139, 149, 119, 109, 86, 105, 129, - 134, 119, 104, 169, 185, 155, 141, 122, 107, 127, - 136, 115, 85, 108, 87, 126, 102, 128, 136, 129, - 125, 99, 126, 158, 133, 139, 132, 113, 91, 107, - 141, 122, 128, 161, 130, 127, 105, 120, 118, 106, - 122, 140, 161, 168, 187, 184, 176, 158, 144, 140, - 127, 111, 89, 130, 132, 105, 134, 121, 100, 122, - 129, 110, 128, 115, 129, 116, 132, 118, 114, 119, - 138, 133, 132, 188, 183, 159, 161, 147, 134, 140, - 132, 113, 84, 167, 147, 132, 124, 109, 133, 121, - 132, 128, 116, 121, 98, 101, 145, 129, 128, 129, - 124, 112, 152, 158, 136, 161, 139, 165, 158, 142, - 139, 138, 110, 127, 148, 117, 126, 118, 101, 116, - 155, 168, 154, 128, 120, 152, 150, 141, 140, 135, - 127, 111, 109, 134, 104, 133, 110, 112, 132, 114, - 111, 87, 68, 89, 107, 121, 121, 126, 126, 129, - 120, 148, 169, 163, 173, 178, 185, 188, 178, 163, - 122, 97, 86, 117, 101, 138, 118, 142, 155, 139, - 125, 114, 131, 138, 153, 149, 163, 150, 143, 141, - 157, 161, 138, 152, 134, 121, 122, 109, 110, 124, - 151, 171, 196, 168, 145, 139, 147, 151, 146, 139, - 134, 169, 179, 170, 175, 178, 177, 173, 165, 154, - 120, 151, 118, 107, 125, 129, 133, 133, 136, 139, - 119, 141, 159, 151, 160, 165, 168, 169, 162, 152, - 115, 111, 119, 94, 117, 121, 127, 127, 132, 136, - 134, 153, 147, 142, 142, 147, 159, 159, 154, 147, - 110, 106, 139, 135, 143, 142, 147, 146, 147, 147, - 115, 133, 151, 133, 141, 142, 151, 152, 147, 144, - 115, 132, 144, 131, 125, 126, 128, 130, 131, 136, - 138, 118, 96, 71, 48, 26, 43, 130, 125, 125, - 134, 122, 98, 54, 28, 84, 77, 73, 109, 125, - 133, 112, 67, 48, 141, 129, 126, 113, 112, 118, - 143, 123, 89, 54, 71, 73, 75, 131, 123, 123, - 126, 109, 81, 31, 15, 94, 110, 109, 119, 128, - 132, 122, 97, 92, 73, 50, 27, 22, 104, 133, - 133, 119, 94, 48, 34, 168, 160, 154, 151, 130, - 147, 133, 90, 54, 71, 123, 106, 105, 93, 117, - 143, 132, 107, 69, 45, 78, 178, 169, 150, 139, - 138, 123, 116, 96, 69, 49, 32, 113, 103, 112, - 154, 151, 125, 79, 60, 152, 160, 154, 155, 137, - 142, 151, 124, 88, 66, 59, 94, 87, 95, 119, - 166, 154, 122, 92, 138, 132, 124, 114, 97, 97, - 122, 99, 98, 219, 191, 176, 165, 159, 153, 131, - 130, 119, 91, 51, 24, 41, 144, 156, 147, 139, - 139, 122, 81, 65, 124, 111, 104, 90, 94, 98, - 138, 120, 112, 91, 63, 65, 89, 75, 78, 106, - 126, 107, 91, 85, 69, 95, 90, 84, 108, 120, - 155, 139, 100, 78, 120, 110, 109, 91, 77, 73, - 144, 130, 135, 112, 88, 65, 62, 142, 129, 126, - 170, 154, 150, 131, 121, 116, 100, 92, 83, 86, - 131, 122, 98, 107, 102, 75, 54, 38, 117, 130, - 146, 139, 117, 107, 86, 66, 44, 30, 97, 128, - 129, 116, 100, 59, 108, 127, 119, 139, 129, 129, - 124, 106, 79, 49, 154, 190, 166, 152, 133, 123, - 141, 149, 123, 89, 61, 70, 143, 132, 125, 126, - 136, 113, 177, 166, 141, 123, 109, 108, 105, 93, - 137, 117, 147, 123, 99, 85, 109, 98, 91, 75, - 129, 121, 102, 78, 53, 90, 149, 136, 134, 135, - 144, 136, 126, 90, 114, 152, 137, 152, 138, 128, - 133, 115, 107, 129, 99, 78, 60, 129, 125, 118, - 147, 141, 119, 124, 110, 91, 79, 64, 106, 117, - 134, 111, 164, 143, 123, 113, 116, 95, 76, 56, - 147, 159, 140, 109, 83, 84, 140, 135, 127, 129, - 123, 104, 116, 99, 91, 87, 80, 110, 113, 121, - 124, 106, 174, 174, 152, 141, 132, 134, 126, 124, - 140, 190, 240, 215, 212, 189, 173, 158, 144, 137, - 123, 97, 79, 102, 110, 111, 90, 75, 126, 124, - 134, 121, 104, 145, 127, 100, 77, 65, 120, 118, - 123, 106, 87, 41, 68, 119, 106, 115, 109, 119, - 137, 232, 241, 225, 217, 202, 183, 169, 156, 145, - 161, 146, 127, 110, 97, 107, 88, 114, 108, 106, - 141, 244, 216, 192, 172, 163, 148, 143, 144, 144, - 128, 127, 109, 89, 77, 68, 124, 120, 121, 125, - 125, 94, 48, 71, 116, 113, 104, 120, 142, 137, - 133, 129, 115, 82, 68, 120, 99, 133, 134, 124, - 130, 106, 108, 160, 130, 111, 89, 129, 124, 119, - 134, 120, 149, 143, 116, 95, 87, 142, 132, 122, - 126, 114, 108, 107, 80, 141, 133, 123, 137, 124, - 117, 95, 69, 43, 62, 98, 114, 116, 112, 120, - 122, 99, 87, 164, 145, 123, 99, 95, 118, 105, - 126, 101, 102, 120, 113, 110, 92, 139, 134, 126, - 148, 194, 241, 219, 221, 215, 200, 193, 174, 151, - 127, 104, 122, 136, 113, 106, 110, 95, 78, 106, - 131, 163, 217, 199, 194, 175, 164, 155, 142, 138, - 139, 124, 88, 57, 161, 161, 145, 139, 124, 116, - 127, 110, 91, 98, 126, 104, 113, 98, 94, 94, - 145, 138, 114, 90, 75, 130, 117, 107, 99, 90, - 119, 98, 86, 101, 148, 133, 103, 83, 124, 131, - 143, 168, 169, 133, 110, 117, 139, 149, 147, 137, - 124, 106, 80, 138, 194, 163, 142, 119, 106, 130, - 136, 125, 105, 114, 87, 113, 101, 89, 108, 102, - 114, 90, 53, 46, 105, 116, 126, 122, 118, 122, - 124, 102, 92, 195, 167, 160, 144, 154, 154, 132, - 118, 97, 88, 72, 98, 120, 112, 98, 79, 117, - 114, 107, 185, 191, 191, 188, 175, 165, 153, 143, - 119, 97, 90, 89, 120, 151, 136, 113, 99, 112, - 141, 121, 144, 122, 125, 113, 133, 111, 92, 69, - 120, 98, 78, 109, 151, 145, 157, 157, 151, 143, - 130, 110, 120, 188, 159, 141, 119, 112, 109, 98, - 126, 112, 83, 110, 169, 139, 127, 105, 93, 123, - 141, 145, 117, 106, 91, 78, 123, 107, 101, 125, - 117, 95, 71, 147, 176, 153, 148, 133, 135, 127, - 124, 106, 79, 64, 115, 96, 108, 115, 106, 105, - 127, 115, 90, 98, 105, 81, 144, 135, 117, 125, - 126, 104, 98, 165, 138, 136, 112, 149, 148, 131, - 119, 144, 186, 185, 204, 202, 209, 200, 182, 161, - 123, 153, 190, 189, 199, 194, 191, 176, 157, 147, - 121, 103, 119, 98, 100, 120, 106, 97, 95, 126, - 137, 130, 102, 117, 117, 92, 126, 114, 101, 118, - 131, 219, 190, 167, 153, 151, 144, 140, 142, 143, - 114, 102, 151, 152, 132, 120, 112, 120, 127, 131, - 138, 122, 91, 143, 118, 120, 114, 104, 124, 117, - 148, 142, 117, 126, 97, 125, 108, 116, 142, 125, - 126, 106, 91, 169, 208, 178, 158, 138, 127, 135, - 133, 126, 101, 83, 147, 130, 125, 117, 114, 117, - 120, 103, 94, 149, 136, 129, 139, 118, 133, 133, - 147, 152, 126, 132, 119, 97, 132, 129, 114, 126, - 112, 107, 148, 125, 112, 114, 124, 125, 129, 135, - 139, 121, 157, 151, 131, 140, 118, 147, 136, 121, - 115, 105, 159, 167, 185, 191, 196, 190, 176, 160, - 124, 106, 104, 122, 130, 114, 152, 144, 134, 136, - 136, 152, 159, 153, 131, 114, 116, 126, 129, 129, - 124, 109, 87, 131, 107, 115, 130, 107, 144, 131, - 126, 162, 176, 175, 180, 176, 160, 141, 134, 134, - 136, 127, 108, 161, 162, 133, 141, 124, 112, 128, - 130, 115, 110, 140, 107, 155, 134, 131, 156, 137, - 122, 106, 116, 127, 118, 161, 150, 170, 167, 152, - 139, 177, 203, 176, 155, 139, 130, 128, 129, 132, - 137, 119, 125, 103, 110, 123, 107, 120, 108, 101, - 113, 107, 160, 154, 160, 166, 169, 176, 168, 156, - 115, 90, 65, 115, 115, 104, 120, 112, 109, 124, - 131, 123, 100, 109, 185, 158, 141, 132, 116, 119, - 139, 130, 119, 156, 124, 138, 127, 116, 141, 128, - 133, 118, 115, 180, 149, 151, 135, 130, 147, 129, - 117, 90, 80, 119, 124, 128, 132, 130, 128, 135, - 112, 97, 142, 161, 167, 165, 154, 142, 136, 135, - 118, 141, 193, 172, 157, 152, 148, 145, 146, 141, - 125, 147, 165, 166, 149, 133, 123, 122, 128, 131, - 128, 193, 177, 174, 182, 186, 197, 193, 191, 173, - 124, 144, 162, 133, 113, 113, 123, 128, 129, 130, - 117, 98, 121, 122, 137, 132, 110, 97, 111, 130, - 128, 176, 151, 125, 126, 134, 130, 121, 127, 130, - 122, 151, 142, 111, 106, 121, 126, 126, 130, 134, - 148, 167, 186, 153, 129, 122, 124, 128, 130, 128, - 148, 172, 206, 178, 171, 182, 169, 180, 172, 156, - 133, 164, 174, 160, 155, 163, 163, 172, 169, 158, - 132, 150, 147, 142, 152, 140, 140, 140, 134, 135, - 137, 158, 167, 172, 163, 153, 169, 158, 146, 147, - 150, 161, 162, 172, 153, 133, 140, 144, 136, 135, - 109, 84, 101, 120, 129, 134, 133, 136, 137, 143, - 112, 114, 157, 147, 141, 136, 135, 133, 135, 138, - 121, 154, 161, 150, 149, 154, 151, 144, 146, 144, - 111, 117, 125, 125, 130, 131, 135, 137, 143, 148, - 121, 141, 146, 131, 138, 126, 118, 111, 119, 130, - 120, 135, 145, 121, 140, 134, 138, 137, 131, 134, - 115, 137, 132, 137, 139, 138, 138, 139, 145, 149, - 131, 149, 147, 133, 132, 126, 131, 134, 130, 133, - 110, 98, 84, 141, 107, 169, 169, 123, 125, 126, - 118, 210, 98, 126, 132, 138, 128, 139, 156, 157, - 140, 142, 129, 95, 192, 178, 182, 186, 183, 159, - 135, 134, 144, 124, 100, 228, 203, 161, 122, 104, - 139, 159, 134, 161, 121, 126, 192, 152, 218, 180, - 132, 132, 119, 99, 96, 97, 80, 53, 134, 143, - 102, 114, 133, 114, 127, 83, 77, 126, 85, 107, - 110, 114, 194, 186, 139, 116, 147, 104, 129, 138, - 126, 133, 109, 144, 115, 45, 130, 97, 159, 155, - 157, 162, 189, 185, 168, 163, 151, 151, 142, 135, - 144, 147, 120, 74, 192, 186, 149, 118, 71, 84, - 143, 156, 133, 178, 168, 107, 119, 149, 105, 112, - 182, 184, 158, 118, 118, 148, 128, 177, 171, 152, - 139, 135, 126, 209, 171, 150, 123, 100, 190, 158, - 166, 97, 136, 123, 136, 139, 128, 138, 126, 121, - 132, 131, 128, 95, 60, 168, 127, 140, 208, 161, - 109, 102, 119, 162, 150, 137, 107, 200, 156, 136, - 136, 128, 103, 95, 74, 91, 220, 173, 152, 138, - 139, 129, 140, 136, 122, 82, 180, 115, 53, 90, - 121, 107, 99, 148, 116, 139, 100, 63, 191, 155, - 130, 129, 163, 155, 98, 175, 95, 151, 127, 107, - 124, 124, 116, 88, 71, 164, 148, 96, 57, 89, - 125, 117, 77, 63, 162, 144, 113, 109, 137, 134, - 134, 130, 149, 174, 158, 158, 130, 81, 28, 67, - 142, 139, 129, 100, 194, 134, 68, 175, 131, 103, - 136, 132, 122, 96, 119, 82, 115, 249, 215, 168, - 125, 139, 199, 96, 146, 123, 136, 179, 142, 137, - 181, 166, 106, 86, 122, 106, 123, 131, 106, 119, - 129, 189, 188, 147, 126, 110, 101, 114, 147, 136, - 132, 106, 72, 175, 148, 99, 130, 153, 125, 136, - 123, 119, 147, 170, 157, 126, 209, 188, 158, 152, - 101, 89, 142, 131, 161, 150, 148, 124, 89, 119, - 141, 137, 131, 103, 81, 85, 64, 175, 129, 121, - 137, 144, 142, 145, 119, 205, 148, 80, 165, 138, - 143, 137, 167, 165, 148, 149, 110, 234, 217, 170, - 167, 152, 75, 140, 155, 155, 175, 129, 136, 134, - 136, 152, 161, 131, 140, 121, 91, 79, 255, 209, - 132, 147, 120, 114, 177, 128, 110, 61, 89, 131, - 125, 127, 93, 87, 167, 115, 186, 162, 107, 106, - 134, 162, 151, 100, 79, 67, 151, 116, 130, 142, - 162, 153, 155, 143, 122, 85, 202, 187, 135, 125, - 158, 155, 103, 129, 74, 149, 130, 98, 129, 126, - 148, 152, 153, 133, 118, 94, 80, 70, 47, 90, - 124, 118, 143, 184, 158, 126, 70, 82, 111, 113, - 126, 135, 175, 141, 203, 166, 123, 123, 134, 133, - 113, 111, 128, 76, 128, 177, 151, 178, 134, 125, - 120, 120, 193, 106, 98, 134, 101, 86, 101, 114, - 136, 127, 134, 196, 86, 105, 145, 128, 119, 137, - 138, 126, 230, 161, 141, 128, 129, 136, 88, 83, - 103, 118, 178, 123, 89, 101, 161, 173, 165, 147, - 130, 123, 171, 158, 131, 81, 50, 177, 162, 136, - 125, 115, 82, 173, 195, 168, 130, 112, 112, 121, - 152, 148, 167, 87, 82, 161, 142, 147, 98, 89, - 168, 138, 97, 157, 132, 114, 74, 126, 161, 141, - 135, 123, 68, 137, 124, 118, 112, 92, 65, 96, - 191, 181, 161, 151, 141, 145, 129, 102, 97, 111, - 144, 128, 55, 128, 115, 155, 129, 184, 167, 147, - 131, 141, 125, 33, 127, 111, 127, 131, 125, 130, - 137, 130, 121, 195, 172, 177, 176, 149, 98, 97, - 126, 106, 168, 159, 144, 185, 156, 151, 182, 158, - 123, 93, 110, 116, 98, 99, 125, 136, 139, 148, - 79, 112, 149, 128, 147, 136, 118, 105, 166, 152, - 117, 115, 92, 128, 148, 132, 170, 143, 226, 190, - 122, 192, 165, 121, 143, 144, 174, 124, 113, 124, - 122, 135, 34, 93, 118, 111, 111, 136, 123, 116, - 99, 195, 139, 99, 114, 102, 96, 108, 111, 112, - 113, 129, 172, 137, 105, 139, 154, 86, 113, 108, - 132, 79, 63, 120, 93, 162, 90, 103, 94, 95, - 117, 127, 104, 100, 142, 129, 93, 27, 196, 153, - 113, 91, 101, 90, 84, 68, 138, 38, 118, 148, - 87, 103, 125, 109, 96, 152, 100, 56, 31, 62, - 176, 129, 124, 115, 103, 92, 100, 121, 130, 125, - 128, 71, 82, 71, 152, 85, 107, 116, 138, 133, - 103, 116, 139, 144, 72, 37, 118, 141, 109, 95, - 86, 92, 121, 167, 156, 104, 92, 91, 122, 114, - 89, 61, 172, 128, 95, 103, 84, 101, 88, 84, - 116, 125, 108, 62, 74, 108, 160, 143, 189, 164, - 91, 115, 144, 43, 116, 79, 106, 108, 74, 83, - 87, 90, 61, 71, 76, 76, 95, 130, 89, 94, - 114, 107, 101, 145, 161, 147, 143, 163, 147, 129, - 101, 73, 111, 108, 93, 104, 186, 141, 99, 89, - 112, 126, 111, 113, 152, 41, 159, 115, 131, 124, - 117, 101, 115, 130, 124, 87, 59, 177, 63, 85, - 109, 116, 103, 68, 145, 132, 29, 119, 96, 89, - 117, 90, 181, 103, 101, 111, 97, 96, 199, 171, - 113, 120, 93, 119, 101, 64, 56, 55, 63, 90, - 105, 101, 86, 45, 136, 179, 142, 102, 115, 114, - 113, 108, 121, 84, 23, 125, 76, 102, 119, 107, - 120, 104, 73, 177, 83, 114, 128, 85, 152, 126, - 137, 115, 149, 109, 163, 133, 110, 98, 54, 61, - 95, 111, 135, 103, 88, 164, 115, 187, 122, 98, - 129, 132, 95, 86, 71, 119, 146, 111, 38, 67, - 102, 100, 66, 148, 137, 103, 145, 95, 35, 85, - 44, 136, 102, 111, 108, 115, 136, 105, 120, 110, - 108, 147, 112, 169, 116, 146, 81, 120, 94, 84, - 93, 97, 90, 119, 102, 91, 48, 147, 204, 151, - 148, 160, 144, 131, 144, 175, 158, 133, 212, 163, - 172, 152, 151, 112, 148, 151, 145, 179, 160, 124, - 164, 164, 167, 161, 141, 120, 131, 141, 198, 177, - 169, 156, 146, 156, 124, 185, 164, 195, 181, 193, - 201, 147, 148, 168, 165, 159, 162, 148, 150, 148, - 146, 157, 158, 149, 164, 129, 160, 214, 174, 166, - 154, 176, 146, 141, 155, 140, 140, 169, 106, 155, - 166, 162, 134, 193, 157, 155, 146, 196, 171, 107, - 177, 174, 163, 155, 147, 203, 162, 146, 150, 83, - 157, 170, 180, 178, 159, 157, 151, 117, 115, 183, - 170, 180, 174, 150, 177, 173, 136, 181, 196, 184, - 164, 168, 165, 148, 175, 168, 209, 189, 159, 114, - 157, 158, 141, 168, 170, 139, 175, 128, 151, 39, - 128, 154, 159, 161, 148, 180, 131, 165, 159, 131, - 163, 150, 174, 178, 178, 198, 172, 138, 184, 191, - 143, 164, 161, 163, 210, 171, 155, 168, 150, 116, - 182, 170, 145, 152, 141, 139, 191, 149, 160, 202, - 145, 169, 145, 181, 148, 183, 197, 165, 146, 171, - 161, 153, 157, 170, 164, 149, 183, 167, 246, 235, - 162, 144, 170, 152, 173, 150, 113, 135, 156, 154, - 158, 148, 178, 159, 161, 114, 180, 156, 116, 163, - 164, 161, 122, 164, 164, 183, 135, 135, 144, 182, - 160, 147, 163, 152, 169, 185, 159, 177, 99, 211, - 168, 167, 215, 170, 150, 157, 154, 176, 154, 143, - 163, 117, 178, 160, 163, 165, 164, 166, 174, 136, - 159, 169, 152, 123, 199, 149, 169, 140, 159, 208, - 155, 161, 186, 122, 134, 167, 171, 145, 148, 176, - 148, 137, 114, 160, 166, 153, 162, 156, 164, 172, - 155, 148, 155, 182, 114, 150, 157, 154, 140, 159, - 166, 160, 169, 206, 182, 145, 157, 165, 147, 202, - 131, 154, 193, 162, 162, 149, 167, 157, 191, 188, - 149, 205, 147, 166, 150, 150, 159, 153, 171, 160 -}; - -static const uint8_t wmavoice_dq_lsp16i1[0x640] = { - 142, 121, 141, 112, 99, 119, 92, 122, 183, 155, - 122, 98, 75, 78, 85, 101, 108, 134, 128, 123, - 115, 90, 79, 58, 73, 127, 106, 60, 97, 107, - 141, 163, 130, 123, 136, 156, 201, 189, 204, 206, - 140, 116, 69, 60, 117, 123, 106, 124, 91, 63, - 150, 144, 110, 80, 63, 112, 80, 70, 76, 63, - 114, 86, 147, 165, 137, 125, 120, 140, 115, 101, - 101, 99, 166, 158, 158, 104, 126, 131, 134, 143, - 121, 102, 73, 36, 83, 132, 113, 76, 38, 20, - 132, 111, 78, 73, 51, 131, 108, 131, 105, 80, - 148, 138, 101, 65, 47, 115, 86, 50, 124, 129, - 116, 89, 85, 87, 64, 111, 74, 39, 115, 113, - 112, 83, 75, 122, 127, 114, 91, 106, 125, 130, - 131, 108, 79, 136, 112, 110, 147, 164, 144, 124, - 121, 236, 218, 190, 168, 106, 101, 160, 172, 191, - 113, 138, 102, 91, 109, 100, 71, 85, 112, 119, - 121, 96, 51, 64, 126, 135, 114, 76, 34, 104, - 145, 127, 90, 56, 131, 142, 131, 92, 123, 102, - 128, 105, 63, 24, 95, 115, 87, 49, 156, 174, - 123, 105, 88, 58, 55, 141, 119, 99, 75, 81, - 137, 117, 114, 80, 56, 119, 91, 106, 166, 135, - 114, 84, 38, 93, 116, 129, 103, 97, 87, 97, - 115, 184, 193, 173, 157, 117, 88, 114, 151, 121, - 126, 111, 75, 129, 133, 130, 107, 71, 115, 92, - 128, 108, 120, 100, 97, 111, 80, 119, 122, 91, - 114, 94, 149, 129, 136, 114, 88, 132, 110, 85, - 116, 99, 101, 71, 71, 110, 140, 142, 131, 110, - 122, 98, 83, 127, 100, 106, 130, 123, 114, 103, - 113, 87, 140, 116, 113, 140, 161, 171, 145, 129, - 115, 178, 158, 161, 160, 118, 195, 209, 221, 228, - 99, 83, 140, 134, 140, 127, 186, 168, 187, 187, - 107, 114, 100, 111, 111, 104, 130, 131, 116, 128, - 128, 104, 64, 18, 49, 126, 107, 69, 56, 153, - 154, 142, 110, 113, 89, 120, 93, 73, 190, 172, - 119, 96, 57, 21, 60, 126, 122, 81, 99, 117, - 159, 141, 108, 88, 120, 144, 125, 89, 44, 94, - 147, 131, 93, 81, 61, 133, 113, 85, 47, 62, - 123, 121, 87, 53, 90, 120, 94, 76, 70, 48, - 125, 103, 93, 64, 35, 140, 129, 88, 47, 30, - 127, 104, 58, 51, 103, 124, 100, 102, 76, 47, - 115, 87, 54, 46, 77, 182, 218, 174, 163, 145, - 140, 126, 89, 105, 82, 125, 119, 101, 69, 58, - 125, 107, 172, 145, 128, 138, 113, 109, 92, 90, - 117, 93, 83, 93, 132, 125, 102, 67, 148, 161, - 131, 110, 96, 99, 74, 119, 92, 54, 84, 81, - 110, 152, 120, 106, 131, 108, 74, 68, 99, 107, - 121, 97, 120, 101, 78, 132, 110, 127, 164, 134, - 111, 159, 204, 189, 178, 158, 183, 146, 144, 137, - 123, 106, 136, 108, 135, 117, 91, 163, 135, 113, - 119, 177, 134, 122, 121, 132, 109, 157, 131, 113, - 115, 87, 87, 100, 92, 120, 95, 59, 146, 139, - 129, 101, 135, 122, 101, 119, 100, 112, 88, 99, - 118, 90, 123, 125, 107, 121, 98, 73, 104, 80, - 112, 79, 86, 122, 96, 104, 81, 107, 90, 93, - 112, 150, 140, 109, 115, 113, 86, 73, 76, 112, - 130, 111, 101, 112, 84, 123, 97, 63, 134, 115, - 109, 77, 128, 141, 119, 125, 101, 108, 147, 119, - 134, 149, 150, 127, 115, 136, 244, 220, 210, 189, - 105, 138, 171, 156, 174, 117, 162, 133, 146, 141, - 115, 93, 119, 98, 122, 114, 106, 154, 145, 162, - 107, 131, 189, 165, 152, 101, 107, 129, 114, 139, - 116, 186, 186, 161, 180, 100, 89, 137, 116, 116, - 106, 130, 194, 196, 207, 110, 156, 157, 138, 149, - 102, 93, 159, 138, 120, 109, 132, 105, 122, 135, - 148, 128, 85, 76, 102, 168, 154, 141, 117, 100, - 125, 106, 62, 101, 146, 124, 102, 65, 25, 15, - 120, 94, 46, 21, 94, 149, 128, 115, 85, 92, - 119, 93, 70, 52, 30, 162, 151, 123, 91, 80, - 126, 112, 84, 47, 33, 138, 114, 73, 60, 87, - 126, 211, 174, 158, 143, 129, 106, 65, 31, 133, - 119, 95, 52, 99, 173, 123, 96, 119, 206, 178, - 127, 104, 60, 61, 67, 152, 136, 104, 63, 83, - 133, 130, 92, 64, 45, 120, 96, 53, 30, 130, - 128, 103, 74, 59, 35, 135, 114, 77, 30, 57, - 108, 130, 123, 90, 87, 143, 125, 93, 54, 60, - 133, 118, 79, 87, 95, 115, 89, 111, 88, 65, - 124, 102, 70, 40, 47, 148, 131, 123, 130, 104, - 127, 109, 87, 56, 121, 147, 123, 121, 107, 85, - 178, 237, 200, 193, 170, 139, 118, 100, 75, 110, - 133, 121, 81, 73, 68, 120, 195, 157, 141, 131, - 127, 102, 107, 88, 60, 136, 113, 100, 69, 45, - 128, 105, 93, 77, 67, 131, 116, 149, 184, 156, - 115, 85, 35, 45, 112, 128, 108, 68, 73, 111, - 118, 93, 187, 162, 139, 136, 115, 84, 57, 37, - 131, 133, 125, 98, 85, 138, 115, 92, 86, 61, - 116, 96, 70, 52, 110, 115, 109, 135, 104, 88, - 136, 159, 122, 109, 115, 122, 110, 98, 70, 95, - 112, 81, 68, 85, 90, 124, 101, 87, 56, 89, - 109, 82, 98, 100, 115, 124, 102, 76, 88, 63, - 111, 78, 42, 78, 102, 110, 71, 64, 131, 111, - 125, 104, 107, 87, 123, 129, 131, 99, 85, 68, - 147, 137, 102, 99, 75, 120, 155, 142, 109, 91, - 132, 109, 131, 141, 113, 136, 119, 94, 152, 128, - 127, 102, 79, 159, 134, 111, 78, 98, 109, 80, - 115, 86, 51, 63, 103, 116, 86, 170, 149, 123, - 135, 178, 159, 125, 114, 113, 189, 226, 203, 202, - 140, 117, 116, 94, 70, 128, 103, 94, 174, 149, - 118, 98, 83, 84, 106, 115, 157, 120, 94, 95, - 131, 112, 75, 96, 74, 121, 97, 144, 117, 95, - 120, 90, 140, 138, 110, 119, 93, 55, 92, 114, - 114, 87, 151, 125, 100, 111, 82, 83, 160, 139, - 114, 86, 56, 90, 138, 104, 109, 101, 77, 118, - 140, 142, 143, 148, 126, 121, 102, 129, 107, 111, - 113, 79, 58, 111, 91, 120, 94, 63, 115, 98, - 121, 94, 99, 97, 78, 120, 92, 68, 173, 148, - 122, 114, 109, 87, 82, 132, 229, 192, 176, 155, - 137, 116, 123, 97, 115, 132, 115, 86, 120, 95, - 135, 116, 101, 136, 108, 109, 74, 100, 125, 115, - 112, 158, 144, 124, 134, 114, 83, 73, 147, 120, - 120, 104, 150, 122, 116, 110, 104, 192, 183, 174, - 134, 112, 116, 120, 93, 121, 101, 93, 110, 90, - 121, 93, 147, 152, 122, 115, 153, 171, 161, 142, - 123, 95, 116, 114, 93, 113, 89, 96, 77, 93, - 113, 174, 180, 143, 138, 116, 86, 100, 135, 106, - 103, 121, 149, 115, 103, 121, 95, 82, 149, 121, - 117, 92, 93, 111, 114, 123, 209, 196, 193, 183, - 125, 102, 107, 130, 104, 115, 91, 113, 103, 99, - 114, 86, 68, 108, 110, 111, 159, 162, 125, 113, - 125, 235, 234, 225, 214, 99, 74, 118, 121, 127, - 104, 123, 158, 128, 127, 113, 96, 116, 136, 158, - 100, 80, 138, 155, 166, 118, 143, 115, 125, 114, - 119, 137, 133, 136, 139, 151, 188, 172, 174, 173, - 138, 161, 158, 158, 155, 121, 198, 194, 211, 202, - 100, 90, 112, 110, 122, 100, 91, 122, 128, 135, - 101, 109, 127, 101, 114, 105, 126, 160, 147, 143, - 109, 138, 142, 158, 163, 113, 174, 185, 188, 206, - 112, 154, 166, 176, 183, 101, 108, 140, 140, 143, - 106, 135, 130, 137, 126, 103, 114, 115, 128, 126, - 107, 86, 21, 115, 75, 117, 139, 97, 65, 105, - 64, 191, 101, 106, 139, 107, 98, 218, 132, 104, - 73, 136, 165, 84, 118, 150, 111, 58, 130, 107, - 99, 136, 132, 56, 52, 102, 136, 69, 78, 163, - 85, 173, 148, 138, 85, 69, 106, 128, 133, 155, - 104, 91, 149, 56, 104, 103, 101, 172, 96, 57, - 104, 97, 125, 197, 166, 107, 169, 47, 120, 103, - 150, 89, 99, 139, 162, 101, 69, 137, 158, 126, - 191, 173, 127, 79, 155, 51, 131, 112, 86, 74, - 135, 61, 114, 81, 125, 117, 112, 72, 175, 72, - 127, 123, 142, 132, 78, 116, 158, 111, 121, 143, - 108, 102, 89, 20, 194, 81, 99, 107, 65, 150, - 103, 78, 91, 69, 96, 104, 116, 116, 103, 105, - 107, 117, 110, 130, 28, 88, 103, 62, 72, 85, - 125, 126, 141, 126, 178, 121, 102, 57, 46, 124, - 97, 91, 89, 138, 95, 98, 143, 99, 169, 123, - 140, 119, 113, 82, 140, 118, 112, 91, 92, 241, - 134, 89, 95, 112, 78, 167, 140, 145, 121, 100, - 109, 205, 144, 91, 100, 113, 103, 142, 175, 95, - 117, 121, 35, 121, 127, 159, 129, 85, 64, 75, - 116, 98, 103, 127, 129, 66, 68, 110, 96, 86, - 79, 100, 156, 133, 92, 135, 96, 164, 132, 121, - 93, 163, 134, 91, 208, 104, 77, 126, 116, 58, - 136, 118, 132, 81, 61, 73, 115, 66, 129, 123, - 111, 85, 42, 178, 134, 108, 132, 159, 45, 157, - 105, 164, 100, 94, 60, 96, 57, 154, 105, 102, - 103, 114, 96, 12, 91, 119, 115, 67, 92, 64, - 94, 61, 106, 106, 165, 105, 94, 98, 68, 30, - 146, 130, 107, 173, 140, 102, 90, 163, 106, 184, - 100, 53, 68, 131, 92, 105, 111, 68, 153, 186, - 101, 82, 48, 99, 147, 122, 136, 176, 96, 96, - 104, 132, 167, 149, 136, 138, 144, 97, 120, 92 -}; - -static const uint8_t wmavoice_dq_lsp16i2[0x3c0] = { - 23, 12, 107, 119, 110, 205, 214, 212, 208, 201, - 102, 95, 69, 117, 107, 118, 123, 118, 123, 121, - 82, 58, 83, 95, 84, 139, 145, 153, 161, 169, - 102, 100, 138, 121, 101, 129, 130, 138, 150, 139, - 76, 104, 86, 112, 133, 113, 91, 63, 73, 129, - 199, 193, 182, 181, 172, 119, 101, 83, 94, 76, - 161, 157, 152, 157, 158, 110, 90, 121, 96, 79, - 124, 107, 114, 88, 73, 152, 137, 121, 107, 99, - 57, 50, 100, 81, 74, 115, 96, 72, 49, 69, - 83, 68, 40, 53, 103, 36, 131, 107, 84, 64, - 236, 245, 242, 231, 213, 95, 109, 88, 69, 110, - 228, 221, 204, 182, 170, 129, 110, 97, 118, 104, - 98, 76, 98, 75, 61, 93, 77, 113, 91, 72, - 116, 94, 106, 134, 118, 177, 188, 169, 162, 153, - 163, 149, 131, 131, 132, 177, 163, 173, 168, 158, - 113, 131, 107, 113, 100, 132, 143, 131, 134, 142, - 45, 36, 121, 113, 102, 43, 95, 84, 67, 56, - 76, 82, 68, 48, 33, 55, 58, 59, 43, 65, - 66, 85, 66, 81, 94, 102, 82, 54, 33, 94, - 113, 111, 89, 60, 34, 138, 120, 101, 101, 86, - 88, 73, 55, 114, 115, 92, 74, 93, 77, 123, - 90, 117, 99, 79, 59, 97, 75, 97, 122, 104, - 233, 237, 227, 208, 190, 209, 230, 233, 240, 241, - 195, 197, 188, 167, 147, 204, 185, 168, 162, 157, - 142, 124, 119, 123, 106, 117, 110, 81, 121, 123, - 74, 116, 124, 119, 120, 178, 168, 146, 132, 125, - 102, 104, 105, 110, 114, 104, 82, 78, 100, 86, - 120, 102, 105, 93, 143, 127, 108, 128, 106, 88, - 177, 189, 203, 207, 215, 101, 131, 119, 95, 73, - 149, 139, 135, 147, 153, 160, 167, 165, 174, 177, - 120, 109, 134, 140, 145, 131, 130, 142, 139, 161, - 143, 158, 148, 145, 145, 123, 142, 132, 116, 102, - 40, 23, 79, 82, 84, 26, 83, 141, 130, 122, - 65, 46, 43, 89, 86, 28, 75, 80, 79, 98, - 84, 65, 47, 26, 44, 49, 112, 101, 100, 94, - 88, 76, 75, 48, 82, 104, 100, 75, 45, 15, - 99, 83, 63, 34, 30, 66, 55, 94, 118, 113, - 122, 106, 91, 68, 60, 135, 122, 104, 77, 59, - 82, 102, 84, 62, 46, 92, 74, 55, 82, 71, - 145, 134, 118, 93, 75, 79, 62, 83, 65, 55, - 91, 94, 64, 70, 98, 89, 117, 110, 87, 97, - 210, 223, 225, 223, 213, 83, 103, 86, 101, 85, - 126, 106, 81, 79, 105, 216, 219, 217, 199, 179, - 86, 78, 115, 138, 135, 102, 84, 87, 59, 46, - 219, 206, 184, 167, 158, 201, 188, 165, 145, 135, - 87, 113, 142, 152, 155, 190, 170, 153, 149, 146, - 205, 208, 201, 185, 167, 84, 73, 124, 104, 96, - 76, 88, 99, 74, 80, 110, 125, 122, 99, 112, - 108, 84, 70, 130, 137, 161, 152, 136, 119, 105, - 110, 91, 101, 74, 96, 111, 101, 93, 153, 149, - 133, 124, 102, 97, 120, 101, 93, 75, 81, 64, - 111, 94, 107, 79, 58, 188, 206, 215, 221, 232, - 163, 175, 165, 150, 136, 103, 106, 123, 133, 132, - 168, 184, 191, 183, 170, 110, 117, 90, 98, 93, - 104, 87, 122, 98, 127, 129, 110, 127, 113, 125, - 134, 118, 102, 140, 132, 186, 199, 202, 198, 188, - 149, 147, 175, 185, 186, 117, 93, 99, 112, 93, - 107, 138, 138, 129, 128, 96, 129, 104, 118, 134, - 145, 136, 115, 121, 129, 138, 155, 148, 134, 120, - 170, 151, 150, 145, 138, 168, 173, 185, 194, 200, - 144, 159, 172, 168, 156, 121, 121, 138, 173, 168, - 126, 111, 140, 139, 117, 149, 133, 142, 137, 130, - 143, 139, 158, 158, 146, 119, 128, 121, 132, 145, - 122, 136, 159, 153, 141, 133, 133, 130, 129, 126, - 120, 76, 50, 149, 109, 92, 155, 118, 90, 66, - 132, 117, 87, 156, 117, 119, 102, 44, 83, 91, - 109, 73, 106, 84, 29, 55, 130, 112, 81, 241, - 75, 40, 91, 89, 67, 112, 90, 149, 81, 72, - 128, 90, 71, 28, 160, 73, 157, 123, 143, 108, - 63, 88, 70, 81, 97, 75, 111, 149, 113, 96, - 78, 104, 83, 179, 95, 105, 106, 65, 130, 66, - 51, 118, 92, 53, 68, 105, 75, 176, 151, 115, - 94, 75, 68, 95, 220, 103, 125, 105, 43, 95, - 39, 114, 65, 145, 135, 33, 142, 138, 103, 52, - 82, 85, 117, 110, 67, 102, 74, 42, 62, 118, - 144, 121, 82, 57, 102, 67, 75, 44, 129, 96, - 75, 63, 88, 48, 116, 135, 94, 85, 102, 66, - 122, 77, 105, 122, 152, 120, 56, 90, 83, 100, - 90, 128, 63, 80, 103, 126, 117, 103, 80, 193, - 42, 73, 117, 93, 91, 95, 128, 100, 128, 162, - 70, 120, 126, 73, 123, 99, 99, 91, 75, 135, - 81, 125, 111, 77, 13, 94, 78, 85, 187, 157, - 11, 143, 109, 99, 119, 53, 141, 82, 122, 68, - 132, 89, 136, 119, 88, 75, 49, 174, 119, 70, - 138, 121, 108, 78, 52, 104, 90, 96, 93, 93, - 114, 90, 78, 46, 58, 62, 114, 69, 44, 162, - 103, 58, 98, 141, 83, 137, 95, 119, 73, 111, - 81, 46, 126, 111, 123, 107, 117, 122, 121, 54, - 106, 104, 59, 110, 148, 97, 155, 97, 83, 133, - 97, 71, 57, 91, 58, 52, 79, 127, 152, 109, - 96, 92, 145, 107, 149, 102, 61, 125, 61, 170, - 56, 89, 77, 106, 38, 147, 96, 77, 105, 123, - 85, 83, 117, 63, 69, 126, 133, 93, 107, 92, - 77, 115, 95, 111, 103, 61, 87, 103, 98, 155, - 94, 111, 80, 78, 54, 117, 128, 130, 99, 109, - 106, 99, 113, 133, 115, 89, 65, 74, 112, 127 -}; - -static const uint8_t wmavoice_dq_lsp16i3[0x300] = { - 70, 100, 121, 129, 132, 132, 201, 188, 165, 145, 144, 136, - 112, 127, 116, 125, 130, 129, 124, 135, 135, 146, 129, 128, - 162, 158, 144, 151, 135, 129, 103, 86, 111, 113, 112, 122, - 90, 139, 129, 117, 126, 129, 142, 145, 167, 147, 124, 124, - 230, 209, 189, 175, 156, 141, 64, 80, 86, 108, 121, 129, - 44, 79, 115, 113, 115, 128, 133, 106, 79, 109, 125, 127, - 171, 156, 132, 109, 103, 115, 106, 70, 93, 145, 141, 128, - 148, 125, 122, 107, 110, 117, 146, 145, 128, 110, 98, 111, - 237, 212, 185, 156, 139, 133, 84, 55, 26, 77, 114, 127, - 172, 170, 171, 168, 162, 143, 82, 82, 76, 70, 104, 126, - 17, 95, 109, 111, 120, 132, 81, 74, 57, 126, 141, 131, - 110, 127, 162, 148, 129, 123, 177, 172, 155, 151, 145, 134, - 144, 123, 90, 66, 109, 130, 82, 127, 103, 123, 132, 131, - 127, 97, 97, 142, 140, 128, 159, 134, 136, 123, 113, 117, - 131, 140, 154, 169, 158, 134, 96, 109, 150, 122, 105, 120, - 120, 150, 152, 122, 119, 125, 123, 126, 124, 107, 100, 113, - 248, 233, 216, 189, 160, 142, 58, 24, 13, 77, 111, 127, - 183, 189, 182, 157, 140, 131, 96, 83, 59, 43, 73, 119, - 222, 196, 171, 146, 129, 128, 32, 13, 53, 101, 114, 127, - 119, 101, 70, 70, 110, 127, 77, 86, 161, 148, 130, 118, - 199, 183, 170, 167, 156, 141, 30, 115, 142, 133, 131, 130, - 101, 103, 181, 176, 152, 126, 66, 44, 73, 94, 111, 128, - 150, 122, 100, 101, 104, 118, 61, 110, 87, 76, 93, 125, - 190, 170, 150, 134, 135, 129, 112, 89, 63, 123, 141, 132, - 175, 154, 136, 142, 140, 132, 117, 143, 129, 128, 136, 132, - 168, 142, 112, 113, 128, 128, 155, 169, 159, 144, 139, 131, - 61, 136, 144, 124, 112, 123, 86, 81, 104, 121, 129, 130, - 160, 127, 118, 150, 151, 134, 126, 115, 121, 132, 134, 131, - 137, 148, 144, 139, 140, 134, 106, 102, 105, 90, 87, 113, - 134, 129, 128, 121, 121, 123, 153, 151, 129, 139, 142, 134, - 150, 142, 141, 148, 149, 141, 100, 121, 133, 147, 150, 134, - 163, 158, 147, 132, 141, 132, 142, 127, 141, 136, 136, 132, - 232, 218, 205, 189, 169, 146, 243, 224, 201, 171, 147, 138, - 224, 196, 169, 162, 154, 140, 51, 20, 59, 111, 121, 128, - 203, 197, 193, 177, 162, 145, 75, 40, 47, 122, 130, 129, - 102, 77, 47, 83, 121, 129, 111, 108, 84, 56, 63, 114, - 211, 181, 154, 137, 126, 125, 213, 198, 186, 162, 144, 138, - 41, 45, 90, 110, 118, 130, 83, 63, 130, 164, 153, 128, - 195, 167, 142, 123, 113, 119, 19, 42, 105, 113, 120, 132, - 50, 63, 49, 64, 112, 128, 114, 90, 132, 171, 162, 134, - 129, 128, 107, 83, 74, 110, 50, 116, 109, 120, 128, 132, - 94, 59, 73, 111, 117, 126, 197, 170, 166, 153, 138, 132, - 65, 48, 109, 133, 131, 128, 170, 163, 172, 158, 138, 130, - 66, 126, 147, 160, 151, 132, 42, 129, 117, 95, 91, 120, - 97, 165, 164, 142, 133, 125, 163, 142, 114, 88, 97, 122, - 104, 77, 142, 143, 128, 120, 136, 160, 188, 169, 149, 130, - 113, 83, 85, 102, 114, 125, 164, 169, 142, 120, 122, 124, - 98, 152, 132, 105, 92, 117, 42, 71, 125, 155, 151, 137, - 94, 105, 81, 107, 118, 126, 84, 56, 123, 117, 108, 122, - 174, 179, 166, 137, 118, 121, 130, 103, 147, 152, 134, 124, - 148, 127, 94, 117, 144, 134, 129, 106, 102, 95, 106, 118, - 147, 157, 153, 125, 103, 117, 155, 128, 113, 132, 120, 122, - 181, 151, 136, 126, 122, 122, 110, 111, 109, 108, 120, 124, - 97, 130, 103, 89, 107, 124, 179, 158, 158, 142, 131, 128, - 142, 111, 115, 122, 126, 125, 145, 145, 134, 115, 129, 128, - 130, 139, 112, 99, 121, 125, 79, 104, 119, 102, 105, 123, - 116, 121, 136, 125, 126, 127, 124, 100, 122, 119, 111, 119, - 159, 140, 139, 128, 138, 131, 105, 100, 116, 128, 135, 132, - 159, 142, 156, 147, 140, 134, 130, 150, 129, 126, 114, 120, - 138, 124, 146, 131, 109, 119, 93, 115, 125, 131, 125, 129, - 125, 121, 101, 119, 114, 120, 163, 154, 151, 153, 153, 139, - 166, 153, 150, 133, 119, 121, 159, 151, 128, 130, 122, 123, - 147, 154, 144, 133, 128, 127, 129, 131, 134, 140, 148, 138, - 138, 136, 120, 131, 135, 131, 150, 140, 137, 144, 129, 129 -}; - -static const uint8_t wmavoice_dq_lsp10r[0x1400] = { - 128, 128, 129, 129, 130, 130, 131, 130, 129, 129, - 134, 133, 127, 125, 136, 135, 135, 134, 173, 172, - 133, 139, 136, 165, 133, 176, 137, 159, 135, 152, - 147, 161, 147, 152, 149, 156, 146, 146, 140, 136, - 134, 135, 136, 140, 139, 155, 123, 133, 132, 142, - 132, 148, 143, 177, 124, 143, 123, 136, 126, 134, - 126, 125, 125, 124, 129, 128, 123, 123, 133, 133, - 116, 116, 121, 121, 121, 120, 129, 128, 131, 131, - 132, 133, 132, 129, 138, 124, 138, 124, 132, 100, - 135, 94, 149, 111, 152, 115, 150, 128, 141, 133, - 129, 129, 130, 129, 147, 145, 136, 137, 120, 122, - 120, 122, 127, 129, 104, 108, 113, 115, 124, 124, - 140, 139, 147, 145, 132, 130, 184, 177, 201, 196, - 170, 171, 160, 161, 145, 147, 137, 145, 131, 131, - 130, 130, 130, 130, 130, 130, 132, 134, 131, 132, - 131, 133, 141, 144, 142, 149, 84, 93, 103, 104, - 139, 139, 142, 140, 147, 147, 172, 165, 122, 121, - 98, 100, 101, 106, 112, 117, 122, 124, 124, 124, - 134, 133, 133, 133, 146, 142, 147, 145, 156, 156, - 143, 146, 119, 124, 129, 132, 151, 149, 136, 135, - 147, 148, 181, 180, 199, 188, 190, 173, 166, 161, - 147, 142, 153, 149, 154, 146, 150, 146, 138, 134, - 131, 135, 96, 136, 48, 138, 56, 131, 63, 124, - 85, 128, 103, 132, 117, 134, 120, 132, 125, 129, - 131, 130, 129, 128, 129, 128, 163, 168, 117, 120, - 121, 121, 136, 138, 131, 132, 135, 136, 131, 133, - 133, 133, 133, 134, 117, 118, 105, 109, 142, 151, - 144, 159, 131, 138, 121, 126, 123, 123, 121, 124, - 131, 131, 129, 129, 141, 140, 142, 134, 87, 90, - 109, 109, 130, 127, 139, 143, 133, 131, 127, 126, - 134, 135, 134, 136, 97, 98, 130, 132, 134, 137, - 115, 119, 125, 130, 107, 109, 119, 118, 126, 127, - 134, 135, 127, 132, 172, 203, 160, 196, 152, 179, - 152, 172, 148, 168, 153, 172, 145, 156, 137, 140, - 102, 116, 42, 56, 74, 61, 82, 70, 86, 78, - 101, 97, 104, 100, 115, 108, 116, 108, 123, 118, - 149, 143, 166, 129, 168, 96, 142, 95, 135, 98, - 117, 86, 116, 93, 121, 108, 119, 107, 121, 117, - 135, 135, 127, 138, 72, 132, 99, 136, 112, 147, - 120, 152, 136, 155, 138, 146, 140, 142, 134, 139, - 163, 145, 192, 130, 147, 124, 147, 125, 133, 125, - 127, 124, 128, 123, 129, 122, 130, 122, 130, 125, - 130, 137, 135, 180, 124, 133, 130, 129, 132, 133, - 124, 124, 131, 130, 132, 136, 126, 124, 127, 125, - 132, 132, 133, 133, 144, 140, 143, 142, 137, 135, - 143, 138, 152, 149, 221, 219, 158, 161, 143, 141, - 130, 129, 140, 135, 170, 145, 193, 156, 186, 152, - 167, 139, 151, 131, 142, 127, 134, 120, 131, 125, - 135, 133, 141, 125, 199, 109, 137, 126, 134, 123, - 130, 129, 132, 123, 128, 125, 122, 126, 125, 125, - 130, 128, 91, 89, 138, 135, 139, 134, 133, 129, - 132, 130, 125, 128, 136, 135, 129, 127, 126, 126, - 132, 131, 133, 131, 128, 120, 132, 126, 126, 119, - 134, 130, 131, 123, 104, 95, 140, 141, 136, 137, - 133, 133, 133, 134, 117, 98, 74, 49, 112, 111, - 123, 122, 126, 127, 131, 131, 127, 126, 128, 129, - 130, 131, 124, 127, 101, 107, 108, 109, 115, 115, - 100, 99, 130, 128, 134, 136, 125, 127, 128, 130, - 136, 137, 145, 150, 149, 164, 136, 151, 114, 111, - 124, 125, 143, 150, 162, 174, 158, 169, 136, 137, - 131, 131, 131, 131, 132, 133, 111, 110, 122, 121, - 136, 136, 134, 133, 131, 132, 127, 127, 125, 125, - 128, 129, 129, 130, 125, 127, 140, 140, 148, 149, - 133, 136, 146, 153, 110, 118, 127, 129, 128, 129, - 131, 133, 127, 131, 140, 161, 167, 224, 131, 139, - 136, 143, 135, 139, 138, 143, 149, 155, 141, 143, - 134, 132, 120, 111, 83, 83, 121, 126, 102, 107, - 112, 115, 97, 104, 120, 115, 129, 123, 122, 122, - 134, 135, 122, 131, 102, 124, 114, 119, 93, 103, - 78, 79, 67, 72, 66, 73, 78, 82, 103, 102, - 144, 135, 165, 139, 165, 129, 160, 126, 153, 127, - 161, 134, 160, 142, 160, 143, 148, 140, 138, 135, - 138, 95, 147, 54, 143, 78, 140, 112, 142, 113, - 140, 121, 135, 117, 135, 122, 136, 131, 131, 132, - 147, 159, 140, 156, 127, 81, 142, 128, 146, 127, - 144, 125, 146, 128, 149, 130, 144, 135, 133, 128, - 130, 131, 131, 131, 134, 139, 126, 134, 141, 154, - 168, 205, 153, 176, 148, 163, 147, 158, 141, 143, - 131, 135, 126, 146, 108, 157, 107, 156, 119, 146, - 100, 138, 104, 125, 119, 134, 101, 122, 113, 122, - 95, 133, 52, 140, 83, 136, 110, 133, 114, 131, - 123, 131, 133, 131, 138, 135, 132, 132, 127, 127, - 129, 128, 124, 122, 128, 126, 145, 170, 143, 172, - 141, 163, 143, 176, 138, 164, 139, 155, 135, 145, - 135, 136, 136, 127, 132, 76, 128, 76, 127, 63, - 125, 66, 123, 67, 120, 71, 124, 92, 122, 111, - 133, 133, 135, 136, 139, 140, 147, 147, 150, 144, - 156, 147, 150, 145, 154, 146, 120, 123, 123, 124, - 137, 133, 170, 141, 124, 124, 135, 134, 134, 135, - 132, 132, 129, 129, 130, 130, 136, 136, 130, 132, - 147, 159, 135, 158, 115, 146, 120, 148, 117, 136, - 115, 137, 113, 132, 133, 142, 140, 144, 132, 134, - 134, 135, 134, 137, 137, 147, 162, 178, 136, 147, - 134, 144, 123, 132, 111, 113, 113, 113, 124, 124, - 132, 131, 126, 126, 117, 114, 100, 95, 130, 125, - 157, 145, 164, 156, 163, 158, 145, 145, 133, 134, - 134, 134, 127, 126, 113, 102, 136, 130, 124, 122, - 143, 145, 127, 131, 135, 143, 133, 137, 132, 132, - 92, 94, 122, 125, 128, 129, 131, 130, 134, 135, - 132, 128, 129, 127, 132, 132, 131, 129, 127, 127, - 129, 129, 132, 131, 139, 131, 137, 132, 216, 178, - 146, 134, 147, 137, 151, 142, 148, 139, 144, 138, - 128, 127, 129, 129, 123, 131, 71, 91, 126, 128, - 130, 134, 117, 123, 125, 125, 135, 140, 129, 132, - 132, 132, 133, 134, 124, 130, 127, 133, 133, 138, - 142, 149, 135, 141, 145, 149, 154, 164, 135, 138, - 135, 135, 141, 142, 138, 137, 116, 96, 105, 86, - 127, 118, 128, 120, 124, 117, 125, 117, 125, 121, - 131, 131, 132, 134, 144, 145, 112, 112, 121, 123, - 113, 116, 121, 123, 139, 138, 128, 128, 131, 131, - 134, 132, 132, 132, 125, 128, 127, 130, 125, 131, - 120, 128, 90, 119, 68, 98, 99, 112, 115, 124, - 135, 135, 134, 134, 128, 129, 137, 137, 137, 138, - 110, 114, 129, 130, 144, 145, 123, 125, 129, 129, - 132, 133, 129, 130, 168, 187, 140, 149, 137, 144, - 129, 130, 129, 134, 133, 138, 118, 118, 122, 120, - 131, 130, 129, 128, 133, 133, 125, 125, 124, 123, - 181, 179, 129, 129, 131, 127, 139, 136, 130, 128, - 133, 133, 132, 132, 121, 120, 122, 119, 132, 129, - 129, 125, 107, 96, 136, 137, 150, 146, 135, 134, - 131, 131, 130, 130, 126, 123, 126, 123, 128, 125, - 130, 123, 134, 127, 183, 159, 143, 135, 137, 134, - 129, 129, 128, 128, 134, 133, 139, 138, 133, 132, - 129, 127, 154, 151, 150, 144, 146, 146, 141, 142, - 132, 132, 131, 131, 130, 130, 132, 133, 114, 115, - 132, 132, 122, 122, 132, 131, 115, 117, 120, 120, - 129, 129, 130, 130, 130, 129, 130, 131, 129, 131, - 130, 130, 129, 129, 133, 132, 143, 144, 91, 91, - 137, 136, 118, 107, 60, 45, 56, 49, 57, 52, - 60, 56, 71, 75, 77, 80, 92, 97, 106, 106, - 112, 131, 58, 121, 19, 65, 84, 101, 108, 122, - 121, 127, 112, 117, 106, 112, 117, 124, 126, 127, - 130, 129, 138, 133, 166, 155, 192, 179, 192, 177, - 208, 191, 204, 192, 186, 179, 163, 163, 138, 142, - 134, 134, 144, 142, 243, 236, 148, 146, 141, 137, - 145, 141, 151, 144, 147, 143, 135, 139, 134, 133, - 134, 128, 138, 88, 142, 10, 127, 76, 130, 96, - 129, 102, 128, 108, 123, 111, 127, 119, 127, 124, - 136, 136, 139, 139, 142, 140, 246, 241, 158, 167, - 143, 145, 146, 149, 143, 145, 148, 152, 133, 134, - 139, 135, 135, 136, 99, 137, 95, 133, 75, 138, - 67, 135, 73, 128, 83, 132, 96, 126, 115, 127, - 130, 132, 137, 136, 140, 135, 134, 130, 137, 131, - 159, 151, 215, 197, 181, 170, 160, 149, 150, 143, - 145, 148, 186, 207, 141, 147, 135, 137, 122, 122, - 126, 125, 128, 126, 127, 127, 134, 126, 131, 123, - 133, 133, 126, 122, 128, 122, 99, 93, 59, 60, - 82, 82, 106, 107, 119, 123, 124, 128, 128, 129, - 134, 137, 133, 139, 133, 136, 141, 132, 139, 122, - 142, 97, 130, 81, 128, 89, 129, 101, 125, 112, - 137, 140, 129, 148, 101, 159, 118, 180, 122, 178, - 120, 178, 116, 168, 118, 153, 127, 151, 126, 136, - 132, 134, 125, 126, 118, 105, 156, 124, 180, 132, - 163, 124, 148, 121, 131, 112, 127, 115, 125, 122, - 129, 131, 128, 129, 136, 134, 142, 141, 165, 158, - 203, 182, 141, 136, 132, 130, 135, 135, 130, 130, - 133, 133, 132, 132, 127, 126, 106, 105, 112, 110, - 106, 105, 80, 84, 100, 101, 122, 125, 126, 128, - 101, 109, 46, 59, 114, 112, 119, 119, 126, 121, - 129, 124, 128, 125, 125, 122, 123, 120, 125, 122, - 135, 134, 121, 134, 56, 139, 131, 145, 135, 138, - 136, 139, 126, 130, 122, 132, 126, 129, 124, 129, - 153, 169, 146, 179, 138, 139, 151, 143, 148, 138, - 153, 137, 142, 129, 144, 126, 140, 128, 133, 126, - 136, 134, 154, 149, 173, 157, 152, 144, 149, 141, - 137, 136, 127, 121, 123, 121, 121, 126, 120, 123, - 157, 143, 166, 135, 120, 122, 112, 118, 102, 118, - 111, 124, 134, 131, 141, 138, 135, 134, 126, 129, - 140, 123, 152, 76, 131, 116, 138, 136, 126, 134, - 130, 142, 126, 136, 120, 132, 126, 128, 124, 127, - 131, 138, 80, 147, 126, 138, 130, 140, 129, 134, - 133, 135, 131, 132, 126, 127, 127, 125, 125, 123, - 132, 132, 130, 132, 123, 130, 102, 102, 107, 110, - 116, 127, 132, 152, 142, 160, 143, 151, 142, 146, - 132, 132, 132, 132, 125, 126, 132, 140, 158, 199, - 135, 149, 134, 140, 135, 131, 129, 120, 127, 121, - 129, 130, 122, 123, 125, 124, 138, 138, 138, 135, - 140, 141, 101, 94, 105, 98, 121, 122, 127, 128, - 126, 127, 119, 121, 133, 156, 132, 159, 130, 148, - 137, 164, 127, 138, 130, 137, 135, 140, 126, 126, - 128, 129, 129, 129, 126, 124, 130, 128, 143, 138, - 149, 143, 185, 170, 129, 127, 138, 133, 138, 135, - 132, 134, 137, 144, 139, 183, 131, 145, 127, 128, - 128, 127, 128, 122, 129, 125, 145, 139, 135, 131, - 132, 133, 132, 130, 152, 96, 159, 85, 150, 105, - 154, 115, 143, 120, 138, 126, 134, 124, 130, 126, - 128, 127, 121, 123, 122, 123, 116, 125, 84, 87, - 133, 135, 129, 131, 123, 126, 133, 135, 131, 130, - 136, 134, 129, 119, 79, 63, 116, 116, 136, 133, - 133, 130, 140, 143, 127, 127, 124, 125, 127, 128, - 128, 126, 124, 120, 139, 128, 153, 134, 151, 134, - 174, 145, 159, 136, 165, 144, 171, 149, 143, 135, - 134, 134, 133, 133, 121, 119, 177, 162, 166, 154, - 127, 130, 132, 132, 136, 137, 142, 143, 138, 137, - 167, 151, 162, 142, 128, 136, 142, 148, 128, 143, - 145, 153, 140, 149, 132, 141, 128, 139, 127, 133, - 156, 169, 131, 129, 126, 120, 127, 125, 129, 120, - 131, 126, 126, 123, 124, 121, 122, 121, 123, 123, - 138, 140, 149, 156, 145, 152, 105, 102, 131, 126, - 151, 146, 147, 139, 144, 137, 143, 133, 135, 130, - 132, 130, 131, 129, 126, 130, 126, 129, 110, 135, - 115, 139, 108, 146, 105, 147, 121, 134, 124, 133, - 137, 137, 135, 134, 143, 142, 146, 146, 120, 121, - 139, 137, 133, 129, 149, 145, 139, 133, 130, 127, - 134, 134, 134, 134, 125, 124, 117, 119, 120, 113, - 84, 80, 122, 125, 108, 112, 97, 102, 118, 120, - 124, 123, 115, 116, 110, 111, 98, 97, 127, 124, - 129, 127, 120, 117, 114, 109, 106, 104, 116, 116, - 138, 138, 139, 141, 142, 146, 127, 125, 133, 130, - 134, 128, 134, 127, 116, 91, 105, 84, 114, 106, - 128, 128, 126, 126, 131, 137, 126, 129, 133, 139, - 134, 145, 132, 143, 150, 192, 131, 142, 138, 141, - 132, 130, 132, 130, 149, 138, 196, 152, 137, 125, - 134, 125, 139, 128, 133, 125, 141, 134, 134, 135, - 134, 135, 134, 135, 131, 130, 136, 133, 110, 106, - 142, 144, 153, 162, 131, 129, 134, 132, 131, 130, - 126, 125, 132, 130, 168, 153, 126, 124, 130, 126, - 140, 135, 140, 134, 138, 133, 145, 137, 135, 134, - 130, 130, 132, 131, 133, 132, 129, 129, 125, 128, - 128, 130, 133, 139, 143, 152, 193, 215, 152, 160, - 130, 131, 129, 131, 130, 131, 135, 136, 136, 141, - 83, 81, 121, 120, 136, 130, 150, 145, 147, 145, - 134, 133, 135, 133, 146, 142, 135, 131, 127, 128, - 134, 135, 93, 102, 126, 132, 131, 133, 127, 129, - 124, 125, 120, 122, 103, 106, 128, 129, 139, 138, - 127, 128, 134, 134, 143, 138, 139, 134, 135, 133, - 131, 130, 133, 131, 139, 134, 138, 136, 166, 156, - 119, 116, 121, 122, 126, 124, 116, 117, 123, 124, - 131, 131, 129, 129, 130, 128, 141, 138, 135, 132, - 154, 145, 137, 129, 131, 125, 146, 137, 138, 135, - 131, 131, 131, 132, 129, 130, 134, 138, 111, 116, - 113, 118, 123, 125, 122, 124, 143, 147, 138, 140, - 116, 113, 114, 112, 130, 126, 117, 115, 127, 126, - 139, 137, 141, 139, 131, 132, 143, 144, 139, 140, - 130, 130, 129, 128, 136, 134, 119, 117, 152, 143, - 155, 143, 120, 119, 142, 139, 124, 130, 126, 128, - 112, 110, 112, 109, 136, 132, 125, 118, 121, 115, - 103, 101, 109, 100, 125, 120, 121, 117, 122, 121, - 128, 128, 127, 127, 124, 124, 128, 127, 131, 129, - 142, 138, 147, 141, 115, 108, 113, 109, 122, 119, - 136, 133, 150, 139, 142, 131, 119, 111, 151, 137, - 121, 116, 146, 134, 137, 129, 121, 123, 127, 129, - 130, 130, 130, 130, 136, 137, 126, 126, 136, 136, - 133, 133, 139, 139, 142, 143, 119, 120, 134, 134, - 132, 132, 133, 133, 135, 138, 129, 131, 133, 134, - 135, 138, 126, 130, 117, 118, 131, 132, 135, 135, - 129, 129, 128, 128, 126, 129, 127, 129, 123, 125, - 115, 117, 156, 157, 127, 131, 129, 129, 128, 129, - 129, 130, 131, 131, 126, 127, 135, 134, 136, 135, - 140, 136, 117, 113, 132, 128, 104, 97, 109, 106, - 131, 131, 131, 131, 121, 123, 124, 125, 126, 127, - 127, 127, 135, 135, 128, 128, 130, 130, 141, 140, - 129, 129, 129, 129, 129, 127, 127, 125, 149, 146, - 125, 123, 134, 133, 134, 132, 152, 150, 138, 138, - 128, 128, 126, 125, 132, 133, 141, 143, 136, 136, - 126, 127, 126, 127, 129, 131, 128, 129, 135, 134, - 176, 139, 192, 135, 145, 122, 149, 117, 155, 134, - 169, 133, 157, 139, 142, 136, 151, 152, 142, 147, - 166, 174, 103, 107, 141, 134, 140, 136, 144, 135, - 147, 135, 156, 131, 153, 127, 133, 126, 130, 124, - 127, 130, 123, 124, 114, 105, 195, 193, 156, 157, - 165, 158, 126, 122, 149, 141, 174, 173, 152, 147, - 136, 139, 131, 138, 163, 169, 103, 124, 80, 102, - 153, 186, 121, 151, 134, 161, 156, 190, 141, 151, - 121, 123, 124, 127, 119, 127, 133, 134, 157, 156, - 81, 69, 136, 134, 160, 169, 118, 114, 135, 128, - 114, 116, 97, 97, 117, 122, 152, 161, 115, 121, - 106, 122, 135, 137, 111, 113, 125, 135, 141, 145, - 143, 146, 143, 150, 132, 136, 142, 150, 151, 167, - 101, 107, 155, 173, 112, 124, 105, 100, 128, 126, - 127, 130, 133, 134, 142, 121, 131, 116, 176, 145, - 161, 120, 209, 150, 196, 133, 147, 115, 149, 130, - 144, 145, 144, 145, 120, 119, 163, 160, 117, 118, - 123, 117, 154, 119, 193, 98, 149, 101, 137, 116, - 133, 135, 140, 143, 144, 156, 131, 146, 186, 201, - 140, 139, 123, 125, 158, 169, 157, 166, 142, 143, - 130, 131, 132, 132, 128, 128, 141, 142, 147, 149, - 145, 148, 137, 139, 129, 129, 107, 108, 157, 157, - 120, 121, 119, 119, 140, 132, 137, 131, 118, 113, - 143, 136, 134, 135, 164, 158, 133, 125, 127, 124, - 148, 122, 197, 130, 173, 145, 110, 139, 123, 165, - 83, 158, 90, 167, 93, 142, 136, 169, 134, 152, - 130, 126, 154, 138, 227, 150, 156, 114, 147, 114, - 142, 109, 135, 110, 166, 135, 176, 150, 152, 142, - 132, 132, 136, 136, 130, 135, 143, 152, 136, 144, - 152, 160, 177, 185, 112, 112, 165, 166, 160, 161, - 145, 145, 138, 139, 116, 118, 127, 131, 66, 80, - 132, 142, 119, 127, 101, 108, 120, 130, 126, 130, - 135, 135, 142, 139, 153, 137, 55, 30, 142, 139, - 139, 143, 135, 133, 129, 133, 109, 108, 129, 129, - 136, 135, 134, 131, 129, 132, 132, 134, 135, 149, - 79, 206, 123, 137, 135, 143, 130, 140, 131, 134, - 100, 99, 165, 164, 142, 123, 148, 133, 133, 122, - 142, 133, 138, 125, 119, 111, 129, 123, 137, 130, - 131, 132, 123, 129, 174, 185, 196, 181, 127, 111, - 156, 141, 132, 114, 129, 106, 132, 107, 126, 117, - 134, 140, 131, 136, 119, 146, 92, 246, 128, 132, - 125, 129, 132, 140, 128, 141, 126, 145, 137, 142, - 130, 130, 110, 115, 124, 139, 127, 151, 118, 152, - 98, 146, 36, 108, 126, 158, 112, 146, 112, 130, - 138, 136, 145, 138, 153, 145, 116, 125, 90, 103, - 137, 138, 189, 185, 141, 151, 86, 93, 111, 111, - 133, 171, 125, 209, 140, 132, 130, 134, 129, 101, - 142, 120, 142, 132, 135, 126, 141, 140, 140, 134, - 128, 123, 131, 123, 138, 118, 163, 133, 240, 197, - 176, 151, 126, 123, 81, 94, 109, 118, 124, 133, - 135, 133, 137, 134, 154, 135, 140, 155, 69, 190, - 119, 149, 141, 151, 142, 123, 135, 125, 129, 130, - 127, 125, 132, 127, 107, 80, 123, 103, 145, 131, - 133, 107, 140, 103, 135, 106, 170, 145, 159, 143, - 136, 137, 127, 130, 105, 119, 129, 134, 141, 151, - 116, 127, 119, 140, 75, 119, 152, 162, 149, 152, - 72, 138, 9, 143, 118, 160, 126, 134, 141, 147, - 135, 131, 129, 129, 135, 129, 136, 126, 133, 125, - 137, 135, 146, 141, 145, 139, 141, 140, 133, 130, - 213, 208, 139, 130, 139, 136, 117, 117, 126, 125, - 133, 130, 138, 131, 141, 100, 145, 93, 159, 121, - 144, 132, 117, 160, 102, 187, 99, 162, 117, 144, - 132, 132, 134, 134, 140, 141, 127, 126, 128, 131, - 116, 116, 121, 127, 119, 126, 114, 114, 99, 100, - 141, 144, 148, 159, 179, 224, 95, 131, 100, 125, - 87, 110, 112, 132, 134, 147, 111, 125, 122, 122, - 137, 140, 141, 129, 169, 12, 144, 132, 133, 144, - 141, 146, 137, 147, 136, 122, 133, 130, 131, 128, - 141, 142, 128, 139, 15, 69, 160, 159, 142, 130, - 137, 126, 159, 141, 145, 143, 128, 125, 134, 128, - 131, 130, 127, 127, 114, 104, 119, 98, 83, 68, - 139, 120, 173, 142, 199, 154, 191, 153, 158, 145, - 128, 130, 127, 127, 148, 150, 110, 99, 119, 109, - 120, 113, 163, 154, 110, 90, 138, 129, 149, 144, - 131, 134, 124, 142, 76, 217, 130, 129, 140, 138, - 133, 135, 145, 150, 136, 138, 127, 130, 130, 134, - 144, 119, 178, 70, 143, 130, 115, 136, 139, 138, - 129, 109, 136, 116, 147, 122, 126, 112, 126, 123, - 132, 139, 128, 144, 107, 156, 75, 163, 120, 164, - 151, 136, 151, 99, 160, 112, 159, 126, 143, 126, - 140, 138, 137, 135, 152, 108, 251, 85, 138, 116, - 137, 118, 141, 119, 136, 121, 150, 134, 138, 131, - 137, 137, 143, 144, 150, 153, 148, 154, 152, 151, - 117, 104, 124, 96, 93, 67, 146, 138, 149, 148, - 149, 153, 172, 193, 108, 114, 125, 128, 145, 165, - 149, 160, 121, 130, 115, 120, 110, 112, 121, 118, - 145, 146, 141, 142, 127, 127, 103, 95, 138, 143, - 114, 126, 109, 115, 143, 136, 153, 149, 144, 142, - 140, 138, 150, 144, 128, 116, 142, 136, 135, 122, - 93, 88, 164, 163, 141, 142, 171, 182, 154, 160, - 124, 125, 122, 123, 158, 155, 111, 97, 138, 130, - 157, 134, 101, 65, 129, 118, 121, 114, 124, 119, - 131, 133, 125, 129, 136, 147, 135, 152, 131, 133, - 110, 115, 118, 114, 161, 159, 233, 218, 172, 166, - 140, 107, 125, 0, 140, 103, 140, 115, 125, 113, - 132, 135, 128, 133, 138, 146, 131, 145, 127, 133, - 131, 131, 122, 122, 135, 132, 126, 124, 132, 133, - 164, 167, 121, 127, 117, 120, 167, 162, 145, 143, - 135, 134, 136, 134, 156, 146, 195, 177, 127, 139, - 108, 140, 141, 173, 141, 178, 131, 155, 129, 141, - 134, 134, 119, 114, 184, 184, 127, 126, 147, 151, - 130, 140, 146, 159, 134, 145, 131, 136, 137, 142, - 135, 137, 128, 136, 83, 108, 97, 98, 152, 119, - 207, 144, 142, 121, 144, 129, 131, 127, 130, 132, - 124, 125, 108, 107, 94, 116, 81, 114, 139, 173, - 131, 158, 145, 177, 141, 163, 136, 140, 143, 144, - 135, 141, 132, 136, 134, 142, 142, 136, 173, 50, - 143, 106, 142, 127, 134, 139, 127, 133, 125, 125, - 129, 130, 131, 133, 132, 148, 110, 138, 113, 135, - 138, 175, 108, 151, 55, 119, 51, 100, 93, 116, - 121, 121, 146, 151, 99, 120, 127, 137, 107, 122, - 125, 139, 110, 132, 135, 156, 141, 156, 148, 157, - 137, 137, 141, 140, 139, 137, 130, 128, 138, 136, - 132, 134, 115, 110, 177, 179, 81, 86, 100, 98, - 84, 83, 121, 121, 148, 157, 127, 133, 146, 156, - 127, 136, 143, 151, 135, 139, 138, 142, 136, 136, - 201, 164, 151, 129, 123, 136, 147, 148, 127, 142, - 128, 143, 101, 126, 119, 133, 114, 131, 116, 126, - 132, 133, 140, 140, 126, 125, 156, 153, 142, 129, - 140, 130, 77, 69, 134, 132, 146, 148, 135, 136, - 133, 132, 123, 116, 116, 103, 150, 135, 144, 127, - 130, 117, 136, 122, 122, 106, 48, 38, 81, 78, - 145, 146, 135, 136, 123, 122, 126, 133, 133, 138, - 145, 145, 144, 150, 160, 181, 142, 139, 150, 150, - 136, 136, 139, 139, 133, 133, 139, 135, 134, 129, - 140, 137, 153, 145, 132, 131, 151, 144, 68, 66, - 137, 137, 139, 139, 146, 146, 142, 139, 129, 128, - 131, 129, 133, 132, 135, 134, 135, 134, 201, 200, - 137, 136, 146, 143, 155, 153, 157, 158, 131, 138, - 140, 139, 143, 144, 128, 123, 216, 192, 159, 150, - 137, 138, 136, 142, 145, 148, 126, 162, 140, 170, - 186, 95, 131, 140, 143, 148, 133, 128, 130, 133, - 141, 139, 153, 150, 122, 122, 134, 144, 124, 130, - 159, 166, 133, 139, 151, 150, 138, 139, 131, 134, - 121, 121, 131, 129, 148, 180, 121, 135, 118, 131, - 124, 148, 119, 119, 129, 126, 150, 156, 155, 160, - 40, 154, 115, 157, 133, 129, 140, 133, 143, 133, - 143, 132, 144, 130, 141, 131, 134, 130, 137, 133, - 134, 136, 141, 140, 145, 137, 152, 124, 183, 91, - 118, 154, 123, 158, 136, 134, 140, 142, 138, 142, - 138, 135, 131, 131, 138, 129, 121, 128, 146, 219, - 124, 123, 125, 135, 120, 126, 127, 141, 133, 136, - 127, 124, 120, 107, 152, 125, 149, 108, 158, 144, - 196, 185, 174, 164, 151, 149, 138, 131, 140, 137, - 149, 148, 144, 145, 143, 145, 140, 143, 141, 147, - 112, 125, 113, 113, 149, 155, 143, 149, 146, 151, - 138, 138, 141, 138, 144, 129, 134, 125, 143, 140, - 153, 154, 142, 123, 162, 42, 154, 106, 153, 130, - 153, 153, 137, 137, 144, 144, 142, 140, 165, 151, - 161, 140, 144, 134, 156, 124, 167, 143, 166, 155, - 132, 132, 137, 138, 137, 132, 124, 127, 140, 144, - 134, 140, 162, 180, 127, 131, 152, 169, 145, 156, - 133, 134, 131, 133, 130, 132, 147, 149, 125, 117, - 127, 118, 159, 155, 147, 142, 122, 117, 145, 144, - 138, 137, 130, 133, 113, 149, 168, 224, 166, 201, - 129, 151, 147, 154, 136, 135, 140, 136, 152, 141, - 120, 112, 140, 127, 161, 100, 132, 115, 118, 125, - 115, 133, 115, 157, 144, 146, 114, 135, 127, 139, - 138, 141, 135, 135, 137, 136, 147, 142, 143, 144, - 139, 152, 142, 136, 147, 143, 177, 39, 125, 71, - 147, 143, 66, 88, 132, 158, 123, 126, 116, 135, - 119, 124, 128, 135, 133, 140, 137, 126, 137, 130, - 155, 38, 149, 103, 130, 135, 139, 143, 127, 137, - 135, 141, 138, 148, 131, 148, 136, 147, 132, 139, - 136, 140, 115, 129, 115, 151, 136, 160, 87, 131, - 157, 176, 150, 164, 140, 141, 135, 119, 137, 133, - 141, 140, 140, 139, 134, 134, 142, 144, 131, 132, - 131, 134, 131, 132, 116, 114, 129, 133, 205, 207, - 130, 133, 160, 170, 137, 127, 124, 112, 158, 146, - 155, 137, 134, 136, 137, 142, 177, 184, 149, 152, - 135, 134, 133, 132, 135, 129, 144, 136, 139, 134, - 161, 155, 126, 109, 215, 186, 177, 153, 160, 149, - 139, 139, 136, 140, 140, 142, 186, 71, 129, 144, - 131, 165, 142, 152, 140, 151, 141, 143, 137, 139, - 144, 138, 150, 135, 133, 126, 136, 143, 99, 152, - 139, 131, 190, 118, 122, 147, 134, 155, 136, 143, - 138, 135, 137, 132, 147, 144, 150, 144, 138, 134, - 129, 133, 130, 138, 56, 175, 129, 166, 147, 165, - 140, 138, 144, 137, 141, 133, 150, 139, 129, 135, - 40, 83, 126, 130, 110, 120, 100, 110, 126, 128, - 141, 142, 217, 175, 172, 151, 146, 153, 125, 132, - 128, 137, 141, 141, 145, 145, 140, 133, 132, 131, - 129, 144, 128, 177, 133, 195, 147, 120, 138, 131, - 161, 114, 166, 134, 162, 118, 161, 115, 155, 129, - 137, 136, 141, 129, 141, 132, 55, 168, 121, 126, - 136, 139, 120, 133, 149, 147, 132, 141, 131, 136, - 147, 150, 151, 132, 101, 31, 117, 101, 129, 132, - 122, 138, 128, 137, 140, 170, 131, 143, 131, 134, - 149, 192, 122, 158, 136, 146, 133, 166, 143, 141, - 141, 136, 141, 129, 125, 155, 140, 138, 137, 131, - 111, 112, 131, 132, 120, 127, 149, 148, 151, 141, - 156, 148, 133, 129, 127, 124, 144, 137, 142, 139, - 134, 133, 141, 138, 133, 135, 124, 96, 226, 152, - 116, 108, 128, 105, 155, 130, 153, 138, 144, 139, - 142, 141, 137, 135, 142, 143, 156, 162, 136, 89, - 188, 145, 181, 152, 138, 146, 146, 154, 145, 149, - 152, 133, 158, 133, 42, 153, 117, 144, 149, 139, - 125, 139, 134, 128, 150, 128, 143, 125, 135, 132, - 143, 141, 143, 141, 164, 173, 141, 142, 156, 155, - 154, 154, 169, 170, 77, 80, 112, 105, 135, 134, - 126, 143, 120, 172, 111, 144, 120, 154, 107, 153, - 95, 134, 104, 134, 128, 116, 163, 131, 151, 136, - 135, 133, 142, 143, 152, 204, 149, 112, 156, 128, - 150, 126, 127, 129, 139, 175, 143, 141, 138, 135, - 168, 148, 152, 105, 164, 121, 134, 122, 119, 109, - 122, 148, 136, 143, 153, 132, 158, 148, 149, 150, - 133, 131, 142, 141, 150, 149, 156, 173, 138, 155, - 129, 144, 111, 107, 130, 129, 96, 89, 106, 104, - 135, 135, 144, 146, 131, 153, 134, 154, 146, 166, - 117, 138, 163, 187, 190, 216, 149, 156, 149, 152, - 142, 142, 153, 154, 109, 145, 40, 102, 116, 126, - 137, 139, 149, 157, 108, 124, 139, 146, 142, 147, - 130, 126, 120, 111, 172, 146, 169, 136, 150, 135, - 126, 96, 159, 143, 150, 122, 162, 129, 156, 142, - 135, 142, 144, 138, 222, 109, 137, 145, 144, 142, - 141, 143, 138, 136, 124, 150, 133, 144, 137, 145, - 141, 144, 139, 144, 134, 154, 114, 136, 145, 173, - 151, 215, 110, 115, 127, 134, 145, 150, 145, 144, - 144, 142, 139, 131, 147, 132, 141, 119, 143, 106, - 165, 41, 147, 129, 129, 144, 138, 135, 138, 140, - 128, 150, 89, 163, 154, 115, 141, 127, 132, 145, - 135, 157, 143, 145, 140, 141, 127, 135, 127, 129, - 142, 147, 116, 147, 104, 162, 153, 143, 146, 130, - 144, 110, 133, 123, 130, 137, 118, 198, 126, 152, - 154, 146, 139, 127, 147, 112, 207, 151, 156, 136, - 162, 137, 108, 121, 130, 135, 125, 131, 131, 134, - 134, 134, 141, 144, 107, 143, 137, 144, 124, 136, - 115, 147, 130, 157, 119, 167, 71, 144, 97, 128, - 134, 138, 132, 133, 138, 138, 146, 146, 147, 131, - 141, 138, 185, 65, 145, 123, 139, 130, 142, 128, - 139, 136, 157, 147, 124, 119, 164, 148, 170, 154, - 133, 130, 157, 148, 140, 141, 130, 135, 134, 137, - 136, 137, 143, 144, 144, 144, 178, 186, 71, 73, - 120, 118, 127, 124, 152, 151, 155, 146, 141, 138, - 142, 143, 139, 143, 133, 134, 139, 140, 138, 135, - 146, 141, 78, 198, 129, 139, 141, 141, 134, 141, - 137, 136, 120, 120, 124, 118, 143, 148, 148, 152, - 131, 143, 129, 137, 152, 158, 157, 160, 175, 178, - 137, 139, 131, 133, 146, 152, 121, 147, 142, 143, - 129, 136, 149, 145, 197, 114, 103, 141, 124, 140, - 141, 140, 129, 129, 127, 130, 131, 124, 123, 117, - 150, 139, 120, 109, 119, 120, 163, 163, 117, 121, - 139, 139, 136, 136, 94, 74, 150, 145, 126, 127, - 147, 150, 158, 162, 84, 74, 136, 129, 140, 132, - 136, 135, 146, 145, 124, 116, 129, 120, 130, 129, - 130, 109, 122, 111, 160, 141, 135, 113, 131, 121, - 136, 135, 135, 135, 147, 147, 140, 140, 144, 145, - 139, 142, 131, 137, 145, 145, 143, 153, 48, 49, - 145, 143, 151, 147, 158, 146, 135, 124, 124, 116, - 159, 140, 131, 126, 123, 120, 103, 117, 113, 119, - 148, 146, 128, 124, 123, 126, 123, 120, 158, 141, - 148, 137, 146, 143, 125, 143, 89, 107, 116, 123, - 149, 147, 141, 139, 149, 153, 118, 121, 139, 138, - 105, 119, 168, 147, 139, 141, 143, 138, 133, 130, - 126, 126, 143, 142, 146, 144, 124, 123, 143, 145, - 149, 148, 147, 141, 151, 143, 118, 113, 175, 171 -}; - -static const uint8_t wmavoice_dq_lsp16r1[0x500] = { - 147, 145, 193, 168, 188, 156, 141, 145, 141, 139, - 148, 149, 148, 149, 153, 157, 144, 144, 152, 152, - 141, 145, 153, 143, 243, 134, 151, 133, 166, 135, - 150, 149, 135, 132, 32, 39, 110, 111, 109, 114, - 126, 127, 147, 146, 177, 169, 162, 156, 210, 187, - 141, 147, 95, 150, 127, 155, 108, 133, 139, 148, - 138, 138, 140, 140, 147, 146, 134, 130, 136, 134, - 147, 146, 142, 150, 62, 174, 126, 151, 122, 156, - 154, 156, 179, 184, 115, 107, 105, 99, 127, 124, - 146, 131, 140, 44, 132, 125, 156, 146, 153, 153, - 136, 137, 145, 144, 141, 139, 158, 152, 138, 132, - 145, 145, 147, 145, 146, 141, 144, 140, 110, 97, - 140, 141, 143, 142, 130, 123, 127, 117, 126, 120, - 147, 146, 161, 155, 169, 135, 122, 117, 166, 155, - 144, 144, 142, 142, 125, 122, 137, 128, 194, 172, - 127, 85, 148, 143, 153, 141, 147, 147, 140, 143, - 118, 140, 0, 69, 51, 60, 111, 123, 137, 135, - 146, 146, 164, 165, 207, 214, 145, 143, 149, 147, - 178, 168, 197, 170, 134, 154, 148, 159, 115, 140, - 103, 118, 13, 38, 139, 138, 135, 138, 140, 141, - 144, 144, 140, 140, 150, 150, 156, 157, 164, 171, - 143, 143, 140, 142, 118, 120, 172, 172, 160, 163, - 146, 147, 150, 151, 176, 176, 230, 237, 153, 153, - 168, 156, 173, 149, 164, 148, 162, 146, 178, 158, - 147, 145, 143, 145, 111, 126, 111, 130, 89, 118, - 153, 158, 122, 120, 142, 125, 124, 105, 148, 138, - 145, 144, 156, 151, 193, 154, 146, 147, 119, 135, - 142, 141, 145, 145, 152, 147, 142, 141, 146, 146, - 139, 138, 154, 154, 148, 150, 147, 149, 144, 145, - 134, 134, 141, 140, 135, 134, 145, 147, 160, 163, - 144, 145, 149, 146, 115, 67, 127, 119, 141, 135, - 145, 141, 130, 124, 143, 144, 151, 165, 141, 144, - 154, 152, 160, 136, 115, 82, 64, 71, 64, 65, - 143, 143, 151, 149, 240, 251, 165, 173, 173, 179, - 148, 134, 156, 55, 160, 105, 133, 91, 129, 96, - 149, 149, 145, 144, 160, 154, 171, 159, 140, 142, - 154, 163, 178, 244, 147, 140, 153, 150, 137, 121, - 145, 144, 145, 146, 138, 139, 149, 152, 189, 198, - 148, 148, 156, 158, 168, 182, 165, 182, 172, 201, - 143, 142, 99, 92, 152, 152, 143, 143, 127, 127, - 165, 148, 173, 124, 113, 122, 134, 142, 127, 142, - 124, 126, 137, 137, 131, 132, 144, 142, 141, 138, - 172, 176, 138, 111, 152, 136, 167, 154, 156, 137, - 140, 150, 78, 145, 158, 157, 161, 154, 155, 147, - 153, 164, 156, 191, 129, 109, 153, 146, 153, 141, - 138, 137, 141, 138, 115, 94, 144, 141, 155, 147, - 144, 142, 144, 137, 168, 113, 141, 134, 145, 137, - 146, 144, 150, 148, 140, 155, 103, 178, 137, 149, - 145, 147, 148, 153, 175, 201, 138, 146, 110, 108, - 143, 146, 124, 134, 124, 127, 164, 158, 127, 135, - 145, 146, 150, 150, 145, 147, 95, 80, 150, 151, - 149, 149, 162, 162, 144, 152, 170, 169, 145, 154, - 145, 149, 143, 146, 142, 145, 152, 146, 160, 98, - 141, 141, 153, 153, 140, 137, 131, 131, 145, 146, - 133, 132, 127, 124, 158, 150, 173, 164, 178, 167, - 146, 146, 154, 155, 117, 127, 143, 147, 147, 156, - 142, 143, 144, 145, 146, 152, 170, 199, 151, 165, - 146, 147, 139, 140, 147, 149, 132, 134, 147, 149, - 138, 139, 142, 143, 162, 188, 145, 149, 160, 164, - 150, 150, 139, 139, 143, 142, 146, 146, 137, 138, - 142, 142, 141, 140, 152, 153, 164, 171, 110, 112, - 139, 139, 143, 143, 138, 138, 142, 142, 143, 143, - 137, 140, 142, 142, 145, 141, 149, 141, 182, 135, - 146, 146, 150, 150, 144, 145, 150, 151, 135, 137, - 137, 145, 51, 62, 68, 54, 69, 57, 62, 41, - 137, 139, 139, 144, 135, 150, 225, 232, 208, 197, - 136, 135, 141, 143, 145, 150, 160, 169, 213, 247, - 142, 137, 72, 54, 110, 107, 105, 107, 127, 130, - 145, 143, 169, 155, 219, 174, 195, 164, 183, 157, - 155, 157, 239, 232, 169, 164, 170, 172, 156, 159, - 142, 143, 136, 144, 59, 100, 139, 142, 130, 138, - 147, 146, 150, 161, 128, 235, 143, 155, 146, 167, - 154, 149, 128, 151, 42, 149, 55, 136, 59, 127, - 128, 126, 74, 92, 143, 153, 140, 150, 166, 176, - 146, 152, 150, 145, 140, 100, 140, 105, 124, 59, - 195, 191, 146, 148, 144, 136, 136, 133, 129, 122, - 133, 148, 40, 147, 102, 140, 123, 148, 118, 136, - 143, 143, 150, 148, 184, 153, 160, 147, 166, 149, - 58, 68, 127, 135, 141, 145, 143, 147, 150, 151, - 140, 143, 137, 137, 120, 114, 71, 65, 125, 123, - 153, 148, 215, 159, 136, 135, 150, 146, 150, 150, - 148, 138, 166, 94, 150, 145, 145, 139, 147, 145, - 146, 147, 150, 139, 171, 63, 158, 142, 153, 133, - 147, 148, 143, 143, 76, 72, 155, 159, 164, 176, - 149, 149, 173, 195, 145, 165, 138, 144, 150, 167, - 180, 169, 146, 151, 146, 166, 147, 166, 149, 171, - 157, 156, 168, 166, 147, 149, 121, 122, 116, 124, - 145, 145, 147, 148, 172, 189, 168, 180, 144, 146, - 139, 145, 141, 150, 115, 172, 141, 146, 143, 148, - 145, 145, 142, 143, 145, 147, 138, 143, 58, 73, - 141, 142, 146, 145, 163, 149, 218, 161, 147, 132, - 152, 147, 146, 147, 140, 150, 141, 152, 89, 150, - 78, 134, 135, 137, 139, 142, 140, 137, 137, 130, - 144, 144, 152, 151, 145, 140, 181, 170, 191, 168, - 164, 166, 136, 148, 112, 124, 139, 144, 146, 149, - 142, 151, 113, 182, 137, 150, 143, 156, 138, 147, - 154, 156, 108, 102, 118, 119, 133, 139, 113, 111, - 145, 144, 150, 147, 175, 151, 104, 106, 116, 114, - 143, 144, 151, 157, 151, 191, 135, 113, 138, 123, - 146, 146, 155, 157, 106, 145, 132, 127, 140, 125, - 161, 165, 146, 150, 151, 154, 139, 140, 142, 143, - 144, 148, 145, 149, 147, 138, 168, 104, 146, 136, - 138, 140, 91, 108, 111, 110, 145, 140, 158, 154, - 130, 112, 122, 118, 136, 135, 119, 118, 141, 140, - 147, 146, 146, 145, 138, 138, 182, 188, 132, 132, - 144, 144, 156, 155, 168, 172, 123, 128, 144, 151, - 142, 140, 145, 145, 137, 144, 141, 152, 128, 188, - 149, 149, 160, 161, 160, 160, 166, 163, 130, 107, - 143, 143, 142, 142, 149, 149, 132, 132, 170, 174, - 148, 148, 154, 153, 118, 111, 157, 155, 114, 109, - 140, 139, 138, 137, 205, 187, 137, 133, 147, 144, - 144, 145, 147, 149, 105, 125, 108, 117, 155, 162, - 146, 146, 162, 157, 144, 122, 154, 143, 161, 139, - 141, 142, 130, 131, 144, 144, 142, 141, 144, 142, - 132, 132, 141, 141, 150, 151, 139, 141, 151, 153, - 142, 142, 154, 154, 150, 150, 148, 148, 166, 165, - 143, 142, 144, 144, 132, 132, 142, 144, 130, 128, - 142, 142, 143, 143, 153, 153, 147, 142, 129, 125, - 142, 141, 143, 142, 143, 147, 105, 122, 135, 140, - 141, 140, 140, 140, 151, 151, 156, 155, 146, 146, - 133, 134, 140, 142, 142, 145, 141, 146, 112, 133, - 142, 142, 145, 145, 137, 138, 155, 157, 149, 150, - 144, 144, 139, 138, 130, 128, 132, 131, 147, 147, - 139, 140, 142, 143, 115, 121, 141, 143, 137, 141, - 146, 146, 150, 150, 145, 144, 133, 133, 133, 135, - 143, 144, 144, 144, 166, 167, 139, 142, 139, 140, - 150, 149, 138, 138, 142, 140, 148, 147, 160, 155, - 146, 146, 147, 147, 138, 137, 143, 142, 151, 150 -}; - -static const uint8_t wmavoice_dq_lsp16r2[0x500] = { - 98, 98, 119, 121, 109, 112, 128, 135, 115, 121, - 159, 113, 113, 106, 127, 114, 101, 102, 105, 111, - 161, 162, 137, 138, 161, 159, 152, 150, 150, 148, - 128, 79, 131, 102, 142, 120, 133, 119, 130, 117, - 121, 115, 142, 133, 186, 155, 179, 144, 169, 135, - 107, 103, 106, 106, 122, 122, 111, 112, 112, 115, - 127, 123, 118, 115, 128, 125, 123, 119, 115, 109, - 124, 130, 117, 126, 121, 133, 84, 144, 99, 114, - 122, 125, 123, 131, 124, 135, 176, 200, 158, 176, - 68, 74, 86, 87, 117, 115, 119, 116, 135, 128, - 115, 116, 102, 104, 119, 123, 133, 148, 102, 109, - 71, 121, 106, 117, 107, 127, 106, 122, 100, 110, - 117, 115, 129, 128, 87, 84, 116, 116, 151, 157, - 116, 128, 110, 117, 119, 134, 100, 114, 120, 129, - 142, 141, 146, 151, 94, 91, 114, 114, 118, 118, - 114, 112, 112, 109, 115, 112, 123, 123, 147, 148, - 110, 164, 106, 152, 110, 158, 106, 151, 105, 135, - 85, 51, 71, 27, 71, 34, 74, 45, 85, 53, - 145, 134, 140, 130, 136, 134, 118, 122, 118, 126, - 117, 84, 121, 81, 106, 80, 109, 106, 121, 127, - 95, 94, 112, 110, 90, 94, 109, 107, 114, 109, - 117, 118, 118, 123, 107, 107, 86, 93, 29, 31, - 125, 112, 104, 60, 121, 111, 127, 116, 133, 130, - 118, 117, 148, 145, 122, 126, 124, 127, 90, 91, - 113, 110, 119, 118, 152, 147, 115, 112, 132, 131, - 129, 140, 98, 112, 73, 85, 109, 115, 122, 126, - 123, 122, 122, 122, 126, 125, 137, 140, 203, 210, - 164, 176, 114, 114, 125, 122, 119, 112, 125, 120, - 124, 122, 118, 115, 95, 96, 141, 144, 132, 131, - 127, 130, 132, 134, 116, 114, 122, 123, 137, 134, - 111, 111, 112, 116, 106, 118, 77, 101, 104, 115, - 111, 111, 125, 126, 118, 121, 113, 115, 113, 113, - 171, 170, 202, 199, 221, 206, 199, 184, 177, 167, - 73, 90, 61, 93, 43, 74, 51, 71, 51, 72, - 130, 130, 140, 137, 134, 132, 164, 160, 118, 111, - 123, 136, 133, 154, 130, 158, 106, 110, 110, 114, - 97, 97, 91, 94, 70, 69, 125, 123, 141, 140, - 119, 100, 116, 77, 111, 67, 105, 52, 95, 34, - 100, 122, 90, 124, 68, 120, 43, 117, 50, 112, - 130, 129, 192, 188, 123, 118, 124, 117, 121, 115, - 122, 111, 129, 111, 157, 85, 125, 109, 125, 119, - 143, 152, 119, 128, 114, 116, 129, 136, 148, 157, - 119, 117, 115, 115, 150, 148, 163, 154, 109, 102, - 120, 126, 73, 119, 106, 121, 102, 122, 96, 113, - 84, 83, 117, 115, 122, 117, 154, 143, 159, 142, - 118, 122, 114, 117, 115, 122, 114, 130, 99, 156, - 123, 120, 122, 116, 100, 81, 99, 91, 121, 112, - 139, 131, 164, 142, 132, 119, 145, 133, 157, 141, - 112, 109, 118, 116, 142, 134, 108, 110, 96, 99, - 111, 110, 113, 112, 111, 104, 98, 94, 131, 131, - 115, 114, 121, 118, 120, 115, 173, 148, 123, 117, - 121, 124, 122, 124, 140, 146, 78, 82, 96, 93, - 86, 90, 124, 125, 121, 123, 105, 106, 134, 135, - 107, 109, 132, 141, 100, 95, 113, 114, 102, 105, - 113, 130, 98, 145, 116, 115, 124, 117, 115, 105, - 120, 123, 89, 87, 109, 108, 102, 101, 117, 117, - 113, 122, 132, 138, 77, 116, 86, 99, 118, 126, - 123, 120, 117, 111, 124, 119, 129, 118, 63, 58, - 141, 135, 108, 106, 109, 111, 108, 110, 135, 138, - 117, 114, 134, 127, 139, 129, 138, 130, 126, 122, - 121, 118, 124, 121, 133, 130, 98, 85, 130, 123, - 147, 129, 118, 112, 148, 130, 136, 123, 148, 131, - 113, 112, 123, 118, 123, 115, 147, 95, 117, 110, - 118, 119, 112, 113, 112, 113, 119, 119, 120, 120, - 158, 133, 198, 145, 188, 129, 197, 137, 195, 133, - 132, 140, 140, 139, 158, 156, 223, 217, 233, 233, - 48, 56, 34, 37, 82, 84, 102, 102, 108, 110, - 120, 142, 136, 169, 146, 195, 136, 186, 140, 182, - 196, 186, 158, 155, 142, 134, 132, 125, 120, 119, - 97, 105, 72, 75, 82, 85, 81, 84, 107, 109, - 67, 121, 43, 119, 69, 124, 87, 129, 88, 128, - 53, 57, 93, 98, 91, 94, 93, 98, 104, 104, - 124, 123, 133, 133, 182, 181, 119, 121, 114, 116, - 128, 105, 134, 112, 131, 72, 119, 59, 111, 84, - 132, 142, 145, 180, 124, 132, 131, 143, 122, 134, - 88, 85, 103, 103, 136, 140, 131, 143, 114, 132, - 116, 57, 113, 57, 121, 76, 126, 80, 118, 86, - 127, 112, 127, 97, 131, 100, 149, 91, 163, 86, - 122, 119, 128, 121, 128, 116, 142, 127, 173, 139, - 162, 116, 166, 107, 149, 103, 152, 107, 141, 108, - 114, 113, 118, 116, 56, 43, 90, 90, 105, 105, - 132, 134, 110, 107, 106, 105, 82, 84, 84, 84, - 102, 106, 79, 89, 99, 99, 127, 129, 114, 118, - 139, 157, 116, 123, 116, 123, 87, 89, 110, 113, - 119, 126, 97, 97, 155, 163, 142, 153, 143, 146, - 117, 114, 66, 67, 125, 126, 127, 128, 114, 113, - 111, 114, 127, 133, 123, 132, 143, 162, 133, 148, - 105, 108, 114, 114, 110, 109, 57, 48, 109, 106, - 113, 130, 104, 131, 88, 139, 102, 169, 100, 172, - 129, 114, 150, 97, 114, 112, 117, 119, 109, 116, - 92, 107, 96, 116, 90, 125, 101, 122, 125, 140, - 125, 133, 122, 129, 136, 153, 125, 135, 131, 139, - 84, 71, 129, 123, 135, 120, 114, 103, 112, 101, - 108, 121, 115, 156, 106, 123, 116, 131, 127, 139, - 137, 147, 109, 117, 119, 126, 135, 144, 117, 119, - 120, 127, 76, 105, 111, 116, 120, 125, 141, 138, - 107, 104, 162, 155, 135, 130, 127, 123, 127, 121, - 102, 104, 84, 87, 112, 115, 97, 102, 78, 82, - 119, 118, 120, 123, 91, 105, 114, 119, 119, 126, - 130, 126, 134, 126, 158, 134, 133, 99, 116, 100, - 125, 122, 145, 143, 126, 117, 98, 96, 121, 120, - 152, 148, 131, 126, 130, 129, 126, 119, 87, 87, - 131, 131, 139, 137, 101, 102, 104, 105, 86, 83, - 92, 89, 111, 105, 121, 115, 137, 124, 96, 84, - 100, 96, 122, 119, 107, 108, 93, 96, 79, 82, - 128, 123, 108, 106, 123, 120, 150, 150, 143, 140, - 121, 120, 97, 99, 79, 80, 116, 116, 88, 90, - 128, 131, 101, 97, 140, 140, 117, 116, 116, 118, - 137, 135, 100, 91, 115, 112, 134, 121, 107, 99, - 120, 122, 122, 125, 124, 126, 136, 141, 89, 95, - 103, 119, 103, 116, 122, 139, 125, 137, 152, 170, - 121, 122, 124, 124, 98, 97, 137, 140, 96, 92, - 115, 113, 136, 136, 128, 132, 122, 124, 151, 158, - 100, 107, 121, 131, 131, 158, 119, 130, 113, 114, - 114, 109, 148, 130, 103, 95, 127, 116, 137, 120, - 103, 108, 97, 97, 133, 128, 113, 109, 136, 128, - 125, 124, 118, 118, 122, 121, 101, 99, 157, 152, - 138, 134, 124, 115, 113, 101, 123, 112, 124, 110, - 116, 113, 128, 121, 119, 110, 124, 113, 128, 67, - 114, 118, 114, 123, 109, 121, 102, 123, 56, 116, - 117, 111, 112, 99, 124, 114, 112, 79, 114, 88, - 112, 113, 115, 117, 126, 127, 130, 132, 123, 122, - 111, 104, 111, 102, 112, 102, 129, 118, 129, 115, - 123, 124, 130, 133, 114, 117, 125, 127, 112, 117, - 124, 125, 119, 120, 117, 116, 105, 104, 110, 110, - 125, 124, 118, 116, 124, 123, 124, 121, 133, 132, - 111, 111, 124, 124, 120, 119, 116, 116, 134, 130, - 114, 116, 112, 113, 109, 111, 116, 118, 95, 98 -}; - -static const uint8_t wmavoice_dq_lsp16r3[0x600] = { - 84, 82, 95, 94, 125, 131, 98, 102, 94, 93, 104, 104, - 127, 113, 87, 77, 125, 114, 109, 94, 94, 91, 106, 105, - 168, 125, 163, 120, 128, 100, 119, 99, 108, 97, 108, 106, - 86, 85, 128, 125, 79, 73, 103, 102, 123, 123, 116, 117, - 84, 76, 135, 131, 133, 133, 129, 130, 125, 123, 115, 114, - 94, 97, 79, 81, 115, 115, 94, 93, 128, 127, 126, 125, - 124, 111, 105, 114, 104, 117, 109, 110, 124, 125, 118, 117, - 107, 110, 106, 110, 93, 93, 149, 148, 118, 119, 111, 110, - 147, 157, 143, 156, 134, 136, 118, 121, 106, 107, 105, 105, - 114, 83, 114, 46, 106, 53, 110, 83, 107, 94, 105, 103, - 92, 90, 109, 106, 172, 160, 114, 110, 109, 110, 110, 109, - 90, 98, 98, 109, 102, 98, 97, 92, 100, 100, 101, 102, - 123, 117, 124, 98, 82, 80, 117, 115, 112, 110, 109, 108, - 107, 111, 100, 115, 105, 120, 104, 105, 83, 82, 95, 96, - 109, 120, 72, 71, 97, 104, 69, 74, 99, 102, 118, 117, - 137, 133, 142, 135, 105, 110, 121, 121, 125, 122, 114, 112, - 151, 186, 115, 132, 103, 111, 100, 104, 99, 101, 104, 105, - 18, 38, 56, 65, 76, 83, 85, 91, 101, 103, 108, 110, - 144, 135, 126, 121, 115, 113, 79, 80, 118, 117, 117, 117, - 117, 124, 115, 115, 126, 113, 130, 116, 112, 106, 108, 105, - 77, 76, 76, 80, 109, 109, 125, 129, 130, 133, 116, 118, - 96, 86, 109, 99, 102, 69, 84, 69, 107, 103, 114, 113, - 78, 118, 82, 114, 84, 129, 69, 112, 78, 98, 96, 103, - 89, 137, 96, 111, 105, 97, 93, 93, 101, 105, 105, 105, - 141, 123, 102, 93, 91, 79, 87, 81, 102, 99, 109, 108, - 94, 92, 124, 123, 130, 134, 100, 107, 71, 75, 92, 91, - 94, 104, 107, 83, 106, 101, 113, 114, 122, 122, 114, 114, - 118, 124, 103, 106, 95, 116, 90, 93, 107, 104, 109, 107, - 116, 118, 76, 72, 88, 88, 132, 132, 140, 141, 116, 116, - 90, 81, 111, 95, 139, 97, 123, 96, 112, 100, 110, 108, - 112, 116, 133, 140, 112, 120, 80, 85, 55, 55, 85, 84, - 125, 94, 111, 104, 116, 103, 112, 86, 93, 84, 99, 98, - 180, 179, 197, 197, 169, 163, 149, 146, 130, 124, 116, 115, - 76, 47, 36, 11, 43, 28, 66, 53, 82, 80, 102, 99, - 119, 123, 176, 201, 113, 120, 112, 111, 103, 105, 106, 110, - 145, 114, 112, 89, 120, 93, 123, 104, 131, 123, 113, 111, - 97, 109, 82, 106, 75, 104, 103, 115, 120, 124, 111, 114, - 114, 111, 113, 105, 34, 33, 63, 63, 105, 106, 122, 122, - 51, 41, 96, 92, 125, 125, 118, 118, 118, 119, 113, 113, - 111, 180, 108, 178, 107, 171, 110, 160, 105, 136, 102, 117, - 76, 79, 90, 92, 80, 88, 88, 93, 123, 124, 122, 122, - 131, 128, 123, 122, 151, 158, 108, 107, 129, 128, 119, 119, - 97, 99, 114, 120, 121, 125, 151, 157, 82, 89, 95, 96, - 128, 94, 130, 95, 149, 113, 149, 120, 127, 115, 113, 109, - 167, 171, 83, 80, 84, 79, 106, 106, 112, 110, 107, 108, - 130, 139, 81, 88, 107, 106, 112, 112, 119, 118, 114, 112, - 108, 105, 100, 98, 120, 116, 122, 117, 38, 37, 72, 73, - 118, 125, 110, 120, 114, 126, 135, 142, 139, 142, 118, 119, - 119, 119, 156, 145, 78, 75, 94, 94, 112, 110, 113, 113, - 101, 108, 98, 104, 103, 109, 117, 118, 167, 167, 132, 132, - 116, 108, 118, 111, 149, 136, 85, 74, 95, 92, 113, 112, - 74, 69, 104, 107, 96, 100, 117, 121, 103, 105, 103, 103, - 110, 106, 111, 101, 82, 72, 96, 92, 132, 130, 120, 121, - 116, 113, 138, 139, 104, 103, 131, 131, 68, 69, 92, 92, - 97, 97, 146, 151, 122, 132, 97, 95, 117, 116, 115, 116, - 139, 134, 110, 110, 124, 129, 100, 110, 86, 91, 100, 102, - 116, 136, 88, 90, 137, 139, 103, 114, 114, 117, 111, 110, - 82, 83, 104, 102, 97, 99, 97, 97, 58, 56, 84, 84, - 83, 122, 76, 105, 112, 126, 120, 134, 112, 120, 108, 110, - 114, 128, 73, 90, 72, 76, 98, 100, 95, 96, 101, 102, - 101, 108, 118, 126, 94, 102, 81, 83, 138, 140, 131, 130, - 88, 100, 112, 124, 105, 106, 122, 123, 121, 121, 114, 114, - 76, 108, 73, 83, 93, 95, 110, 111, 98, 99, 103, 103, - 105, 112, 98, 108, 114, 95, 117, 98, 120, 116, 116, 115, - 231, 238, 150, 146, 124, 126, 115, 122, 117, 121, 112, 112, - 74, 73, 72, 74, 60, 61, 62, 61, 85, 85, 101, 101, - 67, 69, 50, 51, 83, 83, 110, 110, 118, 113, 112, 111, - 199, 124, 184, 115, 176, 117, 165, 120, 138, 115, 116, 114, - 52, 116, 36, 107, 49, 99, 72, 106, 91, 107, 104, 105, - 140, 138, 141, 135, 154, 147, 166, 159, 139, 136, 116, 115, - 130, 119, 180, 157, 183, 149, 136, 121, 119, 114, 111, 110, - 104, 129, 113, 154, 111, 148, 108, 132, 105, 117, 106, 111, - 114, 35, 99, 65, 113, 94, 110, 98, 111, 107, 107, 106, - 106, 110, 128, 135, 162, 175, 143, 155, 115, 116, 109, 109, - 168, 155, 112, 109, 125, 125, 126, 122, 126, 124, 111, 112, - 128, 96, 160, 77, 151, 77, 121, 80, 114, 94, 107, 103, - 97, 104, 101, 116, 56, 79, 74, 83, 92, 95, 104, 106, - 63, 68, 76, 77, 110, 107, 96, 90, 85, 83, 97, 96, - 116, 110, 46, 42, 103, 100, 122, 120, 102, 101, 104, 104, - 106, 101, 109, 98, 96, 61, 67, 35, 72, 61, 96, 93, - 88, 80, 81, 76, 113, 110, 144, 143, 88, 89, 93, 94, - 95, 96, 100, 101, 136, 132, 166, 160, 148, 147, 115, 116, - 80, 78, 130, 129, 120, 108, 91, 85, 95, 91, 104, 102, - 151, 147, 106, 109, 110, 110, 64, 69, 68, 67, 96, 96, - 90, 166, 97, 128, 99, 120, 104, 121, 109, 118, 105, 109, - 122, 138, 110, 143, 75, 97, 83, 94, 89, 94, 102, 103, - 136, 142, 103, 110, 83, 89, 99, 101, 138, 138, 120, 122, - 168, 88, 105, 90, 109, 107, 110, 111, 106, 105, 103, 102, - 68, 72, 102, 104, 92, 102, 65, 75, 89, 94, 106, 106, - 83, 74, 93, 85, 73, 66, 106, 102, 100, 92, 99, 97, - 93, 99, 101, 96, 116, 112, 125, 120, 88, 88, 96, 96, - 44, 98, 93, 115, 104, 116, 103, 107, 112, 113, 107, 107, - 93, 83, 105, 99, 93, 84, 127, 125, 141, 143, 117, 118, - 106, 103, 126, 121, 137, 123, 123, 114, 147, 142, 127, 123, - 103, 110, 89, 91, 121, 124, 66, 71, 68, 69, 96, 97, - 114, 105, 68, 65, 69, 67, 96, 94, 131, 130, 123, 121, - 111, 104, 130, 121, 95, 95, 72, 74, 88, 88, 105, 104, - 135, 124, 110, 98, 114, 111, 159, 158, 111, 113, 104, 106, - 103, 108, 94, 107, 55, 57, 115, 118, 121, 122, 111, 111, - 97, 99, 106, 111, 119, 126, 59, 62, 111, 112, 124, 125, - 86, 93, 100, 110, 118, 145, 113, 132, 120, 125, 112, 112, - 101, 115, 78, 149, 81, 114, 111, 121, 108, 112, 107, 108, - 104, 104, 94, 96, 84, 83, 135, 132, 71, 69, 88, 86, - 100, 98, 62, 60, 81, 80, 90, 89, 63, 66, 89, 90, - 123, 116, 108, 99, 90, 86, 91, 92, 65, 65, 88, 88, - 84, 79, 115, 109, 123, 111, 99, 99, 134, 136, 121, 123, - 127, 137, 84, 88, 104, 107, 128, 130, 74, 69, 89, 89, - 118, 112, 143, 132, 141, 131, 113, 113, 99, 102, 104, 105, - 117, 115, 100, 99, 131, 126, 90, 88, 145, 144, 128, 127, - 112, 114, 131, 133, 85, 84, 118, 119, 151, 152, 117, 117, - 110, 105, 162, 140, 116, 107, 140, 134, 124, 122, 113, 113, - 107, 110, 124, 133, 98, 103, 99, 107, 109, 113, 112, 112, - 115, 105, 82, 77, 125, 122, 133, 132, 118, 120, 113, 113, - 101, 88, 84, 80, 97, 99, 91, 91, 94, 94, 101, 100, - 121, 86, 139, 108, 106, 93, 103, 99, 112, 108, 108, 107, - 113, 83, 105, 102, 125, 125, 114, 115, 110, 112, 108, 109, - 93, 112, 113, 121, 125, 131, 101, 101, 107, 109, 111, 111, - 98, 102, 117, 126, 80, 84, 107, 109, 83, 84, 96, 97, - 132, 136, 112, 118, 94, 93, 121, 118, 99, 98, 102, 103, - 122, 127, 128, 133, 118, 104, 102, 88, 100, 94, 104, 102, - 115, 116, 102, 105, 140, 142, 135, 130, 90, 88, 100, 101, - 94, 86, 112, 112, 89, 121, 92, 101, 109, 108, 110, 112, - 99, 93, 129, 114, 109, 99, 131, 119, 102, 97, 103, 103, - 103, 116, 124, 101, 115, 95, 105, 101, 94, 91, 100, 100, - 113, 90, 94, 86, 92, 92, 117, 111, 106, 103, 106, 105, - 115, 99, 110, 91, 107, 104, 81, 90, 108, 113, 112, 113, - 113, 114, 93, 101, 101, 102, 101, 126, 93, 103, 104, 105, - 117, 106, 124, 107, 104, 119, 108, 133, 104, 111, 104, 106 -}; - -static const float wmavoice_lsp10_intercoeff_a[32][2][10] = { - { { 0.5108627081, 0.0480548441, -1.5099149644, 0.6736935377, - 0.7536551058, 0.7651474178, 0.8510628343, 0.6667704582, - 0.7576012611, 0.7091397047 }, - { 0.1351471841, -0.1965375543, -1.6313457787, 0.3218626380, - 0.4132472873, 0.4663473070, 0.5805781186, 0.3962165117, - 0.4818550050, 0.4907165468 } }, - { { 0.8556320667, 0.7774704993, -0.0175759494, -0.1882298589, - 0.1892164350, 0.4850396216, 0.6270319819, 0.6327089071, - 0.6513319910, 0.6075088978 }, - { 0.4374088347, 0.3505934179, -0.0762144327, -0.2830760479, - -0.0626451969, 0.1500318050, 0.2602472305, 0.2781780064, - 0.3167395592, 0.3596626520 } }, - { { 0.1899779737, 0.0650856197, 0.1699010432, 0.9122628570, - 0.9097705483, 0.7433397174, 0.6304935217, 0.5164704025, - 0.4174703658, 0.5215242505 }, - { 0.0704856217, 0.0169009864, 0.0188394487, 0.5587704182, - 0.5194473267, 0.3539164960, 0.2426626086, 0.1721164286, - 0.1371548772, 0.2594856918 } }, - { { 0.8858859241, 0.9100474715, 0.8921859264, 0.9332397878, - 1.0225475132, 1.0555013716, 1.0983552337, 1.1290244758, - 1.0363244414, 0.9277705550 }, - { 0.4810934663, 0.5782935023, 0.6835935414, 0.7650781870, - 0.9018090069, 0.9996321201, 1.0219936669, 1.0474705994, - 0.9109474719, 0.7774704993 } }, - { { 0.4359549880, 0.2275702953, 0.0993548632, 0.1763395071, - 0.1055856347, 0.1018471718, 0.1170087159, 0.1221317947, - 0.1834010482, 0.2988780141 }, - { 0.1573702693, 0.1041317880, 0.0506856143, 0.0781702399, - 0.0058932900, -0.0026913285, -0.0031067133, 0.0070702136, - 0.0116394460, 0.0566394627 } }, - { { 0.8528628349, 0.8028782010, 0.4680088460, 0.9055474699, - 1.3742399514, 1.1093629301, 0.4122780561, 0.4003703594, - 0.6360319853, 0.6415704489 }, - { 0.4252934456, 0.3823703527, 0.1676856577, 0.5241550207, - 1.1995706558, 0.9088013172, 0.1224087179, 0.0730471611, - 0.3071857095, 0.3772472739 } }, - { { 0.5508781075, 0.2829549313, -0.0022067130, 0.1042702496, - 1.0318244398, 1.3258476257, 1.3550630212, 0.9931936562, - 0.7195243239, 0.6807550788 }, - { 0.2679318488, 0.0960317850, -0.1357529163, -0.1291759908, - 0.6451012194, 0.9968628883, 0.9510321021, 0.6608166099, - 0.3799472749, 0.3735780418 } }, - { { 0.9967244267, 1.0255244374, 0.9800398052, 0.7939474285, - 0.8288397491, 0.8390166759, 0.8660166860, 0.9247936308, - 0.9127474725, 0.8684397638 }, - { 0.7921474278, 0.9416859448, 0.8547320664, 0.5348165631, - 0.6231550574, 0.6703012288, 0.6987550855, 0.8147858977, - 0.7406397164, 0.6496012211 } }, - { { 0.1439394951, -0.3193529844, -0.2024914026, -0.1854606271, - 0.0877240896, 0.1617318094, 0.3087087870, 0.3777318895, - 0.3910242021, 0.4797780812 }, - { -0.0157067180, -0.1778452396, -0.1554836929, -0.1759760082, - -0.0607759655, -0.0161221027, 0.0393317640, 0.0758856237, - 0.1163856387, 0.1947548985 } }, - { { 1.1021629274, 0.9958244264, 0.4658626914, 0.3089164793, - 0.3740626574, 0.2962472439, 0.3170857131, 0.2420395315, - 0.2649549246, 0.2936857045 }, - { 0.4700857699, 0.1809087396, 0.0311625302, 0.0106009841, - 0.0311625302, 0.0266625285, 0.0221625268, 0.0156548321, - 0.0551163852, 0.1010164022 } }, - { { 0.2925087810, 0.3418011069, 0.7339243293, 0.7322627902, - 0.7288704813, 0.7924935818, 0.7724166512, 0.7819012702, - 0.8325782120, 0.7954705060 }, - { 0.0559471548, -0.0456144214, -0.0462374985, -0.1005144417, - -0.0511528850, -0.0455451906, -0.0044220984, 0.0451471508, - 0.1232394874, 0.2085318267 } }, - { { 0.2230702937, -0.9052532017, 1.2441552877, 1.0825706124, - 0.9088705480, 0.8797243834, 0.8648397624, 0.8091089725, - 0.7633474171, 0.7468704879 }, - { -0.2030452490, -1.4167303145, 1.3542322516, 0.8369397521, - 0.6148473620, 0.5560704172, 0.5450627208, 0.4978473186, - 0.4200319052, 0.4904396236 } }, - { { 0.6088242829, 0.5965704322, 0.6547242999, 0.8554936051, - -0.2989298999, 0.2404472232, 0.3573780358, 0.7499166429, - 0.7691628039, 0.6824858487 }, - { 0.2582395375, 0.2721549273, 0.3462318778, 0.4820626974, - -0.4780299664, -0.0712990463, 0.0200163722, 0.4246703684, - 0.4660011530, 0.4172626734 } }, - { { 1.1749937236, 1.0773090720, 1.0566782951, 1.0249013603, - 0.9947167337, 0.9626628757, 0.9562244117, 0.9072782397, - 0.7654243410, 0.6448935270 }, - { 1.1595552564, 0.9340013266, 0.3959395885, 0.3693549633, - 0.3915780485, 0.3104395568, 0.3499011099, 0.2236933708, - 0.1638087332, 0.1811856627 } }, - { { 0.9572628736, 0.9389859438, 0.6619243026, 0.6849089265, - 0.7276935577, 0.7839781940, 0.7987243533, 0.7748397291, - 0.7101089358, 0.7277627885 }, - { 0.5809935033, 0.5575934947, 0.3544703424, 0.3636780381, - 0.3736472726, 0.4486242235, 0.4684934616, 0.4481396079, - 0.3456780314, 0.4478626847 } }, - { { 0.1259394884, 1.3096476197, 1.0794552267, 1.0009475052, - 0.9061013162, 0.9216782451, 0.8954397738, 0.9160013199, - 0.8575012982, 0.7479089499 }, - { -0.3689222336, 1.5293861628, 0.7323320210, 0.4102703631, - 0.3825780451, 0.2828164697, 0.2644010782, 0.2455010712, - 0.2482010722, 0.2335241437 } }, - { { 0.5380704105, 0.1600702703, -0.0657605827, -0.2390452623, - -0.3885837793, -0.4150299430, -0.3001760542, -0.1451683044, - 0.1312010288, 0.2798395455 }, - { 0.2074933648, 0.0560163856, -0.0956682861, -0.2893068194, - -0.3889991641, -0.3918376267, -0.3550068438, -0.2649375796, - -0.0554451942, 0.1167317927 } }, - { { 0.6092396677, 0.5101011693, 0.4012011290, 0.5416011810, - 0.5715781152, 0.6476627588, 0.6988243163, 0.7306012511, - 0.7531704903, 0.6534781456 }, - { 0.2060395181, 0.1409625709, 0.1024702489, 0.1834010482, - 0.1946856678, 0.2547779977, 0.3134857118, 0.3283011019, - 0.3837549686, 0.3501780331 } }, - { { 0.4516011477, 0.5351627171, 0.8068243563, 0.7049858570, - 0.7165473998, 0.6005858183, 0.4870473146, 0.2500010729, - 0.3132087886, 0.4462703764 }, - { 0.1053087115, 0.1348702610, 0.4457857609, 0.3499703407, - 0.3537780344, 0.2628780007, 0.1665087342, 0.0200856030, - 0.0329625309, 0.1525241137 } }, - { { 0.7058166265, 0.7305320203, 1.1684860289, 1.4524707496, - 1.3212091625, 1.2613245249, 1.1712552607, 1.1154552400, - 1.0487167537, 0.9153782427 }, - { 0.2286087573, 0.2851703167, 1.2016475797, 1.5154707730, - 1.2726091444, 1.1459167898, 0.9801090360, 0.9296397865, - 0.8490551412, 0.6772243083 } }, - { { 0.6686396897, 0.5728935003, 0.4734780788, 0.6970243156, - 0.5852165818, -0.0762836635, -0.2054683268, -0.1380375326, - 0.1282933354, 0.3467164934 }, - { 0.2925087810, 0.2344933748, 0.1677548885, 0.2747856975, - 0.2097087502, -0.2795452774, -0.3761222363, -0.3183837533, - -0.0834836662, 0.1482318044 } }, - { { 0.6559704542, 0.7737320364, 0.9867551923, 0.9912551939, - 0.9508936405, 0.9114320874, 0.8336859047, 0.7905551195, - 0.7672935724, 0.7532397211 }, - { 0.1843702793, 0.2565087676, 0.7571858764, 0.7545551062, - 0.6793704629, 0.5981627405, 0.5078165531, 0.4282011390, - 0.3948318958, 0.4502165318 } }, - { { 0.4430857599, 0.6102781296, 0.8485012949, 0.8573628366, - 0.9078320861, 0.9979705811, 1.0411013663, 1.0524552166, - 1.0194321275, 0.9023628533 }, - { 0.0070009828, 0.0084548295, 0.1613856554, 0.3484472632, - 0.4385857582, 0.5895088911, 0.6367935240, 0.6736935377, - 0.7026320100, 0.5924165845 } }, - { { 1.0532859862, 1.1059706211, 1.1311013997, 1.1250783205, - 1.0425552130, 0.9993551970, 0.9673013389, 0.9386397898, - 0.8836013079, 0.8336859047 }, - { 0.9791398048, 1.1481321752, 1.1275706291, 1.0082167387, - 0.8809705377, 0.8031551242, 0.7287320197, 0.6496704519, - 0.5211088657, 0.4734088480 } }, - { { -0.0251221061, -0.0443682671, 0.1282241046, 0.3850703537, - 0.4252934456, 0.4547857642, 0.4690473080, 0.4873242378, - 0.6001012027, 0.5882627368 }, - { -0.0562759638, -0.0246374905, 0.0070009828, 0.0971394777, - 0.1232394874, 0.1278779507, 0.1302317977, 0.1462241113, - 0.2073549032, 0.2446010709 } }, - { { 1.1749244928, 1.1155937016, 0.9236167073, 0.6288319826, - 0.6515396833, 0.5391781032, 0.5398011804, 0.4997165501, - 0.4066703618, 0.3998857439 }, - { 0.9403013289, 0.7346166372, 0.1841625869, 0.1319625676, - 0.1395087242, 0.0857856274, 0.0952702463, 0.0860625505, - 0.0829471648, 0.1132010221 } }, - { { 0.9047167003, 0.9840551913, 0.9933321178, 0.9360090196, - 0.9164859354, 0.9213320911, 0.8701705337, 0.8815936148, - 0.8414397538, 0.8188012838 }, - { 0.0961010158, -0.0147374868, 0.0202240646, 0.1002548635, - 0.1407548785, 0.1837472022, 0.1858241260, 0.2064549029, - 0.2228626013, 0.2859318554 } }, - { { 0.4034165144, 0.1918472052, 2.1959402561, 0.4763165414, - 0.6577012241, 0.7036704719, 0.6626858413, 0.7650089562, - 0.7702704966, 0.6543781459 }, - { 0.0940933228, -0.1222529113, 2.3491480052, 0.1385394931, - 0.3052472472, 0.3665857315, 0.3350857198, 0.4722319245, - 0.4313857555, 0.3846549690 } }, - { { 0.8215012848, 0.8613782227, 1.0399936736, 1.4082322717, - 0.4075011313, 0.4091626704, 0.5230473280, 0.6101396680, - 0.7510243356, 0.7237474024 }, - { 0.4810934663, 0.5670088828, 0.9207782447, 1.3007860780, - 0.0453548431, 0.0858548582, 0.1803548932, 0.2790087759, - 0.3974626660, 0.4581780732 } }, - { { 1.5921784937, 1.4987169206, 1.1321398616, 0.8235089779, - 0.6888550818, 0.6621319950, 0.6192089021, 0.6533396840, - 0.7196627855, 0.6549319923 }, - { 1.5911400318, 1.4768399894, 0.9358705580, 0.4674549997, - 0.3522549570, 0.3144549429, 0.2985318601, 0.3559241891, - 0.4061857462, 0.3958703578 } }, - { { 0.7975474298, 0.8712782264, 0.8974474669, 0.3008164763, - 0.5562088788, 0.6655935347, 0.8921166956, 1.0918475389, - 0.9544936419, 0.8554936051 }, - { 0.3769703507, 0.4930703938, 0.6619243026, -0.0382759571, - 0.1766856611, 0.3015780151, 0.5952550471, 0.8903859258, - 0.7395320237, 0.6205935180 } }, - { { 0.2206472158, 2.4467634261, 1.2920629978, 1.0239321291, - 0.9014628530, 0.8552166820, 0.8219859004, 0.9005628526, - 0.7614781857, 0.7763628066 }, - { -0.2722068131, 2.8967635930, 1.3039706945, 0.7695089579, - 0.6132550538, 0.5701242685, 0.5737935007, 0.6533396840, - 0.5422934890, 0.5150857866 } }, -}; - -static const float wmavoice_lsp10_intercoeff_b[32][2][10] = { - { { 0.4881048799, -0.1998192370, -0.3872502148, 0.0109423101, - 0.0406953394, 0.1788437665, 0.1673750877, 0.3409781158, - 0.4061202109, 0.5221177042 }, - { 0.1492218077, -0.1372330189, -0.2683691680, -0.0621950924, - -0.0624572337, -0.0068177581, -0.0076041818, 0.0680235624, - 0.1055752933, 0.1199930608 } }, - { { 0.7934338748, 0.0012430847, 0.4239458144, 0.5521328747, - 0.6497149467, 0.6423749924, 0.7170197070, 0.7169541717, - 0.7778364718, 0.8397018015 }, - { 0.2768190503, -0.0491535664, -0.0325731337, 0.0261465013, - 0.0469867289, 0.0649434030, 0.0781815350, 0.1031504869, - 0.1194687784, 0.2451654971 } }, - { { 0.7212139666, 0.1658677757, 0.0101558864, 0.5636015534, - 1.3175852597, 1.1911676526, 1.1266809106, 0.8230558336, - 0.8604109585, 0.8094900250 }, - { 0.3658815324, 0.0816549063, -0.2092563212, 0.1946377754, - 1.0856558084, 0.9491457641, 0.8461242616, 0.5193652213, - 0.5975488424, 0.5293265879 } }, - { { 0.9507186115, 0.9078585207, 0.8773190677, 0.8677509129, - 0.8024122119, 0.8127667904, 0.8246286809, 0.8779088855, - 0.9454102516, 0.9863698184 }, - { 0.6883807778, 0.6900191605, 0.7059442401, 0.6552854478, - 0.5843107104, 0.5553441048, 0.5887671113, 0.6494528055, - 0.7725936472, 0.7792782485 } }, - { { 0.2399882078, 0.1938513517, 0.4441962242, 0.4475385249, - 0.3055235147, 0.1745184362, 0.1174371839, 0.0679580271, - 0.0782470703, 0.1695377529 }, - { 0.0170370936, 0.0253600776, 0.2072205544, 0.1907711923, - 0.1096384823, 0.0327000320, -0.0134368241, -0.0461389422, - -0.0372916758, -0.0243156850 } }, - { { 0.5457104146, 0.3774812818, 0.5235594809, 0.2994287312, - 0.2394639254, 0.5731041729, 0.9971176088, 1.1646913886, - 0.9028123021, 0.7777709365 }, - { 0.2288472056, 0.1181580722, 0.2074171603, 0.0355180502, - -0.0024924278, 0.2596487999, 0.7474936247, 0.9103488624, - 0.5927647650, 0.4772915542 } }, - { { 0.6541713476, 0.6412608922, 0.7625012100, 0.7826205492, - 0.4839106202, 0.3311478198, 0.4577620327, 0.8572652638, - 0.9442306161, 0.8282986581 }, - { 0.2852075696, 0.2614837885, 0.4221763611, 0.4314823747, - 0.1434547007, 0.0435788929, 0.1397191882, 0.5525916219, - 0.6752081811, 0.5487250388 } }, - { { 0.6742251515, 1.0610800683, 1.0500701368, 0.9570100009, - 0.9325653315, 0.9243078828, 0.9148707986, 0.8317720294, - 0.7696445584, 0.6784849465 }, - { 0.2283884585, 0.9739181101, 0.5336519182, 0.4974764287, - 0.3998288214, 0.3674543798, 0.2719694376, 0.2608939707, - 0.2087934017, 0.1675716937 } }, - { { 0.3736146986, -1.5457833707, 0.9216864705, 0.7959242165, - 0.7358283401, 0.7233110964, 0.7271121442, 0.6852350831, - 0.6891672015, 0.6589554250 }, - { 0.1246460676, -1.7167649865, 0.7037160397, 0.4803061783, - 0.4694928527, 0.4654951990, 0.5208069980, 0.5305717587, - 0.5288023055, 0.5278192759 } }, - { { 1.0116009116, 0.9882703424, 0.8393741250, 0.8889843524, - 0.8934407532, 0.8906227350, 0.9222107530, 0.8973073363, - 0.9257496595, 0.9306648076 }, - { 0.5097970665, -0.0106843412, 0.1419473886, 0.2804890275, - 0.3719763160, 0.3694859743, 0.4640534222, 0.5034401417, - 0.5592106879, 0.6652468145 } }, - { { 0.9718209803, 0.7615181804, 0.2172474563, 0.4920369983, - 0.4310891628, 0.5038333535, 0.4668059051, 0.5339140594, - 0.4453758597, 0.4050061107 }, - { 0.6543679535, 0.1205173433, -0.0050483048, 0.1580035388, - 0.1308719218, 0.1700620353, 0.1740596890, 0.2179683447, - 0.1967349052, 0.1703897119 } }, - { { 0.7663022578, 0.4025157690, 1.3811545074, 1.1642981768, - 1.0709758997, 0.9812580645, 1.0092416406, 0.9089070857, - 0.7776398659, 0.8189926445 }, - { 0.3471384346, 0.0602248609, 1.3968829811, 1.0841484964, - 0.8940305710, 0.7313719392, 0.7345176339, 0.5304406881, - 0.4076275229, 0.4535677731 } }, - { { 0.1300854981, 0.1323136985, 0.7564064264, 0.7335346043, - 0.7924508452, 0.6039057672, 0.6896914840, 0.3694859743, - 0.2825861573, 0.3179096878 }, - { -0.0208423138, -0.0530856848, 0.3449102342, 0.3819376826, - 0.4466865659, 0.2807511687, 0.3842969537, 0.1144880950, - 0.0617321730, 0.0767397583 } }, - { { 0.7559476793, 0.8462553322, 0.6452585459, 1.1308751702, - 1.0606868565, 0.9498666525, 0.7425129414, 0.6221901178, - 0.6574481130, 0.6976212561 }, - { 0.3420922160, 0.4310236275, 0.2800958157, 0.9317133725, - 0.8210897744, 0.6144569516, 0.3227593005, 0.2464762032, - 0.2769501209, 0.3521846533 } }, - { { 0.7609938979, 0.6943444908, 1.1490939856, 0.4350868165, - 0.6101971567, 0.6246149242, 0.7370079756, 0.6522052884, - 0.6966382265, 0.7565374970 }, - { 0.3939306438, 0.3449102342, 0.9874839187, 0.0910919905, - 0.2804234922, 0.2888775468, 0.4060546756, 0.3284608722, - 0.3483836055, 0.4819445610 } }, - { { 0.7828826904, 1.1833034158, 1.9916158915, 0.8667678833, - 0.9218830764, 0.8856420517, 0.9373494089, 0.7415299118, - 0.7450032830, 0.7074515522 }, - { 0.4685098231, 1.1713104546, 1.9853245020, 0.6206828058, - 0.6664264500, 0.6033814847, 0.6089519858, 0.3784643114, - 0.4212588668, 0.3441893458 } }, - { { 0.4671335816, 0.4177199602, 0.0804097354, -0.1836975515, - -0.1802241802, -0.0775958896, -0.0250365734, 0.0884050429, - 0.2136430144, 0.3472039700 }, - { 0.1187478900, 0.1122598946, -0.0381436348, -0.2284581661, - -0.2302276194, -0.1738672554, -0.1350048184, -0.0547896028, - 0.0000634491, 0.0545888245 } }, - { { 0.5545576811, 0.4791920781, 0.8204999566, 0.8462553322, - 0.9212277234, 0.8946203887, 0.9659883380, 0.9137566984, - 0.9225384295, 0.9207034409 }, - { 0.1176993251, -0.0429277122, -0.0330318809, 0.0566859543, - 0.0983008742, 0.1593797803, 0.1732077301, 0.2320584357, - 0.2739354968, 0.3753186166 } }, - { { 0.7157745361, 0.6367389560, -1.2036890686, 0.7107283175, - 0.6885118484, 0.7332724631, 0.7436270416, 0.7113181353, - 0.5935511887, 0.6023984551 }, - { 0.3664058149, 0.3280676603, -1.3082178831, 0.3909815550, - 0.3641776145, 0.3926854730, 0.3898674548, 0.4086760879, - 0.3127979338, 0.3949792087 } }, - { { 1.0267395675, 1.0621941686, 1.0415505469, 0.9971176088, - 0.9764739871, 0.9904330075, 0.9591071308, 0.9338760376, - 0.9026156962, 0.9073997736 }, - { 0.9855833948, 1.0548542142, 0.9787021875, 0.8573307991, - 0.8360973597, 0.8193203211, 0.7386463583, 0.7038471103, - 0.6333966553, 0.6434235573 } }, - { { 0.6235008240, 0.7635497749, 0.8094900250, 0.7227212787, - -0.0610809922, -0.1357912421, -0.2359291911, 0.0800165236, - 0.3972729445, 0.5078965425 }, - { 0.2983146310, 0.4983939230, 0.4145742655, 0.3284608722, - -0.3203386664, -0.3495018780, -0.4734291434, -0.1808139980, - 0.1211071610, 0.2001427412 } }, - { { 0.8925887942, 0.8804647624, 0.6153089106, 0.6760601401, - 0.7887153327, 1.0065546930, 1.0829033256, 1.0347348750, - 0.9800128937, 0.9125770628 }, - { 0.5955827832, 0.6195687056, 0.2924164534, 0.3553958833, - 0.5417127609, 0.8713553548, 0.9977729619, 0.8817754686, - 0.7645328045, 0.6604627371 } }, - { { 1.1581378579, 1.0359145105, 0.7731179297, 0.6839243770, - 0.6839899123, 0.6664264500, 0.6910677254, 0.6579068601, - 0.6779606640, 0.6243527830 }, - { 1.1508634388, 0.8400294781, 0.2358594835, 0.2542749047, - 0.2484422624, 0.2620736063, 0.2676441073, 0.2713796198, - 0.3068997562, 0.3223005533 } }, - { { 0.1376220584, 1.2572927773, 0.8593623936, 0.6218624413, - 0.5128116906, 0.5393534899, 0.4436064065, 0.4334484339, - 0.4494390488, 0.4002220333 }, - { -0.1159995794, 1.2433337569, 0.4805027843, 0.2632532418, - 0.1769432425, 0.1868390739, 0.1555131972, 0.1530228555, - 0.1490252018, 0.1559064090 } }, - { { 0.1817273200, -0.0085216761, 0.0739872754, 0.1808098257, - 0.2770811915, 0.3344901204, 0.4292541742, 0.5404020548, - 0.5780193210, 0.5707449019 }, - { -0.0035409927, -0.0188107193, -0.0057691932, 0.0132360458, - 0.0560961366, 0.0534747243, 0.1002013981, 0.1737320125, - 0.1706518531, 0.1637706459 } }, - { { 0.9648087025, 1.0030813217, 0.9501943290, 0.8381944895, - 0.7545059025, 0.7621735334, 0.7121700943, 0.7328792512, - 0.7534573376, 0.7414643764 }, - { 0.1872322857, -0.0081939995, 0.0663851798, 0.0963348150, - 0.0509188473, 0.0565548837, 0.0471833348, 0.0809340179, - 0.1049199402, 0.1751082540 } }, - { { 0.6792713702, 0.9521603882, 0.5296542645, 0.3657504618, - 0.3905883431, 0.3121425807, 0.2726903260, 0.3156159520, - 0.2859284580, 0.3179096878 }, - { 0.2307477295, 0.3771536052, 0.0743804872, 0.0260154307, - 0.0477731526, 0.0391880274, 0.0228042006, 0.0572757721, - 0.0337485969, 0.0492149293 } }, - { { 0.8649328947, 0.9505875409, 1.0443030298, 1.1704584956, - 1.2709241211, 1.3232212961, 1.2477901578, 1.1513877213, - 1.0346038043, 0.9695272446 }, - { 0.4620873630, 0.5685822368, 0.8975039423, 1.0476453304, - 1.2278674245, 1.2290470600, 1.1962138712, 1.0051129162, - 0.8706344664, 0.7477557659 } }, - { { 0.4188340604, 0.6011532843, 0.4726385474, 0.6389671564, - 0.6753392518, 0.7842589319, 0.6147846282, 0.6708828509, - 0.6406055391, 0.5398777723 }, - { 0.1012499630, 0.2312064767, 0.1773364544, 0.2800302804, - 0.3348177969, 0.4343003929, 0.2822584808, 0.3293128312, - 0.3024433553, 0.2401848137 } }, - { { 0.5049474537, 0.7943513691, 0.9536021650, 0.9407572448, - 0.9823721647, 0.9747045338, 1.0145500004, 0.9629737139, - 0.9526191354, 0.9283710718 }, - { 0.0566204190, 0.0973178446, 0.5812305510, 0.5687133074, - 0.6834000945, 0.6616423726, 0.7611905038, 0.6683925092, - 0.6463071108, 0.6118355393 } }, - { { 0.8969141245, 0.9359731674, 0.8756151497, 0.8419300020, - 0.8353109360, 0.6807131469, 0.3358008265, 0.3386188447, - 0.3524467945, 0.4495045841 }, - { 0.5298508704, 0.4606455863, 0.4934132397, 0.4415748119, - 0.4015327394, 0.2052544951, -0.0329663455, -0.0154684186, - 0.0418094397, 0.1631152928 } }, - { { 0.6345762908, 2.5209445655, 1.0373562872, 0.9166402519, - 0.8865595460, 0.8907538056, 0.8522190452, 0.7290782034, - 0.7385808229, 0.6345107555 }, - { 0.2641707361, 2.5696372986, 0.8539884984, 0.6532538533, - 0.6087553799, 0.5851626694, 0.5276226699, 0.4330552220, - 0.3971418738, 0.3599833548 } }, -}; - -static const float wmavoice_lsp16_intercoeff_a[32][2][16] = { - { { 0.5337238312, 0.4810695648, -0.3766536713, -0.1204767227, - -0.0898437500, -0.0070896149, 0.1134738922, 0.1337728500, - 0.3739156723, 0.3849058151, 0.4220180511, 0.5404901505, - 0.5224876404, 0.5502910614, 0.5313453674, 0.4405946732 }, - { 0.1775283813, 0.1679325104, -0.2702789307, -0.1359367371, - -0.1452455521, -0.0888595581, -0.0256662369, -0.0023736954, - 0.1074047089, 0.1431636810, 0.1357412338, 0.2045526505, - 0.2686481476, 0.3404531479, 0.3209333420, 0.1493968964 } }, - { { 0.7402400970, 0.0838251114, 0.6486282349, 0.6145095825, - 0.7331047058, 0.7183008194, 0.7436847687, 0.7627944946, - 0.7653779984, 0.7795667648, 0.8399305344, 0.8393154144, - 0.8219690323, 0.7474164963, 0.6681070328, 0.6490793228 }, - { 0.2850513458, -0.0544128418, -0.0300130844, 0.0204677582, - 0.0328931808, 0.0589332581, 0.0796422958, 0.1187639236, - 0.1320505142, 0.1539077759, 0.2189874649, 0.2865276337, - 0.2973947525, 0.2614307404, 0.2416648865, 0.2428951263 } }, - { { 0.6129922867, 0.7300701141, 0.2073822021, 0.5005893707, - 0.5713691711, 0.5374965668, 0.6293134689, 0.5639057159, - 0.7402811050, 0.6982889175, 0.4668397903, 0.6698703766, - 0.8758535385, 0.8678569794, 0.8678569794, 0.7810840607 }, - { 0.2986249924, 0.3269615173, 0.0096416473, 0.1800708771, - 0.2474060059, 0.2203407288, 0.3007984161, 0.2674179077, - 0.4424810410, 0.4046306610, 0.2063980103, 0.4230022430, - 0.6222190857, 0.6574449539, 0.6776618958, 0.6604385376 } }, - { { 0.7258052826, 0.5073966980, -0.3947381973, 0.5254812241, - 1.0561246872, 0.9706230164, 0.9727144241, 0.9185838699, - 0.8184833527, 0.9093980789, 0.8645353317, 0.7870302200, - 0.6347675323, 0.5123996735, 0.2846002579, 0.3252801895 }, - { 0.4306297302, 0.2182903290, -0.4902458191, 0.1783485413, - 0.7783365250, 0.7152252197, 0.7404451370, 0.6012639999, - 0.5421304703, 0.6619558334, 0.6316919327, 0.5596818924, - 0.3952398300, 0.3567333221, 0.1505041122, 0.1290159225 } }, - { { 0.3077287674, 0.2543363571, 0.2834520340, 0.5282287598, - 0.5350360870, 0.4943971634, 0.4521999359, 0.3086309433, - 0.2372770309, 0.0819387436, -0.1385612488, -0.0848407745, - -0.0380916595, 0.1192150116, 0.3228197098, 0.3012905121 }, - { 0.0567188263, 0.0196886063, 0.0682420731, 0.2102527618, - 0.2452325821, 0.2060699463, 0.1620273590, 0.0784120560, - 0.0418329239, -0.0508041382, -0.2193880081, -0.1644783020, - -0.1361827850, -0.0307512283, 0.1486587524, 0.2356367111 } }, - { { 0.4387903214, 0.5723943710, 0.6147556305, 0.9973602295, - 1.1645498276, 1.1898927689, 1.0326681137, 0.6939010620, - 0.6064310074, 0.4686441422, 0.4646663666, 0.4895582199, - 0.5654230118, 0.6004848480, 0.6179132462, 0.6439123154 }, - { 0.1324195862, 0.2426080704, 0.3132238388, 0.7359752655, - 0.9749288559, 0.9535636902, 0.8105278015, 0.4118890762, - 0.3013315201, 0.2006158829, 0.2331352234, 0.2535161972, - 0.3375005722, 0.4103307724, 0.4102897644, 0.4529380798 } }, - { { 0.7335557938, 0.9203472137, 0.4852113724, 0.8646993637, - 0.7304391861, 0.7503690720, 0.6289854050, 0.6900463104, - 0.6421079636, 0.5184278488, 0.4444904327, 0.2660236359, - 0.2143125534, 0.2406396866, 0.4836940765, 0.5597229004 }, - { 0.3689947128, 0.4967346191, 0.1176567078, 0.5127687454, - 0.3235168457, 0.3426265717, 0.2417469025, 0.3310623169, - 0.2629890442, 0.2130823135, 0.1329116821, 0.0468769073, - -0.0081968307, 0.0146446228, 0.2440433502, 0.3408632278 } }, - { { 0.9425325394, 0.9597969055, 0.6160678864, 0.7050962448, - 0.8063859940, 0.9063224792, 0.9890356064, 1.0038805008, - 1.0338163376, 0.9453620911, 0.9634056091, 0.8068370819, - 0.6859455109, 0.8909034729, 0.9990415573, 1.0122871399 }, - { 0.6895952225, 0.6451835632, 0.3169965744, 0.4268569946, - 0.5666122437, 0.7722673416, 0.8845882416, 0.9061584473, - 0.9550399780, 0.8118810654, 0.8601064682, 0.6129922867, - 0.5069866180, 0.7065315247, 0.7862920761, 0.7766551971 } }, - { { 0.5641517639, -0.0941905975, 0.0412998199, 0.1810550690, - 0.3459482193, 0.4213209152, 0.4401025772, 0.5397109985, - 0.5607891083, 0.6348905563, 0.6861915588, 0.7280607224, - 0.7267074585, 0.6447324753, 0.5948257446, 0.5475025177 }, - { 0.1906919479, -0.0519113541, -0.0608100891, -0.0018815994, - 0.0383062363, 0.0362558365, 0.0529870987, 0.0692672729, - 0.0953073502, 0.1327886581, 0.1390628815, 0.1904459000, - 0.2362518311, 0.2063980103, 0.2311668396, 0.2291574478 } }, - { { 0.9901428223, 0.9589767456, 0.9012374878, 0.8017930984, - 0.8929538727, 0.8512077332, 0.8790111542, 0.8832759857, - 0.8949632645, 0.9159183502, 0.9293279648, 0.9152622223, - 0.9247350693, 0.8753614426, 0.8730239868, 0.8066730499 }, - { 0.4230432510, -0.0464572906, 0.0182533264, 0.1159753799, - 0.2349395752, 0.2740612030, 0.2987070084, 0.3620643616, - 0.3923282623, 0.4694643021, 0.5202322006, 0.5356512070, - 0.5564012527, 0.5362663269, 0.4791831970, 0.5046901703 } }, - { { 0.9785375595, 0.8820457458, 0.3965110779, 0.4790191650, - 0.3907699585, 0.4195575714, 0.2938270569, 0.4091415405, - 0.3659191132, 0.4030723572, 0.4168510437, 0.5030908585, - 0.5023117065, 0.5511522293, 0.5354051590, 0.5563192368 }, - { 0.6592903137, 0.2933759689, 0.0562677383, 0.1286878586, - 0.0758285522, 0.1192560196, 0.0508956909, 0.1175336838, - 0.0684061050, 0.0988750458, 0.0923957825, 0.1819572449, - 0.1965150833, 0.2257537842, 0.3049812317, 0.2993221283 } }, - { { 0.7120265961, 0.7847747803, 0.6065950394, 0.7235908508, - 0.6740531921, 0.6535081863, 0.3734235764, 0.4788551331, - 0.4410867691, 0.6927528381, 1.0758495331, 1.1148891449, - 1.0708875656, 0.8896322250, 0.6401805878, 0.5057153702 }, - { 0.4210338593, 0.4763126373, 0.3229017258, 0.4079113007, - 0.3922462463, 0.3529195786, 0.1258993149, 0.2168960571, - 0.2207508087, 0.4605655670, 0.8759355545, 0.9526205063, - 0.8843832016, 0.7001342773, 0.4503545761, 0.3484086990 } }, - { { 0.5254402161, 0.5349540710, 0.7036199570, 0.6240234375, - 0.6464548111, 0.7537727356, 0.8311548233, 0.7334327698, - 0.3484907150, 0.1846637726, 0.0894021988, 0.3977823257, - 0.7672233582, 0.9224796295, 0.8818407059, 0.7453250885 }, - { 0.2587652206, 0.2524499893, 0.4135704041, 0.3129367828, - 0.3403711319, 0.4473199844, 0.5330266953, 0.4227561951, - 0.1080198288, -0.0044651031, -0.0727024078, 0.1583776474, - 0.5302381516, 0.7313823700, 0.6735610962, 0.5630855560 } }, - { { 0.7936325073, 0.8551034927, 0.9755849838, 0.8953323364, - 0.9345769882, 0.7202281952, 0.8388233185, 0.7941656113, - 0.7550849915, 0.7894906998, 0.8590402603, 0.7813711166, - 0.8483371735, 0.8652324677, 0.8586711884, 0.9584846497 }, - { 0.4781579971, 0.4731960297, 0.8289403915, 0.6175031662, - 0.7262973785, 0.3638277054, 0.5544328690, 0.4761896133, - 0.4388723373, 0.5021476746, 0.5630445480, 0.4562187195, - 0.5190429688, 0.5937595367, 0.6121721268, 0.6973457336 } }, - { { 1.0724458694, 1.0449705124, 0.8594503403, 0.7604160309, - 0.7837905884, 0.8136444092, 0.7623023987, 0.6098756790, - 0.6432561874, 0.6395244598, 0.6853713989, 0.7401580811, - 0.7399530411, 0.7652549744, 0.7675104141, 0.7393789291 }, - { 0.9382266998, 0.8419809341, 0.3087539673, 0.3620233536, - 0.3547649384, 0.4241094589, 0.2857894897, 0.2123851776, - 0.2355957031, 0.2794332504, 0.3219995499, 0.3898267746, - 0.3937635422, 0.4058198929, 0.4228382111, 0.4181222916 } }, - { { 1.0275421143, 1.0940570831, 1.0164289474, 0.9097671509, - 0.9400720596, 0.8976287842, 0.9175586700, 0.8900833130, - 0.9154262543, 0.9492578506, 1.0011329651, 1.0361537933, - 1.0359487534, 0.9320344925, 0.8974237442, 0.8811845779 }, - { 1.0046186447, 1.0860195160, 0.9442958832, 0.7473344803, - 0.7876043320, 0.7410602570, 0.7422084808, 0.6844692230, - 0.7256412506, 0.8455486298, 0.8969316483, 0.9362173080, - 0.9092340469, 0.8227071762, 0.7481546402, 0.7088689804 } }, - { { 0.2205047607, -0.0129537582, 0.0972347260, 0.1154832840, - 0.0951843262, 0.1532516479, 0.1288108826, 0.1749858856, - 0.1591157913, 0.2134923935, 0.2477340698, 0.2634811401, - 0.3032999039, 0.3272485733, 0.3170785904, 0.3172016144 }, - { 0.0032854080, -0.0446119308, 0.0284643173, 0.0155467987, - -0.0063104630, 0.0226001740, 0.0086984634, 0.0262088776, - 0.0173921585, 0.0360507965, 0.0366659164, 0.0215339661, - 0.0412178040, 0.1047391891, 0.1258172989, 0.0609836578 } }, - { { 0.1495609283, 0.3275766373, 0.8598194122, 0.6847562790, - 0.7550849915, 0.5662431717, 0.6930398941, 0.7526245117, - 0.7300291061, 0.7284708023, 0.6608896255, 0.5224056244, - 0.4273900986, 0.5757160187, 0.4625749588, 0.5123586655 }, - { -0.0352210999, -0.0428895950, 0.3110914230, 0.2699604034, - 0.3307752609, 0.2059469223, 0.2332172394, 0.3204412460, - 0.2846412659, 0.3354911804, 0.2448635101, 0.1514062881, - 0.1062564850, 0.2613077164, 0.2123441696, 0.3000602722 } }, - { { 0.6218910217, 0.6033554077, 0.4551525116, 0.3161764145, - 0.2864866257, 0.6195125580, 0.7577505112, 1.0062179565, - 0.8485012054, 0.6777849197, 0.7455301285, 0.3630485535, - 0.2327661514, 0.5563192368, 0.4448595047, 0.3806819916 }, - { 0.2624969482, 0.2679510117, 0.1839666367, 0.0335903168, - 0.0294075012, 0.2902593613, 0.4959144592, 0.7905979156, - 0.5748548508, 0.3753919601, 0.4855394363, 0.1089630127, - 0.0362968445, 0.3632535934, 0.2681150436, 0.2735691071 } }, - { { 0.7064495087, 0.4431781769, 0.7628355026, 0.7271585464, - 0.7812070847, 0.7806739807, 0.8909854889, 0.8958654404, - 0.9126787186, 0.9038209915, 0.9246120453, 0.9624624252, - 0.9732475281, 0.7420034409, 0.5060844421, 0.5189199448 }, - { 0.3457021713, -0.0149221420, 0.3174476624, 0.3580865860, - 0.4243965149, 0.4275541306, 0.5887155533, 0.6478490829, - 0.6320610046, 0.6627349854, 0.6868886948, 0.7396659851, - 0.7551259995, 0.5275316238, 0.3075237274, 0.3806819916 } }, - { { 0.4376831055, 0.4904603958, 0.6262788773, 0.5901098251, - 0.4176712036, 0.0221490860, -0.1612796783, -0.2236118317, - -0.1087894440, -0.0022506714, 0.1051902771, 0.3307752609, - 0.4167690277, 0.4997692108, 0.4645843506, 0.5228567123 }, - { 0.1228237152, 0.1671123505, 0.2931299210, 0.2549924850, - 0.1435737610, -0.1124801636, -0.2181987762, -0.2723293304, - -0.1573429108, -0.0837745667, -0.0325555801, 0.1024427414, - 0.1938495636, 0.2825498581, 0.2247285843, 0.2879629135 } }, - { { 0.6100807190, 0.7900238037, 0.9581155777, 0.8999662399, - 0.9277286530, 0.9720993042, 0.9966220856, 0.9630365372, - 0.9571723938, 0.8992280960, 0.8370189667, 0.7417984009, - 0.7174396515, 0.6122951508, 0.6746683121, 0.7030458450 }, - { 0.0859165192, 0.0914115906, 0.6077432632, 0.5471334457, - 0.5943746567, 0.6805324554, 0.6680250168, 0.6033554077, - 0.6302976608, 0.4874258041, 0.3647298813, 0.2770137787, - 0.2544183731, 0.2608156204, 0.3331537247, 0.4950942993 } }, - { { 0.4051227570, 1.1022176743, 0.8262338638, 0.6573219299, - 0.5948667526, 0.5426225662, 0.4987850189, 0.4370269775, - 0.4421119690, 0.3837165833, 0.3728494644, 0.3706760406, - 0.4169740677, 0.3559951782, 0.2994041443, 0.3896217346 }, - { 0.0716867447, 0.9253911972, 0.2780799866, 0.2460117340, - 0.1675224304, 0.1527595520, 0.1278266907, 0.1226596832, - 0.1165084839, 0.0982189178, 0.0952253342, 0.1113414764, - 0.1498889923, 0.0940361023, 0.0802984238, 0.1560811996 } }, - { { 0.7024717331, 0.7363853455, 0.9629545212, 0.9635286331, - 1.0819597244, 1.1529855728, 1.2984409332, 1.2693252563, - 1.2848672867, 1.2877378464, 1.2133083344, 1.0696573257, - 1.0864706039, 0.9851808548, 0.8312368393, 0.8047866821 }, - { 0.3001422882, 0.2273120880, 0.6279602051, 0.6936140060, - 0.8097076416, 0.9440498352, 1.1028738022, 1.1766471863, - 1.1199741364, 1.1608181000, 1.0665817261, 0.8872537613, - 0.9082908630, 0.7602519989, 0.6542053223, 0.7317514420 } }, - { { 0.0643463135, -0.6808919907, 0.2889881134, 0.6142225266, - 0.6356697083, 0.6825828552, 0.6259508133, 0.4945611954, - 0.5866651535, 0.6357517242, 0.5208883286, 0.4207878113, - 0.5125637054, 0.3758020401, 0.5424175262, 0.6172571182 }, - { -0.0636806488, -0.7585611343, 0.0850553513, 0.2996912003, - 0.3620643616, 0.4444084167, 0.4597454071, 0.3120756149, - 0.4016780853, 0.5026807785, 0.4111919403, 0.3183498383, - 0.3666572571, 0.1829824448, 0.3269205093, 0.4095926285 } }, - { { 0.9277286530, 0.9651279449, 0.9602069855, 0.9327726364, - 0.9208393097, 0.8868436813, 0.9011554718, 0.8569488525, - 0.9015245438, 0.8969726562, 0.9367094040, 0.9445009232, - 0.8617057800, 0.8215589523, 0.8333692551, 0.7939195633 }, - { 0.1719102859, 0.1142530441, 0.1245460510, 0.1646108627, - 0.1408672333, 0.0949792862, 0.0271930695, 0.0265779495, - -0.0064334869, -0.0109033585, 0.0152187347, 0.0252656937, - 0.0166950226, 0.0736141205, 0.1205682755, 0.1895437241 } }, - { { 0.5964250565, 0.6065130234, 0.7228116989, 0.7348270416, - 0.0718097687, 0.2369899750, 0.2456426620, 0.4961194992, - 0.6410417557, 0.6765956879, 0.6771287918, 0.7285938263, - 0.6706905365, 0.5105543137, 0.5068635941, 0.5430326462 }, - { 0.2782440186, 0.2620048523, 0.4424400330, 0.4124631882, - -0.1158838272, 0.0186223984, 0.0059919357, 0.1853609085, - 0.3568563461, 0.3791646957, 0.4100847244, 0.4654865265, - 0.4614677429, 0.3209743500, 0.3199081421, 0.3836755753 } }, - { { 0.8051557541, 0.8506336212, 0.9544658661, 0.5584516525, - 0.5874032974, 0.5727224350, 0.6177902222, 0.7659521103, - 0.9526205063, 1.0424280167, 1.0705595016, 1.0042905807, - 0.6005258560, 0.3886785507, 0.4739751816, 0.6542463303 }, - { 0.4775428772, 0.5541868210, 0.7128057480, 0.2146816254, - 0.2502765656, 0.2488822937, 0.3009214401, 0.4667987823, - 0.6929988861, 0.8599834442, 0.8784780502, 0.7463912964, - 0.3217535019, 0.1274986267, 0.2767267227, 0.5119485855 } }, - { { 0.5978193283, 0.5092830658, 1.0738401413, 0.7688636780, - 0.8214769363, 0.7682075500, 0.4970626831, 0.2783260345, - 0.2652854919, 0.3625154495, 0.5700569153, 0.5044031143, - 0.4003248215, 0.5162544250, 0.5727634430, 0.5538587570 }, - { 0.2752094269, 0.1747808456, 0.8557186127, 0.4280872345, - 0.5143680573, 0.4139804840, 0.1810960770, 0.0109539032, - 0.0317039490, 0.0842351913, 0.3129367828, 0.2614717484, - 0.1564092636, 0.2352676392, 0.3249931335, 0.3505821228 } }, - { { 0.7093610764, 0.7587757111, 1.8517618179, 1.0092525482, - 0.8078622818, 0.8792982101, 0.8210668564, 0.8600654602, - 0.6913585663, 0.6436662674, 0.6216859818, 0.6123771667, - 0.5940465927, 0.5910940170, 0.6505966187, 0.5801038742 }, - { 0.3370904922, 0.4681930542, 1.9236078262, 0.8053607941, - 0.5321245193, 0.6342344284, 0.5054693222, 0.5788326263, - 0.4400615692, 0.4086904526, 0.3924102783, 0.4220180511, - 0.3835115433, 0.4230432510, 0.5190839767, 0.3990535736 } }, - { { 0.6277141571, 1.1122236252, 1.0259838104, 0.9486427307, - 0.9184608459, 0.9059944153, 0.9080038071, 0.8282022476, - 0.8440313339, 0.7887935638, 0.7468013763, 0.6746683121, - 0.6319379807, 0.6246795654, 0.7263793945, 0.7349090576 }, - { 0.2427721024, 1.0851583481, 0.6180362701, 0.5837125778, - 0.4324750900, 0.4684801102, 0.3745307922, 0.3027257919, - 0.3646888733, 0.2409267426, 0.2158298492, 0.2052907944, - 0.2100887299, 0.2276401520, 0.3409452438, 0.4045896530 } }, - { { 0.8391513824, 0.8713426590, 1.1366233826, 1.1440868378, - 1.1443738937, 1.0877418518, 1.0516138077, 1.0099496841, - 0.9216184616, 0.8990640640, 0.9001302719, 0.8993101120, - 0.8055248260, 0.8150796890, 0.7272815704, 0.7196130753 }, - { 0.4634771347, 0.5807189941, 1.1287908554, 1.1066875458, - 1.0765056610, 0.9287538528, 0.8956193924, 0.8026132584, - 0.6725769043, 0.5856809616, 0.5527515411, 0.5183868408, - 0.4529380798, 0.5074377060, 0.4632720947, 0.5554990768 } }, -}; - -static const float wmavoice_lsp16_intercoeff_b[32][2][16] = { - { { 0.5431776047, -0.1212130189, -0.2471650839, 0.0683670044, - 0.1418520808, 0.2518971562, 0.3708084226, 0.4141484499, - 0.5712364912, 0.5852659345, 0.5670641661, 0.6401320100, - 0.6447737217, 0.6726239920, 0.4994724989, 0.5574678183 }, - { 0.2040718794, -0.1271064281, -0.2266163826, -0.0406349897, - -0.0145058036, 0.0283126831, 0.0851084590, 0.0913147926, - 0.1307432652, 0.1926501393, 0.2310355306, 0.2828245163, - 0.3171940446, 0.4424681067, 0.2960716486, 0.3510941863 } }, - { { 0.8073900938, 0.0403081179, 0.5392660499, 0.6928597689, - 0.6499369740, 0.7328097820, 0.7755761147, 0.7766191959, - 0.8820225596, 0.8423333168, 0.8898978233, 0.8488525748, - 0.8654375672, 0.6728326082, 0.6169234514, 0.6755967736 }, - { 0.3653843999, -0.0846008658, -0.0224332213, 0.1120721102, - 0.1020585299, 0.1741876006, 0.2129902244, 0.2160151601, - 0.3619422317, 0.4185815454, 0.5455245376, 0.5363975763, - 0.5429168344, 0.3505726457, 0.3296067119, 0.3620986938 } }, - { { 0.1843576431, 0.0179861784, 0.3122915626, 0.3600125313, - 0.2466817498, 0.2172668576, 0.1975526214, 0.1177569032, - 0.1196866035, 0.0849519968, 0.0962694287, 0.1591672301, - 0.2300446033, 0.3082756996, 0.4047607183, 0.3925045133 }, - { -0.0275964737, -0.0794897676, 0.1168181300, 0.1591150761, - 0.0915755630, 0.0460972190, 0.0562151074, 0.0084419847, - -0.0095511675, -0.0408957601, -0.0376100540, -0.0166962743, - 0.0656028390, 0.1226072311, 0.2293144464, 0.2142419219 } }, - { { 0.4781936407, -1.2478972673, 0.4884679914, 0.7755239606, - 0.6785174012, 0.6590117812, 0.6177057624, 0.6427918673, - 0.5402048230, 0.5512614846, 0.6424267888, 0.4229103327, - 0.5106334686, 0.5136062503, 0.4490395188, 0.4753251672 }, - { 0.2852236032, -1.3815159798, 0.1904075146, 0.4874770641, - 0.4593138695, 0.4182686210, 0.4174863100, 0.4604612589, - 0.4089330435, 0.3891666532, 0.4700576067, 0.2383370996, - 0.2801646590, 0.3398289084, 0.2766703367, 0.3374298215 } }, - { { 0.5925153494, 0.3858809471, 1.0754098296, 0.5752002001, - 0.5516265631, 0.4853909016, 0.4719351530, 0.5018194318, - 0.3037382960, 0.5154316425, 0.8809794784, 0.7755761147, - 0.5941321254, 0.3974069953, 0.5925675035, 0.6097261906 }, - { 0.3008176684, 0.0706617832, 0.8484353423, 0.2574254870, - 0.2815728188, 0.1930673718, 0.2523665428, 0.2691601515, - 0.1271967888, 0.2653007507, 0.6473292708, 0.5275835395, - 0.3928174376, 0.2405275702, 0.4008491635, 0.4556109309 } }, - { { 0.7339050174, 0.4290645123, 0.6859754324, 0.6349166036, - 0.8034263849, 0.8509387374, 0.8591269255, 1.1049811840, - 1.3928194642, 1.3423343301, 1.0849018693, 0.8943830729, - 0.8579795361, 0.6920774579, 0.5613272190, 0.4303162098 }, - { 0.4534726143, 0.0901674032, 0.3465046287, 0.3470261693, - 0.5217422843, 0.5874564052, 0.6014336944, 0.9161834717, - 1.2823571563, 1.2193550467, 0.8868207335, 0.6514494419, - 0.6249030232, 0.4453887343, 0.3665317893, 0.2242033482 } }, - { { 0.4293252826, 0.3303368688, 0.6181751490, 0.9884168506, - 0.9915460944, 0.7939864993, 0.3019129038, 0.2443348169, - 0.4543070793, 0.5617444515, 0.4895110726, 0.6600027084, - 0.6290231943, 0.5580936670, 0.5459417701, 0.4647378922 }, - { 0.1409133077, -0.0050137639, 0.2551307082, 0.6764833927, - 0.7112701535, 0.4648943543, 0.0301380754, -0.0235806108, - 0.1018499136, 0.2422486544, 0.2406318784, 0.4000146985, - 0.3713299632, 0.3259559274, 0.3820737004, 0.2888743877 } }, - { { 0.7733334899, 0.8321111202, 1.3098945022, 1.0331128836, - 1.0380675197, 0.9479974508, 0.9740223289, 0.9442945123, - 0.8926619887, 0.8719046712, 0.8640815616, 0.8404036164, - 0.8359183669, 0.7675965428, 0.6895219088, 0.7266034484 }, - { 0.3655408621, 0.4643206596, 1.2171645761, 0.8341451287, - 0.8387868404, 0.6713201404, 0.6814901829, 0.6294404268, - 0.5172048807, 0.5205948949, 0.5408828259, 0.5298783183, - 0.5781729817, 0.5000983477, 0.4727174640, 0.4326109886 } }, - { { 0.8902629018, 0.4598354101, 0.6392975450, 0.4483093619, - 0.6220867038, 0.6323089004, 0.7063676715, 0.3717993498, - 0.6718416810, 0.7876758575, 0.2807383537, 0.3118221760, - 0.6703813672, 0.7662405372, 0.7122610807, 0.7851724625 }, - { 0.6301705837, 0.1221378446, 0.3532846570, 0.1412783861, - 0.3471826315, 0.3435318470, 0.4466925859, 0.1390357614, - 0.4092981219, 0.5406742096, 0.0690450072, 0.0829179883, - 0.4625995755, 0.5700891018, 0.5542864203, 0.6545265317 } }, - { { -0.1100520492, 0.3803526163, 0.8075987101, 0.6903563738, - 0.8012359142, 0.7835035324, 0.8195941448, 0.8381088376, - 0.8033220768, 0.7511680126, 0.6393496990, 0.6096218824, - 0.6934856176, 0.6690253615, 0.6401841640, 0.5600233674 }, - { -0.1776958704, -0.0293175578, 0.1520742774, 0.1746048331, - 0.2222214937, 0.3052507639, 0.2977927327, 0.3797789216, - 0.3395681381, 0.2976884246, 0.2516885400, 0.2403711081, - 0.3567789793, 0.3302847147, 0.3368039727, 0.3310148716 } }, - { { 0.5587195158, 0.4676063657, 0.1392965317, -0.0990996957, - -0.0816280842, -0.1146416068, -0.0116894841, 0.0521992445, - 0.1626615524, 0.2923687100, 0.4029874802, 0.4528989196, - 0.4694839120, 0.5058352947, 0.5369191170, 0.5105291605 }, - { 0.2193530202, 0.1211469173, 0.0179861784, -0.2022604346, - -0.1409794092, -0.2121175528, -0.1152674556, -0.0594626069, - -0.0122110248, 0.0274260640, 0.1414870024, 0.2044369578, - 0.2167974710, 0.2615978122, 0.3348221183, 0.3707562685 } }, - { { 0.5948622823, 0.7065241337, 0.9414781928, 0.9340723157, - 0.8835350275, 0.9730835557, 0.8503650427, 0.8902629018, - 0.8746688366, 0.6910865307, 0.6404449344, 0.6976057887, - 0.5916287303, 0.6022160053, 0.7729684114, 0.6096740365 }, - { 0.1262058616, 0.1300652623, 0.6594290137, 0.6535877585, - 0.5639349222, 0.6982316375, 0.4828875065, 0.5577285886, - 0.4591052532, 0.2964367270, 0.2695252299, 0.3324751854, - 0.2860580683, 0.2902825475, 0.4623388052, 0.3369604349 } }, - { { 0.8821268678, 0.8539636731, 0.2898653150, 0.7478301525, - 0.5109463930, 0.8577187657, 0.4884679914, 0.7846509218, - 0.7684310079, 0.7032384276, 0.6691296697, 0.8593355417, - 0.9383489490, 0.9808023572, 0.6804992557, 0.6403927803 }, - { 0.5590324402, 0.4209806323, 0.0259135962, 0.4318808317, - 0.2104346752, 0.5453680754, 0.1783599257, 0.4467447400, - 0.4352708459, 0.4089330435, 0.3994410038, 0.5984609127, - 0.6872792840, 0.7321317792, 0.4408513308, 0.4542027712 } }, - { { 0.6371070743, 0.6311093569, 0.7152860165, 0.6929640770, - 0.2292101383, 0.3234525323, 0.9644259810, 0.9881039262, - 0.8722697496, 0.4370440841, 0.4051779509, 0.4944135547, - 0.5392660499, 0.5969484448, 0.4268740416, 0.4990552664 }, - { 0.4233797193, 0.3647063971, 0.4345406890, 0.4180078506, - -0.0006328225, 0.0586141944, 0.7620160580, 0.8152132034, - 0.6707985997, 0.2095480561, 0.2178405523, 0.2776612639, - 0.3142212629, 0.3808741570, 0.2676998377, 0.2804775834 } }, - { { 0.4509170651, 0.9490405321, 0.8557890654, 0.8271043301, - 0.6915559173, 0.7321839333, 0.6257896423, 0.6274064183, - 0.5238284469, 0.5194996595, 0.4116972089, 0.3382642865, - 0.3755022883, 0.4867990613, 0.5686287880, 0.5106856227 }, - { 0.0989292860, 0.6244857907, 0.4700576067, 0.3905226588, - 0.2630059719, 0.3009741306, 0.2150763869, 0.2067838907, - 0.1533781290, 0.1815934777, 0.1023714542, 0.0373874903, - 0.0897501707, 0.1849313378, 0.2852757573, 0.2625887394 } }, - { { 0.9954054952, 0.9554033279, 0.8237664700, 0.9780903459, - 0.7261862159, 0.7884581685, 0.7933084965, 0.7393290401, - 0.8783196211, 1.0409359932, 1.0217954516, 0.9159227014, - 0.8698185086, 0.7057939768, 0.7662926912, 0.7339571714 }, - { 0.7913266420, 0.6739278436, 0.5061482191, 0.7058982849, - 0.3480692506, 0.4338105321, 0.4428853393, 0.3758152127, - 0.5962182879, 0.7925261855, 0.7968549728, 0.6629754901, - 0.6325175166, 0.4598354101, 0.5310778618, 0.5518873334 } }, - { { 0.4638512731, 0.0604917407, 0.1897295117, 0.3403504491, - 0.4708399177, 0.5241413713, 0.6061275601, 0.6446694136, - 0.7313494682, 0.7208143473, 0.6268848777, 0.6081094146, - 0.4913364649, 0.3529717326, 0.4954566360, 0.5767126679 }, - { 0.1353849769, -0.0274400115, 0.0002537966, 0.0272174478, - 0.0555371046, 0.0652899146, 0.1010676026, 0.1073260903, - 0.1568724513, 0.2207611799, 0.1434167027, 0.2262373567, - 0.1177047491, 0.0162650943, 0.2529402375, 0.4087765813 } }, - { { 0.9700064659, 0.9917025566, 0.9159227014, 0.9309430718, - 0.8991290927, 0.9314124584, 0.9059612751, 0.9473194480, - 0.9604622722, 0.9377752542, 0.9197821021, 0.8869771957, - 0.8506779671, 0.8594920039, 0.8320589662, 0.8739908338 }, - { 0.2892394662, 0.0551198721, 0.0892807841, 0.1158793569, - 0.0905846357, 0.0738953352, 0.0395258069, 0.0240360498, - 0.0477139950, 0.0751470327, 0.1171310544, 0.1555164456, - 0.1384620667, 0.1818542480, 0.2104868293, 0.1288135648 } }, - { { 0.4101847410, 0.3326316476, 0.4666675925, 0.5077128410, - 0.5892296433, 0.4272912741, 0.0603352785, -0.8668596745, - -1.1103670001, -0.0900248885, 0.1626615524, 0.1487885714, - 0.4130010605, 0.5119373202, 0.5820323825, 0.5486016273 }, - { 0.0383262634, 0.1300652623, 0.2295230627, 0.2706204653, - 0.3722165823, 0.1698066592, -0.0934670568, -0.8677462935, - -1.0724509954, -0.2164463401, -0.0056917667, -0.0301520228, - 0.1299088001, 0.2579991817, 0.3482257128, 0.2469425201 } }, - { { 0.6031547785, 0.5515222549, 0.4292209744, 0.5027582049, - 0.8167778254, 1.0925685167, 0.9878953099, 0.7019345760, - 0.2509583831, 0.2475162148, 0.5660732388, 0.5145971775, - 0.4824181199, 0.5970005989, 0.5996604562, 0.5384315848 }, - { 0.3677313328, 0.2650399804, 0.1585935354, 0.2213348746, - 0.5566333532, 0.8425940871, 0.7604514360, 0.4523773789, - 0.0681062341, 0.0737388730, 0.3169854283, 0.2868403792, - 0.2661873698, 0.3635068536, 0.4300554395, 0.3743027449 } }, - { { 0.5017672777, 0.6634970307, 0.6869142056, 0.7066284418, - 0.5669598579, 0.0621085167, 0.0634645224, 0.2321307659, - 0.8322675824, 0.9855483770, 0.8296598792, 0.6140028238, - 0.5462546945, 0.6730412245, 0.6856103539, 0.5975221395 }, - { 0.2680649161, 0.3324230313, 0.3688787222, 0.3886451125, - 0.2774004936, -0.1695076823, -0.1353467703, 0.0159000158, - 0.5895425677, 0.7586781979, 0.5639870763, 0.3687744141, - 0.3401418328, 0.4477356672, 0.4782979488, 0.4034568667 } }, - { { 0.8838479519, 0.9025712609, 0.7326533198, 0.8124490380, - 0.8956347704, 1.1007045507, 1.2731780410, 1.2029786706, - 1.0839109421, 0.9664078355, 0.7356782556, 0.6942157745, - 0.6917645335, 0.6383587718, 0.6503020525, 0.5989302993 }, - { 0.5576764345, 0.4596789479, 0.3790487647, 0.5514179468, - 0.7333834767, 0.9612445831, 1.1976589561, 1.1094664335, - 0.8868207335, 0.6789346337, 0.4643206596, 0.4029353261, - 0.4384522438, 0.3871847987, 0.4326109886, 0.3691916466 } }, - { { 0.8520861268, 0.8413423896, 0.7238392830, 0.9103943706, - 0.7072542906, 0.6479029655, 0.4557673931, 0.1908247471, - -0.0569070578, -0.1013423204, 0.2517406940, 0.4854952097, - 0.5820845366, 0.5886037946, 0.6177579165, 0.6226603985 }, - { 0.6160889864, 0.4592095613, 0.4752208591, 0.6685559750, - 0.4326109886, 0.4077335000, 0.2314006090, 0.0173603296, - -0.2208272815, -0.3014574647, 0.0321199298, 0.2559130192, - 0.3603254557, 0.3466089368, 0.4072119594, 0.4776199460 } }, - { { 0.7083495259, 0.9001721740, 0.6795083284, 1.2743254304, - 1.3672639728, 1.2563322783, 0.8557369113, 0.8287732601, - 0.7942472696, 0.8006622195, 0.7034991980, 0.5479236245, - 0.6391932368, 0.6248508692, 0.5495925546, 0.4719351530 }, - { 0.4000146985, 0.6493632793, 0.4583229423, 1.1484255195, - 1.2521599531, 1.1232351065, 0.6150459051, 0.5347808003, - 0.4726653099, 0.5269576907, 0.4278128147, 0.2745841742, - 0.3868718743, 0.4183729291, 0.3474434018, 0.3150035739 } }, - { { 0.9070043564, 0.7648323774, 0.4281778932, 0.5475063920, - 0.4134704471, 0.4706834555, 0.4549329281, 0.4648422003, - 0.4572798610, 0.4823138118, 0.4666154385, 0.4841913581, - 0.4018922448, 0.4297946692, 0.4646857381, 0.6091003418 }, - { 0.4925360084, 0.2065231204, 0.0948612690, 0.1716842055, - 0.0992422104, 0.1332988143, 0.1255800128, 0.1257364750, - 0.0955392718, 0.1118634939, 0.1372103691, 0.1525958180, - 0.0902717113, 0.1591672301, 0.2335910797, 0.3767018318 } }, - { { 0.3185500503, 0.8677845001, 0.7776622772, 0.8160476685, - 0.8624126315, 0.8057211637, 0.8852561116, 0.8471314907, - 0.9145145416, 0.8945916891, 0.8638729453, 0.8531292081, - 0.7425104380, 0.6215651631, 0.6501455903, 0.6341864467 }, - { -0.0499705672, 0.0687842369, 0.3051464558, 0.3368039727, - 0.4942049384, 0.3823344707, 0.5683158636, 0.5044271350, - 0.6278236508, 0.5777035952, 0.5745221972, 0.5502184033, - 0.4244228005, 0.3163595796, 0.3525545001, 0.3582914472 } }, - { { 0.3200625181, 0.9415303469, 0.6067534089, 0.3568832874, - 0.1600538492, 0.2938811779, 0.2037589550, 0.3017564416, - 0.2572168708, 0.4796018004, 0.6938506961, 0.6847758889, - 0.7232134342, 0.6111343503, 0.5159531832, 0.4856516719 }, - { 0.0680540800, 0.6285016537, 0.2514277697, 0.0790064335, - -0.0687981844, 0.0521992445, -0.0055874586, 0.0537117124, - 0.0188206434, 0.1883213520, 0.4493002892, 0.4300554395, - 0.4750122428, 0.3658016324, 0.3119786382, 0.2818335891 } }, - { { 0.6864969730, 1.0815640092, 0.9838794470, 0.8845259547, - 0.9438772798, 0.8888025880, 0.8178730607, 0.8581881523, - 0.7128347754, 0.7120524645, 0.7345308661, 0.7945601940, - 0.7854853868, 0.8261655569, 0.6941114664, 0.6646444201 }, - { 0.2847542167, 0.9535257816, 0.6691818237, 0.5026538968, - 0.5945493579, 0.4125838280, 0.3886451125, 0.3740941286, - 0.2453778982, 0.2928902507, 0.3219922185, 0.4065861106, - 0.3838469386, 0.4289602041, 0.3910441995, 0.3821780086 } }, - { { 1.1335094571, 1.0390062928, 0.7019867301, 0.6203134656, - 0.6951545477, 0.4863818288, 0.6171320677, 0.6247465611, - 0.5907421112, 0.6711115241, 0.7322882414, 0.7042293549, - 0.5635698438, 0.6174449921, 0.6727283001, 0.6431047916 }, - { 1.0146503448, 0.7762541175, 0.2200310230, 0.2459515929, - 0.2703596950, 0.1376276016, 0.2522100806, 0.2622758150, - 0.2389107943, 0.2956544161, 0.3799875379, 0.3653843999, - 0.2561216354, 0.2842326760, 0.4034568667, 0.3700782657 } }, - { { 0.6342907548, 0.9627570510, 0.5214815140, -0.0226939917, - 0.5616401434, 0.7231091261, 0.7417802811, 0.9092991352, - 0.9739701748, 0.7804785967, 0.6771092415, 0.6352295280, - 0.4660417438, 0.5869870186, 0.6692339778, 0.5986173749 }, - { 0.3988673091, 0.6997441053, 0.2316613793, -0.2566571236, - 0.2685343027, 0.4484136701, 0.4490395188, 0.6886874437, - 0.7703085542, 0.5847443938, 0.4539941549, 0.4098196626, - 0.2579991817, 0.3376384377, 0.4754816294, 0.5095382333 } }, - { { 0.4443456531, 2.0296727419, 0.6569256186, 0.6439914107, - 0.6436263323, 0.5507399440, 0.6095175743, 0.6066491008, - 0.5347808003, 0.2529402375, 0.4443978071, 0.7000570297, - 0.8259569407, 0.5927761197, 0.5078171492, 0.4418422580 }, - { 0.2430831194, 1.9133691788, 0.3723730445, 0.3764410615, - 0.3874977231, 0.3212099075, 0.3832210898, 0.4474227428, - 0.3644977808, 0.0814055204, 0.2752621770, 0.4647378922, - 0.6619845629, 0.4304205179, 0.3143777251, 0.2705683112 } }, - { { 0.9740744829, 1.0730628967, 0.9743352532, 0.9098728299, - 0.9453375936, 0.9661470652, 0.9270836711, 0.9643738270, - 0.9989519715, 0.9627048969, 0.9348546267, 0.9865393043, - 0.9399657249, 0.9752218723, 0.8440544009, 0.8819182515 }, - { 0.9258319736, 1.0357205868, 0.8463491797, 0.8108844161, - 0.8391519189, 0.8566235304, 0.8305986524, 0.8880724311, - 0.9181653261, 0.8670021892, 0.8305986524, 0.8995984793, - 0.8300249577, 0.8711223602, 0.7195626497, 0.8138571978 } }, -}; - -static const double wmavoice_mean_lsf10[2][10] = { - { 0.2235394066, 0.4097484909, 0.7025292732, 1.1077160169, - 1.3939179044, 1.6741291716, 1.9552949226, 2.2199793918, - 2.5103400247, 2.7829212906 }, - { 0.1493683393, 0.3714357373, 0.7702730245, 1.0609411394, - 1.3270362536, 1.5806033119, 1.8398507524, 2.1116740248, - 2.3823505771, 2.6865718527 } -}; - -static const double wmavoice_mean_lsf16[2][16] = { - { 0.0999206754, 0.2345933590, 0.4621011210, 0.6772546160, - 0.8346396060, 1.0067495130, 1.1571691668, 1.3292508688, - 1.4941465650, 1.6600755584, 1.8461284908, 2.0529487333, - 2.2690810112, 2.4949894820, 2.7172752965, 2.9164840903 }, - { 0.0918298402, 0.2475621892, 0.4782937721, 0.6284774045, - 0.7861951264, 0.9303736000, 1.0940441024, 1.2521029300, - 1.4434732098, 1.6551410742, 1.8917962963, 2.0967280403, - 2.2981430375, 2.4826173497, 2.6827972461, 2.8811350800 } -}; - -static const float wmavoice_std_codebook[1000] = { - -0.185013, -0.150405, -0.707267, -0.284100, 0.882898, - -0.788627, 0.061005, 0.374431, 0.053843, -0.909826, - 0.543602, 0.219326, 0.285698, 0.154709, -0.455005, - 0.426276, -0.868852, -0.952324, -0.550001, 0.813814, - -0.352815, 0.242122, 0.820495, -0.189574, -0.449538, - 0.499132, -0.247783, 0.598159, 0.732040, -0.564406, - -0.631788, -0.452973, 0.285189, -0.339055, 0.262927, - 0.168087, -0.127682, -0.676067, -0.457481, 0.926161, - -0.585893, -0.913880, 0.145487, 0.699804, 0.240829, - 0.690482, 0.126081, 0.371977, 0.738158, 0.576080, - 0.185791, -0.614657, -0.181799, 0.006285, 0.195768, - 0.368663, -0.494583, 0.947985, -0.033178, -0.762543, - -0.616421, 0.335034, -0.215516, 0.668769, 0.995979, - -0.952588, -0.163144, -0.131704, -0.628655, 0.379374, - -0.205543, -0.214549, 0.465494, 0.939944, -0.514744, - -0.293676, 0.630426, 0.611336, -0.921699, 0.368584, - 0.187416, 0.264092, 0.753927, -0.994382, -0.729623, - -0.050304, 0.374280, -0.224205, -0.102319, -0.658897, - 0.013252, 0.281260, 0.676137, 0.797736, -0.049971, - 0.672115, 0.845148, 0.786885, -0.459588, -0.783507, - 0.166259, 0.334869, 0.001944, -0.368247, 0.274813, - 0.487200, 0.338077, -0.094761, 0.098536, 0.416378, - -0.726176, -0.714048, -0.319530, -0.972249, -0.708430, - -0.049153, -0.022553, 0.665850, 0.726642, 0.875127, - -0.993047, -0.260106, 0.156387, 0.683090, -0.462370, - -0.893584, 0.355205, -0.617222, 0.893301, 0.895617, - -0.400729, 0.059559, 0.230486, 0.601215, 0.691313, - -0.494701, 0.088415, 0.029390, 0.410539, -0.813049, - -0.554232, 0.684362, -0.527097, 0.126238, 0.712113, - -0.235528, -0.922915, -0.310440, -0.569678, 0.803727, - -0.435313, -0.562725, -0.456380, 0.721075, -0.879635, - 0.081250, 0.827491, 0.475570, 0.464029, 0.720792, - 0.371187, -0.936700, -0.219649, -0.398327, 0.664515, - -0.528336, 0.106972, -0.247070, 0.501053, -0.482490, - -0.060119, 0.946821, -0.798127, 0.412784, 0.073058, - 0.913986, -0.822744, 0.150143, -0.396453, -0.392421, - -0.046130, 0.168234, 0.044854, 0.497490, -0.110691, - 0.165219, -0.421259, -0.283200, -0.359212, -0.957231, - -0.562409, -0.988025, -0.893931, 0.217942, -0.386352, - 0.770585, 0.689606, 0.720620, -0.476485, 0.190659, - -0.761870, 0.463395, 0.137480, -0.559997, -0.123821, - -0.789461, -0.646011, 0.053435, 0.360682, -0.042464, - 0.661014, -0.685448, -0.874230, -0.294133, 0.812042, - 0.015078, 0.871086, -0.609218, 0.731878, -0.488126, - -0.566448, -0.830530, -0.476150, -0.460379, 0.387412, - 0.137497, -0.689794, 0.077018, -0.141883, -0.166280, - -0.732322, 0.096247, -0.702884, 0.405158, 0.536250, - 0.173295, 0.615696, 0.890239, -0.773270, -0.023622, - -0.152226, 0.887744, 0.290930, -0.026456, -0.406389, - 0.102972, 0.988622, -0.535303, 0.493754, 0.720500, - -0.023428, 0.927306, 0.889970, 0.500421, -0.533073, - 0.277382, -0.362081, -0.222867, -0.645599, 0.496035, - 0.610853, -0.377922, -0.407718, 0.907969, -0.972764, - -0.871468, 0.081264, 0.642933, -0.981230, 0.307994, - -0.380689, -0.133456, 0.195738, 0.910241, 0.840088, - 0.789349, 0.013213, 0.828710, -0.745954, -0.493033, - 0.549210, 0.230618, -0.565727, 0.439180, -0.268961, - -0.098800, -0.283438, 0.368958, 0.678333, 0.070963, - -0.135007, 0.289186, 0.693041, 0.457275, 0.197155, - 0.720277, 0.585807, -0.721581, 0.363210, 0.604577, - 0.586413, 0.982521, -0.528878, -0.217849, 0.892762, - -0.688791, -0.428500, -0.094025, -0.860081, -0.174454, - 0.412942, 0.689129, -0.943836, 0.847215, 0.128309, - -0.212797, -0.251585, 0.844871, -0.843839, -0.573252, - -0.084167, 0.021154, 0.715935, -0.391126, -0.521570, - -0.086910, -0.670848, -0.935763, 0.191509, 0.692361, - 0.668814, -0.222078, 0.674882, -0.860064, 0.560073, - 0.567644, -0.548855, -0.868427, -0.526382, -0.408936, - -0.042881, 0.886560, -0.719807, 0.013283, 0.733775, - 0.408502, 0.800487, -0.517810, 0.253372, 0.956648, - -0.091062, -0.830794, -0.022198, -0.375127, -0.221920, - 0.456232, 0.537963, 0.107232, 0.520469, -0.270529, - -0.200406, 0.189284, 0.507393, -0.525524, 0.329220, - 0.067466, -0.957881, 0.780365, 0.199039, -0.484262, - -0.628570, -0.843843, -0.597703, -0.348377, 0.169441, - -0.863928, -0.939875, -0.030073, -0.381738, 0.313497, - -0.073425, 0.527200, 0.482703, 0.904377, -0.847927, - -0.739217, 0.360609, 0.690035, 0.368015, -0.118921, - -0.580493, -0.832391, -0.929638, 0.926900, -0.357915, - 0.399582, -0.005634, -0.315796, 0.179947, -0.806596, - 0.393360, 0.732931, -0.415833, -0.724526, 0.957347, - -0.892887, 0.475366, 0.173583, -0.418554, -0.302536, - 0.627315, 0.782000, 0.497542, 0.139082, 0.570111, - 0.732375, -0.454643, 0.302218, -0.019505, 0.881778, - -0.057606, 0.273041, 0.414170, -0.503501, -0.079602, - -0.083941, 0.007178, -0.171925, 0.506856, 0.520953, - 0.631684, -0.099784, 0.253885, -0.784149, 0.175691, - 0.211231, -0.677036, -0.348943, -0.615186, -0.095591, - 0.348521, -0.987871, -0.313590, -0.153938, 0.151210, - -0.743479, -0.421562, 0.696567, 0.558739, 0.558933, - 0.578346, -0.498867, -0.168026, -0.007485, -0.002368, - 0.752372, 0.908575, -0.995190, -0.419553, 0.415430, - 0.525763, -0.787869, -0.684353, -0.220353, -0.572018, - 0.491337, 0.990879, -0.249054, -0.857606, -0.624307, - 0.655355, 0.490915, -0.612178, -0.658235, -0.663023, - 0.539032, -0.401714, -0.084585, 0.235599, -0.842975, - -0.525653, -0.186055, -0.341841, 0.306321, 0.806460, - 0.655791, 0.058693, 0.715035, 0.660601, 0.639140, - 0.130465, 0.186363, 0.851271, 0.446112, 0.966011, - -0.720746, -0.062551, 0.956890, 0.030200, 0.079843, - -0.667418, -0.314445, -0.429243, -0.279596, 0.027320, - -0.092266, -0.740564, 0.625606, 0.823149, 0.495035, - 0.782632, -0.702504, -0.691020, -0.559209, 0.603818, - -0.884560, -0.903419, -0.337489, 0.830475, 0.757182, - -0.698349, -0.039060, -0.056455, -0.847078, -0.592948, - -0.090444, -0.567824, 0.344501, -0.133554, 0.462375, - -0.575656, 0.199028, -0.852070, -0.004899, 0.919432, - 0.175251, 0.902835, -0.821132, -0.199143, 0.725984, - 0.673903, -0.416511, -0.976519, 0.982883, 0.024279, - 0.627298, -0.901677, 0.120861, -0.710191, 0.928798, - -0.121958, -0.408540, -0.110261, 0.821588, -0.255618, - 0.296790, -0.268856, 0.176557, -0.358709, 0.597589, - -0.361067, 0.065635, -0.203382, -0.213137, -0.939264, - -0.283951, 0.962113, 0.963571, -0.105083, -0.237030, - 0.689556, -0.431180, 0.346459, 0.713037, -0.448297, - -0.629262, 0.340335, -0.349973, 0.491599, 0.630144, - -0.421175, -0.630359, -0.778396, 0.468564, -0.808771, - -0.034014, -0.234646, -0.077627, -0.857457, 0.406645, - -0.480038, -0.218524, -0.527720, 0.316580, 0.568338, - -0.466984, -0.967371, 0.530452, -0.503413, -0.072454, - -0.706578, -0.813857, 0.496366, 0.639881, 0.899179, - -0.951931, -0.989381, 0.239514, -0.301904, 0.502218, - -0.130341, 0.276921, 0.871860, 0.091262, -0.254515, - -0.936911, -0.942752, 0.510839, -0.014539, -0.800209, - -0.082516, 0.505423, -0.018733, 0.389763, -0.177997, - -0.450395, 0.922779, -0.145368, -0.919943, -0.580634, - 0.782178, -0.626521, -0.394491, 0.278545, -0.986640, - -0.495312, 0.326614, -0.976021, 0.744203, -0.975290, - 0.526197, -0.386139, 0.301631, 0.398057, 0.705124, - -0.952884, 0.461146, 0.762372, 0.557954, -0.553393, - 0.962163, -0.524562, 0.952030, -0.056570, 0.865202, - -0.225967, 0.493035, 0.787981, 0.628665, 0.573093, - -0.792653, 0.410844, 0.946571, -0.187144, -0.310612, - 0.959931, 0.317544, -0.983998, 0.983911, 0.061747, - -0.959287, 0.510108, 0.675608, 0.342344, -0.091835, - 0.380731, 0.389460, -0.630689, 0.143103, -0.052586, - -0.184083, 0.105266, 0.422852, -0.232052, -0.951303, - 0.288054, 0.541981, 0.541732, 0.076035, 0.170646, - 0.114825, 0.283382, -0.418510, 0.061396, -0.903763, - 0.270879, 0.021327, 0.413782, 0.286881, 0.005238, - -0.524472, 0.327594, -0.484654, -0.848864, -0.330063, - 0.423511, 0.531868, -0.940603, 0.792822, -0.325029, - 0.006811, -0.391261, 0.780237, -0.570337, 0.376687, - 0.828934, 0.717717, -0.081333, 0.370666, -0.206248, - -0.910686, -0.514510, -0.922867, -0.329196, 0.546886, - -0.826629, 0.941683, -0.431786, 0.587152, 0.228564, - 0.573452, -0.937320, -0.443843, -0.911202, -0.786184, - 0.226094, 0.512309, 0.745684, 0.285491, 0.305131, - -0.579345, -0.707698, 0.913870, -0.799108, -0.278035, - 0.290556, -0.970174, -0.560318, -0.790776, 0.400492, - 0.233434, -0.701462, 0.885982, 0.310567, -0.030658, - 0.432868, 0.483938, -0.088976, -0.998918, 0.071090, - -0.860412, 0.574534, 0.133770, -0.304255, 0.663332, - 0.347586, 0.921839, 0.175641, 0.093270, 0.207330, - -0.519228, 0.513925, 0.499633, -0.605358, 0.714817, - -0.778402, 0.685198, 0.744643, -0.338720, 0.894422, - 0.145135, 0.894714, -0.807041, 0.031117, 0.205281, - 0.162301, -0.536015, -0.310781, -0.926675, -0.534932, - 0.760308, -0.787088, -0.960398, -0.105922, -0.091343, - 0.702934, -0.758336, -0.169504, -0.121425, 0.334935, - -0.962173, 0.359347, -0.151140, 0.537460, 0.753989, - -0.436323, 0.759058, 0.439187, -0.691680, -0.579662, - 0.333608, 0.453454, -0.684948, 0.526567, -0.515429, - 0.520333, -0.311132, -0.051443, -0.790448, -0.237807, - 0.413625, 0.969861, -0.024895, 0.453226, -0.136061, - 0.883762, 0.156160, 0.105603, -0.285741, -0.965264, - -0.559462, -0.247914, 0.394083, 0.289398, -0.710455, - 0.148072, 0.853074, -0.951397, -0.412742, -0.838606, - -0.531059, 0.920866, 0.614848, -0.216007, 0.447434, - -0.900580, -0.695673, -0.863698, 0.047977, -0.486121, - -0.101505, -0.538399, -0.516261, 0.873600, 0.914828, - 0.347678, 0.757362, 0.070988, -0.546718, -0.528380, - 0.105724, -0.106180, 0.223706, -0.500194, -0.816782, - 0.513251, 0.647878, -0.963708, 0.561854, -0.764864, - -0.802314, -0.969205, -0.843997, 0.812534, -0.185212, - 0.603436, 0.911954, 0.119114, 0.739738, -0.040069, - 0.632993, -0.361767, 0.421532, -0.883268, -0.488168, - 0.336360, 0.464411, -0.730806, -0.592652, 0.917693, - -0.259186, 0.513071, -0.188487, 0.964520, -0.987122, - -0.005270, 0.477771, 0.660756, 0.031023, 0.039625, - 0.895892, 0.228709, 0.070419, -0.948105, 0.041243, - 0.885207, 0.655331, -0.046803, 0.004321, 0.395069, - 0.913128, -0.362686, -0.966698, 0.334661, -0.245954, - -0.454865, -0.328980, -0.781543, -0.185671, 0.078368, - -0.863850, 0.555143, -0.408560, -0.052338, 0.519663, - -0.395683, 0.942393, -0.002565, -0.734927, -0.026585, - -0.962941, -0.839035, -0.797876, 0.107479, -0.787140, - 0.243367, -0.007314, 0.868191, -0.803435, 0.997007, - 0.263261, -0.890307, -0.365679, 0.296563, 0.444354, - 0.388367, 0.841698, -0.884626, 0.606824, -0.343973, - 0.193743, 0.742974, -0.788830, 0.785182, -0.309364, - 0.730833, -0.610500, -0.366971, -0.271732, -0.345427, - 0.606444, -0.234673, -0.184462, 0.808568, 0.872806, - 0.028398, 0.051936, -0.134508, -0.103410, 0.248500, - -0.137501, -0.840150, 0.358194, 0.496819, 0.456413, - -0.197453, -0.114814, 0.298111, -0.082078, -0.507990, - 0.954138, -0.888336, -0.765016, -0.834692, 0.896847, - -0.074380, 0.896141, -0.713654, 0.558649, -0.375591, - -0.059081, 0.165093, 0.389736, 0.756458, -0.026339, - 0.262542, -0.215144, -0.974403, -0.871966, 0.681446 -}; - -static const float wmavoice_gain_silence[256] = { - 0.0000188351, 0.0000249147, 0.0000294447, 0.0000365973, - 0.0000423193, 0.0000464916, 0.0000498295, 0.0000525713, - 0.0000550747, 0.0000574589, 0.0000596046, 0.0000615120, - 0.0000634193, 0.0000649691, 0.0000665188, 0.0000679493, - 0.0000692606, 0.0000704527, 0.0000716448, 0.0000728369, - 0.0000737906, 0.0000747442, 0.0000755787, 0.0000762939, - 0.0000770092, 0.0000778437, 0.0000785589, 0.0000792742, - 0.0000799894, 0.0000807047, 0.0000814199, 0.0000822544, - 0.0000829697, 0.0000838041, 0.0000845194, 0.0000854731, - 0.0000865459, 0.0000876188, 0.0000889301, 0.0000904799, - 0.0000923872, 0.0000950098, 0.0000988245, 0.0001032352, - 0.0001088381, 0.0001147985, 0.0001225471, 0.0001319647, - 0.0001431704, 0.0001568794, 0.0001744032, 0.0001952648, - 0.0002206564, 0.0002535582, 0.0002965927, 0.0003464222, - 0.0004109144, 0.0004891157, 0.0005909204, 0.0007261038, - 0.0008867979, 0.0010721684, 0.0012696981, 0.0015079975, - 0.0017461777, 0.0019979477, 0.0022052526, 0.0023679733, - 0.0025173426, 0.0026556253, 0.0027927160, 0.0029264688, - 0.0030447245, 0.0031807423, 0.0033060312, 0.0034313202, - 0.0035454035, 0.0036598444, 0.0037686825, 0.0038731098, - 0.0039769411, 0.0040702820, 0.0041661263, 0.0042562485, - 0.0043400526, 0.0044249296, 0.0045082569, 0.0045900345, - 0.0046693087, 0.0047430992, 0.0048171282, 0.0048881769, - 0.0049589872, 0.0050252676, 0.0050880909, 0.0051497221, - 0.0052082539, 0.0052671432, 0.0053246021, 0.0053800344, - 0.0054348707, 0.0054861307, 0.0055367947, 0.0055862665, - 0.0056355000, 0.0056805611, 0.0057252645, 0.0057705641, - 0.0058110952, 0.0058538914, 0.0058966875, 0.0059366226, - 0.0059723854, 0.0060091019, 0.0060437918, 0.0060794353, - 0.0061159134, 0.0061485767, 0.0061824322, 0.0062153339, - 0.0062497854, 0.0062820911, 0.0063197613, 0.0063550472, - 0.0063927174, 0.0064336061, 0.0064769983, 0.0065194368, - 0.0065603256, 0.0066006184, 0.0066410303, 0.0066826344, - 0.0067234039, 0.0067654848, 0.0068060160, 0.0068466663, - 0.0068866014, 0.0069231987, 0.0069609880, 0.0069983006, - 0.0070366859, 0.0070750713, 0.0071122646, 0.0071535110, - 0.0071973801, 0.0072410107, 0.0072846413, 0.0073343515, - 0.0073832273, 0.0074360371, 0.0074878931, 0.0075426102, - 0.0076007843, 0.0076560974, 0.0077134371, 0.0077683926, - 0.0078265667, 0.0078855753, 0.0079488754, 0.0080170631, - 0.0080827475, 0.0081528425, 0.0082212687, 0.0082877874, - 0.0083510876, 0.0084129572, 0.0084775686, 0.0085455179, - 0.0086110830, 0.0086781979, 0.0087503195, 0.0088242292, - 0.0089002848, 0.0089734793, 0.0090423822, 0.0091133118, - 0.0091816187, 0.0092473030, 0.0093164444, 0.0093911886, - 0.0094678402, 0.0095427036, 0.0096175671, 0.0096931458, - 0.0097666979, 0.0098397732, 0.0099166632, 0.0099946260, - 0.0100749731, 0.0101612806, 0.0102528334, 0.0103493929, - 0.0104434490, 0.0105448961, 0.0106583834, 0.0107737780, - 0.0108981133, 0.0110142231, 0.0111318827, 0.0112472773, - 0.0113576651, 0.0114786625, 0.0116028786, 0.0117331743, - 0.0118676424, 0.0120122433, 0.0121580362, 0.0123010874, - 0.0124633312, 0.0126402378, 0.0128232241, 0.0130140781, - 0.0132108927, 0.0134289265, 0.0136625767, 0.0138912201, - 0.0141364336, 0.0144006014, 0.0146615505, 0.0149335861, - 0.0152134895, 0.0155050755, 0.0158376694, 0.0162067413, - 0.0165973902, 0.0169926882, 0.0174319744, 0.0179271698, - 0.0184448957, 0.0190744400, 0.0197248459, 0.0204203129, - 0.0212460756, 0.0221523046, 0.0231562853, 0.0243031979, - 0.0256397724, 0.0271918774, 0.0289602280, 0.0310072899, - 0.0333702564, 0.0363805294, 0.0401413441, 0.0443998575, - 0.0498176813, 0.0562580824, 0.0640066862, 0.0732775927, - 0.0836604834, 0.0962959528, 0.1122496128, 0.1335854530, - 0.1608980894, 0.1990102530, 0.2616490126, 0.3926030397 -}; - -static const float wmavoice_gain_universal[64] = { - 0.0000000000, 0.0000000000, 0.0000015497, 0.0000015497, - 0.0000095367, 0.0000164509, 0.0000379086, 0.0000494719, - 0.0000799894, 0.0001058578, 0.0001349449, 0.0001627207, - 0.0001972914, 0.0002325773, 0.0002671480, 0.0003106594, - 0.0003589392, 0.0004127026, 0.0004582405, 0.0005071163, - 0.0005759001, 0.0006588697, 0.0007554293, 0.0008602142, - 0.0009772778, 0.0011068583, 0.0012603998, 0.0013889074, - 0.0015437603, 0.0016924143, 0.0018980503, 0.0021264553, - 0.0023632050, 0.0025693178, 0.0028522015, 0.0031896830, - 0.0034654140, 0.0037885904, 0.0041683912, 0.0046081543, - 0.0050576925, 0.0055632591, 0.0061818361, 0.0068151951, - 0.0073953867, 0.0081818104, 0.0091186762, 0.0102789402, - 0.0119919777, 0.0134155750, 0.0154829025, 0.0173798800, - 0.0199711323, 0.0229473114, 0.0268185139, 0.0319474936, - 0.0393068790, 0.0460114479, 0.0523469448, 0.0637906790, - 0.0845471621, 0.1105458736, 0.1499300003, 0.2219169140 -}; - -static const float wmavoice_gain_codebook_acb[128] = { - 0.05, 0.14, 0.16, 0.05, 0.17, 0.25, 0.07, 0.21, - 0.12, 0.22, 0.23, 0.13, 0.24, 0.32, 0.14, 0.29, - 0.31, 0.41, 0.43, 0.32, 0.43, 0.51, 0.34, 0.48, - 0.38, 0.47, 0.49, 0.38, 0.49, 0.57, 0.40, 0.54, - 0.49, 0.59, 0.61, 0.50, 0.61, 0.69, 0.52, 0.66, - 0.56, 0.65, 0.67, 0.56, 0.67, 0.75, 0.58, 0.72, - 0.65, 0.74, 0.76, 0.65, 0.76, 0.84, 0.67, 0.81, - 0.71, 0.80, 0.82, 0.71, 0.82, 0.90, 0.73, 0.87, - 0.81, 0.90, 0.92, 0.81, 0.93, 1.01, 0.83, 0.97, - 0.87, 0.96, 0.98, 0.87, 0.98, 1.06, 0.89, 1.03, - 0.92, 1.02, 1.04, 0.93, 1.04, 1.12, 0.95, 1.09, - 0.93, 1.02, 1.04, 0.93, 1.04, 1.12, 0.95, 1.09, - 0.94, 1.04, 1.05, 0.10, 1.06, 1.14, 0.96, 1.11, - 0.98, 1.08, 1.10, 0.99, 1.10, 1.18, 1.01, 1.15, - 1.06, 1.15, 1.17, 1.06, 1.17, 1.25, 1.08, 1.22, - 1.16, 1.25, 1.27, 1.16, 1.28, 1.36, 1.18, 1.32 -}; - -static const float wmavoice_gain_codebook_fcb[128] = { - -0.8439700703 /* log(0.430) */, -0.6143360001 /* log(0.541) */, - -0.1531511795 /* log(0.858) */, -0.0998203353 /* log(0.905) */, - 0.3213585988 /* log(1.379) */, 0.3777512695 /* log(1.459) */, - 0.7158866675 /* log(2.046) */, 1.2700414043 /* log(3.561) */, - -1.6873994539 /* log(0.185) */, -1.2173958247 /* log(0.296) */, - -0.4893903430 /* log(0.613) */, -0.4155154440 /* log(0.660) */, - 0.1257512053 /* log(1.134) */, 0.1947440768 /* log(1.215) */, - 0.5883420662 /* log(1.801) */, 1.1987592373 /* log(3.316) */, - -1.3586791941 /* log(0.257) */, -0.9996723408 /* log(0.368) */, - -0.3768776513 /* log(0.686) */, -0.3119747650 /* log(0.732) */, - 0.1881379421 /* log(1.207) */, 0.2523139286 /* log(1.287) */, - 0.6280751838 /* log(1.874) */, 1.2202397768 /* log(3.388) */, - -0.7381445465 /* log(0.478) */, -0.5310283311 /* log(0.588) */, - -0.0987159729 /* log(0.906) */, -0.0491902442 /* log(0.952) */, - 0.3555743385 /* log(1.427) */, 0.4101209196 /* log(1.507) */, - 0.7390761124 /* log(2.094) */, 1.2831536022 /* log(3.608) */, - -0.2497442331 /* log(0.779) */, -0.1165338163 /* log(0.890) */, - 0.1881379421 /* log(1.207) */, 0.2255406759 /* log(1.253) */, - 0.5469646704 /* log(1.728) */, 0.5922212620 /* log(1.808) */, - 0.8733832309 /* log(2.395) */, 1.3632815868 /* log(3.909) */, - -1.3903023825 /* log(0.249) */, -1.0216512475 /* log(0.360) */, - -0.3900840061 /* log(0.677) */, -0.3229638866 /* log(0.724) */, - 0.1806534997 /* log(1.198) */, 0.2460785226 /* log(1.279) */, - 0.6232610531 /* log(1.865) */, 1.2178757095 /* log(3.380) */, - -0.6033064766 /* log(0.547) */, -0.4185503477 /* log(0.658) */, - -0.0253178080 /* log(0.975) */, 0.0217614918 /* log(1.022) */, - 0.4027948796 /* log(1.496) */, 0.4555243080 /* log(1.577) */, - 0.7714961470 /* log(2.163) */, 1.3023691262 /* log(3.678) */, - -1.1056369036 /* log(0.331) */, -0.8164453969 /* log(0.442) */, - -0.2757535016 /* log(0.759) */, -0.2156715365 /* log(0.806) */, - 0.2468600779 /* log(1.280) */, 0.3082197237 /* log(1.361) */, - 0.6662897264 /* log(1.947) */, 1.2418464568 /* log(3.462) */, - -0.5395680926 /* log(0.583) */, -0.3652833185 /* log(0.694) */, - 0.0109399400 /* log(1.011) */, 0.0554347069 /* log(1.057) */, - 0.4265740713 /* log(1.532) */, 0.4774756441 /* log(1.612) */, - 0.7880027116 /* log(2.199) */, 1.3118401752 /* log(3.713) */, - -0.9571127264 /* log(0.384) */, -0.7031975164 /* log(0.495) */, - -0.2082549388 /* log(0.812) */, -0.1519863570 /* log(0.859) */, - 0.2874320412 /* log(1.333) */, 0.3464225675 /* log(1.414) */, - 0.6931471806 /* log(2.000) */, 1.2570395253 /* log(3.515) */, - -0.2420715612 /* log(0.785) */, -0.1098148660 /* log(0.896) */, - 0.1930966300 /* log(1.213) */, 0.2311117210 /* log(1.260) */, - 0.5504308784 /* log(1.734) */, 0.5960854677 /* log(1.815) */, - 0.8758853172 /* log(2.401) */, 1.3650707247 /* log(3.916) */, - 0.6564831962 /* log(1.928) */, 0.7124594916 /* log(2.039) */, - 0.8569652658 /* log(2.356) */, 0.8767179568 /* log(2.403) */, - 1.0567480846 /* log(2.877) */, 1.0841752409 /* log(2.957) */, - 1.2652560327 /* log(3.544) */, 1.6211688353 /* log(5.059) */, - -1.5417792640 /* log(0.214) */, -1.1239300967 /* log(0.325) */, - -0.4431669753 /* log(0.642) */, -5.2983173665 /* log(0.005) */, - 0.1510028735 /* log(1.163) */, 0.2183319943 /* log(1.244) */, - 0.6043159669 /* log(1.830) */, 1.2074666936 /* log(3.345) */, - -0.5124936809 /* log(0.599) */, -0.3424903089 /* log(0.710) */, - 0.0266419309 /* log(1.027) */, 0.0713899961 /* log(1.074) */, - 0.4369637752 /* log(1.548) */, 0.4879663296 /* log(1.629) */, - 0.7952524035 /* log(2.215) */, 1.3164082337 /* log(3.730) */, - -0.8867319296 /* log(0.412) */, -0.6481738149 /* log(0.523) */, - -0.1743533871 /* log(0.840) */, -0.1199102967 /* log(0.887) */, - 0.3089542077 /* log(1.362) */, 0.3660310389 /* log(1.442) */, - 0.7075430608 /* log(2.029) */, 1.2649738259 /* log(3.543) */, - -0.0943106795 /* log(0.910) */, 0.0207825392 /* log(1.021) */, - 0.2911759617 /* log(1.338) */, 0.3249778572 /* log(1.384) */, - 0.6200387087 /* log(1.859) */, 0.6621723763 /* log(1.939) */, - 0.9266370239 /* log(2.526) */, 1.3962446920 /* log(4.040) */ -}; - -static const float wmavoice_ipol1_coeffs[17*9] = { - 0, - 0.6308171151, 0.7613050340, 0.8632577061, 0.9280143976, - 0.9499985575, 0.9273047447, 0.8618999123, 0.7594153284, - -0.1791058179, -0.1351341452, -0.0589959878, 0.0472882274, - 0.1784339990, 0.3262237605, 0.4801855979, 0.6285545824, - 0, - -0.1921342459, -0.1786532696, -0.1341681625, -0.0575229186, - 0.0492091286, 0.1806929555, 0.3286687729, 0.4826357064, - 0.0807464118, 0.0506337392, 0.0080115446, -0.0428523305, - -0.0958572026, -0.1436148431, -0.1782128509, -0.1921164688, - 0, - 0.0960653644, 0.0803771760, 0.0500416081, 0.0072485465, - -0.0437018941, -0.0966834794, -0.1442930843, -0.1786170151, - -0.0391932014, -0.0189622506, 0.0070230183, 0.0356589290, - 0.0630142610, 0.0847979258, 0.0969368290, 0.0961942221, - 0, - -0.0515680681, -0.0389267015, -0.0185848991, 0.0074699190, - 0.0361179407, 0.0634181346, 0.0850781347, 0.0970333587, - 0.0178811825, 0.0048708571, -0.0108041526, -0.0271167825, - -0.0416534986, -0.0519338618, -0.0557823736, -0.0517020743, - 0, - 0.0267091128, 0.0177022810, 0.0046363524, -0.0110662053, - -0.0273700613, -0.0418578978, -0.0520511451, -0.0557823028, - -0.0069270437, 0.0008217385, 0.0097293532, 0.0185749526, - 0.0259542684, 0.0304777338, 0.0309953480, 0.0268154419, - 0, - -0.0125539196, -0.0068173436, 0.0009580161, 0.0098749646, - 0.0187084037, 0.0260526291, 0.0305201071, 0.0309665180, - 0.0019149571, -0.0022503408, -0.0068592466, -0.0112465904, - -0.0146595868, -0.0163685936, -0.0157934162, -0.0126258885, - 0, - 0.0050976076, 0.0018546581, -0.0023221741, -0.0069331308, - -0.0113109085, -0.0147021576, -0.0163786146, -0.0157635096, - -0.0001162733, 0.0019313511, 0.0040823850, 0.0060192454, - 0.0073876535, 0.0078486321, 0.0071403184, 0.0051400312, - 0, - -0.0017920607, -0.0000857157, 0.0019657183, 0.0041159806, - 0.0060465694, 0.0074030068, 0.0078470460, 0.0071185785, - -0.0004100171, -0.0015364708, -0.0025490071, -0.0033188616, - -0.0037196307, -0.0036417283, -0.0030119629, -0.0018155784, - 0, - 0.0006907531, -0.0004282868, -0.0015539061, -0.0025635813, - -0.0033285026, -0.0037224069, -0.0036361245, -0.0029972247, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/** - * Hamming-window sinc function (num = 32, x = [ 0, 31 ]): - * (0.54 + 0.46 * cos(2 * M_PI * x / (num - 1))) * - * sin(x * M_PI / 4) / (x * M_PI / 4) - */ -static const float wmavoice_ipol2_coeffs[32] = { - 1, 0.8563459515, 0.5888634918, 0.2648358640, - 0, -0.1360490318, -0.1434589471, -0.0758505310, - 0, 0.0410402636, 0.0412485781, 0.0200064587, - 0, -0.0081391358, -0.0068223253, -0.0029313546, - 0, 0.0025864919, 0.0053062555, 0.0055688801, - 0, -0.0104795941, -0.0187493577, -0.0160592399, - 0, 0.0212381664, 0.0331059131, 0.0251942366, - 0, -0.0273968070, -0.0392575669, -0.0276240534 -}; - -/** - * LUT for 1.071575641632 * pow(1.0331663, n - 127) - */ -static const float wmavoice_energy_table[128] = { - 0.0169982178, 0.0175619858, 0.0181444519, 0.0187462362, - 0.0193679795, 0.0200103437, 0.0206740128, 0.0213596933, - 0.0220681153, 0.0228000330, 0.0235562258, 0.0243374986, - 0.0251446834, 0.0259786395, 0.0268402549, 0.0277304468, - 0.0286501631, 0.0296003830, 0.0305821182, 0.0315964139, - 0.0326443501, 0.0337270424, 0.0348456436, 0.0360013446, - 0.0371953760, 0.0384290090, 0.0397035571, 0.0410203772, - 0.0423808713, 0.0437864880, 0.0452387238, 0.0467391249, - 0.0482892887, 0.0498908657, 0.0515455612, 0.0532551367, - 0.0550214125, 0.0568462692, 0.0587316496, 0.0606795611, - 0.0626920777, 0.0647713419, 0.0669195677, 0.0691390421, - 0.0714321284, 0.0738012678, 0.0762489827, 0.0787778794, - 0.0813906502, 0.0840900769, 0.0868790336, 0.0897604897, - 0.0927375130, 0.0958132732, 0.0989910450, 0.1022742117, - 0.1056662688, 0.1091708280, 0.1127916204, 0.1165325012, - 0.1203974531, 0.1243905911, 0.1285161668, 0.1327785725, - 0.1371823465, 0.1417321773, 0.1464329093, 0.1512895470, - 0.1563072616, 0.1614913951, 0.1668474671, 0.1723811803, - 0.1780984262, 0.1840052921, 0.1901080668, 0.1964132480, - 0.2029275487, 0.2096579046, 0.2166114816, 0.2237956830, - 0.2312181577, 0.2388868085, 0.2468098001, 0.2549955679, - 0.2634528274, 0.2721905830, 0.2812181375, 0.2905451026, - 0.3001814086, 0.3101373153, 0.3204234225, 0.3310506819, - 0.3420304081, 0.3533742912, 0.3650944090, 0.3772032397, - 0.3897136755, 0.4026390362, 0.4159930832, 0.4297900346, - 0.4440445799, 0.4587718956, 0.4739876619, 0.4897080789, - 0.5059498840, 0.5227303696, 0.5400674019, 0.5579794393, - 0.5764855528, 0.5956054456, 0.6153594745, 0.6357686714, - 0.6568547659, 0.6786402082, 0.7011481929, 0.7244026842, - 0.7484284410, 0.7732510432, 0.7988969192, 0.8253933741, - 0.8527686184, 0.8810517982, 0.9102730265, 0.9404634147, - 0.9716551065, 1.0038813113, 1.0371763400, 1.0715756416 -}; - -/** - * LUT for f(x,y) = pow((y + 6.9) / 64, 0.025 * (x + 1)). - */ -static const float wmavoice_denoise_power_table[12][64] = { - { 0.9458379339, 0.9490436287, 0.9518757236, 0.9544130754, - 0.9567118717, 0.9588135761, 0.9607496688, 0.9625446194, - 0.9642178285, 0.9657849396, 0.9672587526, 0.9686498743, - 0.9699671937, 0.9712182343, 0.9724094211, 0.9735462842, - 0.9746336187, 0.9756756090, 0.9766759291, 0.9776378218, - 0.9785641645, 0.9794575217, 0.9803201890, 0.9811542296, - 0.9819615045, 0.9827436985, 0.9835023412, 0.9842388263, - 0.9849544265, 0.9856503078, 0.9863275406, 0.9869871101, - 0.9876299254, 0.9882568267, 0.9888685922, 0.9894659445, - 0.9900495551, 0.9906200497, 0.9911780119, 0.9917239872, - 0.9922584859, 0.9927819864, 0.9932949377, 0.9937977618, - 0.9942908555, 0.9947745929, 0.9952493267, 0.9957153901, - 0.9961730980, 0.9966227482, 0.9970646231, 0.9974989903, - 0.9979261037, 0.9983462046, 0.9987595223, 0.9991662752, - 0.9995666709, 0.9999609077, 1.0003491745, 1.0007316515, - 1.0011085110, 1.0014799178, 1.0018460292, 1.0022069960 }, - { 0.8946093973, 0.9006838092, 0.9060673931, 0.9109043185, - 0.9152976055, 0.9193234737, 0.9230399260, 0.9264921443, - 0.9297160207, 0.9327405496, 0.9355894944, 0.9382825789, - 0.9408363568, 0.9432648587, 0.9455800822, 0.9477923675, - 0.9499106907, 0.9519428941, 0.9538958704, 0.9557757107, - 0.9575878241, 0.9593370368, 0.9610276730, 0.9626636222, - 0.9642483964, 0.9657851769, 0.9672768552, 0.9687260672, - 0.9701352224, 0.9715065293, 0.9728420173, 0.9741435556, - 0.9754128696, 0.9766515555, 0.9778610927, 0.9790428553, - 0.9801981216, 0.9813280829, 0.9824338513, 0.9835164667, - 0.9845769028, 0.9856160726, 0.9866348334, 0.9876339913, - 0.9886143053, 0.9895764906, 0.9905212223, 0.9914491381, - 0.9923608411, 0.9932569022, 0.9941378627, 0.9950042356, - 0.9958565084, 0.9966951442, 0.9975205834, 0.9983332454, - 0.9991335296, 0.9999218170, 1.0006984708, 1.0014638383, - 1.0022182509, 1.0029620257, 1.0036954662, 1.0044188628 }, - { 0.8461555040, 0.8547882305, 0.8624635555, 0.8693789920, - 0.8756760853, 0.8814598273, 0.8868103032, 0.8917900284, - 0.8964487626, 0.9008267754, 0.9049571273, 0.9088673021, - 0.9125804007, 0.9161160306, 0.9194909803, 0.9227197376, - 0.9258148939, 0.9287874629, 0.9316471355, 0.9344024839, - 0.9370611291, 0.9396298766, 0.9421148300, 0.9445214846, - 0.9468548060, 0.9491192967, 0.9513190517, 0.9534578074, - 0.9555389816, 0.9575657096, 0.9595408742, 0.9614671327, - 0.9633469396, 0.9651825670, 0.9669761222, 0.9687295635, - 0.9704447142, 0.9721232742, 0.9737668316, 0.9753768718, - 0.9769547868, 0.9785018824, 0.9800193854, 0.9815084500, - 0.9829701633, 0.9844055505, 0.9858155796, 0.9872011653, - 0.9885631734, 0.9899024236, 0.9912196934, 0.9925157203, - 0.9937912053, 0.9950468143, 0.9962831814, 0.9975009102, - 0.9987005760, 0.9998827277, 1.0010478892, 1.0021965608, - 1.0033292209, 1.0044463270, 1.0055483173, 1.0066356112 }, - { 0.8003259737, 0.8112313241, 0.8209581209, 0.8297466775, - 0.8377697066, 0.8451556492, 0.8520027051, 0.8583876935, - 0.8643718792, 0.8700049328, 0.8753277020, 0.8803741979, - 0.8851730502, 0.8897485937, 0.8941216918, 0.8983103719, - 0.9023303202, 0.9061952736, 0.9099173316, 0.9135072091, - 0.9169744409, 0.9203275502, 0.9235741882, 0.9267212496, - 0.9297749699, 0.9327410079, 0.9356245146, 0.9384301933, - 0.9411623497, 0.9438249364, 0.9464215906, 0.9489556668, - 0.9514302661, 0.9538482608, 0.9562123167, 0.9585249126, - 0.9607883576, 0.9630048062, 0.9651762722, 0.9673046403, - 0.9693916775, 0.9714390425, 0.9734482944, 0.9754209007, - 0.9773582446, 0.9792616307, 0.9811322918, 0.9829713934, - 0.9847800389, 0.9865592739, 0.9883100900, 0.9900334289, - 0.9917301853, 0.9934012104, 0.9950473143, 0.9966692689, - 0.9982678100, 0.9998436400, 1.0013974295, 1.0029298194, - 1.0044414224, 1.0059328250, 1.0074045889, 1.0088572520 }, - { 0.7569786654, 0.7698939195, 0.7814501054, 0.7919210783, - 0.8015042240, 0.8103467104, 0.8185613167, 0.8262364557, - 0.8334427763, 0.8402376615, 0.8466683811, 0.8527743561, - 0.8585888194, 0.8641400582, 0.8694523567, 0.8745467247, - 0.8794414652, 0.8841526254, 0.8886943552, 0.8930791981, - 0.8973183276, 0.9014217415, 0.9053984227, 0.9092564737, - 0.9130032283, 0.9166453478, 0.9201889007, 0.9236394320, - 0.9270020224, 0.9302813390, 0.9334816797, 0.9366070112, - 0.9396610028, 0.9426470554, 0.9455683275, 0.9484277579, - 0.9512280860, 0.9539718690, 0.9566614986, 0.9592992147, - 0.9618871182, 0.9644271823, 0.9669212630, 0.9693711079, - 0.9717783651, 0.9741445900, 0.9764712529, 0.9787597445, - 0.9810113822, 0.9832274148, 0.9854090274, 0.9875573457, - 0.9896734398, 0.9917583281, 0.9938129803, 0.9958383209, - 0.9978352315, 0.9998045539, 1.0017470919, 1.0036636145, - 1.0055548568, 1.0074215229, 1.0092642871, 1.0110837959 }, - { 0.7159791370, 0.7306629191, 0.7438433845, 0.7558198318, - 0.7668086064, 0.7769714272, 0.7864325139, 0.7952894548, - 0.8036203840, 0.8114888792, 0.8189474022, 0.8260397728, - 0.8328029877, 0.8392685815, 0.8454636629, 0.8514117142, - 0.8571332177, 0.8626461513, 0.8679663850, 0.8731080020, - 0.8780835596, 0.8829043049, 0.8875803529, 0.8921208349, - 0.8965340237, 0.9008274393, 0.9050079382, 0.9090817905, - 0.9130547454, 0.9169320882, 0.9207186893, 0.9244190474, - 0.9280373261, 0.9315773876, 0.9350428208, 0.9384369673, - 0.9417629433, 0.9450236603, 0.9482218422, 0.9513600421, - 0.9544406555, 0.9574659338, 0.9604379957, 0.9633588374, - 0.9662303420, 0.9690542879, 0.9718323569, 0.9745661408, - 0.9772571477, 0.9799068082, 0.9825164805, 0.9850874551, - 0.9876209597, 0.9901181627, 0.9925801775, 0.9950080658, - 0.9974028405, 0.9997654692, 1.0020968764, 1.0043979464, - 1.0066695255, 1.0089124239, 1.0111274185, 1.0133152537 }, - { 0.6772002277, 0.6934309881, 0.7080464599, 0.7213643301, - 0.7336148970, 0.7449707526, 0.7555647772, 0.7655015856, - 0.7748651015, 0.7837237382, 0.7921340426, 0.8001433220, - 0.8077915768, 0.8151129499, 0.8221368310, 0.8288887107, - 0.8353908496, 0.8416628090, 0.8477218755, 0.8535834053, - 0.8592611049, 0.8647672624, 0.8701129393, 0.8753081305, - 0.8803618988, 0.8852824894, 0.8900774261, 0.8947535945, - 0.8993173131, 0.9037743949, 0.9081302004, 0.9123896841, - 0.9165574352, 0.9206377129, 0.9246344779, 0.9285514202, - 0.9323919830, 0.9361593853, 0.9398566405, 0.9434865742, - 0.9470518396, 0.9505549317, 0.9539981992, 0.9573838564, - 0.9607139933, 0.9639905847, 0.9672154989, 0.9703905051, - 0.9735172803, 0.9765974162, 0.9796324243, 0.9826237418, - 0.9855727362, 0.9884807098, 0.9913489039, 0.9941785028, - 0.9969706369, 0.9997263861, 1.0024467831, 1.0051328157, - 1.0077854297, 1.0104055314, 1.0129939892, 1.0155516364 }, - { 0.6405216642, 0.6580962612, 0.6739722363, 0.6884795488, - 0.7018580813, 0.7142880714, 0.7259086094, 0.7368294324, - 0.7471387455, 0.7569085832, 0.7661985859, 0.7750587283, - 0.7835313288, 0.7916525600, 0.7994535998, 0.8069615243, - 0.8142000068, 0.8211898738, 0.8279495504, 0.8344954211, - 0.8408421252, 0.8470027997, 0.8529892811, 0.8588122744, - 0.8644814947, 0.8700057878, 0.8753932324, 0.8806512276, - 0.8857865684, 0.8908055105, 0.8957138271, 0.9005168576, - 0.9052195513, 0.9098265046, 0.9143419945, 0.9187700080, - 0.9231142680, 0.9273782568, 0.9315652364, 0.9356782672, - 0.9397202245, 0.9436938133, 0.9476015819, 0.9514459336, - 0.9552291382, 0.9589533414, 0.9626205741, 0.9662327603, - 0.9697917251, 0.9732992008, 0.9767568340, 0.9801661903, - 0.9835287605, 0.9868459649, 0.9901191578, 0.9933496315, - 0.9965386205, 0.9996873045, 1.0027968119, 1.0058682226, - 1.0089025710, 1.0119008485, 1.0148640056, 1.0177929548 }, - { 0.6058296875, 0.6245620637, 0.6415378101, 0.6570938835, - 0.6714759586, 0.6848691001, 0.6974164561, 0.7092312055, - 0.7204044988, 0.7310109103, 0.7411122884, 0.7507605397, - 0.7599996842, 0.7688674015, 0.7773962122, 0.7856143935, - 0.7935466990, 0.8012149303, 0.8086383963, 0.8158342858, - 0.8228179717, 0.8296032631, 0.8362026133, 0.8426272954, - 0.8488875492, 0.8549927056, 0.8609512936, 0.8667711307, - 0.8724594015, 0.8780227256, 0.8834672161, 0.8887985309, - 0.8940219180, 0.8991422543, 0.9041640810, 0.9090916337, - 0.9139288704, 0.9186794948, 0.9233469789, 0.9279345818, - 0.9324453671, 0.9368822185, 0.9412478543, 0.9455448393, - 0.9497755970, 0.9539424198, 0.9580474782, 0.9620928299, - 0.9660804271, 0.9700121244, 0.9738896845, 0.9777147851, - 0.9814890239, 0.9852139236, 0.9888909370, 0.9925214512, - 0.9961067913, 0.9996482244, 1.0031469629, 1.0066041676, - 1.0100209506, 1.0133983785, 1.0167374742, 1.0200392198 }, - { 0.5730166999, 0.5927366473, 0.6106642672, 0.6271389942, - 0.6424090212, 0.6566617910, 0.6700426292, 0.6826666808, - 0.6946268614, 0.7059993279, 0.7168473476, 0.7272241023, - 0.7371747608, 0.7467380401, 0.7559474006, 0.7648319736, - 0.7734172908, 0.7817258650, 0.7897776570, 0.7975904541, - 0.8051801811, 0.8125611560, 0.8197463039, 0.8267473349, - 0.8335748949, 0.8402386937, 0.8467476129, 0.8531098003, - 0.8593327495, 0.8654233698, 0.8713880464, 0.8772326935, - 0.8829628002, 0.8885834710, 0.8940994619, 0.8995152120, - 0.9048348715, 0.9100623268, 0.9152012229, 0.9202549833, - 0.9252268281, 0.9301197899, 0.9349367288, 0.9396803449, - 0.9443531909, 0.9489576823, 0.9534961076, 0.9579706374, - 0.9623833320, 0.9667361492, 0.9710309512, 0.9752695109, - 0.9794535174, 0.9835845813, 0.9876642399, 0.9916939614, - 0.9956751493, 0.9996091459, 1.0034972362, 1.0073406510, - 1.0111405700, 1.0148981248, 1.0186144013, 1.0222904422 }, - { 0.5419809316, 0.5625329386, 0.5812764912, 0.5985496562, - 0.6146003370, 0.6296162401, 0.6437432340, 0.6570971404, - 0.6697716039, 0.6818435182, 0.6933768712, 0.7044255353, - 0.7150353340, 0.7252456009, 0.7350903742, 0.7445993259, - 0.7537984929, 0.7627108595, 0.7713568269, 0.7797545943, - 0.7879204712, 0.7958691361, 0.8036138516, 0.8111666444, - 0.8185384580, 0.8257392814, 0.8327782597, 0.8396637886, - 0.8464035955, 0.8530048108, 0.8594740287, 0.8658173611, - 0.8720404845, 0.8781486812, 0.8841468762, 0.8900396688, - 0.8958313620, 0.9015259874, 0.9071273286, 0.9126389413, - 0.9180641715, 0.9234061727, 0.9286679198, 0.9338522236, - 0.9389617420, 0.9439989920, 0.9489663591, 0.9538661069, - 0.9587003852, 0.9634712378, 0.9681806094, 0.9728303524, - 0.9774222323, 0.9819579336, 0.9864390644, 0.9908671615, - 0.9952436943, 0.9995700689, 1.0038476318, 1.0080776733, - 1.0122614305, 1.0164000906, 1.0204947932, 1.0245466331 }, - { 0.5126261246, 0.5338683013, 0.5533029807, 0.5712636181, - 0.5879954388, 0.6036845987, 0.6184760989, 0.6324853169, - 0.6458057215, 0.6585142011, 0.6706748475, 0.6823417062, - 0.6935608163, 0.7043717519, 0.7148088052, 0.7249019070, - 0.7346773529, 0.7441583823, 0.7533656456, 0.7623175831, - 0.7710307376, 0.7795200117, 0.7877988829, 0.7958795841, - 0.8037732557, 0.8114900754, 0.8190393682, 0.8264297018, - 0.8336689680, 0.8407644543, 0.8477229049, 0.8545505751, - 0.8612532786, 0.8678364291, 0.8743050768, 0.8806639416, - 0.8869174414, 0.8930697184, 0.8991246621, 0.9050859297, - 0.9109569648, 0.9167410144, 0.9224411436, 0.9280602496, - 0.9336010737, 0.9390662129, 0.9444581300, 0.9497791628, - 0.9550315328, 0.9602173528, 0.9653386345, 0.9703972943, - 0.9753951600, 0.9803339761, 0.9852154088, 0.9900410510, - 0.9948124263, 0.9995309934, 1.0041981497, 1.0088152348, - 1.0133835335, 1.0179042791, 1.0223786564, 1.0268078035 }, -}; - -#endif /* AVCODEC_WMAVOICE_DATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ac3dsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ac3dsp_init.c deleted file mode 100644 index 8c94db0d8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ac3dsp_init.c +++ /dev/null @@ -1,231 +0,0 @@ -/* - * x86-optimized AC-3 DSP utils - * Copyright (c) 2011 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/mem.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "dsputil_x86.h" -#include "libavcodec/ac3.h" -#include "libavcodec/ac3dsp.h" - -void ff_ac3_exponent_min_mmx (uint8_t *exp, int num_reuse_blocks, int nb_coefs); -void ff_ac3_exponent_min_mmxext(uint8_t *exp, int num_reuse_blocks, int nb_coefs); -void ff_ac3_exponent_min_sse2 (uint8_t *exp, int num_reuse_blocks, int nb_coefs); - -int ff_ac3_max_msb_abs_int16_mmx (const int16_t *src, int len); -int ff_ac3_max_msb_abs_int16_mmxext(const int16_t *src, int len); -int ff_ac3_max_msb_abs_int16_sse2 (const int16_t *src, int len); -int ff_ac3_max_msb_abs_int16_ssse3(const int16_t *src, int len); - -void ff_ac3_lshift_int16_mmx (int16_t *src, unsigned int len, unsigned int shift); -void ff_ac3_lshift_int16_sse2(int16_t *src, unsigned int len, unsigned int shift); - -void ff_ac3_rshift_int32_mmx (int32_t *src, unsigned int len, unsigned int shift); -void ff_ac3_rshift_int32_sse2(int32_t *src, unsigned int len, unsigned int shift); - -void ff_float_to_fixed24_3dnow(int32_t *dst, const float *src, unsigned int len); -void ff_float_to_fixed24_sse (int32_t *dst, const float *src, unsigned int len); -void ff_float_to_fixed24_sse2 (int32_t *dst, const float *src, unsigned int len); - -int ff_ac3_compute_mantissa_size_sse2(uint16_t mant_cnt[6][16]); - -void ff_ac3_extract_exponents_3dnow(uint8_t *exp, int32_t *coef, int nb_coefs); -void ff_ac3_extract_exponents_sse2 (uint8_t *exp, int32_t *coef, int nb_coefs); -void ff_ac3_extract_exponents_ssse3(uint8_t *exp, int32_t *coef, int nb_coefs); - -#if ARCH_X86_32 && defined(__INTEL_COMPILER) -# undef HAVE_7REGS -# define HAVE_7REGS 0 -#endif - -#if HAVE_SSE_INLINE && HAVE_7REGS - -#define IF1(x) x -#define IF0(x) - -#define MIX5(mono, stereo) \ - __asm__ volatile ( \ - "movss 0(%1), %%xmm5 \n" \ - "movss 8(%1), %%xmm6 \n" \ - "movss 24(%1), %%xmm7 \n" \ - "shufps $0, %%xmm5, %%xmm5 \n" \ - "shufps $0, %%xmm6, %%xmm6 \n" \ - "shufps $0, %%xmm7, %%xmm7 \n" \ - "1: \n" \ - "movaps (%0, %2), %%xmm0 \n" \ - "movaps (%0, %3), %%xmm1 \n" \ - "movaps (%0, %4), %%xmm2 \n" \ - "movaps (%0, %5), %%xmm3 \n" \ - "movaps (%0, %6), %%xmm4 \n" \ - "mulps %%xmm5, %%xmm0 \n" \ - "mulps %%xmm6, %%xmm1 \n" \ - "mulps %%xmm5, %%xmm2 \n" \ - "mulps %%xmm7, %%xmm3 \n" \ - "mulps %%xmm7, %%xmm4 \n" \ - stereo("addps %%xmm1, %%xmm0 \n") \ - "addps %%xmm1, %%xmm2 \n" \ - "addps %%xmm3, %%xmm0 \n" \ - "addps %%xmm4, %%xmm2 \n" \ - mono("addps %%xmm2, %%xmm0 \n") \ - "movaps %%xmm0, (%0, %2) \n" \ - stereo("movaps %%xmm2, (%0, %3) \n") \ - "add $16, %0 \n" \ - "jl 1b \n" \ - : "+&r"(i) \ - : "r"(matrix), \ - "r"(samples[0] + len), \ - "r"(samples[1] + len), \ - "r"(samples[2] + len), \ - "r"(samples[3] + len), \ - "r"(samples[4] + len) \ - : XMM_CLOBBERS("%xmm0", "%xmm1", "%xmm2", "%xmm3", \ - "%xmm4", "%xmm5", "%xmm6", "%xmm7",) \ - "memory" \ - ); - -#define MIX_MISC(stereo) \ - __asm__ volatile ( \ - "mov %5, %2 \n" \ - "1: \n" \ - "mov -%c7(%6, %2, %c8), %3 \n" \ - "movaps (%3, %0), %%xmm0 \n" \ - stereo("movaps %%xmm0, %%xmm1 \n") \ - "mulps %%xmm4, %%xmm0 \n" \ - stereo("mulps %%xmm5, %%xmm1 \n") \ - "2: \n" \ - "mov (%6, %2, %c8), %1 \n" \ - "movaps (%1, %0), %%xmm2 \n" \ - stereo("movaps %%xmm2, %%xmm3 \n") \ - "mulps (%4, %2, 8), %%xmm2 \n" \ - stereo("mulps 16(%4, %2, 8), %%xmm3 \n") \ - "addps %%xmm2, %%xmm0 \n" \ - stereo("addps %%xmm3, %%xmm1 \n") \ - "add $4, %2 \n" \ - "jl 2b \n" \ - "mov %5, %2 \n" \ - stereo("mov (%6, %2, %c8), %1 \n") \ - "movaps %%xmm0, (%3, %0) \n" \ - stereo("movaps %%xmm1, (%1, %0) \n") \ - "add $16, %0 \n" \ - "jl 1b \n" \ - : "+&r"(i), "=&r"(j), "=&r"(k), "=&r"(m) \ - : "r"(matrix_simd + in_ch), \ - "g"((intptr_t) - 4 * (in_ch - 1)), \ - "r"(samp + in_ch), \ - "i"(sizeof(float *)), "i"(sizeof(float *)/4) \ - : "memory" \ - ); - -static void ac3_downmix_sse(float **samples, float (*matrix)[2], - int out_ch, int in_ch, int len) -{ - int (*matrix_cmp)[2] = (int(*)[2])matrix; - intptr_t i, j, k, m; - - i = -len * sizeof(float); - if (in_ch == 5 && out_ch == 2 && - !(matrix_cmp[0][1] | matrix_cmp[2][0] | - matrix_cmp[3][1] | matrix_cmp[4][0] | - (matrix_cmp[1][0] ^ matrix_cmp[1][1]) | - (matrix_cmp[0][0] ^ matrix_cmp[2][1]))) { - MIX5(IF0, IF1); - } else if (in_ch == 5 && out_ch == 1 && - matrix_cmp[0][0] == matrix_cmp[2][0] && - matrix_cmp[3][0] == matrix_cmp[4][0]) { - MIX5(IF1, IF0); - } else { - DECLARE_ALIGNED(16, float, matrix_simd)[AC3_MAX_CHANNELS][2][4]; - float *samp[AC3_MAX_CHANNELS]; - - for (j = 0; j < in_ch; j++) - samp[j] = samples[j] + len; - - j = 2 * in_ch * sizeof(float); - __asm__ volatile ( - "1: \n" - "sub $8, %0 \n" - "movss (%2, %0), %%xmm4 \n" - "movss 4(%2, %0), %%xmm5 \n" - "shufps $0, %%xmm4, %%xmm4 \n" - "shufps $0, %%xmm5, %%xmm5 \n" - "movaps %%xmm4, (%1, %0, 4) \n" - "movaps %%xmm5, 16(%1, %0, 4) \n" - "jg 1b \n" - : "+&r"(j) - : "r"(matrix_simd), "r"(matrix) - : "memory" - ); - if (out_ch == 2) { - MIX_MISC(IF1); - } else { - MIX_MISC(IF0); - } - } -} - -#endif /* HAVE_SSE_INLINE && HAVE_7REGS */ - -av_cold void ff_ac3dsp_init_x86(AC3DSPContext *c, int bit_exact) -{ - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_MMX(cpu_flags)) { - c->ac3_exponent_min = ff_ac3_exponent_min_mmx; - c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmx; - c->ac3_lshift_int16 = ff_ac3_lshift_int16_mmx; - c->ac3_rshift_int32 = ff_ac3_rshift_int32_mmx; - } - if (EXTERNAL_AMD3DNOW(cpu_flags)) { - if (!bit_exact) { - c->float_to_fixed24 = ff_float_to_fixed24_3dnow; - } - } - if (EXTERNAL_MMXEXT(cpu_flags)) { - c->ac3_exponent_min = ff_ac3_exponent_min_mmxext; - c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_mmxext; - } - if (EXTERNAL_SSE(cpu_flags)) { - c->float_to_fixed24 = ff_float_to_fixed24_sse; - } - if (EXTERNAL_SSE2(cpu_flags)) { - c->ac3_exponent_min = ff_ac3_exponent_min_sse2; - c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_sse2; - c->float_to_fixed24 = ff_float_to_fixed24_sse2; - c->compute_mantissa_size = ff_ac3_compute_mantissa_size_sse2; - c->extract_exponents = ff_ac3_extract_exponents_sse2; - if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { - c->ac3_lshift_int16 = ff_ac3_lshift_int16_sse2; - c->ac3_rshift_int32 = ff_ac3_rshift_int32_sse2; - } - } - if (EXTERNAL_SSSE3(cpu_flags)) { - c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_ssse3; - if (!(cpu_flags & AV_CPU_FLAG_ATOM)) { - c->extract_exponents = ff_ac3_extract_exponents_ssse3; - } - } - -#if HAVE_SSE_INLINE && HAVE_7REGS - if (INLINE_SSE(cpu_flags)) { - c->downmix = ac3_downmix_sse; - } -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.c deleted file mode 100644 index 3bba80bd8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * MMX/SSE constants used across x86 dsp optimizations. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/mem.h" -#include "libavutil/x86/asm.h" // for xmm_reg -#include "constants.h" - -DECLARE_ALIGNED(8, const uint64_t, ff_wtwo) = 0x0002000200020002ULL; - -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1) = { 0x0001000100010001ULL, 0x0001000100010001ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_2) = { 0x0002000200020002ULL, 0x0002000200020002ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_3) = { 0x0003000300030003ULL, 0x0003000300030003ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_4) = { 0x0004000400040004ULL, 0x0004000400040004ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_5) = { 0x0005000500050005ULL, 0x0005000500050005ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8) = { 0x0008000800080008ULL, 0x0008000800080008ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0x0009000900090009ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) = 0x000F000F000F000FULL; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_16) = { 0x0010001000100010ULL, 0x0010001000100010ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_17) = { 0x0011001100110011ULL, 0x0011001100110011ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_20) = 0x0014001400140014ULL; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; -DECLARE_ALIGNED(8, const uint64_t, ff_pw_255) = 0x00ff00ff00ff00ffULL; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_512) = { 0x0200020002000200ULL, 0x0200020002000200ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pw_1019) = { 0x03FB03FB03FB03FBULL, 0x03FB03FB03FB03FBULL }; - -DECLARE_ALIGNED(16, const xmm_reg, ff_pb_0) = { 0x0000000000000000ULL, 0x0000000000000000ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pb_1) = { 0x0101010101010101ULL, 0x0101010101010101ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pb_3) = { 0x0303030303030303ULL, 0x0303030303030303ULL }; -DECLARE_ALIGNED(16, const xmm_reg, ff_pb_80) = { 0x8080808080808080ULL, 0x8080808080808080ULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC) = 0xFCFCFCFCFCFCFCFCULL; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.h deleted file mode 100644 index 8097bc49f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/constants.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * MMX/SSE constants used across x86 dsp optimizations. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_CONSTANTS_H -#define AVCODEC_X86_CONSTANTS_H - -#include - -#include "libavutil/x86/asm.h" - -extern const uint64_t ff_wtwo; - -extern const xmm_reg ff_pw_3; -extern const xmm_reg ff_pw_4; -extern const xmm_reg ff_pw_5; -extern const xmm_reg ff_pw_8; -extern const uint64_t ff_pw_15; -extern const xmm_reg ff_pw_16; -extern const xmm_reg ff_pw_18; -extern const uint64_t ff_pw_20; -extern const xmm_reg ff_pw_32; -extern const uint64_t ff_pw_42; -extern const uint64_t ff_pw_53; -extern const xmm_reg ff_pw_64; -extern const uint64_t ff_pw_96; -extern const uint64_t ff_pw_128; -extern const uint64_t ff_pw_255; - -extern const xmm_reg ff_pb_1; -extern const xmm_reg ff_pb_3; -extern const xmm_reg ff_pb_F8; -extern const uint64_t ff_pb_FC; - -#endif /* AVCODEC_X86_CONSTANTS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dcadsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dcadsp_init.c deleted file mode 100644 index 48880d628..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dcadsp_init.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2012-2014 Christophe Gisquet - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/dcadsp.h" - -void ff_decode_hf_sse(float dst[DCA_SUBBANDS][8], const int vq_num[DCA_SUBBANDS], - const int8_t hf_vq[1024][32], intptr_t vq_offset, - int scale[DCA_SUBBANDS][2], intptr_t start, intptr_t end); -void ff_decode_hf_sse2(float dst[DCA_SUBBANDS][8], const int vq_num[DCA_SUBBANDS], - const int8_t hf_vq[1024][32], intptr_t vq_offset, - int scale[DCA_SUBBANDS][2], intptr_t start, intptr_t end); -void ff_decode_hf_sse4(float dst[DCA_SUBBANDS][8], const int vq_num[DCA_SUBBANDS], - const int8_t hf_vq[1024][32], intptr_t vq_offset, - int scale[DCA_SUBBANDS][2], intptr_t start, intptr_t end); -void ff_dca_lfe_fir0_sse(float *out, const float *in, const float *coefs); -void ff_dca_lfe_fir1_sse(float *out, const float *in, const float *coefs); - -av_cold void ff_dcadsp_init_x86(DCADSPContext *s) -{ - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_SSE(cpu_flags)) { -#if ARCH_X86_32 - s->decode_hf = ff_decode_hf_sse; -#endif - s->lfe_fir[0] = ff_dca_lfe_fir0_sse; - s->lfe_fir[1] = ff_dca_lfe_fir1_sse; - } - - if (EXTERNAL_SSE2(cpu_flags)) { - s->decode_hf = ff_decode_hf_sse2; - } - - if (EXTERNAL_SSE4(cpu_flags)) { - s->decode_hf = ff_decode_hf_sse4; - } -} - - -#define SYNTH_FILTER_FUNC(opt) \ -void ff_synth_filter_inner_##opt(float *synth_buf_ptr, float synth_buf2[32], \ - const float window[512], \ - float out[32], intptr_t offset, float scale); \ -static void synth_filter_##opt(FFTContext *imdct, \ - float *synth_buf_ptr, int *synth_buf_offset, \ - float synth_buf2[32], const float window[512], \ - float out[32], const float in[32], float scale) \ -{ \ - float *synth_buf= synth_buf_ptr + *synth_buf_offset; \ - \ - imdct->imdct_half(imdct, synth_buf, in); \ - \ - ff_synth_filter_inner_##opt(synth_buf, synth_buf2, window, \ - out, *synth_buf_offset, scale); \ - \ - *synth_buf_offset = (*synth_buf_offset - 32) & 511; \ -} \ - -#if HAVE_YASM -#if ARCH_X86_32 -SYNTH_FILTER_FUNC(sse) -#endif -SYNTH_FILTER_FUNC(sse2) -SYNTH_FILTER_FUNC(avx) -SYNTH_FILTER_FUNC(fma3) -#endif /* HAVE_YASM */ - -av_cold void ff_synth_filter_init_x86(SynthFilterContext *s) -{ -#if HAVE_YASM - int cpu_flags = av_get_cpu_flags(); - -#if ARCH_X86_32 - if (EXTERNAL_SSE(cpu_flags)) { - s->synth_filter_float = synth_filter_sse; - } -#endif - if (EXTERNAL_SSE2(cpu_flags)) { - s->synth_filter_float = synth_filter_sse2; - } - if (EXTERNAL_AVX(cpu_flags)) { - s->synth_filter_float = synth_filter_avx; - } - if (EXTERNAL_FMA3(cpu_flags)) { - s->synth_filter_float = synth_filter_fma3; - } -#endif /* HAVE_YASM */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dct_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dct_init.c deleted file mode 100644 index 85e2d0c3e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dct_init.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/dct.h" - -void ff_dct32_float_sse(FFTSample *out, const FFTSample *in); -void ff_dct32_float_sse2(FFTSample *out, const FFTSample *in); -void ff_dct32_float_avx(FFTSample *out, const FFTSample *in); - -av_cold void ff_dct_init_x86(DCTContext *s) -{ - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_SSE(cpu_flags)) - s->dct32 = ff_dct32_float_sse; - if (EXTERNAL_SSE2(cpu_flags)) - s->dct32 = ff_dct32_float_sse2; - if (EXTERNAL_AVX(cpu_flags)) - s->dct32 = ff_dct32_float_avx; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.c deleted file mode 100644 index 04c514f4f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * MMX optimized discrete wavelet transform - * Copyright (c) 2002-2004 Michael Niedermayer - * Copyright (c) 2010 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/x86/asm.h" -#include "dsputil_x86.h" -#include "dirac_dwt.h" - -#define COMPOSE_VERTICAL(ext, align) \ -void ff_vertical_compose53iL0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width); \ -void ff_vertical_compose_dirac53iH0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width); \ -void ff_vertical_compose_dd137iL0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width); \ -void ff_vertical_compose_dd97iH0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, IDWTELEM *b3, IDWTELEM *b4, int width); \ -void ff_vertical_compose_haar##ext(IDWTELEM *b0, IDWTELEM *b1, int width); \ -void ff_horizontal_compose_haar0i##ext(IDWTELEM *b, IDWTELEM *tmp, int w);\ -void ff_horizontal_compose_haar1i##ext(IDWTELEM *b, IDWTELEM *tmp, int w);\ -\ -static void vertical_compose53iL0##ext(IDWTELEM *b0, IDWTELEM *b1, IDWTELEM *b2, int width) \ -{ \ - int i, width_align = width&~(align-1); \ -\ - for(i=width_align; i>1;\ - int x= w2 - (w2&(align-1));\ - ff_horizontal_compose_haar0i##ext(b, tmp, w);\ -\ - for (; x < w2; x++) {\ - b[2*x ] = tmp[x];\ - b[2*x+1] = COMPOSE_HAARiH0(b[x+w2], tmp[x]);\ - }\ -}\ -static void horizontal_compose_haar1i##ext(IDWTELEM *b, IDWTELEM *tmp, int w)\ -{\ - int w2= w>>1;\ - int x= w2 - (w2&(align-1));\ - ff_horizontal_compose_haar1i##ext(b, tmp, w);\ -\ - for (; x < w2; x++) {\ - b[2*x ] = (tmp[x] + 1)>>1;\ - b[2*x+1] = (COMPOSE_HAARiH0(b[x+w2], tmp[x]) + 1)>>1;\ - }\ -}\ -\ - -#if HAVE_YASM -#if !ARCH_X86_64 -COMPOSE_VERTICAL(_mmx, 4) -#endif -COMPOSE_VERTICAL(_sse2, 8) - - -void ff_horizontal_compose_dd97i_ssse3(IDWTELEM *b, IDWTELEM *tmp, int w); - -static void horizontal_compose_dd97i_ssse3(IDWTELEM *b, IDWTELEM *tmp, int w) -{ - int w2= w>>1; - int x= w2 - (w2&7); - ff_horizontal_compose_dd97i_ssse3(b, tmp, w); - - for (; x < w2; x++) { - b[2*x ] = (tmp[x] + 1)>>1; - b[2*x+1] = (COMPOSE_DD97iH0(tmp[x-1], tmp[x], b[x+w2], tmp[x+1], tmp[x+2]) + 1)>>1; - } -} -#endif - -void ff_spatial_idwt_init_mmx(DWTContext *d, enum dwt_type type) -{ -#if HAVE_YASM - int mm_flags = av_get_cpu_flags(); - -#if !ARCH_X86_64 - if (!(mm_flags & AV_CPU_FLAG_MMX)) - return; - - switch (type) { - case DWT_DIRAC_DD9_7: - d->vertical_compose_l0 = (void*)vertical_compose53iL0_mmx; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0_mmx; - break; - case DWT_DIRAC_LEGALL5_3: - d->vertical_compose_l0 = (void*)vertical_compose53iL0_mmx; - d->vertical_compose_h0 = (void*)vertical_compose_dirac53iH0_mmx; - break; - case DWT_DIRAC_DD13_7: - d->vertical_compose_l0 = (void*)vertical_compose_dd137iL0_mmx; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0_mmx; - break; - case DWT_DIRAC_HAAR0: - d->vertical_compose = (void*)vertical_compose_haar_mmx; - d->horizontal_compose = horizontal_compose_haar0i_mmx; - break; - case DWT_DIRAC_HAAR1: - d->vertical_compose = (void*)vertical_compose_haar_mmx; - d->horizontal_compose = horizontal_compose_haar1i_mmx; - break; - } -#endif - - if (!(mm_flags & AV_CPU_FLAG_SSE2)) - return; - - switch (type) { - case DWT_DIRAC_DD9_7: - d->vertical_compose_l0 = (void*)vertical_compose53iL0_sse2; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0_sse2; - break; - case DWT_DIRAC_LEGALL5_3: - d->vertical_compose_l0 = (void*)vertical_compose53iL0_sse2; - d->vertical_compose_h0 = (void*)vertical_compose_dirac53iH0_sse2; - break; - case DWT_DIRAC_DD13_7: - d->vertical_compose_l0 = (void*)vertical_compose_dd137iL0_sse2; - d->vertical_compose_h0 = (void*)vertical_compose_dd97iH0_sse2; - break; - case DWT_DIRAC_HAAR0: - d->vertical_compose = (void*)vertical_compose_haar_sse2; - d->horizontal_compose = horizontal_compose_haar0i_sse2; - break; - case DWT_DIRAC_HAAR1: - d->vertical_compose = (void*)vertical_compose_haar_sse2; - d->horizontal_compose = horizontal_compose_haar1i_sse2; - break; - } - - if (!(mm_flags & AV_CPU_FLAG_SSSE3)) - return; - - switch (type) { - case DWT_DIRAC_DD9_7: - d->horizontal_compose = horizontal_compose_dd97i_ssse3; - break; - } -#endif // HAVE_YASM -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.h deleted file mode 100644 index 126b29029..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dirac_dwt.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_DIRAC_DWT_H -#define AVCODEC_X86_DIRAC_DWT_H - -#include "libavcodec/dirac_dwt.h" - -void ff_horizontal_compose_dd97i_end_c(IDWTELEM *b, IDWTELEM *tmp, int w2, int x); -void ff_horizontal_compose_haar1i_end_c(IDWTELEM *b, IDWTELEM *tmp, int w2, int x); -void ff_horizontal_compose_haar0i_end_c(IDWTELEM *b, IDWTELEM *tmp, int w2, int x); - -void ff_spatial_idwt_init_mmx(DWTContext *d, enum dwt_type type); - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.c deleted file mode 100644 index a28bb8206..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2010 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "dsputil_x86.h" -#include "diracdsp_mmx.h" - -void ff_put_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height); -void ff_put_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height); -void ff_put_signed_rect_clamped_mmx(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height); -void ff_put_signed_rect_clamped_sse2(uint8_t *dst, int dst_stride, const int16_t *src, int src_stride, int width, int height); - -#define HPEL_FILTER(MMSIZE, EXT) \ - void ff_dirac_hpel_filter_v_ ## EXT(uint8_t *, const uint8_t *, int, int); \ - void ff_dirac_hpel_filter_h_ ## EXT(uint8_t *, const uint8_t *, int); \ - \ - static void dirac_hpel_filter_ ## EXT(uint8_t *dsth, uint8_t *dstv, uint8_t *dstc, \ - const uint8_t *src, int stride, int width, int height) \ - { \ - while( height-- ) \ - { \ - ff_dirac_hpel_filter_v_ ## EXT(dstv-MMSIZE, src-MMSIZE, stride, width+MMSIZE+5); \ - ff_dirac_hpel_filter_h_ ## EXT(dsth, src, width); \ - ff_dirac_hpel_filter_h_ ## EXT(dstc, dstv, width); \ - \ - dsth += stride; \ - dstv += stride; \ - dstc += stride; \ - src += stride; \ - } \ - } - -#if !ARCH_X86_64 -HPEL_FILTER(8, mmx) -#endif -HPEL_FILTER(16, sse2) - -#define PIXFUNC(PFX, IDX, EXT) \ - /*MMXDISABLEDc->PFX ## _dirac_pixels_tab[0][IDX] = ff_ ## PFX ## _dirac_pixels8_ ## EXT;*/ \ - c->PFX ## _dirac_pixels_tab[1][IDX] = ff_ ## PFX ## _dirac_pixels16_ ## EXT; \ - c->PFX ## _dirac_pixels_tab[2][IDX] = ff_ ## PFX ## _dirac_pixels32_ ## EXT - -void ff_diracdsp_init_mmx(DiracDSPContext* c) -{ - int mm_flags = av_get_cpu_flags(); - - if (!(mm_flags & AV_CPU_FLAG_MMX)) - return; - -#if HAVE_YASM - c->add_dirac_obmc[0] = ff_add_dirac_obmc8_mmx; -#if !ARCH_X86_64 - c->add_dirac_obmc[1] = ff_add_dirac_obmc16_mmx; - c->add_dirac_obmc[2] = ff_add_dirac_obmc32_mmx; - c->dirac_hpel_filter = dirac_hpel_filter_mmx; - c->add_rect_clamped = ff_add_rect_clamped_mmx; - c->put_signed_rect_clamped = ff_put_signed_rect_clamped_mmx; -#endif -#endif - -#if HAVE_MMX_INLINE - PIXFUNC(put, 0, mmx); - PIXFUNC(avg, 0, mmx); -#endif - -#if HAVE_MMXEXT_INLINE - if (mm_flags & AV_CPU_FLAG_MMX2) { - PIXFUNC(avg, 0, mmxext); - } -#endif - - if (mm_flags & AV_CPU_FLAG_SSE2) { -#if HAVE_YASM - c->dirac_hpel_filter = dirac_hpel_filter_sse2; - c->add_rect_clamped = ff_add_rect_clamped_sse2; - c->put_signed_rect_clamped = ff_put_signed_rect_clamped_sse2; - - c->add_dirac_obmc[1] = ff_add_dirac_obmc16_sse2; - c->add_dirac_obmc[2] = ff_add_dirac_obmc32_sse2; -#endif -#if HAVE_SSE2_INLINE - c->put_dirac_pixels_tab[1][0] = ff_put_dirac_pixels16_sse2; - c->avg_dirac_pixels_tab[1][0] = ff_avg_dirac_pixels16_sse2; - c->put_dirac_pixels_tab[2][0] = ff_put_dirac_pixels32_sse2; - c->avg_dirac_pixels_tab[2][0] = ff_avg_dirac_pixels32_sse2; -#endif - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.h deleted file mode 100644 index 89858544f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_mmx.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2010 David Conrad - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_DIRACDSP_H -#define AVCODEC_X86_DIRACDSP_H - -#include "libavcodec/diracdsp.h" - -void ff_diracdsp_init_mmx(DiracDSPContext* c); - -DECL_DIRAC_PIXOP(put, mmx); -DECL_DIRAC_PIXOP(avg, mmx); -DECL_DIRAC_PIXOP(avg, mmxext); - -void ff_put_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h); -void ff_avg_dirac_pixels16_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h); -void ff_put_dirac_pixels32_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h); -void ff_avg_dirac_pixels32_sse2(uint8_t *dst, const uint8_t *src[5], int stride, int h); - -void ff_add_rect_clamped_mmx(uint8_t *, const uint16_t *, int, const int16_t *, int, int, int); -void ff_add_rect_clamped_sse2(uint8_t *, const uint16_t *, int, const int16_t *, int, int, int); - -void ff_add_dirac_obmc8_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); -void ff_add_dirac_obmc16_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); -void ff_add_dirac_obmc32_mmx(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); - -void ff_add_dirac_obmc16_sse2(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); -void ff_add_dirac_obmc32_sse2(uint16_t *dst, const uint8_t *src, int stride, const uint8_t *obmc_weight, int yblen); - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_yasm.asm b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_yasm.asm deleted file mode 100644 index 3e9765b42..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/diracdsp_yasm.asm +++ /dev/null @@ -1,264 +0,0 @@ -;****************************************************************************** -;* Copyright (c) 2010 David Conrad -;* -;* This file is part of FFmpeg. -;* -;* FFmpeg is free software; you can redistribute it and/or -;* modify it under the terms of the GNU Lesser General Public -;* License as published by the Free Software Foundation; either -;* version 2.1 of the License, or (at your option) any later version. -;* -;* FFmpeg is distributed in the hope that it will be useful, -;* but WITHOUT ANY WARRANTY; without even the implied warranty of -;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -;* Lesser General Public License for more details. -;* -;* You should have received a copy of the GNU Lesser General Public -;* License along with FFmpeg; if not, write to the Free Software -;* 51, Inc., Foundation Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -;****************************************************************************** - -%include "libavutil/x86/x86util.asm" - -SECTION_RODATA -pw_3: times 8 dw 3 -pw_7: times 8 dw 7 -pw_16: times 8 dw 16 -pw_32: times 8 dw 32 -pb_128: times 16 db 128 - -section .text - -%macro UNPACK_ADD 6 - mov%5 %1, %3 - mov%6 m5, %4 - mova m4, %1 - mova %2, m5 - punpcklbw %1, m7 - punpcklbw m5, m7 - punpckhbw m4, m7 - punpckhbw %2, m7 - paddw %1, m5 - paddw %2, m4 -%endmacro - -%macro HPEL_FILTER 1 -; dirac_hpel_filter_v_sse2(uint8_t *dst, uint8_t *src, int stride, int width); -cglobal dirac_hpel_filter_v_%1, 4,6,8, dst, src, stride, width, src0, stridex3 - mov src0q, srcq - lea stridex3q, [3*strideq] - sub src0q, stridex3q - pxor m7, m7 -.loop: - ; 7*(src[0] + src[1]) - UNPACK_ADD m0, m1, [srcq], [srcq + strideq], a,a - pmullw m0, [pw_7] - pmullw m1, [pw_7] - - ; 3*( ... + src[-2] + src[3]) - UNPACK_ADD m2, m3, [src0q + strideq], [srcq + stridex3q], a,a - paddw m0, m2 - paddw m1, m3 - pmullw m0, [pw_3] - pmullw m1, [pw_3] - - ; ... - 7*(src[-1] + src[2]) - UNPACK_ADD m2, m3, [src0q + strideq*2], [srcq + strideq*2], a,a - pmullw m2, [pw_7] - pmullw m3, [pw_7] - psubw m0, m2 - psubw m1, m3 - - ; ... - (src[-3] + src[4]) - UNPACK_ADD m2, m3, [src0q], [srcq + strideq*4], a,a - psubw m0, m2 - psubw m1, m3 - - paddw m0, [pw_16] - paddw m1, [pw_16] - psraw m0, 5 - psraw m1, 5 - packuswb m0, m1 - mova [dstq], m0 - add dstq, mmsize - add srcq, mmsize - add src0q, mmsize - sub widthd, mmsize - jg .loop - RET - -; dirac_hpel_filter_h_sse2(uint8_t *dst, uint8_t *src, int width); -cglobal dirac_hpel_filter_h_%1, 3,3,8, dst, src, width - dec widthd - pxor m7, m7 - and widthd, ~(mmsize-1) -.loop: - ; 7*(src[0] + src[1]) - UNPACK_ADD m0, m1, [srcq + widthq], [srcq + widthq + 1], u,u - pmullw m0, [pw_7] - pmullw m1, [pw_7] - - ; 3*( ... + src[-2] + src[3]) - UNPACK_ADD m2, m3, [srcq + widthq - 2], [srcq + widthq + 3], u,u - paddw m0, m2 - paddw m1, m3 - pmullw m0, [pw_3] - pmullw m1, [pw_3] - - ; ... - 7*(src[-1] + src[2]) - UNPACK_ADD m2, m3, [srcq + widthq - 1], [srcq + widthq + 2], u,u - pmullw m2, [pw_7] - pmullw m3, [pw_7] - psubw m0, m2 - psubw m1, m3 - - ; ... - (src[-3] + src[4]) - UNPACK_ADD m2, m3, [srcq + widthq - 3], [srcq + widthq + 4], u,u - psubw m0, m2 - psubw m1, m3 - - paddw m0, [pw_16] - paddw m1, [pw_16] - psraw m0, 5 - psraw m1, 5 - packuswb m0, m1 - mova [dstq + widthq], m0 - sub widthd, mmsize - jge .loop - RET -%endmacro - -%macro PUT_RECT 1 -; void put_rect_clamped(uint8_t *dst, int dst_stride, int16_t *src, int src_stride, int width, int height) -cglobal put_signed_rect_clamped_%1, 5,9,3, dst, dst_stride, src, src_stride, w, dst2, src2 - mova m0, [pb_128] - add wd, (mmsize-1) - and wd, ~(mmsize-1) - -%if ARCH_X86_64 - movsxd dst_strideq, dst_strided - movsxd src_strideq, src_strided - mov r7d, r5m - mov r8d, wd - %define wspill r8d - %define hd r7d -%else - mov r4m, wd - %define wspill r4m - %define hd r5mp -%endif - -.loopy - lea src2q, [srcq+src_strideq*2] - lea dst2q, [dstq+dst_strideq] -.loopx: - sub wd, mmsize - mova m1, [srcq +2*wq] - mova m2, [src2q+2*wq] - packsswb m1, [srcq +2*wq+mmsize] - packsswb m2, [src2q+2*wq+mmsize] - paddb m1, m0 - paddb m2, m0 - mova [dstq +wq], m1 - mova [dst2q+wq], m2 - jg .loopx - - lea srcq, [srcq+src_strideq*4] - lea dstq, [dstq+dst_strideq*2] - sub hd, 2 - mov wd, wspill - jg .loopy - RET -%endm - -%macro ADD_RECT 1 -; void add_rect_clamped(uint8_t *dst, uint16_t *src, int stride, int16_t *idwt, int idwt_stride, int width, int height) -cglobal add_rect_clamped_%1, 7,9,3, dst, src, stride, idwt, idwt_stride, w, h - mova m0, [pw_32] - add wd, (mmsize-1) - and wd, ~(mmsize-1) - -%if ARCH_X86_64 - movsxd strideq, strided - movsxd idwt_strideq, idwt_strided - mov r8d, wd - %define wspill r8d -%else - mov r5m, wd - %define wspill r5m -%endif - -.loop: - sub wd, mmsize - movu m1, [srcq +2*wq] ; FIXME: ensure alignment - paddw m1, m0 - psraw m1, 6 - movu m2, [srcq +2*wq+mmsize] ; FIXME: ensure alignment - paddw m2, m0 - psraw m2, 6 - paddw m1, [idwtq+2*wq] - paddw m2, [idwtq+2*wq+mmsize] - packuswb m1, m2 - mova [dstq +wq], m1 - jg .loop - - lea srcq, [srcq + 2*strideq] - add dstq, strideq - lea idwtq, [idwtq+ 2*idwt_strideq] - sub hd, 1 - mov wd, wspill - jg .loop - RET -%endm - -%macro ADD_OBMC 2 -; void add_obmc(uint16_t *dst, uint8_t *src, int stride, uint8_t *obmc_weight, int yblen) -cglobal add_dirac_obmc%1_%2, 6,6,5, dst, src, stride, obmc, yblen - pxor m4, m4 -.loop: -%assign i 0 -%rep %1 / mmsize - mova m0, [srcq+i] - mova m1, m0 - punpcklbw m0, m4 - punpckhbw m1, m4 - mova m2, [obmcq+i] - mova m3, m2 - punpcklbw m2, m4 - punpckhbw m3, m4 - pmullw m0, m2 - pmullw m1, m3 - movu m2, [dstq+2*i] - movu m3, [dstq+2*i+mmsize] - paddw m0, m2 - paddw m1, m3 - movu [dstq+2*i], m0 - movu [dstq+2*i+mmsize], m1 -%assign i i+mmsize -%endrep - lea srcq, [srcq+strideq] - lea dstq, [dstq+2*strideq] - add obmcq, 32 - sub yblend, 1 - jg .loop - RET -%endm - -INIT_MMX -%if ARCH_X86_64 == 0 -PUT_RECT mmx -ADD_RECT mmx - -HPEL_FILTER mmx -ADD_OBMC 32, mmx -ADD_OBMC 16, mmx -%endif -ADD_OBMC 8, mmx - -INIT_XMM -PUT_RECT sse2 -ADD_RECT sse2 - -HPEL_FILTER sse2 -ADD_OBMC 32, sse2 -ADD_OBMC 16, sse2 diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_init.c deleted file mode 100644 index df7918a23..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_init.c +++ /dev/null @@ -1,734 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/dsputil.h" -#include "libavcodec/simple_idct.h" -#include "dsputil_x86.h" -#include "idct_xvid.h" - -void ff_put_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, - int dstStride, int src1Stride, int h); -void ff_put_no_rnd_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, - uint8_t *src2, int dstStride, - int src1Stride, int h); -void ff_avg_pixels8_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, - int dstStride, int src1Stride, int h); -void ff_put_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, - int dstStride, int src1Stride, int h); -void ff_avg_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, - int dstStride, int src1Stride, int h); -void ff_put_no_rnd_pixels16_l2_mmxext(uint8_t *dst, uint8_t *src1, uint8_t *src2, - int dstStride, int src1Stride, int h); -void ff_put_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, int h); -void ff_avg_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, int h); -void ff_put_no_rnd_mpeg4_qpel16_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, - int h); -void ff_put_mpeg4_qpel8_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, int h); -void ff_avg_mpeg4_qpel8_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, int h); -void ff_put_no_rnd_mpeg4_qpel8_h_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride, - int h); -void ff_put_mpeg4_qpel16_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -void ff_avg_mpeg4_qpel16_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -void ff_put_no_rnd_mpeg4_qpel16_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -void ff_put_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -void ff_avg_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src, - int dstStride, int srcStride); -#define ff_put_no_rnd_pixels16_mmxext ff_put_pixels16_mmxext -#define ff_put_no_rnd_pixels8_mmxext ff_put_pixels8_mmxext - -void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale); -void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale); - -int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2, - int order); -int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2, - int order); -int32_t ff_scalarproduct_and_madd_int16_mmxext(int16_t *v1, const int16_t *v2, - const int16_t *v3, - int order, int mul); -int32_t ff_scalarproduct_and_madd_int16_sse2(int16_t *v1, const int16_t *v2, - const int16_t *v3, - int order, int mul); -int32_t ff_scalarproduct_and_madd_int16_ssse3(int16_t *v1, const int16_t *v2, - const int16_t *v3, - int order, int mul); - -void ff_apply_window_int16_round_mmxext(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -void ff_apply_window_int16_round_sse2(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -void ff_apply_window_int16_mmxext(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -void ff_apply_window_int16_sse2(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -void ff_apply_window_int16_ssse3(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); -void ff_apply_window_int16_ssse3_atom(int16_t *output, const int16_t *input, - const int16_t *window, unsigned int len); - -void ff_bswap32_buf_ssse3(uint32_t *dst, const uint32_t *src, int w); -void ff_bswap32_buf_sse2(uint32_t *dst, const uint32_t *src, int w); - -void ff_add_hfyu_median_prediction_mmxext(uint8_t *dst, const uint8_t *top, - const uint8_t *diff, int w, - int *left, int *left_top); -int ff_add_hfyu_left_prediction_ssse3(uint8_t *dst, const uint8_t *src, - int w, int left); -int ff_add_hfyu_left_prediction_sse4(uint8_t *dst, const uint8_t *src, - int w, int left); - -void ff_vector_clip_int32_mmx (int32_t *dst, const int32_t *src, - int32_t min, int32_t max, unsigned int len); -void ff_vector_clip_int32_sse2 (int32_t *dst, const int32_t *src, - int32_t min, int32_t max, unsigned int len); -void ff_vector_clip_int32_int_sse2(int32_t *dst, const int32_t *src, - int32_t min, int32_t max, unsigned int len); -void ff_vector_clip_int32_sse4 (int32_t *dst, const int32_t *src, - int32_t min, int32_t max, unsigned int len); - -#if HAVE_YASM - -PIXELS16(static, ff_avg, , , _mmxext) -PIXELS16(static, ff_put, , , _mmxext) - -#define QPEL_OP(OPNAME, RND, MMX) \ -static void OPNAME ## qpel8_mc00_ ## MMX (uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## pixels8_ ## MMX(dst, src, stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc10_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[8]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \ - stride, 8); \ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, src, half, \ - stride, stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc20_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## mpeg4_qpel8_h_lowpass_ ## MMX(dst, src, stride, \ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc30_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[8]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(half, src, 8, \ - stride, 8); \ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, src + 1, half, stride, \ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc01_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[8]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \ - 8, stride); \ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, src, half, \ - stride, stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc02_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, src, \ - stride, stride); \ -} \ - \ -static void OPNAME ## qpel8_mc03_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[8]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(half, src, \ - 8, stride); \ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, src + stride, half, stride,\ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc11_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc31_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc13_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc33_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc21_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc23_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half) + 64; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## mpeg4_qpel8_v_lowpass_ ## MMX(halfHV, halfH, 8, 8);\ - ff_ ## OPNAME ## pixels8_l2_ ## MMX(dst, halfH + 8, halfHV, \ - stride, 8, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc12_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src, halfH, \ - 8, stride, 9); \ - ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc32_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[8 + 9]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_put ## RND ## pixels8_l2_ ## MMX(halfH, src + 1, halfH, 8, \ - stride, 9); \ - ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel8_mc22_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[9]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel8_h_lowpass_ ## MMX(halfH, src, 8, \ - stride, 9); \ - ff_ ## OPNAME ## mpeg4_qpel8_v_lowpass_ ## MMX(dst, halfH, \ - stride, 8); \ -} \ - \ -static void OPNAME ## qpel16_mc00_ ## MMX (uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## pixels16_ ## MMX(dst, src, stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc10_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[32]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \ - stride, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, \ - stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc20_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## mpeg4_qpel16_h_lowpass_ ## MMX(dst, src, \ - stride, stride, 16);\ -} \ - \ -static void OPNAME ## qpel16_mc30_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[32]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(half, src, 16, \ - stride, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, src + 1, half, \ - stride, stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc01_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[32]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \ - stride); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, src, half, stride, \ - stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc02_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, src, \ - stride, stride); \ -} \ - \ -static void OPNAME ## qpel16_mc03_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t temp[32]; \ - uint8_t * const half = (uint8_t*)temp; \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(half, src, 16, \ - stride); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, src+stride, half, \ - stride, stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc11_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc31_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc13_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc33_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc21_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc23_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[16 * 2 + 17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half) + 256; \ - uint8_t * const halfHV = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## mpeg4_qpel16_v_lowpass_ ## MMX(halfHV, halfH, \ - 16, 16); \ - ff_ ## OPNAME ## pixels16_l2_ ## MMX(dst, halfH + 16, halfHV, \ - stride, 16, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc12_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src, halfH, 16, \ - stride, 17); \ - ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \ - stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc32_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_put ## RND ## pixels16_l2_ ## MMX(halfH, src + 1, halfH, 16, \ - stride, 17); \ - ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \ - stride, 16); \ -} \ - \ -static void OPNAME ## qpel16_mc22_ ## MMX(uint8_t *dst, uint8_t *src, \ - ptrdiff_t stride) \ -{ \ - uint64_t half[17 * 2]; \ - uint8_t * const halfH = ((uint8_t*)half); \ - ff_put ## RND ## mpeg4_qpel16_h_lowpass_ ## MMX(halfH, src, 16, \ - stride, 17); \ - ff_ ## OPNAME ## mpeg4_qpel16_v_lowpass_ ## MMX(dst, halfH, \ - stride, 16); \ -} - -QPEL_OP(put_, _, mmxext) -QPEL_OP(avg_, _, mmxext) -QPEL_OP(put_no_rnd_, _no_rnd_, mmxext) -#endif /* HAVE_YASM */ - -#define SET_QPEL_FUNCS(PFX, IDX, SIZE, CPU, PREFIX) \ - do { \ - c->PFX ## _pixels_tab[IDX][ 0] = PREFIX ## PFX ## SIZE ## _mc00_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 1] = PREFIX ## PFX ## SIZE ## _mc10_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 2] = PREFIX ## PFX ## SIZE ## _mc20_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 3] = PREFIX ## PFX ## SIZE ## _mc30_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 4] = PREFIX ## PFX ## SIZE ## _mc01_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 5] = PREFIX ## PFX ## SIZE ## _mc11_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 6] = PREFIX ## PFX ## SIZE ## _mc21_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 7] = PREFIX ## PFX ## SIZE ## _mc31_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 8] = PREFIX ## PFX ## SIZE ## _mc02_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][ 9] = PREFIX ## PFX ## SIZE ## _mc12_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][10] = PREFIX ## PFX ## SIZE ## _mc22_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][11] = PREFIX ## PFX ## SIZE ## _mc32_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][12] = PREFIX ## PFX ## SIZE ## _mc03_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][13] = PREFIX ## PFX ## SIZE ## _mc13_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][14] = PREFIX ## PFX ## SIZE ## _mc23_ ## CPU; \ - c->PFX ## _pixels_tab[IDX][15] = PREFIX ## PFX ## SIZE ## _mc33_ ## CPU; \ - } while (0) - -static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_MMX_INLINE - const int high_bit_depth = avctx->bits_per_raw_sample > 8; - - c->put_pixels_clamped = ff_put_pixels_clamped_mmx; - c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_mmx; - c->add_pixels_clamped = ff_add_pixels_clamped_mmx; - - if (!high_bit_depth) { - c->clear_block = ff_clear_block_mmx; - c->clear_blocks = ff_clear_blocks_mmx; - c->draw_edges = ff_draw_edges_mmx; - } - -#if CONFIG_VIDEODSP && (ARCH_X86_32 || !HAVE_YASM) - c->gmc = ff_gmc_mmx; -#endif - - c->add_bytes = ff_add_bytes_mmx; -#endif /* HAVE_MMX_INLINE */ - -#if HAVE_MMX_EXTERNAL - if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) { - c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx; - c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx; - } - - c->vector_clip_int32 = ff_vector_clip_int32_mmx; -#endif /* HAVE_MMX_EXTERNAL */ -} - -static av_cold void dsputil_init_mmxext(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_MMXEXT_EXTERNAL - SET_QPEL_FUNCS(avg_qpel, 0, 16, mmxext, ); - SET_QPEL_FUNCS(avg_qpel, 1, 8, mmxext, ); - - SET_QPEL_FUNCS(put_qpel, 0, 16, mmxext, ); - SET_QPEL_FUNCS(put_qpel, 1, 8, mmxext, ); - SET_QPEL_FUNCS(put_no_rnd_qpel, 0, 16, mmxext, ); - SET_QPEL_FUNCS(put_no_rnd_qpel, 1, 8, mmxext, ); - - /* slower than cmov version on AMD */ - if (!(cpu_flags & AV_CPU_FLAG_3DNOW)) - c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_mmxext; - - c->scalarproduct_int16 = ff_scalarproduct_int16_mmxext; - c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_mmxext; - - if (avctx->flags & CODEC_FLAG_BITEXACT) { - c->apply_window_int16 = ff_apply_window_int16_mmxext; - } else { - c->apply_window_int16 = ff_apply_window_int16_round_mmxext; - } -#endif /* HAVE_MMXEXT_EXTERNAL */ -} - -static av_cold void dsputil_init_sse(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_SSE_INLINE - const int high_bit_depth = avctx->bits_per_raw_sample > 8; - - if (!high_bit_depth) { - if (!(CONFIG_MPEG_XVMC_DECODER && avctx->xvmc_acceleration > 1)) { - /* XvMCCreateBlocks() may not allocate 16-byte aligned blocks */ - c->clear_block = ff_clear_block_sse; - c->clear_blocks = ff_clear_blocks_sse; - } - } - - c->vector_clipf = ff_vector_clipf_sse; -#endif /* HAVE_SSE_INLINE */ - -#if HAVE_YASM -#if HAVE_INLINE_ASM && CONFIG_VIDEODSP - c->gmc = ff_gmc_sse; -#endif -#endif /* HAVE_YASM */ -} - -static av_cold void dsputil_init_sse2(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_SSE2_INLINE - const int high_bit_depth = avctx->bits_per_raw_sample > 8; - - if (!high_bit_depth && avctx->idct_algo == FF_IDCT_XVIDMMX && avctx->lowres == 0) { - c->idct_put = ff_idct_xvid_sse2_put; - c->idct_add = ff_idct_xvid_sse2_add; - c->idct = ff_idct_xvid_sse2; - c->idct_permutation_type = FF_SSE2_IDCT_PERM; - } -#endif /* HAVE_SSE2_INLINE */ - -#if HAVE_SSE2_EXTERNAL - c->scalarproduct_int16 = ff_scalarproduct_int16_sse2; - c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_sse2; - if (cpu_flags & AV_CPU_FLAG_ATOM) { - c->vector_clip_int32 = ff_vector_clip_int32_int_sse2; - } else { - c->vector_clip_int32 = ff_vector_clip_int32_sse2; - } - if (avctx->flags & CODEC_FLAG_BITEXACT) { - c->apply_window_int16 = ff_apply_window_int16_sse2; - } else if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { - c->apply_window_int16 = ff_apply_window_int16_round_sse2; - } - c->bswap_buf = ff_bswap32_buf_sse2; -#endif /* HAVE_SSE2_EXTERNAL */ -} - -static av_cold void dsputil_init_ssse3(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_SSSE3_EXTERNAL - c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_ssse3; - if (cpu_flags & AV_CPU_FLAG_SSE4) // not really SSE4, just slow on Conroe - c->add_hfyu_left_prediction = ff_add_hfyu_left_prediction_sse4; - - if (cpu_flags & AV_CPU_FLAG_ATOM) - c->apply_window_int16 = ff_apply_window_int16_ssse3_atom; - else - c->apply_window_int16 = ff_apply_window_int16_ssse3; - if (!(cpu_flags & (AV_CPU_FLAG_SSE42 | AV_CPU_FLAG_3DNOW))) // cachesplit - c->scalarproduct_and_madd_int16 = ff_scalarproduct_and_madd_int16_ssse3; - c->bswap_buf = ff_bswap32_buf_ssse3; -#endif /* HAVE_SSSE3_EXTERNAL */ -} - -static av_cold void dsputil_init_sse4(DSPContext *c, AVCodecContext *avctx, - int cpu_flags) -{ -#if HAVE_SSE4_EXTERNAL - c->vector_clip_int32 = ff_vector_clip_int32_sse4; -#endif /* HAVE_SSE4_EXTERNAL */ -} - -av_cold void ff_dsputil_init_x86(DSPContext *c, AVCodecContext *avctx) -{ - int cpu_flags = av_get_cpu_flags(); - -#if HAVE_7REGS && HAVE_INLINE_ASM - if (HAVE_MMX && cpu_flags & AV_CPU_FLAG_CMOV) - c->add_hfyu_median_prediction = ff_add_hfyu_median_prediction_cmov; -#endif - - if (X86_MMX(cpu_flags)) { -#if HAVE_INLINE_ASM - const int idct_algo = avctx->idct_algo; - - if (avctx->lowres == 0 && avctx->bits_per_raw_sample <= 8) { - if (idct_algo == FF_IDCT_AUTO || idct_algo == FF_IDCT_SIMPLEMMX) { - c->idct_put = ff_simple_idct_put_mmx; - c->idct_add = ff_simple_idct_add_mmx; - c->idct = ff_simple_idct_mmx; - c->idct_permutation_type = FF_SIMPLE_IDCT_PERM; - } else if (idct_algo == FF_IDCT_XVIDMMX) { - if (cpu_flags & AV_CPU_FLAG_SSE2) { - c->idct_put = ff_idct_xvid_sse2_put; - c->idct_add = ff_idct_xvid_sse2_add; - c->idct = ff_idct_xvid_sse2; - c->idct_permutation_type = FF_SSE2_IDCT_PERM; - } else if (cpu_flags & AV_CPU_FLAG_MMXEXT) { - c->idct_put = ff_idct_xvid_mmxext_put; - c->idct_add = ff_idct_xvid_mmxext_add; - c->idct = ff_idct_xvid_mmxext; - } else { - c->idct_put = ff_idct_xvid_mmx_put; - c->idct_add = ff_idct_xvid_mmx_add; - c->idct = ff_idct_xvid_mmx; - } - } - } -#endif /* HAVE_INLINE_ASM */ - - dsputil_init_mmx(c, avctx, cpu_flags); - } - - if (X86_MMXEXT(cpu_flags)) - dsputil_init_mmxext(c, avctx, cpu_flags); - - if (X86_SSE(cpu_flags)) - dsputil_init_sse(c, avctx, cpu_flags); - - if (X86_SSE2(cpu_flags)) - dsputil_init_sse2(c, avctx, cpu_flags); - - if (EXTERNAL_SSSE3(cpu_flags)) - dsputil_init_ssse3(c, avctx, cpu_flags); - - if (EXTERNAL_SSE4(cpu_flags)) - dsputil_init_sse4(c, avctx, cpu_flags); - - if (CONFIG_ENCODERS) - ff_dsputilenc_init_mmx(c, avctx); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_mmx.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_mmx.c deleted file mode 100644 index 805bacd44..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/dsputil_mmx.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * MMX optimized DSP utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * MMX optimization by Nick Kurshev - */ - -#include "config.h" -#include "libavutil/avassert.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/asm.h" -#include "libavcodec/videodsp.h" -#include "constants.h" -#include "dsputil_x86.h" -#include "diracdsp_mmx.h" - -#if HAVE_INLINE_ASM - -void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, - int line_size) -{ - const int16_t *p; - uint8_t *pix; - - /* read the pixels */ - p = block; - pix = pixels; - /* unrolled loop */ - __asm__ volatile ( - "movq (%3), %%mm0 \n\t" - "movq 8(%3), %%mm1 \n\t" - "movq 16(%3), %%mm2 \n\t" - "movq 24(%3), %%mm3 \n\t" - "movq 32(%3), %%mm4 \n\t" - "movq 40(%3), %%mm5 \n\t" - "movq 48(%3), %%mm6 \n\t" - "movq 56(%3), %%mm7 \n\t" - "packuswb %%mm1, %%mm0 \n\t" - "packuswb %%mm3, %%mm2 \n\t" - "packuswb %%mm5, %%mm4 \n\t" - "packuswb %%mm7, %%mm6 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm2, (%0, %1) \n\t" - "movq %%mm4, (%0, %1, 2) \n\t" - "movq %%mm6, (%0, %2) \n\t" - :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), - "r"(p) - : "memory"); - pix += line_size * 4; - p += 32; - - // if here would be an exact copy of the code above - // compiler would generate some very strange code - // thus using "r" - __asm__ volatile ( - "movq (%3), %%mm0 \n\t" - "movq 8(%3), %%mm1 \n\t" - "movq 16(%3), %%mm2 \n\t" - "movq 24(%3), %%mm3 \n\t" - "movq 32(%3), %%mm4 \n\t" - "movq 40(%3), %%mm5 \n\t" - "movq 48(%3), %%mm6 \n\t" - "movq 56(%3), %%mm7 \n\t" - "packuswb %%mm1, %%mm0 \n\t" - "packuswb %%mm3, %%mm2 \n\t" - "packuswb %%mm5, %%mm4 \n\t" - "packuswb %%mm7, %%mm6 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm2, (%0, %1) \n\t" - "movq %%mm4, (%0, %1, 2) \n\t" - "movq %%mm6, (%0, %2) \n\t" - :: "r"(pix), "r"((x86_reg)line_size), "r"((x86_reg)line_size * 3), "r"(p) - : "memory"); -} - -#define put_signed_pixels_clamped_mmx_half(off) \ - "movq "#off"(%2), %%mm1 \n\t" \ - "movq 16 + "#off"(%2), %%mm2 \n\t" \ - "movq 32 + "#off"(%2), %%mm3 \n\t" \ - "movq 48 + "#off"(%2), %%mm4 \n\t" \ - "packsswb 8 + "#off"(%2), %%mm1 \n\t" \ - "packsswb 24 + "#off"(%2), %%mm2 \n\t" \ - "packsswb 40 + "#off"(%2), %%mm3 \n\t" \ - "packsswb 56 + "#off"(%2), %%mm4 \n\t" \ - "paddb %%mm0, %%mm1 \n\t" \ - "paddb %%mm0, %%mm2 \n\t" \ - "paddb %%mm0, %%mm3 \n\t" \ - "paddb %%mm0, %%mm4 \n\t" \ - "movq %%mm1, (%0) \n\t" \ - "movq %%mm2, (%0, %3) \n\t" \ - "movq %%mm3, (%0, %3, 2) \n\t" \ - "movq %%mm4, (%0, %1) \n\t" - -void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, - int line_size) -{ - x86_reg line_skip = line_size; - x86_reg line_skip3; - - __asm__ volatile ( - "movq "MANGLE(ff_pb_80)", %%mm0 \n\t" - "lea (%3, %3, 2), %1 \n\t" - put_signed_pixels_clamped_mmx_half(0) - "lea (%0, %3, 4), %0 \n\t" - put_signed_pixels_clamped_mmx_half(64) - : "+&r"(pixels), "=&r"(line_skip3) - : "r"(block), "r"(line_skip) - : "memory"); -} - -void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, - int line_size) -{ - const int16_t *p; - uint8_t *pix; - int i; - - /* read the pixels */ - p = block; - pix = pixels; - MOVQ_ZERO(mm7); - i = 4; - do { - __asm__ volatile ( - "movq (%2), %%mm0 \n\t" - "movq 8(%2), %%mm1 \n\t" - "movq 16(%2), %%mm2 \n\t" - "movq 24(%2), %%mm3 \n\t" - "movq %0, %%mm4 \n\t" - "movq %1, %%mm6 \n\t" - "movq %%mm4, %%mm5 \n\t" - "punpcklbw %%mm7, %%mm4 \n\t" - "punpckhbw %%mm7, %%mm5 \n\t" - "paddsw %%mm4, %%mm0 \n\t" - "paddsw %%mm5, %%mm1 \n\t" - "movq %%mm6, %%mm5 \n\t" - "punpcklbw %%mm7, %%mm6 \n\t" - "punpckhbw %%mm7, %%mm5 \n\t" - "paddsw %%mm6, %%mm2 \n\t" - "paddsw %%mm5, %%mm3 \n\t" - "packuswb %%mm1, %%mm0 \n\t" - "packuswb %%mm3, %%mm2 \n\t" - "movq %%mm0, %0 \n\t" - "movq %%mm2, %1 \n\t" - : "+m"(*pix), "+m"(*(pix + line_size)) - : "r"(p) - : "memory"); - pix += line_size * 2; - p += 16; - } while (--i); -} - -#define CLEAR_BLOCKS(name, n) \ -void name(int16_t *blocks) \ -{ \ - __asm__ volatile ( \ - "pxor %%mm7, %%mm7 \n\t" \ - "mov %1, %%"REG_a" \n\t" \ - "1: \n\t" \ - "movq %%mm7, (%0, %%"REG_a") \n\t" \ - "movq %%mm7, 8(%0, %%"REG_a") \n\t" \ - "movq %%mm7, 16(%0, %%"REG_a") \n\t" \ - "movq %%mm7, 24(%0, %%"REG_a") \n\t" \ - "add $32, %%"REG_a" \n\t" \ - "js 1b \n\t" \ - :: "r"(((uint8_t *)blocks) + 128 * n), \ - "i"(-128 * n) \ - : "%"REG_a \ - ); \ -} -CLEAR_BLOCKS(ff_clear_blocks_mmx, 6) -CLEAR_BLOCKS(ff_clear_block_mmx, 1) - -void ff_clear_block_sse(int16_t *block) -{ - __asm__ volatile ( - "xorps %%xmm0, %%xmm0 \n" - "movaps %%xmm0, (%0) \n" - "movaps %%xmm0, 16(%0) \n" - "movaps %%xmm0, 32(%0) \n" - "movaps %%xmm0, 48(%0) \n" - "movaps %%xmm0, 64(%0) \n" - "movaps %%xmm0, 80(%0) \n" - "movaps %%xmm0, 96(%0) \n" - "movaps %%xmm0, 112(%0) \n" - :: "r"(block) - : "memory" - ); -} - -void ff_clear_blocks_sse(int16_t *blocks) -{ - __asm__ volatile ( - "xorps %%xmm0, %%xmm0 \n" - "mov %1, %%"REG_a" \n" - "1: \n" - "movaps %%xmm0, (%0, %%"REG_a") \n" - "movaps %%xmm0, 16(%0, %%"REG_a") \n" - "movaps %%xmm0, 32(%0, %%"REG_a") \n" - "movaps %%xmm0, 48(%0, %%"REG_a") \n" - "movaps %%xmm0, 64(%0, %%"REG_a") \n" - "movaps %%xmm0, 80(%0, %%"REG_a") \n" - "movaps %%xmm0, 96(%0, %%"REG_a") \n" - "movaps %%xmm0, 112(%0, %%"REG_a") \n" - "add $128, %%"REG_a" \n" - "js 1b \n" - :: "r"(((uint8_t *)blocks) + 128 * 6), - "i"(-128 * 6) - : "%"REG_a - ); -} - -void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w) -{ - x86_reg i = 0; - __asm__ volatile ( - "jmp 2f \n\t" - "1: \n\t" - "movq (%1, %0), %%mm0 \n\t" - "movq (%2, %0), %%mm1 \n\t" - "paddb %%mm0, %%mm1 \n\t" - "movq %%mm1, (%2, %0) \n\t" - "movq 8(%1, %0), %%mm0 \n\t" - "movq 8(%2, %0), %%mm1 \n\t" - "paddb %%mm0, %%mm1 \n\t" - "movq %%mm1, 8(%2, %0) \n\t" - "add $16, %0 \n\t" - "2: \n\t" - "cmp %3, %0 \n\t" - "js 1b \n\t" - : "+r"(i) - : "r"(src), "r"(dst), "r"((x86_reg)w - 15) - ); - for ( ; i < w; i++) - dst[i + 0] += src[i + 0]; -} - -/* Draw the edges of width 'w' of an image of size width, height - * this MMX version can only handle w == 8 || w == 16. */ -void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, - int w, int h, int sides) -{ - uint8_t *ptr, *last_line; - int i; - - last_line = buf + (height - 1) * wrap; - /* left and right */ - ptr = buf; - if (w == 8) { - __asm__ volatile ( - "1: \n\t" - "movd (%0), %%mm0 \n\t" - "punpcklbw %%mm0, %%mm0 \n\t" - "punpcklwd %%mm0, %%mm0 \n\t" - "punpckldq %%mm0, %%mm0 \n\t" - "movq %%mm0, -8(%0) \n\t" - "movq -8(%0, %2), %%mm1 \n\t" - "punpckhbw %%mm1, %%mm1 \n\t" - "punpckhwd %%mm1, %%mm1 \n\t" - "punpckhdq %%mm1, %%mm1 \n\t" - "movq %%mm1, (%0, %2) \n\t" - "add %1, %0 \n\t" - "cmp %3, %0 \n\t" - "jb 1b \n\t" - : "+r"(ptr) - : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height) - ); - } else if(w==16){ - __asm__ volatile ( - "1: \n\t" - "movd (%0), %%mm0 \n\t" - "punpcklbw %%mm0, %%mm0 \n\t" - "punpcklwd %%mm0, %%mm0 \n\t" - "punpckldq %%mm0, %%mm0 \n\t" - "movq %%mm0, -8(%0) \n\t" - "movq %%mm0, -16(%0) \n\t" - "movq -8(%0, %2), %%mm1 \n\t" - "punpckhbw %%mm1, %%mm1 \n\t" - "punpckhwd %%mm1, %%mm1 \n\t" - "punpckhdq %%mm1, %%mm1 \n\t" - "movq %%mm1, (%0, %2) \n\t" - "movq %%mm1, 8(%0, %2) \n\t" - "add %1, %0 \n\t" - "cmp %3, %0 \n\t" - "jb 1b \n\t" - : "+r"(ptr) - : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height) - ); - } else { - av_assert1(w == 4); - __asm__ volatile ( - "1: \n\t" - "movd (%0), %%mm0 \n\t" - "punpcklbw %%mm0, %%mm0 \n\t" - "punpcklwd %%mm0, %%mm0 \n\t" - "movd %%mm0, -4(%0) \n\t" - "movd -4(%0, %2), %%mm1 \n\t" - "punpcklbw %%mm1, %%mm1 \n\t" - "punpckhwd %%mm1, %%mm1 \n\t" - "punpckhdq %%mm1, %%mm1 \n\t" - "movd %%mm1, (%0, %2) \n\t" - "add %1, %0 \n\t" - "cmp %3, %0 \n\t" - "jb 1b \n\t" - : "+r"(ptr) - : "r"((x86_reg)wrap), "r"((x86_reg)width), "r"(ptr + wrap * height) - ); - } - - /* top and bottom (and hopefully also the corners) */ - if (sides & EDGE_TOP) { - for (i = 0; i < h; i += 4) { - ptr = buf - (i + 1) * wrap - w; - __asm__ volatile ( - "1: \n\t" - "movq (%1, %0), %%mm0 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm0, (%0, %2) \n\t" - "movq %%mm0, (%0, %2, 2) \n\t" - "movq %%mm0, (%0, %3) \n\t" - "add $8, %0 \n\t" - "cmp %4, %0 \n\t" - "jb 1b \n\t" - : "+r"(ptr) - : "r"((x86_reg)buf - (x86_reg)ptr - w), "r"((x86_reg) -wrap), - "r"((x86_reg) -wrap * 3), "r"(ptr + width + 2 * w) - ); - } - } - - if (sides & EDGE_BOTTOM) { - for (i = 0; i < h; i += 4) { - ptr = last_line + (i + 1) * wrap - w; - __asm__ volatile ( - "1: \n\t" - "movq (%1, %0), %%mm0 \n\t" - "movq %%mm0, (%0) \n\t" - "movq %%mm0, (%0, %2) \n\t" - "movq %%mm0, (%0, %2, 2) \n\t" - "movq %%mm0, (%0, %3) \n\t" - "add $8, %0 \n\t" - "cmp %4, %0 \n\t" - "jb 1b \n\t" - : "+r"(ptr) - : "r"((x86_reg)last_line - (x86_reg)ptr - w), - "r"((x86_reg)wrap), "r"((x86_reg)wrap * 3), - "r"(ptr + width + 2 * w) - ); - } - } -} - -typedef void emulated_edge_mc_func(uint8_t *dst, ptrdiff_t dst_stride, - const uint8_t *src, ptrdiff_t src_linesize, - int block_w, int block_h, - int src_x, int src_y, int w, int h); - -static av_always_inline void gmc(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height, - emulated_edge_mc_func *emu_edge_fn) -{ - const int w = 8; - const int ix = ox >> (16 + shift); - const int iy = oy >> (16 + shift); - const int oxs = ox >> 4; - const int oys = oy >> 4; - const int dxxs = dxx >> 4; - const int dxys = dxy >> 4; - const int dyxs = dyx >> 4; - const int dyys = dyy >> 4; - const uint16_t r4[4] = { r, r, r, r }; - const uint16_t dxy4[4] = { dxys, dxys, dxys, dxys }; - const uint16_t dyy4[4] = { dyys, dyys, dyys, dyys }; - const uint64_t shift2 = 2 * shift; -#define MAX_STRIDE 4096U -#define MAX_H 8U - uint8_t edge_buf[(MAX_H + 1) * MAX_STRIDE]; - int x, y; - - const int dxw = (dxx - (1 << (16 + shift))) * (w - 1); - const int dyh = (dyy - (1 << (16 + shift))) * (h - 1); - const int dxh = dxy * (h - 1); - const int dyw = dyx * (w - 1); - int need_emu = (unsigned)ix >= width - w || - (unsigned)iy >= height - h; - - if ( // non-constant fullpel offset (3% of blocks) - ((ox ^ (ox + dxw)) | (ox ^ (ox + dxh)) | (ox ^ (ox + dxw + dxh)) | - (oy ^ (oy + dyw)) | (oy ^ (oy + dyh)) | (oy ^ (oy + dyw + dyh))) >> (16 + shift) - // uses more than 16 bits of subpel mv (only at huge resolution) - || (dxx | dxy | dyx | dyy) & 15 - || (need_emu && (h > MAX_H || stride > MAX_STRIDE))) { - // FIXME could still use mmx for some of the rows - ff_gmc_c(dst, src, stride, h, ox, oy, dxx, dxy, dyx, dyy, - shift, r, width, height); - return; - } - - src += ix + iy * stride; - if (need_emu) { - emu_edge_fn(edge_buf, stride, src, stride, w + 1, h + 1, ix, iy, width, height); - src = edge_buf; - } - - __asm__ volatile ( - "movd %0, %%mm6 \n\t" - "pxor %%mm7, %%mm7 \n\t" - "punpcklwd %%mm6, %%mm6 \n\t" - "punpcklwd %%mm6, %%mm6 \n\t" - :: "r"(1< - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_DSPUTIL_MMX_H -#define AVCODEC_X86_DSPUTIL_MMX_H - -#include -#include - -#include "libavcodec/dsputil.h" -#include "libavutil/x86/asm.h" -#include "constants.h" - -#define MOVQ_WONE(regd) \ - __asm__ volatile ( \ - "pcmpeqd %%" #regd ", %%" #regd " \n\t" \ - "psrlw $15, %%" #regd ::) - -#define JUMPALIGN() __asm__ volatile (".p2align 3"::) -#define MOVQ_ZERO(regd) __asm__ volatile ("pxor %%"#regd", %%"#regd ::) - -#define MOVQ_BFE(regd) \ - __asm__ volatile ( \ - "pcmpeqd %%"#regd", %%"#regd" \n\t" \ - "paddb %%"#regd", %%"#regd" \n\t" ::) - -#ifndef PIC -#define MOVQ_WTWO(regd) __asm__ volatile ("movq %0, %%"#regd" \n\t" :: "m"(ff_wtwo)) -#else -// for shared library it's better to use this way for accessing constants -// pcmpeqd -> -1 -#define MOVQ_WTWO(regd) \ - __asm__ volatile ( \ - "pcmpeqd %%"#regd", %%"#regd" \n\t" \ - "psrlw $15, %%"#regd" \n\t" \ - "psllw $1, %%"#regd" \n\t"::) - -#endif - -// using regr as temporary and for the output result -// first argument is unmodifed and second is trashed -// regfe is supposed to contain 0xfefefefefefefefe -#define PAVGB_MMX_NO_RND(rega, regb, regr, regfe) \ - "movq "#rega", "#regr" \n\t" \ - "pand "#regb", "#regr" \n\t" \ - "pxor "#rega", "#regb" \n\t" \ - "pand "#regfe", "#regb" \n\t" \ - "psrlq $1, "#regb" \n\t" \ - "paddb "#regb", "#regr" \n\t" - -#define PAVGB_MMX(rega, regb, regr, regfe) \ - "movq "#rega", "#regr" \n\t" \ - "por "#regb", "#regr" \n\t" \ - "pxor "#rega", "#regb" \n\t" \ - "pand "#regfe", "#regb" \n\t" \ - "psrlq $1, "#regb" \n\t" \ - "psubb "#regb", "#regr" \n\t" - -// mm6 is supposed to contain 0xfefefefefefefefe -#define PAVGBP_MMX_NO_RND(rega, regb, regr, regc, regd, regp) \ - "movq "#rega", "#regr" \n\t" \ - "movq "#regc", "#regp" \n\t" \ - "pand "#regb", "#regr" \n\t" \ - "pand "#regd", "#regp" \n\t" \ - "pxor "#rega", "#regb" \n\t" \ - "pxor "#regc", "#regd" \n\t" \ - "pand %%mm6, "#regb" \n\t" \ - "pand %%mm6, "#regd" \n\t" \ - "psrlq $1, "#regb" \n\t" \ - "psrlq $1, "#regd" \n\t" \ - "paddb "#regb", "#regr" \n\t" \ - "paddb "#regd", "#regp" \n\t" - -#define PAVGBP_MMX(rega, regb, regr, regc, regd, regp) \ - "movq "#rega", "#regr" \n\t" \ - "movq "#regc", "#regp" \n\t" \ - "por "#regb", "#regr" \n\t" \ - "por "#regd", "#regp" \n\t" \ - "pxor "#rega", "#regb" \n\t" \ - "pxor "#regc", "#regd" \n\t" \ - "pand %%mm6, "#regb" \n\t" \ - "pand %%mm6, "#regd" \n\t" \ - "psrlq $1, "#regd" \n\t" \ - "psrlq $1, "#regb" \n\t" \ - "psubb "#regb", "#regr" \n\t" \ - "psubb "#regd", "#regp" \n\t" - -void ff_dsputilenc_init_mmx(DSPContext* c, AVCodecContext *avctx); -void ff_dsputil_init_pix_mmx(DSPContext* c, AVCodecContext *avctx); - -void ff_add_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size); -void ff_put_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size); -void ff_put_signed_pixels_clamped_mmx(const int16_t *block, uint8_t *pixels, int line_size); - -void ff_clear_block_mmx(int16_t *block); -void ff_clear_block_sse(int16_t *block); -void ff_clear_blocks_mmx(int16_t *blocks); -void ff_clear_blocks_sse(int16_t *blocks); - -void ff_add_bytes_mmx(uint8_t *dst, uint8_t *src, int w); - -void ff_add_hfyu_median_prediction_cmov(uint8_t *dst, const uint8_t *top, - const uint8_t *diff, int w, - int *left, int *left_top); - -void ff_draw_edges_mmx(uint8_t *buf, int wrap, int width, int height, - int w, int h, int sides); - -void ff_gmc_mmx(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height); - -void ff_gmc_sse(uint8_t *dst, uint8_t *src, - int stride, int h, int ox, int oy, - int dxx, int dxy, int dyx, int dyy, - int shift, int r, int width, int height); - -void ff_vector_clipf_sse(float *dst, const float *src, - float min, float max, int len); - -void ff_avg_pixels8_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels16_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels8_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels16_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels8_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels16_sse2(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels16_sse2(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); - -void ff_avg_pixels8_x2_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); - -void ff_avg_pixels8_xy2_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels16_xy2_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); - -void ff_put_pixels8_xy2_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels16_xy2_mmx(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); - - -void ff_mmx_idct(int16_t *block); -void ff_mmxext_idct(int16_t *block); - -void ff_deinterlace_line_mmx(uint8_t *dst, - const uint8_t *lum_m4, const uint8_t *lum_m3, - const uint8_t *lum_m2, const uint8_t *lum_m1, - const uint8_t *lum, - int size); - -void ff_deinterlace_line_inplace_mmx(const uint8_t *lum_m4, - const uint8_t *lum_m3, - const uint8_t *lum_m2, - const uint8_t *lum_m1, - const uint8_t *lum, int size); - -#define PIXELS16(STATIC, PFX1, PFX2, TYPE, CPUEXT) \ -STATIC void PFX1 ## _pixels16 ## TYPE ## CPUEXT(uint8_t *block, \ - const uint8_t *pixels, \ - ptrdiff_t line_size, \ - int h) \ -{ \ - PFX2 ## PFX1 ## _pixels8 ## TYPE ## CPUEXT(block, pixels, \ - line_size, h); \ - PFX2 ## PFX1 ## _pixels8 ## TYPE ## CPUEXT(block + 8, pixels + 8, \ - line_size, h); \ -} - -#endif /* AVCODEC_X86_DSPUTIL_MMX_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fft_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fft_init.c deleted file mode 100644 index 22362ab83..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fft_init.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/cpu.h" -#include "fft.h" - -av_cold void ff_fft_init_x86(FFTContext *s) -{ -#if 0 - int cpu_flags = av_get_cpu_flags(); - -#if ARCH_X86_32 - if (EXTERNAL_AMD3DNOW(cpu_flags)) { - /* 3DNow! for K6-2/3 */ - s->imdct_calc = ff_imdct_calc_3dnow; - s->imdct_half = ff_imdct_half_3dnow; - s->fft_calc = ff_fft_calc_3dnow; - } - if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) { - /* 3DNowEx for K7 */ - s->imdct_calc = ff_imdct_calc_3dnowext; - s->imdct_half = ff_imdct_half_3dnowext; - s->fft_calc = ff_fft_calc_3dnowext; - } -#endif - if (EXTERNAL_SSE(cpu_flags)) { - /* SSE for P3/P4/K8 */ - s->imdct_calc = ff_imdct_calc_sse; - s->imdct_half = ff_imdct_half_sse; - s->fft_permute = ff_fft_permute_sse; - s->fft_calc = ff_fft_calc_sse; - s->fft_permutation = FF_FFT_PERM_SWAP_LSBS; - } - if (EXTERNAL_AVX(cpu_flags) && s->nbits >= 5) { - /* AVX for SB */ - s->imdct_half = ff_imdct_half_avx; - s->fft_calc = ff_fft_calc_avx; - s->fft_permutation = FF_FFT_PERM_AVX; - } -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fmtconvert_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fmtconvert_init.c deleted file mode 100644 index d300dfd86..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/fmtconvert_init.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Format Conversion Utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * MMX optimization by Nick Kurshev - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/fmtconvert.h" - -#if HAVE_YASM - -void ff_int32_to_float_fmul_scalar_sse (float *dst, const int32_t *src, float mul, int len); -void ff_int32_to_float_fmul_scalar_sse2(float *dst, const int32_t *src, float mul, int len); - -void ff_float_to_int16_3dnow(int16_t *dst, const float *src, long len); -void ff_float_to_int16_sse (int16_t *dst, const float *src, long len); -void ff_float_to_int16_sse2 (int16_t *dst, const float *src, long len); - -void ff_float_to_int16_step_3dnow(int16_t *dst, const float *src, long len, long step); -void ff_float_to_int16_step_sse (int16_t *dst, const float *src, long len, long step); -void ff_float_to_int16_step_sse2 (int16_t *dst, const float *src, long len, long step); - -void ff_float_to_int16_interleave2_3dnow(int16_t *dst, const float **src, long len); -void ff_float_to_int16_interleave2_sse (int16_t *dst, const float **src, long len); -void ff_float_to_int16_interleave2_sse2 (int16_t *dst, const float **src, long len); - -void ff_float_to_int16_interleave6_sse(int16_t *dst, const float **src, int len); -void ff_float_to_int16_interleave6_3dnow(int16_t *dst, const float **src, int len); -void ff_float_to_int16_interleave6_3dnowext(int16_t *dst, const float **src, int len); - -#define ff_float_to_int16_interleave6_sse2 ff_float_to_int16_interleave6_sse - -#define FLOAT_TO_INT16_INTERLEAVE(cpu) \ -/* gcc pessimizes register allocation if this is in the same function as float_to_int16_interleave_sse2*/\ -static av_noinline void float_to_int16_interleave_misc_##cpu(int16_t *dst, const float **src, long len, int channels){\ - int c;\ - for(c=0; cfloat_interleave = float_interleave_mmx; - } - if (EXTERNAL_AMD3DNOW(cpu_flags)) { - if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { - c->float_to_int16 = ff_float_to_int16_3dnow; - c->float_to_int16_interleave = float_to_int16_interleave_3dnow; - } - } - if (EXTERNAL_AMD3DNOWEXT(cpu_flags)) { - if (!(avctx->flags & CODEC_FLAG_BITEXACT)) { - c->float_to_int16_interleave = float_to_int16_interleave_3dnowext; - } - } - if (EXTERNAL_SSE(cpu_flags)) { - c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse; - c->float_to_int16 = ff_float_to_int16_sse; - c->float_to_int16_interleave = float_to_int16_interleave_sse; - c->float_interleave = float_interleave_sse; - } - if (EXTERNAL_SSE2(cpu_flags)) { - c->int32_to_float_fmul_scalar = ff_int32_to_float_fmul_scalar_sse2; - c->float_to_int16 = ff_float_to_int16_sse2; - c->float_to_int16_interleave = float_to_int16_interleave_sse2; - } -#endif /* HAVE_YASM */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/h264chroma_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/h264chroma_init.c deleted file mode 100644 index 3d8d5b0fe..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/h264chroma_init.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/h264chroma.h" - -void ff_put_h264_chroma_mc8_rnd_mmx (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc8_rnd_mmxext(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc8_rnd_3dnow(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); - -void ff_put_h264_chroma_mc4_mmx (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc4_mmxext (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc4_3dnow (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); - -void ff_put_h264_chroma_mc2_mmxext (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc2_mmxext (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); - -void ff_put_h264_chroma_mc8_rnd_ssse3(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_put_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); - -void ff_avg_h264_chroma_mc8_rnd_ssse3(uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); -void ff_avg_h264_chroma_mc4_ssse3 (uint8_t *dst, uint8_t *src, - int stride, int h, int x, int y); - -#define CHROMA_MC(OP, NUM, DEPTH, OPT) \ -void ff_ ## OP ## _h264_chroma_mc ## NUM ## _ ## DEPTH ## _ ## OPT \ - (uint8_t *dst, uint8_t *src, \ - int stride, int h, int x, int y); - -CHROMA_MC(put, 2, 10, mmxext) -CHROMA_MC(avg, 2, 10, mmxext) -CHROMA_MC(put, 4, 10, mmxext) -CHROMA_MC(avg, 4, 10, mmxext) -CHROMA_MC(put, 8, 10, sse2) -CHROMA_MC(avg, 8, 10, sse2) -CHROMA_MC(put, 8, 10, avx) -CHROMA_MC(avg, 8, 10, avx) - -av_cold void ff_h264chroma_init_x86(H264ChromaContext *c, int bit_depth) -{ -#if HAVE_YASM - int high_bit_depth = bit_depth > 8; - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_MMX(cpu_flags) && !high_bit_depth) { - c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_mmx; - c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_mmx; - } - - if (EXTERNAL_AMD3DNOW(cpu_flags) && !high_bit_depth) { - c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_3dnow; - c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_3dnow; - } - - if (EXTERNAL_MMXEXT(cpu_flags) && !high_bit_depth) { - c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_mmxext; - c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_mmxext; - c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_mmxext; - c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_mmxext; - } - - if (EXTERNAL_MMXEXT(cpu_flags) && bit_depth > 8 && bit_depth <= 10) { - c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_10_mmxext; - c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_10_mmxext; - c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_10_mmxext; - c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_10_mmxext; - } - - if (EXTERNAL_SSE2(cpu_flags) && bit_depth > 8 && bit_depth <= 10) { - c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_sse2; - c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_sse2; - } - - if (EXTERNAL_SSSE3(cpu_flags) && !high_bit_depth) { - c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_rnd_ssse3; - c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_rnd_ssse3; - c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_ssse3; - c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_ssse3; - } - - if (EXTERNAL_AVX(cpu_flags) && bit_depth > 8 && bit_depth <= 10) { - // AVX implies !cache64. - // TODO: Port cache(32|64) detection from x264. - c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_10_avx; - c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_10_avx; - } -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/hpeldsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/hpeldsp_init.c deleted file mode 100644 index 385f01b4b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/hpeldsp_init.c +++ /dev/null @@ -1,270 +0,0 @@ -/* - * MMX optimized DSP utils - * Copyright (c) 2000, 2001 Fabrice Bellard - * Copyright (c) 2002-2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * MMX optimization by Nick Kurshev - */ - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/hpeldsp.h" -#include "dsputil_x86.h" - -void ff_put_pixels8_x2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels8_x2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels16_x2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels16_x2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_x2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_x2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_x2_exact_mmxext(uint8_t *block, - const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_x2_exact_3dnow(uint8_t *block, - const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels8_y2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_pixels8_y2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_y2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_y2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_y2_exact_mmxext(uint8_t *block, - const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_put_no_rnd_pixels8_y2_exact_3dnow(uint8_t *block, - const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_x2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_x2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_y2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_y2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_xy2_mmxext(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); -void ff_avg_pixels8_xy2_3dnow(uint8_t *block, const uint8_t *pixels, - ptrdiff_t line_size, int h); - -#define avg_pixels8_mmx ff_avg_pixels8_mmx -#define avg_pixels8_x2_mmx ff_avg_pixels8_x2_mmx -#define avg_pixels16_mmx ff_avg_pixels16_mmx -#define avg_pixels8_xy2_mmx ff_avg_pixels8_xy2_mmx -#define avg_pixels16_xy2_mmx ff_avg_pixels16_xy2_mmx -#define put_pixels8_mmx ff_put_pixels8_mmx -#define put_pixels16_mmx ff_put_pixels16_mmx -#define put_pixels8_xy2_mmx ff_put_pixels8_xy2_mmx -#define put_pixels16_xy2_mmx ff_put_pixels16_xy2_mmx -#define avg_no_rnd_pixels16_mmx ff_avg_pixels16_mmx -#define put_no_rnd_pixels8_mmx ff_put_pixels8_mmx -#define put_no_rnd_pixels16_mmx ff_put_pixels16_mmx - -#if HAVE_INLINE_ASM - -/***********************************/ -/* MMX no rounding */ -#define DEF(x, y) x ## _no_rnd_ ## y ## _mmx -#define SET_RND MOVQ_WONE -#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX_NO_RND(a, b, c, d, e, f) -#define PAVGB(a, b, c, e) PAVGB_MMX_NO_RND(a, b, c, e) -#define STATIC static - -#include "rnd_template.c" -#include "hpeldsp_rnd_template.c" - -#undef DEF -#undef SET_RND -#undef PAVGBP -#undef PAVGB -#undef STATIC - -PIXELS16(static, avg_no_rnd, , _y2, _mmx) -PIXELS16(static, put_no_rnd, , _y2, _mmx) - -PIXELS16(static, avg_no_rnd, , _xy2, _mmx) -PIXELS16(static, put_no_rnd, , _xy2, _mmx) - -/***********************************/ -/* MMX rounding */ - -#define DEF(x, y) x ## _ ## y ## _mmx -#define SET_RND MOVQ_WTWO -#define PAVGBP(a, b, c, d, e, f) PAVGBP_MMX(a, b, c, d, e, f) -#define PAVGB(a, b, c, e) PAVGB_MMX(a, b, c, e) - -#include "hpeldsp_rnd_template.c" - -#undef DEF -#undef SET_RND -#undef PAVGBP -#undef PAVGB - -PIXELS16(static, avg, , _y2, _mmx) -PIXELS16(static, put, , _y2, _mmx) - -#endif /* HAVE_INLINE_ASM */ - - -#if HAVE_YASM - -#define HPELDSP_AVG_PIXELS16(CPUEXT) \ - PIXELS16(static, put_no_rnd, ff_, _x2, CPUEXT) \ - PIXELS16(static, put, ff_, _y2, CPUEXT) \ - PIXELS16(static, put_no_rnd, ff_, _y2, CPUEXT) \ - PIXELS16(static, avg, ff_, , CPUEXT) \ - PIXELS16(static, avg, ff_, _x2, CPUEXT) \ - PIXELS16(static, avg, ff_, _y2, CPUEXT) \ - PIXELS16(static, avg, ff_, _xy2, CPUEXT) - -HPELDSP_AVG_PIXELS16(_3dnow) -HPELDSP_AVG_PIXELS16(_mmxext) - -#endif /* HAVE_YASM */ - -#define SET_HPEL_FUNCS(PFX, IDX, SIZE, CPU) \ - do { \ - c->PFX ## _pixels_tab IDX [0] = PFX ## _pixels ## SIZE ## _ ## CPU; \ - c->PFX ## _pixels_tab IDX [1] = PFX ## _pixels ## SIZE ## _x2_ ## CPU; \ - c->PFX ## _pixels_tab IDX [2] = PFX ## _pixels ## SIZE ## _y2_ ## CPU; \ - c->PFX ## _pixels_tab IDX [3] = PFX ## _pixels ## SIZE ## _xy2_ ## CPU; \ - } while (0) - -static void hpeldsp_init_mmx(HpelDSPContext *c, int flags, int cpu_flags) -{ -#if HAVE_MMX_INLINE - SET_HPEL_FUNCS(put, [0], 16, mmx); - SET_HPEL_FUNCS(put_no_rnd, [0], 16, mmx); - SET_HPEL_FUNCS(avg, [0], 16, mmx); - SET_HPEL_FUNCS(avg_no_rnd, , 16, mmx); - SET_HPEL_FUNCS(put, [1], 8, mmx); - SET_HPEL_FUNCS(put_no_rnd, [1], 8, mmx); - SET_HPEL_FUNCS(avg, [1], 8, mmx); -#endif /* HAVE_MMX_INLINE */ -} - -static void hpeldsp_init_mmxext(HpelDSPContext *c, int flags, int cpu_flags) -{ -#if HAVE_MMXEXT_EXTERNAL - c->put_pixels_tab[0][1] = ff_put_pixels16_x2_mmxext; - c->put_pixels_tab[0][2] = put_pixels16_y2_mmxext; - - c->avg_pixels_tab[0][0] = avg_pixels16_mmxext; - c->avg_pixels_tab[0][1] = avg_pixels16_x2_mmxext; - c->avg_pixels_tab[0][2] = avg_pixels16_y2_mmxext; - - c->put_pixels_tab[1][1] = ff_put_pixels8_x2_mmxext; - c->put_pixels_tab[1][2] = ff_put_pixels8_y2_mmxext; - - c->avg_pixels_tab[1][0] = ff_avg_pixels8_mmxext; - c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_mmxext; - c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_mmxext; - - if (!(flags & CODEC_FLAG_BITEXACT)) { - c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_mmxext; - c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_mmxext; - c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_mmxext; - c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_mmxext; - - c->avg_pixels_tab[0][3] = avg_pixels16_xy2_mmxext; - c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_mmxext; - } - - if (flags & CODEC_FLAG_BITEXACT && CONFIG_VP3_DECODER) { - c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_exact_mmxext; - c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_exact_mmxext; - } -#endif /* HAVE_MMXEXT_EXTERNAL */ -} - -static void hpeldsp_init_3dnow(HpelDSPContext *c, int flags, int cpu_flags) -{ -#if HAVE_AMD3DNOW_EXTERNAL - c->put_pixels_tab[0][1] = ff_put_pixels16_x2_3dnow; - c->put_pixels_tab[0][2] = put_pixels16_y2_3dnow; - - c->avg_pixels_tab[0][0] = avg_pixels16_3dnow; - c->avg_pixels_tab[0][1] = avg_pixels16_x2_3dnow; - c->avg_pixels_tab[0][2] = avg_pixels16_y2_3dnow; - - c->put_pixels_tab[1][1] = ff_put_pixels8_x2_3dnow; - c->put_pixels_tab[1][2] = ff_put_pixels8_y2_3dnow; - - c->avg_pixels_tab[1][0] = ff_avg_pixels8_3dnow; - c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_3dnow; - c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_3dnow; - - if (!(flags & CODEC_FLAG_BITEXACT)){ - c->put_no_rnd_pixels_tab[0][1] = put_no_rnd_pixels16_x2_3dnow; - c->put_no_rnd_pixels_tab[0][2] = put_no_rnd_pixels16_y2_3dnow; - c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_3dnow; - c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_3dnow; - - c->avg_pixels_tab[0][3] = avg_pixels16_xy2_3dnow; - c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_3dnow; - } - - if (flags & CODEC_FLAG_BITEXACT && CONFIG_VP3_DECODER) { - c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_exact_3dnow; - c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_exact_3dnow; - } -#endif /* HAVE_AMD3DNOW_EXTERNAL */ -} - -static void hpeldsp_init_sse2(HpelDSPContext *c, int flags, int cpu_flags) -{ -#if HAVE_SSE2_EXTERNAL - if (!(cpu_flags & AV_CPU_FLAG_SSE2SLOW)) { - // these functions are slower than mmx on AMD, but faster on Intel - c->put_pixels_tab[0][0] = ff_put_pixels16_sse2; - c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_sse2; - c->avg_pixels_tab[0][0] = ff_avg_pixels16_sse2; - } -#endif /* HAVE_SSE2_EXTERNAL */ -} - -av_cold void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags) -{ - int cpu_flags = av_get_cpu_flags(); - - if (INLINE_MMX(cpu_flags)) - hpeldsp_init_mmx(c, flags, cpu_flags); - - if (EXTERNAL_AMD3DNOW(cpu_flags)) - hpeldsp_init_3dnow(c, flags, cpu_flags); - - if (EXTERNAL_MMXEXT(cpu_flags)) - hpeldsp_init_mmxext(c, flags, cpu_flags); - - if (EXTERNAL_SSE2(cpu_flags)) - hpeldsp_init_sse2(c, flags, cpu_flags); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/idct_xvid.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/idct_xvid.h deleted file mode 100644 index 7a2847b86..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/idct_xvid.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * XVID MPEG-4 VIDEO CODEC - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * header for Xvid IDCT functions - */ - -#ifndef AVCODEC_X86_IDCT_XVID_H -#define AVCODEC_X86_IDCT_XVID_H - -#include - -void ff_idct_xvid_mmx(short *block); -void ff_idct_xvid_mmx_put(uint8_t *dest, int line_size, int16_t *block); -void ff_idct_xvid_mmx_add(uint8_t *dest, int line_size, int16_t *block); - -void ff_idct_xvid_mmxext(short *block); -void ff_idct_xvid_mmxext_put(uint8_t *dest, int line_size, int16_t *block); -void ff_idct_xvid_mmxext_add(uint8_t *dest, int line_size, int16_t *block); - -void ff_idct_xvid_sse2(short *block); -void ff_idct_xvid_sse2_put(uint8_t *dest, int line_size, short *block); -void ff_idct_xvid_sse2_add(uint8_t *dest, int line_size, short *block); - -#endif /* AVCODEC_X86_IDCT_XVID_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/lpc.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/lpc.c deleted file mode 100644 index 8a74755d1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/lpc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * MMX optimized LPC DSP utils - * Copyright (c) 2007 Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/mem.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/lpc.h" - -DECLARE_ASM_CONST(16, double, pd_1)[2] = { 1.0, 1.0 }; -DECLARE_ASM_CONST(16, double, pd_2)[2] = { 2.0, 2.0 }; - -#if HAVE_SSE2_INLINE - -static void lpc_apply_welch_window_sse2(const int32_t *data, int len, - double *w_data) -{ - double c = 2.0 / (len-1.0); - int n2 = len>>1; - x86_reg i = -n2*sizeof(int32_t); - x86_reg j = n2*sizeof(int32_t); - __asm__ volatile( - "movsd %4, %%xmm7 \n\t" - "movapd "MANGLE(pd_1)", %%xmm6 \n\t" - "movapd "MANGLE(pd_2)", %%xmm5 \n\t" - "movlhps %%xmm7, %%xmm7 \n\t" - "subpd %%xmm5, %%xmm7 \n\t" - "addsd %%xmm6, %%xmm7 \n\t" - "test $1, %5 \n\t" - "jz 2f \n\t" -#define WELCH(MOVPD, offset)\ - "1: \n\t"\ - "movapd %%xmm7, %%xmm1 \n\t"\ - "mulpd %%xmm1, %%xmm1 \n\t"\ - "movapd %%xmm6, %%xmm0 \n\t"\ - "subpd %%xmm1, %%xmm0 \n\t"\ - "pshufd $0x4e, %%xmm0, %%xmm1 \n\t"\ - "cvtpi2pd (%3,%0), %%xmm2 \n\t"\ - "cvtpi2pd "#offset"*4(%3,%1), %%xmm3 \n\t"\ - "mulpd %%xmm0, %%xmm2 \n\t"\ - "mulpd %%xmm1, %%xmm3 \n\t"\ - "movapd %%xmm2, (%2,%0,2) \n\t"\ - MOVPD" %%xmm3, "#offset"*8(%2,%1,2) \n\t"\ - "subpd %%xmm5, %%xmm7 \n\t"\ - "sub $8, %1 \n\t"\ - "add $8, %0 \n\t"\ - "jl 1b \n\t"\ - - WELCH("movupd", -1) - "jmp 3f \n\t" - "2: \n\t" - WELCH("movapd", -2) - "3: \n\t" - :"+&r"(i), "+&r"(j) - :"r"(w_data+n2), "r"(data+n2), "m"(c), "r"(len) - XMM_CLOBBERS_ONLY("%xmm0", "%xmm1", "%xmm2", "%xmm3", - "%xmm5", "%xmm6", "%xmm7") - ); -#undef WELCH -} - -static void lpc_compute_autocorr_sse2(const double *data, int len, int lag, - double *autoc) -{ - int j; - - if((x86_reg)data & 15) - data++; - - for(j=0; jlpc_apply_welch_window = lpc_apply_welch_window_sse2; - c->lpc_compute_autocorr = lpc_compute_autocorr_sse2; - } -#endif /* HAVE_SSE2_INLINE */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mathops.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mathops.h deleted file mode 100644 index 9c48afeb2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mathops.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * simple math operations - * Copyright (c) 2006 Michael Niedermayer et al - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVCODEC_X86_MATHOPS_H -#define AVCODEC_X86_MATHOPS_H - -#include "config.h" -#include "libavutil/common.h" - -#if HAVE_INLINE_ASM - -#if ARCH_X86_32 - -#define MULL MULL -static av_always_inline av_const int MULL(int a, int b, unsigned shift) -{ - int rt, dummy; - __asm__ ( - "imull %3 \n\t" - "shrdl %4, %%edx, %%eax \n\t" - :"=a"(rt), "=d"(dummy) - :"a"(a), "rm"(b), "ci"((uint8_t)shift) - ); - return rt; -} - -#define MULH MULH -static av_always_inline av_const int MULH(int a, int b) -{ - int rt, dummy; - __asm__ ( - "imull %3" - :"=d"(rt), "=a"(dummy) - :"a"(a), "rm"(b) - ); - return rt; -} - -#define MUL64 MUL64 -static av_always_inline av_const int64_t MUL64(int a, int b) -{ - int64_t rt; - __asm__ ( - "imull %2" - :"=A"(rt) - :"a"(a), "rm"(b) - ); - return rt; -} - -#endif /* ARCH_X86_32 */ - -#if HAVE_I686 -/* median of 3 */ -#define mid_pred mid_pred -static inline av_const int mid_pred(int a, int b, int c) -{ - int i=b; - __asm__ ( - "cmp %2, %1 \n\t" - "cmovg %1, %0 \n\t" - "cmovg %2, %1 \n\t" - "cmp %3, %1 \n\t" - "cmovl %3, %1 \n\t" - "cmp %1, %0 \n\t" - "cmovg %1, %0 \n\t" - :"+&r"(i), "+&r"(a) - :"r"(b), "r"(c) - ); - return i; -} - -#define COPY3_IF_LT(x, y, a, b, c, d)\ -__asm__ volatile(\ - "cmpl %0, %3 \n\t"\ - "cmovl %3, %0 \n\t"\ - "cmovl %4, %1 \n\t"\ - "cmovl %5, %2 \n\t"\ - : "+&r" (x), "+&r" (a), "+r" (c)\ - : "r" (y), "r" (b), "r" (d)\ -); -#endif /* HAVE_I686 */ - -#define MASK_ABS(mask, level) \ - __asm__ ("cltd \n\t" \ - "xorl %1, %0 \n\t" \ - "subl %1, %0 \n\t" \ - : "+a"(level), "=&d"(mask)) - -// avoid +32 for shift optimization (gcc should do that ...) -#define NEG_SSR32 NEG_SSR32 -static inline int32_t NEG_SSR32( int32_t a, int8_t s){ - __asm__ ("sarl %1, %0\n\t" - : "+r" (a) - : "ic" ((uint8_t)(-s)) - ); - return a; -} - -#define NEG_USR32 NEG_USR32 -static inline uint32_t NEG_USR32(uint32_t a, int8_t s){ - __asm__ ("shrl %1, %0\n\t" - : "+r" (a) - : "ic" ((uint8_t)(-s)) - ); - return a; -} - -#endif /* HAVE_INLINE_ASM */ -#endif /* AVCODEC_X86_MATHOPS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mpegaudiodsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mpegaudiodsp.c deleted file mode 100644 index 3654c8124..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/mpegaudiodsp.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * MMX optimized MP3 decoding functions - * Copyright (c) 2010 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/internal.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/mpegaudiodsp.h" - -#define DECL(CPU)\ -static void imdct36_blocks_ ## CPU(float *out, float *buf, float *in, int count, int switch_point, int block_type);\ -void ff_imdct36_float_ ## CPU(float *out, float *buf, float *in, float *win); - -#if ARCH_X86_32 -DECL(sse) -#endif -DECL(sse2) -DECL(sse3) -DECL(ssse3) -DECL(avx) - -void ff_four_imdct36_float_sse(float *out, float *buf, float *in, float *win, - float *tmpbuf); -void ff_four_imdct36_float_avx(float *out, float *buf, float *in, float *win, - float *tmpbuf); - -DECLARE_ALIGNED(16, static float, mdct_win_sse)[2][4][4*40]; - -#if HAVE_SSE2_INLINE - -#define MACS(rt, ra, rb) rt+=(ra)*(rb) -#define MLSS(rt, ra, rb) rt-=(ra)*(rb) - -#define SUM8(op, sum, w, p) \ -{ \ - op(sum, (w)[0 * 64], (p)[0 * 64]); \ - op(sum, (w)[1 * 64], (p)[1 * 64]); \ - op(sum, (w)[2 * 64], (p)[2 * 64]); \ - op(sum, (w)[3 * 64], (p)[3 * 64]); \ - op(sum, (w)[4 * 64], (p)[4 * 64]); \ - op(sum, (w)[5 * 64], (p)[5 * 64]); \ - op(sum, (w)[6 * 64], (p)[6 * 64]); \ - op(sum, (w)[7 * 64], (p)[7 * 64]); \ -} - -static void apply_window(const float *buf, const float *win1, - const float *win2, float *sum1, float *sum2, int len) -{ - x86_reg count = - 4*len; - const float *win1a = win1+len; - const float *win2a = win2+len; - const float *bufa = buf+len; - float *sum1a = sum1+len; - float *sum2a = sum2+len; - - -#define MULT(a, b) \ - "movaps " #a "(%1,%0), %%xmm1 \n\t" \ - "movaps " #a "(%3,%0), %%xmm2 \n\t" \ - "mulps %%xmm2, %%xmm1 \n\t" \ - "subps %%xmm1, %%xmm0 \n\t" \ - "mulps " #b "(%2,%0), %%xmm2 \n\t" \ - "subps %%xmm2, %%xmm4 \n\t" \ - - __asm__ volatile( - "1: \n\t" - "xorps %%xmm0, %%xmm0 \n\t" - "xorps %%xmm4, %%xmm4 \n\t" - - MULT( 0, 0) - MULT( 256, 64) - MULT( 512, 128) - MULT( 768, 192) - MULT(1024, 256) - MULT(1280, 320) - MULT(1536, 384) - MULT(1792, 448) - - "movaps %%xmm0, (%4,%0) \n\t" - "movaps %%xmm4, (%5,%0) \n\t" - "add $16, %0 \n\t" - "jl 1b \n\t" - :"+&r"(count) - :"r"(win1a), "r"(win2a), "r"(bufa), "r"(sum1a), "r"(sum2a) - ); - -#undef MULT -} - -static void apply_window_mp3(float *in, float *win, int *unused, float *out, - int incr) -{ - LOCAL_ALIGNED_16(float, suma, [17]); - LOCAL_ALIGNED_16(float, sumb, [17]); - LOCAL_ALIGNED_16(float, sumc, [17]); - LOCAL_ALIGNED_16(float, sumd, [17]); - - float sum; - - /* copy to avoid wrap */ - __asm__ volatile( - "movaps 0(%0), %%xmm0 \n\t" \ - "movaps 16(%0), %%xmm1 \n\t" \ - "movaps 32(%0), %%xmm2 \n\t" \ - "movaps 48(%0), %%xmm3 \n\t" \ - "movaps %%xmm0, 0(%1) \n\t" \ - "movaps %%xmm1, 16(%1) \n\t" \ - "movaps %%xmm2, 32(%1) \n\t" \ - "movaps %%xmm3, 48(%1) \n\t" \ - "movaps 64(%0), %%xmm0 \n\t" \ - "movaps 80(%0), %%xmm1 \n\t" \ - "movaps 96(%0), %%xmm2 \n\t" \ - "movaps 112(%0), %%xmm3 \n\t" \ - "movaps %%xmm0, 64(%1) \n\t" \ - "movaps %%xmm1, 80(%1) \n\t" \ - "movaps %%xmm2, 96(%1) \n\t" \ - "movaps %%xmm3, 112(%1) \n\t" - ::"r"(in), "r"(in+512) - :"memory" - ); - - apply_window(in + 16, win , win + 512, suma, sumc, 16); - apply_window(in + 32, win + 48, win + 640, sumb, sumd, 16); - - SUM8(MACS, suma[0], win + 32, in + 48); - - sumc[ 0] = 0; - sumb[16] = 0; - sumd[16] = 0; - -#define SUMS(suma, sumb, sumc, sumd, out1, out2) \ - "movups " #sumd "(%4), %%xmm0 \n\t" \ - "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \ - "subps " #suma "(%1), %%xmm0 \n\t" \ - "movaps %%xmm0," #out1 "(%0) \n\t" \ -\ - "movups " #sumc "(%3), %%xmm0 \n\t" \ - "shufps $0x1b, %%xmm0, %%xmm0 \n\t" \ - "addps " #sumb "(%2), %%xmm0 \n\t" \ - "movaps %%xmm0," #out2 "(%0) \n\t" - - if (incr == 1) { - __asm__ volatile( - SUMS( 0, 48, 4, 52, 0, 112) - SUMS(16, 32, 20, 36, 16, 96) - SUMS(32, 16, 36, 20, 32, 80) - SUMS(48, 0, 52, 4, 48, 64) - - :"+&r"(out) - :"r"(&suma[0]), "r"(&sumb[0]), "r"(&sumc[0]), "r"(&sumd[0]) - :"memory" - ); - out += 16*incr; - } else { - int j; - float *out2 = out + 32 * incr; - out[0 ] = -suma[ 0]; - out += incr; - out2 -= incr; - for(j=1;j<16;j++) { - *out = -suma[ j] + sumd[16-j]; - *out2 = sumb[16-j] + sumc[ j]; - out += incr; - out2 -= incr; - } - } - - sum = 0; - SUM8(MLSS, sum, win + 16 + 32, in + 32); - *out = sum; -} - -#endif /* HAVE_SSE2_INLINE */ - -#if HAVE_YASM -#define DECL_IMDCT_BLOCKS(CPU1, CPU2) \ -static void imdct36_blocks_ ## CPU1(float *out, float *buf, float *in, \ - int count, int switch_point, int block_type) \ -{ \ - int align_end = count - (count & 3); \ - int j; \ - for (j = 0; j < align_end; j+= 4) { \ - LOCAL_ALIGNED_16(float, tmpbuf, [1024]); \ - float *win = mdct_win_sse[switch_point && j < 4][block_type]; \ - /* apply window & overlap with previous buffer */ \ - \ - /* select window */ \ - ff_four_imdct36_float_ ## CPU2(out, buf, in, win, tmpbuf); \ - in += 4*18; \ - buf += 4*18; \ - out += 4; \ - } \ - for (; j < count; j++) { \ - /* apply window & overlap with previous buffer */ \ - \ - /* select window */ \ - int win_idx = (switch_point && j < 2) ? 0 : block_type; \ - float *win = ff_mdct_win_float[win_idx + (4 & -(j & 1))]; \ - \ - ff_imdct36_float_ ## CPU1(out, buf, in, win); \ - \ - in += 18; \ - buf++; \ - out++; \ - } \ -} - -#if HAVE_SSE -#if ARCH_X86_32 -DECL_IMDCT_BLOCKS(sse,sse) -#endif -DECL_IMDCT_BLOCKS(sse2,sse) -DECL_IMDCT_BLOCKS(sse3,sse) -DECL_IMDCT_BLOCKS(ssse3,sse) -#endif -#if HAVE_AVX_EXTERNAL -DECL_IMDCT_BLOCKS(avx,avx) -#endif -#endif /* HAVE_YASM */ - -av_cold void ff_mpadsp_init_x86(MPADSPContext *s) -{ - int cpu_flags = av_get_cpu_flags(); - - int i, j; - for (j = 0; j < 4; j++) { - for (i = 0; i < 40; i ++) { - mdct_win_sse[0][j][4*i ] = ff_mdct_win_float[j ][i]; - mdct_win_sse[0][j][4*i + 1] = ff_mdct_win_float[j + 4][i]; - mdct_win_sse[0][j][4*i + 2] = ff_mdct_win_float[j ][i]; - mdct_win_sse[0][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; - mdct_win_sse[1][j][4*i ] = ff_mdct_win_float[0 ][i]; - mdct_win_sse[1][j][4*i + 1] = ff_mdct_win_float[4 ][i]; - mdct_win_sse[1][j][4*i + 2] = ff_mdct_win_float[j ][i]; - mdct_win_sse[1][j][4*i + 3] = ff_mdct_win_float[j + 4][i]; - } - } - -#if HAVE_SSE2_INLINE - if (INLINE_SSE2(cpu_flags)) { - s->apply_window_float = apply_window_mp3; - } -#endif /* HAVE_SSE2_INLINE */ - -#if HAVE_YASM -#if ARCH_X86_32 - if (EXTERNAL_SSE(cpu_flags)) { - s->imdct36_blocks_float = imdct36_blocks_sse; - } -#endif - if (EXTERNAL_SSE2(cpu_flags)) { - s->imdct36_blocks_float = imdct36_blocks_sse2; - } - if (EXTERNAL_SSE3(cpu_flags)) { - s->imdct36_blocks_float = imdct36_blocks_sse3; - } - if (EXTERNAL_SSSE3(cpu_flags)) { - s->imdct36_blocks_float = imdct36_blocks_ssse3; - } - if (EXTERNAL_AVX(cpu_flags)) { - s->imdct36_blocks_float = imdct36_blocks_avx; - } -#endif /* HAVE_YASM */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/sbrdsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/sbrdsp_init.c deleted file mode 100644 index 2b912d0e9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/sbrdsp_init.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * AAC Spectral Band Replication decoding functions - * Copyright (c) 2012 Christophe Gisquet - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/sbrdsp.h" - -float ff_sbr_sum_square_sse(float (*x)[2], int n); -void ff_sbr_sum64x5_sse(float *z); -void ff_sbr_hf_g_filt_sse(float (*Y)[2], const float (*X_high)[40][2], - const float *g_filt, int m_max, intptr_t ixh); -void ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2], - const float alpha0[2], const float alpha1[2], - float bw, int start, int end); -void ff_sbr_neg_odd_64_sse(float *z); -void ff_sbr_qmf_post_shuffle_sse(float W[32][2], const float *z); -void ff_sbr_qmf_deint_bfly_sse(float *v, const float *src0, const float *src1); -void ff_sbr_qmf_deint_bfly_sse2(float *v, const float *src0, const float *src1); -void ff_sbr_qmf_pre_shuffle_sse2(float *z); - -void ff_sbr_hf_apply_noise_0_sse2(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max); -void ff_sbr_hf_apply_noise_1_sse2(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max); -void ff_sbr_hf_apply_noise_2_sse2(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max); -void ff_sbr_hf_apply_noise_3_sse2(float (*Y)[2], const float *s_m, - const float *q_filt, int noise, - int kx, int m_max); - -av_cold void ff_sbrdsp_init_x86(SBRDSPContext *s) -{ - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_SSE(cpu_flags)) { - s->neg_odd_64 = ff_sbr_neg_odd_64_sse; - s->sum_square = ff_sbr_sum_square_sse; - s->sum64x5 = ff_sbr_sum64x5_sse; - s->hf_g_filt = ff_sbr_hf_g_filt_sse; - s->hf_gen = ff_sbr_hf_gen_sse; - s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_sse; - s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_sse; - } - - if (EXTERNAL_SSE2(cpu_flags)) { - s->qmf_deint_bfly = ff_sbr_qmf_deint_bfly_sse2; - s->qmf_pre_shuffle = ff_sbr_qmf_pre_shuffle_sse2; - s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_sse2; - s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_sse2; - s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_sse2; - s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_sse2; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ttadsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ttadsp_init.c deleted file mode 100644 index 47dc87f6a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/ttadsp_init.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2014 James Almer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavcodec/ttadsp.h" -#include "libavutil/x86/cpu.h" -#include "config.h" - -void ff_ttafilter_process_dec_ssse3(int32_t *qm, int32_t *dx, int32_t *dl, - int32_t *error, int32_t *in, int32_t shift, - int32_t round); -void ff_ttafilter_process_dec_sse4(int32_t *qm, int32_t *dx, int32_t *dl, - int32_t *error, int32_t *in, int32_t shift, - int32_t round); - -av_cold void ff_ttadsp_init_x86(TTADSPContext *c) -{ -#if HAVE_YASM - int cpu_flags = av_get_cpu_flags(); - - if (EXTERNAL_SSSE3(cpu_flags)) - c->ttafilter_process_dec = ff_ttafilter_process_dec_ssse3; - if (EXTERNAL_SSE4(cpu_flags)) - c->ttafilter_process_dec = ff_ttafilter_process_dec_sse4; -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/videodsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/videodsp_init.c deleted file mode 100644 index a709d03d2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/x86/videodsp_init.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2002-2012 Michael Niedermayer - * Copyright (C) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/common.h" -#include "libavutil/cpu.h" -#include "libavutil/mem.h" -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavcodec/videodsp.h" - -#if HAVE_YASM -typedef void emu_edge_vfix_func(uint8_t *dst, x86_reg dst_stride, - const uint8_t *src, x86_reg src_stride, - x86_reg start_y, x86_reg end_y, x86_reg bh); -typedef void emu_edge_vvar_func(uint8_t *dst, x86_reg dst_stride, - const uint8_t *src, x86_reg src_stride, - x86_reg start_y, x86_reg end_y, x86_reg bh, - x86_reg w); - -extern emu_edge_vfix_func ff_emu_edge_vfix1_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix2_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix3_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix4_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix5_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix6_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix7_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix8_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix9_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix10_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix11_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix12_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix13_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix14_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix15_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix16_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix17_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix18_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix19_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix20_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix21_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix22_mmx; -#if ARCH_X86_32 -static emu_edge_vfix_func *vfixtbl_mmx[22] = { - &ff_emu_edge_vfix1_mmx, &ff_emu_edge_vfix2_mmx, &ff_emu_edge_vfix3_mmx, - &ff_emu_edge_vfix4_mmx, &ff_emu_edge_vfix5_mmx, &ff_emu_edge_vfix6_mmx, - &ff_emu_edge_vfix7_mmx, &ff_emu_edge_vfix8_mmx, &ff_emu_edge_vfix9_mmx, - &ff_emu_edge_vfix10_mmx, &ff_emu_edge_vfix11_mmx, &ff_emu_edge_vfix12_mmx, - &ff_emu_edge_vfix13_mmx, &ff_emu_edge_vfix14_mmx, &ff_emu_edge_vfix15_mmx, - &ff_emu_edge_vfix16_mmx, &ff_emu_edge_vfix17_mmx, &ff_emu_edge_vfix18_mmx, - &ff_emu_edge_vfix19_mmx, &ff_emu_edge_vfix20_mmx, &ff_emu_edge_vfix21_mmx, - &ff_emu_edge_vfix22_mmx -}; -#endif -extern emu_edge_vvar_func ff_emu_edge_vvar_mmx; -extern emu_edge_vfix_func ff_emu_edge_vfix16_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix17_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix18_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix19_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix20_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix21_sse; -extern emu_edge_vfix_func ff_emu_edge_vfix22_sse; -static emu_edge_vfix_func *vfixtbl_sse[22] = { - ff_emu_edge_vfix1_mmx, ff_emu_edge_vfix2_mmx, ff_emu_edge_vfix3_mmx, - ff_emu_edge_vfix4_mmx, ff_emu_edge_vfix5_mmx, ff_emu_edge_vfix6_mmx, - ff_emu_edge_vfix7_mmx, ff_emu_edge_vfix8_mmx, ff_emu_edge_vfix9_mmx, - ff_emu_edge_vfix10_mmx, ff_emu_edge_vfix11_mmx, ff_emu_edge_vfix12_mmx, - ff_emu_edge_vfix13_mmx, ff_emu_edge_vfix14_mmx, ff_emu_edge_vfix15_mmx, - ff_emu_edge_vfix16_sse, ff_emu_edge_vfix17_sse, ff_emu_edge_vfix18_sse, - ff_emu_edge_vfix19_sse, ff_emu_edge_vfix20_sse, ff_emu_edge_vfix21_sse, - ff_emu_edge_vfix22_sse -}; -extern emu_edge_vvar_func ff_emu_edge_vvar_sse; - -typedef void emu_edge_hfix_func(uint8_t *dst, x86_reg dst_stride, - x86_reg start_x, x86_reg bh); -typedef void emu_edge_hvar_func(uint8_t *dst, x86_reg dst_stride, - x86_reg start_x, x86_reg n_words, x86_reg bh); - -extern emu_edge_hfix_func ff_emu_edge_hfix2_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix4_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix6_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix8_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix10_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix12_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix14_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix16_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix18_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix20_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix22_mmx; -#if ARCH_X86_32 -static emu_edge_hfix_func *hfixtbl_mmx[11] = { - ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx, - ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx, - ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_mmx, ff_emu_edge_hfix18_mmx, - ff_emu_edge_hfix20_mmx, ff_emu_edge_hfix22_mmx -}; -#endif -extern emu_edge_hvar_func ff_emu_edge_hvar_mmx; -extern emu_edge_hfix_func ff_emu_edge_hfix16_sse; -extern emu_edge_hfix_func ff_emu_edge_hfix18_sse; -extern emu_edge_hfix_func ff_emu_edge_hfix20_sse; -extern emu_edge_hfix_func ff_emu_edge_hfix22_sse; -static emu_edge_hfix_func *hfixtbl_sse[11] = { - ff_emu_edge_hfix2_mmx, ff_emu_edge_hfix4_mmx, ff_emu_edge_hfix6_mmx, - ff_emu_edge_hfix8_mmx, ff_emu_edge_hfix10_mmx, ff_emu_edge_hfix12_mmx, - ff_emu_edge_hfix14_mmx, ff_emu_edge_hfix16_sse, ff_emu_edge_hfix18_sse, - ff_emu_edge_hfix20_sse, ff_emu_edge_hfix22_sse -}; -extern emu_edge_hvar_func ff_emu_edge_hvar_sse; - -static av_always_inline void emulated_edge_mc(uint8_t *dst, ptrdiff_t dst_stride, - const uint8_t *src, ptrdiff_t src_stride, - x86_reg block_w, x86_reg block_h, - x86_reg src_x, x86_reg src_y, - x86_reg w, x86_reg h, - emu_edge_vfix_func **vfix_tbl, - emu_edge_vvar_func *v_extend_var, - emu_edge_hfix_func **hfix_tbl, - emu_edge_hvar_func *h_extend_var) -{ - x86_reg start_y, start_x, end_y, end_x, src_y_add = 0, p; - - if(!w || !h) - return; - - if (src_y >= h) { - src -= src_y*src_stride; - src_y_add = h - 1; - src_y = h - 1; - } else if (src_y <= -block_h) { - src -= src_y*src_stride; - src_y_add = 1 - block_h; - src_y = 1 - block_h; - } - if (src_x >= w) { - src += w - 1 - src_x; - src_x = w - 1; - } else if (src_x <= -block_w) { - src += 1 - block_w - src_x; - src_x = 1 - block_w; - } - - start_y = FFMAX(0, -src_y); - start_x = FFMAX(0, -src_x); - end_y = FFMIN(block_h, h-src_y); - end_x = FFMIN(block_w, w-src_x); - av_assert2(start_x < end_x && block_w > 0); - av_assert2(start_y < end_y && block_h > 0); - - // fill in the to-be-copied part plus all above/below - src += (src_y_add + start_y) * src_stride + start_x; - w = end_x - start_x; - if (w <= 22) { - vfix_tbl[w - 1](dst + start_x, dst_stride, src, src_stride, - start_y, end_y, block_h); - } else { - v_extend_var(dst + start_x, dst_stride, src, src_stride, - start_y, end_y, block_h, w); - } - - // fill left - if (start_x) { - if (start_x <= 22) { - hfix_tbl[(start_x - 1) >> 1](dst, dst_stride, start_x, block_h); - } else { - h_extend_var(dst, dst_stride, - start_x, (start_x + 1) >> 1, block_h); - } - } - - // fill right - p = block_w - end_x; - if (p) { - if (p <= 22) { - hfix_tbl[(p - 1) >> 1](dst + end_x - (p & 1), dst_stride, - -!(p & 1), block_h); - } else { - h_extend_var(dst + end_x - (p & 1), dst_stride, - -!(p & 1), (p + 1) >> 1, block_h); - } - } -} - -#if ARCH_X86_32 -static av_noinline void emulated_edge_mc_mmx(uint8_t *buf, ptrdiff_t buf_stride, - const uint8_t *src, ptrdiff_t src_stride, - int block_w, int block_h, - int src_x, int src_y, int w, int h) -{ - emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, - src_x, src_y, w, h, vfixtbl_mmx, &ff_emu_edge_vvar_mmx, - hfixtbl_mmx, &ff_emu_edge_hvar_mmx); -} -#endif - -static av_noinline void emulated_edge_mc_sse(uint8_t *buf, ptrdiff_t buf_stride, - const uint8_t *src, ptrdiff_t src_stride, - int block_w, int block_h, - int src_x, int src_y, int w, int h) -{ - emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, - src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse, - hfixtbl_sse, &ff_emu_edge_hvar_sse); -} -#endif /* HAVE_YASM */ - -void ff_prefetch_mmxext(uint8_t *buf, ptrdiff_t stride, int h); -void ff_prefetch_3dnow(uint8_t *buf, ptrdiff_t stride, int h); - -av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc) -{ -#if HAVE_YASM - int cpu_flags = av_get_cpu_flags(); - -#if ARCH_X86_32 - if (EXTERNAL_MMX(cpu_flags) && bpc <= 8) { - ctx->emulated_edge_mc = emulated_edge_mc_mmx; - } - if (EXTERNAL_AMD3DNOW(cpu_flags)) { - ctx->prefetch = ff_prefetch_3dnow; - } -#endif /* ARCH_X86_32 */ - if (EXTERNAL_MMXEXT(cpu_flags)) { - ctx->prefetch = ff_prefetch_mmxext; - } - if (EXTERNAL_SSE(cpu_flags) && bpc <= 8) { - ctx->emulated_edge_mc = emulated_edge_mc_sse; - } -#endif /* HAVE_YASM */ -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aacdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aacdec.c deleted file mode 100644 index fea41120f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aacdec.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * raw ADTS AAC demuxer - * Copyright (c) 2008 Michael Niedermayer - * Copyright (c) 2009 Robert Swain ( rob opendot cl ) - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/intreadwrite.h" -#include "avformat.h" -#include "internal.h" -#include "rawdec.h" -#include "id3v1.h" -#include "apetag.h" - -static int adts_aac_probe(AVProbeData *p) -{ - int max_frames = 0, first_frames = 0; - int fsize, frames; - const uint8_t *buf0 = p->buf; - const uint8_t *buf2; - const uint8_t *buf; - const uint8_t *end = buf0 + p->buf_size - 7; - - buf = buf0; - - for(; buf < end; buf= buf2+1) { - buf2 = buf; - - for(frames = 0; buf2 < end; frames++) { - uint32_t header = AV_RB16(buf2); - if((header&0xFFF6) != 0xFFF0) - break; - fsize = (AV_RB32(buf2 + 3) >> 13) & 0x1FFF; - if(fsize < 7) - break; - fsize = FFMIN(fsize, end - buf2); - buf2 += fsize; - } - max_frames = FFMAX(max_frames, frames); - if(buf == buf0) - first_frames= frames; - } - if (first_frames>=3) return AVPROBE_SCORE_EXTENSION + 1; - else if(max_frames>500)return AVPROBE_SCORE_EXTENSION; - else if(max_frames>=3) return AVPROBE_SCORE_EXTENSION / 2; - else if(max_frames>=1) return 1; - else return 0; -} - -static int adts_aac_read_header(AVFormatContext *s) -{ - AVStream *st; - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = s->iformat->raw_codec_id; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - ff_id3v1_read(s); - if (s->pb->seekable && - !av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) { - int64_t cur = avio_tell(s->pb); - ff_ape_parse_tag(s); - avio_seek(s->pb, cur, SEEK_SET); - } - - //LCM of all possible ADTS sample rates - avpriv_set_pts_info(st, 64, 1, 28224000); - - return 0; -} - -AVInputFormat ff_aac_demuxer = { - .name = "aac", - .long_name = "raw ADTS AAC (Advanced Audio Coding)", - .read_probe = adts_aac_probe, - .read_header = adts_aac_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "aac", - .raw_codec_id = AV_CODEC_ID_AAC, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ac3dec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ac3dec.c deleted file mode 100644 index 3db23397d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ac3dec.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * RAW AC-3 and E-AC-3 demuxer - * Copyright (c) 2007 Justin Ruggles - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/crc.h" -#include "libavcodec/ac3_parser.h" -#include "avformat.h" -#include "rawdec.h" - -static int ac3_eac3_probe(AVProbeData *p, enum AVCodecID expected_codec_id) -{ - int max_frames, first_frames = 0, frames; - const uint8_t *buf, *buf2, *end; - AC3HeaderInfo hdr; - GetBitContext gbc; - enum AVCodecID codec_id = AV_CODEC_ID_AC3; - - max_frames = 0; - buf = p->buf; - end = buf + p->buf_size; - - for(; buf < end; buf++) { - if(buf > p->buf && !(buf[0] == 0x0B && buf[1] == 0x77) - && !(buf[0] == 0x77 && buf[1] == 0x0B) ) - continue; - buf2 = buf; - - for(frames = 0; buf2 < end; frames++) { - uint8_t buf3[4096]; - int i; - if(!memcmp(buf2, "\x1\x10\0\0\0\0\0\0", 8)) - buf2+=16; - if (buf[0] == 0x77 && buf[1] == 0x0B) { - for(i=0; i<8; i+=2) { - buf3[i ] = buf[i+1]; - buf3[i+1] = buf[i ]; - } - init_get_bits(&gbc, buf3, 54); - }else - init_get_bits(&gbc, buf2, 54); - if(avpriv_ac3_parse_header(&gbc, &hdr) < 0) - break; - if(buf2 + hdr.frame_size > end) - break; - if (buf[0] == 0x77 && buf[1] == 0x0B) { - av_assert0(hdr.frame_size <= sizeof(buf3)); - for(i=8; i 10) - codec_id = AV_CODEC_ID_EAC3; - buf2 += hdr.frame_size; - } - max_frames = FFMAX(max_frames, frames); - if(buf == p->buf) - first_frames = frames; - } - if(codec_id != expected_codec_id) return 0; - // keep this in sync with mp3 probe, both need to avoid - // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1; - else if(max_frames>200)return AVPROBE_SCORE_EXTENSION; - else if(max_frames>=4) return AVPROBE_SCORE_EXTENSION/2; - else if(max_frames>=1) return 1; - else return 0; -} - -#if CONFIG_AC3_DEMUXER -static int ac3_probe(AVProbeData *p) -{ - return ac3_eac3_probe(p, AV_CODEC_ID_AC3); -} - -AVInputFormat ff_ac3_demuxer = { - .name = "ac3", - .long_name = NULL_IF_CONFIG_SMALL("raw AC-3"), - .read_probe = ac3_probe, - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags= AVFMT_GENERIC_INDEX, - .extensions = "ac3", - .raw_codec_id = AV_CODEC_ID_AC3, -}; -#endif - -#if CONFIG_EAC3_DEMUXER -static int eac3_probe(AVProbeData *p) -{ - return ac3_eac3_probe(p, AV_CODEC_ID_EAC3); -} - -AVInputFormat ff_eac3_demuxer = { - .name = "eac3", - .long_name = NULL_IF_CONFIG_SMALL("raw E-AC-3"), - .read_probe = eac3_probe, - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "eac3", - .raw_codec_id = AV_CODEC_ID_EAC3, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/allformats.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/allformats.c deleted file mode 100644 index eefdccf95..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/allformats.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Register all the formats and protocols - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "avformat.h" -#include "rtp.h" -#include "rdt.h" -#include "url.h" -#include "version.h" - -#define REGISTER_MUXER(X, x) \ - { \ - extern AVOutputFormat ff_##x##_muxer; \ - if (CONFIG_##X##_MUXER) \ - av_register_output_format(&ff_##x##_muxer); \ - } - -#define REGISTER_DEMUXER(X, x) \ - { \ - extern AVInputFormat ff_##x##_demuxer; \ - if (CONFIG_##X##_DEMUXER) \ - av_register_input_format(&ff_##x##_demuxer); \ - } - -#define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x) - -#define REGISTER_PROTOCOL(X, x) \ - { \ - extern URLProtocol ff_##x##_protocol; \ - if (CONFIG_##X##_PROTOCOL) \ - ffurl_register_protocol(&ff_##x##_protocol); \ - } - -void av_register_all(void) -{ - static int initialized; - - if (initialized) - return; - initialized = 1; - - avcodec_register_all(); - - /* (de)muxers */ - REGISTER_MUXER (A64, a64); - REGISTER_DEMUXER (AAC, aac); - REGISTER_MUXDEMUX(AC3, ac3); - REGISTER_DEMUXER (ACT, act); - REGISTER_DEMUXER (ADF, adf); - REGISTER_DEMUXER (ADP, adp); - REGISTER_MUXER (ADTS, adts); - REGISTER_MUXDEMUX(ADX, adx); - REGISTER_DEMUXER (AEA, aea); - REGISTER_DEMUXER (AFC, afc); - REGISTER_MUXDEMUX(AIFF, aiff); - REGISTER_MUXDEMUX(AMR, amr); - REGISTER_DEMUXER (ANM, anm); - REGISTER_DEMUXER (APC, apc); - REGISTER_DEMUXER (APE, ape); - REGISTER_DEMUXER (AQTITLE, aqtitle); - REGISTER_MUXDEMUX(ASF, asf); - REGISTER_MUXDEMUX(ASS, ass); - REGISTER_MUXDEMUX(AST, ast); - REGISTER_MUXER (ASF_STREAM, asf_stream); - REGISTER_MUXDEMUX(AU, au); - REGISTER_MUXDEMUX(AVI, avi); - REGISTER_DEMUXER (AVISYNTH, avisynth); - REGISTER_MUXER (AVM2, avm2); - REGISTER_DEMUXER (AVR, avr); - REGISTER_DEMUXER (AVS, avs); - REGISTER_DEMUXER (BETHSOFTVID, bethsoftvid); - REGISTER_DEMUXER (BFI, bfi); - REGISTER_DEMUXER (BINTEXT, bintext); - REGISTER_DEMUXER (BINK, bink); - REGISTER_MUXDEMUX(BIT, bit); - REGISTER_DEMUXER (BMV, bmv); - REGISTER_DEMUXER (BRSTM, brstm); - REGISTER_DEMUXER (BOA, boa); - REGISTER_DEMUXER (C93, c93); - REGISTER_MUXDEMUX(CAF, caf); - REGISTER_MUXDEMUX(CAVSVIDEO, cavsvideo); - REGISTER_DEMUXER (CDG, cdg); - REGISTER_DEMUXER (CDXL, cdxl); - REGISTER_DEMUXER (CONCAT, concat); - REGISTER_MUXER (CRC, crc); - REGISTER_MUXDEMUX(DATA, data); - REGISTER_MUXDEMUX(DAUD, daud); - REGISTER_DEMUXER (DFA, dfa); - REGISTER_MUXDEMUX(DIRAC, dirac); - REGISTER_MUXDEMUX(DNXHD, dnxhd); - REGISTER_DEMUXER (DSICIN, dsicin); - REGISTER_MUXDEMUX(DTS, dts); - REGISTER_DEMUXER (DTSHD, dtshd); - REGISTER_MUXDEMUX(DV, dv); - REGISTER_DEMUXER (DXA, dxa); - REGISTER_DEMUXER (EA, ea); - REGISTER_DEMUXER (EA_CDATA, ea_cdata); - REGISTER_MUXDEMUX(EAC3, eac3); - REGISTER_DEMUXER (EPAF, epaf); - REGISTER_MUXER (F4V, f4v); - REGISTER_MUXDEMUX(FFM, ffm); - REGISTER_MUXDEMUX(FFMETADATA, ffmetadata); - REGISTER_MUXDEMUX(FILMSTRIP, filmstrip); - REGISTER_MUXDEMUX(FLAC, flac); - REGISTER_DEMUXER (FLIC, flic); - REGISTER_MUXDEMUX(FLV, flv); - REGISTER_DEMUXER (FOURXM, fourxm); - REGISTER_MUXER (FRAMECRC, framecrc); - REGISTER_MUXER (FRAMEMD5, framemd5); - REGISTER_DEMUXER (FRM, frm); - REGISTER_MUXDEMUX(G722, g722); - REGISTER_MUXDEMUX(G723_1, g723_1); - REGISTER_DEMUXER (G729, g729); - REGISTER_MUXDEMUX(GIF, gif); - REGISTER_DEMUXER (GSM, gsm); - REGISTER_MUXDEMUX(GXF, gxf); - REGISTER_MUXDEMUX(H261, h261); - REGISTER_MUXDEMUX(H263, h263); - REGISTER_MUXDEMUX(H264, h264); - REGISTER_MUXER (HDS, hds); - REGISTER_MUXDEMUX(HEVC, hevc); - REGISTER_MUXDEMUX(HLS, hls); - REGISTER_DEMUXER (HNM, hnm); - REGISTER_MUXDEMUX(ICO, ico); - REGISTER_DEMUXER (IDCIN, idcin); - REGISTER_DEMUXER (IDF, idf); - REGISTER_DEMUXER (IFF, iff); - REGISTER_MUXDEMUX(ILBC, ilbc); - REGISTER_MUXDEMUX(IMAGE2, image2); - REGISTER_MUXDEMUX(IMAGE2PIPE, image2pipe); - REGISTER_DEMUXER (INGENIENT, ingenient); - REGISTER_DEMUXER (IPMOVIE, ipmovie); - REGISTER_MUXER (IPOD, ipod); - REGISTER_MUXDEMUX(IRCAM, ircam); - REGISTER_MUXER (ISMV, ismv); - REGISTER_DEMUXER (ISS, iss); - REGISTER_DEMUXER (IV8, iv8); - REGISTER_MUXDEMUX(IVF, ivf); - REGISTER_MUXDEMUX(JACOSUB, jacosub); - REGISTER_DEMUXER (JV, jv); - REGISTER_MUXDEMUX(LATM, latm); - REGISTER_DEMUXER (LMLM4, lmlm4); - REGISTER_DEMUXER (LOAS, loas); - REGISTER_DEMUXER (LVF, lvf); - REGISTER_DEMUXER (LXF, lxf); - REGISTER_MUXDEMUX(M4V, m4v); - REGISTER_MUXER (MD5, md5); - REGISTER_MUXDEMUX(MATROSKA, matroska); - REGISTER_MUXER (MATROSKA_AUDIO, matroska_audio); - REGISTER_DEMUXER (MGSTS, mgsts); - REGISTER_MUXDEMUX(MICRODVD, microdvd); - REGISTER_MUXDEMUX(MJPEG, mjpeg); - REGISTER_MUXDEMUX(MLP, mlp); - REGISTER_DEMUXER (MM, mm); - REGISTER_MUXDEMUX(MMF, mmf); - REGISTER_MUXDEMUX(MOV, mov); - REGISTER_MUXER (MP2, mp2); - REGISTER_MUXDEMUX(MP3, mp3); - REGISTER_MUXER (MP4, mp4); - REGISTER_DEMUXER (MPC, mpc); - REGISTER_DEMUXER (MPC8, mpc8); - REGISTER_MUXER (MPEG1SYSTEM, mpeg1system); - REGISTER_MUXER (MPEG1VCD, mpeg1vcd); - REGISTER_MUXER (MPEG1VIDEO, mpeg1video); - REGISTER_MUXER (MPEG2DVD, mpeg2dvd); - REGISTER_MUXER (MPEG2SVCD, mpeg2svcd); - REGISTER_MUXER (MPEG2VIDEO, mpeg2video); - REGISTER_MUXER (MPEG2VOB, mpeg2vob); - REGISTER_DEMUXER (MPEGPS, mpegps); - REGISTER_MUXDEMUX(MPEGTS, mpegts); - REGISTER_DEMUXER (MPEGTSRAW, mpegtsraw); - REGISTER_DEMUXER (MPEGVIDEO, mpegvideo); - REGISTER_MUXER (MPJPEG, mpjpeg); - REGISTER_DEMUXER (MPL2, mpl2); - REGISTER_DEMUXER (MPSUB, mpsub); - REGISTER_DEMUXER (MSNWC_TCP, msnwc_tcp); - REGISTER_DEMUXER (MTV, mtv); - REGISTER_DEMUXER (MV, mv); - REGISTER_DEMUXER (MVI, mvi); - REGISTER_MUXDEMUX(MXF, mxf); - REGISTER_MUXER (MXF_D10, mxf_d10); - REGISTER_DEMUXER (MXG, mxg); - REGISTER_DEMUXER (NC, nc); - REGISTER_DEMUXER (NISTSPHERE, nistsphere); - REGISTER_DEMUXER (NSV, nsv); - REGISTER_MUXER (NULL, null); - REGISTER_MUXDEMUX(NUT, nut); - REGISTER_DEMUXER (NUV, nuv); - REGISTER_MUXDEMUX(OGG, ogg); - REGISTER_MUXDEMUX(OMA, oma); - REGISTER_MUXER (OPUS, opus); - REGISTER_DEMUXER (PAF, paf); - REGISTER_MUXDEMUX(PCM_ALAW, pcm_alaw); - REGISTER_MUXDEMUX(PCM_MULAW, pcm_mulaw); - REGISTER_MUXDEMUX(PCM_F64BE, pcm_f64be); - REGISTER_MUXDEMUX(PCM_F64LE, pcm_f64le); - REGISTER_MUXDEMUX(PCM_F32BE, pcm_f32be); - REGISTER_MUXDEMUX(PCM_F32LE, pcm_f32le); - REGISTER_MUXDEMUX(PCM_S32BE, pcm_s32be); - REGISTER_MUXDEMUX(PCM_S32LE, pcm_s32le); - REGISTER_MUXDEMUX(PCM_S24BE, pcm_s24be); - REGISTER_MUXDEMUX(PCM_S24LE, pcm_s24le); - REGISTER_MUXDEMUX(PCM_S16BE, pcm_s16be); - REGISTER_MUXDEMUX(PCM_S16LE, pcm_s16le); - REGISTER_MUXDEMUX(PCM_S8, pcm_s8); - REGISTER_MUXDEMUX(PCM_U32BE, pcm_u32be); - REGISTER_MUXDEMUX(PCM_U32LE, pcm_u32le); - REGISTER_MUXDEMUX(PCM_U24BE, pcm_u24be); - REGISTER_MUXDEMUX(PCM_U24LE, pcm_u24le); - REGISTER_MUXDEMUX(PCM_U16BE, pcm_u16be); - REGISTER_MUXDEMUX(PCM_U16LE, pcm_u16le); - REGISTER_MUXDEMUX(PCM_U8, pcm_u8); - REGISTER_DEMUXER (PJS, pjs); - REGISTER_DEMUXER (PMP, pmp); - REGISTER_MUXER (PSP, psp); - REGISTER_DEMUXER (PVA, pva); - REGISTER_DEMUXER (PVF, pvf); - REGISTER_DEMUXER (QCP, qcp); - REGISTER_DEMUXER (R3D, r3d); - REGISTER_MUXDEMUX(RAWVIDEO, rawvideo); - REGISTER_DEMUXER (REALTEXT, realtext); - REGISTER_DEMUXER (REDSPARK, redspark); - REGISTER_DEMUXER (RL2, rl2); - REGISTER_MUXDEMUX(RM, rm); - REGISTER_MUXDEMUX(ROQ, roq); - REGISTER_DEMUXER (RPL, rpl); - REGISTER_DEMUXER (RSD, rsd); - REGISTER_MUXDEMUX(RSO, rso); - REGISTER_MUXDEMUX(RTP, rtp); - REGISTER_MUXDEMUX(RTSP, rtsp); - REGISTER_DEMUXER (SAMI, sami); - REGISTER_MUXDEMUX(SAP, sap); - REGISTER_DEMUXER (SBG, sbg); - REGISTER_DEMUXER (SDP, sdp); - REGISTER_DEMUXER (SDR2, sdr2); -#if CONFIG_RTPDEC - ff_register_rtp_dynamic_payload_handlers(); - ff_register_rdt_dynamic_payload_handlers(); -#endif - REGISTER_DEMUXER (SEGAFILM, segafilm); - REGISTER_MUXER (SEGMENT, segment); - REGISTER_MUXER (SEGMENT, stream_segment); - REGISTER_DEMUXER (SHORTEN, shorten); - REGISTER_DEMUXER (SIFF, siff); - REGISTER_DEMUXER (SMACKER, smacker); - REGISTER_MUXDEMUX(SMJPEG, smjpeg); - REGISTER_MUXER (SMOOTHSTREAMING, smoothstreaming); - REGISTER_DEMUXER (SMUSH, smush); - REGISTER_DEMUXER (SOL, sol); - REGISTER_MUXDEMUX(SOX, sox); - REGISTER_MUXDEMUX(SPDIF, spdif); - REGISTER_MUXER (SPEEX, speex); - REGISTER_MUXDEMUX(SRT, srt); - REGISTER_DEMUXER (STR, str); - REGISTER_DEMUXER (SUBVIEWER1, subviewer1); - REGISTER_DEMUXER (SUBVIEWER, subviewer); - REGISTER_MUXDEMUX(SWF, swf); - REGISTER_DEMUXER (TAK, tak); - REGISTER_MUXER (TEE, tee); - REGISTER_DEMUXER (TEDCAPTIONS, tedcaptions); - REGISTER_MUXER (TG2, tg2); - REGISTER_MUXER (TGP, tgp); - REGISTER_DEMUXER (THP, thp); - REGISTER_DEMUXER (TIERTEXSEQ, tiertexseq); - REGISTER_MUXER (MKVTIMESTAMP_V2, mkvtimestamp_v2); - REGISTER_DEMUXER (TMV, tmv); - REGISTER_MUXDEMUX(TRUEHD, truehd); - REGISTER_DEMUXER (TTA, tta); - REGISTER_DEMUXER (TXD, txd); - REGISTER_DEMUXER (TTY, tty); - REGISTER_MUXER (UNCODEDFRAMECRC, uncodedframecrc); - REGISTER_MUXDEMUX(VC1, vc1); - REGISTER_MUXDEMUX(VC1T, vc1t); - REGISTER_DEMUXER (VIVO, vivo); - REGISTER_DEMUXER (VMD, vmd); - REGISTER_DEMUXER (VOBSUB, vobsub); - REGISTER_MUXDEMUX(VOC, voc); - REGISTER_DEMUXER (VPLAYER, vplayer); - REGISTER_DEMUXER (VQF, vqf); - REGISTER_MUXDEMUX(W64, w64); - REGISTER_MUXDEMUX(WAV, wav); - REGISTER_DEMUXER (WC3, wc3); - REGISTER_MUXER (WEBM, webm); - REGISTER_MUXDEMUX(WEBVTT, webvtt); - REGISTER_DEMUXER (WSAUD, wsaud); - REGISTER_DEMUXER (WSVQA, wsvqa); - REGISTER_MUXDEMUX(WTV, wtv); - REGISTER_MUXDEMUX(WV, wv); - REGISTER_DEMUXER (XA, xa); - REGISTER_DEMUXER (XBIN, xbin); - REGISTER_DEMUXER (XMV, xmv); - REGISTER_DEMUXER (XWMA, xwma); - REGISTER_DEMUXER (YOP, yop); - REGISTER_MUXDEMUX(YUV4MPEGPIPE, yuv4mpegpipe); - - /* protocols */ - REGISTER_PROTOCOL(BLURAY, bluray); - REGISTER_PROTOCOL(CACHE, cache); - REGISTER_PROTOCOL(CONCAT, concat); - REGISTER_PROTOCOL(CRYPTO, crypto); - REGISTER_PROTOCOL(DATA, data); - REGISTER_PROTOCOL(FFRTMPCRYPT, ffrtmpcrypt); - REGISTER_PROTOCOL(FFRTMPHTTP, ffrtmphttp); - REGISTER_PROTOCOL(FILE, file); - REGISTER_PROTOCOL(FTP, ftp); - REGISTER_PROTOCOL(GOPHER, gopher); - REGISTER_PROTOCOL(HLS, hls); - REGISTER_PROTOCOL(HTTP, http); - REGISTER_PROTOCOL(HTTPPROXY, httpproxy); - REGISTER_PROTOCOL(HTTPS, https); - REGISTER_PROTOCOL(MMSH, mmsh); - REGISTER_PROTOCOL(MMST, mmst); - REGISTER_PROTOCOL(MD5, md5); - REGISTER_PROTOCOL(PIPE, pipe); - REGISTER_PROTOCOL(RTMP, rtmp); - REGISTER_PROTOCOL(RTMPE, rtmpe); - REGISTER_PROTOCOL(RTMPS, rtmps); - REGISTER_PROTOCOL(RTMPT, rtmpt); - REGISTER_PROTOCOL(RTMPTE, rtmpte); - REGISTER_PROTOCOL(RTMPTS, rtmpts); - REGISTER_PROTOCOL(RTP, rtp); - REGISTER_PROTOCOL(SCTP, sctp); - REGISTER_PROTOCOL(SRTP, srtp); - REGISTER_PROTOCOL(SUBFILE, subfile); - REGISTER_PROTOCOL(TCP, tcp); - REGISTER_PROTOCOL(TLS, tls); - REGISTER_PROTOCOL(UDP, udp); - REGISTER_PROTOCOL(UNIX, unix); - - /* external libraries */ - REGISTER_DEMUXER (LIBGME, libgme); - REGISTER_DEMUXER (LIBMODPLUG, libmodplug); - REGISTER_MUXDEMUX(LIBNUT, libnut); - REGISTER_DEMUXER (LIBQUVI, libquvi); - REGISTER_PROTOCOL(LIBRTMP, librtmp); - REGISTER_PROTOCOL(LIBRTMPE, librtmpe); - REGISTER_PROTOCOL(LIBRTMPS, librtmps); - REGISTER_PROTOCOL(LIBRTMPT, librtmpt); - REGISTER_PROTOCOL(LIBRTMPTE, librtmpte); - REGISTER_PROTOCOL(LIBSSH, libssh); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/amr.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/amr.c deleted file mode 100644 index ebbdca92e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/amr.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * amr file format - * Copyright (c) 2001 ffmpeg project - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* -Write and read amr data according to RFC3267, http://www.ietf.org/rfc/rfc3267.txt?number=3267 - -Only mono files are supported. - -*/ - -#include "config.h" -#include "libavutil/avassert.h" -#include "libavutil/channel_layout.h" -#include "avformat.h" -#include "internal.h" - -static const char AMR_header[] = "#!AMR\n"; -static const char AMRWB_header[] = "#!AMR-WB\n"; - -#if CONFIG_AMR_MUXER -static int amr_write_header(AVFormatContext *s) -{ - AVIOContext *pb = s->pb; - AVCodecContext *enc = s->streams[0]->codec; - - s->priv_data = NULL; - - if (enc->codec_id == AV_CODEC_ID_AMR_NB) { - avio_write(pb, AMR_header, sizeof(AMR_header) - 1); /* magic number */ - } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) { - avio_write(pb, AMRWB_header, sizeof(AMRWB_header) - 1); /* magic number */ - } else { - return -1; - } - avio_flush(pb); - return 0; -} - -static int amr_write_packet(AVFormatContext *s, AVPacket *pkt) -{ - avio_write(s->pb, pkt->data, pkt->size); - return 0; -} -#endif /* CONFIG_AMR_MUXER */ - -static int amr_probe(AVProbeData *p) -{ - // Only check for "#!AMR" which could be amr-wb, amr-nb. - // This will also trigger multichannel files: "#!AMR_MC1.0\n" and - // "#!AMR-WB_MC1.0\n" (not supported) - - if (!memcmp(p->buf, AMR_header, 5)) - return AVPROBE_SCORE_MAX; - else - return 0; -} - -/* amr input */ -static int amr_read_header(AVFormatContext *s) -{ - AVIOContext *pb = s->pb; - AVStream *st; - uint8_t header[9]; - - avio_read(pb, header, 6); - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - if (memcmp(header, AMR_header, 6)) { - avio_read(pb, header + 6, 3); - if (memcmp(header, AMRWB_header, 9)) { - return -1; - } - - st->codec->codec_tag = MKTAG('s', 'a', 'w', 'b'); - st->codec->codec_id = AV_CODEC_ID_AMR_WB; - st->codec->sample_rate = 16000; - } else { - st->codec->codec_tag = MKTAG('s', 'a', 'm', 'r'); - st->codec->codec_id = AV_CODEC_ID_AMR_NB; - st->codec->sample_rate = 8000; - } - st->codec->channels = 1; - st->codec->channel_layout = AV_CH_LAYOUT_MONO; - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); - - return 0; -} - -static int amr_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - AVCodecContext *enc = s->streams[0]->codec; - int read, size = 0, toc, mode; - int64_t pos = avio_tell(s->pb); - - if (url_feof(s->pb)) { - return AVERROR(EIO); - } - - // FIXME this is wrong, this should rather be in a AVParset - toc = avio_r8(s->pb); - mode = (toc >> 3) & 0x0F; - - if (enc->codec_id == AV_CODEC_ID_AMR_NB) { - static const uint8_t packed_size[16] = { - 12, 13, 15, 17, 19, 20, 26, 31, 5, 0, 0, 0, 0, 0, 0, 0 - }; - - size = packed_size[mode] + 1; - } else if (enc->codec_id == AV_CODEC_ID_AMR_WB) { - static const uint8_t packed_size[16] = { - 18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 6, 0, 0, 0, 1, 1 - }; - - size = packed_size[mode]; - } - - if (!size || av_new_packet(pkt, size)) - return AVERROR(EIO); - - /* Both AMR formats have 50 frames per second */ - s->streams[0]->codec->bit_rate = size*8*50; - - pkt->stream_index = 0; - pkt->pos = pos; - pkt->data[0] = toc; - pkt->duration = enc->codec_id == AV_CODEC_ID_AMR_NB ? 160 : 320; - read = avio_read(s->pb, pkt->data + 1, size - 1); - - if (read != size - 1) { - av_free_packet(pkt); - return AVERROR(EIO); - } - - return 0; -} - -#if CONFIG_AMR_DEMUXER -AVInputFormat ff_amr_demuxer = { - .name = "amr", - .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"), - .read_probe = amr_probe, - .read_header = amr_read_header, - .read_packet = amr_read_packet, - .flags = AVFMT_GENERIC_INDEX, -}; -#endif - -#if CONFIG_AMR_MUXER -AVOutputFormat ff_amr_muxer = { - .name = "amr", - .long_name = NULL_IF_CONFIG_SMALL("3GPP AMR"), - .mime_type = "audio/amr", - .extensions = "amr", - .audio_codec = AV_CODEC_ID_AMR_NB, - .video_codec = AV_CODEC_ID_NONE, - .write_header = amr_write_header, - .write_packet = amr_write_packet, -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ape.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ape.c deleted file mode 100644 index 50d536e8c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ape.c +++ /dev/null @@ -1,472 +0,0 @@ -/* - * Monkey's Audio APE demuxer - * Copyright (c) 2007 Benjamin Zores - * based upon libdemac from Dave Chapman. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/intreadwrite.h" -#include "avformat.h" -#include "internal.h" -#include "apetag.h" - -/* The earliest and latest file formats supported by this library */ -#define APE_MIN_VERSION 3800 -#define APE_MAX_VERSION 3990 - -#define MAC_FORMAT_FLAG_8_BIT 1 // is 8-bit [OBSOLETE] -#define MAC_FORMAT_FLAG_CRC 2 // uses the new CRC32 error detection [OBSOLETE] -#define MAC_FORMAT_FLAG_HAS_PEAK_LEVEL 4 // uint32 nPeakLevel after the header [OBSOLETE] -#define MAC_FORMAT_FLAG_24_BIT 8 // is 24-bit [OBSOLETE] -#define MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS 16 // has the number of seek elements after the peak level -#define MAC_FORMAT_FLAG_CREATE_WAV_HEADER 32 // create the wave header on decompression (not stored) - -#define APE_EXTRADATA_SIZE 6 - -typedef struct { - int64_t pos; - int nblocks; - int size; - int skip; - int64_t pts; -} APEFrame; - -typedef struct { - /* Derived fields */ - uint32_t junklength; - uint32_t firstframe; - uint32_t totalsamples; - int currentframe; - APEFrame *frames; - - /* Info from Descriptor Block */ - char magic[4]; - int16_t fileversion; - int16_t padding1; - uint32_t descriptorlength; - uint32_t headerlength; - uint32_t seektablelength; - uint32_t wavheaderlength; - uint32_t audiodatalength; - uint32_t audiodatalength_high; - uint32_t wavtaillength; - uint8_t md5[16]; - - /* Info from Header Block */ - uint16_t compressiontype; - uint16_t formatflags; - uint32_t blocksperframe; - uint32_t finalframeblocks; - uint32_t totalframes; - uint16_t bps; - uint16_t channels; - uint32_t samplerate; - - /* Seektable */ - uint32_t *seektable; - uint8_t *bittable; -} APEContext; - -static int ape_probe(AVProbeData * p) -{ - int version = AV_RL16(p->buf+4); - if (AV_RL32(p->buf) != MKTAG('M', 'A', 'C', ' ')) - return 0; - - if (version < APE_MIN_VERSION || version > APE_MAX_VERSION) - return AVPROBE_SCORE_MAX/4; - - return AVPROBE_SCORE_MAX; -} - -static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx) -{ -#ifdef DEBUG - int i; - - av_log(s, AV_LOG_DEBUG, "Descriptor Block:\n\n"); - av_log(s, AV_LOG_DEBUG, "magic = \"%c%c%c%c\"\n", ape_ctx->magic[0], ape_ctx->magic[1], ape_ctx->magic[2], ape_ctx->magic[3]); - av_log(s, AV_LOG_DEBUG, "fileversion = %"PRId16"\n", ape_ctx->fileversion); - av_log(s, AV_LOG_DEBUG, "descriptorlength = %"PRIu32"\n", ape_ctx->descriptorlength); - av_log(s, AV_LOG_DEBUG, "headerlength = %"PRIu32"\n", ape_ctx->headerlength); - av_log(s, AV_LOG_DEBUG, "seektablelength = %"PRIu32"\n", ape_ctx->seektablelength); - av_log(s, AV_LOG_DEBUG, "wavheaderlength = %"PRIu32"\n", ape_ctx->wavheaderlength); - av_log(s, AV_LOG_DEBUG, "audiodatalength = %"PRIu32"\n", ape_ctx->audiodatalength); - av_log(s, AV_LOG_DEBUG, "audiodatalength_high = %"PRIu32"\n", ape_ctx->audiodatalength_high); - av_log(s, AV_LOG_DEBUG, "wavtaillength = %"PRIu32"\n", ape_ctx->wavtaillength); - av_log(s, AV_LOG_DEBUG, "md5 = "); - for (i = 0; i < 16; i++) - av_log(s, AV_LOG_DEBUG, "%02x", ape_ctx->md5[i]); - av_log(s, AV_LOG_DEBUG, "\n"); - - av_log(s, AV_LOG_DEBUG, "\nHeader Block:\n\n"); - - av_log(s, AV_LOG_DEBUG, "compressiontype = %"PRIu16"\n", ape_ctx->compressiontype); - av_log(s, AV_LOG_DEBUG, "formatflags = %"PRIu16"\n", ape_ctx->formatflags); - av_log(s, AV_LOG_DEBUG, "blocksperframe = %"PRIu32"\n", ape_ctx->blocksperframe); - av_log(s, AV_LOG_DEBUG, "finalframeblocks = %"PRIu32"\n", ape_ctx->finalframeblocks); - av_log(s, AV_LOG_DEBUG, "totalframes = %"PRIu32"\n", ape_ctx->totalframes); - av_log(s, AV_LOG_DEBUG, "bps = %"PRIu16"\n", ape_ctx->bps); - av_log(s, AV_LOG_DEBUG, "channels = %"PRIu16"\n", ape_ctx->channels); - av_log(s, AV_LOG_DEBUG, "samplerate = %"PRIu32"\n", ape_ctx->samplerate); - - av_log(s, AV_LOG_DEBUG, "\nSeektable\n\n"); - if ((ape_ctx->seektablelength / sizeof(uint32_t)) != ape_ctx->totalframes) { - av_log(s, AV_LOG_DEBUG, "No seektable\n"); - } else { - for (i = 0; i < ape_ctx->seektablelength / sizeof(uint32_t); i++) { - if (i < ape_ctx->totalframes - 1) { - av_log(s, AV_LOG_DEBUG, "%8d %"PRIu32" (%"PRIu32" bytes)", - i, ape_ctx->seektable[i], - ape_ctx->seektable[i + 1] - ape_ctx->seektable[i]); - if (ape_ctx->bittable) - av_log(s, AV_LOG_DEBUG, " + %2d bits\n", - ape_ctx->bittable[i]); - av_log(s, AV_LOG_DEBUG, "\n"); - } else { - av_log(s, AV_LOG_DEBUG, "%8d %"PRIu32"\n", i, ape_ctx->seektable[i]); - } - } - } - - av_log(s, AV_LOG_DEBUG, "\nFrames\n\n"); - for (i = 0; i < ape_ctx->totalframes; i++) - av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8d (%d samples)\n", i, - ape_ctx->frames[i].pos, ape_ctx->frames[i].size, - ape_ctx->frames[i].nblocks); - - av_log(s, AV_LOG_DEBUG, "\nCalculated information:\n\n"); - av_log(s, AV_LOG_DEBUG, "junklength = %"PRIu32"\n", ape_ctx->junklength); - av_log(s, AV_LOG_DEBUG, "firstframe = %"PRIu32"\n", ape_ctx->firstframe); - av_log(s, AV_LOG_DEBUG, "totalsamples = %"PRIu32"\n", ape_ctx->totalsamples); -#endif -} - -static int ape_read_header(AVFormatContext * s) -{ - AVIOContext *pb = s->pb; - APEContext *ape = s->priv_data; - AVStream *st; - uint32_t tag; - int i; - int total_blocks, final_size = 0; - int64_t pts, file_size; - - /* Skip any leading junk such as id3v2 tags */ - ape->junklength = avio_tell(pb); - - tag = avio_rl32(pb); - if (tag != MKTAG('M', 'A', 'C', ' ')) - return AVERROR_INVALIDDATA; - - ape->fileversion = avio_rl16(pb); - - if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { - av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", - ape->fileversion / 1000, (ape->fileversion % 1000) / 10); - return AVERROR_PATCHWELCOME; - } - - if (ape->fileversion >= 3980) { - ape->padding1 = avio_rl16(pb); - ape->descriptorlength = avio_rl32(pb); - ape->headerlength = avio_rl32(pb); - ape->seektablelength = avio_rl32(pb); - ape->wavheaderlength = avio_rl32(pb); - ape->audiodatalength = avio_rl32(pb); - ape->audiodatalength_high = avio_rl32(pb); - ape->wavtaillength = avio_rl32(pb); - avio_read(pb, ape->md5, 16); - - /* Skip any unknown bytes at the end of the descriptor. - This is for future compatibility */ - if (ape->descriptorlength > 52) - avio_skip(pb, ape->descriptorlength - 52); - - /* Read header data */ - ape->compressiontype = avio_rl16(pb); - ape->formatflags = avio_rl16(pb); - ape->blocksperframe = avio_rl32(pb); - ape->finalframeblocks = avio_rl32(pb); - ape->totalframes = avio_rl32(pb); - ape->bps = avio_rl16(pb); - ape->channels = avio_rl16(pb); - ape->samplerate = avio_rl32(pb); - } else { - ape->descriptorlength = 0; - ape->headerlength = 32; - - ape->compressiontype = avio_rl16(pb); - ape->formatflags = avio_rl16(pb); - ape->channels = avio_rl16(pb); - ape->samplerate = avio_rl32(pb); - ape->wavheaderlength = avio_rl32(pb); - ape->wavtaillength = avio_rl32(pb); - ape->totalframes = avio_rl32(pb); - ape->finalframeblocks = avio_rl32(pb); - - if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { - avio_skip(pb, 4); /* Skip the peak level */ - ape->headerlength += 4; - } - - if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { - ape->seektablelength = avio_rl32(pb); - ape->headerlength += 4; - ape->seektablelength *= sizeof(int32_t); - } else - ape->seektablelength = ape->totalframes * sizeof(int32_t); - - if (ape->formatflags & MAC_FORMAT_FLAG_8_BIT) - ape->bps = 8; - else if (ape->formatflags & MAC_FORMAT_FLAG_24_BIT) - ape->bps = 24; - else - ape->bps = 16; - - if (ape->fileversion >= 3950) - ape->blocksperframe = 73728 * 4; - else if (ape->fileversion >= 3900 || (ape->fileversion >= 3800 && ape->compressiontype >= 4000)) - ape->blocksperframe = 73728; - else - ape->blocksperframe = 9216; - - /* Skip any stored wav header */ - if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) - avio_skip(pb, ape->wavheaderlength); - } - - if(!ape->totalframes){ - av_log(s, AV_LOG_ERROR, "No frames in the file!\n"); - return AVERROR(EINVAL); - } - if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ - av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", - ape->totalframes); - return AVERROR_INVALIDDATA; - } - if (ape->seektablelength / sizeof(*ape->seektable) < ape->totalframes) { - av_log(s, AV_LOG_ERROR, - "Number of seek entries is less than number of frames: %zu vs. %"PRIu32"\n", - ape->seektablelength / sizeof(*ape->seektable), ape->totalframes); - return AVERROR_INVALIDDATA; - } - ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame)); - if(!ape->frames) - return AVERROR(ENOMEM); - ape->firstframe = ape->junklength + ape->descriptorlength + ape->headerlength + ape->seektablelength + ape->wavheaderlength; - if (ape->fileversion < 3810) - ape->firstframe += ape->totalframes; - ape->currentframe = 0; - - - ape->totalsamples = ape->finalframeblocks; - if (ape->totalframes > 1) - ape->totalsamples += ape->blocksperframe * (ape->totalframes - 1); - - if (ape->seektablelength > 0) { - ape->seektable = av_mallocz(ape->seektablelength); - if (!ape->seektable) - return AVERROR(ENOMEM); - for (i = 0; i < ape->seektablelength / sizeof(uint32_t) && !pb->eof_reached; i++) - ape->seektable[i] = avio_rl32(pb); - if (ape->fileversion < 3810) { - ape->bittable = av_mallocz(ape->totalframes); - if (!ape->bittable) - return AVERROR(ENOMEM); - for (i = 0; i < ape->totalframes && !pb->eof_reached; i++) - ape->bittable[i] = avio_r8(pb); - } - if (pb->eof_reached) - av_log(s, AV_LOG_WARNING, "File truncated\n"); - } - - ape->frames[0].pos = ape->firstframe; - ape->frames[0].nblocks = ape->blocksperframe; - ape->frames[0].skip = 0; - for (i = 1; i < ape->totalframes; i++) { - ape->frames[i].pos = ape->seektable[i] + ape->junklength; - ape->frames[i].nblocks = ape->blocksperframe; - ape->frames[i - 1].size = ape->frames[i].pos - ape->frames[i - 1].pos; - ape->frames[i].skip = (ape->frames[i].pos - ape->frames[0].pos) & 3; - } - ape->frames[ape->totalframes - 1].nblocks = ape->finalframeblocks; - /* calculate final packet size from total file size, if available */ - file_size = avio_size(pb); - if (file_size > 0) { - final_size = file_size - ape->frames[ape->totalframes - 1].pos - - ape->wavtaillength; - final_size -= final_size & 3; - } - if (file_size <= 0 || final_size <= 0) - final_size = ape->finalframeblocks * 8; - ape->frames[ape->totalframes - 1].size = final_size; - - for (i = 0; i < ape->totalframes; i++) { - if(ape->frames[i].skip){ - ape->frames[i].pos -= ape->frames[i].skip; - ape->frames[i].size += ape->frames[i].skip; - } - ape->frames[i].size = (ape->frames[i].size + 3) & ~3; - } - if (ape->fileversion < 3810) { - for (i = 0; i < ape->totalframes; i++) { - if (i < ape->totalframes - 1 && ape->bittable[i + 1]) - ape->frames[i].size += 4; - ape->frames[i].skip <<= 3; - ape->frames[i].skip += ape->bittable[i]; - } - } - - ape_dumpinfo(s, ape); - - av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %"PRIu16"\n", - ape->fileversion / 1000, (ape->fileversion % 1000) / 10, - ape->compressiontype); - - /* now we are ready: build format streams */ - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - total_blocks = (ape->totalframes == 0) ? 0 : ((ape->totalframes - 1) * ape->blocksperframe) + ape->finalframeblocks; - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_APE; - st->codec->codec_tag = MKTAG('A', 'P', 'E', ' '); - st->codec->channels = ape->channels; - st->codec->sample_rate = ape->samplerate; - st->codec->bits_per_coded_sample = ape->bps; - - st->nb_frames = ape->totalframes; - st->start_time = 0; - st->duration = total_blocks; - avpriv_set_pts_info(st, 64, 1, ape->samplerate); - - if (ff_alloc_extradata(st->codec, APE_EXTRADATA_SIZE)) - return AVERROR(ENOMEM); - AV_WL16(st->codec->extradata + 0, ape->fileversion); - AV_WL16(st->codec->extradata + 2, ape->compressiontype); - AV_WL16(st->codec->extradata + 4, ape->formatflags); - - pts = 0; - for (i = 0; i < ape->totalframes; i++) { - ape->frames[i].pts = pts; - av_add_index_entry(st, ape->frames[i].pos, ape->frames[i].pts, 0, 0, AVINDEX_KEYFRAME); - pts += ape->blocksperframe; - } - - /* try to read APE tags */ - if (pb->seekable) { - ff_ape_parse_tag(s); - avio_seek(pb, 0, SEEK_SET); - } - - return 0; -} - -static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) -{ - int ret; - int nblocks; - APEContext *ape = s->priv_data; - uint32_t extra_size = 8; - - if (url_feof(s->pb)) - return AVERROR_EOF; - if (ape->currentframe >= ape->totalframes) - return AVERROR_EOF; - - if (avio_seek(s->pb, ape->frames[ape->currentframe].pos, SEEK_SET) < 0) - return AVERROR(EIO); - - /* Calculate how many blocks there are in this frame */ - if (ape->currentframe == (ape->totalframes - 1)) - nblocks = ape->finalframeblocks; - else - nblocks = ape->blocksperframe; - - if (ape->frames[ape->currentframe].size <= 0 || - ape->frames[ape->currentframe].size > INT_MAX - extra_size) { - av_log(s, AV_LOG_ERROR, "invalid packet size: %d\n", - ape->frames[ape->currentframe].size); - ape->currentframe++; - return AVERROR(EIO); - } - - if (av_new_packet(pkt, ape->frames[ape->currentframe].size + extra_size) < 0) - return AVERROR(ENOMEM); - - AV_WL32(pkt->data , nblocks); - AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip); - ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size); - if (ret < 0) { - av_free_packet(pkt); - return ret; - } - - pkt->pts = ape->frames[ape->currentframe].pts; - pkt->stream_index = 0; - - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret + extra_size; - - ape->currentframe++; - - return 0; -} - -static int ape_read_close(AVFormatContext * s) -{ - APEContext *ape = s->priv_data; - - av_freep(&ape->frames); - av_freep(&ape->seektable); - av_freep(&ape->bittable); - return 0; -} - -static int ape_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) -{ - AVStream *st = s->streams[stream_index]; - APEContext *ape = s->priv_data; - int index = av_index_search_timestamp(st, timestamp, flags); - - if (index < 0) - return -1; - - if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0) - return -1; - ape->currentframe = index; - return 0; -} - -AVInputFormat ff_ape_demuxer = { - .name = "ape", - .long_name = "Monkey's Audio", - .priv_data_size = sizeof(APEContext), - .read_probe = ape_probe, - .read_header = ape_read_header, - .read_packet = ape_read_packet, - .read_close = ape_read_close, - .read_seek = ape_read_seek, - .extensions = "ape,apl,mac", -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.c deleted file mode 100644 index 03582f369..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * APE tag handling - * Copyright (c) 2007 Benjamin Zores - * based upon libdemac from Dave Chapman. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/intreadwrite.h" -#include "libavutil/dict.h" -#include "avformat.h" -#include "avio_internal.h" -#include "apetag.h" -#include "internal.h" - -#define APE_TAG_FLAG_CONTAINS_HEADER (1 << 31) -#define APE_TAG_FLAG_CONTAINS_FOOTER (1 << 30) -#define APE_TAG_FLAG_IS_HEADER (1 << 29) -#define APE_TAG_FLAG_IS_BINARY (1 << 1) - -static int ape_tag_read_field(AVFormatContext *s) -{ - AVIOContext *pb = s->pb; - uint8_t key[1024], *value; - uint32_t size, flags; - int i, c; - - size = avio_rl32(pb); /* field size */ - flags = avio_rl32(pb); /* field flags */ - for (i = 0; i < sizeof(key) - 1; i++) { - c = avio_r8(pb); - if (c < 0x20 || c > 0x7E) - break; - else - key[i] = c; - } - key[i] = 0; - if (c != 0) { - av_log(s, AV_LOG_WARNING, "Invalid APE tag key '%s'.\n", key); - return -1; - } - if (size >= UINT_MAX) - return -1; - if (flags & APE_TAG_FLAG_IS_BINARY) { - uint8_t filename[1024]; - enum AVCodecID id; - AVStream *st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - size -= avio_get_str(pb, size, (char *)filename, sizeof(filename)); - if (size <= 0) { - av_log(s, AV_LOG_WARNING, "Skipping binary tag '%s'.\n", key); - return 0; - } - - av_dict_set(&st->metadata, (const char *)key, (const char *)filename, 0); - - if ((id = ff_guess_image2_codec((const char *)filename)) != AV_CODEC_ID_NONE) { - AVPacket pkt; - int ret; - - ret = av_get_packet(s->pb, &pkt, size); - if (ret < 0) { - av_log(s, AV_LOG_ERROR, "Error reading cover art.\n"); - return ret; - } - - st->disposition |= AV_DISPOSITION_ATTACHED_PIC; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = id; - - st->attached_pic = pkt; - st->attached_pic.stream_index = st->index; - st->attached_pic.flags |= AV_PKT_FLAG_KEY; - } else { - if (ff_get_extradata(st->codec, s->pb, size) < 0) - return AVERROR(ENOMEM); - st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; - } - } else { - value = av_malloc(size+1); - if (!value) - return AVERROR(ENOMEM); - c = avio_read(pb, value, size); - if (c < 0) { - av_free(value); - return c; - } - value[c] = 0; - av_dict_set(&s->metadata, (const char *)key, (const char *)value, AV_DICT_DONT_STRDUP_VAL); - } - return 0; -} - -int64_t ff_ape_parse_tag(AVFormatContext *s) -{ - AVIOContext *pb = s->pb; - int64_t file_size = avio_size(pb); - uint32_t val, fields, tag_bytes; - uint8_t buf[8]; - int64_t tag_start; - int i; - - if (file_size < APE_TAG_FOOTER_BYTES) - return 0; - - avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); - - avio_read(pb, buf, 8); /* APETAGEX */ - if (strncmp((const char *)buf, APE_TAG_PREAMBLE, 8)) { - return 0; - } - - val = avio_rl32(pb); /* APE tag version */ - if (val > APE_TAG_VERSION) { - av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); - return 0; - } - - tag_bytes = avio_rl32(pb); /* tag size */ - if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { - av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); - return 0; - } - - if (tag_bytes > file_size - APE_TAG_FOOTER_BYTES) { - av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); - return 0; - } - tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; - - fields = avio_rl32(pb); /* number of fields */ - if (fields > 65536) { - av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); - return 0; - } - - val = avio_rl32(pb); /* flags */ - if (val & APE_TAG_FLAG_IS_HEADER) { - av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); - return 0; - } - - avio_seek(pb, file_size - tag_bytes, SEEK_SET); - - for (i=0; i= 0x20 && *str <= 0x7e ) str++; - return !*str; -} - -int ff_ape_write_tag(AVFormatContext *s) -{ - AVDictionaryEntry *e = NULL; - int size, ret, count = 0; - AVIOContext *dyn_bc = NULL; - uint8_t *dyn_buf = NULL; - - if ((ret = avio_open_dyn_buf(&dyn_bc)) < 0) - goto end; - - // flags - avio_wl32(dyn_bc, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER | - APE_TAG_FLAG_IS_HEADER); - ffio_fill(dyn_bc, 0, 8); // reserved - - while ((e = av_dict_get(s->metadata, "", e, AV_DICT_IGNORE_SUFFIX))) { - int val_len; - - if (!string_is_ascii((const uint8_t *)e->key)) { - av_log(s, AV_LOG_WARNING, "Non ASCII keys are not allowed\n"); - continue; - } - - val_len = strlen(e->value); - avio_wl32(dyn_bc, val_len); // value length - avio_wl32(dyn_bc, 0); // item flags - avio_put_str(dyn_bc, e->key); // key - avio_write(dyn_bc, (const unsigned char *)e->value, val_len); // value - count++; - } - if (!count) - goto end; - - size = avio_close_dyn_buf(dyn_bc, &dyn_buf); - if (size <= 0) - goto end; - size += 20; - - // header - avio_write(s->pb, (const unsigned char *)"APETAGEX", 8); // id - avio_wl32(s->pb, APE_TAG_VERSION); // version - avio_wl32(s->pb, size); - avio_wl32(s->pb, count); - - avio_write(s->pb, dyn_buf, size - 20); - - // footer - avio_write(s->pb, (const unsigned char *)"APETAGEX", 8); // id - avio_wl32(s->pb, APE_TAG_VERSION); // version - avio_wl32(s->pb, size); // size - avio_wl32(s->pb, count); // tag count - - // flags - avio_wl32(s->pb, APE_TAG_FLAG_CONTAINS_HEADER | APE_TAG_FLAG_CONTAINS_FOOTER); - ffio_fill(s->pb, 0, 8); // reserved - -end: - if (dyn_bc && !dyn_buf) - avio_close_dyn_buf(dyn_bc, &dyn_buf); - av_freep(&dyn_buf); - - return ret; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.h deleted file mode 100644 index cf2a5f8ab..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/apetag.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * APE tag handling - * Copyright (c) 2007 Benjamin Zores - * based upon libdemac from Dave Chapman. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_APETAG_H -#define AVFORMAT_APETAG_H - -#include "avformat.h" - -#define APE_TAG_PREAMBLE "APETAGEX" -#define APE_TAG_VERSION 2000 -#define APE_TAG_FOOTER_BYTES 32 - -/** - * Read and parse an APE tag - * - * @return offset of the tag start in the file - */ -int64_t ff_ape_parse_tag(AVFormatContext *s); - -/** - * Write an APE tag into a file. - */ -int ff_ape_write_tag(AVFormatContext *s); - -#endif /* AVFORMAT_APETAG_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.c deleted file mode 100644 index 80d24dbf4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "asf.h" - -const ff_asf_guid ff_asf_header = { - 0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C -}; - -const ff_asf_guid ff_asf_file_header = { - 0xA1, 0xDC, 0xAB, 0x8C, 0x47, 0xA9, 0xCF, 0x11, 0x8E, 0xE4, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 -}; - -const ff_asf_guid ff_asf_stream_header = { - 0x91, 0x07, 0xDC, 0xB7, 0xB7, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 -}; - -const ff_asf_guid ff_asf_ext_stream_header = { - 0xCB, 0xA5, 0xE6, 0x14, 0x72, 0xC6, 0x32, 0x43, 0x83, 0x99, 0xA9, 0x69, 0x52, 0x06, 0x5B, 0x5A -}; - -const ff_asf_guid ff_asf_audio_stream = { - 0x40, 0x9E, 0x69, 0xF8, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B -}; - -const ff_asf_guid ff_asf_audio_conceal_none = { - // 0x40, 0xa4, 0xf1, 0x49, 0x4ece, 0x11d0, 0xa3, 0xac, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 - // New value lifted from avifile - 0x00, 0x57, 0xfb, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xa8, 0xfd, 0x00, 0x80, 0x5f, 0x5c, 0x44, 0x2b -}; - -const ff_asf_guid ff_asf_audio_conceal_spread = { - 0x50, 0xCD, 0xC3, 0xBF, 0x8F, 0x61, 0xCF, 0x11, 0x8B, 0xB2, 0x00, 0xAA, 0x00, 0xB4, 0xE2, 0x20 -}; - -const ff_asf_guid ff_asf_video_stream = { - 0xC0, 0xEF, 0x19, 0xBC, 0x4D, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B -}; - -const ff_asf_guid ff_asf_jfif_media = { - 0x00, 0xE1, 0x1B, 0xB6, 0x4E, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B -}; - -const ff_asf_guid ff_asf_video_conceal_none = { - 0x00, 0x57, 0xFB, 0x20, 0x55, 0x5B, 0xCF, 0x11, 0xA8, 0xFD, 0x00, 0x80, 0x5F, 0x5C, 0x44, 0x2B -}; - -const ff_asf_guid ff_asf_command_stream = { - 0xC0, 0xCF, 0xDA, 0x59, 0xE6, 0x59, 0xD0, 0x11, 0xA3, 0xAC, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 -}; - -const ff_asf_guid ff_asf_comment_header = { - 0x33, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c -}; - -const ff_asf_guid ff_asf_codec_comment_header = { - 0x40, 0x52, 0xD1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xA3, 0xA4, 0x00, 0xA0, 0xC9, 0x03, 0x48, 0xF6 -}; -const ff_asf_guid ff_asf_codec_comment1_header = { - 0x41, 0x52, 0xd1, 0x86, 0x1D, 0x31, 0xD0, 0x11, 0xa3, 0xa4, 0x00, 0xa0, 0xc9, 0x03, 0x48, 0xf6 -}; - -const ff_asf_guid ff_asf_data_header = { - 0x36, 0x26, 0xb2, 0x75, 0x8E, 0x66, 0xCF, 0x11, 0xa6, 0xd9, 0x00, 0xaa, 0x00, 0x62, 0xce, 0x6c -}; - -const ff_asf_guid ff_asf_head1_guid = { - 0xb5, 0x03, 0xbf, 0x5f, 0x2E, 0xA9, 0xCF, 0x11, 0x8e, 0xe3, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 -}; - -const ff_asf_guid ff_asf_head2_guid = { - 0x11, 0xd2, 0xd3, 0xab, 0xBA, 0xA9, 0xCF, 0x11, 0x8e, 0xe6, 0x00, 0xc0, 0x0c, 0x20, 0x53, 0x65 -}; - -const ff_asf_guid ff_asf_extended_content_header = { - 0x40, 0xA4, 0xD0, 0xD2, 0x07, 0xE3, 0xD2, 0x11, 0x97, 0xF0, 0x00, 0xA0, 0xC9, 0x5E, 0xA8, 0x50 -}; - -const ff_asf_guid ff_asf_simple_index_header = { - 0x90, 0x08, 0x00, 0x33, 0xB1, 0xE5, 0xCF, 0x11, 0x89, 0xF4, 0x00, 0xA0, 0xC9, 0x03, 0x49, 0xCB -}; - -const ff_asf_guid ff_asf_ext_stream_embed_stream_header = { - 0xe2, 0x65, 0xfb, 0x3a, 0xEF, 0x47, 0xF2, 0x40, 0xac, 0x2c, 0x70, 0xa9, 0x0d, 0x71, 0xd3, 0x43 -}; - -const ff_asf_guid ff_asf_ext_stream_audio_stream = { - 0x9d, 0x8c, 0x17, 0x31, 0xE1, 0x03, 0x28, 0x45, 0xb5, 0x82, 0x3d, 0xf9, 0xdb, 0x22, 0xf5, 0x03 -}; - -const ff_asf_guid ff_asf_metadata_header = { - 0xea, 0xcb, 0xf8, 0xc5, 0xaf, 0x5b, 0x77, 0x48, 0x84, 0x67, 0xaa, 0x8c, 0x44, 0xfa, 0x4c, 0xca -}; - -const ff_asf_guid ff_asf_metadata_library_header = { - 0x94, 0x1c, 0x23, 0x44, 0x98, 0x94, 0xd1, 0x49, 0xa1, 0x41, 0x1d, 0x13, 0x4e, 0x45, 0x70, 0x54 -}; - -const ff_asf_guid ff_asf_marker_header = { - 0x01, 0xCD, 0x87, 0xF4, 0x51, 0xA9, 0xCF, 0x11, 0x8E, 0xE6, 0x00, 0xC0, 0x0C, 0x20, 0x53, 0x65 -}; - -const ff_asf_guid ff_asf_reserved_4 = { - 0x20, 0xdb, 0xfe, 0x4c, 0xf6, 0x75, 0xCF, 0x11, 0x9c, 0x0f, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb -}; - -/* I am not a number !!! This GUID is the one found on the PC used to - * generate the stream */ -const ff_asf_guid ff_asf_my_guid = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -const ff_asf_guid ff_asf_language_guid = { - 0xa9, 0x46, 0x43, 0x7c, 0xe0, 0xef, 0xfc, 0x4b, 0xb2, 0x29, 0x39, 0x3e, 0xde, 0x41, 0x5c, 0x85 -}; - -const ff_asf_guid ff_asf_content_encryption = { - 0xfb, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e -}; - -const ff_asf_guid ff_asf_ext_content_encryption = { - 0x14, 0xe6, 0x8a, 0x29, 0x22, 0x26, 0x17, 0x4c, 0xb9, 0x35, 0xda, 0xe0, 0x7e, 0xe9, 0x28, 0x9c -}; - -const ff_asf_guid ff_asf_digital_signature = { - 0xfc, 0xb3, 0x11, 0x22, 0x23, 0xbd, 0xd2, 0x11, 0xb4, 0xb7, 0x00, 0xa0, 0xc9, 0x55, 0xfc, 0x6e -}; - -/* List of official tags at http://msdn.microsoft.com/en-us/library/dd743066(VS.85).aspx */ -const AVMetadataConv ff_asf_metadata_conv[] = { - { "WM/AlbumArtist", "album_artist" }, - { "WM/AlbumTitle", "album" }, - { "Author", "artist" }, - { "Description", "comment" }, - { "WM/Composer", "composer" }, - { "WM/EncodedBy", "encoded_by" }, - { "WM/EncodingSettings", "encoder" }, - { "WM/Genre", "genre" }, - { "WM/Language", "language" }, - { "WM/OriginalFilename", "filename" }, - { "WM/PartOfSet", "disc" }, - { "WM/Publisher", "publisher" }, - { "WM/Tool", "encoder" }, - { "WM/TrackNumber", "track" }, - { "WM/MediaStationCallSign", "service_provider" }, - { "WM/MediaStationName", "service_name" }, -// { "Year" , "date" }, TODO: conversion year<->date - { 0 } -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.h deleted file mode 100644 index 0c9598a8d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asf.h +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2000, 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_ASF_H -#define AVFORMAT_ASF_H - -#include -#include "avformat.h" -#include "metadata.h" -#include "riff.h" - -#define PACKET_SIZE 3200 - -typedef struct ASFPayload { - uint8_t type; - uint16_t size; -} ASFPayload; - -typedef struct ASFStream { - int num; - unsigned char seq; - /* use for reading */ - AVPacket pkt; - int frag_offset; - int packet_obj_size; - int timestamp; - int64_t duration; - int skip_to_key; - int pkt_clean; - - int ds_span; /* descrambling */ - int ds_packet_size; - int ds_chunk_size; - - int64_t packet_pos; - - uint16_t stream_language_index; - - int palette_changed; - uint32_t palette[256]; - - int payload_ext_ct; - ASFPayload payload[8]; -} ASFStream; - -typedef struct ASFMainHeader { - ff_asf_guid guid; ///< generated by client computer - uint64_t file_size; /**< in bytes - * invalid if broadcasting */ - uint64_t create_time; /**< time of creation, in 100-nanosecond units since 1.1.1601 - * invalid if broadcasting */ - uint64_t play_time; /**< play time, in 100-nanosecond units - * invalid if broadcasting */ - uint64_t send_time; /**< time to send file, in 100-nanosecond units - * invalid if broadcasting (could be ignored) */ - uint32_t preroll; /**< timestamp of the first packet, in milliseconds - * if nonzero - subtract from time */ - uint32_t ignore; ///< preroll is 64bit - but let's just ignore it - uint32_t flags; /**< 0x01 - broadcast - * 0x02 - seekable - * rest is reserved should be 0 */ - uint32_t min_pktsize; /**< size of a data packet - * invalid if broadcasting */ - uint32_t max_pktsize; /**< shall be the same as for min_pktsize - * invalid if broadcasting */ - uint32_t max_bitrate; /**< bandwidth of stream in bps - * should be the sum of bitrates of the - * individual media streams */ -} ASFMainHeader; - - -typedef struct ASFIndex { - uint32_t packet_number; - uint16_t packet_count; - uint64_t send_time; - uint64_t offset; -} ASFIndex; - -extern const ff_asf_guid ff_asf_header; -extern const ff_asf_guid ff_asf_file_header; -extern const ff_asf_guid ff_asf_stream_header; -extern const ff_asf_guid ff_asf_ext_stream_header; -extern const ff_asf_guid ff_asf_audio_stream; -extern const ff_asf_guid ff_asf_audio_conceal_none; -extern const ff_asf_guid ff_asf_audio_conceal_spread; -extern const ff_asf_guid ff_asf_video_stream; -extern const ff_asf_guid ff_asf_jfif_media; -extern const ff_asf_guid ff_asf_video_conceal_none; -extern const ff_asf_guid ff_asf_command_stream; -extern const ff_asf_guid ff_asf_comment_header; -extern const ff_asf_guid ff_asf_codec_comment_header; -extern const ff_asf_guid ff_asf_codec_comment1_header; -extern const ff_asf_guid ff_asf_data_header; -extern const ff_asf_guid ff_asf_head1_guid; -extern const ff_asf_guid ff_asf_head2_guid; -extern const ff_asf_guid ff_asf_extended_content_header; -extern const ff_asf_guid ff_asf_simple_index_header; -extern const ff_asf_guid ff_asf_ext_stream_embed_stream_header; -extern const ff_asf_guid ff_asf_ext_stream_audio_stream; -extern const ff_asf_guid ff_asf_metadata_header; -extern const ff_asf_guid ff_asf_metadata_library_header; -extern const ff_asf_guid ff_asf_marker_header; -extern const ff_asf_guid ff_asf_reserved_4; -extern const ff_asf_guid ff_asf_my_guid; -extern const ff_asf_guid ff_asf_language_guid; -extern const ff_asf_guid ff_asf_content_encryption; -extern const ff_asf_guid ff_asf_ext_content_encryption; -extern const ff_asf_guid ff_asf_digital_signature; - -extern const AVMetadataConv ff_asf_metadata_conv[]; - -#define ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT 0x80 //1000 0000 - - -// ASF data packet structure -// ========================= -// -// -// ----------------------------------- -// | Error Correction Data | Optional -// ----------------------------------- -// | Payload Parsing Information (PPI) | -// ----------------------------------- -// | Payload Data | -// ----------------------------------- -// | Padding Data | -// ----------------------------------- - - -// PPI_FLAG - Payload parsing information flags -#define ASF_PPI_FLAG_MULTIPLE_PAYLOADS_PRESENT 1 - -#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_BYTE 0x02 //0000 0010 -#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_WORD 0x04 //0000 0100 -#define ASF_PPI_FLAG_SEQUENCE_FIELD_IS_DWORD 0x06 //0000 0110 -#define ASF_PPI_MASK_SEQUENCE_FIELD_SIZE 0x06 //0000 0110 - -#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_BYTE 0x08 //0000 1000 -#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_WORD 0x10 //0001 0000 -#define ASF_PPI_FLAG_PADDING_LENGTH_FIELD_IS_DWORD 0x18 //0001 1000 -#define ASF_PPI_MASK_PADDING_LENGTH_FIELD_SIZE 0x18 //0001 1000 - -#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_BYTE 0x20 //0010 0000 -#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_WORD 0x40 //0100 0000 -#define ASF_PPI_FLAG_PACKET_LENGTH_FIELD_IS_DWORD 0x60 //0110 0000 -#define ASF_PPI_MASK_PACKET_LENGTH_FIELD_SIZE 0x60 //0110 0000 - -// PL_FLAG - Payload flags -#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_BYTE 0x01 //0000 0001 -#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_WORD 0x02 //0000 0010 -#define ASF_PL_FLAG_REPLICATED_DATA_LENGTH_FIELD_IS_DWORD 0x03 //0000 0011 -#define ASF_PL_MASK_REPLICATED_DATA_LENGTH_FIELD_SIZE 0x03 //0000 0011 - -#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_BYTE 0x04 //0000 0100 -#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_WORD 0x08 //0000 1000 -#define ASF_PL_FLAG_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_IS_DWORD 0x0c //0000 1100 -#define ASF_PL_MASK_OFFSET_INTO_MEDIA_OBJECT_LENGTH_FIELD_SIZE 0x0c //0000 1100 - -#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_BYTE 0x10 //0001 0000 -#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_WORD 0x20 //0010 0000 -#define ASF_PL_FLAG_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_IS_DWORD 0x30 //0011 0000 -#define ASF_PL_MASK_MEDIA_OBJECT_NUMBER_LENGTH_FIELD_SIZE 0x30 //0011 0000 - -#define ASF_PL_FLAG_STREAM_NUMBER_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 -#define ASF_PL_MASK_STREAM_NUMBER_LENGTH_FIELD_SIZE 0xc0 //1100 0000 - -#define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_BYTE 0x40 //0100 0000 -#define ASF_PL_FLAG_PAYLOAD_LENGTH_FIELD_IS_WORD 0x80 //1000 0000 -#define ASF_PL_MASK_PAYLOAD_LENGTH_FIELD_SIZE 0xc0 //1100 0000 - -#define ASF_PL_FLAG_KEY_FRAME 0x80 //1000 0000 - -extern AVInputFormat ff_asf_demuxer; - -#endif /* AVFORMAT_ASF_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.c deleted file mode 100644 index a402758d0..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * ASF decryption - * Copyright (c) 2007 Reimar Doeffinger - * This is a rewrite of code contained in freeme/freeme2 - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/bswap.h" -#include "libavutil/common.h" -#include "libavutil/des.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/rc4.h" -#include "asfcrypt.h" - -/** - * @brief find multiplicative inverse modulo 2 ^ 32 - * @param v number to invert, must be odd! - * @return number so that result * v = 1 (mod 2^32) - */ -static uint32_t inverse(uint32_t v) -{ - // v ^ 3 gives the inverse (mod 16), could also be implemented - // as table etc. (only lowest 4 bits matter!) - uint32_t inverse = v * v * v; - // uses a fixpoint-iteration that doubles the number - // of correct lowest bits each time - inverse *= 2 - v * inverse; - inverse *= 2 - v * inverse; - inverse *= 2 - v * inverse; - return inverse; -} - -/** - * @brief read keys from keybuf into keys - * @param keybuf buffer containing the keys - * @param keys output key array containing the keys for encryption in - * native endianness - */ -static void multiswap_init(const uint8_t keybuf[48], uint32_t keys[12]) -{ - int i; - for (i = 0; i < 12; i++) - keys[i] = AV_RL32(keybuf + (i << 2)) | 1; -} - -/** - * @brief invert the keys so that encryption become decryption keys and - * the other way round. - * @param keys key array of ints to invert - */ -static void multiswap_invert_keys(uint32_t keys[12]) -{ - int i; - for (i = 0; i < 5; i++) - keys[i] = inverse(keys[i]); - for (i = 6; i < 11; i++) - keys[i] = inverse(keys[i]); -} - -static uint32_t multiswap_step(const uint32_t keys[12], uint32_t v) -{ - int i; - v *= keys[0]; - for (i = 1; i < 5; i++) { - v = (v >> 16) | (v << 16); - v *= keys[i]; - } - v += keys[5]; - return v; -} - -static uint32_t multiswap_inv_step(const uint32_t keys[12], uint32_t v) -{ - int i; - v -= keys[5]; - for (i = 4; i > 0; i--) { - v *= keys[i]; - v = (v >> 16) | (v << 16); - } - v *= keys[0]; - return v; -} - -/** - * @brief "MultiSwap" encryption - * @param keys 32 bit numbers in machine endianness, - * 0-4 and 6-10 must be inverted from decryption - * @param key another key, this one must be the same for the decryption - * @param data data to encrypt - * @return encrypted data - */ -static uint64_t multiswap_enc(const uint32_t keys[12], - uint64_t key, uint64_t data) -{ - uint32_t a = data; - uint32_t b = data >> 32; - uint32_t c; - uint32_t tmp; - a += key; - tmp = multiswap_step(keys, a); - b += tmp; - c = (key >> 32) + tmp; - tmp = multiswap_step(keys + 6, b); - c += tmp; - return ((uint64_t)c << 32) | tmp; -} - -/** - * @brief "MultiSwap" decryption - * @param keys 32 bit numbers in machine endianness, - * 0-4 and 6-10 must be inverted from encryption - * @param key another key, this one must be the same as for the encryption - * @param data data to decrypt - * @return decrypted data - */ -static uint64_t multiswap_dec(const uint32_t keys[12], - uint64_t key, uint64_t data) -{ - uint32_t a; - uint32_t b; - uint32_t c = data >> 32; - uint32_t tmp = data; - c -= tmp; - b = multiswap_inv_step(keys + 6, tmp); - tmp = c - (key >> 32); - b -= tmp; - a = multiswap_inv_step(keys, tmp); - a -= key; - return ((uint64_t)b << 32) | a; -} - -void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len) -{ - struct AVDES des; - struct AVRC4 rc4; - int num_qwords = len >> 3; - uint8_t *qwords = data; - uint64_t rc4buff[8] = { 0 }; - uint64_t packetkey; - uint32_t ms_keys[12]; - uint64_t ms_state; - int i; - if (len < 16) { - for (i = 0; i < len; i++) - data[i] ^= key[i]; - return; - } - - av_rc4_init(&rc4, key, 12 * 8, 1); - av_rc4_crypt(&rc4, (uint8_t *)rc4buff, NULL, sizeof(rc4buff), NULL, 1); - multiswap_init((uint8_t *)rc4buff, ms_keys); - - packetkey = AV_RN64(&qwords[num_qwords * 8 - 8]); - packetkey ^= rc4buff[7]; - av_des_init(&des, key + 12, 64, 1); - av_des_crypt(&des, (uint8_t *)&packetkey, (uint8_t *)&packetkey, 1, NULL, 1); - packetkey ^= rc4buff[6]; - - av_rc4_init(&rc4, (uint8_t *)&packetkey, 64, 1); - av_rc4_crypt(&rc4, data, data, len, NULL, 1); - - ms_state = 0; - for (i = 0; i < num_qwords - 1; i++, qwords += 8) - ms_state = multiswap_enc(ms_keys, ms_state, AV_RL64(qwords)); - multiswap_invert_keys(ms_keys); - packetkey = (packetkey << 32) | (packetkey >> 32); - packetkey = av_le2ne64(packetkey); - packetkey = multiswap_dec(ms_keys, ms_state, packetkey); - AV_WL64(qwords, packetkey); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.h deleted file mode 100644 index 8b80d63c5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfcrypt.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * ASF decryption - * Copyright (c) 2007 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_ASFCRYPT_H -#define AVFORMAT_ASFCRYPT_H - -#include - -void ff_asfcrypt_dec(const uint8_t key[20], uint8_t *data, int len); - -#endif /* AVFORMAT_ASFCRYPT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfdec.c deleted file mode 100644 index 9077bce00..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/asfdec.c +++ /dev/null @@ -1,1597 +0,0 @@ -/* - * ASF compatible demuxer - * Copyright (c) 2000, 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/attributes.h" -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/bswap.h" -#include "libavutil/common.h" -#include "libavutil/dict.h" -#include "libavutil/internal.h" -#include "libavutil/mathematics.h" -#include "libavutil/opt.h" -#include "avformat.h" -#include "avio_internal.h" -#include "avlanguage.h" -#include "id3v2.h" -#include "internal.h" -#include "riff.h" -#include "asf.h" -#include "asfcrypt.h" - -typedef struct { - const AVClass *class; - int asfid2avid[128]; ///< conversion table from asf ID 2 AVStream ID - ASFStream streams[128]; ///< it's max number and it's not that big - uint32_t stream_bitrates[128]; ///< max number of streams, bitrate for each (for streaming) - AVRational dar[128]; - char stream_languages[128][6]; ///< max number of streams, language for each (RFC1766, e.g. en-US) - /* non streamed additonnal info */ - /* packet filling */ - int packet_size_left; - /* only for reading */ - uint64_t data_offset; ///< beginning of the first data packet - uint64_t data_object_offset; ///< data object offset (excl. GUID & size) - uint64_t data_object_size; ///< size of the data object - int index_read; - - ASFMainHeader hdr; - - int packet_flags; - int packet_property; - int packet_timestamp; - int packet_segsizetype; - int packet_segments; - int packet_seq; - int packet_replic_size; - int packet_key_frame; - int packet_padsize; - unsigned int packet_frag_offset; - unsigned int packet_frag_size; - int64_t packet_frag_timestamp; - int packet_multi_size; - int packet_time_delta; - int packet_time_start; - int64_t packet_pos; - - int stream_index; - - ASFStream *asf_st; ///< currently decoded stream - - int no_resync_search; -} ASFContext; - -static const AVOption options[] = { - { "no_resync_search", "Don't try to resynchronize by looking for a certain optional start code", offsetof(ASFContext, no_resync_search), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AV_OPT_FLAG_DECODING_PARAM }, - { NULL }, -}; - -static const AVClass asf_class = { - .class_name = "asf demuxer", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, -}; - -#undef NDEBUG -#include - -#define ASF_MAX_STREAMS 127 -#define FRAME_HEADER_SIZE 16 -// Fix Me! FRAME_HEADER_SIZE may be different. (17 is known to be too large) - -#ifdef DEBUG -static const ff_asf_guid stream_bitrate_guid = { /* (http://get.to/sdp) */ - 0xce, 0x75, 0xf8, 0x7b, 0x8d, 0x46, 0xd1, 0x11, 0x8d, 0x82, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2 -}; - -#define PRINT_IF_GUID(g, cmp) \ - if (!ff_guidcmp(g, &cmp)) \ - av_dlog(NULL, "(GUID: %s) ", # cmp) - -static void print_guid(ff_asf_guid *g) -{ - int i; - PRINT_IF_GUID(g, ff_asf_header); - else PRINT_IF_GUID(g, ff_asf_file_header); - else PRINT_IF_GUID(g, ff_asf_stream_header); - else PRINT_IF_GUID(g, ff_asf_audio_stream); - else PRINT_IF_GUID(g, ff_asf_audio_conceal_none); - else PRINT_IF_GUID(g, ff_asf_video_stream); - else PRINT_IF_GUID(g, ff_asf_video_conceal_none); - else PRINT_IF_GUID(g, ff_asf_command_stream); - else PRINT_IF_GUID(g, ff_asf_comment_header); - else PRINT_IF_GUID(g, ff_asf_codec_comment_header); - else PRINT_IF_GUID(g, ff_asf_codec_comment1_header); - else PRINT_IF_GUID(g, ff_asf_data_header); - else PRINT_IF_GUID(g, ff_asf_simple_index_header); - else PRINT_IF_GUID(g, ff_asf_head1_guid); - else PRINT_IF_GUID(g, ff_asf_head2_guid); - else PRINT_IF_GUID(g, ff_asf_my_guid); - else PRINT_IF_GUID(g, ff_asf_ext_stream_header); - else PRINT_IF_GUID(g, ff_asf_extended_content_header); - else PRINT_IF_GUID(g, ff_asf_ext_stream_embed_stream_header); - else PRINT_IF_GUID(g, ff_asf_ext_stream_audio_stream); - else PRINT_IF_GUID(g, ff_asf_metadata_header); - else PRINT_IF_GUID(g, ff_asf_metadata_library_header); - else PRINT_IF_GUID(g, ff_asf_marker_header); - else PRINT_IF_GUID(g, stream_bitrate_guid); - else PRINT_IF_GUID(g, ff_asf_language_guid); - else - av_dlog(NULL, "(GUID: unknown) "); - for (i = 0; i < 16; i++) - av_dlog(NULL, " 0x%02x,", (*g)[i]); - av_dlog(NULL, "}\n"); -} -#undef PRINT_IF_GUID -#else -#define print_guid(g) -#endif - -static int asf_probe(AVProbeData *pd) -{ - /* check file header */ - if (!ff_guidcmp(pd->buf, &ff_asf_header)) - return AVPROBE_SCORE_MAX; - else - return 0; -} - -/* size of type 2 (BOOL) is 32bit for "Extended Content Description Object" - * but 16 bit for "Metadata Object" and "Metadata Library Object" */ -static int get_value(AVIOContext *pb, int type, int type2_size) -{ - switch (type) { - case 2: - return (type2_size == 32) ? avio_rl32(pb) : avio_rl16(pb); - case 3: - return avio_rl32(pb); - case 4: - return avio_rl64(pb); - case 5: - return avio_rl16(pb); - default: - return INT_MIN; - } -} - -/* MSDN claims that this should be "compatible with the ID3 frame, APIC", - * but in reality this is only loosely similar */ -static int asf_read_picture(AVFormatContext *s, int len) -{ - AVPacket pkt = { 0 }; - const CodecMime *mime = ff_id3v2_mime_tags; - enum AVCodecID id = AV_CODEC_ID_NONE; - char mimetype[64]; - uint8_t *desc = NULL; - AVStream *st = NULL; - int ret, type, picsize, desc_len; - - /* type + picsize + mime + desc */ - if (len < 1 + 4 + 2 + 2) { - av_log(s, AV_LOG_ERROR, "Invalid attached picture size: %d.\n", len); - return AVERROR_INVALIDDATA; - } - - /* picture type */ - type = avio_r8(s->pb); - len--; - if (type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types) || type < 0) { - av_log(s, AV_LOG_WARNING, "Unknown attached picture type: %d.\n", type); - type = 0; - } - - /* picture data size */ - picsize = avio_rl32(s->pb); - len -= 4; - - /* picture MIME type */ - len -= avio_get_str16le(s->pb, len, mimetype, sizeof(mimetype)); - while (mime->id != AV_CODEC_ID_NONE) { - if (!strncmp(mime->str, mimetype, sizeof(mimetype))) { - id = mime->id; - break; - } - mime++; - } - if (id == AV_CODEC_ID_NONE) { - av_log(s, AV_LOG_ERROR, "Unknown attached picture mimetype: %s.\n", - mimetype); - return 0; - } - - if (picsize >= len) { - av_log(s, AV_LOG_ERROR, "Invalid attached picture data size: %d >= %d.\n", - picsize, len); - return AVERROR_INVALIDDATA; - } - - /* picture description */ - desc_len = (len - picsize) * 2 + 1; - desc = av_malloc(desc_len); - if (!desc) - return AVERROR(ENOMEM); - len -= avio_get_str16le(s->pb, len - picsize, (char *) desc, desc_len); - - ret = av_get_packet(s->pb, &pkt, picsize); - if (ret < 0) - goto fail; - - st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } - st->disposition |= AV_DISPOSITION_ATTACHED_PIC; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = id; - st->attached_pic = pkt; - st->attached_pic.stream_index = st->index; - st->attached_pic.flags |= AV_PKT_FLAG_KEY; - - if (*desc) - av_dict_set(&st->metadata, "title", (char *) desc, AV_DICT_DONT_STRDUP_VAL); - else - av_freep(&desc); - - av_dict_set(&st->metadata, "comment", (const char *) ff_id3v2_picture_types[type], 0); - - return 0; - -fail: - av_freep(&desc); - av_free_packet(&pkt); - return ret; -} - -static void get_id3_tag(AVFormatContext *s, int len) -{ - ID3v2ExtraMeta *id3v2_extra_meta = NULL; - - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); - if (id3v2_extra_meta) - ff_id3v2_parse_apic(s, &id3v2_extra_meta); - ff_id3v2_free_extra_meta(&id3v2_extra_meta); -} - -static void get_tag(AVFormatContext *s, const char *key, int type, int len, int type2_size) -{ - char *value; - int64_t off = avio_tell(s->pb); -#define LEN 22 - - if ((unsigned)len >= (UINT_MAX - LEN) / 2) - return; - - value = av_malloc(2 * len + LEN); - if (!value) - goto finish; - - if (type == 0) { // UTF16-LE - avio_get_str16le(s->pb, len, value, 2 * len + 1); - } else if (type == -1) { // ASCII - avio_read(s->pb, (unsigned char *) value, len); - value[len]=0; - } else if (type == 1) { // byte array - if (!strcmp(key, "WM/Picture")) { // handle cover art - asf_read_picture(s, len); - } else if (!strcmp(key, "ID3")) { // handle ID3 tag - get_id3_tag(s, len); - } else { - av_log(s, AV_LOG_VERBOSE, "Unsupported byte array in tag %s.\n", key); - } - goto finish; - } else if (type > 1 && type <= 5) { // boolean or DWORD or QWORD or WORD - uint64_t num = get_value(s->pb, type, type2_size); - snprintf(value, LEN, "%"PRIu64, num); - } else if (type == 6) { // (don't) handle GUID - av_log(s, AV_LOG_DEBUG, "Unsupported GUID value in tag %s.\n", key); - goto finish; - } else { - av_log(s, AV_LOG_DEBUG, - "Unsupported value type %d in tag %s.\n", type, key); - goto finish; - } - if (*value) - av_dict_set(&s->metadata, key, value, 0); - -finish: - av_freep(&value); - avio_seek(s->pb, off + len, SEEK_SET); -} - -static int asf_read_file_properties(AVFormatContext *s, int64_t size) -{ - ASFContext *asf = s->priv_data; - AVIOContext *pb = s->pb; - - ff_get_guid(pb, &asf->hdr.guid); - asf->hdr.file_size = avio_rl64(pb); - asf->hdr.create_time = avio_rl64(pb); - avio_rl64(pb); /* number of packets */ - asf->hdr.play_time = avio_rl64(pb); - asf->hdr.send_time = avio_rl64(pb); - asf->hdr.preroll = avio_rl32(pb); - asf->hdr.ignore = avio_rl32(pb); - asf->hdr.flags = avio_rl32(pb); - asf->hdr.min_pktsize = avio_rl32(pb); - asf->hdr.max_pktsize = avio_rl32(pb); - if (asf->hdr.min_pktsize >= (1U << 29)) - return AVERROR_INVALIDDATA; - asf->hdr.max_bitrate = avio_rl32(pb); - s->packet_size = asf->hdr.max_pktsize; - - return 0; -} - -static int asf_read_stream_properties(AVFormatContext *s, int64_t size) -{ - ASFContext *asf = s->priv_data; - AVIOContext *pb = s->pb; - AVStream *st; - ASFStream *asf_st; - ff_asf_guid g; - enum AVMediaType type; - int type_specific_size, sizeX; - unsigned int tag1; - int64_t pos1, pos2, start_time; - int test_for_ext_stream_audio, is_dvr_ms_audio = 0; - - if (s->nb_streams == ASF_MAX_STREAMS) { - av_log(s, AV_LOG_ERROR, "too many streams\n"); - return AVERROR(EINVAL); - } - - pos1 = avio_tell(pb); - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - avpriv_set_pts_info(st, 32, 1, 1000); /* 32 bit pts in ms */ - start_time = asf->hdr.preroll; - - if (!(asf->hdr.flags & 0x01)) { // if we aren't streaming... - int64_t fsize = avio_size(pb); - if (fsize <= 0 || (int64_t)asf->hdr.file_size <= 0 || FFABS(fsize - (int64_t)asf->hdr.file_size) < 10000) - st->duration = asf->hdr.play_time / - (10000000 / 1000) - start_time; - } - ff_get_guid(pb, &g); - - test_for_ext_stream_audio = 0; - if (!ff_guidcmp(&g, &ff_asf_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - } else if (!ff_guidcmp(&g, &ff_asf_video_stream)) { - type = AVMEDIA_TYPE_VIDEO; - } else if (!ff_guidcmp(&g, &ff_asf_jfif_media)) { - type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = AV_CODEC_ID_MJPEG; - } else if (!ff_guidcmp(&g, &ff_asf_command_stream)) { - type = AVMEDIA_TYPE_DATA; - } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_embed_stream_header)) { - test_for_ext_stream_audio = 1; - type = AVMEDIA_TYPE_UNKNOWN; - } else { - return -1; - } - ff_get_guid(pb, &g); - avio_skip(pb, 8); /* total_size */ - type_specific_size = avio_rl32(pb); - avio_rl32(pb); - st->id = avio_rl16(pb) & 0x7f; /* stream id */ - // mapping of asf ID to AV stream ID; - asf->asfid2avid[st->id] = s->nb_streams - 1; - asf_st = &asf->streams[st->id]; - - avio_rl32(pb); - - if (test_for_ext_stream_audio) { - ff_get_guid(pb, &g); - if (!ff_guidcmp(&g, &ff_asf_ext_stream_audio_stream)) { - type = AVMEDIA_TYPE_AUDIO; - is_dvr_ms_audio = 1; - ff_get_guid(pb, &g); - avio_rl32(pb); - avio_rl32(pb); - avio_rl32(pb); - ff_get_guid(pb, &g); - avio_rl32(pb); - } - } - - st->codec->codec_type = type; - if (type == AVMEDIA_TYPE_AUDIO) { - int ret = ff_get_wav_header(pb, st->codec, type_specific_size); - if (ret < 0) - return ret; - if (is_dvr_ms_audio) { - // codec_id and codec_tag are unreliable in dvr_ms - // files. Set them later by probing stream. - st->request_probe = 1; - st->codec->codec_tag = 0; - } - if (st->codec->codec_id == AV_CODEC_ID_AAC) - st->need_parsing = AVSTREAM_PARSE_NONE; - else - st->need_parsing = AVSTREAM_PARSE_FULL; - /* We have to init the frame size at some point .... */ - pos2 = avio_tell(pb); - if (size >= (pos2 + 8 - pos1 + 24)) { - asf_st->ds_span = avio_r8(pb); - asf_st->ds_packet_size = avio_rl16(pb); - asf_st->ds_chunk_size = avio_rl16(pb); - avio_rl16(pb); // ds_data_size - avio_r8(pb); // ds_silence_data - } - if (asf_st->ds_span > 1) { - if (!asf_st->ds_chunk_size || - (asf_st->ds_packet_size / asf_st->ds_chunk_size <= 1) || - asf_st->ds_packet_size % asf_st->ds_chunk_size) - asf_st->ds_span = 0; // disable descrambling - } - } else if (type == AVMEDIA_TYPE_VIDEO && - size - (avio_tell(pb) - pos1 + 24) >= 51) { - avio_rl32(pb); - avio_rl32(pb); - avio_r8(pb); - avio_rl16(pb); /* size */ - sizeX = avio_rl32(pb); /* size */ - st->codec->width = avio_rl32(pb); - st->codec->height = avio_rl32(pb); - /* not available for asf */ - avio_rl16(pb); /* panes */ - st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ - tag1 = avio_rl32(pb); - avio_skip(pb, 20); - if (sizeX > 40) { - st->codec->extradata_size = ffio_limit(pb, sizeX - 40); - st->codec->extradata = av_mallocz(st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE); - if (!st->codec->extradata) - return AVERROR(ENOMEM); - avio_read(pb, st->codec->extradata, st->codec->extradata_size); - } - - /* Extract palette from extradata if bpp <= 8 */ - /* This code assumes that extradata contains only palette */ - /* This is true for all paletted codecs implemented in libavcodec */ - if (st->codec->extradata_size && (st->codec->bits_per_coded_sample <= 8)) { -#if HAVE_BIGENDIAN - int i; - for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE) / 4; i++) - asf_st->palette[i] = av_bswap32(((uint32_t *)st->codec->extradata)[i]); -#else - memcpy(asf_st->palette, st->codec->extradata, - FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); -#endif - asf_st->palette_changed = 1; - } - - st->codec->codec_tag = tag1; - st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1); - if (tag1 == MKTAG('D', 'V', 'R', ' ')) { - st->need_parsing = AVSTREAM_PARSE_FULL; - /* issue658 contains wrong w/h and MS even puts a fake seq header - * with wrong w/h in extradata while a correct one is in the stream. - * maximum lameness */ - st->codec->width = - st->codec->height = 0; - av_freep(&st->codec->extradata); - st->codec->extradata_size = 0; - } - if (st->codec->codec_id == AV_CODEC_ID_H264) - st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; - } - pos2 = avio_tell(pb); - avio_skip(pb, size - (pos2 - pos1 + 24)); - - return 0; -} - -static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) -{ - ASFContext *asf = s->priv_data; - AVIOContext *pb = s->pb; - ff_asf_guid g; - int ext_len, payload_ext_ct, stream_ct, i; - uint32_t leak_rate, stream_num; - unsigned int stream_languageid_index; - - avio_rl64(pb); // starttime - avio_rl64(pb); // endtime - leak_rate = avio_rl32(pb); // leak-datarate - avio_rl32(pb); // bucket-datasize - avio_rl32(pb); // init-bucket-fullness - avio_rl32(pb); // alt-leak-datarate - avio_rl32(pb); // alt-bucket-datasize - avio_rl32(pb); // alt-init-bucket-fullness - avio_rl32(pb); // max-object-size - avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved) - stream_num = avio_rl16(pb); // stream-num - - stream_languageid_index = avio_rl16(pb); // stream-language-id-index - if (stream_num < 128) - asf->streams[stream_num].stream_language_index = stream_languageid_index; - - avio_rl64(pb); // avg frametime in 100ns units - stream_ct = avio_rl16(pb); // stream-name-count - payload_ext_ct = avio_rl16(pb); // payload-extension-system-count - - if (stream_num < 128) { - asf->stream_bitrates[stream_num] = leak_rate; - asf->streams[stream_num].payload_ext_ct = 0; - } - - for (i = 0; i < stream_ct; i++) { - avio_rl16(pb); - ext_len = avio_rl16(pb); - avio_skip(pb, ext_len); - } - - for (i = 0; i < payload_ext_ct; i++) { - int size; - ff_get_guid(pb, &g); - size = avio_rl16(pb); - ext_len = avio_rl32(pb); - avio_skip(pb, ext_len); - if (stream_num < 128 && i < FF_ARRAY_ELEMS(asf->streams[stream_num].payload)) { - ASFPayload *p = &asf->streams[stream_num].payload[i]; - p->type = g[0]; - p->size = size; - av_log(s, AV_LOG_DEBUG, "Payload extension %x %d\n", g[0], p->size ); - asf->streams[stream_num].payload_ext_ct ++; - } - } - - return 0; -} - -static int asf_read_content_desc(AVFormatContext *s, int64_t size) -{ - AVIOContext *pb = s->pb; - int len1, len2, len3, len4, len5; - - len1 = avio_rl16(pb); - len2 = avio_rl16(pb); - len3 = avio_rl16(pb); - len4 = avio_rl16(pb); - len5 = avio_rl16(pb); - get_tag(s, "title", 0, len1, 32); - get_tag(s, "author", 0, len2, 32); - get_tag(s, "copyright", 0, len3, 32); - get_tag(s, "comment", 0, len4, 32); - avio_skip(pb, len5); - - return 0; -} - -static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) -{ - AVIOContext *pb = s->pb; - ASFContext *asf = s->priv_data; - int desc_count, i, ret; - - desc_count = avio_rl16(pb); - for (i = 0; i < desc_count; i++) { - int name_len, value_type, value_len; - char name[1024]; - - name_len = avio_rl16(pb); - if (name_len % 2) // must be even, broken lavf versions wrote len-1 - name_len += 1; - if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) - avio_skip(pb, name_len - ret); - value_type = avio_rl16(pb); - value_len = avio_rl16(pb); - if (!value_type && value_len % 2) - value_len += 1; - /* My sample has that stream set to 0 maybe that mean the container. - * ASF stream count starts at 1. I am using 0 to the container value - * since it's unused. */ - if (!strcmp(name, "AspectRatioX")) - asf->dar[0].num = get_value(s->pb, value_type, 32); - else if (!strcmp(name, "AspectRatioY")) - asf->dar[0].den = get_value(s->pb, value_type, 32); - else - get_tag(s, name, value_type, value_len, 32); - } - - return 0; -} - -static int asf_read_language_list(AVFormatContext *s, int64_t size) -{ - AVIOContext *pb = s->pb; - ASFContext *asf = s->priv_data; - int j, ret; - int stream_count = avio_rl16(pb); - for (j = 0; j < stream_count; j++) { - char lang[6]; - unsigned int lang_len = avio_r8(pb); - if ((ret = avio_get_str16le(pb, lang_len, lang, - sizeof(lang))) < lang_len) - avio_skip(pb, lang_len - ret); - if (j < 128) - av_strlcpy(asf->stream_languages[j], lang, - sizeof(*asf->stream_languages)); - } - - return 0; -} - -static int asf_read_metadata(AVFormatContext *s, int64_t size) -{ - AVIOContext *pb = s->pb; - ASFContext *asf = s->priv_data; - int n, stream_num, name_len, value_len; - int ret, i; - n = avio_rl16(pb); - - for (i = 0; i < n; i++) { - char name[1024]; - int value_type; - - avio_rl16(pb); // lang_list_index - stream_num = avio_rl16(pb); - name_len = avio_rl16(pb); - value_type = avio_rl16(pb); /* value_type */ - value_len = avio_rl32(pb); - - if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) - avio_skip(pb, name_len - ret); - av_dlog(s, "%d stream %d name_len %2d type %d len %4d <%s>\n", - i, stream_num, name_len, value_type, value_len, name); - - if (!strcmp(name, "AspectRatioX")){ - int aspect_x = get_value(s->pb, value_type, 16); - if(stream_num < 128) - asf->dar[stream_num].num = aspect_x; - } else if(!strcmp(name, "AspectRatioY")){ - int aspect_y = get_value(s->pb, value_type, 16); - if(stream_num < 128) - asf->dar[stream_num].den = aspect_y; - } else { - get_tag(s, name, value_type, value_len, 16); - } - } - - return 0; -} - -static int asf_read_marker(AVFormatContext *s, int64_t size) -{ - AVIOContext *pb = s->pb; - ASFContext *asf = s->priv_data; - int i, count, name_len, ret; - char name[1024]; - - avio_rl64(pb); // reserved 16 bytes - avio_rl64(pb); // ... - count = avio_rl32(pb); // markers count - avio_rl16(pb); // reserved 2 bytes - name_len = avio_rl16(pb); // name length - for (i = 0; i < name_len; i++) - avio_r8(pb); // skip the name - - for (i = 0; i < count; i++) { - int64_t pres_time; - int name_len; - - avio_rl64(pb); // offset, 8 bytes - pres_time = avio_rl64(pb); // presentation time - pres_time -= asf->hdr.preroll * 10000; - avio_rl16(pb); // entry length - avio_rl32(pb); // send time - avio_rl32(pb); // flags - name_len = avio_rl32(pb); // name length - if ((ret = avio_get_str16le(pb, name_len * 2, name, - sizeof(name))) < name_len) - avio_skip(pb, name_len - ret); - avpriv_new_chapter(s, i, (AVRational) { 1, 10000000 }, pres_time, - AV_NOPTS_VALUE, name); - } - - return 0; -} - -static int asf_read_header(AVFormatContext *s) -{ - ASFContext *asf = s->priv_data; - ff_asf_guid g; - AVIOContext *pb = s->pb; - int i; - int64_t gsize; - - ff_get_guid(pb, &g); - if (ff_guidcmp(&g, &ff_asf_header)) - return AVERROR_INVALIDDATA; - avio_rl64(pb); - avio_rl32(pb); - avio_r8(pb); - avio_r8(pb); - memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); - - for (i = 0; i<128; i++) - asf->streams[i].stream_language_index = 128; // invalid stream index means no language info - - for (;;) { - uint64_t gpos = avio_tell(pb); - ff_get_guid(pb, &g); - gsize = avio_rl64(pb); - print_guid(&g); - if (!ff_guidcmp(&g, &ff_asf_data_header)) { - asf->data_object_offset = avio_tell(pb); - /* If not streaming, gsize is not unlimited (how?), - * and there is enough space in the file.. */ - if (!(asf->hdr.flags & 0x01) && gsize >= 100) - asf->data_object_size = gsize - 24; - else - asf->data_object_size = (uint64_t)-1; - break; - } - if (gsize < 24) - return AVERROR_INVALIDDATA; - if (!ff_guidcmp(&g, &ff_asf_file_header)) { - int ret = asf_read_file_properties(s, gsize); - if (ret < 0) - return ret; - } else if (!ff_guidcmp(&g, &ff_asf_stream_header)) { - asf_read_stream_properties(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_comment_header)) { - asf_read_content_desc(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_language_guid)) { - asf_read_language_list(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_extended_content_header)) { - asf_read_ext_content_desc(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_metadata_header)) { - asf_read_metadata(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_metadata_library_header)) { - asf_read_metadata(s, gsize); - } else if (!ff_guidcmp(&g, &ff_asf_ext_stream_header)) { - asf_read_ext_stream_properties(s, gsize); - - // there could be a optional stream properties object to follow - // if so the next iteration will pick it up - continue; - } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) { - ff_get_guid(pb, &g); - avio_skip(pb, 6); - continue; - } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { - asf_read_marker(s, gsize); - } else if (url_feof(pb)) { - return AVERROR_EOF; - } else { - if (!s->keylen) { - if (!ff_guidcmp(&g, &ff_asf_content_encryption)) { - unsigned int len; - AVPacket pkt; - av_log(s, AV_LOG_WARNING, - "DRM protected stream detected, decoding will likely fail!\n"); - len= avio_rl32(pb); - av_log(s, AV_LOG_DEBUG, "Secret data:\n"); - av_get_packet(pb, &pkt, len); av_hex_dump_log(s, AV_LOG_DEBUG, pkt.data, pkt.size); av_free_packet(&pkt); - len= avio_rl32(pb); - get_tag(s, "ASF_Protection_Type", -1, len, 32); - len= avio_rl32(pb); - get_tag(s, "ASF_Key_ID", -1, len, 32); - len= avio_rl32(pb); - get_tag(s, "ASF_License_URL", -1, len, 32); - } else if (!ff_guidcmp(&g, &ff_asf_ext_content_encryption)) { - av_log(s, AV_LOG_WARNING, - "Ext DRM protected stream detected, decoding will likely fail!\n"); - av_dict_set(&s->metadata, "encryption", "ASF Extended Content Encryption", 0); - } else if (!ff_guidcmp(&g, &ff_asf_digital_signature)) { - av_log(s, AV_LOG_INFO, "Digital signature detected!\n"); - } - } - } - if (avio_tell(pb) != gpos + gsize) - av_log(s, AV_LOG_DEBUG, - "gpos mismatch our pos=%"PRIu64", end=%"PRId64"\n", - avio_tell(pb) - gpos, gsize); - avio_seek(pb, gpos + gsize, SEEK_SET); - } - ff_get_guid(pb, &g); - avio_rl64(pb); - avio_r8(pb); - avio_r8(pb); - if (url_feof(pb)) - return AVERROR_EOF; - asf->data_offset = avio_tell(pb); - asf->packet_size_left = 0; - - for (i = 0; i < 128; i++) { - int stream_num = asf->asfid2avid[i]; - if (stream_num >= 0) { - AVStream *st = s->streams[stream_num]; - if (!st->codec->bit_rate) - st->codec->bit_rate = asf->stream_bitrates[i]; - if (asf->dar[i].num > 0 && asf->dar[i].den > 0) { - av_reduce(&st->sample_aspect_ratio.num, - &st->sample_aspect_ratio.den, - asf->dar[i].num, asf->dar[i].den, INT_MAX); - } else if ((asf->dar[0].num > 0) && (asf->dar[0].den > 0) && - // Use ASF container value if the stream doesn't set AR. - (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)) - av_reduce(&st->sample_aspect_ratio.num, - &st->sample_aspect_ratio.den, - asf->dar[0].num, asf->dar[0].den, INT_MAX); - - av_dlog(s, "i=%d, st->codec->codec_type:%d, asf->dar %d:%d sar=%d:%d\n", - i, st->codec->codec_type, asf->dar[i].num, asf->dar[i].den, - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den); - - // copy and convert language codes to the frontend - if (asf->streams[i].stream_language_index < 128) { - const char *rfc1766 = asf->stream_languages[asf->streams[i].stream_language_index]; - if (rfc1766 && strlen(rfc1766) > 1) { - const char primary_tag[3] = { rfc1766[0], rfc1766[1], '\0' }; // ignore country code if any - const char *iso6392 = av_convert_lang_to(primary_tag, - AV_LANG_ISO639_2_BIBL); - if (iso6392) - av_dict_set(&st->metadata, "language", iso6392, 0); - } - } - } - } - - ff_metadata_conv(&s->metadata, NULL, ff_asf_metadata_conv); - - return 0; -} - -#define DO_2BITS(bits, var, defval) \ - switch (bits & 3) { \ - case 3: \ - var = avio_rl32(pb); \ - rsize += 4; \ - break; \ - case 2: \ - var = avio_rl16(pb); \ - rsize += 2; \ - break; \ - case 1: \ - var = avio_r8(pb); \ - rsize++; \ - break; \ - default: \ - var = defval; \ - break; \ - } - -/** - * Load a single ASF packet into the demuxer. - * @param s demux context - * @param pb context to read data from - * @return 0 on success, <0 on error - */ -static int asf_get_packet(AVFormatContext *s, AVIOContext *pb) -{ - ASFContext *asf = s->priv_data; - uint32_t packet_length, padsize; - int rsize = 8; - int c, d, e, off; - - // if we do not know packet size, allow skipping up to 32 kB - off = 32768; - if (asf->no_resync_search) - off = 3; - else if (s->packet_size > 0) - off = (avio_tell(pb) - s->data_offset) % s->packet_size + 3; - - c = d = e = -1; - while (off-- > 0) { - c = d; - d = e; - e = avio_r8(pb); - if (c == 0x82 && !d && !e) - break; - } - - if (c != 0x82) { - /* This code allows handling of -EAGAIN at packet boundaries (i.e. - * if the packet sync code above triggers -EAGAIN). This does not - * imply complete -EAGAIN handling support at random positions in - * the stream. */ - if (pb->error == AVERROR(EAGAIN)) - return AVERROR(EAGAIN); - if (!url_feof(pb)) - av_log(s, AV_LOG_ERROR, - "ff asf bad header %x at:%"PRId64"\n", c, avio_tell(pb)); - } - if ((c & 0x8f) == 0x82) { - if (d || e) { - if (!url_feof(pb)) - av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); - return AVERROR_INVALIDDATA; - } - c = avio_r8(pb); - d = avio_r8(pb); - rsize += 3; - } else if(!url_feof(pb)) { - avio_seek(pb, -1, SEEK_CUR); // FIXME - } - - asf->packet_flags = c; - asf->packet_property = d; - - DO_2BITS(asf->packet_flags >> 5, packet_length, s->packet_size); - DO_2BITS(asf->packet_flags >> 1, padsize, 0); // sequence ignored - DO_2BITS(asf->packet_flags >> 3, padsize, 0); // padding length - - // the following checks prevent overflows and infinite loops - if (!packet_length || packet_length >= (1U << 29)) { - av_log(s, AV_LOG_ERROR, - "invalid packet_length %d at:%"PRId64"\n", - packet_length, avio_tell(pb)); - return AVERROR_INVALIDDATA; - } - if (padsize >= packet_length) { - av_log(s, AV_LOG_ERROR, - "invalid padsize %d at:%"PRId64"\n", padsize, avio_tell(pb)); - return AVERROR_INVALIDDATA; - } - - asf->packet_timestamp = avio_rl32(pb); - avio_rl16(pb); /* duration */ - // rsize has at least 11 bytes which have to be present - - if (asf->packet_flags & 0x01) { - asf->packet_segsizetype = avio_r8(pb); - rsize++; - asf->packet_segments = asf->packet_segsizetype & 0x3f; - } else { - asf->packet_segments = 1; - asf->packet_segsizetype = 0x80; - } - if (rsize > packet_length - padsize) { - asf->packet_size_left = 0; - av_log(s, AV_LOG_ERROR, - "invalid packet header length %d for pktlen %d-%d at %"PRId64"\n", - rsize, packet_length, padsize, avio_tell(pb)); - return AVERROR_INVALIDDATA; - } - asf->packet_size_left = packet_length - padsize - rsize; - if (packet_length < asf->hdr.min_pktsize) - padsize += asf->hdr.min_pktsize - packet_length; - asf->packet_padsize = padsize; - av_dlog(s, "packet: size=%d padsize=%d left=%d\n", - s->packet_size, asf->packet_padsize, asf->packet_size_left); - return 0; -} - -/** - * - * @return <0 if error - */ -static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb) -{ - ASFContext *asf = s->priv_data; - ASFStream *asfst; - int rsize = 1; - int num = avio_r8(pb); - int i; - int64_t ts0, ts1 av_unused; - - asf->packet_segments--; - asf->packet_key_frame = num >> 7; - asf->stream_index = asf->asfid2avid[num & 0x7f]; - asfst = &asf->streams[num & 0x7f]; - // sequence should be ignored! - DO_2BITS(asf->packet_property >> 4, asf->packet_seq, 0); - DO_2BITS(asf->packet_property >> 2, asf->packet_frag_offset, 0); - DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); - av_dlog(asf, "key:%d stream:%d seq:%d offset:%d replic_size:%d\n", - asf->packet_key_frame, asf->stream_index, asf->packet_seq, - asf->packet_frag_offset, asf->packet_replic_size); - if (rsize+(int64_t)asf->packet_replic_size > asf->packet_size_left) { - av_log(s, AV_LOG_ERROR, "packet_replic_size %d is invalid\n", asf->packet_replic_size); - return AVERROR_INVALIDDATA; - } - if (asf->packet_replic_size >= 8) { - int64_t end = avio_tell(pb) + asf->packet_replic_size; - AVRational aspect; - asfst->packet_obj_size = avio_rl32(pb); - if (asfst->packet_obj_size >= (1 << 24) || asfst->packet_obj_size <= 0) { - av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); - asfst->packet_obj_size = 0; - return AVERROR_INVALIDDATA; - } - asf->packet_frag_timestamp = avio_rl32(pb); // timestamp - - for (i = 0; i < asfst->payload_ext_ct; i++) { - ASFPayload *p = &asfst->payload[i]; - int size = p->size; - int64_t payend; - if (size == 0xFFFF) - size = avio_rl16(pb); - payend = avio_tell(pb) + size; - if (payend > end) { - av_log(s, AV_LOG_ERROR, "too long payload\n"); - break; - } - switch (p->type) { - case 0x50: -// duration = avio_rl16(pb); - break; - case 0x54: - aspect.num = avio_r8(pb); - aspect.den = avio_r8(pb); - if (aspect.num > 0 && aspect.den > 0 && asf->stream_index >= 0) { - s->streams[asf->stream_index]->sample_aspect_ratio = aspect; - } - break; - case 0x2A: - avio_skip(pb, 8); - ts0 = avio_rl64(pb); - ts1 = avio_rl64(pb); - if (ts0!= -1) asf->packet_frag_timestamp = ts0/10000; - else asf->packet_frag_timestamp = AV_NOPTS_VALUE; - break; - case 0x5B: - case 0xB7: - case 0xCC: - case 0xC0: - case 0xA0: - //unknown - break; - } - avio_seek(pb, payend, SEEK_SET); - } - - avio_seek(pb, end, SEEK_SET); - rsize += asf->packet_replic_size; // FIXME - check validity - } else if (asf->packet_replic_size == 1) { - // multipacket - frag_offset is beginning timestamp - asf->packet_time_start = asf->packet_frag_offset; - asf->packet_frag_offset = 0; - asf->packet_frag_timestamp = asf->packet_timestamp; - - asf->packet_time_delta = avio_r8(pb); - rsize++; - } else if (asf->packet_replic_size != 0) { - av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", - asf->packet_replic_size); - return AVERROR_INVALIDDATA; - } - if (asf->packet_flags & 0x01) { - DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal - if (rsize > asf->packet_size_left) { - av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); - return AVERROR_INVALIDDATA; - } else if (asf->packet_frag_size > asf->packet_size_left - rsize) { - if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { - av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", - asf->packet_size_left, rsize); - return AVERROR_INVALIDDATA; - } else { - int diff = asf->packet_frag_size - (asf->packet_size_left - rsize); - asf->packet_size_left += diff; - asf->packet_padsize -= diff; - } - } - } else { - asf->packet_frag_size = asf->packet_size_left - rsize; - } - if (asf->packet_replic_size == 1) { - asf->packet_multi_size = asf->packet_frag_size; - if (asf->packet_multi_size > asf->packet_size_left) - return AVERROR_INVALIDDATA; - } - asf->packet_size_left -= rsize; - - return 0; -} - -/** - * Parse data from individual ASF packets (which were previously loaded - * with asf_get_packet()). - * @param s demux context - * @param pb context to read data from - * @param pkt pointer to store packet data into - * @return 0 if data was stored in pkt, <0 on error or 1 if more ASF - * packets need to be loaded (through asf_get_packet()) - */ -static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt) -{ - ASFContext *asf = s->priv_data; - ASFStream *asf_st = 0; - for (;;) { - int ret; - if (url_feof(pb)) - return AVERROR_EOF; - - if (asf->packet_size_left < FRAME_HEADER_SIZE) { - int ret = asf->packet_size_left + asf->packet_padsize; - - assert(ret >= 0); - /* fail safe */ - avio_skip(pb, ret); - - asf->packet_pos = avio_tell(pb); - if (asf->data_object_size != (uint64_t)-1 && - (asf->packet_pos - asf->data_object_offset >= asf->data_object_size)) - return AVERROR_EOF; /* Do not exceed the size of the data object */ - return 1; - } - if (asf->packet_time_start == 0) { - if (asf_read_frame_header(s, pb) < 0) { - asf->packet_time_start = asf->packet_segments = 0; - continue; - } - if (asf->stream_index < 0 || - s->streams[asf->stream_index]->discard >= AVDISCARD_ALL || - (!asf->packet_key_frame && - (s->streams[asf->stream_index]->discard >= AVDISCARD_NONKEY || asf->streams[s->streams[asf->stream_index]->id].skip_to_key))) { - asf->packet_time_start = 0; - /* unhandled packet (should not happen) */ - avio_skip(pb, asf->packet_frag_size); - asf->packet_size_left -= asf->packet_frag_size; - if (asf->stream_index < 0) - av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", - asf->packet_frag_size); - continue; - } - asf->asf_st = &asf->streams[s->streams[asf->stream_index]->id]; - asf->asf_st->skip_to_key = 0; - } - asf_st = asf->asf_st; - av_assert0(asf_st); - - if (!asf_st->frag_offset && asf->packet_frag_offset) { - av_dlog(s, "skipping asf data pkt with fragment offset for " - "stream:%d, expected:%d but got %d from pkt)\n", - asf->stream_index, asf_st->frag_offset, - asf->packet_frag_offset); - avio_skip(pb, asf->packet_frag_size); - asf->packet_size_left -= asf->packet_frag_size; - continue; - } - - if (asf->packet_replic_size == 1) { - // frag_offset is here used as the beginning timestamp - asf->packet_frag_timestamp = asf->packet_time_start; - asf->packet_time_start += asf->packet_time_delta; - asf_st->packet_obj_size = asf->packet_frag_size = avio_r8(pb); - asf->packet_size_left--; - asf->packet_multi_size--; - if (asf->packet_multi_size < asf_st->packet_obj_size) { - asf->packet_time_start = 0; - avio_skip(pb, asf->packet_multi_size); - asf->packet_size_left -= asf->packet_multi_size; - continue; - } - asf->packet_multi_size -= asf_st->packet_obj_size; - } - - if (asf_st->pkt.size != asf_st->packet_obj_size || - // FIXME is this condition sufficient? - asf_st->frag_offset + asf->packet_frag_size > asf_st->pkt.size) { - if (asf_st->pkt.data) { - av_log(s, AV_LOG_INFO, - "freeing incomplete packet size %d, new %d\n", - asf_st->pkt.size, asf_st->packet_obj_size); - asf_st->frag_offset = 0; - av_free_packet(&asf_st->pkt); - } - /* new packet */ - av_new_packet(&asf_st->pkt, asf_st->packet_obj_size); - asf_st->seq = asf->packet_seq; - asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll; - asf_st->pkt.stream_index = asf->stream_index; - asf_st->pkt.pos = asf_st->packet_pos = asf->packet_pos; - asf_st->pkt_clean = 0; - - if (asf_st->pkt.data && asf_st->palette_changed) { - uint8_t *pal; - pal = av_packet_new_side_data(&asf_st->pkt, AV_PKT_DATA_PALETTE, - AVPALETTE_SIZE); - if (!pal) { - av_log(s, AV_LOG_ERROR, "Cannot append palette to packet\n"); - } else { - memcpy(pal, asf_st->palette, AVPALETTE_SIZE); - asf_st->palette_changed = 0; - } - } - av_dlog(asf, "new packet: stream:%d key:%d packet_key:%d audio:%d size:%d\n", - asf->stream_index, asf->packet_key_frame, - asf_st->pkt.flags & AV_PKT_FLAG_KEY, - s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO, - asf_st->packet_obj_size); - if (s->streams[asf->stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO) - asf->packet_key_frame = 1; - if (asf->packet_key_frame) - asf_st->pkt.flags |= AV_PKT_FLAG_KEY; - } - - /* read data */ - av_dlog(asf, "READ PACKET s:%d os:%d o:%d,%d l:%d DATA:%p\n", - s->packet_size, asf_st->pkt.size, asf->packet_frag_offset, - asf_st->frag_offset, asf->packet_frag_size, asf_st->pkt.data); - asf->packet_size_left -= asf->packet_frag_size; - if (asf->packet_size_left < 0) - continue; - - if (asf->packet_frag_offset >= asf_st->pkt.size || - asf->packet_frag_size > asf_st->pkt.size - asf->packet_frag_offset) { - av_log(s, AV_LOG_ERROR, - "packet fragment position invalid %u,%u not in %u\n", - asf->packet_frag_offset, asf->packet_frag_size, - asf_st->pkt.size); - continue; - } - - if (asf->packet_frag_offset != asf_st->frag_offset && !asf_st->pkt_clean) { - memset(asf_st->pkt.data + asf_st->frag_offset, 0, asf_st->pkt.size - asf_st->frag_offset); - asf_st->pkt_clean = 1; - } - - ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset, - asf->packet_frag_size); - if (ret != asf->packet_frag_size) { - if (ret < 0 || asf->packet_frag_offset + ret == 0) - return ret < 0 ? ret : AVERROR_EOF; - - if (asf_st->ds_span > 1) { - // scrambling, we can either drop it completely or fill the remainder - // TODO: should we fill the whole packet instead of just the current - // fragment? - memset(asf_st->pkt.data + asf->packet_frag_offset + ret, 0, - asf->packet_frag_size - ret); - ret = asf->packet_frag_size; - } else { - // no scrambling, so we can return partial packets - av_shrink_packet(&asf_st->pkt, asf->packet_frag_offset + ret); - } - } - if (s->key && s->keylen == 20) - ff_asfcrypt_dec(s->key, asf_st->pkt.data + asf->packet_frag_offset, - ret); - asf_st->frag_offset += ret; - /* test if whole packet is read */ - if (asf_st->frag_offset == asf_st->pkt.size) { - // workaround for macroshit radio DVR-MS files - if (s->streams[asf->stream_index]->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO && - asf_st->pkt.size > 100) { - int i; - for (i = 0; i < asf_st->pkt.size && !asf_st->pkt.data[i]; i++) - ; - if (i == asf_st->pkt.size) { - av_log(s, AV_LOG_DEBUG, "discarding ms fart\n"); - asf_st->frag_offset = 0; - av_free_packet(&asf_st->pkt); - continue; - } - } - - /* return packet */ - if (asf_st->ds_span > 1) { - if (asf_st->pkt.size != asf_st->ds_packet_size * asf_st->ds_span) { - av_log(s, AV_LOG_ERROR, - "pkt.size != ds_packet_size * ds_span (%d %d %d)\n", - asf_st->pkt.size, asf_st->ds_packet_size, - asf_st->ds_span); - } else { - /* packet descrambling */ - AVBufferRef *buf = av_buffer_alloc(asf_st->pkt.size + - FF_INPUT_BUFFER_PADDING_SIZE); - if (buf) { - uint8_t *newdata = buf->data; - int offset = 0; - memset(newdata + asf_st->pkt.size, 0, - FF_INPUT_BUFFER_PADDING_SIZE); - while (offset < asf_st->pkt.size) { - int off = offset / asf_st->ds_chunk_size; - int row = off / asf_st->ds_span; - int col = off % asf_st->ds_span; - int idx = row + col * asf_st->ds_packet_size / asf_st->ds_chunk_size; - assert(offset + asf_st->ds_chunk_size <= asf_st->pkt.size); - assert(idx + 1 <= asf_st->pkt.size / asf_st->ds_chunk_size); - memcpy(newdata + offset, - asf_st->pkt.data + idx * asf_st->ds_chunk_size, - asf_st->ds_chunk_size); - offset += asf_st->ds_chunk_size; - } - av_buffer_unref(&asf_st->pkt.buf); - asf_st->pkt.buf = buf; - asf_st->pkt.data = buf->data; - } - } - } - asf_st->frag_offset = 0; - *pkt = asf_st->pkt; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - asf_st->pkt.destruct = NULL; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - asf_st->pkt.buf = 0; - asf_st->pkt.size = 0; - asf_st->pkt.data = 0; - asf_st->pkt.side_data_elems = 0; - asf_st->pkt.side_data = NULL; - break; // packet completed - } - } - return 0; -} - -static int asf_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - ASFContext *asf = s->priv_data; - - for (;;) { - int ret; - - /* parse cached packets, if any */ - if ((ret = asf_parse_packet(s, s->pb, pkt)) <= 0) - return ret; - if ((ret = asf_get_packet(s, s->pb)) < 0) - assert(asf->packet_size_left < FRAME_HEADER_SIZE || - asf->packet_segments < 1); - asf->packet_time_start = 0; - } -} - -// Added to support seeking after packets have been read -// If information is not reset, read_packet fails due to -// leftover information from previous reads -static void asf_reset_header(AVFormatContext *s) -{ - ASFContext *asf = s->priv_data; - ASFStream *asf_st; - int i; - - asf->packet_size_left = 0; - asf->packet_flags = 0; - asf->packet_property = 0; - asf->packet_timestamp = 0; - asf->packet_segsizetype = 0; - asf->packet_segments = 0; - asf->packet_seq = 0; - asf->packet_replic_size = 0; - asf->packet_key_frame = 0; - asf->packet_padsize = 0; - asf->packet_frag_offset = 0; - asf->packet_frag_size = 0; - asf->packet_frag_timestamp = 0; - asf->packet_multi_size = 0; - asf->packet_time_delta = 0; - asf->packet_time_start = 0; - - for (i = 0; i < 128; i++) { - asf_st = &asf->streams[i]; - av_free_packet(&asf_st->pkt); - asf_st->packet_obj_size = 0; - asf_st->frag_offset = 0; - asf_st->seq = 0; - } - asf->asf_st = NULL; -} - -static void skip_to_key(AVFormatContext *s) -{ - ASFContext *asf = s->priv_data; - int i; - - for (i = 0; i < 128; i++) { - int j = asf->asfid2avid[i]; - ASFStream *asf_st = &asf->streams[i]; - if (j < 0 || s->streams[j]->codec->codec_type != AVMEDIA_TYPE_VIDEO) - continue; - - asf_st->skip_to_key = 1; - } -} - -static int asf_read_close(AVFormatContext *s) -{ - asf_reset_header(s); - - return 0; -} - -static int64_t asf_read_pts(AVFormatContext *s, int stream_index, - int64_t *ppos, int64_t pos_limit) -{ - ASFContext *asf = s->priv_data; - AVPacket pkt1, *pkt = &pkt1; - ASFStream *asf_st; - int64_t pts; - int64_t pos = *ppos; - int i; - int64_t start_pos[ASF_MAX_STREAMS]; - - for (i = 0; i < s->nb_streams; i++) - start_pos[i] = pos; - - if (s->packet_size > 0) - pos = (pos + s->packet_size - 1 - s->data_offset) / - s->packet_size * s->packet_size + - s->data_offset; - *ppos = pos; - if (avio_seek(s->pb, pos, SEEK_SET) < 0) - return AV_NOPTS_VALUE; - - ff_read_frame_flush(s); - asf_reset_header(s); - for (;;) { - if (av_read_frame(s, pkt) < 0) { - av_log(s, AV_LOG_INFO, "asf_read_pts failed\n"); - return AV_NOPTS_VALUE; - } - - pts = pkt->dts; - - av_free_packet(pkt); - if (pkt->flags & AV_PKT_FLAG_KEY) { - i = pkt->stream_index; - - asf_st = &asf->streams[s->streams[i]->id]; - -// assert((asf_st->packet_pos - s->data_offset) % s->packet_size == 0); - pos = asf_st->packet_pos; - - av_add_index_entry(s->streams[i], pos, pts, pkt->size, - pos - start_pos[i] + 1, AVINDEX_KEYFRAME); - start_pos[i] = asf_st->packet_pos + 1; - - if (pkt->stream_index == stream_index) - break; - } - } - - *ppos = pos; - return pts; -} - -static int asf_build_simple_index(AVFormatContext *s, int stream_index) -{ - ff_asf_guid g; - ASFContext *asf = s->priv_data; - int64_t current_pos = avio_tell(s->pb); - int ret = 0; - - if((ret = avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET)) < 0) { - return ret; - } - - if ((ret = ff_get_guid(s->pb, &g)) < 0) - goto end; - - /* the data object can be followed by other top-level objects, - * skip them until the simple index object is reached */ - while (ff_guidcmp(&g, &ff_asf_simple_index_header)) { - int64_t gsize = avio_rl64(s->pb); - if (gsize < 24 || url_feof(s->pb)) { - goto end; - } - avio_skip(s->pb, gsize - 24); - if ((ret = ff_get_guid(s->pb, &g)) < 0) - goto end; - } - - { - int64_t itime, last_pos = -1; - int pct, ict; - int i; - int64_t av_unused gsize = avio_rl64(s->pb); - if ((ret = ff_get_guid(s->pb, &g)) < 0) - goto end; - itime = avio_rl64(s->pb); - pct = avio_rl32(s->pb); - ict = avio_rl32(s->pb); - av_log(s, AV_LOG_DEBUG, - "itime:0x%"PRIx64", pct:%d, ict:%d\n", itime, pct, ict); - - for (i = 0; i < ict; i++) { - int pktnum = avio_rl32(s->pb); - int pktct = avio_rl16(s->pb); - int64_t pos = s->data_offset + s->packet_size * (int64_t)pktnum; - int64_t index_pts = FFMAX(av_rescale(itime, i, 10000) - asf->hdr.preroll, 0); - - if (pos != last_pos) { - av_log(s, AV_LOG_DEBUG, "pktnum:%d, pktct:%d pts: %"PRId64"\n", - pktnum, pktct, index_pts); - av_add_index_entry(s->streams[stream_index], pos, index_pts, - s->packet_size, 0, AVINDEX_KEYFRAME); - last_pos = pos; - } - } - asf->index_read = ict > 1; - } -end: -// if (url_feof(s->pb)) { -// ret = 0; -// } - avio_seek(s->pb, current_pos, SEEK_SET); - return ret; -} - -static int asf_read_seek(AVFormatContext *s, int stream_index, - int64_t pts, int flags) -{ - ASFContext *asf = s->priv_data; - AVStream *st = s->streams[stream_index]; - int ret = 0; - - if (s->packet_size <= 0) - return -1; - - /* Try using the protocol's read_seek if available */ - if (s->pb) { - int ret = avio_seek_time(s->pb, stream_index, pts, flags); - if (ret >= 0) - asf_reset_header(s); - if (ret != AVERROR(ENOSYS)) - return ret; - } - - /* explicitly handle the case of seeking to 0 */ - if (!pts) { - asf_reset_header(s); - avio_seek(s->pb, s->data_offset, SEEK_SET); - return 0; - } - - if (!asf->index_read) { - ret = asf_build_simple_index(s, stream_index); - if (ret < 0) - asf->index_read = -1; - } - - if (asf->index_read > 0 && st->index_entries) { - int index = av_index_search_timestamp(st, pts, flags); - if (index >= 0) { - /* find the position */ - uint64_t pos = st->index_entries[index].pos; - - /* do the seek */ - av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); - if(avio_seek(s->pb, pos, SEEK_SET) < 0) - return -1; - asf_reset_header(s); - skip_to_key(s); - return 0; - } - } - /* no index or seeking by index failed */ - if (ff_seek_frame_binary(s, stream_index, pts, flags) < 0) - return -1; - asf_reset_header(s); - skip_to_key(s); - return 0; -} - -AVInputFormat ff_asf_demuxer = { - .name = "asf", - .long_name = NULL_IF_CONFIG_SMALL("ASF (Advanced / Active Streaming Format)"), - .priv_data_size = sizeof(ASFContext), - .read_probe = asf_probe, - .read_header = asf_read_header, - .read_packet = asf_read_packet, - .read_close = asf_read_close, - .read_seek = asf_read_seek, - .read_timestamp = asf_read_pts, - .flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH, - .priv_class = &asf_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.c deleted file mode 100644 index 9de74aae6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.c +++ /dev/null @@ -1,29 +0,0 @@ -/* - * AST common code - * Copyright (c) 2012 James Almer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "internal.h" - -const AVCodecTag ff_codec_ast_tags[] = { - { AV_CODEC_ID_ADPCM_AFC, 0 }, - { AV_CODEC_ID_PCM_S16BE_PLANAR, 1 }, - { AV_CODEC_ID_NONE, 0 }, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.h deleted file mode 100644 index 4a399ea41..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/ast.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * AST common code - * Copyright (c) 2012 James Almer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AST_H -#define AVFORMAT_AST_H - -#include "avformat.h" -#include "internal.h" - -extern const AVCodecTag ff_codec_ast_tags[]; - -#endif /* AVFORMAT_AST_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/astdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/astdec.c deleted file mode 100644 index ec199d26e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/astdec.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * AST demuxer - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/channel_layout.h" -#include "libavutil/intreadwrite.h" -#include "avformat.h" -#include "internal.h" -#include "ast.h" - -static int ast_probe(AVProbeData *p) -{ - if (AV_RL32(p->buf) != MKTAG('S','T','R','M')) - return 0; - - if (!AV_RB16(p->buf + 10) || - !AV_RB16(p->buf + 12) || AV_RB16(p->buf + 12) > 256 || - !AV_RB32(p->buf + 16) || AV_RB32(p->buf + 16) > 8*48000) - return AVPROBE_SCORE_MAX / 8; - - return AVPROBE_SCORE_MAX / 3 * 2; -} - -static int ast_read_header(AVFormatContext *s) -{ - int depth; - AVStream *st; - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - avio_skip(s->pb, 8); - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = ff_codec_get_id(ff_codec_ast_tags, avio_rb16(s->pb)); - - depth = avio_rb16(s->pb); - if (depth != 16) { - avpriv_request_sample(s, "depth %d", depth); - return AVERROR_INVALIDDATA; - } - - st->codec->channels = avio_rb16(s->pb); - if (!st->codec->channels) - return AVERROR_INVALIDDATA; - - if (st->codec->channels == 2) - st->codec->channel_layout = AV_CH_LAYOUT_STEREO; - else if (st->codec->channels == 4) - st->codec->channel_layout = AV_CH_LAYOUT_4POINT0; - - avio_skip(s->pb, 2); - st->codec->sample_rate = avio_rb32(s->pb); - if (st->codec->sample_rate <= 0) - return AVERROR_INVALIDDATA; - st->start_time = 0; - st->duration = avio_rb32(s->pb); - avio_skip(s->pb, 40); - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); - - return 0; -} - -static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - uint32_t type, size; - int64_t pos; - int ret; - - if (url_feof(s->pb)) - return AVERROR_EOF; - - pos = avio_tell(s->pb); - type = avio_rl32(s->pb); - size = avio_rb32(s->pb); - if (size > INT_MAX / s->streams[0]->codec->channels) - return AVERROR_INVALIDDATA; - - size *= s->streams[0]->codec->channels; - if ((ret = avio_skip(s->pb, 24)) < 0) // padding - return ret; - - if (type == MKTAG('B','L','C','K')) { - ret = av_get_packet(s->pb, pkt, size); - pkt->stream_index = 0; - pkt->pos = pos; - } else { - av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type); - avio_skip(s->pb, size); - ret = AVERROR_INVALIDDATA; - } - - return ret; -} - -AVInputFormat ff_ast_demuxer = { - .name = "ast", - .long_name = "AST (Audio Stream)", - .read_probe = ast_probe, - .read_header = ast_read_header, - .read_packet = ast_read_packet, - .extensions = "ast", - .flags = AVFMT_GENERIC_INDEX, - .codec_tag = (const AVCodecTag* const []){ff_codec_ast_tags, 0}, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.c deleted file mode 100644 index 2aa95f3dc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Audio Interleaving functions - * - * Copyright (c) 2009 Baptiste Coudurier - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/fifo.h" -#include "libavutil/mathematics.h" -#include "avformat.h" -#include "audiointerleave.h" -#include "internal.h" - -void ff_audio_interleave_close(AVFormatContext *s) -{ - int i; - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - AudioInterleaveContext *aic = st->priv_data; - - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - av_fifo_free(aic->fifo); - } -} - -int ff_audio_interleave_init(AVFormatContext *s, - const int *samples_per_frame, - AVRational time_base) -{ - int i; - - if (!samples_per_frame) - return -1; - - if (!time_base.num) { - av_log(s, AV_LOG_ERROR, "timebase not set for audio interleave\n"); - return -1; - } - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - AudioInterleaveContext *aic = st->priv_data; - - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - aic->sample_size = (st->codec->channels * - av_get_bits_per_sample(st->codec->codec_id)) / 8; - if (!aic->sample_size) { - av_log(s, AV_LOG_ERROR, "could not compute sample size\n"); - return -1; - } - aic->samples_per_frame = samples_per_frame; - aic->samples = aic->samples_per_frame; - aic->time_base = time_base; - - aic->fifo_size = 100* *aic->samples; - aic->fifo= av_fifo_alloc(100 * *aic->samples); - } - } - - return 0; -} - -static int interleave_new_audio_packet(AVFormatContext *s, AVPacket *pkt, - int stream_index, int flush) -{ - AVStream *st = s->streams[stream_index]; - AudioInterleaveContext *aic = st->priv_data; - - int size = FFMIN(av_fifo_size(aic->fifo), *aic->samples * aic->sample_size); - if (!size || (!flush && size == av_fifo_size(aic->fifo))) - return 0; - - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - av_fifo_generic_read(aic->fifo, pkt->data, size, NULL); - - pkt->dts = pkt->pts = aic->dts; - pkt->duration = av_rescale_q(*aic->samples, st->time_base, aic->time_base); - pkt->stream_index = stream_index; - aic->dts += pkt->duration; - - aic->samples++; - if (!*aic->samples) - aic->samples = aic->samples_per_frame; - - return size; -} - -int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, - int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), - int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *)) -{ - int i; - - if (pkt) { - AVStream *st = s->streams[pkt->stream_index]; - AudioInterleaveContext *aic = st->priv_data; - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - unsigned new_size = av_fifo_size(aic->fifo) + pkt->size; - if (new_size > aic->fifo_size) { - if (av_fifo_realloc2(aic->fifo, new_size) < 0) - return -1; - aic->fifo_size = new_size; - } - av_fifo_generic_write(aic->fifo, pkt->data, pkt->size, NULL); - } else { - int ret; - // rewrite pts and dts to be decoded time line position - pkt->pts = pkt->dts = aic->dts; - aic->dts += pkt->duration; - ret = ff_interleave_add_packet(s, pkt, compare_ts); - if (ret < 0) - return ret; - } - pkt = NULL; - } - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - AVPacket new_pkt; - int ret; - while ((ret = interleave_new_audio_packet(s, &new_pkt, i, flush)) > 0) { - ret = ff_interleave_add_packet(s, &new_pkt, compare_ts); - if (ret < 0) - return ret; - } - if (ret < 0) - return ret; - } - } - - return get_packet(s, out, NULL, flush); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.h deleted file mode 100644 index 4d77832fa..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/audiointerleave.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * audio interleaving prototypes and declarations - * - * Copyright (c) 2009 Baptiste Coudurier - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AUDIOINTERLEAVE_H -#define AVFORMAT_AUDIOINTERLEAVE_H - -#include "libavutil/fifo.h" -#include "avformat.h" - -typedef struct AudioInterleaveContext { - AVFifoBuffer *fifo; - unsigned fifo_size; ///< size of currently allocated FIFO - uint64_t dts; ///< current dts - int sample_size; ///< size of one sample all channels included - const int *samples_per_frame; ///< must be 0-terminated - const int *samples; ///< current samples per frame, pointer to samples_per_frame - AVRational time_base; ///< time base of output audio packets -} AudioInterleaveContext; - -int ff_audio_interleave_init(AVFormatContext *s, const int *samples_per_frame, AVRational time_base); -void ff_audio_interleave_close(AVFormatContext *s); - -/** - * Rechunk audio PCM packets per AudioInterleaveContext->samples_per_frame - * and interleave them correctly. - * The first element of AVStream->priv_data must be AudioInterleaveContext - * when using this function. - * - * @param get_packet function will output a packet when streams are correctly interleaved. - * @param compare_ts function will compare AVPackets and decide interleaving order. - */ -int ff_audio_rechunk_interleave(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush, - int (*get_packet)(AVFormatContext *, AVPacket *, AVPacket *, int), - int (*compare_ts)(AVFormatContext *, AVPacket *, AVPacket *)); - -#endif /* AVFORMAT_AUDIOINTERLEAVE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avi.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avi.h deleted file mode 100644 index 34da76f71..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avi.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AVI_H -#define AVFORMAT_AVI_H - -#define AVIF_HASINDEX 0x00000010 // Index at end of file? -#define AVIF_MUSTUSEINDEX 0x00000020 -#define AVIF_ISINTERLEAVED 0x00000100 -#define AVIF_TRUSTCKTYPE 0x00000800 // Use CKType to find key frames? -#define AVIF_WASCAPTUREFILE 0x00010000 -#define AVIF_COPYRIGHTED 0x00020000 - -#define AVI_MAX_RIFF_SIZE 0x40000000LL -#define AVI_MASTER_INDEX_SIZE 256 -#define AVI_MAX_STREAM_COUNT 100 - -/* index flags */ -#define AVIIF_INDEX 0x10 - -#endif /* AVFORMAT_AVI_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avidec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avidec.c deleted file mode 100644 index f79b0dfb6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avidec.c +++ /dev/null @@ -1,1750 +0,0 @@ -/* - * AVI demuxer - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/bswap.h" -#include "libavutil/opt.h" -#include "libavutil/dict.h" -#include "libavutil/internal.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/mathematics.h" -#include "avformat.h" -#include "avi.h" -#include "dv.h" -#include "internal.h" -#include "riff.h" - -typedef struct AVIStream { - int64_t frame_offset; /* current frame (video) or byte (audio) counter - * (used to compute the pts) */ - int remaining; - int packet_size; - - uint32_t scale; - uint32_t rate; - int sample_size; /* size of one sample (or packet) - * (in the rate/scale sense) in bytes */ - - int64_t cum_len; /* temporary storage (used during seek) */ - int prefix; /* normally 'd'<<8 + 'c' or 'w'<<8 + 'b' */ - int prefix_count; - uint32_t pal[256]; - int has_pal; - int dshow_block_align; /* block align variable used to emulate bugs in - * the MS dshow demuxer */ - - AVFormatContext *sub_ctx; - AVPacket sub_pkt; - uint8_t *sub_buffer; - - int64_t seek_pos; -} AVIStream; - -typedef struct { - const AVClass *class; - int64_t riff_end; - int64_t movi_end; - int64_t fsize; - int64_t io_fsize; - int64_t movi_list; - int64_t last_pkt_pos; - int index_loaded; - int is_odml; - int non_interleaved; - int stream_index; - DVDemuxContext *dv_demux; - int odml_depth; - int use_odml; -#define MAX_ODML_DEPTH 1000 - int64_t dts_max; -} AVIContext; - - -static const AVOption options[] = { - { "use_odml", "use odml index", offsetof(AVIContext, use_odml), AV_OPT_TYPE_INT, {.i64 = 1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM}, - { NULL }, -}; - -static const AVClass demuxer_class = { - .class_name = "avi", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, - .category = AV_CLASS_CATEGORY_DEMUXER, -}; - - -static const char avi_headers[][8] = { - { 'R', 'I', 'F', 'F', 'A', 'V', 'I', ' ' }, - { 'R', 'I', 'F', 'F', 'A', 'V', 'I', 'X' }, - { 'R', 'I', 'F', 'F', 'A', 'V', 'I', 0x19 }, - { 'O', 'N', '2', ' ', 'O', 'N', '2', 'f' }, - { 'R', 'I', 'F', 'F', 'A', 'M', 'V', ' ' }, - { 0 } -}; - -static const AVMetadataConv avi_metadata_conv[] = { - { "strn", "title" }, - { 0 }, -}; - -static int avi_load_index(AVFormatContext *s); -static int guess_ni_flag(AVFormatContext *s); - -#define print_tag(str, tag, size) \ - av_dlog(NULL, "pos:%"PRIX64" %s: tag=%c%c%c%c size=0x%x\n", \ - avio_tell(pb), str, tag & 0xff, \ - (tag >> 8) & 0xff, \ - (tag >> 16) & 0xff, \ - (tag >> 24) & 0xff, \ - size) - -static inline int get_duration(AVIStream *ast, int len) -{ - if (ast->sample_size) - return len; - else if (ast->dshow_block_align) - return (len + ast->dshow_block_align - 1) / ast->dshow_block_align; - else - return 1; -} - -static int get_riff(AVFormatContext *s, AVIOContext *pb) -{ - AVIContext *avi = s->priv_data; - char header[8]; - int i; - - /* check RIFF header */ - avio_read(pb, header, 4); - avi->riff_end = avio_rl32(pb); /* RIFF chunk size */ - avi->riff_end += avio_tell(pb); /* RIFF chunk end */ - avio_read(pb, header + 4, 4); - - for (i = 0; avi_headers[i][0]; i++) - if (!memcmp(header, avi_headers[i], 8)) - break; - if (!avi_headers[i][0]) - return AVERROR_INVALIDDATA; - - if (header[7] == 0x19) - av_log(s, AV_LOG_INFO, - "This file has been generated by a totally broken muxer.\n"); - - return 0; -} - -static int read_braindead_odml_indx(AVFormatContext *s, int frame_num) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - int longs_pre_entry = avio_rl16(pb); - int index_sub_type = avio_r8(pb); - int index_type = avio_r8(pb); - int entries_in_use = avio_rl32(pb); - int chunk_id = avio_rl32(pb); - int64_t base = avio_rl64(pb); - int stream_id = ((chunk_id & 0xFF) - '0') * 10 + - ((chunk_id >> 8 & 0xFF) - '0'); - AVStream *st; - AVIStream *ast; - int i; - int64_t last_pos = -1; - int64_t filesize = avi->fsize; - - av_dlog(s, - "longs_pre_entry:%d index_type:%d entries_in_use:%d " - "chunk_id:%X base:%16"PRIX64"\n", - longs_pre_entry, - index_type, - entries_in_use, - chunk_id, - base); - - if (stream_id >= s->nb_streams || stream_id < 0) - return AVERROR_INVALIDDATA; - st = s->streams[stream_id]; - ast = st->priv_data; - - if (index_sub_type) - return AVERROR_INVALIDDATA; - - avio_rl32(pb); - - if (index_type && longs_pre_entry != 2) - return AVERROR_INVALIDDATA; - if (index_type > 1) - return AVERROR_INVALIDDATA; - - if (filesize > 0 && base >= filesize) { - av_log(s, AV_LOG_ERROR, "ODML index invalid\n"); - if (base >> 32 == (base & 0xFFFFFFFF) && - (base & 0xFFFFFFFF) < filesize && - filesize <= 0xFFFFFFFF) - base &= 0xFFFFFFFF; - else - return AVERROR_INVALIDDATA; - } - - for (i = 0; i < entries_in_use; i++) { - if (index_type) { - int64_t pos = avio_rl32(pb) + base - 8; - int len = avio_rl32(pb); - int key = len >= 0; - len &= 0x7FFFFFFF; - -#ifdef DEBUG_SEEK - av_log(s, AV_LOG_ERROR, "pos:%"PRId64", len:%X\n", pos, len); -#endif - if (url_feof(pb)) - return AVERROR_INVALIDDATA; - - if (last_pos == pos || pos == base - 8) - avi->non_interleaved = 1; - if (last_pos != pos && (len || !ast->sample_size)) - av_add_index_entry(st, pos, ast->cum_len, len, 0, - key ? AVINDEX_KEYFRAME : 0); - - ast->cum_len += get_duration(ast, len); - last_pos = pos; - } else { - int64_t offset, pos; - int duration; - offset = avio_rl64(pb); - avio_rl32(pb); /* size */ - duration = avio_rl32(pb); - - if (url_feof(pb)) - return AVERROR_INVALIDDATA; - - pos = avio_tell(pb); - - if (avi->odml_depth > MAX_ODML_DEPTH) { - av_log(s, AV_LOG_ERROR, "Too deeply nested ODML indexes\n"); - return AVERROR_INVALIDDATA; - } - - if (avio_seek(pb, offset + 8, SEEK_SET) < 0) - return -1; - avi->odml_depth++; - read_braindead_odml_indx(s, frame_num); - avi->odml_depth--; - frame_num += duration; - - if (avio_seek(pb, pos, SEEK_SET) < 0) { - av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index\n"); - return -1; - } - - } - } - avi->index_loaded = 2; - return 0; -} - -static void clean_index(AVFormatContext *s) -{ - int i; - int64_t j; - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - AVIStream *ast = st->priv_data; - int n = st->nb_index_entries; - int max = ast->sample_size; - int64_t pos, size, ts; - - if (n != 1 || ast->sample_size == 0) - continue; - - while (max < 1024) - max += max; - - pos = st->index_entries[0].pos; - size = st->index_entries[0].size; - ts = st->index_entries[0].timestamp; - - for (j = 0; j < size; j += max) - av_add_index_entry(st, pos + j, ts + j, FFMIN(max, size - j), 0, - AVINDEX_KEYFRAME); - } -} - -static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, - uint32_t size) -{ - AVIOContext *pb = s->pb; - char key[5] = { 0 }; - char *value; - - size += (size & 1); - - if (size == UINT_MAX) - return AVERROR(EINVAL); - value = av_malloc(size + 1); - if (!value) - return AVERROR(ENOMEM); - avio_read(pb, value, size); - value[size] = 0; - - AV_WL32(key, tag); - - return av_dict_set(st ? &st->metadata : &s->metadata, key, value, - AV_DICT_DONT_STRDUP_VAL); -} - -static const char months[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; - -static void avi_metadata_creation_time(AVDictionary **metadata, char *date) -{ - char month[4], time[9], buffer[64]; - int i, day, year; - /* parse standard AVI date format (ie. "Mon Mar 10 15:04:43 2003") */ - if (sscanf(date, "%*3s%*[ ]%3s%*[ ]%2d%*[ ]%8s%*[ ]%4d", - month, &day, time, &year) == 4) { - for (i = 0; i < 12; i++) - if (!av_strcasecmp(month, months[i])) { - snprintf(buffer, sizeof(buffer), "%.4d-%.2d-%.2d %s", - year, i + 1, day, time); - av_dict_set(metadata, "creation_time", buffer, 0); - } - } else if (date[4] == '/' && date[7] == '/') { - date[4] = date[7] = '-'; - av_dict_set(metadata, "creation_time", date, 0); - } -} - -static void avi_read_nikon(AVFormatContext *s, uint64_t end) -{ - while (avio_tell(s->pb) < end) { - uint32_t tag = avio_rl32(s->pb); - uint32_t size = avio_rl32(s->pb); - switch (tag) { - case MKTAG('n', 'c', 't', 'g'): /* Nikon Tags */ - { - uint64_t tag_end = avio_tell(s->pb) + size; - while (avio_tell(s->pb) < tag_end) { - uint16_t tag = avio_rl16(s->pb); - uint16_t size = avio_rl16(s->pb); - const char *name = NULL; - char buffer[64] = { 0 }; - size = FFMIN(size, tag_end - avio_tell(s->pb)); - size -= avio_read(s->pb, buffer, - FFMIN(size, sizeof(buffer) - 1)); - switch (tag) { - case 0x03: - name = "maker"; - break; - case 0x04: - name = "model"; - break; - case 0x13: - name = "creation_time"; - if (buffer[4] == ':' && buffer[7] == ':') - buffer[4] = buffer[7] = '-'; - break; - } - if (name) - av_dict_set(&s->metadata, name, buffer, 0); - avio_skip(s->pb, size); - } - break; - } - default: - avio_skip(s->pb, size); - break; - } - } -} - -static int avi_read_header(AVFormatContext *s) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - unsigned int tag, tag1, handler; - int codec_type, stream_index, frame_period; - unsigned int size; - int i; - AVStream *st; - AVIStream *ast = NULL; - int avih_width = 0, avih_height = 0; - int amv_file_format = 0; - uint64_t list_end = 0; - int ret; - AVDictionaryEntry *dict_entry; - - avi->stream_index = -1; - - ret = get_riff(s, pb); - if (ret < 0) - return ret; - - av_log(avi, AV_LOG_DEBUG, "use odml:%d\n", avi->use_odml); - - avi->io_fsize = avi->fsize = avio_size(pb); - if (avi->fsize <= 0 || avi->fsize < avi->riff_end) - avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end; - - /* first list tag */ - stream_index = -1; - codec_type = -1; - frame_period = 0; - for (;;) { - if (url_feof(pb)) - goto fail; - tag = avio_rl32(pb); - size = avio_rl32(pb); - - print_tag("tag", tag, size); - - switch (tag) { - case MKTAG('L', 'I', 'S', 'T'): - list_end = avio_tell(pb) + size; - /* Ignored, except at start of video packets. */ - tag1 = avio_rl32(pb); - - print_tag("list", tag1, 0); - - if (tag1 == MKTAG('m', 'o', 'v', 'i')) { - avi->movi_list = avio_tell(pb) - 4; - if (size) - avi->movi_end = avi->movi_list + size + (size & 1); - else - avi->movi_end = avi->fsize; - av_dlog(NULL, "movi end=%"PRIx64"\n", avi->movi_end); - goto end_of_header; - } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) - ff_read_riff_info(s, size - 4); - else if (tag1 == MKTAG('n', 'c', 'd', 't')) - avi_read_nikon(s, list_end); - - break; - case MKTAG('I', 'D', 'I', 'T'): - { - unsigned char date[64] = { 0 }; - size += (size & 1); - size -= avio_read(pb, date, FFMIN(size, sizeof(date) - 1)); - avio_skip(pb, size); - avi_metadata_creation_time(&s->metadata, date); - break; - } - case MKTAG('d', 'm', 'l', 'h'): - avi->is_odml = 1; - avio_skip(pb, size + (size & 1)); - break; - case MKTAG('a', 'm', 'v', 'h'): - amv_file_format = 1; - case MKTAG('a', 'v', 'i', 'h'): - /* AVI header */ - /* using frame_period is bad idea */ - frame_period = avio_rl32(pb); - avio_rl32(pb); /* max. bytes per second */ - avio_rl32(pb); - avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; - - avio_skip(pb, 2 * 4); - avio_rl32(pb); - avio_rl32(pb); - avih_width = avio_rl32(pb); - avih_height = avio_rl32(pb); - - avio_skip(pb, size - 10 * 4); - break; - case MKTAG('s', 't', 'r', 'h'): - /* stream header */ - - tag1 = avio_rl32(pb); - handler = avio_rl32(pb); /* codec tag */ - - if (tag1 == MKTAG('p', 'a', 'd', 's')) { - avio_skip(pb, size - 8); - break; - } else { - stream_index++; - st = avformat_new_stream(s, NULL); - if (!st) - goto fail; - - st->id = stream_index; - ast = av_mallocz(sizeof(AVIStream)); - if (!ast) - goto fail; - st->priv_data = ast; - } - if (amv_file_format) - tag1 = stream_index ? MKTAG('a', 'u', 'd', 's') - : MKTAG('v', 'i', 'd', 's'); - - print_tag("strh", tag1, -1); - - if (tag1 == MKTAG('i', 'a', 'v', 's') || - tag1 == MKTAG('i', 'v', 'a', 's')) { - int64_t dv_dur; - - /* After some consideration -- I don't think we - * have to support anything but DV in type1 AVIs. */ - if (s->nb_streams != 1) - goto fail; - - if (handler != MKTAG('d', 'v', 's', 'd') && - handler != MKTAG('d', 'v', 'h', 'd') && - handler != MKTAG('d', 'v', 's', 'l')) - goto fail; - - ast = s->streams[0]->priv_data; - av_freep(&s->streams[0]->codec->extradata); - av_freep(&s->streams[0]->codec); - if (s->streams[0]->info) - av_freep(&s->streams[0]->info->duration_error); - av_freep(&s->streams[0]->info); - av_freep(&s->streams[0]); - s->nb_streams = 0; - if (CONFIG_DV_DEMUXER) { - avi->dv_demux = avpriv_dv_init_demux(s); - if (!avi->dv_demux) - goto fail; - } else - goto fail; - s->streams[0]->priv_data = ast; - avio_skip(pb, 3 * 4); - ast->scale = avio_rl32(pb); - ast->rate = avio_rl32(pb); - avio_skip(pb, 4); /* start time */ - - dv_dur = avio_rl32(pb); - if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { - dv_dur *= AV_TIME_BASE; - s->duration = av_rescale(dv_dur, ast->scale, ast->rate); - } - /* else, leave duration alone; timing estimation in utils.c - * will make a guess based on bitrate. */ - - stream_index = s->nb_streams - 1; - avio_skip(pb, size - 9 * 4); - break; - } - - av_assert0(stream_index < s->nb_streams); - st->codec->stream_codec_tag = handler; - - avio_rl32(pb); /* flags */ - avio_rl16(pb); /* priority */ - avio_rl16(pb); /* language */ - avio_rl32(pb); /* initial frame */ - ast->scale = avio_rl32(pb); - ast->rate = avio_rl32(pb); - if (!(ast->scale && ast->rate)) { - av_log(s, AV_LOG_WARNING, - "scale/rate is %u/%u which is invalid. " - "(This file has been generated by broken software.)\n", - ast->scale, - ast->rate); - if (frame_period) { - ast->rate = 1000000; - ast->scale = frame_period; - } else { - ast->rate = 25; - ast->scale = 1; - } - } - avpriv_set_pts_info(st, 64, ast->scale, ast->rate); - - ast->cum_len = avio_rl32(pb); /* start */ - st->nb_frames = avio_rl32(pb); - - st->start_time = 0; - avio_rl32(pb); /* buffer size */ - avio_rl32(pb); /* quality */ - if (ast->cum_len*ast->scale/ast->rate > 3600) { - av_log(s, AV_LOG_ERROR, "crazy start time, iam scared, giving up\n"); - return AVERROR_INVALIDDATA; - } - ast->sample_size = avio_rl32(pb); /* sample ssize */ - ast->cum_len *= FFMAX(1, ast->sample_size); - av_dlog(s, "%"PRIu32" %"PRIu32" %d\n", - ast->rate, ast->scale, ast->sample_size); - - switch (tag1) { - case MKTAG('v', 'i', 'd', 's'): - codec_type = AVMEDIA_TYPE_VIDEO; - - ast->sample_size = 0; - break; - case MKTAG('a', 'u', 'd', 's'): - codec_type = AVMEDIA_TYPE_AUDIO; - break; - case MKTAG('t', 'x', 't', 's'): - codec_type = AVMEDIA_TYPE_SUBTITLE; - break; - case MKTAG('d', 'a', 't', 's'): - codec_type = AVMEDIA_TYPE_DATA; - break; - default: - av_log(s, AV_LOG_INFO, "unknown stream type %X\n", tag1); - } - if (ast->sample_size == 0) { - st->duration = st->nb_frames; - if (st->duration > 0 && avi->io_fsize > 0 && avi->riff_end > avi->io_fsize) { - av_log(s, AV_LOG_DEBUG, "File is truncated adjusting duration\n"); - st->duration = av_rescale(st->duration, avi->io_fsize, avi->riff_end); - } - } - ast->frame_offset = ast->cum_len; - avio_skip(pb, size - 12 * 4); - break; - case MKTAG('s', 't', 'r', 'f'): - /* stream header */ - if (!size) - break; - if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { - avio_skip(pb, size); - } else { - uint64_t cur_pos = avio_tell(pb); - unsigned esize; - if (cur_pos < list_end) - size = FFMIN(size, list_end - cur_pos); - st = s->streams[stream_index]; - if (st->codec->codec_type != AVMEDIA_TYPE_UNKNOWN) { - avio_skip(pb, size); - break; - } - switch (codec_type) { - case AVMEDIA_TYPE_VIDEO: - if (amv_file_format) { - st->codec->width = avih_width; - st->codec->height = avih_height; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = AV_CODEC_ID_AMV; - avio_skip(pb, size); - break; - } - tag1 = ff_get_bmp_header(pb, st, &esize); - - if (tag1 == MKTAG('D', 'X', 'S', 'B') || - tag1 == MKTAG('D', 'X', 'S', 'A')) { - st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - st->codec->codec_tag = tag1; - st->codec->codec_id = AV_CODEC_ID_XSUB; - break; - } - - if (size > 10 * 4 && size < (1 << 30) && size < avi->fsize) { - if (esize == size-1 && (esize&1)) { - st->codec->extradata_size = esize - 10 * 4; - } else - st->codec->extradata_size = size - 10 * 4; - if (ff_get_extradata(st->codec, pb, st->codec->extradata_size) < 0) - return AVERROR(ENOMEM); - } - - // FIXME: check if the encoder really did this correctly - if (st->codec->extradata_size & 1) - avio_r8(pb); - - /* Extract palette from extradata if bpp <= 8. - * This code assumes that extradata contains only palette. - * This is true for all paletted codecs implemented in - * FFmpeg. */ - if (st->codec->extradata_size && - (st->codec->bits_per_coded_sample <= 8)) { - int pal_size = (1 << st->codec->bits_per_coded_sample) << 2; - const uint8_t *pal_src; - - pal_size = FFMIN(pal_size, st->codec->extradata_size); - pal_src = st->codec->extradata + - st->codec->extradata_size - pal_size; - for (i = 0; i < pal_size / 4; i++) - ast->pal[i] = 0xFFU<<24 | AV_RL32(pal_src+4*i); - ast->has_pal = 1; - } - - print_tag("video", tag1, 0); - - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_tag = tag1; - st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, - tag1); - /* This is needed to get the pict type which is necessary - * for generating correct pts. */ - st->need_parsing = AVSTREAM_PARSE_HEADERS; - if (st->codec->codec_tag == MKTAG('V', 'S', 'S', 'H')) - st->need_parsing = AVSTREAM_PARSE_FULL; - - if (st->codec->codec_tag == 0 && st->codec->height > 0 && - st->codec->extradata_size < 1U << 30) { - st->codec->extradata_size += 9; - if ((ret = av_reallocp(&st->codec->extradata, - st->codec->extradata_size + - FF_INPUT_BUFFER_PADDING_SIZE)) < 0) { - st->codec->extradata_size = 0; - return ret; - } else - memcpy(st->codec->extradata + st->codec->extradata_size - 9, - "BottomUp", 9); - } - st->codec->height = FFABS(st->codec->height); - -// avio_skip(pb, size - 5 * 4); - break; - case AVMEDIA_TYPE_AUDIO: - ret = ff_get_wav_header(pb, st->codec, size); - if (ret < 0) - return ret; - ast->dshow_block_align = st->codec->block_align; - if (ast->sample_size && st->codec->block_align && - ast->sample_size != st->codec->block_align) { - av_log(s, - AV_LOG_WARNING, - "sample size (%d) != block align (%d)\n", - ast->sample_size, - st->codec->block_align); - ast->sample_size = st->codec->block_align; - } - /* 2-aligned - * (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ - if (size & 1) - avio_skip(pb, 1); - /* Force parsing as several audio frames can be in - * one packet and timestamps refer to packet start. */ - st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; - /* ADTS header is in extradata, AAC without header must be - * stored as exact frames. Parser not needed and it will - * fail. */ - if (st->codec->codec_id == AV_CODEC_ID_AAC && - st->codec->extradata_size) - st->need_parsing = AVSTREAM_PARSE_NONE; - /* AVI files with Xan DPCM audio (wrongly) declare PCM - * audio in the header but have Axan as stream_code_tag. */ - if (st->codec->stream_codec_tag == AV_RL32("Axan")) { - st->codec->codec_id = AV_CODEC_ID_XAN_DPCM; - st->codec->codec_tag = 0; - ast->dshow_block_align = 0; - } - if (amv_file_format) { - st->codec->codec_id = AV_CODEC_ID_ADPCM_IMA_AMV; - ast->dshow_block_align = 0; - } - if (st->codec->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align <= 4 && ast->dshow_block_align) { - av_log(s, AV_LOG_DEBUG, "overriding invalid dshow_block_align of %d\n", ast->dshow_block_align); - ast->dshow_block_align = 0; - } - if (st->codec->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 1024 && ast->sample_size == 1024 || - st->codec->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 4096 && ast->sample_size == 4096 || - st->codec->codec_id == AV_CODEC_ID_MP3 && ast->dshow_block_align == 1152 && ast->sample_size == 1152) { - av_log(s, AV_LOG_DEBUG, "overriding sample_size\n"); - ast->sample_size = 0; - } - break; - case AVMEDIA_TYPE_SUBTITLE: - st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - st->request_probe= 1; - avio_skip(pb, size); - break; - default: - st->codec->codec_type = AVMEDIA_TYPE_DATA; - st->codec->codec_id = AV_CODEC_ID_NONE; - st->codec->codec_tag = 0; - avio_skip(pb, size); - break; - } - } - break; - case MKTAG('s', 't', 'r', 'd'): - if (stream_index >= (unsigned)s->nb_streams - || s->streams[stream_index]->codec->extradata_size - || s->streams[stream_index]->codec->codec_tag == MKTAG('H','2','6','4')) { - avio_skip(pb, size); - } else { - uint64_t cur_pos = avio_tell(pb); - if (cur_pos < list_end) - size = FFMIN(size, list_end - cur_pos); - st = s->streams[stream_index]; - - if (size<(1<<30)) { - if (ff_get_extradata(st->codec, pb, size) < 0) - return AVERROR(ENOMEM); - } - - if (st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly - avio_r8(pb); - } - break; - case MKTAG('i', 'n', 'd', 'x'): - i = avio_tell(pb); - if (pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) && - avi->use_odml && - read_braindead_odml_indx(s, 0) < 0 && - (s->error_recognition & AV_EF_EXPLODE)) - goto fail; - avio_seek(pb, i + size, SEEK_SET); - break; - case MKTAG('v', 'p', 'r', 'p'): - if (stream_index < (unsigned)s->nb_streams && size > 9 * 4) { - AVRational active, active_aspect; - - st = s->streams[stream_index]; - avio_rl32(pb); - avio_rl32(pb); - avio_rl32(pb); - avio_rl32(pb); - avio_rl32(pb); - - active_aspect.den = avio_rl16(pb); - active_aspect.num = avio_rl16(pb); - active.num = avio_rl32(pb); - active.den = avio_rl32(pb); - avio_rl32(pb); // nbFieldsPerFrame - - if (active_aspect.num && active_aspect.den && - active.num && active.den) { - st->sample_aspect_ratio = av_div_q(active_aspect, active); - av_dlog(s, "vprp %d/%d %d/%d\n", - active_aspect.num, active_aspect.den, - active.num, active.den); - } - size -= 9 * 4; - } - avio_skip(pb, size); - break; - case MKTAG('s', 't', 'r', 'n'): - if (s->nb_streams) { - ret = avi_read_tag(s, s->streams[s->nb_streams - 1], tag, size); - if (ret < 0) - return ret; - break; - } - default: - if (size > 1000000) { - av_log(s, AV_LOG_ERROR, - "Something went wrong during header parsing, " - "I will ignore it and try to continue anyway.\n"); - if (s->error_recognition & AV_EF_EXPLODE) - goto fail; - avi->movi_list = avio_tell(pb) - 4; - avi->movi_end = avi->fsize; - goto end_of_header; - } - /* skip tag */ - size += (size & 1); - avio_skip(pb, size); - break; - } - } - -end_of_header: - /* check stream number */ - if (stream_index != s->nb_streams - 1) { - -fail: - return AVERROR_INVALIDDATA; - } - - if (!avi->index_loaded && pb->seekable) - avi_load_index(s); - avi->index_loaded |= 1; - avi->non_interleaved |= guess_ni_flag(s) | (s->flags & AVFMT_FLAG_SORT_DTS); - - dict_entry = av_dict_get(s->metadata, "ISFT", NULL, 0); - if (dict_entry && !strcmp(dict_entry->value, "PotEncoder")) - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - if ( st->codec->codec_id == AV_CODEC_ID_MPEG1VIDEO - || st->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) - st->need_parsing = AVSTREAM_PARSE_FULL; - } - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - if (st->nb_index_entries) - break; - } - // DV-in-AVI cannot be non-interleaved, if set this must be - // a mis-detection. - if (avi->dv_demux) - avi->non_interleaved = 0; - if (i == s->nb_streams && avi->non_interleaved) { - av_log(s, AV_LOG_WARNING, - "Non-interleaved AVI without index, switching to interleaved\n"); - avi->non_interleaved = 0; - } - - if (avi->non_interleaved) { - av_log(s, AV_LOG_INFO, "non-interleaved AVI\n"); - clean_index(s); - } - - ff_metadata_conv_ctx(s, NULL, avi_metadata_conv); - ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); - - return 0; -} - -static int read_gab2_sub(AVStream *st, AVPacket *pkt) -{ - if (pkt->size >= 7 && - pkt->size < INT_MAX - AVPROBE_PADDING_SIZE && - !strcmp(pkt->data, "GAB2") && AV_RL16(pkt->data + 5) == 2) { - uint8_t desc[256]; - int score = AVPROBE_SCORE_EXTENSION, ret; - AVIStream *ast = st->priv_data; - AVInputFormat *sub_demuxer; - AVRational time_base; - int size; - AVIOContext *pb = avio_alloc_context(pkt->data + 7, - pkt->size - 7, - 0, NULL, NULL, NULL, NULL); - AVProbeData pd; - unsigned int desc_len = avio_rl32(pb); - - if (desc_len > pb->buf_end - pb->buf_ptr) - goto error; - - ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); - avio_skip(pb, desc_len - ret); - if (*desc) - av_dict_set(&st->metadata, "title", desc, 0); - - avio_rl16(pb); /* flags? */ - avio_rl32(pb); /* data size */ - - size = pb->buf_end - pb->buf_ptr; - pd = (AVProbeData) { .buf = av_mallocz(size + AVPROBE_PADDING_SIZE), - .buf_size = size }; - if (!pd.buf) - goto error; - memcpy(pd.buf, pb->buf_ptr, size); - sub_demuxer = av_probe_input_format2(&pd, 1, &score); - av_freep(&pd.buf); - if (!sub_demuxer) - goto error; - - if (!(ast->sub_ctx = avformat_alloc_context())) - goto error; - - ast->sub_ctx->pb = pb; - if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) { - ff_read_packet(ast->sub_ctx, &ast->sub_pkt); - *st->codec = *ast->sub_ctx->streams[0]->codec; - ast->sub_ctx->streams[0]->codec->extradata = NULL; - time_base = ast->sub_ctx->streams[0]->time_base; - avpriv_set_pts_info(st, 64, time_base.num, time_base.den); - } - ast->sub_buffer = pkt->data; - memset(pkt, 0, sizeof(*pkt)); - return 1; - -error: - av_freep(&pb); - } - return 0; -} - -static AVStream *get_subtitle_pkt(AVFormatContext *s, AVStream *next_st, - AVPacket *pkt) -{ - AVIStream *ast, *next_ast = next_st->priv_data; - int64_t ts, next_ts, ts_min = INT64_MAX; - AVStream *st, *sub_st = NULL; - int i; - - next_ts = av_rescale_q(next_ast->frame_offset, next_st->time_base, - AV_TIME_BASE_Q); - - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - ast = st->priv_data; - if (st->discard < AVDISCARD_ALL && ast && ast->sub_pkt.data) { - ts = av_rescale_q(ast->sub_pkt.dts, st->time_base, AV_TIME_BASE_Q); - if (ts <= next_ts && ts < ts_min) { - ts_min = ts; - sub_st = st; - } - } - } - - if (sub_st) { - ast = sub_st->priv_data; - *pkt = ast->sub_pkt; - pkt->stream_index = sub_st->index; - - if (ff_read_packet(ast->sub_ctx, &ast->sub_pkt) < 0) - ast->sub_pkt.data = NULL; - } - return sub_st; -} - -static int get_stream_idx(unsigned *d) -{ - if (d[0] >= '0' && d[0] <= '9' && - d[1] >= '0' && d[1] <= '9') { - return (d[0] - '0') * 10 + (d[1] - '0'); - } else { - return 100; // invalid stream ID - } -} - -/** - * - * @param exit_early set to 1 to just gather packet position without making the changes needed to actually read & return the packet - */ -static int avi_sync(AVFormatContext *s, int exit_early) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - int n; - unsigned int d[8]; - unsigned int size; - int64_t i, sync; - -start_sync: - memset(d, -1, sizeof(d)); - for (i = sync = avio_tell(pb); !url_feof(pb); i++) { - int j; - - for (j = 0; j < 7; j++) - d[j] = d[j + 1]; - d[7] = avio_r8(pb); - - size = d[4] + (d[5] << 8) + (d[6] << 16) + (d[7] << 24); - - n = get_stream_idx(d + 2); - av_dlog(s, "%X %X %X %X %X %X %X %X %"PRId64" %u %d\n", - d[0], d[1], d[2], d[3], d[4], d[5], d[6], d[7], i, size, n); - if (i*(avi->io_fsize>0) + (uint64_t)size > avi->fsize || d[0] > 127) - continue; - - // parse ix## - if ((d[0] == 'i' && d[1] == 'x' && n < s->nb_streams) || - // parse JUNK - (d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') || - (d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')) { - avio_skip(pb, size); - goto start_sync; - } - - // parse stray LIST - if (d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T') { - avio_skip(pb, 4); - goto start_sync; - } - - n = avi->dv_demux ? 0 : get_stream_idx(d); - - if (!((i - avi->last_pkt_pos) & 1) && - get_stream_idx(d + 1) < s->nb_streams) - continue; - - // detect ##ix chunk and skip - if (d[2] == 'i' && d[3] == 'x' && n < s->nb_streams) { - avio_skip(pb, size); - goto start_sync; - } - - // parse ##dc/##wb - if (n < s->nb_streams) { - AVStream *st; - AVIStream *ast; - st = s->streams[n]; - ast = st->priv_data; - - if (!ast) { - av_log(s, AV_LOG_WARNING, "Skiping foreign stream %d packet\n", n); - continue; - } - - if (s->nb_streams >= 2) { - AVStream *st1 = s->streams[1]; - AVIStream *ast1 = st1->priv_data; - // workaround for broken small-file-bug402.avi - if ( d[2] == 'w' && d[3] == 'b' - && n == 0 - && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO - && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO - && ast->prefix == 'd'*256+'c' - && (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count) - ) { - n = 1; - st = st1; - ast = ast1; - av_log(s, AV_LOG_WARNING, - "Invalid stream + prefix combination, assuming audio.\n"); - } - } - - if (!avi->dv_demux && - ((st->discard >= AVDISCARD_DEFAULT && size == 0) /* || - // FIXME: needs a little reordering - (st->discard >= AVDISCARD_NONKEY && - !(pkt->flags & AV_PKT_FLAG_KEY)) */ - || st->discard >= AVDISCARD_ALL)) { - if (!exit_early) { - ast->frame_offset += get_duration(ast, size); - avio_skip(pb, size); - goto start_sync; - } - } - - if (d[2] == 'p' && d[3] == 'c' && size <= 4 * 256 + 4) { - int k = avio_r8(pb); - int last = (k + avio_r8(pb) - 1) & 0xFF; - - avio_rl16(pb); // flags - - // b + (g << 8) + (r << 16); - for (; k <= last; k++) - ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8; - - ast->has_pal = 1; - goto start_sync; - } else if (((ast->prefix_count < 5 || sync + 9 > i) && - d[2] < 128 && d[3] < 128) || - d[2] * 256 + d[3] == ast->prefix /* || - (d[2] == 'd' && d[3] == 'c') || - (d[2] == 'w' && d[3] == 'b') */) { - if (exit_early) - return 0; - if (d[2] * 256 + d[3] == ast->prefix) - ast->prefix_count++; - else { - ast->prefix = d[2] * 256 + d[3]; - ast->prefix_count = 0; - } - - avi->stream_index = n; - ast->packet_size = size + 8; - ast->remaining = size; - - if (size || !ast->sample_size) { - uint64_t pos = avio_tell(pb) - 8; - if (!st->index_entries || !st->nb_index_entries || - st->index_entries[st->nb_index_entries - 1].pos < pos) { - av_add_index_entry(st, pos, ast->frame_offset, size, - 0, AVINDEX_KEYFRAME); - } - } - return 0; - } - } - } - - if (pb->error) - return pb->error; - return AVERROR_EOF; -} - -static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - int err; -#if FF_API_DESTRUCT_PACKET - void *dstr; -#endif - - if (CONFIG_DV_DEMUXER && avi->dv_demux) { - int size = avpriv_dv_get_packet(avi->dv_demux, pkt); - if (size >= 0) - return size; - else - goto resync; - } - - if (avi->non_interleaved) { - int best_stream_index = 0; - AVStream *best_st = NULL; - AVIStream *best_ast; - int64_t best_ts = INT64_MAX; - int i; - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - AVIStream *ast = st->priv_data; - int64_t ts = ast->frame_offset; - int64_t last_ts; - - if (!st->nb_index_entries) - continue; - - last_ts = st->index_entries[st->nb_index_entries - 1].timestamp; - if (!ast->remaining && ts > last_ts) - continue; - - ts = av_rescale_q(ts, st->time_base, - (AVRational) { FFMAX(1, ast->sample_size), - AV_TIME_BASE }); - - av_dlog(s, "%"PRId64" %d/%d %"PRId64"\n", ts, - st->time_base.num, st->time_base.den, ast->frame_offset); - if (ts < best_ts) { - best_ts = ts; - best_st = st; - best_stream_index = i; - } - } - if (!best_st) - return AVERROR_EOF; - - best_ast = best_st->priv_data; - best_ts = best_ast->frame_offset; - if (best_ast->remaining) { - i = av_index_search_timestamp(best_st, - best_ts, - AVSEEK_FLAG_ANY | - AVSEEK_FLAG_BACKWARD); - } else { - i = av_index_search_timestamp(best_st, best_ts, AVSEEK_FLAG_ANY); - if (i >= 0) - best_ast->frame_offset = best_st->index_entries[i].timestamp; - } - - if (i >= 0) { - int64_t pos = best_st->index_entries[i].pos; - pos += best_ast->packet_size - best_ast->remaining; - if (avio_seek(s->pb, pos + 8, SEEK_SET) < 0) - return AVERROR_EOF; - - av_assert0(best_ast->remaining <= best_ast->packet_size); - - avi->stream_index = best_stream_index; - if (!best_ast->remaining) - best_ast->packet_size = - best_ast->remaining = best_st->index_entries[i].size; - } - else - return AVERROR_EOF; - } - -resync: - if (avi->stream_index >= 0) { - AVStream *st = s->streams[avi->stream_index]; - AVIStream *ast = st->priv_data; - int size, err; - - if (get_subtitle_pkt(s, st, pkt)) - return 0; - - // minorityreport.AVI block_align=1024 sample_size=1 IMA-ADPCM - if (ast->sample_size <= 1) - size = INT_MAX; - else if (ast->sample_size < 32) - // arbitrary multiplier to avoid tiny packets for raw PCM data - size = 1024 * ast->sample_size; - else - size = ast->sample_size; - - if (size > ast->remaining) - size = ast->remaining; - avi->last_pkt_pos = avio_tell(pb); - err = av_get_packet(pb, pkt, size); - if (err < 0) - return err; - size = err; - - if (ast->has_pal && pkt->size < (unsigned)INT_MAX / 2) { - uint8_t *pal; - pal = av_packet_new_side_data(pkt, - AV_PKT_DATA_PALETTE, - AVPALETTE_SIZE); - if (!pal) { - av_log(s, AV_LOG_ERROR, - "Failed to allocate data for palette\n"); - } else { - memcpy(pal, ast->pal, AVPALETTE_SIZE); - ast->has_pal = 0; - } - } - - if (CONFIG_DV_DEMUXER && avi->dv_demux) { - AVBufferRef *avbuf = pkt->buf; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - dstr = pkt->destruct; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - size = avpriv_dv_produce_packet(avi->dv_demux, pkt, - pkt->data, pkt->size, pkt->pos); -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = dstr; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - pkt->buf = avbuf; - pkt->flags |= AV_PKT_FLAG_KEY; - if (size < 0) - av_free_packet(pkt); - } else if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE && - !st->codec->codec_tag && read_gab2_sub(st, pkt)) { - ast->frame_offset++; - avi->stream_index = -1; - ast->remaining = 0; - goto resync; - } else { - /* XXX: How to handle B-frames in AVI? */ - pkt->dts = ast->frame_offset; -// pkt->dts += ast->start; - if (ast->sample_size) - pkt->dts /= ast->sample_size; - av_dlog(s, - "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d " - "base:%d st:%d size:%d\n", - pkt->dts, - ast->frame_offset, - ast->scale, - ast->rate, - ast->sample_size, - AV_TIME_BASE, - avi->stream_index, - size); - pkt->stream_index = avi->stream_index; - - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->index_entries) { - AVIndexEntry *e; - int index; - - index = av_index_search_timestamp(st, ast->frame_offset, 0); - e = &st->index_entries[index]; - - if (index >= 0 && e->timestamp == ast->frame_offset) { - if (index == st->nb_index_entries-1) { - int key=1; - int i; - uint32_t state=-1; - for (i=0; icodec->codec_id == AV_CODEC_ID_MPEG4) { - if (state == 0x1B6) { - key= !(pkt->data[i]&0xC0); - break; - } - }else - break; - state= (state<<8) + pkt->data[i]; - } - if (!key) - e->flags &= ~AVINDEX_KEYFRAME; - } - if (e->flags & AVINDEX_KEYFRAME) - pkt->flags |= AV_PKT_FLAG_KEY; - } - } else { - pkt->flags |= AV_PKT_FLAG_KEY; - } - ast->frame_offset += get_duration(ast, pkt->size); - } - ast->remaining -= err; - if (!ast->remaining) { - avi->stream_index = -1; - ast->packet_size = 0; - } - - if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) { - av_free_packet(pkt); - goto resync; - } - ast->seek_pos= 0; - - if (!avi->non_interleaved && st->nb_index_entries>1 && avi->index_loaded>1) { - int64_t dts= av_rescale_q(pkt->dts, st->time_base, AV_TIME_BASE_Q); - - if (avi->dts_max - dts > 2*AV_TIME_BASE) { - avi->non_interleaved= 1; - av_log(s, AV_LOG_INFO, "Switching to NI mode, due to poor interleaving\n"); - }else if (avi->dts_max < dts) - avi->dts_max = dts; - } - - return 0; - } - - if ((err = avi_sync(s, 0)) < 0) - return err; - goto resync; -} - -/* XXX: We make the implicit supposition that the positions are sorted - * for each stream. */ -static int avi_read_idx1(AVFormatContext *s, int size) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - int nb_index_entries, i; - AVStream *st; - AVIStream *ast; - unsigned int index, tag, flags, pos, len, first_packet = 1; - unsigned last_pos = -1; - unsigned last_idx = -1; - int64_t idx1_pos, first_packet_pos = 0, data_offset = 0; - int anykey = 0; - - nb_index_entries = size / 16; - if (nb_index_entries <= 0) - return AVERROR_INVALIDDATA; - - idx1_pos = avio_tell(pb); - avio_seek(pb, avi->movi_list + 4, SEEK_SET); - if (avi_sync(s, 1) == 0) - first_packet_pos = avio_tell(pb) - 8; - avi->stream_index = -1; - avio_seek(pb, idx1_pos, SEEK_SET); - - if (s->nb_streams == 1 && s->streams[0]->codec->codec_tag == AV_RL32("MMES")) { - first_packet_pos = 0; - data_offset = avi->movi_list; - } - - /* Read the entries and sort them in each stream component. */ - for (i = 0; i < nb_index_entries; i++) { - if (url_feof(pb)) - return -1; - - tag = avio_rl32(pb); - flags = avio_rl32(pb); - pos = avio_rl32(pb); - len = avio_rl32(pb); - av_dlog(s, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", - i, tag, flags, pos, len); - - index = ((tag & 0xff) - '0') * 10; - index += (tag >> 8 & 0xff) - '0'; - if (index >= s->nb_streams) - continue; - st = s->streams[index]; - ast = st->priv_data; - - if (first_packet && first_packet_pos) { - data_offset = first_packet_pos - pos; - first_packet = 0; - } - pos += data_offset; - - av_dlog(s, "%d cum_len=%"PRId64"\n", len, ast->cum_len); - - // even if we have only a single stream, we should - // switch to non-interleaved to get correct timestamps - if (last_pos == pos) - avi->non_interleaved = 1; - if (last_idx != pos && len) { - av_add_index_entry(st, pos, ast->cum_len, len, 0, - (flags & AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); - last_idx= pos; - } - ast->cum_len += get_duration(ast, len); - last_pos = pos; - anykey |= flags&AVIIF_INDEX; - } - if (!anykey) { - for (index = 0; index < s->nb_streams; index++) { - st = s->streams[index]; - if (st->nb_index_entries) - st->index_entries[0].flags |= AVINDEX_KEYFRAME; - } - } - return 0; -} - -static int guess_ni_flag(AVFormatContext *s) -{ - int i; - int64_t last_start = 0; - int64_t first_end = INT64_MAX; - int64_t oldpos = avio_tell(s->pb); - int *idx; - int64_t min_pos, pos; - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - int n = st->nb_index_entries; - unsigned int size; - - if (n <= 0) - continue; - - if (n >= 2) { - int64_t pos = st->index_entries[0].pos; - avio_seek(s->pb, pos + 4, SEEK_SET); - size = avio_rl32(s->pb); - if (pos + size > st->index_entries[1].pos) - last_start = INT64_MAX; - } - - if (st->index_entries[0].pos > last_start) - last_start = st->index_entries[0].pos; - if (st->index_entries[n - 1].pos < first_end) - first_end = st->index_entries[n - 1].pos; - } - avio_seek(s->pb, oldpos, SEEK_SET); - if (last_start > first_end) - return 1; - idx= av_calloc(s->nb_streams, sizeof(*idx)); - if (!idx) - return 0; - for (min_pos=pos=0; min_pos!=INT64_MAX; pos= min_pos+1LU) { - int64_t max_dts = INT64_MIN/2, min_dts= INT64_MAX/2; - min_pos = INT64_MAX; - - for (i=0; inb_streams; i++) { - AVStream *st = s->streams[i]; - AVIStream *ast = st->priv_data; - int n= st->nb_index_entries; - while (idx[i]index_entries[idx[i]].pos < pos) - idx[i]++; - if (idx[i] < n) { - min_dts = FFMIN(min_dts, av_rescale_q(st->index_entries[idx[i]].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q)); - min_pos = FFMIN(min_pos, st->index_entries[idx[i]].pos); - } - if (idx[i]) - max_dts = FFMAX(max_dts, av_rescale_q(st->index_entries[idx[i]-1].timestamp/FFMAX(ast->sample_size, 1), st->time_base, AV_TIME_BASE_Q)); - } - if (max_dts - min_dts > 2*AV_TIME_BASE) { - av_free(idx); - return 1; - } - } - av_free(idx); - return 0; -} - -static int avi_load_index(AVFormatContext *s) -{ - AVIContext *avi = s->priv_data; - AVIOContext *pb = s->pb; - uint32_t tag, size; - int64_t pos = avio_tell(pb); - int64_t next; - int ret = -1; - - if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) - goto the_end; // maybe truncated file - av_dlog(s, "movi_end=0x%"PRIx64"\n", avi->movi_end); - for (;;) { - tag = avio_rl32(pb); - size = avio_rl32(pb); - if (url_feof(pb)) - break; - next = avio_tell(pb) + size + (size & 1); - - av_dlog(s, "tag=%c%c%c%c size=0x%x\n", - tag & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff, - size); - - if (tag == MKTAG('i', 'd', 'x', '1') && - avi_read_idx1(s, size) >= 0) { - avi->index_loaded=2; - ret = 0; - }else if (tag == MKTAG('L', 'I', 'S', 'T')) { - uint32_t tag1 = avio_rl32(pb); - - if (tag1 == MKTAG('I', 'N', 'F', 'O')) - ff_read_riff_info(s, size - 4); - }else if (!ret) - break; - - if (avio_seek(pb, next, SEEK_SET) < 0) - break; // something is wrong here - } - -the_end: - avio_seek(pb, pos, SEEK_SET); - return ret; -} - -static void seek_subtitle(AVStream *st, AVStream *st2, int64_t timestamp) -{ - AVIStream *ast2 = st2->priv_data; - int64_t ts2 = av_rescale_q(timestamp, st->time_base, st2->time_base); - av_free_packet(&ast2->sub_pkt); - if (avformat_seek_file(ast2->sub_ctx, 0, INT64_MIN, ts2, ts2, 0) >= 0 || - avformat_seek_file(ast2->sub_ctx, 0, ts2, ts2, INT64_MAX, 0) >= 0) - ff_read_packet(ast2->sub_ctx, &ast2->sub_pkt); -} - -static int avi_read_seek(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - AVIContext *avi = s->priv_data; - AVStream *st; - int i, index; - int64_t pos, pos_min; - AVIStream *ast; - - /* Does not matter which stream is requested dv in avi has the - * stream information in the first video stream. - */ - if (avi->dv_demux) - stream_index = 0; - - if (!avi->index_loaded) { - /* we only load the index on demand */ - avi_load_index(s); - avi->index_loaded |= 1; - } - av_assert0(stream_index >= 0); - - st = s->streams[stream_index]; - ast = st->priv_data; - index = av_index_search_timestamp(st, - timestamp * FFMAX(ast->sample_size, 1), - flags); - if (index < 0) { - if (st->nb_index_entries > 0) - av_log(s, AV_LOG_DEBUG, "Failed to find timestamp %"PRId64 " in index %"PRId64 " .. %"PRId64 "\n", - timestamp * FFMAX(ast->sample_size, 1), - st->index_entries[0].timestamp, - st->index_entries[st->nb_index_entries - 1].timestamp); - return AVERROR_INVALIDDATA; - } - - /* find the position */ - pos = st->index_entries[index].pos; - timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); - - av_dlog(s, "XX %"PRId64" %d %"PRId64"\n", - timestamp, index, st->index_entries[index].timestamp); - - if (CONFIG_DV_DEMUXER && avi->dv_demux) { - /* One and only one real stream for DV in AVI, and it has video */ - /* offsets. Calling with other stream indexes should have failed */ - /* the av_index_search_timestamp call above. */ - - if (avio_seek(s->pb, pos, SEEK_SET) < 0) - return -1; - - /* Feed the DV video stream version of the timestamp to the */ - /* DV demux so it can synthesize correct timestamps. */ - ff_dv_offset_reset(avi->dv_demux, timestamp); - - avi->stream_index = -1; - return 0; - } - - pos_min = pos; - for (i = 0; i < s->nb_streams; i++) { - AVStream *st2 = s->streams[i]; - AVIStream *ast2 = st2->priv_data; - - ast2->packet_size = - ast2->remaining = 0; - - if (ast2->sub_ctx) { - seek_subtitle(st, st2, timestamp); - continue; - } - - if (st2->nb_index_entries <= 0) - continue; - -// av_assert1(st2->codec->block_align); - av_assert0((int64_t)st2->time_base.num * ast2->rate == - (int64_t)st2->time_base.den * ast2->scale); - index = av_index_search_timestamp(st2, - av_rescale_q(timestamp, - st->time_base, - st2->time_base) * - FFMAX(ast2->sample_size, 1), - flags | - AVSEEK_FLAG_BACKWARD | - (st2->codec->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); - if (index < 0) - index = 0; - ast2->seek_pos = st2->index_entries[index].pos; - pos_min = FFMIN(pos_min,ast2->seek_pos); - } - for (i = 0; i < s->nb_streams; i++) { - AVStream *st2 = s->streams[i]; - AVIStream *ast2 = st2->priv_data; - - if (ast2->sub_ctx || st2->nb_index_entries <= 0) - continue; - - index = av_index_search_timestamp( - st2, - av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), - flags | AVSEEK_FLAG_BACKWARD | (st2->codec->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); - if (index < 0) - index = 0; - while (!avi->non_interleaved && index>0 && st2->index_entries[index-1].pos >= pos_min) - index--; - ast2->frame_offset = st2->index_entries[index].timestamp; - } - - /* do the seek */ - if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) { - av_log(s, AV_LOG_ERROR, "Seek failed\n"); - return -1; - } - avi->stream_index = -1; - avi->dts_max = INT_MIN; - return 0; -} - -static int avi_read_close(AVFormatContext *s) -{ - int i; - AVIContext *avi = s->priv_data; - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - AVIStream *ast = st->priv_data; - if (ast) { - if (ast->sub_ctx) { - av_freep(&ast->sub_ctx->pb); - avformat_close_input(&ast->sub_ctx); - } - av_free(ast->sub_buffer); - av_free_packet(&ast->sub_pkt); - } - } - - av_free(avi->dv_demux); - - return 0; -} - -static int avi_probe(AVProbeData *p) -{ - int i; - - /* check file header */ - for (i = 0; avi_headers[i][0]; i++) - if (!memcmp(p->buf, avi_headers[i], 4) && - !memcmp(p->buf + 8, avi_headers[i] + 4, 4)) - return AVPROBE_SCORE_MAX; - - return 0; -} - -AVInputFormat ff_avi_demuxer = { - .name = "avi", - .long_name = NULL_IF_CONFIG_SMALL("AVI (Audio Video Interleaved)"), - .priv_data_size = sizeof(AVIContext), - .read_probe = avi_probe, - .read_header = avi_read_header, - .read_packet = avi_read_packet, - .read_close = avi_read_close, - .read_seek = avi_read_seek, - .priv_class = &demuxer_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.c deleted file mode 100644 index 19825337b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.c +++ /dev/null @@ -1,467 +0,0 @@ -/* - * unbuffered I/O - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avstring.h" -#include "libavutil/dict.h" -#include "libavutil/opt.h" -#include "libavutil/time_.h" -#include "os_support.h" -#include "avformat.h" -#if CONFIG_NETWORK -#include "network.h" -#endif -#include "url.h" - -static URLProtocol *first_protocol = NULL; - -URLProtocol *ffurl_protocol_next(URLProtocol *prev) -{ - return prev ? prev->next : first_protocol; -} - -/** @name Logging context. */ -/*@{*/ -static const char *urlcontext_to_name(void *ptr) -{ - URLContext *h = (URLContext *)ptr; - if (h->prot) - return h->prot->name; - else - return "NULL"; -} - -static void *urlcontext_child_next(void *obj, void *prev) -{ - URLContext *h = obj; - if (!prev && h->priv_data && h->prot->priv_data_class) - return h->priv_data; - return NULL; -} - -static const AVClass *urlcontext_child_class_next(const AVClass *prev) -{ - URLProtocol *p = NULL; - - /* find the protocol that corresponds to prev */ - while (prev && (p = ffurl_protocol_next(p))) - if (p->priv_data_class == prev) - break; - - /* find next protocol with priv options */ - while (p = ffurl_protocol_next(p)) - if (p->priv_data_class) - return p->priv_data_class; - return NULL; -} - -static const AVOption options[] = { { NULL } }; -const AVClass ffurl_context_class = { - .class_name = "URLContext", - .item_name = urlcontext_to_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, - .child_next = urlcontext_child_next, - .child_class_next = urlcontext_child_class_next, -}; -/*@}*/ - -const char *avio_enum_protocols(void **opaque, int output) -{ - URLProtocol *p; - *opaque = ffurl_protocol_next(*opaque); - if (!(p = *opaque)) - return NULL; - if ((output && p->url_write) || (!output && p->url_read)) - return p->name; - return avio_enum_protocols(opaque, output); -} - -int ffurl_register_protocol(URLProtocol *protocol) -{ - URLProtocol **p; - p = &first_protocol; - while (*p != NULL) - p = &(*p)->next; - *p = protocol; - protocol->next = NULL; - return 0; -} - -static int url_alloc_for_protocol(URLContext **puc, struct URLProtocol *up, - const char *filename, int flags, - const AVIOInterruptCB *int_cb) -{ - URLContext *uc; - int err; - -#if CONFIG_NETWORK - if (up->flags & URL_PROTOCOL_FLAG_NETWORK && !ff_network_init()) - return AVERROR(EIO); -#endif - if ((flags & AVIO_FLAG_READ) && !up->url_read) { - av_log(NULL, AV_LOG_ERROR, - "Impossible to open the '%s' protocol for reading\n", up->name); - return AVERROR(EIO); - } - if ((flags & AVIO_FLAG_WRITE) && !up->url_write) { - av_log(NULL, AV_LOG_ERROR, - "Impossible to open the '%s' protocol for writing\n", up->name); - return AVERROR(EIO); - } - uc = av_mallocz(sizeof(URLContext) + strlen(filename) + 1); - if (!uc) { - err = AVERROR(ENOMEM); - goto fail; - } - uc->av_class = &ffurl_context_class; - uc->filename = (char *)&uc[1]; - strcpy(uc->filename, filename); - uc->prot = up; - uc->flags = flags; - uc->is_streamed = 0; /* default = not streamed */ - uc->max_packet_size = 0; /* default: stream file */ - if (up->priv_data_size) { - uc->priv_data = av_mallocz(up->priv_data_size); - if (!uc->priv_data) { - err = AVERROR(ENOMEM); - goto fail; - } - if (up->priv_data_class) { - int proto_len= strlen(up->name); - char *start = strchr(uc->filename, ','); - *(const AVClass **)uc->priv_data = up->priv_data_class; - av_opt_set_defaults(uc->priv_data); - if(!strncmp(up->name, uc->filename, proto_len) && uc->filename + proto_len == start){ - int ret= 0; - char *p= start; - char sep= *++p; - char *key, *val; - p++; - while(ret >= 0 && (key= strchr(p, sep)) && ppriv_data, p, key+1, 0); - if (ret == AVERROR_OPTION_NOT_FOUND) - av_log(uc, AV_LOG_ERROR, "Key '%s' not found.\n", p); - *val= *key= sep; - p= val+1; - } - if(ret<0 || p!=key){ - av_log(uc, AV_LOG_ERROR, "Error parsing options string %s\n", start); - av_freep(&uc->priv_data); - av_freep(&uc); - err = AVERROR(EINVAL); - goto fail; - } - memmove(start, key+1, strlen(key)); - } - } - } - if (int_cb) - uc->interrupt_callback = *int_cb; - - *puc = uc; - return 0; -fail: - *puc = NULL; - if (uc) - av_freep(&uc->priv_data); - av_freep(&uc); -#if CONFIG_NETWORK - if (up->flags & URL_PROTOCOL_FLAG_NETWORK) - ff_network_close(); -#endif - return err; -} - -int ffurl_connect(URLContext *uc, AVDictionary **options) -{ - int err = - uc->prot->url_open2 ? uc->prot->url_open2(uc, - uc->filename, - uc->flags, - options) : - uc->prot->url_open(uc, uc->filename, uc->flags); - if (err) - return err; - uc->is_connected = 1; - /* We must be careful here as ffurl_seek() could be slow, - * for example for http */ - if ((uc->flags & AVIO_FLAG_WRITE) || !strcmp(uc->prot->name, "file")) - if (!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0) - uc->is_streamed = 1; - return 0; -} - -#define URL_SCHEME_CHARS \ - "abcdefghijklmnopqrstuvwxyz" \ - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" \ - "0123456789+-." - -static struct URLProtocol *url_find_protocol(const char *filename) -{ - URLProtocol *up = NULL; - char proto_str[128], proto_nested[128], *ptr; - size_t proto_len = strspn(filename, URL_SCHEME_CHARS); - - if (filename[proto_len] != ':' && - (filename[proto_len] != ',' || !strchr(filename + proto_len + 1, ':')) || - is_dos_path(filename)) - strcpy(proto_str, "file"); - else - av_strlcpy(proto_str, filename, - FFMIN(proto_len + 1, sizeof(proto_str))); - - if ((ptr = strchr(proto_str, ','))) - *ptr = '\0'; - av_strlcpy(proto_nested, proto_str, sizeof(proto_nested)); - if ((ptr = strchr(proto_nested, '+'))) - *ptr = '\0'; - - while (up = ffurl_protocol_next(up)) { - if (!strcmp(proto_str, up->name)) - break; - if (up->flags & URL_PROTOCOL_FLAG_NESTED_SCHEME && - !strcmp(proto_nested, up->name)) - break; - } - - return up; -} - -int ffurl_alloc(URLContext **puc, const char *filename, int flags, - const AVIOInterruptCB *int_cb) -{ - URLProtocol *p = NULL; - - if (!first_protocol) { - av_log(NULL, AV_LOG_WARNING, "No URL Protocols are registered. " - "Missing call to av_register_all()?\n"); - } - - p = url_find_protocol(filename); - if (p) - return url_alloc_for_protocol(puc, p, filename, flags, int_cb); - - *puc = NULL; - if (av_strstart("https:", filename, NULL)) - av_log(NULL, AV_LOG_WARNING, "https protocol not found, recompile with openssl or gnutls enabled.\n"); - return AVERROR_PROTOCOL_NOT_FOUND; -} - -int ffurl_open(URLContext **puc, const char *filename, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options) -{ - int ret = ffurl_alloc(puc, filename, flags, int_cb); - if (ret < 0) - return ret; - if (options && (*puc)->prot->priv_data_class && - (ret = av_opt_set_dict((*puc)->priv_data, options)) < 0) - goto fail; - ret = ffurl_connect(*puc, options); - if (!ret) - return 0; -fail: - ffurl_close(*puc); - *puc = NULL; - return ret; -} - -static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf, - int size, int size_min, - int (*transfer_func)(URLContext *h, - uint8_t *buf, - int size)) -{ - int ret, len; - int fast_retries = 5; - int64_t wait_since = 0; - - len = 0; - while (len < size_min) { - if (ff_check_interrupt(&h->interrupt_callback)) - return AVERROR_EXIT; - ret = transfer_func(h, buf + len, size - len); - if (ret == AVERROR(EINTR)) - continue; - if (h->flags & AVIO_FLAG_NONBLOCK) - return ret; - if (ret == AVERROR(EAGAIN)) { - ret = 0; - if (fast_retries) { - fast_retries--; - } else { - if (h->rw_timeout) { - if (!wait_since) - wait_since = av_gettime(); - else if (av_gettime() > wait_since + h->rw_timeout) - return AVERROR(EIO); - } - av_usleep(1000); - } - } else if (ret < 1) - return (ret < 0 && ret != AVERROR_EOF) ? ret : len; - if (ret) - fast_retries = FFMAX(fast_retries, 2); - len += ret; - } - return len; -} - -int ffurl_read(URLContext *h, unsigned char *buf, int size) -{ - if (!(h->flags & AVIO_FLAG_READ)) - return AVERROR(EIO); - return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read); -} - -int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) -{ - if (!(h->flags & AVIO_FLAG_READ)) - return AVERROR(EIO); - return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); -} - -int ffurl_write(URLContext *h, const unsigned char *buf, int size) -{ - if (!(h->flags & AVIO_FLAG_WRITE)) - return AVERROR(EIO); - /* avoid sending too big packets */ - if (h->max_packet_size && size > h->max_packet_size) - return AVERROR(EIO); - - return retry_transfer_wrapper(h, (unsigned char *)buf, size, size, (void*)h->prot->url_write); -} - -int64_t ffurl_seek(URLContext *h, int64_t pos, int whence) -{ - int64_t ret; - - if (!h->prot->url_seek) - return AVERROR(ENOSYS); - ret = h->prot->url_seek(h, pos, whence & ~AVSEEK_FORCE); - return ret; -} - -int ffurl_closep(URLContext **hh) -{ - URLContext *h= *hh; - int ret = 0; - if (!h) - return 0; /* can happen when ffurl_open fails */ - - if (h->is_connected && h->prot->url_close) - ret = h->prot->url_close(h); -#if CONFIG_NETWORK - if (h->prot->flags & URL_PROTOCOL_FLAG_NETWORK) - ff_network_close(); -#endif - if (h->prot->priv_data_size) { - if (h->prot->priv_data_class) - av_opt_free(h->priv_data); - av_freep(&h->priv_data); - } - av_freep(hh); - return ret; -} - -int ffurl_close(URLContext *h) -{ - return ffurl_closep(&h); -} - - -const char *avio_find_protocol_name(const char *url) -{ - URLProtocol *p = url_find_protocol(url); - - return p ? p->name : NULL; -} - -int avio_check(const char *url, int flags) -{ - URLContext *h; - int ret = ffurl_alloc(&h, url, flags, NULL); - if (ret < 0) - return ret; - - if (h->prot->url_check) { - ret = h->prot->url_check(h, flags); - } else { - ret = ffurl_connect(h, NULL); - if (ret >= 0) - ret = flags; - } - - ffurl_close(h); - return ret; -} - -int64_t ffurl_size(URLContext *h) -{ - int64_t pos, size; - - size = ffurl_seek(h, 0, AVSEEK_SIZE); - if (size < 0) { - pos = ffurl_seek(h, 0, SEEK_CUR); - if ((size = ffurl_seek(h, -1, SEEK_END)) < 0) - return size; - size++; - ffurl_seek(h, pos, SEEK_SET); - } - return size; -} - -int ffurl_get_file_handle(URLContext *h) -{ - if (!h->prot->url_get_file_handle) - return -1; - return h->prot->url_get_file_handle(h); -} - -int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles) -{ - if (!h->prot->url_get_multi_file_handle) { - if (!h->prot->url_get_file_handle) - return AVERROR(ENOSYS); - *handles = av_malloc(sizeof(**handles)); - if (!*handles) - return AVERROR(ENOMEM); - *numhandles = 1; - *handles[0] = h->prot->url_get_file_handle(h); - return 0; - } - return h->prot->url_get_multi_file_handle(h, handles, numhandles); -} - -int ffurl_shutdown(URLContext *h, int flags) -{ - if (!h->prot->url_shutdown) - return AVERROR(EINVAL); - return h->prot->url_shutdown(h, flags); -} - -int ff_check_interrupt(AVIOInterruptCB *cb) -{ - int ret; - if (cb && cb->callback && (ret = cb->callback(cb->opaque))) - return ret; - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio_internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio_internal.h deleted file mode 100644 index c5a2a9601..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio_internal.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AVIO_INTERNAL_H -#define AVFORMAT_AVIO_INTERNAL_H - -#include "avio.h" -#include "url.h" - -#include "libavutil/log.h" - -extern const AVClass ffio_url_class; - -int ffio_init_context(AVIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)); - - -/** - * Read size bytes from AVIOContext, returning a pointer. - * Note that the data pointed at by the returned pointer is only - * valid until the next call that references the same IO context. - * @param s IO context - * @param buf pointer to buffer into which to assemble the requested - * data if it is not available in contiguous addresses in the - * underlying buffer - * @param size number of bytes requested - * @param data address at which to store pointer: this will be a - * a direct pointer into the underlying buffer if the requested - * number of bytes are available at contiguous addresses, otherwise - * will be a copy of buf - * @return number of bytes read or AVERROR - */ -int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data); - -/** - * Read size bytes from AVIOContext into buf. - * This reads at most 1 packet. If that is not enough fewer bytes will be - * returned. - * @return number of bytes read or AVERROR - */ -int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size); - -void ffio_fill(AVIOContext *s, int b, int count); - -static av_always_inline void ffio_wfourcc(AVIOContext *pb, const uint8_t *s) -{ - avio_wl32(pb, MKTAG(s[0], s[1], s[2], s[3])); -} - -/** - * Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file. - * Used after probing to avoid seeking. - * Joins buf and s->buffer, taking any overlap into consideration. - * @note s->buffer must overlap with buf or they can't be joined and the function fails - * - * @param s The read-only AVIOContext to rewind - * @param buf The probe buffer containing the first buf_size bytes of the file - * @param buf_size The size of buf - * @return 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **buf, int buf_size); - -uint64_t ffio_read_varlen(AVIOContext *bc); - -/** @warning must be called before any I/O */ -int ffio_set_buf_size(AVIOContext *s, int buf_size); - -/** - * Ensures that the requested seekback buffer size will be available - * - * Will ensure that when reading sequentially up to buf_size, seeking - * within the current pos and pos+buf_size is possible. - * Once the stream position moves outside this window this gurantee is lost. - */ -int ffio_ensure_seekback(AVIOContext *s, int buf_size); - -int ffio_limit(AVIOContext *s, int size); - -void ffio_init_checksum(AVIOContext *s, - unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), - unsigned long checksum); -unsigned long ffio_get_checksum(AVIOContext *s); -unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, - unsigned int len); - -/** - * Open a write only packetized memory stream with a maximum packet - * size of 'max_packet_size'. The stream is stored in a memory buffer - * with a big-endian 4 byte header giving the packet size in bytes. - * - * @param s new IO context - * @param max_packet_size maximum packet size (must be > 0) - * @return zero if no error. - */ -int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size); - -/** - * Create and initialize a AVIOContext for accessing the - * resource referenced by the URLContext h. - * @note When the URLContext h has been opened in read+write mode, the - * AVIOContext can be used only for writing. - * - * @param s Used to return the pointer to the created AVIOContext. - * In case of failure the pointed to value is set to NULL. - * @return 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int ffio_fdopen(AVIOContext **s, URLContext *h); - -/** - * Open a write-only fake memory stream. The written data is not stored - * anywhere - this is only used for measuring the amount of data - * written. - * - * @param s new IO context - * @return zero if no error. - */ -int ffio_open_null_buf(AVIOContext **s); - -/** - * Close a null buffer. - * - * @param s an IO context opened by ffio_open_null_buf - * @return the number of bytes written to the null buffer - */ -int ffio_close_null_buf(AVIOContext *s); - -#endif /* AVFORMAT_AVIO_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aviobuf.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aviobuf.c deleted file mode 100644 index 95fdf200e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/aviobuf.c +++ /dev/null @@ -1,1109 +0,0 @@ -/* - * buffered I/O - * Copyright (c) 2000,2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/crc.h" -#include "libavutil/dict.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/opt.h" -#include "libavutil/avassert.h" -#include "avformat.h" -#include "avio.h" -#include "avio_internal.h" -#include "internal.h" -#include "url.h" -#include - -#define IO_BUFFER_SIZE 32768 - -/** - * Do seeks within this distance ahead of the current buffer by skipping - * data instead of calling the protocol seek function, for seekable - * protocols. - */ -#define SHORT_SEEK_THRESHOLD 4096 - -static void *ffio_url_child_next(void *obj, void *prev) -{ - AVIOContext *s = obj; - return prev ? NULL : s->opaque; -} - -static const AVClass *ffio_url_child_class_next(const AVClass *prev) -{ - return prev ? NULL : &ffurl_context_class; -} - -static const AVOption ffio_url_options[] = { - { NULL }, -}; - -const AVClass ffio_url_class = { - .class_name = "AVIOContext", - .item_name = av_default_item_name, - .version = LIBAVUTIL_VERSION_INT, - .option = ffio_url_options, - .child_next = ffio_url_child_next, - .child_class_next = ffio_url_child_class_next, -}; - -static void fill_buffer(AVIOContext *s); -static int url_resetbuf(AVIOContext *s, int flags); - -int ffio_init_context(AVIOContext *s, - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)) -{ - s->buffer = buffer; - s->buffer_size = buffer_size; - s->buf_ptr = buffer; - s->opaque = opaque; - s->direct = 0; - - url_resetbuf(s, write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); - - s->write_packet = write_packet; - s->read_packet = read_packet; - s->seek = seek; - s->pos = 0; - s->must_flush = 0; - s->eof_reached = 0; - s->error = 0; - s->seekable = seek ? AVIO_SEEKABLE_NORMAL : 0; - s->max_packet_size = 0; - s->update_checksum = NULL; - - if (!read_packet && !write_flag) { - s->pos = buffer_size; - s->buf_end = s->buffer + buffer_size; - } - s->read_pause = NULL; - s->read_seek = NULL; - - return 0; -} - -AVIOContext *avio_alloc_context( - unsigned char *buffer, - int buffer_size, - int write_flag, - void *opaque, - int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), - int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), - int64_t (*seek)(void *opaque, int64_t offset, int whence)) -{ - AVIOContext *s = av_mallocz(sizeof(AVIOContext)); - if (!s) - return NULL; - ffio_init_context(s, buffer, buffer_size, write_flag, opaque, - read_packet, write_packet, seek); - return s; -} - -static void writeout(AVIOContext *s, const uint8_t *data, int len) -{ - if (s->write_packet && !s->error) { - int ret = s->write_packet(s->opaque, (uint8_t *)data, len); - if (ret < 0) { - s->error = ret; - } - } - s->writeout_count ++; - s->pos += len; -} - -static void flush_buffer(AVIOContext *s) -{ - if (s->buf_ptr > s->buffer) { - writeout(s, s->buffer, s->buf_ptr - s->buffer); - if (s->update_checksum) { - s->checksum = s->update_checksum(s->checksum, s->checksum_ptr, - s->buf_ptr - s->checksum_ptr); - s->checksum_ptr = s->buffer; - } - } - s->buf_ptr = s->buffer; -} - -void avio_w8(AVIOContext *s, int b) -{ - av_assert2(b>=-128 && b<=255); - *s->buf_ptr++ = b; - if (s->buf_ptr >= s->buf_end) - flush_buffer(s); -} - -void ffio_fill(AVIOContext *s, int b, int count) -{ - while (count > 0) { - int len = FFMIN(s->buf_end - s->buf_ptr, count); - memset(s->buf_ptr, b, len); - s->buf_ptr += len; - - if (s->buf_ptr >= s->buf_end) - flush_buffer(s); - - count -= len; - } -} - -void avio_write(AVIOContext *s, const unsigned char *buf, int size) -{ - if (s->direct && !s->update_checksum) { - avio_flush(s); - writeout(s, buf, size); - return; - } - while (size > 0) { - int len = FFMIN(s->buf_end - s->buf_ptr, size); - memcpy(s->buf_ptr, buf, len); - s->buf_ptr += len; - - if (s->buf_ptr >= s->buf_end) - flush_buffer(s); - - buf += len; - size -= len; - } -} - -void avio_flush(AVIOContext *s) -{ - flush_buffer(s); - s->must_flush = 0; -} - -int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) -{ - int64_t offset1; - int64_t pos; - int force = whence & AVSEEK_FORCE; - int buffer_size; - whence &= ~AVSEEK_FORCE; - - if(!s) - return AVERROR(EINVAL); - - buffer_size = s->buf_end - s->buffer; - pos = s->pos - (s->write_flag ? 0 : buffer_size); - - if (whence != SEEK_CUR && whence != SEEK_SET) - return AVERROR(EINVAL); - - if (whence == SEEK_CUR) { - offset1 = pos + (s->buf_ptr - s->buffer); - if (offset == 0) - return offset1; - offset += offset1; - } - offset1 = offset - pos; - if (!s->must_flush && (!s->direct || !s->seek) && - offset1 >= 0 && offset1 <= buffer_size) { - /* can do the seek inside the buffer */ - s->buf_ptr = s->buffer + offset1; - } else if ((!s->seekable || - offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) && - !s->write_flag && offset1 >= 0 && - (!s->direct || !s->seek) && - (whence != SEEK_END || force)) { - while(s->pos < offset && !s->eof_reached) - fill_buffer(s); - if (s->eof_reached) - return AVERROR_EOF; - s->buf_ptr = s->buf_end + offset - s->pos; - } else if(!s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 && s->seek && offset > 0) { - int64_t res; - - pos -= FFMIN(buffer_size>>1, pos); - if ((res = s->seek(s->opaque, pos, SEEK_SET)) < 0) - return res; - s->buf_end = - s->buf_ptr = s->buffer; - s->pos = pos; - s->eof_reached = 0; - fill_buffer(s); - return avio_seek(s, offset, SEEK_SET | force); - } else { - int64_t res; - if (s->write_flag) { - flush_buffer(s); - s->must_flush = 1; - } - if (!s->seek) - return AVERROR(EPIPE); - if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0) - return res; - s->seek_count ++; - if (!s->write_flag) - s->buf_end = s->buffer; - s->buf_ptr = s->buffer; - s->pos = offset; - } - s->eof_reached = 0; - return offset; -} - -int64_t avio_skip(AVIOContext *s, int64_t offset) -{ - return avio_seek(s, offset, SEEK_CUR); -} - -int64_t avio_size(AVIOContext *s) -{ - int64_t size; - - if (!s) - return AVERROR(EINVAL); - - if (!s->seek) - return AVERROR(ENOSYS); - size = s->seek(s->opaque, 0, AVSEEK_SIZE); - if (size < 0) { - if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0) - return size; - size++; - s->seek(s->opaque, s->pos, SEEK_SET); - } - return size; -} - -int url_feof(AVIOContext *s) -{ - if(!s) - return 0; - if(s->eof_reached){ - s->eof_reached=0; - fill_buffer(s); - } - return s->eof_reached; -} - -void avio_wl32(AVIOContext *s, unsigned int val) -{ - avio_w8(s, (uint8_t) val ); - avio_w8(s, (uint8_t)(val >> 8 )); - avio_w8(s, (uint8_t)(val >> 16)); - avio_w8(s, val >> 24 ); -} - -void avio_wb32(AVIOContext *s, unsigned int val) -{ - avio_w8(s, val >> 24 ); - avio_w8(s, (uint8_t)(val >> 16)); - avio_w8(s, (uint8_t)(val >> 8 )); - avio_w8(s, (uint8_t) val ); -} - -int avio_put_str(AVIOContext *s, const char *str) -{ - int len = 1; - if (str) { - len += strlen(str); - avio_write(s, (const unsigned char *) str, len); - } else - avio_w8(s, 0); - return len; -} - -int avio_put_str16le(AVIOContext *s, const char *str) -{ - const uint8_t *q = str; - int ret = 0; - int err = 0; - - while (*q) { - uint32_t ch; - uint16_t tmp; - - GET_UTF8(ch, *q++, goto invalid;) - PUT_UTF16(ch, tmp, avio_wl16(s, tmp); ret += 2;) - continue; -invalid: - av_log(s, AV_LOG_ERROR, "Invaid UTF8 sequence in avio_put_str16le\n"); - err = AVERROR(EINVAL); - } - avio_wl16(s, 0); - if (err) - return err; - ret += 2; - return ret; -} - -int ff_get_v_length(uint64_t val) -{ - int i = 1; - - while (val >>= 7) - i++; - - return i; -} - -void ff_put_v(AVIOContext *bc, uint64_t val) -{ - int i = ff_get_v_length(val); - - while (--i > 0) - avio_w8(bc, 128 | (uint8_t)(val >> (7*i))); - - avio_w8(bc, val & 127); -} - -void avio_wl64(AVIOContext *s, uint64_t val) -{ - avio_wl32(s, (uint32_t)(val & 0xffffffff)); - avio_wl32(s, (uint32_t)(val >> 32)); -} - -void avio_wb64(AVIOContext *s, uint64_t val) -{ - avio_wb32(s, (uint32_t)(val >> 32)); - avio_wb32(s, (uint32_t)(val & 0xffffffff)); -} - -void avio_wl16(AVIOContext *s, unsigned int val) -{ - avio_w8(s, (uint8_t)val); - avio_w8(s, (int)val >> 8); -} - -void avio_wb16(AVIOContext *s, unsigned int val) -{ - avio_w8(s, (int)val >> 8); - avio_w8(s, (uint8_t)val); -} - -void avio_wl24(AVIOContext *s, unsigned int val) -{ - avio_wl16(s, val & 0xffff); - avio_w8(s, (int)val >> 16); -} - -void avio_wb24(AVIOContext *s, unsigned int val) -{ - avio_wb16(s, (int)val >> 8); - avio_w8(s, (uint8_t)val); -} - -/* Input stream */ - -static void fill_buffer(AVIOContext *s) -{ - int max_buffer_size = s->max_packet_size ? - s->max_packet_size : IO_BUFFER_SIZE; - uint8_t *dst = s->buf_end - s->buffer + max_buffer_size < s->buffer_size ? - s->buf_end : s->buffer; - int len = s->buffer_size - (dst - s->buffer); - - /* can't fill the buffer without read_packet, just set EOF if appropriate */ - if (!s->read_packet && s->buf_ptr >= s->buf_end) - s->eof_reached = 1; - - /* no need to do anything if EOF already reached */ - if (s->eof_reached) - return; - - if (s->update_checksum && dst == s->buffer) { - if (s->buf_end > s->checksum_ptr) - s->checksum = s->update_checksum(s->checksum, s->checksum_ptr, - s->buf_end - s->checksum_ptr); - s->checksum_ptr = s->buffer; - } - - /* make buffer smaller in case it ended up large after probing */ - if (s->read_packet && s->buffer_size > max_buffer_size) { - if (dst == s->buffer) { - ffio_set_buf_size(s, max_buffer_size); - - s->checksum_ptr = dst = s->buffer; - } - av_assert0(len >= max_buffer_size); - len = max_buffer_size; - } - - if (s->read_packet) - len = s->read_packet(s->opaque, dst, len); - else - len = 0; - if (len <= 0) { - /* do not modify buffer if EOF reached so that a seek back can - be done without rereading data */ - s->eof_reached = 1; - if (len < 0) - s->error = len; - } else { - s->pos += len; - s->buf_ptr = dst; - s->buf_end = dst + len; - s->bytes_read += len; - } -} - -unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, - unsigned int len) -{ - return av_crc(av_crc_get_table(AV_CRC_32_IEEE), checksum, buf, len); -} - -unsigned long ffio_get_checksum(AVIOContext *s) -{ - s->checksum = s->update_checksum(s->checksum, s->checksum_ptr, - s->buf_ptr - s->checksum_ptr); - s->update_checksum = NULL; - return s->checksum; -} - -void ffio_init_checksum(AVIOContext *s, - unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), - unsigned long checksum) -{ - s->update_checksum = update_checksum; - if (s->update_checksum) { - s->checksum = checksum; - s->checksum_ptr = s->buf_ptr; - } -} - -/* XXX: put an inline version */ -int avio_r8(AVIOContext *s) -{ - if (s->buf_ptr >= s->buf_end) - fill_buffer(s); - if (s->buf_ptr < s->buf_end) - return *s->buf_ptr++; - return 0; -} - -int avio_read(AVIOContext *s, unsigned char *buf, int size) -{ - int len, size1; - - size1 = size; - while (size > 0) { - len = s->buf_end - s->buf_ptr; - if (len > size) - len = size; - if (len == 0 || s->write_flag) { - if((s->direct || size > s->buffer_size) && !s->update_checksum){ - if(s->read_packet) - len = s->read_packet(s->opaque, buf, size); - if (len <= 0) { - /* do not modify buffer if EOF reached so that a seek back can - be done without rereading data */ - s->eof_reached = 1; - if(len<0) - s->error= len; - break; - } else { - s->pos += len; - s->bytes_read += len; - size -= len; - buf += len; - s->buf_ptr = s->buffer; - s->buf_end = s->buffer/* + len*/; - } - } else { - fill_buffer(s); - len = s->buf_end - s->buf_ptr; - if (len == 0) - break; - } - } else { - memcpy(buf, s->buf_ptr, len); - buf += len; - s->buf_ptr += len; - size -= len; - } - } - if (size1 == size) { - if (s->error) return s->error; - if (url_feof(s)) return AVERROR_EOF; - } - return size1 - size; -} - -int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data) -{ - if (s->buf_end - s->buf_ptr >= size && !s->write_flag) { - *data = s->buf_ptr; - s->buf_ptr += size; - return size; - } else { - *data = buf; - return avio_read(s, buf, size); - } -} - -int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size) -{ - int len; - - if (size < 0) - return -1; - - if (s->read_packet && s->write_flag) { - len = s->read_packet(s->opaque, buf, size); - if (len > 0) - s->pos += len; - return len; - } - - len = s->buf_end - s->buf_ptr; - if (len == 0) { - /* Reset the buf_end pointer to the start of the buffer, to make sure - * the fill_buffer call tries to read as much data as fits into the - * full buffer, instead of just what space is left after buf_end. - * This avoids returning partial packets at the end of the buffer, - * for packet based inputs. - */ - s->buf_end = s->buf_ptr = s->buffer; - fill_buffer(s); - len = s->buf_end - s->buf_ptr; - } - if (len > size) - len = size; - memcpy(buf, s->buf_ptr, len); - s->buf_ptr += len; - if (!len) { - if (s->error) return s->error; - if (url_feof(s)) return AVERROR_EOF; - } - return len; -} - -unsigned int avio_rl16(AVIOContext *s) -{ - unsigned int val; - val = avio_r8(s); - val |= avio_r8(s) << 8; - return val; -} - -unsigned int avio_rl24(AVIOContext *s) -{ - unsigned int val; - val = avio_rl16(s); - val |= avio_r8(s) << 16; - return val; -} - -unsigned int avio_rl32(AVIOContext *s) -{ - unsigned int val; - val = avio_rl16(s); - val |= avio_rl16(s) << 16; - return val; -} - -uint64_t avio_rl64(AVIOContext *s) -{ - uint64_t val; - val = (uint64_t)avio_rl32(s); - val |= (uint64_t)avio_rl32(s) << 32; - return val; -} - -unsigned int avio_rb16(AVIOContext *s) -{ - unsigned int val; - val = avio_r8(s) << 8; - val |= avio_r8(s); - return val; -} - -unsigned int avio_rb24(AVIOContext *s) -{ - unsigned int val; - val = avio_rb16(s) << 8; - val |= avio_r8(s); - return val; -} -unsigned int avio_rb32(AVIOContext *s) -{ - unsigned int val; - val = avio_rb16(s) << 16; - val |= avio_rb16(s); - return val; -} - -int ff_get_line(AVIOContext *s, char *buf, int maxlen) -{ - int i = 0; - char c; - - do { - c = avio_r8(s); - if (c && i < maxlen-1) - buf[i++] = c; - } while (c != '\n' && c); - - buf[i] = 0; - return i; -} - -int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen) -{ - int i; - - if (buflen <= 0) - return AVERROR(EINVAL); - // reserve 1 byte for terminating 0 - buflen = FFMIN(buflen - 1, maxlen); - for (i = 0; i < buflen; i++) - if (!(buf[i] = avio_r8(s))) - return i + 1; - buf[i] = 0; - for (; i < maxlen; i++) - if (!avio_r8(s)) - return i + 1; - return maxlen; -} - -#define GET_STR16(type, read) \ - int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\ -{\ - char* q = buf;\ - int ret = 0;\ - if (buflen <= 0) \ - return AVERROR(EINVAL); \ - while (ret + 1 < maxlen) {\ - uint8_t tmp;\ - uint32_t ch;\ - GET_UTF16(ch, (ret += 2) <= maxlen ? read(pb) : 0, break;)\ - if (!ch)\ - break;\ - PUT_UTF8(ch, tmp, if (q - buf < buflen - 1) *q++ = tmp;)\ - }\ - *q = 0;\ - return ret;\ -}\ - -GET_STR16(le, avio_rl16) -GET_STR16(be, avio_rb16) - -#undef GET_STR16 - -uint64_t avio_rb64(AVIOContext *s) -{ - uint64_t val; - val = (uint64_t)avio_rb32(s) << 32; - val |= (uint64_t)avio_rb32(s); - return val; -} - -uint64_t ffio_read_varlen(AVIOContext *bc){ - uint64_t val = 0; - int tmp; - - do{ - tmp = avio_r8(bc); - val= (val<<7) + (tmp&127); - }while(tmp&128); - return val; -} - -int ffio_fdopen(AVIOContext **s, URLContext *h) -{ - uint8_t *buffer; - int buffer_size, max_packet_size; - - max_packet_size = h->max_packet_size; - if (max_packet_size) { - buffer_size = max_packet_size; /* no need to bufferize more than one packet */ - } else { - buffer_size = IO_BUFFER_SIZE; - } - buffer = av_malloc(buffer_size); - if (!buffer) - return AVERROR(ENOMEM); - - *s = avio_alloc_context(buffer, buffer_size, h->flags & AVIO_FLAG_WRITE, h, - (void*)ffurl_read, (void*)ffurl_write, (void*)ffurl_seek); - if (!*s) { - av_free(buffer); - return AVERROR(ENOMEM); - } - (*s)->direct = h->flags & AVIO_FLAG_DIRECT; - (*s)->seekable = h->is_streamed ? 0 : AVIO_SEEKABLE_NORMAL; - (*s)->max_packet_size = max_packet_size; - if(h->prot) { - (*s)->read_pause = (int (*)(void *, int))h->prot->url_read_pause; - (*s)->read_seek = (int64_t (*)(void *, int, int64_t, int))h->prot->url_read_seek; - } - (*s)->av_class = &ffio_url_class; - return 0; -} - -int ffio_ensure_seekback(AVIOContext *s, int buf_size) -{ - uint8_t *buffer; - int max_buffer_size = s->max_packet_size ? - s->max_packet_size : IO_BUFFER_SIZE; - - buf_size += s->buf_ptr - s->buffer + max_buffer_size; - - if (buf_size < s->buffer_size || s->seekable) - return 0; - av_assert0(!s->write_flag); - - buffer = av_malloc(buf_size); - if (!buffer) - return AVERROR(ENOMEM); - - memcpy(buffer, s->buffer, s->buffer_size); - av_free(s->buffer); - s->buf_ptr = buffer + (s->buf_ptr - s->buffer); - s->buf_end = buffer + (s->buf_end - s->buffer); - s->buffer = buffer; - s->buffer_size = buf_size; - return 0; -} - -int ffio_set_buf_size(AVIOContext *s, int buf_size) -{ - uint8_t *buffer; - buffer = av_malloc(buf_size); - if (!buffer) - return AVERROR(ENOMEM); - - av_free(s->buffer); - s->buffer = buffer; - s->buffer_size = buf_size; - s->buf_ptr = buffer; - url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); - return 0; -} - -static int url_resetbuf(AVIOContext *s, int flags) -{ - av_assert1(flags == AVIO_FLAG_WRITE || flags == AVIO_FLAG_READ); - - if (flags & AVIO_FLAG_WRITE) { - s->buf_end = s->buffer + s->buffer_size; - s->write_flag = 1; - } else { - s->buf_end = s->buffer; - s->write_flag = 0; - } - return 0; -} - -int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **bufp, int buf_size) -{ - int64_t buffer_start; - int buffer_size; - int overlap, new_size, alloc_size; - uint8_t *buf = *bufp; - - if (s->write_flag) { - av_freep(bufp); - return AVERROR(EINVAL); - } - - buffer_size = s->buf_end - s->buffer; - - /* the buffers must touch or overlap */ - if ((buffer_start = s->pos - buffer_size) > buf_size) { - av_freep(bufp); - return AVERROR(EINVAL); - } - - overlap = buf_size - buffer_start; - new_size = buf_size + buffer_size - overlap; - - alloc_size = FFMAX(s->buffer_size, new_size); - if (alloc_size > buf_size) - if (!(buf = (*bufp) = av_realloc_f(buf, 1, alloc_size))) - return AVERROR(ENOMEM); - - if (new_size > buf_size) { - memcpy(buf + buf_size, s->buffer + overlap, buffer_size - overlap); - buf_size = new_size; - } - - av_free(s->buffer); - s->buf_ptr = s->buffer = buf; - s->buffer_size = alloc_size; - s->pos = buf_size; - s->buf_end = s->buf_ptr + buf_size; - s->eof_reached = 0; - s->must_flush = 0; - - return 0; -} - -int avio_open(AVIOContext **s, const char *filename, int flags) -{ - return avio_open2(s, filename, flags, NULL, NULL); -} - -int avio_open2(AVIOContext **s, const char *filename, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options) -{ - URLContext *h; - int err; - - err = ffurl_open(&h, filename, flags, int_cb, options); - if (err < 0) - return err; - err = ffio_fdopen(s, h); - if (err < 0) { - ffurl_close(h); - return err; - } - return 0; -} - -int avio_close(AVIOContext *s) -{ - URLContext *h; - - if (!s) - return 0; - - avio_flush(s); - h = s->opaque; - av_freep(&s->buffer); - if (s->write_flag) - av_log(s, AV_LOG_DEBUG, "Statistics: %d seeks, %d writeouts\n", s->seek_count, s->writeout_count); - else - av_log(s, AV_LOG_DEBUG, "Statistics: %"PRId64" bytes read, %d seeks\n", s->bytes_read, s->seek_count); - av_free(s); - return ffurl_close(h); -} - -int avio_closep(AVIOContext **s) -{ - int ret = avio_close(*s); - *s = NULL; - return ret; -} - -int avio_printf(AVIOContext *s, const char *fmt, ...) -{ - va_list ap; - char buf[4096]; - int ret; - - va_start(ap, fmt); - ret = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - avio_write(s, buf, strlen(buf)); - return ret; -} - -int avio_pause(AVIOContext *s, int pause) -{ - if (!s->read_pause) - return AVERROR(ENOSYS); - return s->read_pause(s->opaque, pause); -} - -int64_t avio_seek_time(AVIOContext *s, int stream_index, - int64_t timestamp, int flags) -{ - URLContext *h = s->opaque; - int64_t ret; - if (!s->read_seek) - return AVERROR(ENOSYS); - ret = s->read_seek(h, stream_index, timestamp, flags); - if (ret >= 0) { - int64_t pos; - s->buf_ptr = s->buf_end; // Flush buffer - pos = s->seek(h, 0, SEEK_CUR); - if (pos >= 0) - s->pos = pos; - else if (pos != AVERROR(ENOSYS)) - ret = pos; - } - return ret; -} - -/* output in a dynamic buffer */ - -typedef struct DynBuffer { - int pos, size, allocated_size; - uint8_t *buffer; - int io_buffer_size; - uint8_t io_buffer[1]; -} DynBuffer; - -static int dyn_buf_write(void *opaque, uint8_t *buf, int buf_size) -{ - DynBuffer *d = opaque; - unsigned new_size, new_allocated_size; - - /* reallocate buffer if needed */ - new_size = d->pos + buf_size; - new_allocated_size = d->allocated_size; - if (new_size < d->pos || new_size > INT_MAX/2) - return -1; - while (new_size > new_allocated_size) { - if (!new_allocated_size) - new_allocated_size = new_size; - else - new_allocated_size += new_allocated_size / 2 + 1; - } - - if (new_allocated_size > d->allocated_size) { - int err; - if ((err = av_reallocp(&d->buffer, new_allocated_size)) < 0) { - d->allocated_size = 0; - d->size = 0; - return err; - } - d->allocated_size = new_allocated_size; - } - memcpy(d->buffer + d->pos, buf, buf_size); - d->pos = new_size; - if (d->pos > d->size) - d->size = d->pos; - return buf_size; -} - -static int dyn_packet_buf_write(void *opaque, uint8_t *buf, int buf_size) -{ - unsigned char buf1[4]; - int ret; - - /* packetized write: output the header */ - AV_WB32(buf1, buf_size); - ret = dyn_buf_write(opaque, buf1, 4); - if (ret < 0) - return ret; - - /* then the data */ - return dyn_buf_write(opaque, buf, buf_size); -} - -static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence) -{ - DynBuffer *d = opaque; - - if (whence == SEEK_CUR) - offset += d->pos; - else if (whence == SEEK_END) - offset += d->size; - if (offset < 0 || offset > 0x7fffffffLL) - return -1; - d->pos = offset; - return 0; -} - -static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size) -{ - DynBuffer *d; - unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024; - - if (sizeof(DynBuffer) + io_buffer_size < io_buffer_size) - return -1; - d = av_mallocz(sizeof(DynBuffer) + io_buffer_size); - if (!d) - return AVERROR(ENOMEM); - d->io_buffer_size = io_buffer_size; - *s = avio_alloc_context(d->io_buffer, d->io_buffer_size, 1, d, NULL, - max_packet_size ? dyn_packet_buf_write : dyn_buf_write, - max_packet_size ? NULL : dyn_buf_seek); - if(!*s) { - av_free(d); - return AVERROR(ENOMEM); - } - (*s)->max_packet_size = max_packet_size; - return 0; -} - -int avio_open_dyn_buf(AVIOContext **s) -{ - return url_open_dyn_buf_internal(s, 0); -} - -int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size) -{ - if (max_packet_size <= 0) - return -1; - return url_open_dyn_buf_internal(s, max_packet_size); -} - -int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer) -{ - DynBuffer *d; - int size; - static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0}; - int padding = 0; - - if (!s) { - *pbuffer = NULL; - return 0; - } - d = s->opaque; - - /* don't attempt to pad fixed-size packet buffers */ - if (!s->max_packet_size) { - avio_write(s, padbuf, sizeof(padbuf)); - padding = FF_INPUT_BUFFER_PADDING_SIZE; - } - - avio_flush(s); - - *pbuffer = d->buffer; - size = d->size; - av_free(d); - av_free(s); - return size - padding; -} - -static int null_buf_write(void *opaque, uint8_t *buf, int buf_size) -{ - DynBuffer *d = opaque; - - d->pos += buf_size; - if (d->pos > d->size) - d->size = d->pos; - return buf_size; -} - -int ffio_open_null_buf(AVIOContext **s) -{ - int ret = url_open_dyn_buf_internal(s, 0); - if (ret >= 0) { - AVIOContext *pb = *s; - pb->write_packet = null_buf_write; - } - return ret; -} - -int ffio_close_null_buf(AVIOContext *s) -{ - DynBuffer *d = s->opaque; - int size; - - avio_flush(s); - - size = d->size; - av_free(d); - av_free(s); - return size; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.c deleted file mode 100644 index 39f2560d9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.c +++ /dev/null @@ -1,765 +0,0 @@ -/* - * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009 - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avlanguage.h" -#include "libavutil/avstring.h" -#include "libavutil/common.h" -#include -#include -#include - -typedef struct LangEntry { - const char str[4]; - uint16_t next_equivalent; -} LangEntry; - -static const uint16_t lang_table_counts[] = { 484, 20, 184 }; -static const uint16_t lang_table_offsets[] = { 0, 484, 504 }; - -static const LangEntry lang_table[] = { - /*----- AV_LANG_ISO639_2_BIBL entries (484) -----*/ - /*0000*/ { "aar", 504 }, - /*0001*/ { "abk", 505 }, - /*0002*/ { "ace", 2 }, - /*0003*/ { "ach", 3 }, - /*0004*/ { "ada", 4 }, - /*0005*/ { "ady", 5 }, - /*0006*/ { "afa", 6 }, - /*0007*/ { "afh", 7 }, - /*0008*/ { "afr", 507 }, - /*0009*/ { "ain", 9 }, - /*0010*/ { "aka", 508 }, - /*0011*/ { "akk", 11 }, - /*0012*/ { "alb", 502 }, - /*0013*/ { "ale", 13 }, - /*0014*/ { "alg", 14 }, - /*0015*/ { "alt", 15 }, - /*0016*/ { "amh", 509 }, - /*0017*/ { "ang", 17 }, - /*0018*/ { "anp", 18 }, - /*0019*/ { "apa", 19 }, - /*0020*/ { "ara", 511 }, - /*0021*/ { "arc", 21 }, - /*0022*/ { "arg", 510 }, - /*0023*/ { "arm", 492 }, - /*0024*/ { "arn", 24 }, - /*0025*/ { "arp", 25 }, - /*0026*/ { "art", 26 }, - /*0027*/ { "arw", 27 }, - /*0028*/ { "asm", 512 }, - /*0029*/ { "ast", 29 }, - /*0030*/ { "ath", 30 }, - /*0031*/ { "aus", 31 }, - /*0032*/ { "ava", 513 }, - /*0033*/ { "ave", 506 }, - /*0034*/ { "awa", 34 }, - /*0035*/ { "aym", 514 }, - /*0036*/ { "aze", 515 }, - /*0037*/ { "bad", 37 }, - /*0038*/ { "bai", 38 }, - /*0039*/ { "bak", 516 }, - /*0040*/ { "bal", 40 }, - /*0041*/ { "bam", 521 }, - /*0042*/ { "ban", 42 }, - /*0043*/ { "baq", 489 }, - /*0044*/ { "bas", 44 }, - /*0045*/ { "bat", 45 }, - /*0046*/ { "bej", 46 }, - /*0047*/ { "bel", 517 }, - /*0048*/ { "bem", 48 }, - /*0049*/ { "ben", 522 }, - /*0050*/ { "ber", 50 }, - /*0051*/ { "bho", 51 }, - /*0052*/ { "bih", 519 }, - /*0053*/ { "bik", 53 }, - /*0054*/ { "bin", 54 }, - /*0055*/ { "bis", 520 }, - /*0056*/ { "bla", 56 }, - /*0057*/ { "bnt", 57 }, - /*0058*/ { "bos", 525 }, - /*0059*/ { "bra", 59 }, - /*0060*/ { "bre", 524 }, - /*0061*/ { "btk", 61 }, - /*0062*/ { "bua", 62 }, - /*0063*/ { "bug", 63 }, - /*0064*/ { "bul", 518 }, - /*0065*/ { "bur", 498 }, - /*0066*/ { "byn", 66 }, - /*0067*/ { "cad", 67 }, - /*0068*/ { "cai", 68 }, - /*0069*/ { "car", 69 }, - /*0070*/ { "cat", 526 }, - /*0071*/ { "cau", 71 }, - /*0072*/ { "ceb", 72 }, - /*0073*/ { "cel", 73 }, - /*0074*/ { "cha", 528 }, - /*0075*/ { "chb", 75 }, - /*0076*/ { "che", 527 }, - /*0077*/ { "chg", 77 }, - /*0078*/ { "chi", 503 }, - /*0079*/ { "chk", 79 }, - /*0080*/ { "chm", 80 }, - /*0081*/ { "chn", 81 }, - /*0082*/ { "cho", 82 }, - /*0083*/ { "chp", 83 }, - /*0084*/ { "chr", 84 }, - /*0085*/ { "chu", 532 }, - /*0086*/ { "chv", 533 }, - /*0087*/ { "chy", 87 }, - /*0088*/ { "cmc", 88 }, - /*0089*/ { "cop", 89 }, - /*0090*/ { "cor", 593 }, - /*0091*/ { "cos", 529 }, - /*0092*/ { "cpe", 92 }, - /*0093*/ { "cpf", 93 }, - /*0094*/ { "cpp", 94 }, - /*0095*/ { "cre", 530 }, - /*0096*/ { "crh", 96 }, - /*0097*/ { "crp", 97 }, - /*0098*/ { "csb", 98 }, - /*0099*/ { "cus", 99 }, - /*0100*/ { "cze", 485 }, - /*0101*/ { "dak", 101 }, - /*0102*/ { "dan", 535 }, - /*0103*/ { "dar", 103 }, - /*0104*/ { "day", 104 }, - /*0105*/ { "del", 105 }, - /*0106*/ { "den", 106 }, - /*0107*/ { "dgr", 107 }, - /*0108*/ { "din", 108 }, - /*0109*/ { "div", 537 }, - /*0110*/ { "doi", 110 }, - /*0111*/ { "dra", 111 }, - /*0112*/ { "dsb", 112 }, - /*0113*/ { "dua", 113 }, - /*0114*/ { "dum", 114 }, - /*0115*/ { "dut", 499 }, - /*0116*/ { "dyu", 116 }, - /*0117*/ { "dzo", 538 }, - /*0118*/ { "efi", 118 }, - /*0119*/ { "egy", 119 }, - /*0120*/ { "eka", 120 }, - /*0121*/ { "elx", 121 }, - /*0122*/ { "eng", 541 }, - /*0123*/ { "enm", 123 }, - /*0124*/ { "epo", 542 }, - /*0125*/ { "est", 544 }, - /*0126*/ { "ewe", 539 }, - /*0127*/ { "ewo", 127 }, - /*0128*/ { "fan", 128 }, - /*0129*/ { "fao", 550 }, - /*0130*/ { "fat", 130 }, - /*0131*/ { "fij", 549 }, - /*0132*/ { "fil", 132 }, - /*0133*/ { "fin", 548 }, - /*0134*/ { "fiu", 134 }, - /*0135*/ { "fon", 135 }, - /*0136*/ { "fre", 491 }, - /*0137*/ { "frm", 137 }, - /*0138*/ { "fro", 138 }, - /*0139*/ { "frr", 139 }, - /*0140*/ { "frs", 140 }, - /*0141*/ { "fry", 552 }, - /*0142*/ { "ful", 547 }, - /*0143*/ { "fur", 143 }, - /*0144*/ { "gaa", 144 }, - /*0145*/ { "gay", 145 }, - /*0146*/ { "gba", 146 }, - /*0147*/ { "gem", 147 }, - /*0148*/ { "geo", 494 }, - /*0149*/ { "ger", 487 }, - /*0150*/ { "gez", 150 }, - /*0151*/ { "gil", 151 }, - /*0152*/ { "gla", 554 }, - /*0153*/ { "gle", 553 }, - /*0154*/ { "glg", 555 }, - /*0155*/ { "glv", 558 }, - /*0156*/ { "gmh", 156 }, - /*0157*/ { "goh", 157 }, - /*0158*/ { "gon", 158 }, - /*0159*/ { "gor", 159 }, - /*0160*/ { "got", 160 }, - /*0161*/ { "grb", 161 }, - /*0162*/ { "grc", 162 }, - /*0163*/ { "gre", 488 }, - /*0164*/ { "grn", 556 }, - /*0165*/ { "gsw", 165 }, - /*0166*/ { "guj", 557 }, - /*0167*/ { "gwi", 167 }, - /*0168*/ { "hai", 168 }, - /*0169*/ { "hat", 564 }, - /*0170*/ { "hau", 559 }, - /*0171*/ { "haw", 171 }, - /*0172*/ { "heb", 560 }, - /*0173*/ { "her", 567 }, - /*0174*/ { "hil", 174 }, - /*0175*/ { "him", 175 }, - /*0176*/ { "hin", 561 }, - /*0177*/ { "hit", 177 }, - /*0178*/ { "hmn", 178 }, - /*0179*/ { "hmo", 562 }, - /*0180*/ { "hrv", 563 }, - /*0181*/ { "hsb", 181 }, - /*0182*/ { "hun", 565 }, - /*0183*/ { "hup", 183 }, - /*0184*/ { "iba", 184 }, - /*0185*/ { "ibo", 571 }, - /*0186*/ { "ice", 493 }, - /*0187*/ { "ido", 574 }, - /*0188*/ { "iii", 572 }, - /*0189*/ { "ijo", 189 }, - /*0190*/ { "iku", 577 }, - /*0191*/ { "ile", 570 }, - /*0192*/ { "ilo", 192 }, - /*0193*/ { "ina", 568 }, - /*0194*/ { "inc", 194 }, - /*0195*/ { "ind", 569 }, - /*0196*/ { "ine", 196 }, - /*0197*/ { "inh", 197 }, - /*0198*/ { "ipk", 573 }, - /*0199*/ { "ira", 199 }, - /*0200*/ { "iro", 200 }, - /*0201*/ { "ita", 576 }, - /*0202*/ { "jav", 579 }, - /*0203*/ { "jbo", 203 }, - /*0204*/ { "jpn", 578 }, - /*0205*/ { "jpr", 205 }, - /*0206*/ { "jrb", 206 }, - /*0207*/ { "kaa", 207 }, - /*0208*/ { "kab", 208 }, - /*0209*/ { "kac", 209 }, - /*0210*/ { "kal", 585 }, - /*0211*/ { "kam", 211 }, - /*0212*/ { "kan", 587 }, - /*0213*/ { "kar", 213 }, - /*0214*/ { "kas", 590 }, - /*0215*/ { "kau", 589 }, - /*0216*/ { "kaw", 216 }, - /*0217*/ { "kaz", 584 }, - /*0218*/ { "kbd", 218 }, - /*0219*/ { "kha", 219 }, - /*0220*/ { "khi", 220 }, - /*0221*/ { "khm", 586 }, - /*0222*/ { "kho", 222 }, - /*0223*/ { "kik", 582 }, - /*0224*/ { "kin", 640 }, - /*0225*/ { "kir", 594 }, - /*0226*/ { "kmb", 226 }, - /*0227*/ { "kok", 227 }, - /*0228*/ { "kom", 592 }, - /*0229*/ { "kon", 581 }, - /*0230*/ { "kor", 588 }, - /*0231*/ { "kos", 231 }, - /*0232*/ { "kpe", 232 }, - /*0233*/ { "krc", 233 }, - /*0234*/ { "krl", 234 }, - /*0235*/ { "kro", 235 }, - /*0236*/ { "kru", 236 }, - /*0237*/ { "kua", 583 }, - /*0238*/ { "kum", 238 }, - /*0239*/ { "kur", 591 }, - /*0240*/ { "kut", 240 }, - /*0241*/ { "lad", 241 }, - /*0242*/ { "lah", 242 }, - /*0243*/ { "lam", 243 }, - /*0244*/ { "lao", 600 }, - /*0245*/ { "lat", 595 }, - /*0246*/ { "lav", 603 }, - /*0247*/ { "lez", 247 }, - /*0248*/ { "lim", 598 }, - /*0249*/ { "lin", 599 }, - /*0250*/ { "lit", 601 }, - /*0251*/ { "lol", 251 }, - /*0252*/ { "loz", 252 }, - /*0253*/ { "ltz", 596 }, - /*0254*/ { "lua", 254 }, - /*0255*/ { "lub", 602 }, - /*0256*/ { "lug", 597 }, - /*0257*/ { "lui", 257 }, - /*0258*/ { "lun", 258 }, - /*0259*/ { "luo", 259 }, - /*0260*/ { "lus", 260 }, - /*0261*/ { "mac", 495 }, - /*0262*/ { "mad", 262 }, - /*0263*/ { "mag", 263 }, - /*0264*/ { "mah", 605 }, - /*0265*/ { "mai", 265 }, - /*0266*/ { "mak", 266 }, - /*0267*/ { "mal", 608 }, - /*0268*/ { "man", 268 }, - /*0269*/ { "mao", 496 }, - /*0270*/ { "map", 270 }, - /*0271*/ { "mar", 610 }, - /*0272*/ { "mas", 272 }, - /*0273*/ { "may", 497 }, - /*0274*/ { "mdf", 274 }, - /*0275*/ { "mdr", 275 }, - /*0276*/ { "men", 276 }, - /*0277*/ { "mga", 277 }, - /*0278*/ { "mic", 278 }, - /*0279*/ { "min", 279 }, - /*0280*/ { "mis", 280 }, - /*0281*/ { "mkh", 281 }, - /*0282*/ { "mlg", 604 }, - /*0283*/ { "mlt", 612 }, - /*0284*/ { "mnc", 284 }, - /*0285*/ { "mni", 285 }, - /*0286*/ { "mno", 286 }, - /*0287*/ { "moh", 287 }, - /*0288*/ { "mon", 609 }, - /*0289*/ { "mos", 289 }, - /*0290*/ { "mul", 290 }, - /*0291*/ { "mun", 291 }, - /*0292*/ { "mus", 292 }, - /*0293*/ { "mwl", 293 }, - /*0294*/ { "mwr", 294 }, - /*0295*/ { "myn", 295 }, - /*0296*/ { "myv", 296 }, - /*0297*/ { "nah", 297 }, - /*0298*/ { "nai", 298 }, - /*0299*/ { "nap", 299 }, - /*0300*/ { "nau", 614 }, - /*0301*/ { "nav", 623 }, - /*0302*/ { "nbl", 622 }, - /*0303*/ { "nde", 616 }, - /*0304*/ { "ndo", 618 }, - /*0305*/ { "nds", 305 }, - /*0306*/ { "nep", 617 }, - /*0307*/ { "new", 307 }, - /*0308*/ { "nia", 308 }, - /*0309*/ { "nic", 309 }, - /*0310*/ { "niu", 310 }, - /*0311*/ { "nno", 620 }, - /*0312*/ { "nob", 615 }, - /*0313*/ { "nog", 313 }, - /*0314*/ { "non", 314 }, - /*0315*/ { "nor", 621 }, - /*0316*/ { "nqo", 316 }, - /*0317*/ { "nso", 317 }, - /*0318*/ { "nub", 318 }, - /*0319*/ { "nwc", 319 }, - /*0320*/ { "nya", 624 }, - /*0321*/ { "nym", 321 }, - /*0322*/ { "nyn", 322 }, - /*0323*/ { "nyo", 323 }, - /*0324*/ { "nzi", 324 }, - /*0325*/ { "oci", 625 }, - /*0326*/ { "oji", 626 }, - /*0327*/ { "ori", 628 }, - /*0328*/ { "orm", 627 }, - /*0329*/ { "osa", 329 }, - /*0330*/ { "oss", 629 }, - /*0331*/ { "ota", 331 }, - /*0332*/ { "oto", 332 }, - /*0333*/ { "paa", 333 }, - /*0334*/ { "pag", 334 }, - /*0335*/ { "pal", 335 }, - /*0336*/ { "pam", 336 }, - /*0337*/ { "pan", 630 }, - /*0338*/ { "pap", 338 }, - /*0339*/ { "pau", 339 }, - /*0340*/ { "peo", 340 }, - /*0341*/ { "per", 490 }, - /*0342*/ { "phi", 342 }, - /*0343*/ { "phn", 343 }, - /*0344*/ { "pli", 631 }, - /*0345*/ { "pol", 632 }, - /*0346*/ { "pon", 346 }, - /*0347*/ { "por", 634 }, - /*0348*/ { "pra", 348 }, - /*0349*/ { "pro", 349 }, - /*0350*/ { "pus", 633 }, - /*0351*/ { "que", 635 }, - /*0352*/ { "raj", 352 }, - /*0353*/ { "rap", 353 }, - /*0354*/ { "rar", 354 }, - /*0355*/ { "roa", 355 }, - /*0356*/ { "roh", 636 }, - /*0357*/ { "rom", 357 }, - /*0358*/ { "rum", 500 }, - /*0359*/ { "run", 637 }, - /*0360*/ { "rup", 360 }, - /*0361*/ { "rus", 639 }, - /*0362*/ { "sad", 362 }, - /*0363*/ { "sag", 645 }, - /*0364*/ { "sah", 364 }, - /*0365*/ { "sai", 365 }, - /*0366*/ { "sal", 366 }, - /*0367*/ { "sam", 367 }, - /*0368*/ { "san", 641 }, - /*0369*/ { "sas", 369 }, - /*0370*/ { "sat", 370 }, - /*0371*/ { "scn", 371 }, - /*0372*/ { "sco", 372 }, - /*0373*/ { "sel", 373 }, - /*0374*/ { "sem", 374 }, - /*0375*/ { "sga", 375 }, - /*0376*/ { "sgn", 376 }, - /*0377*/ { "shn", 377 }, - /*0378*/ { "sid", 378 }, - /*0379*/ { "sin", 646 }, - /*0380*/ { "sio", 380 }, - /*0381*/ { "sit", 381 }, - /*0382*/ { "sla", 382 }, - /*0383*/ { "slo", 501 }, - /*0384*/ { "slv", 648 }, - /*0385*/ { "sma", 385 }, - /*0386*/ { "sme", 644 }, - /*0387*/ { "smi", 387 }, - /*0388*/ { "smj", 388 }, - /*0389*/ { "smn", 389 }, - /*0390*/ { "smo", 649 }, - /*0391*/ { "sms", 391 }, - /*0392*/ { "sna", 650 }, - /*0393*/ { "snd", 643 }, - /*0394*/ { "snk", 394 }, - /*0395*/ { "sog", 395 }, - /*0396*/ { "som", 651 }, - /*0397*/ { "son", 397 }, - /*0398*/ { "sot", 655 }, - /*0399*/ { "spa", 543 }, - /*0400*/ { "srd", 642 }, - /*0401*/ { "srn", 401 }, - /*0402*/ { "srp", 653 }, - /*0403*/ { "srr", 403 }, - /*0404*/ { "ssa", 404 }, - /*0405*/ { "ssw", 654 }, - /*0406*/ { "suk", 406 }, - /*0407*/ { "sun", 656 }, - /*0408*/ { "sus", 408 }, - /*0409*/ { "sux", 409 }, - /*0410*/ { "swa", 658 }, - /*0411*/ { "swe", 657 }, - /*0412*/ { "syc", 412 }, - /*0413*/ { "syr", 413 }, - /*0414*/ { "tah", 672 }, - /*0415*/ { "tai", 415 }, - /*0416*/ { "tam", 659 }, - /*0417*/ { "tat", 670 }, - /*0418*/ { "tel", 660 }, - /*0419*/ { "tem", 419 }, - /*0420*/ { "ter", 420 }, - /*0421*/ { "tet", 421 }, - /*0422*/ { "tgk", 661 }, - /*0423*/ { "tgl", 665 }, - /*0424*/ { "tha", 662 }, - /*0425*/ { "tib", 484 }, - /*0426*/ { "tig", 426 }, - /*0427*/ { "tir", 663 }, - /*0428*/ { "tiv", 428 }, - /*0429*/ { "tkl", 429 }, - /*0430*/ { "tlh", 430 }, - /*0431*/ { "tli", 431 }, - /*0432*/ { "tmh", 432 }, - /*0433*/ { "tog", 433 }, - /*0434*/ { "ton", 667 }, - /*0435*/ { "tpi", 435 }, - /*0436*/ { "tsi", 436 }, - /*0437*/ { "tsn", 666 }, - /*0438*/ { "tso", 669 }, - /*0439*/ { "tuk", 664 }, - /*0440*/ { "tum", 440 }, - /*0441*/ { "tup", 441 }, - /*0442*/ { "tur", 668 }, - /*0443*/ { "tut", 443 }, - /*0444*/ { "tvl", 444 }, - /*0445*/ { "twi", 671 }, - /*0446*/ { "tyv", 446 }, - /*0447*/ { "udm", 447 }, - /*0448*/ { "uga", 448 }, - /*0449*/ { "uig", 673 }, - /*0450*/ { "ukr", 674 }, - /*0451*/ { "umb", 451 }, - /*0452*/ { "und", 452 }, - /*0453*/ { "urd", 675 }, - /*0454*/ { "uzb", 676 }, - /*0455*/ { "vai", 455 }, - /*0456*/ { "ven", 677 }, - /*0457*/ { "vie", 678 }, - /*0458*/ { "vol", 679 }, - /*0459*/ { "vot", 459 }, - /*0460*/ { "wak", 460 }, - /*0461*/ { "wal", 461 }, - /*0462*/ { "war", 462 }, - /*0463*/ { "was", 463 }, - /*0464*/ { "wel", 486 }, - /*0465*/ { "wen", 465 }, - /*0466*/ { "wln", 680 }, - /*0467*/ { "wol", 681 }, - /*0468*/ { "xal", 468 }, - /*0469*/ { "xho", 682 }, - /*0470*/ { "yao", 470 }, - /*0471*/ { "yap", 471 }, - /*0472*/ { "yid", 683 }, - /*0473*/ { "yor", 684 }, - /*0474*/ { "ypk", 474 }, - /*0475*/ { "zap", 475 }, - /*0476*/ { "zbl", 476 }, - /*0477*/ { "zen", 477 }, - /*0478*/ { "zha", 685 }, - /*0479*/ { "znd", 479 }, - /*0480*/ { "zul", 687 }, - /*0481*/ { "zun", 481 }, - /*0482*/ { "zxx", 482 }, - /*0483*/ { "zza", 483 }, - /*----- AV_LANG_ISO639_2_TERM entries (20) -----*/ - /*0484*/ { "bod", 523 }, - /*0485*/ { "ces", 531 }, - /*0486*/ { "cym", 534 }, - /*0487*/ { "deu", 536 }, - /*0488*/ { "ell", 540 }, - /*0489*/ { "eus", 545 }, - /*0490*/ { "fas", 546 }, - /*0491*/ { "fra", 551 }, - /*0492*/ { "hye", 566 }, - /*0493*/ { "isl", 575 }, - /*0494*/ { "kat", 580 }, - /*0495*/ { "mkd", 607 }, - /*0496*/ { "mri", 606 }, - /*0497*/ { "msa", 611 }, - /*0498*/ { "mya", 613 }, - /*0499*/ { "nld", 619 }, - /*0500*/ { "ron", 638 }, - /*0501*/ { "slk", 647 }, - /*0502*/ { "sqi", 652 }, - /*0503*/ { "zho", 686 }, - /*----- AV_LANG_ISO639_1 entries (184) -----*/ - /*0504*/ { "aa" , 0 }, - /*0505*/ { "ab" , 1 }, - /*0506*/ { "ae" , 33 }, - /*0507*/ { "af" , 8 }, - /*0508*/ { "ak" , 10 }, - /*0509*/ { "am" , 16 }, - /*0510*/ { "an" , 22 }, - /*0511*/ { "ar" , 20 }, - /*0512*/ { "as" , 28 }, - /*0513*/ { "av" , 32 }, - /*0514*/ { "ay" , 35 }, - /*0515*/ { "az" , 36 }, - /*0516*/ { "ba" , 39 }, - /*0517*/ { "be" , 47 }, - /*0518*/ { "bg" , 64 }, - /*0519*/ { "bh" , 52 }, - /*0520*/ { "bi" , 55 }, - /*0521*/ { "bm" , 41 }, - /*0522*/ { "bn" , 49 }, - /*0523*/ { "bo" , 425 }, - /*0524*/ { "br" , 60 }, - /*0525*/ { "bs" , 58 }, - /*0526*/ { "ca" , 70 }, - /*0527*/ { "ce" , 76 }, - /*0528*/ { "ch" , 74 }, - /*0529*/ { "co" , 91 }, - /*0530*/ { "cr" , 95 }, - /*0531*/ { "cs" , 100 }, - /*0532*/ { "cu" , 85 }, - /*0533*/ { "cv" , 86 }, - /*0534*/ { "cy" , 464 }, - /*0535*/ { "da" , 102 }, - /*0536*/ { "de" , 149 }, - /*0537*/ { "dv" , 109 }, - /*0538*/ { "dz" , 117 }, - /*0539*/ { "ee" , 126 }, - /*0540*/ { "el" , 163 }, - /*0541*/ { "en" , 122 }, - /*0542*/ { "eo" , 124 }, - /*0543*/ { "es" , 399 }, - /*0544*/ { "et" , 125 }, - /*0545*/ { "eu" , 43 }, - /*0546*/ { "fa" , 341 }, - /*0547*/ { "ff" , 142 }, - /*0548*/ { "fi" , 133 }, - /*0549*/ { "fj" , 131 }, - /*0550*/ { "fo" , 129 }, - /*0551*/ { "fr" , 136 }, - /*0552*/ { "fy" , 141 }, - /*0553*/ { "ga" , 153 }, - /*0554*/ { "gd" , 152 }, - /*0555*/ { "gl" , 154 }, - /*0556*/ { "gn" , 164 }, - /*0557*/ { "gu" , 166 }, - /*0558*/ { "gv" , 155 }, - /*0559*/ { "ha" , 170 }, - /*0560*/ { "he" , 172 }, - /*0561*/ { "hi" , 176 }, - /*0562*/ { "ho" , 179 }, - /*0563*/ { "hr" , 180 }, - /*0564*/ { "ht" , 169 }, - /*0565*/ { "hu" , 182 }, - /*0566*/ { "hy" , 23 }, - /*0567*/ { "hz" , 173 }, - /*0568*/ { "ia" , 193 }, - /*0569*/ { "id" , 195 }, - /*0570*/ { "ie" , 191 }, - /*0571*/ { "ig" , 185 }, - /*0572*/ { "ii" , 188 }, - /*0573*/ { "ik" , 198 }, - /*0574*/ { "io" , 187 }, - /*0575*/ { "is" , 186 }, - /*0576*/ { "it" , 201 }, - /*0577*/ { "iu" , 190 }, - /*0578*/ { "ja" , 204 }, - /*0579*/ { "jv" , 202 }, - /*0580*/ { "ka" , 148 }, - /*0581*/ { "kg" , 229 }, - /*0582*/ { "ki" , 223 }, - /*0583*/ { "kj" , 237 }, - /*0584*/ { "kk" , 217 }, - /*0585*/ { "kl" , 210 }, - /*0586*/ { "km" , 221 }, - /*0587*/ { "kn" , 212 }, - /*0588*/ { "ko" , 230 }, - /*0589*/ { "kr" , 215 }, - /*0590*/ { "ks" , 214 }, - /*0591*/ { "ku" , 239 }, - /*0592*/ { "kv" , 228 }, - /*0593*/ { "kw" , 90 }, - /*0594*/ { "ky" , 225 }, - /*0595*/ { "la" , 245 }, - /*0596*/ { "lb" , 253 }, - /*0597*/ { "lg" , 256 }, - /*0598*/ { "li" , 248 }, - /*0599*/ { "ln" , 249 }, - /*0600*/ { "lo" , 244 }, - /*0601*/ { "lt" , 250 }, - /*0602*/ { "lu" , 255 }, - /*0603*/ { "lv" , 246 }, - /*0604*/ { "mg" , 282 }, - /*0605*/ { "mh" , 264 }, - /*0606*/ { "mi" , 269 }, - /*0607*/ { "mk" , 261 }, - /*0608*/ { "ml" , 267 }, - /*0609*/ { "mn" , 288 }, - /*0610*/ { "mr" , 271 }, - /*0611*/ { "ms" , 273 }, - /*0612*/ { "mt" , 283 }, - /*0613*/ { "my" , 65 }, - /*0614*/ { "na" , 300 }, - /*0615*/ { "nb" , 312 }, - /*0616*/ { "nd" , 303 }, - /*0617*/ { "ne" , 306 }, - /*0618*/ { "ng" , 304 }, - /*0619*/ { "nl" , 115 }, - /*0620*/ { "nn" , 311 }, - /*0621*/ { "no" , 315 }, - /*0622*/ { "nr" , 302 }, - /*0623*/ { "nv" , 301 }, - /*0624*/ { "ny" , 320 }, - /*0625*/ { "oc" , 325 }, - /*0626*/ { "oj" , 326 }, - /*0627*/ { "om" , 328 }, - /*0628*/ { "or" , 327 }, - /*0629*/ { "os" , 330 }, - /*0630*/ { "pa" , 337 }, - /*0631*/ { "pi" , 344 }, - /*0632*/ { "pl" , 345 }, - /*0633*/ { "ps" , 350 }, - /*0634*/ { "pt" , 347 }, - /*0635*/ { "qu" , 351 }, - /*0636*/ { "rm" , 356 }, - /*0637*/ { "rn" , 359 }, - /*0638*/ { "ro" , 358 }, - /*0639*/ { "ru" , 361 }, - /*0640*/ { "rw" , 224 }, - /*0641*/ { "sa" , 368 }, - /*0642*/ { "sc" , 400 }, - /*0643*/ { "sd" , 393 }, - /*0644*/ { "se" , 386 }, - /*0645*/ { "sg" , 363 }, - /*0646*/ { "si" , 379 }, - /*0647*/ { "sk" , 383 }, - /*0648*/ { "sl" , 384 }, - /*0649*/ { "sm" , 390 }, - /*0650*/ { "sn" , 392 }, - /*0651*/ { "so" , 396 }, - /*0652*/ { "sq" , 12 }, - /*0653*/ { "sr" , 402 }, - /*0654*/ { "ss" , 405 }, - /*0655*/ { "st" , 398 }, - /*0656*/ { "su" , 407 }, - /*0657*/ { "sv" , 411 }, - /*0658*/ { "sw" , 410 }, - /*0659*/ { "ta" , 416 }, - /*0660*/ { "te" , 418 }, - /*0661*/ { "tg" , 422 }, - /*0662*/ { "th" , 424 }, - /*0663*/ { "ti" , 427 }, - /*0664*/ { "tk" , 439 }, - /*0665*/ { "tl" , 423 }, - /*0666*/ { "tn" , 437 }, - /*0667*/ { "to" , 434 }, - /*0668*/ { "tr" , 442 }, - /*0669*/ { "ts" , 438 }, - /*0670*/ { "tt" , 417 }, - /*0671*/ { "tw" , 445 }, - /*0672*/ { "ty" , 414 }, - /*0673*/ { "ug" , 449 }, - /*0674*/ { "uk" , 450 }, - /*0675*/ { "ur" , 453 }, - /*0676*/ { "uz" , 454 }, - /*0677*/ { "ve" , 456 }, - /*0678*/ { "vi" , 457 }, - /*0679*/ { "vo" , 458 }, - /*0680*/ { "wa" , 466 }, - /*0681*/ { "wo" , 467 }, - /*0682*/ { "xh" , 469 }, - /*0683*/ { "yi" , 472 }, - /*0684*/ { "yo" , 473 }, - /*0685*/ { "za" , 478 }, - /*0686*/ { "zh" , 78 }, - /*0687*/ { "zu" , 480 }, - { "", 0 } -}; - -static int lang_table_compare(const void *lhs, const void *rhs) -{ - return strcmp(lhs, ((const LangEntry *)rhs)->str); -} - -const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace) -{ - int i; - const LangEntry *entry = NULL; - const int NB_CODESPACES = FF_ARRAY_ELEMS(lang_table_counts); - - if (target_codespace >= NB_CODESPACES) - return NULL; - - for (i=0; !entry && i= lang_table + lang_table_offsets[target_codespace] && - entry < lang_table + lang_table_offsets[target_codespace] + lang_table_counts[target_codespace]) - return entry->str; - else - entry = lang_table + entry->next_equivalent; - - if (target_codespace == AV_LANG_ISO639_2_TERM) - return av_convert_lang_to(lang, AV_LANG_ISO639_2_BIBL); - - return NULL; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.h deleted file mode 100644 index 7fb896881..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avlanguage.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Cyril Comparon, Larbi Joubala, Resonate-MP4 2009 - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_AVLANGUAGE_H -#define AVFORMAT_AVLANGUAGE_H - -/** - * Known language codespaces - */ -enum AVLangCodespace { - AV_LANG_ISO639_2_BIBL, /** 3-char bibliographic language codes as per ISO-IEC 639-2 */ - AV_LANG_ISO639_2_TERM, /** 3-char terminologic language codes as per ISO-IEC 639-2 */ - AV_LANG_ISO639_1 /** 2-char code of language as per ISO/IEC 639-1 */ -}; - -/** - * Convert a language code to a target codespace. The source codespace is guessed. - * @return NULL if the provided lang is null or invalid. - */ -const char *av_convert_lang_to(const char *lang, enum AVLangCodespace target_codespace); - -#endif /* AVFORMAT_AVLANGUAGE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/cutils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/cutils.c deleted file mode 100644 index 0458a2dc7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/cutils.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * various simple utilities for libavformat - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "avformat.h" -#include "internal.h" - -#define ISLEAP(y) (((y) % 4 == 0) && (((y) % 100) != 0 || ((y) % 400) == 0)) -#define LEAPS_COUNT(y) ((y)/4 - (y)/100 + (y)/400) - -/* This is our own gmtime_r. It differs from its POSIX counterpart in a - couple of places, though. */ -struct tm *ff_brktimegm(time_t secs, struct tm *tm) -{ - int days, y, ny, m; - int md[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; - - days = secs / 86400; - secs %= 86400; - tm->tm_hour = secs / 3600; - tm->tm_min = (secs % 3600) / 60; - tm->tm_sec = secs % 60; - - /* oh well, may be someone some day will invent a formula for this stuff */ - y = 1970; /* start "guessing" */ - while (days > 365) { - ny = (y + days/366); - days -= (ny - y) * 365 + LEAPS_COUNT(ny - 1) - LEAPS_COUNT(y - 1); - y = ny; - } - if (days==365 && !ISLEAP(y)) { days=0; y++; } - md[1] = ISLEAP(y)?29:28; - for (m=0; days >= md[m]; m++) - days -= md[m]; - - tm->tm_year = y; /* unlike gmtime_r we store complete year here */ - tm->tm_mon = m+1; /* unlike gmtime_r tm_mon is from 1 to 12 */ - tm->tm_mday = days+1; - - return tm; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtsdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtsdec.c deleted file mode 100644 index c395d2238..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtsdec.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * RAW DTS demuxer - * Copyright (c) 2008 Benjamin Larsson - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavcodec/bytestream.h" -#include "avformat.h" -#include "rawdec.h" - -#define DCA_MARKER_14B_BE 0x1FFFE800 -#define DCA_MARKER_14B_LE 0xFF1F00E8 -#define DCA_MARKER_RAW_BE 0x7FFE8001 -#define DCA_MARKER_RAW_LE 0xFE7F0180 - -static int dts_probe(AVProbeData *p) -{ - const uint8_t *buf, *bufp; - uint32_t state = -1; - int markers[3] = {0}; - int sum, max; - int64_t diff = 0; - - buf = p->buf; - - for(; buf < (p->buf+p->buf_size)-2; buf+=2) { - bufp = buf; - state = (state << 16) | bytestream_get_be16(&bufp); - - /* regular bitstream */ - if (state == DCA_MARKER_RAW_BE || state == DCA_MARKER_RAW_LE) - markers[0]++; - - /* 14 bits big-endian bitstream */ - if (state == DCA_MARKER_14B_BE) - if ((bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0) - markers[1]++; - - /* 14 bits little-endian bitstream */ - if (state == DCA_MARKER_14B_LE) - if ((bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) - markers[2]++; - - if (buf - p->buf >= 4) - diff += FFABS(AV_RL16(buf) - AV_RL16(buf-4)); - } - sum = markers[0] + markers[1] + markers[2]; - max = markers[1] > markers[0]; - max = markers[2] > markers[max] ? 2 : max; - if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && - markers[max] * 4 > sum * 3 && - diff / p->buf_size > 200) - return AVPROBE_SCORE_EXTENSION + 1; - - return 0; -} - -AVInputFormat ff_dts_demuxer = { - .name = "dts", - .long_name = "raw DTS", - .read_probe = dts_probe, - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "dts", - .raw_codec_id = AV_CODEC_ID_DTS, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtshddec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtshddec.c deleted file mode 100644 index 8581bf35b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dtshddec.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Raw DTS-HD demuxer - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/intreadwrite.h" -#include "libavutil/dict.h" -#include "avformat.h" - -#define AUPR_HDR 0x415550522D484452 -#define AUPRINFO 0x41555052494E464F -#define BITSHVTB 0x4249545348565442 -#define BLACKOUT 0x424C41434B4F5554 -#define BRANCHPT 0x4252414E43485054 -#define BUILDVER 0x4255494C44564552 -#define CORESSMD 0x434F524553534D44 -#define DTSHDHDR 0x4454534844484452 -#define EXTSS_MD 0x45585453535f4d44 -#define FILEINFO 0x46494C45494E464F -#define NAVI_TBL 0x4E4156492D54424C -#define STRMDATA 0x5354524D44415441 -#define TIMECODE 0x54494D45434F4445 - -typedef struct DTSHDDemuxContext { - uint64_t data_end; -} DTSHDDemuxContext; - -static int dtshd_probe(AVProbeData *p) -{ - if (AV_RB64(p->buf) == DTSHDHDR) - return AVPROBE_SCORE_MAX; - return 0; -} - -static int dtshd_read_header(AVFormatContext *s) -{ - DTSHDDemuxContext *dtshd = s->priv_data; - AVIOContext *pb = s->pb; - uint64_t chunk_type, chunk_size; - AVStream *st; - int ret; - char *value; - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_DTS; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - while (!url_feof(pb)) { - chunk_type = avio_rb64(pb); - chunk_size = avio_rb64(pb); - - if (chunk_size < 4) { - av_log(s, AV_LOG_ERROR, "chunk size too small\n"); - return AVERROR_INVALIDDATA; - } - if (chunk_size > ((uint64_t)1 << 61)) { - av_log(s, AV_LOG_ERROR, "chunk size too big\n"); - return AVERROR_INVALIDDATA; - } - - switch (chunk_type) { - case STRMDATA: - dtshd->data_end = chunk_size + avio_tell(pb); - if (dtshd->data_end <= chunk_size) - return AVERROR_INVALIDDATA; - return 0; - break; - case FILEINFO: - if (chunk_size > INT_MAX) - goto skip; - value = av_malloc(chunk_size); - if (!value) - goto skip; - avio_read(pb, (unsigned char *)value, chunk_size); - value[chunk_size - 1] = 0; - av_dict_set(&s->metadata, "fileinfo", value, - AV_DICT_DONT_STRDUP_VAL); - break; - default: -skip: - ret = avio_skip(pb, chunk_size); - if (ret < 0) - return ret; - }; - } - - return AVERROR_EOF; -} - -static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - DTSHDDemuxContext *dtshd = s->priv_data; - int64_t size, left; - int ret; - - left = dtshd->data_end - avio_tell(s->pb); - size = FFMIN(left, 1024); - if (size <= 0) - return AVERROR_EOF; - - ret = av_get_packet(s->pb, pkt, size); - if (ret < 0) - return ret; - - pkt->stream_index = 0; - - return ret; -} - -AVInputFormat ff_dtshd_demuxer = { - .name = "dtshd", - .long_name = "raw DTS-HD", - .priv_data_size = sizeof(DTSHDDemuxContext), - .read_probe = dtshd_probe, - .read_header = dtshd_read_header, - .read_packet = raw_read_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "dtshd", - .raw_codec_id = AV_CODEC_ID_DTS, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.c deleted file mode 100644 index e3b0d0a31..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.c +++ /dev/null @@ -1,631 +0,0 @@ -/* - * General DV muxer/demuxer - * Copyright (c) 2003 Roman Shaposhnik - * - * Many thanks to Dan Dennedy for providing wealth - * of DV technical info. - * - * Raw DV format - * Copyright (c) 2002 Fabrice Bellard - * - * 50 Mbps (DVCPRO50) and 100 Mbps (DVCPRO HD) support - * Copyright (c) 2006 Daniel Maas - * Funded by BBC Research & Development - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -#include "avformat.h" -#include "internal.h" -#include "libavcodec/dv_profile.h" -#include "libavcodec/dvdata.h" -#include "libavutil/channel_layout.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/mathematics.h" -#include "libavutil/timecode.h" -#include "dv.h" -#include "libavutil/avassert.h" - -struct DVDemuxContext { - const DVprofile* sys; /* Current DV profile. E.g.: 525/60, 625/50 */ - AVFormatContext* fctx; - AVStream* vst; - AVStream* ast[4]; - AVPacket audio_pkt[4]; - uint8_t audio_buf[4][8192]; - int ach; - int frames; - uint64_t abytes; -}; - -static inline uint16_t dv_audio_12to16(uint16_t sample) -{ - uint16_t shift, result; - - sample = (sample < 0x800) ? sample : sample | 0xf000; - shift = (sample & 0xf00) >> 8; - - if (shift < 0x2 || shift > 0xd) { - result = sample; - } else if (shift < 0x8) { - shift--; - result = (sample - (256 * shift)) << shift; - } else { - shift = 0xe - shift; - result = ((sample + ((256 * shift) + 1)) << shift) - 1; - } - - return result; -} - -/* - * This is the dumbest implementation of all -- it simply looks at - * a fixed offset and if pack isn't there -- fails. We might want - * to have a fallback mechanism for complete search of missing packs. - */ -static const uint8_t *dv_extract_pack(uint8_t *frame, enum dv_pack_type t) -{ - int offs; - - switch (t) { - case dv_audio_source: - offs = (80 * 6 + 80 * 16 * 3 + 3); - break; - case dv_audio_control: - offs = (80 * 6 + 80 * 16 * 4 + 3); - break; - case dv_video_control: - offs = (80 * 5 + 48 + 5); - break; - case dv_timecode: - offs = (80*1 + 3 + 3); - break; - default: - return NULL; - } - - return frame[offs] == t ? &frame[offs] : NULL; -} - -static const int dv_audio_frequency[3] = { - 48000, 44100, 32000, -}; - -/* - * There's a couple of assumptions being made here: - * 1. By default we silence erroneous (0x8000/16bit 0x800/12bit) audio samples. - * We can pass them upwards when libavcodec will be ready to deal with them. - * 2. We don't do software emphasis. - * 3. Audio is always returned as 16bit linear samples: 12bit nonlinear samples - * are converted into 16bit linear ones. - */ -static int dv_extract_audio(uint8_t *frame, uint8_t **ppcm, - const DVprofile *sys) -{ - int size, chan, i, j, d, of, smpls, freq, quant, half_ch; - uint16_t lc, rc; - const uint8_t *as_pack; - uint8_t *pcm, ipcm; - - as_pack = dv_extract_pack(frame, dv_audio_source); - if (!as_pack) /* No audio ? */ - return 0; - - smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ - freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */ - quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ - - if (quant > 1) - return -1; /* unsupported quantization */ - - if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) - return AVERROR_INVALIDDATA; - - size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ - half_ch = sys->difseg_size / 2; - - /* We work with 720p frames split in half, thus even frames have - * channels 0,1 and odd 2,3. */ - ipcm = (sys->height == 720 && !(frame[1] & 0x0C)) ? 2 : 0; - - if (ipcm + sys->n_difchan > (quant == 1 ? 2 : 4)) { - av_log(NULL, AV_LOG_ERROR, "too many dv pcm frames\n"); - return AVERROR_INVALIDDATA; - } - - /* for each DIF channel */ - for (chan = 0; chan < sys->n_difchan; chan++) { - av_assert0(ipcm<4); - pcm = ppcm[ipcm++]; - if (!pcm) - break; - - /* for each DIF segment */ - for (i = 0; i < sys->difseg_size; i++) { - frame += 6 * 80; /* skip DIF segment header */ - if (quant == 1 && i == half_ch) { - /* next stereo channel (12bit mode only) */ - av_assert0(ipcm<4); - pcm = ppcm[ipcm++]; - if (!pcm) - break; - } - - /* for each AV sequence */ - for (j = 0; j < 9; j++) { - for (d = 8; d < 80; d += 2) { - if (quant == 0) { /* 16bit quantization */ - of = sys->audio_shuffle[i][j] + - (d - 8) / 2 * sys->audio_stride; - if (of * 2 >= size) - continue; - - /* FIXME: maybe we have to admit that DV is a - * big-endian PCM */ - pcm[of * 2] = frame[d + 1]; - pcm[of * 2 + 1] = frame[d]; - - if (pcm[of * 2 + 1] == 0x80 && pcm[of * 2] == 0x00) - pcm[of * 2 + 1] = 0; - } else { /* 12bit quantization */ - lc = ((uint16_t)frame[d] << 4) | - ((uint16_t)frame[d + 2] >> 4); - rc = ((uint16_t)frame[d + 1] << 4) | - ((uint16_t)frame[d + 2] & 0x0f); - lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc)); - rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc)); - - of = sys->audio_shuffle[i % half_ch][j] + - (d - 8) / 3 * sys->audio_stride; - if (of * 2 >= size) - continue; - - /* FIXME: maybe we have to admit that DV is a - * big-endian PCM */ - pcm[of * 2] = lc & 0xff; - pcm[of * 2 + 1] = lc >> 8; - of = sys->audio_shuffle[i % half_ch + half_ch][j] + - (d - 8) / 3 * sys->audio_stride; - /* FIXME: maybe we have to admit that DV is a - * big-endian PCM */ - pcm[of * 2] = rc & 0xff; - pcm[of * 2 + 1] = rc >> 8; - ++d; - } - } - - frame += 16 * 80; /* 15 Video DIFs + 1 Audio DIF */ - } - } - } - - return size; -} - -static int dv_extract_audio_info(DVDemuxContext *c, uint8_t *frame) -{ - const uint8_t *as_pack; - int freq, stype, smpls, quant, i, ach; - - as_pack = dv_extract_pack(frame, dv_audio_source); - if (!as_pack || !c->sys) { /* No audio ? */ - c->ach = 0; - return 0; - } - - smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */ - freq = as_pack[4] >> 3 & 0x07; /* 0 - 48kHz, 1 - 44,1kHz, 2 - 32kHz */ - stype = as_pack[3] & 0x1f; /* 0 - 2CH, 2 - 4CH, 3 - 8CH */ - quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */ - - if (freq >= FF_ARRAY_ELEMS(dv_audio_frequency)) { - av_log(c->fctx, AV_LOG_ERROR, - "Unrecognized audio sample rate index (%d)\n", freq); - return 0; - } - - if (stype > 3) { - av_log(c->fctx, AV_LOG_ERROR, "stype %d is invalid\n", stype); - c->ach = 0; - return 0; - } - - /* note: ach counts PAIRS of channels (i.e. stereo channels) */ - ach = ((int[4]) { 1, 0, 2, 4 })[stype]; - if (ach == 1 && quant && freq == 2) - ach = 2; - - /* Dynamic handling of the audio streams in DV */ - for (i = 0; i < ach; i++) { - if (!c->ast[i]) { - c->ast[i] = avformat_new_stream(c->fctx, NULL); - if (!c->ast[i]) - break; - avpriv_set_pts_info(c->ast[i], 64, 1, 30000); - c->ast[i]->codec->codec_type = AVMEDIA_TYPE_AUDIO; - c->ast[i]->codec->codec_id = AV_CODEC_ID_PCM_S16LE; - - av_init_packet(&c->audio_pkt[i]); - c->audio_pkt[i].size = 0; - c->audio_pkt[i].data = c->audio_buf[i]; - c->audio_pkt[i].stream_index = c->ast[i]->index; - c->audio_pkt[i].flags |= AV_PKT_FLAG_KEY; - } - c->ast[i]->codec->sample_rate = dv_audio_frequency[freq]; - c->ast[i]->codec->channels = 2; - c->ast[i]->codec->channel_layout = AV_CH_LAYOUT_STEREO; - c->ast[i]->codec->bit_rate = 2 * dv_audio_frequency[freq] * 16; - c->ast[i]->start_time = 0; - } - c->ach = i; - - return (c->sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */ -} - -static int dv_extract_video_info(DVDemuxContext *c, uint8_t *frame) -{ - const uint8_t *vsc_pack; - AVCodecContext *avctx; - int apt, is16_9; - int size = 0; - - if (c->sys) { - avctx = c->vst->codec; - - avpriv_set_pts_info(c->vst, 64, c->sys->time_base.num, - c->sys->time_base.den); - avctx->time_base = c->sys->time_base; - - /* finding out SAR is a little bit messy */ - vsc_pack = dv_extract_pack(frame, dv_video_control); - apt = frame[4] & 0x07; - is16_9 = (vsc_pack && ((vsc_pack[2] & 0x07) == 0x02 || - (!apt && (vsc_pack[2] & 0x07) == 0x07))); - c->vst->sample_aspect_ratio = c->sys->sar[is16_9]; - avctx->bit_rate = av_rescale_q(c->sys->frame_size, - (AVRational) { 8, 1 }, - c->sys->time_base); - size = c->sys->frame_size; - } - return size; -} - -static int dv_extract_timecode(DVDemuxContext* c, uint8_t* frame, char *tc) -{ - const uint8_t *tc_pack; - - // For PAL systems, drop frame bit is replaced by an arbitrary - // bit so its value should not be considered. Drop frame timecode - // is only relevant for NTSC systems. - int prevent_df = c->sys->ltc_divisor == 25 || c->sys->ltc_divisor == 50; - - tc_pack = dv_extract_pack(frame, dv_timecode); - if (!tc_pack) - return 0; - av_timecode_make_smpte_tc_string(tc, AV_RB32(tc_pack + 1), prevent_df); - return 1; -} - -/* The following 3 functions constitute our interface to the world */ - -DVDemuxContext *avpriv_dv_init_demux(AVFormatContext *s) -{ - DVDemuxContext *c; - - c = av_mallocz(sizeof(DVDemuxContext)); - if (!c) - return NULL; - - c->vst = avformat_new_stream(s, NULL); - if (!c->vst) { - av_free(c); - return NULL; - } - - c->fctx = s; - c->vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; - c->vst->codec->codec_id = AV_CODEC_ID_DVVIDEO; - c->vst->codec->bit_rate = 25000000; - c->vst->start_time = 0; - - return c; -} - -int avpriv_dv_get_packet(DVDemuxContext *c, AVPacket *pkt) -{ - int size = -1; - int i; - - for (i = 0; i < c->ach; i++) { - if (c->ast[i] && c->audio_pkt[i].size) { - *pkt = c->audio_pkt[i]; - c->audio_pkt[i].size = 0; - size = pkt->size; - break; - } - } - - return size; -} - -int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, - uint8_t *buf, int buf_size, int64_t pos) -{ - int size, i; - uint8_t *ppcm[5] = { 0 }; - - if (buf_size < DV_PROFILE_BYTES || - !(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) || - buf_size < c->sys->frame_size) { - return -1; /* Broken frame, or not enough data */ - } - - /* Queueing audio packet */ - /* FIXME: in case of no audio/bad audio we have to do something */ - size = dv_extract_audio_info(c, buf); - for (i = 0; i < c->ach; i++) { - c->audio_pkt[i].pos = pos; - c->audio_pkt[i].size = size; - c->audio_pkt[i].pts = c->abytes * 30000 * 8 / - c->ast[i]->codec->bit_rate; - ppcm[i] = c->audio_buf[i]; - } - if (c->ach) - dv_extract_audio(buf, ppcm, c->sys); - - /* We work with 720p frames split in half, thus even frames have - * channels 0,1 and odd 2,3. */ - if (c->sys->height == 720) { - if (buf[1] & 0x0C) { - c->audio_pkt[2].size = c->audio_pkt[3].size = 0; - } else { - c->audio_pkt[0].size = c->audio_pkt[1].size = 0; - c->abytes += size; - } - } else { - c->abytes += size; - } - - /* Now it's time to return video packet */ - size = dv_extract_video_info(c, buf); - av_init_packet(pkt); - pkt->data = buf; - pkt->pos = pos; - pkt->size = size; - pkt->flags |= AV_PKT_FLAG_KEY; - pkt->stream_index = c->vst->index; - pkt->pts = c->frames; - - c->frames++; - - return size; -} - -static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, - int64_t timestamp, int flags) -{ - // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk) - const DVprofile *sys = avpriv_dv_codec_profile(c->vst->codec); - int64_t offset; - int64_t size = avio_size(s->pb) - s->data_offset; - int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size; - - offset = sys->frame_size * timestamp; - - if (size >= 0 && offset > max_offset) - offset = max_offset; - else if (offset < 0) - offset = 0; - - return offset + s->data_offset; -} - -void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset) -{ - c->frames = frame_offset; - if (c->ach) { - if (c->sys) { - c->abytes = av_rescale_q(c->frames, c->sys->time_base, - (AVRational) { 8, c->ast[0]->codec->bit_rate }); - } else - av_log(c->fctx, AV_LOG_ERROR, "cannot adjust audio bytes\n"); - } - c->audio_pkt[0].size = c->audio_pkt[1].size = 0; - c->audio_pkt[2].size = c->audio_pkt[3].size = 0; -} - -/************************************************************ - * Implementation of the easiest DV storage of all -- raw DV. - ************************************************************/ - -typedef struct RawDVContext { - DVDemuxContext *dv_demux; - uint8_t buf[DV_MAX_FRAME_SIZE]; -} RawDVContext; - -static int dv_read_timecode(AVFormatContext *s) { - int ret; - char timecode[AV_TIMECODE_STR_SIZE]; - int64_t pos = avio_tell(s->pb); - - // Read 3 DIF blocks: Header block and 2 Subcode blocks. - int partial_frame_size = 3 * 80; - uint8_t *partial_frame = av_mallocz(sizeof(*partial_frame) * - partial_frame_size); - - RawDVContext *c = s->priv_data; - ret = avio_read(s->pb, partial_frame, partial_frame_size); - if (ret < 0) - goto finish; - - if (ret < partial_frame_size) { - ret = -1; - goto finish; - } - - ret = dv_extract_timecode(c->dv_demux, partial_frame, timecode); - if (ret) - av_dict_set(&s->metadata, "timecode", timecode, 0); - else - av_log(s, AV_LOG_ERROR, "Detected timecode is invalid\n"); - -finish: - av_free(partial_frame); - avio_seek(s->pb, pos, SEEK_SET); - return ret; -} - -static int dv_read_header(AVFormatContext *s) -{ - unsigned state, marker_pos = 0; - RawDVContext *c = s->priv_data; - - c->dv_demux = avpriv_dv_init_demux(s); - if (!c->dv_demux) - return -1; - - state = avio_rb32(s->pb); - while ((state & 0xffffff7f) != 0x1f07003f) { - if (url_feof(s->pb)) { - av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n"); - return -1; - } - if (state == 0x003f0700 || state == 0xff3f0700) - marker_pos = avio_tell(s->pb); - if (state == 0xff3f0701 && avio_tell(s->pb) - marker_pos == 80) { - avio_seek(s->pb, -163, SEEK_CUR); - state = avio_rb32(s->pb); - break; - } - state = (state << 8) | avio_r8(s->pb); - } - AV_WB32(c->buf, state); - - if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) != DV_PROFILE_BYTES - 4 || - avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) - return AVERROR(EIO); - - c->dv_demux->sys = avpriv_dv_frame_profile(c->dv_demux->sys, - c->buf, - DV_PROFILE_BYTES); - if (!c->dv_demux->sys) { - av_log(s, AV_LOG_ERROR, - "Can't determine profile of DV input stream.\n"); - return -1; - } - - s->bit_rate = av_rescale_q(c->dv_demux->sys->frame_size, - (AVRational) { 8, 1 }, - c->dv_demux->sys->time_base); - - if (s->pb->seekable) - dv_read_timecode(s); - - return 0; -} - -static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int size; - RawDVContext *c = s->priv_data; - - size = avpriv_dv_get_packet(c->dv_demux, pkt); - - if (size < 0) { - int64_t pos = avio_tell(s->pb); - if (!c->dv_demux->sys) - return AVERROR(EIO); - size = c->dv_demux->sys->frame_size; - if (avio_read(s->pb, c->buf, size) <= 0) - return AVERROR(EIO); - - size = avpriv_dv_produce_packet(c->dv_demux, pkt, c->buf, size, pos); - } - - return size; -} - -static int dv_read_seek(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - RawDVContext *r = s->priv_data; - DVDemuxContext *c = r->dv_demux; - int64_t offset = dv_frame_offset(s, c, timestamp, flags); - - if (avio_seek(s->pb, offset, SEEK_SET) < 0) - return -1; - - ff_dv_offset_reset(c, offset / c->sys->frame_size); - return 0; -} - -static int dv_read_close(AVFormatContext *s) -{ - RawDVContext *c = s->priv_data; - av_free(c->dv_demux); - return 0; -} - -static int dv_probe(AVProbeData *p) -{ - unsigned state, marker_pos = 0; - int i; - int matches = 0; - int secondary_matches = 0; - - if (p->buf_size < 5) - return 0; - - state = AV_RB32(p->buf); - for (i = 4; i < p->buf_size; i++) { - if ((state & 0xffffff7f) == 0x1f07003f) - matches++; - // any section header, also with seq/chan num != 0, - // should appear around every 12000 bytes, at least 10 per frame - if ((state & 0xff07ff7f) == 0x1f07003f) - secondary_matches++; - if (state == 0x003f0700 || state == 0xff3f0700) - marker_pos = i; - if (state == 0xff3f0701 && i - marker_pos == 80) - matches++; - state = (state << 8) | p->buf[i]; - } - - if (matches && p->buf_size / matches < 1024 * 1024) { - if (matches > 4 || - (secondary_matches >= 10 && - p->buf_size / secondary_matches < 24000)) - // not max to avoid dv in mov to match - return AVPROBE_SCORE_MAX * 3 / 4; - return AVPROBE_SCORE_MAX / 4; - } - return 0; -} - -#if CONFIG_DV_DEMUXER -AVInputFormat ff_dv_demuxer = { - .name = "dv", - .long_name = NULL_IF_CONFIG_SMALL("DV (Digital Video)"), - .priv_data_size = sizeof(RawDVContext), - .read_probe = dv_probe, - .read_header = dv_read_header, - .read_packet = dv_read_packet, - .read_close = dv_read_close, - .read_seek = dv_read_seek, - .extensions = "dv,dif", -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.h deleted file mode 100644 index 160c6ab87..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/dv.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * General DV muxer/demuxer - * Copyright (c) 2003 Roman Shaposhnik - * - * Many thanks to Dan Dennedy for providing wealth - * of DV technical info. - * - * Raw DV format - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_DV_H -#define AVFORMAT_DV_H - -#include "avformat.h" - -typedef struct DVDemuxContext DVDemuxContext; -DVDemuxContext* avpriv_dv_init_demux(AVFormatContext* s); -int avpriv_dv_get_packet(DVDemuxContext*, AVPacket *); -int avpriv_dv_produce_packet(DVDemuxContext*, AVPacket*, uint8_t*, int, int64_t); -void ff_dv_offset_reset(DVDemuxContext *c, int64_t frame_offset); - -typedef struct DVMuxContext DVMuxContext; - -#endif /* AVFORMAT_DV_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/file.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/file.c deleted file mode 100644 index 2defc75e5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/file.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * buffered file I/O - * Copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avstring.h" -#include "libavutil/internal.h" -#include "libavutil/opt.h" -#include "avformat.h" -#include -#if HAVE_IO_H -#include -#endif -#if HAVE_UNISTD_H -#include -#endif -#include -#include -#include "os_support.h" -#include "url.h" - -/* Some systems may not have S_ISFIFO */ -#ifndef S_ISFIFO -# ifdef S_IFIFO -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -# else -# define S_ISFIFO(m) 0 -# endif -#endif - -/* standard file protocol */ - -typedef struct FileContext { - const AVClass *class; - int fd; - int trunc; - int blocksize; -} FileContext; - -static const AVOption file_options[] = { - { "truncate", "Truncate existing files on write", offsetof(FileContext, trunc), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM }, - { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, - { NULL } -}; - -static const AVOption pipe_options[] = { - { "blocksize", "set I/O operation maximum block size", offsetof(FileContext, blocksize), AV_OPT_TYPE_INT, { .i64 = INT_MAX }, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM }, - { NULL } -}; - -static const AVClass file_class = { - .class_name = "file", - .item_name = av_default_item_name, - .option = file_options, - .version = LIBAVUTIL_VERSION_INT, -}; - -static const AVClass pipe_class = { - .class_name = "pipe", - .item_name = av_default_item_name, - .option = pipe_options, - .version = LIBAVUTIL_VERSION_INT, -}; - -static int file_read(URLContext *h, unsigned char *buf, int size) -{ - FileContext *c = h->priv_data; - int r; - size = FFMIN(size, c->blocksize); - r = read(c->fd, buf, size); - return (-1 == r)?AVERROR(errno):r; -} - -static int file_write(URLContext *h, const unsigned char *buf, int size) -{ - FileContext *c = h->priv_data; - int r; - size = FFMIN(size, c->blocksize); - r = write(c->fd, buf, size); - return (-1 == r)?AVERROR(errno):r; -} - -static int file_get_handle(URLContext *h) -{ - FileContext *c = h->priv_data; - return c->fd; -} - -static int file_check(URLContext *h, int mask) -{ -#if HAVE_ACCESS && defined(R_OK) - int ret = 0; - if (access(h->filename, F_OK) < 0) - return AVERROR(errno); - if (mask&AVIO_FLAG_READ) - if (access(h->filename, R_OK) >= 0) - ret |= AVIO_FLAG_READ; - if (mask&AVIO_FLAG_WRITE) - if (access(h->filename, W_OK) >= 0) - ret |= AVIO_FLAG_WRITE; -#else - struct stat st; - int ret = stat(h->filename, &st); - if (ret < 0) - return AVERROR(errno); - - ret |= st.st_mode&S_IRUSR ? mask&AVIO_FLAG_READ : 0; - ret |= st.st_mode&S_IWUSR ? mask&AVIO_FLAG_WRITE : 0; -#endif - return ret; -} - -#if CONFIG_FILE_PROTOCOL - -static int file_open(URLContext *h, const char *filename, int flags) -{ - FileContext *c = h->priv_data; - int access; - int fd; - struct stat st; - - av_strstart(filename, "file:", &filename); - - if (flags & AVIO_FLAG_WRITE && flags & AVIO_FLAG_READ) { - access = O_CREAT | O_RDWR; - if (c->trunc) - access |= O_TRUNC; - } else if (flags & AVIO_FLAG_WRITE) { - access = O_CREAT | O_WRONLY; - if (c->trunc) - access |= O_TRUNC; - } else { - access = O_RDONLY; - } -#ifdef O_BINARY - access |= O_BINARY; -#endif - fd = avpriv_open(filename, access, 0666); - if (fd == -1) - return AVERROR(errno); - c->fd = fd; - - h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode); - - return 0; -} - -/* XXX: use llseek */ -static int64_t file_seek(URLContext *h, int64_t pos, int whence) -{ - FileContext *c = h->priv_data; - int64_t ret; - - if (whence == AVSEEK_SIZE) { - struct stat st; - ret = fstat(c->fd, &st); - return ret < 0 ? AVERROR(errno) : (S_ISFIFO(st.st_mode) ? 0 : st.st_size); - } - - ret = lseek(c->fd, pos, whence); - - return ret < 0 ? AVERROR(errno) : ret; -} - -static int file_close(URLContext *h) -{ - FileContext *c = h->priv_data; - return close(c->fd); -} - -URLProtocol ff_file_protocol = { - .name = "file", - .url_open = file_open, - .url_read = file_read, - .url_write = file_write, - .url_seek = file_seek, - .url_close = file_close, - .url_get_file_handle = file_get_handle, - .url_check = file_check, - .priv_data_size = sizeof(FileContext), - .priv_data_class = &file_class, -}; - -#endif /* CONFIG_FILE_PROTOCOL */ - -#if CONFIG_PIPE_PROTOCOL - -static int pipe_open(URLContext *h, const char *filename, int flags) -{ - FileContext *c = h->priv_data; - int fd; - char *final; - av_strstart(filename, "pipe:", &filename); - - fd = strtol(filename, &final, 10); - if((filename == final) || *final ) {/* No digits found, or something like 10ab */ - if (flags & AVIO_FLAG_WRITE) { - fd = 1; - } else { - fd = 0; - } - } -#if HAVE_SETMODE - setmode(fd, O_BINARY); -#endif - c->fd = fd; - h->is_streamed = 1; - return 0; -} - -URLProtocol ff_pipe_protocol = { - .name = "pipe", - .url_open = pipe_open, - .url_read = file_read, - .url_write = file_write, - .url_get_file_handle = file_get_handle, - .url_check = file_check, - .priv_data_size = sizeof(FileContext), - .priv_data_class = &pipe_class, -}; - -#endif /* CONFIG_PIPE_PROTOCOL */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/format.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/format.c deleted file mode 100644 index ac9100b60..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/format.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Format register and lookup - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "internal.h" -#include "libavutil/atomic.h" -#include "libavutil/avstring.h" - -/** - * @file - * Format register and lookup - */ -/** head of registered input format linked list */ -static AVInputFormat *first_iformat = NULL; -/** head of registered output format linked list */ -static AVOutputFormat *first_oformat = NULL; - -AVInputFormat *av_iformat_next(AVInputFormat *f) -{ - if (f) - return f->next; - else - return first_iformat; -} - -AVOutputFormat *av_oformat_next(AVOutputFormat *f) -{ - if (f) - return f->next; - else - return first_oformat; -} - -void av_register_input_format(AVInputFormat *format) -{ - AVInputFormat **p = &first_iformat; - - format->next = NULL; - while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) - p = &(*p)->next; -} - -void av_register_output_format(AVOutputFormat *format) -{ - AVOutputFormat **p = &first_oformat; - - format->next = NULL; - while(avpriv_atomic_ptr_cas((void * volatile *)p, NULL, format)) - p = &(*p)->next; -} - -int av_match_ext(const char *filename, const char *extensions) -{ - const char *ext, *p; - char ext1[32], *q; - - if (!filename) - return 0; - - ext = strrchr(filename, '.'); - if (ext) { - ext++; - p = extensions; - for (;;) { - q = ext1; - while (*p != '\0' && *p != ',' && q - ext1 < sizeof(ext1) - 1) - *q++ = *p++; - *q = '\0'; - if (!av_strcasecmp(ext1, ext)) - return 1; - if (*p == '\0') - break; - p++; - } - } - return 0; -} - -static int match_format(const char *name, const char *names) -{ - const char *p; - int len, namelen; - - if (!name || !names) - return 0; - - namelen = strlen(name); - while ((p = strchr(names, ','))) { - len = FFMAX(p - names, namelen); - if (!av_strncasecmp(name, names, len)) - return 1; - names = p + 1; - } - return !av_strcasecmp(name, names); -} - -AVOutputFormat *av_guess_format(const char *short_name, const char *filename, - const char *mime_type) -{ - AVOutputFormat *fmt = NULL, *fmt_found; - int score_max, score; - - /* specific test for image sequences */ -#if CONFIG_IMAGE2_MUXER - if (!short_name && filename && - av_filename_number_test(filename) && - ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) { - return av_guess_format("image2", NULL, NULL); - } -#endif - /* Find the proper file type. */ - fmt_found = NULL; - score_max = 0; - while ((fmt = av_oformat_next(fmt))) { - score = 0; - if (fmt->name && short_name && match_format(short_name, fmt->name)) - score += 100; - if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type)) - score += 10; - if (filename && fmt->extensions && - av_match_ext(filename, fmt->extensions)) { - score += 5; - } - if (score > score_max) { - score_max = score; - fmt_found = fmt; - } - } - return fmt_found; -} - -enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, - const char *filename, const char *mime_type, - enum AVMediaType type) -{ - if (!strcmp(fmt->name, "segment") || !strcmp(fmt->name, "ssegment")) { - fmt = av_guess_format(NULL, filename, NULL); - } - - if (type == AVMEDIA_TYPE_VIDEO) { - enum AVCodecID codec_id = AV_CODEC_ID_NONE; - -#if CONFIG_IMAGE2_MUXER - if (!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")) { - codec_id = ff_guess_image2_codec(filename); - } -#endif - if (codec_id == AV_CODEC_ID_NONE) - codec_id = fmt->video_codec; - return codec_id; - } else if (type == AVMEDIA_TYPE_AUDIO) - return fmt->audio_codec; - else if (type == AVMEDIA_TYPE_SUBTITLE) - return fmt->subtitle_codec; - else - return AV_CODEC_ID_NONE; -} - -AVInputFormat *av_find_input_format(const char *short_name) -{ - AVInputFormat *fmt = NULL; - while ((fmt = av_iformat_next(fmt))) - if (match_format(short_name, fmt->name)) - return fmt; - return NULL; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.c deleted file mode 100644 index d73adc713..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * ID3v1 header parser - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "id3v1.h" -#include "libavcodec/avcodec.h" -#include "libavutil/dict.h" - -/* See Genre List at http://id3.org/id3v2.3.0 */ -const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1] = { - [0] = "Blues", - [1] = "Classic Rock", - [2] = "Country", - [3] = "Dance", - [4] = "Disco", - [5] = "Funk", - [6] = "Grunge", - [7] = "Hip-Hop", - [8] = "Jazz", - [9] = "Metal", - [10] = "New Age", - [11] = "Oldies", - [12] = "Other", - [13] = "Pop", - [14] = "R&B", - [15] = "Rap", - [16] = "Reggae", - [17] = "Rock", - [18] = "Techno", - [19] = "Industrial", - [20] = "Alternative", - [21] = "Ska", - [22] = "Death Metal", - [23] = "Pranks", - [24] = "Soundtrack", - [25] = "Euro-Techno", - [26] = "Ambient", - [27] = "Trip-Hop", - [28] = "Vocal", - [29] = "Jazz+Funk", - [30] = "Fusion", - [31] = "Trance", - [32] = "Classical", - [33] = "Instrumental", - [34] = "Acid", - [35] = "House", - [36] = "Game", - [37] = "Sound Clip", - [38] = "Gospel", - [39] = "Noise", - [40] = "AlternRock", - [41] = "Bass", - [42] = "Soul", - [43] = "Punk", - [44] = "Space", - [45] = "Meditative", - [46] = "Instrumental Pop", - [47] = "Instrumental Rock", - [48] = "Ethnic", - [49] = "Gothic", - [50] = "Darkwave", - [51] = "Techno-Industrial", - [52] = "Electronic", - [53] = "Pop-Folk", - [54] = "Eurodance", - [55] = "Dream", - [56] = "Southern Rock", - [57] = "Comedy", - [58] = "Cult", - [59] = "Gangsta", - [60] = "Top 40", - [61] = "Christian Rap", - [62] = "Pop/Funk", - [63] = "Jungle", - [64] = "Native American", - [65] = "Cabaret", - [66] = "New Wave", - [67] = "Psychadelic", /* sic, the misspelling is used in the specification */ - [68] = "Rave", - [69] = "Showtunes", - [70] = "Trailer", - [71] = "Lo-Fi", - [72] = "Tribal", - [73] = "Acid Punk", - [74] = "Acid Jazz", - [75] = "Polka", - [76] = "Retro", - [77] = "Musical", - [78] = "Rock & Roll", - [79] = "Hard Rock", - [80] = "Folk", - [81] = "Folk-Rock", - [82] = "National Folk", - [83] = "Swing", - [84] = "Fast Fusion", - [85] = "Bebob", - [86] = "Latin", - [87] = "Revival", - [88] = "Celtic", - [89] = "Bluegrass", - [90] = "Avantgarde", - [91] = "Gothic Rock", - [92] = "Progressive Rock", - [93] = "Psychedelic Rock", - [94] = "Symphonic Rock", - [95] = "Slow Rock", - [96] = "Big Band", - [97] = "Chorus", - [98] = "Easy Listening", - [99] = "Acoustic", - [100] = "Humour", - [101] = "Speech", - [102] = "Chanson", - [103] = "Opera", - [104] = "Chamber Music", - [105] = "Sonata", - [106] = "Symphony", - [107] = "Booty Bass", - [108] = "Primus", - [109] = "Porn Groove", - [110] = "Satire", - [111] = "Slow Jam", - [112] = "Club", - [113] = "Tango", - [114] = "Samba", - [115] = "Folklore", - [116] = "Ballad", - [117] = "Power Ballad", - [118] = "Rhythmic Soul", - [119] = "Freestyle", - [120] = "Duet", - [121] = "Punk Rock", - [122] = "Drum Solo", - [123] = "A capella", - [124] = "Euro-House", - [125] = "Dance Hall", - [126] = "Goa", - [127] = "Drum & Bass", - [128] = "Club-House", - [129] = "Hardcore", - [130] = "Terror", - [131] = "Indie", - [132] = "BritPop", - [133] = "Negerpunk", - [134] = "Polsk Punk", - [135] = "Beat", - [136] = "Christian Gangsta", - [137] = "Heavy Metal", - [138] = "Black Metal", - [139] = "Crossover", - [140] = "Contemporary Christian", - [141] = "Christian Rock", - [142] = "Merengue", - [143] = "Salsa", - [144] = "Thrash Metal", - [145] = "Anime", - [146] = "JPop", - [147] = "SynthPop", -}; - -static void get_string(AVFormatContext *s, const char *key, - const uint8_t *buf, int buf_size) -{ - int i, c; - char *q, str[512]; - - q = str; - for(i = 0; i < buf_size; i++) { - c = buf[i]; - if (c == '\0') - break; - if ((q - str) >= sizeof(str) - 1) - break; - *q++ = c; - } - *q = '\0'; - - if (*str) - av_dict_set(&s->metadata, key, str, 0); -} - -/** - * Parse an ID3v1 tag - * - * @param buf ID3v1_TAG_SIZE long buffer containing the tag - */ -static int parse_tag(AVFormatContext *s, const uint8_t *buf) -{ - char str[5]; - int genre; - - if (!(buf[0] == 'T' && - buf[1] == 'A' && - buf[2] == 'G')) - return -1; - get_string(s, "title", buf + 3, 30); - get_string(s, "artist", buf + 33, 30); - get_string(s, "album", buf + 63, 30); - get_string(s, "date", buf + 93, 4); - get_string(s, "comment", buf + 97, 30); - if (buf[125] == 0 && buf[126] != 0) { - snprintf(str, sizeof(str), "%d", buf[126]); - av_dict_set(&s->metadata, "track", str, 0); - } - genre = buf[127]; - if (genre <= ID3v1_GENRE_MAX) - av_dict_set(&s->metadata, "genre", ff_id3v1_genre_str[genre], 0); - return 0; -} - -void ff_id3v1_read(AVFormatContext *s) -{ - int ret; - uint8_t buf[ID3v1_TAG_SIZE]; - int64_t filesize, position = avio_tell(s->pb); - - if (s->pb->seekable) { - /* XXX: change that */ - filesize = avio_size(s->pb); - if (filesize > 128) { - avio_seek(s->pb, filesize - 128, SEEK_SET); - ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); - if (ret == ID3v1_TAG_SIZE) { - parse_tag(s, buf); - } - avio_seek(s->pb, position, SEEK_SET); - } - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.h deleted file mode 100644 index d5dca3587..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v1.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ID3v1 header parser - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_ID3V1_H -#define AVFORMAT_ID3V1_H - -#include "avformat.h" - -#define ID3v1_TAG_SIZE 128 - -#define ID3v1_GENRE_MAX 147 - -/** - * ID3v1 genres - */ -extern const char * const ff_id3v1_genre_str[ID3v1_GENRE_MAX + 1]; - -/** - * Read an ID3v1 tag - */ -void ff_id3v1_read(AVFormatContext *s); - -#endif /* AVFORMAT_ID3V1_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.c deleted file mode 100644 index f1b4e6003..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * ID3v2 header parser - * - * Specifications available at: - * http://id3.org/Developer_Information - */ - -#include "config.h" - -#if CONFIG_ZLIB -#include -#endif - -#include "libavutil/avstring.h" -#include "libavutil/dict.h" -#include "libavutil/intreadwrite.h" -#include "avio_internal.h" -#include "internal.h" -#include "id3v1.h" -#include "id3v2.h" - -const AVMetadataConv ff_id3v2_34_metadata_conv[] = { - { "TALB", "album" }, - { "TCOM", "composer" }, - { "TCON", "genre" }, - { "TCOP", "copyright" }, - { "TENC", "encoded_by" }, - { "TIT2", "title" }, - { "TLAN", "language" }, - { "TPE1", "artist" }, - { "TPE2", "album_artist" }, - { "TPE3", "performer" }, - { "TPOS", "disc" }, - { "TPUB", "publisher" }, - { "TRCK", "track" }, - { "TSSE", "encoder" }, - { 0 } -}; - -const AVMetadataConv ff_id3v2_4_metadata_conv[] = { - { "TDRL", "date" }, - { "TDRC", "date" }, - { "TDEN", "creation_time" }, - { "TSOA", "album-sort" }, - { "TSOP", "artist-sort" }, - { "TSOT", "title-sort" }, - { 0 } -}; - -static const AVMetadataConv id3v2_2_metadata_conv[] = { - { "TAL", "album" }, - { "TCO", "genre" }, - { "TT2", "title" }, - { "TEN", "encoded_by" }, - { "TP1", "artist" }, - { "TP2", "album_artist" }, - { "TP3", "performer" }, - { "TRK", "track" }, - { 0 } -}; - -const char ff_id3v2_tags[][4] = { - "TALB", "TBPM", "TCOM", "TCON", "TCOP", "TDLY", "TENC", "TEXT", - "TFLT", "TIT1", "TIT2", "TIT3", "TKEY", "TLAN", "TLEN", "TMED", - "TOAL", "TOFN", "TOLY", "TOPE", "TOWN", "TPE1", "TPE2", "TPE3", - "TPE4", "TPOS", "TPUB", "TRCK", "TRSN", "TRSO", "TSRC", "TSSE", - { 0 }, -}; - -const char ff_id3v2_4_tags[][4] = { - "TDEN", "TDOR", "TDRC", "TDRL", "TDTG", "TIPL", "TMCL", "TMOO", - "TPRO", "TSOA", "TSOP", "TSOT", "TSST", - { 0 }, -}; - -const char ff_id3v2_3_tags[][4] = { - "TDAT", "TIME", "TORY", "TRDA", "TSIZ", "TYER", - { 0 }, -}; - -const char *ff_id3v2_picture_types[21] = { - "Other", - "32x32 pixels 'file icon'", - "Other file icon", - "Cover (front)", - "Cover (back)", - "Leaflet page", - "Media (e.g. label side of CD)", - "Lead artist/lead performer/soloist", - "Artist/performer", - "Conductor", - "Band/Orchestra", - "Composer", - "Lyricist/text writer", - "Recording Location", - "During recording", - "During performance", - "Movie/video screen capture", - "A bright coloured fish", - "Illustration", - "Band/artist logotype", - "Publisher/Studio logotype", -}; - -const CodecMime ff_id3v2_mime_tags[] = { - { "image/gif", AV_CODEC_ID_GIF }, - { "image/jpeg", AV_CODEC_ID_MJPEG }, - { "image/jpg", AV_CODEC_ID_MJPEG }, - { "image/png", AV_CODEC_ID_PNG }, - { "image/tiff", AV_CODEC_ID_TIFF }, - { "image/bmp", AV_CODEC_ID_BMP }, - { "JPG", AV_CODEC_ID_MJPEG }, /* ID3v2.2 */ - { "PNG", AV_CODEC_ID_PNG }, /* ID3v2.2 */ - { "", AV_CODEC_ID_NONE }, -}; - -int ff_id3v2_match(const uint8_t *buf, const char *magic) -{ - return buf[0] == magic[0] && - buf[1] == magic[1] && - buf[2] == magic[2] && - buf[3] != 0xff && - buf[4] != 0xff && - (buf[6] & 0x80) == 0 && - (buf[7] & 0x80) == 0 && - (buf[8] & 0x80) == 0 && - (buf[9] & 0x80) == 0; -} - -int ff_id3v2_tag_len(const uint8_t *buf) -{ - int len = ((buf[6] & 0x7f) << 21) + - ((buf[7] & 0x7f) << 14) + - ((buf[8] & 0x7f) << 7) + - (buf[9] & 0x7f) + - ID3v2_HEADER_SIZE; - if (buf[5] & 0x10) - len += ID3v2_HEADER_SIZE; - return len; -} - -static unsigned int get_size(AVIOContext *s, int len) -{ - int v = 0; - while (len--) - v = (v << 7) + (avio_r8(s) & 0x7F); - return v; -} - -/** - * Free GEOB type extra metadata. - */ -static void free_geobtag(void *obj) -{ - ID3v2ExtraMetaGEOB *geob = obj; - av_free(geob->mime_type); - av_free(geob->file_name); - av_free(geob->description); - av_free(geob->data); - av_free(geob); -} - -/** - * Decode characters to UTF-8 according to encoding type. The decoded buffer is - * always null terminated. Stop reading when either *maxread bytes are read from - * pb or U+0000 character is found. - * - * @param dst Pointer where the address of the buffer with the decoded bytes is - * stored. Buffer must be freed by caller. - * @param maxread Pointer to maximum number of characters to read from the - * AVIOContext. After execution the value is decremented by the number of bytes - * actually read. - * @returns 0 if no error occurred, dst is uninitialized on error - */ -static int decode_str(AVFormatContext *s, AVIOContext *pb, int encoding, - uint8_t **dst, int *maxread) -{ - int ret; - uint8_t tmp; - uint32_t ch = 1; - int left = *maxread; - unsigned int (*get)(AVIOContext*) = avio_rb16; - AVIOContext *dynbuf; - - if ((ret = avio_open_dyn_buf(&dynbuf)) < 0) { - av_log(s, AV_LOG_ERROR, "Error opening memory stream\n"); - return ret; - } - - switch (encoding) { - case ID3v2_ENCODING_ISO8859: - while (left && ch) { - ch = avio_r8(pb); - PUT_UTF8(ch, tmp, avio_w8(dynbuf, tmp);) - left--; - } - break; - - case ID3v2_ENCODING_UTF16BOM: - if ((left -= 2) < 0) { - av_log(s, AV_LOG_ERROR, "Cannot read BOM value, input too short\n"); - avio_close_dyn_buf(dynbuf, dst); - av_freep(dst); - return AVERROR_INVALIDDATA; - } - switch (avio_rb16(pb)) { - case 0xfffe: - get = avio_rl16; - case 0xfeff: - break; - default: - av_log(s, AV_LOG_ERROR, "Incorrect BOM value\n"); - avio_close_dyn_buf(dynbuf, dst); - av_freep(dst); - *maxread = left; - return AVERROR_INVALIDDATA; - } - // fall-through - - case ID3v2_ENCODING_UTF16BE: - while ((left > 1) && ch) { - GET_UTF16(ch, ((left -= 2) >= 0 ? get(pb) : 0), break;) - PUT_UTF8(ch, tmp, avio_w8(dynbuf, tmp);) - } - if (left < 0) - left += 2; /* did not read last char from pb */ - break; - - case ID3v2_ENCODING_UTF8: - while (left && ch) { - ch = avio_r8(pb); - avio_w8(dynbuf, ch); - left--; - } - break; - default: - av_log(s, AV_LOG_WARNING, "Unknown encoding\n"); - } - - if (ch) - avio_w8(dynbuf, 0); - - avio_close_dyn_buf(dynbuf, dst); - *maxread = left; - - return 0; -} - -/** - * Parse a text tag. - */ -static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, - AVDictionary **metadata, const char *key) -{ - uint8_t *dst; - int encoding, dict_flags = AV_DICT_DONT_OVERWRITE | AV_DICT_DONT_STRDUP_VAL; - unsigned genre; - - if (taglen < 1) - return; - - encoding = avio_r8(pb); - taglen--; /* account for encoding type byte */ - - if (decode_str(s, pb, encoding, &dst, &taglen) < 0) { - av_log(s, AV_LOG_ERROR, "Error reading frame %s, skipped\n", key); - return; - } - - if (!(strcmp(key, "TCON") && strcmp(key, "TCO")) && - (sscanf((const char *) dst, "(%d)", &genre) == 1 || sscanf((const char *) dst, "%d", &genre) == 1) && - genre <= ID3v1_GENRE_MAX) { - av_freep(&dst); - dst = (uint8_t *) av_strdup(ff_id3v1_genre_str[genre]); - } else if (!(strcmp(key, "TXXX") && strcmp(key, "TXX"))) { - /* dst now contains the key, need to get value */ - key = (const char *) dst; - if (decode_str(s, pb, encoding, &dst, &taglen) < 0) { - av_log(s, AV_LOG_ERROR, "Error reading frame %s, skipped\n", key); - av_freep(&key); - return; - } - dict_flags |= AV_DICT_DONT_STRDUP_KEY; - } else if (!*dst) - av_freep(&dst); - - if (dst) - av_dict_set(metadata, key, (const char *) dst, dict_flags); -} - -/** - * Parse a comment tag. - */ -static void read_comm(AVFormatContext *s, AVIOContext *pb, int taglen, - AVDictionary **metadata) -{ - const char *key = "comment"; - uint8_t *dst; - int encoding, dict_flags = AV_DICT_DONT_OVERWRITE | AV_DICT_DONT_STRDUP_VAL; - int language; - - if (taglen < 4) - return; - - encoding = avio_r8(pb); - taglen--; - - language = avio_rl24(pb); - taglen -= 3; - - if (decode_str(s, pb, encoding, &dst, &taglen) < 0) { - av_log(s, AV_LOG_ERROR, "Error reading comment frame, skipped\n"); - return; - } - - if (dst && dst[0]) { - key = (const char *) dst; - dict_flags |= AV_DICT_DONT_STRDUP_KEY; - } - - if (decode_str(s, pb, encoding, &dst, &taglen) < 0) { - av_log(s, AV_LOG_ERROR, "Error reading comment frame, skipped\n"); - if (dict_flags & AV_DICT_DONT_STRDUP_KEY) - av_freep((void*)&key); - return; - } - - if (dst) - av_dict_set(metadata, key, (const char *) dst, dict_flags); -} - -/** - * Parse GEOB tag into a ID3v2ExtraMetaGEOB struct. - */ -static void read_geobtag(AVFormatContext *s, AVIOContext *pb, int taglen, - char *tag, ID3v2ExtraMeta **extra_meta, int isv34) -{ - ID3v2ExtraMetaGEOB *geob_data = NULL; - ID3v2ExtraMeta *new_extra = NULL; - char encoding; - unsigned int len; - - if (taglen < 1) - return; - - geob_data = av_mallocz(sizeof(ID3v2ExtraMetaGEOB)); - if (!geob_data) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %zu bytes\n", - sizeof(ID3v2ExtraMetaGEOB)); - return; - } - - new_extra = av_mallocz(sizeof(ID3v2ExtraMeta)); - if (!new_extra) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %zu bytes\n", - sizeof(ID3v2ExtraMeta)); - goto fail; - } - - /* read encoding type byte */ - encoding = avio_r8(pb); - taglen--; - - /* read MIME type (always ISO-8859) */ - if (decode_str(s, pb, ID3v2_ENCODING_ISO8859, &geob_data->mime_type, - &taglen) < 0 || - taglen <= 0) - goto fail; - - /* read file name */ - if (decode_str(s, pb, encoding, &geob_data->file_name, &taglen) < 0 || - taglen <= 0) - goto fail; - - /* read content description */ - if (decode_str(s, pb, encoding, &geob_data->description, &taglen) < 0 || - taglen < 0) - goto fail; - - if (taglen) { - /* save encapsulated binary data */ - geob_data->data = av_malloc(taglen); - if (!geob_data->data) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", taglen); - goto fail; - } - if ((len = avio_read(pb, geob_data->data, taglen)) < taglen) - av_log(s, AV_LOG_WARNING, - "Error reading GEOB frame, data truncated.\n"); - geob_data->datasize = len; - } else { - geob_data->data = NULL; - geob_data->datasize = 0; - } - - /* add data to the list */ - new_extra->tag = "GEOB"; - new_extra->data = geob_data; - new_extra->next = *extra_meta; - *extra_meta = new_extra; - - return; - -fail: - av_log(s, AV_LOG_ERROR, "Error reading frame %s, skipped\n", tag); - free_geobtag(geob_data); - av_free(new_extra); - return; -} - -static int is_number(const char *str) -{ - while (*str >= '0' && *str <= '9') - str++; - return !*str; -} - -static AVDictionaryEntry *get_date_tag(AVDictionary *m, const char *tag) -{ - AVDictionaryEntry *t; - if ((t = av_dict_get(m, tag, NULL, AV_DICT_MATCH_CASE)) && - strlen(t->value) == 4 && is_number(t->value)) - return t; - return NULL; -} - -static void merge_date(AVDictionary **m) -{ - AVDictionaryEntry *t; - char date[17] = { 0 }; // YYYY-MM-DD hh:mm - - if (!(t = get_date_tag(*m, "TYER")) && - !(t = get_date_tag(*m, "TYE"))) - return; - av_strlcpy(date, t->value, 5); - av_dict_set(m, "TYER", NULL, 0); - av_dict_set(m, "TYE", NULL, 0); - - if (!(t = get_date_tag(*m, "TDAT")) && - !(t = get_date_tag(*m, "TDA"))) - goto finish; - snprintf(date + 4, sizeof(date) - 4, "-%.2s-%.2s", t->value + 2, t->value); - av_dict_set(m, "TDAT", NULL, 0); - av_dict_set(m, "TDA", NULL, 0); - - if (!(t = get_date_tag(*m, "TIME")) && - !(t = get_date_tag(*m, "TIM"))) - goto finish; - snprintf(date + 10, sizeof(date) - 10, - " %.2s:%.2s", t->value, t->value + 2); - av_dict_set(m, "TIME", NULL, 0); - av_dict_set(m, "TIM", NULL, 0); - -finish: - if (date[0]) - av_dict_set(m, "date", date, 0); -} - -static void free_apic(void *obj) -{ - ID3v2ExtraMetaAPIC *apic = obj; - av_buffer_unref(&apic->buf); - av_freep(&apic->description); - av_freep(&apic); -} - -static void read_apic(AVFormatContext *s, AVIOContext *pb, int taglen, - char *tag, ID3v2ExtraMeta **extra_meta, int isv34) -{ - int enc, pic_type; - char mimetype[64]; - const CodecMime *mime = ff_id3v2_mime_tags; - enum AVCodecID id = AV_CODEC_ID_NONE; - ID3v2ExtraMetaAPIC *apic = NULL; - ID3v2ExtraMeta *new_extra = NULL; - int64_t end = avio_tell(pb) + taglen; - - if (taglen <= 4) - goto fail; - - new_extra = av_mallocz(sizeof(*new_extra)); - apic = av_mallocz(sizeof(*apic)); - if (!new_extra || !apic) - goto fail; - - enc = avio_r8(pb); - taglen--; - - /* mimetype */ - if (isv34) { - taglen -= avio_get_str(pb, taglen, mimetype, sizeof(mimetype)); - } else { - avio_read(pb, mimetype, 3); - mimetype[3] = 0; - } - while (mime->id != AV_CODEC_ID_NONE) { - if (!av_strncasecmp(mime->str, mimetype, sizeof(mimetype))) { - id = mime->id; - break; - } - mime++; - } - if (id == AV_CODEC_ID_NONE) { - av_log(s, AV_LOG_WARNING, - "Unknown attached picture mimetype: %s, skipping.\n", mimetype); - goto fail; - } - apic->id = id; - - /* picture type */ - pic_type = avio_r8(pb); - taglen--; - if (pic_type < 0 || pic_type >= FF_ARRAY_ELEMS(ff_id3v2_picture_types)) { - av_log(s, AV_LOG_WARNING, "Unknown attached picture type %d.\n", - pic_type); - pic_type = 0; - } - apic->type = ff_id3v2_picture_types[pic_type]; - - /* description and picture data */ - if (decode_str(s, pb, enc, &apic->description, &taglen) < 0) { - av_log(s, AV_LOG_ERROR, - "Error decoding attached picture description.\n"); - goto fail; - } - - apic->buf = av_buffer_alloc(taglen + FF_INPUT_BUFFER_PADDING_SIZE); - if (!apic->buf || !taglen || avio_read(pb, apic->buf->data, taglen) != taglen) - goto fail; - memset(apic->buf->data + taglen, 0, FF_INPUT_BUFFER_PADDING_SIZE); - - new_extra->tag = "APIC"; - new_extra->data = apic; - new_extra->next = *extra_meta; - *extra_meta = new_extra; - - return; - -fail: - if (apic) - free_apic(apic); - av_freep(&new_extra); - avio_seek(pb, end, SEEK_SET); -} - -static void read_chapter(AVFormatContext *s, AVIOContext *pb, int len, char *ttag, ID3v2ExtraMeta **extra_meta, int isv34) -{ - AVRational time_base = {1, 1000}; - uint32_t start, end; - AVChapter *chapter; - uint8_t *dst = NULL; - int taglen; - char tag[5]; - - if (!s) { - /* We should probably just put the chapter data to extra_meta here - * and do the AVFormatContext-needing part in a separate - * ff_id3v2_parse_apic()-like function. */ - av_log(NULL, AV_LOG_DEBUG, "No AVFormatContext, skipped ID3 chapter data\n"); - return; - } - - if (decode_str(s, pb, 0, &dst, &len) < 0) - return; - if (len < 16) - return; - - start = avio_rb32(pb); - end = avio_rb32(pb); - avio_skip(pb, 8); - - chapter = avpriv_new_chapter(s, s->nb_chapters + 1, time_base, start, end, (const char *) dst); - if (!chapter) { - av_free(dst); - return; - } - - len -= 16; - while (len > 10) { - if (avio_read(pb, tag, 4) < 4) - goto end; - tag[4] = 0; - taglen = avio_rb32(pb); - avio_skip(pb, 2); - len -= 10; - if (taglen < 0 || taglen > len) - goto end; - if (tag[0] == 'T') - read_ttag(s, pb, taglen, &chapter->metadata, tag); - else - avio_skip(pb, taglen); - len -= taglen; - } - - ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_34_metadata_conv); - ff_metadata_conv(&chapter->metadata, NULL, ff_id3v2_4_metadata_conv); -end: - av_free(dst); -} - -static void free_priv(void *obj) -{ - ID3v2ExtraMetaPRIV *priv = obj; - av_freep(&priv->owner); - av_freep(&priv->data); - av_freep(&priv); -} - -static void read_priv(AVFormatContext *s, AVIOContext *pb, int taglen, - char *tag, ID3v2ExtraMeta **extra_meta, int isv34) -{ - ID3v2ExtraMeta *meta; - ID3v2ExtraMetaPRIV *priv; - - meta = av_mallocz(sizeof(*meta)); - priv = av_mallocz(sizeof(*priv)); - - if (!meta || !priv) - goto fail; - - if (decode_str(s, pb, ID3v2_ENCODING_ISO8859, &priv->owner, &taglen) < 0) - goto fail; - - priv->data = av_malloc(taglen); - if (!priv->data) - goto fail; - - priv->datasize = taglen; - - if (avio_read(pb, priv->data, priv->datasize) != priv->datasize) - goto fail; - - meta->tag = "PRIV"; - meta->data = priv; - meta->next = *extra_meta; - *extra_meta = meta; - - return; - -fail: - if (priv) - free_priv(priv); - av_freep(&meta); -} - -typedef struct ID3v2EMFunc { - const char *tag3; - const char *tag4; - void (*read)(AVFormatContext *, AVIOContext *, int, char *, - ID3v2ExtraMeta **, int isv34); - void (*free)(void *obj); -} ID3v2EMFunc; - -static const ID3v2EMFunc id3v2_extra_meta_funcs[] = { - { "GEO", "GEOB", read_geobtag, free_geobtag }, - { "PIC", "APIC", read_apic, free_apic }, - { "CHAP","CHAP", read_chapter, NULL }, - { "PRIV","PRIV", read_priv, free_priv }, - { NULL } -}; - -/** - * Get the corresponding ID3v2EMFunc struct for a tag. - * @param isv34 Determines if v2.2 or v2.3/4 strings are used - * @return A pointer to the ID3v2EMFunc struct if found, NULL otherwise. - */ -static const ID3v2EMFunc *get_extra_meta_func(const char *tag, int isv34) -{ - int i = 0; - while (id3v2_extra_meta_funcs[i].tag3) { - if (tag && !memcmp(tag, - (isv34 ? id3v2_extra_meta_funcs[i].tag4 : - id3v2_extra_meta_funcs[i].tag3), - (isv34 ? 4 : 3))) - return &id3v2_extra_meta_funcs[i]; - i++; - } - return NULL; -} - -static void id3v2_parse(AVIOContext *pb, AVDictionary **metadata, - AVFormatContext *s, int len, uint8_t version, - uint8_t flags, ID3v2ExtraMeta **extra_meta) -{ - int isv34, unsync; - unsigned tlen; - char tag[5]; - int64_t next, end = avio_tell(pb) + len; - int taghdrlen; - const char *reason = NULL; - AVIOContext pb_local; - AVIOContext *pbx; - unsigned char *buffer = NULL; - int buffer_size = 0; - const ID3v2EMFunc *extra_func = NULL; - unsigned char *uncompressed_buffer = NULL; - int uncompressed_buffer_size = 0; - - av_log(s, AV_LOG_DEBUG, "id3v2 ver:%d flags:%02X len:%d\n", version, flags, len); - - switch (version) { - case 2: - if (flags & 0x40) { - reason = "compression"; - goto error; - } - isv34 = 0; - taghdrlen = 6; - break; - - case 3: - case 4: - isv34 = 1; - taghdrlen = 10; - break; - - default: - reason = "version"; - goto error; - } - - unsync = flags & 0x80; - - if (isv34 && flags & 0x40) { /* Extended header present, just skip over it */ - int extlen = get_size(pb, 4); - if (version == 4) - /* In v2.4 the length includes the length field we just read. */ - extlen -= 4; - - if (extlen < 0) { - reason = "invalid extended header length"; - goto error; - } - avio_skip(pb, extlen); - len -= extlen + 4; - if (len < 0) { - reason = "extended header too long."; - goto error; - } - } - - while (len >= taghdrlen) { - unsigned int tflags = 0; - int tunsync = 0; - int tcomp = 0; - int tencr = 0; - unsigned long dlen; - - if (isv34) { - if (avio_read(pb, tag, 4) < 4) - break; - tag[4] = 0; - if (version == 3) { - tlen = avio_rb32(pb); - } else - tlen = get_size(pb, 4); - tflags = avio_rb16(pb); - tunsync = tflags & ID3v2_FLAG_UNSYNCH; - } else { - if (avio_read(pb, tag, 3) < 3) - break; - tag[3] = 0; - tlen = avio_rb24(pb); - } - if (tlen > (1<<28)) - break; - len -= taghdrlen + tlen; - - if (len < 0) - break; - - next = avio_tell(pb) + tlen; - - if (!tlen) { - if (tag[0]) - av_log(s, AV_LOG_DEBUG, "Invalid empty frame %s, skipping.\n", - tag); - continue; - } - - if (tflags & ID3v2_FLAG_DATALEN) { - if (tlen < 4) - break; - dlen = avio_rb32(pb); - tlen -= 4; - } else - dlen = tlen; - - tcomp = tflags & ID3v2_FLAG_COMPRESSION; - tencr = tflags & ID3v2_FLAG_ENCRYPTION; - - /* skip encrypted tags and, if no zlib, compressed tags */ - if (tencr || (!CONFIG_ZLIB && tcomp)) { - const char *type; - if (!tcomp) - type = "encrypted"; - else if (!tencr) - type = "compressed"; - else - type = "encrypted and compressed"; - - av_log(s, AV_LOG_WARNING, "Skipping %s ID3v2 frame %s.\n", type, tag); - avio_skip(pb, tlen); - /* check for text tag or supported special meta tag */ - } else if (tag[0] == 'T' || - (extra_meta && - (extra_func = get_extra_meta_func(tag, isv34)))) { - pbx = pb; - - if (unsync || tunsync || tcomp) { - av_fast_malloc(&buffer, &buffer_size, tlen); - if (!buffer) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %d bytes\n", tlen); - goto seek; - } - } - if (unsync || tunsync) { - int64_t end = avio_tell(pb) + tlen; - uint8_t *b; - - b = buffer; - while (avio_tell(pb) < end && b - buffer < tlen && !pb->eof_reached) { - *b++ = avio_r8(pb); - if (*(b - 1) == 0xff && avio_tell(pb) < end - 1 && - b - buffer < tlen && - !pb->eof_reached ) { - uint8_t val = avio_r8(pb); - *b++ = val ? val : avio_r8(pb); - } - } - ffio_init_context(&pb_local, buffer, b - buffer, 0, NULL, NULL, NULL, - NULL); - tlen = b - buffer; - pbx = &pb_local; // read from sync buffer - } - -#if CONFIG_ZLIB - if (tcomp) { - int err; - - av_log(s, AV_LOG_DEBUG, "Compresssed frame %s tlen=%d dlen=%ld\n", tag, tlen, dlen); - - av_fast_malloc(&uncompressed_buffer, (unsigned int *) &uncompressed_buffer_size, dlen); - if (!uncompressed_buffer) { - av_log(s, AV_LOG_ERROR, "Failed to alloc %ld bytes\n", dlen); - goto seek; - } - - if (!(unsync || tunsync)) { - err = avio_read(pb, buffer, tlen); - if (err < 0) { - av_log(s, AV_LOG_ERROR, "Failed to read compressed tag\n"); - goto seek; - } - tlen = err; - } - - err = uncompress(uncompressed_buffer, &dlen, buffer, tlen); - if (err != Z_OK) { - av_log(s, AV_LOG_ERROR, "Failed to uncompress tag: %d\n", err); - goto seek; - } - ffio_init_context(&pb_local, uncompressed_buffer, dlen, 0, NULL, NULL, NULL, NULL); - tlen = dlen; - pbx = &pb_local; // read from sync buffer - } -#endif - if (tag[0] == 'T') - /* parse text tag */ - read_ttag(s, pbx, tlen, metadata, tag); - else - /* parse special meta tag */ - extra_func->read(s, pbx, tlen, tag, extra_meta, isv34); - } else if (!tag[0]) { - if (tag[1]) - av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding\n"); - avio_skip(pb, tlen); - break; - } - /* Skip to end of tag */ -seek: - avio_seek(pb, next, SEEK_SET); - } - - /* Footer preset, always 10 bytes, skip over it */ - if (version == 4 && flags & 0x10) - end += 10; - -error: - if (reason) - av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", - version, reason); - avio_seek(pb, end, SEEK_SET); - av_free(buffer); - av_free(uncompressed_buffer); - return; -} - -static void id3v2_read_internal(AVIOContext *pb, AVDictionary **metadata, - AVFormatContext *s, const char *magic, - ID3v2ExtraMeta **extra_meta) -{ - int len, ret; - uint8_t buf[ID3v2_HEADER_SIZE]; - int found_header; - int64_t off; - - do { - /* save the current offset in case there's nothing to read/skip */ - off = avio_tell(pb); - ret = avio_read(pb, buf, ID3v2_HEADER_SIZE); - if (ret != ID3v2_HEADER_SIZE) { - avio_seek(pb, off, SEEK_SET); - break; - } - found_header = ff_id3v2_match(buf, magic); - if (found_header) { - /* parse ID3v2 header */ - len = ((buf[6] & 0x7f) << 21) | - ((buf[7] & 0x7f) << 14) | - ((buf[8] & 0x7f) << 7) | - (buf[9] & 0x7f); - id3v2_parse(pb, metadata, s, len, buf[3], buf[5], extra_meta); - } else { - avio_seek(pb, off, SEEK_SET); - } - } while (found_header); - ff_metadata_conv(metadata, NULL, ff_id3v2_34_metadata_conv); - ff_metadata_conv(metadata, NULL, id3v2_2_metadata_conv); - ff_metadata_conv(metadata, NULL, ff_id3v2_4_metadata_conv); - merge_date(metadata); -} - -void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, - const char *magic, ID3v2ExtraMeta **extra_meta) -{ - id3v2_read_internal(pb, metadata, NULL, magic, extra_meta); -} - -void ff_id3v2_read(AVFormatContext *s, const char *magic, - ID3v2ExtraMeta **extra_meta) -{ - id3v2_read_internal(s->pb, &s->metadata, s, magic, extra_meta); -} - -void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta) -{ - ID3v2ExtraMeta *current = *extra_meta, *next; - const ID3v2EMFunc *extra_func; - - while (current) { - if ((extra_func = get_extra_meta_func(current->tag, 1))) - extra_func->free(current->data); - next = current->next; - av_freep(¤t); - current = next; - } -} - -int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta) -{ - ID3v2ExtraMeta *cur; - - for (cur = *extra_meta; cur; cur = cur->next) { - ID3v2ExtraMetaAPIC *apic; - AVStream *st; - - if (strcmp(cur->tag, "APIC")) - continue; - apic = cur->data; - - if (!(st = avformat_new_stream(s, NULL))) - return AVERROR(ENOMEM); - - st->disposition |= AV_DISPOSITION_ATTACHED_PIC; - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = apic->id; - av_dict_set(&st->metadata, "title", (const char *) apic->description, 0); - av_dict_set(&st->metadata, "comment", apic->type, 0); - - av_init_packet(&st->attached_pic); - st->attached_pic.buf = apic->buf; - st->attached_pic.data = apic->buf->data; - st->attached_pic.size = apic->buf->size - FF_INPUT_BUFFER_PADDING_SIZE; - st->attached_pic.stream_index = st->index; - st->attached_pic.flags |= AV_PKT_FLAG_KEY; - - apic->buf = NULL; - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.h deleted file mode 100644 index eb4dc799e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/id3v2.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * ID3v2 header parser - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_ID3V2_H -#define AVFORMAT_ID3V2_H - -#include -#include "avformat.h" -#include "internal.h" -#include "metadata.h" - -#define ID3v2_HEADER_SIZE 10 - -/** - * Default magic bytes for ID3v2 header: "ID3" - */ -#define ID3v2_DEFAULT_MAGIC "ID3" - -#define ID3v2_FLAG_DATALEN 0x0001 -#define ID3v2_FLAG_UNSYNCH 0x0002 -#define ID3v2_FLAG_ENCRYPTION 0x0004 -#define ID3v2_FLAG_COMPRESSION 0x0008 - -enum ID3v2Encoding { - ID3v2_ENCODING_ISO8859 = 0, - ID3v2_ENCODING_UTF16BOM = 1, - ID3v2_ENCODING_UTF16BE = 2, - ID3v2_ENCODING_UTF8 = 3, -}; - -typedef struct ID3v2EncContext { - int version; ///< ID3v2 minor version, either 3 or 4 - int64_t size_pos; ///< offset of the tag total size - int len; ///< size of the tag written so far -} ID3v2EncContext; - -typedef struct ID3v2ExtraMeta { - const char *tag; - void *data; - struct ID3v2ExtraMeta *next; -} ID3v2ExtraMeta; - -typedef struct ID3v2ExtraMetaGEOB { - uint32_t datasize; - uint8_t *mime_type; - uint8_t *file_name; - uint8_t *description; - uint8_t *data; -} ID3v2ExtraMetaGEOB; - -typedef struct ID3v2ExtraMetaAPIC { - AVBufferRef *buf; - const char *type; - uint8_t *description; - enum AVCodecID id; -} ID3v2ExtraMetaAPIC; - -typedef struct ID3v2ExtraMetaPRIV { - uint8_t *owner; - uint8_t *data; - uint32_t datasize; -} ID3v2ExtraMetaPRIV; - -/** - * Detect ID3v2 Header. - * @param buf must be ID3v2_HEADER_SIZE byte long - * @param magic magic bytes to identify the header. - * If in doubt, use ID3v2_DEFAULT_MAGIC. - */ -int ff_id3v2_match(const uint8_t *buf, const char *magic); - -/** - * Get the length of an ID3v2 tag. - * @param buf must be ID3v2_HEADER_SIZE bytes long and point to the start of an - * already detected ID3v2 tag - */ -int ff_id3v2_tag_len(const uint8_t *buf); - -/** - * Read an ID3v2 tag into specified dictionary and retrieve supported extra metadata. - * - * Chapters are not currently read by this variant. - * - * @param metadata Parsed metadata is stored here - * @param extra_meta If not NULL, extra metadata is parsed into a list of - * ID3v2ExtraMeta structs and *extra_meta points to the head of the list - */ -void ff_id3v2_read_dict(AVIOContext *pb, AVDictionary **metadata, const char *magic, ID3v2ExtraMeta **extra_meta); - -/** - * Read an ID3v2 tag, including supported extra metadata and chapters. - * - * Data is read from and stored to AVFormatContext. - * - * @param extra_meta If not NULL, extra metadata is parsed into a list of - * ID3v2ExtraMeta structs and *extra_meta points to the head of the list - */ -void ff_id3v2_read(AVFormatContext *s, const char *magic, ID3v2ExtraMeta **extra_meta); - -/** - * Initialize an ID3v2 tag. - */ -void ff_id3v2_start(ID3v2EncContext *id3, AVIOContext *pb, int id3v2_version, - const char *magic); - -/** - * Convert and write all global metadata from s into an ID3v2 tag. - */ -int ff_id3v2_write_metadata(AVFormatContext *s, ID3v2EncContext *id3); - -/** - * Write an attached picture from pkt into an ID3v2 tag. - */ -int ff_id3v2_write_apic(AVFormatContext *s, ID3v2EncContext *id3, AVPacket *pkt); - -/** - * Finalize an opened ID3v2 tag. - */ -void ff_id3v2_finish(ID3v2EncContext *id3, AVIOContext *pb, int padding_bytes); - -/** - * Write an ID3v2 tag containing all global metadata from s. - * @param id3v2_version Subversion of ID3v2; supported values are 3 and 4 - * @param magic magic bytes to identify the header - * If in doubt, use ID3v2_DEFAULT_MAGIC. - */ -int ff_id3v2_write_simple(struct AVFormatContext *s, int id3v2_version, const char *magic); - -/** - * Free memory allocated parsing special (non-text) metadata. - * @param extra_meta Pointer to a pointer to the head of a ID3v2ExtraMeta list, *extra_meta is set to NULL. - */ -void ff_id3v2_free_extra_meta(ID3v2ExtraMeta **extra_meta); - -/** - * Create a stream for each APIC (attached picture) extracted from the - * ID3v2 header. - */ -int ff_id3v2_parse_apic(AVFormatContext *s, ID3v2ExtraMeta **extra_meta); - -extern const AVMetadataConv ff_id3v2_34_metadata_conv[]; -extern const AVMetadataConv ff_id3v2_4_metadata_conv[]; - -/** - * A list of text information frames allowed in both ID3 v2.3 and v2.4 - * http://www.id3.org/id3v2.4.0-frames - * http://www.id3.org/id3v2.4.0-changes - */ -extern const char ff_id3v2_tags[][4]; - -/** - * ID3v2.4-only text information frames. - */ -extern const char ff_id3v2_4_tags[][4]; - -/** - * ID3v2.3-only text information frames. - */ -extern const char ff_id3v2_3_tags[][4]; - -extern const CodecMime ff_id3v2_mime_tags[]; - -extern const char *ff_id3v2_picture_types[21]; - -#endif /* AVFORMAT_ID3V2_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/img2.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/img2.c deleted file mode 100644 index 753935954..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/img2.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Image format - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/avstring.h" -#include "internal.h" - -typedef struct { - enum AVCodecID id; - const char *str; -} IdStrMap; - -static const IdStrMap img_tags[] = { - { AV_CODEC_ID_MJPEG, "jpeg" }, - { AV_CODEC_ID_MJPEG, "jpg" }, - { AV_CODEC_ID_MJPEG, "jps" }, - { AV_CODEC_ID_LJPEG, "ljpg" }, - { AV_CODEC_ID_JPEGLS, "jls" }, - { AV_CODEC_ID_PNG, "png" }, - { AV_CODEC_ID_PNG, "pns" }, - { AV_CODEC_ID_PNG, "mng" }, - { AV_CODEC_ID_PPM, "ppm" }, - { AV_CODEC_ID_PPM, "pnm" }, - { AV_CODEC_ID_PGM, "pgm" }, - { AV_CODEC_ID_PGMYUV, "pgmyuv" }, - { AV_CODEC_ID_PBM, "pbm" }, - { AV_CODEC_ID_PAM, "pam" }, - { AV_CODEC_ID_MPEG1VIDEO, "mpg1-img" }, - { AV_CODEC_ID_MPEG2VIDEO, "mpg2-img" }, - { AV_CODEC_ID_MPEG4, "mpg4-img" }, - { AV_CODEC_ID_FFV1, "ffv1-img" }, - { AV_CODEC_ID_RAWVIDEO, "y" }, - { AV_CODEC_ID_RAWVIDEO, "raw" }, - { AV_CODEC_ID_BMP, "bmp" }, - { AV_CODEC_ID_TARGA, "tga" }, - { AV_CODEC_ID_TIFF, "tiff" }, - { AV_CODEC_ID_TIFF, "tif" }, - { AV_CODEC_ID_SGI, "sgi" }, - { AV_CODEC_ID_PTX, "ptx" }, - { AV_CODEC_ID_PCX, "pcx" }, - { AV_CODEC_ID_BRENDER_PIX, "pix" }, - { AV_CODEC_ID_SUNRAST, "sun" }, - { AV_CODEC_ID_SUNRAST, "ras" }, - { AV_CODEC_ID_SUNRAST, "rs" }, - { AV_CODEC_ID_SUNRAST, "im1" }, - { AV_CODEC_ID_SUNRAST, "im8" }, - { AV_CODEC_ID_SUNRAST, "im24" }, - { AV_CODEC_ID_SUNRAST, "im32" }, - { AV_CODEC_ID_SUNRAST, "sunras" }, - { AV_CODEC_ID_JPEG2000, "j2c" }, - { AV_CODEC_ID_JPEG2000, "jp2" }, - { AV_CODEC_ID_JPEG2000, "jpc" }, - { AV_CODEC_ID_JPEG2000, "j2k" }, - { AV_CODEC_ID_DPX, "dpx" }, - { AV_CODEC_ID_EXR, "exr" }, - { AV_CODEC_ID_PICTOR, "pic" }, - { AV_CODEC_ID_V210X, "yuv10" }, - { AV_CODEC_ID_WEBP, "webp" }, - { AV_CODEC_ID_XBM, "xbm" }, - { AV_CODEC_ID_XFACE, "xface" }, - { AV_CODEC_ID_XWD, "xwd" }, - { AV_CODEC_ID_NONE, NULL } -}; - -static enum AVCodecID av_str2id(const IdStrMap *tags, const char *str) -{ - str = strrchr(str, '.'); - if (!str) - return AV_CODEC_ID_NONE; - str++; - - while (tags->id) { - if (!av_strcasecmp(str, tags->str)) - return tags->id; - - tags++; - } - return AV_CODEC_ID_NONE; -} - -enum AVCodecID ff_guess_image2_codec(const char *filename) -{ - return av_str2id(img_tags, filename); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/internal.h deleted file mode 100644 index f19cebf22..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/internal.h +++ /dev/null @@ -1,415 +0,0 @@ -/* - * copyright (c) 2001 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_INTERNAL_H -#define AVFORMAT_INTERNAL_H - -#include -#include "avformat.h" - -#define MAX_URL_SIZE 4096 - -/** size of probe buffer, for guessing file type from file contents */ -#define PROBE_BUF_MIN 2048 -#define PROBE_BUF_MAX (1 << 20) - -#ifdef DEBUG -# define hex_dump_debug(class, buf, size) av_hex_dump_log(class, AV_LOG_DEBUG, buf, size) -#else -# define hex_dump_debug(class, buf, size) -#endif - -typedef struct AVCodecTag { - enum AVCodecID id; - unsigned int tag; -} AVCodecTag; - -typedef struct CodecMime{ - char str[32]; - enum AVCodecID id; -} CodecMime; - -struct AVFormatInternal { - /** - * Number of streams relevant for interleaving. - * Muxing only. - */ - int nb_interleaved_streams; -}; - -#ifdef __GNUC__ -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - __typeof__(tab) _tab = (tab);\ - __typeof__(elem) _elem = (elem);\ - (void)sizeof(**_tab == _elem); /* check that types are compatible */\ - av_dynarray_add(_tab, nb_ptr, _elem);\ -} while(0) -#else -#define dynarray_add(tab, nb_ptr, elem)\ -do {\ - av_dynarray_add((tab), nb_ptr, (elem));\ -} while(0) -#endif - -struct tm *ff_brktimegm(time_t secs, struct tm *tm); - -char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase); - -/** - * Parse a string of hexadecimal strings. Any space between the hexadecimal - * digits is ignored. - * - * @param data if non-null, the parsed data is written to this pointer - * @param p the string to parse - * @return the number of bytes written (or to be written, if data is null) - */ -int ff_hex_to_data(uint8_t *data, const char *p); - -void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); - -/** - * Add packet to AVFormatContext->packet_buffer list, determining its - * interleaved position using compare() function argument. - * @return 0, or < 0 on error - */ -int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, - int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)); - -void ff_read_frame_flush(AVFormatContext *s); - -#define NTP_OFFSET 2208988800ULL -#define NTP_OFFSET_US (NTP_OFFSET * 1000000ULL) - -/** Get the current time since NTP epoch in microseconds. */ -uint64_t ff_ntp_time(void); - -/** - * Append the media-specific SDP fragment for the media stream c - * to the buffer buff. - * - * Note, the buffer needs to be initialized, since it is appended to - * existing content. - * - * @param buff the buffer to append the SDP fragment to - * @param size the size of the buff buffer - * @param st the AVStream of the media to describe - * @param idx the global stream index - * @param dest_addr the destination address of the media stream, may be NULL - * @param dest_type the destination address type, may be NULL - * @param port the destination port of the media stream, 0 if unknown - * @param ttl the time to live of the stream, 0 if not multicast - * @param fmt the AVFormatContext, which might contain options modifying - * the generated SDP - */ -void ff_sdp_write_media(char *buff, int size, AVStream *st, int idx, - const char *dest_addr, const char *dest_type, - int port, int ttl, AVFormatContext *fmt); - -/** - * Write a packet to another muxer than the one the user originally - * intended. Useful when chaining muxers, where one muxer internally - * writes a received packet to another muxer. - * - * @param dst the muxer to write the packet to - * @param dst_stream the stream index within dst to write the packet to - * @param pkt the packet to be written - * @param src the muxer the packet originally was intended for - * @return the value av_write_frame returned - */ -int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, - AVFormatContext *src); - -/** - * Get the length in bytes which is needed to store val as v. - */ -int ff_get_v_length(uint64_t val); - -/** - * Put val using a variable number of bytes. - */ -void ff_put_v(AVIOContext *bc, uint64_t val); - -/** - * Read a whole line of text from AVIOContext. Stop reading after reaching - * either a \\n, a \\0 or EOF. The returned string is always \\0-terminated, - * and may be truncated if the buffer is too small. - * - * @param s the read-only AVIOContext - * @param buf buffer to store the read line - * @param maxlen size of the buffer - * @return the length of the string written in the buffer, not including the - * final \\0 - */ -int ff_get_line(AVIOContext *s, char *buf, int maxlen); - -#define SPACE_CHARS " \t\r\n" - -/** - * Callback function type for ff_parse_key_value. - * - * @param key a pointer to the key - * @param key_len the number of bytes that belong to the key, including the '=' - * char - * @param dest return the destination pointer for the value in *dest, may - * be null to ignore the value - * @param dest_len the length of the *dest buffer - */ -typedef void (*ff_parse_key_val_cb)(void *context, const char *key, - int key_len, char **dest, int *dest_len); -/** - * Parse a string with comma-separated key=value pairs. The value strings - * may be quoted and may contain escaped characters within quoted strings. - * - * @param str the string to parse - * @param callback_get_buf function that returns where to store the - * unescaped value string. - * @param context the opaque context pointer to pass to callback_get_buf - */ -void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, - void *context); - -/** - * Find stream index based on format-specific stream ID - * @return stream index, or < 0 on error - */ -int ff_find_stream_index(AVFormatContext *s, int id); - -/** - * Internal version of av_index_search_timestamp - */ -int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, - int64_t wanted_timestamp, int flags); - -/** - * Internal version of av_add_index_entry - */ -int ff_add_index_entry(AVIndexEntry **index_entries, - int *nb_index_entries, - unsigned int *index_entries_allocated_size, - int64_t pos, int64_t timestamp, int size, int distance, int flags); - -/** - * Add a new chapter. - * - * @param s media file handle - * @param id unique ID for this chapter - * @param start chapter start time in time_base units - * @param end chapter end time in time_base units - * @param title chapter title - * - * @return AVChapter or NULL on error - */ -AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title); - -/** - * Ensure the index uses less memory than the maximum specified in - * AVFormatContext.max_index_size by discarding entries if it grows - * too large. - */ -void ff_reduce_index(AVFormatContext *s, int stream_index); - -enum AVCodecID ff_guess_image2_codec(const char *filename); - -/** - * Convert a date string in ISO8601 format to Unix timestamp. - */ -int64_t ff_iso8601_to_unix_time(const char *datestr); - -/** - * Perform a binary search using av_index_search_timestamp() and - * AVInputFormat.read_timestamp(). - * - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int ff_seek_frame_binary(AVFormatContext *s, int stream_index, - int64_t target_ts, int flags); - -/** - * Update cur_dts of all streams based on the given timestamp and AVStream. - * - * Stream ref_st unchanged, others set cur_dts in their native time base. - * Only needed for timestamp wrapping or if (dts not set and pts!=dts). - * @param timestamp new dts expressed in time_base of param ref_st - * @param ref_st reference stream giving time_base of param timestamp - */ -void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp); - -int ff_find_last_ts(AVFormatContext *s, int stream_index, int64_t *ts, int64_t *pos, - int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); - -/** - * Perform a binary search using read_timestamp(). - * - * @param target_ts target timestamp in the time base of the given stream - * @param stream_index stream number - */ -int64_t ff_gen_search(AVFormatContext *s, int stream_index, - int64_t target_ts, int64_t pos_min, - int64_t pos_max, int64_t pos_limit, - int64_t ts_min, int64_t ts_max, - int flags, int64_t *ts_ret, - int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )); - -/** - * Set the time base and wrapping info for a given stream. This will be used - * to interpret the stream's timestamps. If the new time base is invalid - * (numerator or denominator are non-positive), it leaves the stream - * unchanged. - * - * @param s stream - * @param pts_wrap_bits number of bits effectively used by the pts - * (used for wrap control) - * @param pts_num time base numerator - * @param pts_den time base denominator - */ -void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, - unsigned int pts_num, unsigned int pts_den); - -/** - * Add side data to a packet for changing parameters to the given values. - * Parameters set to 0 aren't included in the change. - */ -int ff_add_param_change(AVPacket *pkt, int32_t channels, - uint64_t channel_layout, int32_t sample_rate, - int32_t width, int32_t height); - -/** - * Set the timebase for each stream from the corresponding codec timebase and - * print it. - */ -int ff_framehash_write_header(AVFormatContext *s); - -/** - * Read a transport packet from a media file. - * - * @param s media file handle - * @param pkt is filled - * @return 0 if OK, AVERROR_xxx on error - */ -int ff_read_packet(AVFormatContext *s, AVPacket *pkt); - -/** - * Interleave a packet per dts in an output media file. - * - * Packets with pkt->destruct == av_destruct_packet will be freed inside this - * function, so they cannot be used after it. Note that calling av_free_packet() - * on them is still safe. - * - * @param s media file handle - * @param out the interleaved packet will be output here - * @param pkt the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occurred - */ -int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, - AVPacket *pkt, int flush); - -void ff_free_stream(AVFormatContext *s, AVStream *st); - -/** - * Return the frame duration in seconds. Return 0 if not available. - */ -void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt); - -int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux); - -unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id); - -enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag); - -/** - * Select a PCM codec based on the given parameters. - * - * @param bps bits-per-sample - * @param flt floating-point - * @param be big-endian - * @param sflags signed flags. each bit corresponds to one byte of bit depth. - * e.g. the 1st bit indicates if 8-bit should be signed or - * unsigned, the 2nd bit indicates if 16-bit should be signed or - * unsigned, etc... This is useful for formats such as WAVE where - * only 8-bit is unsigned and all other bit depths are signed. - * @return a PCM codec id or AV_CODEC_ID_NONE - */ -enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags); - -/** - * Chooses a timebase for muxing the specified stream. - * - * The choosen timebase allows sample accurate timestamps based - * on the framerate or sample rate for audio streams. It also is - * at least as precisse as 1/min_precission would be. - */ -AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission); - -/** - * Generate standard extradata for AVC-Intra based on width/height and field - * order. - */ -int ff_generate_avci_extradata(AVStream *st); - -/** - * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end - * which is always set to 0. - * - * @param size size of extradata - * @return 0 if OK, AVERROR_xxx on error - */ -int ff_alloc_extradata(AVCodecContext *avctx, int size); - -/** - * Allocate extradata with additional FF_INPUT_BUFFER_PADDING_SIZE at end - * which is always set to 0 and fill it from pb. - * - * @param size size of extradata - * @return >= 0 if OK, AVERROR_xxx on error - */ -int ff_get_extradata(AVCodecContext *avctx, AVIOContext *pb, int size); - -/** - * add frame for rfps calculation. - * - * @param dts timestamp of the i-th frame - * @return 0 if OK, AVERROR_xxx on error - */ -int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t dts); - -void ff_rfps_calculate(AVFormatContext *ic); - -/** - * Flags for AVFormatContext.write_uncoded_frame() - */ -enum AVWriteUncodedFrameFlags { - - /** - * Query whether the feature is possible on this stream. - * The frame argument is ignored. - */ - AV_WRITE_UNCODED_FRAME_QUERY = 0x0001, - -}; - - -#endif /* AVFORMAT_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.c deleted file mode 100644 index fc3a9d7d5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * copyright (c) 2009 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "metadata.h" -#include "libavutil/dict.h" -#include "libavutil/avstring.h" - -void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv) -{ - /* TODO: use binary search to look up the two conversion tables - if the tables are getting big enough that it would matter speed wise */ - const AVMetadataConv *sc, *dc; - AVDictionaryEntry *mtag = NULL; - AVDictionary *dst = NULL; - const char *key; - - if (d_conv == s_conv) - return; - - while ((mtag = av_dict_get(*pm, "", mtag, AV_DICT_IGNORE_SUFFIX))) { - key = mtag->key; - if (s_conv) - for (sc=s_conv; sc->native; sc++) - if (!av_strcasecmp(key, sc->native)) { - key = sc->generic; - break; - } - if (d_conv) - for (dc=d_conv; dc->native; dc++) - if (!av_strcasecmp(key, dc->generic)) { - key = dc->native; - break; - } - av_dict_set(&dst, key, mtag->value, 0); - } - av_dict_free(pm); - *pm = dst; -} - -void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv) -{ - int i; - ff_metadata_conv(&ctx->metadata, d_conv, s_conv); - for (i=0; inb_streams ; i++) - ff_metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv); - for (i=0; inb_chapters; i++) - ff_metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv); - for (i=0; inb_programs; i++) - ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.h deleted file mode 100644 index 6586094e8..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/metadata.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * copyright (c) 2009 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_METADATA_H -#define AVFORMAT_METADATA_H - -/** - * @file - * internal metadata API header - * see avformat.h or the public API! - */ - - -#include "avformat.h" -#include "libavutil/dict.h" - -typedef struct AVMetadataConv { - const char *native; - const char *generic; -} AVMetadataConv; - -void ff_metadata_conv(AVDictionary **pm, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); -void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv, - const AVMetadataConv *s_conv); - -#endif /* AVFORMAT_METADATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mp3dec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mp3dec.c deleted file mode 100644 index 95435712b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mp3dec.c +++ /dev/null @@ -1,480 +0,0 @@ -/* - * MP3 demuxer - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "libavutil/opt.h" -#include "libavutil/avstring.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/dict.h" -#include "libavutil/mathematics.h" -#include "avformat.h" -#include "internal.h" -#include "id3v2.h" -#include "id3v1.h" -#include "apetag.h" -#include "libavcodec/mpegaudiodecheader.h" - -#define MP3_RESYNC_TOLERANCE_BYTES 65536 - -#define XING_FLAG_FRAMES 0x01 -#define XING_FLAG_SIZE 0x02 -#define XING_FLAG_TOC 0x04 - -#define XING_TOC_COUNT 100 - -typedef struct { - AVClass *class; - int64_t filesize; - int64_t header_filesize; - int xing_toc; - int start_pad; - int end_pad; - int usetoc; - int is_cbr; -} MP3DecContext; - -/* mp3 read */ - -static int mp3_read_probe(AVProbeData *p) -{ - int max_frames, first_frames = 0; - int fsize, frames, sample_rate; - uint32_t header; - const uint8_t *buf, *buf0, *buf2, *end; - AVCodecContext avctx; - - buf0 = p->buf; - end = p->buf + p->buf_size - sizeof(uint32_t); - while(buf0 < end && !*buf0) - buf0++; - - max_frames = 0; - buf = buf0; - - for(; buf < end; buf= buf2+1) { - buf2 = buf; - if(ff_mpa_check_header(AV_RB32(buf2))) - continue; - - for(frames = 0; buf2 < end; frames++) { - header = AV_RB32(buf2); - fsize = avpriv_mpa_decode_header(&avctx, header, &sample_rate, &sample_rate, &sample_rate, &sample_rate); - if(fsize < 0) - break; - buf2 += fsize; - } - max_frames = FFMAX(max_frames, frames); - if(buf == buf0) - first_frames= frames; - } - // keep this in sync with ac3 probe, both need to avoid - // issues with MPEG-files! - if (first_frames>=4) return AVPROBE_SCORE_EXTENSION + 1; - else if(max_frames>200)return AVPROBE_SCORE_EXTENSION; - else if(max_frames>=4) return AVPROBE_SCORE_EXTENSION / 2; - else if(ff_id3v2_match(buf0, ID3v2_DEFAULT_MAGIC) && 2*ff_id3v2_tag_len(buf0) >= p->buf_size) - return p->buf_size < PROBE_BUF_MAX ? AVPROBE_SCORE_EXTENSION / 4 : AVPROBE_SCORE_EXTENSION - 2; - else if(max_frames>=1) return 1; - else return 0; -//mpegps_mp3_unrecognized_format.mpg has max_frames=3 -} - -static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration) -{ - int i; - MP3DecContext *mp3 = s->priv_data; - int fill_index = mp3->usetoc && duration > 0; - - if (!filesize && - !(filesize = avio_size(s->pb))) { - av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n"); - fill_index = 0; - } - - for (i = 0; i < XING_TOC_COUNT; i++) { - uint8_t b = avio_r8(s->pb); - if (fill_index) - av_add_index_entry(s->streams[0], - av_rescale(b, filesize, 256), - av_rescale(i, duration, XING_TOC_COUNT), - 0, 0, AVINDEX_KEYFRAME); - } - if (fill_index) - mp3->xing_toc = 1; -} - -/** - * Try to find Xing/Info/VBRI tags and compute duration from info therein - */ -static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) -{ - MP3DecContext *mp3 = s->priv_data; - uint32_t v, spf; - unsigned frames = 0; /* Total number of frames in file */ - unsigned size = 0; /* Total number of bytes in the stream */ - static const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}}; - MPADecodeHeader c; - int vbrtag_size = 0; - int is_cbr; - AVDictionaryEntry *de; - uint64_t duration = 0; - - v = avio_rb32(s->pb); - if(ff_mpa_check_header(v) < 0) - return -1; - - if (avpriv_mpegaudio_decode_header(&c, v) == 0) - vbrtag_size = c.frame_size; - if(c.layer != 3) - return -1; - - mp3->start_pad = 0; - mp3->end_pad = 0; - - spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ - - /* Check for Xing / Info tag */ - avio_skip(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1]); - v = avio_rb32(s->pb); - is_cbr = v == MKBETAG('I', 'n', 'f', 'o'); - if (v == MKBETAG('X', 'i', 'n', 'g') || is_cbr) { - v = avio_rb32(s->pb); - if(v & XING_FLAG_FRAMES) - frames = avio_rb32(s->pb); - if(v & XING_FLAG_SIZE) - size = avio_rb32(s->pb); - if (v & XING_FLAG_TOC) - read_xing_toc(s, size, av_rescale_q(frames, (AVRational){spf, c.sample_rate}, - st->time_base)); - if(v & 8) - avio_skip(s->pb, 4); - - v = avio_rb32(s->pb); - if(v == MKBETAG('L', 'A', 'M', 'E') || v == MKBETAG('L', 'a', 'v', 'f')) { - avio_skip(s->pb, 21-4); - v= avio_rb24(s->pb); - mp3->start_pad = v>>12; - mp3-> end_pad = v&4095; - if (mp3->end_pad >= 528 + 1) { - mp3->end_pad = mp3->end_pad - (528 + 1); - st->skip_samples = mp3->start_pad + 528 + 1; - } else { - st->skip_samples = mp3->start_pad; - } - if (!st->start_time) - st->start_time = av_rescale_q(st->skip_samples, - (AVRational){1, c.sample_rate}, - st->time_base); - av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3-> end_pad); - } - } - - /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ - avio_seek(s->pb, base + 4 + 32, SEEK_SET); - v = avio_rb32(s->pb); - if(v == MKBETAG('V', 'B', 'R', 'I')) { - /* Check tag version */ - if(avio_rb16(s->pb) == 1) { - /* skip delay and quality */ - avio_skip(s->pb, 4); - size = avio_rb32(s->pb); - frames = avio_rb32(s->pb); - } - } - - if (!frames) - vbrtag_size = 0; - - if (s->metadata && (de = av_dict_get(s->metadata, "iTunSMPB", NULL, 0))) { - uint32_t zero, start_pad, end_pad; - uint64_t last_eight_frames_offset; - if (sscanf(de->value, "%x %x %x %llx %x %llx", &zero, &start_pad, &end_pad, &duration, &zero, &last_eight_frames_offset) < 6) { - duration = 0; - } - else { - mp3->start_pad = start_pad; - mp3->end_pad = end_pad; - if (end_pad >= 528 + 1) - mp3->end_pad = end_pad - (528 + 1); - st->skip_samples = mp3->start_pad + 528 + 1; - av_log(s, AV_LOG_DEBUG, "pad %d %d\n", mp3->start_pad, mp3->end_pad); - if (s->pb->seekable) { - int i; - size = last_eight_frames_offset; - avio_seek(s->pb, base + vbrtag_size + last_eight_frames_offset, SEEK_SET); - for (i = 0; i < 8; ++i) { - v = avio_rb32(s->pb); - if (ff_mpa_check_header(v) < 0) - return -1; - if (avpriv_mpegaudio_decode_header(&c, v) != 0) - break; - size += c.frame_size; - avio_skip(s->pb, c.frame_size - 4); - } - } - } - } - - if(!frames && !size && !duration) - return -1; - - /* Skip the vbr tag frame */ - avio_seek(s->pb, base + vbrtag_size, SEEK_SET); - - if (duration) - st->duration = av_rescale_q(duration, (AVRational){1, c.sample_rate}, st->time_base); - else if(frames) - st->duration = av_rescale_q(frames, (AVRational){spf, c.sample_rate}, - st->time_base) - av_rescale_q(mp3->end_pad, (AVRational){1, c.sample_rate}, st->time_base); - - if (size) { - if (duration) - st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, duration); - else if (frames) - st->codec->bit_rate = av_rescale(size, 8 * c.sample_rate, frames * (int64_t)spf); - } - - mp3->is_cbr = is_cbr; - mp3->header_filesize = size; - - return 0; -} - -static int mp3_read_header(AVFormatContext *s) -{ - MP3DecContext *mp3 = s->priv_data; - AVStream *st; - int64_t off; - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_MP3; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - st->start_time = 0; - - // lcm of all mp3 sample rates - avpriv_set_pts_info(st, 64, 1, 14112000); - - s->pb->maxsize = -1; - off = avio_tell(s->pb); - - if (!av_dict_get(s->metadata, "", NULL, AV_DICT_IGNORE_SUFFIX)) - ff_id3v1_read(s); - - if(s->pb->seekable) - mp3->filesize = avio_size(s->pb); - - if (mp3_parse_vbr_tags(s, st, off) < 0 && s->pb->seekable) - { - uint64_t duration = 0; - uint8_t buf[8]; - int sample_rate = 0; - int retry_count; - /* Time for a full parse! */ - avio_seek(s->pb, mp3->filesize - 128, SEEK_SET); - avio_read(s->pb, buf, 3); - if (buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') - mp3->filesize -= 128; - avio_seek(s->pb, mp3->filesize - APE_TAG_FOOTER_BYTES, SEEK_SET); - avio_read(s->pb, buf, 8); - if (memcmp(buf, APE_TAG_PREAMBLE, 8) == 0) - { - avio_seek(s->pb, 4, SEEK_CUR); - mp3->filesize -= avio_rl32(s->pb) + APE_TAG_FOOTER_BYTES; - } - avio_seek(s->pb, off, SEEK_SET); - retry_count = MP3_RESYNC_TOLERANCE_BYTES; - while (avio_tell(s->pb) < mp3->filesize) - { - MPADecodeHeader c; - uint32_t v, spf; - - v = avio_rb32(s->pb); - - if(ff_mpa_check_header(v) < 0) - { - if (--retry_count) - { - avio_seek(s->pb, -3, SEEK_CUR); - continue; - } - else break; - } - - retry_count = MP3_RESYNC_TOLERANCE_BYTES; - - if (avpriv_mpegaudio_decode_header(&c, v) != 0) - break; - - if (!sample_rate) - sample_rate = c.sample_rate; - - spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ - - duration += spf; - - avio_skip(s->pb, c.frame_size - 4); - } - avio_seek(s->pb, off, SEEK_SET); - st->duration = duration && sample_rate ? av_rescale_q(duration, (AVRational){1, sample_rate}, st->time_base) : 0; - } - - /* the parameters will be extracted from the compressed bitstream */ - return 0; -} - -#define MP3_PACKET_SIZE 1024 - -static int mp3_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - MP3DecContext *mp3 = s->priv_data; - int ret, size; - int64_t pos; - - size= MP3_PACKET_SIZE; - pos = avio_tell(s->pb); - if(mp3->filesize > ID3v1_TAG_SIZE && pos < mp3->filesize) - size= FFMIN(size, mp3->filesize - pos); - - ret= av_get_packet(s->pb, pkt, size); - if (ret <= 0) { - if(ret<0) - return ret; - return AVERROR_EOF; - } - - pkt->flags &= ~AV_PKT_FLAG_CORRUPT; - pkt->stream_index = 0; - - if (ret >= ID3v1_TAG_SIZE && - memcmp(&pkt->data[ret - ID3v1_TAG_SIZE], "TAG", 3) == 0) - ret -= ID3v1_TAG_SIZE; - - /* note: we need to modify the packet size here to handle the last - packet */ - pkt->size = ret; - return ret; -} - -static int check(AVFormatContext *s, int64_t pos) -{ - int64_t ret = avio_seek(s->pb, pos, SEEK_SET); - unsigned header; - MPADecodeHeader sd; - if (ret < 0) - return ret; - header = avio_rb32(s->pb); - if (ff_mpa_check_header(header) < 0) - return -1; - if (avpriv_mpegaudio_decode_header(&sd, header) == 1) - return -1; - return sd.frame_size; -} - -static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp, - int flags) -{ - MP3DecContext *mp3 = s->priv_data; - AVIndexEntry *ie, ie1; - AVStream *st = s->streams[0]; - int64_t ret = av_index_search_timestamp(st, timestamp, flags); - int i, j; - int dir = (flags&AVSEEK_FLAG_BACKWARD) ? -1 : 1; - - if (mp3->is_cbr && st->duration > 0 && mp3->header_filesize > s->data_offset) { - int64_t filesize = avio_size(s->pb); - int64_t duration; - if (filesize <= s->data_offset) - filesize = mp3->header_filesize; - filesize -= s->data_offset; - duration = av_rescale(st->duration, filesize, mp3->header_filesize - s->data_offset); - ie = &ie1; - timestamp = av_clip64(timestamp, 0, duration); - ie->timestamp = timestamp; - ie->pos = av_rescale(timestamp, filesize, duration) + s->data_offset; - } else if (mp3->xing_toc) { - if (ret < 0) - return ret; - - ie = &st->index_entries[ret]; - } else { - st->skip_samples = timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; - - return -1; - } - - if (dir < 0) - avio_seek(s->pb, FFMAX(ie->pos - 4096, 0), SEEK_SET); - ret = avio_seek(s->pb, ie->pos, SEEK_SET); - if (ret < 0) - return ret; - -#define MIN_VALID 3 - for(i=0; i<4096; i++) { - int64_t pos = ie->pos + i*dir; - for(j=0; jpb, ie->pos + i*dir, SEEK_SET); - if (ret < 0) - return ret; - ff_update_cur_dts(s, st, ie->timestamp); - st->skip_samples = ie->timestamp <= 0 ? mp3->start_pad + 528 + 1 : 0; - return 0; -} - -static const AVOption options[] = { - { "usetoc", "use table of contents", offsetof(MP3DecContext, usetoc), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, AV_OPT_FLAG_DECODING_PARAM}, - { NULL }, -}; - -static const AVClass demuxer_class = { - .class_name = "mp3", - .item_name = av_default_item_name, - .option = options, - .version = LIBAVUTIL_VERSION_INT, - .category = AV_CLASS_CATEGORY_DEMUXER, -}; - -AVInputFormat ff_mp3_demuxer = { - .name = "mp3", - .long_name = NULL_IF_CONFIG_SMALL("MP2/3 (MPEG audio layer 2/3)"), - .read_probe = mp3_read_probe, - .read_header = mp3_read_header, - .read_packet = mp3_read_packet, - .read_seek = mp3_seek, - .priv_data_size = sizeof(MP3DecContext), - .flags = AVFMT_GENERIC_INDEX, - .extensions = "mp2,mp3,m2a,mpa", /* XXX: use probe */ - .priv_class = &demuxer_class, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.c deleted file mode 100644 index 35d3f6bb9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.c +++ /dev/null @@ -1,957 +0,0 @@ -/* - * MPEG1/2 demuxer - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "internal.h" -#include "mpeg.h" - -#if CONFIG_VOBSUB_DEMUXER -# include "subtitles.h" -# include "libavutil/bprint.h" -#endif - -#undef NDEBUG -#include -#include "libavutil/avassert.h" - -/*********************************************/ -/* demux code */ - -#define MAX_SYNC_SIZE 100000 - -static int check_pes(const uint8_t *p, const uint8_t *end){ - int pes1; - int pes2= (p[3] & 0xC0) == 0x80 - && (p[4] & 0xC0) != 0x40 - &&((p[4] & 0xC0) == 0x00 || (p[4]&0xC0)>>2 == (p[6]&0xF0)); - - for(p+=3; pbuf_size; i++){ - code = (code<<8) + p->buf[i]; - if ((code & 0xffffff00) == 0x100) { - int len= p->buf[i+1] << 8 | p->buf[i+2]; - int pes= check_pes(p->buf+i, p->buf+p->buf_size); - int pack = check_pack_header(p->buf+i); - - if(code == SYSTEM_HEADER_START_CODE) sys++; - else if(code == PACK_START_CODE && pack) pspack++; - else if((code & 0xf0) == VIDEO_ID && pes) vid++; - // skip pes payload to avoid start code emulation for private - // and audio streams - else if((code & 0xe0) == AUDIO_ID && pes) {audio++; i+=len;} - else if(code == PRIVATE_STREAM_1 && pes) {priv1++; i+=len;} - else if(code == 0x1fd && pes) vid++; //VC1 - - else if((code & 0xf0) == VIDEO_ID && !pes) invalid++; - else if((code & 0xe0) == AUDIO_ID && !pes) invalid++; - else if(code == PRIVATE_STREAM_1 && !pes) invalid++; - } - } - - if(vid+audio > invalid+1) /* invalid VDR files nd short PES streams */ - score = AVPROBE_SCORE_EXTENSION / 2; - - if(sys>invalid && sys*9 <= pspack*10) - return (audio > 12 || vid > 3 || pspack > 2) ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2; // 1 more than .mpg - if(pspack > invalid && (priv1+vid+audio)*10 >= pspack*9) - return pspack > 2 ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2; // 1 more than .mpg - if((!!vid ^ !!audio) && (audio > 4 || vid > 1) && !sys && !pspack && p->buf_size>2048 && vid + audio > invalid) /* PES stream */ - return (audio > 12 || vid > 3 + 2*invalid) ? AVPROBE_SCORE_EXTENSION + 2 : AVPROBE_SCORE_EXTENSION / 2; - - //02-Penguin.flac has sys:0 priv1:0 pspack:0 vid:0 audio:1 - //mp3_misidentified_2.mp3 has sys:0 priv1:0 pspack:0 vid:0 audio:6 - //Have\ Yourself\ a\ Merry\ Little\ Christmas.mp3 0 0 0 5 0 1 len:21618 - return score; -} - - -typedef struct MpegDemuxContext { - int32_t header_state; - unsigned char psm_es_type[256]; - int sofdec; - int dvd; - int imkh_cctv; -#if CONFIG_VOBSUB_DEMUXER - AVFormatContext *sub_ctx; - FFDemuxSubtitlesQueue q[32]; -#endif -} MpegDemuxContext; - -static int mpegps_read_header(AVFormatContext *s) -{ - MpegDemuxContext *m = s->priv_data; - char buffer[7]; - int64_t last_pos = avio_tell(s->pb); - - m->header_state = 0xff; - s->ctx_flags |= AVFMTCTX_NOHEADER; - - avio_get_str(s->pb, 6, buffer, sizeof(buffer)); - if (!memcmp("IMKH", buffer, 4)) { - m->imkh_cctv = 1; - } else if (!memcmp("Sofdec", buffer, 6)) { - m->sofdec = 1; - } else - avio_seek(s->pb, last_pos, SEEK_SET); - - /* no need to do more */ - return 0; -} - -static int64_t get_pts(AVIOContext *pb, int c) -{ - uint8_t buf[5]; - - buf[0] = c<0 ? avio_r8(pb) : c; - avio_read(pb, buf+1, 4); - - return ff_parse_pes_pts(buf); -} - -static int find_next_start_code(AVIOContext *pb, int *size_ptr, - int32_t *header_state) -{ - unsigned int state, v; - int val, n; - - state = *header_state; - n = *size_ptr; - while (n > 0) { - if (url_feof(pb)) - break; - v = avio_r8(pb); - n--; - if (state == 0x000001) { - state = ((state << 8) | v) & 0xffffff; - val = state; - goto found; - } - state = ((state << 8) | v) & 0xffffff; - } - val = -1; - found: - *header_state = state; - *size_ptr = n; - return val; -} - -/** - * Extract stream types from a program stream map - * According to ISO/IEC 13818-1 ('MPEG-2 Systems') table 2-35 - * - * @return number of bytes occupied by PSM in the bitstream - */ -static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) -{ - int psm_length, ps_info_length, es_map_length; - - psm_length = avio_rb16(pb); - avio_r8(pb); - avio_r8(pb); - ps_info_length = avio_rb16(pb); - - /* skip program_stream_info */ - avio_skip(pb, ps_info_length); - es_map_length = avio_rb16(pb); - /* Ignore es_map_length, trust psm_length */ - es_map_length = psm_length - ps_info_length - 10; - - /* at least one es available? */ - while (es_map_length >= 4){ - unsigned char type = avio_r8(pb); - unsigned char es_id = avio_r8(pb); - uint16_t es_info_length = avio_rb16(pb); - /* remember mapping from stream id to stream type */ - m->psm_es_type[es_id] = type; - /* skip program_stream_info */ - avio_skip(pb, es_info_length); - es_map_length -= 4 + es_info_length; - } - avio_rb32(pb); /* crc32 */ - return 2 + psm_length; -} - -/* read the next PES header. Return its position in ppos - (if not NULL), and its start code, pts and dts. - */ -static int mpegps_read_pes_header(AVFormatContext *s, - int64_t *ppos, int *pstart_code, - int64_t *ppts, int64_t *pdts) -{ - MpegDemuxContext *m = s->priv_data; - int len, size, startcode, c, flags, header_len; - int pes_ext, ext2_len, id_ext, skip; - int64_t pts, dts; - int64_t last_sync= avio_tell(s->pb); - - error_redo: - avio_seek(s->pb, last_sync, SEEK_SET); - redo: - /* next start code (should be immediately after) */ - m->header_state = 0xff; - size = MAX_SYNC_SIZE; - startcode = find_next_start_code(s->pb, &size, &m->header_state); - last_sync = avio_tell(s->pb); - if (startcode < 0){ - if(url_feof(s->pb)) - return AVERROR_EOF; - //FIXME we should remember header_state - return AVERROR(EAGAIN); - } - - if (startcode == PACK_START_CODE) - goto redo; - if (startcode == SYSTEM_HEADER_START_CODE) - goto redo; - if (startcode == PADDING_STREAM) { - avio_skip(s->pb, avio_rb16(s->pb)); - goto redo; - } - if (startcode == PRIVATE_STREAM_2) { - if (!m->sofdec) { - /* Need to detect whether this from a DVD or a 'Sofdec' stream */ - int len = avio_rb16(s->pb); - int bytesread = 0; - uint8_t *ps2buf = av_malloc(len); - - if (ps2buf) { - bytesread = avio_read(s->pb, ps2buf, len); - - if (bytesread != len) { - avio_skip(s->pb, len - bytesread); - } else { - uint8_t *p = 0; - if (len >= 6) - p = memchr(ps2buf, 'S', len - 5); - - if (p) - m->sofdec = !memcmp(p+1, "ofdec", 5); - - m->sofdec -= !m->sofdec; - - if (m->sofdec < 0) { - if (len == 980 && ps2buf[0] == 0) { - /* PCI structure? */ - uint32_t startpts = AV_RB32(ps2buf + 0x0d); - uint32_t endpts = AV_RB32(ps2buf + 0x11); - uint8_t hours = ((ps2buf[0x19] >> 4) * 10) + (ps2buf[0x19] & 0x0f); - uint8_t mins = ((ps2buf[0x1a] >> 4) * 10) + (ps2buf[0x1a] & 0x0f); - uint8_t secs = ((ps2buf[0x1b] >> 4) * 10) + (ps2buf[0x1b] & 0x0f); - - m->dvd = (hours <= 23 && - mins <= 59 && - secs <= 59 && - (ps2buf[0x19] & 0x0f) < 10 && - (ps2buf[0x1a] & 0x0f) < 10 && - (ps2buf[0x1b] & 0x0f) < 10 && - endpts >= startpts); - } else if (len == 1018 && ps2buf[0] == 1) { - /* DSI structure? */ - uint8_t hours = ((ps2buf[0x1d] >> 4) * 10) + (ps2buf[0x1d] & 0x0f); - uint8_t mins = ((ps2buf[0x1e] >> 4) * 10) + (ps2buf[0x1e] & 0x0f); - uint8_t secs = ((ps2buf[0x1f] >> 4) * 10) + (ps2buf[0x1f] & 0x0f); - - m->dvd = (hours <= 23 && - mins <= 59 && - secs <= 59 && - (ps2buf[0x1d] & 0x0f) < 10 && - (ps2buf[0x1e] & 0x0f) < 10 && - (ps2buf[0x1f] & 0x0f) < 10); - } - } - } - - av_free(ps2buf); - - /* If this isn't a DVD packet or no memory - * could be allocated, just ignore it. - * If we did, move back to the start of the - * packet (plus 'length' field) */ - if (!m->dvd || avio_skip(s->pb, -(len + 2)) < 0) { - /* Skip back failed. - * This packet will be lost but that can't be helped - * if we can't skip back - */ - goto redo; - } - } else { - /* No memory */ - avio_skip(s->pb, len); - goto redo; - } - } else if (!m->dvd) { - int len = avio_rb16(s->pb); - avio_skip(s->pb, len); - goto redo; - } - } - if (startcode == PROGRAM_STREAM_MAP) { - mpegps_psm_parse(m, s->pb); - goto redo; - } - - /* find matching stream */ - if (!((startcode >= 0x1c0 && startcode <= 0x1df) || - (startcode >= 0x1e0 && startcode <= 0x1ef) || - (startcode == 0x1bd) || - (startcode == PRIVATE_STREAM_2) || - (startcode == 0x1fd))) - goto redo; - if (ppos) { - *ppos = avio_tell(s->pb) - 4; - } - len = avio_rb16(s->pb); - pts = - dts = AV_NOPTS_VALUE; - if (startcode != PRIVATE_STREAM_2) - { - /* stuffing */ - for(;;) { - if (len < 1) - goto error_redo; - c = avio_r8(s->pb); - len--; - /* XXX: for mpeg1, should test only bit 7 */ - if (c != 0xff) - break; - } - if ((c & 0xc0) == 0x40) { - /* buffer scale & size */ - avio_r8(s->pb); - c = avio_r8(s->pb); - len -= 2; - } - if ((c & 0xe0) == 0x20) { - dts = pts = get_pts(s->pb, c); - len -= 4; - if (c & 0x10){ - dts = get_pts(s->pb, -1); - len -= 5; - } - } else if ((c & 0xc0) == 0x80) { - /* mpeg 2 PES */ - flags = avio_r8(s->pb); - header_len = avio_r8(s->pb); - len -= 2; - if (header_len > len) - goto error_redo; - len -= header_len; - if (flags & 0x80) { - dts = pts = get_pts(s->pb, -1); - header_len -= 5; - if (flags & 0x40) { - dts = get_pts(s->pb, -1); - header_len -= 5; - } - } - if (flags & 0x3f && header_len == 0){ - flags &= 0xC0; - av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n"); - } - if (flags & 0x01) { /* PES extension */ - pes_ext = avio_r8(s->pb); - header_len--; - /* Skip PES private data, program packet sequence counter and P-STD buffer */ - skip = (pes_ext >> 4) & 0xb; - skip += skip & 0x9; - if (pes_ext & 0x40 || skip > header_len){ - av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext); - pes_ext=skip=0; - } - avio_skip(s->pb, skip); - header_len -= skip; - - if (pes_ext & 0x01) { /* PES extension 2 */ - ext2_len = avio_r8(s->pb); - header_len--; - if ((ext2_len & 0x7f) > 0) { - id_ext = avio_r8(s->pb); - if ((id_ext & 0x80) == 0) - startcode = ((startcode & 0xff) << 8) | id_ext; - header_len--; - } - } - } - if(header_len < 0) - goto error_redo; - avio_skip(s->pb, header_len); - } - else if( c!= 0xf ) - goto redo; - } - - if (startcode == PRIVATE_STREAM_1) { - startcode = avio_r8(s->pb); - len--; - } - if(len<0) - goto error_redo; - if(dts != AV_NOPTS_VALUE && ppos){ - int i; - for(i=0; inb_streams; i++){ - if(startcode == s->streams[i]->id && - s->pb->seekable /* index useless on streams anyway */) { - ff_reduce_index(s, i); - av_add_index_entry(s->streams[i], *ppos, dts, 0, 0, AVINDEX_KEYFRAME /* FIXME keyframe? */); - } - } - } - - *pstart_code = startcode; - *ppts = pts; - *pdts = dts; - return len; -} - -static int mpegps_read_packet(AVFormatContext *s, - AVPacket *pkt) -{ - MpegDemuxContext *m = s->priv_data; - AVStream *st; - int len, startcode, i, es_type, ret; - int lpcm_header_len = -1; //Init to supress warning - int request_probe= 0; - enum AVCodecID codec_id = AV_CODEC_ID_NONE; - enum AVMediaType type; - int64_t pts, dts, dummy_pos; //dummy_pos is needed for the index building to work - - redo: - len = mpegps_read_pes_header(s, &dummy_pos, &startcode, &pts, &dts); - if (len < 0) - return len; - - if (startcode >= 0x80 && startcode <= 0xcf) { - if(len < 4) - goto skip; - - /* audio: skip header */ - avio_r8(s->pb); - lpcm_header_len = avio_rb16(s->pb); - len -= 3; - if (startcode >= 0xb0 && startcode <= 0xbf) { - /* MLP/TrueHD audio has a 4-byte header */ - avio_r8(s->pb); - len--; - } - } - - /* now find stream */ - for(i=0;inb_streams;i++) { - st = s->streams[i]; - if (st->id == startcode) - goto found; - } - - es_type = m->psm_es_type[startcode & 0xff]; - if(es_type == STREAM_TYPE_VIDEO_MPEG1){ - codec_id = AV_CODEC_ID_MPEG2VIDEO; - type = AVMEDIA_TYPE_VIDEO; - } else if(es_type == STREAM_TYPE_VIDEO_MPEG2){ - codec_id = AV_CODEC_ID_MPEG2VIDEO; - type = AVMEDIA_TYPE_VIDEO; - } else if(es_type == STREAM_TYPE_AUDIO_MPEG1 || - es_type == STREAM_TYPE_AUDIO_MPEG2){ - codec_id = AV_CODEC_ID_MP3; - type = AVMEDIA_TYPE_AUDIO; - } else if(es_type == STREAM_TYPE_AUDIO_AAC){ - codec_id = AV_CODEC_ID_AAC; - type = AVMEDIA_TYPE_AUDIO; - } else if(es_type == STREAM_TYPE_VIDEO_MPEG4){ - codec_id = AV_CODEC_ID_MPEG4; - type = AVMEDIA_TYPE_VIDEO; - } else if(es_type == STREAM_TYPE_VIDEO_H264){ - codec_id = AV_CODEC_ID_H264; - type = AVMEDIA_TYPE_VIDEO; - } else if(es_type == STREAM_TYPE_AUDIO_AC3){ - codec_id = AV_CODEC_ID_AC3; - type = AVMEDIA_TYPE_AUDIO; - } else if(m->imkh_cctv && es_type == 0x91){ - codec_id = AV_CODEC_ID_PCM_MULAW; - type = AVMEDIA_TYPE_AUDIO; - } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { - static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; - unsigned char buf[8]; - avio_read(s->pb, buf, 8); - avio_seek(s->pb, -8, SEEK_CUR); - if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) - codec_id = AV_CODEC_ID_CAVS; - else - request_probe= 1; - type = AVMEDIA_TYPE_VIDEO; - } else if (startcode == PRIVATE_STREAM_2) { - type = AVMEDIA_TYPE_DATA; - codec_id = AV_CODEC_ID_DVD_NAV; - } else if (startcode >= 0x1c0 && startcode <= 0x1df) { - type = AVMEDIA_TYPE_AUDIO; - if (m->sofdec > 0) { - codec_id = AV_CODEC_ID_ADPCM_ADX; - // Auto-detect AC-3 - request_probe = 50; - } else { - codec_id = AV_CODEC_ID_MP2; - } - } else if (startcode >= 0x80 && startcode <= 0x87) { - type = AVMEDIA_TYPE_AUDIO; - codec_id = AV_CODEC_ID_AC3; - } else if ( ( startcode >= 0x88 && startcode <= 0x8f) - ||( startcode >= 0x98 && startcode <= 0x9f)) { - /* 0x90 - 0x97 is reserved for SDDS in DVD specs */ - type = AVMEDIA_TYPE_AUDIO; - codec_id = AV_CODEC_ID_DTS; - } else if (startcode >= 0xa0 && startcode <= 0xaf) { - type = AVMEDIA_TYPE_AUDIO; - if(lpcm_header_len == 6) { - codec_id = AV_CODEC_ID_MLP; - } else { - codec_id = AV_CODEC_ID_PCM_DVD; - } - } else if (startcode >= 0xb0 && startcode <= 0xbf) { - type = AVMEDIA_TYPE_AUDIO; - codec_id = AV_CODEC_ID_TRUEHD; - } else if (startcode >= 0xc0 && startcode <= 0xcf) { - /* Used for both AC-3 and E-AC-3 in EVOB files */ - type = AVMEDIA_TYPE_AUDIO; - codec_id = AV_CODEC_ID_AC3; - } else if (startcode >= 0x20 && startcode <= 0x3f) { - type = AVMEDIA_TYPE_SUBTITLE; - codec_id = AV_CODEC_ID_DVD_SUBTITLE; - } else if (startcode >= 0xfd55 && startcode <= 0xfd5f) { - type = AVMEDIA_TYPE_VIDEO; - codec_id = AV_CODEC_ID_VC1; - } else { - skip: - /* skip packet */ - avio_skip(s->pb, len); - goto redo; - } - /* no stream found: add a new stream */ - st = avformat_new_stream(s, NULL); - if (!st) - goto skip; - st->id = startcode; - st->codec->codec_type = type; - st->codec->codec_id = codec_id; - if (st->codec->codec_id == AV_CODEC_ID_PCM_MULAW) { - st->codec->channels = 1; - st->codec->channel_layout = AV_CH_LAYOUT_MONO; - st->codec->sample_rate = 8000; - } - st->request_probe = request_probe; - st->need_parsing = AVSTREAM_PARSE_FULL; - found: - if(st->discard >= AVDISCARD_ALL) - goto skip; - if (startcode >= 0xa0 && startcode <= 0xaf) { - if (lpcm_header_len == 6 && st->codec->codec_id == AV_CODEC_ID_MLP) { - if (len < 6) - goto skip; - avio_skip(s->pb, 6); - len -=6; - } - } - ret = av_get_packet(s->pb, pkt, len); - pkt->pts = pts; - pkt->dts = dts; - pkt->pos = dummy_pos; - pkt->stream_index = st->index; - av_dlog(s, "%d: pts=%0.3f dts=%0.3f size=%d\n", - pkt->stream_index, pkt->pts / 90000.0, pkt->dts / 90000.0, - pkt->size); - - return (ret < 0) ? ret : 0; -} - -static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, - int64_t *ppos, int64_t pos_limit) -{ - int len, startcode; - int64_t pos, pts, dts; - - pos = *ppos; - if (avio_seek(s->pb, pos, SEEK_SET) < 0) - return AV_NOPTS_VALUE; - - for(;;) { - len = mpegps_read_pes_header(s, &pos, &startcode, &pts, &dts); - if (len < 0) { - av_dlog(s, "none (ret=%d)\n", len); - return AV_NOPTS_VALUE; - } - if (startcode == s->streams[stream_index]->id && - dts != AV_NOPTS_VALUE) { - break; - } - avio_skip(s->pb, len); - } - av_dlog(s, "pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", - pos, dts, dts / 90000.0); - *ppos = pos; - return dts; -} - -AVInputFormat ff_mpegps_demuxer = { - .name = "mpeg", - .long_name = "MPEG-PS (MPEG-2 Program Stream)", - .priv_data_size = sizeof(MpegDemuxContext), - .read_probe = mpegps_probe, - .read_header = mpegps_read_header, - .read_packet = mpegps_read_packet, - .read_timestamp = mpegps_read_dts, - .flags = AVFMT_SHOW_IDS | AVFMT_TS_DISCONT, -}; - -#if CONFIG_VOBSUB_DEMUXER - -#define REF_STRING "# VobSub index file," - -static int vobsub_probe(AVProbeData *p) -{ - if (!strncmp(p->buf, REF_STRING, sizeof(REF_STRING) - 1)) - return AVPROBE_SCORE_MAX; - return 0; -} - -static int vobsub_read_header(AVFormatContext *s) -{ - int i, ret = 0, header_parsed = 0, langidx = 0; - MpegDemuxContext *vobsub = s->priv_data; - char *sub_name = NULL; - size_t fname_len; - char *ext, *header_str; - AVBPrint header; - int64_t delay = 0; - AVStream *st = NULL; - - sub_name = av_strdup(s->filename); - fname_len = strlen(sub_name); - ext = sub_name - 3 + fname_len; - if (fname_len < 4 || *(ext - 1) != '.') { - av_log(s, AV_LOG_ERROR, "The input index filename is too short " - "to guess the associated .SUB file\n"); - ret = AVERROR_INVALIDDATA; - goto end; - } - memcpy(ext, !strncmp(ext, "IDX", 3) ? "SUB" : "sub", 3); - av_log(s, AV_LOG_VERBOSE, "IDX/SUB: %s -> %s\n", s->filename, sub_name); - ret = avformat_open_input(&vobsub->sub_ctx, sub_name, &ff_mpegps_demuxer, NULL); - if (ret < 0) { - av_log(s, AV_LOG_ERROR, "Unable to open %s as MPEG subtitles\n", sub_name); - goto end; - } - - av_bprint_init(&header, 0, AV_BPRINT_SIZE_UNLIMITED); - while (!url_feof(s->pb)) { - char line[2048]; - int len = ff_get_line(s->pb, line, sizeof(line)); - - if (!len) - break; - - line[strcspn(line, "\r\n")] = 0; - - if (!strncmp(line, "id:", 3)) { - int n, stream_id = 0; - char id[64] = {0}; - - n = sscanf(line, "id: %63[^,], index: %u", id, &stream_id); - if (n != 2) { - av_log(s, AV_LOG_WARNING, "Unable to parse index line '%s', " - "assuming 'id: und, index: 0'\n", line); - strcpy(id, "und"); - stream_id = 0; - } - - if (stream_id >= FF_ARRAY_ELEMS(vobsub->q)) { - av_log(s, AV_LOG_ERROR, "Maximum number of subtitles streams reached\n"); - ret = AVERROR(EINVAL); - goto end; - } - - st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto end; - } - st->id = stream_id; - st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; - st->codec->codec_id = AV_CODEC_ID_DVD_SUBTITLE; - avpriv_set_pts_info(st, 64, 1, 1000); - av_dict_set(&st->metadata, "language", id, 0); - av_log(s, AV_LOG_DEBUG, "IDX stream[%d] id=%s\n", stream_id, id); - header_parsed = 1; - - } else if (st && !strncmp(line, "timestamp:", 10)) { - AVPacket *sub; - int hh, mm, ss, ms; - int64_t pos, timestamp; - const char *p = line + 10; - - if (!s->nb_streams) { - av_log(s, AV_LOG_ERROR, "Timestamp declared before any stream\n"); - ret = AVERROR_INVALIDDATA; - goto end; - } - - if (sscanf(p, "%02d:%02d:%02d:%03d, filepos: %"SCNx64, - &hh, &mm, &ss, &ms, &pos) != 5) { - av_log(s, AV_LOG_ERROR, "Unable to parse timestamp line '%s', " - "abort parsing\n", line); - break; - } - timestamp = (hh*3600LL + mm*60LL + ss) * 1000LL + ms + delay; - timestamp = av_rescale_q(timestamp, (AVRational){1,1000}, st->time_base); - - sub = ff_subtitles_queue_insert(&vobsub->q[s->nb_streams - 1], "", 0, 0); - if (!sub) { - ret = AVERROR(ENOMEM); - goto end; - } - sub->pos = pos; - sub->pts = timestamp; - sub->stream_index = s->nb_streams - 1; - - } else if (st && !strncmp(line, "alt:", 4)) { - const char *p = line + 4; - - while (*p == ' ') - p++; - av_dict_set(&st->metadata, "title", p, 0); - av_log(s, AV_LOG_DEBUG, "IDX stream[%d] name=%s\n", st->id, p); - header_parsed = 1; - - } else if (!strncmp(line, "delay:", 6)) { - int sign = 1, hh = 0, mm = 0, ss = 0, ms = 0; - const char *p = line + 6; - - while (*p == ' ') - p++; - if (*p == '-' || *p == '+') { - sign = *p == '-' ? -1 : 1; - p++; - } - sscanf(p, "%d:%d:%d:%d", &hh, &mm, &ss, &ms); - delay = ((hh*3600LL + mm*60LL + ss) * 1000LL + ms) * sign; - - } else if (!strncmp(line, "langidx:", 8)) { - const char *p = line + 8; - - if (sscanf(p, "%d", &langidx) != 1) - av_log(s, AV_LOG_ERROR, "Invalid langidx specified\n"); - - } else if (!header_parsed) { - if (line[0] && line[0] != '#') - av_bprintf(&header, "%s\n", line); - } - } - - if (langidx < s->nb_streams) - s->streams[langidx]->disposition |= AV_DISPOSITION_DEFAULT; - - for (i = 0; i < s->nb_streams; i++) { - vobsub->q[i].sort = SUB_SORT_POS_TS; - ff_subtitles_queue_finalize(&vobsub->q[i]); - } - - if (!av_bprint_is_complete(&header)) { - av_bprint_finalize(&header, NULL); - ret = AVERROR(ENOMEM); - goto end; - } - av_bprint_finalize(&header, &header_str); - for (i = 0; i < s->nb_streams; i++) { - AVStream *sub_st = s->streams[i]; - sub_st->codec->extradata = av_strdup(header_str); - sub_st->codec->extradata_size = header.len; - } - av_free(header_str); - -end: - av_free(sub_name); - return ret; -} - -#define FAIL(r) do { ret = r; goto fail; } while (0) - -static int vobsub_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - MpegDemuxContext *vobsub = s->priv_data; - FFDemuxSubtitlesQueue *q; - AVIOContext *pb = vobsub->sub_ctx->pb; - int ret, psize, total_read = 0, i; - AVPacket idx_pkt; - - int64_t min_ts = INT64_MAX; - int sid = 0; - for (i = 0; i < s->nb_streams; i++) { - FFDemuxSubtitlesQueue *tmpq = &vobsub->q[i]; - int64_t ts = tmpq->subs[tmpq->current_sub_idx].pts; - if (ts < min_ts) { - min_ts = ts; - sid = i; - } - } - q = &vobsub->q[sid]; - ret = ff_subtitles_queue_read_packet(q, &idx_pkt); - if (ret < 0) - return ret; - - /* compute maximum packet size using the next packet position. This is - * useful when the len in the header is non-sense */ - if (q->current_sub_idx < q->nb_subs) { - psize = q->subs[q->current_sub_idx].pos - idx_pkt.pos; - } else { - int64_t fsize = avio_size(pb); - psize = fsize < 0 ? 0xffff : fsize - idx_pkt.pos; - } - - avio_seek(pb, idx_pkt.pos, SEEK_SET); - - av_init_packet(pkt); - pkt->size = 0; - pkt->data = NULL; - - do { - int n, to_read, startcode; - int64_t pts, dts; - int64_t old_pos = avio_tell(pb), new_pos; - int pkt_size; - - ret = mpegps_read_pes_header(vobsub->sub_ctx, NULL, &startcode, &pts, &dts); - if (ret < 0) { - if (pkt->size) // raise packet even if incomplete - break; - FAIL(ret); - } - to_read = ret & 0xffff; - new_pos = avio_tell(pb); - pkt_size = ret + (new_pos - old_pos); - - /* this prevents reads above the current packet */ - if (total_read + pkt_size > psize) - break; - total_read += pkt_size; - - /* the current chunk doesn't match the stream index (unlikely) */ - if ((startcode & 0x1f) != idx_pkt.stream_index) - break; - - ret = av_grow_packet(pkt, to_read); - if (ret < 0) - FAIL(ret); - - n = avio_read(pb, pkt->data + (pkt->size - to_read), to_read); - if (n < to_read) - pkt->size -= to_read - n; - } while (total_read < psize); - - pkt->pts = pkt->dts = idx_pkt.pts; - pkt->pos = idx_pkt.pos; - pkt->stream_index = idx_pkt.stream_index; - - av_free_packet(&idx_pkt); - return 0; - -fail: - av_free_packet(pkt); - av_free_packet(&idx_pkt); - return ret; -} - -static int vobsub_read_seek(AVFormatContext *s, int stream_index, - int64_t min_ts, int64_t ts, int64_t max_ts, int flags) -{ - MpegDemuxContext *vobsub = s->priv_data; - - /* Rescale requested timestamps based on the first stream (timebase is the - * same for all subtitles stream within a .idx/.sub). Rescaling is done just - * like in avformat_seek_file(). */ - if (stream_index == -1 && s->nb_streams != 1) { - int i, ret = 0; - AVRational time_base = s->streams[0]->time_base; - ts = av_rescale_q(ts, AV_TIME_BASE_Q, time_base); - min_ts = av_rescale_rnd(min_ts, time_base.den, - time_base.num * (int64_t)AV_TIME_BASE, - AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - max_ts = av_rescale_rnd(max_ts, time_base.den, - time_base.num * (int64_t)AV_TIME_BASE, - AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); - for (i = 0; i < s->nb_streams; i++) { - int r = ff_subtitles_queue_seek(&vobsub->q[i], s, stream_index, - min_ts, ts, max_ts, flags); - if (r < 0) - ret = r; - } - return ret; - } - - if (stream_index == -1) // only 1 stream - stream_index = 0; - return ff_subtitles_queue_seek(&vobsub->q[stream_index], s, stream_index, - min_ts, ts, max_ts, flags); -} - -static int vobsub_read_close(AVFormatContext *s) -{ - int i; - MpegDemuxContext *vobsub = s->priv_data; - - for (i = 0; i < s->nb_streams; i++) - ff_subtitles_queue_clean(&vobsub->q[i]); - if (vobsub->sub_ctx) - avformat_close_input(&vobsub->sub_ctx); - return 0; -} - -AVInputFormat ff_vobsub_demuxer = { - .name = "vobsub", - .long_name = NULL_IF_CONFIG_SMALL("VobSub subtitle format"), - .priv_data_size = sizeof(MpegDemuxContext), - .read_probe = vobsub_probe, - .read_header = vobsub_read_header, - .read_packet = vobsub_read_packet, - .read_seek2 = vobsub_read_seek, - .read_close = vobsub_read_close, - .flags = AVFMT_SHOW_IDS, - .extensions = "idx", -}; -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.h deleted file mode 100644 index cf10d6a4c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mpeg.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * MPEG1/2 muxer and demuxer common defines - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_MPEG_H -#define AVFORMAT_MPEG_H - -#include -#include "libavutil/intreadwrite.h" - -#define PACK_START_CODE ((unsigned int)0x000001ba) -#define SYSTEM_HEADER_START_CODE ((unsigned int)0x000001bb) -#define SEQUENCE_END_CODE ((unsigned int)0x000001b7) -#define PACKET_START_CODE_MASK ((unsigned int)0xffffff00) -#define PACKET_START_CODE_PREFIX ((unsigned int)0x00000100) -#define ISO_11172_END_CODE ((unsigned int)0x000001b9) - -/* mpeg2 */ -#define PROGRAM_STREAM_MAP 0x1bc -#define PRIVATE_STREAM_1 0x1bd -#define PADDING_STREAM 0x1be -#define PRIVATE_STREAM_2 0x1bf - -#define AUDIO_ID 0xc0 -#define VIDEO_ID 0xe0 -#define AC3_ID 0x80 -#define DTS_ID 0x88 -#define LPCM_ID 0xa0 -#define SUB_ID 0x20 - -#define STREAM_TYPE_VIDEO_MPEG1 0x01 -#define STREAM_TYPE_VIDEO_MPEG2 0x02 -#define STREAM_TYPE_AUDIO_MPEG1 0x03 -#define STREAM_TYPE_AUDIO_MPEG2 0x04 -#define STREAM_TYPE_PRIVATE_SECTION 0x05 -#define STREAM_TYPE_PRIVATE_DATA 0x06 -#define STREAM_TYPE_AUDIO_AAC 0x0f -#define STREAM_TYPE_VIDEO_MPEG4 0x10 -#define STREAM_TYPE_VIDEO_H264 0x1b -#define STREAM_TYPE_VIDEO_CAVS 0x42 - -#define STREAM_TYPE_AUDIO_AC3 0x81 -#define STREAM_TYPE_AUDIO_DTS 0x8a - -static const int lpcm_freq_tab[4] = { 48000, 96000, 44100, 32000 }; - -/** - * Parse MPEG-PES five-byte timestamp - */ -static inline int64_t ff_parse_pes_pts(const uint8_t *buf) { - return (int64_t)(*buf & 0x0e) << 29 | - (AV_RB16(buf+1) >> 1) << 15 | - AV_RB16(buf+3) >> 1; -} - -#endif /* AVFORMAT_MPEG_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mux.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mux.c deleted file mode 100644 index a578b01b3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/mux.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* - * muxing functions for use within FFmpeg - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "avio_internal.h" -#include "internal.h" -#include "libavcodec/internal.h" -#include "libavcodec/bytestream.h" -#include "libavutil/opt.h" -#include "libavutil/dict.h" -#include "libavutil/pixdesc.h" -#include "libavutil/timestamp.h" -#include "metadata.h" -#include "id3v2.h" -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/internal.h" -#include "libavutil/mathematics.h" -#include "libavutil/parseutils.h" -#include "libavutil/time_.h" -#include "riff.h" -#include "audiointerleave.h" -#include "url.h" -#include -#if CONFIG_NETWORK -#include "network.h" -#endif - -#undef NDEBUG -#include - -/** - * @file - * muxing functions for use within libavformat - */ - -/* fraction handling */ - -/** - * f = val + (num / den) + 0.5. - * - * 'num' is normalized so that it is such as 0 <= num < den. - * - * @param f fractional number - * @param val integer value - * @param num must be >= 0 - * @param den must be >= 1 - */ -static void frac_init(AVFrac *f, int64_t val, int64_t num, int64_t den) -{ - num += (den >> 1); - if (num >= den) { - val += num / den; - num = num % den; - } - f->val = val; - f->num = num; - f->den = den; -} - -/** - * Fractional addition to f: f = f + (incr / f->den). - * - * @param f fractional number - * @param incr increment, can be positive or negative - */ -static void frac_add(AVFrac *f, int64_t incr) -{ - int64_t num, den; - - num = f->num + incr; - den = f->den; - if (num < 0) { - f->val += num / den; - num = num % den; - if (num < 0) { - num += den; - f->val--; - } - } else if (num >= den) { - f->val += num / den; - num = num % den; - } - f->num = num; -} - -AVRational ff_choose_timebase(AVFormatContext *s, AVStream *st, int min_precission) -{ - AVRational q; - int j; - - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - q = (AVRational){1, st->codec->sample_rate}; - } else { - q = st->codec->time_base; - } - for (j=2; j<14; j+= 1+(j>2)) - while (q.den / q.num < min_precission && q.num % j == 0) - q.num /= j; - while (q.den / q.num < min_precission && q.den < (1<<24)) - q.den <<= 1; - - return q; -} - -int avformat_alloc_output_context2(AVFormatContext **avctx, AVOutputFormat *oformat, - const char *format, const char *filename) -{ - AVFormatContext *s = avformat_alloc_context(); - int ret = 0; - - *avctx = NULL; - if (!s) - goto nomem; - - if (!oformat) { - if (format) { - oformat = av_guess_format(format, NULL, NULL); - if (!oformat) { - av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); - ret = AVERROR(EINVAL); - goto error; - } - } else { - oformat = av_guess_format(NULL, filename, NULL); - if (!oformat) { - ret = AVERROR(EINVAL); - av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", - filename); - goto error; - } - } - } - - s->oformat = oformat; - if (s->oformat->priv_data_size > 0) { - s->priv_data = av_mallocz(s->oformat->priv_data_size); - if (!s->priv_data) - goto nomem; - if (s->oformat->priv_class) { - *(const AVClass**)s->priv_data= s->oformat->priv_class; - av_opt_set_defaults(s->priv_data); - } - } else - s->priv_data = NULL; - - if (filename) - av_strlcpy(s->filename, filename, sizeof(s->filename)); - *avctx = s; - return 0; -nomem: - av_log(s, AV_LOG_ERROR, "Out of memory\n"); - ret = AVERROR(ENOMEM); -error: - avformat_free_context(s); - return ret; -} - -#if FF_API_ALLOC_OUTPUT_CONTEXT -AVFormatContext *avformat_alloc_output_context(const char *format, - AVOutputFormat *oformat, const char *filename) -{ - AVFormatContext *avctx; - int ret = avformat_alloc_output_context2(&avctx, oformat, format, filename); - return ret < 0 ? NULL : avctx; -} -#endif - -static int validate_codec_tag(AVFormatContext *s, AVStream *st) -{ - const AVCodecTag *avctag; - int n; - enum AVCodecID id = AV_CODEC_ID_NONE; - int64_t tag = -1; - - /** - * Check that tag + id is in the table - * If neither is in the table -> OK - * If tag is in the table with another id -> FAIL - * If id is in the table with another tag -> FAIL unless strict < normal - */ - for (n = 0; s->oformat->codec_tag[n]; n++) { - avctag = s->oformat->codec_tag[n]; - while (avctag->id != AV_CODEC_ID_NONE) { - if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) { - id = avctag->id; - if (id == st->codec->codec_id) - return 1; - } - if (avctag->id == st->codec->codec_id) - tag = avctag->tag; - avctag++; - } - } - if (id != AV_CODEC_ID_NONE) - return 0; - if (tag >= 0 && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL)) - return 0; - return 1; -} - - -static int init_muxer(AVFormatContext *s, AVDictionary **options) -{ - int ret = 0, i; - AVStream *st; - AVDictionary *tmp = NULL; - AVCodecContext *codec = NULL; - AVOutputFormat *of = s->oformat; - - if (options) - av_dict_copy(&tmp, *options, 0); - - if ((ret = av_opt_set_dict(s, &tmp)) < 0) - goto fail; - if (s->priv_data && s->oformat->priv_class && *(const AVClass**)s->priv_data==s->oformat->priv_class && - (ret = av_opt_set_dict(s->priv_data, &tmp)) < 0) - goto fail; - - // some sanity checks - if (s->nb_streams == 0 && !(of->flags & AVFMT_NOSTREAMS)) { - av_log(s, AV_LOG_ERROR, "No streams to mux were specified\n"); - ret = AVERROR(EINVAL); - goto fail; - } - - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - codec = st->codec; - - switch (codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - if (codec->sample_rate <= 0) { - av_log(s, AV_LOG_ERROR, "sample rate not set\n"); - ret = AVERROR(EINVAL); - goto fail; - } - if (!codec->block_align) - codec->block_align = codec->channels * - av_get_bits_per_sample(codec->codec_id) >> 3; - break; - case AVMEDIA_TYPE_VIDEO: - if (codec->time_base.num <= 0 || - codec->time_base.den <= 0) { //FIXME audio too? - av_log(s, AV_LOG_ERROR, "time base not set\n"); - ret = AVERROR(EINVAL); - goto fail; - } - - if ((codec->width <= 0 || codec->height <= 0) && - !(of->flags & AVFMT_NODIMENSIONS)) { - av_log(s, AV_LOG_ERROR, "dimensions not set\n"); - ret = AVERROR(EINVAL); - goto fail; - } - if (av_cmp_q(st->sample_aspect_ratio, codec->sample_aspect_ratio) - && FFABS(av_q2d(st->sample_aspect_ratio) - av_q2d(codec->sample_aspect_ratio)) > 0.004*av_q2d(st->sample_aspect_ratio) - ) { - if (st->sample_aspect_ratio.num != 0 && - st->sample_aspect_ratio.den != 0 && - codec->sample_aspect_ratio.den != 0 && - codec->sample_aspect_ratio.den != 0) { - av_log(s, AV_LOG_ERROR, "Aspect ratio mismatch between muxer " - "(%d/%d) and encoder layer (%d/%d)\n", - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, - codec->sample_aspect_ratio.num, - codec->sample_aspect_ratio.den); - ret = AVERROR(EINVAL); - goto fail; - } - } - break; - } - - if (of->codec_tag) { - if ( codec->codec_tag - && codec->codec_id == AV_CODEC_ID_RAWVIDEO - && ( av_codec_get_tag(of->codec_tag, codec->codec_id) == 0 - || av_codec_get_tag(of->codec_tag, codec->codec_id) == MKTAG('r', 'a', 'w', ' ')) - && !validate_codec_tag(s, st)) { - // the current rawvideo encoding system ends up setting - // the wrong codec_tag for avi/mov, we override it here - codec->codec_tag = 0; - } - if (codec->codec_tag) { - if (!validate_codec_tag(s, st)) { - char tagbuf[32], tagbuf2[32]; - av_get_codec_tag_string(tagbuf, sizeof(tagbuf), codec->codec_tag); - av_get_codec_tag_string(tagbuf2, sizeof(tagbuf2), av_codec_get_tag(s->oformat->codec_tag, codec->codec_id)); - av_log(s, AV_LOG_ERROR, - "Tag %s/0x%08x incompatible with output codec id '%d' (%s)\n", - tagbuf, codec->codec_tag, codec->codec_id, tagbuf2); - ret = AVERROR_INVALIDDATA; - goto fail; - } - } else - codec->codec_tag = av_codec_get_tag(of->codec_tag, codec->codec_id); - } - - if (of->flags & AVFMT_GLOBALHEADER && - !(codec->flags & CODEC_FLAG_GLOBAL_HEADER)) - av_log(s, AV_LOG_WARNING, - "Codec for stream %d does not use global headers " - "but container format requires global headers\n", i); - - if (codec->codec_type != AVMEDIA_TYPE_ATTACHMENT) - s->internal->nb_interleaved_streams++; - } - - if (!s->priv_data && of->priv_data_size > 0) { - s->priv_data = av_mallocz(of->priv_data_size); - if (!s->priv_data) { - ret = AVERROR(ENOMEM); - goto fail; - } - if (of->priv_class) { - *(const AVClass **)s->priv_data = of->priv_class; - av_opt_set_defaults(s->priv_data); - if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0) - goto fail; - } - } - - /* set muxer identification string */ - if (s->nb_streams && !(s->streams[0]->codec->flags & CODEC_FLAG_BITEXACT)) { - av_dict_set(&s->metadata, "encoder", LIBAVFORMAT_IDENT, 0); - } else { - av_dict_set(&s->metadata, "encoder", NULL, 0); - } - - if (options) { - av_dict_free(options); - *options = tmp; - } - - return 0; - -fail: - av_dict_free(&tmp); - return ret; -} - -static int init_pts(AVFormatContext *s) -{ - int i; - AVStream *st; - - /* init PTS generation */ - for (i = 0; i < s->nb_streams; i++) { - int64_t den = AV_NOPTS_VALUE; - st = s->streams[i]; - - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - den = (int64_t)st->time_base.num * st->codec->sample_rate; - break; - case AVMEDIA_TYPE_VIDEO: - den = (int64_t)st->time_base.num * st->codec->time_base.den; - break; - default: - break; - } - if (den != AV_NOPTS_VALUE) { - if (den <= 0) - return AVERROR_INVALIDDATA; - - frac_init(&st->pts, 0, 0, den); - } - } - - return 0; -} - -int avformat_write_header(AVFormatContext *s, AVDictionary **options) -{ - int ret = 0; - - if (ret = init_muxer(s, options)) - return ret; - - if (s->oformat->write_header) { - ret = s->oformat->write_header(s); - if (ret >= 0 && s->pb && s->pb->error < 0) - ret = s->pb->error; - if (ret < 0) - return ret; - } - - if ((ret = init_pts(s)) < 0) - return ret; - - if (s->avoid_negative_ts < 0) { - if (s->oformat->flags & (AVFMT_TS_NEGATIVE | AVFMT_NOTIMESTAMPS)) { - s->avoid_negative_ts = 0; - } else - s->avoid_negative_ts = 1; - } - - return 0; -} - -#define AV_PKT_FLAG_UNCODED_FRAME 0x2000 - -/* Note: using sizeof(AVFrame) from outside lavu is unsafe in general, but - it is only being used internally to this file as a consistency check. - The value is chosen to be very unlikely to appear on its own and to cause - immediate failure if used anywhere as a real size. */ -#define UNCODED_FRAME_PACKET_SIZE (INT_MIN / 3 * 2 + (int)sizeof(AVFrame)) - - -//FIXME merge with compute_pkt_fields -static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt) -{ - int delay = FFMAX(st->codec->has_b_frames, st->codec->max_b_frames > 0); - int num, den, frame_size, i; - - av_dlog(s, "compute_pkt_fields2: pts:%s dts:%s cur_dts:%s b:%d size:%d st:%d\n", - av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index); - - /* duration field */ - if (pkt->duration == 0) { - ff_compute_frame_duration(&num, &den, st, NULL, pkt); - if (den && num) { - pkt->duration = av_rescale(1, num * (int64_t)st->time_base.den * st->codec->ticks_per_frame, den * (int64_t)st->time_base.num); - } - } - - if (pkt->pts == AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && delay == 0) - pkt->pts = pkt->dts; - - //XXX/FIXME this is a temporary hack until all encoders output pts - if ((pkt->pts == 0 || pkt->pts == AV_NOPTS_VALUE) && pkt->dts == AV_NOPTS_VALUE && !delay) { - static int warned; - if (!warned) { - av_log(s, AV_LOG_WARNING, "Encoder did not produce proper pts, making some up.\n"); - warned = 1; - } - pkt->dts = -// pkt->pts= st->cur_dts; - pkt->pts = st->pts.val; - } - - //calculate dts from pts - if (pkt->pts != AV_NOPTS_VALUE && pkt->dts == AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY) { - st->pts_buffer[0] = pkt->pts; - for (i = 1; i < delay + 1 && st->pts_buffer[i] == AV_NOPTS_VALUE; i++) - st->pts_buffer[i] = pkt->pts + (i - delay - 1) * pkt->duration; - for (i = 0; ipts_buffer[i] > st->pts_buffer[i + 1]; i++) - FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]); - - pkt->dts = st->pts_buffer[0]; - } - - if (st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && - ((!(s->oformat->flags & AVFMT_TS_NONSTRICT) && - st->cur_dts >= pkt->dts) || st->cur_dts > pkt->dts)) { - av_log(s, AV_LOG_ERROR, - "Application provided invalid, non monotonically increasing dts to muxer in stream %d: %s >= %s\n", - st->index, av_ts2str(st->cur_dts), av_ts2str(pkt->dts)); - return AVERROR(EINVAL); - } - if (pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts) { - av_log(s, AV_LOG_ERROR, "pts (%s) < dts (%s) in stream %d\n", - av_ts2str(pkt->pts), av_ts2str(pkt->dts), st->index); - return AVERROR(EINVAL); - } - - av_dlog(s, "av_write_frame: pts2:%s dts2:%s\n", - av_ts2str(pkt->pts), av_ts2str(pkt->dts)); - st->cur_dts = pkt->dts; - st->pts.val = pkt->dts; - - /* update pts */ - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_AUDIO: - frame_size = (pkt->flags & AV_PKT_FLAG_UNCODED_FRAME) ? - ((AVFrame *)pkt->data)->nb_samples : - ff_get_audio_frame_size(st->codec, pkt->size, 1); - - /* HACK/FIXME, we skip the initial 0 size packets as they are most - * likely equal to the encoder delay, but it would be better if we - * had the real timestamps from the encoder */ - if (frame_size >= 0 && (pkt->size || st->pts.num != st->pts.den >> 1 || st->pts.val)) { - frac_add(&st->pts, (int64_t)st->time_base.den * frame_size); - } - break; - case AVMEDIA_TYPE_VIDEO: - frac_add(&st->pts, (int64_t)st->time_base.den * st->codec->time_base.num); - break; - default: - break; - } - return 0; -} - -/** - * Make timestamps non negative, move side data from payload to internal struct, call muxer, and restore - * sidedata. - * - * FIXME: this function should NEVER get undefined pts/dts beside when the - * AVFMT_NOTIMESTAMPS is set. - * Those additional safety checks should be dropped once the correct checks - * are set in the callers. - */ -static int write_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, did_split; - - if (s->output_ts_offset) { - AVStream *st = s->streams[pkt->stream_index]; - int64_t offset = av_rescale_q(s->output_ts_offset, AV_TIME_BASE_Q, st->time_base); - - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts += offset; - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts += offset; - } - - if (s->avoid_negative_ts > 0) { - AVStream *st = s->streams[pkt->stream_index]; - int64_t offset = st->mux_ts_offset; - - if ((pkt->dts < 0 || s->avoid_negative_ts == 2) && pkt->dts != AV_NOPTS_VALUE && !s->offset) { - s->offset = -pkt->dts; - s->offset_timebase = st->time_base; - } - - if (s->offset && !offset) { - offset = st->mux_ts_offset = - av_rescale_q_rnd(s->offset, - s->offset_timebase, - st->time_base, - AV_ROUND_UP); - } - - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts += offset; - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts += offset; - - av_assert2(pkt->dts == AV_NOPTS_VALUE || pkt->dts >= 0); - } - - did_split = av_packet_split_side_data(pkt); - if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) { - AVFrame *frame = (AVFrame *)pkt->data; - av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE); - ret = s->oformat->write_uncoded_frame(s, pkt->stream_index, &frame, 0); - av_frame_free(&frame); - } else { - ret = s->oformat->write_packet(s, pkt); - } - - if (s->flush_packets && s->pb && ret >= 0 && s->flags & AVFMT_FLAG_FLUSH_PACKETS) - avio_flush(s->pb); - - if (did_split) - av_packet_merge_side_data(pkt); - - return ret; -} - -static int check_packet(AVFormatContext *s, AVPacket *pkt) -{ - if (!pkt) - return 0; - - if (pkt->stream_index < 0 || pkt->stream_index >= s->nb_streams) { - av_log(s, AV_LOG_ERROR, "Invalid packet stream index: %d\n", - pkt->stream_index); - return AVERROR(EINVAL); - } - - if (s->streams[pkt->stream_index]->codec->codec_type == AVMEDIA_TYPE_ATTACHMENT) { - av_log(s, AV_LOG_ERROR, "Received a packet for an attachment stream.\n"); - return AVERROR(EINVAL); - } - - return 0; -} - -int av_write_frame(AVFormatContext *s, AVPacket *pkt) -{ - int ret; - - ret = check_packet(s, pkt); - if (ret < 0) - return ret; - - if (!pkt) { - if (s->oformat->flags & AVFMT_ALLOW_FLUSH) { - ret = s->oformat->write_packet(s, NULL); - if (s->flush_packets && s->pb && s->pb->error >= 0) - avio_flush(s->pb); - if (ret >= 0 && s->pb && s->pb->error < 0) - ret = s->pb->error; - return ret; - } - return 1; - } - - ret = compute_pkt_fields2(s, s->streams[pkt->stream_index], pkt); - - if (ret < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) - return ret; - - ret = write_packet(s, pkt); - if (ret >= 0 && s->pb && s->pb->error < 0) - ret = s->pb->error; - - if (ret >= 0) - s->streams[pkt->stream_index]->nb_frames++; - return ret; -} - -#define CHUNK_START 0x1000 - -int ff_interleave_add_packet(AVFormatContext *s, AVPacket *pkt, - int (*compare)(AVFormatContext *, AVPacket *, AVPacket *)) -{ - AVPacketList **next_point, *this_pktl; - AVStream *st = s->streams[pkt->stream_index]; - int chunked = s->max_chunk_size || s->max_chunk_duration; - int ret; - - this_pktl = av_mallocz(sizeof(AVPacketList)); - if (!this_pktl) - return AVERROR(ENOMEM); - this_pktl->pkt = *pkt; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - pkt->destruct = NULL; // do not free original but only the copy -FF_ENABLE_DEPRECATION_WARNINGS -#endif - pkt->buf = NULL; - if ((pkt->flags & AV_PKT_FLAG_UNCODED_FRAME)) { - av_assert0(pkt->size == UNCODED_FRAME_PACKET_SIZE); - av_assert0(((AVFrame *)pkt->data)->buf); - } else { - // duplicate the packet if it uses non-allocated memory - if ((ret = av_dup_packet(&this_pktl->pkt)) < 0) { - av_free(this_pktl); - return ret; - } - av_copy_packet_side_data(&this_pktl->pkt, &this_pktl->pkt); // copy side data - } - - if (s->streams[pkt->stream_index]->last_in_packet_buffer) { - next_point = &(st->last_in_packet_buffer->next); - } else { - next_point = &s->packet_buffer; - } - - if (chunked) { - uint64_t max= av_rescale_q_rnd(s->max_chunk_duration, AV_TIME_BASE_Q, st->time_base, AV_ROUND_UP); - st->interleaver_chunk_size += pkt->size; - st->interleaver_chunk_duration += pkt->duration; - if ( (s->max_chunk_size && st->interleaver_chunk_size > s->max_chunk_size) - || (max && st->interleaver_chunk_duration > max)) { - st->interleaver_chunk_size = 0; - this_pktl->pkt.flags |= CHUNK_START; - if (max && st->interleaver_chunk_duration > max) { - int64_t syncoffset = (st->codec->codec_type == AVMEDIA_TYPE_VIDEO)*max/2; - int64_t syncto = av_rescale(pkt->dts + syncoffset, 1, max)*max - syncoffset; - - st->interleaver_chunk_duration += (pkt->dts - syncto)/8 - max; - } else - st->interleaver_chunk_duration = 0; - } - } - if (*next_point) { - if (chunked && !(this_pktl->pkt.flags & CHUNK_START)) - goto next_non_null; - - if (compare(s, &s->packet_buffer_end->pkt, pkt)) { - while ( *next_point - && ((chunked && !((*next_point)->pkt.flags&CHUNK_START)) - || !compare(s, &(*next_point)->pkt, pkt))) - next_point = &(*next_point)->next; - if (*next_point) - goto next_non_null; - } else { - next_point = &(s->packet_buffer_end->next); - } - } - av_assert1(!*next_point); - - s->packet_buffer_end = this_pktl; -next_non_null: - - this_pktl->next = *next_point; - - s->streams[pkt->stream_index]->last_in_packet_buffer = - *next_point = this_pktl; - return 0; -} - -static int interleave_compare_dts(AVFormatContext *s, AVPacket *next, - AVPacket *pkt) -{ - AVStream *st = s->streams[pkt->stream_index]; - AVStream *st2 = s->streams[next->stream_index]; - int comp = av_compare_ts(next->dts, st2->time_base, pkt->dts, - st->time_base); - if (s->audio_preload && ((st->codec->codec_type == AVMEDIA_TYPE_AUDIO) != (st2->codec->codec_type == AVMEDIA_TYPE_AUDIO))) { - int64_t ts = av_rescale_q(pkt ->dts, st ->time_base, AV_TIME_BASE_Q) - s->audio_preload*(st ->codec->codec_type == AVMEDIA_TYPE_AUDIO); - int64_t ts2= av_rescale_q(next->dts, st2->time_base, AV_TIME_BASE_Q) - s->audio_preload*(st2->codec->codec_type == AVMEDIA_TYPE_AUDIO); - if (ts == ts2) { - ts= ( pkt ->dts* st->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st ->codec->codec_type == AVMEDIA_TYPE_AUDIO)* st->time_base.den)*st2->time_base.den - -( next->dts*st2->time_base.num*AV_TIME_BASE - s->audio_preload*(int64_t)(st2->codec->codec_type == AVMEDIA_TYPE_AUDIO)*st2->time_base.den)* st->time_base.den; - ts2=0; - } - comp= (ts>ts2) - (tsstream_index < next->stream_index; - return comp > 0; -} - -int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, - AVPacket *pkt, int flush) -{ - AVPacketList *pktl; - int stream_count = 0, noninterleaved_count = 0; - int i, ret; - - if (pkt) { - ret = ff_interleave_add_packet(s, pkt, interleave_compare_dts); - if (ret < 0) - return ret; - } - - for (i = 0; i < s->nb_streams; i++) { - if (s->streams[i]->last_in_packet_buffer) { - ++stream_count; - } else if (s->streams[i]->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { - ++noninterleaved_count; - } - } - - if (s->internal->nb_interleaved_streams == stream_count) - flush = 1; - - if (s->max_interleave_delta > 0 && s->packet_buffer && !flush) { - AVPacket *top_pkt = &s->packet_buffer->pkt; - int64_t delta_dts = INT64_MIN; - int64_t top_dts = av_rescale_q(top_pkt->dts, - s->streams[top_pkt->stream_index]->time_base, - AV_TIME_BASE_Q); - - for (i = 0; i < s->nb_streams; i++) { - int64_t last_dts; - const AVPacketList *last = s->streams[i]->last_in_packet_buffer; - - if (!last) - continue; - - last_dts = av_rescale_q(last->pkt.dts, - s->streams[i]->time_base, - AV_TIME_BASE_Q); - delta_dts = FFMAX(delta_dts, last_dts - top_dts); - } - - if (delta_dts > s->max_interleave_delta) { - av_log(s, AV_LOG_DEBUG, - "Delay between the first packet and last packet in the " - "muxing queue is %"PRId64" > %"PRId64": forcing output\n", - delta_dts, s->max_interleave_delta); - flush = 1; - } - } - - if (stream_count && flush) { - AVStream *st; - pktl = s->packet_buffer; - *out = pktl->pkt; - st = s->streams[out->stream_index]; - - s->packet_buffer = pktl->next; - if (!s->packet_buffer) - s->packet_buffer_end = NULL; - - if (st->last_in_packet_buffer == pktl) - st->last_in_packet_buffer = NULL; - av_freep(&pktl); - - return 1; - } else { - av_init_packet(out); - return 0; - } -} - -/** - * Interleave an AVPacket correctly so it can be muxed. - * @param out the interleaved packet will be output here - * @param in the input packet - * @param flush 1 if no further packets are available as input and all - * remaining packets should be output - * @return 1 if a packet was output, 0 if no packet could be output, - * < 0 if an error occurred - */ -static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush) -{ - if (s->oformat->interleave_packet) { - int ret = s->oformat->interleave_packet(s, out, in, flush); - if (in) - av_free_packet(in); - return ret; - } else - return ff_interleave_packet_per_dts(s, out, in, flush); -} - -int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt) -{ - int ret, flush = 0; - - ret = check_packet(s, pkt); - if (ret < 0) - goto fail; - - if (pkt) { - AVStream *st = s->streams[pkt->stream_index]; - - //FIXME/XXX/HACK drop zero sized packets - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && pkt->size == 0) { - ret = 0; - goto fail; - } - - av_dlog(s, "av_interleaved_write_frame size:%d dts:%s pts:%s\n", - pkt->size, av_ts2str(pkt->dts), av_ts2str(pkt->pts)); - if ((ret = compute_pkt_fields2(s, st, pkt)) < 0 && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) - goto fail; - - if (pkt->dts == AV_NOPTS_VALUE && !(s->oformat->flags & AVFMT_NOTIMESTAMPS)) { - ret = AVERROR(EINVAL); - goto fail; - } - } else { - av_dlog(s, "av_interleaved_write_frame FLUSH\n"); - flush = 1; - } - - for (;; ) { - AVPacket opkt; - int ret = interleave_packet(s, &opkt, pkt, flush); - if (pkt) { - memset(pkt, 0, sizeof(*pkt)); - av_init_packet(pkt); - pkt = NULL; - } - if (ret <= 0) //FIXME cleanup needed for ret<0 ? - return ret; - - ret = write_packet(s, &opkt); - if (ret >= 0) - s->streams[opkt.stream_index]->nb_frames++; - - av_free_packet(&opkt); - - if (ret < 0) - return ret; - if(s->pb && s->pb->error) - return s->pb->error; - } -fail: - av_packet_unref(pkt); - return ret; -} - -int av_write_trailer(AVFormatContext *s) -{ - int ret, i; - - for (;; ) { - AVPacket pkt; - ret = interleave_packet(s, &pkt, NULL, 1); - if (ret < 0) //FIXME cleanup needed for ret<0 ? - goto fail; - if (!ret) - break; - - ret = write_packet(s, &pkt); - if (ret >= 0) - s->streams[pkt.stream_index]->nb_frames++; - - av_free_packet(&pkt); - - if (ret < 0) - goto fail; - if(s->pb && s->pb->error) - goto fail; - } - - if (s->oformat->write_trailer) - ret = s->oformat->write_trailer(s); - -fail: - if (s->pb) - avio_flush(s->pb); - if (ret == 0) - ret = s->pb ? s->pb->error : 0; - for (i = 0; i < s->nb_streams; i++) { - av_freep(&s->streams[i]->priv_data); - av_freep(&s->streams[i]->index_entries); - } - if (s->oformat->priv_class) - av_opt_free(s->priv_data); - av_freep(&s->priv_data); - return ret; -} - -int av_get_output_timestamp(struct AVFormatContext *s, int stream, - int64_t *dts, int64_t *wall) -{ - if (!s->oformat || !s->oformat->get_output_timestamp) - return AVERROR(ENOSYS); - s->oformat->get_output_timestamp(s, stream, dts, wall); - return 0; -} - -int ff_write_chained(AVFormatContext *dst, int dst_stream, AVPacket *pkt, - AVFormatContext *src) -{ - AVPacket local_pkt; - - local_pkt = *pkt; - local_pkt.stream_index = dst_stream; - if (pkt->pts != AV_NOPTS_VALUE) - local_pkt.pts = av_rescale_q(pkt->pts, - src->streams[pkt->stream_index]->time_base, - dst->streams[dst_stream]->time_base); - if (pkt->dts != AV_NOPTS_VALUE) - local_pkt.dts = av_rescale_q(pkt->dts, - src->streams[pkt->stream_index]->time_base, - dst->streams[dst_stream]->time_base); - if (pkt->duration) - local_pkt.duration = av_rescale_q(pkt->duration, - src->streams[pkt->stream_index]->time_base, - dst->streams[dst_stream]->time_base); - return av_write_frame(dst, &local_pkt); -} - -static int av_write_uncoded_frame_internal(AVFormatContext *s, int stream_index, - AVFrame *frame, int interleaved) -{ - AVPacket pkt, *pktp; - - av_assert0(s->oformat); - if (!s->oformat->write_uncoded_frame) - return AVERROR(ENOSYS); - - if (!frame) { - pktp = NULL; - } else { - pktp = &pkt; - av_init_packet(&pkt); - pkt.data = (void *)frame; - pkt.size = UNCODED_FRAME_PACKET_SIZE; - pkt.pts = - pkt.dts = frame->pts; - pkt.duration = av_frame_get_pkt_duration(frame); - pkt.stream_index = stream_index; - pkt.flags |= AV_PKT_FLAG_UNCODED_FRAME; - } - - return interleaved ? av_interleaved_write_frame(s, pktp) : - av_write_frame(s, pktp); -} - -int av_write_uncoded_frame(AVFormatContext *s, int stream_index, - AVFrame *frame) -{ - return av_write_uncoded_frame_internal(s, stream_index, frame, 0); -} - -int av_interleaved_write_uncoded_frame(AVFormatContext *s, int stream_index, - AVFrame *frame) -{ - return av_write_uncoded_frame_internal(s, stream_index, frame, 1); -} - -int av_write_uncoded_frame_query(AVFormatContext *s, int stream_index) -{ - av_assert0(s->oformat); - if (!s->oformat->write_uncoded_frame) - return AVERROR(ENOSYS); - return s->oformat->write_uncoded_frame(s, stream_index, NULL, - AV_WRITE_UNCODED_FRAME_QUERY); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options.c deleted file mode 100644 index 55a8e07f2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "avformat.h" -#include "avio_internal.h" -#include "internal.h" -#include "libavutil/opt.h" - -/** - * @file - * Options definition for AVFormatContext. - */ - -#include "options_table.h" - -static const char* format_to_name(void* ptr) -{ - AVFormatContext* fc = (AVFormatContext*) ptr; - if(fc->iformat) return fc->iformat->name; - else if(fc->oformat) return fc->oformat->name; - else return "NULL"; -} - -static void *format_child_next(void *obj, void *prev) -{ - AVFormatContext *s = obj; - if (!prev && s->priv_data && - ((s->iformat && s->iformat->priv_class) || - (s->oformat && s->oformat->priv_class))) - return s->priv_data; - if (s->pb && s->pb->av_class && prev != s->pb) - return s->pb; - return NULL; -} - -static const AVClass *format_child_class_next(const AVClass *prev) -{ - AVInputFormat *ifmt = NULL; - AVOutputFormat *ofmt = NULL; - - if (!prev) - return &ffio_url_class; - - while ((ifmt = av_iformat_next(ifmt))) - if (ifmt->priv_class == prev) - break; - - if (!ifmt) - while ((ofmt = av_oformat_next(ofmt))) - if (ofmt->priv_class == prev) - break; - if (!ofmt) - while ((ifmt = av_iformat_next(ifmt))) - if (ifmt->priv_class) - return ifmt->priv_class; - - while ((ofmt = av_oformat_next(ofmt))) - if (ofmt->priv_class) - return ofmt->priv_class; - - return NULL; -} - -static AVClassCategory get_category(void *ptr) -{ - AVFormatContext* s = ptr; - if(s->iformat) return AV_CLASS_CATEGORY_DEMUXER; - else return AV_CLASS_CATEGORY_MUXER; -} - -static const AVClass av_format_context_class = { - .class_name = "AVFormatContext", - .item_name = format_to_name, - .option = avformat_options, - .version = LIBAVUTIL_VERSION_INT, - .child_next = format_child_next, - .child_class_next = format_child_class_next, - .category = AV_CLASS_CATEGORY_MUXER, - .get_category = get_category, -}; - -static void avformat_get_context_defaults(AVFormatContext *s) -{ - memset(s, 0, sizeof(AVFormatContext)); - - s->av_class = &av_format_context_class; - - av_opt_set_defaults(s); -} - -AVFormatContext *avformat_alloc_context(void) -{ - AVFormatContext *ic; - ic = av_malloc(sizeof(AVFormatContext)); - if (!ic) return ic; - avformat_get_context_defaults(ic); - - ic->internal = av_mallocz(sizeof(*ic->internal)); - if (!ic->internal) { - avformat_free_context(ic); - return NULL; - } - - return ic; -} - -enum AVDurationEstimationMethod av_fmt_ctx_get_duration_estimation_method(const AVFormatContext* ctx) -{ - return ctx->duration_estimation_method; -} - -const AVClass *avformat_get_class(void) -{ - return &av_format_context_class; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options_table.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options_table.h deleted file mode 100644 index 982eaa05a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/options_table.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_OPTIONS_TABLE_H -#define AVFORMAT_OPTIONS_TABLE_H - -#include - -#include "libavutil/opt.h" -#include "avformat.h" - -#define OFFSET(x) offsetof(AVFormatContext,x) -#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C -//these names are too long to be readable -#define E AV_OPT_FLAG_ENCODING_PARAM -#define D AV_OPT_FLAG_DECODING_PARAM - -static const AVOption avformat_options[] = { -{"avioflags", NULL, OFFSET(avio_flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, INT_MIN, INT_MAX, D|E, "avioflags"}, -{"direct", "reduce buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVIO_FLAG_DIRECT }, INT_MIN, INT_MAX, D|E, "avioflags"}, -{"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT, {.i64 = 5000000 }, 32, INT_MAX, D}, -{"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, E}, -{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"}, -{"flush_packets", "reduce the latency by flushing out packets immediately", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D, "fflags"}, -{"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, INT_MIN, INT_MAX, D, "fflags"}, -{"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, INT_MIN, INT_MAX, D, "fflags"}, -{"nofillin", "do not fill in missing values that can be exactly calculated", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOFILLIN }, INT_MIN, INT_MAX, D, "fflags"}, -{"noparse", "disable AVParsers, this needs nofillin too", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOPARSE }, INT_MIN, INT_MAX, D, "fflags"}, -{"igndts", "ignore dts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNDTS }, INT_MIN, INT_MAX, D, "fflags"}, -{"discardcorrupt", "discard corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_DISCARD_CORRUPT }, INT_MIN, INT_MAX, D, "fflags"}, -{"sortdts", "try to interleave outputted packets by dts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_SORT_DTS }, INT_MIN, INT_MAX, D, "fflags"}, -{"keepside", "don't merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"}, -{"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"}, -{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"}, -{"seek2any", "allow seeking to non-keyframes on demuxer level when supported", OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D}, -{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.i64 = 5*AV_TIME_BASE }, 0, INT_MAX, D}, -{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D}, -{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D}, -{"rtbufsize", "max memory used for buffering real-time frames", OFFSET(max_picture_buffer), AV_OPT_TYPE_INT, {.i64 = 3041280 }, 0, INT_MAX, D}, /* defaults to 1s of 15fps 352x288 YUYV422 video */ -{"fdebug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, E|D, "fdebug"}, -{"ts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_FDEBUG_TS }, INT_MIN, INT_MAX, E|D, "fdebug"}, -{"max_delay", "maximum muxing or demuxing delay in microseconds", OFFSET(max_delay), AV_OPT_TYPE_INT, {.i64 = -1 }, -1, INT_MAX, E|D}, -{"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX-1, D}, -{"audio_preload", "microseconds by which audio packets should be interleaved earlier", OFFSET(audio_preload), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, E}, -{"chunk_duration", "microseconds for each chunk", OFFSET(max_chunk_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, E}, -{"chunk_size", "size in bytes for each chunk", OFFSET(max_chunk_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, E}, -/* this is a crutch for avconv, since it cannot deal with identically named options in different contexts. - * to be removed when avconv is fixed */ -{"f_err_detect", "set error detection flags (deprecated; use err_detect, save via avconv)", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"}, -{"err_detect", "set error detection flags", OFFSET(error_recognition), AV_OPT_TYPE_FLAGS, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"}, -{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, D, "err_detect"}, -{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, D, "err_detect"}, -{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, D, "err_detect"}, -{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, D, "err_detect"}, -{"careful", "consider things that violate the spec and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CAREFUL }, INT_MIN, INT_MAX, D, "err_detect"}, -{"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, D, "err_detect"}, -{"aggressive", "consider things that a sane encoder shouldn't do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, D, "err_detect"}, -{"use_wallclock_as_timestamps", "use wallclock as timestamps", OFFSET(use_wallclock_as_timestamps), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D}, -{"avoid_negative_ts", "shift timestamps to make them non-negative. 1 enables, 0 disables, default of -1 enables when required by target format.", OFFSET(avoid_negative_ts), AV_OPT_TYPE_INT, {.i64 = -1}, -1, 1, E}, -{"skip_initial_bytes", "set number of bytes to skip before reading header and frames", OFFSET(skip_initial_bytes), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX-1, D}, -{"correct_ts_overflow", "correct single timestamp overflows", OFFSET(correct_ts_overflow), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, D}, -{"flush_packets", "enable flushing of the I/O context after each packet", OFFSET(flush_packets), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 1, E}, -{NULL}, -}; - -#undef E -#undef D -#undef DEFAULT -#undef OFFSET - -#endif /* AVFORMAT_OPTIONS_TABLE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.c deleted file mode 100644 index 3218956df..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * various OS-feature replacement utilities - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * copyright (c) 2002 Francois Revol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/* needed by inet_aton() */ -#define _SVID_SOURCE - -#include "config.h" -#include "avformat.h" -#include "os_support.h" - -#if CONFIG_NETWORK -#include -#if !HAVE_POLL_H -#if HAVE_SYS_TIME_H -#include -#endif -#if HAVE_WINSOCK2_H -#include -#elif HAVE_SYS_SELECT_H -#include -#endif -#endif - -#include "network.h" - -#if !HAVE_INET_ATON -#include - -int ff_inet_aton(const char *str, struct in_addr *add) -{ - unsigned int add1 = 0, add2 = 0, add3 = 0, add4 = 0; - - if (sscanf(str, "%d.%d.%d.%d", &add1, &add2, &add3, &add4) != 4) - return 0; - - if (!add1 || (add1 | add2 | add3 | add4) > 255) - return 0; - - add->s_addr = htonl((add1 << 24) + (add2 << 16) + (add3 << 8) + add4); - - return 1; -} -#else -int ff_inet_aton(const char *str, struct in_addr *add) -{ - return inet_aton(str, add); -} -#endif /* !HAVE_INET_ATON */ - -#if !HAVE_GETADDRINFO -int ff_getaddrinfo(const char *node, const char *service, - const struct addrinfo *hints, struct addrinfo **res) -{ - struct hostent *h = NULL; - struct addrinfo *ai; - struct sockaddr_in *sin; - -#if HAVE_WINSOCK2_H - int (WSAAPI *win_getaddrinfo)(const char *node, const char *service, - const struct addrinfo *hints, - struct addrinfo **res); - HMODULE ws2mod = GetModuleHandle("ws2_32.dll"); - win_getaddrinfo = GetProcAddress(ws2mod, "getaddrinfo"); - if (win_getaddrinfo) - return win_getaddrinfo(node, service, hints, res); -#endif - - *res = NULL; - sin = av_mallocz(sizeof(struct sockaddr_in)); - if (!sin) - return EAI_FAIL; - sin->sin_family = AF_INET; - - if (node) { - if (!ff_inet_aton(node, &sin->sin_addr)) { - if (hints && (hints->ai_flags & AI_NUMERICHOST)) { - av_free(sin); - return EAI_FAIL; - } - h = gethostbyname(node); - if (!h) { - av_free(sin); - return EAI_FAIL; - } - memcpy(&sin->sin_addr, h->h_addr_list[0], sizeof(struct in_addr)); - } - } else { - if (hints && (hints->ai_flags & AI_PASSIVE)) - sin->sin_addr.s_addr = INADDR_ANY; - else - sin->sin_addr.s_addr = INADDR_LOOPBACK; - } - - /* Note: getaddrinfo allows service to be a string, which - * should be looked up using getservbyname. */ - if (service) - sin->sin_port = htons(atoi(service)); - - ai = av_mallocz(sizeof(struct addrinfo)); - if (!ai) { - av_free(sin); - return EAI_FAIL; - } - - *res = ai; - ai->ai_family = AF_INET; - ai->ai_socktype = hints ? hints->ai_socktype : 0; - switch (ai->ai_socktype) { - case SOCK_STREAM: - ai->ai_protocol = IPPROTO_TCP; - break; - case SOCK_DGRAM: - ai->ai_protocol = IPPROTO_UDP; - break; - default: - ai->ai_protocol = 0; - break; - } - - ai->ai_addr = (struct sockaddr *)sin; - ai->ai_addrlen = sizeof(struct sockaddr_in); - if (hints && (hints->ai_flags & AI_CANONNAME)) - ai->ai_canonname = h ? av_strdup(h->h_name) : NULL; - - ai->ai_next = NULL; - return 0; -} - -void ff_freeaddrinfo(struct addrinfo *res) -{ -#if HAVE_WINSOCK2_H - void (WSAAPI *win_freeaddrinfo)(struct addrinfo *res); - HMODULE ws2mod = GetModuleHandle("ws2_32.dll"); - win_freeaddrinfo = (void (WSAAPI *)(struct addrinfo *res)) - GetProcAddress(ws2mod, "freeaddrinfo"); - if (win_freeaddrinfo) { - win_freeaddrinfo(res); - return; - } -#endif - - av_free(res->ai_canonname); - av_free(res->ai_addr); - av_free(res); -} - -int ff_getnameinfo(const struct sockaddr *sa, int salen, - char *host, int hostlen, - char *serv, int servlen, int flags) -{ - const struct sockaddr_in *sin = (const struct sockaddr_in *)sa; - -#if HAVE_WINSOCK2_H - int (WSAAPI *win_getnameinfo)(const struct sockaddr *sa, socklen_t salen, - char *host, DWORD hostlen, - char *serv, DWORD servlen, int flags); - HMODULE ws2mod = GetModuleHandle("ws2_32.dll"); - win_getnameinfo = GetProcAddress(ws2mod, "getnameinfo"); - if (win_getnameinfo) - return win_getnameinfo(sa, salen, host, hostlen, serv, servlen, flags); -#endif - - if (sa->sa_family != AF_INET) - return EAI_FAMILY; - if (!host && !serv) - return EAI_NONAME; - - if (host && hostlen > 0) { - struct hostent *ent = NULL; - uint32_t a; - if (!(flags & NI_NUMERICHOST)) - ent = gethostbyaddr((const char *)&sin->sin_addr, - sizeof(sin->sin_addr), AF_INET); - - if (ent) { - snprintf(host, hostlen, "%s", ent->h_name); - } else if (flags & NI_NAMERQD) { - return EAI_NONAME; - } else { - a = ntohl(sin->sin_addr.s_addr); - snprintf(host, hostlen, "%d.%d.%d.%d", - ((a >> 24) & 0xff), ((a >> 16) & 0xff), - ((a >> 8) & 0xff), (a & 0xff)); - } - } - - if (serv && servlen > 0) { - struct servent *ent = NULL; -#if HAVE_GETSERVBYPORT - if (!(flags & NI_NUMERICSERV)) - ent = getservbyport(sin->sin_port, flags & NI_DGRAM ? "udp" : "tcp"); -#endif - - if (ent) - snprintf(serv, servlen, "%s", ent->s_name); - else - snprintf(serv, servlen, "%d", ntohs(sin->sin_port)); - } - - return 0; -} -#endif /* !HAVE_GETADDRINFO */ - -#if !HAVE_GETADDRINFO || HAVE_WINSOCK2_H -const char *ff_gai_strerror(int ecode) -{ - switch (ecode) { - case EAI_AGAIN: - return "Temporary failure in name resolution"; - case EAI_BADFLAGS: - return "Invalid flags for ai_flags"; - case EAI_FAIL: - return "A non-recoverable error occurred"; - case EAI_FAMILY: - return "The address family was not recognized or the address " - "length was invalid for the specified family"; - case EAI_MEMORY: - return "Memory allocation failure"; -#if EAI_NODATA != EAI_NONAME - case EAI_NODATA: - return "No address associated with hostname"; -#endif - case EAI_NONAME: - return "The name does not resolve for the supplied parameters"; - case EAI_SERVICE: - return "servname not supported for ai_socktype"; - case EAI_SOCKTYPE: - return "ai_socktype not supported"; - } - - return "Unknown error"; -} -#endif /* !HAVE_GETADDRINFO || HAVE_WINSOCK2_H */ - -int ff_socket_nonblock(int socket, int enable) -{ -#if HAVE_WINSOCK2_H - u_long param = enable; - return ioctlsocket(socket, FIONBIO, ¶m); -#else - if (enable) - return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) | O_NONBLOCK); - else - return fcntl(socket, F_SETFL, fcntl(socket, F_GETFL) & ~O_NONBLOCK); -#endif -} - -#if !HAVE_POLL_H -int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout) -{ - fd_set read_set; - fd_set write_set; - fd_set exception_set; - nfds_t i; - int n; - int rc; - -#if HAVE_WINSOCK2_H - if (numfds >= FD_SETSIZE) { - errno = EINVAL; - return -1; - } -#endif - - FD_ZERO(&read_set); - FD_ZERO(&write_set); - FD_ZERO(&exception_set); - - n = 0; - for (i = 0; i < numfds; i++) { - if (fds[i].fd < 0) - continue; -#if !HAVE_WINSOCK2_H - if (fds[i].fd >= FD_SETSIZE) { - errno = EINVAL; - return -1; - } -#endif - - if (fds[i].events & POLLIN) - FD_SET(fds[i].fd, &read_set); - if (fds[i].events & POLLOUT) - FD_SET(fds[i].fd, &write_set); - if (fds[i].events & POLLERR) - FD_SET(fds[i].fd, &exception_set); - - if (fds[i].fd >= n) - n = fds[i].fd + 1; - } - - if (n == 0) - /* Hey!? Nothing to poll, in fact!!! */ - return 0; - - if (timeout < 0) { - rc = select(n, &read_set, &write_set, &exception_set, NULL); - } else { - struct timeval tv; - tv.tv_sec = timeout / 1000; - tv.tv_usec = 1000 * (timeout % 1000); - rc = select(n, &read_set, &write_set, &exception_set, &tv); - } - - if (rc < 0) - return rc; - - for (i = 0; i < numfds; i++) { - fds[i].revents = 0; - - if (FD_ISSET(fds[i].fd, &read_set)) - fds[i].revents |= POLLIN; - if (FD_ISSET(fds[i].fd, &write_set)) - fds[i].revents |= POLLOUT; - if (FD_ISSET(fds[i].fd, &exception_set)) - fds[i].revents |= POLLERR; - } - - return rc; -} -#endif /* HAVE_POLL_H */ -#endif /* CONFIG_NETWORK */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.h deleted file mode 100644 index 7c7cd1f1a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/os_support.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * various OS-feature replacement utilities - * copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_OS_SUPPORT_H -#define AVFORMAT_OS_SUPPORT_H - -/** - * @file - * miscellaneous OS support macros and functions. - */ - -#include "config.h" - -#include - -#if defined(_WIN32) && !defined(__MINGW32CE__) -# include -# ifdef lseek -# undef lseek -# endif -# define lseek(f,p,w) _lseeki64((f), (p), (w)) -# ifdef stat -# undef stat -# endif -# define stat _stati64 -# ifdef fstat -# undef fstat -# endif -# define fstat(f,s) _fstati64((f), (s)) -#endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */ - -#ifdef _WIN32 -#if HAVE_DIRECT_H -#include -#elif HAVE_IO_H -#include -#endif -#define mkdir(a, b) _mkdir(a) -#endif - -static inline int is_dos_path(const char *path) -{ -#if HAVE_DOS_PATHS - if (path[0] && path[1] == ':') - return 1; -#endif - return 0; -} - -#if defined(__OS2__) || defined(__Plan9__) -#define SHUT_RD 0 -#define SHUT_WR 1 -#define SHUT_RDWR 2 -#endif - -#if defined(_WIN32) -#define SHUT_RD SD_RECEIVE -#define SHUT_WR SD_SEND -#define SHUT_RDWR SD_BOTH - -#ifndef S_IRUSR -#define S_IRUSR S_IREAD -#endif -#ifndef S_IWUSR -#define S_IWUSR S_IWRITE -#endif -#endif - -#if CONFIG_NETWORK -#if !HAVE_SOCKLEN_T -typedef int socklen_t; -#endif - -/* most of the time closing a socket is just closing an fd */ -#if !HAVE_CLOSESOCKET -#define closesocket close -#endif - -#if !HAVE_POLL_H -typedef unsigned long nfds_t; - -#if HAVE_WINSOCK2_H -#include -#endif -#if !HAVE_STRUCT_POLLFD -struct pollfd { - int fd; - short events; /* events to look for */ - short revents; /* events that occurred */ -}; - -/* events & revents */ -#define POLLIN 0x0001 /* any readable data available */ -#define POLLOUT 0x0002 /* file descriptor is writeable */ -#define POLLRDNORM POLLIN -#define POLLWRNORM POLLOUT -#define POLLRDBAND 0x0008 /* priority readable data */ -#define POLLWRBAND 0x0010 /* priority data can be written */ -#define POLLPRI 0x0020 /* high priority readable data */ - -/* revents only */ -#define POLLERR 0x0004 /* errors pending */ -#define POLLHUP 0x0080 /* disconnected */ -#define POLLNVAL 0x1000 /* invalid file descriptor */ -#endif - - -int ff_poll(struct pollfd *fds, nfds_t numfds, int timeout); -#define poll ff_poll -#endif /* HAVE_POLL_H */ -#endif /* CONFIG_NETWORK */ - -#endif /* AVFORMAT_OS_SUPPORT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.c deleted file mode 100644 index 2fe44dcb4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * PCM common functions - * Copyright (c) 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/mathematics.h" -#include "avformat.h" -#include "pcm.h" - -#define RAW_SAMPLES 1024 - -int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size; - - size= RAW_SAMPLES*s->streams[0]->codec->block_align; - if (size <= 0) - return AVERROR(EINVAL); - - ret= av_get_packet(s->pb, pkt, size); - - pkt->flags &= ~AV_PKT_FLAG_CORRUPT; - pkt->stream_index = 0; - if (ret < 0) - return ret; - - return ret; -} - -int ff_pcm_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags) -{ - AVStream *st; - int block_align, byte_rate; - int64_t pos, ret; - - st = s->streams[0]; - - block_align = st->codec->block_align ? st->codec->block_align : - (av_get_bits_per_sample(st->codec->codec_id) * st->codec->channels) >> 3; - byte_rate = st->codec->bit_rate ? st->codec->bit_rate >> 3 : - block_align * st->codec->sample_rate; - - if (block_align <= 0 || byte_rate <= 0) - return -1; - if (timestamp < 0) timestamp = 0; - - /* compute the position by aligning it to block_align */ - pos = av_rescale_rnd(timestamp * byte_rate, - st->time_base.num, - st->time_base.den * (int64_t)block_align, - (flags & AVSEEK_FLAG_BACKWARD) ? AV_ROUND_DOWN : AV_ROUND_UP); - pos *= block_align; - - /* recompute exact position */ - st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); - if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) - return ret; - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.h deleted file mode 100644 index 9af36d5a2..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/pcm.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * PCM common functions - * Copyright (C) 2007 Aurelien Jacobs - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_PCM_H -#define AVFORMAT_PCM_H - -#include "avformat.h" - -int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt); -int ff_pcm_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags); - -#endif /* AVFORMAT_PCM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.c deleted file mode 100644 index a9ff22ae1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * RAW demuxers - * Copyright (c) 2001 Fabrice Bellard - * Copyright (c) 2005 Alex Beregszaszi - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "internal.h" -#include "avio_internal.h" -#include "rawdec.h" -#include "libavutil/opt.h" -#include "libavutil/parseutils.h" -#include "libavutil/pixdesc.h" -#include "libavutil/avassert.h" - -#define RAW_PACKET_SIZE 1024 - -int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size; - - size = RAW_PACKET_SIZE; - - if (av_new_packet(pkt, size) < 0) - return AVERROR(ENOMEM); - - pkt->pos= avio_tell(s->pb); - pkt->stream_index = 0; - ret = ffio_read_partial(s->pb, pkt->data, size); - if (ret < 0) { - av_free_packet(pkt); - return ret; - } - av_shrink_packet(pkt, ret); - return ret; -} - -int ff_raw_audio_read_header(AVFormatContext *s) -{ - AVStream *st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = s->iformat->raw_codec_id; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - st->start_time = 0; - /* the parameters will be extracted from the compressed bitstream */ - - return 0; -} - -/* MPEG-1/H.263 input */ -int ff_raw_video_read_header(AVFormatContext *s) -{ - AVStream *st; - FFRawVideoDemuxerContext *s1 = s->priv_data; - int ret = 0; - - - st = avformat_new_stream(s, NULL); - if (!st) { - ret = AVERROR(ENOMEM); - goto fail; - } - - st->codec->codec_type = AVMEDIA_TYPE_VIDEO; - st->codec->codec_id = s->iformat->raw_codec_id; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - st->codec->time_base = av_inv_q(s1->framerate); - avpriv_set_pts_info(st, 64, 1, 1200000); - -fail: - return ret; -} - -static int ff_raw_data_read_header(AVFormatContext *s) -{ - AVStream *st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - st->codec->codec_type = AVMEDIA_TYPE_DATA; - st->codec->codec_id = s->iformat->raw_codec_id; - st->start_time = 0; - return 0; -} - -/* Note: Do not forget to add new entries to the Makefile as well. */ - -#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) -#define DEC AV_OPT_FLAG_DECODING_PARAM -const AVOption ff_rawvideo_options[] = { - { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, DEC}, - { NULL }, -}; - -#if CONFIG_DATA_DEMUXER -AVInputFormat ff_data_demuxer = { - .name = "data", - .long_name = NULL_IF_CONFIG_SMALL("raw data"), - .read_header = ff_raw_data_read_header, - .read_packet = ff_raw_read_partial_packet, - .raw_codec_id = AV_CODEC_ID_NONE, -}; -#endif - -#if CONFIG_LATM_DEMUXER -AVInputFormat ff_latm_demuxer = { - .name = "latm", - .long_name = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"), - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "latm", - .raw_codec_id = AV_CODEC_ID_AAC_LATM, -}; -#endif - -#if CONFIG_MJPEG_DEMUXER -FF_DEF_RAWVIDEO_DEMUXER(mjpeg, "raw MJPEG video", NULL, "mjpg,mjpeg,mpo", AV_CODEC_ID_MJPEG) -#endif - -#if CONFIG_MLP_DEMUXER -AVInputFormat ff_mlp_demuxer = { - .name = "mlp", - .long_name = NULL_IF_CONFIG_SMALL("raw MLP"), - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "mlp", - .raw_codec_id = AV_CODEC_ID_MLP, -}; -#endif - -#if CONFIG_TRUEHD_DEMUXER -AVInputFormat ff_truehd_demuxer = { - .name = "truehd", - .long_name = NULL_IF_CONFIG_SMALL("raw TrueHD"), - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "thd", - .raw_codec_id = AV_CODEC_ID_TRUEHD, -}; -#endif - -#if CONFIG_SHORTEN_DEMUXER -AVInputFormat ff_shorten_demuxer = { - .name = "shn", - .long_name = NULL_IF_CONFIG_SMALL("raw Shorten"), - .read_header = ff_raw_audio_read_header, - .read_packet = ff_raw_read_partial_packet, - .flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK, - .extensions = "shn", - .raw_codec_id = AV_CODEC_ID_SHORTEN, -}; -#endif - -#if CONFIG_VC1_DEMUXER -FF_DEF_RAWVIDEO_DEMUXER(vc1, "raw VC-1", NULL, "vc1", AV_CODEC_ID_VC1) -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.h deleted file mode 100644 index 59108559d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rawdec.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * RAW demuxers - * Copyright (C) 2007 Aurelien Jacobs - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_RAWDEC_H -#define AVFORMAT_RAWDEC_H - -#include "avformat.h" -#include "libavutil/log.h" -#include "libavutil/opt.h" - -typedef struct FFRawVideoDemuxerContext { - const AVClass *class; /**< Class for private options. */ - char *video_size; /**< String describing video size, set by a private option. */ - char *pixel_format; /**< Set by a private option. */ - AVRational framerate; /**< AVRational describing framerate, set by a private option. */ -} FFRawVideoDemuxerContext; - -extern const AVOption ff_rawvideo_options[]; - -int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt); - -int ff_raw_audio_read_header(AVFormatContext *s); - -int ff_raw_video_read_header(AVFormatContext *s); - -#define FF_RAWVIDEO_DEMUXER_CLASS(name)\ -static const AVClass name ## _demuxer_class = {\ - .class_name = #name " demuxer",\ - .item_name = av_default_item_name,\ - .option = ff_rawvideo_options,\ - .version = LIBAVUTIL_VERSION_INT,\ -}; - -#define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\ -FF_RAWVIDEO_DEMUXER_CLASS(shortname)\ -AVInputFormat ff_ ## shortname ## _demuxer = {\ - .name = #shortname,\ - .long_name = NULL_IF_CONFIG_SMALL(longname),\ - .read_probe = probe,\ - .read_header = ff_raw_video_read_header,\ - .read_packet = ff_raw_read_partial_packet,\ - .extensions = ext,\ - .flags = AVFMT_GENERIC_INDEX,\ - .raw_codec_id = id,\ - .priv_data_size = sizeof(FFRawVideoDemuxerContext),\ - .priv_class = &shortname ## _demuxer_class,\ -}; - -#endif /* AVFORMAT_RAWDEC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rdt.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rdt.h deleted file mode 100644 index c2ec94b8b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rdt.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Realmedia RTSP (RDT) definitions - * Copyright (c) 2007 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_RDT_H -#define AVFORMAT_RDT_H - -#include -#include "avformat.h" -#include "rtpdec.h" - -typedef struct RDTDemuxContext RDTDemuxContext; - -/** - * Allocate and init the RDT parsing context. - * @param ic the containing RTSP demuxer context - * @param first_stream_of_set_idx index to the first AVStream in the RTSP - * demuxer context's ic->streams array that is part of this - * particular stream's set of streams (with identical content) - * @param priv_data private data of the payload data handler context - * @param handler pointer to the parse_packet() payload parsing function - * @return a newly allocated RDTDemuxContext. Free with ff_rdt_parse_close(). - */ -RDTDemuxContext *ff_rdt_parse_open(AVFormatContext *ic, - int first_stream_of_set_idx, - void *priv_data, - RTPDynamicProtocolHandler *handler); -void ff_rdt_parse_close(RDTDemuxContext *s); - -/** - * Calculate the response (RealChallenge2 in the RTSP header) to the - * challenge (RealChallenge1 in the RTSP header from the Real/Helix - * server), which is used as some sort of client validation. - * - * @param response pointer to response buffer, it should be at least 41 bytes - * (40 data + 1 zero) bytes long. - * @param chksum pointer to buffer containing a checksum of the response, - * it should be at least 9 (8 data + 1 zero) bytes long. - * @param challenge pointer to the RealChallenge1 value provided by the - * server. - */ -void ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], - const char *challenge); - -/** - * Register RDT-related dynamic payload handlers with our cache. - */ -void av_register_rdt_dynamic_payload_handlers(void); - -/** - * Add subscription information to Subscribe parameter string. - * - * @param cmd string to write the subscription information into. - * @param size size of cmd. - * @param stream_nr stream number. - * @param rule_nr rule number to conform to. - */ -void ff_rdt_subscribe_rule(char *cmd, int size, - int stream_nr, int rule_nr); - -/** - * Parse RDT-style packet header. - * - * @param buf input buffer - * @param len length of input buffer - * @param pset_id will be set to the set ID this packet belongs to - * @param pseq_no will be set to the sequence number of the packet - * @param pstream_id will be set to the stream ID this packet belongs to - * @param pis_keyframe will be whether this packet belongs to a keyframe - * @param ptimestamp will be set to the timestamp of the packet - * @return the amount of bytes consumed, or negative on error - */ -int ff_rdt_parse_header(const uint8_t *buf, int len, - int *pset_id, int *pseq_no, int *pstream_id, - int *pis_keyframe, uint32_t *ptimestamp); - -/** - * Parse RDT-style packet data (header + media data). - * Usage similar to rtp_parse_packet(). - */ -int ff_rdt_parse_packet(RDTDemuxContext *s, AVPacket *pkt, - uint8_t **buf, int len); - -/** - * Parse a server-related SDP line. - * - * @param s the RTSP AVFormatContext - * @param stream_index the index of the first stream in the set represented - * by the SDP m= line (in s->streams) - * @param buf the SDP line - */ -void ff_real_parse_sdp_a_line(AVFormatContext *s, int stream_index, - const char *buf); - -#endif /* AVFORMAT_RDT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.c deleted file mode 100644 index 2ad9c9f67..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.c +++ /dev/null @@ -1,469 +0,0 @@ -/* - * RIFF common functions and data - * Copyright (c) 2000 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/error.h" -#include "libavcodec/avcodec.h" -#include "avformat.h" -#include "riff.h" - -/* Note: When encoding, the first matching tag is used, so order is - * important if multiple tags are possible for a given codec. - * Note also that this list is used for more than just riff, other - * files use it as well. - */ -const AVCodecTag ff_codec_bmp_tags[] = { - { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4') }, - { AV_CODEC_ID_H264, MKTAG('h', '2', '6', '4') }, - { AV_CODEC_ID_H264, MKTAG('X', '2', '6', '4') }, - { AV_CODEC_ID_H264, MKTAG('x', '2', '6', '4') }, - { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, - { AV_CODEC_ID_H264, MKTAG('D', 'A', 'V', 'C') }, - { AV_CODEC_ID_H264, MKTAG('S', 'M', 'V', '2') }, - { AV_CODEC_ID_H264, MKTAG('V', 'S', 'S', 'H') }, - { AV_CODEC_ID_H264, MKTAG('Q', '2', '6', '4') }, /* QNAP surveillance system */ - { AV_CODEC_ID_H264, MKTAG('V', '2', '6', '4') }, - { AV_CODEC_ID_H264, MKTAG('G', 'A', 'V', 'C') }, /* GeoVision camera */ - { AV_CODEC_ID_H264, MKTAG('U', 'M', 'S', 'V') }, - { AV_CODEC_ID_H264, MKTAG('I', 'N', 'M', 'C') }, - { AV_CODEC_ID_H263, MKTAG('H', '2', '6', '3') }, - { AV_CODEC_ID_H263, MKTAG('X', '2', '6', '3') }, - { AV_CODEC_ID_H263, MKTAG('T', '2', '6', '3') }, - { AV_CODEC_ID_H263, MKTAG('L', '2', '6', '3') }, - { AV_CODEC_ID_H263, MKTAG('V', 'X', '1', 'K') }, - { AV_CODEC_ID_H263, MKTAG('Z', 'y', 'G', 'o') }, - { AV_CODEC_ID_H263, MKTAG('M', '2', '6', '3') }, - { AV_CODEC_ID_H263, MKTAG('l', 's', 'v', 'm') }, - { AV_CODEC_ID_H263P, MKTAG('H', '2', '6', '3') }, - { AV_CODEC_ID_H263I, MKTAG('I', '2', '6', '3') }, /* Intel H.263 */ - { AV_CODEC_ID_H261, MKTAG('H', '2', '6', '1') }, - { AV_CODEC_ID_H263, MKTAG('U', '2', '6', '3') }, - { AV_CODEC_ID_MPEG4, MKTAG('F', 'M', 'P', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', 'X') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'X', '5', '0') }, - { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'D') }, - { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'S') }, - { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'S', '2') }, - /* some broken AVIs use this */ - { AV_CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 0 ) }, - /* some broken AVIs use this */ - { AV_CODEC_ID_MPEG4, MKTAG('Z', 'M', 'P', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'V', '1') }, - { AV_CODEC_ID_MPEG4, MKTAG('B', 'L', 'Z', '0') }, - { AV_CODEC_ID_MPEG4, MKTAG('m', 'p', '4', 'v') }, - { AV_CODEC_ID_MPEG4, MKTAG('U', 'M', 'P', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('W', 'V', '1', 'F') }, - { AV_CODEC_ID_MPEG4, MKTAG('S', 'E', 'D', 'G') }, - { AV_CODEC_ID_MPEG4, MKTAG('R', 'M', 'P', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('3', 'I', 'V', '2') }, - /* WaWv MPEG-4 Video Codec */ - { AV_CODEC_ID_MPEG4, MKTAG('W', 'A', 'W', 'V') }, - { AV_CODEC_ID_MPEG4, MKTAG('F', 'F', 'D', 'S') }, - { AV_CODEC_ID_MPEG4, MKTAG('F', 'V', 'F', 'W') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'C', 'O', 'D') }, - { AV_CODEC_ID_MPEG4, MKTAG('M', 'V', 'X', 'M') }, - { AV_CODEC_ID_MPEG4, MKTAG('P', 'M', '4', 'V') }, - { AV_CODEC_ID_MPEG4, MKTAG('S', 'M', 'P', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'X', 'G', 'M') }, - { AV_CODEC_ID_MPEG4, MKTAG('V', 'I', 'D', 'M') }, - { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'T', '3') }, - { AV_CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'X') }, - /* flipped video */ - { AV_CODEC_ID_MPEG4, MKTAG('G', '2', '6', '4') }, - /* flipped video */ - { AV_CODEC_ID_MPEG4, MKTAG('H', 'D', 'X', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'M', '4', 'V') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'M', 'K', '2') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'Y', 'M', '4') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'I', 'G', 'I') }, - /* Ephv MPEG-4 */ - { AV_CODEC_ID_MPEG4, MKTAG('E', 'P', 'H', 'V') }, - { AV_CODEC_ID_MPEG4, MKTAG('E', 'M', '4', 'A') }, - /* Divio MPEG-4 */ - { AV_CODEC_ID_MPEG4, MKTAG('M', '4', 'C', 'C') }, - { AV_CODEC_ID_MPEG4, MKTAG('S', 'N', '4', '0') }, - { AV_CODEC_ID_MPEG4, MKTAG('V', 'S', 'P', 'X') }, - { AV_CODEC_ID_MPEG4, MKTAG('U', 'L', 'D', 'X') }, - { AV_CODEC_ID_MPEG4, MKTAG('G', 'E', 'O', 'V') }, - /* Samsung SHR-6040 */ - { AV_CODEC_ID_MPEG4, MKTAG('S', 'I', 'P', 'P') }, - { AV_CODEC_ID_MPEG4, MKTAG('S', 'M', '4', 'V') }, - { AV_CODEC_ID_MPEG4, MKTAG('X', 'V', 'I', 'X') }, - { AV_CODEC_ID_MPEG4, MKTAG('D', 'r', 'e', 'X') }, - { AV_CODEC_ID_MPEG4, MKTAG('Q', 'M', 'P', '4') }, /* QNAP Systems */ - { AV_CODEC_ID_MPEG4, MKTAG('P', 'L', 'V', '1') }, /* Pelco DVR MPEG-4 */ - { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', '4', '3') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '3') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('M', 'P', 'G', '3') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '5') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '6') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'I', 'V', '4') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('D', 'V', 'X', '3') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('A', 'P', '4', '1') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '1') }, - { AV_CODEC_ID_MSMPEG4V3, MKTAG('C', 'O', 'L', '0') }, - { AV_CODEC_ID_MSMPEG4V2, MKTAG('M', 'P', '4', '2') }, - { AV_CODEC_ID_MSMPEG4V2, MKTAG('D', 'I', 'V', '2') }, - { AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', 'G', '4') }, - { AV_CODEC_ID_MSMPEG4V1, MKTAG('M', 'P', '4', '1') }, - { AV_CODEC_ID_WMV1, MKTAG('W', 'M', 'V', '1') }, - { AV_CODEC_ID_WMV2, MKTAG('W', 'M', 'V', '2') }, - { AV_CODEC_ID_WMV2, MKTAG('G', 'X', 'V', 'E') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', 'd') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'l') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '2', '5') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', '5', '0') }, - /* Canopus DV */ - { AV_CODEC_ID_DVVIDEO, MKTAG('c', 'd', 'v', 'c') }, - /* Canopus DV */ - { AV_CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', 'H') }, - /* Canopus DV */ - { AV_CODEC_ID_DVVIDEO, MKTAG('C', 'D', 'V', '5') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', ' ') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'c', 's') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'h', '1') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 'i', 's') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('p', 'd', 'v', 'c') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('S', 'L', '2', '5') }, - { AV_CODEC_ID_DVVIDEO, MKTAG('S', 'L', 'D', 'V') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '1') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'g', '2') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', '2') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'E', 'G') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('P', 'I', 'M', '1') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('P', 'I', 'M', '2') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('V', 'C', 'R', '2') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG( 1 , 0 , 0 , 16) }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG( 2 , 0 , 0 , 16) }, - { AV_CODEC_ID_MPEG4, MKTAG( 4 , 0 , 0 , 16) }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('D', 'V', 'R', ' ') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'M', 'E', 'S') }, - /* Lead MPEG-2 in AVI */ - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('L', 'M', 'P', '2') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('s', 'l', 'i', 'f') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('E', 'M', '2', 'V') }, - /* Matrox MPEG-2 intra-only */ - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', '7', '0', '1') }, - { AV_CODEC_ID_MPEG2VIDEO, MKTAG('m', 'p', 'g', 'v') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('B', 'W', '1', '0') }, - { AV_CODEC_ID_MPEG1VIDEO, MKTAG('X', 'M', 'P', 'G') }, /* Xing MPEG intra only */ - { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'P', 'G') }, - { AV_CODEC_ID_MJPEG, MKTAG('L', 'J', 'P', 'G') }, - { AV_CODEC_ID_MJPEG, MKTAG('d', 'm', 'b', '1') }, - { AV_CODEC_ID_MJPEG, MKTAG('m', 'j', 'p', 'a') }, - { AV_CODEC_ID_LJPEG, MKTAG('L', 'J', 'P', 'G') }, - /* Pegasus lossless JPEG */ - { AV_CODEC_ID_MJPEG, MKTAG('J', 'P', 'G', 'L') }, - /* JPEG-LS custom FOURCC for AVI - encoder */ - { AV_CODEC_ID_JPEGLS, MKTAG('M', 'J', 'L', 'S') }, - { AV_CODEC_ID_JPEGLS, MKTAG('M', 'J', 'P', 'G') }, - /* JPEG-LS custom FOURCC for AVI - decoder */ - { AV_CODEC_ID_MJPEG, MKTAG('M', 'J', 'L', 'S') }, - { AV_CODEC_ID_MJPEG, MKTAG('j', 'p', 'e', 'g') }, - { AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'P', 'G') }, - { AV_CODEC_ID_AVRN, MKTAG('A', 'V', 'R', 'n') }, - { AV_CODEC_ID_MJPEG, MKTAG('A', 'C', 'D', 'V') }, - { AV_CODEC_ID_MJPEG, MKTAG('Q', 'I', 'V', 'G') }, - /* SL M-JPEG */ - { AV_CODEC_ID_MJPEG, MKTAG('S', 'L', 'M', 'J') }, - /* Creative Webcam JPEG */ - { AV_CODEC_ID_MJPEG, MKTAG('C', 'J', 'P', 'G') }, - /* Intel JPEG Library Video Codec */ - { AV_CODEC_ID_MJPEG, MKTAG('I', 'J', 'L', 'V') }, - /* Midvid JPEG Video Codec */ - { AV_CODEC_ID_MJPEG, MKTAG('M', 'V', 'J', 'P') }, - { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '1') }, - { AV_CODEC_ID_MJPEG, MKTAG('A', 'V', 'I', '2') }, - { AV_CODEC_ID_MJPEG, MKTAG('M', 'T', 'S', 'J') }, - /* Paradigm Matrix M-JPEG Codec */ - { AV_CODEC_ID_MJPEG, MKTAG('Z', 'J', 'P', 'G') }, - { AV_CODEC_ID_MJPEG, MKTAG('M', 'M', 'J', 'P') }, - { AV_CODEC_ID_HUFFYUV, MKTAG('H', 'F', 'Y', 'U') }, - { AV_CODEC_ID_FFVHUFF, MKTAG('F', 'F', 'V', 'H') }, - { AV_CODEC_ID_CYUV, MKTAG('C', 'Y', 'U', 'V') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG( 0 , 0 , 0 , 0 ) }, - { AV_CODEC_ID_RAWVIDEO, MKTAG( 3 , 0 , 0 , 0 ) }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('I', '4', '2', '0') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'Y', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('V', '4', '2', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'N', 'V') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'V') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'N', 'Y') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('u', 'y', 'v', '1') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'V', 'u', '1') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('2', 'v', 'u', 'y') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', 's') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('y', 'u', 'v', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('P', '4', '2', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '1', '6') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', '2', '4') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('U', 'Y', 'V', 'Y') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('V', 'Y', 'U', 'Y') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('I', 'Y', 'U', 'V') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', '0', '0') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '8', ' ', ' ') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('H', 'D', 'Y', 'C') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') }, - /* SoftLab-NSK VideoTizer */ - { AV_CODEC_ID_RAWVIDEO, MKTAG('V', 'D', 'T', 'Z') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', '1') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '1', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('N', 'V', '2', '1') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '1', 'B') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', '4', '2', 'B') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'U', 'V', '9') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'U', '9') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('a', 'u', 'v', '2') }, - { AV_CODEC_ID_RAWVIDEO, MKTAG('Y', 'V', 'Y', 'U') }, - { AV_CODEC_ID_FRWU, MKTAG('F', 'R', 'W', 'U') }, - { AV_CODEC_ID_R10K, MKTAG('R', '1', '0', 'k') }, - { AV_CODEC_ID_R210, MKTAG('r', '2', '1', '0') }, - { AV_CODEC_ID_V210, MKTAG('v', '2', '1', '0') }, - { AV_CODEC_ID_V308, MKTAG('v', '3', '0', '8') }, - { AV_CODEC_ID_V408, MKTAG('v', '4', '0', '8') }, - { AV_CODEC_ID_AYUV, MKTAG('A', 'Y', 'U', 'V') }, - { AV_CODEC_ID_V410, MKTAG('v', '4', '1', '0') }, - { AV_CODEC_ID_YUV4, MKTAG('y', 'u', 'v', '4') }, - { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '1') }, - { AV_CODEC_ID_INDEO3, MKTAG('I', 'V', '3', '2') }, - { AV_CODEC_ID_INDEO4, MKTAG('I', 'V', '4', '1') }, - { AV_CODEC_ID_INDEO5, MKTAG('I', 'V', '5', '0') }, - { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '1') }, - { AV_CODEC_ID_VP3, MKTAG('V', 'P', '3', '0') }, - { AV_CODEC_ID_VP5, MKTAG('V', 'P', '5', '0') }, - { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '0') }, - { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '1') }, - { AV_CODEC_ID_VP6, MKTAG('V', 'P', '6', '2') }, - { AV_CODEC_ID_VP6A, MKTAG('V', 'P', '6', 'A') }, - { AV_CODEC_ID_VP6F, MKTAG('V', 'P', '6', 'F') }, - { AV_CODEC_ID_VP6F, MKTAG('F', 'L', 'V', '4') }, - { AV_CODEC_ID_VP8, MKTAG('V', 'P', '8', '0') }, - { AV_CODEC_ID_VP9, MKTAG('V', 'P', '9', '0') }, - { AV_CODEC_ID_ASV1, MKTAG('A', 'S', 'V', '1') }, - { AV_CODEC_ID_ASV2, MKTAG('A', 'S', 'V', '2') }, - { AV_CODEC_ID_VCR1, MKTAG('V', 'C', 'R', '1') }, - { AV_CODEC_ID_FFV1, MKTAG('F', 'F', 'V', '1') }, - { AV_CODEC_ID_XAN_WC4, MKTAG('X', 'x', 'a', 'n') }, - { AV_CODEC_ID_MIMIC, MKTAG('L', 'M', '2', '0') }, - { AV_CODEC_ID_MSRLE, MKTAG('m', 'r', 'l', 'e') }, - { AV_CODEC_ID_MSRLE, MKTAG( 1 , 0 , 0 , 0 ) }, - { AV_CODEC_ID_MSRLE, MKTAG( 2 , 0 , 0 , 0 ) }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('M', 'S', 'V', 'C') }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('m', 's', 'v', 'c') }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('C', 'R', 'A', 'M') }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('c', 'r', 'a', 'm') }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('W', 'H', 'A', 'M') }, - { AV_CODEC_ID_MSVIDEO1, MKTAG('w', 'h', 'a', 'm') }, - { AV_CODEC_ID_CINEPAK, MKTAG('c', 'v', 'i', 'd') }, - { AV_CODEC_ID_TRUEMOTION1, MKTAG('D', 'U', 'C', 'K') }, - { AV_CODEC_ID_TRUEMOTION1, MKTAG('P', 'V', 'E', 'Z') }, - { AV_CODEC_ID_MSZH, MKTAG('M', 'S', 'Z', 'H') }, - { AV_CODEC_ID_ZLIB, MKTAG('Z', 'L', 'I', 'B') }, - { AV_CODEC_ID_SNOW, MKTAG('S', 'N', 'O', 'W') }, - { AV_CODEC_ID_4XM, MKTAG('4', 'X', 'M', 'V') }, - { AV_CODEC_ID_FLV1, MKTAG('F', 'L', 'V', '1') }, - { AV_CODEC_ID_FLV1, MKTAG('S', '2', '6', '3') }, - { AV_CODEC_ID_FLASHSV, MKTAG('F', 'S', 'V', '1') }, - { AV_CODEC_ID_SVQ1, MKTAG('s', 'v', 'q', '1') }, - { AV_CODEC_ID_TSCC, MKTAG('t', 's', 'c', 'c') }, - { AV_CODEC_ID_ULTI, MKTAG('U', 'L', 'T', 'I') }, - { AV_CODEC_ID_VIXL, MKTAG('V', 'I', 'X', 'L') }, - { AV_CODEC_ID_QPEG, MKTAG('Q', 'P', 'E', 'G') }, - { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '0') }, - { AV_CODEC_ID_QPEG, MKTAG('Q', '1', '.', '1') }, - { AV_CODEC_ID_WMV3, MKTAG('W', 'M', 'V', '3') }, - { AV_CODEC_ID_WMV3IMAGE, MKTAG('W', 'M', 'V', 'P') }, - { AV_CODEC_ID_VC1, MKTAG('W', 'V', 'C', '1') }, - { AV_CODEC_ID_VC1, MKTAG('W', 'M', 'V', 'A') }, - { AV_CODEC_ID_VC1IMAGE, MKTAG('W', 'V', 'P', '2') }, - { AV_CODEC_ID_LOCO, MKTAG('L', 'O', 'C', 'O') }, - { AV_CODEC_ID_WNV1, MKTAG('W', 'N', 'V', '1') }, - { AV_CODEC_ID_WNV1, MKTAG('Y', 'U', 'V', '8') }, - { AV_CODEC_ID_AASC, MKTAG('A', 'A', 'S', '4') }, - { AV_CODEC_ID_AASC, MKTAG('A', 'A', 'S', 'C') }, - { AV_CODEC_ID_INDEO2, MKTAG('R', 'T', '2', '1') }, - { AV_CODEC_ID_FRAPS, MKTAG('F', 'P', 'S', '1') }, - { AV_CODEC_ID_THEORA, MKTAG('t', 'h', 'e', 'o') }, - { AV_CODEC_ID_TRUEMOTION2, MKTAG('T', 'M', '2', '0') }, - { AV_CODEC_ID_CSCD, MKTAG('C', 'S', 'C', 'D') }, - { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') }, - { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') }, - { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') }, - { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') }, - { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') }, - { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') }, - { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'K') }, - { AV_CODEC_ID_JPEG2000, MKTAG('I', 'P', 'J', '2') }, - { AV_CODEC_ID_VMNC, MKTAG('V', 'M', 'n', 'c') }, - { AV_CODEC_ID_TARGA, MKTAG('t', 'g', 'a', ' ') }, - { AV_CODEC_ID_PNG, MKTAG('M', 'P', 'N', 'G') }, - { AV_CODEC_ID_PNG, MKTAG('P', 'N', 'G', '1') }, - { AV_CODEC_ID_CLJR, MKTAG('C', 'L', 'J', 'R') }, - { AV_CODEC_ID_DIRAC, MKTAG('d', 'r', 'a', 'c') }, - { AV_CODEC_ID_RPZA, MKTAG('a', 'z', 'p', 'r') }, - { AV_CODEC_ID_RPZA, MKTAG('R', 'P', 'Z', 'A') }, - { AV_CODEC_ID_RPZA, MKTAG('r', 'p', 'z', 'a') }, - { AV_CODEC_ID_SP5X, MKTAG('S', 'P', '5', '4') }, - { AV_CODEC_ID_AURA, MKTAG('A', 'U', 'R', 'A') }, - { AV_CODEC_ID_AURA2, MKTAG('A', 'U', 'R', '2') }, - { AV_CODEC_ID_DPX, MKTAG('d', 'p', 'x', ' ') }, - { AV_CODEC_ID_KGV1, MKTAG('K', 'G', 'V', '1') }, - { AV_CODEC_ID_LAGARITH, MKTAG('L', 'A', 'G', 'S') }, - { AV_CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'F') }, - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'A') }, - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'R', 'G') }, - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '0') }, - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'Y', '2') }, - /* Ut Video version 13.0.1 BT.709 codecs */ - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'H', '0') }, - { AV_CODEC_ID_UTVIDEO, MKTAG('U', 'L', 'H', '2') }, - { AV_CODEC_ID_VBLE, MKTAG('V', 'B', 'L', 'E') }, - { AV_CODEC_ID_ESCAPE130, MKTAG('E', '1', '3', '0') }, - { AV_CODEC_ID_DXTORY, MKTAG('x', 't', 'o', 'r') }, - { AV_CODEC_ID_ZEROCODEC, MKTAG('Z', 'E', 'C', 'O') }, - { AV_CODEC_ID_Y41P, MKTAG('Y', '4', '1', 'P') }, - { AV_CODEC_ID_FLIC, MKTAG('A', 'F', 'L', 'C') }, - { AV_CODEC_ID_MSS1, MKTAG('M', 'S', 'S', '1') }, - { AV_CODEC_ID_MSA1, MKTAG('M', 'S', 'A', '1') }, - { AV_CODEC_ID_TSCC2, MKTAG('T', 'S', 'C', '2') }, - { AV_CODEC_ID_MTS2, MKTAG('M', 'T', 'S', '2') }, - { AV_CODEC_ID_CLLC, MKTAG('C', 'L', 'L', 'C') }, - { AV_CODEC_ID_MSS2, MKTAG('M', 'S', 'S', '2') }, - { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3') }, - { AV_CODEC_ID_012V, MKTAG('0', '1', '2', 'v') }, - { AV_CODEC_ID_012V, MKTAG('a', '1', '2', 'v') }, - { AV_CODEC_ID_G2M, MKTAG('G', '2', 'M', '2') }, - { AV_CODEC_ID_G2M, MKTAG('G', '2', 'M', '3') }, - { AV_CODEC_ID_G2M, MKTAG('G', '2', 'M', '4') }, - { AV_CODEC_ID_FIC, MKTAG('F', 'I', 'C', 'V') }, - { AV_CODEC_ID_NONE, 0 } -}; - -const AVCodecTag ff_codec_wav_tags[] = { - { AV_CODEC_ID_PCM_S16LE, 0x0001 }, - /* must come after s16le in this list */ - { AV_CODEC_ID_PCM_U8, 0x0001 }, - { AV_CODEC_ID_PCM_S24LE, 0x0001 }, - { AV_CODEC_ID_PCM_S32LE, 0x0001 }, - { AV_CODEC_ID_ADPCM_MS, 0x0002 }, - { AV_CODEC_ID_PCM_F32LE, 0x0003 }, - /* must come after f32le in this list */ - { AV_CODEC_ID_PCM_F64LE, 0x0003 }, - { AV_CODEC_ID_PCM_ALAW, 0x0006 }, - { AV_CODEC_ID_PCM_MULAW, 0x0007 }, - { AV_CODEC_ID_WMAVOICE, 0x000A }, - { AV_CODEC_ID_ADPCM_IMA_OKI, 0x0010 }, - { AV_CODEC_ID_ADPCM_IMA_WAV, 0x0011 }, - /* must come after adpcm_ima_wav in this list */ - { AV_CODEC_ID_PCM_ZORK, 0x0011 }, - { AV_CODEC_ID_ADPCM_IMA_OKI, 0x0017 }, - { AV_CODEC_ID_ADPCM_YAMAHA, 0x0020 }, - { AV_CODEC_ID_TRUESPEECH, 0x0022 }, - { AV_CODEC_ID_GSM_MS, 0x0031 }, - { AV_CODEC_ID_GSM_MS, 0x0032 }, /* msn audio */ - { AV_CODEC_ID_AMR_NB, 0x0038 }, /* rogue format number */ - { AV_CODEC_ID_G723_1, 0x0042 }, - { AV_CODEC_ID_ADPCM_G726, 0x0045 }, - { AV_CODEC_ID_MP2, 0x0050 }, - { AV_CODEC_ID_MP3, 0x0055 }, - { AV_CODEC_ID_AMR_NB, 0x0057 }, - { AV_CODEC_ID_AMR_WB, 0x0058 }, - /* rogue format number */ - { AV_CODEC_ID_ADPCM_IMA_DK4, 0x0061 }, - /* rogue format number */ - { AV_CODEC_ID_ADPCM_IMA_DK3, 0x0062 }, - { AV_CODEC_ID_ADPCM_G726, 0x0064 }, - { AV_CODEC_ID_ADPCM_IMA_WAV, 0x0069 }, - { AV_CODEC_ID_METASOUND, 0x0075 }, - { AV_CODEC_ID_AAC, 0x00ff }, - { AV_CODEC_ID_G723_1, 0x0111 }, - { AV_CODEC_ID_SIPR, 0x0130 }, - { AV_CODEC_ID_WMAV1, 0x0160 }, - { AV_CODEC_ID_WMAV2, 0x0161 }, - { AV_CODEC_ID_WMAPRO, 0x0162 }, - { AV_CODEC_ID_WMALOSSLESS, 0x0163 }, - { AV_CODEC_ID_ADPCM_CT, 0x0200 }, - { AV_CODEC_ID_ATRAC3, 0x0270 }, - { AV_CODEC_ID_ADPCM_G722, 0x028F }, - { AV_CODEC_ID_IMC, 0x0401 }, - { AV_CODEC_ID_IAC, 0x0402 }, - { AV_CODEC_ID_GSM_MS, 0x1500 }, - { AV_CODEC_ID_TRUESPEECH, 0x1501 }, - /* ADTS AAC */ - { AV_CODEC_ID_AAC, 0x1600 }, - { AV_CODEC_ID_AAC_LATM, 0x1602 }, - { AV_CODEC_ID_AC3, 0x2000 }, - /* There is no Microsoft Format Tag for E-AC3, the GUID has to be used */ - { AV_CODEC_ID_EAC3, 0x2000 }, - { AV_CODEC_ID_DTS, 0x2001 }, - { AV_CODEC_ID_SONIC, 0x2048 }, - { AV_CODEC_ID_SONIC_LS, 0x2048 }, - { AV_CODEC_ID_PCM_MULAW, 0x6c75 }, - { AV_CODEC_ID_AAC, 0x706d }, - { AV_CODEC_ID_AAC, 0x4143 }, - { AV_CODEC_ID_XAN_DPCM, 0x594a }, - { AV_CODEC_ID_G723_1, 0xA100 }, - { AV_CODEC_ID_AAC, 0xA106 }, - { AV_CODEC_ID_SPEEX, 0xA109 }, - { AV_CODEC_ID_FLAC, 0xF1AC }, - { AV_CODEC_ID_ADPCM_SWF, ('S' << 8) + 'F' }, - /* HACK/FIXME: Does Vorbis in WAV/AVI have an (in)official ID? */ - { AV_CODEC_ID_VORBIS, ('V' << 8) + 'o' }, - { AV_CODEC_ID_NONE, 0 }, -}; - -const AVMetadataConv ff_riff_info_conv[] = { - { "IART", "artist" }, - { "ICMT", "comment" }, - { "ICOP", "copyright" }, - { "ICRD", "date" }, - { "IGNR", "genre" }, - { "ILNG", "language" }, - { "INAM", "title" }, - { "IPRD", "album" }, - { "IPRT", "track" }, - { "ITRK", "track" }, - { "ISFT", "encoder" }, - { "ISMP", "timecode" }, - { "ITCH", "encoded_by" }, - { 0 }, -}; - -const struct AVCodecTag *avformat_get_riff_video_tags(void) -{ - return ff_codec_bmp_tags; -} - -const struct AVCodecTag *avformat_get_riff_audio_tags(void) -{ - return ff_codec_wav_tags; -} - -const AVCodecGuid ff_codec_wav_guids[] = { - { AV_CODEC_ID_AC3, { 0x2C, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, - { AV_CODEC_ID_ATRAC3P, { 0xBF, 0xAA, 0x23, 0xE9, 0x58, 0xCB, 0x71, 0x44, 0xA1, 0x19, 0xFF, 0xFA, 0x01, 0xE4, 0xCE, 0x62 } }, - { AV_CODEC_ID_EAC3, { 0xAF, 0x87, 0xFB, 0xA7, 0x02, 0x2D, 0xFB, 0x42, 0xA4, 0xD4, 0x05, 0xCD, 0x93, 0x84, 0x3B, 0xDD } }, - { AV_CODEC_ID_MP2, { 0x2B, 0x80, 0x6D, 0xE0, 0x46, 0xDB, 0xCF, 0x11, 0xB4, 0xD1, 0x00, 0x80, 0x5F, 0x6C, 0xBB, 0xEA } }, - { AV_CODEC_ID_NONE } -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.h deleted file mode 100644 index dba38034e..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riff.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * RIFF common functions and data - * copyright (c) 2000 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * internal header for RIFF based (de)muxers - * do NOT include this in end user applications - */ - -#ifndef AVFORMAT_RIFF_H -#define AVFORMAT_RIFF_H - -#include "libavcodec/avcodec.h" -#include "avio.h" -#include "internal.h" -#include "metadata.h" - -extern const AVMetadataConv ff_riff_info_conv[]; - -int64_t ff_start_tag(AVIOContext *pb, const char *tag); -void ff_end_tag(AVIOContext *pb, int64_t start); - -/** - * Read BITMAPINFOHEADER structure and set AVStream codec width, height and - * bits_per_encoded_sample fields. Does not read extradata. - * @return codec tag - */ -int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize); - -void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc, const AVCodecTag *tags, int for_asf, int ignore_extradata); -int ff_put_wav_header(AVIOContext *pb, AVCodecContext *enc); -enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps); -int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size); - -extern const AVCodecTag ff_codec_bmp_tags[]; // exposed through avformat_get_riff_video_tags() -extern const AVCodecTag ff_codec_wav_tags[]; - -void ff_parse_specific_params(AVCodecContext *stream, int *au_rate, int *au_ssize, int *au_scale); - -int ff_read_riff_info(AVFormatContext *s, int64_t size); - -/** - * Write all recognized RIFF tags from s->metadata - */ -void ff_riff_write_info(AVFormatContext *s); - -/** - * Write a single RIFF info tag - */ -void ff_riff_write_info_tag(AVIOContext *pb, const char *tag, const char *str); - -typedef uint8_t ff_asf_guid[16]; - -typedef struct AVCodecGuid { - enum AVCodecID id; - ff_asf_guid guid; -} AVCodecGuid; - -extern const AVCodecGuid ff_codec_wav_guids[]; - -#define FF_PRI_GUID \ - "%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x" - -#define FF_ARG_GUID(g) \ - g[0], g[1], g[2], g[3], g[4], g[5], g[6], g[7], \ - g[8], g[9], g[10], g[11], g[12], g[13], g[14], g[15] - -#define FF_MEDIASUBTYPE_BASE_GUID \ - 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71 - -static av_always_inline int ff_guidcmp(const void *g1, const void *g2) -{ - return memcmp(g1, g2, sizeof(ff_asf_guid)); -} - -int ff_get_guid(AVIOContext *s, ff_asf_guid *g); -void ff_put_guid(AVIOContext *s, const ff_asf_guid *g); -const ff_asf_guid *get_codec_guid(enum AVCodecID id, const AVCodecGuid *av_guid); - -enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid); - -#endif /* AVFORMAT_RIFF_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riffdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riffdec.c deleted file mode 100644 index c3dd371d1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/riffdec.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * RIFF demuxing functions and data - * Copyright (c) 2000 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/dict.h" -#include "libavutil/error.h" -#include "libavutil/log.h" -#include "libavutil/mathematics.h" -#include "libavcodec/avcodec.h" -#include "libavcodec/bytestream.h" -#include "avformat.h" -#include "avio_internal.h" -#include "riff.h" - -int ff_get_guid(AVIOContext *s, ff_asf_guid *g) -{ - av_assert0(sizeof(*g) == 16); //compiler will optimize this out - if (avio_read(s, *g, sizeof(*g)) < (int)sizeof(*g)) { - memset(*g, 0, sizeof(*g)); - return AVERROR_INVALIDDATA; - } - return 0; -} - -enum AVCodecID ff_codec_guid_get_id(const AVCodecGuid *guids, ff_asf_guid guid) -{ - int i; - for (i = 0; guids[i].id != AV_CODEC_ID_NONE; i++) - if (!ff_guidcmp(guids[i].guid, guid)) - return guids[i].id; - return AV_CODEC_ID_NONE; -} - -/* We could be given one of the three possible structures here: - * WAVEFORMAT, PCMWAVEFORMAT or WAVEFORMATEX. Each structure - * is an expansion of the previous one with the fields added - * at the bottom. PCMWAVEFORMAT adds 'WORD wBitsPerSample' and - * WAVEFORMATEX adds 'WORD cbSize' and basically makes itself - * an openended structure. - */ - -static void parse_waveformatex(AVIOContext *pb, AVCodecContext *c) -{ - ff_asf_guid subformat; - int bps = avio_rl16(pb); - if (bps) - c->bits_per_coded_sample = bps; - - c->channel_layout = avio_rl32(pb); /* dwChannelMask */ - - ff_get_guid(pb, &subformat); - if (!memcmp(subformat + 4, - (const uint8_t[]){ FF_MEDIASUBTYPE_BASE_GUID }, 12)) { - c->codec_tag = AV_RL32(subformat); - c->codec_id = ff_wav_codec_get_id(c->codec_tag, - c->bits_per_coded_sample); - } else { - c->codec_id = ff_codec_guid_get_id(ff_codec_wav_guids, subformat); - if (!c->codec_id) - av_log(c, AV_LOG_WARNING, - "unknown subformat:"FF_PRI_GUID"\n", - FF_ARG_GUID(subformat)); - } -} - -int ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) -{ - int id; - - id = avio_rl16(pb); - codec->codec_type = AVMEDIA_TYPE_AUDIO; - codec->channels = avio_rl16(pb); - codec->sample_rate = avio_rl32(pb); - codec->bit_rate = avio_rl32(pb) * 8; - codec->block_align = avio_rl16(pb); - if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ - codec->bits_per_coded_sample = 8; - } else - codec->bits_per_coded_sample = avio_rl16(pb); - if (id == 0xFFFE) { - codec->codec_tag = 0; - } else { - codec->codec_tag = id; - codec->codec_id = ff_wav_codec_get_id(id, - codec->bits_per_coded_sample); - } - if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ - int cbSize = avio_rl16(pb); /* cbSize */ - size -= 18; - cbSize = FFMIN(size, cbSize); - if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */ - parse_waveformatex(pb, codec); - cbSize -= 22; - size -= 22; - } - if (cbSize > 0) { - av_free(codec->extradata); - if (ff_get_extradata(codec, pb, cbSize) < 0) - return AVERROR(ENOMEM); - size -= cbSize; - } - - /* It is possible for the chunk to contain garbage at the end */ - if (size > 0) - avio_skip(pb, size); - } - if (codec->sample_rate <= 0) { - av_log(NULL, AV_LOG_ERROR, - "Invalid sample rate: %d\n", codec->sample_rate); - return AVERROR_INVALIDDATA; - } - if (codec->codec_id == AV_CODEC_ID_AAC_LATM) { - /* Channels and sample_rate values are those prior to applying SBR - * and/or PS. */ - codec->channels = 0; - codec->sample_rate = 0; - } - /* override bits_per_coded_sample for G.726 */ - if (codec->codec_id == AV_CODEC_ID_ADPCM_G726 && codec->sample_rate) - codec->bits_per_coded_sample = codec->bit_rate / codec->sample_rate; - - return 0; -} - -enum AVCodecID ff_wav_codec_get_id(unsigned int tag, int bps) -{ - enum AVCodecID id; - id = ff_codec_get_id(ff_codec_wav_tags, tag); - if (id <= 0) - return id; - - if (id == AV_CODEC_ID_PCM_S16LE) - id = ff_get_pcm_codec_id(bps, 0, 0, ~1); - else if (id == AV_CODEC_ID_PCM_F32LE) - id = ff_get_pcm_codec_id(bps, 1, 0, 0); - - if (id == AV_CODEC_ID_ADPCM_IMA_WAV && bps == 8) - id = AV_CODEC_ID_PCM_ZORK; - return id; -} - -int ff_get_bmp_header(AVIOContext *pb, AVStream *st, unsigned *esize) -{ - int tag1; - if(esize) *esize = avio_rl32(pb); - else avio_rl32(pb); - st->codec->width = avio_rl32(pb); - st->codec->height = (int32_t)avio_rl32(pb); - avio_rl16(pb); /* planes */ - st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ - tag1 = avio_rl32(pb); - avio_rl32(pb); /* ImageSize */ - avio_rl32(pb); /* XPelsPerMeter */ - avio_rl32(pb); /* YPelsPerMeter */ - avio_rl32(pb); /* ClrUsed */ - avio_rl32(pb); /* ClrImportant */ - return tag1; -} - -int ff_read_riff_info(AVFormatContext *s, int64_t size) -{ - int64_t start, end, cur; - AVIOContext *pb = s->pb; - - start = avio_tell(pb); - end = start + size; - - while ((cur = avio_tell(pb)) >= 0 && - cur <= end - 8 /* = tag + size */) { - uint32_t chunk_code; - int64_t chunk_size; - char key[5] = { 0 }; - char *value; - - chunk_code = avio_rl32(pb); - chunk_size = avio_rl32(pb); - if (url_feof(pb)) { - if (chunk_code || chunk_size) { - av_log(s, AV_LOG_WARNING, "INFO subchunk truncated\n"); - return AVERROR_INVALIDDATA; - } - return AVERROR_EOF; - } - if (chunk_size > end || - end - chunk_size < cur || - chunk_size == UINT_MAX) { - avio_seek(pb, -9, SEEK_CUR); - chunk_code = avio_rl32(pb); - chunk_size = avio_rl32(pb); - if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) { - av_log(s, AV_LOG_WARNING, "too big INFO subchunk\n"); - return AVERROR_INVALIDDATA; - } - } - - chunk_size += (chunk_size & 1); - - if (!chunk_code) { - if (chunk_size) - avio_skip(pb, chunk_size); - else if (pb->eof_reached) { - av_log(s, AV_LOG_WARNING, "truncated file\n"); - return AVERROR_EOF; - } - continue; - } - - value = av_mallocz(chunk_size + 1); - if (!value) { - av_log(s, AV_LOG_ERROR, - "out of memory, unable to read INFO tag\n"); - return AVERROR(ENOMEM); - } - - AV_WL32(key, chunk_code); - - if (avio_read(pb, (unsigned char *)value, chunk_size) != chunk_size) { - av_log(s, AV_LOG_WARNING, - "premature end of file while reading INFO tag\n"); - } - - av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL); - } - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtp.h deleted file mode 100644 index 66a4f3afb..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtp.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * RTP definitions - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#ifndef AVFORMAT_RTP_H -#define AVFORMAT_RTP_H - -#include "libavformat/avformat.h" -#include "libavcodec/avcodec.h" -#include "libavutil/mathematics.h" - -/** - * Return the payload type for a given stream used in the given format context. - * Static payload types are derived from the codec. - * Dynamic payload type are derived from the id field in AVStream. - * The format context private option payload_type overrides both. - * - * @param fmt The context of the format - * @param codec The context of the codec - * @param idx The stream index - * @return The payload type (the 'PT' field in the RTP header). - */ -int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec, - int idx); - -/** - * Initialize a codec context based on the payload type. - * - * Fill the codec_type and codec_id fields of a codec context with - * information depending on the payload type; for audio codecs, the - * channels and sample_rate fields are also filled. - * - * @param codec The context of the codec - * @param payload_type The payload type (the 'PT' field in the RTP header) - * @return In case of unknown payload type or dynamic payload type, a - * negative value is returned; otherwise, 0 is returned - */ -int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type); - -/** - * Return the encoding name (as defined in - * http://www.iana.org/assignments/rtp-parameters) for a given payload type. - * - * @param payload_type The payload type (the 'PT' field in the RTP header) - * @return In case of unknown payload type or dynamic payload type, a pointer - * to an empty string is returned; otherwise, a pointer to a string containing - * the encoding name is returned - */ -const char *ff_rtp_enc_name(int payload_type); - -/** - * Return the codec id for the given encoding name and codec type. - * - * @param buf A pointer to the string containing the encoding name - * @param codec_type The codec type - * @return In case of unknown encoding name, AV_CODEC_ID_NONE is returned; - * otherwise, the codec id is returned - */ -enum AVCodecID ff_rtp_codec_id(const char *buf, enum AVMediaType codec_type); - -#define RTP_PT_PRIVATE 96 -#define RTP_VERSION 2 -#define RTP_MAX_SDES 256 /**< maximum text length for SDES */ - -/* RTCP packets use 0.5% of the bandwidth */ -#define RTCP_TX_RATIO_NUM 5 -#define RTCP_TX_RATIO_DEN 1000 - -/* An arbitrary id value for RTP Xiph streams - only relevant to indicate - * that the configuration has changed within a stream (by changing the - * ident value sent). - */ -#define RTP_XIPH_IDENT 0xfecdba - -/* RTCP packet types */ -enum RTCPType { - RTCP_FIR = 192, - RTCP_NACK, // 193 - RTCP_SMPTETC,// 194 - RTCP_IJ, // 195 - RTCP_SR = 200, - RTCP_RR, // 201 - RTCP_SDES, // 202 - RTCP_BYE, // 203 - RTCP_APP, // 204 - RTCP_RTPFB,// 205 - RTCP_PSFB, // 206 - RTCP_XR, // 207 - RTCP_AVB, // 208 - RTCP_RSI, // 209 - RTCP_TOKEN,// 210 -}; - -#define RTP_PT_IS_RTCP(x) (((x) >= RTCP_FIR && (x) <= RTCP_IJ) || \ - ((x) >= RTCP_SR && (x) <= RTCP_TOKEN)) - -#define NTP_TO_RTP_FORMAT(x) av_rescale((x), INT64_C(1) << 32, 1000000) - -#endif /* AVFORMAT_RTP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtpdec.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtpdec.h deleted file mode 100644 index 2a191ec76..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/rtpdec.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * RTP demuxer definitions - * Copyright (c) 2002 Fabrice Bellard - * Copyright (c) 2006 Ryan Martell - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_RTPDEC_H -#define AVFORMAT_RTPDEC_H - -#include "libavcodec/avcodec.h" -#include "avformat.h" -#include "rtp.h" -#include "url.h" -#include "srtp.h" - -typedef struct PayloadContext PayloadContext; -typedef struct RTPDynamicProtocolHandler RTPDynamicProtocolHandler; - -#define RTP_MIN_PACKET_LENGTH 12 -#define RTP_MAX_PACKET_LENGTH 8192 - -#define RTP_REORDER_QUEUE_DEFAULT_SIZE 10 - -#define RTP_NOTS_VALUE ((uint32_t)-1) - -typedef struct RTPDemuxContext RTPDemuxContext; -RTPDemuxContext *ff_rtp_parse_open(AVFormatContext *s1, AVStream *st, - int payload_type, int queue_size); -void ff_rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx, - RTPDynamicProtocolHandler *handler); -void ff_rtp_parse_set_crypto(RTPDemuxContext *s, const char *suite, - const char *params); -int ff_rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, - uint8_t **buf, int len); -void ff_rtp_parse_close(RTPDemuxContext *s); -int64_t ff_rtp_queued_packet_time(RTPDemuxContext *s); -void ff_rtp_reset_packet_queue(RTPDemuxContext *s); - -/** - * Send a dummy packet on both port pairs to set up the connection - * state in potential NAT routers, so that we're able to receive - * packets. - * - * Note, this only works if the NAT router doesn't remap ports. This - * isn't a standardized procedure, but it works in many cases in practice. - * - * The same routine is used with RDT too, even if RDT doesn't use normal - * RTP packets otherwise. - */ -void ff_rtp_send_punch_packets(URLContext* rtp_handle); - -/** - * some rtp servers assume client is dead if they don't hear from them... - * so we send a Receiver Report to the provided URLContext or AVIOContext - * (we don't have access to the rtcp handle from here) - */ -int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, URLContext *fd, - AVIOContext *avio, int count); -int ff_rtp_send_rtcp_feedback(RTPDemuxContext *s, URLContext *fd, - AVIOContext *avio); - -// these statistics are used for rtcp receiver reports... -typedef struct RTPStatistics { - uint16_t max_seq; ///< highest sequence number seen - uint32_t cycles; ///< shifted count of sequence number cycles - uint32_t base_seq; ///< base sequence number - uint32_t bad_seq; ///< last bad sequence number + 1 - int probation; ///< sequence packets till source is valid - uint32_t received; ///< packets received - uint32_t expected_prior; ///< packets expected in last interval - uint32_t received_prior; ///< packets received in last interval - uint32_t transit; ///< relative transit time for previous packet - uint32_t jitter; ///< estimated jitter. -} RTPStatistics; - -#define RTP_FLAG_KEY 0x1 ///< RTP packet contains a keyframe -#define RTP_FLAG_MARKER 0x2 ///< RTP marker bit was set for this packet -/** - * Packet parsing for "private" payloads in the RTP specs. - * - * @param ctx RTSP demuxer context - * @param s stream context - * @param st stream that this packet belongs to - * @param pkt packet in which to write the parsed data - * @param timestamp pointer to the RTP timestamp of the input data, can be - * updated by the function if returning older, buffered data - * @param buf pointer to raw RTP packet data - * @param len length of buf - * @param seq RTP sequence number of the packet - * @param flags flags from the RTP packet header (RTP_FLAG_*) - */ -typedef int (*DynamicPayloadPacketHandlerProc)(AVFormatContext *ctx, - PayloadContext *s, - AVStream *st, AVPacket *pkt, - uint32_t *timestamp, - const uint8_t * buf, - int len, uint16_t seq, int flags); - -struct RTPDynamicProtocolHandler { - const char enc_name[50]; - enum AVMediaType codec_type; - enum AVCodecID codec_id; - int static_payload_id; /* 0 means no payload id is set. 0 is a valid - * payload ID (PCMU), too, but that format doesn't - * require any custom depacketization code. */ - - /** Initialize dynamic protocol handler, called after the full rtpmap line is parsed, may be null */ - int (*init)(AVFormatContext *s, int st_index, PayloadContext *priv_data); - /** Parse the a= line from the sdp field */ - int (*parse_sdp_a_line)(AVFormatContext *s, int st_index, - PayloadContext *priv_data, const char *line); - /** Allocate any data needed by the rtp parsing for this dynamic data. */ - PayloadContext *(*alloc)(void); - /** Free any data needed by the rtp parsing for this dynamic data. */ - void (*free)(PayloadContext *protocol_data); - /** Parse handler for this dynamic packet */ - DynamicPayloadPacketHandlerProc parse_packet; - int (*need_keyframe)(PayloadContext *context); - - struct RTPDynamicProtocolHandler *next; -}; - -typedef struct RTPPacket { - uint16_t seq; - uint8_t *buf; - int len; - int64_t recvtime; - struct RTPPacket *next; -} RTPPacket; - -struct RTPDemuxContext { - AVFormatContext *ic; - AVStream *st; - int payload_type; - uint32_t ssrc; - uint16_t seq; - uint32_t timestamp; - uint32_t base_timestamp; - uint32_t cur_timestamp; - int64_t unwrapped_timestamp; - int64_t range_start_offset; - int max_payload_size; - /* used to send back RTCP RR */ - char hostname[256]; - - int srtp_enabled; - struct SRTPContext srtp; - - /** Statistics for this stream (used by RTCP receiver reports) */ - RTPStatistics statistics; - - /** Fields for packet reordering @{ */ - int prev_ret; ///< The return value of the actual parsing of the previous packet - RTPPacket* queue; ///< A sorted queue of buffered packets not yet returned - int queue_len; ///< The number of packets in queue - int queue_size; ///< The size of queue, or 0 if reordering is disabled - /*@}*/ - - /* rtcp sender statistics receive */ - int64_t last_rtcp_ntp_time; - int64_t last_rtcp_reception_time; - int64_t first_rtcp_ntp_time; - uint32_t last_rtcp_timestamp; - int64_t rtcp_ts_offset; - - /* rtcp sender statistics */ - unsigned int packet_count; - unsigned int octet_count; - unsigned int last_octet_count; - int64_t last_feedback_time; - - /* dynamic payload stuff */ - const RTPDynamicProtocolHandler *handler; - PayloadContext *dynamic_protocol_context; -}; - -void ff_register_dynamic_payload_handler(RTPDynamicProtocolHandler *handler); -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_name(const char *name, - enum AVMediaType codec_type); -RTPDynamicProtocolHandler *ff_rtp_handler_find_by_id(int id, - enum AVMediaType codec_type); - -/* from rtsp.c, but used by rtp dynamic protocol handlers. */ -int ff_rtsp_next_attr_and_value(const char **p, char *attr, int attr_size, - char *value, int value_size); - -int ff_parse_fmtp(AVStream *stream, PayloadContext *data, const char *p, - int (*parse_fmtp)(AVStream *stream, - PayloadContext *data, - char *attr, char *value)); - -void av_register_rtp_dynamic_payload_handlers(void); - -/** - * Close the dynamic buffer and make a packet from it. - */ -int ff_rtp_finalize_packet(AVPacket *pkt, AVIOContext **dyn_buf, int stream_idx); - -#endif /* AVFORMAT_RTPDEC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.c deleted file mode 100644 index 604141a26..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * IEC 61937 common code - * Copyright (c) 2009 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "spdif.h" -#include "libavutil/bswap.h" - -//TODO move to DSP -void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w) -{ - int i; - - for (i = 0; i + 8 <= w; i += 8) { - dst[i + 0] = av_bswap16(src[i + 0]); - dst[i + 1] = av_bswap16(src[i + 1]); - dst[i + 2] = av_bswap16(src[i + 2]); - dst[i + 3] = av_bswap16(src[i + 3]); - dst[i + 4] = av_bswap16(src[i + 4]); - dst[i + 5] = av_bswap16(src[i + 5]); - dst[i + 6] = av_bswap16(src[i + 6]); - dst[i + 7] = av_bswap16(src[i + 7]); - } - for (; i < w; i++) - dst[i + 0] = av_bswap16(src[i + 0]); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.h deleted file mode 100644 index fee4ff710..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdif.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * IEC 61937 common header - * Copyright (c) 2009 Bartlomiej Wolowiec - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_SPDIF_H -#define AVFORMAT_SPDIF_H - -#include -#include "avformat.h" - -#define SYNCWORD1 0xF872 -#define SYNCWORD2 0x4E1F -#define BURST_HEADER_SIZE 0x8 - -enum IEC61937DataType { - IEC61937_AC3 = 0x01, ///< AC-3 data - IEC61937_MPEG1_LAYER1 = 0x04, ///< MPEG-1 layer 1 - IEC61937_MPEG1_LAYER23 = 0x05, ///< MPEG-1 layer 2 or 3 data or MPEG-2 without extension - IEC61937_MPEG2_EXT = 0x06, ///< MPEG-2 data with extension - IEC61937_MPEG2_AAC = 0x07, ///< MPEG-2 AAC ADTS - IEC61937_MPEG2_LAYER1_LSF = 0x08, ///< MPEG-2, layer-1 low sampling frequency - IEC61937_MPEG2_LAYER2_LSF = 0x09, ///< MPEG-2, layer-2 low sampling frequency - IEC61937_MPEG2_LAYER3_LSF = 0x0A, ///< MPEG-2, layer-3 low sampling frequency - IEC61937_DTS1 = 0x0B, ///< DTS type I (512 samples) - IEC61937_DTS2 = 0x0C, ///< DTS type II (1024 samples) - IEC61937_DTS3 = 0x0D, ///< DTS type III (2048 samples) - IEC61937_ATRAC = 0x0E, ///< ATRAC data - IEC61937_ATRAC3 = 0x0F, ///< ATRAC3 data - IEC61937_ATRACX = 0x10, ///< ATRAC3+ data - IEC61937_DTSHD = 0x11, ///< DTS HD data - IEC61937_WMAPRO = 0x12, ///< WMA 9 Professional data - IEC61937_MPEG2_AAC_LSF_2048 = 0x13, ///< MPEG-2 AAC ADTS half-rate low sampling frequency - IEC61937_MPEG2_AAC_LSF_4096 = 0x13 | 0x20, ///< MPEG-2 AAC ADTS quarter-rate low sampling frequency - IEC61937_EAC3 = 0x15, ///< E-AC-3 data - IEC61937_TRUEHD = 0x16, ///< TrueHD data -}; - -static const uint16_t spdif_mpeg_pkt_offset[2][3] = { - //LAYER1 LAYER2 LAYER3 - { 3072, 9216, 4608 }, // MPEG2 LSF - { 1536, 4608, 4608 }, // MPEG1 -}; - -void ff_spdif_bswap_buf16(uint16_t *dst, const uint16_t *src, int w); -int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt); -int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec); - -#endif /* AVFORMAT_SPDIF_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdifdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdifdec.c deleted file mode 100644 index 7da16c95b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/spdifdec.c +++ /dev/null @@ -1,240 +0,0 @@ -/* - * IEC 61937 demuxer - * Copyright (c) 2010 Anssi Hannula - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * IEC 61937 demuxer, used for compressed data in S/PDIF - * @author Anssi Hannula - */ - -#include "avformat.h" -#include "spdif.h" -#include "libavcodec/ac3.h" -#include "libavcodec/aacadtsdec.h" - -static int spdif_get_offset_and_codec(AVFormatContext *s, - enum IEC61937DataType data_type, - const char *buf, int *offset, - enum AVCodecID *codec) -{ - AACADTSHeaderInfo aac_hdr; - GetBitContext gbc; - - switch (data_type & 0xff) { - case IEC61937_AC3: - *offset = AC3_FRAME_SIZE << 2; - *codec = AV_CODEC_ID_AC3; - break; - case IEC61937_MPEG1_LAYER1: - *offset = spdif_mpeg_pkt_offset[1][0]; - *codec = AV_CODEC_ID_MP1; - break; - case IEC61937_MPEG1_LAYER23: - *offset = spdif_mpeg_pkt_offset[1][0]; - *codec = AV_CODEC_ID_MP3; - break; - case IEC61937_MPEG2_EXT: - *offset = 4608; - *codec = AV_CODEC_ID_MP3; - break; - case IEC61937_MPEG2_AAC: - init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8); - if (avpriv_aac_parse_header(&gbc, &aac_hdr) < 0) { - if (s) /* be silent during a probe */ - av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n"); - return AVERROR_INVALIDDATA; - } - *offset = aac_hdr.samples << 2; - *codec = AV_CODEC_ID_AAC; - break; - case IEC61937_MPEG2_LAYER1_LSF: - *offset = spdif_mpeg_pkt_offset[0][0]; - *codec = AV_CODEC_ID_MP1; - break; - case IEC61937_MPEG2_LAYER2_LSF: - *offset = spdif_mpeg_pkt_offset[0][1]; - *codec = AV_CODEC_ID_MP2; - break; - case IEC61937_MPEG2_LAYER3_LSF: - *offset = spdif_mpeg_pkt_offset[0][2]; - *codec = AV_CODEC_ID_MP3; - break; - case IEC61937_DTS1: - *offset = 2048; - *codec = AV_CODEC_ID_DTS; - break; - case IEC61937_DTS2: - *offset = 4096; - *codec = AV_CODEC_ID_DTS; - break; - case IEC61937_DTS3: - *offset = 8192; - *codec = AV_CODEC_ID_DTS; - break; - default: - if (s) { /* be silent during a probe */ - avpriv_request_sample(s, "Data type 0x%04x in IEC 61937", - data_type); - } - return AVERROR_PATCHWELCOME; - } - return 0; -} - -/* Largest offset between bursts we currently handle, i.e. AAC with - aac_hdr.samples = 4096 */ -#define SPDIF_MAX_OFFSET 16384 - -static int spdif_probe(AVProbeData *p) -{ - enum AVCodecID codec; - return ff_spdif_probe (p->buf, p->buf_size, &codec); -} - -int ff_spdif_probe(const uint8_t *p_buf, int buf_size, enum AVCodecID *codec) -{ - const uint8_t *buf = p_buf; - const uint8_t *probe_end = p_buf + FFMIN(2 * SPDIF_MAX_OFFSET, buf_size - 1); - const uint8_t *expected_code = buf + 7; - uint32_t state = 0; - int sync_codes = 0; - int consecutive_codes = 0; - int offset; - - for (; buf < probe_end; buf++) { - state = (state << 8) | *buf; - - if (state == (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2)) - && buf[1] < 0x37) { - sync_codes++; - - if (buf == expected_code) { - if (++consecutive_codes >= 2) - return AVPROBE_SCORE_MAX; - } else - consecutive_codes = 0; - - if (buf + 4 + AAC_ADTS_HEADER_SIZE > p_buf + buf_size) - break; - - /* continue probing to find more sync codes */ - probe_end = FFMIN(buf + SPDIF_MAX_OFFSET, p_buf + buf_size - 1); - - /* skip directly to the next sync code */ - if (!spdif_get_offset_and_codec(NULL, (buf[2] << 8) | buf[1], - &buf[5], &offset, codec)) { - if (buf + offset >= p_buf + buf_size) - break; - expected_code = buf + offset; - buf = expected_code - 7; - } - } - } - - if (!sync_codes) - return 0; - - if (sync_codes >= 6) - /* good amount of sync codes but with unexpected offsets */ - return AVPROBE_SCORE_EXTENSION; - - /* some sync codes were found */ - return AVPROBE_SCORE_EXTENSION / 4; -} - -static int spdif_read_header(AVFormatContext *s) -{ - s->ctx_flags |= AVFMTCTX_NOHEADER; - return 0; -} - -int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - AVIOContext *pb = s->pb; - enum IEC61937DataType data_type; - enum AVCodecID codec_id; - uint32_t state = 0; - int pkt_size_bits, offset, ret; - - while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { - state = (state << 8) | avio_r8(pb); - if (url_feof(pb)) - return AVERROR_EOF; - } - - data_type = avio_rl16(pb); - pkt_size_bits = avio_rl16(pb); - - if (pkt_size_bits % 16) - avpriv_request_sample(s, "Packet not ending at a 16-bit boundary"); - - ret = av_new_packet(pkt, FFALIGN(pkt_size_bits, 16) >> 3); - if (ret) - return ret; - - pkt->pos = avio_tell(pb) - BURST_HEADER_SIZE; - - if (avio_read(pb, pkt->data, pkt->size) < pkt->size) { - av_free_packet(pkt); - return AVERROR_EOF; - } - ff_spdif_bswap_buf16((uint16_t *)pkt->data, (uint16_t *)pkt->data, pkt->size >> 1); - - ret = spdif_get_offset_and_codec(s, data_type, pkt->data, - &offset, &codec_id); - if (ret) { - av_free_packet(pkt); - return ret; - } - - /* skip over the padding to the beginning of the next frame */ - avio_skip(pb, offset - pkt->size - BURST_HEADER_SIZE); - - if (!s->nb_streams) { - /* first packet, create a stream */ - AVStream *st = avformat_new_stream(s, NULL); - if (!st) { - av_free_packet(pkt); - return AVERROR(ENOMEM); - } - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = codec_id; - } else if (codec_id != s->streams[0]->codec->codec_id) { - avpriv_report_missing_feature(s, "Codec change in IEC 61937"); - return AVERROR_PATCHWELCOME; - } - - if (!s->bit_rate && s->streams[0]->codec->sample_rate) - /* stream bitrate matches 16-bit stereo PCM bitrate for currently - supported codecs */ - s->bit_rate = 2 * 16 * s->streams[0]->codec->sample_rate; - - return 0; -} - -AVInputFormat ff_spdif_demuxer = { - .name = "spdif", - .long_name = NULL_IF_CONFIG_SMALL("IEC 61937 (compressed data in S/PDIF)"), - .read_probe = spdif_probe, - .read_header = spdif_read_header, - .read_packet = ff_spdif_read_packet, - .flags = AVFMT_GENERIC_INDEX, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/srtp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/srtp.h deleted file mode 100644 index 3189f8f54..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/srtp.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * SRTP encryption/decryption - * Copyright (c) 2012 Martin Storsjo - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_SRTP_H -#define AVFORMAT_SRTP_H - -#include - -struct AVAES; -struct AVHMAC; - -struct SRTPContext { - struct AVAES *aes; - struct AVHMAC *hmac; - int rtp_hmac_size, rtcp_hmac_size; - uint8_t master_key[16]; - uint8_t master_salt[14]; - uint8_t rtp_key[16], rtcp_key[16]; - uint8_t rtp_salt[14], rtcp_salt[14]; - uint8_t rtp_auth[20], rtcp_auth[20]; - int seq_largest, seq_initialized; - uint32_t roc; - - uint32_t rtcp_index; -}; - -int ff_srtp_set_crypto(struct SRTPContext *s, const char *suite, - const char *params); -void ff_srtp_free(struct SRTPContext *s); -int ff_srtp_decrypt(struct SRTPContext *s, uint8_t *buf, int *lenptr); -int ff_srtp_encrypt(struct SRTPContext *s, const uint8_t *in, int len, - uint8_t *out, int outlen); - -#endif /* AVFORMAT_SRTP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/takdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/takdec.c deleted file mode 100644 index 2ed8a1e3b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/takdec.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Raw TAK demuxer - * Copyright (c) 2012 Paul B Mahol - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/crc.h" -#include "libavcodec/tak.h" -#include "avformat.h" -#include "avio_internal.h" -#include "internal.h" -#include "rawdec.h" -#include "apetag.h" - -typedef struct TAKDemuxContext { - int mlast_frame; - int64_t data_end; -} TAKDemuxContext; - -static int tak_probe(AVProbeData *p) -{ - if (!memcmp(p->buf, "tBaK", 4)) - return AVPROBE_SCORE_EXTENSION; - return 0; -} - -static unsigned long tak_check_crc(unsigned long checksum, const uint8_t *buf, - unsigned int len) -{ - return av_crc(av_crc_get_table(AV_CRC_24_IEEE), checksum, buf, len); -} - -static int tak_read_header(AVFormatContext *s) -{ - TAKDemuxContext *tc = s->priv_data; - AVIOContext *pb = s->pb; - GetBitContext gb; - AVStream *st; - uint8_t *buffer = NULL; - int ret; - - st = avformat_new_stream(s, 0); - if (!st) - return AVERROR(ENOMEM); - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_TAK; - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - tc->mlast_frame = 0; - if (avio_rl32(pb) != MKTAG('t', 'B', 'a', 'K')) { - avio_seek(pb, -4, SEEK_CUR); - return 0; - } - - while (!url_feof(pb)) { - enum TAKMetaDataType type; - int size; - - type = avio_r8(pb) & 0x7f; - size = avio_rl24(pb); - - switch (type) { - case TAK_METADATA_STREAMINFO: - case TAK_METADATA_LAST_FRAME: - case TAK_METADATA_ENCODER: - if (size <= 3) - return AVERROR_INVALIDDATA; - - buffer = av_malloc(size - 3 + FF_INPUT_BUFFER_PADDING_SIZE); - if (!buffer) - return AVERROR(ENOMEM); - - ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U); - if (avio_read(pb, buffer, size - 3) != size - 3) { - av_freep(&buffer); - return AVERROR(EIO); - } - if (ffio_get_checksum(s->pb) != avio_rb24(pb)) { - av_log(s, AV_LOG_ERROR, "%d metadata block CRC error.\n", type); - if (s->error_recognition & AV_EF_EXPLODE) { - av_freep(&buffer); - return AVERROR_INVALIDDATA; - } - } - - init_get_bits8(&gb, buffer, size - 3); - break; - case TAK_METADATA_MD5: { - uint8_t md5[16]; - int i; - - if (size != 19) - return AVERROR_INVALIDDATA; - ffio_init_checksum(pb, tak_check_crc, 0xCE04B7U); - avio_read(pb, md5, 16); - if (ffio_get_checksum(s->pb) != avio_rb24(pb)) { - av_log(s, AV_LOG_ERROR, "MD5 metadata block CRC error.\n"); - if (s->error_recognition & AV_EF_EXPLODE) - return AVERROR_INVALIDDATA; - } - - av_log(s, AV_LOG_VERBOSE, "MD5="); - for (i = 0; i < 16; i++) - av_log(s, AV_LOG_VERBOSE, "%02x", md5[i]); - av_log(s, AV_LOG_VERBOSE, "\n"); - break; - } - case TAK_METADATA_END: { - int64_t curpos = avio_tell(pb); - - if (pb->seekable) { - ff_ape_parse_tag(s); - avio_seek(pb, curpos, SEEK_SET); - } - - tc->data_end += curpos; - return 0; - } - default: - ret = avio_skip(pb, size); - if (ret < 0) - return ret; - } - - if (type == TAK_METADATA_STREAMINFO) { - TAKStreamInfo ti; - - avpriv_tak_parse_streaminfo(&gb, &ti); - if (ti.samples > 0) - st->duration = ti.samples; - st->codec->bits_per_coded_sample = ti.bps; - if (ti.ch_layout) - st->codec->channel_layout = ti.ch_layout; - st->codec->sample_rate = ti.sample_rate; - st->codec->channels = ti.channels; - st->start_time = 0; - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); - st->codec->extradata = buffer; - st->codec->extradata_size = size - 3; - buffer = NULL; - } else if (type == TAK_METADATA_LAST_FRAME) { - if (size != 11) - return AVERROR_INVALIDDATA; - tc->mlast_frame = 1; - tc->data_end = get_bits64(&gb, TAK_LAST_FRAME_POS_BITS) + - get_bits(&gb, TAK_LAST_FRAME_SIZE_BITS); - av_freep(&buffer); - } else if (type == TAK_METADATA_ENCODER) { - av_log(s, AV_LOG_VERBOSE, "encoder version: %0X\n", - get_bits_long(&gb, TAK_ENCODER_VERSION_BITS)); - av_freep(&buffer); - } - } - - return AVERROR_EOF; -} - -static int raw_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - TAKDemuxContext *tc = s->priv_data; - int ret; - - if (tc->mlast_frame) { - AVIOContext *pb = s->pb; - int64_t size, left; - - left = tc->data_end - avio_tell(pb); - size = FFMIN(left, 1024); - if (size <= 0) - return AVERROR_EOF; - - ret = av_get_packet(pb, pkt, size); - if (ret < 0) - return ret; - - pkt->stream_index = 0; - } else { - ret = ff_raw_read_partial_packet(s, pkt); - } - - return ret; -} - -AVInputFormat ff_tak_demuxer = { - .name = "tak", - .long_name = NULL_IF_CONFIG_SMALL("raw TAK"), - .priv_data_size = sizeof(TAKDemuxContext), - .read_probe = tak_probe, - .read_header = tak_read_header, - .read_packet = raw_read_packet, - .flags = AVFMT_GENERIC_INDEX, - .extensions = "tak", - .raw_codec_id = AV_CODEC_ID_TAK, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/tta.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/tta.c deleted file mode 100644 index bbb6a2292..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/tta.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * TTA demuxer - * Copyright (c) 2006 Alex Beregszaszi - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavcodec/get_bits.h" -#include "apetag.h" -#include "avformat.h" -#include "avio_internal.h" -#include "internal.h" -#include "id3v1.h" -#include "libavutil/crc.h" -#include "libavutil/dict.h" - -typedef struct { - int totalframes, currentframe; - int frame_size; - int last_frame_size; -} TTAContext; - -static unsigned long tta_check_crc(unsigned long checksum, const uint8_t *buf, - unsigned int len) -{ - return av_crc(av_crc_get_table(AV_CRC_32_IEEE_LE), checksum, buf, len); -} - -static int tta_probe(AVProbeData *p) -{ - if (AV_RL32(&p->buf[0]) == MKTAG('T', 'T', 'A', '1') && - (AV_RL16(&p->buf[4]) == 1 || AV_RL16(&p->buf[4]) == 2) && - AV_RL16(&p->buf[6]) > 0 && - AV_RL16(&p->buf[8]) > 0 && - AV_RL32(&p->buf[10]) > 0) - return AVPROBE_SCORE_EXTENSION + 30; - return 0; -} - -static int tta_read_header(AVFormatContext *s) -{ - TTAContext *c = s->priv_data; - AVStream *st; - int i, channels, bps, samplerate; - uint64_t framepos, start_offset; - uint32_t nb_samples, crc; - - ff_id3v1_read(s); - - start_offset = avio_tell(s->pb); - ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); - if (avio_rl32(s->pb) != AV_RL32("TTA1")) - return AVERROR_INVALIDDATA; - - avio_skip(s->pb, 2); // FIXME: flags - channels = avio_rl16(s->pb); - bps = avio_rl16(s->pb); - samplerate = avio_rl32(s->pb); - if(samplerate <= 0 || samplerate > 1000000){ - av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); - return AVERROR_INVALIDDATA; - } - - nb_samples = avio_rl32(s->pb); - if (!nb_samples) { - av_log(s, AV_LOG_ERROR, "invalid number of samples\n"); - return AVERROR_INVALIDDATA; - } - - crc = ffio_get_checksum(s->pb) ^ UINT32_MAX; - if (crc != avio_rl32(s->pb)) { - av_log(s, AV_LOG_ERROR, "Header CRC error\n"); - return AVERROR_INVALIDDATA; - } - - c->frame_size = samplerate * 256 / 245; - c->last_frame_size = nb_samples % c->frame_size; - if (!c->last_frame_size) - c->last_frame_size = c->frame_size; - c->totalframes = nb_samples / c->frame_size + (c->last_frame_size < c->frame_size); - c->currentframe = 0; - - if(c->totalframes >= UINT_MAX/sizeof(uint32_t) || c->totalframes <= 0){ - av_log(s, AV_LOG_ERROR, "totalframes %d invalid\n", c->totalframes); - return AVERROR_INVALIDDATA; - } - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - avpriv_set_pts_info(st, 64, 1, samplerate); - st->start_time = 0; - st->duration = nb_samples; - - framepos = avio_tell(s->pb) + 4*c->totalframes + 4; - - st->codec->extradata_size = avio_tell(s->pb) - start_offset; - st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); - if (!st->codec->extradata) { - st->codec->extradata_size = 0; - return AVERROR(ENOMEM); - } - - avio_seek(s->pb, start_offset, SEEK_SET); - avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); - - ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); - for (i = 0; i < c->totalframes; i++) { - uint32_t size = avio_rl32(s->pb); - av_add_index_entry(st, framepos, i * c->frame_size, size, 0, - AVINDEX_KEYFRAME); - framepos += size; - } - crc = ffio_get_checksum(s->pb) ^ UINT32_MAX; - if (crc != avio_rl32(s->pb)) { - av_log(s, AV_LOG_ERROR, "Seek table CRC error\n"); - return AVERROR_INVALIDDATA; - } - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_TTA; - st->codec->channels = channels; - st->codec->sample_rate = samplerate; - st->codec->bits_per_coded_sample = bps; - - if (s->pb->seekable) { - int64_t pos = avio_tell(s->pb); - ff_ape_parse_tag(s); - avio_seek(s->pb, pos, SEEK_SET); - } - - return 0; -} - -static int tta_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - TTAContext *c = s->priv_data; - AVStream *st = s->streams[0]; - int size, ret; - - // FIXME! - if (c->currentframe >= c->totalframes) - return AVERROR_EOF; - - size = st->index_entries[c->currentframe].size; - - ret = av_get_packet(s->pb, pkt, size); - pkt->dts = st->index_entries[c->currentframe++].timestamp; - pkt->duration = c->currentframe == c->totalframes ? c->last_frame_size : - c->frame_size; - return ret; -} - -static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) -{ - TTAContext *c = s->priv_data; - AVStream *st = s->streams[stream_index]; - int index = av_index_search_timestamp(st, timestamp, flags); - if (index < 0) - return -1; - if (avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET) < 0) - return -1; - - c->currentframe = index; - - return 0; -} - -AVInputFormat ff_tta_demuxer = { - .name = "tta", - .long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"), - .priv_data_size = sizeof(TTAContext), - .read_probe = tta_probe, - .read_header = tta_read_header, - .read_packet = tta_read_packet, - .read_seek = tta_read_seek, - .extensions = "tta", -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.c deleted file mode 100644 index 47e15843c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * URL utility functions - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - - -#include "avformat.h" -#include "config.h" -#include "url.h" -#if CONFIG_NETWORK -#include "network.h" -#endif -#include "libavutil/avstring.h" - -/** - * @file - * URL utility functions. - */ - -int ff_url_join(char *str, int size, const char *proto, - const char *authorization, const char *hostname, - int port, const char *fmt, ...) -{ -#if CONFIG_NETWORK - struct addrinfo hints = { 0 }, *ai; -#endif - - str[0] = '\0'; - if (proto) - av_strlcatf(str, size, "%s://", proto); - if (authorization && authorization[0]) - av_strlcatf(str, size, "%s@", authorization); -#if CONFIG_NETWORK && defined(AF_INET6) - /* Determine if hostname is a numerical IPv6 address, - * properly escape it within [] in that case. */ - hints.ai_flags = AI_NUMERICHOST; - if (!getaddrinfo(hostname, NULL, &hints, &ai)) { - if (ai->ai_family == AF_INET6) { - av_strlcat(str, "[", size); - av_strlcat(str, hostname, size); - av_strlcat(str, "]", size); - } else { - av_strlcat(str, hostname, size); - } - freeaddrinfo(ai); - } else -#endif - /* Not an IPv6 address, just output the plain string. */ - av_strlcat(str, hostname, size); - - if (port >= 0) - av_strlcatf(str, size, ":%d", port); - if (fmt) { - va_list vl; - int len = strlen(str); - - va_start(vl, fmt); - vsnprintf(str + len, size > len ? size - len : 0, fmt, vl); - va_end(vl); - } - return strlen(str); -} - -void ff_make_absolute_url(char *buf, int size, const char *base, - const char *rel) -{ - char *sep, *path_query; - /* Absolute path, relative to the current server */ - if (base && strstr(base, "://") && rel[0] == '/') { - if (base != buf) - av_strlcpy(buf, base, size); - sep = strstr(buf, "://"); - if (sep) { - /* Take scheme from base url */ - if (rel[1] == '/') { - sep[1] = '\0'; - } else { - /* Take scheme and host from base url */ - sep += 3; - sep = strchr(sep, '/'); - if (sep) - *sep = '\0'; - } - } - av_strlcat(buf, rel, size); - return; - } - /* If rel actually is an absolute url, just copy it */ - if (!base || strstr(rel, "://") || rel[0] == '/') { - av_strlcpy(buf, rel, size); - return; - } - if (base != buf) - av_strlcpy(buf, base, size); - - /* Strip off any query string from base */ - path_query = strchr(buf, '?'); - if (path_query != NULL) - *path_query = '\0'; - - /* Is relative path just a new query part? */ - if (rel[0] == '?') { - av_strlcat(buf, rel, size); - return; - } - - /* Remove the file name from the base url */ - sep = strrchr(buf, '/'); - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - while (av_strstart(rel, "../", NULL) && sep) { - /* Remove the path delimiter at the end */ - sep[0] = '\0'; - sep = strrchr(buf, '/'); - /* If the next directory name to pop off is "..", break here */ - if (!strcmp(sep ? &sep[1] : buf, "..")) { - /* Readd the slash we just removed */ - av_strlcat(buf, "/", size); - break; - } - /* Cut off the directory name */ - if (sep) - sep[1] = '\0'; - else - buf[0] = '\0'; - rel += 3; - } - av_strlcat(buf, rel, size); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.h deleted file mode 100644 index 0923c70d6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/url.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * unbuffered private I/O API - */ - -#ifndef AVFORMAT_URL_H -#define AVFORMAT_URL_H - -#include "avio.h" -#ifdef __FRAMEWORK__ -#include "dict.h" -#include "log.h" -#else -#include "libavformat/version.h" - -#include "libavutil/dict.h" -#include "libavutil/log.h" -#endif - -#define URL_PROTOCOL_FLAG_NESTED_SCHEME 1 /*< The protocol name can be the first part of a nested protocol scheme */ -#define URL_PROTOCOL_FLAG_NETWORK 2 /*< The protocol uses network */ - -extern int (*url_interrupt_cb)(void); - -extern const AVClass ffurl_context_class; - -typedef struct URLContext { - const AVClass *av_class; /**< information for av_log(). Set by url_open(). */ - struct URLProtocol *prot; - void *priv_data; - char *filename; /**< specified URL */ - int flags; - int max_packet_size; /**< if non zero, the stream is packetized with this max packet size */ - int is_streamed; /**< true if streamed (no seek possible), default = false */ - int is_connected; - AVIOInterruptCB interrupt_callback; - int64_t rw_timeout; /**< maximum time to wait for (network) read/write operation completion, in mcs */ -} URLContext; - -typedef struct URLProtocol { - const char *name; - int (*url_open)( URLContext *h, const char *url, int flags); - /** - * This callback is to be used by protocols which open further nested - * protocols. options are then to be passed to ffurl_open()/ffurl_connect() - * for those nested protocols. - */ - int (*url_open2)(URLContext *h, const char *url, int flags, AVDictionary **options); - - /** - * Read data from the protocol. - * If data is immediately available (even less than size), EOF is - * reached or an error occurs (including EINTR), return immediately. - * Otherwise: - * In non-blocking mode, return AVERROR(EAGAIN) immediately. - * In blocking mode, wait for data/EOF/error with a short timeout (0.1s), - * and return AVERROR(EAGAIN) on timeout. - * Checking interrupt_callback, looping on EINTR and EAGAIN and until - * enough data has been read is left to the calling function; see - * retry_transfer_wrapper in avio.c. - */ - int (*url_read)( URLContext *h, unsigned char *buf, int size); - int (*url_write)(URLContext *h, const unsigned char *buf, int size); - int64_t (*url_seek)( URLContext *h, int64_t pos, int whence); - int (*url_close)(URLContext *h); - struct URLProtocol *next; - int (*url_read_pause)(URLContext *h, int pause); - int64_t (*url_read_seek)(URLContext *h, int stream_index, - int64_t timestamp, int flags); - int (*url_get_file_handle)(URLContext *h); - int (*url_get_multi_file_handle)(URLContext *h, int **handles, - int *numhandles); - int (*url_shutdown)(URLContext *h, int flags); - int priv_data_size; - const AVClass *priv_data_class; - int flags; - int (*url_check)(URLContext *h, int mask); -} URLProtocol; - -/** - * Create a URLContext for accessing to the resource indicated by - * url, but do not initiate the connection yet. - * - * @param puc pointer to the location where, in case of success, the - * function puts the pointer to the created URLContext - * @param flags flags which control how the resource indicated by url - * is to be opened - * @param int_cb interrupt callback to use for the URLContext, may be - * NULL - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int ffurl_alloc(URLContext **puc, const char *filename, int flags, - const AVIOInterruptCB *int_cb); - -/** - * Connect an URLContext that has been allocated by ffurl_alloc - * - * @param options A dictionary filled with options for nested protocols, - * i.e. it will be passed to url_open2() for protocols implementing it. - * This parameter will be destroyed and replaced with a dict containing options - * that were not found. May be NULL. - */ -int ffurl_connect(URLContext *uc, AVDictionary **options); - -/** - * Create an URLContext for accessing to the resource indicated by - * url, and open it. - * - * @param puc pointer to the location where, in case of success, the - * function puts the pointer to the created URLContext - * @param flags flags which control how the resource indicated by url - * is to be opened - * @param int_cb interrupt callback to use for the URLContext, may be - * NULL - * @param options A dictionary filled with protocol-private options. On return - * this parameter will be destroyed and replaced with a dict containing options - * that were not found. May be NULL. - * @return >= 0 in case of success, a negative value corresponding to an - * AVERROR code in case of failure - */ -int ffurl_open(URLContext **puc, const char *filename, int flags, - const AVIOInterruptCB *int_cb, AVDictionary **options); - -/** - * Read up to size bytes from the resource accessed by h, and store - * the read bytes in buf. - * - * @return The number of bytes actually read, or a negative value - * corresponding to an AVERROR code in case of error. A value of zero - * indicates that it is not possible to read more from the accessed - * resource (except if the value of the size argument is also zero). - */ -int ffurl_read(URLContext *h, unsigned char *buf, int size); - -/** - * Read as many bytes as possible (up to size), calling the - * read function multiple times if necessary. - * This makes special short-read handling in applications - * unnecessary, if the return value is < size then it is - * certain there was either an error or the end of file was reached. - */ -int ffurl_read_complete(URLContext *h, unsigned char *buf, int size); - -/** - * Write size bytes from buf to the resource accessed by h. - * - * @return the number of bytes actually written, or a negative value - * corresponding to an AVERROR code in case of failure - */ -int ffurl_write(URLContext *h, const unsigned char *buf, int size); - -/** - * Change the position that will be used by the next read/write - * operation on the resource accessed by h. - * - * @param pos specifies the new position to set - * @param whence specifies how pos should be interpreted, it must be - * one of SEEK_SET (seek from the beginning), SEEK_CUR (seek from the - * current position), SEEK_END (seek from the end), or AVSEEK_SIZE - * (return the filesize of the requested resource, pos is ignored). - * @return a negative value corresponding to an AVERROR code in case - * of failure, or the resulting file position, measured in bytes from - * the beginning of the file. You can use this feature together with - * SEEK_CUR to read the current file position. - */ -int64_t ffurl_seek(URLContext *h, int64_t pos, int whence); - -/** - * Close the resource accessed by the URLContext h, and free the - * memory used by it. Also set the URLContext pointer to NULL. - * - * @return a negative value if an error condition occurred, 0 - * otherwise - */ -int ffurl_closep(URLContext **h); -int ffurl_close(URLContext *h); - -/** - * Return the filesize of the resource accessed by h, AVERROR(ENOSYS) - * if the operation is not supported by h, or another negative value - * corresponding to an AVERROR error code in case of failure. - */ -int64_t ffurl_size(URLContext *h); - -/** - * Return the file descriptor associated with this URL. For RTP, this - * will return only the RTP file descriptor, not the RTCP file descriptor. - * - * @return the file descriptor associated with this URL, or <0 on error. - */ -int ffurl_get_file_handle(URLContext *h); - -/** - * Return the file descriptors associated with this URL. - * - * @return 0 on success or <0 on error. - */ -int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles); - -/** - * Signal the URLContext that we are done reading or writing the stream. - * - * @param h pointer to the resource - * @param flags flags which control how the resource indicated by url - * is to be shutdown - * - * @return a negative value if an error condition occurred, 0 - * otherwise - */ -int ffurl_shutdown(URLContext *h, int flags); - -/** - * Register the URLProtocol protocol. - */ -int ffurl_register_protocol(URLProtocol *protocol); - -/** - * Check if the user has requested to interrup a blocking function - * associated with cb. - */ -int ff_check_interrupt(AVIOInterruptCB *cb); - -/** - * Iterate over all available protocols. - * - * @param prev result of the previous call to this functions or NULL. - */ -URLProtocol *ffurl_protocol_next(URLProtocol *prev); - -/* udp.c */ -int ff_udp_set_remote_url(URLContext *h, const char *uri); -int ff_udp_get_local_port(URLContext *h); - -/** - * Assemble a URL string from components. This is the reverse operation - * of av_url_split. - * - * Note, this requires networking to be initialized, so the caller must - * ensure ff_network_init has been called. - * - * @see av_url_split - * - * @param str the buffer to fill with the url - * @param size the size of the str buffer - * @param proto the protocol identifier, if null, the separator - * after the identifier is left out, too - * @param authorization an optional authorization string, may be null. - * An empty string is treated the same as a null string. - * @param hostname the host name string - * @param port the port number, left out from the string if negative - * @param fmt a generic format string for everything to add after the - * host/port, may be null - * @return the number of characters written to the destination buffer - */ -int ff_url_join(char *str, int size, const char *proto, - const char *authorization, const char *hostname, - int port, const char *fmt, ...) av_printf_format(7, 8); - -/** - * Convert a relative url into an absolute url, given a base url. - * - * @param buf the buffer where output absolute url is written - * @param size the size of buf - * @param base the base url, may be equal to buf. - * @param rel the new url, which is interpreted relative to base - */ -void ff_make_absolute_url(char *buf, int size, const char *base, - const char *rel); - - -#endif /* AVFORMAT_URL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/utils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/utils.c deleted file mode 100644 index b25aadb24..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/utils.c +++ /dev/null @@ -1,4578 +0,0 @@ -/* - * various utility functions for use within FFmpeg - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#undef NDEBUG -#include -#include -#include - -#include "config.h" - -#include "libavutil/avassert.h" -#include "libavutil/avstring.h" -#include "libavutil/dict.h" -#include "libavutil/internal.h" -#include "libavutil/mathematics.h" -#include "libavutil/opt.h" -#include "libavutil/parseutils.h" -#include "libavutil/pixdesc.h" -#include "libavutil/time_.h" -#include "libavutil/timestamp.h" - -#include "libavcodec/bytestream.h" -#include "libavcodec/internal.h" -#include "libavcodec/raw.h" - -#include "audiointerleave.h" -#include "avformat.h" -#include "avio_internal.h" -#include "id3v2.h" -#include "internal.h" -#include "metadata.h" -#if CONFIG_NETWORK -#include "network.h" -#endif -#include "riff.h" -#include "url.h" - -/** - * @file - * various utility functions for use within FFmpeg - */ - -unsigned avformat_version(void) -{ - av_assert0(LIBAVFORMAT_VERSION_MICRO >= 100); - return LIBAVFORMAT_VERSION_INT; -} - -const char *avformat_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char *avformat_license(void) -{ -#define LICENSE_PREFIX "libavformat license: " - return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; -} - -#define RELATIVE_TS_BASE (INT64_MAX - (1LL<<48)) - -static int is_relative(int64_t ts) { - return ts > (RELATIVE_TS_BASE - (1LL<<48)); -} - -/** - * Wrap a given time stamp, if there is an indication for an overflow - * - * @param st stream - * @param timestamp the time stamp to wrap - * @return resulting time stamp - */ -static int64_t wrap_timestamp(AVStream *st, int64_t timestamp) -{ - if (st->pts_wrap_behavior != AV_PTS_WRAP_IGNORE && - st->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) { - if (st->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET && - timestamp < st->pts_wrap_reference) - return timestamp + (1ULL << st->pts_wrap_bits); - else if (st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET && - timestamp >= st->pts_wrap_reference) - return timestamp - (1ULL << st->pts_wrap_bits); - } - return timestamp; -} - -MAKE_ACCESSORS(AVStream, stream, AVRational, r_frame_rate) -MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, video_codec) -MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, audio_codec) -MAKE_ACCESSORS(AVFormatContext, format, AVCodec *, subtitle_codec) -MAKE_ACCESSORS(AVFormatContext, format, int, metadata_header_padding) -MAKE_ACCESSORS(AVFormatContext, format, void *, opaque) -MAKE_ACCESSORS(AVFormatContext, format, av_format_control_message, control_message_cb) - -static AVCodec *find_decoder(AVFormatContext *s, AVStream *st, enum AVCodecID codec_id) -{ - if (st->codec->codec) - return st->codec->codec; - - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - if (s->video_codec) return s->video_codec; - break; - case AVMEDIA_TYPE_AUDIO: - if (s->audio_codec) return s->audio_codec; - break; - case AVMEDIA_TYPE_SUBTITLE: - if (s->subtitle_codec) return s->subtitle_codec; - break; - } - - return avcodec_find_decoder(codec_id); -} - -int av_format_get_probe_score(const AVFormatContext *s) -{ - return s->probe_score; -} - -/* an arbitrarily chosen "sane" max packet size -- 50M */ -#define SANE_CHUNK_SIZE (50000000) - -int ffio_limit(AVIOContext *s, int size) -{ - if (s->maxsize>= 0) { - int64_t remaining= s->maxsize - avio_tell(s); - if (remaining < size) { - int64_t newsize = avio_size(s); - if (!s->maxsize || s->maxsizemaxsize = newsize - !newsize; - remaining= s->maxsize - avio_tell(s); - remaining= FFMAX(remaining, 0); - } - - if (s->maxsize>= 0 && remaining+1 < size) { - av_log(NULL, remaining ? AV_LOG_ERROR : AV_LOG_DEBUG, "Truncating packet of size %d to %"PRId64"\n", size, remaining+1); - size = remaining+1; - } - } - return size; -} - -/* Read the data in sane-sized chunks and append to pkt. - * Return the number of bytes read or an error. */ -static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size) -{ - int64_t orig_pos = pkt->pos; // av_grow_packet might reset pos - int orig_size = pkt->size; - int ret; - - do { - int prev_size = pkt->size; - int read_size; - - /* When the caller requests a lot of data, limit it to the amount - * left in file or SANE_CHUNK_SIZE when it is not known. */ - read_size = size; - if (read_size > SANE_CHUNK_SIZE/10) { - read_size = ffio_limit(s, read_size); - // If filesize/maxsize is unknown, limit to SANE_CHUNK_SIZE - if (s->maxsize < 0) - read_size = FFMIN(read_size, SANE_CHUNK_SIZE); - } - - ret = av_grow_packet(pkt, read_size); - if (ret < 0) - break; - - ret = avio_read(s, pkt->data + prev_size, read_size); - if (ret != read_size) { - av_shrink_packet(pkt, prev_size + FFMAX(ret, 0)); - break; - } - - size -= read_size; - } while (size > 0); - if (size > 0) - pkt->flags |= AV_PKT_FLAG_CORRUPT; - - pkt->pos = orig_pos; - if (!pkt->size) - av_free_packet(pkt); - return pkt->size > orig_size ? pkt->size - orig_size : ret; -} - -int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) -{ - av_init_packet(pkt); - pkt->data = NULL; - pkt->size = 0; - pkt->pos = avio_tell(s); - - return append_packet_chunked(s, pkt, size); -} - -int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) -{ - if (!pkt->size) - return av_get_packet(s, pkt, size); - return append_packet_chunked(s, pkt, size); -} - -int av_filename_number_test(const char *filename) -{ - char buf[1024]; - return filename && - (av_get_frame_filename(buf, sizeof(buf), filename, 1) >= 0); -} - -AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, - int *score_ret) -{ - AVProbeData lpd = *pd; - AVInputFormat *fmt1 = NULL, *fmt; - int score, nodat = 0, score_max = 0; - const static uint8_t zerobuffer[AVPROBE_PADDING_SIZE]; - - if (!lpd.buf) - lpd.buf = zerobuffer; - - if (lpd.buf_size > 10 && ff_id3v2_match(lpd.buf, ID3v2_DEFAULT_MAGIC)) { - int id3len = ff_id3v2_tag_len(lpd.buf); - if (lpd.buf_size > id3len + 16) { - lpd.buf += id3len; - lpd.buf_size -= id3len; - } else - nodat = 1; - } - - fmt = NULL; - while ((fmt1 = av_iformat_next(fmt1))) { - if (!is_opened == !(fmt1->flags & AVFMT_NOFILE)) - continue; - score = 0; - if (fmt1->read_probe) { - score = fmt1->read_probe(&lpd); - if (fmt1->extensions && av_match_ext(lpd.filename, fmt1->extensions)) - score = FFMAX(score, nodat ? AVPROBE_SCORE_EXTENSION / 2 - 1 : 1); - } else if (fmt1->extensions) { - if (av_match_ext(lpd.filename, fmt1->extensions)) - score = AVPROBE_SCORE_EXTENSION; - } - if (score > score_max) { - score_max = score; - fmt = fmt1; - } else if (score == score_max) - fmt = NULL; - } - if (nodat) - score_max = FFMIN(AVPROBE_SCORE_EXTENSION / 2 - 1, score_max); - *score_ret = score_max; - - return fmt; -} - -AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max) -{ - int score_ret; - AVInputFormat *fmt = av_probe_input_format3(pd, is_opened, &score_ret); - if (score_ret > *score_max) { - *score_max = score_ret; - return fmt; - } else - return NULL; -} - -AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened) -{ - int score = 0; - return av_probe_input_format2(pd, is_opened, &score); -} - -static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, - AVProbeData *pd) -{ - static const struct { - const char *name; - enum AVCodecID id; - enum AVMediaType type; - } fmt_id_type[] = { - { "aac", AV_CODEC_ID_AAC, AVMEDIA_TYPE_AUDIO }, - { "ac3", AV_CODEC_ID_AC3, AVMEDIA_TYPE_AUDIO }, - { "dts", AV_CODEC_ID_DTS, AVMEDIA_TYPE_AUDIO }, - { "eac3", AV_CODEC_ID_EAC3, AVMEDIA_TYPE_AUDIO }, - { "h264", AV_CODEC_ID_H264, AVMEDIA_TYPE_VIDEO }, - { "hevc", AV_CODEC_ID_HEVC, AVMEDIA_TYPE_VIDEO }, - { "loas", AV_CODEC_ID_AAC_LATM, AVMEDIA_TYPE_AUDIO }, - { "m4v", AV_CODEC_ID_MPEG4, AVMEDIA_TYPE_VIDEO }, - { "mp3", AV_CODEC_ID_MP3, AVMEDIA_TYPE_AUDIO }, - { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO }, - { 0 } - }; - int score; - AVInputFormat *fmt = av_probe_input_format3(pd, 1, &score); - - if (fmt && st->request_probe <= score) { - int i; - av_log(s, AV_LOG_DEBUG, - "Probe with size=%d, packets=%d detected %s with score=%d\n", - pd->buf_size, MAX_PROBE_PACKETS - st->probe_packets, - fmt->name, score); - for (i = 0; fmt_id_type[i].name; i++) { - if (!strcmp(fmt->name, fmt_id_type[i].name)) { - st->codec->codec_id = fmt_id_type[i].id; - st->codec->codec_type = fmt_id_type[i].type; - break; - } - } - } - return score; -} - -/************************************************************/ -/* input media file */ - -int av_demuxer_open(AVFormatContext *ic) { - int err; - - if (ic->iformat->read_header) { - err = ic->iformat->read_header(ic); - if (err < 0) - return err; - } - - if (ic->pb && !ic->data_offset) - ic->data_offset = avio_tell(ic->pb); - - return 0; -} - - -int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, - unsigned int offset, unsigned int max_probe_size) -{ - AVProbeData pd = { filename ? filename : "" }; - uint8_t *buf = NULL; - uint8_t *mime_type; - int ret = 0, probe_size, buf_offset = 0; - int score = 0; - - if (!max_probe_size) - max_probe_size = PROBE_BUF_MAX; - else if (max_probe_size > PROBE_BUF_MAX) - max_probe_size = PROBE_BUF_MAX; - else if (max_probe_size < PROBE_BUF_MIN) { - av_log(logctx, AV_LOG_ERROR, - "Specified probe size value %u cannot be < %u\n", max_probe_size, PROBE_BUF_MIN); - return AVERROR(EINVAL); - } - - if (offset >= max_probe_size) - return AVERROR(EINVAL); - - if (!*fmt && pb->av_class && av_opt_get(pb, "mime_type", AV_OPT_SEARCH_CHILDREN, &mime_type) >= 0 && mime_type) { - if (!av_strcasecmp(mime_type, "audio/aacp")) { - *fmt = av_find_input_format("aac"); - } - av_freep(&mime_type); - } - - for (probe_size = PROBE_BUF_MIN; probe_size <= max_probe_size && !*fmt; - probe_size = FFMIN(probe_size << 1, - FFMAX(max_probe_size, probe_size + 1))) { - score = probe_size < max_probe_size ? AVPROBE_SCORE_RETRY : 0; - - /* Read probe data. */ - if ((ret = av_reallocp(&buf, probe_size + AVPROBE_PADDING_SIZE)) < 0) - return ret; - if ((ret = avio_read(pb, buf + buf_offset, - probe_size - buf_offset)) < 0) { - /* Fail if error was not end of file, otherwise, lower score. */ - if (ret != AVERROR_EOF) { - av_free(buf); - return ret; - } - score = 0; - ret = 0; /* error was end of file, nothing read */ - } - buf_offset += ret; - if (buf_offset < offset) - continue; - pd.buf_size = buf_offset - offset; - pd.buf = &buf[offset]; - - memset(pd.buf + pd.buf_size, 0, AVPROBE_PADDING_SIZE); - - /* Guess file format. */ - *fmt = av_probe_input_format2(&pd, 1, &score); - if (*fmt) { - /* This can only be true in the last iteration. */ - if (score <= AVPROBE_SCORE_RETRY) { - av_log(logctx, AV_LOG_WARNING, - "Format %s detected only with low score of %d, " - "misdetection possible!\n", (*fmt)->name, score); - } else - av_log(logctx, AV_LOG_DEBUG, - "Format %s probed with size=%d and score=%d\n", - (*fmt)->name, probe_size, score); -#if 0 - FILE *f = fopen("probestat.tmp", "ab"); - fprintf(f, "probe_size:%d format:%s score:%d filename:%s\n", probe_size, (*fmt)->name, score, filename); - fclose(f); -#endif - } - } - - if (!*fmt) { - av_free(buf); - return AVERROR_INVALIDDATA; - } - - /* Rewind. Reuse probe buffer to avoid seeking. */ - ret = ffio_rewind_with_probe_data(pb, &buf, buf_offset); - - return ret < 0 ? ret : score; -} - -int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, - unsigned int offset, unsigned int max_probe_size) -{ - int ret = av_probe_input_buffer2(pb, fmt, filename, logctx, offset, max_probe_size); - return ret < 0 ? ret : 0; -} - -/* Open input file and probe the format if necessary. */ -static int init_input(AVFormatContext *s, const char *filename, - AVDictionary **options) -{ - int ret; - AVProbeData pd = { filename, NULL, 0 }; - int score = AVPROBE_SCORE_RETRY; - - if (s->pb) { - s->flags |= AVFMT_FLAG_CUSTOM_IO; - if (!s->iformat) - return av_probe_input_buffer2(s->pb, &s->iformat, filename, - s, 0, s->probesize); - else if (s->iformat->flags & AVFMT_NOFILE) - av_log(s, AV_LOG_WARNING, "Custom AVIOContext makes no sense and " - "will be ignored with AVFMT_NOFILE format.\n"); - return 0; - } - - if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || - (!s->iformat && (s->iformat = av_probe_input_format2(&pd, 0, &score)))) - return score; - - if ((ret = avio_open2(&s->pb, filename, AVIO_FLAG_READ | s->avio_flags, - &s->interrupt_callback, options)) < 0) - return ret; - if (s->iformat) - return 0; - return av_probe_input_buffer2(s->pb, &s->iformat, filename, - s, 0, s->probesize); -} - -static AVPacket *add_to_pktbuf(AVPacketList **packet_buffer, AVPacket *pkt, - AVPacketList **plast_pktl) -{ - AVPacketList *pktl = av_mallocz(sizeof(AVPacketList)); - if (!pktl) - return NULL; - - if (*packet_buffer) - (*plast_pktl)->next = pktl; - else - *packet_buffer = pktl; - - /* Add the packet in the buffered packet list. */ - *plast_pktl = pktl; - pktl->pkt = *pkt; - return &pktl->pkt; -} - -int avformat_queue_attached_pictures(AVFormatContext *s) -{ - int i; - for (i = 0; i < s->nb_streams; i++) - if (s->streams[i]->disposition & AV_DISPOSITION_ATTACHED_PIC && - s->streams[i]->discard < AVDISCARD_ALL) { - AVPacket copy = s->streams[i]->attached_pic; - copy.buf = av_buffer_ref(copy.buf); - if (!copy.buf) - return AVERROR(ENOMEM); - - add_to_pktbuf(&s->raw_packet_buffer, ©, - &s->raw_packet_buffer_end); - } - return 0; -} - -int avformat_open_input(AVFormatContext **ps, const char *filename, - AVInputFormat *fmt, AVDictionary **options) -{ - AVFormatContext *s = *ps; - int ret = 0; - AVDictionary *tmp = NULL; - ID3v2ExtraMeta *id3v2_extra_meta = NULL; - - if (!s && !(s = avformat_alloc_context())) - return AVERROR(ENOMEM); - if (!s->av_class) { - av_log(NULL, AV_LOG_ERROR, "Input context has not been properly allocated by avformat_alloc_context() and is not NULL either\n"); - return AVERROR(EINVAL); - } - if (fmt) - s->iformat = fmt; - - if (options) - av_dict_copy(&tmp, *options, 0); - - if ((ret = av_opt_set_dict(s, &tmp)) < 0) - goto fail; - - if ((ret = init_input(s, filename, &tmp)) < 0) - goto fail; - s->probe_score = ret; - avio_skip(s->pb, s->skip_initial_bytes); - - /* Check filename in case an image number is expected. */ - if (s->iformat->flags & AVFMT_NEEDNUMBER) { - if (!av_filename_number_test(filename)) { - ret = AVERROR(EINVAL); - goto fail; - } - } - - s->duration = s->start_time = AV_NOPTS_VALUE; - av_strlcpy(s->filename, filename ? filename : "", sizeof(s->filename)); - - /* Allocate private data. */ - if (s->iformat->priv_data_size > 0) { - if (!(s->priv_data = av_mallocz(s->iformat->priv_data_size))) { - ret = AVERROR(ENOMEM); - goto fail; - } - if (s->iformat->priv_class) { - *(const AVClass **) s->priv_data = s->iformat->priv_class; - av_opt_set_defaults(s->priv_data); - if ((ret = av_opt_set_dict(s->priv_data, &tmp)) < 0) - goto fail; - } - } - - /* e.g. AVFMT_NOFILE formats will not have a AVIOContext */ - if (s->pb) - ff_id3v2_read(s, ID3v2_DEFAULT_MAGIC, &id3v2_extra_meta); - - if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->iformat->read_header) - if ((ret = s->iformat->read_header(s)) < 0) - goto fail; - - if (id3v2_extra_meta) { - if (!strcmp(s->iformat->name, "mp3") || !strcmp(s->iformat->name, "aac") || - !strcmp(s->iformat->name, "tta")) { - if ((ret = ff_id3v2_parse_apic(s, &id3v2_extra_meta)) < 0) - goto fail; - } else - av_log(s, AV_LOG_DEBUG, "demuxer does not support additional id3 data, skipping\n"); - } - ff_id3v2_free_extra_meta(&id3v2_extra_meta); - - if ((ret = avformat_queue_attached_pictures(s)) < 0) - goto fail; - - if (!(s->flags&AVFMT_FLAG_PRIV_OPT) && s->pb && !s->data_offset) - s->data_offset = avio_tell(s->pb); - - s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; - - if (options) { - av_dict_free(options); - *options = tmp; - } - *ps = s; - return 0; - -fail: - ff_id3v2_free_extra_meta(&id3v2_extra_meta); - av_dict_free(&tmp); - if (s->pb && !(s->flags & AVFMT_FLAG_CUSTOM_IO)) - avio_close(s->pb); - avformat_free_context(s); - *ps = NULL; - return ret; -} - -/*******************************************************/ - -static void force_codec_ids(AVFormatContext *s, AVStream *st) -{ - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - if (s->video_codec_id) - st->codec->codec_id = s->video_codec_id; - break; - case AVMEDIA_TYPE_AUDIO: - if (s->audio_codec_id) - st->codec->codec_id = s->audio_codec_id; - break; - case AVMEDIA_TYPE_SUBTITLE: - if (s->subtitle_codec_id) - st->codec->codec_id = s->subtitle_codec_id; - break; - } -} - -static int probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt) -{ - if (st->request_probe>0) { - AVProbeData *pd = &st->probe_data; - int end; - av_log(s, AV_LOG_DEBUG, "probing stream %d pp:%d\n", st->index, st->probe_packets); - --st->probe_packets; - - if (pkt) { - uint8_t *new_buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE); - if (!new_buf) { - av_log(s, AV_LOG_WARNING, - "Failed to reallocate probe buffer for stream %d\n", - st->index); - goto no_packet; - } - pd->buf = new_buf; - memcpy(pd->buf + pd->buf_size, pkt->data, pkt->size); - pd->buf_size += pkt->size; - memset(pd->buf + pd->buf_size, 0, AVPROBE_PADDING_SIZE); - } else { -no_packet: - st->probe_packets = 0; - if (!pd->buf_size) { - av_log(s, AV_LOG_WARNING, - "nothing to probe for stream %d\n", st->index); - } - } - - end= s->raw_packet_buffer_remaining_size <= 0 - || st->probe_packets<= 0; - - if (end || av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) { - int score = set_codec_from_probe_data(s, st, pd); - if ( (st->codec->codec_id != AV_CODEC_ID_NONE && score > AVPROBE_SCORE_STREAM_RETRY) - || end) { - pd->buf_size = 0; - av_freep(&pd->buf); - st->request_probe = -1; - if (st->codec->codec_id != AV_CODEC_ID_NONE) { - av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index); - } else - av_log(s, AV_LOG_WARNING, "probed stream %d failed\n", st->index); - } - force_codec_ids(s, st); - } - } - return 0; -} - -static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_index, AVPacket *pkt) -{ - int64_t ref = pkt->dts; - int i, pts_wrap_behavior; - int64_t pts_wrap_reference; - AVProgram *first_program; - - if (ref == AV_NOPTS_VALUE) - ref = pkt->pts; - if (st->pts_wrap_reference != AV_NOPTS_VALUE || st->pts_wrap_bits >= 63 || ref == AV_NOPTS_VALUE || !s->correct_ts_overflow) - return 0; - ref &= (1LL << st->pts_wrap_bits)-1; - - // reference time stamp should be 60 s before first time stamp - pts_wrap_reference = ref - av_rescale(60, st->time_base.den, st->time_base.num); - // if first time stamp is not more than 1/8 and 60s before the wrap point, subtract rather than add wrap offset - pts_wrap_behavior = (ref < (1LL << st->pts_wrap_bits) - (1LL << st->pts_wrap_bits-3)) || - (ref < (1LL << st->pts_wrap_bits) - av_rescale(60, st->time_base.den, st->time_base.num)) ? - AV_PTS_WRAP_ADD_OFFSET : AV_PTS_WRAP_SUB_OFFSET; - - first_program = av_find_program_from_stream(s, NULL, stream_index); - - if (!first_program) { - int default_stream_index = av_find_default_stream_index(s); - if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) { - for (i = 0; i < s->nb_streams; i++) { - s->streams[i]->pts_wrap_reference = pts_wrap_reference; - s->streams[i]->pts_wrap_behavior = pts_wrap_behavior; - } - } - else { - st->pts_wrap_reference = s->streams[default_stream_index]->pts_wrap_reference; - st->pts_wrap_behavior = s->streams[default_stream_index]->pts_wrap_behavior; - } - } - else { - AVProgram *program = first_program; - while (program) { - if (program->pts_wrap_reference != AV_NOPTS_VALUE) { - pts_wrap_reference = program->pts_wrap_reference; - pts_wrap_behavior = program->pts_wrap_behavior; - break; - } - program = av_find_program_from_stream(s, program, stream_index); - } - - // update every program with differing pts_wrap_reference - program = first_program; - while (program) { - if (program->pts_wrap_reference != pts_wrap_reference) { - for (i = 0; inb_stream_indexes; i++) { - s->streams[program->stream_index[i]]->pts_wrap_reference = pts_wrap_reference; - s->streams[program->stream_index[i]]->pts_wrap_behavior = pts_wrap_behavior; - } - - program->pts_wrap_reference = pts_wrap_reference; - program->pts_wrap_behavior = pts_wrap_behavior; - } - program = av_find_program_from_stream(s, program, stream_index); - } - } - return 1; -} - -int ff_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, i, err; - AVStream *st; - - for (;;) { - AVPacketList *pktl = s->raw_packet_buffer; - - if (pktl) { - *pkt = pktl->pkt; - st = s->streams[pkt->stream_index]; - if (s->raw_packet_buffer_remaining_size <= 0) - if ((err = probe_codec(s, st, NULL)) < 0) - return err; - if (st->request_probe <= 0) { - s->raw_packet_buffer = pktl->next; - s->raw_packet_buffer_remaining_size += pkt->size; - av_free(pktl); - return 0; - } - } - - pkt->data = NULL; - pkt->size = 0; - av_init_packet(pkt); - ret = s->iformat->read_packet(s, pkt); - if (ret < 0) { - if (!pktl || ret == AVERROR(EAGAIN)) - return ret; - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - if (st->probe_packets) - if ((err = probe_codec(s, st, NULL)) < 0) - return err; - av_assert0(st->request_probe <= 0); - } - continue; - } - - if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) && - (pkt->flags & AV_PKT_FLAG_CORRUPT)) { - av_log(s, AV_LOG_WARNING, - "Dropped corrupted packet (stream = %d)\n", - pkt->stream_index); - av_free_packet(pkt); - continue; - } - - if (pkt->stream_index >= (unsigned)s->nb_streams) { - av_log(s, AV_LOG_ERROR, "Invalid stream index %d\n", pkt->stream_index); - continue; - } - - st = s->streams[pkt->stream_index]; - - if (update_wrap_reference(s, st, pkt->stream_index, pkt) && st->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET) { - // correct first time stamps to negative values - if (!is_relative(st->first_dts)) - st->first_dts = wrap_timestamp(st, st->first_dts); - if (!is_relative(st->start_time)) - st->start_time = wrap_timestamp(st, st->start_time); - if (!is_relative(st->cur_dts)) - st->cur_dts = wrap_timestamp(st, st->cur_dts); - } - - pkt->dts = wrap_timestamp(st, pkt->dts); - pkt->pts = wrap_timestamp(st, pkt->pts); - - force_codec_ids(s, st); - - /* TODO: audio: time filter; video: frame reordering (pts != dts) */ - if (s->use_wallclock_as_timestamps) - pkt->dts = pkt->pts = av_rescale_q(av_gettime(), AV_TIME_BASE_Q, st->time_base); - - if (!pktl && st->request_probe <= 0) - return ret; - - add_to_pktbuf(&s->raw_packet_buffer, pkt, &s->raw_packet_buffer_end); - s->raw_packet_buffer_remaining_size -= pkt->size; - - if ((err = probe_codec(s, st, pkt)) < 0) - return err; - } -} - -#if FF_API_READ_PACKET -int av_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - return ff_read_packet(s, pkt); -} -#endif - - -/**********************************************************/ - -static int determinable_frame_size(AVCodecContext *avctx) -{ - if (/*avctx->codec_id == AV_CODEC_ID_AAC ||*/ - avctx->codec_id == AV_CODEC_ID_MP1 || - avctx->codec_id == AV_CODEC_ID_MP2 || - avctx->codec_id == AV_CODEC_ID_MP3/* || - avctx->codec_id == AV_CODEC_ID_CELT*/) - return 1; - return 0; -} - -/** - * Get the number of samples of an audio frame. Return -1 on error. - */ -int ff_get_audio_frame_size(AVCodecContext *enc, int size, int mux) -{ - int frame_size; - - /* give frame_size priority if demuxing */ - if (!mux && enc->frame_size > 1) - return enc->frame_size; - - if ((frame_size = av_get_audio_frame_duration(enc, size)) > 0) - return frame_size; - - /* Fall back on using frame_size if muxing. */ - if (enc->frame_size > 1) - return enc->frame_size; - - //For WMA we currently have no other means to calculate duration thus we - //do it here by assuming CBR, which is true for all known cases. - if (!mux && enc->bit_rate>0 && size>0 && enc->sample_rate>0 && enc->block_align>1) { - if (enc->codec_id == AV_CODEC_ID_WMAV1 || enc->codec_id == AV_CODEC_ID_WMAV2) - return ((int64_t)size * 8 * enc->sample_rate) / enc->bit_rate; - } - - return -1; -} - -/** - * Return the frame duration in seconds. Return 0 if not available. - */ -void ff_compute_frame_duration(int *pnum, int *pden, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt) -{ - int frame_size; - - *pnum = 0; - *pden = 0; - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - if (st->r_frame_rate.num && !pc) { - *pnum = st->r_frame_rate.den; - *pden = st->r_frame_rate.num; - } else if (st->time_base.num * 1000LL > st->time_base.den) { - *pnum = st->time_base.num; - *pden = st->time_base.den; - } else if (st->codec->time_base.num * 1000LL > st->codec->time_base.den) { - *pnum = st->codec->time_base.num; - *pden = st->codec->time_base.den; - if (pc && pc->repeat_pict) { - if (*pnum > INT_MAX / (1 + pc->repeat_pict)) - *pden /= 1 + pc->repeat_pict; - else - *pnum *= 1 + pc->repeat_pict; - } - /* If this codec can be interlaced or progressive then we need - * a parser to compute duration of a packet. Thus if we have - * no parser in such case leave duration undefined. */ - if (st->codec->ticks_per_frame > 1 && !pc) - *pnum = *pden = 0; - } - break; - case AVMEDIA_TYPE_AUDIO: - frame_size = ff_get_audio_frame_size(st->codec, pkt->size, 0); - if (frame_size <= 0 || st->codec->sample_rate <= 0) - break; - *pnum = frame_size; - *pden = st->codec->sample_rate; - break; - default: - break; - } -} - -static int is_intra_only(AVCodecContext *enc) { - const AVCodecDescriptor *desc; - - if (enc->codec_type != AVMEDIA_TYPE_VIDEO) - return 1; - - desc = av_codec_get_codec_descriptor(enc); - if (!desc) { - desc = avcodec_descriptor_get(enc->codec_id); - av_codec_set_codec_descriptor(enc, desc); - } - if (desc) - return !!(desc->props & AV_CODEC_PROP_INTRA_ONLY); - return 0; -} - -static int has_decode_delay_been_guessed(AVStream *st) -{ - if (st->codec->codec_id != AV_CODEC_ID_H264) return 1; - if (!st->info) // if we have left find_stream_info then nb_decoded_frames won't increase anymore for stream copy - return 1; -#if CONFIG_H264_DECODER - if (st->codec->has_b_frames && - avpriv_h264_has_num_reorder_frames(st->codec) == st->codec->has_b_frames) - return 1; -#endif - if (st->codec->has_b_frames<3) - return st->nb_decoded_frames >= 7; - else if (st->codec->has_b_frames<4) - return st->nb_decoded_frames >= 18; - else - return st->nb_decoded_frames >= 20; -} - -static AVPacketList *get_next_pkt(AVFormatContext *s, AVStream *st, AVPacketList *pktl) -{ - if (pktl->next) - return pktl->next; - if (pktl == s->packet_buffer_end) - return s->parse_queue; - return NULL; -} - -static int64_t select_from_pts_buffer(AVStream *st, int64_t *pts_buffer, int64_t dts) { - int onein_oneout = st->codec->codec_id != AV_CODEC_ID_H264 && - st->codec->codec_id != AV_CODEC_ID_HEVC; - - if(!onein_oneout) { - int delay = st->codec->has_b_frames; - int i; - - if (dts == AV_NOPTS_VALUE) { - int64_t best_score = INT64_MAX; - for (i = 0; ipts_reorder_error_count[i]) { - int64_t score = st->pts_reorder_error[i] / st->pts_reorder_error_count[i]; - if (score < best_score) { - best_score = score; - dts = pts_buffer[i]; - } - } - } - } else { - for (i = 0; ipts_reorder_error[i]; - diff = FFMAX(diff, st->pts_reorder_error[i]); - st->pts_reorder_error[i] = diff; - st->pts_reorder_error_count[i]++; - if (st->pts_reorder_error_count[i] > 250) { - st->pts_reorder_error[i] >>= 1; - st->pts_reorder_error_count[i] >>= 1; - } - } - } - } - } - - if (dts == AV_NOPTS_VALUE) - dts = pts_buffer[0]; - - return dts; -} - -static void update_initial_timestamps(AVFormatContext *s, int stream_index, - int64_t dts, int64_t pts, AVPacket *pkt) -{ - AVStream *st = s->streams[stream_index]; - AVPacketList *pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue; - int64_t pts_buffer[MAX_REORDER_DELAY+1]; - int64_t shift; - int i, delay; - - if (st->first_dts != AV_NOPTS_VALUE || - dts == AV_NOPTS_VALUE || - st->cur_dts == AV_NOPTS_VALUE || - is_relative(dts)) - return; - - delay = st->codec->has_b_frames; - st->first_dts = dts - (st->cur_dts - RELATIVE_TS_BASE); - st->cur_dts = dts; - shift = st->first_dts - RELATIVE_TS_BASE; - - for (i = 0; ipkt.stream_index != stream_index) - continue; - if (is_relative(pktl->pkt.pts)) - pktl->pkt.pts += shift; - - if (is_relative(pktl->pkt.dts)) - pktl->pkt.dts += shift; - - if (st->start_time == AV_NOPTS_VALUE && pktl->pkt.pts != AV_NOPTS_VALUE) - st->start_time = pktl->pkt.pts; - - if (pktl->pkt.pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) { - pts_buffer[0] = pktl->pkt.pts; - for (i = 0; i pts_buffer[i + 1]; i++) - FFSWAP(int64_t, pts_buffer[i], pts_buffer[i + 1]); - - pktl->pkt.dts = select_from_pts_buffer(st, pts_buffer, pktl->pkt.dts); - } - } - - if (st->start_time == AV_NOPTS_VALUE) - st->start_time = pts; -} - -static void update_initial_durations(AVFormatContext *s, AVStream *st, - int stream_index, int duration) -{ - AVPacketList *pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue; - int64_t cur_dts = RELATIVE_TS_BASE; - - if (st->first_dts != AV_NOPTS_VALUE) { - if (st->update_initial_durations_done) - return; - st->update_initial_durations_done = 1; - cur_dts = st->first_dts; - for (; pktl; pktl = get_next_pkt(s, st, pktl)) { - if (pktl->pkt.stream_index == stream_index) { - if (pktl->pkt.pts != pktl->pkt.dts || - pktl->pkt.dts != AV_NOPTS_VALUE || - pktl->pkt.duration) - break; - cur_dts -= duration; - } - } - if (pktl && pktl->pkt.dts != st->first_dts) { - av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %d) in the queue\n", - av_ts2str(st->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.duration); - return; - } - if (!pktl) { - av_log(s, AV_LOG_DEBUG, "first_dts %s but no packet with dts in the queue\n", av_ts2str(st->first_dts)); - return; - } - pktl = s->packet_buffer ? s->packet_buffer : s->parse_queue; - st->first_dts = cur_dts; - } else if (st->cur_dts != RELATIVE_TS_BASE) - return; - - for (; pktl; pktl = get_next_pkt(s, st, pktl)) { - if (pktl->pkt.stream_index != stream_index) - continue; - if (pktl->pkt.pts == pktl->pkt.dts && - (pktl->pkt.dts == AV_NOPTS_VALUE || pktl->pkt.dts == st->first_dts) && - !pktl->pkt.duration) { - pktl->pkt.dts = cur_dts; - if (!st->codec->has_b_frames) - pktl->pkt.pts = cur_dts; -// if (st->codec->codec_type != AVMEDIA_TYPE_AUDIO) - pktl->pkt.duration = duration; - } else - break; - cur_dts = pktl->pkt.dts + pktl->pkt.duration; - } - if (!pktl) - st->cur_dts = cur_dts; -} - -static void compute_pkt_fields(AVFormatContext *s, AVStream *st, - AVCodecParserContext *pc, AVPacket *pkt) -{ - int num, den, presentation_delayed, delay, i; - int64_t offset; - AVRational duration; - int onein_oneout = st->codec->codec_id != AV_CODEC_ID_H264 && - st->codec->codec_id != AV_CODEC_ID_HEVC; - - if (s->flags & AVFMT_FLAG_NOFILLIN) - return; - - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && pkt->dts != AV_NOPTS_VALUE) { - if (pkt->dts == pkt->pts && st->last_dts_for_order_check != AV_NOPTS_VALUE) { - if (st->last_dts_for_order_check <= pkt->dts) { - st->dts_ordered++; - } else { - av_log(s, st->dts_misordered ? AV_LOG_DEBUG : AV_LOG_WARNING, - "DTS %"PRIi64" < %"PRIi64" out of order\n", - pkt->dts, - st->last_dts_for_order_check); - st->dts_misordered++; - } - if (st->dts_ordered + st->dts_misordered > 250) { - st->dts_ordered >>= 1; - st->dts_misordered >>= 1; - } - } - - st->last_dts_for_order_check = pkt->dts; - if (st->dts_ordered < 8*st->dts_misordered && pkt->dts == pkt->pts) - pkt->dts = AV_NOPTS_VALUE; - } - - if ((s->flags & AVFMT_FLAG_IGNDTS) && pkt->pts != AV_NOPTS_VALUE) - pkt->dts = AV_NOPTS_VALUE; - - if (pc && pc->pict_type == AV_PICTURE_TYPE_B - && !st->codec->has_b_frames) - //FIXME Set low_delay = 0 when has_b_frames = 1 - st->codec->has_b_frames = 1; - - /* do we have a video B-frame ? */ - delay = st->codec->has_b_frames; - presentation_delayed = 0; - - /* XXX: need has_b_frame, but cannot get it if the codec is - * not initialized */ - if (delay && - pc && pc->pict_type != AV_PICTURE_TYPE_B) - presentation_delayed = 1; - - if (pkt->pts != AV_NOPTS_VALUE && pkt->dts != AV_NOPTS_VALUE && - st->pts_wrap_bits < 63 && - pkt->dts - (1LL << (st->pts_wrap_bits - 1)) > pkt->pts) { - if (is_relative(st->cur_dts) || pkt->dts - (1LL<<(st->pts_wrap_bits - 1)) > st->cur_dts) { - pkt->dts -= 1LL << st->pts_wrap_bits; - } else - pkt->pts += 1LL << st->pts_wrap_bits; - } - - /* Some MPEG-2 in MPEG-PS lack dts (issue #171 / input_file.mpg). - * We take the conservative approach and discard both. - * Note: If this is misbehaving for an H.264 file, then possibly - * presentation_delayed is not set correctly. */ - if (delay == 1 && pkt->dts == pkt->pts && - pkt->dts != AV_NOPTS_VALUE && presentation_delayed) { - av_log(s, AV_LOG_DEBUG, "invalid dts/pts combination %"PRIi64"\n", pkt->dts); - if ( strcmp(s->iformat->name, "mov,mp4,m4a,3gp,3g2,mj2") - && strcmp(s->iformat->name, "flv")) // otherwise we discard correct timestamps for vc1-wmapro.ism - pkt->dts = AV_NOPTS_VALUE; - } - - duration = av_mul_q((AVRational) {pkt->duration, 1}, st->time_base); - if (pkt->duration == 0) { - ff_compute_frame_duration(&num, &den, st, pc, pkt); - if (den && num) { - duration = (AVRational) {num, den}; - pkt->duration = av_rescale_rnd(1, - num * (int64_t) st->time_base.den, - den * (int64_t) st->time_base.num, - AV_ROUND_DOWN); - } - } - - if (pkt->duration != 0 && (s->packet_buffer || s->parse_queue)) - update_initial_durations(s, st, pkt->stream_index, pkt->duration); - - /* Correct timestamps with byte offset if demuxers only have timestamps - * on packet boundaries */ - if (pc && st->need_parsing == AVSTREAM_PARSE_TIMESTAMPS && pkt->size) { - /* this will estimate bitrate based on this frame's duration and size */ - offset = av_rescale(pc->offset, pkt->duration, pkt->size); - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts += offset; - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts += offset; - } - - /* This may be redundant, but it should not hurt. */ - if (pkt->dts != AV_NOPTS_VALUE && - pkt->pts != AV_NOPTS_VALUE && - pkt->pts > pkt->dts) - presentation_delayed = 1; - - av_dlog(NULL, - "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d\n", - presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), - pkt->stream_index, pc, pkt->duration); - /* Interpolate PTS and DTS if they are not present. We skip H264 - * currently because delay and has_b_frames are not reliably set. */ - if ((delay == 0 || (delay == 1 && pc)) && - onein_oneout) { - if (presentation_delayed) { - /* DTS = decompression timestamp */ - /* PTS = presentation timestamp */ - if (pkt->dts == AV_NOPTS_VALUE) - pkt->dts = st->last_IP_pts; - update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts, pkt); - if (pkt->dts == AV_NOPTS_VALUE) - pkt->dts = st->cur_dts; - - /* This is tricky: the dts must be incremented by the duration - * of the frame we are displaying, i.e. the last I- or P-frame. */ - if (st->last_IP_duration == 0) - st->last_IP_duration = pkt->duration; - if (pkt->dts != AV_NOPTS_VALUE) - st->cur_dts = pkt->dts + st->last_IP_duration; - st->last_IP_duration = pkt->duration; - st->last_IP_pts = pkt->pts; - /* Cannot compute PTS if not present (we can compute it only - * by knowing the future. */ - } else if (pkt->pts != AV_NOPTS_VALUE || - pkt->dts != AV_NOPTS_VALUE || - pkt->duration ) { - - /* presentation is not delayed : PTS and DTS are the same */ - if (pkt->pts == AV_NOPTS_VALUE) - pkt->pts = pkt->dts; - update_initial_timestamps(s, pkt->stream_index, pkt->pts, - pkt->pts, pkt); - if (pkt->pts == AV_NOPTS_VALUE) - pkt->pts = st->cur_dts; - pkt->dts = pkt->pts; - if (pkt->pts != AV_NOPTS_VALUE) - st->cur_dts = av_add_stable(st->time_base, pkt->pts, duration, 1); - } - } - - if (pkt->pts != AV_NOPTS_VALUE && delay <= MAX_REORDER_DELAY && has_decode_delay_been_guessed(st)) { - st->pts_buffer[0] = pkt->pts; - for (i = 0; ipts_buffer[i] > st->pts_buffer[i + 1]; i++) - FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i + 1]); - - pkt->dts = select_from_pts_buffer(st, st->pts_buffer, pkt->dts); - } - // We skipped it above so we try here. - if (!onein_oneout) - // This should happen on the first packet - update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts, pkt); - if (pkt->dts > st->cur_dts) - st->cur_dts = pkt->dts; - - av_dlog(NULL, "OUTdelayed:%d/%d pts:%s, dts:%s cur_dts:%s\n", - presentation_delayed, delay, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts)); - - /* update flags */ - if (is_intra_only(st->codec)) - pkt->flags |= AV_PKT_FLAG_KEY; - if (pc) - pkt->convergence_duration = pc->convergence_duration; -} - -static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) -{ - while (*pkt_buf) { - AVPacketList *pktl = *pkt_buf; - *pkt_buf = pktl->next; - av_free_packet(&pktl->pkt); - av_freep(&pktl); - } - *pkt_buf_end = NULL; -} - -/** - * Parse a packet, add all split parts to parse_queue. - * - * @param pkt Packet to parse, NULL when flushing the parser at end of stream. - */ -static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index) -{ - AVPacket out_pkt = { 0 }, flush_pkt = { 0 }; - AVStream *st = s->streams[stream_index]; - uint8_t *data = pkt ? pkt->data : NULL; - int size = pkt ? pkt->size : 0; - int ret = 0, got_output = 0; - - if (!pkt) { - av_init_packet(&flush_pkt); - pkt = &flush_pkt; - got_output = 1; - } else if (!size && st->parser->flags & PARSER_FLAG_COMPLETE_FRAMES) { - // preserve 0-size sync packets - compute_pkt_fields(s, st, st->parser, pkt); - } - - while (size > 0 || (pkt == &flush_pkt && got_output)) { - int len; - - av_init_packet(&out_pkt); - len = av_parser_parse2(st->parser, st->codec, - &out_pkt.data, &out_pkt.size, data, size, - pkt->pts, pkt->dts, pkt->pos); - - pkt->pts = pkt->dts = AV_NOPTS_VALUE; - pkt->pos = -1; - /* increment read pointer */ - data += len; - size -= len; - - got_output = !!out_pkt.size; - - if (!out_pkt.size) - continue; - - if (pkt->side_data) { - out_pkt.side_data = pkt->side_data; - out_pkt.side_data_elems = pkt->side_data_elems; - pkt->side_data = NULL; - pkt->side_data_elems = 0; - } - - /* set the duration */ - out_pkt.duration = 0; - if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - if (st->codec->sample_rate > 0) { - out_pkt.duration = - av_rescale_q_rnd(st->parser->duration, - (AVRational) { 1, st->codec->sample_rate }, - st->time_base, - AV_ROUND_DOWN); - } - } else if (st->codec->time_base.num != 0 && - st->codec->time_base.den != 0) { - out_pkt.duration = av_rescale_q_rnd(st->parser->duration, - st->codec->time_base, - st->time_base, - AV_ROUND_DOWN); - } - - out_pkt.stream_index = st->index; - out_pkt.pts = st->parser->pts; - out_pkt.dts = st->parser->dts; - out_pkt.pos = st->parser->pos; - - if (st->need_parsing == AVSTREAM_PARSE_FULL_RAW) - out_pkt.pos = st->parser->frame_offset; - - if (st->parser->key_frame == 1 || - (st->parser->key_frame == -1 && - st->parser->pict_type == AV_PICTURE_TYPE_I)) - out_pkt.flags |= AV_PKT_FLAG_KEY; - - if (st->parser->key_frame == -1 && st->parser->pict_type ==AV_PICTURE_TYPE_NONE && (pkt->flags&AV_PKT_FLAG_KEY)) - out_pkt.flags |= AV_PKT_FLAG_KEY; - - compute_pkt_fields(s, st, st->parser, &out_pkt); - - if (out_pkt.data == pkt->data && out_pkt.size == pkt->size) { - out_pkt.buf = pkt->buf; - pkt->buf = NULL; -#if FF_API_DESTRUCT_PACKET -FF_DISABLE_DEPRECATION_WARNINGS - out_pkt.destruct = pkt->destruct; - pkt->destruct = NULL; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - } - if ((ret = av_dup_packet(&out_pkt)) < 0) - goto fail; - - if (!add_to_pktbuf(&s->parse_queue, &out_pkt, &s->parse_queue_end)) { - av_free_packet(&out_pkt); - ret = AVERROR(ENOMEM); - goto fail; - } - } - - /* end of the stream => close and free the parser */ - if (pkt == &flush_pkt) { - av_parser_close(st->parser); - st->parser = NULL; - } - -fail: - av_free_packet(pkt); - return ret; -} - -static int read_from_packet_buffer(AVPacketList **pkt_buffer, - AVPacketList **pkt_buffer_end, - AVPacket *pkt) -{ - AVPacketList *pktl; - av_assert0(*pkt_buffer); - pktl = *pkt_buffer; - *pkt = pktl->pkt; - *pkt_buffer = pktl->next; - if (!pktl->next) - *pkt_buffer_end = NULL; - av_freep(&pktl); - return 0; -} - -static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) -{ - int ret = 0, i, got_packet = 0; - - av_init_packet(pkt); - - while (!got_packet && !s->parse_queue) { - AVStream *st; - AVPacket cur_pkt; - - /* read next packet */ - ret = ff_read_packet(s, &cur_pkt); - if (ret < 0) { - if (ret == AVERROR(EAGAIN)) - return ret; - /* flush the parsers */ - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - if (st->parser && st->need_parsing) - parse_packet(s, NULL, st->index); - } - /* all remaining packets are now in parse_queue => - * really terminate parsing */ - break; - } - ret = 0; - st = s->streams[cur_pkt.stream_index]; - - if (cur_pkt.pts != AV_NOPTS_VALUE && - cur_pkt.dts != AV_NOPTS_VALUE && - cur_pkt.pts < cur_pkt.dts) { - av_log(s, AV_LOG_WARNING, - "Invalid timestamps stream=%d, pts=%s, dts=%s, size=%d\n", - cur_pkt.stream_index, - av_ts2str(cur_pkt.pts), - av_ts2str(cur_pkt.dts), - cur_pkt.size); - } - if (s->debug & FF_FDEBUG_TS) - av_log(s, AV_LOG_DEBUG, - "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n", - cur_pkt.stream_index, - av_ts2str(cur_pkt.pts), - av_ts2str(cur_pkt.dts), - cur_pkt.size, cur_pkt.duration, cur_pkt.flags); - - if (st->need_parsing && !st->parser && !(s->flags & AVFMT_FLAG_NOPARSE)) { - st->parser = av_parser_init(st->codec->codec_id); - if (!st->parser) { - av_log(s, AV_LOG_VERBOSE, "parser not found for codec " - "%s, packets or times may be invalid.\n", - avcodec_get_name(st->codec->codec_id)); - /* no parser available: just output the raw packets */ - st->need_parsing = AVSTREAM_PARSE_NONE; - } else if (st->need_parsing == AVSTREAM_PARSE_HEADERS) - st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; - else if (st->need_parsing == AVSTREAM_PARSE_FULL_ONCE) - st->parser->flags |= PARSER_FLAG_ONCE; - else if (st->need_parsing == AVSTREAM_PARSE_FULL_RAW) - st->parser->flags |= PARSER_FLAG_USE_CODEC_TS; - } - - if (!st->need_parsing || !st->parser) { - /* no parsing needed: we just output the packet as is */ - *pkt = cur_pkt; - compute_pkt_fields(s, st, NULL, pkt); - if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && - (pkt->flags & AV_PKT_FLAG_KEY) && pkt->dts != AV_NOPTS_VALUE) { - ff_reduce_index(s, st->index); - av_add_index_entry(st, pkt->pos, pkt->dts, - 0, 0, AVINDEX_KEYFRAME); - } - got_packet = 1; - } else if (st->discard < AVDISCARD_ALL) { - if ((ret = parse_packet(s, &cur_pkt, cur_pkt.stream_index)) < 0) - return ret; - } else { - /* free packet */ - av_free_packet(&cur_pkt); - } - if (pkt->flags & AV_PKT_FLAG_KEY) - st->skip_to_keyframe = 0; - if (st->skip_to_keyframe) { - av_free_packet(&cur_pkt); - if (got_packet) { - *pkt = cur_pkt; - } - got_packet = 0; - } - } - - if (!got_packet && s->parse_queue) - ret = read_from_packet_buffer(&s->parse_queue, &s->parse_queue_end, pkt); - - if (ret >= 0) { - AVStream *st = s->streams[pkt->stream_index]; - if (st->skip_samples) { - uint8_t *p = av_packet_new_side_data(pkt, AV_PKT_DATA_SKIP_SAMPLES, 10); - if (p) { - AV_WL32(p, st->skip_samples); - av_log(s, AV_LOG_DEBUG, "demuxer injecting skip %d\n", st->skip_samples); - } - st->skip_samples = 0; - } - } - - if (ret >= 0 && !(s->flags & AVFMT_FLAG_KEEP_SIDE_DATA)) - av_packet_merge_side_data(pkt); - - if (s->debug & FF_FDEBUG_TS) - av_log(s, AV_LOG_DEBUG, - "read_frame_internal stream=%d, pts=%s, dts=%s, " - "size=%d, duration=%d, flags=%d\n", - pkt->stream_index, - av_ts2str(pkt->pts), - av_ts2str(pkt->dts), - pkt->size, pkt->duration, pkt->flags); - - return ret; -} - -int av_read_frame(AVFormatContext *s, AVPacket *pkt) -{ - const int genpts = s->flags & AVFMT_FLAG_GENPTS; - int eof = 0; - int ret; - AVStream *st; - - if (!genpts) { - ret = s->packet_buffer - ? read_from_packet_buffer(&s->packet_buffer, - &s->packet_buffer_end, pkt) - : read_frame_internal(s, pkt); - if (ret < 0) - return ret; - goto return_packet; - } - - for (;;) { - AVPacketList *pktl = s->packet_buffer; - - if (pktl) { - AVPacket *next_pkt = &pktl->pkt; - - if (next_pkt->dts != AV_NOPTS_VALUE) { - int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits; - // last dts seen for this stream. if any of packets following - // current one had no dts, we will set this to AV_NOPTS_VALUE. - int64_t last_dts = next_pkt->dts; - while (pktl && next_pkt->pts == AV_NOPTS_VALUE) { - if (pktl->pkt.stream_index == next_pkt->stream_index && - (av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)) < 0)) { - if (av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { - // not B-frame - next_pkt->pts = pktl->pkt.dts; - } - if (last_dts != AV_NOPTS_VALUE) { - // Once last dts was set to AV_NOPTS_VALUE, we don't change it. - last_dts = pktl->pkt.dts; - } - } - pktl = pktl->next; - } - if (eof && next_pkt->pts == AV_NOPTS_VALUE && last_dts != AV_NOPTS_VALUE) { - // Fixing the last reference frame had none pts issue (For MXF etc). - // We only do this when - // 1. eof. - // 2. we are not able to resolve a pts value for current packet. - // 3. the packets for this stream at the end of the files had valid dts. - next_pkt->pts = last_dts + next_pkt->duration; - } - pktl = s->packet_buffer; - } - - /* read packet from packet buffer, if there is data */ - if (!(next_pkt->pts == AV_NOPTS_VALUE && - next_pkt->dts != AV_NOPTS_VALUE && !eof)) { - ret = read_from_packet_buffer(&s->packet_buffer, - &s->packet_buffer_end, pkt); - goto return_packet; - } - } - - ret = read_frame_internal(s, pkt); - if (ret < 0) { - if (pktl && ret != AVERROR(EAGAIN)) { - eof = 1; - continue; - } else - return ret; - } - - if (av_dup_packet(add_to_pktbuf(&s->packet_buffer, pkt, - &s->packet_buffer_end)) < 0) - return AVERROR(ENOMEM); - } - -return_packet: - - st = s->streams[pkt->stream_index]; - if ((s->iformat->flags & AVFMT_GENERIC_INDEX) && pkt->flags & AV_PKT_FLAG_KEY) { - ff_reduce_index(s, st->index); - av_add_index_entry(st, pkt->pos, pkt->dts, 0, 0, AVINDEX_KEYFRAME); - } - - if (is_relative(pkt->dts)) - pkt->dts -= RELATIVE_TS_BASE; - if (is_relative(pkt->pts)) - pkt->pts -= RELATIVE_TS_BASE; - - return ret; -} - -/* XXX: suppress the packet queue */ -static void flush_packet_queue(AVFormatContext *s) -{ - free_packet_buffer(&s->parse_queue, &s->parse_queue_end); - free_packet_buffer(&s->packet_buffer, &s->packet_buffer_end); - free_packet_buffer(&s->raw_packet_buffer, &s->raw_packet_buffer_end); - - s->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; -} - -/*******************************************************/ -/* seek support */ - -int av_find_default_stream_index(AVFormatContext *s) -{ - int first_audio_index = -1; - int i; - AVStream *st; - - if (s->nb_streams <= 0) - return -1; - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && - !(st->disposition & AV_DISPOSITION_ATTACHED_PIC)) { - return i; - } - if (first_audio_index < 0 && - st->codec->codec_type == AVMEDIA_TYPE_AUDIO) - first_audio_index = i; - } - return first_audio_index >= 0 ? first_audio_index : 0; -} - -/** Flush the frame reader. */ -void ff_read_frame_flush(AVFormatContext *s) -{ - AVStream *st; - int i, j; - - flush_packet_queue(s); - - /* Reset read state for each stream. */ - for (i = 0; i < s->nb_streams; i++) { - st = s->streams[i]; - - if (st->parser) { - av_parser_close(st->parser); - st->parser = NULL; - } - st->last_IP_pts = AV_NOPTS_VALUE; - st->last_dts_for_order_check = AV_NOPTS_VALUE; - if (st->first_dts == AV_NOPTS_VALUE) - st->cur_dts = RELATIVE_TS_BASE; - else - /* We set the current DTS to an unspecified origin. */ - st->cur_dts = AV_NOPTS_VALUE; - - st->probe_packets = MAX_PROBE_PACKETS; - - for (j = 0; j < MAX_REORDER_DELAY + 1; j++) - st->pts_buffer[j] = AV_NOPTS_VALUE; - } -} - -void ff_update_cur_dts(AVFormatContext *s, AVStream *ref_st, int64_t timestamp) -{ - int i; - - for (i = 0; i < s->nb_streams; i++) { - AVStream *st = s->streams[i]; - - st->cur_dts = - av_rescale(timestamp, - st->time_base.den * (int64_t) ref_st->time_base.num, - st->time_base.num * (int64_t) ref_st->time_base.den); - } -} - -void ff_reduce_index(AVFormatContext *s, int stream_index) -{ - AVStream *st = s->streams[stream_index]; - unsigned int max_entries = s->max_index_size / sizeof(AVIndexEntry); - - if ((unsigned) st->nb_index_entries >= max_entries) { - int i; - for (i = 0; 2 * i < st->nb_index_entries; i++) - st->index_entries[i] = st->index_entries[2 * i]; - st->nb_index_entries = i; - } -} - -int ff_add_index_entry(AVIndexEntry **index_entries, - int *nb_index_entries, - unsigned int *index_entries_allocated_size, - int64_t pos, int64_t timestamp, - int size, int distance, int flags) -{ - AVIndexEntry *entries, *ie; - int index; - - if ((unsigned) *nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) - return -1; - - if (timestamp == AV_NOPTS_VALUE) - return AVERROR(EINVAL); - - if (size < 0 || size > 0x3FFFFFFF) - return AVERROR(EINVAL); - - if (is_relative(timestamp)) //FIXME this maintains previous behavior but we should shift by the correct offset once known - timestamp -= RELATIVE_TS_BASE; - - entries = av_fast_realloc(*index_entries, - index_entries_allocated_size, - (*nb_index_entries + 1) * - sizeof(AVIndexEntry)); - if (!entries) - return -1; - - *index_entries = entries; - - index = ff_index_search_timestamp(*index_entries, *nb_index_entries, - timestamp, AVSEEK_FLAG_ANY); - - if (index < 0) { - index = (*nb_index_entries)++; - ie = &entries[index]; - av_assert0(index == 0 || ie[-1].timestamp < timestamp); - } else { - ie = &entries[index]; - if (ie->timestamp != timestamp) { - if (ie->timestamp <= timestamp) - return -1; - memmove(entries + index + 1, entries + index, - sizeof(AVIndexEntry) * (*nb_index_entries - index)); - (*nb_index_entries)++; - } else if (ie->pos == pos && distance < ie->min_distance) - // do not reduce the distance - distance = ie->min_distance; - } - - ie->pos = pos; - ie->timestamp = timestamp; - ie->min_distance = distance; - ie->size = size; - ie->flags = flags; - - return index; -} - -int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, - int size, int distance, int flags) -{ - timestamp = wrap_timestamp(st, timestamp); - return ff_add_index_entry(&st->index_entries, &st->nb_index_entries, - &st->index_entries_allocated_size, pos, - timestamp, size, distance, flags); -} - -int ff_index_search_timestamp(const AVIndexEntry *entries, int nb_entries, - int64_t wanted_timestamp, int flags) -{ - int a, b, m; - int64_t timestamp; - - a = -1; - b = nb_entries; - - // Optimize appending index entries at the end. - if (b && entries[b - 1].timestamp < wanted_timestamp) - a = b - 1; - - while (b - a > 1) { - m = (a + b) >> 1; - timestamp = entries[m].timestamp; - if (timestamp >= wanted_timestamp) - b = m; - if (timestamp <= wanted_timestamp) - a = m; - } - m = (flags & AVSEEK_FLAG_BACKWARD) ? a : b; - - if (!(flags & AVSEEK_FLAG_ANY)) - while (m >= 0 && m < nb_entries && - !(entries[m].flags & AVINDEX_KEYFRAME)) - m += (flags & AVSEEK_FLAG_BACKWARD) ? -1 : 1; - - if (m == nb_entries) - return -1; - return m; -} - -int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, int flags) -{ - return ff_index_search_timestamp(st->index_entries, st->nb_index_entries, - wanted_timestamp, flags); -} - -static int64_t ff_read_timestamp(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit, - int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )) -{ - int64_t ts = read_timestamp(s, stream_index, ppos, pos_limit); - if (stream_index >= 0) - ts = wrap_timestamp(s->streams[stream_index], ts); - return ts; -} - -int ff_seek_frame_binary(AVFormatContext *s, int stream_index, - int64_t target_ts, int flags) -{ - AVInputFormat *avif = s->iformat; - int64_t av_uninit(pos_min), av_uninit(pos_max), pos, pos_limit; - int64_t ts_min, ts_max, ts; - int index; - int64_t ret; - AVStream *st; - - if (stream_index < 0) - return -1; - - av_dlog(s, "read_seek: %d %s\n", stream_index, av_ts2str(target_ts)); - - ts_max = - ts_min = AV_NOPTS_VALUE; - pos_limit = -1; // GCC falsely says it may be uninitialized. - - st = s->streams[stream_index]; - if (st->index_entries) { - AVIndexEntry *e; - - /* FIXME: Whole function must be checked for non-keyframe entries in - * index case, especially read_timestamp(). */ - index = av_index_search_timestamp(st, target_ts, - flags | AVSEEK_FLAG_BACKWARD); - index = FFMAX(index, 0); - e = &st->index_entries[index]; - - if (e->timestamp <= target_ts || e->pos == e->min_distance) { - pos_min = e->pos; - ts_min = e->timestamp; - av_dlog(s, "using cached pos_min=0x%"PRIx64" dts_min=%s\n", - pos_min, av_ts2str(ts_min)); - } else { - av_assert1(index == 0); - } - - index = av_index_search_timestamp(st, target_ts, - flags & ~AVSEEK_FLAG_BACKWARD); - av_assert0(index < st->nb_index_entries); - if (index >= 0) { - e = &st->index_entries[index]; - av_assert1(e->timestamp >= target_ts); - pos_max = e->pos; - ts_max = e->timestamp; - pos_limit = pos_max - e->min_distance; - av_dlog(s, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64 - " dts_max=%s\n", pos_max, pos_limit, av_ts2str(ts_max)); - } - } - - pos = ff_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, - ts_min, ts_max, flags, &ts, avif->read_timestamp); - if (pos < 0) - return -1; - - /* do the seek */ - if ((ret = avio_seek(s->pb, pos, SEEK_SET)) < 0) - return ret; - - ff_read_frame_flush(s); - ff_update_cur_dts(s, st, ts); - - return 0; -} - -int ff_find_last_ts(AVFormatContext *s, int stream_index, int64_t *ts, int64_t *pos, - int64_t (*read_timestamp)(struct AVFormatContext *, int , int64_t *, int64_t )) -{ - int64_t step = 1024; - int64_t limit, ts_max; - int64_t filesize = avio_size(s->pb); - int64_t pos_max = filesize - 1; - do { - limit = pos_max; - pos_max = FFMAX(0, (pos_max) - step); - ts_max = ff_read_timestamp(s, stream_index, - &pos_max, limit, read_timestamp); - step += step; - } while (ts_max == AV_NOPTS_VALUE && 2*limit > step); - if (ts_max == AV_NOPTS_VALUE) - return -1; - - for (;;) { - int64_t tmp_pos = pos_max + 1; - int64_t tmp_ts = ff_read_timestamp(s, stream_index, - &tmp_pos, INT64_MAX, read_timestamp); - if (tmp_ts == AV_NOPTS_VALUE) - break; - av_assert0(tmp_pos > pos_max); - ts_max = tmp_ts; - pos_max = tmp_pos; - if (tmp_pos >= filesize) - break; - } - - if (ts) - *ts = ts_max; - if (pos) - *pos = pos_max; - - return 0; -} - -int64_t ff_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, - int64_t pos_min, int64_t pos_max, int64_t pos_limit, - int64_t ts_min, int64_t ts_max, - int flags, int64_t *ts_ret, - int64_t (*read_timestamp)(struct AVFormatContext *, int, - int64_t *, int64_t)) -{ - int64_t pos, ts; - int64_t start_pos; - int no_change; - int ret; - - av_dlog(s, "gen_seek: %d %s\n", stream_index, av_ts2str(target_ts)); - - if (ts_min == AV_NOPTS_VALUE) { - pos_min = s->data_offset; - ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); - if (ts_min == AV_NOPTS_VALUE) - return -1; - } - - if (ts_min >= target_ts) { - *ts_ret = ts_min; - return pos_min; - } - - if (ts_max == AV_NOPTS_VALUE) { - if ((ret = ff_find_last_ts(s, stream_index, &ts_max, &pos_max, read_timestamp)) < 0) - return ret; - pos_limit = pos_max; - } - - if (ts_max <= target_ts) { - *ts_ret = ts_max; - return pos_max; - } - - if (ts_min > ts_max) - return -1; - else if (ts_min == ts_max) - pos_limit = pos_min; - - no_change = 0; - while (pos_min < pos_limit) { - av_dlog(s, - "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%s dts_max=%s\n", - pos_min, pos_max, av_ts2str(ts_min), av_ts2str(ts_max)); - assert(pos_limit <= pos_max); - - if (no_change == 0) { - int64_t approximate_keyframe_distance = pos_max - pos_limit; - // interpolate position (better than dichotomy) - pos = av_rescale(target_ts - ts_min, pos_max - pos_min, - ts_max - ts_min) + - pos_min - approximate_keyframe_distance; - } else if (no_change == 1) { - // bisection if interpolation did not change min / max pos last time - pos = (pos_min + pos_limit) >> 1; - } else { - /* linear search if bisection failed, can only happen if there - * are very few or no keyframes between min/max */ - pos = pos_min; - } - if (pos <= pos_min) - pos = pos_min + 1; - else if (pos > pos_limit) - pos = pos_limit; - start_pos = pos; - - // May pass pos_limit instead of -1. - ts = ff_read_timestamp(s, stream_index, &pos, INT64_MAX, read_timestamp); - if (pos == pos_max) - no_change++; - else - no_change = 0; - av_dlog(s, "%"PRId64" %"PRId64" %"PRId64" / %s %s %s" - " target:%s limit:%"PRId64" start:%"PRId64" noc:%d\n", - pos_min, pos, pos_max, - av_ts2str(ts_min), av_ts2str(ts), av_ts2str(ts_max), av_ts2str(target_ts), - pos_limit, start_pos, no_change); - if (ts == AV_NOPTS_VALUE) { - av_log(s, AV_LOG_ERROR, "read_timestamp() failed in the middle\n"); - return -1; - } - assert(ts != AV_NOPTS_VALUE); - if (target_ts <= ts) { - pos_limit = start_pos - 1; - pos_max = pos; - ts_max = ts; - } - if (target_ts >= ts) { - pos_min = pos; - ts_min = ts; - } - } - - pos = (flags & AVSEEK_FLAG_BACKWARD) ? pos_min : pos_max; - ts = (flags & AVSEEK_FLAG_BACKWARD) ? ts_min : ts_max; -#if 0 - pos_min = pos; - ts_min = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); - pos_min++; - ts_max = ff_read_timestamp(s, stream_index, &pos_min, INT64_MAX, read_timestamp); - av_dlog(s, "pos=0x%"PRIx64" %s<=%s<=%s\n", - pos, av_ts2str(ts_min), av_ts2str(target_ts), av_ts2str(ts_max)); -#endif - *ts_ret = ts; - return pos; -} - -static int seek_frame_byte(AVFormatContext *s, int stream_index, - int64_t pos, int flags) -{ - int64_t pos_min, pos_max; - - pos_min = s->data_offset; - pos_max = avio_size(s->pb) - 1; - - if (pos < pos_min) - pos = pos_min; - else if (pos > pos_max) - pos = pos_max; - - avio_seek(s->pb, pos, SEEK_SET); - - s->io_repositioned = 1; - - return 0; -} - -static int seek_frame_generic(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - int index; - int64_t ret; - AVStream *st; - AVIndexEntry *ie; - - st = s->streams[stream_index]; - - index = av_index_search_timestamp(st, timestamp, flags); - - if (index < 0 && st->nb_index_entries && - timestamp < st->index_entries[0].timestamp) - return -1; - - if (index < 0 || index == st->nb_index_entries - 1) { - AVPacket pkt; - int nonkey = 0; - - if (st->nb_index_entries) { - av_assert0(st->index_entries); - ie = &st->index_entries[st->nb_index_entries - 1]; - if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) - return ret; - ff_update_cur_dts(s, st, ie->timestamp); - } else { - if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0) - return ret; - } - for (;;) { - int read_status; - do { - read_status = av_read_frame(s, &pkt); - } while (read_status == AVERROR(EAGAIN)); - if (read_status < 0) - break; - av_free_packet(&pkt); - if (stream_index == pkt.stream_index && pkt.dts > timestamp) { - if (pkt.flags & AV_PKT_FLAG_KEY) - break; - if (nonkey++ > 1000 && st->codec->codec_id != AV_CODEC_ID_CDGRAPHICS) { - av_log(s, AV_LOG_ERROR,"seek_frame_generic failed as this stream seems to contain no keyframes after the target timestamp, %d non keyframes found\n", nonkey); - break; - } - } - } - index = av_index_search_timestamp(st, timestamp, flags); - } - if (index < 0) - return -1; - - ff_read_frame_flush(s); - if (s->iformat->read_seek) - if (s->iformat->read_seek(s, stream_index, timestamp, flags) >= 0) - return 0; - ie = &st->index_entries[index]; - if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) - return ret; - ff_update_cur_dts(s, st, ie->timestamp); - - return 0; -} - -static int seek_frame_internal(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - int ret; - AVStream *st; - - if (flags & AVSEEK_FLAG_BYTE) { - if (s->iformat->flags & AVFMT_NO_BYTE_SEEK) - return -1; - ff_read_frame_flush(s); - return seek_frame_byte(s, stream_index, timestamp, flags); - } - - if (stream_index < 0) { - stream_index = av_find_default_stream_index(s); - if (stream_index < 0) - return -1; - - st = s->streams[stream_index]; - /* timestamp for default must be expressed in AV_TIME_BASE units */ - timestamp = av_rescale(timestamp, st->time_base.den, - AV_TIME_BASE * (int64_t) st->time_base.num); - } - - /* first, we try the format specific seek */ - if (s->iformat->read_seek) { - ff_read_frame_flush(s); - ret = s->iformat->read_seek(s, stream_index, timestamp, flags); - } else - ret = -1; - if (ret >= 0) - return 0; - - if (s->iformat->read_timestamp && - !(s->iformat->flags & AVFMT_NOBINSEARCH)) { - ff_read_frame_flush(s); - return ff_seek_frame_binary(s, stream_index, timestamp, flags); - } else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) { - ff_read_frame_flush(s); - return seek_frame_generic(s, stream_index, timestamp, flags); - } else - return -1; -} - -int av_seek_frame(AVFormatContext *s, int stream_index, - int64_t timestamp, int flags) -{ - int ret; - - if (s->iformat->read_seek2 && !s->iformat->read_seek) { - int64_t min_ts = INT64_MIN, max_ts = INT64_MAX; - if ((flags & AVSEEK_FLAG_BACKWARD)) - max_ts = timestamp; - else - min_ts = timestamp; - return avformat_seek_file(s, stream_index, min_ts, timestamp, max_ts, - flags & ~AVSEEK_FLAG_BACKWARD); - } - - ret = seek_frame_internal(s, stream_index, timestamp, flags); - - if (ret >= 0) - ret = avformat_queue_attached_pictures(s); - - return ret; -} - -int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, - int64_t ts, int64_t max_ts, int flags) -{ - if (min_ts > ts || max_ts < ts) - return -1; - if (stream_index < -1 || stream_index >= (int)s->nb_streams) - return AVERROR(EINVAL); - - if (s->seek2any>0) - flags |= AVSEEK_FLAG_ANY; - flags &= ~AVSEEK_FLAG_BACKWARD; - - if (s->iformat->read_seek2) { - int ret; - ff_read_frame_flush(s); - - if (stream_index == -1 && s->nb_streams == 1) { - AVRational time_base = s->streams[0]->time_base; - ts = av_rescale_q(ts, AV_TIME_BASE_Q, time_base); - min_ts = av_rescale_rnd(min_ts, time_base.den, - time_base.num * (int64_t)AV_TIME_BASE, - AV_ROUND_UP | AV_ROUND_PASS_MINMAX); - max_ts = av_rescale_rnd(max_ts, time_base.den, - time_base.num * (int64_t)AV_TIME_BASE, - AV_ROUND_DOWN | AV_ROUND_PASS_MINMAX); - } - - ret = s->iformat->read_seek2(s, stream_index, min_ts, - ts, max_ts, flags); - - if (ret >= 0) - ret = avformat_queue_attached_pictures(s); - return ret; - } - - if (s->iformat->read_timestamp) { - // try to seek via read_timestamp() - } - - // Fall back on old API if new is not implemented but old is. - // Note the old API has somewhat different semantics. - if (s->iformat->read_seek || 1) { - int dir = (ts - (uint64_t)min_ts > (uint64_t)max_ts - ts ? AVSEEK_FLAG_BACKWARD : 0); - int ret = av_seek_frame(s, stream_index, ts, flags | dir); - if (ret<0 && ts != min_ts && max_ts != ts) { - ret = av_seek_frame(s, stream_index, dir ? max_ts : min_ts, flags | dir); - if (ret >= 0) - ret = av_seek_frame(s, stream_index, ts, flags | (dir^AVSEEK_FLAG_BACKWARD)); - } - return ret; - } - - // try some generic seek like seek_frame_generic() but with new ts semantics - return -1; //unreachable -} - -/*******************************************************/ - -/** - * Return TRUE if the stream has accurate duration in any stream. - * - * @return TRUE if the stream has accurate duration for at least one component. - */ -static int has_duration(AVFormatContext *ic) -{ - int i; - AVStream *st; - - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->duration != AV_NOPTS_VALUE) - return 1; - } - if (ic->duration != AV_NOPTS_VALUE) - return 1; - return 0; -} - -/** - * Estimate the stream timings from the one of each components. - * - * Also computes the global bitrate if possible. - */ -static void update_stream_timings(AVFormatContext *ic) -{ - int64_t start_time, start_time1, start_time_text, end_time, end_time1; - int64_t duration, duration1, filesize; - int i; - AVStream *st; - AVProgram *p; - - start_time = INT64_MAX; - start_time_text = INT64_MAX; - end_time = INT64_MIN; - duration = INT64_MIN; - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->start_time != AV_NOPTS_VALUE && st->time_base.den) { - start_time1 = av_rescale_q(st->start_time, st->time_base, - AV_TIME_BASE_Q); - if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codec->codec_type == AVMEDIA_TYPE_DATA) { - if (start_time1 < start_time_text) - start_time_text = start_time1; - } else - start_time = FFMIN(start_time, start_time1); - end_time1 = AV_NOPTS_VALUE; - if (st->duration != AV_NOPTS_VALUE) { - end_time1 = start_time1 + - av_rescale_q(st->duration, st->time_base, - AV_TIME_BASE_Q); - end_time = FFMAX(end_time, end_time1); - } - for (p = NULL; (p = av_find_program_from_stream(ic, p, i)); ) { - if (p->start_time == AV_NOPTS_VALUE || p->start_time > start_time1) - p->start_time = start_time1; - if (p->end_time < end_time1) - p->end_time = end_time1; - } - } - if (st->duration != AV_NOPTS_VALUE) { - duration1 = av_rescale_q(st->duration, st->time_base, - AV_TIME_BASE_Q); - duration = FFMAX(duration, duration1); - } - } - if (start_time == INT64_MAX || (start_time > start_time_text && start_time - start_time_text < AV_TIME_BASE)) - start_time = start_time_text; - else if (start_time > start_time_text) - av_log(ic, AV_LOG_VERBOSE, "Ignoring outlier non primary stream starttime %f\n", start_time_text / (float)AV_TIME_BASE); - - if (start_time != INT64_MAX) { - ic->start_time = start_time; - if (end_time != INT64_MIN) { - if (ic->nb_programs) { - for (i = 0; i < ic->nb_programs; i++) { - p = ic->programs[i]; - if (p->start_time != AV_NOPTS_VALUE && p->end_time > p->start_time) - duration = FFMAX(duration, p->end_time - p->start_time); - } - } else - duration = FFMAX(duration, end_time - start_time); - } - } - if (duration != INT64_MIN && duration > 0 && ic->duration == AV_NOPTS_VALUE) { - ic->duration = duration; - } - if (ic->pb && (filesize = avio_size(ic->pb)) > 0 && ic->duration != AV_NOPTS_VALUE) { - /* compute the bitrate */ - double bitrate = (double) filesize * 8.0 * AV_TIME_BASE / - (double) ic->duration; - if (bitrate >= 0 && bitrate <= INT_MAX) - ic->bit_rate = bitrate; - } -} - -static void fill_all_stream_timings(AVFormatContext *ic) -{ - int i; - AVStream *st; - - update_stream_timings(ic); - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->start_time == AV_NOPTS_VALUE) { - if (ic->start_time != AV_NOPTS_VALUE) - st->start_time = av_rescale_q(ic->start_time, AV_TIME_BASE_Q, - st->time_base); - if (ic->duration != AV_NOPTS_VALUE) - st->duration = av_rescale_q(ic->duration, AV_TIME_BASE_Q, - st->time_base); - } - } -} - -static void estimate_timings_from_bit_rate(AVFormatContext *ic) -{ - int64_t filesize, duration; - int i, show_warning = 0; - AVStream *st; - - /* if bit_rate is already set, we believe it */ - if (ic->bit_rate <= 0) { - int bit_rate = 0; - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->codec->bit_rate > 0) { - if (INT_MAX - st->codec->bit_rate < bit_rate) { - bit_rate = 0; - break; - } - bit_rate += st->codec->bit_rate; - } - } - ic->bit_rate = bit_rate; - } - - /* if duration is already set, we believe it */ - if (ic->duration == AV_NOPTS_VALUE && - ic->bit_rate != 0) { - filesize = ic->pb ? avio_size(ic->pb) : 0; - if (filesize > 0) { - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if ( st->time_base.num <= INT64_MAX / ic->bit_rate - && st->duration == AV_NOPTS_VALUE) { - duration = av_rescale(8 * filesize, st->time_base.den, - ic->bit_rate * - (int64_t) st->time_base.num); - st->duration = duration; - show_warning = 1; - } - } - } - } - if (show_warning) - av_log(ic, AV_LOG_WARNING, - "Estimating duration from bitrate, this may be inaccurate\n"); -} - -#define DURATION_MAX_READ_SIZE 250000LL -#define DURATION_MAX_RETRY 4 - -/* only usable for MPEG-PS streams */ -static void estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset) -{ - AVPacket pkt1, *pkt = &pkt1; - AVStream *st; - int read_size, i, ret; - int64_t end_time; - int64_t filesize, offset, duration; - int retry = 0; - - /* flush packet queue */ - flush_packet_queue(ic); - - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->start_time == AV_NOPTS_VALUE && - st->first_dts == AV_NOPTS_VALUE && - st->codec->codec_type != AVMEDIA_TYPE_UNKNOWN) - av_log(st->codec, AV_LOG_WARNING, - "start time is not set in estimate_timings_from_pts\n"); - - if (st->parser) { - av_parser_close(st->parser); - st->parser = NULL; - } - } - - /* estimate the end time (duration) */ - /* XXX: may need to support wrapping */ - filesize = ic->pb ? avio_size(ic->pb) : 0; - end_time = AV_NOPTS_VALUE; - do { - offset = filesize - (DURATION_MAX_READ_SIZE << retry); - if (offset < 0) - offset = 0; - - avio_seek(ic->pb, offset, SEEK_SET); - read_size = 0; - for (;;) { - if (read_size >= DURATION_MAX_READ_SIZE << (FFMAX(retry - 1, 0))) - break; - - do { - ret = ff_read_packet(ic, pkt); - } while (ret == AVERROR(EAGAIN)); - if (ret != 0) - break; - read_size += pkt->size; - st = ic->streams[pkt->stream_index]; - if (pkt->pts != AV_NOPTS_VALUE && - (st->start_time != AV_NOPTS_VALUE || - st->first_dts != AV_NOPTS_VALUE)) { - duration = end_time = pkt->pts; - if (st->start_time != AV_NOPTS_VALUE) - duration -= st->start_time; - else - duration -= st->first_dts; - if (duration > 0) { - if (st->duration == AV_NOPTS_VALUE || st->info->last_duration<= 0 || - (st->duration < duration && FFABS(duration - st->info->last_duration) < 60LL*st->time_base.den / st->time_base.num)) - st->duration = duration; - st->info->last_duration = duration; - } - } - av_free_packet(pkt); - } - } while (end_time == AV_NOPTS_VALUE && - filesize > (DURATION_MAX_READ_SIZE << retry) && - ++retry <= DURATION_MAX_RETRY); - - fill_all_stream_timings(ic); - - avio_seek(ic->pb, old_offset, SEEK_SET); - for (i = 0; i < ic->nb_streams; i++) { - int j; - - st = ic->streams[i]; - st->cur_dts = st->first_dts; - st->last_IP_pts = AV_NOPTS_VALUE; - st->last_dts_for_order_check = AV_NOPTS_VALUE; - for (j = 0; j < MAX_REORDER_DELAY + 1; j++) - st->pts_buffer[j] = AV_NOPTS_VALUE; - } -} - -static void estimate_timings(AVFormatContext *ic, int64_t old_offset) -{ - int64_t file_size; - - /* get the file size, if possible */ - if (ic->iformat->flags & AVFMT_NOFILE) { - file_size = 0; - } else { - file_size = avio_size(ic->pb); - file_size = FFMAX(0, file_size); - } - - if ((!strcmp(ic->iformat->name, "mpeg") || - !strcmp(ic->iformat->name, "mpegts")) && - file_size && ic->pb->seekable) { - /* get accurate estimate from the PTSes */ - estimate_timings_from_pts(ic, old_offset); - ic->duration_estimation_method = AVFMT_DURATION_FROM_PTS; - } else if (has_duration(ic)) { - /* at least one component has timings - we use them for all - * the components */ - fill_all_stream_timings(ic); - ic->duration_estimation_method = AVFMT_DURATION_FROM_STREAM; - } else { - /* less precise: use bitrate info */ - estimate_timings_from_bit_rate(ic); - ic->duration_estimation_method = AVFMT_DURATION_FROM_BITRATE; - } - update_stream_timings(ic); - - { - int i; - AVStream av_unused *st; - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - av_dlog(ic, "%d: start_time: %0.3f duration: %0.3f\n", i, - (double) st->start_time / AV_TIME_BASE, - (double) st->duration / AV_TIME_BASE); - } - av_dlog(ic, - "stream: start_time: %0.3f duration: %0.3f bitrate=%d kb/s\n", - (double) ic->start_time / AV_TIME_BASE, - (double) ic->duration / AV_TIME_BASE, - ic->bit_rate / 1000); - } -} - -static int has_codec_parameters(AVStream *st, const char **errmsg_ptr) -{ - AVCodecContext *avctx = st->codec; - -#define FAIL(errmsg) do { \ - if (errmsg_ptr) \ - *errmsg_ptr = errmsg; \ - return 0; \ - } while (0) - - switch (avctx->codec_type) { - case AVMEDIA_TYPE_AUDIO: - if (!avctx->frame_size && determinable_frame_size(avctx)) - FAIL("unspecified frame size"); - if (st->info->found_decoder >= 0 && - avctx->sample_fmt == AV_SAMPLE_FMT_NONE) - FAIL("unspecified sample format"); - if (!avctx->sample_rate) - FAIL("unspecified sample rate"); - if (!avctx->channels) - FAIL("unspecified number of channels"); - if (st->info->found_decoder >= 0 && !st->nb_decoded_frames && avctx->codec_id == AV_CODEC_ID_DTS) - FAIL("no decodable DTS frames"); - break; - case AVMEDIA_TYPE_VIDEO: - if (!avctx->width) - FAIL("unspecified size"); - if (st->info->found_decoder >= 0 && avctx->pix_fmt == AV_PIX_FMT_NONE) - FAIL("unspecified pixel format"); - if (st->codec->codec_id == AV_CODEC_ID_RV30 || st->codec->codec_id == AV_CODEC_ID_RV40) - if (!st->sample_aspect_ratio.num && !st->codec->sample_aspect_ratio.num && !st->codec_info_nb_frames) - FAIL("no frame in rv30/40 and no sar"); - break; - case AVMEDIA_TYPE_SUBTITLE: - if (avctx->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE && !avctx->width) - FAIL("unspecified size"); - break; - case AVMEDIA_TYPE_DATA: - if (avctx->codec_id == AV_CODEC_ID_NONE) return 1; - } - - if (avctx->codec_id == AV_CODEC_ID_NONE) - FAIL("unknown codec"); - return 1; -} - -/* returns 1 or 0 if or if not decoded data was returned, or a negative error */ -static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, - AVDictionary **options) -{ - const AVCodec *codec; - int got_picture = 1, ret = 0; - AVFrame *frame = av_frame_alloc(); - AVSubtitle subtitle; - AVPacket pkt = *avpkt; - - if (!frame) - return AVERROR(ENOMEM); - - if (!avcodec_is_open(st->codec) && !st->info->found_decoder) { - AVDictionary *thread_opt = NULL; - - codec = find_decoder(s, st, st->codec->codec_id); - - if (!codec) { - st->info->found_decoder = -1; - ret = -1; - goto fail; - } - - /* Force thread count to 1 since the H.264 decoder will not extract - * SPS and PPS to extradata during multi-threaded decoding. */ - av_dict_set(options ? options : &thread_opt, "threads", "1", 0); - ret = avcodec_open2(st->codec, codec, options ? options : &thread_opt); - if (!options) - av_dict_free(&thread_opt); - if (ret < 0) { - st->info->found_decoder = -1; - goto fail; - } - st->info->found_decoder = 1; - } else if (!st->info->found_decoder) - st->info->found_decoder = 1; - - if (st->info->found_decoder < 0) { - ret = -1; - goto fail; - } - - while ((pkt.size > 0 || (!pkt.data && got_picture)) && - ret >= 0 && - (!has_codec_parameters(st, NULL) || !has_decode_delay_been_guessed(st) || - (!st->codec_info_nb_frames && - st->codec->codec->capabilities & CODEC_CAP_CHANNEL_CONF))) { - got_picture = 0; - switch (st->codec->codec_type) { - case AVMEDIA_TYPE_VIDEO: - ret = avcodec_decode_video2(st->codec, frame, - &got_picture, &pkt); - break; - case AVMEDIA_TYPE_AUDIO: - ret = avcodec_decode_audio4(st->codec, frame, &got_picture, &pkt); - break; - case AVMEDIA_TYPE_SUBTITLE: - ret = avcodec_decode_subtitle2(st->codec, &subtitle, - &got_picture, &pkt); - ret = pkt.size; - break; - default: - break; - } - if (ret >= 0) { - if (got_picture) - st->nb_decoded_frames++; - pkt.data += ret; - pkt.size -= ret; - ret = got_picture; - } - } - - if (!pkt.data && !got_picture) - ret = -1; - -fail: - av_frame_free(&frame); - return ret; -} - -unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id) -{ - while (tags->id != AV_CODEC_ID_NONE) { - if (tags->id == id) - return tags->tag; - tags++; - } - return 0; -} - -enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag) -{ - int i; - for (i = 0; tags[i].id != AV_CODEC_ID_NONE; i++) - if (tag == tags[i].tag) - return tags[i].id; - for (i = 0; tags[i].id != AV_CODEC_ID_NONE; i++) - if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag)) - return tags[i].id; - return AV_CODEC_ID_NONE; -} - -enum AVCodecID ff_get_pcm_codec_id(int bps, int flt, int be, int sflags) -{ - if (flt) { - switch (bps) { - case 32: - return be ? AV_CODEC_ID_PCM_F32BE : AV_CODEC_ID_PCM_F32LE; - case 64: - return be ? AV_CODEC_ID_PCM_F64BE : AV_CODEC_ID_PCM_F64LE; - default: - return AV_CODEC_ID_NONE; - } - } else { - bps += 7; - bps >>= 3; - if (sflags & (1 << (bps - 1))) { - switch (bps) { - case 1: - return AV_CODEC_ID_PCM_S8; - case 2: - return be ? AV_CODEC_ID_PCM_S16BE : AV_CODEC_ID_PCM_S16LE; - case 3: - return be ? AV_CODEC_ID_PCM_S24BE : AV_CODEC_ID_PCM_S24LE; - case 4: - return be ? AV_CODEC_ID_PCM_S32BE : AV_CODEC_ID_PCM_S32LE; - default: - return AV_CODEC_ID_NONE; - } - } else { - switch (bps) { - case 1: - return AV_CODEC_ID_PCM_U8; - case 2: - return be ? AV_CODEC_ID_PCM_U16BE : AV_CODEC_ID_PCM_U16LE; - case 3: - return be ? AV_CODEC_ID_PCM_U24BE : AV_CODEC_ID_PCM_U24LE; - case 4: - return be ? AV_CODEC_ID_PCM_U32BE : AV_CODEC_ID_PCM_U32LE; - default: - return AV_CODEC_ID_NONE; - } - } - } -} - -unsigned int av_codec_get_tag(const AVCodecTag *const *tags, enum AVCodecID id) -{ - unsigned int tag; - if (!av_codec_get_tag2(tags, id, &tag)) - return 0; - return tag; -} - -int av_codec_get_tag2(const AVCodecTag * const *tags, enum AVCodecID id, - unsigned int *tag) -{ - int i; - for (i = 0; tags && tags[i]; i++) { - const AVCodecTag *codec_tags = tags[i]; - while (codec_tags->id != AV_CODEC_ID_NONE) { - if (codec_tags->id == id) { - *tag = codec_tags->tag; - return 1; - } - codec_tags++; - } - } - return 0; -} - -enum AVCodecID av_codec_get_id(const AVCodecTag *const *tags, unsigned int tag) -{ - int i; - for (i = 0; tags && tags[i]; i++) { - enum AVCodecID id = ff_codec_get_id(tags[i], tag); - if (id != AV_CODEC_ID_NONE) - return id; - } - return AV_CODEC_ID_NONE; -} - -static void compute_chapters_end(AVFormatContext *s) -{ - unsigned int i, j; - int64_t max_time = s->duration + - ((s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time); - - for (i = 0; i < s->nb_chapters; i++) - if (s->chapters[i]->end == AV_NOPTS_VALUE) { - AVChapter *ch = s->chapters[i]; - int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q, - ch->time_base) - : INT64_MAX; - - for (j = 0; j < s->nb_chapters; j++) { - AVChapter *ch1 = s->chapters[j]; - int64_t next_start = av_rescale_q(ch1->start, ch1->time_base, - ch->time_base); - if (j != i && next_start > ch->start && next_start < end) - end = next_start; - } - ch->end = (end == INT64_MAX) ? ch->start : end; - } -} - -static int get_std_framerate(int i) -{ - if (i < 60 * 12) - return (i + 1) * 1001; - else - return ((const int[]) { 24, 30, 60, 12, 15, 48 })[i - 60 * 12] * 1000 * 12; -} - -/* Is the time base unreliable? - * This is a heuristic to balance between quick acceptance of the values in - * the headers vs. some extra checks. - * Old DivX and Xvid often have nonsense timebases like 1fps or 2fps. - * MPEG-2 commonly misuses field repeat flags to store different framerates. - * And there are "variable" fps files this needs to detect as well. */ -static int tb_unreliable(AVCodecContext *c) -{ - if (c->time_base.den >= 101L * c->time_base.num || - c->time_base.den < 5L * c->time_base.num || - // c->codec_tag == AV_RL32("DIVX") || - // c->codec_tag == AV_RL32("XVID") || - c->codec_tag == AV_RL32("mp4v") || - c->codec_id == AV_CODEC_ID_MPEG2VIDEO || - c->codec_id == AV_CODEC_ID_H264) - return 1; - return 0; -} - -#if FF_API_FORMAT_PARAMETERS -int av_find_stream_info(AVFormatContext *ic) -{ - return avformat_find_stream_info(ic, NULL); -} -#endif - -int ff_alloc_extradata(AVCodecContext *avctx, int size) -{ - int ret; - - if (size < 0 || size >= INT32_MAX - FF_INPUT_BUFFER_PADDING_SIZE) { - avctx->extradata_size = 0; - return AVERROR(EINVAL); - } - avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); - if (avctx->extradata) { - memset(avctx->extradata + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); - avctx->extradata_size = size; - ret = 0; - } else { - avctx->extradata_size = 0; - ret = AVERROR(ENOMEM); - } - return ret; -} - -int ff_get_extradata(AVCodecContext *avctx, AVIOContext *pb, int size) -{ - int ret = ff_alloc_extradata(avctx, size); - if (ret < 0) - return ret; - ret = avio_read(pb, avctx->extradata, size); - if (ret != size) { - av_freep(&avctx->extradata); - avctx->extradata_size = 0; - av_log(avctx, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size); - return ret < 0 ? ret : AVERROR_INVALIDDATA; - } - - return ret; -} - -int ff_rfps_add_frame(AVFormatContext *ic, AVStream *st, int64_t ts) -{ - int i, j; - int64_t last = st->info->last_dts; - - if ( ts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && ts > last - && ts - (uint64_t)last < INT64_MAX) { - double dts = (is_relative(ts) ? ts - RELATIVE_TS_BASE : ts) * av_q2d(st->time_base); - int64_t duration = ts - last; - - if (!st->info->duration_error) - st->info->duration_error = av_mallocz(sizeof(st->info->duration_error[0])*2); - if (!st->info->duration_error) - return AVERROR(ENOMEM); - -// if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) -// av_log(NULL, AV_LOG_ERROR, "%f\n", dts); - for (i = 0; iinfo->duration_error[0][1][i] < 1e10) { - int framerate = get_std_framerate(i); - double sdts = dts*framerate/(1001*12); - for (j= 0; j<2; j++) { - int64_t ticks = llrint(sdts+j*0.5); - double error= sdts - ticks + j*0.5; - st->info->duration_error[j][0][i] += error; - st->info->duration_error[j][1][i] += error*error; - } - } - } - st->info->duration_count++; - st->info->rfps_duration_sum += duration; - - if (st->info->duration_count % 10 == 0) { - int n = st->info->duration_count; - for (i = 0; iinfo->duration_error[0][1][i] < 1e10) { - double a0 = st->info->duration_error[0][0][i] / n; - double error0 = st->info->duration_error[0][1][i] / n - a0*a0; - double a1 = st->info->duration_error[1][0][i] / n; - double error1 = st->info->duration_error[1][1][i] / n - a1*a1; - if (error0 > 0.04 && error1 > 0.04) { - st->info->duration_error[0][1][i] = 2e10; - st->info->duration_error[1][1][i] = 2e10; - } - } - } - } - - // ignore the first 4 values, they might have some random jitter - if (st->info->duration_count > 3 && is_relative(ts) == is_relative(last)) - st->info->duration_gcd = av_gcd(st->info->duration_gcd, duration); - } - if (ts != AV_NOPTS_VALUE) - st->info->last_dts = ts; - - return 0; -} - -void ff_rfps_calculate(AVFormatContext *ic) -{ - int i, j; - - for (i = 0; i < ic->nb_streams; i++) { - AVStream *st = ic->streams[i]; - - if (st->codec->codec_type != AVMEDIA_TYPE_VIDEO) - continue; - // the check for tb_unreliable() is not completely correct, since this is not about handling - // a unreliable/inexact time base, but a time base that is finer than necessary, as e.g. - // ipmovie.c produces. - if (tb_unreliable(st->codec) && st->info->duration_count > 15 && st->info->duration_gcd > FFMAX(1, st->time_base.den/(500LL*st->time_base.num)) && !st->r_frame_rate.num) - av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, st->time_base.den, st->time_base.num * st->info->duration_gcd, INT_MAX); - if (st->info->duration_count>1 && !st->r_frame_rate.num - && tb_unreliable(st->codec)) { - int num = 0; - double best_error= 0.01; - - for (j= 0; jinfo->codec_info_duration && st->info->codec_info_duration*av_q2d(st->time_base) < (1001*12.0)/get_std_framerate(j)) - continue; - if (!st->info->codec_info_duration && 1.0 < (1001*12.0)/get_std_framerate(j)) - continue; - - if (av_q2d(st->time_base) * st->info->rfps_duration_sum / st->info->duration_count < (1001*12.0 * 0.8)/get_std_framerate(j)) - continue; - - for (k= 0; k<2; k++) { - int n = st->info->duration_count; - double a= st->info->duration_error[k][0][j] / n; - double error= st->info->duration_error[k][1][j]/n - a*a; - - if (error < best_error && best_error> 0.000000001) { - best_error= error; - num = get_std_framerate(j); - } - if (error < 0.02) - av_log(NULL, AV_LOG_DEBUG, "rfps: %f %f\n", get_std_framerate(j) / 12.0/1001, error); - } - } - // do not increase frame rate by more than 1 % in order to match a standard rate. - if (num && (!st->r_frame_rate.num || (double)num/(12*1001) < 1.01 * av_q2d(st->r_frame_rate))) - av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, num, 12*1001, INT_MAX); - } - - av_freep(&st->info->duration_error); - st->info->last_dts = AV_NOPTS_VALUE; - st->info->duration_count = 0; - st->info->rfps_duration_sum = 0; - } -} - -int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) -{ - int i, count, ret = 0, j; - int64_t read_size; - AVStream *st; - AVPacket pkt1, *pkt; - int64_t old_offset = avio_tell(ic->pb); - // new streams might appear, no options for those - int orig_nb_streams = ic->nb_streams; - int flush_codecs = ic->probesize > 0; - - if (ic->pb) - av_log(ic, AV_LOG_DEBUG, "Before avformat_find_stream_info() pos: %"PRId64" bytes read:%"PRId64" seeks:%d\n", - avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count); - - for (i = 0; i < ic->nb_streams; i++) { - const AVCodec *codec; - AVDictionary *thread_opt = NULL; - st = ic->streams[i]; - - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || - st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { -/* if (!st->time_base.num) - st->time_base = */ - if (!st->codec->time_base.num) - st->codec->time_base = st->time_base; - } - // only for the split stuff - if (!st->parser && !(ic->flags & AVFMT_FLAG_NOPARSE)) { - st->parser = av_parser_init(st->codec->codec_id); - if (st->parser) { - if (st->need_parsing == AVSTREAM_PARSE_HEADERS) { - st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; - } else if (st->need_parsing == AVSTREAM_PARSE_FULL_RAW) { - st->parser->flags |= PARSER_FLAG_USE_CODEC_TS; - } - } else if (st->need_parsing) { - av_log(ic, AV_LOG_VERBOSE, "parser not found for codec " - "%s, packets or times may be invalid.\n", - avcodec_get_name(st->codec->codec_id)); - } - } - codec = find_decoder(ic, st, st->codec->codec_id); - - /* Force thread count to 1 since the H.264 decoder will not extract - * SPS and PPS to extradata during multi-threaded decoding. */ - av_dict_set(options ? &options[i] : &thread_opt, "threads", "1", 0); - - /* Ensure that subtitle_header is properly set. */ - if (st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE - && codec && !st->codec->codec) { - if (avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt) < 0) - av_log(ic, AV_LOG_WARNING, - "Failed to open codec in av_find_stream_info\n"); - } - - // Try to just open decoders, in case this is enough to get parameters. - if (!has_codec_parameters(st, NULL) && st->request_probe <= 0) { - if (codec && !st->codec->codec) - if (avcodec_open2(st->codec, codec, options ? &options[i] : &thread_opt) < 0) - av_log(ic, AV_LOG_WARNING, - "Failed to open codec in av_find_stream_info\n"); - } - if (!options) - av_dict_free(&thread_opt); - } - - for (i = 0; i < ic->nb_streams; i++) { -#if FF_API_R_FRAME_RATE - ic->streams[i]->info->last_dts = AV_NOPTS_VALUE; -#endif - ic->streams[i]->info->fps_first_dts = AV_NOPTS_VALUE; - ic->streams[i]->info->fps_last_dts = AV_NOPTS_VALUE; - } - - count = 0; - read_size = 0; - for (;;) { - if (ff_check_interrupt(&ic->interrupt_callback)) { - ret = AVERROR_EXIT; - av_log(ic, AV_LOG_DEBUG, "interrupted\n"); - break; - } - - /* check if one codec still needs to be handled */ - for (i = 0; i < ic->nb_streams; i++) { - int fps_analyze_framecount = 20; - - st = ic->streams[i]; - if (!has_codec_parameters(st, NULL)) - break; - /* If the timebase is coarse (like the usual millisecond precision - * of mkv), we need to analyze more frames to reliably arrive at - * the correct fps. */ - if (av_q2d(st->time_base) > 0.0005) - fps_analyze_framecount *= 2; - if (ic->fps_probe_size >= 0) - fps_analyze_framecount = ic->fps_probe_size; - if (st->disposition & AV_DISPOSITION_ATTACHED_PIC) - fps_analyze_framecount = 0; - /* variable fps and no guess at the real fps */ - if (tb_unreliable(st->codec) && - !(st->r_frame_rate.num && st->avg_frame_rate.num) && - st->info->duration_count < fps_analyze_framecount && - st->codec->codec_type == AVMEDIA_TYPE_VIDEO) - break; - if (st->parser && st->parser->parser->split && - !st->codec->extradata) - break; - if (st->first_dts == AV_NOPTS_VALUE && - (st->codec->codec_type == AVMEDIA_TYPE_VIDEO || - st->codec->codec_type == AVMEDIA_TYPE_AUDIO)) - break; - } - if (i == ic->nb_streams) { - /* NOTE: If the format has no header, then we need to read some - * packets to get most of the streams, so we cannot stop here. */ - if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { - /* If we found the info for all the codecs, we can stop. */ - ret = count; - av_log(ic, AV_LOG_DEBUG, "All info found\n"); - flush_codecs = 0; - break; - } - } - /* We did not get all the codec info, but we read too much data. */ - if (read_size >= ic->probesize) { - ret = count; - av_log(ic, AV_LOG_DEBUG, - "Probe buffer size limit of %d bytes reached\n", ic->probesize); - for (i = 0; i < ic->nb_streams; i++) - if (!ic->streams[i]->r_frame_rate.num && - ic->streams[i]->info->duration_count <= 1 && - ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_VIDEO && - strcmp(ic->iformat->name, "image2")) - av_log(ic, AV_LOG_WARNING, - "Stream #%d: not enough frames to estimate rate; " - "consider increasing probesize\n", i); - break; - } - - /* NOTE: A new stream can be added there if no header in file - * (AVFMTCTX_NOHEADER). */ - ret = read_frame_internal(ic, &pkt1); - if (ret == AVERROR(EAGAIN)) - continue; - - if (ret < 0) { - /* EOF or error*/ - break; - } - - if (ic->flags & AVFMT_FLAG_NOBUFFER) - free_packet_buffer(&ic->packet_buffer, &ic->packet_buffer_end); - { - pkt = add_to_pktbuf(&ic->packet_buffer, &pkt1, - &ic->packet_buffer_end); - if (!pkt) { - ret = AVERROR(ENOMEM); - goto find_stream_info_err; - } - if ((ret = av_dup_packet(pkt)) < 0) - goto find_stream_info_err; - } - - st = ic->streams[pkt->stream_index]; - if (!(st->disposition & AV_DISPOSITION_ATTACHED_PIC)) - read_size += pkt->size; - - if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) { - /* check for non-increasing dts */ - if (st->info->fps_last_dts != AV_NOPTS_VALUE && - st->info->fps_last_dts >= pkt->dts) { - av_log(ic, AV_LOG_DEBUG, - "Non-increasing DTS in stream %d: packet %d with DTS " - "%"PRId64", packet %d with DTS %"PRId64"\n", - st->index, st->info->fps_last_dts_idx, - st->info->fps_last_dts, st->codec_info_nb_frames, - pkt->dts); - st->info->fps_first_dts = - st->info->fps_last_dts = AV_NOPTS_VALUE; - } - /* Check for a discontinuity in dts. If the difference in dts - * is more than 1000 times the average packet duration in the - * sequence, we treat it as a discontinuity. */ - if (st->info->fps_last_dts != AV_NOPTS_VALUE && - st->info->fps_last_dts_idx > st->info->fps_first_dts_idx && - (pkt->dts - st->info->fps_last_dts) / 1000 > - (st->info->fps_last_dts - st->info->fps_first_dts) / - (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) { - av_log(ic, AV_LOG_WARNING, - "DTS discontinuity in stream %d: packet %d with DTS " - "%"PRId64", packet %d with DTS %"PRId64"\n", - st->index, st->info->fps_last_dts_idx, - st->info->fps_last_dts, st->codec_info_nb_frames, - pkt->dts); - st->info->fps_first_dts = - st->info->fps_last_dts = AV_NOPTS_VALUE; - } - - /* update stored dts values */ - if (st->info->fps_first_dts == AV_NOPTS_VALUE) { - st->info->fps_first_dts = pkt->dts; - st->info->fps_first_dts_idx = st->codec_info_nb_frames; - } - st->info->fps_last_dts = pkt->dts; - st->info->fps_last_dts_idx = st->codec_info_nb_frames; - } - if (st->codec_info_nb_frames>1) { - int64_t t = 0; - if (st->time_base.den > 0) - t = av_rescale_q(st->info->codec_info_duration, st->time_base, AV_TIME_BASE_Q); - if (st->avg_frame_rate.num > 0) - t = FFMAX(t, av_rescale_q(st->codec_info_nb_frames, av_inv_q(st->avg_frame_rate), AV_TIME_BASE_Q)); - - if ( t == 0 - && st->codec_info_nb_frames>30 - && st->info->fps_first_dts != AV_NOPTS_VALUE - && st->info->fps_last_dts != AV_NOPTS_VALUE) - t = FFMAX(t, av_rescale_q(st->info->fps_last_dts - st->info->fps_first_dts, st->time_base, AV_TIME_BASE_Q)); - - if (t >= ic->max_analyze_duration) { - av_log(ic, AV_LOG_VERBOSE, "max_analyze_duration %d reached at %"PRId64" microseconds\n", ic->max_analyze_duration, t); - break; - } - if (pkt->duration) { - st->info->codec_info_duration += pkt->duration; - st->info->codec_info_duration_fields += st->parser && st->need_parsing && st->codec->ticks_per_frame ==2 ? st->parser->repeat_pict + 1 : 2; - } - } -#if FF_API_R_FRAME_RATE - ff_rfps_add_frame(ic, st, pkt->dts); -#endif - if (st->parser && st->parser->parser->split && !st->codec->extradata) { - int i = st->parser->parser->split(st->codec, pkt->data, pkt->size); - if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) { - if (ff_alloc_extradata(st->codec, i)) - return AVERROR(ENOMEM); - memcpy(st->codec->extradata, pkt->data, - st->codec->extradata_size); - } - } - - /* If still no information, we try to open the codec and to - * decompress the frame. We try to avoid that in most cases as - * it takes longer and uses more memory. For MPEG-4, we need to - * decompress for QuickTime. - * - * If CODEC_CAP_CHANNEL_CONF is set this will force decoding of at - * least one frame of codec data, this makes sure the codec initializes - * the channel configuration and does not only trust the values from - * the container. */ - try_decode_frame(ic, st, pkt, - (options && i < orig_nb_streams) ? &options[i] : NULL); - - st->codec_info_nb_frames++; - count++; - } - - if (flush_codecs) { - AVPacket empty_pkt = { 0 }; - int err = 0; - av_init_packet(&empty_pkt); - - for (i = 0; i < ic->nb_streams; i++) { - - st = ic->streams[i]; - - /* flush the decoders */ - if (st->info->found_decoder == 1) { - do { - err = try_decode_frame(ic, st, &empty_pkt, - (options && i < orig_nb_streams) - ? &options[i] : NULL); - } while (err > 0 && !has_codec_parameters(st, NULL)); - - if (err < 0) { - av_log(ic, AV_LOG_INFO, - "decoding for stream %d failed\n", st->index); - } - } - } - } - - // close codecs which were opened in try_decode_frame() - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - avcodec_close(st->codec); - } - - ff_rfps_calculate(ic); - - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - if (st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_coded_sample) { - uint32_t tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); - if (avpriv_find_pix_fmt(ff_raw_pix_fmt_tags, tag) == st->codec->pix_fmt) - st->codec->codec_tag= tag; - } - - /* estimate average framerate if not set by demuxer */ - if (st->info->codec_info_duration_fields && - !st->avg_frame_rate.num && - st->info->codec_info_duration) { - int best_fps = 0; - double best_error = 0.01; - - if (st->info->codec_info_duration >= INT64_MAX / st->time_base.num / 2|| - st->info->codec_info_duration_fields >= INT64_MAX / st->time_base.den || - st->info->codec_info_duration < 0) - continue; - av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, - st->info->codec_info_duration_fields * (int64_t) st->time_base.den, - st->info->codec_info_duration * 2 * (int64_t) st->time_base.num, 60000); - - /* Round guessed framerate to a "standard" framerate if it's - * within 1% of the original estimate. */ - for (j = 0; j < MAX_STD_TIMEBASES; j++) { - AVRational std_fps = { get_std_framerate(j), 12 * 1001 }; - double error = fabs(av_q2d(st->avg_frame_rate) / - av_q2d(std_fps) - 1); - - if (error < best_error) { - best_error = error; - best_fps = std_fps.num; - } - } - if (best_fps) - av_reduce(&st->avg_frame_rate.num, &st->avg_frame_rate.den, - best_fps, 12 * 1001, INT_MAX); - } - - if (!st->r_frame_rate.num) { - if ( st->codec->time_base.den * (int64_t) st->time_base.num - <= st->codec->time_base.num * st->codec->ticks_per_frame * (int64_t) st->time_base.den) { - st->r_frame_rate.num = st->codec->time_base.den; - st->r_frame_rate.den = st->codec->time_base.num * st->codec->ticks_per_frame; - } else { - st->r_frame_rate.num = st->time_base.den; - st->r_frame_rate.den = st->time_base.num; - } - } - } else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) { - if (!st->codec->bits_per_coded_sample) - st->codec->bits_per_coded_sample = - av_get_bits_per_sample(st->codec->codec_id); - // set stream disposition based on audio service type - switch (st->codec->audio_service_type) { - case AV_AUDIO_SERVICE_TYPE_EFFECTS: - st->disposition = AV_DISPOSITION_CLEAN_EFFECTS; - break; - case AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED: - st->disposition = AV_DISPOSITION_VISUAL_IMPAIRED; - break; - case AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED: - st->disposition = AV_DISPOSITION_HEARING_IMPAIRED; - break; - case AV_AUDIO_SERVICE_TYPE_COMMENTARY: - st->disposition = AV_DISPOSITION_COMMENT; - break; - case AV_AUDIO_SERVICE_TYPE_KARAOKE: - st->disposition = AV_DISPOSITION_KARAOKE; - break; - } - } - } - - if (ic->probesize) - estimate_timings(ic, old_offset); - - if (ret >= 0 && ic->nb_streams) - /* We could not have all the codec parameters before EOF. */ - ret = -1; - for (i = 0; i < ic->nb_streams; i++) { - const char *errmsg; - st = ic->streams[i]; - if (!has_codec_parameters(st, &errmsg)) { - char buf[256]; - avcodec_string(buf, sizeof(buf), st->codec, 0); - av_log(ic, AV_LOG_WARNING, - "Could not find codec parameters for stream %d (%s): %s\n" - "Consider increasing the value for the 'analyzeduration' and 'probesize' options\n", - i, buf, errmsg); - } else { - ret = 0; - } - } - - compute_chapters_end(ic); - -find_stream_info_err: - for (i = 0; i < ic->nb_streams; i++) { - st = ic->streams[i]; - if (ic->streams[i]->codec->codec_type != AVMEDIA_TYPE_AUDIO) - ic->streams[i]->codec->thread_count = 0; - if (st->info) - av_freep(&st->info->duration_error); - av_freep(&ic->streams[i]->info); - } - if (ic->pb) - av_log(ic, AV_LOG_DEBUG, "After avformat_find_stream_info() pos: %"PRId64" bytes read:%"PRId64" seeks:%d frames:%d\n", - avio_tell(ic->pb), ic->pb->bytes_read, ic->pb->seek_count, count); - return ret; -} - -AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s) -{ - int i, j; - - for (i = 0; i < ic->nb_programs; i++) { - if (ic->programs[i] == last) { - last = NULL; - } else { - if (!last) - for (j = 0; j < ic->programs[i]->nb_stream_indexes; j++) - if (ic->programs[i]->stream_index[j] == s) - return ic->programs[i]; - } - } - return NULL; -} - -int av_find_best_stream(AVFormatContext *ic, enum AVMediaType type, - int wanted_stream_nb, int related_stream, - AVCodec **decoder_ret, int flags) -{ - int i, nb_streams = ic->nb_streams; - int ret = AVERROR_STREAM_NOT_FOUND, best_count = -1, best_bitrate = -1, best_multiframe = -1, count, bitrate, multiframe; - unsigned *program = NULL; - AVCodec *decoder = NULL, *best_decoder = NULL; - - if (related_stream >= 0 && wanted_stream_nb < 0) { - AVProgram *p = av_find_program_from_stream(ic, NULL, related_stream); - if (p) { - program = p->stream_index; - nb_streams = p->nb_stream_indexes; - } - } - for (i = 0; i < nb_streams; i++) { - int real_stream_index = program ? program[i] : i; - AVStream *st = ic->streams[real_stream_index]; - AVCodecContext *avctx = st->codec; - if (avctx->codec_type != type) - continue; - if (wanted_stream_nb >= 0 && real_stream_index != wanted_stream_nb) - continue; - if (wanted_stream_nb != real_stream_index && - st->disposition & (AV_DISPOSITION_HEARING_IMPAIRED | - AV_DISPOSITION_VISUAL_IMPAIRED)) - continue; - if (type == AVMEDIA_TYPE_AUDIO && !avctx->channels) - continue; - if (decoder_ret) { - decoder = find_decoder(ic, st, st->codec->codec_id); - if (!decoder) { - if (ret < 0) - ret = AVERROR_DECODER_NOT_FOUND; - continue; - } - } - count = st->codec_info_nb_frames; - bitrate = avctx->bit_rate; - multiframe = FFMIN(5, count); - if ((best_multiframe > multiframe) || - (best_multiframe == multiframe && best_bitrate > bitrate) || - (best_multiframe == multiframe && best_bitrate == bitrate && best_count >= count)) - continue; - best_count = count; - best_bitrate = bitrate; - best_multiframe = multiframe; - ret = real_stream_index; - best_decoder = decoder; - if (program && i == nb_streams - 1 && ret < 0) { - program = NULL; - nb_streams = ic->nb_streams; - /* no related stream found, try again with everything */ - i = 0; - } - } - if (decoder_ret) - *decoder_ret = best_decoder; - return ret; -} - -/*******************************************************/ - -int av_read_play(AVFormatContext *s) -{ - if (s->iformat->read_play) - return s->iformat->read_play(s); - if (s->pb) - return avio_pause(s->pb, 0); - return AVERROR(ENOSYS); -} - -int av_read_pause(AVFormatContext *s) -{ - if (s->iformat->read_pause) - return s->iformat->read_pause(s); - if (s->pb) - return avio_pause(s->pb, 1); - return AVERROR(ENOSYS); -} - -void ff_free_stream(AVFormatContext *s, AVStream *st) { - av_assert0(s->nb_streams>0); - av_assert0(s->streams[ s->nb_streams - 1 ] == st); - - if (st->parser) { - av_parser_close(st->parser); - } - if (st->attached_pic.data) - av_free_packet(&st->attached_pic); - av_dict_free(&st->metadata); - av_freep(&st->probe_data.buf); - av_freep(&st->index_entries); - av_freep(&st->codec->extradata); - av_freep(&st->codec->subtitle_header); - av_freep(&st->codec); - av_freep(&st->priv_data); - if (st->info) - av_freep(&st->info->duration_error); - av_freep(&st->info); - av_freep(&s->streams[ --s->nb_streams ]); -} - -void avformat_free_context(AVFormatContext *s) -{ - int i; - - if (!s) - return; - - av_opt_free(s); - if (s->iformat && s->iformat->priv_class && s->priv_data) - av_opt_free(s->priv_data); - - for (i = s->nb_streams - 1; i >= 0; i--) { - ff_free_stream(s, s->streams[i]); - } - for (i = s->nb_programs - 1; i >= 0; i--) { - av_dict_free(&s->programs[i]->metadata); - av_freep(&s->programs[i]->stream_index); - av_freep(&s->programs[i]); - } - av_freep(&s->programs); - av_freep(&s->priv_data); - while (s->nb_chapters--) { - av_dict_free(&s->chapters[s->nb_chapters]->metadata); - av_freep(&s->chapters[s->nb_chapters]); - } - av_freep(&s->chapters); - av_dict_free(&s->metadata); - av_freep(&s->streams); - av_freep(&s->internal); - av_free(s); -} - -#if FF_API_CLOSE_INPUT_FILE -void av_close_input_file(AVFormatContext *s) -{ - avformat_close_input(&s); -} -#endif - -void avformat_close_input(AVFormatContext **ps) -{ - AVFormatContext *s; - AVIOContext *pb; - - if (!ps || !*ps) - return; - - s = *ps; - pb = s->pb; - - if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || - (s->flags & AVFMT_FLAG_CUSTOM_IO)) - pb = NULL; - - flush_packet_queue(s); - - if (s->iformat) - if (s->iformat->read_close) - s->iformat->read_close(s); - - avformat_free_context(s); - - *ps = NULL; - - avio_close(pb); -} - -#if FF_API_NEW_STREAM -AVStream *av_new_stream(AVFormatContext *s, int id) -{ - AVStream *st = avformat_new_stream(s, NULL); - if (st) - st->id = id; - return st; -} -#endif - -AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) -{ - AVStream *st; - int i; - AVStream **streams; - - if (s->nb_streams >= INT_MAX/sizeof(*streams)) - return NULL; - streams = av_realloc_array(s->streams, s->nb_streams + 1, sizeof(*streams)); - if (!streams) - return NULL; - s->streams = streams; - - st = av_mallocz(sizeof(AVStream)); - if (!st) - return NULL; - if (!(st->info = av_mallocz(sizeof(*st->info)))) { - av_free(st); - return NULL; - } - st->info->last_dts = AV_NOPTS_VALUE; - - st->codec = avcodec_alloc_context3(c); - if (s->iformat) - /* no default bitrate if decoding */ - st->codec->bit_rate = 0; - st->index = s->nb_streams; - st->start_time = AV_NOPTS_VALUE; - st->duration = AV_NOPTS_VALUE; - /* we set the current DTS to 0 so that formats without any timestamps - * but durations get some timestamps, formats with some unknown - * timestamps have their first few packets buffered and the - * timestamps corrected before they are returned to the user */ - st->cur_dts = s->iformat ? RELATIVE_TS_BASE : 0; - st->first_dts = AV_NOPTS_VALUE; - st->probe_packets = MAX_PROBE_PACKETS; - st->pts_wrap_reference = AV_NOPTS_VALUE; - st->pts_wrap_behavior = AV_PTS_WRAP_IGNORE; - - /* default pts setting is MPEG-like */ - avpriv_set_pts_info(st, 33, 1, 90000); - st->last_IP_pts = AV_NOPTS_VALUE; - st->last_dts_for_order_check = AV_NOPTS_VALUE; - for (i = 0; i < MAX_REORDER_DELAY + 1; i++) - st->pts_buffer[i] = AV_NOPTS_VALUE; - - st->sample_aspect_ratio = (AVRational) { 0, 1 }; - -#if FF_API_R_FRAME_RATE - st->info->last_dts = AV_NOPTS_VALUE; -#endif - st->info->fps_first_dts = AV_NOPTS_VALUE; - st->info->fps_last_dts = AV_NOPTS_VALUE; - - s->streams[s->nb_streams++] = st; - return st; -} - -AVProgram *av_new_program(AVFormatContext *ac, int id) -{ - AVProgram *program = NULL; - int i; - - av_dlog(ac, "new_program: id=0x%04x\n", id); - - for (i = 0; i < ac->nb_programs; i++) - if (ac->programs[i]->id == id) - program = ac->programs[i]; - - if (!program) { - program = av_mallocz(sizeof(AVProgram)); - if (!program) - return NULL; - dynarray_add(&ac->programs, &ac->nb_programs, program); - program->discard = AVDISCARD_NONE; - } - program->id = id; - program->pts_wrap_reference = AV_NOPTS_VALUE; - program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE; - - program->start_time = - program->end_time = AV_NOPTS_VALUE; - - return program; -} - -AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base, - int64_t start, int64_t end, const char *title) -{ - AVChapter *chapter = NULL; - int i; - - for (i = 0; i < s->nb_chapters; i++) - if (s->chapters[i]->id == id) - chapter = s->chapters[i]; - - if (!chapter) { - chapter = av_mallocz(sizeof(AVChapter)); - if (!chapter) - return NULL; - dynarray_add(&s->chapters, &s->nb_chapters, chapter); - } - av_dict_set(&chapter->metadata, "title", title, 0); - chapter->id = id; - chapter->time_base = time_base; - chapter->start = start; - chapter->end = end; - - return chapter; -} - -void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx) -{ - int i, j; - AVProgram *program = NULL; - void *tmp; - - if (idx >= ac->nb_streams) { - av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\n", idx); - return; - } - - for (i = 0; i < ac->nb_programs; i++) { - if (ac->programs[i]->id != progid) - continue; - program = ac->programs[i]; - for (j = 0; j < program->nb_stream_indexes; j++) - if (program->stream_index[j] == idx) - return; - - tmp = av_realloc_array(program->stream_index, program->nb_stream_indexes+1, sizeof(unsigned int)); - if (!tmp) - return; - program->stream_index = tmp; - program->stream_index[program->nb_stream_indexes++] = idx; - return; - } -} - -static void print_fps(double d, const char *postfix) -{ - uint64_t v = lrintf(d * 100); - if (v % 100) - av_log(NULL, AV_LOG_INFO, ", %3.2f %s", d, postfix); - else if (v % (100 * 1000)) - av_log(NULL, AV_LOG_INFO, ", %1.0f %s", d, postfix); - else - av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d / 1000, postfix); -} - -static void dump_metadata(void *ctx, AVDictionary *m, const char *indent) -{ - if (m && !(av_dict_count(m) == 1 && av_dict_get(m, "language", NULL, 0))) { - AVDictionaryEntry *tag = NULL; - - av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent); - while ((tag = av_dict_get(m, "", tag, AV_DICT_IGNORE_SUFFIX))) - if (strcmp("language", tag->key)) { - const char *p = tag->value; - av_log(ctx, AV_LOG_INFO, - "%s %-16s: ", indent, tag->key); - while (*p) { - char tmp[256]; - size_t len = strcspn(p, "\x8\xa\xb\xc\xd"); - av_strlcpy(tmp, p, FFMIN(sizeof(tmp), len+1)); - av_log(ctx, AV_LOG_INFO, "%s", tmp); - p += len; - if (*p == 0xd) av_log(ctx, AV_LOG_INFO, " "); - if (*p == 0xa) av_log(ctx, AV_LOG_INFO, "\n%s %-16s: ", indent, ""); - if (*p) p++; - } - av_log(ctx, AV_LOG_INFO, "\n"); - } - } -} - -/* "user interface" functions */ -static void dump_stream_format(AVFormatContext *ic, int i, - int index, int is_output) -{ - char buf[256]; - int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); - AVStream *st = ic->streams[i]; - int g = av_gcd(st->time_base.num, st->time_base.den); - AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); - avcodec_string(buf, sizeof(buf), st->codec, is_output); - av_log(NULL, AV_LOG_INFO, " Stream #%d:%d", index, i); - /* the pid is an important information, so we display it */ - /* XXX: add a generic system */ - if (flags & AVFMT_SHOW_IDS) - av_log(NULL, AV_LOG_INFO, "[0x%x]", st->id); - if (lang) - av_log(NULL, AV_LOG_INFO, "(%s)", lang->value); - av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, - st->time_base.num / g, st->time_base.den / g); - av_log(NULL, AV_LOG_INFO, ": %s", buf); - if (st->sample_aspect_ratio.num && // default - av_cmp_q(st->sample_aspect_ratio, st->codec->sample_aspect_ratio)) { - AVRational display_aspect_ratio; - av_reduce(&display_aspect_ratio.num, &display_aspect_ratio.den, - st->codec->width * st->sample_aspect_ratio.num, - st->codec->height * st->sample_aspect_ratio.den, - 1024 * 1024); - av_log(NULL, AV_LOG_INFO, ", SAR %d:%d DAR %d:%d", - st->sample_aspect_ratio.num, st->sample_aspect_ratio.den, - display_aspect_ratio.num, display_aspect_ratio.den); - } - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { - if (st->avg_frame_rate.den && st->avg_frame_rate.num) - print_fps(av_q2d(st->avg_frame_rate), "fps"); -#if FF_API_R_FRAME_RATE - if (st->r_frame_rate.den && st->r_frame_rate.num) - print_fps(av_q2d(st->r_frame_rate), "tbr"); -#endif - if (st->time_base.den && st->time_base.num) - print_fps(1 / av_q2d(st->time_base), "tbn"); - if (st->codec->time_base.den && st->codec->time_base.num) - print_fps(1 / av_q2d(st->codec->time_base), "tbc"); - } - if (st->disposition & AV_DISPOSITION_DEFAULT) - av_log(NULL, AV_LOG_INFO, " (default)"); - if (st->disposition & AV_DISPOSITION_DUB) - av_log(NULL, AV_LOG_INFO, " (dub)"); - if (st->disposition & AV_DISPOSITION_ORIGINAL) - av_log(NULL, AV_LOG_INFO, " (original)"); - if (st->disposition & AV_DISPOSITION_COMMENT) - av_log(NULL, AV_LOG_INFO, " (comment)"); - if (st->disposition & AV_DISPOSITION_LYRICS) - av_log(NULL, AV_LOG_INFO, " (lyrics)"); - if (st->disposition & AV_DISPOSITION_KARAOKE) - av_log(NULL, AV_LOG_INFO, " (karaoke)"); - if (st->disposition & AV_DISPOSITION_FORCED) - av_log(NULL, AV_LOG_INFO, " (forced)"); - if (st->disposition & AV_DISPOSITION_HEARING_IMPAIRED) - av_log(NULL, AV_LOG_INFO, " (hearing impaired)"); - if (st->disposition & AV_DISPOSITION_VISUAL_IMPAIRED) - av_log(NULL, AV_LOG_INFO, " (visual impaired)"); - if (st->disposition & AV_DISPOSITION_CLEAN_EFFECTS) - av_log(NULL, AV_LOG_INFO, " (clean effects)"); - av_log(NULL, AV_LOG_INFO, "\n"); - dump_metadata(NULL, st->metadata, " "); -} - -void av_dump_format(AVFormatContext *ic, int index, - const char *url, int is_output) -{ - int i; - uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL; - if (ic->nb_streams && !printed) - return; - - av_log(NULL, AV_LOG_INFO, "%s #%d, %s, %s '%s':\n", - is_output ? "Output" : "Input", - index, - is_output ? ic->oformat->name : ic->iformat->name, - is_output ? "to" : "from", url); - dump_metadata(NULL, ic->metadata, " "); - if (!is_output) { - av_log(NULL, AV_LOG_INFO, " Duration: "); - if (ic->duration != AV_NOPTS_VALUE) { - int hours, mins, secs, us; - int64_t duration = ic->duration + 5000; - secs = duration / AV_TIME_BASE; - us = duration % AV_TIME_BASE; - mins = secs / 60; - secs %= 60; - hours = mins / 60; - mins %= 60; - av_log(NULL, AV_LOG_INFO, "%02d:%02d:%02d.%02d", hours, mins, secs, - (100 * us) / AV_TIME_BASE); - } else { - av_log(NULL, AV_LOG_INFO, "N/A"); - } - if (ic->start_time != AV_NOPTS_VALUE) { - int secs, us; - av_log(NULL, AV_LOG_INFO, ", start: "); - secs = ic->start_time / AV_TIME_BASE; - us = abs(ic->start_time % AV_TIME_BASE); - av_log(NULL, AV_LOG_INFO, "%d.%06d", - secs, (int) av_rescale(us, 1000000, AV_TIME_BASE)); - } - av_log(NULL, AV_LOG_INFO, ", bitrate: "); - if (ic->bit_rate) - av_log(NULL, AV_LOG_INFO, "%d kb/s", ic->bit_rate / 1000); - else - av_log(NULL, AV_LOG_INFO, "N/A"); - av_log(NULL, AV_LOG_INFO, "\n"); - } - for (i = 0; i < ic->nb_chapters; i++) { - AVChapter *ch = ic->chapters[i]; - av_log(NULL, AV_LOG_INFO, " Chapter #%d.%d: ", index, i); - av_log(NULL, AV_LOG_INFO, - "start %f, ", ch->start * av_q2d(ch->time_base)); - av_log(NULL, AV_LOG_INFO, - "end %f\n", ch->end * av_q2d(ch->time_base)); - - dump_metadata(NULL, ch->metadata, " "); - } - if (ic->nb_programs) { - int j, k, total = 0; - for (j = 0; j < ic->nb_programs; j++) { - AVDictionaryEntry *name = av_dict_get(ic->programs[j]->metadata, - "name", NULL, 0); - av_log(NULL, AV_LOG_INFO, " Program %d %s\n", ic->programs[j]->id, - name ? name->value : ""); - dump_metadata(NULL, ic->programs[j]->metadata, " "); - for (k = 0; k < ic->programs[j]->nb_stream_indexes; k++) { - dump_stream_format(ic, ic->programs[j]->stream_index[k], - index, is_output); - printed[ic->programs[j]->stream_index[k]] = 1; - } - total += ic->programs[j]->nb_stream_indexes; - } - if (total < ic->nb_streams) - av_log(NULL, AV_LOG_INFO, " No Program\n"); - } - for (i = 0; i < ic->nb_streams; i++) - if (!printed[i]) - dump_stream_format(ic, i, index, is_output); - - av_free(printed); -} - -uint64_t ff_ntp_time(void) -{ - return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US; -} - -int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) -{ - const char *p; - char *q, buf1[20], c; - int nd, len, percentd_found; - - q = buf; - p = path; - percentd_found = 0; - for (;;) { - c = *p++; - if (c == '\0') - break; - if (c == '%') { - do { - nd = 0; - while (av_isdigit(*p)) - nd = nd * 10 + *p++ - '0'; - c = *p++; - } while (av_isdigit(c)); - - switch (c) { - case '%': - goto addchar; - case 'd': - if (percentd_found) - goto fail; - percentd_found = 1; - snprintf(buf1, sizeof(buf1), "%0*d", nd, number); - len = strlen(buf1); - if ((q - buf + len) > buf_size - 1) - goto fail; - memcpy(q, buf1, len); - q += len; - break; - default: - goto fail; - } - } else { -addchar: - if ((q - buf) < buf_size - 1) - *q++ = c; - } - } - if (!percentd_found) - goto fail; - *q = '\0'; - return 0; -fail: - *q = '\0'; - return -1; -} - -#define HEXDUMP_PRINT(...) \ - do { \ - if (!f) \ - av_log(avcl, level, __VA_ARGS__); \ - else \ - fprintf(f, __VA_ARGS__); \ - } while (0) - -static void hex_dump_internal(void *avcl, FILE *f, int level, - const uint8_t *buf, int size) -{ - int len, i, j, c; - - for (i = 0; i < size; i += 16) { - len = size - i; - if (len > 16) - len = 16; - HEXDUMP_PRINT("%08x ", i); - for (j = 0; j < 16; j++) { - if (j < len) - HEXDUMP_PRINT(" %02x", buf[i + j]); - else - HEXDUMP_PRINT(" "); - } - HEXDUMP_PRINT(" "); - for (j = 0; j < len; j++) { - c = buf[i + j]; - if (c < ' ' || c > '~') - c = '.'; - HEXDUMP_PRINT("%c", c); - } - HEXDUMP_PRINT("\n"); - } -} - -void av_hex_dump(FILE *f, const uint8_t *buf, int size) -{ - hex_dump_internal(NULL, f, 0, buf, size); -} - -void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size) -{ - hex_dump_internal(avcl, NULL, level, buf, size); -} - -static void pkt_dump_internal(void *avcl, FILE *f, int level, AVPacket *pkt, - int dump_payload, AVRational time_base) -{ - HEXDUMP_PRINT("stream #%d:\n", pkt->stream_index); - HEXDUMP_PRINT(" keyframe=%d\n", (pkt->flags & AV_PKT_FLAG_KEY) != 0); - HEXDUMP_PRINT(" duration=%0.3f\n", pkt->duration * av_q2d(time_base)); - /* DTS is _always_ valid after av_read_frame() */ - HEXDUMP_PRINT(" dts="); - if (pkt->dts == AV_NOPTS_VALUE) - HEXDUMP_PRINT("N/A"); - else - HEXDUMP_PRINT("%0.3f", pkt->dts * av_q2d(time_base)); - /* PTS may not be known if B-frames are present. */ - HEXDUMP_PRINT(" pts="); - if (pkt->pts == AV_NOPTS_VALUE) - HEXDUMP_PRINT("N/A"); - else - HEXDUMP_PRINT("%0.3f", pkt->pts * av_q2d(time_base)); - HEXDUMP_PRINT("\n"); - HEXDUMP_PRINT(" size=%d\n", pkt->size); - if (dump_payload) - av_hex_dump(f, pkt->data, pkt->size); -} - -void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st) -{ - pkt_dump_internal(NULL, f, 0, pkt, dump_payload, st->time_base); -} - -void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, - AVStream *st) -{ - pkt_dump_internal(avcl, NULL, level, pkt, dump_payload, st->time_base); -} - -void av_url_split(char *proto, int proto_size, - char *authorization, int authorization_size, - char *hostname, int hostname_size, - int *port_ptr, char *path, int path_size, const char *url) -{ - const char *p, *ls, *ls2, *at, *at2, *col, *brk; - - if (port_ptr) - *port_ptr = -1; - if (proto_size > 0) - proto[0] = 0; - if (authorization_size > 0) - authorization[0] = 0; - if (hostname_size > 0) - hostname[0] = 0; - if (path_size > 0) - path[0] = 0; - - /* parse protocol */ - if ((p = strchr(url, ':'))) { - av_strlcpy(proto, url, FFMIN(proto_size, p + 1 - url)); - p++; /* skip ':' */ - if (*p == '/') - p++; - if (*p == '/') - p++; - } else { - /* no protocol means plain filename */ - av_strlcpy(path, url, path_size); - return; - } - - /* separate path from hostname */ - ls = strchr(p, '/'); - ls2 = strchr(p, '?'); - if (!ls) - ls = ls2; - else if (ls && ls2) - ls = FFMIN(ls, ls2); - if (ls) - av_strlcpy(path, ls, path_size); - else - ls = &p[strlen(p)]; // XXX - - /* the rest is hostname, use that to parse auth/port */ - if (ls != p) { - /* authorization (user[:pass]@hostname) */ - at2 = p; - while ((at = strchr(p, '@')) && at < ls) { - av_strlcpy(authorization, at2, - FFMIN(authorization_size, at + 1 - at2)); - p = at + 1; /* skip '@' */ - } - - if (*p == '[' && (brk = strchr(p, ']')) && brk < ls) { - /* [host]:port */ - av_strlcpy(hostname, p + 1, - FFMIN(hostname_size, brk - p)); - if (brk[1] == ':' && port_ptr) - *port_ptr = atoi(brk + 2); - } else if ((col = strchr(p, ':')) && col < ls) { - av_strlcpy(hostname, p, - FFMIN(col + 1 - p, hostname_size)); - if (port_ptr) - *port_ptr = atoi(col + 1); - } else - av_strlcpy(hostname, p, - FFMIN(ls + 1 - p, hostname_size)); - } -} - -char *ff_data_to_hex(char *buff, const uint8_t *src, int s, int lowercase) -{ - int i; - static const char hex_table_uc[16] = { '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 'A', 'B', - 'C', 'D', 'E', 'F' }; - static const char hex_table_lc[16] = { '0', '1', '2', '3', - '4', '5', '6', '7', - '8', '9', 'a', 'b', - 'c', 'd', 'e', 'f' }; - const char *hex_table = lowercase ? hex_table_lc : hex_table_uc; - - for (i = 0; i < s; i++) { - buff[i * 2] = hex_table[src[i] >> 4]; - buff[i * 2 + 1] = hex_table[src[i] & 0xF]; - } - - return buff; -} - -int ff_hex_to_data(uint8_t *data, const char *p) -{ - int c, len, v; - - len = 0; - v = 1; - for (;;) { - p += strspn(p, SPACE_CHARS); - if (*p == '\0') - break; - c = av_toupper((unsigned char) *p++); - if (c >= '0' && c <= '9') - c = c - '0'; - else if (c >= 'A' && c <= 'F') - c = c - 'A' + 10; - else - break; - v = (v << 4) | c; - if (v & 0x100) { - if (data) - data[len] = v; - len++; - v = 1; - } - } - return len; -} - -#if FF_API_SET_PTS_INFO -void av_set_pts_info(AVStream *s, int pts_wrap_bits, - unsigned int pts_num, unsigned int pts_den) -{ - avpriv_set_pts_info(s, pts_wrap_bits, pts_num, pts_den); -} -#endif - -void avpriv_set_pts_info(AVStream *s, int pts_wrap_bits, - unsigned int pts_num, unsigned int pts_den) -{ - AVRational new_tb; - if (av_reduce(&new_tb.num, &new_tb.den, pts_num, pts_den, INT_MAX)) { - if (new_tb.num != pts_num) - av_log(NULL, AV_LOG_DEBUG, - "st:%d removing common factor %d from timebase\n", - s->index, pts_num / new_tb.num); - } else - av_log(NULL, AV_LOG_WARNING, - "st:%d has too large timebase, reducing\n", s->index); - - if (new_tb.num <= 0 || new_tb.den <= 0) { - av_log(NULL, AV_LOG_ERROR, - "Ignoring attempt to set invalid timebase %d/%d for st:%d\n", - new_tb.num, new_tb.den, - s->index); - return; - } - s->time_base = new_tb; - av_codec_set_pkt_timebase(s->codec, new_tb); - s->pts_wrap_bits = pts_wrap_bits; -} - -void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf, - void *context) -{ - const char *ptr = str; - - /* Parse key=value pairs. */ - for (;;) { - const char *key; - char *dest = NULL, *dest_end; - int key_len, dest_len = 0; - - /* Skip whitespace and potential commas. */ - while (*ptr && (av_isspace(*ptr) || *ptr == ',')) - ptr++; - if (!*ptr) - break; - - key = ptr; - - if (!(ptr = strchr(key, '='))) - break; - ptr++; - key_len = ptr - key; - - callback_get_buf(context, key, key_len, &dest, &dest_len); - dest_end = dest + dest_len - 1; - - if (*ptr == '\"') { - ptr++; - while (*ptr && *ptr != '\"') { - if (*ptr == '\\') { - if (!ptr[1]) - break; - if (dest && dest < dest_end) - *dest++ = ptr[1]; - ptr += 2; - } else { - if (dest && dest < dest_end) - *dest++ = *ptr; - ptr++; - } - } - if (*ptr == '\"') - ptr++; - } else { - for (; *ptr && !(av_isspace(*ptr) || *ptr == ','); ptr++) - if (dest && dest < dest_end) - *dest++ = *ptr; - } - if (dest) - *dest = 0; - } -} - -int ff_find_stream_index(AVFormatContext *s, int id) -{ - int i; - for (i = 0; i < s->nb_streams; i++) - if (s->streams[i]->id == id) - return i; - return -1; -} - -int64_t ff_iso8601_to_unix_time(const char *datestr) -{ - struct tm time1 = { 0 }, time2 = { 0 }; - char *ret1, *ret2; - ret1 = av_small_strptime(datestr, "%Y - %m - %d %H:%M:%S", &time1); - ret2 = av_small_strptime(datestr, "%Y - %m - %dT%H:%M:%S", &time2); - if (ret2 && !ret1) - return av_timegm(&time2); - else - return av_timegm(&time1); -} - -int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, - int std_compliance) -{ - if (ofmt) { - if (ofmt->query_codec) - return ofmt->query_codec(codec_id, std_compliance); - else if (ofmt->codec_tag) - return !!av_codec_get_tag(ofmt->codec_tag, codec_id); - else if (codec_id == ofmt->video_codec || - codec_id == ofmt->audio_codec || - codec_id == ofmt->subtitle_codec) - return 1; - } - return AVERROR_PATCHWELCOME; -} - -int avformat_network_init(void) -{ -#if CONFIG_NETWORK - int ret; - ff_network_inited_globally = 1; - if ((ret = ff_network_init()) < 0) - return ret; - ff_tls_init(); -#endif - return 0; -} - -int avformat_network_deinit(void) -{ -#if CONFIG_NETWORK - ff_network_close(); - ff_tls_deinit(); -#endif - return 0; -} - -int ff_add_param_change(AVPacket *pkt, int32_t channels, - uint64_t channel_layout, int32_t sample_rate, - int32_t width, int32_t height) -{ - uint32_t flags = 0; - int size = 4; - uint8_t *data; - if (!pkt) - return AVERROR(EINVAL); - if (channels) { - size += 4; - flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT; - } - if (channel_layout) { - size += 8; - flags |= AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT; - } - if (sample_rate) { - size += 4; - flags |= AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE; - } - if (width || height) { - size += 8; - flags |= AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS; - } - data = av_packet_new_side_data(pkt, AV_PKT_DATA_PARAM_CHANGE, size); - if (!data) - return AVERROR(ENOMEM); - bytestream_put_le32(&data, flags); - if (channels) - bytestream_put_le32(&data, channels); - if (channel_layout) - bytestream_put_le64(&data, channel_layout); - if (sample_rate) - bytestream_put_le32(&data, sample_rate); - if (width || height) { - bytestream_put_le32(&data, width); - bytestream_put_le32(&data, height); - } - return 0; -} - -AVRational av_guess_sample_aspect_ratio(AVFormatContext *format, AVStream *stream, AVFrame *frame) -{ - AVRational undef = {0, 1}; - AVRational stream_sample_aspect_ratio = stream ? stream->sample_aspect_ratio : undef; - AVRational codec_sample_aspect_ratio = stream && stream->codec ? stream->codec->sample_aspect_ratio : undef; - AVRational frame_sample_aspect_ratio = frame ? frame->sample_aspect_ratio : codec_sample_aspect_ratio; - - av_reduce(&stream_sample_aspect_ratio.num, &stream_sample_aspect_ratio.den, - stream_sample_aspect_ratio.num, stream_sample_aspect_ratio.den, INT_MAX); - if (stream_sample_aspect_ratio.num <= 0 || stream_sample_aspect_ratio.den <= 0) - stream_sample_aspect_ratio = undef; - - av_reduce(&frame_sample_aspect_ratio.num, &frame_sample_aspect_ratio.den, - frame_sample_aspect_ratio.num, frame_sample_aspect_ratio.den, INT_MAX); - if (frame_sample_aspect_ratio.num <= 0 || frame_sample_aspect_ratio.den <= 0) - frame_sample_aspect_ratio = undef; - - if (stream_sample_aspect_ratio.num) - return stream_sample_aspect_ratio; - else - return frame_sample_aspect_ratio; -} - -AVRational av_guess_frame_rate(AVFormatContext *format, AVStream *st, AVFrame *frame) -{ - AVRational fr = st->r_frame_rate; - AVRational codec_fr = av_inv_q(st->codec->time_base); - AVRational avg_fr = st->avg_frame_rate; - - if (avg_fr.num > 0 && avg_fr.den > 0 && fr.num > 0 && fr.den > 0 && - av_q2d(avg_fr) < 70 && av_q2d(fr) > 210) { - fr = avg_fr; - } - - - if (st->codec->ticks_per_frame > 1) { - codec_fr.den *= st->codec->ticks_per_frame; - if ( codec_fr.num > 0 && codec_fr.den > 0 && av_q2d(codec_fr) < av_q2d(fr)*0.7 - && fabs(1.0 - av_q2d(av_div_q(avg_fr, fr))) > 0.1) - fr = codec_fr; - } - - return fr; -} - -int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, - const char *spec) -{ - if (*spec <= '9' && *spec >= '0') /* opt:index */ - return strtol(spec, NULL, 0) == st->index; - else if (*spec == 'v' || *spec == 'a' || *spec == 's' || *spec == 'd' || - *spec == 't') { /* opt:[vasdt] */ - enum AVMediaType type; - - switch (*spec++) { - case 'v': type = AVMEDIA_TYPE_VIDEO; break; - case 'a': type = AVMEDIA_TYPE_AUDIO; break; - case 's': type = AVMEDIA_TYPE_SUBTITLE; break; - case 'd': type = AVMEDIA_TYPE_DATA; break; - case 't': type = AVMEDIA_TYPE_ATTACHMENT; break; - default: av_assert0(0); - } - if (type != st->codec->codec_type) - return 0; - if (*spec++ == ':') { /* possibly followed by :index */ - int i, index = strtol(spec, NULL, 0); - for (i = 0; i < s->nb_streams; i++) - if (s->streams[i]->codec->codec_type == type && index-- == 0) - return i == st->index; - return 0; - } - return 1; - } else if (*spec == 'p' && *(spec + 1) == ':') { - int prog_id, i, j; - char *endptr; - spec += 2; - prog_id = strtol(spec, &endptr, 0); - for (i = 0; i < s->nb_programs; i++) { - if (s->programs[i]->id != prog_id) - continue; - - if (*endptr++ == ':') { - int stream_idx = strtol(endptr, NULL, 0); - return stream_idx >= 0 && - stream_idx < s->programs[i]->nb_stream_indexes && - st->index == s->programs[i]->stream_index[stream_idx]; - } - - for (j = 0; j < s->programs[i]->nb_stream_indexes; j++) - if (st->index == s->programs[i]->stream_index[j]) - return 1; - } - return 0; - } else if (*spec == '#') { - int sid; - char *endptr; - sid = strtol(spec + 1, &endptr, 0); - if (!*endptr) - return st->id == sid; - } else if (!*spec) /* empty specifier, matches everything */ - return 1; - - av_log(s, AV_LOG_ERROR, "Invalid stream specifier: %s.\n", spec); - return AVERROR(EINVAL); -} - -int ff_generate_avci_extradata(AVStream *st) -{ - static const uint8_t avci100_1080p_extradata[] = { - // SPS - 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29, - 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63, - 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19, - 0x18, 0x21, 0x02, 0x56, 0xb9, 0x3d, 0x7d, 0x7e, - 0x4f, 0xe3, 0x3f, 0x11, 0xf1, 0x9e, 0x08, 0xb8, - 0x8c, 0x54, 0x43, 0xc0, 0x78, 0x02, 0x27, 0xe2, - 0x70, 0x1e, 0x30, 0x10, 0x10, 0x14, 0x00, 0x00, - 0x03, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0xca, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - // PPS - 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48, - 0xd0 - }; - static const uint8_t avci100_1080i_extradata[] = { - // SPS - 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29, - 0xb6, 0xd4, 0x20, 0x22, 0x33, 0x19, 0xc6, 0x63, - 0x23, 0x21, 0x01, 0x11, 0x98, 0xce, 0x33, 0x19, - 0x18, 0x21, 0x03, 0x3a, 0x46, 0x65, 0x6a, 0x65, - 0x24, 0xad, 0xe9, 0x12, 0x32, 0x14, 0x1a, 0x26, - 0x34, 0xad, 0xa4, 0x41, 0x82, 0x23, 0x01, 0x50, - 0x2b, 0x1a, 0x24, 0x69, 0x48, 0x30, 0x40, 0x2e, - 0x11, 0x12, 0x08, 0xc6, 0x8c, 0x04, 0x41, 0x28, - 0x4c, 0x34, 0xf0, 0x1e, 0x01, 0x13, 0xf2, 0xe0, - 0x3c, 0x60, 0x20, 0x20, 0x28, 0x00, 0x00, 0x03, - 0x00, 0x08, 0x00, 0x00, 0x03, 0x01, 0x94, 0x00, - // PPS - 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x33, 0x48, - 0xd0 - }; - static const uint8_t avci50_1080i_extradata[] = { - // SPS - 0x00, 0x00, 0x00, 0x01, 0x67, 0x6e, 0x10, 0x28, - 0xa6, 0xd4, 0x20, 0x32, 0x33, 0x0c, 0x71, 0x18, - 0x88, 0x62, 0x10, 0x19, 0x19, 0x86, 0x38, 0x8c, - 0x44, 0x30, 0x21, 0x02, 0x56, 0x4e, 0x6e, 0x61, - 0x87, 0x3e, 0x73, 0x4d, 0x98, 0x0c, 0x03, 0x06, - 0x9c, 0x0b, 0x73, 0xe6, 0xc0, 0xb5, 0x18, 0x63, - 0x0d, 0x39, 0xe0, 0x5b, 0x02, 0xd4, 0xc6, 0x19, - 0x1a, 0x79, 0x8c, 0x32, 0x34, 0x24, 0xf0, 0x16, - 0x81, 0x13, 0xf7, 0xff, 0x80, 0x02, 0x00, 0x01, - 0xf1, 0x80, 0x80, 0x80, 0xa0, 0x00, 0x00, 0x03, - 0x00, 0x20, 0x00, 0x00, 0x06, 0x50, 0x80, 0x00, - // PPS - 0x00, 0x00, 0x00, 0x01, 0x68, 0xee, 0x31, 0x12, - 0x11 - }; - static const uint8_t avci100_720p_extradata[] = { - // SPS - 0x00, 0x00, 0x00, 0x01, 0x67, 0x7a, 0x10, 0x29, - 0xb6, 0xd4, 0x20, 0x2a, 0x33, 0x1d, 0xc7, 0x62, - 0xa1, 0x08, 0x40, 0x54, 0x66, 0x3b, 0x8e, 0xc5, - 0x42, 0x02, 0x10, 0x25, 0x64, 0x2c, 0x89, 0xe8, - 0x85, 0xe4, 0x21, 0x4b, 0x90, 0x83, 0x06, 0x95, - 0xd1, 0x06, 0x46, 0x97, 0x20, 0xc8, 0xd7, 0x43, - 0x08, 0x11, 0xc2, 0x1e, 0x4c, 0x91, 0x0f, 0x01, - 0x40, 0x16, 0xec, 0x07, 0x8c, 0x04, 0x04, 0x05, - 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x00, 0x03, - 0x00, 0x64, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, - // PPS - 0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12, - 0x11 - }; - - const uint8_t *data = NULL; - int size = 0; - - if (st->codec->width == 1920) { - if (st->codec->field_order == AV_FIELD_PROGRESSIVE) { - data = avci100_1080p_extradata; - size = sizeof(avci100_1080p_extradata); - } else { - data = avci100_1080i_extradata; - size = sizeof(avci100_1080i_extradata); - } - } else if (st->codec->width == 1440) { - data = avci50_1080i_extradata; - size = sizeof(avci50_1080i_extradata); - } else if (st->codec->width == 1280) { - data = avci100_720p_extradata; - size = sizeof(avci100_720p_extradata); - } - - if (!size) - return 0; - - av_freep(&st->codec->extradata); - if (ff_alloc_extradata(st->codec, size)) - return AVERROR(ENOMEM); - memcpy(st->codec->extradata, data, size); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/vqf.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/vqf.c deleted file mode 100644 index 66dda8de5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/vqf.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * VQF demuxer - * Copyright (c) 2009 Vitor Sessak - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avformat.h" -#include "internal.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/dict.h" -#include "libavutil/mathematics.h" -#include "riff.h" - -typedef struct VqfContext { - int frame_bit_len; - uint8_t last_frame_bits; - int remaining_bits; -} VqfContext; - -static int vqf_probe(AVProbeData *probe_packet) -{ - if (AV_RL32(probe_packet->buf) != MKTAG('T','W','I','N')) - return 0; - - if (!memcmp(probe_packet->buf + 4, "97012000", 8)) - return AVPROBE_SCORE_MAX; - - if (!memcmp(probe_packet->buf + 4, "00052200", 8)) - return AVPROBE_SCORE_MAX; - - if (AV_RL32(probe_packet->buf + 12) > (1<<27)) - return AVPROBE_SCORE_EXTENSION/2; - - return AVPROBE_SCORE_EXTENSION; -} - -static void add_metadata(AVFormatContext *s, uint32_t tag, - unsigned int tag_len, unsigned int remaining) -{ - int len = FFMIN(tag_len, remaining); - char *buf, key[5] = {0}; - - if (len == UINT_MAX) - return; - - buf = av_malloc(len+1); - if (!buf) - return; - avio_read(s->pb, buf, len); - buf[len] = 0; - AV_WL32(key, tag); - av_dict_set(&s->metadata, key, buf, AV_DICT_DONT_STRDUP_VAL); -} - -static const AVMetadataConv vqf_metadata_conv[] = { - { "(c) ", "copyright" }, - { "ARNG", "arranger" }, - { "AUTH", "author" }, - { "BAND", "band" }, - { "CDCT", "conductor" }, - { "COMT", "comment" }, - { "FILE", "filename" }, - { "GENR", "genre" }, - { "LABL", "publisher" }, - { "MUSC", "composer" }, - { "NAME", "title" }, - { "NOTE", "note" }, - { "PROD", "producer" }, - { "PRSN", "personnel" }, - { "REMX", "remixer" }, - { "SING", "singer" }, - { "TRCK", "track" }, - { "WORD", "words" }, - { 0 }, -}; - -static int vqf_read_header(AVFormatContext *s) -{ - VqfContext *c = s->priv_data; - AVStream *st = avformat_new_stream(s, NULL); - int chunk_tag; - int rate_flag = -1; - int header_size; - int read_bitrate = 0; - int size; - uint8_t comm_chunk[12]; - - if (!st) - return AVERROR(ENOMEM); - - avio_skip(s->pb, 12); - - header_size = avio_rb32(s->pb); - - st->codec->codec_type = AVMEDIA_TYPE_AUDIO; - st->codec->codec_id = AV_CODEC_ID_TWINVQ; - st->start_time = 0; - - do { - int len; - chunk_tag = avio_rl32(s->pb); - - if (chunk_tag == MKTAG('D','A','T','A')) - break; - - len = avio_rb32(s->pb); - - if ((unsigned) len > INT_MAX/2) { - av_log(s, AV_LOG_ERROR, "Malformed header\n"); - return -1; - } - - header_size -= 8; - - switch(chunk_tag){ - case MKTAG('C','O','M','M'): - avio_read(s->pb, comm_chunk, 12); - st->codec->channels = AV_RB32(comm_chunk ) + 1; - read_bitrate = AV_RB32(comm_chunk + 4); - rate_flag = AV_RB32(comm_chunk + 8); - avio_skip(s->pb, len-12); - - if (st->codec->channels <= 0) { - av_log(s, AV_LOG_ERROR, "Invalid number of channels\n"); - return AVERROR_INVALIDDATA; - } - - st->codec->bit_rate = read_bitrate*1000; - break; - case MKTAG('D','S','I','Z'): // size of compressed data - { - char buf[8] = {0}; - int size = avio_rb32(s->pb); - - snprintf(buf, sizeof(buf), "%d", size); - av_dict_set(&s->metadata, "size", buf, 0); - } - break; - case MKTAG('Y','E','A','R'): // recording date - case MKTAG('E','N','C','D'): // compression date - case MKTAG('E','X','T','R'): // reserved - case MKTAG('_','Y','M','H'): // reserved - case MKTAG('_','N','T','T'): // reserved - case MKTAG('_','I','D','3'): // reserved for ID3 tags - avio_skip(s->pb, FFMIN(len, header_size)); - break; - default: - add_metadata(s, chunk_tag, len, header_size); - break; - } - - header_size -= len; - - } while (header_size >= 0 && !url_feof(s->pb)); - - switch (rate_flag) { - case -1: - av_log(s, AV_LOG_ERROR, "COMM tag not found!\n"); - return -1; - case 44: - st->codec->sample_rate = 44100; - break; - case 22: - st->codec->sample_rate = 22050; - break; - case 11: - st->codec->sample_rate = 11025; - break; - default: - if (rate_flag < 8 || rate_flag > 44) { - av_log(s, AV_LOG_ERROR, "Invalid rate flag %d\n", rate_flag); - return AVERROR_INVALIDDATA; - } - st->codec->sample_rate = rate_flag*1000; - break; - } - - if (read_bitrate / st->codec->channels < 8 || - read_bitrate / st->codec->channels > 48) { - av_log(s, AV_LOG_ERROR, "Invalid bitrate per channel %d\n", - read_bitrate / st->codec->channels); - return AVERROR_INVALIDDATA; - } - - switch (((st->codec->sample_rate/1000) << 8) + - read_bitrate/st->codec->channels) { - case (11<<8) + 8 : - case (8 <<8) + 8 : - case (11<<8) + 10: - case (22<<8) + 32: - size = 512; - break; - case (16<<8) + 16: - case (22<<8) + 20: - case (22<<8) + 24: - size = 1024; - break; - case (44<<8) + 40: - case (44<<8) + 48: - size = 2048; - break; - default: - av_log(s, AV_LOG_ERROR, "Mode not suported: %d Hz, %d kb/s.\n", - st->codec->sample_rate, st->codec->bit_rate); - return -1; - } - c->frame_bit_len = st->codec->bit_rate*size/st->codec->sample_rate; - avpriv_set_pts_info(st, 64, size, st->codec->sample_rate); - - /* put first 12 bytes of COMM chunk in extradata */ - if (ff_alloc_extradata(st->codec, 12)) - return AVERROR(ENOMEM); - memcpy(st->codec->extradata, comm_chunk, 12); - - ff_metadata_conv_ctx(s, NULL, vqf_metadata_conv); - - return 0; -} - -static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - VqfContext *c = s->priv_data; - int ret; - int size = (c->frame_bit_len - c->remaining_bits + 7)>>3; - - if (av_new_packet(pkt, size+2) < 0) - return AVERROR(EIO); - - pkt->pos = avio_tell(s->pb); - pkt->stream_index = 0; - pkt->duration = 1; - - pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip - pkt->data[1] = c->last_frame_bits; - ret = avio_read(s->pb, pkt->data+2, size); - - if (ret != size) { - av_free_packet(pkt); - return AVERROR(EIO); - } - - c->last_frame_bits = pkt->data[size+1]; - c->remaining_bits = (size << 3) - c->frame_bit_len + c->remaining_bits; - - return size+2; -} - -static int vqf_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags) -{ - VqfContext *c = s->priv_data; - AVStream *st; - int ret; - int64_t pos; - - st = s->streams[stream_index]; - pos = av_rescale_rnd(timestamp * st->codec->bit_rate, - st->time_base.num, - st->time_base.den * (int64_t)c->frame_bit_len, - (flags & AVSEEK_FLAG_BACKWARD) ? - AV_ROUND_DOWN : AV_ROUND_UP); - pos *= c->frame_bit_len; - - st->cur_dts = av_rescale(pos, st->time_base.den, - st->codec->bit_rate * (int64_t)st->time_base.num); - - if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) - return ret; - - c->remaining_bits = -7 - ((pos-7)&7); - return 0; -} - -AVInputFormat ff_vqf_demuxer = { - .name = "vqf", - .long_name = "Nippon Telegraph and Telephone Corporation (NTT) TwinVQ", - .priv_data_size = sizeof(VqfContext), - .read_probe = vqf_probe, - .read_header = vqf_read_header, - .read_packet = vqf_read_packet, - .read_seek = vqf_read_seek, - .extensions = "vqf,vql,vqe", -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.c deleted file mode 100644 index ef2d90a60..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2009 Daniel Verkamp - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "w64.h" - -const uint8_t ff_w64_guid_riff[16] = { - 'r', 'i', 'f', 'f', - 0x2E, 0x91, 0xCF, 0x11, 0xA5, 0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00 -}; - -const uint8_t ff_w64_guid_wave[16] = { - 'w', 'a', 'v', 'e', - 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A -}; - -const uint8_t ff_w64_guid_fmt [16] = { - 'f', 'm', 't', ' ', - 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A -}; - -const uint8_t ff_w64_guid_fact[16] = { 'f', 'a', 'c', 't', - 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A -}; - -const uint8_t ff_w64_guid_data[16] = { - 'd', 'a', 't', 'a', - 0xF3, 0xAC, 0xD3, 0x11, 0x8C, 0xD1, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A -}; - -const uint8_t ff_w64_guid_summarylist[16] = { - 0xBC, 0x94, 0x5F, 0x92, - 0x5A, 0x52, 0xD2, 0x11, 0x86, 0xDC, 0x00, 0xC0, 0x4F, 0x8E, 0xDB, 0x8A -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.h deleted file mode 100644 index 0ec3fa914..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/w64.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVFORMAT_W64_H -#define AVFORMAT_W64_H - -#include - -extern const uint8_t ff_w64_guid_riff[16]; -extern const uint8_t ff_w64_guid_wave[16]; -extern const uint8_t ff_w64_guid_fmt [16]; -extern const uint8_t ff_w64_guid_fact[16]; -extern const uint8_t ff_w64_guid_data[16]; -extern const uint8_t ff_w64_guid_summarylist[16]; - -#endif /* AVFORMAT_W64_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/wavdec.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/wavdec.c deleted file mode 100644 index afaf0a0e5..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/wavdec.c +++ /dev/null @@ -1,741 +0,0 @@ -/* - * WAV demuxer - * Copyright (c) 2001, 2002 Fabrice Bellard - * - * Sony Wave64 demuxer - * RF64 demuxer - * Copyright (c) 2009 Daniel Verkamp - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "config.h" - -#include "libavutil/avassert.h" -#include "libavutil/dict.h" -#include "libavutil/intreadwrite.h" -#include "libavutil/log.h" -#include "libavutil/mathematics.h" -#include "libavutil/opt.h" -#include "avformat.h" -#include "avio.h" -#include "avio_internal.h" -#include "internal.h" -#include "metadata.h" -#include "pcm.h" -#include "riff.h" -#include "w64.h" -#include "spdif.h" - -typedef struct WAVDemuxContext { - const AVClass *class; - int64_t data_end; - int w64; - int64_t smv_data_ofs; - int smv_block_size; - int smv_frames_per_jpeg; - int smv_block; - int smv_last_stream; - int smv_eof; - int audio_eof; - int ignore_length; - int spdif; - int smv_cur_pt; - int smv_given_first; - int unaligned; // e.g. if an odd number of bytes ID3 tag was prepended -} WAVDemuxContext; - -#if CONFIG_WAV_DEMUXER - -static int64_t next_tag(AVIOContext *pb, uint32_t *tag) -{ - *tag = avio_rl32(pb); - return avio_rl32(pb); -} - -/* RIFF chunks are always at even offsets relative to where they start. */ -static int64_t wav_seek_tag(WAVDemuxContext * wav, AVIOContext *s, int64_t offset, int whence) -{ - offset += offset < INT64_MAX && offset + wav->unaligned & 1; - - return avio_seek(s, offset, whence); -} - -/* return the size of the found tag */ -static int64_t find_tag(WAVDemuxContext * wav, AVIOContext *pb, uint32_t tag1) -{ - unsigned int tag; - int64_t size; - - for (;;) { - if (url_feof(pb)) - return AVERROR_EOF; - size = next_tag(pb, &tag); - if (tag == tag1) - break; - wav_seek_tag(wav, pb, size, SEEK_CUR); - } - return size; -} - -static int wav_probe(AVProbeData *p) -{ - /* check file header */ - if (p->buf_size <= 32) - return 0; - if (!memcmp(p->buf + 8, "WAVE", 4)) { - if (!memcmp(p->buf, "RIFF", 4)) - /* Since the ACT demuxer has a standard WAV header at the top of - * its own, the returned score is decreased to avoid a probe - * conflict between ACT and WAV. */ - return AVPROBE_SCORE_MAX - 1; - else if (!memcmp(p->buf, "RF64", 4) && - !memcmp(p->buf + 12, "ds64", 4)) - return AVPROBE_SCORE_MAX; - } - return 0; -} - -static void handle_stream_probing(AVStream *st) -{ - if (st->codec->codec_id == AV_CODEC_ID_PCM_S16LE) { - st->request_probe = AVPROBE_SCORE_EXTENSION; - st->probe_packets = FFMIN(st->probe_packets, 4); - } -} - -static int wav_parse_fmt_tag(AVFormatContext *s, int64_t size, AVStream **st) -{ - AVIOContext *pb = s->pb; - int ret; - - /* parse fmt header */ - *st = avformat_new_stream(s, NULL); - if (!*st) - return AVERROR(ENOMEM); - - ret = ff_get_wav_header(pb, (*st)->codec, size); - if (ret < 0) - return ret; - handle_stream_probing(*st); - - (*st)->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - avpriv_set_pts_info(*st, 64, 1, (*st)->codec->sample_rate); - - return 0; -} - -static inline int wav_parse_bext_string(AVFormatContext *s, const char *key, - int length) -{ - char temp[257]; - int ret; - - av_assert0(length <= sizeof(temp)); - if ((ret = avio_read(s->pb, (unsigned char *) temp, length)) < 0) - return ret; - - temp[length] = 0; - - if (strlen(temp)) - return av_dict_set(&s->metadata, key, temp, 0); - - return 0; -} - -static int wav_parse_bext_tag(AVFormatContext *s, int64_t size) -{ - char temp[131], *coding_history; - int ret, x; - uint64_t time_reference; - int64_t umid_parts[8], umid_mask = 0; - - if ((ret = wav_parse_bext_string(s, "description", 256)) < 0 || - (ret = wav_parse_bext_string(s, "originator", 32)) < 0 || - (ret = wav_parse_bext_string(s, "originator_reference", 32)) < 0 || - (ret = wav_parse_bext_string(s, "origination_date", 10)) < 0 || - (ret = wav_parse_bext_string(s, "origination_time", 8)) < 0) - return ret; - - time_reference = avio_rl64(s->pb); - snprintf(temp, sizeof(temp), "%"PRIu64, time_reference); - if ((ret = av_dict_set(&s->metadata, "time_reference", temp, 0)) < 0) - return ret; - - /* check if version is >= 1, in which case an UMID may be present */ - if (avio_rl16(s->pb) >= 1) { - for (x = 0; x < 8; x++) - umid_mask |= umid_parts[x] = avio_rb64(s->pb); - - if (umid_mask) { - /* the string formatting below is per SMPTE 330M-2004 Annex C */ - if (umid_parts[4] == 0 && umid_parts[5] == 0 && - umid_parts[6] == 0 && umid_parts[7] == 0) { - /* basic UMID */ - snprintf(temp, sizeof(temp), - "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64, - umid_parts[0], umid_parts[1], - umid_parts[2], umid_parts[3]); - } else { - /* extended UMID */ - snprintf(temp, sizeof(temp), - "0x%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64 - "%016"PRIX64"%016"PRIX64"%016"PRIX64"%016"PRIX64, - umid_parts[0], umid_parts[1], - umid_parts[2], umid_parts[3], - umid_parts[4], umid_parts[5], - umid_parts[6], umid_parts[7]); - } - - if ((ret = av_dict_set(&s->metadata, "umid", temp, 0)) < 0) - return ret; - } - - avio_skip(s->pb, 190); - } else - avio_skip(s->pb, 254); - - if (size > 602) { - /* CodingHistory present */ - size -= 602; - - if (!(coding_history = av_malloc(size + 1))) - return AVERROR(ENOMEM); - - if ((ret = avio_read(s->pb, (unsigned char *) coding_history, size)) < 0) - return ret; - - coding_history[size] = 0; - if ((ret = av_dict_set(&s->metadata, "coding_history", coding_history, - AV_DICT_DONT_STRDUP_VAL)) < 0) - return ret; - } - - return 0; -} - -static const AVMetadataConv wav_metadata_conv[] = { - { "description", "comment" }, - { "originator", "encoded_by" }, - { "origination_date", "date" }, - { "origination_time", "creation_time" }, - { 0 }, -}; - -/* wav input */ -static int wav_read_header(AVFormatContext *s) -{ - int64_t size, av_uninit(data_size); - int64_t sample_count = 0; - int rf64; - uint32_t tag; - AVIOContext *pb = s->pb; - AVStream *st = NULL; - WAVDemuxContext *wav = s->priv_data; - int ret, got_fmt = 0; - int64_t next_tag_ofs, data_ofs = -1; - - wav->unaligned = avio_tell(s->pb) & 1; - - wav->smv_data_ofs = -1; - - /* check RIFF header */ - tag = avio_rl32(pb); - - rf64 = tag == MKTAG('R', 'F', '6', '4'); - if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) - return AVERROR_INVALIDDATA; - avio_rl32(pb); /* file size */ - tag = avio_rl32(pb); - if (tag != MKTAG('W', 'A', 'V', 'E')) - return AVERROR_INVALIDDATA; - - if (rf64) { - if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) - return AVERROR_INVALIDDATA; - size = avio_rl32(pb); - if (size < 24) - return AVERROR_INVALIDDATA; - avio_rl64(pb); /* RIFF size */ - - data_size = avio_rl64(pb); - sample_count = avio_rl64(pb); - - if (data_size < 0 || sample_count < 0) { - av_log(s, AV_LOG_ERROR, "negative data_size and/or sample_count in " - "ds64: data_size = %"PRId64", sample_count = %"PRId64"\n", - data_size, sample_count); - return AVERROR_INVALIDDATA; - } - avio_skip(pb, size - 24); /* skip rest of ds64 chunk */ - - } - - for (;;) { - AVStream *vst; - size = next_tag(pb, &tag); - next_tag_ofs = avio_tell(pb) + size; - - if (url_feof(pb)) - break; - - switch (tag) { - case MKTAG('f', 'm', 't', ' '): - /* only parse the first 'fmt ' tag found */ - if (!got_fmt && (ret = wav_parse_fmt_tag(s, size, &st)) < 0) { - return ret; - } else if (got_fmt) - av_log(s, AV_LOG_WARNING, "found more than one 'fmt ' tag\n"); - - got_fmt = 1; - break; - case MKTAG('d', 'a', 't', 'a'): - if (!got_fmt) { - av_log(s, AV_LOG_ERROR, - "found no 'fmt ' tag before the 'data' tag\n"); - return AVERROR_INVALIDDATA; - } - - if (rf64) { - next_tag_ofs = wav->data_end = avio_tell(pb) + data_size; - } else { - data_size = size; - next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; - } - - data_ofs = avio_tell(pb); - - /* don't look for footer metadata if we can't seek or if we don't - * know where the data tag ends - */ - if (!pb->seekable || (!rf64 && !size)) - goto break_loop; - break; - case MKTAG('f', 'a', 'c', 't'): - if (!sample_count) - sample_count = avio_rl32(pb); - break; - case MKTAG('b', 'e', 'x', 't'): - if ((ret = wav_parse_bext_tag(s, size)) < 0) - return ret; - break; - case MKTAG('S','M','V','0'): - if (!got_fmt) { - av_log(s, AV_LOG_ERROR, "found no 'fmt ' tag before the 'SMV0' tag\n"); - return AVERROR_INVALIDDATA; - } - // SMV file, a wav file with video appended. - if (size != MKTAG('0','2','0','0')) { - av_log(s, AV_LOG_ERROR, "Unknown SMV version found\n"); - goto break_loop; - } - av_log(s, AV_LOG_DEBUG, "Found SMV data\n"); - wav->smv_given_first = 0; - vst = avformat_new_stream(s, NULL); - if (!vst) - return AVERROR(ENOMEM); - avio_r8(pb); - vst->id = 1; - vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; - vst->codec->codec_id = AV_CODEC_ID_SMVJPEG; - vst->codec->width = avio_rl24(pb); - vst->codec->height = avio_rl24(pb); - if (ff_alloc_extradata(vst->codec, 4)) { - av_log(s, AV_LOG_ERROR, "Could not allocate extradata.\n"); - return AVERROR(ENOMEM); - } - size = avio_rl24(pb); - wav->smv_data_ofs = avio_tell(pb) + (size - 5) * 3; - avio_rl24(pb); - wav->smv_block_size = avio_rl24(pb); - avpriv_set_pts_info(vst, 32, 1, avio_rl24(pb)); - vst->duration = avio_rl24(pb); - avio_rl24(pb); - avio_rl24(pb); - wav->smv_frames_per_jpeg = avio_rl24(pb); - if (wav->smv_frames_per_jpeg > 65536) { - av_log(s, AV_LOG_ERROR, "too many frames per jpeg\n"); - return AVERROR_INVALIDDATA; - } - AV_WL32(vst->codec->extradata, wav->smv_frames_per_jpeg); - wav->smv_cur_pt = 0; - goto break_loop; - case MKTAG('L', 'I', 'S', 'T'): - if (size < 4) { - av_log(s, AV_LOG_ERROR, "too short LIST tag\n"); - return AVERROR_INVALIDDATA; - } - switch (avio_rl32(pb)) { - case MKTAG('I', 'N', 'F', 'O'): - ff_read_riff_info(s, size - 4); - } - break; - } - - /* seek to next tag unless we know that we'll run into EOF */ - if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || - wav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) { - break; - } - } - -break_loop: - if (data_ofs < 0) { - av_log(s, AV_LOG_ERROR, "no 'data' tag found\n"); - return AVERROR_INVALIDDATA; - } - - avio_seek(pb, data_ofs, SEEK_SET); - - if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0) - if ( st->codec->channels - && data_size - && av_get_bits_per_sample(st->codec->codec_id) - && wav->data_end <= avio_size(pb)) - sample_count = (data_size << 3) - / - (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id)); - - if (sample_count) - st->duration = sample_count; - - ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); - ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); - - return 0; -} - -/** - * Find chunk with w64 GUID by skipping over other chunks. - * @return the size of the found chunk - */ -static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) -{ - uint8_t guid[16]; - int64_t size; - - while (!url_feof(pb)) { - avio_read(pb, guid, 16); - size = avio_rl64(pb); - if (size <= 24) - return AVERROR_INVALIDDATA; - if (!memcmp(guid, guid1, 16)) - return size; - avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); - } - return AVERROR_EOF; -} - -#define MAX_SIZE 4096 - -static int wav_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size; - int64_t left; - AVStream *st; - WAVDemuxContext *wav = s->priv_data; - - if (CONFIG_SPDIF_DEMUXER && wav->spdif == 0 && - s->streams[0]->codec->codec_tag == 1) { - enum AVCodecID codec; - ret = ff_spdif_probe(s->pb->buffer, s->pb->buf_end - s->pb->buffer, - &codec); - if (ret > AVPROBE_SCORE_EXTENSION) { - s->streams[0]->codec->codec_id = codec; - wav->spdif = 1; - } else { - wav->spdif = -1; - } - } - if (CONFIG_SPDIF_DEMUXER && wav->spdif == 1) - return ff_spdif_read_packet(s, pkt); - - if (wav->smv_data_ofs > 0) { - int64_t audio_dts, video_dts; -smv_retry: - audio_dts = (int32_t)s->streams[0]->cur_dts; - video_dts = (int32_t)s->streams[1]->cur_dts; - - if (audio_dts != AV_NOPTS_VALUE && video_dts != AV_NOPTS_VALUE) { - /*We always return a video frame first to get the pixel format first*/ - wav->smv_last_stream = wav->smv_given_first ? - av_compare_ts(video_dts, s->streams[1]->time_base, - audio_dts, s->streams[0]->time_base) > 0 : 0; - wav->smv_given_first = 1; - } - wav->smv_last_stream = !wav->smv_last_stream; - wav->smv_last_stream |= wav->audio_eof; - wav->smv_last_stream &= !wav->smv_eof; - if (wav->smv_last_stream) { - uint64_t old_pos = avio_tell(s->pb); - uint64_t new_pos = wav->smv_data_ofs + - wav->smv_block * wav->smv_block_size; - if (avio_seek(s->pb, new_pos, SEEK_SET) < 0) { - ret = AVERROR_EOF; - goto smv_out; - } - size = avio_rl24(s->pb); - ret = av_get_packet(s->pb, pkt, size); - if (ret < 0) - goto smv_out; - pkt->pos -= 3; - pkt->pts = wav->smv_block * wav->smv_frames_per_jpeg + wav->smv_cur_pt; - wav->smv_cur_pt++; - if (wav->smv_frames_per_jpeg > 0) - wav->smv_cur_pt %= wav->smv_frames_per_jpeg; - if (!wav->smv_cur_pt) - wav->smv_block++; - - pkt->stream_index = 1; -smv_out: - avio_seek(s->pb, old_pos, SEEK_SET); - if (ret == AVERROR_EOF) { - wav->smv_eof = 1; - goto smv_retry; - } - return ret; - } - } - - st = s->streams[0]; - - left = wav->data_end - avio_tell(s->pb); - if (wav->ignore_length) - left = INT_MAX; - if (left <= 0) { - if (CONFIG_W64_DEMUXER && wav->w64) - left = find_guid(s->pb, ff_w64_guid_data) - 24; - else - left = find_tag(wav, s->pb, MKTAG('d', 'a', 't', 'a')); - if (left < 0) { - wav->audio_eof = 1; - if (wav->smv_data_ofs > 0 && !wav->smv_eof) - goto smv_retry; - return AVERROR_EOF; - } - wav->data_end = avio_tell(s->pb) + left; - } - - size = MAX_SIZE; - if (st->codec->block_align > 1) { - if (size < st->codec->block_align) - size = st->codec->block_align; - size = (size / st->codec->block_align) * st->codec->block_align; - } - size = FFMIN(size, left); - ret = av_get_packet(s->pb, pkt, size); - if (ret < 0) - return ret; - pkt->stream_index = 0; - - return ret; -} - -static int wav_read_seek(AVFormatContext *s, - int stream_index, int64_t timestamp, int flags) -{ - WAVDemuxContext *wav = s->priv_data; - AVStream *st; - wav->smv_eof = 0; - wav->audio_eof = 0; - if (wav->smv_data_ofs > 0) { - int64_t smv_timestamp = timestamp; - if (stream_index == 0) - smv_timestamp = av_rescale_q(timestamp, s->streams[0]->time_base, s->streams[1]->time_base); - else - timestamp = av_rescale_q(smv_timestamp, s->streams[1]->time_base, s->streams[0]->time_base); - if (wav->smv_frames_per_jpeg > 0) { - wav->smv_block = smv_timestamp / wav->smv_frames_per_jpeg; - wav->smv_cur_pt = smv_timestamp % wav->smv_frames_per_jpeg; - } - } - - st = s->streams[0]; - switch (st->codec->codec_id) { - case AV_CODEC_ID_MP2: - case AV_CODEC_ID_MP3: - case AV_CODEC_ID_AC3: - case AV_CODEC_ID_DTS: - /* use generic seeking with dynamically generated indexes */ - return -1; - default: - break; - } - return ff_pcm_read_seek(s, stream_index, timestamp, flags); -} - -#define OFFSET(x) offsetof(WAVDemuxContext, x) -#define DEC AV_OPT_FLAG_DECODING_PARAM -static const AVOption demux_options[] = { - { "ignore_length", "Ignore length", OFFSET(ignore_length), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, DEC }, - { NULL }, -}; - -static const AVClass wav_demuxer_class = { - .class_name = "WAV demuxer", - .item_name = av_default_item_name, - .option = demux_options, - .version = LIBAVUTIL_VERSION_INT, -}; -AVInputFormat ff_wav_demuxer = { - .name = "wav", - .long_name = NULL_IF_CONFIG_SMALL("WAV / WAVE (Waveform Audio)"), - .priv_data_size = sizeof(WAVDemuxContext), - .read_probe = wav_probe, - .read_header = wav_read_header, - .read_packet = wav_read_packet, - .read_seek = wav_read_seek, - .flags = AVFMT_GENERIC_INDEX, - .codec_tag = (const AVCodecTag * const []) { ff_codec_wav_tags, 0 }, - .priv_class = &wav_demuxer_class, -}; -#endif /* CONFIG_WAV_DEMUXER */ - -#if CONFIG_W64_DEMUXER -static int w64_probe(AVProbeData *p) -{ - if (p->buf_size <= 40) - return 0; - if (!memcmp(p->buf, ff_w64_guid_riff, 16) && - !memcmp(p->buf + 24, ff_w64_guid_wave, 16)) - return AVPROBE_SCORE_MAX; - else - return 0; -} - -static int w64_read_header(AVFormatContext *s) -{ - int64_t size, data_ofs = 0; - AVIOContext *pb = s->pb; - WAVDemuxContext *wav = s->priv_data; - AVStream *st; - uint8_t guid[16]; - int ret; - - avio_read(pb, guid, 16); - if (memcmp(guid, ff_w64_guid_riff, 16)) - return AVERROR_INVALIDDATA; - - /* riff + wave + fmt + sizes */ - if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) - return AVERROR_INVALIDDATA; - - avio_read(pb, guid, 16); - if (memcmp(guid, ff_w64_guid_wave, 16)) { - av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); - return AVERROR_INVALIDDATA; - } - - wav->w64 = 1; - - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - while (!url_feof(pb)) { - if (avio_read(pb, guid, 16) != 16) - break; - size = avio_rl64(pb); - if (size <= 24 || INT64_MAX - size < avio_tell(pb)) - return AVERROR_INVALIDDATA; - - if (!memcmp(guid, ff_w64_guid_fmt, 16)) { - /* subtract chunk header size - normal wav file doesn't count it */ - ret = ff_get_wav_header(pb, st->codec, size - 24); - if (ret < 0) - return ret; - avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); - - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); - } else if (!memcmp(guid, ff_w64_guid_fact, 16)) { - int64_t samples; - - samples = avio_rl64(pb); - if (samples > 0) - st->duration = samples; - } else if (!memcmp(guid, ff_w64_guid_data, 16)) { - wav->data_end = avio_tell(pb) + size - 24; - - data_ofs = avio_tell(pb); - if (!pb->seekable) - break; - - avio_skip(pb, size - 24); - } else if (!memcmp(guid, ff_w64_guid_summarylist, 16)) { - int64_t start, end, cur; - uint32_t count, chunk_size, i; - - start = avio_tell(pb); - end = start + FFALIGN(size, INT64_C(8)) - 24; - count = avio_rl32(pb); - - for (i = 0; i < count; i++) { - char chunk_key[5], *value; - - if (url_feof(pb) || (cur = avio_tell(pb)) < 0 || cur > end - 8 /* = tag + size */) - break; - - chunk_key[4] = 0; - avio_read(pb, chunk_key, 4); - chunk_size = avio_rl32(pb); - - value = av_mallocz(chunk_size + 1); - if (!value) - return AVERROR(ENOMEM); - - ret = avio_get_str16le(pb, chunk_size, value, chunk_size); - avio_skip(pb, chunk_size - ret); - - av_dict_set(&s->metadata, chunk_key, value, AV_DICT_DONT_STRDUP_VAL); - } - - avio_skip(pb, end - avio_tell(pb)); - } else { - av_log(s, AV_LOG_DEBUG, "unknown guid: "FF_PRI_GUID"\n", FF_ARG_GUID(guid)); - avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); - } - } - - if (!data_ofs) - return AVERROR_EOF; - - ff_metadata_conv_ctx(s, NULL, wav_metadata_conv); - ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv); - - handle_stream_probing(st); - st->need_parsing = AVSTREAM_PARSE_FULL_RAW; - - avio_seek(pb, data_ofs, SEEK_SET); - - return 0; -} - -AVInputFormat ff_w64_demuxer = { - .name = "w64", - .long_name = NULL_IF_CONFIG_SMALL("Sony Wave64"), - .priv_data_size = sizeof(WAVDemuxContext), - .read_probe = w64_probe, - .read_header = w64_read_header, - .read_packet = wav_read_packet, - .read_seek = wav_read_seek, - .flags = AVFMT_GENERIC_INDEX, - .codec_tag = (const AVCodecTag * const []) { ff_codec_wav_tags, 0 }, -}; -#endif /* CONFIG_W64_DEMUXER */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xmv.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xmv.c deleted file mode 100644 index b42b0b196..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xmv.c +++ /dev/null @@ -1,580 +0,0 @@ -/* - * Microsoft XMV demuxer - * Copyright (c) 2011 Sven Hesse - * Copyright (c) 2011 Matthew Hoops - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Microsoft XMV demuxer - */ - -#include - -#include "libavutil/intreadwrite.h" - -#include "avformat.h" -#include "internal.h" -#include "riff.h" -#include "libavutil/avassert.h" - -/** The min size of an XMV header. */ -#define XMV_MIN_HEADER_SIZE 36 - -/** Audio flag: ADPCM'd 5.1 stream, front left / right channels */ -#define XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT 1 -/** Audio flag: ADPCM'd 5.1 stream, front center / low frequency channels */ -#define XMV_AUDIO_ADPCM51_FRONTCENTERLOW 2 -/** Audio flag: ADPCM'd 5.1 stream, rear left / right channels */ -#define XMV_AUDIO_ADPCM51_REARLEFTRIGHT 4 - -/** Audio flag: Any of the ADPCM'd 5.1 stream flags. */ -#define XMV_AUDIO_ADPCM51 (XMV_AUDIO_ADPCM51_FRONTLEFTRIGHT | \ - XMV_AUDIO_ADPCM51_FRONTCENTERLOW | \ - XMV_AUDIO_ADPCM51_REARLEFTRIGHT) - -#define XMV_BLOCK_ALIGN_SIZE 36 - -/** A video packet with an XMV file. */ -typedef struct XMVVideoPacket { - int stream_index; ///< The decoder stream index for this video packet. - - uint32_t data_size; ///< The size of the remaining video data. - uint64_t data_offset; ///< The offset of the video data within the file. - - uint32_t current_frame; ///< The current frame within this video packet. - uint32_t frame_count; ///< The amount of frames within this video packet. - - int has_extradata; ///< Does the video packet contain extra data? - uint8_t extradata[4]; ///< The extra data - - int64_t last_pts; ///< PTS of the last video frame. - int64_t pts; ///< PTS of the most current video frame. -} XMVVideoPacket; - -/** An audio packet with an XMV file. */ -typedef struct XMVAudioPacket { - int stream_index; ///< The decoder stream index for this audio packet. - - /* Stream format properties. */ - uint16_t compression; ///< The type of compression. - uint16_t channels; ///< Number of channels. - uint32_t sample_rate; ///< Sampling rate. - uint16_t bits_per_sample; ///< Bits per compressed sample. - uint32_t bit_rate; ///< Bits of compressed data per second. - uint16_t flags; ///< Flags - unsigned block_align; ///< Bytes per compressed block. - uint16_t block_samples; ///< Decompressed samples per compressed block. - - enum AVCodecID codec_id; ///< The codec ID of the compression scheme. - - uint32_t data_size; ///< The size of the remaining audio data. - uint64_t data_offset; ///< The offset of the audio data within the file. - - uint32_t frame_size; ///< Number of bytes to put into an audio frame. - - uint64_t block_count; ///< Running counter of decompressed audio block. -} XMVAudioPacket; - -/** Context for demuxing an XMV file. */ -typedef struct XMVDemuxContext { - uint16_t audio_track_count; ///< Number of audio track in this file. - - uint32_t this_packet_size; ///< Size of the current packet. - uint32_t next_packet_size; ///< Size of the next packet. - - uint64_t this_packet_offset; ///< Offset of the current packet. - uint64_t next_packet_offset; ///< Offset of the next packet. - - uint16_t current_stream; ///< The index of the stream currently handling. - uint16_t stream_count; ///< The number of streams in this file. - - XMVVideoPacket video; ///< The video packet contained in each packet. - XMVAudioPacket *audio; ///< The audio packets contained in each packet. -} XMVDemuxContext; - -static int xmv_probe(AVProbeData *p) -{ - uint32_t file_version; - - if (p->buf_size < XMV_MIN_HEADER_SIZE) - return 0; - - file_version = AV_RL32(p->buf + 16); - if ((file_version == 0) || (file_version > 4)) - return 0; - - if (!memcmp(p->buf + 12, "xobX", 4)) - return AVPROBE_SCORE_MAX; - - return 0; -} - -static int xmv_read_close(AVFormatContext *s) -{ - XMVDemuxContext *xmv = s->priv_data; - - av_freep(&xmv->audio); - - return 0; -} - -static int xmv_read_header(AVFormatContext *s) -{ - XMVDemuxContext *xmv = s->priv_data; - AVIOContext *pb = s->pb; - AVStream *vst = NULL; - - uint32_t file_version; - uint32_t this_packet_size; - uint16_t audio_track; - int ret; - - avio_skip(pb, 4); /* Next packet size */ - - this_packet_size = avio_rl32(pb); - - avio_skip(pb, 4); /* Max packet size */ - avio_skip(pb, 4); /* "xobX" */ - - file_version = avio_rl32(pb); - if ((file_version != 4) && (file_version != 2)) - avpriv_request_sample(s, "Uncommon version %d", file_version); - - - /* Video track */ - - vst = avformat_new_stream(s, NULL); - if (!vst) - return AVERROR(ENOMEM); - - avpriv_set_pts_info(vst, 32, 1, 1000); - - vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; - vst->codec->codec_id = AV_CODEC_ID_WMV2; - vst->codec->codec_tag = MKBETAG('W', 'M', 'V', '2'); - vst->codec->width = avio_rl32(pb); - vst->codec->height = avio_rl32(pb); - - vst->duration = avio_rl32(pb); - - xmv->video.stream_index = vst->index; - - /* Audio tracks */ - - xmv->audio_track_count = avio_rl16(pb); - - avio_skip(pb, 2); /* Unknown (padding?) */ - - xmv->audio = av_malloc(xmv->audio_track_count * sizeof(XMVAudioPacket)); - if (!xmv->audio) { - ret = AVERROR(ENOMEM); - goto fail; - } - - for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { - XMVAudioPacket *packet = &xmv->audio[audio_track]; - AVStream *ast = NULL; - - packet->compression = avio_rl16(pb); - packet->channels = avio_rl16(pb); - packet->sample_rate = avio_rl32(pb); - packet->bits_per_sample = avio_rl16(pb); - packet->flags = avio_rl16(pb); - - packet->bit_rate = packet->bits_per_sample * - packet->sample_rate * - packet->channels; - packet->block_align = XMV_BLOCK_ALIGN_SIZE * packet->channels; - packet->block_samples = 64; - packet->codec_id = ff_wav_codec_get_id(packet->compression, - packet->bits_per_sample); - - packet->stream_index = -1; - - packet->frame_size = 0; - packet->block_count = 0; - - /* TODO: ADPCM'd 5.1 sound is encoded in three separate streams. - * Those need to be interleaved to a proper 5.1 stream. */ - if (packet->flags & XMV_AUDIO_ADPCM51) - av_log(s, AV_LOG_WARNING, "Unsupported 5.1 ADPCM audio stream " - "(0x%04X)\n", packet->flags); - - if (!packet->channels || !packet->sample_rate || - packet->channels >= UINT16_MAX / XMV_BLOCK_ALIGN_SIZE) { - av_log(s, AV_LOG_ERROR, "Invalid parameters for audio track %d.\n", - audio_track); - ret = AVERROR_INVALIDDATA; - goto fail; - } - - ast = avformat_new_stream(s, NULL); - if (!ast) { - ret = AVERROR(ENOMEM); - goto fail; - } - - ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; - ast->codec->codec_id = packet->codec_id; - ast->codec->codec_tag = packet->compression; - ast->codec->channels = packet->channels; - ast->codec->sample_rate = packet->sample_rate; - ast->codec->bits_per_coded_sample = packet->bits_per_sample; - ast->codec->bit_rate = packet->bit_rate; - ast->codec->block_align = 36 * packet->channels; - - avpriv_set_pts_info(ast, 32, packet->block_samples, packet->sample_rate); - - packet->stream_index = ast->index; - - ast->duration = vst->duration; - } - - - /* Initialize the packet context */ - - xmv->next_packet_offset = avio_tell(pb); - xmv->next_packet_size = this_packet_size - xmv->next_packet_offset; - xmv->stream_count = xmv->audio_track_count + 1; - - return 0; - -fail: - xmv_read_close(s); - return ret; -} - -static void xmv_read_extradata(uint8_t *extradata, AVIOContext *pb) -{ - /* Read the XMV extradata */ - - uint32_t data = avio_rl32(pb); - - int mspel_bit = !!(data & 0x01); - int loop_filter = !!(data & 0x02); - int abt_flag = !!(data & 0x04); - int j_type_bit = !!(data & 0x08); - int top_left_mv_flag = !!(data & 0x10); - int per_mb_rl_bit = !!(data & 0x20); - int slice_count = (data >> 6) & 7; - - /* Write it back as standard WMV2 extradata */ - - data = 0; - - data |= mspel_bit << 15; - data |= loop_filter << 14; - data |= abt_flag << 13; - data |= j_type_bit << 12; - data |= top_left_mv_flag << 11; - data |= per_mb_rl_bit << 10; - data |= slice_count << 7; - - AV_WB32(extradata, data); -} - -static int xmv_process_packet_header(AVFormatContext *s) -{ - XMVDemuxContext *xmv = s->priv_data; - AVIOContext *pb = s->pb; - - uint8_t data[8]; - uint16_t audio_track; - uint64_t data_offset; - - /* Next packet size */ - xmv->next_packet_size = avio_rl32(pb); - - /* Packet video header */ - - if (avio_read(pb, data, 8) != 8) - return AVERROR(EIO); - - xmv->video.data_size = AV_RL32(data) & 0x007FFFFF; - - xmv->video.current_frame = 0; - xmv->video.frame_count = (AV_RL32(data) >> 23) & 0xFF; - - xmv->video.has_extradata = (data[3] & 0x80) != 0; - - /* Adding the audio data sizes and the video data size keeps you 4 bytes - * short for every audio track. But as playing around with XMV files with - * ADPCM audio showed, taking the extra 4 bytes from the audio data gives - * you either completely distorted audio or click (when skipping the - * remaining 68 bytes of the ADPCM block). Subtracting 4 bytes for every - * audio track from the video data works at least for the audio. Probably - * some alignment thing? - * The video data has (always?) lots of padding, so it should work out... - */ - xmv->video.data_size -= xmv->audio_track_count * 4; - - xmv->current_stream = 0; - if (!xmv->video.frame_count) { - xmv->video.frame_count = 1; - xmv->current_stream = xmv->stream_count > 1; - } - - /* Packet audio header */ - - for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { - XMVAudioPacket *packet = &xmv->audio[audio_track]; - - if (avio_read(pb, data, 4) != 4) - return AVERROR(EIO); - - packet->data_size = AV_RL32(data) & 0x007FFFFF; - if ((packet->data_size == 0) && (audio_track != 0)) - /* This happens when I create an XMV with several identical audio - * streams. From the size calculations, duplicating the previous - * stream's size works out, but the track data itself is silent. - * Maybe this should also redirect the offset to the previous track? - */ - packet->data_size = xmv->audio[audio_track - 1].data_size; - - /* Carve up the audio data in frame_count slices */ - packet->frame_size = packet->data_size / xmv->video.frame_count; - packet->frame_size -= packet->frame_size % packet->block_align; - } - - /* Packet data offsets */ - - data_offset = avio_tell(pb); - - xmv->video.data_offset = data_offset; - data_offset += xmv->video.data_size; - - for (audio_track = 0; audio_track < xmv->audio_track_count; audio_track++) { - xmv->audio[audio_track].data_offset = data_offset; - data_offset += xmv->audio[audio_track].data_size; - } - - /* Video frames header */ - - /* Read new video extra data */ - if (xmv->video.data_size > 0) { - if (xmv->video.has_extradata) { - xmv_read_extradata(xmv->video.extradata, pb); - - xmv->video.data_size -= 4; - xmv->video.data_offset += 4; - - if (xmv->video.stream_index >= 0) { - AVStream *vst = s->streams[xmv->video.stream_index]; - - av_assert0(xmv->video.stream_index < s->nb_streams); - - if (vst->codec->extradata_size < 4) { - av_free(vst->codec->extradata); - - vst->codec->extradata = - av_malloc(4 + FF_INPUT_BUFFER_PADDING_SIZE); - vst->codec->extradata_size = 4; - } - - memcpy(vst->codec->extradata, xmv->video.extradata, 4); - } - } - } - - return 0; -} - -static int xmv_fetch_new_packet(AVFormatContext *s) -{ - XMVDemuxContext *xmv = s->priv_data; - AVIOContext *pb = s->pb; - int result; - - if (xmv->this_packet_offset == xmv->next_packet_offset) - return AVERROR_EOF; - - /* Seek to it */ - xmv->this_packet_offset = xmv->next_packet_offset; - if (avio_seek(pb, xmv->this_packet_offset, SEEK_SET) != xmv->this_packet_offset) - return AVERROR(EIO); - - /* Update the size */ - xmv->this_packet_size = xmv->next_packet_size; - if (xmv->this_packet_size < (12 + xmv->audio_track_count * 4)) - return AVERROR(EIO); - - /* Process the header */ - result = xmv_process_packet_header(s); - if (result) - return result; - - /* Update the offset */ - xmv->next_packet_offset = xmv->this_packet_offset + xmv->this_packet_size; - - return 0; -} - -static int xmv_fetch_audio_packet(AVFormatContext *s, - AVPacket *pkt, uint32_t stream) -{ - XMVDemuxContext *xmv = s->priv_data; - AVIOContext *pb = s->pb; - XMVAudioPacket *audio = &xmv->audio[stream]; - - uint32_t data_size; - uint32_t block_count; - int result; - - /* Seek to it */ - if (avio_seek(pb, audio->data_offset, SEEK_SET) != audio->data_offset) - return AVERROR(EIO); - - if ((xmv->video.current_frame + 1) < xmv->video.frame_count) - /* Not the last frame, get at most frame_size bytes. */ - data_size = FFMIN(audio->frame_size, audio->data_size); - else - /* Last frame, get the rest. */ - data_size = audio->data_size; - - /* Read the packet */ - result = av_get_packet(pb, pkt, data_size); - if (result <= 0) - return result; - - pkt->stream_index = audio->stream_index; - - /* Calculate the PTS */ - - block_count = data_size / audio->block_align; - - pkt->duration = block_count; - pkt->pts = audio->block_count; - pkt->dts = AV_NOPTS_VALUE; - - audio->block_count += block_count; - - /* Advance offset */ - audio->data_size -= data_size; - audio->data_offset += data_size; - - return 0; -} - -static int xmv_fetch_video_packet(AVFormatContext *s, - AVPacket *pkt) -{ - XMVDemuxContext *xmv = s->priv_data; - AVIOContext *pb = s->pb; - XMVVideoPacket *video = &xmv->video; - - int result; - uint32_t frame_header; - uint32_t frame_size, frame_timestamp; - uint8_t *data, *end; - - /* Seek to it */ - if (avio_seek(pb, video->data_offset, SEEK_SET) != video->data_offset) - return AVERROR(EIO); - - /* Read the frame header */ - frame_header = avio_rl32(pb); - - frame_size = (frame_header & 0x1FFFF) * 4 + 4; - frame_timestamp = (frame_header >> 17); - - if ((frame_size + 4) > video->data_size) - return AVERROR(EIO); - - /* Get the packet data */ - result = av_get_packet(pb, pkt, frame_size); - if (result != frame_size) - return result; - - /* Contrary to normal WMV2 video, the bit stream in XMV's - * WMV2 is little-endian. - * TODO: This manual swap is of course suboptimal. - */ - for (data = pkt->data, end = pkt->data + frame_size; data < end; data += 4) - AV_WB32(data, AV_RL32(data)); - - pkt->stream_index = video->stream_index; - - /* Calculate the PTS */ - - video->last_pts = frame_timestamp + video->pts; - - pkt->duration = 0; - pkt->pts = video->last_pts; - pkt->dts = AV_NOPTS_VALUE; - - video->pts += frame_timestamp; - - /* Keyframe? */ - pkt->flags = (pkt->data[0] & 0x80) ? 0 : AV_PKT_FLAG_KEY; - - /* Advance offset */ - video->data_size -= frame_size + 4; - video->data_offset += frame_size + 4; - - return 0; -} - -static int xmv_read_packet(AVFormatContext *s, - AVPacket *pkt) -{ - XMVDemuxContext *xmv = s->priv_data; - int result; - - if (xmv->video.current_frame == xmv->video.frame_count) { - /* No frames left in this packet, so we fetch a new one */ - - result = xmv_fetch_new_packet(s); - if (result) - return result; - } - - if (xmv->current_stream == 0) { - /* Fetch a video frame */ - - result = xmv_fetch_video_packet(s, pkt); - if (result) - return result; - - } else { - /* Fetch an audio frame */ - - result = xmv_fetch_audio_packet(s, pkt, xmv->current_stream - 1); - if (result) - return result; - } - - /* Increase our counters */ - if (++xmv->current_stream >= xmv->stream_count) { - xmv->current_stream = 0; - xmv->video.current_frame += 1; - } - - return 0; -} - -AVInputFormat ff_xmv_demuxer = { - .name = "xmv", - .long_name = NULL_IF_CONFIG_SMALL("Microsoft XMV"), - .priv_data_size = sizeof(XMVDemuxContext), - .read_probe = xmv_probe, - .read_header = xmv_read_header, - .read_packet = xmv_read_packet, - .read_close = xmv_read_close, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xwma.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xwma.c deleted file mode 100644 index 9623dd1a3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/xwma.c +++ /dev/null @@ -1,281 +0,0 @@ -/* - * xWMA demuxer - * Copyright (c) 2011 Max Horn - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "avformat.h" -#include "libavutil/internal.h" -#include "internal.h" -#include "riff.h" - -/* - * Demuxer for xWMA, a Microsoft audio container used by XAudio 2. - */ - -typedef struct { - int64_t data_end; -} XWMAContext; - -static int xwma_probe(AVProbeData *p) -{ - if (!memcmp(p->buf, "RIFF", 4) && !memcmp(p->buf + 8, "XWMA", 4)) - return AVPROBE_SCORE_MAX; - return 0; -} - -static int xwma_read_header(AVFormatContext *s) -{ - int64_t size; - int ret; - uint32_t dpds_table_size = 0; - uint32_t *dpds_table = 0; - unsigned int tag; - AVIOContext *pb = s->pb; - AVStream *st; - XWMAContext *xwma = s->priv_data; - int i; - - /* The following code is mostly copied from wav.c, with some - * minor alterations. - */ - - /* check RIFF header */ - tag = avio_rl32(pb); - if (tag != MKTAG('R', 'I', 'F', 'F')) - return -1; - avio_rl32(pb); /* file size */ - tag = avio_rl32(pb); - if (tag != MKTAG('X', 'W', 'M', 'A')) - return -1; - - /* parse fmt header */ - tag = avio_rl32(pb); - if (tag != MKTAG('f', 'm', 't', ' ')) - return -1; - size = avio_rl32(pb); - st = avformat_new_stream(s, NULL); - if (!st) - return AVERROR(ENOMEM); - - ret = ff_get_wav_header(pb, st->codec, size); - if (ret < 0) - return ret; - st->need_parsing = AVSTREAM_PARSE_NONE; - - /* All xWMA files I have seen contained WMAv2 data. If there are files - * using WMA Pro or some other codec, then we need to figure out the right - * extradata for that. Thus, ask the user for feedback, but try to go on - * anyway. - */ - if (st->codec->codec_id != AV_CODEC_ID_WMAV2) { - avpriv_request_sample(s, "Unexpected codec (tag 0x04%x; id %d)", - st->codec->codec_tag, st->codec->codec_id); - } else { - /* In all xWMA files I have seen, there is no extradata. But the WMA - * codecs require extradata, so we provide our own fake extradata. - * - * First, check that there really was no extradata in the header. If - * there was, then try to use it, after asking the user to provide a - * sample of this unusual file. - */ - if (st->codec->extradata_size != 0) { - /* Surprise, surprise: We *did* get some extradata. No idea - * if it will work, but just go on and try it, after asking - * the user for a sample. - */ - avpriv_request_sample(s, "Unexpected extradata (%d bytes)", - st->codec->extradata_size); - } else { - st->codec->extradata_size = 6; - st->codec->extradata = av_mallocz(6 + FF_INPUT_BUFFER_PADDING_SIZE); - if (!st->codec->extradata) - return AVERROR(ENOMEM); - - /* setup extradata with our experimentally obtained value */ - st->codec->extradata[4] = 31; - } - } - - if (!st->codec->channels) { - av_log(s, AV_LOG_WARNING, "Invalid channel count: %d\n", - st->codec->channels); - return AVERROR_INVALIDDATA; - } - if (!st->codec->bits_per_coded_sample) { - av_log(s, AV_LOG_WARNING, "Invalid bits_per_coded_sample: %d\n", - st->codec->bits_per_coded_sample); - return AVERROR_INVALIDDATA; - } - - /* set the sample rate */ - avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate); - - /* parse the remaining RIFF chunks */ - for (;;) { - if (pb->eof_reached) - return -1; - /* read next chunk tag */ - tag = avio_rl32(pb); - size = avio_rl32(pb); - if (tag == MKTAG('d', 'a', 't', 'a')) { - /* We assume that the data chunk comes last. */ - break; - } else if (tag == MKTAG('d','p','d','s')) { - /* Quoting the MSDN xWMA docs on the dpds chunk: "Contains the - * decoded packet cumulative data size array, each element is the - * number of bytes accumulated after the corresponding xWMA packet - * is decoded in order." - * - * Each packet has size equal to st->codec->block_align, which in - * all cases I saw so far was always 2230. Thus, we can use the - * dpds data to compute a seeking index. - */ - - /* Error out if there is more than one dpds chunk. */ - if (dpds_table) { - av_log(s, AV_LOG_ERROR, "two dpds chunks present\n"); - return -1; - } - - /* Compute the number of entries in the dpds chunk. */ - if (size & 3) { /* Size should be divisible by four */ - av_log(s, AV_LOG_WARNING, - "dpds chunk size %"PRId64" not divisible by 4\n", size); - } - dpds_table_size = size / 4; - if (dpds_table_size == 0 || dpds_table_size >= INT_MAX / 4) { - av_log(s, AV_LOG_ERROR, - "dpds chunk size %"PRId64" invalid\n", size); - return -1; - } - - /* Allocate some temporary storage to keep the dpds data around. - * for processing later on. - */ - dpds_table = av_malloc(dpds_table_size * sizeof(uint32_t)); - if (!dpds_table) { - return AVERROR(ENOMEM); - } - - for (i = 0; i < dpds_table_size; ++i) { - dpds_table[i] = avio_rl32(pb); - size -= 4; - } - } - avio_skip(pb, size); - } - - /* Determine overall data length */ - if (size < 0) - return -1; - if (!size) { - xwma->data_end = INT64_MAX; - } else - xwma->data_end = avio_tell(pb) + size; - - - if (dpds_table && dpds_table_size) { - int64_t cur_pos; - const uint32_t bytes_per_sample - = (st->codec->channels * st->codec->bits_per_coded_sample) >> 3; - - /* Estimate the duration from the total number of output bytes. */ - const uint64_t total_decoded_bytes = dpds_table[dpds_table_size - 1]; - - if (!bytes_per_sample) { - av_log(s, AV_LOG_ERROR, - "Invalid bits_per_coded_sample %d for %d channels\n", - st->codec->bits_per_coded_sample, st->codec->channels); - return AVERROR_INVALIDDATA; - } - - st->duration = total_decoded_bytes / bytes_per_sample; - - /* Use the dpds data to build a seek table. We can only do this after - * we know the offset to the data chunk, as we need that to determine - * the actual offset to each input block. - * Note: If we allowed ourselves to assume that the data chunk always - * follows immediately after the dpds block, we could of course guess - * the data block's start offset already while reading the dpds chunk. - * I decided against that, just in case other chunks ever are - * discovered. - */ - cur_pos = avio_tell(pb); - for (i = 0; i < dpds_table_size; ++i) { - /* From the number of output bytes that would accumulate in the - * output buffer after decoding the first (i+1) packets, we compute - * an offset / timestamp pair. - */ - av_add_index_entry(st, - cur_pos + (i+1) * st->codec->block_align, /* pos */ - dpds_table[i] / bytes_per_sample, /* timestamp */ - st->codec->block_align, /* size */ - 0, /* duration */ - AVINDEX_KEYFRAME); - } - } else if (st->codec->bit_rate) { - /* No dpds chunk was present (or only an empty one), so estimate - * the total duration using the average bits per sample and the - * total data length. - */ - st->duration = (size<<3) * st->codec->sample_rate / st->codec->bit_rate; - } - - av_free(dpds_table); - - return 0; -} - -static int xwma_read_packet(AVFormatContext *s, AVPacket *pkt) -{ - int ret, size; - int64_t left; - AVStream *st; - XWMAContext *xwma = s->priv_data; - - st = s->streams[0]; - - left = xwma->data_end - avio_tell(s->pb); - if (left <= 0) { - return AVERROR_EOF; - } - - /* read a single block; the default block size is 2230. */ - size = (st->codec->block_align > 1) ? st->codec->block_align : 2230; - size = FFMIN(size, left); - - ret = av_get_packet(s->pb, pkt, size); - if (ret < 0) - return ret; - - pkt->stream_index = 0; - return ret; -} - -AVInputFormat ff_xwma_demuxer = { - .name = "xwma", - .long_name = "Microsoft xWMA", - .priv_data_size = sizeof(XWMAContext), - .read_probe = xwma_probe, - .read_header = xwma_read_header, - .read_packet = xwma_read_packet, -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.c deleted file mode 100644 index 04182f233..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "atomic.h" - -#if !HAVE_ATOMICS_NATIVE - -#if HAVE_PTHREADS - -#include - -static pthread_mutex_t atomic_lock = PTHREAD_MUTEX_INITIALIZER; - -int avpriv_atomic_int_get(volatile int *ptr) -{ - int res; - - pthread_mutex_lock(&atomic_lock); - res = *ptr; - pthread_mutex_unlock(&atomic_lock); - - return res; -} - -void avpriv_atomic_int_set(volatile int *ptr, int val) -{ - pthread_mutex_lock(&atomic_lock); - *ptr = val; - pthread_mutex_unlock(&atomic_lock); -} - -int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc) -{ - int res; - - pthread_mutex_lock(&atomic_lock); - *ptr += inc; - res = *ptr; - pthread_mutex_unlock(&atomic_lock); - - return res; -} - -void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval) -{ - void *ret; - pthread_mutex_lock(&atomic_lock); - ret = *ptr; - if (*ptr == oldval) - *ptr = newval; - pthread_mutex_unlock(&atomic_lock); - return ret; -} - -#elif !HAVE_THREADS - -int avpriv_atomic_int_get(volatile int *ptr) -{ - return *ptr; -} - -void avpriv_atomic_int_set(volatile int *ptr, int val) -{ - *ptr = val; -} - -int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc) -{ - *ptr += inc; - return *ptr; -} - -void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval) -{ - if (*ptr == oldval) { - *ptr = newval; - return oldval; - } - return *ptr; -} - -#else - -#error "Threading is enabled, but there is no implementation of atomic operations available" - -#endif /* HAVE_PTHREADS */ - -#endif /* !HAVE_MEMORYBARRIER && !HAVE_SYNC_VAL_COMPARE_AND_SWAP && !HAVE_MACHINE_RW_BARRIER */ - -#ifdef TEST -#include "avassert.h" - -int main(void) -{ - volatile int val = 1; - int res; - - res = avpriv_atomic_int_add_and_fetch(&val, 1); - av_assert0(res == 2); - avpriv_atomic_int_set(&val, 3); - res = avpriv_atomic_int_get(&val); - av_assert0(res == 3); - - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.h deleted file mode 100644 index fd7d8fc03..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_ATOMIC_H -#define AVUTIL_ATOMIC_H - -#include "config.h" - -#if HAVE_ATOMICS_GCC -#include "atomic_gcc.h" -#elif HAVE_ATOMICS_WIN32 -#include "atomic_win32.h" -#elif HAVE_ATOMICS_SUNCC -#include "atomic_suncc.h" -#else - -/** - * Load the current value stored in an atomic integer. - * - * @param ptr atomic integer - * @return the current value of the atomic integer - * @note This acts as a memory barrier. - */ -int avpriv_atomic_int_get(volatile int *ptr); - -/** - * Store a new value in an atomic integer. - * - * @param ptr atomic integer - * @param val the value to store in the atomic integer - * @note This acts as a memory barrier. - */ -void avpriv_atomic_int_set(volatile int *ptr, int val); - -/** - * Add a value to an atomic integer. - * - * @param ptr atomic integer - * @param inc the value to add to the atomic integer (may be negative) - * @return the new value of the atomic integer. - * @note This does NOT act as a memory barrier. This is primarily - * intended for reference counting. - */ -int avpriv_atomic_int_add_and_fetch(volatile int *ptr, int inc); - -/** - * Atomic pointer compare and swap. - * - * @param ptr pointer to the pointer to operate on - * @param oldval do the swap if the current value of *ptr equals to oldval - * @param newval value to replace *ptr with - * @return the value of *ptr before comparison - */ -void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval); - -#endif /* HAVE_MEMORYBARRIER */ -#endif /* AVUTIL_ATOMIC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic_gcc.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic_gcc.h deleted file mode 100644 index 2bb43c3ce..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/atomic_gcc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2012 Ronald S. Bultje - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_ATOMIC_GCC_H -#define AVUTIL_ATOMIC_GCC_H - -#include - -#include "atomic.h" - -#define avpriv_atomic_int_get atomic_int_get_gcc -static inline int atomic_int_get_gcc(volatile int *ptr) -{ - __sync_synchronize(); - return *ptr; -} - -#define avpriv_atomic_int_set atomic_int_set_gcc -static inline void atomic_int_set_gcc(volatile int *ptr, int val) -{ - *ptr = val; - __sync_synchronize(); -} - -#define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_gcc -static inline int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc) -{ - return __sync_add_and_fetch(ptr, inc); -} - -#define avpriv_atomic_ptr_cas atomic_ptr_cas_gcc -static inline void *atomic_ptr_cas_gcc(void * volatile *ptr, - void *oldval, void *newval) -{ -#ifdef __ARMCC_VERSION - // armcc will throw an error if ptr is not an integer type - volatile uintptr_t *tmp = (volatile uintptr_t*)ptr; - return (void*)__sync_val_compare_and_swap(tmp, oldval, newval); -#else - return __sync_val_compare_and_swap(ptr, oldval, newval); -#endif -} - -#endif /* AVUTIL_ATOMIC_GCC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avconfig.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avconfig.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.c deleted file mode 100644 index eed58fae1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2007 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include - -#include "config.h" -#include "common.h" -#include "mem.h" -#include "avstring.h" -#include "bprint.h" - -int av_strstart(const char *str, const char *pfx, const char **ptr) -{ - while (*pfx && *pfx == *str) { - pfx++; - str++; - } - if (!*pfx && ptr) - *ptr = str; - return !*pfx; -} - -int av_stristart(const char *str, const char *pfx, const char **ptr) -{ - while (*pfx && av_toupper((unsigned)*pfx) == av_toupper((unsigned)*str)) { - pfx++; - str++; - } - if (!*pfx && ptr) - *ptr = str; - return !*pfx; -} - -char *av_stristr(const char *s1, const char *s2) -{ - if (!*s2) - return (char*)(intptr_t)s1; - - do - if (av_stristart(s1, s2, NULL)) - return (char*)(intptr_t)s1; - while (*s1++); - - return NULL; -} - -char *av_strnstr(const char *haystack, const char *needle, size_t hay_length) -{ - size_t needle_len = strlen(needle); - if (!needle_len) - return (char*)haystack; - while (hay_length >= needle_len) { - hay_length--; - if (!memcmp(haystack, needle, needle_len)) - return (char*)haystack; - haystack++; - } - return NULL; -} - -size_t av_strlcpy(char *dst, const char *src, size_t size) -{ - size_t len = 0; - while (++len < size && *src) - *dst++ = *src++; - if (len <= size) - *dst = 0; - return len + strlen(src) - 1; -} - -size_t av_strlcat(char *dst, const char *src, size_t size) -{ - size_t len = strlen(dst); - if (size <= len + 1) - return len + strlen(src); - return len + av_strlcpy(dst + len, src, size - len); -} - -size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) -{ - int len = strlen(dst); - va_list vl; - - va_start(vl, fmt); - len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); - va_end(vl); - - return len; -} - -char *av_asprintf(const char *fmt, ...) -{ - char *p = NULL; - va_list va; - int len; - - va_start(va, fmt); - len = vsnprintf(NULL, 0, fmt, va); - va_end(va); - if (len < 0) - goto end; - - p = av_malloc(len + 1); - if (!p) - goto end; - - va_start(va, fmt); - len = vsnprintf(p, len + 1, fmt, va); - va_end(va); - if (len < 0) - av_freep(&p); - -end: - return p; -} - -char *av_d2str(double d) -{ - char *str = av_malloc(16); - if (str) - snprintf(str, 16, "%f", d); - return str; -} - -#define WHITESPACES " \n\t" - -char *av_get_token(const char **buf, const char *term) -{ - char *out = av_malloc(strlen(*buf) + 1); - char *ret = out, *end = out; - const char *p = *buf; - if (!out) - return NULL; - p += strspn(p, WHITESPACES); - - while (*p && !strspn(p, term)) { - char c = *p++; - if (c == '\\' && *p) { - *out++ = *p++; - end = out; - } else if (c == '\'') { - while (*p && *p != '\'') - *out++ = *p++; - if (*p) { - p++; - end = out; - } - } else { - *out++ = c; - } - } - - do - *out-- = 0; - while (out >= end && strspn(out, WHITESPACES)); - - *buf = p; - - return ret; -} - -char *av_strtok(char *s, const char *delim, char **saveptr) -{ - char *tok; - - if (!s && !(s = *saveptr)) - return NULL; - - /* skip leading delimiters */ - s += strspn(s, delim); - - /* s now points to the first non delimiter char, or to the end of the string */ - if (!*s) { - *saveptr = NULL; - return NULL; - } - tok = s++; - - /* skip non delimiters */ - s += strcspn(s, delim); - if (*s) { - *s = 0; - *saveptr = s+1; - } else { - *saveptr = NULL; - } - - return tok; -} - -int av_strcasecmp(const char *a, const char *b) -{ - uint8_t c1, c2; - do { - c1 = av_tolower(*a++); - c2 = av_tolower(*b++); - } while (c1 && c1 == c2); - return c1 - c2; -} - -int av_strncasecmp(const char *a, const char *b, size_t n) -{ - const char *end = a + n; - uint8_t c1, c2; - do { - c1 = av_tolower(*a++); - c2 = av_tolower(*b++); - } while (a < end && c1 && c1 == c2); - return c1 - c2; -} - -const char *av_basename(const char *path) -{ - char *p = strrchr(path, '/'); - -#if HAVE_DOS_PATHS - char *q = strrchr(path, '\\'); - char *d = strchr(path, ':'); - - p = FFMAX3(p, q, d); -#endif - - if (!p) - return path; - - return p + 1; -} - -const char *av_dirname(char *path) -{ - char *p = strrchr(path, '/'); - -#if HAVE_DOS_PATHS - char *q = strrchr(path, '\\'); - char *d = strchr(path, ':'); - - d = d ? d + 1 : d; - - p = FFMAX3(p, q, d); -#endif - - if (!p) - return "."; - - *p = '\0'; - - return path; -} - -int av_escape(char **dst, const char *src, const char *special_chars, - enum AVEscapeMode mode, int flags) -{ - AVBPrint dstbuf; - - av_bprint_init(&dstbuf, 1, AV_BPRINT_SIZE_UNLIMITED); - av_bprint_escape(&dstbuf, src, special_chars, mode, flags); - - if (!av_bprint_is_complete(&dstbuf)) { - av_bprint_finalize(&dstbuf, NULL); - return AVERROR(ENOMEM); - } else { - av_bprint_finalize(&dstbuf, dst); - return dstbuf.len; - } -} - -int av_isdigit(int c) -{ - return c >= '0' && c <= '9'; -} - -int av_isgraph(int c) -{ - return c > 32 && c < 127; -} - -int av_isspace(int c) -{ - return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || - c == '\v'; -} - -int av_isxdigit(int c) -{ - c = av_tolower(c); - return av_isdigit(c) || (c >= 'a' && c <= 'f'); -} - -#ifdef TEST - -int main(void) -{ - int i; - static const char * const strings[] = { - "''", - "", - ":", - "\\", - "'", - " '' :", - " '' '' :", - "foo '' :", - "'foo'", - "foo ", - " ' foo ' ", - "foo\\", - "foo': blah:blah", - "foo\\: blah:blah", - "foo\'", - "'foo : ' :blahblah", - "\\ :blah", - " foo", - " foo ", - " foo \\ ", - "foo ':blah", - " foo bar : blahblah", - "\\f\\o\\o", - "'foo : \\ \\ ' : blahblah", - "'\\fo\\o:': blahblah", - "\\'fo\\o\\:': foo ' :blahblah" - }; - - printf("Testing av_get_token()\n"); - for (i = 0; i < FF_ARRAY_ELEMS(strings); i++) { - const char *p = strings[i]; - char *q; - printf("|%s|", p); - q = av_get_token(&p, ":"); - printf(" -> |%s|", q); - printf(" + |%s|\n", p); - av_free(q); - } - - return 0; -} - -#endif /* TEST */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.c deleted file mode 100644 index 7786e3bce..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2012 Nicolas George - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include -#include "avassert.h" -#include "avstring.h" -#include "bprint.h" -#include "common.h" -#include "compat/va_copy.h" -#include "error.h" -#include "mem.h" - -#define av_bprint_room(buf) ((buf)->size - FFMIN((buf)->len, (buf)->size)) -#define av_bprint_is_allocated(buf) ((buf)->str != (buf)->reserved_internal_buffer) - -static int av_bprint_alloc(AVBPrint *buf, unsigned room) -{ - char *old_str, *new_str; - unsigned min_size, new_size; - - if (buf->size == buf->size_max) - return AVERROR(EIO); - if (!av_bprint_is_complete(buf)) - return AVERROR_INVALIDDATA; /* it is already truncated anyway */ - min_size = buf->len + 1 + FFMIN(UINT_MAX - buf->len - 1, room); - new_size = buf->size > buf->size_max / 2 ? buf->size_max : buf->size * 2; - if (new_size < min_size) - new_size = FFMIN(buf->size_max, min_size); - old_str = av_bprint_is_allocated(buf) ? buf->str : NULL; - new_str = av_realloc(old_str, new_size); - if (!new_str) - return AVERROR(ENOMEM); - if (!old_str) - memcpy(new_str, buf->str, buf->len + 1); - buf->str = new_str; - buf->size = new_size; - return 0; -} - -static void av_bprint_grow(AVBPrint *buf, unsigned extra_len) -{ - /* arbitrary margin to avoid small overflows */ - extra_len = FFMIN(extra_len, UINT_MAX - 5 - buf->len); - buf->len += extra_len; - if (buf->size) - buf->str[FFMIN(buf->len, buf->size - 1)] = 0; -} - -void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max) -{ - unsigned size_auto = (char *)buf + sizeof(*buf) - - buf->reserved_internal_buffer; - - if (size_max == 1) - size_max = size_auto; - buf->str = buf->reserved_internal_buffer; - buf->len = 0; - buf->size = FFMIN(size_auto, size_max); - buf->size_max = size_max; - *buf->str = 0; - if (size_init > buf->size) - av_bprint_alloc(buf, size_init - 1); -} - -void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size) -{ - buf->str = buffer; - buf->len = 0; - buf->size = size; - buf->size_max = size; - *buf->str = 0; -} - -void av_bprintf(AVBPrint *buf, const char *fmt, ...) -{ - unsigned room; - char *dst; - va_list vl; - int extra_len; - - while (1) { - room = av_bprint_room(buf); - dst = room ? buf->str + buf->len : NULL; - va_start(vl, fmt); - extra_len = vsnprintf(dst, room, fmt, vl); - va_end(vl); - if (extra_len <= 0) - return; - if (extra_len < room) - break; - if (av_bprint_alloc(buf, extra_len)) - break; - } - av_bprint_grow(buf, extra_len); -} - -void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg) -{ - unsigned room; - char *dst; - int extra_len; - va_list vl; - - while (1) { - room = av_bprint_room(buf); - dst = room ? buf->str + buf->len : NULL; - va_copy(vl, vl_arg); - extra_len = vsnprintf(dst, room, fmt, vl); - va_end(vl); - if (extra_len <= 0) - return; - if (extra_len < room) - break; - if (av_bprint_alloc(buf, extra_len)) - break; - } - av_bprint_grow(buf, extra_len); -} - -void av_bprint_chars(AVBPrint *buf, char c, unsigned n) -{ - unsigned room, real_n; - - while (1) { - room = av_bprint_room(buf); - if (n < room) - break; - if (av_bprint_alloc(buf, n)) - break; - } - if (room) { - real_n = FFMIN(n, room - 1); - memset(buf->str + buf->len, c, real_n); - } - av_bprint_grow(buf, n); -} - -void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size) -{ - unsigned room, real_n; - - while (1) { - room = av_bprint_room(buf); - if (size < room) - break; - if (av_bprint_alloc(buf, size)) - break; - } - if (room) { - real_n = FFMIN(size, room - 1); - memcpy(buf->str + buf->len, data, real_n); - } - av_bprint_grow(buf, size); -} - -void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm) -{ - unsigned room; - size_t l; - - if (!*fmt) - return; - while (1) { - room = av_bprint_room(buf); - if (room && (l = strftime(buf->str + buf->len, room, fmt, tm))) - break; - /* strftime does not tell us how much room it would need: let us - retry with twice as much until the buffer is large enough */ - room = !room ? strlen(fmt) + 1 : - room <= INT_MAX / 2 ? room * 2 : INT_MAX; - if (av_bprint_alloc(buf, room)) { - /* impossible to grow, try to manage something useful anyway */ - room = av_bprint_room(buf); - if (room < 1024) { - /* if strftime fails because the buffer has (almost) reached - its maximum size, let us try in a local buffer; 1k should - be enough to format any real date+time string */ - char buf2[1024]; - if ((l = strftime(buf2, sizeof(buf2), fmt, tm))) { - av_bprintf(buf, "%s", buf2); - return; - } - } - if (room) { - /* if anything else failed and the buffer is not already - truncated, let us add a stock string and force truncation */ - static const char txt[] = "[truncated strftime output]"; - memset(buf->str + buf->len, '!', room); - memcpy(buf->str + buf->len, txt, FFMIN(sizeof(txt) - 1, room)); - av_bprint_grow(buf, room); /* force truncation */ - } - return; - } - } - av_bprint_grow(buf, l); -} - -void av_bprint_get_buffer(AVBPrint *buf, unsigned size, - unsigned char **mem, unsigned *actual_size) -{ - if (size > av_bprint_room(buf)) - av_bprint_alloc(buf, size); - *actual_size = av_bprint_room(buf); - *mem = *actual_size ? buf->str + buf->len : NULL; -} - -void av_bprint_clear(AVBPrint *buf) -{ - if (buf->len) { - *buf->str = 0; - buf->len = 0; - } -} - -int av_bprint_finalize(AVBPrint *buf, char **ret_str) -{ - unsigned real_size = FFMIN(buf->len + 1, buf->size); - char *str; - int ret = 0; - - if (ret_str) { - if (av_bprint_is_allocated(buf)) { - str = av_realloc(buf->str, real_size); - if (!str) - str = buf->str; - buf->str = NULL; - } else { - str = av_malloc(real_size); - if (str) - memcpy(str, buf->str, real_size); - else - ret = AVERROR(ENOMEM); - } - *ret_str = str; - } else { - if (av_bprint_is_allocated(buf)) - av_freep(&buf->str); - } - buf->size = real_size; - return ret; -} - -#define WHITESPACES " \n\t" - -void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars, - enum AVEscapeMode mode, int flags) -{ - const char *src0 = src; - - if (mode == AV_ESCAPE_MODE_AUTO) - mode = AV_ESCAPE_MODE_BACKSLASH; /* TODO: implement a heuristic */ - - switch (mode) { - case AV_ESCAPE_MODE_QUOTE: - /* enclose the string between '' */ - av_bprint_chars(dstbuf, '\'', 1); - for (; *src; src++) { - if (*src == '\'') - av_bprintf(dstbuf, "'\\''"); - else - av_bprint_chars(dstbuf, *src, 1); - } - av_bprint_chars(dstbuf, '\'', 1); - break; - - /* case AV_ESCAPE_MODE_BACKSLASH or unknown mode */ - default: - /* \-escape characters */ - for (; *src; src++) { - int is_first_last = src == src0 || !*(src+1); - int is_ws = !!strchr(WHITESPACES, *src); - int is_strictly_special = special_chars && strchr(special_chars, *src); - int is_special = - is_strictly_special || strchr("'\\", *src) || - (is_ws && (flags & AV_ESCAPE_FLAG_WHITESPACE)); - - if (is_strictly_special || - (!(flags & AV_ESCAPE_FLAG_STRICT) && - (is_special || (is_ws && is_first_last)))) - av_bprint_chars(dstbuf, '\\', 1); - av_bprint_chars(dstbuf, *src, 1); - } - break; - } -} - -#ifdef TEST - -#undef printf - -static void bprint_pascal(AVBPrint *b, unsigned size) -{ - unsigned i, j; - unsigned p[42]; - - av_assert0(size < FF_ARRAY_ELEMS(p)); - - p[0] = 1; - av_bprintf(b, "%8d\n", 1); - for (i = 1; i <= size; i++) { - p[i] = 1; - for (j = i - 1; j > 0; j--) - p[j] = p[j] + p[j - 1]; - for (j = 0; j <= i; j++) - av_bprintf(b, "%8d", p[j]); - av_bprintf(b, "\n"); - } -} - -int main(void) -{ - AVBPrint b; - char buf[256]; - struct tm testtime = { .tm_year = 100, .tm_mon = 11, .tm_mday = 20 }; - - av_bprint_init(&b, 0, -1); - bprint_pascal(&b, 5); - printf("Short text in unlimited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len); - printf("%s\n", b.str); - av_bprint_finalize(&b, NULL); - - av_bprint_init(&b, 0, -1); - bprint_pascal(&b, 25); - printf("Long text in unlimited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len); - av_bprint_finalize(&b, NULL); - - av_bprint_init(&b, 0, 2048); - bprint_pascal(&b, 25); - printf("Long text in limited buffer: %u/%u\n", (unsigned)strlen(b.str), b.len); - av_bprint_finalize(&b, NULL); - - av_bprint_init(&b, 0, 1); - bprint_pascal(&b, 5); - printf("Short text in automatic buffer: %u/%u\n", (unsigned)strlen(b.str), b.len); - - av_bprint_init(&b, 0, 1); - bprint_pascal(&b, 25); - printf("Long text in automatic buffer: %u/%u\n", (unsigned)strlen(b.str)/8*8, b.len); - /* Note that the size of the automatic buffer is arch-dependant. */ - - av_bprint_init(&b, 0, 0); - bprint_pascal(&b, 25); - printf("Long text count only buffer: %u/%u\n", (unsigned)strlen(b.str), b.len); - - av_bprint_init_for_buffer(&b, buf, sizeof(buf)); - bprint_pascal(&b, 25); - printf("Long text count only buffer: %u/%u\n", (unsigned)strlen(buf), b.len); - - av_bprint_init(&b, 0, -1); - av_bprint_strftime(&b, "%Y-%m-%d", &testtime); - printf("strftime full: %u/%u \"%s\"\n", (unsigned)strlen(buf), b.len, b.str); - av_bprint_finalize(&b, NULL); - - av_bprint_init(&b, 0, 8); - av_bprint_strftime(&b, "%Y-%m-%d", &testtime); - printf("strftime truncated: %u/%u \"%s\"\n", (unsigned)strlen(buf), b.len, b.str); - - return 0; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer.c deleted file mode 100644 index e9bf54b96..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "atomic.h" -#include "buffer_internal.h" -#include "common.h" -#include "mem.h" - -AVBufferRef *av_buffer_create(uint8_t *data, int size, - void (*free)(void *opaque, uint8_t *data), - void *opaque, int flags) -{ - AVBufferRef *ref = NULL; - AVBuffer *buf = NULL; - - buf = av_mallocz(sizeof(*buf)); - if (!buf) - return NULL; - - buf->data = data; - buf->size = size; - buf->free = free ? free : av_buffer_default_free; - buf->opaque = opaque; - buf->refcount = 1; - - if (flags & AV_BUFFER_FLAG_READONLY) - buf->flags |= BUFFER_FLAG_READONLY; - - ref = av_mallocz(sizeof(*ref)); - if (!ref) { - av_freep(&buf); - return NULL; - } - - ref->buffer = buf; - ref->data = data; - ref->size = size; - - return ref; -} - -void av_buffer_default_free(void *opaque, uint8_t *data) -{ - av_free(data); -} - -AVBufferRef *av_buffer_alloc(int size) -{ - AVBufferRef *ret = NULL; - uint8_t *data = NULL; - - data = av_malloc(size); - if (!data) - return NULL; - - ret = av_buffer_create(data, size, av_buffer_default_free, NULL, 0); - if (!ret) - av_freep(&data); - - return ret; -} - -AVBufferRef *av_buffer_allocz(int size) -{ - AVBufferRef *ret = av_buffer_alloc(size); - if (!ret) - return NULL; - - memset(ret->data, 0, size); - return ret; -} - -AVBufferRef *av_buffer_ref(AVBufferRef *buf) -{ - AVBufferRef *ret = av_mallocz(sizeof(*ret)); - - if (!ret) - return NULL; - - *ret = *buf; - - avpriv_atomic_int_add_and_fetch(&buf->buffer->refcount, 1); - - return ret; -} - -void av_buffer_unref(AVBufferRef **buf) -{ - AVBuffer *b; - - if (!buf || !*buf) - return; - b = (*buf)->buffer; - av_freep(buf); - - if (!avpriv_atomic_int_add_and_fetch(&b->refcount, -1)) { - b->free(b->opaque, b->data); - av_freep(&b); - } -} - -int av_buffer_is_writable(const AVBufferRef *buf) -{ - if (buf->buffer->flags & AV_BUFFER_FLAG_READONLY) - return 0; - - return avpriv_atomic_int_get(&buf->buffer->refcount) == 1; -} - -void *av_buffer_get_opaque(const AVBufferRef *buf) -{ - return buf->buffer->opaque; -} - -int av_buffer_get_ref_count(const AVBufferRef *buf) -{ - return buf->buffer->refcount; -} - -int av_buffer_make_writable(AVBufferRef **pbuf) -{ - AVBufferRef *newbuf, *buf = *pbuf; - - if (av_buffer_is_writable(buf)) - return 0; - - newbuf = av_buffer_alloc(buf->size); - if (!newbuf) - return AVERROR(ENOMEM); - - memcpy(newbuf->data, buf->data, buf->size); - av_buffer_unref(pbuf); - *pbuf = newbuf; - - return 0; -} - -int av_buffer_realloc(AVBufferRef **pbuf, int size) -{ - AVBufferRef *buf = *pbuf; - uint8_t *tmp; - - if (!buf) { - /* allocate a new buffer with av_realloc(), so it will be reallocatable - * later */ - uint8_t *data = av_realloc(NULL, size); - if (!data) - return AVERROR(ENOMEM); - - buf = av_buffer_create(data, size, av_buffer_default_free, NULL, 0); - if (!buf) { - av_freep(&data); - return AVERROR(ENOMEM); - } - - buf->buffer->flags |= BUFFER_FLAG_REALLOCATABLE; - *pbuf = buf; - - return 0; - } else if (buf->size == size) - return 0; - - if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || - !av_buffer_is_writable(buf)) { - /* cannot realloc, allocate a new reallocable buffer and copy data */ - AVBufferRef *new = NULL; - - av_buffer_realloc(&new, size); - if (!new) - return AVERROR(ENOMEM); - - memcpy(new->data, buf->data, FFMIN(size, buf->size)); - - av_buffer_unref(pbuf); - *pbuf = new; - return 0; - } - - tmp = av_realloc(buf->buffer->data, size); - if (!tmp) - return AVERROR(ENOMEM); - - buf->buffer->data = buf->data = tmp; - buf->buffer->size = buf->size = size; - return 0; -} - -AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)) -{ - AVBufferPool *pool = av_mallocz(sizeof(*pool)); - if (!pool) - return NULL; - - pool->size = size; - pool->alloc = alloc ? alloc : av_buffer_alloc; - - avpriv_atomic_int_set(&pool->refcount, 1); - - return pool; -} - -/* - * This function gets called when the pool has been uninited and - * all the buffers returned to it. - */ -static void buffer_pool_free(AVBufferPool *pool) -{ - while (pool->pool) { - BufferPoolEntry *buf = pool->pool; - pool->pool = buf->next; - - buf->free(buf->opaque, buf->data); - av_freep(&buf); - } - av_freep(&pool); -} - -void av_buffer_pool_uninit(AVBufferPool **ppool) -{ - AVBufferPool *pool; - - if (!ppool || !*ppool) - return; - pool = *ppool; - *ppool = NULL; - - if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1)) - buffer_pool_free(pool); -} - -/* remove the whole buffer list from the pool and return it */ -static BufferPoolEntry *get_pool(AVBufferPool *pool) -{ - BufferPoolEntry *cur = *(void * volatile *)&pool->pool, *last = NULL; - - while (cur != last) { - last = cur; - cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, last, NULL); - if (!cur) - return NULL; - } - - return cur; -} - -static void add_to_pool(BufferPoolEntry *buf) -{ - AVBufferPool *pool; - BufferPoolEntry *cur, *end = buf; - - if (!buf) - return; - pool = buf->pool; - - while (end->next) - end = end->next; - - while (avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf)) { - /* pool is not empty, retrieve it and append it to our list */ - cur = get_pool(pool); - end->next = cur; - while (end->next) - end = end->next; - } -} - -static void pool_release_buffer(void *opaque, uint8_t *data) -{ - BufferPoolEntry *buf = opaque; - AVBufferPool *pool = buf->pool; - - if(CONFIG_MEMORY_POISONING) - memset(buf->data, FF_MEMORY_POISON, pool->size); - - add_to_pool(buf); - if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1)) - buffer_pool_free(pool); -} - -/* allocate a new buffer and override its free() callback so that - * it is returned to the pool on free */ -static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool) -{ - BufferPoolEntry *buf; - AVBufferRef *ret; - - ret = pool->alloc(pool->size); - if (!ret) - return NULL; - - buf = av_mallocz(sizeof(*buf)); - if (!buf) { - av_buffer_unref(&ret); - return NULL; - } - - buf->data = ret->buffer->data; - buf->opaque = ret->buffer->opaque; - buf->free = ret->buffer->free; - buf->pool = pool; - - ret->buffer->opaque = buf; - ret->buffer->free = pool_release_buffer; - - avpriv_atomic_int_add_and_fetch(&pool->refcount, 1); - avpriv_atomic_int_add_and_fetch(&pool->nb_allocated, 1); - - return ret; -} - -AVBufferRef *av_buffer_pool_get(AVBufferPool *pool) -{ - AVBufferRef *ret; - BufferPoolEntry *buf; - - /* check whether the pool is empty */ - buf = get_pool(pool); - if (!buf && pool->refcount <= pool->nb_allocated) { - av_log(NULL, AV_LOG_DEBUG, "Pool race dectected, spining to avoid overallocation and eventual OOM\n"); - while (!buf && avpriv_atomic_int_get(&pool->refcount) <= avpriv_atomic_int_get(&pool->nb_allocated)) - buf = get_pool(pool); - } - - if (!buf) - return pool_alloc_buffer(pool); - - /* keep the first entry, return the rest of the list to the pool */ - add_to_pool(buf->next); - buf->next = NULL; - - ret = av_buffer_create(buf->data, pool->size, pool_release_buffer, - buf, 0); - if (!ret) { - add_to_pool(buf); - return NULL; - } - avpriv_atomic_int_add_and_fetch(&pool->refcount, 1); - - return ret; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer_internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer_internal.h deleted file mode 100644 index c29190839..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer_internal.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_BUFFER_INTERNAL_H -#define AVUTIL_BUFFER_INTERNAL_H - -#include - -#include "buffer.h" - -/** - * The buffer is always treated as read-only. - */ -#define BUFFER_FLAG_READONLY (1 << 0) -/** - * The buffer was av_realloc()ed, so it is reallocatable. - */ -#define BUFFER_FLAG_REALLOCATABLE (1 << 1) - -struct AVBuffer { - uint8_t *data; /**< data described by this buffer */ - int size; /**< size of data in bytes */ - - /** - * number of existing AVBufferRef instances referring to this buffer - */ - volatile int refcount; - - /** - * a callback for freeing the data - */ - void (*free)(void *opaque, uint8_t *data); - - /** - * an opaque pointer, to be used by the freeing callback - */ - void *opaque; - - /** - * A combination of BUFFER_FLAG_* - */ - int flags; -}; - -typedef struct BufferPoolEntry { - uint8_t *data; - - /* - * Backups of the original opaque/free of the AVBuffer corresponding to - * data. They will be used to free the buffer when the pool is freed. - */ - void *opaque; - void (*free)(void *opaque, uint8_t *data); - - AVBufferPool *pool; - struct BufferPoolEntry * volatile next; -} BufferPoolEntry; - -struct AVBufferPool { - BufferPoolEntry * volatile pool; - - /* - * This is used to track when the pool is to be freed. - * The pointer to the pool itself held by the caller is considered to - * be one reference. Each buffer requested by the caller increases refcount - * by one, returning the buffer to the pool decreases it by one. - * refcount reaches zero when the buffer has been uninited AND all the - * buffers have been released, then it's safe to free the pool and all - * the buffers in it. - */ - volatile int refcount; - - volatile int nb_allocated; - - int size; - AVBufferRef* (*alloc)(int size); -}; - -#endif /* AVUTIL_BUFFER_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.c deleted file mode 100644 index 4c0677f79..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.c +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * audio channel layout utility functions - */ - -#include - -#include "avstring.h" -#include "avutil.h" -#include "channel_layout.h" -#include "bprint.h" -#include "common.h" - -struct channel_name { - const char *name; - const char *description; -}; - -static const struct channel_name channel_names[] = { - [0] = { "FL", "front left" }, - [1] = { "FR", "front right" }, - [2] = { "FC", "front center" }, - [3] = { "LFE", "low frequency" }, - [4] = { "BL", "back left" }, - [5] = { "BR", "back right" }, - [6] = { "FLC", "front left-of-center" }, - [7] = { "FRC", "front right-of-center" }, - [8] = { "BC", "back center" }, - [9] = { "SL", "side left" }, - [10] = { "SR", "side right" }, - [11] = { "TC", "top center" }, - [12] = { "TFL", "top front left" }, - [13] = { "TFC", "top front center" }, - [14] = { "TFR", "top front right" }, - [15] = { "TBL", "top back left" }, - [16] = { "TBC", "top back center" }, - [17] = { "TBR", "top back right" }, - [29] = { "DL", "downmix left" }, - [30] = { "DR", "downmix right" }, - [31] = { "WL", "wide left" }, - [32] = { "WR", "wide right" }, - [33] = { "SDL", "surround direct left" }, - [34] = { "SDR", "surround direct right" }, - [35] = { "LFE2", "low frequency 2" }, -}; - -static const char *get_channel_name(int channel_id) -{ - if (channel_id < 0 || channel_id >= FF_ARRAY_ELEMS(channel_names)) - return NULL; - return channel_names[channel_id].name; -} - -static const struct { - const char *name; - int nb_channels; - uint64_t layout; -} channel_layout_map[] = { - { "mono", 1, AV_CH_LAYOUT_MONO }, - { "stereo", 2, AV_CH_LAYOUT_STEREO }, - { "2.1", 3, AV_CH_LAYOUT_2POINT1 }, - { "3.0", 3, AV_CH_LAYOUT_SURROUND }, - { "3.0(back)", 3, AV_CH_LAYOUT_2_1 }, - { "4.0", 4, AV_CH_LAYOUT_4POINT0 }, - { "quad", 4, AV_CH_LAYOUT_QUAD }, - { "quad(side)", 4, AV_CH_LAYOUT_2_2 }, - { "3.1", 4, AV_CH_LAYOUT_3POINT1 }, - { "5.0", 5, AV_CH_LAYOUT_5POINT0_BACK }, - { "5.0(side)", 5, AV_CH_LAYOUT_5POINT0 }, - { "4.1", 5, AV_CH_LAYOUT_4POINT1 }, - { "5.1", 6, AV_CH_LAYOUT_5POINT1_BACK }, - { "5.1(side)", 6, AV_CH_LAYOUT_5POINT1 }, - { "6.0", 6, AV_CH_LAYOUT_6POINT0 }, - { "6.0(front)", 6, AV_CH_LAYOUT_6POINT0_FRONT }, - { "hexagonal", 6, AV_CH_LAYOUT_HEXAGONAL }, - { "6.1", 7, AV_CH_LAYOUT_6POINT1 }, - { "6.1", 7, AV_CH_LAYOUT_6POINT1_BACK }, - { "6.1(front)", 7, AV_CH_LAYOUT_6POINT1_FRONT }, - { "7.0", 7, AV_CH_LAYOUT_7POINT0 }, - { "7.0(front)", 7, AV_CH_LAYOUT_7POINT0_FRONT }, - { "7.1", 8, AV_CH_LAYOUT_7POINT1 }, - { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE_BACK }, - { "7.1(wide-side)", 8, AV_CH_LAYOUT_7POINT1_WIDE }, - { "octagonal", 8, AV_CH_LAYOUT_OCTAGONAL }, - { "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, }, -}; - -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT -static uint64_t get_channel_layout_single(const char *name, int name_len, int compat) -#else -static uint64_t get_channel_layout_single(const char *name, int name_len) -#endif -{ - int i; - char *end; - int64_t layout; - - for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) { - if (strlen(channel_layout_map[i].name) == name_len && - !memcmp(channel_layout_map[i].name, name, name_len)) - return channel_layout_map[i].layout; - } - for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++) - if (channel_names[i].name && - strlen(channel_names[i].name) == name_len && - !memcmp(channel_names[i].name, name, name_len)) - return (int64_t)1 << i; - i = strtol(name, &end, 10); - -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT - if (compat) { - if (end - name == name_len || - (end + 1 - name == name_len && *end == 'c')) { - layout = av_get_default_channel_layout(i); - if (end - name == name_len) { - av_log(NULL, AV_LOG_WARNING, - "Single channel layout '%.*s' is interpreted as a number of channels, " - "switch to the syntax '%.*sc' otherwise it will be interpreted as a " - "channel layout number in a later version\n", - name_len, name, name_len, name); - return layout; - } - } - } else { -#endif - if ((end + 1 - name == name_len && *end == 'c')) - return av_get_default_channel_layout(i); -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT - } -#endif - - layout = strtoll(name, &end, 0); - if (end - name == name_len) - return FFMAX(layout, 0); - return 0; -} - -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT -uint64_t ff_get_channel_layout(const char *name, int compat) -#else -uint64_t av_get_channel_layout(const char *name) -#endif -{ - const char *n, *e; - const char *name_end = name + strlen(name); - int64_t layout = 0, layout_single; - - for (n = name; n < name_end; n = e + 1) { - for (e = n; e < name_end && *e != '+' && *e != '|'; e++); -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT - layout_single = get_channel_layout_single(n, e - n, compat); -#else - layout_single = get_channel_layout_single(n, e - n); -#endif - if (!layout_single) - return 0; - layout |= layout_single; - } - return layout; -} - -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT -uint64_t av_get_channel_layout(const char *name) -{ - return ff_get_channel_layout(name, 1); -} -#endif - -void av_bprint_channel_layout(struct AVBPrint *bp, - int nb_channels, uint64_t channel_layout) -{ - int i; - - if (nb_channels <= 0) - nb_channels = av_get_channel_layout_nb_channels(channel_layout); - - for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) - if (nb_channels == channel_layout_map[i].nb_channels && - channel_layout == channel_layout_map[i].layout) { - av_bprintf(bp, "%s", channel_layout_map[i].name); - return; - } - - av_bprintf(bp, "%d channels", nb_channels); - if (channel_layout) { - int i, ch; - av_bprintf(bp, " ("); - for (i = 0, ch = 0; i < 64; i++) { - if ((channel_layout & (UINT64_C(1) << i))) { - const char *name = get_channel_name(i); - if (name) { - if (ch > 0) - av_bprintf(bp, "+"); - av_bprintf(bp, "%s", name); - } - ch++; - } - } - av_bprintf(bp, ")"); - } -} - -void av_get_channel_layout_string(char *buf, int buf_size, - int nb_channels, uint64_t channel_layout) -{ - AVBPrint bp; - - av_bprint_init_for_buffer(&bp, buf, buf_size); - av_bprint_channel_layout(&bp, nb_channels, channel_layout); -} - -int av_get_channel_layout_nb_channels(uint64_t channel_layout) -{ - return av_popcount64(channel_layout); -} - -int64_t av_get_default_channel_layout(int nb_channels) { - int i; - for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map); i++) - if (nb_channels == channel_layout_map[i].nb_channels) - return channel_layout_map[i].layout; - return 0; -} - -int av_get_channel_layout_channel_index(uint64_t channel_layout, - uint64_t channel) -{ - if (!(channel_layout & channel) || - av_get_channel_layout_nb_channels(channel) != 1) - return AVERROR(EINVAL); - channel_layout &= channel - 1; - return av_get_channel_layout_nb_channels(channel_layout); -} - -const char *av_get_channel_name(uint64_t channel) -{ - int i; - if (av_get_channel_layout_nb_channels(channel) != 1) - return NULL; - for (i = 0; i < 64; i++) - if ((1ULL<= FF_ARRAY_ELEMS(channel_layout_map)) - return AVERROR_EOF; - if (layout) *layout = channel_layout_map[index].layout; - if (name) *name = channel_layout_map[index].name; - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/colorspace.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/colorspace.h deleted file mode 100644 index f43815981..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/colorspace.h +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Colorspace conversion defines - * Copyright (c) 2001, 2002, 2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Various defines for YUV<->RGB conversion - */ - -#ifndef AVUTIL_COLORSPACE_H -#define AVUTIL_COLORSPACE_H - -#define SCALEBITS 10 -#define ONE_HALF (1 << (SCALEBITS - 1)) -#define FIX(x) ((int) ((x) * (1<> SCALEBITS];\ - g = cm[(y + g_add) >> SCALEBITS];\ - b = cm[(y + b_add) >> SCALEBITS];\ -} - -#define YUV_TO_RGB1(cb1, cr1)\ -{\ - cb = (cb1) - 128;\ - cr = (cr1) - 128;\ - r_add = FIX(1.40200) * cr + ONE_HALF;\ - g_add = - FIX(0.34414) * cb - FIX(0.71414) * cr + ONE_HALF;\ - b_add = FIX(1.77200) * cb + ONE_HALF;\ -} - -#define YUV_TO_RGB2(r, g, b, y1)\ -{\ - y = (y1) << SCALEBITS;\ - r = cm[(y + r_add) >> SCALEBITS];\ - g = cm[(y + g_add) >> SCALEBITS];\ - b = cm[(y + b_add) >> SCALEBITS];\ -} - -#define Y_CCIR_TO_JPEG(y)\ - cm[((y) * FIX(255.0/219.0) + (ONE_HALF - 16 * FIX(255.0/219.0))) >> SCALEBITS] - -#define Y_JPEG_TO_CCIR(y)\ - (((y) * FIX(219.0/255.0) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) - -#define C_CCIR_TO_JPEG(y)\ - cm[(((y) - 128) * FIX(127.0/112.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS] - -/* NOTE: the clamp is really necessary! */ -static inline int C_JPEG_TO_CCIR(int y) { - y = (((y - 128) * FIX(112.0/127.0) + (ONE_HALF + (128 << SCALEBITS))) >> SCALEBITS); - if (y < 16) - y = 16; - return y; -} - - -#define RGB_TO_Y(r, g, b) \ -((FIX(0.29900) * (r) + FIX(0.58700) * (g) + \ - FIX(0.11400) * (b) + ONE_HALF) >> SCALEBITS) - -#define RGB_TO_U(r1, g1, b1, shift)\ -(((- FIX(0.16874) * r1 - FIX(0.33126) * g1 + \ - FIX(0.50000) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#define RGB_TO_V(r1, g1, b1, shift)\ -(((FIX(0.50000) * r1 - FIX(0.41869) * g1 - \ - FIX(0.08131) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#define RGB_TO_Y_CCIR(r, g, b) \ -((FIX(0.29900*219.0/255.0) * (r) + FIX(0.58700*219.0/255.0) * (g) + \ - FIX(0.11400*219.0/255.0) * (b) + (ONE_HALF + (16 << SCALEBITS))) >> SCALEBITS) - -#define RGB_TO_U_CCIR(r1, g1, b1, shift)\ -(((- FIX(0.16874*224.0/255.0) * r1 - FIX(0.33126*224.0/255.0) * g1 + \ - FIX(0.50000*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#define RGB_TO_V_CCIR(r1, g1, b1, shift)\ -(((FIX(0.50000*224.0/255.0) * r1 - FIX(0.41869*224.0/255.0) * g1 - \ - FIX(0.08131*224.0/255.0) * b1 + (ONE_HALF << shift) - 1) >> (SCALEBITS + shift)) + 128) - -#endif /* AVUTIL_COLORSPACE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.c deleted file mode 100644 index 256bd237d..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.c +++ /dev/null @@ -1,318 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "cpu.h" -#include "cpu_internal.h" -#include "config.h" -#include "opt.h" -#include "common.h" - -#if HAVE_SCHED_GETAFFINITY -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif -#include -#endif -#if HAVE_GETPROCESSAFFINITYMASK -#include -#endif -#if HAVE_SYSCTL -#if HAVE_SYS_PARAM_H -#include -#endif -#include -#include -#endif -#if HAVE_SYSCONF -#include -#endif - -static int flags, checked; - -void av_force_cpu_flags(int arg){ - flags = arg; - checked = arg != -1; -} - -int av_get_cpu_flags(void) -{ - if (checked) - return flags; - - if (ARCH_AARCH64) - flags = ff_get_cpu_flags_aarch64(); - if (ARCH_ARM) - flags = ff_get_cpu_flags_arm(); - if (ARCH_PPC) - flags = ff_get_cpu_flags_ppc(); - if (ARCH_X86) - flags = ff_get_cpu_flags_x86(); - - checked = 1; - return flags; -} - -void av_set_cpu_flags_mask(int mask) -{ - checked = 0; - flags = av_get_cpu_flags() & mask; - checked = 1; -} - -int av_parse_cpu_flags(const char *s) -{ -#define CPUFLAG_MMXEXT (AV_CPU_FLAG_MMX | AV_CPU_FLAG_MMXEXT | AV_CPU_FLAG_CMOV) -#define CPUFLAG_3DNOW (AV_CPU_FLAG_3DNOW | AV_CPU_FLAG_MMX) -#define CPUFLAG_3DNOWEXT (AV_CPU_FLAG_3DNOWEXT | CPUFLAG_3DNOW) -#define CPUFLAG_SSE (AV_CPU_FLAG_SSE | CPUFLAG_MMXEXT) -#define CPUFLAG_SSE2 (AV_CPU_FLAG_SSE2 | CPUFLAG_SSE) -#define CPUFLAG_SSE2SLOW (AV_CPU_FLAG_SSE2SLOW | CPUFLAG_SSE2) -#define CPUFLAG_SSE3 (AV_CPU_FLAG_SSE3 | CPUFLAG_SSE2) -#define CPUFLAG_SSE3SLOW (AV_CPU_FLAG_SSE3SLOW | CPUFLAG_SSE3) -#define CPUFLAG_SSSE3 (AV_CPU_FLAG_SSSE3 | CPUFLAG_SSE3) -#define CPUFLAG_SSE4 (AV_CPU_FLAG_SSE4 | CPUFLAG_SSSE3) -#define CPUFLAG_SSE42 (AV_CPU_FLAG_SSE42 | CPUFLAG_SSE4) -#define CPUFLAG_AVX (AV_CPU_FLAG_AVX | CPUFLAG_SSE42) -#define CPUFLAG_XOP (AV_CPU_FLAG_XOP | CPUFLAG_AVX) -#define CPUFLAG_FMA3 (AV_CPU_FLAG_FMA3 | CPUFLAG_AVX) -#define CPUFLAG_FMA4 (AV_CPU_FLAG_FMA4 | CPUFLAG_AVX) -#define CPUFLAG_AVX2 (AV_CPU_FLAG_AVX2 | CPUFLAG_AVX) -#define CPUFLAG_BMI1 (AV_CPU_FLAG_BMI1) -#define CPUFLAG_BMI2 (AV_CPU_FLAG_BMI2 | CPUFLAG_BMI1) - static const AVOption cpuflags_opts[] = { - { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, -#if ARCH_PPC - { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" }, -#elif ARCH_X86 - { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" }, - { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_MMXEXT }, .unit = "flags" }, - { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE }, .unit = "flags" }, - { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2 }, .unit = "flags" }, - { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE2SLOW }, .unit = "flags" }, - { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3 }, .unit = "flags" }, - { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE3SLOW }, .unit = "flags" }, - { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSSE3 }, .unit = "flags" }, - { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" }, - { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE4 }, .unit = "flags" }, - { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_SSE42 }, .unit = "flags" }, - { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX }, .unit = "flags" }, - { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_XOP }, .unit = "flags" }, - { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA3 }, .unit = "flags" }, - { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_FMA4 }, .unit = "flags" }, - { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_AVX2 }, .unit = "flags" }, - { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI1 }, .unit = "flags" }, - { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_BMI2 }, .unit = "flags" }, - { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOW }, .unit = "flags" }, - { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPUFLAG_3DNOWEXT }, .unit = "flags" }, - { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" }, -#elif ARCH_ARM - { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, - { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, - { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, - { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, - { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, - { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, -#elif ARCH_AARCH64 - { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, - { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, -#endif - { NULL }, - }; - static const AVClass class = { - .class_name = "cpuflags", - .item_name = av_default_item_name, - .option = cpuflags_opts, - .version = LIBAVUTIL_VERSION_INT, - }; - - int flags = 0, ret; - const AVClass *pclass = &class; - - if ((ret = av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, &flags)) < 0) - return ret; - - return flags & INT_MAX; -} - -int av_parse_cpu_caps(unsigned *flags, const char *s) -{ - static const AVOption cpuflags_opts[] = { - { "flags" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, -#if ARCH_PPC - { "altivec" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ALTIVEC }, .unit = "flags" }, -#elif ARCH_X86 - { "mmx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" }, - { "mmx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX2 }, .unit = "flags" }, - { "mmxext" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX2 }, .unit = "flags" }, - { "sse" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE }, .unit = "flags" }, - { "sse2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE2 }, .unit = "flags" }, - { "sse2slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE2SLOW }, .unit = "flags" }, - { "sse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE3 }, .unit = "flags" }, - { "sse3slow", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE3SLOW }, .unit = "flags" }, - { "ssse3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSSE3 }, .unit = "flags" }, - { "atom" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ATOM }, .unit = "flags" }, - { "sse4.1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE4 }, .unit = "flags" }, - { "sse4.2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SSE42 }, .unit = "flags" }, - { "avx" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX }, .unit = "flags" }, - { "xop" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_XOP }, .unit = "flags" }, - { "fma3" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_FMA3 }, .unit = "flags" }, - { "fma4" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_FMA4 }, .unit = "flags" }, - { "avx2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX2 }, .unit = "flags" }, - { "bmi1" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI1 }, .unit = "flags" }, - { "bmi2" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_BMI2 }, .unit = "flags" }, - { "3dnow" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOW }, .unit = "flags" }, - { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOWEXT }, .unit = "flags" }, - { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" }, - -#define CPU_FLAG_P2 AV_CPU_FLAG_CMOV | AV_CPU_FLAG_MMX -#define CPU_FLAG_P3 CPU_FLAG_P2 | AV_CPU_FLAG_MMX2 | AV_CPU_FLAG_SSE -#define CPU_FLAG_P4 CPU_FLAG_P3| AV_CPU_FLAG_SSE2 - { "pentium2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P2 }, .unit = "flags" }, - { "pentium3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P3 }, .unit = "flags" }, - { "pentium4", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_P4 }, .unit = "flags" }, - -#define CPU_FLAG_K62 AV_CPU_FLAG_MMX | AV_CPU_FLAG_3DNOW -#define CPU_FLAG_ATHLON CPU_FLAG_K62 | AV_CPU_FLAG_CMOV | AV_CPU_FLAG_3DNOWEXT | AV_CPU_FLAG_MMX2 -#define CPU_FLAG_ATHLONXP CPU_FLAG_ATHLON | AV_CPU_FLAG_SSE -#define CPU_FLAG_K8 CPU_FLAG_ATHLONXP | AV_CPU_FLAG_SSE2 - { "k6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMX }, .unit = "flags" }, - { "k62", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_K62 }, .unit = "flags" }, - { "athlon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_ATHLON }, .unit = "flags" }, - { "athlonxp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_ATHLONXP }, .unit = "flags" }, - { "k8", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = CPU_FLAG_K8 }, .unit = "flags" }, -#elif ARCH_ARM - { "armv5te", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV5TE }, .unit = "flags" }, - { "armv6", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6 }, .unit = "flags" }, - { "armv6t2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARMV6T2 }, .unit = "flags" }, - { "vfp", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFP }, .unit = "flags" }, - { "vfpv3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_VFPV3 }, .unit = "flags" }, - { "neon", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_NEON }, .unit = "flags" }, -#endif - { NULL }, - }; - static const AVClass class = { - .class_name = "cpuflags", - .item_name = av_default_item_name, - .option = cpuflags_opts, - .version = LIBAVUTIL_VERSION_INT, - }; - const AVClass *pclass = &class; - - return av_opt_eval_flags(&pclass, &cpuflags_opts[0], s, flags); -} - -int av_cpu_count(void) -{ - static volatile int printed; - - int nb_cpus = 1; -#if HAVE_SCHED_GETAFFINITY && defined(CPU_COUNT) - cpu_set_t cpuset; - - CPU_ZERO(&cpuset); - - if (!sched_getaffinity(0, sizeof(cpuset), &cpuset)) - nb_cpus = CPU_COUNT(&cpuset); -#elif HAVE_GETPROCESSAFFINITYMASK - DWORD_PTR proc_aff, sys_aff; - if (GetProcessAffinityMask(GetCurrentProcess(), &proc_aff, &sys_aff)) - nb_cpus = av_popcount64(proc_aff); -#elif HAVE_SYSCTL && defined(HW_NCPU) - int mib[2] = { CTL_HW, HW_NCPU }; - size_t len = sizeof(nb_cpus); - - if (sysctl(mib, 2, &nb_cpus, &len, NULL, 0) == -1) - nb_cpus = 0; -#elif HAVE_SYSCONF && defined(_SC_NPROC_ONLN) - nb_cpus = sysconf(_SC_NPROC_ONLN); -#elif HAVE_SYSCONF && defined(_SC_NPROCESSORS_ONLN) - nb_cpus = sysconf(_SC_NPROCESSORS_ONLN); -#endif - - if (!printed) { - av_log(NULL, AV_LOG_DEBUG, "detected %d logical cores\n", nb_cpus); - printed = 1; - } - - return nb_cpus; -} - -#ifdef TEST - -#include - -static const struct { - int flag; - const char *name; -} cpu_flag_tab[] = { -#if ARCH_AARCH64 - { AV_CPU_FLAG_NEON, "neon" }, - { AV_CPU_FLAG_VFP, "vfp" }, -#elif ARCH_ARM - { AV_CPU_FLAG_ARMV5TE, "armv5te" }, - { AV_CPU_FLAG_ARMV6, "armv6" }, - { AV_CPU_FLAG_ARMV6T2, "armv6t2" }, - { AV_CPU_FLAG_VFP, "vfp" }, - { AV_CPU_FLAG_VFPV3, "vfpv3" }, - { AV_CPU_FLAG_NEON, "neon" }, -#elif ARCH_PPC - { AV_CPU_FLAG_ALTIVEC, "altivec" }, -#elif ARCH_X86 - { AV_CPU_FLAG_MMX, "mmx" }, - { AV_CPU_FLAG_MMXEXT, "mmxext" }, - { AV_CPU_FLAG_SSE, "sse" }, - { AV_CPU_FLAG_SSE2, "sse2" }, - { AV_CPU_FLAG_SSE2SLOW, "sse2(slow)" }, - { AV_CPU_FLAG_SSE3, "sse3" }, - { AV_CPU_FLAG_SSE3SLOW, "sse3(slow)" }, - { AV_CPU_FLAG_SSSE3, "ssse3" }, - { AV_CPU_FLAG_ATOM, "atom" }, - { AV_CPU_FLAG_SSE4, "sse4.1" }, - { AV_CPU_FLAG_SSE42, "sse4.2" }, - { AV_CPU_FLAG_AVX, "avx" }, - { AV_CPU_FLAG_XOP, "xop" }, - { AV_CPU_FLAG_FMA3, "fma3" }, - { AV_CPU_FLAG_FMA4, "fma4" }, - { AV_CPU_FLAG_3DNOW, "3dnow" }, - { AV_CPU_FLAG_3DNOWEXT, "3dnowext" }, - { AV_CPU_FLAG_CMOV, "cmov" }, - { AV_CPU_FLAG_AVX2, "avx2" }, - { AV_CPU_FLAG_BMI1, "bmi1" }, - { AV_CPU_FLAG_BMI2, "bmi2" }, -#endif - { 0 } -}; - -int main(void) -{ - int cpu_flags = av_get_cpu_flags(); - int i; - - printf("cpu_flags = 0x%08X\n", cpu_flags); - printf("cpu_flags ="); - for (i = 0; cpu_flag_tab[i].flag; i++) - if (cpu_flags & cpu_flag_tab[i].flag) - printf(" %s", cpu_flag_tab[i].name); - printf("\n"); - - return 0; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu_internal.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu_internal.h deleted file mode 100644 index 8597a32eb..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu_internal.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_CPU_INTERNAL_H -#define AVUTIL_CPU_INTERNAL_H - -#include "cpu.h" - -#define CPUEXT_SUFFIX(flags, suffix, cpuext) \ - (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext)) - -#define CPUEXT(flags, cpuext) CPUEXT_SUFFIX(flags, , cpuext) - -int ff_get_cpu_flags_arm(void); -int ff_get_cpu_flags_ppc(void); -int ff_get_cpu_flags_x86(void); - -#endif /* AVUTIL_CPU_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.c deleted file mode 100644 index b429fe1e3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.c +++ /dev/null @@ -1,367 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "common.h" -#include "bswap.h" -#include "crc.h" - -#if CONFIG_HARDCODED_TABLES -static const AVCRC av_crc_table[AV_CRC_MAX][257] = { - [AV_CRC_8_ATM] = { - 0x00, 0x07, 0x0E, 0x09, 0x1C, 0x1B, 0x12, 0x15, 0x38, 0x3F, 0x36, 0x31, - 0x24, 0x23, 0x2A, 0x2D, 0x70, 0x77, 0x7E, 0x79, 0x6C, 0x6B, 0x62, 0x65, - 0x48, 0x4F, 0x46, 0x41, 0x54, 0x53, 0x5A, 0x5D, 0xE0, 0xE7, 0xEE, 0xE9, - 0xFC, 0xFB, 0xF2, 0xF5, 0xD8, 0xDF, 0xD6, 0xD1, 0xC4, 0xC3, 0xCA, 0xCD, - 0x90, 0x97, 0x9E, 0x99, 0x8C, 0x8B, 0x82, 0x85, 0xA8, 0xAF, 0xA6, 0xA1, - 0xB4, 0xB3, 0xBA, 0xBD, 0xC7, 0xC0, 0xC9, 0xCE, 0xDB, 0xDC, 0xD5, 0xD2, - 0xFF, 0xF8, 0xF1, 0xF6, 0xE3, 0xE4, 0xED, 0xEA, 0xB7, 0xB0, 0xB9, 0xBE, - 0xAB, 0xAC, 0xA5, 0xA2, 0x8F, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9D, 0x9A, - 0x27, 0x20, 0x29, 0x2E, 0x3B, 0x3C, 0x35, 0x32, 0x1F, 0x18, 0x11, 0x16, - 0x03, 0x04, 0x0D, 0x0A, 0x57, 0x50, 0x59, 0x5E, 0x4B, 0x4C, 0x45, 0x42, - 0x6F, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7D, 0x7A, 0x89, 0x8E, 0x87, 0x80, - 0x95, 0x92, 0x9B, 0x9C, 0xB1, 0xB6, 0xBF, 0xB8, 0xAD, 0xAA, 0xA3, 0xA4, - 0xF9, 0xFE, 0xF7, 0xF0, 0xE5, 0xE2, 0xEB, 0xEC, 0xC1, 0xC6, 0xCF, 0xC8, - 0xDD, 0xDA, 0xD3, 0xD4, 0x69, 0x6E, 0x67, 0x60, 0x75, 0x72, 0x7B, 0x7C, - 0x51, 0x56, 0x5F, 0x58, 0x4D, 0x4A, 0x43, 0x44, 0x19, 0x1E, 0x17, 0x10, - 0x05, 0x02, 0x0B, 0x0C, 0x21, 0x26, 0x2F, 0x28, 0x3D, 0x3A, 0x33, 0x34, - 0x4E, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5C, 0x5B, 0x76, 0x71, 0x78, 0x7F, - 0x6A, 0x6D, 0x64, 0x63, 0x3E, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2C, 0x2B, - 0x06, 0x01, 0x08, 0x0F, 0x1A, 0x1D, 0x14, 0x13, 0xAE, 0xA9, 0xA0, 0xA7, - 0xB2, 0xB5, 0xBC, 0xBB, 0x96, 0x91, 0x98, 0x9F, 0x8A, 0x8D, 0x84, 0x83, - 0xDE, 0xD9, 0xD0, 0xD7, 0xC2, 0xC5, 0xCC, 0xCB, 0xE6, 0xE1, 0xE8, 0xEF, - 0xFA, 0xFD, 0xF4, 0xF3, 0x01 - }, - [AV_CRC_16_ANSI] = { - 0x0000, 0x0580, 0x0F80, 0x0A00, 0x1B80, 0x1E00, 0x1400, 0x1180, - 0x3380, 0x3600, 0x3C00, 0x3980, 0x2800, 0x2D80, 0x2780, 0x2200, - 0x6380, 0x6600, 0x6C00, 0x6980, 0x7800, 0x7D80, 0x7780, 0x7200, - 0x5000, 0x5580, 0x5F80, 0x5A00, 0x4B80, 0x4E00, 0x4400, 0x4180, - 0xC380, 0xC600, 0xCC00, 0xC980, 0xD800, 0xDD80, 0xD780, 0xD200, - 0xF000, 0xF580, 0xFF80, 0xFA00, 0xEB80, 0xEE00, 0xE400, 0xE180, - 0xA000, 0xA580, 0xAF80, 0xAA00, 0xBB80, 0xBE00, 0xB400, 0xB180, - 0x9380, 0x9600, 0x9C00, 0x9980, 0x8800, 0x8D80, 0x8780, 0x8200, - 0x8381, 0x8601, 0x8C01, 0x8981, 0x9801, 0x9D81, 0x9781, 0x9201, - 0xB001, 0xB581, 0xBF81, 0xBA01, 0xAB81, 0xAE01, 0xA401, 0xA181, - 0xE001, 0xE581, 0xEF81, 0xEA01, 0xFB81, 0xFE01, 0xF401, 0xF181, - 0xD381, 0xD601, 0xDC01, 0xD981, 0xC801, 0xCD81, 0xC781, 0xC201, - 0x4001, 0x4581, 0x4F81, 0x4A01, 0x5B81, 0x5E01, 0x5401, 0x5181, - 0x7381, 0x7601, 0x7C01, 0x7981, 0x6801, 0x6D81, 0x6781, 0x6201, - 0x2381, 0x2601, 0x2C01, 0x2981, 0x3801, 0x3D81, 0x3781, 0x3201, - 0x1001, 0x1581, 0x1F81, 0x1A01, 0x0B81, 0x0E01, 0x0401, 0x0181, - 0x0383, 0x0603, 0x0C03, 0x0983, 0x1803, 0x1D83, 0x1783, 0x1203, - 0x3003, 0x3583, 0x3F83, 0x3A03, 0x2B83, 0x2E03, 0x2403, 0x2183, - 0x6003, 0x6583, 0x6F83, 0x6A03, 0x7B83, 0x7E03, 0x7403, 0x7183, - 0x5383, 0x5603, 0x5C03, 0x5983, 0x4803, 0x4D83, 0x4783, 0x4203, - 0xC003, 0xC583, 0xCF83, 0xCA03, 0xDB83, 0xDE03, 0xD403, 0xD183, - 0xF383, 0xF603, 0xFC03, 0xF983, 0xE803, 0xED83, 0xE783, 0xE203, - 0xA383, 0xA603, 0xAC03, 0xA983, 0xB803, 0xBD83, 0xB783, 0xB203, - 0x9003, 0x9583, 0x9F83, 0x9A03, 0x8B83, 0x8E03, 0x8403, 0x8183, - 0x8002, 0x8582, 0x8F82, 0x8A02, 0x9B82, 0x9E02, 0x9402, 0x9182, - 0xB382, 0xB602, 0xBC02, 0xB982, 0xA802, 0xAD82, 0xA782, 0xA202, - 0xE382, 0xE602, 0xEC02, 0xE982, 0xF802, 0xFD82, 0xF782, 0xF202, - 0xD002, 0xD582, 0xDF82, 0xDA02, 0xCB82, 0xCE02, 0xC402, 0xC182, - 0x4382, 0x4602, 0x4C02, 0x4982, 0x5802, 0x5D82, 0x5782, 0x5202, - 0x7002, 0x7582, 0x7F82, 0x7A02, 0x6B82, 0x6E02, 0x6402, 0x6182, - 0x2002, 0x2582, 0x2F82, 0x2A02, 0x3B82, 0x3E02, 0x3402, 0x3182, - 0x1382, 0x1602, 0x1C02, 0x1982, 0x0802, 0x0D82, 0x0782, 0x0202, - 0x0001 - }, - [AV_CRC_16_CCITT] = { - 0x0000, 0x2110, 0x4220, 0x6330, 0x8440, 0xA550, 0xC660, 0xE770, - 0x0881, 0x2991, 0x4AA1, 0x6BB1, 0x8CC1, 0xADD1, 0xCEE1, 0xEFF1, - 0x3112, 0x1002, 0x7332, 0x5222, 0xB552, 0x9442, 0xF772, 0xD662, - 0x3993, 0x1883, 0x7BB3, 0x5AA3, 0xBDD3, 0x9CC3, 0xFFF3, 0xDEE3, - 0x6224, 0x4334, 0x2004, 0x0114, 0xE664, 0xC774, 0xA444, 0x8554, - 0x6AA5, 0x4BB5, 0x2885, 0x0995, 0xEEE5, 0xCFF5, 0xACC5, 0x8DD5, - 0x5336, 0x7226, 0x1116, 0x3006, 0xD776, 0xF666, 0x9556, 0xB446, - 0x5BB7, 0x7AA7, 0x1997, 0x3887, 0xDFF7, 0xFEE7, 0x9DD7, 0xBCC7, - 0xC448, 0xE558, 0x8668, 0xA778, 0x4008, 0x6118, 0x0228, 0x2338, - 0xCCC9, 0xEDD9, 0x8EE9, 0xAFF9, 0x4889, 0x6999, 0x0AA9, 0x2BB9, - 0xF55A, 0xD44A, 0xB77A, 0x966A, 0x711A, 0x500A, 0x333A, 0x122A, - 0xFDDB, 0xDCCB, 0xBFFB, 0x9EEB, 0x799B, 0x588B, 0x3BBB, 0x1AAB, - 0xA66C, 0x877C, 0xE44C, 0xC55C, 0x222C, 0x033C, 0x600C, 0x411C, - 0xAEED, 0x8FFD, 0xECCD, 0xCDDD, 0x2AAD, 0x0BBD, 0x688D, 0x499D, - 0x977E, 0xB66E, 0xD55E, 0xF44E, 0x133E, 0x322E, 0x511E, 0x700E, - 0x9FFF, 0xBEEF, 0xDDDF, 0xFCCF, 0x1BBF, 0x3AAF, 0x599F, 0x788F, - 0x8891, 0xA981, 0xCAB1, 0xEBA1, 0x0CD1, 0x2DC1, 0x4EF1, 0x6FE1, - 0x8010, 0xA100, 0xC230, 0xE320, 0x0450, 0x2540, 0x4670, 0x6760, - 0xB983, 0x9893, 0xFBA3, 0xDAB3, 0x3DC3, 0x1CD3, 0x7FE3, 0x5EF3, - 0xB102, 0x9012, 0xF322, 0xD232, 0x3542, 0x1452, 0x7762, 0x5672, - 0xEAB5, 0xCBA5, 0xA895, 0x8985, 0x6EF5, 0x4FE5, 0x2CD5, 0x0DC5, - 0xE234, 0xC324, 0xA014, 0x8104, 0x6674, 0x4764, 0x2454, 0x0544, - 0xDBA7, 0xFAB7, 0x9987, 0xB897, 0x5FE7, 0x7EF7, 0x1DC7, 0x3CD7, - 0xD326, 0xF236, 0x9106, 0xB016, 0x5766, 0x7676, 0x1546, 0x3456, - 0x4CD9, 0x6DC9, 0x0EF9, 0x2FE9, 0xC899, 0xE989, 0x8AB9, 0xABA9, - 0x4458, 0x6548, 0x0678, 0x2768, 0xC018, 0xE108, 0x8238, 0xA328, - 0x7DCB, 0x5CDB, 0x3FEB, 0x1EFB, 0xF98B, 0xD89B, 0xBBAB, 0x9ABB, - 0x754A, 0x545A, 0x376A, 0x167A, 0xF10A, 0xD01A, 0xB32A, 0x923A, - 0x2EFD, 0x0FED, 0x6CDD, 0x4DCD, 0xAABD, 0x8BAD, 0xE89D, 0xC98D, - 0x267C, 0x076C, 0x645C, 0x454C, 0xA23C, 0x832C, 0xE01C, 0xC10C, - 0x1FEF, 0x3EFF, 0x5DCF, 0x7CDF, 0x9BAF, 0xBABF, 0xD98F, 0xF89F, - 0x176E, 0x367E, 0x554E, 0x745E, 0x932E, 0xB23E, 0xD10E, 0xF01E, - 0x0001 - }, - [AV_CRC_24_IEEE] = { - 0x000000, 0xFB4C86, 0x0DD58A, 0xF6990C, 0xE1E693, 0x1AAA15, 0xEC3319, - 0x177F9F, 0x3981A1, 0xC2CD27, 0x34542B, 0xCF18AD, 0xD86732, 0x232BB4, - 0xD5B2B8, 0x2EFE3E, 0x894EC5, 0x720243, 0x849B4F, 0x7FD7C9, 0x68A856, - 0x93E4D0, 0x657DDC, 0x9E315A, 0xB0CF64, 0x4B83E2, 0xBD1AEE, 0x465668, - 0x5129F7, 0xAA6571, 0x5CFC7D, 0xA7B0FB, 0xE9D10C, 0x129D8A, 0xE40486, - 0x1F4800, 0x08379F, 0xF37B19, 0x05E215, 0xFEAE93, 0xD050AD, 0x2B1C2B, - 0xDD8527, 0x26C9A1, 0x31B63E, 0xCAFAB8, 0x3C63B4, 0xC72F32, 0x609FC9, - 0x9BD34F, 0x6D4A43, 0x9606C5, 0x81795A, 0x7A35DC, 0x8CACD0, 0x77E056, - 0x591E68, 0xA252EE, 0x54CBE2, 0xAF8764, 0xB8F8FB, 0x43B47D, 0xB52D71, - 0x4E61F7, 0xD2A319, 0x29EF9F, 0xDF7693, 0x243A15, 0x33458A, 0xC8090C, - 0x3E9000, 0xC5DC86, 0xEB22B8, 0x106E3E, 0xE6F732, 0x1DBBB4, 0x0AC42B, - 0xF188AD, 0x0711A1, 0xFC5D27, 0x5BEDDC, 0xA0A15A, 0x563856, 0xAD74D0, - 0xBA0B4F, 0x4147C9, 0xB7DEC5, 0x4C9243, 0x626C7D, 0x9920FB, 0x6FB9F7, - 0x94F571, 0x838AEE, 0x78C668, 0x8E5F64, 0x7513E2, 0x3B7215, 0xC03E93, - 0x36A79F, 0xCDEB19, 0xDA9486, 0x21D800, 0xD7410C, 0x2C0D8A, 0x02F3B4, - 0xF9BF32, 0x0F263E, 0xF46AB8, 0xE31527, 0x1859A1, 0xEEC0AD, 0x158C2B, - 0xB23CD0, 0x497056, 0xBFE95A, 0x44A5DC, 0x53DA43, 0xA896C5, 0x5E0FC9, - 0xA5434F, 0x8BBD71, 0x70F1F7, 0x8668FB, 0x7D247D, 0x6A5BE2, 0x911764, - 0x678E68, 0x9CC2EE, 0xA44733, 0x5F0BB5, 0xA992B9, 0x52DE3F, 0x45A1A0, - 0xBEED26, 0x48742A, 0xB338AC, 0x9DC692, 0x668A14, 0x901318, 0x6B5F9E, - 0x7C2001, 0x876C87, 0x71F58B, 0x8AB90D, 0x2D09F6, 0xD64570, 0x20DC7C, - 0xDB90FA, 0xCCEF65, 0x37A3E3, 0xC13AEF, 0x3A7669, 0x148857, 0xEFC4D1, - 0x195DDD, 0xE2115B, 0xF56EC4, 0x0E2242, 0xF8BB4E, 0x03F7C8, 0x4D963F, - 0xB6DAB9, 0x4043B5, 0xBB0F33, 0xAC70AC, 0x573C2A, 0xA1A526, 0x5AE9A0, - 0x74179E, 0x8F5B18, 0x79C214, 0x828E92, 0x95F10D, 0x6EBD8B, 0x982487, - 0x636801, 0xC4D8FA, 0x3F947C, 0xC90D70, 0x3241F6, 0x253E69, 0xDE72EF, - 0x28EBE3, 0xD3A765, 0xFD595B, 0x0615DD, 0xF08CD1, 0x0BC057, 0x1CBFC8, - 0xE7F34E, 0x116A42, 0xEA26C4, 0x76E42A, 0x8DA8AC, 0x7B31A0, 0x807D26, - 0x9702B9, 0x6C4E3F, 0x9AD733, 0x619BB5, 0x4F658B, 0xB4290D, 0x42B001, - 0xB9FC87, 0xAE8318, 0x55CF9E, 0xA35692, 0x581A14, 0xFFAAEF, 0x04E669, - 0xF27F65, 0x0933E3, 0x1E4C7C, 0xE500FA, 0x1399F6, 0xE8D570, 0xC62B4E, - 0x3D67C8, 0xCBFEC4, 0x30B242, 0x27CDDD, 0xDC815B, 0x2A1857, 0xD154D1, - 0x9F3526, 0x6479A0, 0x92E0AC, 0x69AC2A, 0x7ED3B5, 0x859F33, 0x73063F, - 0x884AB9, 0xA6B487, 0x5DF801, 0xAB610D, 0x502D8B, 0x475214, 0xBC1E92, - 0x4A879E, 0xB1CB18, 0x167BE3, 0xED3765, 0x1BAE69, 0xE0E2EF, 0xF79D70, - 0x0CD1F6, 0xFA48FA, 0x01047C, 0x2FFA42, 0xD4B6C4, 0x222FC8, 0xD9634E, - 0xCE1CD1, 0x355057, 0xC3C95B, 0x3885DD, 0x000001, - }, - [AV_CRC_32_IEEE] = { - 0x00000000, 0xB71DC104, 0x6E3B8209, 0xD926430D, 0xDC760413, 0x6B6BC517, - 0xB24D861A, 0x0550471E, 0xB8ED0826, 0x0FF0C922, 0xD6D68A2F, 0x61CB4B2B, - 0x649B0C35, 0xD386CD31, 0x0AA08E3C, 0xBDBD4F38, 0x70DB114C, 0xC7C6D048, - 0x1EE09345, 0xA9FD5241, 0xACAD155F, 0x1BB0D45B, 0xC2969756, 0x758B5652, - 0xC836196A, 0x7F2BD86E, 0xA60D9B63, 0x11105A67, 0x14401D79, 0xA35DDC7D, - 0x7A7B9F70, 0xCD665E74, 0xE0B62398, 0x57ABE29C, 0x8E8DA191, 0x39906095, - 0x3CC0278B, 0x8BDDE68F, 0x52FBA582, 0xE5E66486, 0x585B2BBE, 0xEF46EABA, - 0x3660A9B7, 0x817D68B3, 0x842D2FAD, 0x3330EEA9, 0xEA16ADA4, 0x5D0B6CA0, - 0x906D32D4, 0x2770F3D0, 0xFE56B0DD, 0x494B71D9, 0x4C1B36C7, 0xFB06F7C3, - 0x2220B4CE, 0x953D75CA, 0x28803AF2, 0x9F9DFBF6, 0x46BBB8FB, 0xF1A679FF, - 0xF4F63EE1, 0x43EBFFE5, 0x9ACDBCE8, 0x2DD07DEC, 0x77708634, 0xC06D4730, - 0x194B043D, 0xAE56C539, 0xAB068227, 0x1C1B4323, 0xC53D002E, 0x7220C12A, - 0xCF9D8E12, 0x78804F16, 0xA1A60C1B, 0x16BBCD1F, 0x13EB8A01, 0xA4F64B05, - 0x7DD00808, 0xCACDC90C, 0x07AB9778, 0xB0B6567C, 0x69901571, 0xDE8DD475, - 0xDBDD936B, 0x6CC0526F, 0xB5E61162, 0x02FBD066, 0xBF469F5E, 0x085B5E5A, - 0xD17D1D57, 0x6660DC53, 0x63309B4D, 0xD42D5A49, 0x0D0B1944, 0xBA16D840, - 0x97C6A5AC, 0x20DB64A8, 0xF9FD27A5, 0x4EE0E6A1, 0x4BB0A1BF, 0xFCAD60BB, - 0x258B23B6, 0x9296E2B2, 0x2F2BAD8A, 0x98366C8E, 0x41102F83, 0xF60DEE87, - 0xF35DA999, 0x4440689D, 0x9D662B90, 0x2A7BEA94, 0xE71DB4E0, 0x500075E4, - 0x892636E9, 0x3E3BF7ED, 0x3B6BB0F3, 0x8C7671F7, 0x555032FA, 0xE24DF3FE, - 0x5FF0BCC6, 0xE8ED7DC2, 0x31CB3ECF, 0x86D6FFCB, 0x8386B8D5, 0x349B79D1, - 0xEDBD3ADC, 0x5AA0FBD8, 0xEEE00C69, 0x59FDCD6D, 0x80DB8E60, 0x37C64F64, - 0x3296087A, 0x858BC97E, 0x5CAD8A73, 0xEBB04B77, 0x560D044F, 0xE110C54B, - 0x38368646, 0x8F2B4742, 0x8A7B005C, 0x3D66C158, 0xE4408255, 0x535D4351, - 0x9E3B1D25, 0x2926DC21, 0xF0009F2C, 0x471D5E28, 0x424D1936, 0xF550D832, - 0x2C769B3F, 0x9B6B5A3B, 0x26D61503, 0x91CBD407, 0x48ED970A, 0xFFF0560E, - 0xFAA01110, 0x4DBDD014, 0x949B9319, 0x2386521D, 0x0E562FF1, 0xB94BEEF5, - 0x606DADF8, 0xD7706CFC, 0xD2202BE2, 0x653DEAE6, 0xBC1BA9EB, 0x0B0668EF, - 0xB6BB27D7, 0x01A6E6D3, 0xD880A5DE, 0x6F9D64DA, 0x6ACD23C4, 0xDDD0E2C0, - 0x04F6A1CD, 0xB3EB60C9, 0x7E8D3EBD, 0xC990FFB9, 0x10B6BCB4, 0xA7AB7DB0, - 0xA2FB3AAE, 0x15E6FBAA, 0xCCC0B8A7, 0x7BDD79A3, 0xC660369B, 0x717DF79F, - 0xA85BB492, 0x1F467596, 0x1A163288, 0xAD0BF38C, 0x742DB081, 0xC3307185, - 0x99908A5D, 0x2E8D4B59, 0xF7AB0854, 0x40B6C950, 0x45E68E4E, 0xF2FB4F4A, - 0x2BDD0C47, 0x9CC0CD43, 0x217D827B, 0x9660437F, 0x4F460072, 0xF85BC176, - 0xFD0B8668, 0x4A16476C, 0x93300461, 0x242DC565, 0xE94B9B11, 0x5E565A15, - 0x87701918, 0x306DD81C, 0x353D9F02, 0x82205E06, 0x5B061D0B, 0xEC1BDC0F, - 0x51A69337, 0xE6BB5233, 0x3F9D113E, 0x8880D03A, 0x8DD09724, 0x3ACD5620, - 0xE3EB152D, 0x54F6D429, 0x7926A9C5, 0xCE3B68C1, 0x171D2BCC, 0xA000EAC8, - 0xA550ADD6, 0x124D6CD2, 0xCB6B2FDF, 0x7C76EEDB, 0xC1CBA1E3, 0x76D660E7, - 0xAFF023EA, 0x18EDE2EE, 0x1DBDA5F0, 0xAAA064F4, 0x738627F9, 0xC49BE6FD, - 0x09FDB889, 0xBEE0798D, 0x67C63A80, 0xD0DBFB84, 0xD58BBC9A, 0x62967D9E, - 0xBBB03E93, 0x0CADFF97, 0xB110B0AF, 0x060D71AB, 0xDF2B32A6, 0x6836F3A2, - 0x6D66B4BC, 0xDA7B75B8, 0x035D36B5, 0xB440F7B1, 0x00000001 - }, - [AV_CRC_32_IEEE_LE] = { - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, - 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, 0x1DB71064, 0x6AB020F2, - 0xF3B97148, 0x84BE41DE, 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, 0x14015C4F, 0x63066CD9, - 0xFA0F3D63, 0x8D080DF5, 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, 0x35B5A8FA, 0x42B2986C, - 0xDBBBC9D6, 0xACBCF940, 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, 0x21B4F4B5, 0x56B3C423, - 0xCFBA9599, 0xB8BDA50F, 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, 0x76DC4190, 0x01DB7106, - 0x98D220BC, 0xEFD5102A, 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, 0x7F6A0DBB, 0x086D3D2D, - 0x91646C97, 0xE6635C01, 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, 0x65B0D9C6, 0x12B7E950, - 0x8BBEB8EA, 0xFCB9887C, 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, 0x4ADFA541, 0x3DD895D7, - 0xA4D1C46D, 0xD3D6F4FB, 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, 0x5005713C, 0x270241AA, - 0xBE0B1010, 0xC90C2086, 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, 0x59B33D17, 0x2EB40D81, - 0xB7BD5C3B, 0xC0BA6CAD, 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, 0xE3630B12, 0x94643B84, - 0x0D6D6A3E, 0x7A6A5AA8, 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, 0xF762575D, 0x806567CB, - 0x196C3671, 0x6E6B06E7, 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, 0xD6D6A3E8, 0xA1D1937E, - 0x38D8C2C4, 0x4FDFF252, 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, 0xDF60EFC3, 0xA867DF55, - 0x316E8EEF, 0x4669BE79, 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, 0xC5BA3BBE, 0xB2BD0B28, - 0x2BB45A92, 0x5CB36A04, 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, 0x9C0906A9, 0xEB0E363F, - 0x72076785, 0x05005713, 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, 0x86D3D2D4, 0xF1D4E242, - 0x68DDB3F8, 0x1FDA836E, 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, 0x8F659EFF, 0xF862AE69, - 0x616BFFD3, 0x166CCF45, 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, 0xAED16A4A, 0xD9D65ADC, - 0x40DF0B66, 0x37D83BF0, 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, 0xBAD03605, 0xCDD70693, - 0x54DE5729, 0x23D967BF, 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D, 0x00000001 - }, -}; -#else -#if CONFIG_SMALL -#define CRC_TABLE_SIZE 257 -#else -#define CRC_TABLE_SIZE 1024 -#endif -static struct { - uint8_t le; - uint8_t bits; - uint32_t poly; -} av_crc_table_params[AV_CRC_MAX] = { - [AV_CRC_8_ATM] = { 0, 8, 0x07 }, - [AV_CRC_16_ANSI] = { 0, 16, 0x8005 }, - [AV_CRC_16_CCITT] = { 0, 16, 0x1021 }, - [AV_CRC_24_IEEE] = { 0, 24, 0x864CFB }, - [AV_CRC_32_IEEE] = { 0, 32, 0x04C11DB7 }, - [AV_CRC_32_IEEE_LE] = { 1, 32, 0xEDB88320 }, -}; -static AVCRC av_crc_table[AV_CRC_MAX][CRC_TABLE_SIZE]; -#endif - -int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size) -{ - unsigned i, j; - uint32_t c; - - if (bits < 8 || bits > 32 || poly >= (1LL << bits)) - return -1; - if (ctx_size != sizeof(AVCRC) * 257 && ctx_size != sizeof(AVCRC) * 1024) - return -1; - - for (i = 0; i < 256; i++) { - if (le) { - for (c = i, j = 0; j < 8; j++) - c = (c >> 1) ^ (poly & (-(c & 1))); - ctx[i] = c; - } else { - for (c = i << 24, j = 0; j < 8; j++) - c = (c << 1) ^ ((poly << (32 - bits)) & (((int32_t) c) >> 31)); - ctx[i] = av_bswap32(c); - } - } - ctx[256] = 1; -#if !CONFIG_SMALL - if (ctx_size >= sizeof(AVCRC) * 1024) - for (i = 0; i < 256; i++) - for (j = 0; j < 3; j++) - ctx[256 *(j + 1) + i] = - (ctx[256 * j + i] >> 8) ^ ctx[ctx[256 * j + i] & 0xFF]; -#endif - - return 0; -} - -const AVCRC *av_crc_get_table(AVCRCId crc_id) -{ -#if !CONFIG_HARDCODED_TABLES - if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id]) - 1]) - if (av_crc_init(av_crc_table[crc_id], - av_crc_table_params[crc_id].le, - av_crc_table_params[crc_id].bits, - av_crc_table_params[crc_id].poly, - sizeof(av_crc_table[crc_id])) < 0) - return NULL; -#endif - return av_crc_table[crc_id]; -} - -uint32_t av_crc(const AVCRC *ctx, uint32_t crc, - const uint8_t *buffer, size_t length) -{ - const uint8_t *end = buffer + length; - -#if !CONFIG_SMALL - if (!ctx[256]) { - while (((intptr_t) buffer & 3) && buffer < end) - crc = ctx[((uint8_t) crc) ^ *buffer++] ^ (crc >> 8); - - while (buffer < end - 3) { - crc ^= av_le2ne32(*(const uint32_t *) buffer); buffer += 4; - crc = ctx[3 * 256 + ( crc & 0xFF)] ^ - ctx[2 * 256 + ((crc >> 8 ) & 0xFF)] ^ - ctx[1 * 256 + ((crc >> 16) & 0xFF)] ^ - ctx[0 * 256 + ((crc >> 24) )]; - } - } -#endif - while (buffer < end) - crc = ctx[((uint8_t) crc) ^ *buffer++] ^ (crc >> 8); - - return crc; -} - -#ifdef TEST -int main(void) -{ - uint8_t buf[1999]; - int i; - int p[5][3] = { { AV_CRC_32_IEEE_LE, 0xEDB88320, 0x3D5CDD04 }, - { AV_CRC_32_IEEE , 0x04C11DB7, 0xC0F5BAE0 }, - { AV_CRC_24_IEEE , 0x864CFB , 0xB704CE }, - { AV_CRC_16_ANSI , 0x8005 , 0x1FBB }, - { AV_CRC_8_ATM , 0x07 , 0xE3 } - }; - const AVCRC *ctx; - - for (i = 0; i < sizeof(buf); i++) - buf[i] = i + i * i; - - for (i = 0; i < 5; i++) { - ctx = av_crc_get_table(p[i][0]); - printf("crc %08X = %X\n", p[i][1], av_crc(ctx, 0, buf, sizeof(buf))); - } - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.c deleted file mode 100644 index 57ad0a4ff..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - * DES encryption/decryption - * Copyright (c) 2007 Reimar Doeffinger - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include -#include "avutil.h" -#include "common.h" -#include "intreadwrite.h" -#include "des.h" - -typedef struct AVDES AVDES; - -#define T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h -static const uint8_t IP_shuffle[] = { - T(58, 50, 42, 34, 26, 18, 10, 2), - T(60, 52, 44, 36, 28, 20, 12, 4), - T(62, 54, 46, 38, 30, 22, 14, 6), - T(64, 56, 48, 40, 32, 24, 16, 8), - T(57, 49, 41, 33, 25, 17, 9, 1), - T(59, 51, 43, 35, 27, 19, 11, 3), - T(61, 53, 45, 37, 29, 21, 13, 5), - T(63, 55, 47, 39, 31, 23, 15, 7) -}; -#undef T - -#if CONFIG_SMALL || defined(GENTABLES) -#define T(a, b, c, d) 32-a,32-b,32-c,32-d -static const uint8_t P_shuffle[] = { - T(16, 7, 20, 21), - T(29, 12, 28, 17), - T( 1, 15, 23, 26), - T( 5, 18, 31, 10), - T( 2, 8, 24, 14), - T(32, 27, 3, 9), - T(19, 13, 30, 6), - T(22, 11, 4, 25) -}; -#undef T -#endif - -#define T(a, b, c, d, e, f, g) 64-a,64-b,64-c,64-d,64-e,64-f,64-g -static const uint8_t PC1_shuffle[] = { - T(57, 49, 41, 33, 25, 17, 9), - T( 1, 58, 50, 42, 34, 26, 18), - T(10, 2, 59, 51, 43, 35, 27), - T(19, 11, 3, 60, 52, 44, 36), - T(63, 55, 47, 39, 31, 23, 15), - T( 7, 62, 54, 46, 38, 30, 22), - T(14, 6, 61, 53, 45, 37, 29), - T(21, 13, 5, 28, 20, 12, 4) -}; -#undef T - -#define T(a, b, c, d, e, f) 56-a,56-b,56-c,56-d,56-e,56-f -static const uint8_t PC2_shuffle[] = { - T(14, 17, 11, 24, 1, 5), - T( 3, 28, 15, 6, 21, 10), - T(23, 19, 12, 4, 26, 8), - T(16, 7, 27, 20, 13, 2), - T(41, 52, 31, 37, 47, 55), - T(30, 40, 51, 45, 33, 48), - T(44, 49, 39, 56, 34, 53), - T(46, 42, 50, 36, 29, 32) -}; -#undef T - -#if CONFIG_SMALL -static const uint8_t S_boxes[8][32] = { - { - 0x0e, 0xf4, 0x7d, 0x41, 0xe2, 0x2f, 0xdb, 0x18, 0xa3, 0x6a, 0xc6, 0xbc, 0x95, 0x59, 0x30, 0x87, - 0xf4, 0xc1, 0x8e, 0x28, 0x4d, 0x96, 0x12, 0x7b, 0x5f, 0xbc, 0x39, 0xe7, 0xa3, 0x0a, 0x65, 0xd0, - }, { - 0x3f, 0xd1, 0x48, 0x7e, 0xf6, 0x2b, 0x83, 0xe4, 0xc9, 0x07, 0x12, 0xad, 0x6c, 0x90, 0xb5, 0x5a, - 0xd0, 0x8e, 0xa7, 0x1b, 0x3a, 0xf4, 0x4d, 0x21, 0xb5, 0x68, 0x7c, 0xc6, 0x09, 0x53, 0xe2, 0x9f, - }, { - 0xda, 0x70, 0x09, 0x9e, 0x36, 0x43, 0x6f, 0xa5, 0x21, 0x8d, 0x5c, 0xe7, 0xcb, 0xb4, 0xf2, 0x18, - 0x1d, 0xa6, 0xd4, 0x09, 0x68, 0x9f, 0x83, 0x70, 0x4b, 0xf1, 0xe2, 0x3c, 0xb5, 0x5a, 0x2e, 0xc7, - }, { - 0xd7, 0x8d, 0xbe, 0x53, 0x60, 0xf6, 0x09, 0x3a, 0x41, 0x72, 0x28, 0xc5, 0x1b, 0xac, 0xe4, 0x9f, - 0x3a, 0xf6, 0x09, 0x60, 0xac, 0x1b, 0xd7, 0x8d, 0x9f, 0x41, 0x53, 0xbe, 0xc5, 0x72, 0x28, 0xe4, - }, { - 0xe2, 0xbc, 0x24, 0xc1, 0x47, 0x7a, 0xdb, 0x16, 0x58, 0x05, 0xf3, 0xaf, 0x3d, 0x90, 0x8e, 0x69, - 0xb4, 0x82, 0xc1, 0x7b, 0x1a, 0xed, 0x27, 0xd8, 0x6f, 0xf9, 0x0c, 0x95, 0xa6, 0x43, 0x50, 0x3e, - }, { - 0xac, 0xf1, 0x4a, 0x2f, 0x79, 0xc2, 0x96, 0x58, 0x60, 0x1d, 0xd3, 0xe4, 0x0e, 0xb7, 0x35, 0x8b, - 0x49, 0x3e, 0x2f, 0xc5, 0x92, 0x58, 0xfc, 0xa3, 0xb7, 0xe0, 0x14, 0x7a, 0x61, 0x0d, 0x8b, 0xd6, - }, { - 0xd4, 0x0b, 0xb2, 0x7e, 0x4f, 0x90, 0x18, 0xad, 0xe3, 0x3c, 0x59, 0xc7, 0x25, 0xfa, 0x86, 0x61, - 0x61, 0xb4, 0xdb, 0x8d, 0x1c, 0x43, 0xa7, 0x7e, 0x9a, 0x5f, 0x06, 0xf8, 0xe0, 0x25, 0x39, 0xc2, - }, { - 0x1d, 0xf2, 0xd8, 0x84, 0xa6, 0x3f, 0x7b, 0x41, 0xca, 0x59, 0x63, 0xbe, 0x05, 0xe0, 0x9c, 0x27, - 0x27, 0x1b, 0xe4, 0x71, 0x49, 0xac, 0x8e, 0xd2, 0xf0, 0xc6, 0x9a, 0x0d, 0x3f, 0x53, 0x65, 0xb8, - } -}; -#else -/** - * This table contains the results of applying both the S-box and P-shuffle. - * It can be regenerated by compiling this file with -DCONFIG_SMALL -DTEST -DGENTABLES - */ -static const uint32_t S_boxes_P_shuffle[8][64] = { - { - 0x00808200, 0x00000000, 0x00008000, 0x00808202, 0x00808002, 0x00008202, 0x00000002, 0x00008000, - 0x00000200, 0x00808200, 0x00808202, 0x00000200, 0x00800202, 0x00808002, 0x00800000, 0x00000002, - 0x00000202, 0x00800200, 0x00800200, 0x00008200, 0x00008200, 0x00808000, 0x00808000, 0x00800202, - 0x00008002, 0x00800002, 0x00800002, 0x00008002, 0x00000000, 0x00000202, 0x00008202, 0x00800000, - 0x00008000, 0x00808202, 0x00000002, 0x00808000, 0x00808200, 0x00800000, 0x00800000, 0x00000200, - 0x00808002, 0x00008000, 0x00008200, 0x00800002, 0x00000200, 0x00000002, 0x00800202, 0x00008202, - 0x00808202, 0x00008002, 0x00808000, 0x00800202, 0x00800002, 0x00000202, 0x00008202, 0x00808200, - 0x00000202, 0x00800200, 0x00800200, 0x00000000, 0x00008002, 0x00008200, 0x00000000, 0x00808002, - }, - { - 0x40084010, 0x40004000, 0x00004000, 0x00084010, 0x00080000, 0x00000010, 0x40080010, 0x40004010, - 0x40000010, 0x40084010, 0x40084000, 0x40000000, 0x40004000, 0x00080000, 0x00000010, 0x40080010, - 0x00084000, 0x00080010, 0x40004010, 0x00000000, 0x40000000, 0x00004000, 0x00084010, 0x40080000, - 0x00080010, 0x40000010, 0x00000000, 0x00084000, 0x00004010, 0x40084000, 0x40080000, 0x00004010, - 0x00000000, 0x00084010, 0x40080010, 0x00080000, 0x40004010, 0x40080000, 0x40084000, 0x00004000, - 0x40080000, 0x40004000, 0x00000010, 0x40084010, 0x00084010, 0x00000010, 0x00004000, 0x40000000, - 0x00004010, 0x40084000, 0x00080000, 0x40000010, 0x00080010, 0x40004010, 0x40000010, 0x00080010, - 0x00084000, 0x00000000, 0x40004000, 0x00004010, 0x40000000, 0x40080010, 0x40084010, 0x00084000, - }, - { - 0x00000104, 0x04010100, 0x00000000, 0x04010004, 0x04000100, 0x00000000, 0x00010104, 0x04000100, - 0x00010004, 0x04000004, 0x04000004, 0x00010000, 0x04010104, 0x00010004, 0x04010000, 0x00000104, - 0x04000000, 0x00000004, 0x04010100, 0x00000100, 0x00010100, 0x04010000, 0x04010004, 0x00010104, - 0x04000104, 0x00010100, 0x00010000, 0x04000104, 0x00000004, 0x04010104, 0x00000100, 0x04000000, - 0x04010100, 0x04000000, 0x00010004, 0x00000104, 0x00010000, 0x04010100, 0x04000100, 0x00000000, - 0x00000100, 0x00010004, 0x04010104, 0x04000100, 0x04000004, 0x00000100, 0x00000000, 0x04010004, - 0x04000104, 0x00010000, 0x04000000, 0x04010104, 0x00000004, 0x00010104, 0x00010100, 0x04000004, - 0x04010000, 0x04000104, 0x00000104, 0x04010000, 0x00010104, 0x00000004, 0x04010004, 0x00010100, - }, - { - 0x80401000, 0x80001040, 0x80001040, 0x00000040, 0x00401040, 0x80400040, 0x80400000, 0x80001000, - 0x00000000, 0x00401000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00400040, 0x80400000, - 0x80000000, 0x00001000, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x80001000, 0x00001040, - 0x80400040, 0x80000000, 0x00001040, 0x00400040, 0x00001000, 0x00401040, 0x80401040, 0x80000040, - 0x00400040, 0x80400000, 0x00401000, 0x80401040, 0x80000040, 0x00000000, 0x00000000, 0x00401000, - 0x00001040, 0x00400040, 0x80400040, 0x80000000, 0x80401000, 0x80001040, 0x80001040, 0x00000040, - 0x80401040, 0x80000040, 0x80000000, 0x00001000, 0x80400000, 0x80001000, 0x00401040, 0x80400040, - 0x80001000, 0x00001040, 0x00400000, 0x80401000, 0x00000040, 0x00400000, 0x00001000, 0x00401040, - }, - { - 0x00000080, 0x01040080, 0x01040000, 0x21000080, 0x00040000, 0x00000080, 0x20000000, 0x01040000, - 0x20040080, 0x00040000, 0x01000080, 0x20040080, 0x21000080, 0x21040000, 0x00040080, 0x20000000, - 0x01000000, 0x20040000, 0x20040000, 0x00000000, 0x20000080, 0x21040080, 0x21040080, 0x01000080, - 0x21040000, 0x20000080, 0x00000000, 0x21000000, 0x01040080, 0x01000000, 0x21000000, 0x00040080, - 0x00040000, 0x21000080, 0x00000080, 0x01000000, 0x20000000, 0x01040000, 0x21000080, 0x20040080, - 0x01000080, 0x20000000, 0x21040000, 0x01040080, 0x20040080, 0x00000080, 0x01000000, 0x21040000, - 0x21040080, 0x00040080, 0x21000000, 0x21040080, 0x01040000, 0x00000000, 0x20040000, 0x21000000, - 0x00040080, 0x01000080, 0x20000080, 0x00040000, 0x00000000, 0x20040000, 0x01040080, 0x20000080, - }, - { - 0x10000008, 0x10200000, 0x00002000, 0x10202008, 0x10200000, 0x00000008, 0x10202008, 0x00200000, - 0x10002000, 0x00202008, 0x00200000, 0x10000008, 0x00200008, 0x10002000, 0x10000000, 0x00002008, - 0x00000000, 0x00200008, 0x10002008, 0x00002000, 0x00202000, 0x10002008, 0x00000008, 0x10200008, - 0x10200008, 0x00000000, 0x00202008, 0x10202000, 0x00002008, 0x00202000, 0x10202000, 0x10000000, - 0x10002000, 0x00000008, 0x10200008, 0x00202000, 0x10202008, 0x00200000, 0x00002008, 0x10000008, - 0x00200000, 0x10002000, 0x10000000, 0x00002008, 0x10000008, 0x10202008, 0x00202000, 0x10200000, - 0x00202008, 0x10202000, 0x00000000, 0x10200008, 0x00000008, 0x00002000, 0x10200000, 0x00202008, - 0x00002000, 0x00200008, 0x10002008, 0x00000000, 0x10202000, 0x10000000, 0x00200008, 0x10002008, - }, - { - 0x00100000, 0x02100001, 0x02000401, 0x00000000, 0x00000400, 0x02000401, 0x00100401, 0x02100400, - 0x02100401, 0x00100000, 0x00000000, 0x02000001, 0x00000001, 0x02000000, 0x02100001, 0x00000401, - 0x02000400, 0x00100401, 0x00100001, 0x02000400, 0x02000001, 0x02100000, 0x02100400, 0x00100001, - 0x02100000, 0x00000400, 0x00000401, 0x02100401, 0x00100400, 0x00000001, 0x02000000, 0x00100400, - 0x02000000, 0x00100400, 0x00100000, 0x02000401, 0x02000401, 0x02100001, 0x02100001, 0x00000001, - 0x00100001, 0x02000000, 0x02000400, 0x00100000, 0x02100400, 0x00000401, 0x00100401, 0x02100400, - 0x00000401, 0x02000001, 0x02100401, 0x02100000, 0x00100400, 0x00000000, 0x00000001, 0x02100401, - 0x00000000, 0x00100401, 0x02100000, 0x00000400, 0x02000001, 0x02000400, 0x00000400, 0x00100001, - }, - { - 0x08000820, 0x00000800, 0x00020000, 0x08020820, 0x08000000, 0x08000820, 0x00000020, 0x08000000, - 0x00020020, 0x08020000, 0x08020820, 0x00020800, 0x08020800, 0x00020820, 0x00000800, 0x00000020, - 0x08020000, 0x08000020, 0x08000800, 0x00000820, 0x00020800, 0x00020020, 0x08020020, 0x08020800, - 0x00000820, 0x00000000, 0x00000000, 0x08020020, 0x08000020, 0x08000800, 0x00020820, 0x00020000, - 0x00020820, 0x00020000, 0x08020800, 0x00000800, 0x00000020, 0x08020020, 0x00000800, 0x00020820, - 0x08000800, 0x00000020, 0x08000020, 0x08020000, 0x08020020, 0x08000000, 0x00020000, 0x08000820, - 0x00000000, 0x08020820, 0x00020020, 0x08000020, 0x08020000, 0x08000800, 0x08000820, 0x00000000, - 0x08020820, 0x00020800, 0x00020800, 0x00000820, 0x00000820, 0x00020020, 0x08000000, 0x08020800, - }, -}; -#endif - -static uint64_t shuffle(uint64_t in, const uint8_t *shuffle, int shuffle_len) { - int i; - uint64_t res = 0; - for (i = 0; i < shuffle_len; i++) - res += res + ((in >> *shuffle++) & 1); - return res; -} - -static uint64_t shuffle_inv(uint64_t in, const uint8_t *shuffle, int shuffle_len) { - int i; - uint64_t res = 0; - shuffle += shuffle_len - 1; - for (i = 0; i < shuffle_len; i++) { - res |= (in & 1) << *shuffle--; - in >>= 1; - } - return res; -} - -static uint32_t f_func(uint32_t r, uint64_t k) { - int i; - uint32_t out = 0; - // rotate to get first part of E-shuffle in the lowest 6 bits - r = (r << 1) | (r >> 31); - // apply S-boxes, those compress the data again from 8 * 6 to 8 * 4 bits - for (i = 7; i >= 0; i--) { - uint8_t tmp = (r ^ k) & 0x3f; -#if CONFIG_SMALL - uint8_t v = S_boxes[i][tmp >> 1]; - if (tmp & 1) v >>= 4; - out = (out >> 4) | (v << 28); -#else - out |= S_boxes_P_shuffle[i][tmp]; -#endif - // get next 6 bits of E-shuffle and round key k into the lowest bits - r = (r >> 4) | (r << 28); - k >>= 6; - } -#if CONFIG_SMALL - out = shuffle(out, P_shuffle, sizeof(P_shuffle)); -#endif - return out; -} - -/** - * @brief rotate the two halves of the expanded 56 bit key each 1 bit left - * - * Note: the specification calls this "shift", so I kept it although - * it is confusing. - */ -static uint64_t key_shift_left(uint64_t CDn) { - uint64_t carries = (CDn >> 27) & 0x10000001; - CDn <<= 1; - CDn &= ~0x10000001; - CDn |= carries; - return CDn; -} - -static void gen_roundkeys(uint64_t K[16], uint64_t key) { - int i; - // discard parity bits from key and shuffle it into C and D parts - uint64_t CDn = shuffle(key, PC1_shuffle, sizeof(PC1_shuffle)); - // generate round keys - for (i = 0; i < 16; i++) { - CDn = key_shift_left(CDn); - if (i > 1 && i != 8 && i != 15) - CDn = key_shift_left(CDn); - K[i] = shuffle(CDn, PC2_shuffle, sizeof(PC2_shuffle)); - } -} - -static uint64_t des_encdec(uint64_t in, uint64_t K[16], int decrypt) { - int i; - // used to apply round keys in reverse order for decryption - decrypt = decrypt ? 15 : 0; - // shuffle irrelevant to security but to ease hardware implementations - in = shuffle(in, IP_shuffle, sizeof(IP_shuffle)); - for (i = 0; i < 16; i++) { - uint32_t f_res; - f_res = f_func(in, K[decrypt ^ i]); - in = (in << 32) | (in >> 32); - in ^= f_res; - } - in = (in << 32) | (in >> 32); - // reverse shuffle used to ease hardware implementations - in = shuffle_inv(in, IP_shuffle, sizeof(IP_shuffle)); - return in; -} - -int av_des_init(AVDES *d, const uint8_t *key, int key_bits, av_unused int decrypt) { - if (key_bits != 64 && key_bits != 192) - return -1; - d->triple_des = key_bits > 64; - gen_roundkeys(d->round_keys[0], AV_RB64(key)); - if (d->triple_des) { - gen_roundkeys(d->round_keys[1], AV_RB64(key + 8)); - gen_roundkeys(d->round_keys[2], AV_RB64(key + 16)); - } - return 0; -} - -static void av_des_crypt_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt, int mac) { - uint64_t iv_val = iv ? AV_RB64(iv) : 0; - while (count-- > 0) { - uint64_t dst_val; - uint64_t src_val = src ? AV_RB64(src) : 0; - if (decrypt) { - uint64_t tmp = src_val; - if (d->triple_des) { - src_val = des_encdec(src_val, d->round_keys[2], 1); - src_val = des_encdec(src_val, d->round_keys[1], 0); - } - dst_val = des_encdec(src_val, d->round_keys[0], 1) ^ iv_val; - iv_val = iv ? tmp : 0; - } else { - dst_val = des_encdec(src_val ^ iv_val, d->round_keys[0], 0); - if (d->triple_des) { - dst_val = des_encdec(dst_val, d->round_keys[1], 1); - dst_val = des_encdec(dst_val, d->round_keys[2], 0); - } - iv_val = iv ? dst_val : 0; - } - AV_WB64(dst, dst_val); - src += 8; - if (!mac) - dst += 8; - } - if (iv) - AV_WB64(iv, iv_val); -} - -void av_des_crypt(AVDES *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) { - av_des_crypt_mac(d, dst, src, count, iv, decrypt, 0); -} - -void av_des_mac(AVDES *d, uint8_t *dst, const uint8_t *src, int count) { - av_des_crypt_mac(d, dst, src, count, (uint8_t[8]){0}, 0, 1); -} - -#ifdef TEST -#include -#include - -#include "time.h" - -static uint64_t rand64(void) { - uint64_t r = rand(); - r = (r << 32) | rand(); - return r; -} - -static const uint8_t test_key[] = {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0}; -static const DECLARE_ALIGNED(8, uint8_t, plain)[] = {0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10}; -static const DECLARE_ALIGNED(8, uint8_t, crypt)[] = {0x4a, 0xb6, 0x5b, 0x3d, 0x4b, 0x06, 0x15, 0x18}; -static DECLARE_ALIGNED(8, uint8_t, tmp)[8]; -static DECLARE_ALIGNED(8, uint8_t, large_buffer)[10002][8]; -static const uint8_t cbc_key[] = { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, - 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0x01, 0x23 -}; - -static int run_test(int cbc, int decrypt) { - AVDES d; - int delay = cbc && !decrypt ? 2 : 1; - uint64_t res; - AV_WB64(large_buffer[0], 0x4e6f772069732074ULL); - AV_WB64(large_buffer[1], 0x1234567890abcdefULL); - AV_WB64(tmp, 0x1234567890abcdefULL); - av_des_init(&d, cbc_key, 192, decrypt); - av_des_crypt(&d, large_buffer[delay], large_buffer[0], 10000, cbc ? tmp : NULL, decrypt); - res = AV_RB64(large_buffer[9999 + delay]); - if (cbc) { - if (decrypt) - return res == 0xc5cecf63ecec514cULL; - else - return res == 0xcb191f85d1ed8439ULL; - } else { - if (decrypt) - return res == 0x8325397644091a0aULL; - else - return res == 0xdd17e8b8b437d232ULL; - } -} - -int main(void) { - AVDES d; - int i; -#ifdef GENTABLES - int j; -#endif - uint64_t key[3]; - uint64_t data; - uint64_t ct; - uint64_t roundkeys[16]; - srand(av_gettime()); - key[0] = AV_RB64(test_key); - data = AV_RB64(plain); - gen_roundkeys(roundkeys, key[0]); - if (des_encdec(data, roundkeys, 0) != AV_RB64(crypt)) { - printf("Test 1 failed\n"); - return 1; - } - av_des_init(&d, test_key, 64, 0); - av_des_crypt(&d, tmp, plain, 1, NULL, 0); - if (memcmp(tmp, crypt, sizeof(crypt))) { - printf("Public API decryption failed\n"); - return 1; - } - if (!run_test(0, 0) || !run_test(0, 1) || !run_test(1, 0) || !run_test(1, 1)) { - printf("Partial Monte-Carlo test failed\n"); - return 1; - } - for (i = 0; i < 1000; i++) { - key[0] = rand64(); key[1] = rand64(); key[2] = rand64(); - data = rand64(); - av_des_init(&d, (uint8_t*)key, 192, 0); - av_des_crypt(&d, (uint8_t*)&ct, (uint8_t*)&data, 1, NULL, 0); - av_des_init(&d, (uint8_t*)key, 192, 1); - av_des_crypt(&d, (uint8_t*)&ct, (uint8_t*)&ct, 1, NULL, 1); - if (ct != data) { - printf("Test 2 failed\n"); - return 1; - } - } -#ifdef GENTABLES - printf("static const uint32_t S_boxes_P_shuffle[8][64] = {\n"); - for (i = 0; i < 8; i++) { - printf(" {"); - for (j = 0; j < 64; j++) { - uint32_t v = S_boxes[i][j >> 1]; - v = j & 1 ? v >> 4 : v & 0xf; - v <<= 28 - 4 * i; - v = shuffle(v, P_shuffle, sizeof(P_shuffle)); - printf((j & 7) == 0 ? "\n " : " "); - printf("0x%08X,", v); - } - printf("\n },\n"); - } - printf("};\n"); -#endif - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.c deleted file mode 100644 index 3a0e84cd4..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.c +++ /dev/null @@ -1,182 +0,0 @@ -/* - * copyright (c) 2009 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "avstring.h" -#include "dict.h" -#include "internal.h" -#include "mem.h" - -struct AVDictionary { - int count; - AVDictionaryEntry *elems; -}; - -int av_dict_count(const AVDictionary *m) -{ - return m ? m->count : 0; -} - -AVDictionaryEntry * -av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags) -{ - unsigned int i, j; - - if(!m) - return NULL; - - if(prev) i= prev - m->elems + 1; - else i= 0; - - for(; icount; i++){ - const char *s= m->elems[i].key; - if(flags & AV_DICT_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++); - else for(j=0; av_toupper(s[j]) == av_toupper(key[j]) && key[j]; j++); - if(key[j]) - continue; - if(s[j] && !(flags & AV_DICT_IGNORE_SUFFIX)) - continue; - return &m->elems[i]; - } - return NULL; -} - -int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags) -{ - AVDictionary *m = *pm; - AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); - char *oldval = NULL; - - if(!m) - m = *pm = av_mallocz(sizeof(*m)); - - if(tag) { - if (flags & AV_DICT_DONT_OVERWRITE) - return 0; - if (flags & AV_DICT_APPEND) - oldval = tag->value; - else - av_free(tag->value); - av_free(tag->key); - *tag = m->elems[--m->count]; - } else { - AVDictionaryEntry *tmp = av_realloc(m->elems, (m->count+1) * sizeof(*m->elems)); - if(tmp) { - m->elems = tmp; - } else - return AVERROR(ENOMEM); - } - if (value) { - if (flags & AV_DICT_DONT_STRDUP_KEY) { - m->elems[m->count].key = (char*)(intptr_t)key; - } else - m->elems[m->count].key = av_strdup(key); - if (flags & AV_DICT_DONT_STRDUP_VAL) { - m->elems[m->count].value = (char*)(intptr_t)value; - } else if (oldval && flags & AV_DICT_APPEND) { - int len = strlen(oldval) + strlen(value) + 1; - char *newval = av_mallocz(len); - if (!newval) - return AVERROR(ENOMEM); - av_strlcat(newval, oldval, len); - av_freep(&oldval); - av_strlcat(newval, value, len); - m->elems[m->count].value = newval; - } else - m->elems[m->count].value = av_strdup(value); - m->count++; - } - if (!m->count) { - av_free(m->elems); - av_freep(pm); - } - - return 0; -} - -static int parse_key_value_pair(AVDictionary **pm, const char **buf, - const char *key_val_sep, const char *pairs_sep, - int flags) -{ - char *key = av_get_token(buf, key_val_sep); - char *val = NULL; - int ret; - - if (key && *key && strspn(*buf, key_val_sep)) { - (*buf)++; - val = av_get_token(buf, pairs_sep); - } - - if (key && *key && val && *val) - ret = av_dict_set(pm, key, val, flags); - else - ret = AVERROR(EINVAL); - - av_freep(&key); - av_freep(&val); - - return ret; -} - -int av_dict_parse_string(AVDictionary **pm, const char *str, - const char *key_val_sep, const char *pairs_sep, - int flags) -{ - int ret; - - if (!str) - return 0; - - /* ignore STRDUP flags */ - flags &= ~(AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); - - while (*str) { - if ((ret = parse_key_value_pair(pm, &str, key_val_sep, pairs_sep, flags)) < 0) - return ret; - - if (*str) - str++; - } - - return 0; -} - -void av_dict_free(AVDictionary **pm) -{ - AVDictionary *m = *pm; - - if (m) { - while(m->count--) { - av_free(m->elems[m->count].key); - av_free(m->elems[m->count].value); - } - av_free(m->elems); - } - av_freep(pm); -} - -void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags) -{ - AVDictionaryEntry *t = NULL; - - while ((t = av_dict_get(src, "", t, AV_DICT_IGNORE_SUFFIX))) - av_dict_set(dst, t->key, t->value, flags); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.c deleted file mode 100644 index c634c6a79..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2014 Tim Walker - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "downmix_info.h" -#include "frame.h" - -AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame) -{ - AVFrameSideData *side_data; - - side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_DOWNMIX_INFO); - - if (!side_data) - side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_DOWNMIX_INFO, - sizeof(AVDownmixInfo)); - - if (!side_data) - return NULL; - - return (AVDownmixInfo*)side_data->data; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.c deleted file mode 100644 index bd66354df..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#undef _GNU_SOURCE -#include "avutil.h" -#include "avstring.h" -#include "common.h" - -struct error_entry { - int num; - const char *tag; - const char *str; -}; - -#define ERROR_TAG(tag) AVERROR_##tag, #tag -static const struct error_entry error_entries[] = { - { ERROR_TAG(BSF_NOT_FOUND), "Bitstream filter not found" }, - { ERROR_TAG(BUG), "Internal bug, should not have happened" }, - { ERROR_TAG(BUG2), "Internal bug, should not have happened" }, - { ERROR_TAG(BUFFER_TOO_SMALL), "Buffer too small" }, - { ERROR_TAG(DECODER_NOT_FOUND), "Decoder not found" }, - { ERROR_TAG(DEMUXER_NOT_FOUND), "Demuxer not found" }, - { ERROR_TAG(ENCODER_NOT_FOUND), "Encoder not found" }, - { ERROR_TAG(EOF), "End of file" }, - { ERROR_TAG(EXIT), "Immediate exit requested" }, - { ERROR_TAG(EXTERNAL), "Generic error in an external library" }, - { ERROR_TAG(FILTER_NOT_FOUND), "Filter not found" }, - { ERROR_TAG(INVALIDDATA), "Invalid data found when processing input" }, - { ERROR_TAG(MUXER_NOT_FOUND), "Muxer not found" }, - { ERROR_TAG(OPTION_NOT_FOUND), "Option not found" }, - { ERROR_TAG(PATCHWELCOME), "Not yet implemented in FFmpeg, patches welcome" }, - { ERROR_TAG(PROTOCOL_NOT_FOUND), "Protocol not found" }, - { ERROR_TAG(STREAM_NOT_FOUND), "Stream not found" }, - { ERROR_TAG(UNKNOWN), "Unknown error occurred" }, - { ERROR_TAG(EXPERIMENTAL), "Experimental feature" }, -}; - -int av_strerror(int errnum, char *errbuf, size_t errbuf_size) -{ - int ret = 0, i; - const struct error_entry *entry = NULL; - - for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) { - if (errnum == error_entries[i].num) { - entry = &error_entries[i]; - break; - } - } - if (entry) { - av_strlcpy(errbuf, entry->str, errbuf_size); - } else { -#if HAVE_STRERROR_R - ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size)); -#else - ret = -1; -#endif - if (ret < 0) - snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum); - } - - return ret; -} - -#ifdef TEST - -#undef printf - -int main(void) -{ - int i; - - for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) { - const struct error_entry *entry = &error_entries[i]; - printf("%d: %s [%s]\n", entry->num, av_err2str(entry->num), entry->tag); - } - - for (i = 0; i < 256; i++) { - printf("%d: %s\n", -i, av_err2str(-i)); - } - - return 0; -} - -#endif /* TEST */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.c deleted file mode 100644 index 4a313bfad..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.c +++ /dev/null @@ -1,869 +0,0 @@ -/* - * Copyright (c) 2002-2006 Michael Niedermayer - * Copyright (c) 2006 Oded Shimon - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * simple arithmetic expression evaluator. - * - * see http://joe.hotchkiss.com/programming/eval/eval.html - */ - -#include -#include "attributes.h" -#include "avutil.h" -#include "common.h" -#include "eval.h" -#include "log.h" -#include "mathematics.h" -#include "time.h" -#include "avstring.h" -#include "timer.h" - -typedef struct Parser { - const AVClass *class; - int stack_index; - char *s; - const double *const_values; - const char * const *const_names; // NULL terminated - double (* const *funcs1)(void *, double a); // NULL terminated - const char * const *func1_names; // NULL terminated - double (* const *funcs2)(void *, double a, double b); // NULL terminated - const char * const *func2_names; // NULL terminated - void *opaque; - int log_offset; - void *log_ctx; -#define VARS 10 - double *var; -} Parser; - -static const AVClass eval_class = { "Eval", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(Parser,log_offset), offsetof(Parser,log_ctx) }; - -static const int8_t si_prefixes['z' - 'E' + 1] = { - ['y'-'E']= -24, - ['z'-'E']= -21, - ['a'-'E']= -18, - ['f'-'E']= -15, - ['p'-'E']= -12, - ['n'-'E']= - 9, - ['u'-'E']= - 6, - ['m'-'E']= - 3, - ['c'-'E']= - 2, - ['d'-'E']= - 1, - ['h'-'E']= 2, - ['k'-'E']= 3, - ['K'-'E']= 3, - ['M'-'E']= 6, - ['G'-'E']= 9, - ['T'-'E']= 12, - ['P'-'E']= 15, - ['E'-'E']= 18, - ['Z'-'E']= 21, - ['Y'-'E']= 24, -}; - -static const struct { - const char *name; - double value; -} constants[] = { - { "E", M_E }, - { "PI", M_PI }, - { "PHI", M_PHI }, -}; - -double av_strtod(const char *numstr, char **tail) -{ - double d; - char *next; - if(numstr[0]=='0' && (numstr[1]|0x20)=='x') { - d = strtoul(numstr, &next, 16); - } else - d = strtod(numstr, &next); - /* if parsing succeeded, check for and interpret postfixes */ - if (next!=numstr) { - if (next[0] == 'd' && next[1] == 'B') { - /* treat dB as decibels instead of decibytes */ - d = pow(10, d / 20); - next += 2; - } else if (*next >= 'E' && *next <= 'z') { - int e= si_prefixes[*next - 'E']; - if (e) { - if (next[1] == 'i') { - d*= pow( 2, e/0.3); - next+=2; - } else { - d*= pow(10, e); - next++; - } - } - } - - if (*next=='B') { - d*=8; - next++; - } - } - /* if requested, fill in tail with the position after the last parsed - character */ - if (tail) - *tail = next; - return d; -} - -#define IS_IDENTIFIER_CHAR(c) ((c) - '0' <= 9U || (c) - 'a' <= 25U || (c) - 'A' <= 25U || (c) == '_') - -static int strmatch(const char *s, const char *prefix) -{ - int i; - for (i=0; prefix[i]; i++) { - if (prefix[i] != s[i]) return 0; - } - /* return 1 only if the s identifier is terminated */ - return !IS_IDENTIFIER_CHAR(s[i]); -} - -struct AVExpr { - enum { - e_value, e_const, e_func0, e_func1, e_func2, - e_squish, e_gauss, e_ld, e_isnan, e_isinf, - e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_lte, e_lt, - e_pow, e_mul, e_div, e_add, - e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc, - e_sqrt, e_not, e_random, e_hypot, e_gcd, - e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between, - } type; - double value; // is sign in other types - union { - int const_index; - double (*func0)(double); - double (*func1)(void *, double); - double (*func2)(void *, double, double); - } a; - struct AVExpr *param[3]; - double *var; -}; - -static double etime(double v) -{ - return av_gettime() * 0.000001; -} - -static double eval_expr(Parser *p, AVExpr *e) -{ - switch (e->type) { - case e_value: return e->value; - case e_const: return e->value * p->const_values[e->a.const_index]; - case e_func0: return e->value * e->a.func0(eval_expr(p, e->param[0])); - case e_func1: return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0])); - case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); - case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); - case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } - case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)]; - case e_isnan: return e->value * !!isnan(eval_expr(p, e->param[0])); - case e_isinf: return e->value * !!isinf(eval_expr(p, e->param[0])); - case e_floor: return e->value * floor(eval_expr(p, e->param[0])); - case e_ceil : return e->value * ceil (eval_expr(p, e->param[0])); - case e_trunc: return e->value * trunc(eval_expr(p, e->param[0])); - case e_sqrt: return e->value * sqrt (eval_expr(p, e->param[0])); - case e_not: return e->value * (eval_expr(p, e->param[0]) == 0); - case e_if: return e->value * (eval_expr(p, e->param[0]) ? eval_expr(p, e->param[1]) : - e->param[2] ? eval_expr(p, e->param[2]) : 0); - case e_ifnot: return e->value * (!eval_expr(p, e->param[0]) ? eval_expr(p, e->param[1]) : - e->param[2] ? eval_expr(p, e->param[2]) : 0); - case e_between: { - double d = eval_expr(p, e->param[0]); - return e->value * (d >= eval_expr(p, e->param[1]) && - d <= eval_expr(p, e->param[2])); - } - case e_print: { - double x = eval_expr(p, e->param[0]); - int level = e->param[1] ? av_clip(eval_expr(p, e->param[1]), INT_MIN, INT_MAX) : AV_LOG_INFO; - av_log(p, level, "%f\n", x); - return x; - } - case e_random:{ - int idx= av_clip(eval_expr(p, e->param[0]), 0, VARS-1); - uint64_t r= isnan(p->var[idx]) ? 0 : p->var[idx]; - r= r*1664525+1013904223; - p->var[idx]= r; - return e->value * (r * (1.0/UINT64_MAX)); - } - case e_while: { - double d = NAN; - while (eval_expr(p, e->param[0])) - d=eval_expr(p, e->param[1]); - return d; - } - case e_taylor: { - double t = 1, d = 0, v; - double x = eval_expr(p, e->param[1]); - int id = e->param[2] ? av_clip(eval_expr(p, e->param[2]), 0, VARS-1) : 0; - int i; - double var0 = p->var[id]; - for(i=0; i<1000; i++) { - double ld = d; - p->var[id] = i; - v = eval_expr(p, e->param[0]); - d += t*v; - if(ld==d && v) - break; - t *= x / (i+1); - } - p->var[id] = var0; - return d; - } - case e_root: { - int i, j; - double low = -1, high = -1, v, low_v = -DBL_MAX, high_v = DBL_MAX; - double var0 = p->var[0]; - double x_max = eval_expr(p, e->param[1]); - for(i=-1; i<1024; i++) { - if(i<255) { - p->var[0] = av_reverse[i&255]*x_max/255; - } else { - p->var[0] = x_max*pow(0.9, i-255); - if (i&1) p->var[0] *= -1; - if (i&2) p->var[0] += low; - else p->var[0] += high; - } - v = eval_expr(p, e->param[0]); - if (v<=0 && v>low_v) { - low = p->var[0]; - low_v = v; - } - if (v>=0 && vvar[0]; - high_v = v; - } - if (low>=0 && high>=0){ - for (j=0; j<1000; j++) { - p->var[0] = (low+high)*0.5; - if (low == p->var[0] || high == p->var[0]) - break; - v = eval_expr(p, e->param[0]); - if (v<=0) low = p->var[0]; - if (v>=0) high= p->var[0]; - if (isnan(v)) { - low = high = v; - break; - } - } - break; - } - } - p->var[0] = var0; - return -low_vparam[0]); - double d2 = eval_expr(p, e->param[1]); - switch (e->type) { - case e_mod: return e->value * (d - floor((!CONFIG_FTRAPV || d2) ? d / d2 : d * INFINITY) * d2); - case e_gcd: return e->value * av_gcd(d,d2); - case e_max: return e->value * (d > d2 ? d : d2); - case e_min: return e->value * (d < d2 ? d : d2); - case e_eq: return e->value * (d == d2 ? 1.0 : 0.0); - case e_gt: return e->value * (d > d2 ? 1.0 : 0.0); - case e_gte: return e->value * (d >= d2 ? 1.0 : 0.0); - case e_lt: return e->value * (d < d2 ? 1.0 : 0.0); - case e_lte: return e->value * (d <= d2 ? 1.0 : 0.0); - case e_pow: return e->value * pow(d, d2); - case e_mul: return e->value * (d * d2); - case e_div: return e->value * ((!CONFIG_FTRAPV || d2 ) ? (d / d2) : d * INFINITY); - case e_add: return e->value * (d + d2); - case e_last:return e->value * d2; - case e_st : return e->value * (p->var[av_clip(d, 0, VARS-1)]= d2); - case e_hypot:return e->value * (sqrt(d*d + d2*d2)); - case e_bitand: return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d & (long int)d2); - case e_bitor: return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d | (long int)d2); - } - } - } - return NAN; -} - -static int parse_expr(AVExpr **e, Parser *p); - -void av_expr_free(AVExpr *e) -{ - if (!e) return; - av_expr_free(e->param[0]); - av_expr_free(e->param[1]); - av_expr_free(e->param[2]); - av_freep(&e->var); - av_freep(&e); -} - -static int parse_primary(AVExpr **e, Parser *p) -{ - AVExpr *d = av_mallocz(sizeof(AVExpr)); - char *next = p->s, *s0 = p->s; - int ret, i; - - if (!d) - return AVERROR(ENOMEM); - - /* number */ - d->value = av_strtod(p->s, &next); - if (next != p->s) { - d->type = e_value; - p->s= next; - *e = d; - return 0; - } - d->value = 1; - - /* named constants */ - for (i=0; p->const_names && p->const_names[i]; i++) { - if (strmatch(p->s, p->const_names[i])) { - p->s+= strlen(p->const_names[i]); - d->type = e_const; - d->a.const_index = i; - *e = d; - return 0; - } - } - for (i = 0; i < FF_ARRAY_ELEMS(constants); i++) { - if (strmatch(p->s, constants[i].name)) { - p->s += strlen(constants[i].name); - d->type = e_value; - d->value = constants[i].value; - *e = d; - return 0; - } - } - - p->s= strchr(p->s, '('); - if (p->s==NULL) { - av_log(p, AV_LOG_ERROR, "Undefined constant or missing '(' in '%s'\n", s0); - p->s= next; - av_expr_free(d); - return AVERROR(EINVAL); - } - p->s++; // "(" - if (*next == '(') { // special case do-nothing - av_freep(&d); - if ((ret = parse_expr(&d, p)) < 0) - return ret; - if (p->s[0] != ')') { - av_log(p, AV_LOG_ERROR, "Missing ')' in '%s'\n", s0); - av_expr_free(d); - return AVERROR(EINVAL); - } - p->s++; // ")" - *e = d; - return 0; - } - if ((ret = parse_expr(&(d->param[0]), p)) < 0) { - av_expr_free(d); - return ret; - } - if (p->s[0]== ',') { - p->s++; // "," - parse_expr(&d->param[1], p); - } - if (p->s[0]== ',') { - p->s++; // "," - parse_expr(&d->param[2], p); - } - if (p->s[0] != ')') { - av_log(p, AV_LOG_ERROR, "Missing ')' or too many args in '%s'\n", s0); - av_expr_free(d); - return AVERROR(EINVAL); - } - p->s++; // ")" - - d->type = e_func0; - if (strmatch(next, "sinh" )) d->a.func0 = sinh; - else if (strmatch(next, "cosh" )) d->a.func0 = cosh; - else if (strmatch(next, "tanh" )) d->a.func0 = tanh; - else if (strmatch(next, "sin" )) d->a.func0 = sin; - else if (strmatch(next, "cos" )) d->a.func0 = cos; - else if (strmatch(next, "tan" )) d->a.func0 = tan; - else if (strmatch(next, "atan" )) d->a.func0 = atan; - else if (strmatch(next, "asin" )) d->a.func0 = asin; - else if (strmatch(next, "acos" )) d->a.func0 = acos; - else if (strmatch(next, "exp" )) d->a.func0 = exp; - else if (strmatch(next, "log" )) d->a.func0 = log; - else if (strmatch(next, "abs" )) d->a.func0 = fabs; - else if (strmatch(next, "time" )) d->a.func0 = etime; - else if (strmatch(next, "squish")) d->type = e_squish; - else if (strmatch(next, "gauss" )) d->type = e_gauss; - else if (strmatch(next, "mod" )) d->type = e_mod; - else if (strmatch(next, "max" )) d->type = e_max; - else if (strmatch(next, "min" )) d->type = e_min; - else if (strmatch(next, "eq" )) d->type = e_eq; - else if (strmatch(next, "gte" )) d->type = e_gte; - else if (strmatch(next, "gt" )) d->type = e_gt; - else if (strmatch(next, "lte" )) d->type = e_lte; - else if (strmatch(next, "lt" )) d->type = e_lt; - else if (strmatch(next, "ld" )) d->type = e_ld; - else if (strmatch(next, "isnan" )) d->type = e_isnan; - else if (strmatch(next, "isinf" )) d->type = e_isinf; - else if (strmatch(next, "st" )) d->type = e_st; - else if (strmatch(next, "while" )) d->type = e_while; - else if (strmatch(next, "taylor")) d->type = e_taylor; - else if (strmatch(next, "root" )) d->type = e_root; - else if (strmatch(next, "floor" )) d->type = e_floor; - else if (strmatch(next, "ceil" )) d->type = e_ceil; - else if (strmatch(next, "trunc" )) d->type = e_trunc; - else if (strmatch(next, "sqrt" )) d->type = e_sqrt; - else if (strmatch(next, "not" )) d->type = e_not; - else if (strmatch(next, "pow" )) d->type = e_pow; - else if (strmatch(next, "print" )) d->type = e_print; - else if (strmatch(next, "random")) d->type = e_random; - else if (strmatch(next, "hypot" )) d->type = e_hypot; - else if (strmatch(next, "gcd" )) d->type = e_gcd; - else if (strmatch(next, "if" )) d->type = e_if; - else if (strmatch(next, "ifnot" )) d->type = e_ifnot; - else if (strmatch(next, "bitand")) d->type = e_bitand; - else if (strmatch(next, "bitor" )) d->type = e_bitor; - else if (strmatch(next, "between"))d->type = e_between; - else { - for (i=0; p->func1_names && p->func1_names[i]; i++) { - if (strmatch(next, p->func1_names[i])) { - d->a.func1 = p->funcs1[i]; - d->type = e_func1; - *e = d; - return 0; - } - } - - for (i=0; p->func2_names && p->func2_names[i]; i++) { - if (strmatch(next, p->func2_names[i])) { - d->a.func2 = p->funcs2[i]; - d->type = e_func2; - *e = d; - return 0; - } - } - - av_log(p, AV_LOG_ERROR, "Unknown function in '%s'\n", s0); - av_expr_free(d); - return AVERROR(EINVAL); - } - - *e = d; - return 0; -} - -static AVExpr *make_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1) -{ - AVExpr *e = av_mallocz(sizeof(AVExpr)); - if (!e) - return NULL; - e->type =type ; - e->value =value ; - e->param[0] =p0 ; - e->param[1] =p1 ; - return e; -} - -static int parse_pow(AVExpr **e, Parser *p, int *sign) -{ - *sign= (*p->s == '+') - (*p->s == '-'); - p->s += *sign&1; - return parse_primary(e, p); -} - -static int parse_dB(AVExpr **e, Parser *p, int *sign) -{ - /* do not filter out the negative sign when parsing a dB value. - for example, -3dB is not the same as -(3dB) */ - if (*p->s == '-') { - char *next; - double av_unused ignored = strtod(p->s, &next); - if (next != p->s && next[0] == 'd' && next[1] == 'B') { - *sign = 0; - return parse_primary(e, p); - } - } - return parse_pow(e, p, sign); -} - -static int parse_factor(AVExpr **e, Parser *p) -{ - int sign, sign2, ret; - AVExpr *e0, *e1, *e2; - if ((ret = parse_dB(&e0, p, &sign)) < 0) - return ret; - while(p->s[0]=='^'){ - e1 = e0; - p->s++; - if ((ret = parse_dB(&e2, p, &sign2)) < 0) { - av_expr_free(e1); - return ret; - } - e0 = make_eval_expr(e_pow, 1, e1, e2); - if (!e0) { - av_expr_free(e1); - av_expr_free(e2); - return AVERROR(ENOMEM); - } - if (e0->param[1]) e0->param[1]->value *= (sign2|1); - } - if (e0) e0->value *= (sign|1); - - *e = e0; - return 0; -} - -static int parse_term(AVExpr **e, Parser *p) -{ - int ret; - AVExpr *e0, *e1, *e2; - if ((ret = parse_factor(&e0, p)) < 0) - return ret; - while (p->s[0]=='*' || p->s[0]=='/') { - int c= *p->s++; - e1 = e0; - if ((ret = parse_factor(&e2, p)) < 0) { - av_expr_free(e1); - return ret; - } - e0 = make_eval_expr(c == '*' ? e_mul : e_div, 1, e1, e2); - if (!e0) { - av_expr_free(e1); - av_expr_free(e2); - return AVERROR(ENOMEM); - } - } - *e = e0; - return 0; -} - -static int parse_subexpr(AVExpr **e, Parser *p) -{ - int ret; - AVExpr *e0, *e1, *e2; - if ((ret = parse_term(&e0, p)) < 0) - return ret; - while (*p->s == '+' || *p->s == '-') { - e1 = e0; - if ((ret = parse_term(&e2, p)) < 0) { - av_expr_free(e1); - return ret; - } - e0 = make_eval_expr(e_add, 1, e1, e2); - if (!e0) { - av_expr_free(e1); - av_expr_free(e2); - return AVERROR(ENOMEM); - } - }; - - *e = e0; - return 0; -} - -static int parse_expr(AVExpr **e, Parser *p) -{ - int ret; - AVExpr *e0, *e1, *e2; - if (p->stack_index <= 0) //protect against stack overflows - return AVERROR(EINVAL); - p->stack_index--; - - if ((ret = parse_subexpr(&e0, p)) < 0) - return ret; - while (*p->s == ';') { - p->s++; - e1 = e0; - if ((ret = parse_subexpr(&e2, p)) < 0) { - av_expr_free(e1); - return ret; - } - e0 = make_eval_expr(e_last, 1, e1, e2); - if (!e0) { - av_expr_free(e1); - av_expr_free(e2); - return AVERROR(ENOMEM); - } - }; - - p->stack_index++; - *e = e0; - return 0; -} - -static int verify_expr(AVExpr *e) -{ - if (!e) return 0; - switch (e->type) { - case e_value: - case e_const: return 1; - case e_func0: - case e_func1: - case e_squish: - case e_ld: - case e_gauss: - case e_isnan: - case e_isinf: - case e_floor: - case e_ceil: - case e_trunc: - case e_sqrt: - case e_not: - case e_random: - return verify_expr(e->param[0]) && !e->param[1]; - case e_print: - return verify_expr(e->param[0]) - && (!e->param[1] || verify_expr(e->param[1])); - case e_if: - case e_ifnot: - case e_taylor: - return verify_expr(e->param[0]) && verify_expr(e->param[1]) - && (!e->param[2] || verify_expr(e->param[2])); - case e_between: - return verify_expr(e->param[0]) && - verify_expr(e->param[1]) && - verify_expr(e->param[2]); - default: return verify_expr(e->param[0]) && verify_expr(e->param[1]) && !e->param[2]; - } -} - -int av_expr_parse(AVExpr **expr, const char *s, - const char * const *const_names, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - int log_offset, void *log_ctx) -{ - Parser p = { 0 }; - AVExpr *e = NULL; - char *w = av_malloc(strlen(s) + 1); - char *wp = w; - const char *s0 = s; - int ret = 0; - - if (!w) - return AVERROR(ENOMEM); - - while (*s) - if (!av_isspace(*s++)) *wp++ = s[-1]; - *wp++ = 0; - - p.class = &eval_class; - p.stack_index=100; - p.s= w; - p.const_names = const_names; - p.funcs1 = funcs1; - p.func1_names = func1_names; - p.funcs2 = funcs2; - p.func2_names = func2_names; - p.log_offset = log_offset; - p.log_ctx = log_ctx; - - if ((ret = parse_expr(&e, &p)) < 0) - goto end; - if (*p.s) { - av_expr_free(e); - av_log(&p, AV_LOG_ERROR, "Invalid chars '%s' at the end of expression '%s'\n", p.s, s0); - ret = AVERROR(EINVAL); - goto end; - } - if (!verify_expr(e)) { - av_expr_free(e); - ret = AVERROR(EINVAL); - goto end; - } - e->var= av_mallocz(sizeof(double) *VARS); - *expr = e; -end: - av_free(w); - return ret; -} - -double av_expr_eval(AVExpr *e, const double *const_values, void *opaque) -{ - Parser p = { 0 }; - p.var= e->var; - - p.const_values = const_values; - p.opaque = opaque; - return eval_expr(&p, e); -} - -int av_expr_parse_and_eval(double *d, const char *s, - const char * const *const_names, const double *const_values, - const char * const *func1_names, double (* const *funcs1)(void *, double), - const char * const *func2_names, double (* const *funcs2)(void *, double, double), - void *opaque, int log_offset, void *log_ctx) -{ - AVExpr *e = NULL; - int ret = av_expr_parse(&e, s, const_names, func1_names, funcs1, func2_names, funcs2, log_offset, log_ctx); - - if (ret < 0) { - *d = NAN; - return ret; - } - *d = av_expr_eval(e, const_values, opaque); - av_expr_free(e); - return isnan(*d) ? AVERROR(EINVAL) : 0; -} - -#ifdef TEST -#include - -static const double const_values[] = { - M_PI, - M_E, - 0 -}; - -static const char *const const_names[] = { - "PI", - "E", - 0 -}; - -int main(int argc, char **argv) -{ - int i; - double d; - const char *const *expr; - static const char *const exprs[] = { - "", - "1;2", - "-20", - "-PI", - "+PI", - "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", - "80G/80Gi", - "1k", - "1Gi", - "1gi", - "1GiFoo", - "1k+1k", - "1Gi*3foo", - "foo", - "foo(", - "foo()", - "foo)", - "sin", - "sin(", - "sin()", - "sin)", - "sin 10", - "sin(1,2,3)", - "sin(1 )", - "1", - "1foo", - "bar + PI + E + 100f*2 + foo", - "13k + 12f - foo(1, 2)", - "1gi", - "1Gi", - "st(0, 123)", - "st(1, 123); ld(1)", - "lte(0, 1)", - "lte(1, 1)", - "lte(1, 0)", - "lt(0, 1)", - "lt(1, 1)", - "gt(1, 0)", - "gt(2, 7)", - "gte(122, 122)", - /* compute 1+2+...+N */ - "st(0, 1); while(lte(ld(0), 100), st(1, ld(1)+ld(0));st(0, ld(0)+1)); ld(1)", - /* compute Fib(N) */ - "st(1, 1); st(2, 2); st(0, 1); while(lte(ld(0),10), st(3, ld(1)+ld(2)); st(1, ld(2)); st(2, ld(3)); st(0, ld(0)+1)); ld(3)", - "while(0, 10)", - "st(0, 1); while(lte(ld(0),100), st(1, ld(1)+ld(0)); st(0, ld(0)+1))", - "isnan(1)", - "isnan(NAN)", - "isnan(INF)", - "isinf(1)", - "isinf(NAN)", - "isinf(INF)", - "floor(NAN)", - "floor(123.123)", - "floor(-123.123)", - "trunc(123.123)", - "trunc(-123.123)", - "ceil(123.123)", - "ceil(-123.123)", - "sqrt(1764)", - "isnan(sqrt(-1))", - "not(1)", - "not(NAN)", - "not(0)", - "6.0206dB", - "-3.0103dB", - "pow(0,1.23)", - "pow(PI,1.23)", - "PI^1.23", - "pow(-1,1.23)", - "if(1, 2)", - "if(1, 1, 2)", - "if(0, 1, 2)", - "ifnot(0, 23)", - "ifnot(1, NaN) + if(0, 1)", - "ifnot(1, 1, 2)", - "ifnot(0, 1, 2)", - "taylor(1, 1)", - "taylor(eq(mod(ld(1),4),1)-eq(mod(ld(1),4),3), PI/2, 1)", - "root(sin(ld(0))-1, 2)", - "root(sin(ld(0))+6+sin(ld(0)/12)-log(ld(0)), 100)", - "7000000B*random(0)", - "squish(2)", - "gauss(0.1)", - "hypot(4,3)", - "gcd(30,55)*print(min(9,1))", - "bitor(42, 12)", - "bitand(42, 12)", - "bitand(NAN, 1)", - "between(10, -3, 10)", - "between(-4, -2, -1)", - "between(1,2)", - NULL - }; - - for (expr = exprs; *expr; expr++) { - printf("Evaluating '%s'\n", *expr); - av_expr_parse_and_eval(&d, *expr, - const_names, const_values, - NULL, NULL, NULL, NULL, NULL, 0, NULL); - if (isnan(d)) - printf("'%s' -> nan\n\n", *expr); - else - printf("'%s' -> %f\n\n", *expr, d); - } - - av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", - const_names, const_values, - NULL, NULL, NULL, NULL, NULL, 0, NULL); - printf("%f == 12.7\n", d); - av_expr_parse_and_eval(&d, "80G/80Gi", - const_names, const_values, - NULL, NULL, NULL, NULL, NULL, 0, NULL); - printf("%f == 0.931322575\n", d); - - if (argc > 1 && !strcmp(argv[1], "-t")) { - for (i = 0; i < 1050; i++) { - START_TIMER; - av_expr_parse_and_eval(&d, "1+(5-2)^(3-1)+1/2+sin(PI)-max(-2.2,-3.1)", - const_names, const_values, - NULL, NULL, NULL, NULL, NULL, 0, NULL); - STOP_TIMER("av_expr_parse_and_eval"); - } - } - - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.c deleted file mode 100644 index ca25bc523..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.c +++ /dev/null @@ -1,188 +0,0 @@ -/* - * a very simple circular buffer FIFO implementation - * Copyright (c) 2000, 2001, 2002 Fabrice Bellard - * Copyright (c) 2006 Roman Shaposhnik - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "avassert.h" -#include "common.h" -#include "fifo.h" - -AVFifoBuffer *av_fifo_alloc(unsigned int size) -{ - AVFifoBuffer *f = av_mallocz(sizeof(AVFifoBuffer)); - if (!f) - return NULL; - f->buffer = av_malloc(size); - f->end = f->buffer + size; - av_fifo_reset(f); - if (!f->buffer) - av_freep(&f); - return f; -} - -void av_fifo_free(AVFifoBuffer *f) -{ - if (f) { - av_freep(&f->buffer); - av_free(f); - } -} - -void av_fifo_reset(AVFifoBuffer *f) -{ - f->wptr = f->rptr = f->buffer; - f->wndx = f->rndx = 0; -} - -int av_fifo_size(AVFifoBuffer *f) -{ - return (uint32_t)(f->wndx - f->rndx); -} - -int av_fifo_space(AVFifoBuffer *f) -{ - return f->end - f->buffer - av_fifo_size(f); -} - -int av_fifo_realloc2(AVFifoBuffer *f, unsigned int new_size) -{ - unsigned int old_size = f->end - f->buffer; - - if (old_size < new_size) { - int len = av_fifo_size(f); - AVFifoBuffer *f2 = av_fifo_alloc(new_size); - - if (!f2) - return AVERROR(ENOMEM); - av_fifo_generic_read(f, f2->buffer, len, NULL); - f2->wptr += len; - f2->wndx += len; - av_free(f->buffer); - *f = *f2; - av_free(f2); - } - return 0; -} - -int av_fifo_grow(AVFifoBuffer *f, unsigned int size) -{ - unsigned int old_size = f->end - f->buffer; - if(size + (unsigned)av_fifo_size(f) < size) - return AVERROR(EINVAL); - - size += av_fifo_size(f); - - if (old_size < size) - return av_fifo_realloc2(f, FFMAX(size, 2*size)); - return 0; -} - -/* src must NOT be const as it can be a context for func that may need - * updating (like a pointer or byte counter) */ -int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, - int (*func)(void *, void *, int)) -{ - int total = size; - uint32_t wndx= f->wndx; - uint8_t *wptr= f->wptr; - - do { - int len = FFMIN(f->end - wptr, size); - if (func) { - if (func(src, wptr, len) <= 0) - break; - } else { - memcpy(wptr, src, len); - src = (uint8_t *)src + len; - } -// Write memory barrier needed for SMP here in theory - wptr += len; - if (wptr >= f->end) - wptr = f->buffer; - wndx += len; - size -= len; - } while (size > 0); - f->wndx= wndx; - f->wptr= wptr; - return total - size; -} - -int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, - void (*func)(void *, void *, int)) -{ -// Read memory barrier needed for SMP here in theory - do { - int len = FFMIN(f->end - f->rptr, buf_size); - if (func) - func(dest, f->rptr, len); - else { - memcpy(dest, f->rptr, len); - dest = (uint8_t *)dest + len; - } -// memory barrier needed for SMP here in theory - av_fifo_drain(f, len); - buf_size -= len; - } while (buf_size > 0); - return 0; -} - -/** Discard data from the FIFO. */ -void av_fifo_drain(AVFifoBuffer *f, int size) -{ - av_assert2(av_fifo_size(f) >= size); - f->rptr += size; - if (f->rptr >= f->end) - f->rptr -= f->end - f->buffer; - f->rndx += size; -} - -#ifdef TEST - -int main(void) -{ - /* create a FIFO buffer */ - AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int)); - int i, j, n; - - /* fill data */ - for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++) - av_fifo_generic_write(fifo, &i, sizeof(int), NULL); - - /* peek at FIFO */ - n = av_fifo_size(fifo) / sizeof(int); - for (i = -n + 1; i < n; i++) { - int *v = (int *)av_fifo_peek2(fifo, i * sizeof(int)); - printf("%d: %d\n", i, *v); - } - printf("\n"); - - /* read data */ - for (i = 0; av_fifo_size(fifo) >= sizeof(int); i++) { - av_fifo_generic_read(fifo, &j, sizeof(int), NULL); - printf("%d ", j); - } - printf("\n"); - - av_fifo_free(fifo); - - return 0; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/file_open.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/file_open.c deleted file mode 100644 index ddb1c5138..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/file_open.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "internal.h" -#include "mem.h" -#include -#include -#include -#if HAVE_UNISTD_H -#include -#endif -#if HAVE_IO_H -#include -#endif - -#if defined(_WIN32) && !defined(__MINGW32CE__) -#undef open -#undef lseek -#undef stat -#undef fstat -#include -#include -#include - -static int win32_open(const char *filename_utf8, int oflag, int pmode) -{ - int fd; - int num_chars; - wchar_t *filename_w; - - /* convert UTF-8 to wide chars */ - num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0); - if (num_chars <= 0) - goto fallback; - filename_w = av_mallocz(sizeof(wchar_t) * num_chars); - if (!filename_w) { - errno = ENOMEM; - return -1; - } - MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, filename_w, num_chars); - - fd = _wsopen(filename_w, oflag, SH_DENYNO, pmode); - av_freep(&filename_w); - - if (fd != -1 || (oflag & O_CREAT)) - return fd; - -fallback: - /* filename may be in CP_ACP */ - return _sopen(filename_utf8, oflag, SH_DENYNO, pmode); -} -#define open win32_open -#endif - -int avpriv_open(const char *filename, int flags, ...) -{ - int fd; - unsigned int mode = 0; - va_list ap; - - va_start(ap, flags); - if (flags & O_CREAT) - mode = va_arg(ap, unsigned int); - va_end(ap); - -#ifdef O_CLOEXEC - flags |= O_CLOEXEC; -#endif - - fd = open(filename, flags, mode); -#if HAVE_FCNTL - if (fd != -1) - fcntl(fd, F_SETFD, FD_CLOEXEC); -#endif - - return fd; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.c deleted file mode 100644 index efff47f89..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2005 Balatoni Denes - * Copyright 2006 Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "attributes.h" -#include "float_dsp.h" - -static void vector_fmul_c(float *dst, const float *src0, const float *src1, - int len) -{ - int i; - for (i = 0; i < len; i++) - dst[i] = src0[i] * src1[i]; -} - -static void vector_fmac_scalar_c(float *dst, const float *src, float mul, - int len) -{ - int i; - for (i = 0; i < len; i++) - dst[i] += src[i] * mul; -} - -static void vector_fmul_scalar_c(float *dst, const float *src, float mul, - int len) -{ - int i; - for (i = 0; i < len; i++) - dst[i] = src[i] * mul; -} - -static void vector_dmul_scalar_c(double *dst, const double *src, double mul, - int len) -{ - int i; - for (i = 0; i < len; i++) - dst[i] = src[i] * mul; -} - -static void vector_fmul_window_c(float *dst, const float *src0, - const float *src1, const float *win, int len) -{ - int i, j; - - dst += len; - win += len; - src0 += len; - - for (i = -len, j = len - 1; i < 0; i++, j--) { - float s0 = src0[i]; - float s1 = src1[j]; - float wi = win[i]; - float wj = win[j]; - dst[i] = s0 * wj - s1 * wi; - dst[j] = s0 * wi + s1 * wj; - } -} - -static void vector_fmul_add_c(float *dst, const float *src0, const float *src1, - const float *src2, int len){ - int i; - - for (i = 0; i < len; i++) - dst[i] = src0[i] * src1[i] + src2[i]; -} - -static void vector_fmul_reverse_c(float *dst, const float *src0, - const float *src1, int len) -{ - int i; - - src1 += len-1; - for (i = 0; i < len; i++) - dst[i] = src0[i] * src1[-i]; -} - -static void butterflies_float_c(float *av_restrict v1, float *av_restrict v2, - int len) -{ - int i; - - for (i = 0; i < len; i++) { - float t = v1[i] - v2[i]; - v1[i] += v2[i]; - v2[i] = t; - } -} - -float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len) -{ - float p = 0.0; - int i; - - for (i = 0; i < len; i++) - p += v1[i] * v2[i]; - - return p; -} - -av_cold void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int bit_exact) -{ - fdsp->vector_fmul = vector_fmul_c; - fdsp->vector_fmac_scalar = vector_fmac_scalar_c; - fdsp->vector_fmul_scalar = vector_fmul_scalar_c; - fdsp->vector_dmul_scalar = vector_dmul_scalar_c; - fdsp->vector_fmul_window = vector_fmul_window_c; - fdsp->vector_fmul_add = vector_fmul_add_c; - fdsp->vector_fmul_reverse = vector_fmul_reverse_c; - fdsp->butterflies_float = butterflies_float_c; - fdsp->scalarproduct_float = avpriv_scalarproduct_float_c; - -#if ARCH_ARM - ff_float_dsp_init_arm(fdsp); -#elif ARCH_PPC - ff_float_dsp_init_ppc(fdsp, bit_exact); -#elif ARCH_X86 - ff_float_dsp_init_x86(fdsp); -#elif ARCH_MIPS - ff_float_dsp_init_mips(fdsp); -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.h deleted file mode 100644 index d0447d634..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/float_dsp.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_FLOAT_DSP_H -#define AVUTIL_FLOAT_DSP_H - -#include "config.h" - -typedef struct AVFloatDSPContext { - /** - * Calculate the product of two vectors of floats and store the result in - * a vector of floats. - * - * @param dst output vector - * constraints: 32-byte aligned - * @param src0 first input vector - * constraints: 32-byte aligned - * @param src1 second input vector - * constraints: 32-byte aligned - * @param len number of elements in the input - * constraints: multiple of 16 - */ - void (*vector_fmul)(float *dst, const float *src0, const float *src1, - int len); - - /** - * Multiply a vector of floats by a scalar float and add to - * destination vector. Source and destination vectors must - * overlap exactly or not at all. - * - * @param dst result vector - * constraints: 32-byte aligned - * @param src input vector - * constraints: 32-byte aligned - * @param mul scalar value - * @param len length of vector - * constraints: multiple of 16 - */ - void (*vector_fmac_scalar)(float *dst, const float *src, float mul, - int len); - - /** - * Multiply a vector of floats by a scalar float. Source and - * destination vectors must overlap exactly or not at all. - * - * @param dst result vector - * constraints: 16-byte aligned - * @param src input vector - * constraints: 16-byte aligned - * @param mul scalar value - * @param len length of vector - * constraints: multiple of 4 - */ - void (*vector_fmul_scalar)(float *dst, const float *src, float mul, - int len); - - /** - * Multiply a vector of double by a scalar double. Source and - * destination vectors must overlap exactly or not at all. - * - * @param dst result vector - * constraints: 32-byte aligned - * @param src input vector - * constraints: 32-byte aligned - * @param mul scalar value - * @param len length of vector - * constraints: multiple of 8 - */ - void (*vector_dmul_scalar)(double *dst, const double *src, double mul, - int len); - - /** - * Overlap/add with window function. - * Used primarily by MDCT-based audio codecs. - * Source and destination vectors must overlap exactly or not at all. - * - * @param dst result vector - * constraints: 16-byte aligned - * @param src0 first source vector - * constraints: 16-byte aligned - * @param src1 second source vector - * constraints: 16-byte aligned - * @param win half-window vector - * constraints: 16-byte aligned - * @param len length of vector - * constraints: multiple of 4 - */ - void (*vector_fmul_window)(float *dst, const float *src0, - const float *src1, const float *win, int len); - - /** - * Calculate the product of two vectors of floats, add a third vector of - * floats and store the result in a vector of floats. - * - * @param dst output vector - * constraints: 32-byte aligned - * @param src0 first input vector - * constraints: 32-byte aligned - * @param src1 second input vector - * constraints: 32-byte aligned - * @param src1 third input vector - * constraints: 32-byte aligned - * @param len number of elements in the input - * constraints: multiple of 16 - */ - void (*vector_fmul_add)(float *dst, const float *src0, const float *src1, - const float *src2, int len); - - /** - * Calculate the product of two vectors of floats, and store the result - * in a vector of floats. The second vector of floats is iterated over - * in reverse order. - * - * @param dst output vector - * constraints: 32-byte aligned - * @param src0 first input vector - * constraints: 32-byte aligned - * @param src1 second input vector - * constraints: 32-byte aligned - * @param src1 third input vector - * constraints: 32-byte aligned - * @param len number of elements in the input - * constraints: multiple of 16 - */ - void (*vector_fmul_reverse)(float *dst, const float *src0, - const float *src1, int len); - - /** - * Calculate the sum and difference of two vectors of floats. - * - * @param v1 first input vector, sum output, 16-byte aligned - * @param v2 second input vector, difference output, 16-byte aligned - * @param len length of vectors, multiple of 4 - */ - void (*butterflies_float)(float *av_restrict v1, float *av_restrict v2, int len); - - /** - * Calculate the scalar product of two vectors of floats. - * - * @param v1 first vector, 16-byte aligned - * @param v2 second vector, 16-byte aligned - * @param len length of vectors, multiple of 4 - * - * @return sum of elementwise products - */ - float (*scalarproduct_float)(const float *v1, const float *v2, int len); -} AVFloatDSPContext; - -/** - * Return the scalar product of two vectors. - * - * @param v1 first input vector - * @param v2 first input vector - * @param len number of elements - * - * @return sum of elementwise products - */ -float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len); - -/** - * Initialize a float DSP context. - * - * @param fdsp float DSP context - * @param strict setting to non-zero avoids using functions which may not be IEEE-754 compliant - */ -void avpriv_float_dsp_init(AVFloatDSPContext *fdsp, int strict); - - -void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp); -void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict); -void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp); -void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp); - -#endif /* AVUTIL_FLOAT_DSP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.c deleted file mode 100644 index 1b7f137e1..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.c +++ /dev/null @@ -1,645 +0,0 @@ -/* - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "channel_layout.h" -#include "avassert.h" -#include "buffer.h" -#include "common.h" -#include "dict.h" -#include "frame.h" -#include "imgutils.h" -#include "mem.h" -#include "samplefmt.h" -#include "internal.h" - -MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp) -MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration) -MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos) -MAKE_ACCESSORS(AVFrame, frame, int64_t, channel_layout) -MAKE_ACCESSORS(AVFrame, frame, int, channels) -MAKE_ACCESSORS(AVFrame, frame, int, sample_rate) -MAKE_ACCESSORS(AVFrame, frame, AVDictionary *, metadata) -MAKE_ACCESSORS(AVFrame, frame, int, decode_error_flags) -MAKE_ACCESSORS(AVFrame, frame, int, pkt_size) -MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace) -MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range) - -#define CHECK_CHANNELS_CONSISTENCY(frame) \ - av_assert2(!(frame)->channel_layout || \ - (frame)->channels == \ - av_get_channel_layout_nb_channels((frame)->channel_layout)) - -AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame) {return &frame->metadata;}; - -int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int qp_type) -{ - av_buffer_unref(&f->qp_table_buf); - - f->qp_table_buf = buf; - - f->qscale_table = buf->data; - f->qstride = stride; - f->qscale_type = qp_type; - - return 0; -} - -int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type) -{ - *stride = f->qstride; - *type = f->qscale_type; - - if (!f->qp_table_buf) - return NULL; - - return f->qp_table_buf->data; -} - -const char *av_get_colorspace_name(enum AVColorSpace val) -{ - static const char *name[] = { - [AVCOL_SPC_RGB] = "GBR", - [AVCOL_SPC_BT709] = "bt709", - [AVCOL_SPC_FCC] = "fcc", - [AVCOL_SPC_BT470BG] = "bt470bg", - [AVCOL_SPC_SMPTE170M] = "smpte170m", - [AVCOL_SPC_SMPTE240M] = "smpte240m", - [AVCOL_SPC_YCOCG] = "YCgCo", - }; - if ((unsigned)val >= FF_ARRAY_ELEMS(name)) - return NULL; - return name[val]; -} - -static void get_frame_defaults(AVFrame *frame) -{ - if (frame->extended_data != frame->data) - av_freep(&frame->extended_data); - - memset(frame, 0, sizeof(*frame)); - - frame->pts = - frame->pkt_dts = - frame->pkt_pts = AV_NOPTS_VALUE; - av_frame_set_best_effort_timestamp(frame, AV_NOPTS_VALUE); - av_frame_set_pkt_duration (frame, 0); - av_frame_set_pkt_pos (frame, -1); - av_frame_set_pkt_size (frame, -1); - frame->key_frame = 1; - frame->sample_aspect_ratio = (AVRational){ 0, 1 }; - frame->format = -1; /* unknown */ - frame->colorspace = AVCOL_SPC_UNSPECIFIED; - frame->extended_data = frame->data; -} - -AVFrame *av_frame_alloc(void) -{ - AVFrame *frame = av_mallocz(sizeof(*frame)); - - if (!frame) - return NULL; - - frame->extended_data = NULL; - get_frame_defaults(frame); - - return frame; -} - -void av_frame_free(AVFrame **frame) -{ - if (!frame || !*frame) - return; - - av_frame_unref(*frame); - av_freep(frame); -} - -static int get_video_buffer(AVFrame *frame, int align) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); - int ret, i; - - if (!desc) - return AVERROR(EINVAL); - - if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0) - return ret; - - if (!frame->linesize[0]) { - for(i=1; i<=align; i+=i) { - ret = av_image_fill_linesizes(frame->linesize, frame->format, - FFALIGN(frame->width, i)); - if (ret < 0) - return ret; - if (!(frame->linesize[0] & (align-1))) - break; - } - - for (i = 0; i < 4 && frame->linesize[i]; i++) - frame->linesize[i] = FFALIGN(frame->linesize[i], align); - } - - for (i = 0; i < 4 && frame->linesize[i]; i++) { - int h = FFALIGN(frame->height, 32); - if (i == 1 || i == 2) - h = FF_CEIL_RSHIFT(h, desc->log2_chroma_h); - - frame->buf[i] = av_buffer_alloc(frame->linesize[i] * h + 16 + 16/*STRIDE_ALIGN*/ - 1); - if (!frame->buf[i]) - goto fail; - - frame->data[i] = frame->buf[i]->data; - } - if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { - av_buffer_unref(&frame->buf[1]); - frame->buf[1] = av_buffer_alloc(1024); - if (!frame->buf[1]) - goto fail; - frame->data[1] = frame->buf[1]->data; - } - - frame->extended_data = frame->data; - - return 0; -fail: - av_frame_unref(frame); - return AVERROR(ENOMEM); -} - -static int get_audio_buffer(AVFrame *frame, int align) -{ - int channels; - int planar = av_sample_fmt_is_planar(frame->format); - int planes; - int ret, i; - - if (!frame->channels) - frame->channels = av_get_channel_layout_nb_channels(frame->channel_layout); - - channels = frame->channels; - planes = planar ? channels : 1; - - CHECK_CHANNELS_CONSISTENCY(frame); - if (!frame->linesize[0]) { - ret = av_samples_get_buffer_size(&frame->linesize[0], channels, - frame->nb_samples, frame->format, - align); - if (ret < 0) - return ret; - } - - if (planes > AV_NUM_DATA_POINTERS) { - frame->extended_data = av_mallocz(planes * - sizeof(*frame->extended_data)); - frame->extended_buf = av_mallocz((planes - AV_NUM_DATA_POINTERS) * - sizeof(*frame->extended_buf)); - if (!frame->extended_data || !frame->extended_buf) { - av_freep(&frame->extended_data); - av_freep(&frame->extended_buf); - return AVERROR(ENOMEM); - } - frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS; - } else - frame->extended_data = frame->data; - - for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) { - frame->buf[i] = av_buffer_alloc(frame->linesize[0]); - if (!frame->buf[i]) { - av_frame_unref(frame); - return AVERROR(ENOMEM); - } - frame->extended_data[i] = frame->data[i] = frame->buf[i]->data; - } - for (i = 0; i < planes - AV_NUM_DATA_POINTERS; i++) { - frame->extended_buf[i] = av_buffer_alloc(frame->linesize[0]); - if (!frame->extended_buf[i]) { - av_frame_unref(frame); - return AVERROR(ENOMEM); - } - frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data; - } - return 0; - -} - -int av_frame_get_buffer(AVFrame *frame, int align) -{ - if (frame->format < 0) - return AVERROR(EINVAL); - - if (frame->width > 0 && frame->height > 0) - return get_video_buffer(frame, align); - else if (frame->nb_samples > 0 && (frame->channel_layout || frame->channels > 0)) - return get_audio_buffer(frame, align); - - return AVERROR(EINVAL); -} - -int av_frame_ref(AVFrame *dst, const AVFrame *src) -{ - int i, ret = 0; - - dst->format = src->format; - dst->width = src->width; - dst->height = src->height; - dst->channels = src->channels; - dst->channel_layout = src->channel_layout; - dst->nb_samples = src->nb_samples; - - ret = av_frame_copy_props(dst, src); - if (ret < 0) - return ret; - - /* duplicate the frame data if it's not refcounted */ - if (!src->buf[0]) { - ret = av_frame_get_buffer(dst, 32); - if (ret < 0) - return ret; - - ret = av_frame_copy(dst, src); - if (ret < 0) - av_frame_unref(dst); - - return ret; - } - - /* ref the buffers */ - for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) { - if (!src->buf[i]) - continue; - dst->buf[i] = av_buffer_ref(src->buf[i]); - if (!dst->buf[i]) { - ret = AVERROR(ENOMEM); - goto fail; - } - } - - if (src->extended_buf) { - dst->extended_buf = av_mallocz(sizeof(*dst->extended_buf) * - src->nb_extended_buf); - if (!dst->extended_buf) { - ret = AVERROR(ENOMEM); - goto fail; - } - dst->nb_extended_buf = src->nb_extended_buf; - - for (i = 0; i < src->nb_extended_buf; i++) { - dst->extended_buf[i] = av_buffer_ref(src->extended_buf[i]); - if (!dst->extended_buf[i]) { - ret = AVERROR(ENOMEM); - goto fail; - } - } - } - - /* duplicate extended data */ - if (src->extended_data != src->data) { - int ch = src->channels; - - if (!ch) { - ret = AVERROR(EINVAL); - goto fail; - } - CHECK_CHANNELS_CONSISTENCY(src); - - dst->extended_data = av_malloc(sizeof(*dst->extended_data) * ch); - if (!dst->extended_data) { - ret = AVERROR(ENOMEM); - goto fail; - } - memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch); - } else - dst->extended_data = dst->data; - - memcpy(dst->data, src->data, sizeof(src->data)); - memcpy(dst->linesize, src->linesize, sizeof(src->linesize)); - - return 0; - -fail: - av_frame_unref(dst); - return ret; -} - -AVFrame *av_frame_clone(const AVFrame *src) -{ - AVFrame *ret = av_frame_alloc(); - - if (!ret) - return NULL; - - if (av_frame_ref(ret, src) < 0) - av_frame_free(&ret); - - return ret; -} - -void av_frame_unref(AVFrame *frame) -{ - int i; - - for (i = 0; i < frame->nb_side_data; i++) { - av_freep(&frame->side_data[i]->data); - av_dict_free(&frame->side_data[i]->metadata); - av_freep(&frame->side_data[i]); - } - av_freep(&frame->side_data); - - for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++) - av_buffer_unref(&frame->buf[i]); - for (i = 0; i < frame->nb_extended_buf; i++) - av_buffer_unref(&frame->extended_buf[i]); - av_freep(&frame->extended_buf); - av_dict_free(&frame->metadata); - av_buffer_unref(&frame->qp_table_buf); - - get_frame_defaults(frame); -} - -void av_frame_move_ref(AVFrame *dst, AVFrame *src) -{ - *dst = *src; - if (src->extended_data == src->data) - dst->extended_data = dst->data; - memset(src, 0, sizeof(*src)); - get_frame_defaults(src); -} - -int av_frame_is_writable(AVFrame *frame) -{ - int i, ret = 1; - - /* assume non-refcounted frames are not writable */ - if (!frame->buf[0]) - return 0; - - for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++) - if (frame->buf[i]) - ret &= !!av_buffer_is_writable(frame->buf[i]); - for (i = 0; i < frame->nb_extended_buf; i++) - ret &= !!av_buffer_is_writable(frame->extended_buf[i]); - - return ret; -} - -int av_frame_make_writable(AVFrame *frame) -{ - AVFrame tmp; - int ret; - - if (!frame->buf[0]) - return AVERROR(EINVAL); - - if (av_frame_is_writable(frame)) - return 0; - - memset(&tmp, 0, sizeof(tmp)); - tmp.format = frame->format; - tmp.width = frame->width; - tmp.height = frame->height; - tmp.channels = frame->channels; - tmp.channel_layout = frame->channel_layout; - tmp.nb_samples = frame->nb_samples; - ret = av_frame_get_buffer(&tmp, 32); - if (ret < 0) - return ret; - - ret = av_frame_copy(&tmp, frame); - if (ret < 0) { - av_frame_unref(&tmp); - return ret; - } - - ret = av_frame_copy_props(&tmp, frame); - if (ret < 0) { - av_frame_unref(&tmp); - return ret; - } - - av_frame_unref(frame); - - *frame = tmp; - if (tmp.data == tmp.extended_data) - frame->extended_data = frame->data; - - return 0; -} - -int av_frame_copy_props(AVFrame *dst, const AVFrame *src) -{ - int i; - - dst->key_frame = src->key_frame; - dst->pict_type = src->pict_type; - dst->sample_aspect_ratio = src->sample_aspect_ratio; - dst->pts = src->pts; - dst->repeat_pict = src->repeat_pict; - dst->interlaced_frame = src->interlaced_frame; - dst->top_field_first = src->top_field_first; - dst->palette_has_changed = src->palette_has_changed; - dst->sample_rate = src->sample_rate; - dst->opaque = src->opaque; -#if FF_API_AVFRAME_LAVC - dst->type = src->type; -#endif - dst->pkt_pts = src->pkt_pts; - dst->pkt_dts = src->pkt_dts; - dst->pkt_pos = src->pkt_pos; - dst->pkt_size = src->pkt_size; - dst->pkt_duration = src->pkt_duration; - dst->reordered_opaque = src->reordered_opaque; - dst->quality = src->quality; - dst->best_effort_timestamp = src->best_effort_timestamp; - dst->coded_picture_number = src->coded_picture_number; - dst->display_picture_number = src->display_picture_number; - dst->flags = src->flags; - dst->decode_error_flags = src->decode_error_flags; - dst->colorspace = src->colorspace; - dst->color_range = src->color_range; - - av_dict_copy(&dst->metadata, src->metadata, 0); - - memcpy(dst->error, src->error, sizeof(dst->error)); - - for (i = 0; i < src->nb_side_data; i++) { - const AVFrameSideData *sd_src = src->side_data[i]; - AVFrameSideData *sd_dst = av_frame_new_side_data(dst, sd_src->type, - sd_src->size); - if (!sd_dst) { - for (i = 0; i < dst->nb_side_data; i++) { - av_freep(&dst->side_data[i]->data); - av_freep(&dst->side_data[i]); - av_dict_free(&dst->side_data[i]->metadata); - } - av_freep(&dst->side_data); - return AVERROR(ENOMEM); - } - memcpy(sd_dst->data, sd_src->data, sd_src->size); - av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0); - } - - dst->qscale_table = NULL; - dst->qstride = 0; - dst->qscale_type = 0; - if (src->qp_table_buf) { - dst->qp_table_buf = av_buffer_ref(src->qp_table_buf); - if (dst->qp_table_buf) { - dst->qscale_table = dst->qp_table_buf->data; - dst->qstride = src->qstride; - dst->qscale_type = src->qscale_type; - } - } - - return 0; -} - -AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane) -{ - uint8_t *data; - int planes, i; - - if (frame->nb_samples) { - int channels = frame->channels; - if (!channels) - return NULL; - CHECK_CHANNELS_CONSISTENCY(frame); - planes = av_sample_fmt_is_planar(frame->format) ? channels : 1; - } else - planes = 4; - - if (plane < 0 || plane >= planes || !frame->extended_data[plane]) - return NULL; - data = frame->extended_data[plane]; - - for (i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) { - AVBufferRef *buf = frame->buf[i]; - if (data >= buf->data && data < buf->data + buf->size) - return buf; - } - for (i = 0; i < frame->nb_extended_buf; i++) { - AVBufferRef *buf = frame->extended_buf[i]; - if (data >= buf->data && data < buf->data + buf->size) - return buf; - } - return NULL; -} - -AVFrameSideData *av_frame_new_side_data(AVFrame *frame, - enum AVFrameSideDataType type, - int size) -{ - AVFrameSideData *ret, **tmp; - - if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1) - return NULL; - - tmp = av_realloc(frame->side_data, - (frame->nb_side_data + 1) * sizeof(*frame->side_data)); - if (!tmp) - return NULL; - frame->side_data = tmp; - - ret = av_mallocz(sizeof(*ret)); - if (!ret) - return NULL; - - ret->data = av_malloc(size); - if (!ret->data) { - av_freep(&ret); - return NULL; - } - - ret->size = size; - ret->type = type; - - frame->side_data[frame->nb_side_data++] = ret; - - return ret; -} - -AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, - enum AVFrameSideDataType type) -{ - int i; - - for (i = 0; i < frame->nb_side_data; i++) { - if (frame->side_data[i]->type == type) - return frame->side_data[i]; - } - return NULL; -} - -static int frame_copy_video(AVFrame *dst, const AVFrame *src) -{ - const uint8_t *src_data[4]; - int i, planes; - - if (dst->width != src->width || - dst->height != src->height) - return AVERROR(EINVAL); - - planes = av_pix_fmt_count_planes(dst->format); - for (i = 0; i < planes; i++) - if (!dst->data[i] || !src->data[i]) - return AVERROR(EINVAL); - - memcpy(src_data, src->data, sizeof(src_data)); - av_image_copy(dst->data, dst->linesize, - src_data, src->linesize, - dst->format, dst->width, dst->height); - - return 0; -} - -static int frame_copy_audio(AVFrame *dst, const AVFrame *src) -{ - int planar = av_sample_fmt_is_planar(dst->format); - int channels = dst->channels; - int planes = planar ? channels : 1; - int i; - - if (dst->nb_samples != src->nb_samples || - dst->channels != src->channels || - dst->channel_layout != src->channel_layout) - return AVERROR(EINVAL); - - CHECK_CHANNELS_CONSISTENCY(src); - - for (i = 0; i < planes; i++) - if (!dst->extended_data[i] || !src->extended_data[i]) - return AVERROR(EINVAL); - - av_samples_copy(dst->extended_data, src->extended_data, 0, 0, - dst->nb_samples, channels, dst->format); - - return 0; -} - -int av_frame_copy(AVFrame *dst, const AVFrame *src) -{ - if (dst->format != src->format || dst->format < 0) - return AVERROR(EINVAL); - - if (dst->width > 0 && dst->height > 0) - return frame_copy_video(dst, src); - else if (dst->nb_samples > 0 && dst->channel_layout) - return frame_copy_audio(dst, src); - - return AVERROR(EINVAL); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.c deleted file mode 100644 index d8a579fc6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.c +++ /dev/null @@ -1,368 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * misc image utilities - */ - -#include "avassert.h" -#include "common.h" -#include "imgutils.h" -#include "internal.h" -#include "intreadwrite.h" -#include "log.h" -#include "pixdesc.h" - -void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], - const AVPixFmtDescriptor *pixdesc) -{ - int i; - memset(max_pixsteps, 0, 4*sizeof(max_pixsteps[0])); - if (max_pixstep_comps) - memset(max_pixstep_comps, 0, 4*sizeof(max_pixstep_comps[0])); - - for (i = 0; i < 4; i++) { - const AVComponentDescriptor *comp = &(pixdesc->comp[i]); - if ((comp->step_minus1+1) > max_pixsteps[comp->plane]) { - max_pixsteps[comp->plane] = comp->step_minus1+1; - if (max_pixstep_comps) - max_pixstep_comps[comp->plane] = i; - } - } -} - -static inline -int image_get_linesize(int width, int plane, - int max_step, int max_step_comp, - const AVPixFmtDescriptor *desc) -{ - int s, shifted_w, linesize; - - if (!desc) - return AVERROR(EINVAL); - - if (width < 0) - return AVERROR(EINVAL); - s = (max_step_comp == 1 || max_step_comp == 2) ? desc->log2_chroma_w : 0; - shifted_w = ((width + (1 << s) - 1)) >> s; - if (shifted_w && max_step > INT_MAX / shifted_w) - return AVERROR(EINVAL); - linesize = max_step * shifted_w; - - if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) - linesize = (linesize + 7) >> 3; - return linesize; -} - -int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int max_step [4]; /* max pixel step for each plane */ - int max_step_comp[4]; /* the component for each plane which has the max pixel step */ - - if ((unsigned)pix_fmt >= AV_PIX_FMT_NB || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) - return AVERROR(EINVAL); - - av_image_fill_max_pixsteps(max_step, max_step_comp, desc); - return image_get_linesize(width, plane, max_step[plane], max_step_comp[plane], desc); -} - -int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width) -{ - int i, ret; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int max_step [4]; /* max pixel step for each plane */ - int max_step_comp[4]; /* the component for each plane which has the max pixel step */ - - memset(linesizes, 0, 4*sizeof(linesizes[0])); - - if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) - return AVERROR(EINVAL); - - av_image_fill_max_pixsteps(max_step, max_step_comp, desc); - for (i = 0; i < 4; i++) { - if ((ret = image_get_linesize(width, i, max_step[i], max_step_comp[i], desc)) < 0) - return ret; - linesizes[i] = ret; - } - - return 0; -} - -int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, - uint8_t *ptr, const int linesizes[4]) -{ - int i, total_size, size[4] = { 0 }, has_plane[4] = { 0 }; - - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - memset(data , 0, sizeof(data[0])*4); - - if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) - return AVERROR(EINVAL); - - data[0] = ptr; - if (linesizes[0] > (INT_MAX - 1024) / height) - return AVERROR(EINVAL); - size[0] = linesizes[0] * height; - - if (desc->flags & AV_PIX_FMT_FLAG_PAL || - desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { - size[0] = (size[0] + 3) & ~3; - data[1] = ptr + size[0]; /* palette is stored here as 256 32 bits words */ - return size[0] + 256 * 4; - } - - for (i = 0; i < 4; i++) - has_plane[desc->comp[i].plane] = 1; - - total_size = size[0]; - for (i = 1; i < 4 && has_plane[i]; i++) { - int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; - data[i] = data[i-1] + size[i-1]; - h = (height + (1 << s) - 1) >> s; - if (linesizes[i] > INT_MAX / h) - return AVERROR(EINVAL); - size[i] = h * linesizes[i]; - if (total_size > INT_MAX - size[i]) - return AVERROR(EINVAL); - total_size += size[i]; - } - - return total_size; -} - -int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt) -{ - int i; - - for (i = 0; i < 256; i++) { - int r, g, b; - - switch (pix_fmt) { - case AV_PIX_FMT_RGB8: - r = (i>>5 )*36; - g = ((i>>2)&7)*36; - b = (i&3 )*85; - break; - case AV_PIX_FMT_BGR8: - b = (i>>6 )*85; - g = ((i>>3)&7)*36; - r = (i&7 )*36; - break; - case AV_PIX_FMT_RGB4_BYTE: - r = (i>>3 )*255; - g = ((i>>1)&3)*85; - b = (i&1 )*255; - break; - case AV_PIX_FMT_BGR4_BYTE: - b = (i>>3 )*255; - g = ((i>>1)&3)*85; - r = (i&1 )*255; - break; - case AV_PIX_FMT_GRAY8: - r = b = g = i; - break; - default: - return AVERROR(EINVAL); - } - pal[i] = b + (g<<8) + (r<<16) + (0xFFU<<24); - } - - return 0; -} - -int av_image_alloc(uint8_t *pointers[4], int linesizes[4], - int w, int h, enum AVPixelFormat pix_fmt, int align) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int i, ret; - uint8_t *buf; - - if (!desc) - return AVERROR(EINVAL); - - if ((ret = av_image_check_size(w, h, 0, NULL)) < 0) - return ret; - if ((ret = av_image_fill_linesizes(linesizes, pix_fmt, align>7 ? FFALIGN(w, 8) : w)) < 0) - return ret; - - for (i = 0; i < 4; i++) - linesizes[i] = FFALIGN(linesizes[i], align); - - if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, NULL, linesizes)) < 0) - return ret; - buf = av_malloc(ret + align); - if (!buf) - return AVERROR(ENOMEM); - if ((ret = av_image_fill_pointers(pointers, pix_fmt, h, buf, linesizes)) < 0) { - av_free(buf); - return ret; - } - if (desc->flags & AV_PIX_FMT_FLAG_PAL || desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) - avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); - - return ret; -} - -typedef struct ImgUtils { - const AVClass *class; - int log_offset; - void *log_ctx; -} ImgUtils; - -static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) }; - -int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) -{ - ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; - - if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) - return 0; - - av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); - return AVERROR(EINVAL); -} - -void av_image_copy_plane(uint8_t *dst, int dst_linesize, - const uint8_t *src, int src_linesize, - int bytewidth, int height) -{ - if (!dst || !src) - return; - av_assert0(abs(src_linesize) >= bytewidth); - av_assert0(abs(dst_linesize) >= bytewidth); - for (;height > 0; height--) { - memcpy(dst, src, bytewidth); - dst += dst_linesize; - src += src_linesize; - } -} - -void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], - const uint8_t *src_data[4], const int src_linesizes[4], - enum AVPixelFormat pix_fmt, int width, int height) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - - if (!desc || desc->flags & AV_PIX_FMT_FLAG_HWACCEL) - return; - - if (desc->flags & AV_PIX_FMT_FLAG_PAL || - desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) { - av_image_copy_plane(dst_data[0], dst_linesizes[0], - src_data[0], src_linesizes[0], - width, height); - /* copy the palette */ - memcpy(dst_data[1], src_data[1], 4*256); - } else { - int i, planes_nb = 0; - - for (i = 0; i < desc->nb_components; i++) - planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); - - for (i = 0; i < planes_nb; i++) { - int h = height; - int bwidth = av_image_get_linesize(pix_fmt, width, i); - if (bwidth < 0) { - av_log(NULL, AV_LOG_ERROR, "av_image_get_linesize failed\n"); - return; - } - if (i == 1 || i == 2) { - h = FF_CEIL_RSHIFT(height, desc->log2_chroma_h); - } - av_image_copy_plane(dst_data[i], dst_linesizes[i], - src_data[i], src_linesizes[i], - bwidth, h); - } - } -} - -int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4], - const uint8_t *src, - enum AVPixelFormat pix_fmt, int width, int height, int align) -{ - int ret, i; - - if ((ret = av_image_check_size(width, height, 0, NULL)) < 0) - return ret; - - if ((ret = av_image_fill_linesizes(dst_linesize, pix_fmt, width)) < 0) - return ret; - - for (i = 0; i < 4; i++) - dst_linesize[i] = FFALIGN(dst_linesize[i], align); - - if ((ret = av_image_fill_pointers(dst_data, pix_fmt, width, NULL, dst_linesize)) < 0) - return ret; - - return av_image_fill_pointers(dst_data, pix_fmt, height, (uint8_t *)src, dst_linesize); -} - -int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - uint8_t *data[4]; - int linesize[4]; - - if (!desc) - return AVERROR(EINVAL); - if (av_image_check_size(width, height, 0, NULL) < 0) - return AVERROR(EINVAL); - if (desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) - // do not include palette for these pseudo-paletted formats - return width * height; - return av_image_fill_arrays(data, linesize, NULL, pix_fmt, width, height, align); -} - -int av_image_copy_to_buffer(uint8_t *dst, int dst_size, - const uint8_t * const src_data[4], const int src_linesize[4], - enum AVPixelFormat pix_fmt, int width, int height, int align) -{ - int i, j, nb_planes = 0, linesize[4]; - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int size = av_image_get_buffer_size(pix_fmt, width, height, align); - - if (size > dst_size || size < 0) - return AVERROR(EINVAL); - - for (i = 0; i < desc->nb_components; i++) - nb_planes = FFMAX(desc->comp[i].plane, nb_planes); - nb_planes++; - - av_image_fill_linesizes(linesize, pix_fmt, width); - for (i = 0; i < nb_planes; i++) { - int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; - const uint8_t *src = src_data[i]; - h = (height + (1 << shift) - 1) >> shift; - - for (j = 0; j < h; j++) { - memcpy(dst, src, linesize[i]); - dst += FFALIGN(linesize[i], align); - src += src_linesize[i]; - } - } - - if (desc->flags & AV_PIX_FMT_FLAG_PAL) { - uint32_t *d32 = (uint32_t *)(((size_t)dst + 3) & ~3); - for (i = 0; i<256; i++) - AV_WL32(d32 + i, AV_RN32(src_data[1] + 4*i)); - } - - return size; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.c deleted file mode 100644 index 5bcde0dc6..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * arbitrary precision integers - * @author Michael Niedermayer - */ - -#include "common.h" -#include "integer.h" -#include "avassert.h" - -AVInteger av_add_i(AVInteger a, AVInteger b){ - int i, carry=0; - - for(i=0; i>16) + a.v[i] + b.v[i]; - a.v[i]= carry; - } - return a; -} - -AVInteger av_sub_i(AVInteger a, AVInteger b){ - int i, carry=0; - - for(i=0; i>16) + a.v[i] - b.v[i]; - a.v[i]= carry; - } - return a; -} - -int av_log2_i(AVInteger a){ - int i; - - for(i=AV_INTEGER_SIZE-1; i>=0; i--){ - if(a.v[i]) - return av_log2_16bit(a.v[i]) + 16*i; - } - return -1; -} - -AVInteger av_mul_i(AVInteger a, AVInteger b){ - AVInteger out; - int i, j; - int na= (av_log2_i(a)+16) >> 4; - int nb= (av_log2_i(b)+16) >> 4; - - memset(&out, 0, sizeof(out)); - - for(i=0; i>16) + out.v[j] + a.v[i]*b.v[j-i]; - out.v[j]= carry; - } - } - - return out; -} - -int av_cmp_i(AVInteger a, AVInteger b){ - int i; - int v= (int16_t)a.v[AV_INTEGER_SIZE-1] - (int16_t)b.v[AV_INTEGER_SIZE-1]; - if(v) return (v>>16)|1; - - for(i=AV_INTEGER_SIZE-2; i>=0; i--){ - int v= a.v[i] - b.v[i]; - if(v) return (v>>16)|1; - } - return 0; -} - -AVInteger av_shr_i(AVInteger a, int s){ - AVInteger out; - int i; - - for(i=0; i>4); - unsigned int v=0; - if(index+1> (s&15); - } - return out; -} - -AVInteger av_mod_i(AVInteger *quot, AVInteger a, AVInteger b){ - int i= av_log2_i(a) - av_log2_i(b); - AVInteger quot_temp; - if(!quot) quot = "_temp; - - av_assert2((int16_t)a.v[AV_INTEGER_SIZE-1] >= 0 && (int16_t)b.v[AV_INTEGER_SIZE-1] >= 0); - av_assert2(av_log2_i(b)>=0); - - if(i > 0) - b= av_shr_i(b, -i); - - memset(quot, 0, sizeof(AVInteger)); - - while(i-- >= 0){ - *quot= av_shr_i(*quot, -1); - if(av_cmp_i(a, b) >= 0){ - a= av_sub_i(a, b); - quot->v[0] += 1; - } - b= av_shr_i(b, 1); - } - return a; -} - -AVInteger av_div_i(AVInteger a, AVInteger b){ - AVInteger quot; - av_mod_i(", a, b); - return quot; -} - -AVInteger av_int2i(int64_t a){ - AVInteger out; - int i; - - for(i=0; i>=16; - } - return out; -} - -int64_t av_i2int(AVInteger a){ - int i; - int64_t out=(int8_t)a.v[AV_INTEGER_SIZE-1]; - - for(i= AV_INTEGER_SIZE-2; i>=0; i--){ - out = (out<<16) + a.v[i]; - } - return out; -} - -#ifdef TEST - -const uint8_t ff_log2_tab[256]={ - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -int main(void){ - int64_t a,b; - - for(a=7; a<256*256*256; a+=13215){ - for(b=3; b<256*256*256; b+=27118){ - AVInteger ai= av_int2i(a); - AVInteger bi= av_int2i(b); - - av_assert0(av_i2int(ai) == a); - av_assert0(av_i2int(bi) == b); - av_assert0(av_i2int(av_add_i(ai,bi)) == a+b); - av_assert0(av_i2int(av_sub_i(ai,bi)) == a-b); - av_assert0(av_i2int(av_mul_i(ai,bi)) == a*b); - av_assert0(av_i2int(av_shr_i(ai, 9)) == a>>9); - av_assert0(av_i2int(av_shr_i(ai,-9)) == a<<9); - av_assert0(av_i2int(av_shr_i(ai, 17)) == a>>17); - av_assert0(av_i2int(av_shr_i(ai,-17)) == a<<17); - av_assert0(av_log2_i(ai) == av_log2(a)); - av_assert0(av_i2int(av_div_i(ai,bi)) == a/b); - } - } - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.h deleted file mode 100644 index 45f733c04..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/integer.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * arbitrary precision integers - * Copyright (c) 2004 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * arbitrary precision integers - * @author Michael Niedermayer - */ - -#ifndef AVUTIL_INTEGER_H -#define AVUTIL_INTEGER_H - -#include -#include "common.h" - -#define AV_INTEGER_SIZE 8 - -typedef struct AVInteger{ - uint16_t v[AV_INTEGER_SIZE]; -} AVInteger; - -AVInteger av_add_i(AVInteger a, AVInteger b) av_const; -AVInteger av_sub_i(AVInteger a, AVInteger b) av_const; - -/** - * Return the rounded-down value of the base 2 logarithm of the given - * AVInteger. This is simply the index of the most significant bit - * which is 1, or 0 if all bits are 0. - */ -int av_log2_i(AVInteger a) av_const; -AVInteger av_mul_i(AVInteger a, AVInteger b) av_const; - -/** - * Return 0 if a==b, 1 if a>b and -1 if a - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * common internal API header - */ - -#ifndef AVUTIL_INTERNAL_H -#define AVUTIL_INTERNAL_H - -#if !defined(DEBUG) && !defined(NDEBUG) -# define NDEBUG -#endif - -#include -#include -#include -#include -#include "config.h" -#include "attributes.h" -#include "timer.h" -#include "cpu.h" -#include "dict.h" -#include "version.h" - -#if ARCH_X86 -# include "x86/emms.h" -#endif - -#ifndef emms_c -# define emms_c() -#endif - -#ifndef attribute_align_arg -#if ARCH_X86_32 && AV_GCC_VERSION_AT_LEAST(4,2) -# define attribute_align_arg __attribute__((force_align_arg_pointer)) -#else -# define attribute_align_arg -#endif -#endif - -#if defined(_MSC_VER) && CONFIG_SHARED -# define av_export __declspec(dllimport) -#else -# define av_export -#endif - -#if HAVE_PRAGMA_DEPRECATED -# if defined(__ICL) || defined (__INTEL_COMPILER) -# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478)) -# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) -# elif defined(_MSC_VER) -# define FF_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996)) -# define FF_ENABLE_DEPRECATION_WARNINGS __pragma(warning(pop)) -# else -# define FF_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") -# define FF_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"") -# endif -#else -# define FF_DISABLE_DEPRECATION_WARNINGS -# define FF_ENABLE_DEPRECATION_WARNINGS -#endif - -#ifndef INT_BIT -# define INT_BIT (CHAR_BIT * sizeof(int)) -#endif - -#define FF_MEMORY_POISON 0x2a - -#define MAKE_ACCESSORS(str, name, type, field) \ - type av_##name##_get_##field(const str *s) { return s->field; } \ - void av_##name##_set_##field(str *s, type v) { s->field = v; } - -// Some broken preprocessors need a second expansion -// to be forced to tokenize __VA_ARGS__ -#define E1(x) x - -#define LOCAL_ALIGNED_A(a, t, v, s, o, ...) \ - uint8_t la_##v[sizeof(t s o) + (a)]; \ - t (*v) o = (void *)FFALIGN((uintptr_t)la_##v, a) - -#define LOCAL_ALIGNED_D(a, t, v, s, o, ...) \ - DECLARE_ALIGNED(a, t, la_##v) s o; \ - t (*v) o = la_##v - -#define LOCAL_ALIGNED(a, t, v, ...) E1(LOCAL_ALIGNED_A(a, t, v, __VA_ARGS__,,)) - -#if HAVE_LOCAL_ALIGNED_8 -# define LOCAL_ALIGNED_8(t, v, ...) E1(LOCAL_ALIGNED_D(8, t, v, __VA_ARGS__,,)) -#else -# define LOCAL_ALIGNED_8(t, v, ...) LOCAL_ALIGNED(8, t, v, __VA_ARGS__) -#endif - -#if HAVE_LOCAL_ALIGNED_16 -# define LOCAL_ALIGNED_16(t, v, ...) E1(LOCAL_ALIGNED_D(16, t, v, __VA_ARGS__,,)) -#else -# define LOCAL_ALIGNED_16(t, v, ...) LOCAL_ALIGNED(16, t, v, __VA_ARGS__) -#endif - -#define FF_ALLOC_OR_GOTO(ctx, p, size, label)\ -{\ - p = av_malloc(size);\ - if (p == NULL && (size) != 0) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - -#define FF_ALLOCZ_OR_GOTO(ctx, p, size, label)\ -{\ - p = av_mallocz(size);\ - if (p == NULL && (size) != 0) {\ - av_log(ctx, AV_LOG_ERROR, "Cannot allocate memory.\n");\ - goto label;\ - }\ -} - -#include "libm.h" - -#if defined(_MSC_VER) -#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_strtod") -#pragma comment(linker, "/include:"EXTERN_PREFIX"avpriv_snprintf") -#endif - -/** - * Return NULL if CONFIG_SMALL is true, otherwise the argument - * without modification. Used to disable the definition of strings - * (for example AVCodec long_names). - */ -#undef NULL_IF_CONFIG_SMALL -#if CONFIG_SMALL -# define NULL_IF_CONFIG_SMALL(x) NULL -#else -# define NULL_IF_CONFIG_SMALL(x) x -#endif - -/** - * Define a function with only the non-default version specified. - * - * On systems with ELF shared libraries, all symbols exported from - * FFmpeg libraries are tagged with the name and major version of the - * library to which they belong. If a function is moved from one - * library to another, a wrapper must be retained in the original - * location to preserve binary compatibility. - * - * Functions defined with this macro will never be used to resolve - * symbols by the build-time linker. - * - * @param type return type of function - * @param name name of function - * @param args argument list of function - * @param ver version tag to assign function - */ -#if HAVE_SYMVER_ASM_LABEL -# define FF_SYMVER(type, name, args, ver) \ - type ff_##name args __asm__ (EXTERN_PREFIX #name "@" ver); \ - type ff_##name args -#elif HAVE_SYMVER_GNU_ASM -# define FF_SYMVER(type, name, args, ver) \ - __asm__ (".symver ff_" #name "," EXTERN_PREFIX #name "@" ver); \ - type ff_##name args; \ - type ff_##name args -#endif - -/** - * Return NULL if a threading library has not been enabled. - * Used to disable threading functions in AVCodec definitions - * when not needed. - */ -#if HAVE_THREADS -# define ONLY_IF_THREADS_ENABLED(x) x -#else -# define ONLY_IF_THREADS_ENABLED(x) NULL -#endif - -/** - * Log a generic warning message about a missing feature. - * - * @param[in] avc a pointer to an arbitrary struct of which the first - * field is a pointer to an AVClass struct - * @param[in] msg string containing the name of the missing feature - */ -void avpriv_report_missing_feature(void *avc, - const char *msg, ...) av_printf_format(2, 3); - -/** - * Log a generic warning message about a missing feature. - * Additionally request that a sample showcasing the feature be uploaded. - * - * @param[in] avc a pointer to an arbitrary struct of which the first field is - * a pointer to an AVClass struct - * @param[in] msg string containing the name of the missing feature - */ -void avpriv_request_sample(void *avc, - const char *msg, ...) av_printf_format(2, 3); - -#if HAVE_LIBC_MSVCRT -#define avpriv_open ff_open -#endif - -/** - * A wrapper for open() setting O_CLOEXEC. - */ -int avpriv_open(const char *filename, int flags, ...); - -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT -uint64_t ff_get_channel_layout(const char *name, int compat); -#endif - -#endif /* AVUTIL_INTERNAL_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.c deleted file mode 100644 index 142331dac..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * portable IEEE float/double read/write functions - * - * Copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * portable IEEE float/double read/write functions - */ - -#include -#include "common.h" -#include "mathematics.h" -#include "intfloat_readwrite.h" - -double av_int2dbl(int64_t v){ - if((uint64_t)v+v > 0xFFEULL<<52) - return NAN; - return ldexp(((v&((1LL<<52)-1)) + (1LL<<52)) * (v>>63|1), (v>>52&0x7FF)-1075); -} - -float av_int2flt(int32_t v){ - if((uint32_t)v+v > 0xFF000000U) - return NAN; - return ldexp(((v&0x7FFFFF) + (1<<23)) * (v>>31|1), (v>>23&0xFF)-150); -} - -double av_ext2dbl(const AVExtFloat ext){ - uint64_t m = 0; - int e, i; - - for (i = 0; i < 8; i++) - m = (m<<8) + ext.mantissa[i]; - e = (((int)ext.exponent[0]&0x7f)<<8) | ext.exponent[1]; - if (e == 0x7fff && m) - return NAN; - e -= 16383 + 63; /* In IEEE 80 bits, the whole (i.e. 1.xxxx) - * mantissa bit is written as opposed to the - * single and double precision formats. */ - if (ext.exponent[0]&0x80) - m= -m; - return ldexp(m, e); -} - -int64_t av_dbl2int(double d){ - int e; - if ( !d) return 0; - else if(d-d) return 0x7FF0000000000000LL + ((int64_t)(d<0)<<63) + (d!=d); - d= frexp(d, &e); - return (int64_t)(d<0)<<63 | (e+1022LL)<<52 | (int64_t)((fabs(d)-0.5)*(1LL<<53)); -} - -int32_t av_flt2int(float d){ - int e; - if ( !d) return 0; - else if(d-d) return 0x7F800000 + ((d<0)<<31) + (d!=d); - d= frexp(d, &e); - return (d<0)<<31 | (e+126)<<23 | (int64_t)((fabs(d)-0.5)*(1<<24)); -} - -AVExtFloat av_dbl2ext(double d){ - struct AVExtFloat ext= {{0}}; - int e, i; double f; uint64_t m; - - f = fabs(frexp(d, &e)); - if (f >= 0.5 && f < 1) { - e += 16382; - ext.exponent[0] = e>>8; - ext.exponent[1] = e; - m = (uint64_t)ldexp(f, 64); - for (i=0; i < 8; i++) - ext.mantissa[i] = m>>(56-(i<<3)); - } else if (f != 0.0) { - ext.exponent[0] = 0x7f; ext.exponent[1] = 0xff; - if (!isinf(f)) - ext.mantissa[0] = ~0; - } - if (d < 0) - ext.exponent[0] |= 0x80; - return ext; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.c deleted file mode 100644 index 1f725c741..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "intmath.h" - -/* undef these to get the function prototypes from common.h */ -#undef av_log2 -#undef av_log2_16bit -#include "common.h" - -int av_log2(unsigned v) -{ - return ff_log2(v); -} - -int av_log2_16bit(unsigned v) -{ - return ff_log2_16bit(v); -} - -int av_ctz(int v) -{ - return ff_ctz(v); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.h deleted file mode 100644 index e140d822f..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intmath.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2010 Mans Rullgard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_INTMATH_H -#define AVUTIL_INTMATH_H - -#include - -#include "config.h" -#include "attributes.h" - -#if ARCH_ARM -# include "arm/intmath.h" -#endif - -/** - * @addtogroup lavu_internal - * @{ - */ - -#if ARCH_ARM -# include "arm/intmath.h" -#endif - -#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4) - -#ifndef ff_log2 -# define ff_log2(x) (31 - __builtin_clz((x)|1)) -# ifndef ff_log2_16bit -# define ff_log2_16bit av_log2 -# endif -#endif /* ff_log2 */ - -#endif /* AV_GCC_VERSION_AT_LEAST(3,4) */ - -extern const uint8_t ff_log2_tab[256]; - -#ifndef ff_log2 -#define ff_log2 ff_log2_c -static av_always_inline av_const int ff_log2_c(unsigned int v) -{ - int n = 0; - if (v & 0xffff0000) { - v >>= 16; - n += 16; - } - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} -#endif - -#ifndef ff_log2_16bit -#define ff_log2_16bit ff_log2_16bit_c -static av_always_inline av_const int ff_log2_16bit_c(unsigned int v) -{ - int n = 0; - if (v & 0xff00) { - v >>= 8; - n += 8; - } - n += ff_log2_tab[v]; - - return n; -} -#endif - -#define av_log2 ff_log2 -#define av_log2_16bit ff_log2_16bit - -/** - * @} - */ - -/** - * @addtogroup lavu_math - * @{ - */ - -#if HAVE_FAST_CLZ && AV_GCC_VERSION_AT_LEAST(3,4) -#ifndef ff_ctz -#define ff_ctz(v) __builtin_ctz(v) -#endif -#endif - -#ifndef ff_ctz -#define ff_ctz ff_ctz_c -static av_always_inline av_const int ff_ctz_c(int v) -{ - int c; - - if (v & 0x1) - return 0; - - c = 1; - if (!(v & 0xffff)) { - v >>= 16; - c += 16; - } - if (!(v & 0xff)) { - v >>= 8; - c += 8; - } - if (!(v & 0xf)) { - v >>= 4; - c += 4; - } - if (!(v & 0x3)) { - v >>= 2; - c += 2; - } - c -= v & 0x1; - - return c; -} -#endif - -/** - * Trailing zero bit count. - * - * @param v input value. If v is 0, the result is undefined. - * @return the number of trailing 0-bits - */ -int av_ctz(int v); - -/** - * @} - */ -#endif /* AVUTIL_INTMATH_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lfg.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lfg.c deleted file mode 100644 index ffa2f1fd3..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lfg.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Lagged Fibonacci PRNG - * Copyright (c) 2008 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include "lfg.h" -#include "md5.h" -#include "intreadwrite.h" -#include "attributes.h" - -av_cold void av_lfg_init(AVLFG *c, unsigned int seed) -{ - uint8_t tmp[16] = { 0 }; - int i; - - for (i = 8; i < 64; i += 4) { - AV_WL32(tmp, seed); - tmp[4] = i; - av_md5_sum(tmp, tmp, 16); - c->state[i ] = AV_RL32(tmp); - c->state[i + 1] = AV_RL32(tmp + 4); - c->state[i + 2] = AV_RL32(tmp + 8); - c->state[i + 3] = AV_RL32(tmp + 12); - } - c->index = 0; -} - -void av_bmg_get(AVLFG *lfg, double out[2]) -{ - double x1, x2, w; - - do { - x1 = 2.0 / UINT_MAX * av_lfg_get(lfg) - 1.0; - x2 = 2.0 / UINT_MAX * av_lfg_get(lfg) - 1.0; - w = x1 * x1 + x2 * x2; - } while (w >= 1.0); - - w = sqrt((-2.0 * log(w)) / w); - out[0] = x1 * w; - out[1] = x2 * w; -} - -#ifdef TEST -#include "log.h" -#include "timer.h" - -int main(void) -{ - int x = 0; - int i, j; - AVLFG state; - - av_lfg_init(&state, 0xdeadbeef); - for (j = 0; j < 10000; j++) { - START_TIMER - for (i = 0; i < 624; i++) { - //av_log(NULL, AV_LOG_ERROR, "%X\n", av_lfg_get(&state)); - x += av_lfg_get(&state); - } - STOP_TIMER("624 calls of av_lfg_get"); - } - av_log(NULL, AV_LOG_ERROR, "final value:%X\n", x); - - /* BMG usage example */ - { - double mean = 1000; - double stddev = 53; - - av_lfg_init(&state, 42); - - for (i = 0; i < 1000; i += 2) { - double bmg_out[2]; - av_bmg_get(&state, bmg_out); - av_log(NULL, AV_LOG_INFO, - "%f\n%f\n", - bmg_out[0] * stddev + mean, - bmg_out[1] * stddev + mean); - } - } - - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/libm.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/libm.h deleted file mode 100644 index 6c17b287b..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/libm.h +++ /dev/null @@ -1,189 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Replacements for frequently missing libm functions - */ - -#ifndef AVUTIL_LIBM_H -#define AVUTIL_LIBM_H - -#include -#include "config.h" -#include "attributes.h" -#include "intfloat.h" - -#if HAVE_MIPSFPU && HAVE_INLINE_ASM -#include "libavutil/mips/libm_mips.h" -#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM*/ - -#if !HAVE_ATANF -#undef atanf -#define atanf(x) ((float)atan(x)) -#endif - -#if !HAVE_ATAN2F -#undef atan2f -#define atan2f(y, x) ((float)atan2(y, x)) -#endif - -#if !HAVE_POWF -#undef powf -#define powf(x, y) ((float)pow(x, y)) -#endif - -#if !HAVE_CBRT -static av_always_inline double cbrt(double x) -{ - return x < 0 ? -pow(-x, 1.0 / 3.0) : pow(x, 1.0 / 3.0); -} -#endif - -#if !HAVE_CBRTF -static av_always_inline float cbrtf(float x) -{ - return x < 0 ? -powf(-x, 1.0 / 3.0) : powf(x, 1.0 / 3.0); -} -#endif - -#if !HAVE_COSF -#undef cosf -#define cosf(x) ((float)cos(x)) -#endif - -#if !HAVE_EXPF -#undef expf -#define expf(x) ((float)exp(x)) -#endif - -#if !HAVE_EXP2 -#undef exp2 -#define exp2(x) exp((x) * 0.693147180559945) -#endif /* HAVE_EXP2 */ - -#if !HAVE_EXP2F -#undef exp2f -#define exp2f(x) ((float)exp2(x)) -#endif /* HAVE_EXP2F */ - -#if !HAVE_ISINF -static av_always_inline av_const int isinf(float x) -{ - uint32_t v = av_float2int(x); - if ((v & 0x7f800000) != 0x7f800000) - return 0; - return !(v & 0x007fffff); -} -#endif /* HAVE_ISINF */ - -#if !HAVE_ISNAN -static av_always_inline av_const int isnan(float x) -{ - uint32_t v = av_float2int(x); - if ((v & 0x7f800000) != 0x7f800000) - return 0; - return v & 0x007fffff; -} -#endif /* HAVE_ISNAN */ - -#if !HAVE_LDEXPF -#undef ldexpf -#define ldexpf(x, exp) ((float)ldexp(x, exp)) -#endif - -#if !HAVE_LLRINT -#undef llrint -#define llrint(x) ((long long)rint(x)) -#endif /* HAVE_LLRINT */ - -#if !HAVE_LLRINTF -#undef llrintf -#define llrintf(x) ((long long)rint(x)) -#endif /* HAVE_LLRINT */ - -#if !HAVE_LOG2 -#undef log2 -#define log2(x) (log(x) * 1.44269504088896340736) -#endif /* HAVE_LOG2 */ - -#if !HAVE_LOG2F -#undef log2f -#define log2f(x) ((float)log2(x)) -#endif /* HAVE_LOG2F */ - -#if !HAVE_LOG10F -#undef log10f -#define log10f(x) ((float)log10(x)) -#endif - -#if !HAVE_SINF -#undef sinf -#define sinf(x) ((float)sin(x)) -#endif - -#if !HAVE_RINT -static inline double rint(double x) -{ - return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5); -} -#endif /* HAVE_RINT */ - -#if !HAVE_LRINT -static av_always_inline av_const long int lrint(double x) -{ - return rint(x); -} -#endif /* HAVE_LRINT */ - -#if !HAVE_LRINTF -static av_always_inline av_const long int lrintf(float x) -{ - return (int)(rint(x)); -} -#endif /* HAVE_LRINTF */ - -#if !HAVE_ROUND -static av_always_inline av_const double round(double x) -{ - return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); -} -#endif /* HAVE_ROUND */ - -#if !HAVE_ROUNDF -static av_always_inline av_const float roundf(float x) -{ - return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); -} -#endif /* HAVE_ROUNDF */ - -#if !HAVE_TRUNC -static av_always_inline av_const double trunc(double x) -{ - return (x > 0) ? floor(x) : ceil(x); -} -#endif /* HAVE_TRUNC */ - -#if !HAVE_TRUNCF -static av_always_inline av_const float truncf(float x) -{ - return (x > 0) ? floor(x) : ceil(x); -} -#endif /* HAVE_TRUNCF */ - -#endif /* AVUTIL_LIBM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.c deleted file mode 100644 index 06a0eb8c7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * linear least squares model - */ - -#include -#include - -#include "config.h" -#include "attributes.h" -#include "version.h" -#include "lls2.h" - -static void update_lls(LLSModel2 *m, double *var) -{ - int i, j; - - for (i = 0; i <= m->indep_count; i++) { - for (j = i; j <= m->indep_count; j++) { - m->covariance[i][j] += var[i] * var[j]; - } - } -} - -void avpriv_solve_lls2(LLSModel2 *m, double threshold, unsigned short min_order) -{ - int i, j, k; - double (*factor)[MAX_VARS_ALIGN] = (void *) &m->covariance[1][0]; - double (*covar) [MAX_VARS_ALIGN] = (void *) &m->covariance[1][1]; - double *covar_y = m->covariance[0]; - int count = m->indep_count; - - for (i = 0; i < count; i++) { - for (j = i; j < count; j++) { - double sum = covar[i][j]; - - for (k = i - 1; k >= 0; k--) - sum -= factor[i][k] * factor[j][k]; - - if (i == j) { - if (sum < threshold) - sum = 1.0; - factor[i][i] = sqrt(sum); - } else { - factor[j][i] = sum / factor[i][i]; - } - } - } - - for (i = 0; i < count; i++) { - double sum = covar_y[i + 1]; - - for (k = i - 1; k >= 0; k--) - sum -= factor[i][k] * m->coeff[0][k]; - - m->coeff[0][i] = sum / factor[i][i]; - } - - for (j = count - 1; j >= min_order; j--) { - for (i = j; i >= 0; i--) { - double sum = m->coeff[0][i]; - - for (k = i + 1; k <= j; k++) - sum -= factor[k][i] * m->coeff[j][k]; - - m->coeff[j][i] = sum / factor[i][i]; - } - - m->variance[j] = covar_y[0]; - - for (i = 0; i <= j; i++) { - double sum = m->coeff[j][i] * covar[i][i] - 2 * covar_y[i + 1]; - - for (k = 0; k < i; k++) - sum += 2 * m->coeff[j][k] * covar[k][i]; - - m->variance[j] += m->coeff[j][i] * sum; - } - } -} - -static double evaluate_lls(LLSModel2 *m, double *param, int order) -{ - int i; - double out = 0; - - for (i = 0; i <= order; i++) - out += param[i] * m->coeff[order][i]; - - return out; -} - -av_cold void avpriv_init_lls2(LLSModel2 *m, int indep_count) -{ - memset(m, 0, sizeof(LLSModel2)); - m->indep_count = indep_count; - m->update_lls = update_lls; - m->evaluate_lls = evaluate_lls; - if (ARCH_X86) - ff_init_lls_x86(m); -} - -#ifdef TEST - -#include -#include -#include "lfg.h" - -int main(void) -{ - LLSModel2 m; - int i, order; - AVLFG lfg; - - av_lfg_init(&lfg, 1); - avpriv_init_lls2(&m, 3); - - for (i = 0; i < 100; i++) { - LOCAL_ALIGNED(32, double, var, [4]); - double eval; - - var[0] = (av_lfg_get(&lfg) / (double) UINT_MAX - 0.5) * 2; - var[1] = var[0] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5; - var[2] = var[1] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5; - var[3] = var[2] + av_lfg_get(&lfg) / (double) UINT_MAX - 0.5; - m.update_lls(&m, var); - avpriv_solve_lls2(&m, 0.001, 0); - for (order = 0; order < 3; order++) { - eval = m.evaluate_lls(&m, var + 1, order); - printf("real:%9f order:%d pred:%9f var:%f coeffs:%f %9f %9f\n", - var[0], order, eval, sqrt(m.variance[order] / (i + 1)), - m.coeff[order][0], m.coeff[order][1], - m.coeff[order][2]); - } - } - return 0; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.h deleted file mode 100644 index 35815d270..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lls2.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_LLS_H -#define AVUTIL_LLS_H - -#include "common.h" -#include "mem.h" -#include "version.h" - -#define MAX_VARS 32 -#define MAX_VARS_ALIGN FFALIGN(MAX_VARS+1,4) - -//FIXME avoid direct access to LLSModel2 from outside - -/** - * Linear least squares model. - */ -typedef struct LLSModel2 { - DECLARE_ALIGNED(32, double, covariance[MAX_VARS_ALIGN][MAX_VARS_ALIGN]); - DECLARE_ALIGNED(32, double, coeff[MAX_VARS][MAX_VARS]); - double variance[MAX_VARS]; - int indep_count; - /** - * Take the outer-product of var[] with itself, and add to the covariance matrix. - * @param m this context - * @param var training samples, starting with the value to be predicted - * 32-byte aligned, and any padding elements must be initialized - * (i.e not denormal/nan). - */ - void (*update_lls)(struct LLSModel2 *m, double *var); - /** - * Inner product of var[] and the LPC coefs. - * @param m this context - * @param var training samples, excluding the value to be predicted. unaligned. - * @param order lpc order - */ - double (*evaluate_lls)(struct LLSModel2 *m, double *var, int order); -} LLSModel2; - -void avpriv_init_lls2(LLSModel2 *m, int indep_count); -void ff_init_lls_x86(LLSModel2 *m); -void avpriv_solve_lls2(LLSModel2 *m, double threshold, unsigned short min_order); - -#endif /* AVUTIL_LLS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.c deleted file mode 100644 index a0bb5e468..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.c +++ /dev/null @@ -1,362 +0,0 @@ -/* - * log functions - * Copyright (c) 2003 Michel Bardiaux - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * logging functions - */ - -#include "config.h" - -#if HAVE_UNISTD_H -#include -#endif -#if HAVE_IO_H -#include -#endif -#include -#include -#include "avutil.h" -#include "bprint.h" -#include "common.h" -#include "internal.h" -#include "log.h" - -#if HAVE_PTHREADS -#include -static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -#endif - -#define LINE_SZ 1024 - -static int av_log_level = AV_LOG_INFO; -static int flags; - -#if HAVE_SETCONSOLETEXTATTRIBUTE -#include -static const uint8_t color[16 + AV_CLASS_CATEGORY_NB] = { - [AV_LOG_PANIC /8] = 12, - [AV_LOG_FATAL /8] = 12, - [AV_LOG_ERROR /8] = 12, - [AV_LOG_WARNING/8] = 14, - [AV_LOG_INFO /8] = 7, - [AV_LOG_VERBOSE/8] = 10, - [AV_LOG_DEBUG /8] = 10, - [16+AV_CLASS_CATEGORY_NA ] = 7, - [16+AV_CLASS_CATEGORY_INPUT ] = 13, - [16+AV_CLASS_CATEGORY_OUTPUT ] = 5, - [16+AV_CLASS_CATEGORY_MUXER ] = 13, - [16+AV_CLASS_CATEGORY_DEMUXER ] = 5, - [16+AV_CLASS_CATEGORY_ENCODER ] = 11, - [16+AV_CLASS_CATEGORY_DECODER ] = 3, - [16+AV_CLASS_CATEGORY_FILTER ] = 10, - [16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 9, - [16+AV_CLASS_CATEGORY_SWSCALER ] = 7, - [16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 7, - [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 13, - [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 5, - [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 13, - [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 5, - [16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 13, - [16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 5, -}; - -static int16_t background, attr_orig; -static HANDLE con; -#else - -static const uint32_t color[16 + AV_CLASS_CATEGORY_NB] = { - [AV_LOG_PANIC /8] = 52 << 16 | 196 << 8 | 0x41, - [AV_LOG_FATAL /8] = 208 << 8 | 0x41, - [AV_LOG_ERROR /8] = 196 << 8 | 0x11, - [AV_LOG_WARNING/8] = 226 << 8 | 0x03, - [AV_LOG_INFO /8] = 253 << 8 | 0x09, - [AV_LOG_VERBOSE/8] = 40 << 8 | 0x02, - [AV_LOG_DEBUG /8] = 34 << 8 | 0x02, - [16+AV_CLASS_CATEGORY_NA ] = 250 << 8 | 0x09, - [16+AV_CLASS_CATEGORY_INPUT ] = 219 << 8 | 0x15, - [16+AV_CLASS_CATEGORY_OUTPUT ] = 201 << 8 | 0x05, - [16+AV_CLASS_CATEGORY_MUXER ] = 213 << 8 | 0x15, - [16+AV_CLASS_CATEGORY_DEMUXER ] = 207 << 8 | 0x05, - [16+AV_CLASS_CATEGORY_ENCODER ] = 51 << 8 | 0x16, - [16+AV_CLASS_CATEGORY_DECODER ] = 39 << 8 | 0x06, - [16+AV_CLASS_CATEGORY_FILTER ] = 155 << 8 | 0x12, - [16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 192 << 8 | 0x14, - [16+AV_CLASS_CATEGORY_SWSCALER ] = 153 << 8 | 0x14, - [16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 147 << 8 | 0x14, - [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 213 << 8 | 0x15, - [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 207 << 8 | 0x05, - [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 213 << 8 | 0x15, - [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT ] = 207 << 8 | 0x05, - [16+AV_CLASS_CATEGORY_DEVICE_OUTPUT ] = 213 << 8 | 0x15, - [16+AV_CLASS_CATEGORY_DEVICE_INPUT ] = 207 << 8 | 0x05, -}; - -#endif -static int use_color = -1; - -static void colored_fputs(int level, const char *str) -{ - if (!*str) - return; - - if (use_color < 0) { -#if HAVE_SETCONSOLETEXTATTRIBUTE - CONSOLE_SCREEN_BUFFER_INFO con_info; - con = GetStdHandle(STD_ERROR_HANDLE); - use_color = (con != INVALID_HANDLE_VALUE) && !getenv("NO_COLOR") && - !getenv("AV_LOG_FORCE_NOCOLOR"); - if (use_color) { - GetConsoleScreenBufferInfo(con, &con_info); - attr_orig = con_info.wAttributes; - background = attr_orig & 0xF0; - } -#elif HAVE_ISATTY - use_color = !getenv("NO_COLOR") && !getenv("AV_LOG_FORCE_NOCOLOR") && - (getenv("TERM") && isatty(2) || - getenv("AV_LOG_FORCE_COLOR")); - if (getenv("AV_LOG_FORCE_256COLOR")) - use_color *= 256; -#else - use_color = getenv("AV_LOG_FORCE_COLOR") && !getenv("NO_COLOR") && - !getenv("AV_LOG_FORCE_NOCOLOR"); -#endif - } - -#if HAVE_SETCONSOLETEXTATTRIBUTE - if (use_color && level != AV_LOG_INFO/8) - SetConsoleTextAttribute(con, background | color[level]); - fputs(str, stderr); - if (use_color && level != AV_LOG_INFO/8) - SetConsoleTextAttribute(con, attr_orig); -#else - if (use_color == 1 && level != AV_LOG_INFO/8) { - fprintf(stderr, - "\033[%d;3%dm%s\033[0m", - (color[level] >> 4) & 15, - color[level] & 15, - str); - } else if (use_color == 256 && level != AV_LOG_INFO/8) { - fprintf(stderr, - "\033[48;5;%dm\033[38;5;%dm%s\033[0m", - (color[level] >> 16) & 0xff, - (color[level] >> 8) & 0xff, - str); - } else - fputs(str, stderr); -#endif - -} - -const char *av_default_item_name(void *ptr) -{ - return (*(AVClass **) ptr)->class_name; -} - -AVClassCategory av_default_get_category(void *ptr) -{ - return (*(AVClass **) ptr)->category; -} - -static void sanitize(uint8_t *line){ - while(*line){ - if(*line < 0x08 || (*line > 0x0D && *line < 0x20)) - *line='?'; - line++; - } -} - -static int get_category(void *ptr){ - AVClass *avc = *(AVClass **) ptr; - if( !avc - || (avc->version&0xFF)<100 - || avc->version < (51 << 16 | 59 << 8) - || avc->category >= AV_CLASS_CATEGORY_NB) return AV_CLASS_CATEGORY_NA + 16; - - if(avc->get_category) - return avc->get_category(ptr) + 16; - - return avc->category + 16; -} - -static void format_line(void *avcl, int level, const char *fmt, va_list vl, - AVBPrint part[3], int *print_prefix, int type[2]) -{ - AVClass* avc = avcl ? *(AVClass **) avcl : NULL; - av_bprint_init(part+0, 0, 1); - av_bprint_init(part+1, 0, 1); - av_bprint_init(part+2, 0, 65536); - - if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16; - if (*print_prefix && avc) { - if (avc->parent_log_context_offset) { - AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) + - avc->parent_log_context_offset); - if (parent && *parent) { - av_bprintf(part+0, "[%s @ %p] ", - (*parent)->item_name(parent), parent); - if(type) type[0] = get_category(parent); - } - } - av_bprintf(part+1, "[%s @ %p] ", - avc->item_name(avcl), avcl); - if(type) type[1] = get_category(avcl); - } - - av_vbprintf(part+2, fmt, vl); - - if(*part[0].str || *part[1].str || *part[2].str) { - char lastc = part[2].len && part[2].len <= part[2].size ? part[2].str[part[2].len - 1] : 0; - *print_prefix = lastc == '\n' || lastc == '\r'; - } -} - -void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, - char *line, int line_size, int *print_prefix) -{ - AVBPrint part[3]; - format_line(ptr, level, fmt, vl, part, print_prefix, NULL); - snprintf(line, line_size, "%s%s%s", part[0].str, part[1].str, part[2].str); - av_bprint_finalize(part+2, NULL); -} - -void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl) -{ - static int print_prefix = 1; - static int count; - static char prev[LINE_SZ]; - AVBPrint part[3]; - char line[LINE_SZ]; - static int is_atty; - int type[2]; - - if (level > av_log_level) - return; -#if HAVE_PTHREADS - pthread_mutex_lock(&mutex); -#endif - - format_line(ptr, level, fmt, vl, part, &print_prefix, type); - snprintf(line, sizeof(line), "%s%s%s", part[0].str, part[1].str, part[2].str); - -#if HAVE_ISATTY - if (!is_atty) - is_atty = isatty(2) ? 1 : -1; -#endif - - if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) && - *line && line[strlen(line) - 1] != '\r'){ - count++; - if (is_atty == 1) - fprintf(stderr, " Last message repeated %d times\r", count); - goto end; - } - if (count > 0) { - fprintf(stderr, " Last message repeated %d times\n", count); - count = 0; - } - strcpy(prev, line); - sanitize(part[0].str); - colored_fputs(type[0], part[0].str); - sanitize(part[1].str); - colored_fputs(type[1], part[1].str); - sanitize(part[2].str); - colored_fputs(av_clip(level >> 3, 0, 6), part[2].str); -end: - av_bprint_finalize(part+2, NULL); -#if HAVE_PTHREADS - pthread_mutex_unlock(&mutex); -#endif -} - -static void (*av_log_callback)(void*, int, const char*, va_list) = - av_log_default_callback; - -void av_log(void* avcl, int level, const char *fmt, ...) -{ - AVClass* avc = avcl ? *(AVClass **) avcl : NULL; - va_list vl; - va_start(vl, fmt); - if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) && - avc->log_level_offset_offset && level >= AV_LOG_FATAL) - level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset); - av_vlog(avcl, level, fmt, vl); - va_end(vl); -} - -void av_vlog(void* avcl, int level, const char *fmt, va_list vl) -{ - void (*log_callback)(void*, int, const char*, va_list) = av_log_callback; - if (log_callback) - log_callback(avcl, level, fmt, vl); -} - -int av_log_get_level(void) -{ - return av_log_level; -} - -void av_log_set_level(int level) -{ - av_log_level = level; -} - -void av_log_set_flags(int arg) -{ - flags = arg; -} - -void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) -{ - av_log_callback = callback; -} - -static void missing_feature_sample(int sample, void *avc, const char *msg, - va_list argument_list) -{ - av_vlog(avc, AV_LOG_WARNING, msg, argument_list); - av_log(avc, AV_LOG_WARNING, " is not implemented. Update your FFmpeg " - "version to the newest one from Git. If the problem still " - "occurs, it means that your file has a feature which has not " - "been implemented.\n"); - if (sample) - av_log(avc, AV_LOG_WARNING, "If you want to help, upload a sample " - "of this file to ftp://upload.ffmpeg.org/MPlayer/incoming/ " - "and contact the ffmpeg-devel mailing list.\n"); -} - -void avpriv_request_sample(void *avc, const char *msg, ...) -{ - va_list argument_list; - - va_start(argument_list, msg); - missing_feature_sample(1, avc, msg, argument_list); - va_end(argument_list); -} - -void avpriv_report_missing_feature(void *avc, const char *msg, ...) -{ - va_list argument_list; - - va_start(argument_list, msg); - missing_feature_sample(0, avc, msg, argument_list); - va_end(argument_list); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log2_tab.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log2_tab.c deleted file mode 100644 index 0dbf07d74..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log2_tab.c +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003-2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -const uint8_t ff_log2_tab[256]={ - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.c deleted file mode 100644 index 30963aa07..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.c +++ /dev/null @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2005-2012 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * miscellaneous math routines and tables - */ - -#include -#include - -#include "mathematics.h" -#include "libavutil/common.h" -#include "avassert.h" -#include "version.h" - -#if FF_API_AV_REVERSE -const uint8_t av_reverse[256]={ -0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0, -0x08,0x88,0x48,0xC8,0x28,0xA8,0x68,0xE8,0x18,0x98,0x58,0xD8,0x38,0xB8,0x78,0xF8, -0x04,0x84,0x44,0xC4,0x24,0xA4,0x64,0xE4,0x14,0x94,0x54,0xD4,0x34,0xB4,0x74,0xF4, -0x0C,0x8C,0x4C,0xCC,0x2C,0xAC,0x6C,0xEC,0x1C,0x9C,0x5C,0xDC,0x3C,0xBC,0x7C,0xFC, -0x02,0x82,0x42,0xC2,0x22,0xA2,0x62,0xE2,0x12,0x92,0x52,0xD2,0x32,0xB2,0x72,0xF2, -0x0A,0x8A,0x4A,0xCA,0x2A,0xAA,0x6A,0xEA,0x1A,0x9A,0x5A,0xDA,0x3A,0xBA,0x7A,0xFA, -0x06,0x86,0x46,0xC6,0x26,0xA6,0x66,0xE6,0x16,0x96,0x56,0xD6,0x36,0xB6,0x76,0xF6, -0x0E,0x8E,0x4E,0xCE,0x2E,0xAE,0x6E,0xEE,0x1E,0x9E,0x5E,0xDE,0x3E,0xBE,0x7E,0xFE, -0x01,0x81,0x41,0xC1,0x21,0xA1,0x61,0xE1,0x11,0x91,0x51,0xD1,0x31,0xB1,0x71,0xF1, -0x09,0x89,0x49,0xC9,0x29,0xA9,0x69,0xE9,0x19,0x99,0x59,0xD9,0x39,0xB9,0x79,0xF9, -0x05,0x85,0x45,0xC5,0x25,0xA5,0x65,0xE5,0x15,0x95,0x55,0xD5,0x35,0xB5,0x75,0xF5, -0x0D,0x8D,0x4D,0xCD,0x2D,0xAD,0x6D,0xED,0x1D,0x9D,0x5D,0xDD,0x3D,0xBD,0x7D,0xFD, -0x03,0x83,0x43,0xC3,0x23,0xA3,0x63,0xE3,0x13,0x93,0x53,0xD3,0x33,0xB3,0x73,0xF3, -0x0B,0x8B,0x4B,0xCB,0x2B,0xAB,0x6B,0xEB,0x1B,0x9B,0x5B,0xDB,0x3B,0xBB,0x7B,0xFB, -0x07,0x87,0x47,0xC7,0x27,0xA7,0x67,0xE7,0x17,0x97,0x57,0xD7,0x37,0xB7,0x77,0xF7, -0x0F,0x8F,0x4F,0xCF,0x2F,0xAF,0x6F,0xEF,0x1F,0x9F,0x5F,0xDF,0x3F,0xBF,0x7F,0xFF, -}; -#endif - -int64_t av_gcd(int64_t a, int64_t b){ - if(b) return av_gcd(b, a%b); - else return a; -} - -int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd){ - int64_t r=0; - av_assert2(c > 0); - av_assert2(b >=0); - av_assert2((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4); - - if (c <= 0 || b < 0 || !((unsigned)(rnd&~AV_ROUND_PASS_MINMAX)<=5 && (rnd&~AV_ROUND_PASS_MINMAX)!=4)) - return INT64_MIN; - - if (rnd & AV_ROUND_PASS_MINMAX) { - if (a == INT64_MIN || a == INT64_MAX) - return a; - rnd -= AV_ROUND_PASS_MINMAX; - } - - if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); - - if(rnd==AV_ROUND_NEAR_INF) r= c/2; - else if(rnd&1) r= c-1; - - if(b<=INT_MAX && c<=INT_MAX){ - if(a<=INT_MAX) - return (a * b + r)/c; - else - return a/c*b + (a%c*b + r)/c; - }else{ -#if 1 - uint64_t a0= a&0xFFFFFFFF; - uint64_t a1= a>>32; - uint64_t b0= b&0xFFFFFFFF; - uint64_t b1= b>>32; - uint64_t t1= a0*b1 + a1*b0; - uint64_t t1a= t1<<32; - int i; - - a0 = a0*b0 + t1a; - a1 = a1*b1 + (t1>>32) + (a0=0; i--){ -// int o= a1 & 0x8000000000000000ULL; - a1+= a1 + ((a0>>i)&1); - t1+=t1; - if(/*o || */c <= a1){ - a1 -= c; - t1++; - } - } - return t1; - } -#else - AVInteger ai; - ai= av_mul_i(av_int2i(a), av_int2i(b)); - ai= av_add_i(ai, av_int2i(r)); - - return av_i2int(av_div_i(ai, av_int2i(c))); - } -#endif -} - -int64_t av_rescale(int64_t a, int64_t b, int64_t c){ - return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); -} - -int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, - enum AVRounding rnd) -{ - int64_t b= bq.num * (int64_t)cq.den; - int64_t c= cq.num * (int64_t)bq.den; - return av_rescale_rnd(a, b, c, rnd); -} - -int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) -{ - return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); -} - -int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ - int64_t a= tb_a.num * (int64_t)tb_b.den; - int64_t b= tb_b.num * (int64_t)tb_a.den; - if((FFABS(ts_a)|a|FFABS(ts_b)|b)<=INT_MAX) - return (ts_a*a > ts_b*b) - (ts_a*a < ts_b*b); - if (av_rescale_rnd(ts_a, a, b, AV_ROUND_DOWN) < ts_b) return -1; - if (av_rescale_rnd(ts_b, b, a, AV_ROUND_DOWN) < ts_a) return 1; - return 0; -} - -int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){ - int64_t c= (a-b) & (mod-1); - if(c > (mod>>1)) - c-= mod; - return c; -} - -int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb){ - int64_t a, b, this; - - av_assert0(in_ts != AV_NOPTS_VALUE); - av_assert0(duration >= 0); - - if (*last == AV_NOPTS_VALUE || !duration || in_tb.num*(int64_t)out_tb.den <= out_tb.num*(int64_t)in_tb.den) { -simple_round: - *last = av_rescale_q(in_ts, in_tb, fs_tb) + duration; - return av_rescale_q(in_ts, in_tb, out_tb); - } - - a = av_rescale_q_rnd(2*in_ts-1, in_tb, fs_tb, AV_ROUND_DOWN) >>1; - b = (av_rescale_q_rnd(2*in_ts+1, in_tb, fs_tb, AV_ROUND_UP )+1)>>1; - if (*last < 2*a - b || *last > 2*b - a) - goto simple_round; - - this = av_clip64(*last, a, b); - *last = this + duration; - - return av_rescale_q(this, fs_tb, out_tb); -} - -int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc) -{ - AVRational step = av_mul_q(inc_tb, (AVRational) {inc, 1}); - - if (av_cmp_q(step, ts_tb) < 0) { - //increase step is too small for even 1 step to be representable - return ts; - } else { - int64_t old = av_rescale_q(ts, ts_tb, step); - int64_t old_ts = av_rescale_q(old, step, ts_tb); - return av_rescale_q(old + 1, step, ts_tb) + (ts - old_ts); - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/md5.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/md5.c deleted file mode 100644 index 683d2c892..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/md5.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (C) 2006 Michael Niedermayer (michaelni@gmx.at) - * Copyright (C) 2003-2005 by Christopher R. Hertel (crh@ubiqx.mn.org) - * - * References: - * IETF RFC 1321: The MD5 Message-Digest Algorithm - * Ron Rivest. IETF, April, 1992 - * - * based on http://ubiqx.org/libcifs/source/Auth/MD5.c - * from Christopher R. Hertel (crh@ubiqx.mn.org) - * Simplified, cleaned and IMO redundant comments removed by michael. - * - * If you use gcc, then version 4.1 or later and -fomit-frame-pointer is - * strongly recommended. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include "config.h" -#include "bswap.h" -#include "intreadwrite.h" -#include "md5.h" -#include "mem.h" - -typedef struct AVMD5{ - uint64_t len; - uint8_t block[64]; - uint32_t ABCD[4]; -} AVMD5; - -const int av_md5_size = sizeof(AVMD5); - -struct AVMD5 *av_md5_alloc(void) -{ - return av_mallocz(sizeof(struct AVMD5)); -} - -static const uint8_t S[4][4] = { - { 7, 12, 17, 22 }, /* round 1 */ - { 5, 9, 14, 20 }, /* round 2 */ - { 4, 11, 16, 23 }, /* round 3 */ - { 6, 10, 15, 21 } /* round 4 */ -}; - -static const uint32_t T[64] = { // T[i]= fabs(sin(i+1)<<32) - 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, /* round 1 */ - 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, - 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, - 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, - - 0xf61e2562, 0xc040b340, 0x265e5a51, 0xe9b6c7aa, /* round 2 */ - 0xd62f105d, 0x02441453, 0xd8a1e681, 0xe7d3fbc8, - 0x21e1cde6, 0xc33707d6, 0xf4d50d87, 0x455a14ed, - 0xa9e3e905, 0xfcefa3f8, 0x676f02d9, 0x8d2a4c8a, - - 0xfffa3942, 0x8771f681, 0x6d9d6122, 0xfde5380c, /* round 3 */ - 0xa4beea44, 0x4bdecfa9, 0xf6bb4b60, 0xbebfbc70, - 0x289b7ec6, 0xeaa127fa, 0xd4ef3085, 0x04881d05, - 0xd9d4d039, 0xe6db99e5, 0x1fa27cf8, 0xc4ac5665, - - 0xf4292244, 0x432aff97, 0xab9423a7, 0xfc93a039, /* round 4 */ - 0x655b59c3, 0x8f0ccc92, 0xffeff47d, 0x85845dd1, - 0x6fa87e4f, 0xfe2ce6e0, 0xa3014314, 0x4e0811a1, - 0xf7537e82, 0xbd3af235, 0x2ad7d2bb, 0xeb86d391, -}; - -#define CORE(i, a, b, c, d) do { \ - t = S[i >> 4][i & 3]; \ - a += T[i]; \ - \ - if (i < 32) { \ - if (i < 16) a += (d ^ (b & (c ^ d))) + X[ i & 15]; \ - else a += ((d & b) | (~d & c)) + X[(1 + 5*i) & 15]; \ - } else { \ - if (i < 48) a += (b ^ c ^ d) + X[(5 + 3*i) & 15]; \ - else a += (c ^ (b | ~d)) + X[( 7*i) & 15]; \ - } \ - a = b + (a << t | a >> (32 - t)); \ - } while (0) - -static void body(uint32_t ABCD[4], uint32_t *src, int nblocks) -{ - int i av_unused; - int n; - uint32_t a, b, c, d, t, *X; - - for (n = 0; n < nblocks; n++) { - a = ABCD[3]; - b = ABCD[2]; - c = ABCD[1]; - d = ABCD[0]; - - X = src + n * 16; - -#if HAVE_BIGENDIAN - for (i = 0; i < 16; i++) - X[i] = av_bswap32(X[i]); -#endif - -#if CONFIG_SMALL - for (i = 0; i < 64; i++) { - CORE(i, a, b, c, d); - t = d; - d = c; - c = b; - b = a; - a = t; - } -#else -#define CORE2(i) \ - CORE( i, a,b,c,d); CORE((i+1),d,a,b,c); \ - CORE((i+2),c,d,a,b); CORE((i+3),b,c,d,a) -#define CORE4(i) CORE2(i); CORE2((i+4)); CORE2((i+8)); CORE2((i+12)) - CORE4(0); CORE4(16); CORE4(32); CORE4(48); -#endif - - ABCD[0] += d; - ABCD[1] += c; - ABCD[2] += b; - ABCD[3] += a; - } -} - -void av_md5_init(AVMD5 *ctx) -{ - ctx->len = 0; - - ctx->ABCD[0] = 0x10325476; - ctx->ABCD[1] = 0x98badcfe; - ctx->ABCD[2] = 0xefcdab89; - ctx->ABCD[3] = 0x67452301; -} - -void av_md5_update(AVMD5 *ctx, const uint8_t *src, int len) -{ - const uint8_t *end; - int j; - - j = ctx->len & 63; - ctx->len += len; - - if (j) { - int cnt = FFMIN(len, 64 - j); - memcpy(ctx->block + j, src, cnt); - src += cnt; - len -= cnt; - if (j + cnt < 64) - return; - body(ctx->ABCD, (uint32_t *)ctx->block, 1); - } - - end = src + (len & ~63); - if (HAVE_BIGENDIAN || (!HAVE_FAST_UNALIGNED && ((intptr_t)src & 3))) { - while (src < end) { - memcpy(ctx->block, src, 64); - body(ctx->ABCD, (uint32_t *) ctx->block, 1); - src += 64; - } - } else { - int nblocks = len / 64; - body(ctx->ABCD, (uint32_t *)src, nblocks); - src = end; - } - len &= 63; - if (len > 0) - memcpy(ctx->block, src, len); -} - -void av_md5_final(AVMD5 *ctx, uint8_t *dst) -{ - int i; - uint64_t finalcount = av_le2ne64(ctx->len << 3); - - av_md5_update(ctx, (const unsigned char *) "\200", 1); - while ((ctx->len & 63) != 56) - av_md5_update(ctx, (const unsigned char *) "", 1); - - av_md5_update(ctx, (uint8_t *)&finalcount, 8); - - for (i = 0; i < 4; i++) - AV_WL32(dst + 4*i, ctx->ABCD[3 - i]); -} - -void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len) -{ - AVMD5 ctx; - - av_md5_init(&ctx); - av_md5_update(&ctx, src, len); - av_md5_final(&ctx, dst); -} - -#ifdef TEST -#include - -static void print_md5(uint8_t *md5) -{ - int i; - for (i = 0; i < 16; i++) - printf("%02x", md5[i]); - printf("\n"); -} - -int main(void){ - uint8_t md5val[16]; - int i; - uint8_t in[1000]; - - for (i = 0; i < 1000; i++) - in[i] = i * i; - av_md5_sum(md5val, in, 1000); print_md5(md5val); - av_md5_sum(md5val, in, 63); print_md5(md5val); - av_md5_sum(md5val, in, 64); print_md5(md5val); - av_md5_sum(md5val, in, 65); print_md5(md5val); - for (i = 0; i < 1000; i++) - in[i] = i % 127; - av_md5_sum(md5val, in, 999); print_md5(md5val); - - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.c deleted file mode 100644 index 10b0137a7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.c +++ /dev/null @@ -1,504 +0,0 @@ -/* - * default memory allocator for libavutil - * Copyright (c) 2002 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * default memory allocator for libavutil - */ - -#define _XOPEN_SOURCE 600 - -#include "config.h" - -#include -#include -#include -#include -#if HAVE_MALLOC_H -#include -#endif - -#include "avassert.h" -#include "avutil.h" -#include "common.h" -#include "intreadwrite.h" -#include "mem.h" - -#ifdef MALLOC_PREFIX - -#define malloc AV_JOIN(MALLOC_PREFIX, malloc) -#define memalign AV_JOIN(MALLOC_PREFIX, memalign) -#define posix_memalign AV_JOIN(MALLOC_PREFIX, posix_memalign) -#define realloc AV_JOIN(MALLOC_PREFIX, realloc) -#define free AV_JOIN(MALLOC_PREFIX, free) - -void *malloc(size_t size); -void *memalign(size_t align, size_t size); -int posix_memalign(void **ptr, size_t align, size_t size); -void *realloc(void *ptr, size_t size); -void free(void *ptr); - -#endif /* MALLOC_PREFIX */ - -#define ALIGN (HAVE_AVX ? 32 : 16) - -/* NOTE: if you want to override these functions with your own - * implementations (not recommended) you have to link libav* as - * dynamic libraries and remove -Wl,-Bsymbolic from the linker flags. - * Note that this will cost performance. */ - -static size_t max_alloc_size= INT_MAX; - -void av_max_alloc(size_t max){ - max_alloc_size = max; -} - -void *av_malloc(size_t size) -{ - void *ptr = NULL; -#if CONFIG_MEMALIGN_HACK - long diff; -#endif - - /* let's disallow possibly ambiguous cases */ - if (size > (max_alloc_size - 32)) - return NULL; - -#if CONFIG_MEMALIGN_HACK - ptr = malloc(size + ALIGN); - if (!ptr) - return ptr; - diff = ((~(long)ptr)&(ALIGN - 1)) + 1; - ptr = (char *)ptr + diff; - ((char *)ptr)[-1] = diff; -#elif HAVE_POSIX_MEMALIGN - if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation - if (posix_memalign(&ptr, ALIGN, size)) - ptr = NULL; -#elif HAVE_ALIGNED_MALLOC - ptr = _aligned_malloc(size, ALIGN); -#elif HAVE_MEMALIGN -#ifndef __DJGPP__ - ptr = memalign(ALIGN, size); -#else - ptr = memalign(size, ALIGN); -#endif - /* Why 64? - * Indeed, we should align it: - * on 4 for 386 - * on 16 for 486 - * on 32 for 586, PPro - K6-III - * on 64 for K7 (maybe for P3 too). - * Because L1 and L2 caches are aligned on those values. - * But I don't want to code such logic here! - */ - /* Why 32? - * For AVX ASM. SSE / NEON needs only 16. - * Why not larger? Because I did not see a difference in benchmarks ... - */ - /* benchmarks with P3 - * memalign(64) + 1 3071, 3051, 3032 - * memalign(64) + 2 3051, 3032, 3041 - * memalign(64) + 4 2911, 2896, 2915 - * memalign(64) + 8 2545, 2554, 2550 - * memalign(64) + 16 2543, 2572, 2563 - * memalign(64) + 32 2546, 2545, 2571 - * memalign(64) + 64 2570, 2533, 2558 - * - * BTW, malloc seems to do 8-byte alignment by default here. - */ -#else - ptr = malloc(size); -#endif - if(!ptr && !size) { - size = 1; - ptr= av_malloc(1); - } -#if CONFIG_MEMORY_POISONING - if (ptr) - memset(ptr, FF_MEMORY_POISON, size); -#endif - return ptr; -} - -void *av_realloc(void *ptr, size_t size) -{ -#if CONFIG_MEMALIGN_HACK - int diff; -#endif - - /* let's disallow possibly ambiguous cases */ - if (size > (max_alloc_size - 32)) - return NULL; - -#if CONFIG_MEMALIGN_HACK - //FIXME this isn't aligned correctly, though it probably isn't needed - if (!ptr) - return av_malloc(size); - diff = ((char *)ptr)[-1]; - av_assert0(diff>0 && diff<=ALIGN); - ptr = realloc((char *)ptr - diff, size + diff); - if (ptr) - ptr = (char *)ptr + diff; - return ptr; -#elif HAVE_ALIGNED_MALLOC - return _aligned_realloc(ptr, size + !size, ALIGN); -#else - return realloc(ptr, size + !size); -#endif -} - -void *av_realloc_f(void *ptr, size_t nelem, size_t elsize) -{ - size_t size; - void *r; - - if (av_size_mult(elsize, nelem, &size)) { - av_free(ptr); - return NULL; - } - r = av_realloc(ptr, size); - if (!r && size) - av_free(ptr); - return r; -} - -int av_reallocp(void *ptr, size_t size) -{ - void **ptrptr = ptr; - void *ret; - - if (!size) { - av_freep(ptr); - return 0; - } - ret = av_realloc(*ptrptr, size); - - if (!ret) { - av_freep(ptr); - return AVERROR(ENOMEM); - } - - *ptrptr = ret; - return 0; -} - -void *av_realloc_array(void *ptr, size_t nmemb, size_t size) -{ - if (!size || nmemb >= INT_MAX / size) - return NULL; - return av_realloc(ptr, nmemb * size); -} - -int av_reallocp_array(void *ptr, size_t nmemb, size_t size) -{ - void **ptrptr = ptr; - *ptrptr = av_realloc_f(*ptrptr, nmemb, size); - if (!*ptrptr && nmemb && size) - return AVERROR(ENOMEM); - return 0; -} - -void av_free(void *ptr) -{ -#if CONFIG_MEMALIGN_HACK - if (ptr) { - int v= ((char *)ptr)[-1]; - av_assert0(v>0 && v<=ALIGN); - free((char *)ptr - v); - } -#elif HAVE_ALIGNED_MALLOC - _aligned_free(ptr); -#else - free(ptr); -#endif -} - -void av_freep(void *arg) -{ - void **ptr = (void **)arg; - av_free(*ptr); - *ptr = NULL; -} - -void *av_mallocz(size_t size) -{ - void *ptr = av_malloc(size); - if (ptr) - memset(ptr, 0, size); - return ptr; -} - -void *av_calloc(size_t nmemb, size_t size) -{ - if (size <= 0 || nmemb >= INT_MAX / size) - return NULL; - return av_mallocz(nmemb * size); -} - -char *av_strdup(const char *s) -{ - char *ptr = NULL; - if (s) { - int len = strlen(s) + 1; - ptr = av_realloc(NULL, len); - if (ptr) - memcpy(ptr, s, len); - } - return ptr; -} - -void *av_memdup(const void *p, size_t size) -{ - void *ptr = NULL; - if (p) { - ptr = av_malloc(size); - if (ptr) - memcpy(ptr, p, size); - } - return ptr; -} - -void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem) -{ - /* see similar ffmpeg.c:grow_array() */ - int nb, nb_alloc; - intptr_t *tab; - - nb = *nb_ptr; - tab = *(intptr_t**)tab_ptr; - if ((nb & (nb - 1)) == 0) { - if (nb == 0) { - nb_alloc = 1; - } else { - if (nb > INT_MAX / (2 * sizeof(intptr_t))) - goto fail; - nb_alloc = nb * 2; - } - tab = av_realloc(tab, nb_alloc * sizeof(intptr_t)); - if (!tab) - goto fail; - *(intptr_t**)tab_ptr = tab; - } - tab[nb++] = (intptr_t)elem; - *nb_ptr = nb; - return; - -fail: - av_freep(tab_ptr); - *nb_ptr = 0; -} - -void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, - const uint8_t *elem_data) -{ - int nb = *nb_ptr, nb_alloc; - uint8_t *tab = *tab_ptr, *tab_elem_data; - - if ((nb & (nb - 1)) == 0) { - if (nb == 0) { - nb_alloc = 1; - } else { - if (nb > INT_MAX / (2 * elem_size)) - goto fail; - nb_alloc = nb * 2; - } - tab = av_realloc(tab, nb_alloc * elem_size); - if (!tab) - goto fail; - *tab_ptr = tab; - } - *nb_ptr = nb + 1; - tab_elem_data = tab + nb*elem_size; - if (elem_data) - memcpy(tab_elem_data, elem_data, elem_size); - else if (CONFIG_MEMORY_POISONING) - memset(tab_elem_data, FF_MEMORY_POISON, elem_size); - return tab_elem_data; - -fail: - av_freep(tab_ptr); - *nb_ptr = 0; - return NULL; -} - -static void fill16(uint8_t *dst, int len) -{ - uint32_t v = AV_RN16(dst - 2); - - v |= v << 16; - - while (len >= 4) { - AV_WN32(dst, v); - dst += 4; - len -= 4; - } - - while (len--) { - *dst = dst[-2]; - dst++; - } -} - -static void fill24(uint8_t *dst, int len) -{ -#if HAVE_BIGENDIAN - uint32_t v = AV_RB24(dst - 3); - uint32_t a = v << 8 | v >> 16; - uint32_t b = v << 16 | v >> 8; - uint32_t c = v << 24 | v; -#else - uint32_t v = AV_RL24(dst - 3); - uint32_t a = v | v << 24; - uint32_t b = v >> 8 | v << 16; - uint32_t c = v >> 16 | v << 8; -#endif - - while (len >= 12) { - AV_WN32(dst, a); - AV_WN32(dst + 4, b); - AV_WN32(dst + 8, c); - dst += 12; - len -= 12; - } - - if (len >= 4) { - AV_WN32(dst, a); - dst += 4; - len -= 4; - } - - if (len >= 4) { - AV_WN32(dst, b); - dst += 4; - len -= 4; - } - - while (len--) { - *dst = dst[-3]; - dst++; - } -} - -static void fill32(uint8_t *dst, int len) -{ - uint32_t v = AV_RN32(dst - 4); - - while (len >= 4) { - AV_WN32(dst, v); - dst += 4; - len -= 4; - } - - while (len--) { - *dst = dst[-4]; - dst++; - } -} - -void av_memcpy_backptr(uint8_t *dst, int back, int cnt) -{ - const uint8_t *src = &dst[-back]; - if (!back) - return; - - if (back == 1) { - memset(dst, *src, cnt); - } else if (back == 2) { - fill16(dst, cnt); - } else if (back == 3) { - fill24(dst, cnt); - } else if (back == 4) { - fill32(dst, cnt); - } else { - if (cnt >= 16) { - int blocklen = back; - while (cnt > blocklen) { - memcpy(dst, src, blocklen); - dst += blocklen; - cnt -= blocklen; - blocklen <<= 1; - } - memcpy(dst, src, cnt); - return; - } - if (cnt >= 8) { - AV_COPY32U(dst, src); - AV_COPY32U(dst + 4, src + 4); - src += 8; - dst += 8; - cnt -= 8; - } - if (cnt >= 4) { - AV_COPY32U(dst, src); - src += 4; - dst += 4; - cnt -= 4; - } - if (cnt >= 2) { - AV_COPY16U(dst, src); - src += 2; - dst += 2; - cnt -= 2; - } - if (cnt) - *dst = *src; - } -} - -void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size) -{ - if (min_size < *size) - return ptr; - - min_size = FFMAX(17 * min_size / 16 + 32, min_size); - - ptr = av_realloc(ptr, min_size); - /* we could set this to the unmodified min_size but this is safer - * if the user lost the ptr and uses NULL now - */ - if (!ptr) - min_size = 0; - - *size = min_size; - - return ptr; -} - -static inline int ff_fast_malloc(void *ptr, unsigned int *size, size_t min_size, int zero_realloc) -{ - void **p = ptr; - if (min_size < *size) - return 0; - min_size = FFMAX(17 * min_size / 16 + 32, min_size); - av_free(*p); - *p = zero_realloc ? av_mallocz(min_size) : av_malloc(min_size); - if (!*p) - min_size = 0; - *size = min_size; - return 1; -} - -void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) -{ - ff_fast_malloc(ptr, size, min_size, 0); -} - diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.c deleted file mode 100644 index 652a2ddbb..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.c +++ /dev/null @@ -1,1762 +0,0 @@ -/* - * AVOptions - * Copyright (c) 2005 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * AVOptions - * @author Michael Niedermayer - */ - -#include "avutil.h" -#include "avstring.h" -#include "channel_layout.h" -#include "common.h" -#include "opt.h" -#include "eval.h" -#include "dict.h" -#include "log.h" -#include "parseutils.h" -#include "pixdesc.h" -#include "mathematics.h" -#include "samplefmt.h" - -#include - -#if FF_API_FIND_OPT -//FIXME order them and do a bin search -const AVOption *av_find_opt(void *v, const char *name, const char *unit, int mask, int flags) -{ - const AVOption *o = NULL; - - while ((o = av_next_option(v, o))) { - if (!strcmp(o->name, name) && (!unit || (o->unit && !strcmp(o->unit, unit))) && (o->flags & mask) == flags) - return o; - } - return NULL; -} -#endif - -#if FF_API_OLD_AVOPTIONS -const AVOption *av_next_option(void *obj, const AVOption *last) -{ - return av_opt_next(obj, last); -} -#endif - -const AVOption *av_opt_next(void *obj, const AVOption *last) -{ - AVClass *class = *(AVClass**)obj; - if (!last && class && class->option && class->option[0].name) - return class->option; - if (last && last[1].name) - return ++last; - return NULL; -} - -static int read_number(const AVOption *o, void *dst, double *num, int *den, int64_t *intnum) -{ - switch (o->type) { - case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0; - case AV_OPT_TYPE_PIXEL_FMT: - case AV_OPT_TYPE_SAMPLE_FMT: - case AV_OPT_TYPE_INT: *intnum = *(int *)dst;return 0; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - case AV_OPT_TYPE_DURATION: - case AV_OPT_TYPE_INT64: *intnum = *(int64_t *)dst;return 0; - case AV_OPT_TYPE_FLOAT: *num = *(float *)dst;return 0; - case AV_OPT_TYPE_DOUBLE: *num = *(double *)dst;return 0; - case AV_OPT_TYPE_RATIONAL: *intnum = ((AVRational*)dst)->num; - *den = ((AVRational*)dst)->den; - return 0; - case AV_OPT_TYPE_CONST: *num = o->default_val.dbl; return 0; - } - return AVERROR(EINVAL); -} - -static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum) -{ - if (o->type != AV_OPT_TYPE_FLAGS && - (o->max * den < num * intnum || o->min * den > num * intnum)) { - av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n", - num*intnum/den, o->name, o->min, o->max); - return AVERROR(ERANGE); - } - if (o->type == AV_OPT_TYPE_FLAGS) { - double d = num*intnum/den; - if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (llrint(d*256) & 255)) { - av_log(obj, AV_LOG_ERROR, - "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n", - num*intnum/den, o->name); - return AVERROR(ERANGE); - } - } - - switch (o->type) { - case AV_OPT_TYPE_FLAGS: - case AV_OPT_TYPE_PIXEL_FMT: - case AV_OPT_TYPE_SAMPLE_FMT: - case AV_OPT_TYPE_INT: *(int *)dst= llrint(num/den)*intnum; break; - case AV_OPT_TYPE_DURATION: - case AV_OPT_TYPE_CHANNEL_LAYOUT: - case AV_OPT_TYPE_INT64: *(int64_t *)dst= llrint(num/den)*intnum; break; - case AV_OPT_TYPE_FLOAT: *(float *)dst= num*intnum/den; break; - case AV_OPT_TYPE_DOUBLE:*(double *)dst= num*intnum/den; break; - case AV_OPT_TYPE_RATIONAL: - if ((int)num == num) *(AVRational*)dst= (AVRational){num*intnum, den}; - else *(AVRational*)dst= av_d2q(num*intnum/den, 1<<24); - break; - default: - return AVERROR(EINVAL); - } - return 0; -} - -static const double const_values[] = { - M_PI, - M_E, - FF_QP2LAMBDA, - 0 -}; - -static const char * const const_names[] = { - "PI", - "E", - "QP2LAMBDA", - 0 -}; - -static int hexchar2int(char c) { - if (c >= '0' && c <= '9') return c - '0'; - if (c >= 'a' && c <= 'f') return c - 'a' + 10; - if (c >= 'A' && c <= 'F') return c - 'A' + 10; - return -1; -} - -static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst) -{ - int *lendst = (int *)(dst + 1); - uint8_t *bin, *ptr; - int len = strlen(val); - - av_freep(dst); - *lendst = 0; - - if (len & 1) - return AVERROR(EINVAL); - len /= 2; - - ptr = bin = av_malloc(len); - while (*val) { - int a = hexchar2int(*val++); - int b = hexchar2int(*val++); - if (a < 0 || b < 0) { - av_free(bin); - return AVERROR(EINVAL); - } - *ptr++ = (a << 4) | b; - } - *dst = bin; - *lendst = len; - - return 0; -} - -static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst) -{ - av_freep(dst); - *dst = av_strdup(val); - return 0; -} - -#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \ - opt->type == AV_OPT_TYPE_CONST || \ - opt->type == AV_OPT_TYPE_FLAGS || \ - opt->type == AV_OPT_TYPE_INT) ? \ - opt->default_val.i64 : opt->default_val.dbl) - -static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst) -{ - int ret = 0, notfirst = 0; - int num, den; - char c; - - if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) { - if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0) - return ret; - ret = 0; - } - - for (;;) { - int i, den = 1; - char buf[256]; - int cmd = 0; - double d, num = 1; - int64_t intnum = 1; - - i = 0; - if (*val == '+' || *val == '-') { - if (o->type == AV_OPT_TYPE_FLAGS) - cmd = *(val++); - else if (!notfirst) - buf[i++] = *val; - } - - for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++) - buf[i] = val[i]; - buf[i] = 0; - - { - const AVOption *o_named = av_opt_find(target_obj, buf, o->unit, 0, 0); - if (o_named && o_named->type == AV_OPT_TYPE_CONST) - d = DEFAULT_NUMVAL(o_named); - else if (!strcmp(buf, "default")) d = DEFAULT_NUMVAL(o); - else if (!strcmp(buf, "max" )) d = o->max; - else if (!strcmp(buf, "min" )) d = o->min; - else if (!strcmp(buf, "none" )) d = 0; - else if (!strcmp(buf, "all" )) d = ~0; - else { - int res = av_expr_parse_and_eval(&d, buf, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); - if (res < 0) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); - return res; - } - } - } - if (o->type == AV_OPT_TYPE_FLAGS) { - read_number(o, dst, NULL, NULL, &intnum); - if (cmd == '+') d = intnum | (int64_t)d; - else if (cmd == '-') d = intnum &~(int64_t)d; - } else { - read_number(o, dst, &num, &den, &intnum); - if (cmd == '+') d = notfirst*num*intnum/den + d; - else if (cmd == '-') d = notfirst*num*intnum/den - d; - } - - if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0) - return ret; - val += i; - if (!*val) - return 0; - notfirst = 1; - } - - return 0; -} - -static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst) -{ - int ret; - - if (!val || !strcmp(val, "none")) { - dst[0] = - dst[1] = 0; - return 0; - } - ret = av_parse_video_size(dst, dst + 1, val); - if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val); - return ret; -} - -static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst) -{ - int ret; - if (!val) { - ret = AVERROR(EINVAL); - } else { - ret = av_parse_video_rate(dst, val); - } - if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val); - return ret; -} - -static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst) -{ - int ret; - - if (!val) { - return 0; - } else { - ret = av_parse_color(dst, val, -1, obj); - if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val); - return ret; - } - return 0; -} - -static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst, - int fmt_nb, int ((*get_fmt)(const char *)), const char *desc) -{ - int fmt, min, max; - - if (!val || !strcmp(val, "none")) { - fmt = -1; - } else { - fmt = get_fmt(val); - if (fmt == -1) { - char *tail; - fmt = strtol(val, &tail, 0); - if (*tail || (unsigned)fmt >= fmt_nb) { - av_log(obj, AV_LOG_ERROR, - "Unable to parse option value \"%s\" as %s\n", val, desc); - return AVERROR(EINVAL); - } - } - } - - min = FFMAX(o->min, -1); - max = FFMIN(o->max, fmt_nb-1); - - // hack for compatibility with old ffmpeg - if(min == 0 && max == 0) { - min = -1; - max = fmt_nb-1; - } - - if (fmt < min || fmt > max) { - av_log(obj, AV_LOG_ERROR, - "Value %d for parameter '%s' out of %s format range [%d - %d]\n", - fmt, o->name, desc, min, max); - return AVERROR(ERANGE); - } - - *(int *)dst = fmt; - return 0; -} - -static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) -{ - return set_string_fmt(obj, o, val, dst, - AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format"); -} - -static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst) -{ - return set_string_fmt(obj, o, val, dst, - AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format"); -} - -#if FF_API_OLD_AVOPTIONS -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out) -{ - const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - if (o_out) - *o_out = o; - return av_opt_set(obj, name, val, 0); -} -#endif - -int av_opt_set(void *obj, const char *name, const char *val, int search_flags) -{ - int ret = 0; - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (!val && (o->type != AV_OPT_TYPE_STRING && - o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT && - o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != AV_OPT_TYPE_VIDEO_RATE && - o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR && - o->type != AV_OPT_TYPE_CHANNEL_LAYOUT)) - return AVERROR(EINVAL); - - if (o->flags & AV_OPT_FLAG_READONLY) - return AVERROR(EINVAL); - - dst = ((uint8_t*)target_obj) + o->offset; - switch (o->type) { - case AV_OPT_TYPE_STRING: return set_string(obj, o, val, dst); - case AV_OPT_TYPE_BINARY: return set_string_binary(obj, o, val, dst); - case AV_OPT_TYPE_FLAGS: - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - case AV_OPT_TYPE_FLOAT: - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_RATIONAL: return set_string_number(obj, target_obj, o, val, dst); - case AV_OPT_TYPE_IMAGE_SIZE: return set_string_image_size(obj, o, val, dst); - case AV_OPT_TYPE_VIDEO_RATE: return set_string_video_rate(obj, o, val, dst); - case AV_OPT_TYPE_PIXEL_FMT: return set_string_pixel_fmt(obj, o, val, dst); - case AV_OPT_TYPE_SAMPLE_FMT: return set_string_sample_fmt(obj, o, val, dst); - case AV_OPT_TYPE_DURATION: - if (!val) { - *(int64_t *)dst = 0; - return 0; - } else { - if ((ret = av_parse_time(dst, val, 1)) < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val); - return ret; - } - break; - case AV_OPT_TYPE_COLOR: return set_string_color(obj, o, val, dst); - case AV_OPT_TYPE_CHANNEL_LAYOUT: - if (!val || !strcmp(val, "none")) { - *(int64_t *)dst = 0; - } else { -#if FF_API_GET_CHANNEL_LAYOUT_COMPAT - int64_t cl = ff_get_channel_layout(val, 0); -#else - int64_t cl = av_get_channel_layout(val); -#endif - if (!cl) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val); - ret = AVERROR(EINVAL); - } - *(int64_t *)dst = cl; - return ret; - } - break; - } - - av_log(obj, AV_LOG_ERROR, "Invalid option type.\n"); - return AVERROR(EINVAL); -} - -#define OPT_EVAL_NUMBER(name, opttype, vartype)\ - int av_opt_eval_ ## name(void *obj, const AVOption *o, const char *val, vartype *name ## _out)\ - {\ - if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY)\ - return AVERROR(EINVAL);\ - return set_string_number(obj, obj, o, val, name ## _out);\ - } - -OPT_EVAL_NUMBER(flags, AV_OPT_TYPE_FLAGS, int) -OPT_EVAL_NUMBER(int, AV_OPT_TYPE_INT, int) -OPT_EVAL_NUMBER(int64, AV_OPT_TYPE_INT64, int64_t) -OPT_EVAL_NUMBER(float, AV_OPT_TYPE_FLOAT, float) -OPT_EVAL_NUMBER(double, AV_OPT_TYPE_DOUBLE, double) -OPT_EVAL_NUMBER(q, AV_OPT_TYPE_RATIONAL, AVRational) - -static int set_number(void *obj, const char *name, double num, int den, int64_t intnum, - int search_flags) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - - if (o->flags & AV_OPT_FLAG_READONLY) - return AVERROR(EINVAL); - - dst = ((uint8_t*)target_obj) + o->offset; - return write_number(obj, o, dst, num, den, intnum); -} - -#if FF_API_OLD_AVOPTIONS -const AVOption *av_set_double(void *obj, const char *name, double n) -{ - const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - if (set_number(obj, name, n, 1, 1, 0) < 0) - return NULL; - return o; -} - -const AVOption *av_set_q(void *obj, const char *name, AVRational n) -{ - const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - if (set_number(obj, name, n.num, n.den, 1, 0) < 0) - return NULL; - return o; -} - -const AVOption *av_set_int(void *obj, const char *name, int64_t n) -{ - const AVOption *o = av_opt_find(obj, name, NULL, 0, 0); - if (set_number(obj, name, 1, 1, n, 0) < 0) - return NULL; - return o; -} -#endif - -int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags) -{ - return set_number(obj, name, 1, 1, val, search_flags); -} - -int av_opt_set_double(void *obj, const char *name, double val, int search_flags) -{ - return set_number(obj, name, val, 1, 1, search_flags); -} - -int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags) -{ - return set_number(obj, name, val.num, val.den, 1, search_flags); -} - -int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags) -{ - void *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - uint8_t *ptr; - uint8_t **dst; - int *lendst; - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - - if (o->type != AV_OPT_TYPE_BINARY || o->flags & AV_OPT_FLAG_READONLY) - return AVERROR(EINVAL); - - ptr = len ? av_malloc(len) : NULL; - if (len && !ptr) - return AVERROR(ENOMEM); - - dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset); - lendst = (int *)(dst + 1); - - av_free(*dst); - *dst = ptr; - *lendst = len; - if (len) - memcpy(ptr, val, len); - - return 0; -} - -int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags) -{ - void *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != AV_OPT_TYPE_IMAGE_SIZE) { - av_log(obj, AV_LOG_ERROR, - "The value set by option '%s' is not an image size.\n", o->name); - return AVERROR(EINVAL); - } - if (w<0 || h<0) { - av_log(obj, AV_LOG_ERROR, - "Invalid negative size value %dx%d for size '%s'\n", w, h, o->name); - return AVERROR(EINVAL); - } - *(int *)(((uint8_t *)target_obj) + o->offset) = w; - *(int *)(((uint8_t *)target_obj+sizeof(int)) + o->offset) = h; - return 0; -} - -int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags) -{ - void *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != AV_OPT_TYPE_VIDEO_RATE) { - av_log(obj, AV_LOG_ERROR, - "The value set by option '%s' is not a video rate.\n", o->name); - return AVERROR(EINVAL); - } - if (val.num <= 0 || val.den <= 0) - return AVERROR(EINVAL); - return set_number(obj, name, val.num, val.den, 1, search_flags); -} - -static int set_format(void *obj, const char *name, int fmt, int search_flags, - enum AVOptionType type, const char *desc, int nb_fmts) -{ - void *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, - search_flags, &target_obj); - int min, max; - const AVClass *class = *(AVClass **)obj; - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != type) { - av_log(obj, AV_LOG_ERROR, - "The value set by option '%s' is not a %s format", name, desc); - return AVERROR(EINVAL); - } - -#if LIBAVUTIL_VERSION_MAJOR < 54 - if (class->version && class->version < AV_VERSION_INT(52, 11, 100)) { - min = -1; - max = nb_fmts-1; - } else -#endif - { - min = FFMAX(o->min, -1); - max = FFMIN(o->max, nb_fmts-1); - } - if (fmt < min || fmt > max) { - av_log(obj, AV_LOG_ERROR, - "Value %d for parameter '%s' out of %s format range [%d - %d]\n", - fmt, name, desc, min, max); - return AVERROR(ERANGE); - } - *(int *)(((uint8_t *)target_obj) + o->offset) = fmt; - return 0; -} - -int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags) -{ - return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_PIXEL_FMT, "pixel", AV_PIX_FMT_NB); -} - -int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags) -{ - return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB); -} - -int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags) -{ - void *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) { - av_log(obj, AV_LOG_ERROR, - "The value set by option '%s' is not a channel layout.\n", o->name); - return AVERROR(EINVAL); - } - *(int *)(((int64_t *)target_obj) + o->offset) = cl; - return 0; -} - -#if FF_API_OLD_AVOPTIONS -/** - * - * @param buf a buffer which is used for returning non string values as strings, can be NULL - * @param buf_len allocated length in bytes of buf - */ -const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len) -{ - const AVOption *o = av_opt_find(obj, name, NULL, 0, AV_OPT_SEARCH_CHILDREN); - void *dst; - uint8_t *bin; - int len, i; - if (!o) - return NULL; - if (o->type != AV_OPT_TYPE_STRING && (!buf || !buf_len)) - return NULL; - - dst= ((uint8_t*)obj) + o->offset; - if (o_out) *o_out= o; - - switch (o->type) { - case AV_OPT_TYPE_FLAGS: snprintf(buf, buf_len, "0x%08X",*(int *)dst);break; - case AV_OPT_TYPE_INT: snprintf(buf, buf_len, "%d" , *(int *)dst);break; - case AV_OPT_TYPE_INT64: snprintf(buf, buf_len, "%"PRId64, *(int64_t*)dst);break; - case AV_OPT_TYPE_FLOAT: snprintf(buf, buf_len, "%f" , *(float *)dst);break; - case AV_OPT_TYPE_DOUBLE: snprintf(buf, buf_len, "%f" , *(double *)dst);break; - case AV_OPT_TYPE_RATIONAL: snprintf(buf, buf_len, "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; - case AV_OPT_TYPE_CONST: snprintf(buf, buf_len, "%f" , o->default_val.dbl);break; - case AV_OPT_TYPE_STRING: return *(void**)dst; - case AV_OPT_TYPE_BINARY: - len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); - if (len >= (buf_len + 1)/2) return NULL; - bin = *(uint8_t**)dst; - for (i = 0; i < len; i++) snprintf(buf + i*2, 3, "%02X", bin[i]); - break; - default: return NULL; - } - return buf; -} -#endif - -int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - uint8_t *bin, buf[128]; - int len, i, ret; - int64_t i64; - - if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST)) - return AVERROR_OPTION_NOT_FOUND; - - dst = (uint8_t*)target_obj + o->offset; - - buf[0] = 0; - switch (o->type) { - case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; - case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; - case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; - case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; - case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; - case AV_OPT_TYPE_VIDEO_RATE: - case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; - case AV_OPT_TYPE_CONST: ret = snprintf(buf, sizeof(buf), "%f" , o->default_val.dbl);break; - case AV_OPT_TYPE_STRING: - if (*(uint8_t**)dst) - *out_val = av_strdup(*(uint8_t**)dst); - else - *out_val = av_strdup(""); - return 0; - case AV_OPT_TYPE_BINARY: - len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); - if ((uint64_t)len*2 + 1 > INT_MAX) - return AVERROR(EINVAL); - if (!(*out_val = av_malloc(len*2 + 1))) - return AVERROR(ENOMEM); - bin = *(uint8_t**)dst; - for (i = 0; i < len; i++) - snprintf(*out_val + i*2, 3, "%02X", bin[i]); - return 0; - case AV_OPT_TYPE_IMAGE_SIZE: - ret = snprintf(buf, sizeof(buf), "%dx%d", ((int *)dst)[0], ((int *)dst)[1]); - break; - case AV_OPT_TYPE_PIXEL_FMT: - ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_get_pix_fmt_name(*(enum AVPixelFormat *)dst), "none")); - break; - case AV_OPT_TYPE_SAMPLE_FMT: - ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_get_sample_fmt_name(*(enum AVSampleFormat *)dst), "none")); - break; - case AV_OPT_TYPE_DURATION: - i64 = *(int64_t *)dst; - ret = snprintf(buf, sizeof(buf), "%"PRIi64"d:%02d:%02d.%06d", - i64 / 3600000000, (int)((i64 / 60000000) % 60), - (int)((i64 / 1000000) % 60), (int)(i64 % 1000000)); - break; - case AV_OPT_TYPE_COLOR: - ret = snprintf(buf, sizeof(buf), "0x%02x%02x%02x%02x", ((int *)dst)[0], ((int *)dst)[1], ((int *)dst)[2], ((int *)dst)[3]); - break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - i64 = *(int64_t *)dst; - ret = snprintf(buf, sizeof(buf), "0x%"PRIx64, i64); - break; - default: - return AVERROR(EINVAL); - } - - if (ret >= sizeof(buf)) - return AVERROR(EINVAL); - *out_val = av_strdup(buf); - return 0; -} - -static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum, - int search_flags) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o || !target_obj) - goto error; - - dst = ((uint8_t*)target_obj) + o->offset; - - if (o_out) *o_out= o; - - return read_number(o, dst, num, den, intnum); - -error: - *den=*intnum=0; - return -1; -} - -#if FF_API_OLD_AVOPTIONS -double av_get_double(void *obj, const char *name, const AVOption **o_out) -{ - int64_t intnum=1; - double num=1; - int den=1; - - if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) - return NAN; - return num*intnum/den; -} - -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out) -{ - int64_t intnum=1; - double num=1; - int den=1; - - if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) - return (AVRational){0, 0}; - if (num == 1.0 && (int)intnum == intnum) - return (AVRational){intnum, den}; - else - return av_d2q(num*intnum/den, 1<<24); -} - -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out) -{ - int64_t intnum=1; - double num=1; - int den=1; - - if (get_number(obj, name, o_out, &num, &den, &intnum, 0) < 0) - return -1; - return num*intnum/den; -} -#endif - -int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val) -{ - int64_t intnum = 1; - double num = 1; - int ret, den = 1; - - if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) - return ret; - *out_val = num*intnum/den; - return 0; -} - -int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val) -{ - int64_t intnum = 1; - double num = 1; - int ret, den = 1; - - if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) - return ret; - *out_val = num*intnum/den; - return 0; -} - -int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val) -{ - int64_t intnum = 1; - double num = 1; - int ret, den = 1; - - if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) - return ret; - - if (num == 1.0 && (int)intnum == intnum) - *out_val = (AVRational){intnum, den}; - else - *out_val = av_d2q(num*intnum/den, 1<<24); - return 0; -} - -int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != AV_OPT_TYPE_IMAGE_SIZE) { - av_log(obj, AV_LOG_ERROR, - "The value for option '%s' is not an image size.\n", name); - return AVERROR(EINVAL); - } - - dst = ((uint8_t*)target_obj) + o->offset; - if (w_out) *w_out = *(int *)dst; - if (h_out) *h_out = *((int *)dst+1); - return 0; -} - -int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val) -{ - int64_t intnum = 1; - double num = 1; - int ret, den = 1; - - if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0) - return ret; - - if (num == 1.0 && (int)intnum == intnum) - *out_val = (AVRational){intnum, den}; - else - *out_val = av_d2q(num*intnum/den, 1<<24); - return 0; -} - -static int get_format(void *obj, const char *name, int search_flags, int *out_fmt, - enum AVOptionType type, const char *desc) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != type) { - av_log(obj, AV_LOG_ERROR, - "The value for option '%s' is not a %s format.\n", desc, name); - return AVERROR(EINVAL); - } - - dst = ((uint8_t*)target_obj) + o->offset; - *out_fmt = *(int *)dst; - return 0; -} - -int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt) -{ - return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_PIXEL_FMT, "pixel"); -} - -int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt) -{ - return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample"); -} - -int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl) -{ - void *dst, *target_obj; - const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); - if (!o || !target_obj) - return AVERROR_OPTION_NOT_FOUND; - if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) { - av_log(obj, AV_LOG_ERROR, - "The value for option '%s' is not a channel layout.\n", name); - return AVERROR(EINVAL); - } - - dst = ((uint8_t*)target_obj) + o->offset; - *cl = *(int64_t *)dst; - return 0; -} - -int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) -{ - const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0); - const AVOption *flag = av_opt_find(obj, flag_name, - field ? field->unit : NULL, 0, 0); - int64_t res; - - if (!field || !flag || flag->type != AV_OPT_TYPE_CONST || - av_opt_get_int(obj, field_name, 0, &res) < 0) - return 0; - return res & flag->default_val.i64; -} - -static void log_value(void *av_log_obj, int level, double d) -{ - if (d == INT_MAX) { - av_log(av_log_obj, level, "INT_MAX"); - } else if (d == INT_MIN) { - av_log(av_log_obj, level, "INT_MIN"); - } else if (d == UINT32_MAX) { - av_log(av_log_obj, level, "UINT32_MAX"); - } else if (d == (double)INT64_MAX) { - av_log(av_log_obj, level, "I64_MAX"); - } else if (d == INT64_MIN) { - av_log(av_log_obj, level, "I64_MIN"); - } else if (d == FLT_MAX) { - av_log(av_log_obj, level, "FLT_MAX"); - } else if (d == FLT_MIN) { - av_log(av_log_obj, level, "FLT_MIN"); - } else if (d == -FLT_MAX) { - av_log(av_log_obj, level, "-FLT_MAX"); - } else if (d == -FLT_MIN) { - av_log(av_log_obj, level, "-FLT_MIN"); - } else if (d == DBL_MAX) { - av_log(av_log_obj, level, "DBL_MAX"); - } else if (d == DBL_MIN) { - av_log(av_log_obj, level, "DBL_MIN"); - } else if (d == -DBL_MAX) { - av_log(av_log_obj, level, "-DBL_MAX"); - } else if (d == -DBL_MIN) { - av_log(av_log_obj, level, "-DBL_MIN"); - } else { - av_log(av_log_obj, level, "%g", d); - } -} - -static void opt_list(void *obj, void *av_log_obj, const char *unit, - int req_flags, int rej_flags) -{ - const AVOption *opt=NULL; - AVOptionRanges *r; - int i; - - while ((opt = av_opt_next(obj, opt))) { - if (!(opt->flags & req_flags) || (opt->flags & rej_flags)) - continue; - - /* Don't print CONST's on level one. - * Don't print anything but CONST's on level two. - * Only print items from the requested unit. - */ - if (!unit && opt->type==AV_OPT_TYPE_CONST) - continue; - else if (unit && opt->type!=AV_OPT_TYPE_CONST) - continue; - else if (unit && opt->type==AV_OPT_TYPE_CONST && strcmp(unit, opt->unit)) - continue; - else if (unit && opt->type == AV_OPT_TYPE_CONST) - av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name); - else - av_log(av_log_obj, AV_LOG_INFO, " %s%-17s ", - (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-", - opt->name); - - switch (opt->type) { - case AV_OPT_TYPE_FLAGS: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_INT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_INT64: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_DOUBLE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_FLOAT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_STRING: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_RATIONAL: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_BINARY: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_IMAGE_SIZE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_VIDEO_RATE: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_PIXEL_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_SAMPLE_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_DURATION: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_COLOR: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - case AV_OPT_TYPE_CONST: - default: - av_log(av_log_obj, AV_LOG_INFO, "%-12s ", ""); - break; - } - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_FILTERING_PARAM)? 'F' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_EXPORT) ? 'X' : '.'); - av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_READONLY) ? 'R' : '.'); - - if (opt->help) - av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help); - - if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) { - switch (opt->type) { - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_FLOAT: - case AV_OPT_TYPE_RATIONAL: - for (i = 0; i < r->nb_ranges; i++) { - av_log(av_log_obj, AV_LOG_INFO, " (from "); - log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_min); - av_log(av_log_obj, AV_LOG_INFO, " to "); - log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_max); - av_log(av_log_obj, AV_LOG_INFO, ")"); - } - break; - } - av_opt_freep_ranges(&r); - } - - if (opt->type != AV_OPT_TYPE_CONST && - opt->type != AV_OPT_TYPE_BINARY && - !((opt->type == AV_OPT_TYPE_COLOR || - opt->type == AV_OPT_TYPE_IMAGE_SIZE || - opt->type == AV_OPT_TYPE_STRING || - opt->type == AV_OPT_TYPE_VIDEO_RATE) && - !opt->default_val.str)) { - av_log(av_log_obj, AV_LOG_INFO, " (default "); - switch (opt->type) { - case AV_OPT_TYPE_FLAGS: - av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64); - break; - case AV_OPT_TYPE_DURATION: - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64); - break; - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_FLOAT: - log_value(av_log_obj, AV_LOG_INFO, opt->default_val.dbl); - break; - case AV_OPT_TYPE_RATIONAL: { - AVRational q = av_d2q(opt->default_val.dbl, INT_MAX); - av_log(av_log_obj, AV_LOG_INFO, "%d/%d", q.num, q.den); } - break; - case AV_OPT_TYPE_PIXEL_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_pix_fmt_name(opt->default_val.i64), "none")); - break; - case AV_OPT_TYPE_SAMPLE_FMT: - av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_sample_fmt_name(opt->default_val.i64), "none")); - break; - case AV_OPT_TYPE_COLOR: - case AV_OPT_TYPE_IMAGE_SIZE: - case AV_OPT_TYPE_STRING: - case AV_OPT_TYPE_VIDEO_RATE: - av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str); - break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: - av_log(av_log_obj, AV_LOG_INFO, "0x%"PRIx64, opt->default_val.i64); - break; - } - av_log(av_log_obj, AV_LOG_INFO, ")"); - } - - av_log(av_log_obj, AV_LOG_INFO, "\n"); - if (opt->unit && opt->type != AV_OPT_TYPE_CONST) { - opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags); - } - } -} - -int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags) -{ - if (!obj) - return -1; - - av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass**)obj)->class_name); - - opt_list(obj, av_log_obj, NULL, req_flags, rej_flags); - - return 0; -} - -void av_opt_set_defaults(void *s) -{ -#if FF_API_OLD_AVOPTIONS - av_opt_set_defaults2(s, 0, 0); -} - -void av_opt_set_defaults2(void *s, int mask, int flags) -{ -#endif - const AVClass *class = *(AVClass **)s; - const AVOption *opt = NULL; - while ((opt = av_opt_next(s, opt)) != NULL) { - void *dst = ((uint8_t*)s) + opt->offset; -#if FF_API_OLD_AVOPTIONS - if ((opt->flags & mask) != flags) - continue; -#endif - - if (opt->flags & AV_OPT_FLAG_READONLY) - continue; - - switch (opt->type) { - case AV_OPT_TYPE_CONST: - /* Nothing to be done here */ - break; - case AV_OPT_TYPE_FLAGS: - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - case AV_OPT_TYPE_DURATION: - case AV_OPT_TYPE_CHANNEL_LAYOUT: - write_number(s, opt, dst, 1, 1, opt->default_val.i64); - break; - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_FLOAT: { - double val; - val = opt->default_val.dbl; - write_number(s, opt, dst, val, 1, 1); - } - break; - case AV_OPT_TYPE_RATIONAL: { - AVRational val; - val = av_d2q(opt->default_val.dbl, INT_MAX); - write_number(s, opt, dst, 1, val.den, val.num); - } - break; - case AV_OPT_TYPE_COLOR: - set_string_color(s, opt, opt->default_val.str, dst); - break; - case AV_OPT_TYPE_STRING: - set_string(s, opt, opt->default_val.str, dst); - break; - case AV_OPT_TYPE_IMAGE_SIZE: - set_string_image_size(s, opt, opt->default_val.str, dst); - break; - case AV_OPT_TYPE_VIDEO_RATE: - set_string_video_rate(s, opt, opt->default_val.str, dst); - break; - case AV_OPT_TYPE_PIXEL_FMT: -#if LIBAVUTIL_VERSION_MAJOR < 54 - if (class->version && class->version < AV_VERSION_INT(52, 10, 100)) - av_opt_set(s, opt->name, opt->default_val.str, 0); - else -#endif - write_number(s, opt, dst, 1, 1, opt->default_val.i64); - break; - case AV_OPT_TYPE_SAMPLE_FMT: -#if LIBAVUTIL_VERSION_MAJOR < 54 - if (class->version && class->version < AV_VERSION_INT(52, 10, 100)) - av_opt_set(s, opt->name, opt->default_val.str, 0); - else -#endif - write_number(s, opt, dst, 1, 1, opt->default_val.i64); - break; - case AV_OPT_TYPE_BINARY: - /* Cannot set default for binary */ - break; - default: - av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n", opt->type, opt->name); - } - } -} - -/** - * Store the value in the field in ctx that is named like key. - * ctx must be an AVClass context, storing is done using AVOptions. - * - * @param buf the string to parse, buf will be updated to point at the - * separator just after the parsed key/value pair - * @param key_val_sep a 0-terminated list of characters used to - * separate key from value - * @param pairs_sep a 0-terminated list of characters used to separate - * two pairs from each other - * @return 0 if the key/value pair has been successfully parsed and - * set, or a negative value corresponding to an AVERROR code in case - * of error: - * AVERROR(EINVAL) if the key/value pair cannot be parsed, - * the error code issued by av_opt_set() if the key/value pair - * cannot be set - */ -static int parse_key_value_pair(void *ctx, const char **buf, - const char *key_val_sep, const char *pairs_sep) -{ - char *key = av_get_token(buf, key_val_sep); - char *val; - int ret; - - if (!key) - return AVERROR(ENOMEM); - - if (*key && strspn(*buf, key_val_sep)) { - (*buf)++; - val = av_get_token(buf, pairs_sep); - if (!val) { - av_freep(&key); - return AVERROR(ENOMEM); - } - } else { - av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key); - av_free(key); - return AVERROR(EINVAL); - } - - av_log(ctx, AV_LOG_DEBUG, "Setting entry with key '%s' to value '%s'\n", key, val); - - ret = av_opt_set(ctx, key, val, AV_OPT_SEARCH_CHILDREN); - if (ret == AVERROR_OPTION_NOT_FOUND) - av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key); - - av_free(key); - av_free(val); - return ret; -} - -int av_set_options_string(void *ctx, const char *opts, - const char *key_val_sep, const char *pairs_sep) -{ - int ret, count = 0; - - if (!opts) - return 0; - - while (*opts) { - if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0) - return ret; - count++; - - if (*opts) - opts++; - } - - return count; -} - -#define WHITESPACES " \n\t" - -static int is_key_char(char c) -{ - return (unsigned)((c | 32) - 'a') < 26 || - (unsigned)(c - '0') < 10 || - c == '-' || c == '_' || c == '/' || c == '.'; -} - -/** - * Read a key from a string. - * - * The key consists of is_key_char characters and must be terminated by a - * character from the delim string; spaces are ignored. - * - * @return 0 for success (even with ellipsis), <0 for failure - */ -static int get_key(const char **ropts, const char *delim, char **rkey) -{ - const char *opts = *ropts; - const char *key_start, *key_end; - - key_start = opts += strspn(opts, WHITESPACES); - while (is_key_char(*opts)) - opts++; - key_end = opts; - opts += strspn(opts, WHITESPACES); - if (!*opts || !strchr(delim, *opts)) - return AVERROR(EINVAL); - opts++; - if (!(*rkey = av_malloc(key_end - key_start + 1))) - return AVERROR(ENOMEM); - memcpy(*rkey, key_start, key_end - key_start); - (*rkey)[key_end - key_start] = 0; - *ropts = opts; - return 0; -} - -int av_opt_get_key_value(const char **ropts, - const char *key_val_sep, const char *pairs_sep, - unsigned flags, - char **rkey, char **rval) -{ - int ret; - char *key = NULL, *val; - const char *opts = *ropts; - - if ((ret = get_key(&opts, key_val_sep, &key)) < 0 && - !(flags & AV_OPT_FLAG_IMPLICIT_KEY)) - return AVERROR(EINVAL); - if (!(val = av_get_token(&opts, pairs_sep))) { - av_free(key); - return AVERROR(ENOMEM); - } - *ropts = opts; - *rkey = key; - *rval = val; - return 0; -} - -int av_opt_set_from_string(void *ctx, const char *opts, - const char *const *shorthand, - const char *key_val_sep, const char *pairs_sep) -{ - int ret, count = 0; - const char *dummy_shorthand = NULL; - char *av_uninit(parsed_key), *av_uninit(value); - const char *key; - - if (!opts) - return 0; - if (!shorthand) - shorthand = &dummy_shorthand; - - while (*opts) { - ret = av_opt_get_key_value(&opts, key_val_sep, pairs_sep, - *shorthand ? AV_OPT_FLAG_IMPLICIT_KEY : 0, - &parsed_key, &value); - if (ret < 0) { - if (ret == AVERROR(EINVAL)) - av_log(ctx, AV_LOG_ERROR, "No option name near '%s'\n", opts); - else - av_log(ctx, AV_LOG_ERROR, "Unable to parse '%s': %s\n", opts, - av_err2str(ret)); - return ret; - } - if (*opts) - opts++; - if (parsed_key) { - key = parsed_key; - while (*shorthand) /* discard all remaining shorthand */ - shorthand++; - } else { - key = *(shorthand++); - } - - av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value); - if ((ret = av_opt_set(ctx, key, value, 0)) < 0) { - if (ret == AVERROR_OPTION_NOT_FOUND) - av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key); - av_free(value); - av_free(parsed_key); - return ret; - } - - av_free(value); - av_free(parsed_key); - count++; - } - return count; -} - -void av_opt_free(void *obj) -{ - const AVOption *o = NULL; - while ((o = av_opt_next(obj, o))) - if (o->type == AV_OPT_TYPE_STRING || o->type == AV_OPT_TYPE_BINARY) - av_freep((uint8_t *)obj + o->offset); -} - -int av_opt_set_dict(void *obj, AVDictionary **options) -{ - AVDictionaryEntry *t = NULL; - AVDictionary *tmp = NULL; - int ret = 0; - - while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { - ret = av_opt_set(obj, t->key, t->value, 0); - if (ret == AVERROR_OPTION_NOT_FOUND) - av_dict_set(&tmp, t->key, t->value, 0); - else if (ret < 0) { - av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value); - break; - } - ret = 0; - } - av_dict_free(options); - *options = tmp; - return ret; -} - -const AVOption *av_opt_find(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags) -{ - return av_opt_find2(obj, name, unit, opt_flags, search_flags, NULL); -} - -const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, - int opt_flags, int search_flags, void **target_obj) -{ - const AVClass *c; - const AVOption *o = NULL; - - if(!obj) - return NULL; - - c= *(AVClass**)obj; - - if (!c) - return NULL; - - if (search_flags & AV_OPT_SEARCH_CHILDREN) { - if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) { - const AVClass *child = NULL; - while (child = av_opt_child_class_next(c, child)) - if (o = av_opt_find2(&child, name, unit, opt_flags, search_flags, NULL)) - return o; - } else { - void *child = NULL; - while (child = av_opt_child_next(obj, child)) - if (o = av_opt_find2(child, name, unit, opt_flags, search_flags, target_obj)) - return o; - } - } - - while (o = av_opt_next(obj, o)) { - if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags && - ((!unit && o->type != AV_OPT_TYPE_CONST) || - (unit && o->type == AV_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)))) { - if (target_obj) { - if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ)) - *target_obj = obj; - else - *target_obj = NULL; - } - return o; - } - } - return NULL; -} - -void *av_opt_child_next(void *obj, void *prev) -{ - const AVClass *c = *(AVClass**)obj; - if (c->child_next) - return c->child_next(obj, prev); - return NULL; -} - -const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev) -{ - if (parent->child_class_next) - return parent->child_class_next(prev); - return NULL; -} - -void *av_opt_ptr(const AVClass *class, void *obj, const char *name) -{ - const AVOption *opt= av_opt_find2(&class, name, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ, NULL); - if(!opt) - return NULL; - return (uint8_t*)obj + opt->offset; -} - -int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags) -{ - const AVClass *c = *(AVClass**)obj; - int (*callback)(AVOptionRanges **, void *obj, const char *key, int flags) = NULL; - - if (c->version > (52 << 16 | 11 << 8)) - callback = c->query_ranges; - - if (!callback) - callback = av_opt_query_ranges_default; - - return callback(ranges_arg, obj, key, flags); -} - -int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags) -{ - AVOptionRanges *ranges = av_mallocz(sizeof(*ranges)); - AVOptionRange **range_array = av_mallocz(sizeof(void*)); - AVOptionRange *range = av_mallocz(sizeof(*range)); - const AVOption *field = av_opt_find(obj, key, NULL, 0, flags); - int ret; - - *ranges_arg = NULL; - - if (!ranges || !range || !range_array || !field) { - ret = AVERROR(ENOMEM); - goto fail; - } - - ranges->range = range_array; - ranges->range[0] = range; - ranges->nb_ranges = 1; - range->is_range = 1; - range->value_min = field->min; - range->value_max = field->max; - - switch (field->type) { - case AV_OPT_TYPE_INT: - case AV_OPT_TYPE_INT64: - case AV_OPT_TYPE_PIXEL_FMT: - case AV_OPT_TYPE_SAMPLE_FMT: - case AV_OPT_TYPE_FLOAT: - case AV_OPT_TYPE_DOUBLE: - case AV_OPT_TYPE_DURATION: - case AV_OPT_TYPE_COLOR: - case AV_OPT_TYPE_CHANNEL_LAYOUT: - break; - case AV_OPT_TYPE_STRING: - range->component_min = 0; - range->component_max = 0x10FFFF; // max unicode value - range->value_min = -1; - range->value_max = INT_MAX; - break; - case AV_OPT_TYPE_RATIONAL: - range->component_min = INT_MIN; - range->component_max = INT_MAX; - break; - case AV_OPT_TYPE_IMAGE_SIZE: - range->component_min = 0; - range->component_max = INT_MAX/128/8; - range->value_min = 0; - range->value_max = INT_MAX/8; - break; - case AV_OPT_TYPE_VIDEO_RATE: - range->component_min = 1; - range->component_max = INT_MAX; - range->value_min = 1; - range->value_max = INT_MAX; - break; - default: - ret = AVERROR(ENOSYS); - goto fail; - } - - *ranges_arg = ranges; - return 0; -fail: - av_free(ranges); - av_free(range); - av_free(range_array); - return ret; -} - -void av_opt_freep_ranges(AVOptionRanges **rangesp) -{ - int i; - AVOptionRanges *ranges = *rangesp; - - for (i = 0; i < ranges->nb_ranges; i++) { - AVOptionRange *range = ranges->range[i]; - av_freep(&range->str); - av_freep(&ranges->range[i]); - } - av_freep(&ranges->range); - av_freep(rangesp); -} - -#ifdef TEST - -typedef struct TestContext -{ - const AVClass *class; - int num; - int toggle; - char *string; - int flags; - AVRational rational; - AVRational video_rate; - int w, h; - enum AVPixelFormat pix_fmt; - enum AVSampleFormat sample_fmt; - int64_t duration; - uint8_t color[4]; - int64_t channel_layout; -} TestContext; - -#define OFFSET(x) offsetof(TestContext, x) - -#define TEST_FLAG_COOL 01 -#define TEST_FLAG_LAME 02 -#define TEST_FLAG_MU 04 - -static const AVOption test_options[]= { -{"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 100 }, -{"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1 }, -{"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10 }, -{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, {.str = "default"}, CHAR_MIN, CHAR_MAX }, -{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, 0, INT_MAX, 0, "flags" }, -{"cool", "set cool flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_COOL}, INT_MIN, INT_MAX, 0, "flags" }, -{"lame", "set lame flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_LAME}, INT_MIN, INT_MAX, 0, "flags" }, -{"mu", "set mu flag ", 0, AV_OPT_TYPE_CONST, {.i64 = TEST_FLAG_MU}, INT_MIN, INT_MAX, 0, "flags" }, -{"size", "set size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE,{0}, 0, 0 }, -{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64 = AV_PIX_FMT_NONE}, -1, INT_MAX}, -{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64 = AV_SAMPLE_FMT_NONE}, -1, INT_MAX}, -{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0 }, -{"duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX}, -{"color", "set color", OFFSET(color), AV_OPT_TYPE_COLOR, {.str = "pink"}, 0, 0}, -{"cl", "set channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, {.i64 = AV_CH_LAYOUT_HEXAGONAL}, 0, INT64_MAX}, -{NULL}, -}; - -static const char *test_get_name(void *ctx) -{ - return "test"; -} - -static const AVClass test_class = { - "TestContext", - test_get_name, - test_options -}; - -int main(void) -{ - int i; - - printf("\nTesting av_set_options_string()\n"); - { - TestContext test_ctx = { 0 }; - static const char * const options[] = { - "", - ":", - "=", - "foo=:", - ":=foo", - "=foo", - "foo=", - "foo", - "foo=val", - "foo==val", - "toggle=:", - "string=:", - "toggle=1 : foo", - "toggle=100", - "toggle==1", - "flags=+mu-lame : num=42: toggle=0", - "num=42 : string=blahblah", - "rational=0 : rational=1/2 : rational=1/-1", - "rational=-1/0", - "size=1024x768", - "size=pal", - "size=bogus", - "pix_fmt=yuv420p", - "pix_fmt=2", - "pix_fmt=bogus", - "sample_fmt=s16", - "sample_fmt=2", - "sample_fmt=bogus", - "video_rate=pal", - "video_rate=25", - "video_rate=30000/1001", - "video_rate=30/1.001", - "video_rate=bogus", - "duration=bogus", - "duration=123.45", - "duration=1\\:23\\:45.67", - "color=blue", - "color=0x223300", - "color=0x42FF07AA", - "cl=stereo+downmix", - "cl=foo", - }; - - test_ctx.class = &test_class; - av_opt_set_defaults(&test_ctx); - - av_log_set_level(AV_LOG_DEBUG); - - for (i=0; i < FF_ARRAY_ELEMS(options); i++) { - av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); - if (av_set_options_string(&test_ctx, options[i], "=", ":") < 0) - av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]); - printf("\n"); - } - av_opt_free(&test_ctx); - } - - printf("\nTesting av_opt_set_from_string()\n"); - { - TestContext test_ctx = { 0 }; - static const char * const options[] = { - "", - "5", - "5:hello", - "5:hello:size=pal", - "5:size=pal:hello", - ":", - "=", - " 5 : hello : size = pal ", - "a_very_long_option_name_that_will_need_to_be_ellipsized_around_here=42" - }; - static const char * const shorthand[] = { "num", "string", NULL }; - - test_ctx.class = &test_class; - av_opt_set_defaults(&test_ctx); - - av_log_set_level(AV_LOG_DEBUG); - - for (i=0; i < FF_ARRAY_ELEMS(options); i++) { - av_log(&test_ctx, AV_LOG_DEBUG, "Setting options string '%s'\n", options[i]); - if (av_opt_set_from_string(&test_ctx, options[i], shorthand, "=", ":") < 0) - av_log(&test_ctx, AV_LOG_ERROR, "Error setting options string: '%s'\n", options[i]); - printf("\n"); - } - av_opt_free(&test_ctx); - } - - return 0; -} - -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.c deleted file mode 100644 index ba4b4e1b7..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.c +++ /dev/null @@ -1,892 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * misc parsing utilities - */ - -#include - -#include "avstring.h" -#include "avutil.h" -#include "common.h" -#include "eval.h" -#include "log.h" -#include "random_seed.h" -#include "parseutils.h" - -#ifdef TEST - -#define av_get_random_seed av_get_random_seed_deterministic -static uint32_t av_get_random_seed_deterministic(void); - -#define time(t) 1331972053 - -#endif - -int av_parse_ratio(AVRational *q, const char *str, int max, - int log_offset, void *log_ctx) -{ - char c; - int ret; - - if (sscanf(str, "%d:%d%c", &q->num, &q->den, &c) != 2) { - double d; - ret = av_expr_parse_and_eval(&d, str, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, log_offset, log_ctx); - if (ret < 0) - return ret; - *q = av_d2q(d, max); - } else { - av_reduce(&q->num, &q->den, q->num, q->den, max); - } - - return 0; -} - -typedef struct { - const char *abbr; - int width, height; -} VideoSizeAbbr; - -typedef struct { - const char *abbr; - AVRational rate; -} VideoRateAbbr; - -static const VideoSizeAbbr video_size_abbrs[] = { - { "ntsc", 720, 480 }, - { "pal", 720, 576 }, - { "qntsc", 352, 240 }, /* VCD compliant NTSC */ - { "qpal", 352, 288 }, /* VCD compliant PAL */ - { "sntsc", 640, 480 }, /* square pixel NTSC */ - { "spal", 768, 576 }, /* square pixel PAL */ - { "film", 352, 240 }, - { "ntsc-film", 352, 240 }, - { "sqcif", 128, 96 }, - { "qcif", 176, 144 }, - { "cif", 352, 288 }, - { "4cif", 704, 576 }, - { "16cif", 1408,1152 }, - { "qqvga", 160, 120 }, - { "qvga", 320, 240 }, - { "vga", 640, 480 }, - { "svga", 800, 600 }, - { "xga", 1024, 768 }, - { "uxga", 1600,1200 }, - { "qxga", 2048,1536 }, - { "sxga", 1280,1024 }, - { "qsxga", 2560,2048 }, - { "hsxga", 5120,4096 }, - { "wvga", 852, 480 }, - { "wxga", 1366, 768 }, - { "wsxga", 1600,1024 }, - { "wuxga", 1920,1200 }, - { "woxga", 2560,1600 }, - { "wqsxga", 3200,2048 }, - { "wquxga", 3840,2400 }, - { "whsxga", 6400,4096 }, - { "whuxga", 7680,4800 }, - { "cga", 320, 200 }, - { "ega", 640, 350 }, - { "hd480", 852, 480 }, - { "hd720", 1280, 720 }, - { "hd1080", 1920,1080 }, - { "2k", 2048,1080 }, /* Digital Cinema System Specification */ - { "2kflat", 1998,1080 }, - { "2kscope", 2048, 858 }, - { "4k", 4096,2160 }, /* Digital Cinema System Specification */ - { "4kflat", 3996,2160 }, - { "4kscope", 4096,1716 }, - { "nhd", 640,360 }, - { "hqvga", 240,160 }, - { "wqvga", 400,240 }, - { "fwqvga", 432,240 }, - { "hvga", 480,320 }, - { "qhd", 960,540 }, -}; - -static const VideoRateAbbr video_rate_abbrs[]= { - { "ntsc", { 30000, 1001 } }, - { "pal", { 25, 1 } }, - { "qntsc", { 30000, 1001 } }, /* VCD compliant NTSC */ - { "qpal", { 25, 1 } }, /* VCD compliant PAL */ - { "sntsc", { 30000, 1001 } }, /* square pixel NTSC */ - { "spal", { 25, 1 } }, /* square pixel PAL */ - { "film", { 24, 1 } }, - { "ntsc-film", { 24000, 1001 } }, -}; - -int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str) -{ - int i; - int n = FF_ARRAY_ELEMS(video_size_abbrs); - const char *p; - int width = 0, height = 0; - - for (i = 0; i < n; i++) { - if (!strcmp(video_size_abbrs[i].abbr, str)) { - width = video_size_abbrs[i].width; - height = video_size_abbrs[i].height; - break; - } - } - if (i == n) { - width = strtol(str, (void*)&p, 10); - if (*p) - p++; - height = strtol(p, (void*)&p, 10); - - /* trailing extraneous data detected, like in 123x345foobar */ - if (*p) - return AVERROR(EINVAL); - } - if (width <= 0 || height <= 0) - return AVERROR(EINVAL); - *width_ptr = width; - *height_ptr = height; - return 0; -} - -int av_parse_video_rate(AVRational *rate, const char *arg) -{ - int i, ret; - int n = FF_ARRAY_ELEMS(video_rate_abbrs); - - /* First, we check our abbreviation table */ - for (i = 0; i < n; ++i) - if (!strcmp(video_rate_abbrs[i].abbr, arg)) { - *rate = video_rate_abbrs[i].rate; - return 0; - } - - /* Then, we try to parse it as fraction */ - if ((ret = av_parse_ratio_quiet(rate, arg, 1001000)) < 0) - return ret; - if (rate->num <= 0 || rate->den <= 0) - return AVERROR(EINVAL); - return 0; -} - -typedef struct { - const char *name; ///< a string representing the name of the color - uint8_t rgb_color[3]; ///< RGB values for the color -} ColorEntry; - -static const ColorEntry color_table[] = { - { "AliceBlue", { 0xF0, 0xF8, 0xFF } }, - { "AntiqueWhite", { 0xFA, 0xEB, 0xD7 } }, - { "Aqua", { 0x00, 0xFF, 0xFF } }, - { "Aquamarine", { 0x7F, 0xFF, 0xD4 } }, - { "Azure", { 0xF0, 0xFF, 0xFF } }, - { "Beige", { 0xF5, 0xF5, 0xDC } }, - { "Bisque", { 0xFF, 0xE4, 0xC4 } }, - { "Black", { 0x00, 0x00, 0x00 } }, - { "BlanchedAlmond", { 0xFF, 0xEB, 0xCD } }, - { "Blue", { 0x00, 0x00, 0xFF } }, - { "BlueViolet", { 0x8A, 0x2B, 0xE2 } }, - { "Brown", { 0xA5, 0x2A, 0x2A } }, - { "BurlyWood", { 0xDE, 0xB8, 0x87 } }, - { "CadetBlue", { 0x5F, 0x9E, 0xA0 } }, - { "Chartreuse", { 0x7F, 0xFF, 0x00 } }, - { "Chocolate", { 0xD2, 0x69, 0x1E } }, - { "Coral", { 0xFF, 0x7F, 0x50 } }, - { "CornflowerBlue", { 0x64, 0x95, 0xED } }, - { "Cornsilk", { 0xFF, 0xF8, 0xDC } }, - { "Crimson", { 0xDC, 0x14, 0x3C } }, - { "Cyan", { 0x00, 0xFF, 0xFF } }, - { "DarkBlue", { 0x00, 0x00, 0x8B } }, - { "DarkCyan", { 0x00, 0x8B, 0x8B } }, - { "DarkGoldenRod", { 0xB8, 0x86, 0x0B } }, - { "DarkGray", { 0xA9, 0xA9, 0xA9 } }, - { "DarkGreen", { 0x00, 0x64, 0x00 } }, - { "DarkKhaki", { 0xBD, 0xB7, 0x6B } }, - { "DarkMagenta", { 0x8B, 0x00, 0x8B } }, - { "DarkOliveGreen", { 0x55, 0x6B, 0x2F } }, - { "Darkorange", { 0xFF, 0x8C, 0x00 } }, - { "DarkOrchid", { 0x99, 0x32, 0xCC } }, - { "DarkRed", { 0x8B, 0x00, 0x00 } }, - { "DarkSalmon", { 0xE9, 0x96, 0x7A } }, - { "DarkSeaGreen", { 0x8F, 0xBC, 0x8F } }, - { "DarkSlateBlue", { 0x48, 0x3D, 0x8B } }, - { "DarkSlateGray", { 0x2F, 0x4F, 0x4F } }, - { "DarkTurquoise", { 0x00, 0xCE, 0xD1 } }, - { "DarkViolet", { 0x94, 0x00, 0xD3 } }, - { "DeepPink", { 0xFF, 0x14, 0x93 } }, - { "DeepSkyBlue", { 0x00, 0xBF, 0xFF } }, - { "DimGray", { 0x69, 0x69, 0x69 } }, - { "DodgerBlue", { 0x1E, 0x90, 0xFF } }, - { "FireBrick", { 0xB2, 0x22, 0x22 } }, - { "FloralWhite", { 0xFF, 0xFA, 0xF0 } }, - { "ForestGreen", { 0x22, 0x8B, 0x22 } }, - { "Fuchsia", { 0xFF, 0x00, 0xFF } }, - { "Gainsboro", { 0xDC, 0xDC, 0xDC } }, - { "GhostWhite", { 0xF8, 0xF8, 0xFF } }, - { "Gold", { 0xFF, 0xD7, 0x00 } }, - { "GoldenRod", { 0xDA, 0xA5, 0x20 } }, - { "Gray", { 0x80, 0x80, 0x80 } }, - { "Green", { 0x00, 0x80, 0x00 } }, - { "GreenYellow", { 0xAD, 0xFF, 0x2F } }, - { "HoneyDew", { 0xF0, 0xFF, 0xF0 } }, - { "HotPink", { 0xFF, 0x69, 0xB4 } }, - { "IndianRed", { 0xCD, 0x5C, 0x5C } }, - { "Indigo", { 0x4B, 0x00, 0x82 } }, - { "Ivory", { 0xFF, 0xFF, 0xF0 } }, - { "Khaki", { 0xF0, 0xE6, 0x8C } }, - { "Lavender", { 0xE6, 0xE6, 0xFA } }, - { "LavenderBlush", { 0xFF, 0xF0, 0xF5 } }, - { "LawnGreen", { 0x7C, 0xFC, 0x00 } }, - { "LemonChiffon", { 0xFF, 0xFA, 0xCD } }, - { "LightBlue", { 0xAD, 0xD8, 0xE6 } }, - { "LightCoral", { 0xF0, 0x80, 0x80 } }, - { "LightCyan", { 0xE0, 0xFF, 0xFF } }, - { "LightGoldenRodYellow", { 0xFA, 0xFA, 0xD2 } }, - { "LightGreen", { 0x90, 0xEE, 0x90 } }, - { "LightGrey", { 0xD3, 0xD3, 0xD3 } }, - { "LightPink", { 0xFF, 0xB6, 0xC1 } }, - { "LightSalmon", { 0xFF, 0xA0, 0x7A } }, - { "LightSeaGreen", { 0x20, 0xB2, 0xAA } }, - { "LightSkyBlue", { 0x87, 0xCE, 0xFA } }, - { "LightSlateGray", { 0x77, 0x88, 0x99 } }, - { "LightSteelBlue", { 0xB0, 0xC4, 0xDE } }, - { "LightYellow", { 0xFF, 0xFF, 0xE0 } }, - { "Lime", { 0x00, 0xFF, 0x00 } }, - { "LimeGreen", { 0x32, 0xCD, 0x32 } }, - { "Linen", { 0xFA, 0xF0, 0xE6 } }, - { "Magenta", { 0xFF, 0x00, 0xFF } }, - { "Maroon", { 0x80, 0x00, 0x00 } }, - { "MediumAquaMarine", { 0x66, 0xCD, 0xAA } }, - { "MediumBlue", { 0x00, 0x00, 0xCD } }, - { "MediumOrchid", { 0xBA, 0x55, 0xD3 } }, - { "MediumPurple", { 0x93, 0x70, 0xD8 } }, - { "MediumSeaGreen", { 0x3C, 0xB3, 0x71 } }, - { "MediumSlateBlue", { 0x7B, 0x68, 0xEE } }, - { "MediumSpringGreen", { 0x00, 0xFA, 0x9A } }, - { "MediumTurquoise", { 0x48, 0xD1, 0xCC } }, - { "MediumVioletRed", { 0xC7, 0x15, 0x85 } }, - { "MidnightBlue", { 0x19, 0x19, 0x70 } }, - { "MintCream", { 0xF5, 0xFF, 0xFA } }, - { "MistyRose", { 0xFF, 0xE4, 0xE1 } }, - { "Moccasin", { 0xFF, 0xE4, 0xB5 } }, - { "NavajoWhite", { 0xFF, 0xDE, 0xAD } }, - { "Navy", { 0x00, 0x00, 0x80 } }, - { "OldLace", { 0xFD, 0xF5, 0xE6 } }, - { "Olive", { 0x80, 0x80, 0x00 } }, - { "OliveDrab", { 0x6B, 0x8E, 0x23 } }, - { "Orange", { 0xFF, 0xA5, 0x00 } }, - { "OrangeRed", { 0xFF, 0x45, 0x00 } }, - { "Orchid", { 0xDA, 0x70, 0xD6 } }, - { "PaleGoldenRod", { 0xEE, 0xE8, 0xAA } }, - { "PaleGreen", { 0x98, 0xFB, 0x98 } }, - { "PaleTurquoise", { 0xAF, 0xEE, 0xEE } }, - { "PaleVioletRed", { 0xD8, 0x70, 0x93 } }, - { "PapayaWhip", { 0xFF, 0xEF, 0xD5 } }, - { "PeachPuff", { 0xFF, 0xDA, 0xB9 } }, - { "Peru", { 0xCD, 0x85, 0x3F } }, - { "Pink", { 0xFF, 0xC0, 0xCB } }, - { "Plum", { 0xDD, 0xA0, 0xDD } }, - { "PowderBlue", { 0xB0, 0xE0, 0xE6 } }, - { "Purple", { 0x80, 0x00, 0x80 } }, - { "Red", { 0xFF, 0x00, 0x00 } }, - { "RosyBrown", { 0xBC, 0x8F, 0x8F } }, - { "RoyalBlue", { 0x41, 0x69, 0xE1 } }, - { "SaddleBrown", { 0x8B, 0x45, 0x13 } }, - { "Salmon", { 0xFA, 0x80, 0x72 } }, - { "SandyBrown", { 0xF4, 0xA4, 0x60 } }, - { "SeaGreen", { 0x2E, 0x8B, 0x57 } }, - { "SeaShell", { 0xFF, 0xF5, 0xEE } }, - { "Sienna", { 0xA0, 0x52, 0x2D } }, - { "Silver", { 0xC0, 0xC0, 0xC0 } }, - { "SkyBlue", { 0x87, 0xCE, 0xEB } }, - { "SlateBlue", { 0x6A, 0x5A, 0xCD } }, - { "SlateGray", { 0x70, 0x80, 0x90 } }, - { "Snow", { 0xFF, 0xFA, 0xFA } }, - { "SpringGreen", { 0x00, 0xFF, 0x7F } }, - { "SteelBlue", { 0x46, 0x82, 0xB4 } }, - { "Tan", { 0xD2, 0xB4, 0x8C } }, - { "Teal", { 0x00, 0x80, 0x80 } }, - { "Thistle", { 0xD8, 0xBF, 0xD8 } }, - { "Tomato", { 0xFF, 0x63, 0x47 } }, - { "Turquoise", { 0x40, 0xE0, 0xD0 } }, - { "Violet", { 0xEE, 0x82, 0xEE } }, - { "Wheat", { 0xF5, 0xDE, 0xB3 } }, - { "White", { 0xFF, 0xFF, 0xFF } }, - { "WhiteSmoke", { 0xF5, 0xF5, 0xF5 } }, - { "Yellow", { 0xFF, 0xFF, 0x00 } }, - { "YellowGreen", { 0x9A, 0xCD, 0x32 } }, -}; - -static int color_table_compare(const void *lhs, const void *rhs) -{ - return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name); -} - -#define ALPHA_SEP '@' - -int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, - void *log_ctx) -{ - char *tail, color_string2[128]; - const ColorEntry *entry; - int len, hex_offset = 0; - - if (color_string[0] == '#') { - hex_offset = 1; - } else if (!strncmp(color_string, "0x", 2)) - hex_offset = 2; - - if (slen < 0) - slen = strlen(color_string); - av_strlcpy(color_string2, color_string + hex_offset, - FFMIN(slen-hex_offset+1, sizeof(color_string2))); - if ((tail = strchr(color_string2, ALPHA_SEP))) - *tail++ = 0; - len = strlen(color_string2); - rgba_color[3] = 255; - - if (!av_strcasecmp(color_string2, "random") || !av_strcasecmp(color_string2, "bikeshed")) { - int rgba = av_get_random_seed(); - rgba_color[0] = rgba >> 24; - rgba_color[1] = rgba >> 16; - rgba_color[2] = rgba >> 8; - rgba_color[3] = rgba; - } else if (hex_offset || - strspn(color_string2, "0123456789ABCDEFabcdef") == len) { - char *tail; - unsigned int rgba = strtoul(color_string2, &tail, 16); - - if (*tail || (len != 6 && len != 8)) { - av_log(log_ctx, AV_LOG_ERROR, "Invalid 0xRRGGBB[AA] color string: '%s'\n", color_string2); - return AVERROR(EINVAL); - } - if (len == 8) { - rgba_color[3] = rgba; - rgba >>= 8; - } - rgba_color[0] = rgba >> 16; - rgba_color[1] = rgba >> 8; - rgba_color[2] = rgba; - } else { - entry = bsearch(color_string2, - color_table, - FF_ARRAY_ELEMS(color_table), - sizeof(ColorEntry), - color_table_compare); - if (!entry) { - av_log(log_ctx, AV_LOG_ERROR, "Cannot find color '%s'\n", color_string2); - return AVERROR(EINVAL); - } - memcpy(rgba_color, entry->rgb_color, 3); - } - - if (tail) { - double alpha; - const char *alpha_string = tail; - if (!strncmp(alpha_string, "0x", 2)) { - alpha = strtoul(alpha_string, &tail, 16); - } else { - double norm_alpha = strtod(alpha_string, &tail); - if (norm_alpha < 0.0 || norm_alpha > 1.0) - alpha = 256; - else - alpha = 255 * norm_alpha; - } - - if (tail == alpha_string || *tail || alpha > 255 || alpha < 0) { - av_log(log_ctx, AV_LOG_ERROR, "Invalid alpha value specifier '%s' in '%s'\n", - alpha_string, color_string); - return AVERROR(EINVAL); - } - rgba_color[3] = alpha; - } - - return 0; -} - -const char *av_get_known_color_name(int color_idx, const uint8_t **rgbp) -{ - const ColorEntry *color; - - if ((unsigned)color_idx >= FF_ARRAY_ELEMS(color_table)) - return NULL; - - color = &color_table[color_idx]; - if (rgbp) - *rgbp = color->rgb_color; - - return color->name; -} - -/* get a positive number between n_min and n_max, for a maximum length - of len_max. Return -1 if error. */ -static int date_get_num(const char **pp, - int n_min, int n_max, int len_max) -{ - int i, val, c; - const char *p; - - p = *pp; - val = 0; - for(i = 0; i < len_max; i++) { - c = *p; - if (!av_isdigit(c)) - break; - val = (val * 10) + c - '0'; - p++; - } - /* no number read ? */ - if (p == *pp) - return -1; - if (val < n_min || val > n_max) - return -1; - *pp = p; - return val; -} - -char *av_small_strptime(const char *p, const char *fmt, struct tm *dt) -{ - int c, val; - - for(;;) { - /* consume time string until a non whitespace char is found */ - while (av_isspace(*fmt)) { - while (av_isspace(*p)) - p++; - fmt++; - } - c = *fmt++; - if (c == '\0') { - return (char *)p; - } else if (c == '%') { - c = *fmt++; - switch(c) { - case 'H': - case 'J': - val = date_get_num(&p, 0, c == 'H' ? 23 : INT_MAX, 2); - if (val == -1) - return NULL; - dt->tm_hour = val; - break; - case 'M': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_min = val; - break; - case 'S': - val = date_get_num(&p, 0, 59, 2); - if (val == -1) - return NULL; - dt->tm_sec = val; - break; - case 'Y': - val = date_get_num(&p, 0, 9999, 4); - if (val == -1) - return NULL; - dt->tm_year = val - 1900; - break; - case 'm': - val = date_get_num(&p, 1, 12, 2); - if (val == -1) - return NULL; - dt->tm_mon = val - 1; - break; - case 'd': - val = date_get_num(&p, 1, 31, 2); - if (val == -1) - return NULL; - dt->tm_mday = val; - break; - case '%': - goto match; - default: - return NULL; - } - } else { - match: - if (c != *p) - return NULL; - p++; - } - } -} - -time_t av_timegm(struct tm *tm) -{ - time_t t; - - int y = tm->tm_year + 1900, m = tm->tm_mon + 1, d = tm->tm_mday; - - if (m < 3) { - m += 12; - y--; - } - - t = 86400LL * - (d + (153 * m - 457) / 5 + 365 * y + y / 4 - y / 100 + y / 400 - 719469); - - t += 3600 * tm->tm_hour + 60 * tm->tm_min + tm->tm_sec; - - return t; -} - -int av_parse_time(int64_t *timeval, const char *timestr, int duration) -{ - const char *p, *q; - int64_t t; - time_t now; - struct tm dt = { 0 }; - int today = 0, negative = 0, microseconds = 0; - int i; - static const char * const date_fmt[] = { - "%Y-%m-%d", - "%Y%m%d", - }; - static const char * const time_fmt[] = { - "%H:%M:%S", - "%H%M%S", - }; - - p = timestr; - q = NULL; - *timeval = INT64_MIN; - if (!duration) { - now = time(0); - - if (!av_strcasecmp(timestr, "now")) { - *timeval = (int64_t) now * 1000000; - return 0; - } - - /* parse the year-month-day part */ - for (i = 0; i < FF_ARRAY_ELEMS(date_fmt); i++) { - q = av_small_strptime(p, date_fmt[i], &dt); - if (q) - break; - } - - /* if the year-month-day part is missing, then take the - * current year-month-day time */ - if (!q) { - today = 1; - q = p; - } - p = q; - - if (*p == 'T' || *p == 't' || *p == ' ') - p++; - - /* parse the hour-minute-second part */ - for (i = 0; i < FF_ARRAY_ELEMS(time_fmt); i++) { - q = av_small_strptime(p, time_fmt[i], &dt); - if (q) - break; - } - } else { - /* parse timestr as a duration */ - if (p[0] == '-') { - negative = 1; - ++p; - } - /* parse timestr as HH:MM:SS */ - q = av_small_strptime(p, "%J:%M:%S", &dt); - if (!q) { - /* parse timestr as MM:SS */ - q = av_small_strptime(p, "%M:%S", &dt); - dt.tm_hour = 0; - } - if (!q) { - char *o; - /* parse timestr as S+ */ - dt.tm_sec = strtol(p, &o, 10); - if (o == p) /* the parsing didn't succeed */ - return AVERROR(EINVAL); - dt.tm_min = 0; - dt.tm_hour = 0; - q = o; - } - } - - /* Now we have all the fields that we can get */ - if (!q) - return AVERROR(EINVAL); - - /* parse the .m... part */ - if (*q == '.') { - int n; - q++; - for (n = 100000; n >= 1; n /= 10, q++) { - if (!av_isdigit(*q)) - break; - microseconds += n * (*q - '0'); - } - while (av_isdigit(*q)) - q++; - } - - if (duration) { - t = dt.tm_hour * 3600 + dt.tm_min * 60 + dt.tm_sec; - } else { - int is_utc = *q == 'Z' || *q == 'z'; - q += is_utc; - if (today) { /* fill in today's date */ - struct tm dt2 = is_utc ? *gmtime(&now) : *localtime(&now); - dt2.tm_hour = dt.tm_hour; - dt2.tm_min = dt.tm_min; - dt2.tm_sec = dt.tm_sec; - dt = dt2; - } - t = is_utc ? av_timegm(&dt) : mktime(&dt); - } - - /* Check that we are at the end of the string */ - if (*q) - return AVERROR(EINVAL); - - t *= 1000000; - t += microseconds; - *timeval = negative ? -t : t; - return 0; -} - -int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) -{ - const char *p; - char tag[128], *q; - - p = info; - if (*p == '?') - p++; - for(;;) { - q = tag; - while (*p != '\0' && *p != '=' && *p != '&') { - if ((q - tag) < sizeof(tag) - 1) - *q++ = *p; - p++; - } - *q = '\0'; - q = arg; - if (*p == '=') { - p++; - while (*p != '&' && *p != '\0') { - if ((q - arg) < arg_size - 1) { - if (*p == '+') - *q++ = ' '; - else - *q++ = *p; - } - p++; - } - } - *q = '\0'; - if (!strcmp(tag, tag1)) - return 1; - if (*p != '&') - break; - p++; - } - return 0; -} - -#ifdef TEST - -static uint32_t randomv = MKTAG('L','A','V','U'); - -static uint32_t av_get_random_seed_deterministic(void) -{ - return randomv = randomv * 1664525 + 1013904223; -} - -int main(void) -{ - printf("Testing av_parse_video_rate()\n"); - { - int i; - static const char *const rates[] = { - "-inf", - "inf", - "nan", - "123/0", - "-123 / 0", - "", - "/", - " 123 / 321", - "foo/foo", - "foo/1", - "1/foo", - "0/0", - "/0", - "1/", - "1", - "0", - "-123/123", - "-foo", - "123.23", - ".23", - "-.23", - "-0.234", - "-0.0000001", - " 21332.2324 ", - " -21332.2324 ", - }; - - for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) { - int ret; - AVRational q = { 0, 0 }; - ret = av_parse_video_rate(&q, rates[i]); - printf("'%s' -> %d/%d %s\n", - rates[i], q.num, q.den, ret ? "ERROR" : "OK"); - } - } - - printf("\nTesting av_parse_color()\n"); - { - int i; - uint8_t rgba[4]; - static const char *const color_names[] = { - "bikeshed", - "RaNdOm", - "foo", - "red", - "Red ", - "RED", - "Violet", - "Yellow", - "Red", - "0x000000", - "0x0000000", - "0xff000000", - "0x3e34ff", - "0x3e34ffaa", - "0xffXXee", - "0xfoobar", - "0xffffeeeeeeee", - "#ff0000", - "#ffXX00", - "ff0000", - "ffXX00", - "red@foo", - "random@10", - "0xff0000@1.0", - "red@", - "red@0xfff", - "red@0xf", - "red@2", - "red@0.1", - "red@-1", - "red@0.5", - "red@1.0", - "red@256", - "red@10foo", - "red@-1.0", - "red@-0.0", - }; - - av_log_set_level(AV_LOG_DEBUG); - - for (i = 0; i < FF_ARRAY_ELEMS(color_names); i++) { - if (av_parse_color(rgba, color_names[i], -1, NULL) >= 0) - printf("%s -> R(%d) G(%d) B(%d) A(%d)\n", - color_names[i], rgba[0], rgba[1], rgba[2], rgba[3]); - else - printf("%s -> error\n", color_names[i]); - } - } - - printf("\nTesting av_small_strptime()\n"); - { - int i; - struct tm tm = { 0 }; - struct fmt_timespec_entry { - const char *fmt, *timespec; - } fmt_timespec_entries[] = { - { "%Y-%m-%d", "2012-12-21" }, - { "%Y - %m - %d", "2012-12-21" }, - { "%Y-%m-%d %H:%M:%S", "2012-12-21 20:12:21" }, - { " %Y - %m - %d %H : %M : %S", " 2012 - 12 - 21 20 : 12 : 21" }, - }; - - av_log_set_level(AV_LOG_DEBUG); - for (i = 0; i < FF_ARRAY_ELEMS(fmt_timespec_entries); i++) { - char *p; - struct fmt_timespec_entry *e = &fmt_timespec_entries[i]; - printf("fmt:'%s' spec:'%s' -> ", e->fmt, e->timespec); - p = av_small_strptime(e->timespec, e->fmt, &tm); - if (p) { - printf("%04d-%02d-%2d %02d:%02d:%02d\n", - 1900+tm.tm_year, tm.tm_mon+1, tm.tm_mday, - tm.tm_hour, tm.tm_min, tm.tm_sec); - } else { - printf("error\n"); - } - } - } - - printf("\nTesting av_parse_time()\n"); - { - int i; - int64_t tv; - time_t tvi; - struct tm *tm; - static char tzstr[] = "TZ=CET-1"; - static const char * const time_string[] = { - "now", - "12:35:46", - "2000-12-20 0:02:47.5z", - "2000-12-20T010247.6", - }; - static const char * const duration_string[] = { - "2:34:56.79", - "-1:23:45.67", - "42.1729", - "-1729.42", - "12:34", - }; - - av_log_set_level(AV_LOG_DEBUG); - putenv(tzstr); - printf("(now is 2012-03-17 09:14:13 +0100, local time is UTC+1)\n"); - for (i = 0; i < FF_ARRAY_ELEMS(time_string); i++) { - printf("%-24s -> ", time_string[i]); - if (av_parse_time(&tv, time_string[i], 0)) { - printf("error\n"); - } else { - tvi = tv / 1000000; - tm = gmtime(&tvi); - printf("%14"PRIi64".%06d = %04d-%02d-%02dT%02d:%02d:%02dZ\n", - tv / 1000000, (int)(tv % 1000000), - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); - } - } - for (i = 0; i < FF_ARRAY_ELEMS(duration_string); i++) { - printf("%-24s -> ", duration_string[i]); - if (av_parse_time(&tv, duration_string[i], 1)) { - printf("error\n"); - } else { - printf("%+21"PRIi64"\n", tv); - } - } - } - - return 0; -} - -#endif /* TEST */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.c deleted file mode 100644 index 7d41b2220..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.c +++ /dev/null @@ -1,2073 +0,0 @@ -/* - * pixel format descriptor - * Copyright (c) 2009 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "avassert.h" -#include "common.h" -#include "pixfmt.h" -#include "pixdesc.h" -#include "internal.h" -#include "intreadwrite.h" -#include "avstring.h" -#include "version.h" - -void av_read_image_line(uint16_t *dst, - const uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, - int x, int y, int c, int w, - int read_pal_component) -{ - AVComponentDescriptor comp = desc->comp[c]; - int plane = comp.plane; - int depth = comp.depth_minus1 + 1; - int mask = (1 << depth) - 1; - int shift = comp.shift; - int step = comp.step_minus1 + 1; - int flags = desc->flags; - - if (flags & AV_PIX_FMT_FLAG_BITSTREAM) { - int skip = x * step + comp.offset_plus1 - 1; - const uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3); - int shift = 8 - depth - (skip & 7); - - while (w--) { - int val = (*p >> shift) & mask; - if (read_pal_component) - val = data[1][4*val + c]; - shift -= step; - p -= shift >> 3; - shift &= 7; - *dst++ = val; - } - } else { - const uint8_t *p = data[plane] + y * linesize[plane] + - x * step + comp.offset_plus1 - 1; - int is_8bit = shift + depth <= 8; - - if (is_8bit) - p += !!(flags & AV_PIX_FMT_FLAG_BE); - - while (w--) { - int val = is_8bit ? *p : - flags & AV_PIX_FMT_FLAG_BE ? AV_RB16(p) : AV_RL16(p); - val = (val >> shift) & mask; - if (read_pal_component) - val = data[1][4 * val + c]; - p += step; - *dst++ = val; - } - } -} - -void av_write_image_line(const uint16_t *src, - uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, - int x, int y, int c, int w) -{ - AVComponentDescriptor comp = desc->comp[c]; - int plane = comp.plane; - int depth = comp.depth_minus1 + 1; - int step = comp.step_minus1 + 1; - int flags = desc->flags; - - if (flags & AV_PIX_FMT_FLAG_BITSTREAM) { - int skip = x * step + comp.offset_plus1 - 1; - uint8_t *p = data[plane] + y * linesize[plane] + (skip >> 3); - int shift = 8 - depth - (skip & 7); - - while (w--) { - *p |= *src++ << shift; - shift -= step; - p -= shift >> 3; - shift &= 7; - } - } else { - int shift = comp.shift; - uint8_t *p = data[plane] + y * linesize[plane] + - x * step + comp.offset_plus1 - 1; - - if (shift + depth <= 8) { - p += !!(flags & AV_PIX_FMT_FLAG_BE); - while (w--) { - *p |= (*src++ << shift); - p += step; - } - } else { - while (w--) { - if (flags & AV_PIX_FMT_FLAG_BE) { - uint16_t val = AV_RB16(p) | (*src++ << shift); - AV_WB16(p, val); - } else { - uint16_t val = AV_RL16(p) | (*src++ << shift); - AV_WL16(p, val); - } - p += step; - } - } - } -} - -#if !FF_API_PIX_FMT_DESC -static -#endif -const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = { - [AV_PIX_FMT_YUV420P] = { - .name = "yuv420p", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUYV422] = { - .name = "yuyv422", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 7 }, /* Y */ - { 0, 3, 2, 0, 7 }, /* U */ - { 0, 3, 4, 0, 7 }, /* V */ - }, - }, - [AV_PIX_FMT_RGB24] = { - .name = "rgb24", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 1, 0, 7 }, /* R */ - { 0, 2, 2, 0, 7 }, /* G */ - { 0, 2, 3, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR24] = { - .name = "bgr24", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 2, 3, 0, 7 }, /* R */ - { 0, 2, 2, 0, 7 }, /* G */ - { 0, 2, 1, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_YUV422P] = { - .name = "yuv422p", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P] = { - .name = "yuv444p", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV410P] = { - .name = "yuv410p", - .nb_components = 3, - .log2_chroma_w = 2, - .log2_chroma_h = 2, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV411P] = { - .name = "yuv411p", - .nb_components = 3, - .log2_chroma_w = 2, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUVJ411P] = { - .name = "yuvj411p", - .nb_components = 3, - .log2_chroma_w = 2, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_GRAY8] = { - .name = "gray", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - }, - .flags = AV_PIX_FMT_FLAG_PSEUDOPAL, - }, - [AV_PIX_FMT_MONOWHITE] = { - .name = "monow", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 0 }, /* Y */ - }, - .flags = AV_PIX_FMT_FLAG_BITSTREAM, - }, - [AV_PIX_FMT_MONOBLACK] = { - .name = "monob", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 7, 0 }, /* Y */ - }, - .flags = AV_PIX_FMT_FLAG_BITSTREAM, - }, - [AV_PIX_FMT_PAL8] = { - .name = "pal8", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, - }, - .flags = AV_PIX_FMT_FLAG_PAL, - }, - [AV_PIX_FMT_YUVJ420P] = { - .name = "yuvj420p", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUVJ422P] = { - .name = "yuvj422p", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUVJ444P] = { - .name = "yuvj444p", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, -#if FF_API_XVMC - [AV_PIX_FMT_XVMC_MPEG2_MC] = { - .name = "xvmcmc", - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_XVMC_MPEG2_IDCT] = { - .name = "xvmcidct", - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, -#endif /* FF_API_XVMC */ -#if !FF_API_XVMC - [AV_PIX_FMT_XVMC] = { - .name = "xvmc", - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, -#endif /* !FF_API_XVMC */ - [AV_PIX_FMT_UYVY422] = { - .name = "uyvy422", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 2, 0, 7 }, /* Y */ - { 0, 3, 1, 0, 7 }, /* U */ - { 0, 3, 3, 0, 7 }, /* V */ - }, - }, - [AV_PIX_FMT_UYYVYY411] = { - .name = "uyyvyy411", - .nb_components = 3, - .log2_chroma_w = 2, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 2, 0, 7 }, /* Y */ - { 0, 5, 1, 0, 7 }, /* U */ - { 0, 5, 4, 0, 7 }, /* V */ - }, - }, - [AV_PIX_FMT_BGR8] = { - .name = "bgr8", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 2 }, /* R */ - { 0, 0, 1, 3, 2 }, /* G */ - { 0, 0, 1, 6, 1 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL, - }, - [AV_PIX_FMT_BGR4] = { - .name = "bgr4", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 4, 0, 0 }, /* R */ - { 0, 3, 2, 0, 1 }, /* G */ - { 0, 3, 1, 0, 0 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR4_BYTE] = { - .name = "bgr4_byte", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 0 }, /* R */ - { 0, 0, 1, 1, 1 }, /* G */ - { 0, 0, 1, 3, 0 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL, - }, - [AV_PIX_FMT_RGB8] = { - .name = "rgb8", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 6, 1 }, /* R */ - { 0, 0, 1, 3, 2 }, /* G */ - { 0, 0, 1, 0, 2 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL, - }, - [AV_PIX_FMT_RGB4] = { - .name = "rgb4", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 1, 0, 0 }, /* R */ - { 0, 3, 2, 0, 1 }, /* G */ - { 0, 3, 4, 0, 0 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB4_BYTE] = { - .name = "rgb4_byte", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 3, 0 }, /* R */ - { 0, 0, 1, 1, 1 }, /* G */ - { 0, 0, 1, 0, 0 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_PSEUDOPAL, - }, - [AV_PIX_FMT_NV12] = { - .name = "nv12", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 1, 1, 0, 7 }, /* U */ - { 1, 1, 2, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_NV21] = { - .name = "nv21", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 1, 2, 0, 7 }, /* U */ - { 1, 1, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_ARGB] = { - .name = "argb", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 2, 0, 7 }, /* R */ - { 0, 3, 3, 0, 7 }, /* G */ - { 0, 3, 4, 0, 7 }, /* B */ - { 0, 3, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_RGBA] = { - .name = "rgba", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 1, 0, 7 }, /* R */ - { 0, 3, 2, 0, 7 }, /* G */ - { 0, 3, 3, 0, 7 }, /* B */ - { 0, 3, 4, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_ABGR] = { - .name = "abgr", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 4, 0, 7 }, /* R */ - { 0, 3, 3, 0, 7 }, /* G */ - { 0, 3, 2, 0, 7 }, /* B */ - { 0, 3, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_BGRA] = { - .name = "bgra", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 3, 3, 0, 7 }, /* R */ - { 0, 3, 2, 0, 7 }, /* G */ - { 0, 3, 1, 0, 7 }, /* B */ - { 0, 3, 4, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_0RGB] = { - .name = "0rgb", - .nb_components= 3, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 3, 2, 0, 7 }, /* R */ - { 0, 3, 3, 0, 7 }, /* G */ - { 0, 3, 4, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB0] = { - .name = "rgb0", - .nb_components= 3, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 3, 1, 0, 7 }, /* R */ - { 0, 3, 2, 0, 7 }, /* G */ - { 0, 3, 3, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_0BGR] = { - .name = "0bgr", - .nb_components= 3, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 3, 4, 0, 7 }, /* R */ - { 0, 3, 3, 0, 7 }, /* G */ - { 0, 3, 2, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR0] = { - .name = "bgr0", - .nb_components= 3, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 3, 3, 0, 7 }, /* R */ - { 0, 3, 2, 0, 7 }, /* G */ - { 0, 3, 1, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GRAY16BE] = { - .name = "gray16be", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - }, - .flags = AV_PIX_FMT_FLAG_BE, - }, - [AV_PIX_FMT_GRAY16LE] = { - .name = "gray16le", - .nb_components = 1, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - }, - }, - [AV_PIX_FMT_YUV440P] = { - .name = "yuv440p", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUVJ440P] = { - .name = "yuvj440p", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUVA420P] = { - .name = "yuva420p", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - { 3, 0, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P] = { - .name = "yuva422p", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - { 3, 0, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P] = { - .name = "yuva444p", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 0, 1, 0, 7 }, /* U */ - { 2, 0, 1, 0, 7 }, /* V */ - { 3, 0, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P9BE] = { - .name = "yuva420p9be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P9LE] = { - .name = "yuva420p9le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P9BE] = { - .name = "yuva422p9be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P9LE] = { - .name = "yuva422p9le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P9BE] = { - .name = "yuva444p9be", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P9LE] = { - .name = "yuva444p9le", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - { 3, 1, 1, 0, 8 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P10BE] = { - .name = "yuva420p10be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P10LE] = { - .name = "yuva420p10le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P10BE] = { - .name = "yuva422p10be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P10LE] = { - .name = "yuva422p10le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P10BE] = { - .name = "yuva444p10be", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P10LE] = { - .name = "yuva444p10le", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - { 3, 1, 1, 0, 9 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P16BE] = { - .name = "yuva420p16be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA420P16LE] = { - .name = "yuva420p16le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P16BE] = { - .name = "yuva422p16be", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA422P16LE] = { - .name = "yuva422p16le", - .nb_components = 4, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P16BE] = { - .name = "yuva444p16be", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_YUVA444P16LE] = { - .name = "yuva444p16le", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA, - }, -#if FF_API_VDPAU - [AV_PIX_FMT_VDPAU_H264] = { - .name = "vdpau_h264", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDPAU_MPEG1] = { - .name = "vdpau_mpeg1", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDPAU_MPEG2] = { - .name = "vdpau_mpeg2", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDPAU_WMV3] = { - .name = "vdpau_wmv3", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDPAU_VC1] = { - .name = "vdpau_vc1", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDPAU_MPEG4] = { - .name = "vdpau_mpeg4", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, -#endif - [AV_PIX_FMT_RGB48BE] = { - .name = "rgb48be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 1, 0, 15 }, /* R */ - { 0, 5, 3, 0, 15 }, /* G */ - { 0, 5, 5, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE, - }, - [AV_PIX_FMT_RGB48LE] = { - .name = "rgb48le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 1, 0, 15 }, /* R */ - { 0, 5, 3, 0, 15 }, /* G */ - { 0, 5, 5, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGBA64BE] = { - .name = "rgba64be", - .nb_components= 4, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 7, 1, 0, 15 }, /* R */ - { 0, 7, 3, 0, 15 }, /* G */ - { 0, 7, 5, 0, 15 }, /* B */ - { 0, 7, 7, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_RGBA64LE] = { - .name = "rgba64le", - .nb_components= 4, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 7, 1, 0, 15 }, /* R */ - { 0, 7, 3, 0, 15 }, /* G */ - { 0, 7, 5, 0, 15 }, /* B */ - { 0, 7, 7, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_RGB565BE] = { - .name = "rgb565be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 0, 3, 4 }, /* R */ - { 0, 1, 1, 5, 5 }, /* G */ - { 0, 1, 1, 0, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB565LE] = { - .name = "rgb565le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 2, 3, 4 }, /* R */ - { 0, 1, 1, 5, 5 }, /* G */ - { 0, 1, 1, 0, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB555BE] = { - .name = "rgb555be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 0, 2, 4 }, /* R */ - { 0, 1, 1, 5, 4 }, /* G */ - { 0, 1, 1, 0, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB555LE] = { - .name = "rgb555le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 2, 2, 4 }, /* R */ - { 0, 1, 1, 5, 4 }, /* G */ - { 0, 1, 1, 0, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB444BE] = { - .name = "rgb444be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 0, 0, 3 }, /* R */ - { 0, 1, 1, 4, 3 }, /* G */ - { 0, 1, 1, 0, 3 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_RGB444LE] = { - .name = "rgb444le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 2, 0, 3 }, /* R */ - { 0, 1, 1, 4, 3 }, /* G */ - { 0, 1, 1, 0, 3 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR48BE] = { - .name = "bgr48be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 5, 0, 15 }, /* R */ - { 0, 5, 3, 0, 15 }, /* G */ - { 0, 5, 1, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR48LE] = { - .name = "bgr48le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 5, 0, 15 }, /* R */ - { 0, 5, 3, 0, 15 }, /* G */ - { 0, 5, 1, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGRA64BE] = { - .name = "bgra64be", - .nb_components= 4, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 7, 5, 0, 15 }, /* R */ - { 0, 7, 3, 0, 15 }, /* G */ - { 0, 7, 1, 0, 15 }, /* B */ - { 0, 7, 7, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_BGRA64LE] = { - .name = "bgra64le", - .nb_components= 4, - .log2_chroma_w= 0, - .log2_chroma_h= 0, - .comp = { - { 0, 7, 5, 0, 15 }, /* R */ - { 0, 7, 3, 0, 15 }, /* G */ - { 0, 7, 1, 0, 15 }, /* B */ - { 0, 7, 7, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_BGR565BE] = { - .name = "bgr565be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 4 }, /* R */ - { 0, 1, 1, 5, 5 }, /* G */ - { 0, 1, 0, 3, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR565LE] = { - .name = "bgr565le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 4 }, /* R */ - { 0, 1, 1, 5, 5 }, /* G */ - { 0, 1, 2, 3, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR555BE] = { - .name = "bgr555be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 4 }, /* R */ - { 0, 1, 1, 5, 4 }, /* G */ - { 0, 1, 0, 2, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR555LE] = { - .name = "bgr555le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 4 }, /* R */ - { 0, 1, 1, 5, 4 }, /* G */ - { 0, 1, 2, 2, 4 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR444BE] = { - .name = "bgr444be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 3 }, /* R */ - { 0, 1, 1, 4, 3 }, /* G */ - { 0, 1, 0, 0, 3 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BGR444LE] = { - .name = "bgr444le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 3 }, /* R */ - { 0, 1, 1, 4, 3 }, /* G */ - { 0, 1, 2, 0, 3 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_VAAPI_MOCO] = { - .name = "vaapi_moco", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VAAPI_IDCT] = { - .name = "vaapi_idct", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VAAPI_VLD] = { - .name = "vaapi_vld", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_YUV420P9LE] = { - .name = "yuv420p9le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P9BE] = { - .name = "yuv420p9be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P10LE] = { - .name = "yuv420p10le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P10BE] = { - .name = "yuv420p10be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P12LE] = { - .name = "yuv420p12le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P12BE] = { - .name = "yuv420p12be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P14LE] = { - .name = "yuv420p14le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P14BE] = { - .name = "yuv420p14be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P16LE] = { - .name = "yuv420p16le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV420P16BE] = { - .name = "yuv420p16be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P9LE] = { - .name = "yuv422p9le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P9BE] = { - .name = "yuv422p9be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P10LE] = { - .name = "yuv422p10le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P10BE] = { - .name = "yuv422p10be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P12LE] = { - .name = "yuv422p12le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P12BE] = { - .name = "yuv422p12be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P14LE] = { - .name = "yuv422p14le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P14BE] = { - .name = "yuv422p14be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P16LE] = { - .name = "yuv422p16le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV422P16BE] = { - .name = "yuv422p16be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P16LE] = { - .name = "yuv444p16le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P16BE] = { - .name = "yuv444p16be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 15 }, /* Y */ - { 1, 1, 1, 0, 15 }, /* U */ - { 2, 1, 1, 0, 15 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P10LE] = { - .name = "yuv444p10le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P10BE] = { - .name = "yuv444p10be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 1, 1, 0, 9 }, /* U */ - { 2, 1, 1, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P9LE] = { - .name = "yuv444p9le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P9BE] = { - .name = "yuv444p9be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 8 }, /* Y */ - { 1, 1, 1, 0, 8 }, /* U */ - { 2, 1, 1, 0, 8 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P12LE] = { - .name = "yuv444p12le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P12BE] = { - .name = "yuv444p12be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 11 }, /* Y */ - { 1, 1, 1, 0, 11 }, /* U */ - { 2, 1, 1, 0, 11 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P14LE] = { - .name = "yuv444p14le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_YUV444P14BE] = { - .name = "yuv444p14be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 13 }, /* Y */ - { 1, 1, 1, 0, 13 }, /* U */ - { 2, 1, 1, 0, 13 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_DXVA2_VLD] = { - .name = "dxva2_vld", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_VDA_VLD] = { - .name = "vda_vld", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_GRAY8A] = { - .name = "gray8a", - .nb_components = 2, - .comp = { - { 0, 1, 1, 0, 7 }, /* Y */ - { 0, 1, 2, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_GBRP] = { - .name = "gbrp", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 0, 1, 0, 7 }, /* R */ - { 0, 0, 1, 0, 7 }, /* G */ - { 1, 0, 1, 0, 7 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP9LE] = { - .name = "gbrp9le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 8 }, /* R */ - { 0, 1, 1, 0, 8 }, /* G */ - { 1, 1, 1, 0, 8 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP9BE] = { - .name = "gbrp9be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 8 }, /* R */ - { 0, 1, 1, 0, 8 }, /* G */ - { 1, 1, 1, 0, 8 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP10LE] = { - .name = "gbrp10le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 9 }, /* R */ - { 0, 1, 1, 0, 9 }, /* G */ - { 1, 1, 1, 0, 9 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP10BE] = { - .name = "gbrp10be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 9 }, /* R */ - { 0, 1, 1, 0, 9 }, /* G */ - { 1, 1, 1, 0, 9 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP12LE] = { - .name = "gbrp12le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 11 }, /* R */ - { 0, 1, 1, 0, 11 }, /* G */ - { 1, 1, 1, 0, 11 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP12BE] = { - .name = "gbrp12be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 11 }, /* R */ - { 0, 1, 1, 0, 11 }, /* G */ - { 1, 1, 1, 0, 11 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP14LE] = { - .name = "gbrp14le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 13 }, /* R */ - { 0, 1, 1, 0, 13 }, /* G */ - { 1, 1, 1, 0, 13 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP14BE] = { - .name = "gbrp14be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 13 }, /* R */ - { 0, 1, 1, 0, 13 }, /* G */ - { 1, 1, 1, 0, 13 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP16LE] = { - .name = "gbrp16le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 15 }, /* R */ - { 0, 1, 1, 0, 15 }, /* G */ - { 1, 1, 1, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRP16BE] = { - .name = "gbrp16be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 15 }, /* R */ - { 0, 1, 1, 0, 15 }, /* G */ - { 1, 1, 1, 0, 15 }, /* B */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_GBRAP] = { - .name = "gbrap", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 0, 1, 0, 7 }, /* R */ - { 0, 0, 1, 0, 7 }, /* G */ - { 1, 0, 1, 0, 7 }, /* B */ - { 3, 0, 1, 0, 7 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_GBRAP16LE] = { - .name = "gbrap16le", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 15 }, /* R */ - { 0, 1, 1, 0, 15 }, /* G */ - { 1, 1, 1, 0, 15 }, /* B */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_GBRAP16BE] = { - .name = "gbrap16be", - .nb_components = 4, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 2, 1, 1, 0, 15 }, /* R */ - { 0, 1, 1, 0, 15 }, /* G */ - { 1, 1, 1, 0, 15 }, /* B */ - { 3, 1, 1, 0, 15 }, /* A */ - }, - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, - }, - [AV_PIX_FMT_VDPAU] = { - .name = "vdpau", - .log2_chroma_w = 1, - .log2_chroma_h = 1, - .flags = AV_PIX_FMT_FLAG_HWACCEL, - }, - [AV_PIX_FMT_XYZ12LE] = { - .name = "xyz12le", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 1, 4, 11 }, /* X */ - { 0, 5, 3, 4, 11 }, /* Y */ - { 0, 5, 5, 4, 11 }, /* Z */ - }, - /*.flags = -- not used*/ - }, - [AV_PIX_FMT_XYZ12BE] = { - .name = "xyz12be", - .nb_components = 3, - .log2_chroma_w = 0, - .log2_chroma_h = 0, - .comp = { - { 0, 5, 1, 4, 11 }, /* X */ - { 0, 5, 3, 4, 11 }, /* Y */ - { 0, 5, 5, 4, 11 }, /* Z */ - }, - .flags = AV_PIX_FMT_FLAG_BE, - }, - -#define BAYER8_DESC_COMMON \ - .nb_components= 3, \ - .log2_chroma_w= 0, \ - .log2_chroma_h= 0, \ - .comp = { \ - {0,0,0,0,1}, \ - {0,0,0,0,3}, \ - {0,0,0,0,1}, \ - }, \ - -#define BAYER16_DESC_COMMON \ - .nb_components= 3, \ - .log2_chroma_w= 0, \ - .log2_chroma_h= 0, \ - .comp = { \ - {0,1,0,0, 3}, \ - {0,1,0,0, 7}, \ - {0,1,0,0, 3}, \ - }, \ - - [AV_PIX_FMT_BAYER_BGGR8] = { - .name = "bayer_bggr8", - BAYER8_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_BGGR16LE] = { - .name = "bayer_bggr16le", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_BGGR16BE] = { - .name = "bayer_bggr16be", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_RGGB8] = { - .name = "bayer_rggb8", - BAYER8_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_RGGB16LE] = { - .name = "bayer_rggb16le", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_RGGB16BE] = { - .name = "bayer_rggb16be", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GBRG8] = { - .name = "bayer_gbrg8", - BAYER8_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GBRG16LE] = { - .name = "bayer_gbrg16le", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GBRG16BE] = { - .name = "bayer_gbrg16be", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GRBG8] = { - .name = "bayer_grbg8", - BAYER8_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GRBG16LE] = { - .name = "bayer_grbg16le", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_BAYER_GRBG16BE] = { - .name = "bayer_grbg16be", - BAYER16_DESC_COMMON - .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB, - }, - [AV_PIX_FMT_NV16] = { - .name = "nv16", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 0, 1, 0, 7 }, /* Y */ - { 1, 1, 1, 0, 7 }, /* U */ - { 1, 1, 2, 0, 7 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_NV20LE] = { - .name = "nv20le", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 3, 1, 0, 9 }, /* U */ - { 1, 3, 3, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR, - }, - [AV_PIX_FMT_NV20BE] = { - .name = "nv20be", - .nb_components = 3, - .log2_chroma_w = 1, - .log2_chroma_h = 0, - .comp = { - { 0, 1, 1, 0, 9 }, /* Y */ - { 1, 3, 1, 0, 9 }, /* U */ - { 1, 3, 3, 0, 9 }, /* V */ - }, - .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE, - }, -}; - -FF_DISABLE_DEPRECATION_WARNINGS -static enum AVPixelFormat get_pix_fmt_internal(const char *name) -{ - enum AVPixelFormat pix_fmt; - - for (pix_fmt = 0; pix_fmt < AV_PIX_FMT_NB; pix_fmt++) - if (av_pix_fmt_descriptors[pix_fmt].name && - !strcmp(av_pix_fmt_descriptors[pix_fmt].name, name)) - return pix_fmt; - - return AV_PIX_FMT_NONE; -} - -const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt) -{ - return (unsigned)pix_fmt < AV_PIX_FMT_NB ? - av_pix_fmt_descriptors[pix_fmt].name : NULL; -} - -#if HAVE_BIGENDIAN -# define X_NE(be, le) be -#else -# define X_NE(be, le) le -#endif - -enum AVPixelFormat av_get_pix_fmt(const char *name) -{ - enum AVPixelFormat pix_fmt; - - if (!strcmp(name, "rgb32")) - name = X_NE("argb", "bgra"); - else if (!strcmp(name, "bgr32")) - name = X_NE("abgr", "rgba"); - - pix_fmt = get_pix_fmt_internal(name); - if (pix_fmt == AV_PIX_FMT_NONE) { - char name2[32]; - - snprintf(name2, sizeof(name2), "%s%s", name, X_NE("be", "le")); - pix_fmt = get_pix_fmt_internal(name2); - } - return pix_fmt; -} - -int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) -{ - int c, bits = 0; - int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h; - - for (c = 0; c < pixdesc->nb_components; c++) { - int s = c == 1 || c == 2 ? 0 : log2_pixels; - bits += (pixdesc->comp[c].depth_minus1 + 1) << s; - } - - return bits >> log2_pixels; -} - -int av_get_padded_bits_per_pixel(const AVPixFmtDescriptor *pixdesc) -{ - int c, bits = 0; - int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h; - int steps[4] = {0}; - - for (c = 0; c < pixdesc->nb_components; c++) { - const AVComponentDescriptor *comp = &pixdesc->comp[c]; - int s = c == 1 || c == 2 ? 0 : log2_pixels; - steps[comp->plane] = (comp->step_minus1 + 1) << s; - } - for (c = 0; c < 4; c++) - bits += steps[c]; - - if(!(pixdesc->flags & AV_PIX_FMT_FLAG_BITSTREAM)) - bits *= 8; - - return bits >> log2_pixels; -} - -char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt) -{ - /* print header */ - if (pix_fmt < 0) { - snprintf (buf, buf_size, "name" " nb_components" " nb_bits"); - } else { - const AVPixFmtDescriptor *pixdesc = &av_pix_fmt_descriptors[pix_fmt]; - snprintf(buf, buf_size, "%-11s %7d %10d", pixdesc->name, - pixdesc->nb_components, av_get_bits_per_pixel(pixdesc)); - } - - return buf; -} - -const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) -{ - if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) - return NULL; - return &av_pix_fmt_descriptors[pix_fmt]; -} - -const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) -{ - if (!prev) - return &av_pix_fmt_descriptors[0]; - while (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) { - prev++; - if (prev->name) - return prev; - } - return NULL; -} - -enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) -{ - if (desc < av_pix_fmt_descriptors || - desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) - return AV_PIX_FMT_NONE; - - return desc - av_pix_fmt_descriptors; -} -FF_ENABLE_DEPRECATION_WARNINGS - -int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, - int *h_shift, int *v_shift) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - if (!desc) - return AVERROR(ENOSYS); - *h_shift = desc->log2_chroma_w; - *v_shift = desc->log2_chroma_h; - - return 0; -} - -int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - int i, planes[4] = { 0 }, ret = 0; - - if (!desc) - return AVERROR(EINVAL); - - for (i = 0; i < desc->nb_components; i++) - planes[desc->comp[i].plane] = 1; - for (i = 0; i < FF_ARRAY_ELEMS(planes); i++) - ret += planes[i]; - return ret; -} - -void ff_check_pixfmt_descriptors(void){ - int i, j; - - for (i=0; iname && !d->nb_components && !d->log2_chroma_w && !d->log2_chroma_h && !d->flags) - continue; -// av_log(NULL, AV_LOG_DEBUG, "Checking: %s\n", d->name); - av_assert0(d->log2_chroma_w <= 3); - av_assert0(d->log2_chroma_h <= 3); - av_assert0(d->nb_components <= 4); - av_assert0(d->name && d->name[0]); - av_assert0((d->nb_components==4 || d->nb_components==2) == !!(d->flags & AV_PIX_FMT_FLAG_ALPHA)); - av_assert2(av_get_pix_fmt(d->name) == i); - - for (j=0; jcomp); j++) { - const AVComponentDescriptor *c = &d->comp[j]; - if(j>=d->nb_components) { - av_assert0(!c->plane && !c->step_minus1 && !c->offset_plus1 && !c->shift && !c->depth_minus1); - continue; - } - if (d->flags & AV_PIX_FMT_FLAG_BITSTREAM) { - av_assert0(c->step_minus1 >= c->depth_minus1); - } else { - av_assert0(8*(c->step_minus1+1) >= c->depth_minus1+1); - } - if (!strncmp(d->name, "bayer_", 6)) - continue; - av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0); - av_assert0(tmp[0] == 0 && tmp[1] == 0); - tmp[0] = tmp[1] = (1<<(c->depth_minus1 + 1)) - 1; - av_write_image_line(tmp, data, linesize, d, 0, 0, j, 2); - } - } -} - - -enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt) -{ - const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); - char name[16]; - int i; - - if (!desc || strlen(desc->name) < 2) - return AV_PIX_FMT_NONE; - av_strlcpy(name, desc->name, sizeof(name)); - i = strlen(name) - 2; - if (strcmp(name + i, "be") && strcmp(name + i, "le")) - return AV_PIX_FMT_NONE; - - name[i] ^= 'b' ^ 'l'; - - return get_pix_fmt_internal(name); -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/random_seed.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/random_seed.c deleted file mode 100644 index e3ffaff01..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/random_seed.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2009 Baptiste Coudurier - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#if HAVE_UNISTD_H -#include -#endif -#if HAVE_CRYPTGENRANDOM -#include -#include -#endif -#include -#include -#include -#include -#include "avassert.h" -#include "internal.h" -#include "intreadwrite.h" -#include "timer.h" -#include "random_seed.h" -#include "sha.h" - -#ifndef TEST -#define TEST 0 -#endif - -static int read_random(uint32_t *dst, const char *file) -{ -#if HAVE_UNISTD_H - int fd = avpriv_open(file, O_RDONLY); - int err = -1; - - if (fd == -1) - return -1; - err = read(fd, dst, sizeof(*dst)); - close(fd); - - return err; -#else - return -1; -#endif -} - -static uint32_t get_generic_seed(void) -{ - uint8_t tmp[120]; - struct AVSHA *sha = (void*)tmp; - clock_t last_t = 0; - static uint64_t i = 0; - static uint32_t buffer[512] = { 0 }; - unsigned char digest[20]; - uint64_t last_i = i; - - av_assert0(sizeof(tmp) >= av_sha_size); - - if(TEST){ - memset(buffer, 0, sizeof(buffer)); - last_i = i = 0; - }else{ -#ifdef AV_READ_TIME - buffer[13] ^= AV_READ_TIME(); - buffer[41] ^= AV_READ_TIME()>>32; -#endif - } - - for (;;) { - clock_t t = clock(); - - if (last_t == t) { - buffer[i & 511]++; - } else { - buffer[++i & 511] += (t - last_t) % 3294638521U; - if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i - last_i > 8) - break; - } - last_t = t; - } - - if(TEST) - buffer[0] = buffer[1] = 0; - - av_sha_init(sha, 160); - av_sha_update(sha, (const uint8_t *)buffer, sizeof(buffer)); - av_sha_final(sha, digest); - return AV_RB32(digest) + AV_RB32(digest + 16); -} - -uint32_t av_get_random_seed(void) -{ - uint32_t seed; - -#if HAVE_CRYPTGENRANDOM - HCRYPTPROV provider; - if (CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT | CRYPT_SILENT)) { - BOOL ret = CryptGenRandom(provider, sizeof(seed), (PBYTE) &seed); - CryptReleaseContext(provider, 0); - if (ret) - return seed; - } -#endif - - if (read_random(&seed, "/dev/urandom") == sizeof(seed)) - return seed; - if (read_random(&seed, "/dev/random") == sizeof(seed)) - return seed; - return get_generic_seed(); -} - -#if TEST -#undef printf -#define N 256 -#include - -int main(void) -{ - int i, j, retry; - uint32_t seeds[N]; - - for (retry=0; retry<3; retry++){ - for (i=0; i - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * rational numbers - * @author Michael Niedermayer - */ - -#include "avassert.h" -#include - -#include "common.h" -#include "mathematics.h" -#include "rational.h" - -int av_reduce(int *dst_num, int *dst_den, - int64_t num, int64_t den, int64_t max) -{ - AVRational a0 = { 0, 1 }, a1 = { 1, 0 }; - int sign = (num < 0) ^ (den < 0); - int64_t gcd = av_gcd(FFABS(num), FFABS(den)); - - if (gcd) { - num = FFABS(num) / gcd; - den = FFABS(den) / gcd; - } - if (num <= max && den <= max) { - a1 = (AVRational) { num, den }; - den = 0; - } - - while (den) { - uint64_t x = num / den; - int64_t next_den = num - den * x; - int64_t a2n = x * a1.num + a0.num; - int64_t a2d = x * a1.den + a0.den; - - if (a2n > max || a2d > max) { - if (a1.num) x = (max - a0.num) / a1.num; - if (a1.den) x = FFMIN(x, (max - a0.den) / a1.den); - - if (den * (2 * x * a1.den + a0.den) > num * a1.den) - a1 = (AVRational) { x * a1.num + a0.num, x * a1.den + a0.den }; - break; - } - - a0 = a1; - a1 = (AVRational) { a2n, a2d }; - num = den; - den = next_den; - } - av_assert2(av_gcd(a1.num, a1.den) <= 1U); - - *dst_num = sign ? -a1.num : a1.num; - *dst_den = a1.den; - - return den == 0; -} - -AVRational av_mul_q(AVRational b, AVRational c) -{ - av_reduce(&b.num, &b.den, - b.num * (int64_t) c.num, - b.den * (int64_t) c.den, INT_MAX); - return b; -} - -AVRational av_div_q(AVRational b, AVRational c) -{ - return av_mul_q(b, (AVRational) { c.den, c.num }); -} - -AVRational av_add_q(AVRational b, AVRational c) { - av_reduce(&b.num, &b.den, - b.num * (int64_t) c.den + - c.num * (int64_t) b.den, - b.den * (int64_t) c.den, INT_MAX); - return b; -} - -AVRational av_sub_q(AVRational b, AVRational c) -{ - return av_add_q(b, (AVRational) { -c.num, c.den }); -} - -AVRational av_d2q(double d, int max) -{ - AVRational a; -#define LOG2 0.69314718055994530941723212145817656807550013436025 - int exponent; - int64_t den; - if (isnan(d)) - return (AVRational) { 0,0 }; - if (fabs(d) > INT_MAX + 3LL) - return (AVRational) { d < 0 ? -1 : 1, 0 }; - exponent = FFMAX( (int)(log(fabs(d) + 1e-20)/LOG2), 0); - den = 1LL << (61 - exponent); - // (int64_t)rint() and llrint() do not work with gcc on ia64 and sparc64 - av_reduce(&a.num, &a.den, floor(d * den + 0.5), den, max); - if ((!a.num || !a.den) && d && max>0 && max n => a*d/b > n */ - int64_t x_up = av_rescale_rnd(a, q.den, b, AV_ROUND_UP); - - /* rnd_down(a*d/b) < n => a*d/b < n */ - int64_t x_down = av_rescale_rnd(a, q.den, b, AV_ROUND_DOWN); - - return ((x_up > q.num) - (x_down < q.num)) * av_cmp_q(q2, q1); -} - -int av_find_nearest_q_idx(AVRational q, const AVRational* q_list) -{ - int i, nearest_q_idx = 0; - for (i = 0; q_list[i].den; i++) - if (av_nearer_q(q, q_list[i], q_list[nearest_q_idx]) > 0) - nearest_q_idx = i; - - return nearest_q_idx; -} - -#ifdef TEST -int main(void) -{ - AVRational a,b,r; - for (a.num = -2; a.num <= 2; a.num++) { - for (a.den = -2; a.den <= 2; a.den++) { - for (b.num = -2; b.num <= 2; b.num++) { - for (b.den = -2; b.den <= 2; b.den++) { - int c = av_cmp_q(a,b); - double d = av_q2d(a) == av_q2d(b) ? - 0 : (av_q2d(a) - av_q2d(b)); - if (d > 0) d = 1; - else if (d < 0) d = -1; - else if (d != d) d = INT_MIN; - if (c != d) - av_log(NULL, AV_LOG_ERROR, "%d/%d %d/%d, %d %f\n", a.num, - a.den, b.num, b.den, c,d); - r = av_sub_q(av_add_q(b,a), b); - if(b.den && (r.num*a.den != a.num*r.den || !r.num != !a.num || !r.den != !a.den)) - av_log(NULL, AV_LOG_ERROR, "%d/%d ", r.num, r.den); - } - } - } - } - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.c deleted file mode 100644 index 4e52ba5ac..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * RC4 encryption/decryption/pseudo-random number generator - * Copyright (c) 2007 Reimar Doeffinger - * - * loosely based on LibTomCrypt by Tom St Denis - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ -#include "avutil.h" -#include "common.h" -#include "rc4.h" - -typedef struct AVRC4 AVRC4; - -int av_rc4_init(AVRC4 *r, const uint8_t *key, int key_bits, int decrypt) { - int i, j; - uint8_t y; - uint8_t *state = r->state; - int keylen = key_bits >> 3; - if (key_bits & 7) - return -1; - for (i = 0; i < 256; i++) - state[i] = i; - y = 0; - // j is i % keylen - for (j = 0, i = 0; i < 256; i++, j++) { - if (j == keylen) j = 0; - y += state[i] + key[j]; - FFSWAP(uint8_t, state[i], state[y]); - } - r->x = 1; - r->y = state[1]; - return 0; -} - -void av_rc4_crypt(AVRC4 *r, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt) { - uint8_t x = r->x, y = r->y; - uint8_t *state = r->state; - while (count-- > 0) { - uint8_t sum = state[x] + state[y]; - FFSWAP(uint8_t, state[x], state[y]); - *dst++ = src ? *src++ ^ state[sum] : state[sum]; - x++; - y += state[x]; - } - r->x = x; r->y = y; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.c deleted file mode 100644 index 08ecc8346..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "common.h" -#include "samplefmt.h" - -#include -#include -#include - -typedef struct SampleFmtInfo { - char name[8]; - int bits; - int planar; - enum AVSampleFormat altform; ///< planar<->packed alternative form -} SampleFmtInfo; - -/** this table gives more information about formats */ -static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = { - [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_U8P }, - [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0, .altform = AV_SAMPLE_FMT_S16P }, - [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_S32P }, - [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_FLTP }, - [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_DBLP }, - [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_U8 }, - [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1, .altform = AV_SAMPLE_FMT_S16 }, - [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_S32 }, - [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT }, - [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL }, -}; - -const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt) -{ - if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) - return NULL; - return sample_fmt_info[sample_fmt].name; -} - -enum AVSampleFormat av_get_sample_fmt(const char *name) -{ - int i; - - for (i = 0; i < AV_SAMPLE_FMT_NB; i++) - if (!strcmp(sample_fmt_info[i].name, name)) - return i; - return AV_SAMPLE_FMT_NONE; -} - -enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar) -{ - if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) - return AV_SAMPLE_FMT_NONE; - if (sample_fmt_info[sample_fmt].planar == planar) - return sample_fmt; - return sample_fmt_info[sample_fmt].altform; -} - -enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt) -{ - if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) - return AV_SAMPLE_FMT_NONE; - if (sample_fmt_info[sample_fmt].planar) - return sample_fmt_info[sample_fmt].altform; - return sample_fmt; -} - -enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt) -{ - if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) - return AV_SAMPLE_FMT_NONE; - if (sample_fmt_info[sample_fmt].planar) - return sample_fmt; - return sample_fmt_info[sample_fmt].altform; -} - -char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt) -{ - /* print header */ - if (sample_fmt < 0) - snprintf(buf, buf_size, "name " " depth"); - else if (sample_fmt < AV_SAMPLE_FMT_NB) { - SampleFmtInfo info = sample_fmt_info[sample_fmt]; - snprintf (buf, buf_size, "%-6s" " %2d ", info.name, info.bits); - } - - return buf; -} - -int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt) -{ - return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? - 0 : sample_fmt_info[sample_fmt].bits >> 3; -} - -#if FF_API_GET_BITS_PER_SAMPLE_FMT -int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt) -{ - return sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB ? - 0 : sample_fmt_info[sample_fmt].bits; -} -#endif - -int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt) -{ - if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) - return 0; - return sample_fmt_info[sample_fmt].planar; -} - -int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, - enum AVSampleFormat sample_fmt, int align) -{ - int line_size; - int sample_size = av_get_bytes_per_sample(sample_fmt); - int planar = av_sample_fmt_is_planar(sample_fmt); - - /* validate parameter ranges */ - if (!sample_size || nb_samples <= 0 || nb_channels <= 0) - return AVERROR(EINVAL); - - /* auto-select alignment if not specified */ - if (!align) { - align = 1; - nb_samples = FFALIGN(nb_samples, 32); - } - - /* check for integer overflow */ - if (nb_channels > INT_MAX / align || - (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) - return AVERROR(EINVAL); - - line_size = planar ? FFALIGN(nb_samples * sample_size, align) : - FFALIGN(nb_samples * sample_size * nb_channels, align); - if (linesize) - *linesize = line_size; - - return planar ? line_size * nb_channels : line_size; -} - -int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, - const uint8_t *buf, int nb_channels, int nb_samples, - enum AVSampleFormat sample_fmt, int align) -{ - int ch, planar, buf_size, line_size; - - planar = av_sample_fmt_is_planar(sample_fmt); - buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples, - sample_fmt, align); - if (buf_size < 0) - return buf_size; - - audio_data[0] = (uint8_t *)buf; - for (ch = 1; planar && ch < nb_channels; ch++) - audio_data[ch] = audio_data[ch-1] + line_size; - - if (linesize) - *linesize = line_size; - -#if FF_API_SAMPLES_UTILS_RETURN_ZERO - return 0; -#else - return buf_size; -#endif -} - -int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, - int nb_samples, enum AVSampleFormat sample_fmt, int align) -{ - uint8_t *buf; - int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, - sample_fmt, align); - if (size < 0) - return size; - - buf = av_malloc(size); - if (!buf) - return AVERROR(ENOMEM); - - size = av_samples_fill_arrays(audio_data, linesize, buf, nb_channels, - nb_samples, sample_fmt, align); - if (size < 0) { - av_free(buf); - return size; - } - - av_samples_set_silence(audio_data, 0, nb_samples, nb_channels, sample_fmt); - -#if FF_API_SAMPLES_UTILS_RETURN_ZERO - return 0; -#else - return size; -#endif -} - -int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, - int nb_samples, enum AVSampleFormat sample_fmt, int align) -{ - int ret, nb_planes = av_sample_fmt_is_planar(sample_fmt) ? nb_channels : 1; - - *audio_data = av_calloc(nb_planes, sizeof(**audio_data)); - if (!*audio_data) - return AVERROR(ENOMEM); - ret = av_samples_alloc(*audio_data, linesize, nb_channels, - nb_samples, sample_fmt, align); - if (ret < 0) - av_freep(audio_data); - return ret; -} - -int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, - int src_offset, int nb_samples, int nb_channels, - enum AVSampleFormat sample_fmt) -{ - int planar = av_sample_fmt_is_planar(sample_fmt); - int planes = planar ? nb_channels : 1; - int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels); - int data_size = nb_samples * block_align; - int i; - - dst_offset *= block_align; - src_offset *= block_align; - - if((dst[0] < src[0] ? src[0] - dst[0] : dst[0] - src[0]) >= data_size) { - for (i = 0; i < planes; i++) - memcpy(dst[i] + dst_offset, src[i] + src_offset, data_size); - } else { - for (i = 0; i < planes; i++) - memmove(dst[i] + dst_offset, src[i] + src_offset, data_size); - } - - return 0; -} - -int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, - int nb_channels, enum AVSampleFormat sample_fmt) -{ - int planar = av_sample_fmt_is_planar(sample_fmt); - int planes = planar ? nb_channels : 1; - int block_align = av_get_bytes_per_sample(sample_fmt) * (planar ? 1 : nb_channels); - int data_size = nb_samples * block_align; - int fill_char = (sample_fmt == AV_SAMPLE_FMT_U8 || - sample_fmt == AV_SAMPLE_FMT_U8P) ? 0x80 : 0x00; - int i; - - offset *= block_align; - - for (i = 0; i < planes; i++) - memset(audio_data[i] + offset, fill_char, data_size); - - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/sha.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/sha.c deleted file mode 100644 index 0cf94245a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/sha.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer - * Copyright (C) 2009 Konstantin Shishkov - * based on public domain SHA-1 code by Steve Reid - * and on BSD-licensed SHA-2 code by Aaron D. Gifford - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include - -#include "attributes.h" -#include "avutil.h" -#include "bswap.h" -#include "sha.h" -#include "intreadwrite.h" -#include "mem.h" - -/** hash context */ -typedef struct AVSHA { - uint8_t digest_len; ///< digest length in 32-bit words - uint64_t count; ///< number of bytes in buffer - uint8_t buffer[64]; ///< 512-bit buffer of input values used in hash updating - uint32_t state[8]; ///< current hash value - /** function used to update hash for 512-bit input block */ - void (*transform)(uint32_t *state, const uint8_t buffer[64]); -} AVSHA; - -const int av_sha_size = sizeof(AVSHA); - -struct AVSHA *av_sha_alloc(void) -{ - return av_mallocz(sizeof(struct AVSHA)); -} - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define blk0(i) (block[i] = AV_RB32(buffer + 4 * (i))) -#define blk(i) (block[i] = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1)) - -#define R0(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk0(i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); -#define R1(v,w,x,y,z,i) z += ((w&(x^y))^y) + blk (i) + 0x5A827999 + rol(v, 5); w = rol(w, 30); -#define R2(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30); -#define R3(v,w,x,y,z,i) z += (((w|x)&y)|(w&x)) + blk (i) + 0x8F1BBCDC + rol(v, 5); w = rol(w, 30); -#define R4(v,w,x,y,z,i) z += ( w^x ^y) + blk (i) + 0xCA62C1D6 + rol(v, 5); w = rol(w, 30); - -/* Hash a single 512-bit block. This is the core of the algorithm. */ - -static void sha1_transform(uint32_t state[5], const uint8_t buffer[64]) -{ - uint32_t block[80]; - unsigned int i, a, b, c, d, e; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; -#if CONFIG_SMALL - for (i = 0; i < 80; i++) { - int t; - if (i < 16) - t = AV_RB32(buffer + 4 * i); - else - t = rol(block[i-3] ^ block[i-8] ^ block[i-14] ^ block[i-16], 1); - block[i] = t; - t += e + rol(a, 5); - if (i < 40) { - if (i < 20) - t += ((b&(c^d))^d) + 0x5A827999; - else - t += ( b^c ^d) + 0x6ED9EBA1; - } else { - if (i < 60) - t += (((b|c)&d)|(b&c)) + 0x8F1BBCDC; - else - t += ( b^c ^d) + 0xCA62C1D6; - } - e = d; - d = c; - c = rol(b, 30); - b = a; - a = t; - } -#else - -#define R1_0 \ - R0(a, b, c, d, e, 0 + i); \ - R0(e, a, b, c, d, 1 + i); \ - R0(d, e, a, b, c, 2 + i); \ - R0(c, d, e, a, b, 3 + i); \ - R0(b, c, d, e, a, 4 + i); \ - i += 5 - - i = 0; - R1_0; R1_0; R1_0; - R0(a, b, c, d, e, 15); - R1(e, a, b, c, d, 16); - R1(d, e, a, b, c, 17); - R1(c, d, e, a, b, 18); - R1(b, c, d, e, a, 19); - -#define R1_20 \ - R2(a, b, c, d, e, 0 + i); \ - R2(e, a, b, c, d, 1 + i); \ - R2(d, e, a, b, c, 2 + i); \ - R2(c, d, e, a, b, 3 + i); \ - R2(b, c, d, e, a, 4 + i); \ - i += 5 - - i = 20; - R1_20; R1_20; R1_20; R1_20; - -#define R1_40 \ - R3(a, b, c, d, e, 0 + i); \ - R3(e, a, b, c, d, 1 + i); \ - R3(d, e, a, b, c, 2 + i); \ - R3(c, d, e, a, b, 3 + i); \ - R3(b, c, d, e, a, 4 + i); \ - i += 5 - - R1_40; R1_40; R1_40; R1_40; - -#define R1_60 \ - R4(a, b, c, d, e, 0 + i); \ - R4(e, a, b, c, d, 1 + i); \ - R4(d, e, a, b, c, 2 + i); \ - R4(c, d, e, a, b, 3 + i); \ - R4(b, c, d, e, a, 4 + i); \ - i += 5 - - R1_60; R1_60; R1_60; R1_60; -#endif - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; -} - -static const uint32_t K256[64] = { - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2 -}; - - -#define Ch(x,y,z) (((x) & ((y) ^ (z))) ^ (z)) -#define Maj(z,y,x) ((((x) | (y)) & (z)) | ((x) & (y))) - -#define Sigma0_256(x) (rol((x), 30) ^ rol((x), 19) ^ rol((x), 10)) -#define Sigma1_256(x) (rol((x), 26) ^ rol((x), 21) ^ rol((x), 7)) -#define sigma0_256(x) (rol((x), 25) ^ rol((x), 14) ^ ((x) >> 3)) -#define sigma1_256(x) (rol((x), 15) ^ rol((x), 13) ^ ((x) >> 10)) - -#undef blk -#define blk(i) (block[i] = block[i - 16] + sigma0_256(block[i - 15]) + \ - sigma1_256(block[i - 2]) + block[i - 7]) - -#define ROUND256(a,b,c,d,e,f,g,h) \ - T1 += (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[i]; \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - i++ - -#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ - T1 = blk0(i); \ - ROUND256(a,b,c,d,e,f,g,h) - -#define ROUND256_16_TO_63(a,b,c,d,e,f,g,h) \ - T1 = blk(i); \ - ROUND256(a,b,c,d,e,f,g,h) - -static void sha256_transform(uint32_t *state, const uint8_t buffer[64]) -{ - unsigned int i, a, b, c, d, e, f, g, h; - uint32_t block[64]; - uint32_t T1; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - f = state[5]; - g = state[6]; - h = state[7]; -#if CONFIG_SMALL - for (i = 0; i < 64; i++) { - uint32_t T2; - if (i < 16) - T1 = blk0(i); - else - T1 = blk(i); - T1 += h + Sigma1_256(e) + Ch(e, f, g) + K256[i]; - T2 = Sigma0_256(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - } -#else - - i = 0; -#define R256_0 \ - ROUND256_0_TO_15(a, b, c, d, e, f, g, h); \ - ROUND256_0_TO_15(h, a, b, c, d, e, f, g); \ - ROUND256_0_TO_15(g, h, a, b, c, d, e, f); \ - ROUND256_0_TO_15(f, g, h, a, b, c, d, e); \ - ROUND256_0_TO_15(e, f, g, h, a, b, c, d); \ - ROUND256_0_TO_15(d, e, f, g, h, a, b, c); \ - ROUND256_0_TO_15(c, d, e, f, g, h, a, b); \ - ROUND256_0_TO_15(b, c, d, e, f, g, h, a) - - R256_0; R256_0; - -#define R256_16 \ - ROUND256_16_TO_63(a, b, c, d, e, f, g, h); \ - ROUND256_16_TO_63(h, a, b, c, d, e, f, g); \ - ROUND256_16_TO_63(g, h, a, b, c, d, e, f); \ - ROUND256_16_TO_63(f, g, h, a, b, c, d, e); \ - ROUND256_16_TO_63(e, f, g, h, a, b, c, d); \ - ROUND256_16_TO_63(d, e, f, g, h, a, b, c); \ - ROUND256_16_TO_63(c, d, e, f, g, h, a, b); \ - ROUND256_16_TO_63(b, c, d, e, f, g, h, a) - - R256_16; R256_16; R256_16; - R256_16; R256_16; R256_16; -#endif - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; - state[5] += f; - state[6] += g; - state[7] += h; -} - - -av_cold int av_sha_init(AVSHA *ctx, int bits) -{ - ctx->digest_len = bits >> 5; - switch (bits) { - case 160: // SHA-1 - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; - ctx->transform = sha1_transform; - break; - case 224: // SHA-224 - ctx->state[0] = 0xC1059ED8; - ctx->state[1] = 0x367CD507; - ctx->state[2] = 0x3070DD17; - ctx->state[3] = 0xF70E5939; - ctx->state[4] = 0xFFC00B31; - ctx->state[5] = 0x68581511; - ctx->state[6] = 0x64F98FA7; - ctx->state[7] = 0xBEFA4FA4; - ctx->transform = sha256_transform; - break; - case 256: // SHA-256 - ctx->state[0] = 0x6A09E667; - ctx->state[1] = 0xBB67AE85; - ctx->state[2] = 0x3C6EF372; - ctx->state[3] = 0xA54FF53A; - ctx->state[4] = 0x510E527F; - ctx->state[5] = 0x9B05688C; - ctx->state[6] = 0x1F83D9AB; - ctx->state[7] = 0x5BE0CD19; - ctx->transform = sha256_transform; - break; - default: - return -1; - } - ctx->count = 0; - return 0; -} - -void av_sha_update(AVSHA* ctx, const uint8_t* data, unsigned int len) -{ - unsigned int i, j; - - j = ctx->count & 63; - ctx->count += len; -#if CONFIG_SMALL - for (i = 0; i < len; i++) { - ctx->buffer[j++] = data[i]; - if (64 == j) { - ctx->transform(ctx->state, ctx->buffer); - j = 0; - } - } -#else - if ((j + len) > 63) { - memcpy(&ctx->buffer[j], data, (i = 64 - j)); - ctx->transform(ctx->state, ctx->buffer); - for (; i + 63 < len; i += 64) - ctx->transform(ctx->state, &data[i]); - j = 0; - } else - i = 0; - memcpy(&ctx->buffer[j], &data[i], len - i); -#endif -} - -void av_sha_final(AVSHA* ctx, uint8_t *digest) -{ - int i; - uint64_t finalcount = av_be2ne64(ctx->count << 3); - - av_sha_update(ctx, "\200", 1); - while ((ctx->count & 63) != 56) - av_sha_update(ctx, "", 1); - av_sha_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */ - for (i = 0; i < ctx->digest_len; i++) - AV_WB32(digest + i*4, ctx->state[i]); -} - -#ifdef TEST -#include - -int main(void) -{ - int i, j, k; - AVSHA ctx; - unsigned char digest[32]; - static const int lengths[3] = { 160, 224, 256 }; - - for (j = 0; j < 3; j++) { - printf("Testing SHA-%d\n", lengths[j]); - for (k = 0; k < 3; k++) { - av_sha_init(&ctx, lengths[j]); - if (k == 0) - av_sha_update(&ctx, "abc", 3); - else if (k == 1) - av_sha_update(&ctx, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56); - else - for (i = 0; i < 1000*1000; i++) - av_sha_update(&ctx, "a", 1); - av_sha_final(&ctx, digest); - for (i = 0; i < lengths[j] >> 3; i++) - printf("%02X", digest[i]); - putchar('\n'); - } - switch (j) { - case 0: - //test vectors (from FIPS PUB 180-1) - printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n" - "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n" - "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n"); - break; - case 1: - //test vectors (from FIPS PUB 180-2 Appendix A) - printf("23097d22 3405d822 8642a477 bda255b3 2aadbce4 bda0b3f7 e36c9da7\n" - "75388b16 512776cc 5dba5da1 fd890150 b0c6455c b4f58b19 52522525\n" - "20794655 980c91d8 bbb4c1ea 97618a4b f03f4258 1948b2ee 4ee7ad67\n"); - break; - case 2: - //test vectors (from FIPS PUB 180-2) - printf("ba7816bf 8f01cfea 414140de 5dae2223 b00361a3 96177a9c b410ff61 f20015ad\n" - "248d6a61 d20638b8 e5c02693 0c3e6039 a33ce459 64ff2167 f6ecedd4 19db06c1\n" - "cdc76e5c 9914fb92 81a1c7e2 84d73e67 f1809a48 a497200e 046d39cc c7112cd0\n"); - break; - } - } - - return 0; -} -#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time.c deleted file mode 100644 index 5a00e7025..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2000-2003 Fabrice Bellard - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include -#include -#include -#if HAVE_GETTIMEOFDAY -#include -#endif -#if HAVE_UNISTD_H -#include -#endif -#if HAVE_WINDOWS_H -#include -#endif - -#include "time.h" -#include "error.h" - -int64_t av_gettime(void) -{ -#if HAVE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; -#elif HAVE_GETSYSTEMTIMEASFILETIME - FILETIME ft; - int64_t t; - GetSystemTimeAsFileTime(&ft); - t = (int64_t)ft.dwHighDateTime << 32 | ft.dwLowDateTime; - return t / 10 - 11644473600000000; /* Jan 1, 1601 */ -#else - return -1; -#endif -} - -int av_usleep(unsigned usec) -{ -#if HAVE_NANOSLEEP - struct timespec ts = { usec / 1000000, usec % 1000000 * 1000 }; - while (nanosleep(&ts, &ts) < 0 && errno == EINTR); - return 0; -#elif HAVE_USLEEP - return usleep(usec); -#elif HAVE_SLEEP - Sleep(usec / 1000); - return 0; -#else - return AVERROR(ENOSYS); -#endif -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timecode.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timecode.c deleted file mode 100644 index d396032b9..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timecode.c +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier - * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * Timecode helpers - * @see https://en.wikipedia.org/wiki/SMPTE_time_code - * @see http://www.dropframetimecode.org - */ - -#include -#include "timecode.h" -#include "log.h" -#include "error.h" - -int av_timecode_adjust_ntsc_framenum2(int framenum, int fps) -{ - /* only works for NTSC 29.97 and 59.94 */ - int drop_frames = 0; - int d, m, frames_per_10mins; - - if (fps == 30) { - drop_frames = 2; - frames_per_10mins = 17982; - } else if (fps == 60) { - drop_frames = 4; - frames_per_10mins = 35964; - } else - return framenum; - - d = framenum / frames_per_10mins; - m = framenum % frames_per_10mins; - - return framenum + 9 * drop_frames * d + drop_frames * ((m - drop_frames) / (frames_per_10mins / 10)); -} - -uint32_t av_timecode_get_smpte_from_framenum(const AVTimecode *tc, int framenum) -{ - unsigned fps = tc->fps; - int drop = !!(tc->flags & AV_TIMECODE_FLAG_DROPFRAME); - int hh, mm, ss, ff; - - framenum += tc->start; - if (drop) - framenum = av_timecode_adjust_ntsc_framenum2(framenum, tc->fps); - ff = framenum % fps; - ss = framenum / fps % 60; - mm = framenum / (fps*60) % 60; - hh = framenum / (fps*3600) % 24; - return 0 << 31 | // color frame flag (0: unsync mode, 1: sync mode) - drop << 30 | // drop frame flag (0: non drop, 1: drop) - (ff / 10) << 28 | // tens of frames - (ff % 10) << 24 | // units of frames - 0 << 23 | // PC (NTSC) or BGF0 (PAL) - (ss / 10) << 20 | // tens of seconds - (ss % 10) << 16 | // units of seconds - 0 << 15 | // BGF0 (NTSC) or BGF2 (PAL) - (mm / 10) << 12 | // tens of minutes - (mm % 10) << 8 | // units of minutes - 0 << 7 | // BGF2 (NTSC) or PC (PAL) - 0 << 6 | // BGF1 - (hh / 10) << 4 | // tens of hours - (hh % 10); // units of hours -} - -char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum) -{ - int fps = tc->fps; - int drop = tc->flags & AV_TIMECODE_FLAG_DROPFRAME; - int hh, mm, ss, ff, neg = 0; - - framenum += tc->start; - if (drop) - framenum = av_timecode_adjust_ntsc_framenum2(framenum, fps); - if (framenum < 0) { - framenum = -framenum; - neg = tc->flags & AV_TIMECODE_FLAG_ALLOWNEGATIVE; - } - ff = framenum % fps; - ss = framenum / fps % 60; - mm = framenum / (fps*60) % 60; - hh = framenum / (fps*3600); - if (tc->flags & AV_TIMECODE_FLAG_24HOURSMAX) - hh = hh % 24; - snprintf(buf, AV_TIMECODE_STR_SIZE, "%s%02d:%02d:%02d%c%02d", - neg ? "-" : "", - hh, mm, ss, drop ? ';' : ':', ff); - return buf; -} - -static unsigned bcd2uint(uint8_t bcd) -{ - unsigned low = bcd & 0xf; - unsigned high = bcd >> 4; - if (low > 9 || high > 9) - return 0; - return low + 10*high; -} - -char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_df) -{ - unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours - unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes - unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds - unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames - unsigned drop = tcsmpte & 1<<30 && !prevent_df; // 1-bit drop if not arbitrary bit - snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u", - hh, mm, ss, drop ? ';' : ':', ff); - return buf; -} - -char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit) -{ - snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u", - tc25bit>>19 & 0x1f, // 5-bit hours - tc25bit>>13 & 0x3f, // 6-bit minutes - tc25bit>>6 & 0x3f, // 6-bit seconds - tc25bit & 1<<24 ? ';' : ':', // 1-bit drop flag - tc25bit & 0x3f); // 6-bit frames - return buf; -} - -static int check_fps(int fps) -{ - int i; - static const int supported_fps[] = {24, 25, 30, 50, 60}; - - for (i = 0; i < FF_ARRAY_ELEMS(supported_fps); i++) - if (fps == supported_fps[i]) - return 0; - return -1; -} - -static int check_timecode(void *log_ctx, AVTimecode *tc) -{ - if (tc->fps <= 0) { - av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate must be specified\n"); - return AVERROR(EINVAL); - } - if ((tc->flags & AV_TIMECODE_FLAG_DROPFRAME) && tc->fps != 30 && tc->fps != 60) { - av_log(log_ctx, AV_LOG_ERROR, "Drop frame is only allowed with 30000/1001 or 60000/1001 FPS\n"); - return AVERROR(EINVAL); - } - if (check_fps(tc->fps) < 0) { - av_log(log_ctx, AV_LOG_ERROR, "Timecode frame rate %d/%d not supported\n", - tc->rate.num, tc->rate.den); - return AVERROR_PATCHWELCOME; - } - return 0; -} - -static int fps_from_frame_rate(AVRational rate) -{ - if (!rate.den || !rate.num) - return -1; - return (rate.num + rate.den/2) / rate.den; -} - -int av_timecode_check_frame_rate(AVRational rate) -{ - return check_fps(fps_from_frame_rate(rate)); -} - -int av_timecode_init(AVTimecode *tc, AVRational rate, int flags, int frame_start, void *log_ctx) -{ - memset(tc, 0, sizeof(*tc)); - tc->start = frame_start; - tc->flags = flags; - tc->rate = rate; - tc->fps = fps_from_frame_rate(rate); - return check_timecode(log_ctx, tc); -} - -int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx) -{ - char c; - int hh, mm, ss, ff, ret; - - if (sscanf(str, "%d:%d:%d%c%d", &hh, &mm, &ss, &c, &ff) != 5) { - av_log(log_ctx, AV_LOG_ERROR, "Unable to parse timecode, " - "syntax: hh:mm:ss[:;.]ff\n"); - return AVERROR_INVALIDDATA; - } - - memset(tc, 0, sizeof(*tc)); - tc->flags = c != ':' ? AV_TIMECODE_FLAG_DROPFRAME : 0; // drop if ';', '.', ... - tc->rate = rate; - tc->fps = fps_from_frame_rate(rate); - - ret = check_timecode(log_ctx, tc); - if (ret < 0) - return ret; - - tc->start = (hh*3600 + mm*60 + ss) * tc->fps + ff; - if (tc->flags & AV_TIMECODE_FLAG_DROPFRAME) { /* adjust frame number */ - int tmins = 60*hh + mm; - tc->start -= 2 * (tmins - tmins/10); - } - return 0; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timer.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timer.h deleted file mode 100644 index 3e242f346..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timer.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * high precision timer, useful to profile code - */ - -#ifndef AVUTIL_TIMER_H -#define AVUTIL_TIMER_H - -#include -#include -#include - -#include "config.h" - -#if ARCH_ARM -# include "arm/timer.h" -#elif ARCH_BFIN -# include "bfin/timer.h" -#elif ARCH_PPC -# include "ppc/timer.h" -#elif ARCH_X86 -# include "x86/timer.h" -#endif - -#if !defined(AV_READ_TIME) && HAVE_GETHRTIME -# define AV_READ_TIME gethrtime -#endif - -#ifdef AV_READ_TIME -#define START_TIMER \ - uint64_t tend; \ - uint64_t tstart = AV_READ_TIME(); \ - -#define STOP_TIMER(id) \ - tend = AV_READ_TIME(); \ - { \ - static uint64_t tsum = 0; \ - static int tcount = 0; \ - static int tskip_count = 0; \ - if (tcount < 2 || \ - tend - tstart < 8 * tsum / tcount || \ - tend - tstart < 2000) { \ - tsum+= tend - tstart; \ - tcount++; \ - } else \ - tskip_count++; \ - if (((tcount + tskip_count) & (tcount + tskip_count - 1)) == 0) { \ - av_log(NULL, AV_LOG_ERROR, \ - "%"PRIu64" decicycles in %s, %d runs, %d skips\n", \ - tsum * 10 / tcount, id, tcount, tskip_count); \ - } \ - } -#else -#define START_TIMER -#define STOP_TIMER(id) { } -#endif - -#endif /* AVUTIL_TIMER_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/utils.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/utils.c deleted file mode 100644 index eb87c906c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/utils.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" -#include "avutil.h" -#include "avassert.h" -#include "samplefmt.h" -#include "pixdesc.h" - -/** - * @file - * various utility functions - */ - -unsigned avutil_version(void) -{ - static int checks_done; - if (checks_done) - return LIBAVUTIL_VERSION_INT; - - av_assert0(AV_PIX_FMT_VDA_VLD == 81); //check if the pix fmt enum has not had anything inserted or removed by mistake - av_assert0(AV_SAMPLE_FMT_DBLP == 9); - av_assert0(AVMEDIA_TYPE_ATTACHMENT == 4); - av_assert0(AV_PICTURE_TYPE_BI == 7); - av_assert0(LIBAVUTIL_VERSION_MICRO >= 100); - av_assert0(HAVE_MMX2 == HAVE_MMXEXT); - - if (av_sat_dadd32(1, 2) != 5) { - av_log(NULL, AV_LOG_FATAL, "Libavutil has been build with a broken binutils, please upgrade binutils and rebuild\n"); - abort(); - } - - if (llrint(1LL<<60) != 1LL<<60) { - av_log(NULL, AV_LOG_ERROR, "Libavutil has been linked to a broken llrint()\n"); - } - - ff_check_pixfmt_descriptors(); - checks_done = 1; - return LIBAVUTIL_VERSION_INT; -} - -const char *avutil_configuration(void) -{ - return FFMPEG_CONFIGURATION; -} - -const char *avutil_license(void) -{ -#define LICENSE_PREFIX "libavutil license: " - return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1; -} - -const char *av_get_media_type_string(enum AVMediaType media_type) -{ - switch (media_type) { - case AVMEDIA_TYPE_VIDEO: return "video"; - case AVMEDIA_TYPE_AUDIO: return "audio"; - case AVMEDIA_TYPE_DATA: return "data"; - case AVMEDIA_TYPE_SUBTITLE: return "subtitle"; - case AVMEDIA_TYPE_ATTACHMENT: return "attachment"; - default: return NULL; - } -} - -char av_get_picture_type_char(enum AVPictureType pict_type) -{ - switch (pict_type) { - case AV_PICTURE_TYPE_I: return 'I'; - case AV_PICTURE_TYPE_P: return 'P'; - case AV_PICTURE_TYPE_B: return 'B'; - case AV_PICTURE_TYPE_S: return 'S'; - case AV_PICTURE_TYPE_SI: return 'i'; - case AV_PICTURE_TYPE_SP: return 'p'; - case AV_PICTURE_TYPE_BI: return 'b'; - default: return '?'; - } -} - -unsigned av_int_list_length_for_size(unsigned elsize, - const void *list, uint64_t term) -{ - unsigned i; - - if (!list) - return 0; -#define LIST_LENGTH(type) \ - { type t = term, *l = (type *)list; for (i = 0; l[i] != t; i++); } - switch (elsize) { - case 1: LIST_LENGTH(uint8_t); break; - case 2: LIST_LENGTH(uint16_t); break; - case 4: LIST_LENGTH(uint32_t); break; - case 8: LIST_LENGTH(uint64_t); break; - default: av_assert0(!"valid element size"); - } - return i; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/asm.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/asm.h deleted file mode 100644 index 70ccac788..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/asm.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_X86_ASM_H -#define AVUTIL_X86_ASM_H - -#include -#include "config.h" - -typedef struct xmm_reg { uint64_t a, b; } xmm_reg; - -#if ARCH_X86_64 -# define OPSIZE "q" -# define REG_a "rax" -# define REG_b "rbx" -# define REG_c "rcx" -# define REG_d "rdx" -# define REG_D "rdi" -# define REG_S "rsi" -# define PTR_SIZE "8" -typedef int64_t x86_reg; - -# define REG_SP "rsp" -# define REG_BP "rbp" -# define REGBP rbp -# define REGa rax -# define REGb rbx -# define REGc rcx -# define REGd rdx -# define REGSP rsp - -#elif ARCH_X86_32 - -# define OPSIZE "l" -# define REG_a "eax" -# define REG_b "ebx" -# define REG_c "ecx" -# define REG_d "edx" -# define REG_D "edi" -# define REG_S "esi" -# define PTR_SIZE "4" -typedef int32_t x86_reg; - -# define REG_SP "esp" -# define REG_BP "ebp" -# define REGBP ebp -# define REGa eax -# define REGb ebx -# define REGc ecx -# define REGd edx -# define REGSP esp -#else -typedef int x86_reg; -#endif - -#define HAVE_7REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE && HAVE_EBP_AVAILABLE)) -#define HAVE_6REGS (ARCH_X86_64 || (HAVE_EBX_AVAILABLE || HAVE_EBP_AVAILABLE)) - -#if ARCH_X86_64 && defined(PIC) -# define BROKEN_RELOCATIONS 1 -#endif - -/* - * If gcc is not set to support sse (-msse) it will not accept xmm registers - * in the clobber list for inline asm. XMM_CLOBBERS takes a list of xmm - * registers to be marked as clobbered and evaluates to nothing if they are - * not supported, or to the list itself if they are supported. Since a clobber - * list may not be empty, XMM_CLOBBERS_ONLY should be used if the xmm - * registers are the only in the clobber list. - * For example a list with "eax" and "xmm0" as clobbers should become: - * : XMM_CLOBBERS("xmm0",) "eax" - * and a list with only "xmm0" should become: - * XMM_CLOBBERS_ONLY("xmm0") - */ -#if HAVE_XMM_CLOBBERS -# define XMM_CLOBBERS(...) __VA_ARGS__ -# define XMM_CLOBBERS_ONLY(...) : __VA_ARGS__ -#else -# define XMM_CLOBBERS(...) -# define XMM_CLOBBERS_ONLY(...) -#endif - -/* Use to export labels from asm. */ -#define LABEL_MANGLE(a) EXTERN_PREFIX #a - -// Use rip-relative addressing if compiling PIC code on x86-64. -#if ARCH_X86_64 && defined(PIC) -# define LOCAL_MANGLE(a) #a "(%%rip)" -#else -# define LOCAL_MANGLE(a) #a -#endif - -#define MANGLE(a) EXTERN_PREFIX LOCAL_MANGLE(a) - -#endif /* AVUTIL_X86_ASM_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/bswap.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/bswap.h deleted file mode 100644 index 08e2a6252..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/bswap.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -/** - * @file - * byte swapping routines - */ - -#ifndef AVUTIL_X86_BSWAP_H -#define AVUTIL_X86_BSWAP_H - -#include -#include "config.h" -#include "libavutil/attributes.h" - -#if HAVE_INLINE_ASM - -#if !AV_GCC_VERSION_AT_LEAST(4,1) -#define av_bswap16 av_bswap16 -static av_always_inline av_const unsigned av_bswap16(unsigned x) -{ - __asm__("rorw $8, %w0" : "+r"(x)); - return x; -} -#endif /* !AV_GCC_VERSION_AT_LEAST(4,1) */ - -#if !AV_GCC_VERSION_AT_LEAST(4,5) -#define av_bswap32 av_bswap32 -static av_always_inline av_const uint32_t av_bswap32(uint32_t x) -{ - __asm__("bswap %0" : "+r" (x)); - return x; -} - -#if ARCH_X86_64 -#define av_bswap64 av_bswap64 -static inline uint64_t av_const av_bswap64(uint64_t x) -{ - __asm__("bswap %0": "=r" (x) : "0" (x)); - return x; -} -#endif -#endif /* !AV_GCC_VERSION_AT_LEAST(4,5) */ - -#endif /* HAVE_INLINE_ASM */ -#endif /* AVUTIL_X86_BSWAP_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.c deleted file mode 100644 index 81bb15a0a..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * CPU detection code, extracted from mmx.h - * (c)1997-99 by H. Dietz and R. Fisher - * Converted to C and improved by Fabrice Bellard. - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include - -#include "libavutil/x86/asm.h" -#include "libavutil/x86/cpu.h" -#include "libavutil/cpu.h" -#include "libavutil/cpu_internal.h" - -#if HAVE_YASM - -#define cpuid(index, eax, ebx, ecx, edx) \ - ff_cpu_cpuid(index, &eax, &ebx, &ecx, &edx) - -#define xgetbv(index, eax, edx) \ - ff_cpu_xgetbv(index, &eax, &edx) - -#elif HAVE_INLINE_ASM - -/* ebx saving is necessary for PIC. gcc seems unable to see it alone */ -#define cpuid(index, eax, ebx, ecx, edx) \ - __asm__ volatile ( \ - "mov %%"REG_b", %%"REG_S" \n\t" \ - "cpuid \n\t" \ - "xchg %%"REG_b", %%"REG_S \ - : "=a" (eax), "=S" (ebx), "=c" (ecx), "=d" (edx) \ - : "0" (index)) - -#define xgetbv(index, eax, edx) \ - __asm__ (".byte 0x0f, 0x01, 0xd0" : "=a"(eax), "=d"(edx) : "c" (index)) - -#define get_eflags(x) \ - __asm__ volatile ("pushfl \n" \ - "pop %0 \n" \ - : "=r"(x)) - -#define set_eflags(x) \ - __asm__ volatile ("push %0 \n" \ - "popfl \n" \ - :: "r"(x)) - -#endif /* HAVE_INLINE_ASM */ - -#if ARCH_X86_64 - -#define cpuid_test() 1 - -#elif HAVE_YASM - -#define cpuid_test ff_cpu_cpuid_test - -#elif HAVE_INLINE_ASM - -static int cpuid_test(void) -{ - x86_reg a, c; - - /* Check if CPUID is supported by attempting to toggle the ID bit in - * the EFLAGS register. */ - get_eflags(a); - set_eflags(a ^ 0x200000); - get_eflags(c); - - return a != c; -} -#endif - -/* Function to test if multimedia instructions are supported... */ -int ff_get_cpu_flags_x86(void) -{ - int rval = 0; - -#ifdef cpuid - - int eax, ebx, ecx, edx; - int max_std_level, max_ext_level, std_caps = 0, ext_caps = 0; - int family = 0, model = 0; - union { int i[3]; char c[12]; } vendor; - - if (!cpuid_test()) - return 0; /* CPUID not supported */ - - cpuid(0, max_std_level, vendor.i[0], vendor.i[2], vendor.i[1]); - - if (max_std_level >= 1) { - cpuid(1, eax, ebx, ecx, std_caps); - family = ((eax >> 8) & 0xf) + ((eax >> 20) & 0xff); - model = ((eax >> 4) & 0xf) + ((eax >> 12) & 0xf0); - if (std_caps & (1 << 15)) - rval |= AV_CPU_FLAG_CMOV; - if (std_caps & (1 << 23)) - rval |= AV_CPU_FLAG_MMX; - if (std_caps & (1 << 25)) - rval |= AV_CPU_FLAG_MMXEXT; -#if HAVE_SSE - if (std_caps & (1 << 25)) - rval |= AV_CPU_FLAG_SSE; - if (std_caps & (1 << 26)) - rval |= AV_CPU_FLAG_SSE2; - if (ecx & 1) - rval |= AV_CPU_FLAG_SSE3; - if (ecx & 0x00000200 ) - rval |= AV_CPU_FLAG_SSSE3; - if (ecx & 0x00080000 ) - rval |= AV_CPU_FLAG_SSE4; - if (ecx & 0x00100000 ) - rval |= AV_CPU_FLAG_SSE42; -#if HAVE_AVX - /* Check OXSAVE and AVX bits */ - if ((ecx & 0x18000000) == 0x18000000) { - /* Check for OS support */ - xgetbv(0, eax, edx); - if ((eax & 0x6) == 0x6) - rval |= AV_CPU_FLAG_AVX; - } -#endif /* HAVE_AVX */ -#endif /* HAVE_SSE */ - } - - cpuid(0x80000000, max_ext_level, ebx, ecx, edx); - - if (max_ext_level >= 0x80000001) { - cpuid(0x80000001, eax, ebx, ecx, ext_caps); - if (ext_caps & (1U << 31)) - rval |= AV_CPU_FLAG_3DNOW; - if (ext_caps & (1 << 30)) - rval |= AV_CPU_FLAG_3DNOWEXT; - if (ext_caps & (1 << 23)) - rval |= AV_CPU_FLAG_MMX; - if (ext_caps & (1 << 22)) - rval |= AV_CPU_FLAG_MMXEXT; - - /* Allow for selectively disabling SSE2 functions on AMD processors - with SSE2 support but not SSE4a. This includes Athlon64, some - Opteron, and some Sempron processors. MMX, SSE, or 3DNow! are faster - than SSE2 often enough to utilize this special-case flag. - AV_CPU_FLAG_SSE2 and AV_CPU_FLAG_SSE2SLOW are both set in this case - so that SSE2 is used unless explicitly disabled by checking - AV_CPU_FLAG_SSE2SLOW. */ - if (!strncmp(vendor.c, "AuthenticAMD", 12) && - rval & AV_CPU_FLAG_SSE2 && !(ecx & 0x00000040)) { - rval |= AV_CPU_FLAG_SSE2SLOW; - } - - /* XOP and FMA4 use the AVX instruction coding scheme, so they can't be - * used unless the OS has AVX support. */ - if (rval & AV_CPU_FLAG_AVX) { - if (ecx & 0x00000800) - rval |= AV_CPU_FLAG_XOP; - if (ecx & 0x00010000) - rval |= AV_CPU_FLAG_FMA4; - } - } - - if (!strncmp(vendor.c, "GenuineIntel", 12)) { - if (family == 6 && (model == 9 || model == 13 || model == 14)) { - /* 6/9 (pentium-m "banias"), 6/13 (pentium-m "dothan"), and - * 6/14 (core1 "yonah") theoretically support sse2, but it's - * usually slower than mmx, so let's just pretend they don't. - * AV_CPU_FLAG_SSE2 is disabled and AV_CPU_FLAG_SSE2SLOW is - * enabled so that SSE2 is not used unless explicitly enabled - * by checking AV_CPU_FLAG_SSE2SLOW. The same situation - * applies for AV_CPU_FLAG_SSE3 and AV_CPU_FLAG_SSE3SLOW. */ - if (rval & AV_CPU_FLAG_SSE2) - rval ^= AV_CPU_FLAG_SSE2SLOW | AV_CPU_FLAG_SSE2; - if (rval & AV_CPU_FLAG_SSE3) - rval ^= AV_CPU_FLAG_SSE3SLOW | AV_CPU_FLAG_SSE3; - } - /* The Atom processor has SSSE3 support, which is useful in many cases, - * but sometimes the SSSE3 version is slower than the SSE2 equivalent - * on the Atom, but is generally faster on other processors supporting - * SSSE3. This flag allows for selectively disabling certain SSSE3 - * functions on the Atom. */ - if (family == 6 && model == 28) - rval |= AV_CPU_FLAG_ATOM; - } - -#endif /* cpuid */ - - return rval; -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.h deleted file mode 100644 index 738c1ec48..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/cpu.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_X86_CPU_H -#define AVUTIL_X86_CPU_H - -#include "config.h" -#include "libavutil/cpu.h" -#include "libavutil/cpu_internal.h" - -#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW -#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT - -#define X86_AMD3DNOW(flags) CPUEXT(flags, AMD3DNOW) -#define X86_AMD3DNOWEXT(flags) CPUEXT(flags, AMD3DNOWEXT) -#define X86_MMX(flags) CPUEXT(flags, MMX) -#define X86_MMXEXT(flags) CPUEXT(flags, MMXEXT) -#define X86_SSE(flags) CPUEXT(flags, SSE) -#define X86_SSE2(flags) CPUEXT(flags, SSE2) -#define X86_SSE3(flags) CPUEXT(flags, SSE3) -#define X86_SSSE3(flags) CPUEXT(flags, SSSE3) -#define X86_SSE4(flags) CPUEXT(flags, SSE4) -#define X86_SSE42(flags) CPUEXT(flags, SSE42) -#define X86_AVX(flags) CPUEXT(flags, AVX) -#define X86_FMA4(flags) CPUEXT(flags, FMA4) - -#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW) -#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT) -#define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX) -#define EXTERNAL_MMXEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT) -#define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE) -#define EXTERNAL_SSE2(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE2) -#define EXTERNAL_SSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE3) -#define EXTERNAL_SSSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3) -#define EXTERNAL_SSE4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4) -#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42) -#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX) -#define EXTERNAL_FMA4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, FMA4) - -#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW) -#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT) -#define INLINE_MMX(flags) CPUEXT_SUFFIX(flags, _INLINE, MMX) -#define INLINE_MMXEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, MMXEXT) -#define INLINE_SSE(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE) -#define INLINE_SSE2(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE2) -#define INLINE_SSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE3) -#define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3) -#define INLINE_SSE4(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE4) -#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42) -#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX) -#define INLINE_FMA4(flags) CPUEXT_SUFFIX(flags, _INLINE, FMA4) - -void ff_cpu_cpuid(int index, int *eax, int *ebx, int *ecx, int *edx); -void ff_cpu_xgetbv(int op, int *eax, int *edx); -int ff_cpu_cpuid_test(void); - -#endif /* AVUTIL_X86_CPU_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/emms.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/emms.h deleted file mode 100644 index a529b6bbb..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/emms.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_X86_EMMS_H -#define AVUTIL_X86_EMMS_H - -#include "config.h" -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" - -void avpriv_emms_yasm(void); - -#if HAVE_MMX_INLINE -# define emms_c emms_c -/** - * Empty mmx state. - * this must be called between any dsp function and float/double code. - * for example sin(); dsp->idct_put(); emms_c(); cos() - */ -static av_always_inline void emms_c(void) -{ - if(av_get_cpu_flags() & AV_CPU_FLAG_MMX) - __asm__ volatile ("emms" ::: "memory"); -} -#elif HAVE_MMX && HAVE_MM_EMPTY -# include -# define emms_c _mm_empty -#elif HAVE_MMX_EXTERNAL -# define emms_c avpriv_emms_yasm -#endif /* HAVE_MMX_INLINE */ - -#endif /* AVUTIL_X86_EMMS_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/float_dsp_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/float_dsp_init.c deleted file mode 100644 index 97f7b7c7c..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/float_dsp_init.c +++ /dev/null @@ -1,156 +0,0 @@ -/* - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "config.h" - -#include "libavutil/attributes.h" -#include "libavutil/cpu.h" -#include "libavutil/float_dsp.h" -#include "cpu.h" -#include "asm.h" - -void ff_vector_fmul_sse(float *dst, const float *src0, const float *src1, - int len); -void ff_vector_fmul_avx(float *dst, const float *src0, const float *src1, - int len); - -void ff_vector_fmac_scalar_sse(float *dst, const float *src, float mul, - int len); -void ff_vector_fmac_scalar_avx(float *dst, const float *src, float mul, - int len); - -void ff_vector_fmul_scalar_sse(float *dst, const float *src, float mul, - int len); - -void ff_vector_dmul_scalar_sse2(double *dst, const double *src, - double mul, int len); -void ff_vector_dmul_scalar_avx(double *dst, const double *src, - double mul, int len); - -void ff_vector_fmul_add_sse(float *dst, const float *src0, const float *src1, - const float *src2, int len); -void ff_vector_fmul_add_avx(float *dst, const float *src0, const float *src1, - const float *src2, int len); - -void ff_vector_fmul_reverse_sse(float *dst, const float *src0, - const float *src1, int len); -void ff_vector_fmul_reverse_avx(float *dst, const float *src0, - const float *src1, int len); - -float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order); - -void ff_butterflies_float_sse(float *src0, float *src1, int len); - -#if HAVE_6REGS && HAVE_INLINE_ASM -static void vector_fmul_window_3dnowext(float *dst, const float *src0, - const float *src1, const float *win, - int len) -{ - x86_reg i = -len * 4; - x86_reg j = len * 4 - 8; - __asm__ volatile ( - "1: \n" - "pswapd (%5, %1), %%mm1 \n" - "movq (%5, %0), %%mm0 \n" - "pswapd (%4, %1), %%mm5 \n" - "movq (%3, %0), %%mm4 \n" - "movq %%mm0, %%mm2 \n" - "movq %%mm1, %%mm3 \n" - "pfmul %%mm4, %%mm2 \n" // src0[len + i] * win[len + i] - "pfmul %%mm5, %%mm3 \n" // src1[j] * win[len + j] - "pfmul %%mm4, %%mm1 \n" // src0[len + i] * win[len + j] - "pfmul %%mm5, %%mm0 \n" // src1[j] * win[len + i] - "pfadd %%mm3, %%mm2 \n" - "pfsub %%mm0, %%mm1 \n" - "pswapd %%mm2, %%mm2 \n" - "movq %%mm1, (%2, %0) \n" - "movq %%mm2, (%2, %1) \n" - "sub $8, %1 \n" - "add $8, %0 \n" - "jl 1b \n" - "femms \n" - : "+r"(i), "+r"(j) - : "r"(dst + len), "r"(src0 + len), "r"(src1), "r"(win + len) - ); -} - -static void vector_fmul_window_sse(float *dst, const float *src0, - const float *src1, const float *win, int len) -{ - x86_reg i = -len * 4; - x86_reg j = len * 4 - 16; - __asm__ volatile ( - "1: \n" - "movaps (%5, %1), %%xmm1 \n" - "movaps (%5, %0), %%xmm0 \n" - "movaps (%4, %1), %%xmm5 \n" - "movaps (%3, %0), %%xmm4 \n" - "shufps $0x1b, %%xmm1, %%xmm1 \n" - "shufps $0x1b, %%xmm5, %%xmm5 \n" - "movaps %%xmm0, %%xmm2 \n" - "movaps %%xmm1, %%xmm3 \n" - "mulps %%xmm4, %%xmm2 \n" // src0[len + i] * win[len + i] - "mulps %%xmm5, %%xmm3 \n" // src1[j] * win[len + j] - "mulps %%xmm4, %%xmm1 \n" // src0[len + i] * win[len + j] - "mulps %%xmm5, %%xmm0 \n" // src1[j] * win[len + i] - "addps %%xmm3, %%xmm2 \n" - "subps %%xmm0, %%xmm1 \n" - "shufps $0x1b, %%xmm2, %%xmm2 \n" - "movaps %%xmm1, (%2, %0) \n" - "movaps %%xmm2, (%2, %1) \n" - "sub $16, %1 \n" - "add $16, %0 \n" - "jl 1b \n" - : "+r"(i), "+r"(j) - : "r"(dst + len), "r"(src0 + len), "r"(src1), "r"(win + len) - ); -} -#endif /* HAVE_6REGS && HAVE_INLINE_ASM */ - -av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp) -{ - int cpu_flags = av_get_cpu_flags(); - -#if HAVE_6REGS && HAVE_INLINE_ASM - if (INLINE_AMD3DNOWEXT(cpu_flags)) { - fdsp->vector_fmul_window = vector_fmul_window_3dnowext; - } - if (INLINE_SSE(cpu_flags)) { - fdsp->vector_fmul_window = vector_fmul_window_sse; - } -#endif - if (EXTERNAL_SSE(cpu_flags)) { - fdsp->vector_fmul = ff_vector_fmul_sse; - fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_sse; - fdsp->vector_fmul_scalar = ff_vector_fmul_scalar_sse; - fdsp->vector_fmul_add = ff_vector_fmul_add_sse; - fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_sse; - fdsp->scalarproduct_float = ff_scalarproduct_float_sse; - fdsp->butterflies_float = ff_butterflies_float_sse; - } - if (EXTERNAL_SSE2(cpu_flags)) { - fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2; - } - if (EXTERNAL_AVX(cpu_flags)) { - fdsp->vector_fmul = ff_vector_fmul_avx; - fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx; - fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx; - fdsp->vector_fmul_add = ff_vector_fmul_add_avx; - fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_avx; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/lls_init.c b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/lls_init.c deleted file mode 100644 index bf999d5fc..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/lls_init.c +++ /dev/null @@ -1,41 +0,0 @@ -/* - * linear least squares model - * - * Copyright (c) 2013 Loren Merritt - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "libavutil/lls2.h" -#include "libavutil/x86/cpu.h" - -void ff_update_lls_sse2(LLSModel2 *m, double *var); -void ff_update_lls_avx(LLSModel2 *m, double *var); -double ff_evaluate_lls_sse2(LLSModel2 *m, double *var, int order); - -av_cold void ff_init_lls_x86(LLSModel2 *m) -{ - int cpu_flags = av_get_cpu_flags(); - if (EXTERNAL_SSE2(cpu_flags)) { - m->update_lls = ff_update_lls_sse2; - if (m->indep_count >= 4) - m->evaluate_lls = ff_evaluate_lls_sse2; - } - if (EXTERNAL_AVX(cpu_flags)) { - m->update_lls = ff_update_lls_avx; - } -} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/timer.h b/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/timer.h deleted file mode 100644 index d812d46ae..000000000 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/x86/timer.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * copyright (c) 2006 Michael Niedermayer - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef AVUTIL_X86_TIMER_H -#define AVUTIL_X86_TIMER_H - -#include - -#if HAVE_INLINE_ASM - -#define AV_READ_TIME read_time - -static inline uint64_t read_time(void) -{ - uint32_t a, d; - __asm__ volatile("rdtsc" : "=a" (a), "=d" (d)); - return ((uint64_t)d << 32) + a; -} - -#elif HAVE_RDTSC - -#include -#define AV_READ_TIME __rdtsc - -#endif /* HAVE_INLINE_ASM */ - -#endif /* AVUTIL_X86_TIMER_H */ diff --git a/Plugins/FFMPEG/FFMPEG.xcodeproj/project.pbxproj b/Plugins/FFMPEG/FFMPEG.xcodeproj/project.pbxproj index fd215627d..53b17e5e3 100644 --- a/Plugins/FFMPEG/FFMPEG.xcodeproj/project.pbxproj +++ b/Plugins/FFMPEG/FFMPEG.xcodeproj/project.pbxproj @@ -7,57 +7,45 @@ objects = { /* Begin PBXBuildFile section */ - 834225D317FFBD2200DD3E2F /* FFMPEGFileProtocols.m in Sources */ = {isa = PBXBuildFile; fileRef = 834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */; }; + 8352D48B1CDDAEDD009D16AA /* libavcodec.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4881CDDAEDD009D16AA /* libavcodec.a */; }; + 8352D48C1CDDAEDD009D16AA /* libavformat.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4891CDDAEDD009D16AA /* libavformat.a */; }; + 8352D48D1CDDAEDD009D16AA /* libavutil.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D48A1CDDAEDD009D16AA /* libavutil.a */; }; + 8352D48F1CDDB023009D16AA /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D48E1CDDB023009D16AA /* CoreFoundation.framework */; }; + 8352D4911CDDB02A009D16AA /* VideoDecodeAcceleration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4901CDDB02A009D16AA /* VideoDecodeAcceleration.framework */; }; + 8352D4931CDDB034009D16AA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4921CDDB034009D16AA /* QuartzCore.framework */; }; + 8352D4951CDDB03E009D16AA /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4941CDDB03E009D16AA /* libiconv.tbd */; }; + 8352D4971CDDB05E009D16AA /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4961CDDB05E009D16AA /* Security.framework */; }; + 8352D4991CDDB06A009D16AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D4981CDDB06A009D16AA /* libz.tbd */; }; + 8352D49B1CDDB8B2009D16AA /* VideoToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49A1CDDB8B2009D16AA /* VideoToolbox.framework */; }; + 8352D49D1CDDB8C0009D16AA /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49C1CDDB8C0009D16AA /* CoreMedia.framework */; }; + 8352D49F1CDDB8D7009D16AA /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8352D49E1CDDB8D7009D16AA /* CoreVideo.framework */; }; 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; }; B09E942F0D747F410064F138 /* FFMPEGDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = B09E942E0D747F410064F138 /* FFMPEGDecoder.m */; }; - B09E95560D749A780064F138 /* FFMPEG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B09E95080D748F9B0064F138 /* FFMPEG.framework */; }; - B09E95E50D74A3000064F138 /* FFMPEG.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = B09E95080D748F9B0064F138 /* FFMPEG.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; /* End PBXBuildFile section */ -/* Begin PBXContainerItemProxy section */ - B09E95070D748F9B0064F138 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = B09E95030D748F9B0064F138 /* FFMPEG.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = FFMPEG; - }; - B09E95450D7496C60064F138 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = B09E95030D748F9B0064F138 /* FFMPEG.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8DC2EF4F0486A6940098B216; - remoteInfo = "FFMPEG Framework"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - B09E95E90D74A32C0064F138 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 10; - files = ( - B09E95E50D74A3000064F138 /* FFMPEG.framework in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - /* Begin PBXFileReference section */ 089C1672FE841209C02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 089C167FFE841241C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 32DBCF630370AF2F00C91783 /* FFMPEG_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEG_Prefix.pch; sourceTree = ""; }; - 834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGFileProtocols.h; sourceTree = ""; }; - 834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFMPEGFileProtocols.m; sourceTree = ""; }; + 8352D4881CDDAEDD009D16AA /* libavcodec.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavcodec.a; path = ../../ThirdParty/ffmpeg/lib/libavcodec.a; sourceTree = ""; }; + 8352D4891CDDAEDD009D16AA /* libavformat.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavformat.a; path = ../../ThirdParty/ffmpeg/lib/libavformat.a; sourceTree = ""; }; + 8352D48A1CDDAEDD009D16AA /* libavutil.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libavutil.a; path = ../../ThirdParty/ffmpeg/lib/libavutil.a; sourceTree = ""; }; + 8352D48E1CDDB023009D16AA /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; + 8352D4901CDDB02A009D16AA /* VideoDecodeAcceleration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoDecodeAcceleration.framework; path = System/Library/Frameworks/VideoDecodeAcceleration.framework; sourceTree = SDKROOT; }; + 8352D4921CDDB034009D16AA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 8352D4941CDDB03E009D16AA /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; + 8352D4961CDDB05E009D16AA /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 8352D4981CDDB06A009D16AA /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; }; + 8352D49A1CDDB8B2009D16AA /* VideoToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = VideoToolbox.framework; path = System/Library/Frameworks/VideoToolbox.framework; sourceTree = SDKROOT; }; + 8352D49C1CDDB8C0009D16AA /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 8352D49E1CDDB8D7009D16AA /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; 8384913818081F6C00E7332D /* Logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Logging.h; path = ../../Utils/Logging.h; sourceTree = ""; }; 8D5B49B6048680CD000E48DA /* FFMPEG.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = FFMPEG.bundle; sourceTree = BUILT_PRODUCTS_DIR; }; 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; B09E942D0D747F410064F138 /* FFMPEGDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFMPEGDecoder.h; sourceTree = ""; }; B09E942E0D747F410064F138 /* FFMPEGDecoder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FFMPEGDecoder.m; sourceTree = ""; }; B09E94370D747FAD0064F138 /* Plugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plugin.h; path = ../../Audio/Plugin.h; sourceTree = SOURCE_ROOT; }; - B09E95030D748F9B0064F138 /* FFMPEG.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = FFMPEG.xcodeproj; path = ../../Frameworks/FFMPEG/FFMPEG.xcodeproj; sourceTree = SOURCE_ROOT; }; B09E95F50D74A3ED0064F138 /* Frameworks-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Frameworks-Info.plist"; sourceTree = ""; }; D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; /* End PBXFileReference section */ @@ -67,8 +55,19 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - B09E95560D749A780064F138 /* FFMPEG.framework in Frameworks */, + 8352D4991CDDB06A009D16AA /* libz.tbd in Frameworks */, + 8352D4971CDDB05E009D16AA /* Security.framework in Frameworks */, + 8352D4951CDDB03E009D16AA /* libiconv.tbd in Frameworks */, + 8352D4911CDDB02A009D16AA /* VideoDecodeAcceleration.framework in Frameworks */, + 8352D49F1CDDB8D7009D16AA /* CoreVideo.framework in Frameworks */, + 8352D4931CDDB034009D16AA /* QuartzCore.framework in Frameworks */, + 8352D49D1CDDB8C0009D16AA /* CoreMedia.framework in Frameworks */, + 8352D49B1CDDB8B2009D16AA /* VideoToolbox.framework in Frameworks */, + 8352D48F1CDDB023009D16AA /* CoreFoundation.framework in Frameworks */, 8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */, + 8352D48C1CDDAEDD009D16AA /* libavformat.a in Frameworks */, + 8352D48D1CDDAEDD009D16AA /* libavutil.a in Frameworks */, + 8352D48B1CDDAEDD009D16AA /* libavcodec.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -91,6 +90,11 @@ 089C1671FE841209C02AAC07 /* Frameworks and Libraries */ = { isa = PBXGroup; children = ( + 8352D4981CDDB06A009D16AA /* libz.tbd */, + 8352D4941CDDB03E009D16AA /* libiconv.tbd */, + 8352D4881CDDAEDD009D16AA /* libavcodec.a */, + 8352D4891CDDAEDD009D16AA /* libavformat.a */, + 8352D48A1CDDAEDD009D16AA /* libavutil.a */, 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */, 1058C7AEFEA557BF11CA2CBB /* Other Frameworks */, ); @@ -109,8 +113,6 @@ isa = PBXGroup; children = ( 8384913818081F6C00E7332D /* Logging.h */, - 834225D117FFBD2200DD3E2F /* FFMPEGFileProtocols.h */, - 834225D217FFBD2200DD3E2F /* FFMPEGFileProtocols.m */, B09E94370D747FAD0064F138 /* Plugin.h */, B09E942D0D747F410064F138 /* FFMPEGDecoder.h */, B09E942E0D747F410064F138 /* FFMPEGDecoder.m */, @@ -121,7 +123,13 @@ 1058C7ACFEA557BF11CA2CBB /* Linked Frameworks */ = { isa = PBXGroup; children = ( - B09E95030D748F9B0064F138 /* FFMPEG.xcodeproj */, + 8352D48E1CDDB023009D16AA /* CoreFoundation.framework */, + 8352D4901CDDB02A009D16AA /* VideoDecodeAcceleration.framework */, + 8352D4921CDDB034009D16AA /* QuartzCore.framework */, + 8352D4961CDDB05E009D16AA /* Security.framework */, + 8352D49A1CDDB8B2009D16AA /* VideoToolbox.framework */, + 8352D49C1CDDB8C0009D16AA /* CoreMedia.framework */, + 8352D49E1CDDB8D7009D16AA /* CoreVideo.framework */, 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */, ); name = "Linked Frameworks"; @@ -153,14 +161,6 @@ name = "Other Sources"; sourceTree = ""; }; - B09E95040D748F9B0064F138 /* Products */ = { - isa = PBXGroup; - children = ( - B09E95080D748F9B0064F138 /* FFMPEG.framework */, - ); - name = Products; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -171,12 +171,10 @@ 8D5B49AF048680CD000E48DA /* Resources */, 8D5B49B1048680CD000E48DA /* Sources */, 8D5B49B3048680CD000E48DA /* Frameworks */, - B09E95E90D74A32C0064F138 /* CopyFiles */, ); buildRules = ( ); dependencies = ( - B09E95460D7496C60064F138 /* PBXTargetDependency */, ); name = "FFMPEG Plugin"; productInstallPath = "$(HOME)/Library/Bundles"; @@ -201,12 +199,6 @@ ); mainGroup = 089C166AFE841209C02AAC07 /* FFMPEG */; projectDirPath = ""; - projectReferences = ( - { - ProductGroup = B09E95040D748F9B0064F138 /* Products */; - ProjectRef = B09E95030D748F9B0064F138 /* FFMPEG.xcodeproj */; - }, - ); projectRoot = ""; targets = ( 8D5B49AC048680CD000E48DA /* FFMPEG Plugin */, @@ -214,16 +206,6 @@ }; /* End PBXProject section */ -/* Begin PBXReferenceProxy section */ - B09E95080D748F9B0064F138 /* FFMPEG.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = FFMPEG.framework; - remoteRef = B09E95070D748F9B0064F138 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - /* Begin PBXResourcesBuildPhase section */ 8D5B49AF048680CD000E48DA /* Resources */ = { isa = PBXResourcesBuildPhase; @@ -240,20 +222,11 @@ buildActionMask = 2147483647; files = ( B09E942F0D747F410064F138 /* FFMPEGDecoder.m in Sources */, - 834225D317FFBD2200DD3E2F /* FFMPEGFileProtocols.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXTargetDependency section */ - B09E95460D7496C60064F138 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = "FFMPEG Framework"; - targetProxy = B09E95450D7496C60064F138 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - /* Begin XCBuildConfiguration section */ 1DEB913B08733D840010E9CD /* Debug */ = { isa = XCBuildConfiguration; @@ -308,6 +281,8 @@ GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../../ThirdParty/ffmpeg/include; + LIBRARY_SEARCH_PATHS = ../../ThirdParty/ffmpeg/lib; MACOSX_DEPLOYMENT_TARGET = 10.7; ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; @@ -323,6 +298,8 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ../../ThirdParty/ffmpeg/include; + LIBRARY_SEARCH_PATHS = ../../ThirdParty/ffmpeg/lib; MACOSX_DEPLOYMENT_TARGET = 10.7; PREBINDING = NO; SDKROOT = macosx; diff --git a/Plugins/FFMPEG/FFMPEGDecoder.m b/Plugins/FFMPEG/FFMPEGDecoder.m index 711981606..c1c41c6e3 100644 --- a/Plugins/FFMPEG/FFMPEGDecoder.m +++ b/Plugins/FFMPEG/FFMPEGDecoder.m @@ -52,7 +52,6 @@ int lockmgr_callback(void ** mutex, enum AVLockOp op) av_log_set_flags(AV_LOG_SKIP_REPEATED); av_log_set_level(AV_LOG_ERROR); av_register_all(); - registerCogProtocols(); av_lockmgr_register(lockmgr_callback); } } diff --git a/Plugins/FFMPEG/FFMPEGFileProtocols.m b/Plugins/FFMPEG/FFMPEGFileProtocols.m index cbb0930f1..888f658af 100644 --- a/Plugins/FFMPEG/FFMPEGFileProtocols.m +++ b/Plugins/FFMPEG/FFMPEGFileProtocols.m @@ -120,7 +120,7 @@ static int file_close(URLContext *h) return 0; } -URLProtocol ff_file_protocol = { +static URLProtocol ff_file_protocol = { .name = "file", .url_open = file_open, .url_read = file_read, @@ -131,7 +131,7 @@ URLProtocol ff_file_protocol = { .priv_data_class = &file_class, }; -URLProtocol ff_http_protocol = { +static URLProtocol ff_http_protocol = { .name = "http", .url_open = http_open, .url_read = file_read, @@ -139,10 +139,11 @@ URLProtocol ff_http_protocol = { .url_close = file_close, .url_check = file_check, .priv_data_size = sizeof(FileContext), - .priv_data_class = &file_class, + .flags = URL_PROTOCOL_FLAG_NETWORK, + .priv_data_class = &http_class, }; -URLProtocol ff_unpack_protocol = { +static URLProtocol ff_unpack_protocol = { .name = "unpack", .url_open = file_open, .url_read = file_read, @@ -150,7 +151,7 @@ URLProtocol ff_unpack_protocol = { .url_close = file_close, .url_check = file_check, .priv_data_size = sizeof(FileContext), - .priv_data_class = &file_class, + .priv_data_class = &unpack_class, }; void registerCogProtocols() diff --git a/Scripts/ffmpeg-build.sh b/Scripts/ffmpeg-build.sh new file mode 100755 index 000000000..d9521bf50 --- /dev/null +++ b/Scripts/ffmpeg-build.sh @@ -0,0 +1,33 @@ +# This is the commands used to build the ffmpeg libs provided here +./configure --extra-cflags="-fPIC -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.6"\ + --enable-static --disable-shared --prefix=$HOME/Source/Repos/cog/ThirdParty/ffmpeg\ + --enable-pic --enable-gpl --disable-doc --disable-ffplay\ + --disable-ffprobe --disable-ffserver --disable-avdevice --disable-ffmpeg\ + --disable-postproc --disable-swresample --disable-avfilter\ + --disable-swscale --enable-network --disable-swscale-alpha --disable-vdpau\ + --disable-dxva2 --enable-hwaccels\ + --disable-encoders --disable-muxers --disable-indevs --disable-outdevs\ + --disable-devices --disable-filters --disable-parsers --enable-parser=ac3\ + --enable-demuxer=ac3 --disable-bsfs --disable-bzlib --disable-protocols\ + --disable-decoders --disable-decoder=libopus --disable-libopus\ + --enable-decoder=wmapro --enable-decoder=wmav1 --enable-decoder=wmav2\ + --enable-decoder=wmavoice --enable-decoder=ac3\ + --disable-decoder=amrnb\ + --disable-demuxers --enable-demuxer=asf\ + --enable-demuxer=mov --enable-demuxer=oma --enable-demuxer=ac3\ + --disable-demuxer=amr --enable-demuxer=ogg\ + --enable-demuxer=tak --enable-decoder=tak\ + --enable-decoder=dsd_lsbf --enable-decoder=dsd_lsbf_planar\ + --enable-decoder=dsd_msbf --enable-decoder=dsd_msbf_planar\ + --enable-demuxer=dsf\ + --enable-demuxer=aac --enable-decoder=aac\ + --enable-decoder=g722dsp\ + --enable-decoder=atrac3 --enable-decoder=atrac3p\ + --enable-libdcadec --enable-demuxer=dts --enable-demuxer=dtshd\ + --enable-demuxer=mp3 --enable-decoder=mp3float\ + --disable-libopencore-amrnb --disable-libopencore-amrwb\ + --disable-version3 --disable-mmx\ + --disable-yasm\ + --enable-protocol=file --enable-protocol=http + +make -j8 diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avcodec.h b/ThirdParty/ffmpeg/include/libavcodec/avcodec.h similarity index 78% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avcodec.h rename to ThirdParty/ffmpeg/include/libavcodec/avcodec.h index d04be623e..d8497655b 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avcodec.h +++ b/ThirdParty/ffmpeg/include/libavcodec/avcodec.h @@ -28,20 +28,6 @@ */ #include - -#ifdef __FRAMEWORK__ -#include "samplefmt.h" -#include "attributes.h" -#include "avutil.h" -#include "buffer.h" -#include "cpu.h" -#include "channel_layout.h" -#include "dict.h" -#include "frame.h" -#include "log.h" -#include "pixfmt.h" -#include "rational.h" -#else #include "libavutil/samplefmt.h" #include "libavutil/attributes.h" #include "libavutil/avutil.h" @@ -53,19 +39,9 @@ #include "libavutil/log.h" #include "libavutil/pixfmt.h" #include "libavutil/rational.h" -#endif #include "version.h" -#if FF_API_FAST_MALLOC -// to provide fast_*alloc -#ifdef __FRAMEWORK__ -#include "mem.h" -#else -#include "libavutil/mem.h" -#endif -#endif - /** * @defgroup libavc Encoding/Decoding Library * @{ @@ -117,8 +93,7 @@ * * If you add a codec ID to this list, add it so that * 1. no value of a existing codec ID changes (that would break ABI), - * 2. Give it a value which when taken as ASCII is recognized uniquely by a human as this specific codec. - * This ensures that 2 forks can independently add AVCodecIDs without producing conflicts. + * 2. it is as close as possible to similar codecs * * After adding new codec IDs, do not forget to add an entry to the codec * descriptor list and bump libavcodec minor version. @@ -266,7 +241,7 @@ enum AVCodecID { AV_CODEC_ID_ANM, AV_CODEC_ID_BINKVIDEO, AV_CODEC_ID_IFF_ILBM, - AV_CODEC_ID_IFF_BYTERUN1, +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM AV_CODEC_ID_KGV1, AV_CODEC_ID_YOP, AV_CODEC_ID_VP8, @@ -299,40 +274,48 @@ enum AVCodecID { AV_CODEC_ID_MSS2, AV_CODEC_ID_VP9, AV_CODEC_ID_AIC, - AV_CODEC_ID_ESCAPE130_DEPRECATED, - AV_CODEC_ID_G2M_DEPRECATED, - AV_CODEC_ID_WEBP_DEPRECATED, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, AV_CODEC_ID_HNM4_VIDEO, - AV_CODEC_ID_HEVC_DEPRECATED, - AV_CODEC_ID_FIC, - - AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'), - AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'), - AV_CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'), - AV_CODEC_ID_EXR = MKBETAG('0','E','X','R'), - AV_CODEC_ID_AVRP = MKBETAG('A','V','R','P'), - - AV_CODEC_ID_012V = MKBETAG('0','1','2','V'), - AV_CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), - AV_CODEC_ID_AVUI = MKBETAG('A','V','U','I'), - AV_CODEC_ID_AYUV = MKBETAG('A','Y','U','V'), - AV_CODEC_ID_TARGA_Y216 = MKBETAG('T','2','1','6'), - AV_CODEC_ID_V308 = MKBETAG('V','3','0','8'), - AV_CODEC_ID_V408 = MKBETAG('V','4','0','8'), - AV_CODEC_ID_YUV4 = MKBETAG('Y','U','V','4'), - AV_CODEC_ID_SANM = MKBETAG('S','A','N','M'), - AV_CODEC_ID_PAF_VIDEO = MKBETAG('P','A','F','V'), - AV_CODEC_ID_AVRN = MKBETAG('A','V','R','n'), - AV_CODEC_ID_CPIA = MKBETAG('C','P','I','A'), - AV_CODEC_ID_XFACE = MKBETAG('X','F','A','C'), - AV_CODEC_ID_SGIRLE = MKBETAG('S','G','I','R'), - AV_CODEC_ID_MVC1 = MKBETAG('M','V','C','1'), - AV_CODEC_ID_MVC2 = MKBETAG('M','V','C','2'), - AV_CODEC_ID_SNOW = MKBETAG('S','N','O','W'), - AV_CODEC_ID_WEBP = MKBETAG('W','E','B','P'), - AV_CODEC_ID_SMVJPEG = MKBETAG('S','M','V','J'), - AV_CODEC_ID_HEVC = MKBETAG('H','2','6','5'), + AV_CODEC_ID_HEVC, #define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC + AV_CODEC_ID_FIC, + AV_CODEC_ID_ALIAS_PIX, + AV_CODEC_ID_BRENDER_PIX, + AV_CODEC_ID_PAF_VIDEO, + AV_CODEC_ID_EXR, + AV_CODEC_ID_VP7, + AV_CODEC_ID_SANM, + AV_CODEC_ID_SGIRLE, + AV_CODEC_ID_MVC1, + AV_CODEC_ID_MVC2, + AV_CODEC_ID_HQX, + AV_CODEC_ID_TDSC, + AV_CODEC_ID_HQ_HQA, + AV_CODEC_ID_HAP, + AV_CODEC_ID_DDS, + AV_CODEC_ID_DXV, + AV_CODEC_ID_SCREENPRESSO, + AV_CODEC_ID_RSCC, + + AV_CODEC_ID_Y41P = 0x8000, + AV_CODEC_ID_AVRP, + AV_CODEC_ID_012V, + AV_CODEC_ID_AVUI, + AV_CODEC_ID_AYUV, + AV_CODEC_ID_TARGA_Y216, + AV_CODEC_ID_V308, + AV_CODEC_ID_V408, + AV_CODEC_ID_YUV4, + AV_CODEC_ID_AVRN, + AV_CODEC_ID_CPIA, + AV_CODEC_ID_XFACE, + AV_CODEC_ID_SNOW, + AV_CODEC_ID_SMVJPEG, + AV_CODEC_ID_APNG, + AV_CODEC_ID_DAALA, + AV_CODEC_ID_CFHD, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -364,11 +347,12 @@ enum AVCodecID { AV_CODEC_ID_PCM_LXF, AV_CODEC_ID_S302M, AV_CODEC_ID_PCM_S8_PLANAR, - AV_CODEC_ID_PCM_S24LE_PLANAR_DEPRECATED, - AV_CODEC_ID_PCM_S32LE_PLANAR_DEPRECATED, - AV_CODEC_ID_PCM_S24LE_PLANAR = MKBETAG(24,'P','S','P'), - AV_CODEC_ID_PCM_S32LE_PLANAR = MKBETAG(32,'P','S','P'), - AV_CODEC_ID_PCM_S16BE_PLANAR = MKBETAG('P','S','P',16), + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + AV_CODEC_ID_PCM_S16BE_PLANAR, + /* new PCM "codecs" should be added right below this line starting with + * an explicit value of for example 0x10800 + */ /* various ADPCM codecs */ AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, @@ -401,12 +385,19 @@ enum AVCodecID { AV_CODEC_ID_ADPCM_IMA_ISS, AV_CODEC_ID_ADPCM_G722, AV_CODEC_ID_ADPCM_IMA_APC, - AV_CODEC_ID_VIMA = MKBETAG('V','I','M','A'), - AV_CODEC_ID_ADPCM_AFC = MKBETAG('A','F','C',' '), - AV_CODEC_ID_ADPCM_IMA_OKI = MKBETAG('O','K','I',' '), - AV_CODEC_ID_ADPCM_DTK = MKBETAG('D','T','K',' '), - AV_CODEC_ID_ADPCM_IMA_RAD = MKBETAG('R','A','D',' '), - AV_CODEC_ID_ADPCM_G726LE = MKBETAG('6','2','7','G'), + AV_CODEC_ID_ADPCM_VIMA, +#if FF_API_VIMA_DECODER + AV_CODEC_ID_VIMA = AV_CODEC_ID_ADPCM_VIMA, +#endif + + AV_CODEC_ID_ADPCM_AFC = 0x11800, + AV_CODEC_ID_ADPCM_IMA_OKI, + AV_CODEC_ID_ADPCM_DTK, + AV_CODEC_ID_ADPCM_IMA_RAD, + AV_CODEC_ID_ADPCM_G726LE, + AV_CODEC_ID_ADPCM_THP_LE, + AV_CODEC_ID_ADPCM_PSX, + AV_CODEC_ID_ADPCM_AICA, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -422,6 +413,8 @@ enum AVCodecID { AV_CODEC_ID_XAN_DPCM, AV_CODEC_ID_SOL_DPCM, + AV_CODEC_ID_SDX2_DPCM = 0x14800, + /* audio codecs */ AV_CODEC_ID_MP2 = 0x15000, AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 @@ -486,18 +479,27 @@ enum AVCodecID { AV_CODEC_ID_RALF, AV_CODEC_ID_IAC, AV_CODEC_ID_ILBC, - AV_CODEC_ID_OPUS_DEPRECATED, + AV_CODEC_ID_OPUS, AV_CODEC_ID_COMFORT_NOISE, - AV_CODEC_ID_TAK_DEPRECATED, + AV_CODEC_ID_TAK, AV_CODEC_ID_METASOUND, - AV_CODEC_ID_FFWAVESYNTH = MKBETAG('F','F','W','S'), - AV_CODEC_ID_SONIC = MKBETAG('S','O','N','C'), - AV_CODEC_ID_SONIC_LS = MKBETAG('S','O','N','L'), - AV_CODEC_ID_PAF_AUDIO = MKBETAG('P','A','F','A'), - AV_CODEC_ID_OPUS = MKBETAG('O','P','U','S'), - AV_CODEC_ID_TAK = MKBETAG('t','B','a','K'), - AV_CODEC_ID_EVRC = MKBETAG('s','e','v','c'), - AV_CODEC_ID_SMV = MKBETAG('s','s','m','v'), + AV_CODEC_ID_PAF_AUDIO, + AV_CODEC_ID_ON2AVC, + AV_CODEC_ID_DSS_SP, + + AV_CODEC_ID_FFWAVESYNTH = 0x15800, + AV_CODEC_ID_SONIC, + AV_CODEC_ID_SONIC_LS, + AV_CODEC_ID_EVRC, + AV_CODEC_ID_SMV, + AV_CODEC_ID_DSD_LSBF, + AV_CODEC_ID_DSD_MSBF, + AV_CODEC_ID_DSD_LSBF_PLANAR, + AV_CODEC_ID_DSD_MSBF_PLANAR, + AV_CODEC_ID_4GV, + AV_CODEC_ID_INTERPLAY_ACM, + AV_CODEC_ID_XMA1, + AV_CODEC_ID_XMA2, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -510,30 +512,35 @@ enum AVCodecID { AV_CODEC_ID_HDMV_PGS_SUBTITLE, AV_CODEC_ID_DVB_TELETEXT, AV_CODEC_ID_SRT, - AV_CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), - AV_CODEC_ID_EIA_608 = MKBETAG('c','6','0','8'), - AV_CODEC_ID_JACOSUB = MKBETAG('J','S','U','B'), - AV_CODEC_ID_SAMI = MKBETAG('S','A','M','I'), - AV_CODEC_ID_REALTEXT = MKBETAG('R','T','X','T'), - AV_CODEC_ID_SUBVIEWER1 = MKBETAG('S','b','V','1'), - AV_CODEC_ID_SUBVIEWER = MKBETAG('S','u','b','V'), - AV_CODEC_ID_SUBRIP = MKBETAG('S','R','i','p'), - AV_CODEC_ID_WEBVTT = MKBETAG('W','V','T','T'), - AV_CODEC_ID_MPL2 = MKBETAG('M','P','L','2'), - AV_CODEC_ID_VPLAYER = MKBETAG('V','P','l','r'), - AV_CODEC_ID_PJS = MKBETAG('P','h','J','S'), - AV_CODEC_ID_ASS = MKBETAG('A','S','S',' '), ///< ASS as defined in Matroska + + AV_CODEC_ID_MICRODVD = 0x17800, + AV_CODEC_ID_EIA_608, + AV_CODEC_ID_JACOSUB, + AV_CODEC_ID_SAMI, + AV_CODEC_ID_REALTEXT, + AV_CODEC_ID_STL, + AV_CODEC_ID_SUBVIEWER1, + AV_CODEC_ID_SUBVIEWER, + AV_CODEC_ID_SUBRIP, + AV_CODEC_ID_WEBVTT, + AV_CODEC_ID_MPL2, + AV_CODEC_ID_VPLAYER, + AV_CODEC_ID_PJS, + AV_CODEC_ID_ASS, + AV_CODEC_ID_HDMV_TEXT_SUBTITLE, /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. AV_CODEC_ID_TTF = 0x18000, - AV_CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), - AV_CODEC_ID_XBIN = MKBETAG('X','B','I','N'), - AV_CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'), - AV_CODEC_ID_OTF = MKBETAG( 0 ,'O','T','F'), - AV_CODEC_ID_SMPTE_KLV = MKBETAG('K','L','V','A'), - AV_CODEC_ID_DVD_NAV = MKBETAG('D','N','A','V'), - AV_CODEC_ID_TIMED_ID3 = MKBETAG('T','I','D','3'), + + AV_CODEC_ID_BINTEXT = 0x18800, + AV_CODEC_ID_XBIN, + AV_CODEC_ID_IDF, + AV_CODEC_ID_OTF, + AV_CODEC_ID_SMPTE_KLV, + AV_CODEC_ID_DVD_NAV, + AV_CODEC_ID_TIMED_ID3, + AV_CODEC_ID_BIN_DATA, AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it @@ -543,16 +550,13 @@ enum AVCodecID { AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems * stream (only used by libavformat) */ AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. - -#if FF_API_CODEC_ID -#include "old_codec_ids.h" -#endif + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket }; /** * This struct describes the properties of a single codec described by an * AVCodecID. - * @see avcodec_get_descriptor() + * @see avcodec_descriptor_get() */ typedef struct AVCodecDescriptor { enum AVCodecID id; @@ -571,6 +575,17 @@ typedef struct AVCodecDescriptor { * Codec properties, a combination of AV_CODEC_PROP_* flags. */ int props; + /** + * MIME type(s) associated with the codec. + * May be NULL; if not, a NULL-terminated array of MIME types. + * The first item is always non-NULL and is the preferred MIME type. + */ + const char *const *mime_types; + /** + * If non-NULL, an array of profiles recognized for this codec. + * Terminated with FF_PROFILE_UNKNOWN. + */ + const struct AVProfile *profiles; } AVCodecDescriptor; /** @@ -588,6 +603,16 @@ typedef struct AVCodecDescriptor { * Codec supports lossless compression. Audio and video codecs only. */ #define AV_CODEC_PROP_LOSSLESS (1 << 2) +/** + * Codec supports frame reordering. That is, the coded order (the order in which + * the encoded packets are output by the encoders / stored / input to the + * decoders) may be different from the presentation order of the corresponding + * frames. + * + * For codecs that do not have this property set, PTS and DTS should always be + * equal. + */ +#define AV_CODEC_PROP_REORDER (1 << 3) /** * Subtitle codec is bitmap based * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. @@ -607,20 +632,33 @@ typedef struct AVCodecDescriptor { * Note: If the first 23 bits of the additional bytes are not 0, then damaged * MPEG bitstreams could cause overread and segfault. */ -#define FF_INPUT_BUFFER_PADDING_SIZE 16 +#define AV_INPUT_BUFFER_PADDING_SIZE 32 /** * @ingroup lavc_encoding * minimum encoding buffer size * Used to avoid some checks during header writing. */ -#define FF_MIN_BUFFER_SIZE 16384 +#define AV_INPUT_BUFFER_MIN_SIZE 16384 +#if FF_API_WITHOUT_PREFIX +/** + * @deprecated use AV_INPUT_BUFFER_PADDING_SIZE instead + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 32 + +/** + * @deprecated use AV_INPUT_BUFFER_MIN_SIZE instead + */ +#define FF_MIN_BUFFER_SIZE 16384 +#endif /* FF_API_WITHOUT_PREFIX */ /** * @ingroup lavc_encoding * motion estimation type. + * @deprecated use codec private option instead */ +#if FF_API_MOTION_EST enum Motion_Est_ID { ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed ME_FULL, @@ -633,6 +671,7 @@ enum Motion_Est_ID { ME_TESA, ///< transformed exhaustive search algorithm ME_ITER=50, ///< iterative search }; +#endif /** * @ingroup lavc_decoding @@ -644,56 +683,11 @@ enum AVDiscard{ AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi AVDISCARD_NONREF = 8, ///< discard all non reference AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes AVDISCARD_ALL = 48, ///< discard all }; -enum AVColorPrimaries{ - AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B - AVCOL_PRI_UNSPECIFIED = 2, - AVCOL_PRI_BT470M = 4, - AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM - AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC - AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above - AVCOL_PRI_FILM = 8, - AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 - AVCOL_PRI_NB , ///< Not part of ABI -}; - -enum AVColorTransferCharacteristic{ - AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 - AVCOL_TRC_UNSPECIFIED = 2, - AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM - AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG - AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC - AVCOL_TRC_SMPTE240M = 7, - AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" - AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" - AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt( 10 ) : 1 range)" - AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 - AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut - AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) - AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system - AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system - AVCOL_TRC_NB , ///< Not part of ABI -}; - -/** - * X X 3 4 X X are luma samples, - * 1 2 1-6 are possible chroma positions - * X X 5 6 X 0 is undefined/unknown position - */ -enum AVChromaLocation{ - AVCHROMA_LOC_UNSPECIFIED = 0, - AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default - AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 - AVCHROMA_LOC_TOPLEFT = 3, ///< DV - AVCHROMA_LOC_TOP = 4, - AVCHROMA_LOC_BOTTOMLEFT = 5, - AVCHROMA_LOC_BOTTOM = 6, - AVCHROMA_LOC_NB , ///< Not part of ABI -}; - enum AVAudioServiceType { AV_AUDIO_SERVICE_TYPE_MAIN = 0, AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, @@ -733,50 +727,115 @@ typedef struct RcOverride{ * Allow decoders to produce frames with data planes that are not aligned * to CPU requirements (e.g. due to cropping). */ -#define CODEC_FLAG_UNALIGNED 0x0001 -#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. -#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. -#define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted -#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. -#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. -#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. +#define AV_CODEC_FLAG_UNALIGNED (1 << 0) /** - * The parent program guarantees that the input for B-frames containing - * streams is not written to for at least s->max_b_frames+1 frames, if - * this is not set the input will be copied. + * Use fixed qscale. */ -#define CODEC_FLAG_INPUT_PRESERVED 0x0100 -#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. -#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. -#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. -#if FF_API_EMU_EDGE +#define AV_CODEC_FLAG_QSCALE (1 << 1) /** - * @deprecated edges are not used/required anymore. I.e. this flag is now always - * set. + * 4 MV per MB allowed / advanced prediction for H.263. */ -#define CODEC_FLAG_EMU_EDGE 0x4000 -#endif -#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. -#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random - location instead of only at frame boundaries. */ -#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. -#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. -#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. -#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. -#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). +#define AV_CODEC_FLAG_4MV (1 << 2) +/** + * Output even those frames that might be corrupted. + */ +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3) +/** + * Use qpel MC. + */ +#define AV_CODEC_FLAG_QPEL (1 << 4) +/** + * Use internal 2pass ratecontrol in first pass mode. + */ +#define AV_CODEC_FLAG_PASS1 (1 << 9) +/** + * Use internal 2pass ratecontrol in second pass mode. + */ +#define AV_CODEC_FLAG_PASS2 (1 << 10) +/** + * loop filter. + */ +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) +/** + * Only decode/encode grayscale. + */ +#define AV_CODEC_FLAG_GRAY (1 << 13) +/** + * error[?] variables will be set during encoding. + */ +#define AV_CODEC_FLAG_PSNR (1 << 15) +/** + * Input bitstream might be truncated at a random location + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG_TRUNCATED (1 << 16) +/** + * Use interlaced DCT. + */ +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18) +/** + * Force low delay. + */ +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19) +/** + * Place global headers in extradata instead of every keyframe. + */ +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) +/** + * Use only bitexact stuff (except (I)DCT). + */ +#define AV_CODEC_FLAG_BITEXACT (1 << 23) /* Fx : Flag for h263+ extra options */ -#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction -#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter -#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation -#define CODEC_FLAG_CLOSED_GOP 0x80000000 -#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. -#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. -#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. -#define CODEC_FLAG2_DROP_FRAME_TIMECODE 0x00002000 ///< timecode is in drop frame format. DEPRECATED!!!! -#define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. +/** + * H.263 advanced intra coding / MPEG-4 AC prediction + */ +#define AV_CODEC_FLAG_AC_PRED (1 << 24) +/** + * interlaced motion estimation + */ +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31) -#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. -#define CODEC_FLAG2_SHOW_ALL 0x00400000 ///< Show all frames before the first keyframe +/** + * Allow non spec compliant speedup tricks. + */ +#define AV_CODEC_FLAG2_FAST (1 << 0) +/** + * Skip bitstream encoding. + */ +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2) +/** + * Place global headers at every keyframe instead of in extradata. + */ +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3) + +/** + * timecode is in drop frame format. DEPRECATED!!!! + */ +#define AV_CODEC_FLAG2_DROP_FRAME_TIMECODE (1 << 13) + +/** + * Input bitstream might be truncated at a packet boundaries + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG2_CHUNKS (1 << 15) +/** + * Discard cropping information from SPS. + */ +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16) + +/** + * Show all frames before the first keyframe + */ +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) +/** + * Export motion vectors through frame side data + */ +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28) +/** + * Do not skip samples and export skip information as frame side data + */ +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29) /* Unsupported options : * Syntax Arithmetic coding (SAC) @@ -785,14 +844,189 @@ typedef struct RcOverride{ /* /Fx */ /* codec capabilities */ -#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +/** + * Decoder can use draw_horiz_band callback. + */ +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0) /** * Codec uses get_buffer() for allocating buffers and supports custom allocators. * If not set, it might not use get_buffer() at all or use operations that * assume the buffer was allocated by avcodec_default_get_buffer. */ -#define CODEC_CAP_DR1 0x0002 -#define CODEC_CAP_TRUNCATED 0x0008 +#define AV_CODEC_CAP_DR1 (1 << 1) +#define AV_CODEC_CAP_TRUNCATED (1 << 3) +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define AV_CODEC_CAP_DELAY (1 << 5) +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) + +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define AV_CODEC_CAP_HWACCEL_VDPAU (1 << 7) +#endif + +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define AV_CODEC_CAP_SUBFRAMES (1 << 8) +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9) +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10) +/** + * Codec supports frame-level multithreading. + */ +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12) +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13) +/** + * Codec supports changed parameters at any point. + */ +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14) +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define AV_CODEC_CAP_AUTO_THREADS (1 << 15) +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16) +/** + * Codec is intra only. + */ +#define AV_CODEC_CAP_INTRA_ONLY 0x40000000 +/** + * Codec is lossless. + */ +#define AV_CODEC_CAP_LOSSLESS 0x80000000 + + +#if FF_API_WITHOUT_PREFIX +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define CODEC_FLAG_UNALIGNED AV_CODEC_FLAG_UNALIGNED +#define CODEC_FLAG_QSCALE AV_CODEC_FLAG_QSCALE +#define CODEC_FLAG_4MV AV_CODEC_FLAG_4MV +#define CODEC_FLAG_OUTPUT_CORRUPT AV_CODEC_FLAG_OUTPUT_CORRUPT +#define CODEC_FLAG_QPEL AV_CODEC_FLAG_QPEL +#if FF_API_GMC +/** + * @deprecated use the "gmc" private option of the libxvid encoder + */ +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#endif +#if FF_API_MV0 +/** + * @deprecated use the flag "mv0" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_MV0 0x0040 +#endif +#if FF_API_INPUT_PRESERVED +/** + * @deprecated passing reference-counted frames to the encoders replaces this + * flag + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#endif +#define CODEC_FLAG_PASS1 AV_CODEC_FLAG_PASS1 +#define CODEC_FLAG_PASS2 AV_CODEC_FLAG_PASS2 +#define CODEC_FLAG_GRAY AV_CODEC_FLAG_GRAY +#if FF_API_EMU_EDGE +/** + * @deprecated edges are not used/required anymore. I.e. this flag is now always + * set. + */ +#define CODEC_FLAG_EMU_EDGE 0x4000 +#endif +#define CODEC_FLAG_PSNR AV_CODEC_FLAG_PSNR +#define CODEC_FLAG_TRUNCATED AV_CODEC_FLAG_TRUNCATED + +#if FF_API_NORMALIZE_AQP +/** + * @deprecated use the flag "naq" in the "mpv_flags" private option of the + * mpegvideo encoders + */ +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 +#endif +#define CODEC_FLAG_INTERLACED_DCT AV_CODEC_FLAG_INTERLACED_DCT +#define CODEC_FLAG_LOW_DELAY AV_CODEC_FLAG_LOW_DELAY +#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER +#define CODEC_FLAG_BITEXACT AV_CODEC_FLAG_BITEXACT +#define CODEC_FLAG_AC_PRED AV_CODEC_FLAG_AC_PRED +#define CODEC_FLAG_LOOP_FILTER AV_CODEC_FLAG_LOOP_FILTER +#define CODEC_FLAG_INTERLACED_ME AV_CODEC_FLAG_INTERLACED_ME +#define CODEC_FLAG_CLOSED_GOP AV_CODEC_FLAG_CLOSED_GOP +#define CODEC_FLAG2_FAST AV_CODEC_FLAG2_FAST +#define CODEC_FLAG2_NO_OUTPUT AV_CODEC_FLAG2_NO_OUTPUT +#define CODEC_FLAG2_LOCAL_HEADER AV_CODEC_FLAG2_LOCAL_HEADER +#define CODEC_FLAG2_DROP_FRAME_TIMECODE AV_CODEC_FLAG2_DROP_FRAME_TIMECODE +#define CODEC_FLAG2_IGNORE_CROP AV_CODEC_FLAG2_IGNORE_CROP + +#define CODEC_FLAG2_CHUNKS AV_CODEC_FLAG2_CHUNKS +#define CODEC_FLAG2_SHOW_ALL AV_CODEC_FLAG2_SHOW_ALL +#define CODEC_FLAG2_EXPORT_MVS AV_CODEC_FLAG2_EXPORT_MVS +#define CODEC_FLAG2_SKIP_MANUAL AV_CODEC_FLAG2_SKIP_MANUAL + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND AV_CODEC_CAP_DRAW_HORIZ_BAND ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 AV_CODEC_CAP_DR1 +#define CODEC_CAP_TRUNCATED AV_CODEC_CAP_TRUNCATED #if FF_API_XVMC /* Codec can export data for HW decoding. This flag indicates that * the codec would call get_format() with list that might contain HW accelerated @@ -826,17 +1060,17 @@ typedef struct RcOverride{ * each output packet. If this flag is not set, the pts and duration will * be determined by libavcodec from the input frame. */ -#define CODEC_CAP_DELAY 0x0020 +#define CODEC_CAP_DELAY AV_CODEC_CAP_DELAY /** * Codec can be fed a final frame with a smaller size. * This can be used to prevent truncation of the last audio samples. */ -#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#define CODEC_CAP_SMALL_LAST_FRAME AV_CODEC_CAP_SMALL_LAST_FRAME #if FF_API_CAP_VDPAU /** * Codec can export data for HW decoding (VDPAU). */ -#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#define CODEC_CAP_HWACCEL_VDPAU AV_CODEC_CAP_HWACCEL_VDPAU #endif /** * Codec can output multiple frames per AVPacket @@ -849,16 +1083,16 @@ typedef struct RcOverride{ * prohibiting stream copy in many cases thus it should only be considered * as a last resort. */ -#define CODEC_CAP_SUBFRAMES 0x0100 +#define CODEC_CAP_SUBFRAMES AV_CODEC_CAP_SUBFRAMES /** * Codec is experimental and is thus avoided in favor of non experimental * encoders */ -#define CODEC_CAP_EXPERIMENTAL 0x0200 +#define CODEC_CAP_EXPERIMENTAL AV_CODEC_CAP_EXPERIMENTAL /** * Codec should fill in channel configuration and samplerate instead of container */ -#define CODEC_CAP_CHANNEL_CONF 0x0400 +#define CODEC_CAP_CHANNEL_CONF AV_CODEC_CAP_CHANNEL_CONF #if FF_API_NEG_LINESIZES /** * @deprecated no codecs use this capability @@ -868,31 +1102,38 @@ typedef struct RcOverride{ /** * Codec supports frame-level multithreading. */ -#define CODEC_CAP_FRAME_THREADS 0x1000 +#define CODEC_CAP_FRAME_THREADS AV_CODEC_CAP_FRAME_THREADS /** * Codec supports slice-based (or partition-based) multithreading. */ -#define CODEC_CAP_SLICE_THREADS 0x2000 +#define CODEC_CAP_SLICE_THREADS AV_CODEC_CAP_SLICE_THREADS /** * Codec supports changed parameters at any point. */ -#define CODEC_CAP_PARAM_CHANGE 0x4000 +#define CODEC_CAP_PARAM_CHANGE AV_CODEC_CAP_PARAM_CHANGE /** * Codec supports avctx->thread_count == 0 (auto). */ -#define CODEC_CAP_AUTO_THREADS 0x8000 +#define CODEC_CAP_AUTO_THREADS AV_CODEC_CAP_AUTO_THREADS /** * Audio encoder supports receiving a different number of samples in each call. */ -#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 +#define CODEC_CAP_VARIABLE_FRAME_SIZE AV_CODEC_CAP_VARIABLE_FRAME_SIZE /** * Codec is intra only. */ -#define CODEC_CAP_INTRA_ONLY 0x40000000 +#define CODEC_CAP_INTRA_ONLY AV_CODEC_CAP_INTRA_ONLY /** * Codec is lossless. */ -#define CODEC_CAP_LOSSLESS 0x80000000 +#define CODEC_CAP_LOSSLESS AV_CODEC_CAP_LOSSLESS + +/** + * HWAccel is experimental and is thus avoided in favor of non experimental + * codecs + */ +#define HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 +#endif /* FF_API_WITHOUT_PREFIX */ #if FF_API_MB_TYPE //The following defines may change, don't expect compatibility if you use them. @@ -949,6 +1190,44 @@ typedef struct AVPanScan{ int16_t position[3][2]; }AVPanScan; +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + #if FF_API_QSCALE_TYPE #define FF_QSCALE_TYPE_MPEG1 0 #define FF_QSCALE_TYPE_MPEG2 1 @@ -956,18 +1235,6 @@ typedef struct AVPanScan{ #define FF_QSCALE_TYPE_VP56 3 #endif -#if FF_API_GET_BUFFER -#define FF_BUFFER_TYPE_INTERNAL 1 -#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) -#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. -#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. - -#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). -#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. -#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. -#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). -#endif - /** * The decoder will keep a reference to the frame and may reuse it later. */ @@ -1021,6 +1288,58 @@ enum AVPacketSideDataType { */ AV_PKT_DATA_H263_MB_INFO, + /** + * This side data should be associated with an audio stream and contains + * ReplayGain information in form of the AVReplayGain struct. + */ + AV_PKT_DATA_REPLAYGAIN, + + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the decoded video frames for + * correct presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_PKT_DATA_DISPLAYMATRIX, + + /** + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, + + /** + * This side data should be associated with an audio stream and corresponds + * to enum AVAudioServiceType. + */ + AV_PKT_DATA_AUDIO_SERVICE_TYPE, + + /** + * This side data contains quality related information from the encoder. + * @code + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). + * u8 picture type + * u8 error count + * u16 reserved + * u64le[error count] sum of squared differences between encoder in and output + * @endcode + */ + AV_PKT_DATA_QUALITY_STATS, + + /** + * This side data contains an integer value representing the stream index + * of a "fallback" track. A fallback track indicates an alternate + * track to use when the current track can not be decoded for some reason. + * e.g. no decoder available for codec. + */ + AV_PKT_DATA_FALLBACK_TRACK, + + /** + * This side data corresponds to the AVCPBProperties struct. + */ + AV_PKT_DATA_CPB_PROPERTIES, + /** * Recommmends skipping the specified number of samples * @code @@ -1086,27 +1405,41 @@ enum AVPacketSideDataType { AV_PKT_DATA_METADATA_UPDATE, }; +#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED + +typedef struct AVPacketSideData { + uint8_t *data; + int size; + enum AVPacketSideDataType type; +} AVPacketSideData; + /** * This structure stores compressed data. It is typically exported by demuxers * and then passed as input to decoders, or received as output from encoders and * then passed to muxers. * * For video, it should typically contain one compressed frame. For audio it may - * contain several compressed frames. + * contain several compressed frames. Encoders are allowed to output empty + * packets, with no compressed data, containing only side data + * (e.g. to update some stream parameters at the end of encoding). * * AVPacket is one of the few structs in FFmpeg, whose size is a part of public * ABI. Thus it may be allocated on stack and no new fields can be added to it * without libavcodec and libavformat major bump. * - * The semantics of data ownership depends on the buf or destruct (deprecated) - * fields. If either is set, the packet data is dynamically allocated and is - * valid indefinitely until av_free_packet() is called (which in turn calls - * av_buffer_unref()/the destruct callback to free the data). If neither is set, - * the packet data is typically backed by some static buffer somewhere and is - * only valid for a limited time (e.g. until the next read call when demuxing). + * The semantics of data ownership depends on the buf field. + * If it is set, the packet data is dynamically allocated and is + * valid indefinitely until a call to av_packet_unref() reduces the + * reference count to 0. * - * The side data is always allocated with av_malloc() and is freed in - * av_free_packet(). + * If the buf field is not set av_packet_ref() would make a copy instead + * of increasing the reference count. + * + * The side data is always allocated with av_malloc(), copied by + * av_packet_ref() and freed by av_packet_unref(). + * + * @see av_packet_ref + * @see av_packet_unref */ typedef struct AVPacket { /** @@ -1142,44 +1475,26 @@ typedef struct AVPacket { * Additional packet data that can be provided by the container. * Packet can contain several types of side information. */ - struct { - uint8_t *data; - int size; - enum AVPacketSideDataType type; - } *side_data; + AVPacketSideData *side_data; int side_data_elems; /** * Duration of this packet in AVStream->time_base units, 0 if unknown. * Equals next_pts - this_pts in presentation order. */ - int duration; -#if FF_API_DESTRUCT_PACKET - attribute_deprecated - void (*destruct)(struct AVPacket *); - attribute_deprecated - void *priv; -#endif + int64_t duration; + int64_t pos; ///< byte position in stream, -1 if unknown +#if FF_API_CONVERGENCE_DURATION /** - * Time difference in AVStream->time_base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current packet. - * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY - * set. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. + * @deprecated Same as the duration field, but as int64_t. This was required + * for Matroska subtitles, whose duration values could overflow when the + * duration field was still an int. */ + attribute_deprecated int64_t convergence_duration; +#endif } AVPacket; #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted @@ -1224,7 +1539,13 @@ typedef struct AVCodecContext { enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ const struct AVCodec *codec; +#if FF_API_CODEC_NAME + /** + * @deprecated this field is not used for anything in libavcodec + */ + attribute_deprecated char codec_name[32]; +#endif enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ /** @@ -1242,13 +1563,13 @@ typedef struct AVCodecContext { */ unsigned int codec_tag; +#if FF_API_STREAM_CODEC_TAG /** - * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). - * This is used to work around some encoder bugs. - * - encoding: unused - * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + * @deprecated this field is unused */ + attribute_deprecated unsigned int stream_codec_tag; +#endif void *priv_data; @@ -1270,9 +1591,10 @@ typedef struct AVCodecContext { /** * the average bitrate * - encoding: Set by user; unused for constant quantizer encoding. - * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + * - decoding: Set by user, may be overwritten by libavcodec + * if this info is available in the stream */ - int bit_rate; + int64_t bit_rate; /** * number of bits the bitstream is allowed to diverge from the reference. @@ -1298,14 +1620,14 @@ typedef struct AVCodecContext { #define FF_COMPRESSION_DEFAULT -1 /** - * CODEC_FLAG_*. + * AV_CODEC_FLAG_*. * - encoding: Set by user. * - decoding: Set by user. */ int flags; /** - * CODEC_FLAG2_* + * AV_CODEC_FLAG2_* * - encoding: Set by user. * - decoding: Set by user. */ @@ -1316,7 +1638,7 @@ typedef struct AVCodecContext { * mjpeg: Huffman tables * rv10: additional flags * mpeg4: global headers (they can be in the bitstream or here) - * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * The allocated memory should be AV_INPUT_BUFFER_PADDING_SIZE bytes larger * than extradata_size to avoid problems if it is read with the bitstream reader. * The bytewise contents of extradata must not depend on the architecture or CPU endianness. * - encoding: Set/allocated/freed by libavcodec. @@ -1330,8 +1652,11 @@ typedef struct AVCodecContext { * of which frame timestamps are represented. For fixed-fps content, * timebase should be 1/framerate and timestamp increments should be * identically 1. + * This often, but not always is the inverse of the frame rate or field rate + * for video. * - encoding: MUST be set by user. - * - decoding: Set by libavcodec. + * - decoding: the use of this field for decoding is deprecated. + * Use framerate instead. */ AVRational time_base; @@ -1357,12 +1682,8 @@ typedef struct AVCodecContext { * encoded input. * * Audio: - * For encoding, this is the number of "priming" samples added to the - * beginning of the stream. The decoded output will be delayed by this - * many samples relative to the input to the encoder. Note that this - * field is purely informational and does not directly affect the pts - * output by the encoder, which should always be based on the actual - * presentation time, including any delay. + * For encoding, this field is unused (see initial_padding). + * * For decoding, this is the number of samples the decoder needs to * output before the decoder's output is valid. When seeking, you should * start decoding this many samples prior to your desired seek point. @@ -1376,21 +1697,31 @@ typedef struct AVCodecContext { /* video only */ /** * picture width / height. + * + * @note Those fields may not match the values of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: MUST be set by user. * - decoding: May be set by the user before opening the decoder if known e.g. * from the container. Some decoders will require the dimensions * to be set by the caller. During decoding, the decoder may - * overwrite those values as required. + * overwrite those values as required while parsing the data. */ int width, height; /** * Bitstream width / height, may be different from width/height e.g. when * the decoded frame is cropped before being output or lowres is enabled. + * + * @note Those field may not match the value of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: unused * - decoding: May be set by the user before opening the decoder if known * e.g. from the container. During decoding, the decoder may - * overwrite those values as required. + * overwrite those values as required while parsing the data. */ int coded_width, coded_height; @@ -1409,19 +1740,24 @@ typedef struct AVCodecContext { * Pixel format, see AV_PIX_FMT_xxx. * May be set by the demuxer if known from headers. * May be overridden by the decoder if it knows better. + * + * @note This field may not match the value of the last + * AVFrame outputted by avcodec_decode_video2 due frame + * reordering. + * * - encoding: Set by user. - * - decoding: Set by user if known, overridden by libavcodec if known + * - decoding: Set by user if known, overridden by libavcodec while + * parsing the data. */ enum AVPixelFormat pix_fmt; +#if FF_API_MOTION_EST /** - * Motion estimation algorithm used for video coding. - * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), - * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] - * - encoding: MUST be set by user. - * - decoding: unused + * This option does nothing + * @deprecated use codec private options instead */ - int me_method; + attribute_deprecated int me_method; +#endif /** * If non NULL, 'draw_horiz_band' is called by the libavcodec @@ -1455,6 +1791,10 @@ typedef struct AVCodecContext { * @param fmt is the list of formats which are supported by the codec, * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. * The first is always the native one. + * @note The callback may be called again immediately if initialization for + * the selected (hardware-accelerated) pixel format failed. + * @warning Behavior is undefined if the callback returns a value not + * in the fmt list of formats. * @return the chosen format * - encoding: unused * - decoding: Set by user, if not set the native format will be chosen. @@ -1478,11 +1818,17 @@ typedef struct AVCodecContext { */ float b_quant_factor; - /** obsolete FIXME remove */ - int rc_strategy; +#if FF_API_RC_STRATEGY + /** @deprecated use codec private option instead */ + attribute_deprecated int rc_strategy; #define FF_RC_STRATEGY_XVID 1 +#endif +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int b_frame_strategy; +#endif /** * qscale offset between IP and B-frames @@ -1499,12 +1845,11 @@ typedef struct AVCodecContext { */ int has_b_frames; - /** - * 0-> h263 quant 1-> mpeg quant - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int mpeg_quant; +#endif /** * qscale factor between P and I-frames @@ -1563,15 +1908,15 @@ typedef struct AVCodecContext { * - decoding: Set by user (or 0). */ int slice_count; - /** - * prediction method (needed for huffyuv) - * - encoding: Set by user. - * - decoding: unused - */ + +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int prediction_method; #define FF_PRED_LEFT 0 #define FF_PRED_PLANE 1 #define FF_PRED_MEDIAN 2 +#endif /** * slice offsets in the frame in bytes @@ -1644,12 +1989,11 @@ typedef struct AVCodecContext { */ int last_predictor_count; - /** - * prepass for motion estimation - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int pre_me; +#endif /** * motion estimation prepass comparison function @@ -1672,6 +2016,7 @@ typedef struct AVCodecContext { */ int me_subpel_quality; +#if FF_API_AFD /** * DTG active format information (additional aspect ratio * information only used in DVB MPEG-2 transport streams) @@ -1679,8 +2024,9 @@ typedef struct AVCodecContext { * * - encoding: unused * - decoding: Set by decoder. + * @deprecated Deprecated in favor of AVSideData */ - int dtg_active_format; + attribute_deprecated int dtg_active_format; #define FF_DTG_AFD_SAME 8 #define FF_DTG_AFD_4_3 9 #define FF_DTG_AFD_16_9 10 @@ -1688,6 +2034,7 @@ typedef struct AVCodecContext { #define FF_DTG_AFD_4_3_SP_14_9 13 #define FF_DTG_AFD_16_9_SP_14_9 14 #define FF_DTG_AFD_SP_4_3 15 +#endif /* FF_API_AFD */ /** * maximum motion estimation search range in subpel units @@ -1698,20 +2045,18 @@ typedef struct AVCodecContext { */ int me_range; +#if FF_API_QUANT_BIAS /** - * intra quantizer bias - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private option instead */ - int intra_quant_bias; + attribute_deprecated int intra_quant_bias; #define FF_DEFAULT_QUANT_BIAS 999999 /** - * inter quantizer bias - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private option instead */ - int inter_quant_bias; + attribute_deprecated int inter_quant_bias; +#endif /** * slice flags @@ -1757,41 +2102,34 @@ typedef struct AVCodecContext { */ uint16_t *inter_matrix; - /** - * scene change detection threshold - * 0 is default, larger means fewer detected scene changes. - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int scenechange_threshold; - /** - * noise reduction strength - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int noise_reduction; +#endif +#if FF_API_MPV_OPT /** - * Motion estimation threshold below which no motion estimation is - * performed, but instead the user specified motion vectors are used. - * - * - encoding: Set by user. - * - decoding: unused + * @deprecated this field is unused */ + attribute_deprecated int me_threshold; /** - * Macroblock threshold below which the user specified macroblock types will be used. - * - encoding: Set by user. - * - decoding: unused + * @deprecated this field is unused */ + attribute_deprecated int mb_threshold; +#endif /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. - * - decoding: unused + * - decoding: Set by libavcodec */ int intra_dc_precision; @@ -1809,13 +2147,13 @@ typedef struct AVCodecContext { */ int skip_bottom; +#if FF_API_MPV_OPT /** - * Border processing masking, raises the quantizer for mbs on the borders - * of the picture. - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated float border_masking; +#endif /** * minimum MB lagrange multipler @@ -1831,12 +2169,13 @@ typedef struct AVCodecContext { */ int mb_lmax; +#if FF_API_PRIVATE_OPT /** - * - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int me_penalty_compensation; +#endif /** * @@ -1845,12 +2184,11 @@ typedef struct AVCodecContext { */ int bidir_refine; - /** - * - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int brd_scale; +#endif /** * minimum GOP size @@ -1866,19 +2204,20 @@ typedef struct AVCodecContext { */ int refs; - /** - * chroma qp offset from luma - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int chromaoffset; +#endif +#if FF_API_UNUSED_MEMBERS /** * Multiplied by qscale for each frame and added to scene_change_score. * - encoding: Set by user. * - decoding: unused */ - int scenechange_factor; + attribute_deprecated int scenechange_factor; +#endif /** * @@ -1888,12 +2227,11 @@ typedef struct AVCodecContext { */ int mv0_threshold; - /** - * Adjust sensitivity of b_frame_strategy 1. - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int b_sensitivity; +#endif /** * Chromaticity coordinates of the source primaries. @@ -1962,7 +2300,7 @@ typedef struct AVCodecContext { * * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame * except the last must contain exactly frame_size samples per channel. - * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the * frame size is not restricted. * - decoding: may be set by some decoders to indicate constant frame size */ @@ -1992,16 +2330,6 @@ typedef struct AVCodecContext { */ int cutoff; -#if FF_API_REQUEST_CHANNELS - /** - * Decoder should decode to this many channels if it can (0 for default) - * - encoding: unused - * - decoding: Set by user. - * @deprecated Deprecated in favor of request_channel_layout. - */ - attribute_deprecated int request_channels; -#endif - /** * Audio channel layout. * - encoding: set by user. @@ -2031,102 +2359,6 @@ typedef struct AVCodecContext { */ enum AVSampleFormat request_sample_fmt; -#if FF_API_GET_BUFFER - /** - * Called at the beginning of each frame to get a buffer for it. - * - * The function will set AVFrame.data[], AVFrame.linesize[]. - * AVFrame.extended_data[] must also be set, but it should be the same as - * AVFrame.data[] except for planar audio with more channels than can fit - * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as - * many data pointers as it can hold. - * - * if CODEC_CAP_DR1 is not set then get_buffer() must call - * avcodec_default_get_buffer() instead of providing buffers allocated by - * some other means. - * - * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't - * need it. avcodec_default_get_buffer() aligns the output buffer properly, - * but if get_buffer() is overridden then alignment considerations should - * be taken into account. - * - * @see avcodec_default_get_buffer() - * - * Video: - * - * If pic.reference is set then the frame will be read later by libavcodec. - * avcodec_align_dimensions2() should be used to find the required width and - * height, as they normally need to be rounded up to the next multiple of 16. - * - * If frame multithreading is used and thread_safe_callbacks is set, - * it may be called from a different thread, but not from more than one at - * once. Does not need to be reentrant. - * - * @see release_buffer(), reget_buffer() - * @see avcodec_align_dimensions2() - * - * Audio: - * - * Decoders request a buffer of a particular size by setting - * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, - * however, utilize only part of the buffer by setting AVFrame.nb_samples - * to a smaller value in the output frame. - * - * Decoders cannot use the buffer after returning from - * avcodec_decode_audio4(), so they will not call release_buffer(), as it - * is assumed to be released immediately upon return. In some rare cases, - * a decoder may need to call get_buffer() more than once in a single - * call to avcodec_decode_audio4(). In that case, when get_buffer() is - * called again after it has already been called once, the previously - * acquired buffer is assumed to be released at that time and may not be - * reused by the decoder. - * - * As a convenience, av_samples_get_buffer_size() and - * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() - * functions to find the required data size and to fill data pointers and - * linesize. In AVFrame.linesize, only linesize[0] may be set for audio - * since all planes must be the same size. - * - * @see av_samples_get_buffer_size(), av_samples_fill_arrays() - * - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - * - * @deprecated use get_buffer2() - */ - attribute_deprecated - int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * Called to release buffers which were allocated with get_buffer. - * A released buffer can be reused in get_buffer(). - * pic.data[*] must be set to NULL. - * May be called from a different thread if frame multithreading is used, - * but not by more than one thread at once, so does not need to be reentrant. - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - * - * @deprecated custom freeing callbacks should be set from get_buffer2() - */ - attribute_deprecated - void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); - - /** - * Called at the beginning of a frame to get cr buffer for it. - * Buffer type (size, hints) must be the same. libavcodec won't check it. - * libavcodec will pass previous buffer in pic, function should return - * same buffer or new buffer with old frame "painted" into it. - * If pic.data[0] == NULL must behave like get_buffer(). - * if CODEC_CAP_DR1 is not set then reget_buffer() must call - * avcodec_default_reget_buffer() instead of providing buffers allocated by - * some other means. - * - encoding: unused - * - decoding: Set by libavcodec, user can override. - */ - attribute_deprecated - int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); -#endif - /** * This callback is called at the beginning of each frame to get data * buffer(s) for it. There may be one contiguous buffer for all the data or @@ -2164,7 +2396,7 @@ typedef struct AVCodecContext { * buffers than buf[] can hold. extended_buf will be freed in * av_frame_unref(). * - * If CODEC_CAP_DR1 is not set then get_buffer2() must call + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call * avcodec_default_get_buffer2() instead of providing buffers allocated by * some other means. * @@ -2247,16 +2479,18 @@ typedef struct AVCodecContext { */ int max_qdiff; +#if FF_API_MPV_OPT /** - * ratecontrol qmin qmax limiting method - * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated float rc_qsquish; + attribute_deprecated float rc_qmod_amp; + attribute_deprecated int rc_qmod_freq; +#endif /** * decoder bitstream buffer size @@ -2273,35 +2507,38 @@ typedef struct AVCodecContext { int rc_override_count; RcOverride *rc_override; +#if FF_API_MPV_OPT /** - * rate control equation - * - encoding: Set by user - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated const char *rc_eq; +#endif /** * maximum bitrate * - encoding: Set by user. - * - decoding: unused + * - decoding: Set by user, may be overwritten by libavcodec. */ - int rc_max_rate; + int64_t rc_max_rate; /** * minimum bitrate * - encoding: Set by user. * - decoding: unused */ - int rc_min_rate; + int64_t rc_min_rate; +#if FF_API_MPV_OPT + /** + * @deprecated use encoder private options instead + */ + attribute_deprecated float rc_buffer_aggressivity; - /** - * initial complexity for pass1 ratecontrol - * - encoding: Set by user. - * - decoding: unused - */ + attribute_deprecated float rc_initial_cplx; +#endif /** * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. @@ -2324,66 +2561,58 @@ typedef struct AVCodecContext { */ int rc_initial_buffer_occupancy; +#if FF_API_CODER_TYPE #define FF_CODER_TYPE_VLC 0 #define FF_CODER_TYPE_AC 1 #define FF_CODER_TYPE_RAW 2 #define FF_CODER_TYPE_RLE 3 +#if FF_API_UNUSED_MEMBERS #define FF_CODER_TYPE_DEFLATE 4 +#endif /* FF_API_UNUSED_MEMBERS */ /** - * coder type - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int coder_type; +#endif /* FF_API_CODER_TYPE */ - /** - * context model - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int context_model; +#endif +#if FF_API_MPV_OPT /** - * minimum Lagrange multipler - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int lmin; /** - * maximum Lagrange multipler - * - encoding: Set by user. - * - decoding: unused + * @deprecated use encoder private options instead */ + attribute_deprecated int lmax; +#endif - /** - * frame skip threshold - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_threshold; - /** - * frame skip factor - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_factor; - /** - * frame skip exponent - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_exp; - /** - * frame skip comparison function - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int frame_skip_cmp; +#endif /* FF_API_PRIVATE_OPT */ /** * trellis RD quantization @@ -2392,56 +2621,68 @@ typedef struct AVCodecContext { */ int trellis; - /** - * - encoding: Set by user. - * - decoding: unused - */ +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int min_prediction_order; - /** - * - encoding: Set by user. - * - decoding: unused - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int max_prediction_order; - /** - * GOP timecode frame start number - * - encoding: Set by user, in non drop frame format - * - decoding: Set by libavcodec (timecode in the 25 bits format, -1 if unset) - */ + /** @deprecated use encoder private options instead */ + attribute_deprecated int64_t timecode_frame_start; +#endif +#if FF_API_RTP_CALLBACK + /** + * @deprecated unused + */ /* The RTP callback: This function is called */ /* every time the encoder has a packet to send. */ /* It depends on the encoder if the data starts */ /* with a Start Code (it should). H.263 does. */ /* mb_nb contains the number of macroblocks */ /* encoded in the RTP payload. */ + attribute_deprecated void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); +#endif +#if FF_API_PRIVATE_OPT + /** @deprecated use encoder private options instead */ + attribute_deprecated int rtp_payload_size; /* The size of the RTP payload: the coder will */ /* do its best to deliver a chunk with size */ /* below rtp_payload_size, the chunk will start */ /* with a start code on some codecs like H.263. */ /* This doesn't take account of any particular */ /* headers inside the transmitted RTP payload. */ +#endif +#if FF_API_STAT_BITS /* statistics, used for 2-pass encoding */ + attribute_deprecated int mv_bits; + attribute_deprecated int header_bits; + attribute_deprecated int i_tex_bits; + attribute_deprecated int p_tex_bits; + attribute_deprecated int i_count; + attribute_deprecated int p_count; + attribute_deprecated int skip_count; + attribute_deprecated int misc_bits; - /** - * number of bits used for the previously encoded frame - * - encoding: Set by libavcodec. - * - decoding: unused - */ + /** @deprecated this field is unused */ + attribute_deprecated int frame_bits; +#endif /** * pass1 encoding statistics output buffer @@ -2512,6 +2753,7 @@ typedef struct AVCodecContext { int error_concealment; #define FF_EC_GUESS_MVS 1 #define FF_EC_DEBLOCK 2 +#define FF_EC_FAVOR_INTER 256 /** * debug @@ -2533,7 +2775,9 @@ typedef struct AVCodecContext { #define FF_DEBUG_DCT_COEFF 0x00000040 #define FF_DEBUG_SKIP 0x00000080 #define FF_DEBUG_STARTCODE 0x00000100 +#if FF_API_UNUSED_MEMBERS #define FF_DEBUG_PTS 0x00000200 +#endif /* FF_API_UNUSED_MEMBERS */ #define FF_DEBUG_ER 0x00000400 #define FF_DEBUG_MMCO 0x00000800 #define FF_DEBUG_BUGS 0x00001000 @@ -2543,6 +2787,8 @@ typedef struct AVCodecContext { #endif #define FF_DEBUG_BUFFERS 0x00008000 #define FF_DEBUG_THREADS 0x00010000 +#define FF_DEBUG_GREEN_MD 0x00800000 +#define FF_DEBUG_NOMC 0x01000000 #if FF_API_DEBUG_MV /** @@ -2575,15 +2821,15 @@ typedef struct AVCodecContext { #define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length #define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue #define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors -#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliancies as errors +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors #define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder should not do as an error /** * opaque 64bit number (generally a PTS) that will be reordered and * output in AVFrame.reordered_opaque - * @deprecated in favor of pkt_pts * - encoding: unused * - decoding: Set by user. */ @@ -2610,7 +2856,7 @@ typedef struct AVCodecContext { /** * error - * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR. * - decoding: unused */ uint64_t error[AV_NUM_DATA_POINTERS]; @@ -2640,18 +2886,28 @@ typedef struct AVCodecContext { #define FF_IDCT_SIMPLEMMX 3 #define FF_IDCT_ARM 7 #define FF_IDCT_ALTIVEC 8 +#if FF_API_ARCH_SH4 #define FF_IDCT_SH4 9 +#endif #define FF_IDCT_SIMPLEARM 10 +#if FF_API_UNUSED_MEMBERS #define FF_IDCT_IPP 13 +#endif /* FF_API_UNUSED_MEMBERS */ +#define FF_IDCT_XVID 14 +#if FF_API_IDCT_XVIDMMX #define FF_IDCT_XVIDMMX 14 +#endif /* FF_API_IDCT_XVIDMMX */ #define FF_IDCT_SIMPLEARMV5TE 16 #define FF_IDCT_SIMPLEARMV6 17 +#if FF_API_ARCH_SPARC #define FF_IDCT_SIMPLEVIS 18 +#endif #define FF_IDCT_FAAN 20 #define FF_IDCT_SIMPLENEON 22 #if FF_API_ARCH_ALPHA #define FF_IDCT_SIMPLEALPHA 23 #endif +#define FF_IDCT_SIMPLEAUTO 128 /** * bits per sample/pixel from the demuxer (needed for huffyuv). @@ -2678,12 +2934,16 @@ typedef struct AVCodecContext { int lowres; #endif +#if FF_API_CODED_FRAME /** * the picture in the bitstream * - encoding: Set by libavcodec. * - decoding: unused + * + * @deprecated use the quality factor packet side data instead */ - AVFrame *coded_frame; + attribute_deprecated AVFrame *coded_frame; +#endif /** * thread count @@ -2753,16 +3013,8 @@ typedef struct AVCodecContext { */ int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); -#if FF_API_THREAD_OPAQUE /** - * @deprecated this field should not be used from outside of lavc - */ - attribute_deprecated - void *thread_opaque; -#endif - - /** - * noise vs. sse weight for the nsse comparsion function + * noise vs. sse weight for the nsse comparison function * - encoding: Set by user. * - decoding: unused */ @@ -2793,6 +3045,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_DTS_96_24 40 #define FF_PROFILE_DTS_HD_HRA 50 #define FF_PROFILE_DTS_HD_MA 60 +#define FF_PROFILE_DTS_EXPRESS 70 #define FF_PROFILE_MPEG2_422 0 #define FF_PROFILE_MPEG2_HIGH 1 @@ -2846,10 +3099,15 @@ typedef struct AVCodecContext { #define FF_PROFILE_JPEG2000_DCINEMA_2K 3 #define FF_PROFILE_JPEG2000_DCINEMA_4K 4 +#define FF_PROFILE_VP9_0 0 +#define FF_PROFILE_VP9_1 1 +#define FF_PROFILE_VP9_2 2 +#define FF_PROFILE_VP9_3 3 #define FF_PROFILE_HEVC_MAIN 1 #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 +#define FF_PROFILE_HEVC_REXT 4 /** * level @@ -2900,21 +3158,65 @@ typedef struct AVCodecContext { int error_rate; #endif -#if FF_API_CODEC_PKT - /** - * @deprecated this field is not supposed to be accessed from outside lavc - */ - attribute_deprecated - AVPacket *pkt; -#endif - +#if FF_API_VBV_DELAY /** * VBV delay coded in the last frame (in periods of a 27 MHz clock). * Used for compliant TS muxing. * - encoding: Set by libavcodec. * - decoding: unused. + * @deprecated this value is now exported as a part of + * AV_PKT_DATA_CPB_PROPERTIES packet side data */ + attribute_deprecated uint64_t vbv_delay; +#endif + +#if FF_API_SIDEDATA_ONLY_PKT + /** + * Encoding only and set by default. Allow encoders to output packets + * that do not contain any encoded data, only side data. + * + * Some encoders need to output such packets, e.g. to update some stream + * parameters at the end of encoding. + * + * @deprecated this field disables the default behaviour and + * it is kept only for compatibility. + */ + attribute_deprecated + int side_data_only_packets; +#endif + + /** + * Audio only. The number of "priming" samples (padding) inserted by the + * encoder at the beginning of the audio. I.e. this number of leading + * decoded samples must be discarded by the caller to get the original audio + * without leading padding. + * + * - decoding: unused + * - encoding: Set by libavcodec. The timestamps on the output packets are + * adjusted by the encoder so that they always refer to the + * first sample of the data actually contained in the packet, + * including any added padding. E.g. if the timebase is + * 1/samplerate and the timestamp of the first input sample is + * 0, the timestamp of the first output packet will be + * -initial_padding. + */ + int initial_padding; + + /** + * - decoding: For codecs that store a framerate value in the compressed + * bitstream, the decoder may export it here. { 0, 1} when + * unknown. + * - encoding: unused + */ + AVRational framerate; + + /** + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. + * - encoding: unused. + * - decoding: Set by libavcodec before calling get_format() + */ + enum AVPixelFormat sw_pix_fmt; /** * Timebase in which pkt_dts/pts and AVPacket.dts/pts are. @@ -3015,6 +3317,44 @@ typedef struct AVCodecContext { * - decoding: unused. */ uint16_t *chroma_intra_matrix; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * Code outside libavcodec should access this field using AVOptions + * (NO direct access). + * - encoding: Set by user. + * - decoding: Set by user. + */ + uint8_t *dump_separator; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOPtions (NO direct access) + */ + char *codec_whitelist; + + /* + * Properties of the stream that gets decoded + * To be accessed through av_codec_get_properties() (NO direct access) + * - encoding: unused + * - decoding: set by libavcodec + */ + unsigned properties; +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 + + /** + * Additional data associated with the entire coded stream. + * + * - decoding: unused + * - encoding: may be set by libavcodec after avcodec_open2(). + */ + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + } AVCodecContext; AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); @@ -3023,6 +3363,8 @@ void av_codec_set_pkt_timebase (AVCodecContext *avctx, AVRational const AVCodecDescriptor *av_codec_get_codec_descriptor(const AVCodecContext *avctx); void av_codec_set_codec_descriptor(AVCodecContext *avctx, const AVCodecDescriptor *desc); +unsigned av_codec_get_codec_properties(const AVCodecContext *avctx); + int av_codec_get_lowres(const AVCodecContext *avctx); void av_codec_set_lowres(AVCodecContext *avctx, int val); @@ -3064,7 +3406,7 @@ typedef struct AVCodec { enum AVCodecID id; /** * Codec capabilities. - * see CODEC_CAP_* + * see AV_CODEC_CAP_* */ int capabilities; const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} @@ -3072,7 +3414,7 @@ typedef struct AVCodec { const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 - uint8_t max_lowres; ///< maximum value for lowres supported by the decoder + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres() const AVClass *priv_class; ///< AVClass for the private context const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} @@ -3137,6 +3479,11 @@ typedef struct AVCodec { * Will be called when seeking */ void (*flush)(AVCodecContext *); + /** + * Internal codec capabilities. + * See FF_CODEC_CAP_* in internal.h + */ + int caps_internal; } AVCodec; int av_codec_get_max_lowres(const AVCodec *codec); @@ -3144,7 +3491,8 @@ int av_codec_get_max_lowres(const AVCodec *codec); struct MpegEncContext; /** - * AVHWAccel. + * @defgroup lavc_hwaccel AVHWAccel + * @{ */ typedef struct AVHWAccel { /** @@ -3177,12 +3525,24 @@ typedef struct AVHWAccel { /** * Hardware accelerated codec capabilities. - * see FF_HWACCEL_CODEC_CAP_* + * see HWACCEL_CODEC_CAP_* */ int capabilities; + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ struct AVHWAccel *next; + /** + * Allocate a custom buffer + */ + int (*alloc_frame)(AVCodecContext *avctx, AVFrame *frame); + /** * Called at the beginning of each frame or field picture. * @@ -3225,26 +3585,70 @@ typedef struct AVHWAccel { int (*end_frame)(AVCodecContext *avctx); /** - * Size of HW accelerator private data. + * Size of per-frame hardware accelerator private data. * * Private data is allocated with av_mallocz() before * AVCodecContext.get_buffer() and deallocated after * AVCodecContext.release_buffer(). */ - int priv_data_size; + int frame_priv_data_size; /** * Called for every Macroblock in a slice. * - * XvMC uses it to replace the ff_MPV_decode_mb(). + * XvMC uses it to replace the ff_mpv_decode_mb(). * Instead of decoding to raw picture, MB parameters are * stored in an array provided by the video driver. * * @param s the mpeg context */ void (*decode_mb)(struct MpegEncContext *s); + + /** + * Initialize the hwaccel private data. + * + * This will be called from ff_get_format(), after hwaccel and + * hwaccel_context are set and the hwaccel private data in AVCodecInternal + * is allocated. + */ + int (*init)(AVCodecContext *avctx); + + /** + * Uninitialize the hwaccel private data. + * + * This will be called from get_format() or avcodec_close(), after hwaccel + * and hwaccel_context are already uninitialized. + */ + int (*uninit)(AVCodecContext *avctx); + + /** + * Size of the private data to allocate in + * AVCodecInternal.hwaccel_priv_data. + */ + int priv_data_size; } AVHWAccel; +/** + * Hardware acceleration should be used for decoding even if the codec level + * used is unknown or higher than the maximum supported level reported by the + * hardware driver. + * + * It's generally a good idea to pass this flag unless you have a specific + * reason not to, as hardware tends to under-report supported levels. + */ +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) + +/** + * Hardware acceleration can output YUV pixel formats with a different chroma + * sampling than 4:2:0 and/or other than 8 bits per component. + */ +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1) + +/** + * @} + */ + +#if FF_API_AVPICTURE /** * @defgroup lavc_picture AVPicture * @@ -3257,15 +3661,19 @@ typedef struct AVHWAccel { * * Up to four components can be stored into it, the last component is * alpha. + * @deprecated use AVFrame or imgutils functions instead */ typedef struct AVPicture { + attribute_deprecated uint8_t *data[AV_NUM_DATA_POINTERS]; ///< pointers to the image data planes + attribute_deprecated int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line } AVPicture; /** * @} */ +#endif enum AVSubtitleType { SUBTITLE_NONE, @@ -3294,11 +3702,20 @@ typedef struct AVSubtitleRect { int h; ///< height of pict, undefined when pict is not set int nb_colors; ///< number of colors in pict, undefined when pict is not set +#if FF_API_AVPICTURE + /** + * @deprecated unused + */ + attribute_deprecated + AVPicture pict; +#endif /** * data+linesize for the bitmap of this subtitle. - * can be set for text/ass as well once they where rendered + * Can be set for text/ass as well once they are rendered. */ - AVPicture pict; + uint8_t *data[4]; + int linesize[4]; + enum AVSubtitleType type; char *text; ///< 0 terminated plain UTF-8 text @@ -3327,7 +3744,7 @@ typedef struct AVSubtitle { * if c is non-NULL, returns the next registered codec after c, * or NULL if c is the last one. */ -const AVCodec *av_codec_next(const AVCodec *c); +AVCodec *av_codec_next(const AVCodec *c); /** * Return the LIBAVCODEC_VERSION_INT constant. @@ -3367,9 +3784,8 @@ void avcodec_register(AVCodec *codec); void avcodec_register_all(void); /** - * Allocate an AVCodecContext and set its fields to default values. The - * resulting struct can be deallocated by calling avcodec_close() on it followed - * by av_free(). + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct should be freed with avcodec_free_context(). * * @param codec if non-NULL, allocate private data and initialize defaults * for the given codec. It is illegal to then call avcodec_open2() @@ -3383,6 +3799,12 @@ void avcodec_register_all(void); */ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); +/** + * Free the codec context and everything associated with it and write NULL to + * the provided pointer. + */ +void avcodec_free_context(AVCodecContext **avctx); + /** * Set the fields of the given AVCodecContext to default values corresponding * to the given codec (defaults may be codec-dependent). @@ -3431,39 +3853,6 @@ const AVClass *avcodec_get_subtitle_rect_class(void); */ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); -#if FF_API_AVFRAME_LAVC -/** - * @deprecated use av_frame_alloc() - */ -attribute_deprecated -AVFrame *avcodec_alloc_frame(void); - -/** - * Set the fields of the given AVFrame to default values. - * - * @param frame The AVFrame of which the fields should be set to default values. - * - * @deprecated use av_frame_unref() - */ -attribute_deprecated -void avcodec_get_frame_defaults(AVFrame *frame); - -/** - * Free the frame and any dynamically allocated objects in it, - * e.g. extended_data. - * - * @param frame frame to be freed. The pointer will be set to NULL. - * - * @warning this function does NOT free the data buffers themselves - * (it does not know how, since they might have been allocated with - * a custom get_buffer()). - * - * @deprecated use av_frame_free() - */ -attribute_deprecated -void avcodec_free_frame(AVFrame **frame); -#endif - /** * Initialize the AVCodecContext to use the given AVCodec. Prior to using this * function the context has to be allocated with avcodec_alloc_context3(). @@ -3474,6 +3863,9 @@ void avcodec_free_frame(AVFrame **frame); * * @warning This function is not thread safe! * + * @note Always call this function before using decoding routines (such as + * @ref avcodec_decode_video2()). + * * @code * avcodec_register_all(); * av_dict_set(&opts, "b", "2.5M", 0); @@ -3529,14 +3921,39 @@ void avsubtitle_free(AVSubtitle *sub); * @{ */ -#if FF_API_DESTRUCT_PACKET /** - * Default packet destructor. - * @deprecated use the AVBuffer API instead + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet */ -attribute_deprecated -void av_destruct_packet(AVPacket *pkt); -#endif +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref + */ +AVPacket *av_packet_clone(AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param packet packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); /** * Initialize optional fields of a packet with default values. @@ -3583,39 +4000,45 @@ int av_grow_packet(AVPacket *pkt, int grow_by); * function returns successfully, the data is owned by the underlying AVBuffer. * The caller may not access the data through other means. * @param size size of data in bytes, without the padding. I.e. the full buffer - * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. * * @return 0 on success, a negative AVERROR on error */ int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); +#if FF_API_AVPACKET_OLD_API /** * @warning This is a hack - the packet memory allocation stuff is broken. The * packet is allocated if it was not really allocated. + * + * @deprecated Use av_packet_ref */ +attribute_deprecated int av_dup_packet(AVPacket *pkt); - /** * Copy packet, including contents * * @return 0 on success, negative AVERROR on fail */ -int av_copy_packet(AVPacket *dst, AVPacket *src); +int av_copy_packet(AVPacket *dst, const AVPacket *src); /** * Copy packet side data * * @return 0 on success, negative AVERROR on fail */ -int av_copy_packet_side_data(AVPacket *dst, AVPacket *src); +int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src); /** * Free a packet. * + * @deprecated Use av_packet_unref + * * @param pkt packet to free */ +attribute_deprecated void av_free_packet(AVPacket *pkt); - +#endif /** * Allocate new information of a packet. * @@ -3627,6 +4050,22 @@ void av_free_packet(AVPacket *pkt); uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size); +/** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + /** * Shrink the already allocated side data buffer * @@ -3653,6 +4092,8 @@ int av_packet_merge_side_data(AVPacket *pkt); int av_packet_split_side_data(AVPacket *pkt); +const char *av_packet_side_data_name(enum AVPacketSideDataType type); + /** * Pack a dictionary for use in side_data. * @@ -3696,7 +4137,7 @@ void av_packet_free_side_data(AVPacket *pkt); * * @return 0 on success, a negative AVERROR on error. */ -int av_packet_ref(AVPacket *dst, AVPacket *src); +int av_packet_ref(AVPacket *dst, const AVPacket *src); /** * Wipe the packet. @@ -3732,6 +4173,19 @@ void av_packet_move_ref(AVPacket *dst, AVPacket *src); */ int av_packet_copy_props(AVPacket *dst, const AVPacket *src); +/** + * Convert valid timing fields (timestamps / durations) in a packet from one + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be + * ignored. + * + * @param pkt packet on which the conversion will be performed + * @param tb_src source timebase, in which the timing fields in pkt are + * expressed + * @param tb_dst destination timebase, to which the timing fields will be + * converted + */ +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); + /** * @} */ @@ -3757,16 +4211,10 @@ AVCodec *avcodec_find_decoder(enum AVCodecID id); */ AVCodec *avcodec_find_decoder_by_name(const char *name); -#if FF_API_GET_BUFFER -attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); -attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); -attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); -#endif - /** * The default callback for AVCodecContext.get_buffer2(). It is made public so * it can be called by custom get_buffer2() implementations for decoders without - * CODEC_CAP_DR1 set. + * AV_CODEC_CAP_DR1 set. */ int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); @@ -3790,7 +4238,7 @@ unsigned avcodec_get_edge_width(void); * buffer that is acceptable for the codec if you do not use any horizontal * padding. * - * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. */ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); @@ -3799,7 +4247,7 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); * buffer that is acceptable for the codec if you also ensure that all * line sizes are a multiple of the respective linesize_align[i]. * - * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. */ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]); @@ -3826,66 +4274,6 @@ int avcodec_enum_to_chroma_pos(int *xpos, int *ypos, enum AVChromaLocation pos); */ enum AVChromaLocation avcodec_chroma_pos_to_enum(int xpos, int ypos); -#if FF_API_OLD_DECODE_AUDIO -/** - * Wrapper function which calls avcodec_decode_audio4. - * - * @deprecated Use avcodec_decode_audio4 instead. - * - * Decode the audio frame of size avpkt->size from avpkt->data into samples. - * Some decoders may support multiple frames in a single AVPacket, such - * decoders would then just decode the first frame. In this case, - * avcodec_decode_audio3 has to be called again with an AVPacket that contains - * the remaining data in order to decode the second frame etc. - * If no frame - * could be outputted, frame_size_ptr is zero. Otherwise, it is the - * decompressed frame size in bytes. - * - * @warning You must set frame_size_ptr to the allocated size of the - * output buffer before calling avcodec_decode_audio3(). - * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than - * the actual read bytes because some optimized bitstream readers read 32 or 64 - * bits at once and could read over the end. - * - * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that - * no overreading happens for damaged MPEG streams. - * - * @warning You must not provide a custom get_buffer() when using - * avcodec_decode_audio3(). Doing so will override it with - * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, - * which does allow the application to provide a custom get_buffer(). - * - * @note You might have to align the input buffer avpkt->data and output buffer - * samples. The alignment requirements depend on the CPU: On some CPUs it isn't - * necessary at all, on others it won't work at all if not aligned and on others - * it will work but it will have an impact on performance. - * - * In practice, avpkt->data should have 4 byte alignment at minimum and - * samples should be 16 byte aligned unless the CPU doesn't need it - * (AltiVec and SSE do). - * - * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay - * between input and output, these need to be fed with avpkt->data=NULL, - * avpkt->size=0 at the end to return the remaining frames. - * - * @param avctx the codec context - * @param[out] samples the output buffer, sample type in avctx->sample_fmt - * If the sample format is planar, each channel plane will - * be the same size, with no padding between channels. - * @param[in,out] frame_size_ptr the output buffer size in bytes - * @param[in] avpkt The input AVPacket containing the input buffer. - * You can create such packet with av_init_packet() and by then setting - * data and size, some decoders might in addition need other fields. - * All decoders are designed to use the least fields possible though. - * @return On error a negative value is returned, otherwise the number of bytes - * used or zero if no frame data was decompressed (used) from the input AVPacket. - */ -attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, - int *frame_size_ptr, - AVPacket *avpkt); -#endif - /** * Decode the audio frame of size avpkt->size from avpkt->data into frame. * @@ -3897,18 +4285,21 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * needs to be fed to the decoder with remaining data until it is completely * consumed or an error occurs. * - * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input * and output. This means that for some packets they will not immediately * produce decoded output and need to be flushed at the end of decoding to get * all the decoded data. Flushing is done by calling this function with packets * with avpkt->data set to NULL and avpkt->size set to 0 until it stops * returning samples. It is safe to flush even those decoders that are not - * marked with CODEC_CAP_DELAY, then no samples will be returned. + * marked with AV_CODEC_CAP_DELAY, then no samples will be returned. * - * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE * larger than the actual read bytes because some optimized bitstream * readers read 32 or 64 bits at once and could read over the end. * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * * @param avctx the codec context * @param[out] frame The AVFrame in which to store decoded audio samples. * The decoder will allocate a buffer for the decoded frame by @@ -3925,7 +4316,7 @@ attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *s * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is * non-zero. Note that this field being set to zero * does not mean that an error has occurred. For - * decoders with CODEC_CAP_DELAY set, no given decode + * decoders with AV_CODEC_CAP_DELAY set, no given decode * call is guaranteed to produce a frame. * @param[in] avpkt The input AVPacket containing the input buffer. * At least avpkt->data and avpkt->size should be set. Some @@ -3942,17 +4333,20 @@ int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, * Some decoders may support multiple frames in a single AVPacket, such * decoders would then just decode the first frame. * - * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * @warning The input buffer must be AV_INPUT_BUFFER_PADDING_SIZE larger than * the actual read bytes because some optimized bitstream readers read 32 or 64 * bits at once and could read over the end. * * @warning The end of the input buffer buf should be set to 0 to ensure that * no overreading happens for damaged MPEG streams. * - * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * @note Codecs which have the AV_CODEC_CAP_DELAY capability set have a delay * between input and output, these need to be fed with avpkt->data=NULL, * avpkt->size=0 at the end to return the remaining frames. * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * * @param avctx the codec context * @param[out] picture The AVFrame in which the decoded video frame will be stored. * Use av_frame_alloc() to get an AVFrame. The codec will @@ -3986,7 +4380,7 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, * Return a negative value on error, otherwise return the number of bytes used. * If no subtitle could be decompressed, got_sub_ptr is zero. * Otherwise, the subtitle is stored in *sub. - * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for * simplicity, because the performance difference is expect to be negligible * and reusing a get_buffer written for video codecs would probably perform badly * due to a potentially very different allocation pattern. @@ -3999,9 +4393,12 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, * returning subtitles. It is safe to flush even those decoders that are not * marked with CODEC_CAP_DELAY, then no subtitles will be returned. * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * * @param avctx the codec context - * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be - freed with avsubtitle_free if *got_sub_ptr is set. + * @param[out] sub The Preallocated AVSubtitle in which the decoded subtitle will be stored, + * must be freed with avsubtitle_free if *got_sub_ptr is set. * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. * @param[in] avpkt The input AVPacket containing the input buffer. */ @@ -4072,24 +4469,13 @@ typedef struct AVCodecParserContext { */ int key_frame; +#if FF_API_CONVERGENCE_DURATION /** - * Time difference in stream time base units from the pts of this - * packet to the point at which the output from the decoder has converged - * independent from the availability of previous frames. That is, the - * frames are virtually identical no matter if decoding started from - * the very first frame or from this keyframe. - * Is AV_NOPTS_VALUE if unknown. - * This field is not the display duration of the current frame. - * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY - * set. - * - * The purpose of this field is to allow seeking in streams that have no - * keyframes in the conventional sense. It corresponds to the - * recovery point SEI in H.264 and match_time_delta in NUT. It is also - * essential for some types of subtitle streams to ensure that all - * subtitles are correctly displayed after seeking. + * @deprecated unused */ + attribute_deprecated int64_t convergence_duration; +#endif // Timestamp generation support: /** @@ -4175,12 +4561,36 @@ typedef struct AVCodecParserContext { * For example, this corresponds to H.264 PicOrderCnt. */ int output_picture_number; + + /** + * Dimensions of the decoded video intended for presentation. + */ + int width; + int height; + + /** + * Dimensions of the coded video. + */ + int coded_width; + int coded_height; + + /** + * The format of the coded data, corresponds to enum AVPixelFormat for video + * and for enum AVSampleFormat for audio. + * + * Note that a decoder can have considerable freedom in how exactly it + * decodes the data, so the format reported here might be different from the + * one returned by a decoder. + */ + int format; } AVCodecParserContext; typedef struct AVCodecParser { int codec_ids[5]; /* several codec IDs are permitted */ int priv_data_size; int (*parser_init)(AVCodecParserContext *s); + /* This callback never returns an error, a negative value means that + * the frame start was in a previous packet. */ int (*parser_parse)(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, @@ -4190,7 +4600,7 @@ typedef struct AVCodecParser { struct AVCodecParser *next; } AVCodecParser; -AVCodecParser *av_parser_next(AVCodecParser *c); +AVCodecParser *av_parser_next(const AVCodecParser *c); void av_register_codec_parser(AVCodecParser *parser); AVCodecParserContext *av_parser_init(int codec_id); @@ -4266,36 +4676,6 @@ AVCodec *avcodec_find_encoder(enum AVCodecID id); */ AVCodec *avcodec_find_encoder_by_name(const char *name); -#if FF_API_OLD_ENCODE_AUDIO -/** - * Encode an audio frame from samples into buf. - * - * @deprecated Use avcodec_encode_audio2 instead. - * - * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. - * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user - * will know how much space is needed because it depends on the value passed - * in buf_size as described below. In that case a lower value can be used. - * - * @param avctx the codec context - * @param[out] buf the output buffer - * @param[in] buf_size the output buffer size - * @param[in] samples the input buffer containing the samples - * The number of samples read from this buffer is frame_size*channels, - * both of which are defined in avctx. - * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of - * samples read from samples is equal to: - * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) - * This also implies that av_get_bits_per_sample() must not return 0 for these - * codecs. - * @return On error a negative value is returned, on success zero or the number - * of bytes used to encode the data read from the input buffer. - */ -int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, - uint8_t *buf, int buf_size, - const short *samples); -#endif - /** * Encode a frame of audio. * @@ -4317,12 +4697,11 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, * of the output packet. * * If this function fails or produces no output, avpkt will be - * freed using av_free_packet() (i.e. avpkt->destruct will be - * called to free the user supplied buffer). + * freed using av_packet_unref(). * @param[in] frame AVFrame containing the raw audio data to be encoded. * May be NULL when flushing an encoder that has the - * CODEC_CAP_DELAY capability set. - * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * AV_CODEC_CAP_DELAY capability set. + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame * can have any number of samples. * If it is not set, frame->nb_samples must be equal to * avctx->frame_size for all frames except the last. @@ -4338,26 +4717,6 @@ int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr); -#if FF_API_OLD_ENCODE_VIDEO -/** - * @deprecated use avcodec_encode_video2() instead. - * - * Encode a video frame from pict into buf. - * The input picture should be - * stored using a specific format, namely avctx.pix_fmt. - * - * @param avctx the codec context - * @param[out] buf the output buffer for the bitstream of encoded frame - * @param[in] buf_size the size of the output buffer in bytes - * @param[in] pict the input picture to encode - * @return On error a negative value is returned, on success zero or the number - * of bytes used from the output buffer. - */ -attribute_deprecated -int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, - const AVFrame *pict); -#endif - /** * Encode a frame of video. * @@ -4379,11 +4738,10 @@ int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, * caller, he is responsible for freeing it. * * If this function fails or produces no output, avpkt will be - * freed using av_free_packet() (i.e. avpkt->destruct will be - * called to free the user supplied buffer). + * freed using av_packet_unref(). * @param[in] frame AVFrame containing the raw video data to be encoded. * May be NULL when flushing an encoder that has the - * CODEC_CAP_DELAY capability set. + * AV_CODEC_CAP_DELAY capability set. * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the * output packet is non-empty, and to 0 if it is * empty. If the function returns an error, the @@ -4500,129 +4858,70 @@ void av_resample_close(struct AVResampleContext *c); */ #endif +#if FF_API_AVPICTURE /** * @addtogroup lavc_picture * @{ */ /** - * Allocate memory for the pixels of a picture and setup the AVPicture - * fields for it. - * - * Call avpicture_free() to free it. - * - * @param picture the picture structure to be filled in - * @param pix_fmt the pixel format of the picture - * @param width the width of the picture - * @param height the height of the picture - * @return zero if successful, a negative error code otherwise - * - * @see av_image_alloc(), avpicture_fill() + * @deprecated unused */ +attribute_deprecated int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); /** - * Free a picture previously allocated by avpicture_alloc(). - * The data buffer used by the AVPicture is freed, but the AVPicture structure - * itself is not. - * - * @param picture the AVPicture to be freed + * @deprecated unused */ +attribute_deprecated void avpicture_free(AVPicture *picture); /** - * Setup the picture fields based on the specified image parameters - * and the provided image data buffer. - * - * The picture fields are filled in by using the image data buffer - * pointed to by ptr. - * - * If ptr is NULL, the function will fill only the picture linesize - * array and return the required size for the image buffer. - * - * To allocate an image buffer and fill the picture data in one call, - * use avpicture_alloc(). - * - * @param picture the picture to be filled in - * @param ptr buffer where the image data is stored, or NULL - * @param pix_fmt the pixel format of the image - * @param width the width of the image in pixels - * @param height the height of the image in pixels - * @return the size in bytes required for src, a negative error code - * in case of failure - * - * @see av_image_fill_arrays() + * @deprecated use av_image_fill_arrays() instead. */ +attribute_deprecated int avpicture_fill(AVPicture *picture, const uint8_t *ptr, enum AVPixelFormat pix_fmt, int width, int height); /** - * Copy pixel data from an AVPicture into a buffer. - * - * avpicture_get_size() can be used to compute the required size for - * the buffer to fill. - * - * @param src source picture with filled data - * @param pix_fmt picture pixel format - * @param width picture width - * @param height picture height - * @param dest destination buffer - * @param dest_size destination buffer size in bytes - * @return the number of bytes written to dest, or a negative value - * (error code) on error, for example if the destination buffer is not - * big enough - * - * @see av_image_copy_to_buffer() + * @deprecated use av_image_copy_to_buffer() instead. */ +attribute_deprecated int avpicture_layout(const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height, unsigned char *dest, int dest_size); /** - * Calculate the size in bytes that a picture of the given width and height - * would occupy if stored in the given picture format. - * - * @param pix_fmt picture pixel format - * @param width picture width - * @param height picture height - * @return the computed picture buffer size or a negative error code - * in case of error - * - * @see av_image_get_buffer_size(). - */ -int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); - -#if FF_API_DEINTERLACE -/** - * deinterlace - if not supported return -1 - * - * @deprecated - use yadif (in libavfilter) instead + * @deprecated use av_image_get_buffer_size() instead. */ attribute_deprecated -int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, - enum AVPixelFormat pix_fmt, int width, int height); -#endif +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + /** - * Copy image src to dst. Wraps av_image_copy(). + * @deprecated av_image_copy() instead. */ +attribute_deprecated void av_picture_copy(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height); /** - * Crop image top and left side. + * @deprecated unused */ +attribute_deprecated int av_picture_crop(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int top_band, int left_band); /** - * Pad image. + * @deprecated unused */ +attribute_deprecated int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, int padtop, int padbottom, int padleft, int padright, int *color); /** * @} */ +#endif /** * @defgroup lavc_misc Utility functions @@ -4664,30 +4963,8 @@ void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int */ unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); -#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ -#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ -#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ -#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ -#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ -#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ - /** - * Compute what kind of losses will occur when converting from one specific - * pixel format to another. - * When converting from one pixel format to another, information loss may occur. - * For example, when converting from RGB24 to GRAY, the color information will - * be lost. Similarly, other losses occur when converting from some formats to - * other formats. These losses can involve loss of chroma, but also loss of - * resolution, loss of color depth, loss due to the color space conversion, loss - * of the alpha bits or loss due to color quantization. - * avcodec_get_fix_fmt_loss() informs you about the various types of losses - * which will occur when converting from one pixel format to another. - * - * @param[in] dst_pix_fmt destination pixel format - * @param[in] src_pix_fmt source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @return Combination of flags informing you what kind of losses will occur - * (maximum loss for an invalid dst_pix_fmt). + * @deprecated see av_get_pix_fmt_loss() */ int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, int has_alpha); @@ -4714,34 +4991,7 @@ enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *p int has_alpha, int *loss_ptr); /** - * Find the best pixel format to convert to given a certain source pixel - * format and a selection of two destination pixel formats. When converting from - * one pixel format to another, information loss may occur. For example, when converting - * from RGB24 to GRAY, the color information will be lost. Similarly, other losses occur when - * converting from some formats to other formats. avcodec_find_best_pix_fmt_of_2() selects which of - * the given pixel formats should be used to suffer the least amount of loss. - * - * If one of the destination formats is AV_PIX_FMT_NONE the other pixel format (if valid) will be - * returned. - * - * @code - * src_pix_fmt = AV_PIX_FMT_YUV420P; - * dst_pix_fmt1= AV_PIX_FMT_RGB24; - * dst_pix_fmt2= AV_PIX_FMT_GRAY8; - * dst_pix_fmt3= AV_PIX_FMT_RGB8; - * loss= FF_LOSS_CHROMA; // don't care about chroma loss, so chroma loss will be ignored. - * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt1, dst_pix_fmt2, src_pix_fmt, alpha, &loss); - * dst_pix_fmt = avcodec_find_best_pix_fmt_of_2(dst_pix_fmt, dst_pix_fmt3, src_pix_fmt, alpha, &loss); - * @endcode - * - * @param[in] dst_pix_fmt1 One of the two destination pixel formats to choose from - * @param[in] dst_pix_fmt2 The other of the two destination pixel formats to choose from - * @param[in] src_pix_fmt Source pixel format - * @param[in] has_alpha Whether the source pixel format alpha channel is used. - * @param[in, out] loss_ptr Combination of loss flags. In: selects which of the losses to ignore, i.e. - * NULL or value of zero means we care about all losses. Out: the loss - * that occurs when converting from src to selected dst pixel format. - * @return The best pixel format to convert to or -1 if none was found. + * @deprecated see av_find_best_pix_fmt_of_2() */ enum AVPixelFormat avcodec_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); @@ -4793,6 +5043,19 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); */ const char *av_get_profile_name(const AVCodec *codec, int profile); +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); //FIXME func typedef @@ -4877,6 +5140,11 @@ typedef struct AVBitStreamFilterContext { struct AVBitStreamFilter *filter; AVCodecParserContext *parser; struct AVBitStreamFilterContext *next; + /** + * Internal default arguments, used if NULL is passed to av_bitstream_filter_filter(). + * Not for access by library users. + */ + char *args; } AVBitStreamFilterContext; @@ -4935,7 +5203,7 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); * @return >= 0 in case of success, or a negative error code in case of failure * * If the return value is positive, an output buffer is allocated and - * is availble in *poutbuf, and is distinct from the input buffer. + * is available in *poutbuf, and is distinct from the input buffer. * * If the return value is 0, the output buffer is not allocated and * should be considered identical to the input buffer, or in case @@ -4963,13 +5231,13 @@ void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); * This function can be used to iterate over all registered bitstream * filters. */ -AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); +AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f); /* memory */ /** * Same behaviour av_fast_malloc but the buffer has additional - * FF_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. * * In addition the whole buffer will initially and after resizes * be 0-initialized so that no uninitialized data will ever appear. @@ -5031,7 +5299,7 @@ void av_register_hwaccel(AVHWAccel *hwaccel); * if hwaccel is non-NULL, returns the next registered hardware accelerator * after hwaccel, or NULL if hwaccel is the last one. */ -AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); +AVHWAccel *av_hwaccel_next(const AVHWAccel *hwaccel); /** @@ -5046,16 +5314,26 @@ enum AVLockOp { /** * Register a user provided lock manager supporting the operations - * specified by AVLockOp. mutex points to a (void *) where the - * lockmgr should store/get a pointer to a user allocated mutex. It's - * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * specified by AVLockOp. The "mutex" argument to the function points + * to a (void *) where the lockmgr should store/get a pointer to a user + * allocated mutex. It is NULL upon AV_LOCK_CREATE and equal to the + * value left by the last call for all other ops. If the lock manager is + * unable to perform the op then it should leave the mutex in the same + * state as when it was called and return a non-zero value. However, + * when called with AV_LOCK_DESTROY the mutex will always be assumed to + * have been successfully destroyed. If av_lockmgr_register succeeds + * it will return a non-negative value, if it fails it will return a + * negative value and destroy all mutex and unregister all callbacks. + * av_lockmgr_register is not thread-safe, it must be called from a + * single thread before any calls which make use of locking are used. * - * @param cb User defined callback. Note: FFmpeg may invoke calls to this - * callback during the call to av_lockmgr_register(). - * Thus, the application must be prepared to handle that. - * If cb is set to NULL the lockmgr will be unregistered. - * Also note that during unregistration the previously registered - * lockmgr callback may also be invoked. + * @param cb User defined callback. av_lockmgr_register invokes calls + * to this callback and the previously registered callback. + * The callback will be used to create more than one mutex + * each of which must be backed by its own underlying locking + * mechanism (i.e. do not use a single static object to + * implement your lock manager). If cb is set to NULL the + * lockmgr will be unregistered. */ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); @@ -5106,6 +5384,17 @@ const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); */ const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + /** * @} */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/avdct.h b/ThirdParty/ffmpeg/include/libavcodec/avdct.h new file mode 100644 index 000000000..272422e44 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/avdct.h @@ -0,0 +1,84 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVDCT_H +#define AVCODEC_AVDCT_H + +#include "libavutil/opt.h" + +/** + * AVDCT context. + * @note function pointers can be NULL if the specific features have been + * disabled at build time. + */ +typedef struct AVDCT { + const AVClass *av_class; + + void (*idct)(int16_t *block /* align 16 */); + + /** + * IDCT input permutation. + * Several optimized IDCTs need a permutated input (relative to the + * normal order of the reference IDCT). + * This permutation must be performed before the idct_put/add. + * Note, normally this can be merged with the zigzag/alternate scan
+ * An example to avoid confusion: + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) + * - (x -> reference DCT -> reference IDCT -> x) + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation + * -> simple_idct_mmx -> x) + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant + * -> simple_idct_mmx -> ...) + */ + uint8_t idct_permutation[64]; + + void (*fdct)(int16_t *block /* align 16 */); + + + /** + * DCT algorithm. + * must use AVOptions to set this field. + */ + int dct_algo; + + /** + * IDCT algorithm. + * must use AVOptions to set this field. + */ + int idct_algo; + + void (*get_pixels)(int16_t *block /* align 16 */, + const uint8_t *pixels /* align 8 */, + ptrdiff_t line_size); + + int bits_per_sample; +} AVDCT; + +/** + * Allocates a AVDCT context. + * This needs to be initialized with avcodec_dct_init() after optionally + * configuring it with AVOptions. + * + * To free it use av_free() + */ +AVDCT *avcodec_dct_alloc(void); +int avcodec_dct_init(AVDCT *); + +const AVClass *avcodec_dct_get_class(void); + +#endif /* AVCODEC_AVDCT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.h b/ThirdParty/ffmpeg/include/libavcodec/avfft.h similarity index 98% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.h rename to ThirdParty/ffmpeg/include/libavcodec/avfft.h index 2d20a45f8..0c0f9b8d8 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/avfft.h +++ b/ThirdParty/ffmpeg/include/libavcodec/avfft.h @@ -99,9 +99,11 @@ enum DCTTransformType { /** * Set up DCT. + * * @param nbits size of the input array: * (1 << nbits) for DCT-II, DCT-III and DST-I * (1 << nbits) + 1 for DCT-I + * @param type the type of transform * * @note the first element of the input of DST-I is ignored */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/d3d11va.h b/ThirdParty/ffmpeg/include/libavcodec/d3d11va.h new file mode 100644 index 000000000..6816b6c1e --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/d3d11va.h @@ -0,0 +1,112 @@ +/* + * Direct3D11 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * copyright (c) 2015 Steve Lhomme + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_D3D11VA_H +#define AVCODEC_D3D11VA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_d3d11va + * Public libavcodec D3D11VA header. + */ + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0602 +#endif + +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_d3d11va Direct3D11 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for Direct3D11 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for Direct3D11 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the Direct3D11 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + * + * Use av_d3d11va_alloc_context() exclusively to allocate an AVD3D11VAContext. + */ +typedef struct AVD3D11VAContext { + /** + * D3D11 decoder object + */ + ID3D11VideoDecoder *decoder; + + /** + * D3D11 VideoContext + */ + ID3D11VideoContext *video_context; + + /** + * D3D11 configuration used to create the decoder + */ + D3D11_VIDEO_DECODER_CONFIG *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + ID3D11VideoDecoderOutputView **surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; + + /** + * Mutex to access video_context + */ + HANDLE context_mutex; +} AVD3D11VAContext; + +/** + * Allocate an AVD3D11VAContext. + * + * @return Newly-allocated AVD3D11VAContext or NULL on failure. + */ +AVD3D11VAContext *av_d3d11va_alloc_context(void); + +/** + * @} + */ + +#endif /* AVCODEC_D3D11VA_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/dirac.h b/ThirdParty/ffmpeg/include/libavcodec/dirac.h new file mode 100644 index 000000000..e6d9d346d --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/dirac.h @@ -0,0 +1,131 @@ +/* + * Copyright (C) 2007 Marco Gerards + * Copyright (C) 2009 David Conrad + * Copyright (C) 2011 Jordi Ortiz + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DIRAC_H +#define AVCODEC_DIRAC_H + +/** + * @file + * Interface to Dirac Decoder/Encoder + * @author Marco Gerards + * @author David Conrad + * @author Jordi Ortiz + */ + +#include "avcodec.h" + +/** + * The spec limits the number of wavelet decompositions to 4 for both + * level 1 (VC-2) and 128 (long-gop default). + * 5 decompositions is the maximum before >16-bit buffers are needed. + * Schroedinger allows this for DD 9,7 and 13,7 wavelets only, limiting + * the others to 4 decompositions (or 3 for the fidelity filter). + * + * We use this instead of MAX_DECOMPOSITIONS to save some memory. + */ +#define MAX_DWT_LEVELS 5 + +/** + * Parse code values: + * + * Dirac Specification -> + * 9.6.1 Table 9.1 + * + * VC-2 Specification -> + * 10.4.1 Table 10.1 + */ + +enum DiracParseCodes { + DIRAC_PCODE_SEQ_HEADER = 0x00, + DIRAC_PCODE_END_SEQ = 0x10, + DIRAC_PCODE_AUX = 0x20, + DIRAC_PCODE_PAD = 0x30, + DIRAC_PCODE_PICTURE_CODED = 0x08, + DIRAC_PCODE_PICTURE_RAW = 0x48, + DIRAC_PCODE_PICTURE_LOW_DEL = 0xC8, + DIRAC_PCODE_PICTURE_HQ = 0xE8, + DIRAC_PCODE_INTER_NOREF_CO1 = 0x0A, + DIRAC_PCODE_INTER_NOREF_CO2 = 0x09, + DIRAC_PCODE_INTER_REF_CO1 = 0x0D, + DIRAC_PCODE_INTER_REF_CO2 = 0x0E, + DIRAC_PCODE_INTRA_REF_CO = 0x0C, + DIRAC_PCODE_INTRA_REF_RAW = 0x4C, + DIRAC_PCODE_INTRA_REF_PICT = 0xCC, + DIRAC_PCODE_MAGIC = 0x42424344, +}; + +typedef struct DiracVersionInfo { + int major; + int minor; +} DiracVersionInfo; + +typedef struct AVDiracSeqHeader { + unsigned width; + unsigned height; + uint8_t chroma_format; ///< 0: 444 1: 422 2: 420 + + uint8_t interlaced; + uint8_t top_field_first; + + uint8_t frame_rate_index; ///< index into dirac_frame_rate[] + uint8_t aspect_ratio_index; ///< index into dirac_aspect_ratio[] + + uint16_t clean_width; + uint16_t clean_height; + uint16_t clean_left_offset; + uint16_t clean_right_offset; + + uint8_t pixel_range_index; ///< index into dirac_pixel_range_presets[] + uint8_t color_spec_index; ///< index into dirac_color_spec_presets[] + + int profile; + int level; + + AVRational framerate; + AVRational sample_aspect_ratio; + + enum AVPixelFormat pix_fmt; + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace colorspace; + + DiracVersionInfo version; + int bit_depth; +} AVDiracSeqHeader; + +/** + * Parse a Dirac sequence header. + * + * @param dsh this function will allocate and fill an AVDiracSeqHeader struct + * and write it into this pointer. The caller must free it with + * av_free(). + * @param buf the data buffer + * @param buf_size the size of the data buffer in bytes + * @param log_ctx if non-NULL, this function will log errors here + * @return 0 on success, a negative AVERROR code on failure + */ +int av_dirac_parse_sequence_header(AVDiracSeqHeader **dsh, + const uint8_t *buf, size_t buf_size, + void *log_ctx); + +#endif /* AVCODEC_DIRAC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.h b/ThirdParty/ffmpeg/include/libavcodec/dv_profile.h similarity index 72% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.h rename to ThirdParty/ffmpeg/include/libavcodec/dv_profile.h index 8f0faf315..9380a66f0 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/dv_profile.h +++ b/ThirdParty/ffmpeg/include/libavcodec/dv_profile.h @@ -26,21 +26,17 @@ #include "avcodec.h" /* minimum number of bytes to read from a DV stream in order to - determine the profile */ -#define DV_PROFILE_BYTES (6*80) /* 6 DIF blocks */ + * determine the profile */ +#define DV_PROFILE_BYTES (6 * 80) /* 6 DIF blocks */ -typedef struct DVwork_chunk { - uint16_t buf_offset; - uint16_t mb_coordinates[5]; -} DVwork_chunk; /* - * DVprofile is used to express the differences between various + * AVDVProfile is used to express the differences between various * DV flavors. For now it's primarily used for differentiating * 525/60 and 625/50, but the plans are to use it for various * DV specs as well (e.g. SMPTE314M vs. IEC 61834). */ -typedef struct DVprofile { +typedef struct AVDVProfile { int dsf; /* value of the dsf in the DV header */ int video_stype; /* stype for VAUX source pack */ int frame_size; /* total size of one frame in bytes */ @@ -51,8 +47,6 @@ typedef struct DVprofile { int height; /* picture height in pixels */ int width; /* picture width in pixels */ AVRational sar[2]; /* sample aspect ratios for 4:3 and 16:9 */ - DVwork_chunk *work_chunks; /* each thread gets its own chunk of frame to work on */ - uint32_t *idct_factor; /* set of iDCT factor tables */ enum AVPixelFormat pix_fmt; /* picture pixel format */ int bpm; /* blocks per macroblock */ const uint8_t *block_sizes; /* AC block sizes, in bits */ @@ -62,17 +56,28 @@ typedef struct DVprofile { int audio_samples_dist[5]; /* how many samples are supposed to be */ /* in each frame in a 5 frames window */ const uint8_t (*audio_shuffle)[9]; /* PCM shuffling table */ -} DVprofile; - -const DVprofile* avpriv_dv_frame_profile(const DVprofile *sys, - const uint8_t* frame, unsigned buf_size); -const DVprofile* avpriv_dv_frame_profile2(AVCodecContext* codec, const DVprofile *sys, - const uint8_t* frame, unsigned buf_size); -const DVprofile* avpriv_dv_codec_profile(AVCodecContext* codec); +} AVDVProfile; /** - * Print all allowed DV profiles into logctx at specified logging level. + * Get a DV profile for the provided compressed frame. + * + * @param sys the profile used for the previous frame, may be NULL + * @param frame the compressed data buffer + * @param buf_size size of the buffer in bytes + * @return the DV profile for the supplied data or NULL on failure */ -void ff_dv_print_profiles(void *logctx, int loglevel); +const AVDVProfile *av_dv_frame_profile(const AVDVProfile *sys, + const uint8_t *frame, unsigned buf_size); + +/** + * Get a DV profile for the provided stream parameters. + */ +const AVDVProfile *av_dv_codec_profile(int width, int height, enum AVPixelFormat pix_fmt); + +/** + * Get a DV profile for the provided stream parameters. + * The frame rate is used as a best-effort parameter. + */ +const AVDVProfile *av_dv_codec_profile2(int width, int height, enum AVPixelFormat pix_fmt, AVRational frame_rate); #endif /* AVCODEC_DV_PROFILE_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/dxva2.h b/ThirdParty/ffmpeg/include/libavcodec/dxva2.h new file mode 100644 index 000000000..22c93992f --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/dxva2.h @@ -0,0 +1,93 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA2_H +#define AVCODEC_DXVA2_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0602 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0602 +#endif + +#include +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the FFmpeg AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA2_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/old_codec_ids.h b/ThirdParty/ffmpeg/include/libavcodec/old_codec_ids.h similarity index 99% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/old_codec_ids.h rename to ThirdParty/ffmpeg/include/libavcodec/old_codec_ids.h index 858ea6e65..c7aa0e0a1 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/old_codec_ids.h +++ b/ThirdParty/ffmpeg/include/libavcodec/old_codec_ids.h @@ -19,12 +19,6 @@ #ifndef AVCODEC_OLD_CODEC_IDS_H #define AVCODEC_OLD_CODEC_IDS_H -#ifdef __FRAMEWORK__ -#include "common.h" -#else -#include "libavutil/common.h" -#endif - /* * This header exists to prevent new codec IDs from being accidentally added to * the deprecated list. diff --git a/ThirdParty/ffmpeg/include/libavcodec/qsv.h b/ThirdParty/ffmpeg/include/libavcodec/qsv.h new file mode 100644 index 000000000..b77158ec2 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/qsv.h @@ -0,0 +1,107 @@ +/* + * Intel MediaSDK QSV public API + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_QSV_H +#define AVCODEC_QSV_H + +#include + +#include "libavutil/buffer.h" + +/** + * This struct is used for communicating QSV parameters between libavcodec and + * the caller. It is managed by the caller and must be assigned to + * AVCodecContext.hwaccel_context. + * - decoding: hwaccel_context must be set on return from the get_format() + * callback + * - encoding: hwaccel_context must be set before avcodec_open2() + */ +typedef struct AVQSVContext { + /** + * If non-NULL, the session to use for encoding or decoding. + * Otherwise, libavcodec will try to create an internal session. + */ + mfxSession session; + + /** + * The IO pattern to use. + */ + int iopattern; + + /** + * Extra buffers to pass to encoder or decoder initialization. + */ + mfxExtBuffer **ext_buffers; + int nb_ext_buffers; + + /** + * Encoding only. If this field is set to non-zero by the caller, libavcodec + * will create an mfxExtOpaqueSurfaceAlloc extended buffer and pass it to + * the encoder initialization. This only makes sense if iopattern is also + * set to MFX_IOPATTERN_IN_OPAQUE_MEMORY. + * + * The number of allocated opaque surfaces will be the sum of the number + * required by the encoder and the user-provided value nb_opaque_surfaces. + * The array of the opaque surfaces will be exported to the caller through + * the opaque_surfaces field. + */ + int opaque_alloc; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. Before + * calling avcodec_open2(), the caller should set this field to the number + * of extra opaque surfaces to allocate beyond what is required by the + * encoder. + * + * On return from avcodec_open2(), this field will be set by libavcodec to + * the total number of allocated opaque surfaces. + */ + int nb_opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be used by libavcodec to export the + * array of the allocated opaque surfaces to the caller, so they can be + * passed to other parts of the pipeline. + * + * The buffer reference exported here is owned and managed by libavcodec, + * the callers should make their own reference with av_buffer_ref() and free + * it with av_buffer_unref() when it is no longer needed. + * + * The buffer data is an nb_opaque_surfaces-sized array of mfxFrameSurface1. + */ + AVBufferRef *opaque_surfaces; + + /** + * Encoding only, and only if opaque_alloc is set to non-zero. On return + * from avcodec_open2(), this field will be set to the surface type used in + * the opaque allocation request. + */ + int opaque_alloc_type; +} AVQSVContext; + +/** + * Allocate a new context. + * + * It must be freed by the caller with av_free(). + */ +AVQSVContext *av_qsv_alloc_context(void); + +#endif /* AVCODEC_QSV_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/vaapi.h b/ThirdParty/ffmpeg/include/libavcodec/vaapi.h new file mode 100644 index 000000000..7a29f6f88 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/vaapi.h @@ -0,0 +1,189 @@ +/* + * Video Acceleration API (shared data between FFmpeg and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include +#include "libavutil/attributes.h" +#include "version.h" + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the FFmpeg library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + +#if FF_API_VAAPI_CONTEXT + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + attribute_deprecated + uint32_t slice_data_size; +#endif +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/vda.h b/ThirdParty/ffmpeg/include/libavcodec/vda.h new file mode 100644 index 000000000..bde14e31d --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/vda.h @@ -0,0 +1,230 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vda + * Public libavcodec VDA header. + */ + +#include "libavcodec/avcodec.h" + +#include + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture +#include +#undef Picture + +#include "libavcodec/version.h" + +// extra flags not defined in VDADecoder.h +enum { + kVDADecodeInfo_Asynchronous = 1UL << 0, + kVDADecodeInfo_FrameDropped = 1UL << 1 +}; + +/** + * @defgroup lavc_codec_hwaccel_vda VDA + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA FFmpeg HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * The Core Video pixel buffer that contains the current image data. + * + * encoding: unused + * decoding: Set by libavcodec. Unset by user. + */ + CVPixelBufferRef cv_buffer; + + /** + * Use the hardware decoder in synchronous mode. + * + * encoding: unused + * decoding: Set by user. + */ + int use_sync_decoding; + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * unused + */ + uint8_t *priv_bitstream; + + /** + * unused + */ + int priv_bitstream_size; + + /** + * unused + */ + int priv_allocated_size; + + /** + * Use av_buffer to manage buffer. + * When the flag is set, the CVPixelBuffers returned by the decoder will + * be released automatically, so you have to retain them if necessary. + * Not setting this flag may cause memory leak. + * + * encoding: unused + * decoding: Set by user. + */ + int use_ref_buffer; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing VDA decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_vda_alloc_context() and freed with av_free(). + */ +typedef struct AVVDAContext { + /** + * VDA decoder object. Created and freed by the caller. + */ + VDADecoder decoder; + + /** + * The output callback that must be passed to VDADecoderCreate. + * Set by av_vda_alloc_context(). + */ + VDADecoderOutputCallback output_callback; + + /** + * CVPixelBuffer Format Type that VDA will use for decoded frames; set by + * the caller. + */ + OSType cv_pix_fmt_type; +} AVVDAContext; + +/** + * Allocate and initialize a VDA context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VDA format. The caller must then create the decoder + * object (using the output callback provided by libavcodec) that will be used + * for VDA-accelerated decoding. + * + * When decoding with VDA is finished, the caller must destroy the decoder + * object and free the VDA context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVDAContext *av_vda_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the VDA context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_vda_default_init(AVCodecContext *avctx); + +/** + * This is a convenience function that creates and sets up the VDA context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * @param vdactx the VDA context to use + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_vda_default_init2(AVCodecContext *avctx, AVVDAContext *vdactx); + +/** + * This function must be called to free the VDA context initialized with + * av_vda_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_vda_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VDA_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/vdpau.h b/ThirdParty/ffmpeg/include/libavcodec/vdpau.h new file mode 100644 index 000000000..e85e4d9e9 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/vdpau.h @@ -0,0 +1,253 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using FFmpeg + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include +#include +#include "libavutil/avconfig.h" +#include "libavutil/attributes.h" + +#include "avcodec.h" +#include "version.h" + +#if FF_API_BUFS_VDPAU +union AVVDPAUPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; +}; +#endif + +struct AVCodecContext; +struct AVFrame; + +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, + const VdpPictureInfo *, uint32_t, + const VdpBitstreamBuffer *); + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall allocate the structure via the av_alloc_vdpau_hwaccel + * function and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an + * AVVDPAUContext. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + +#if FF_API_BUFS_VDPAU + /** + * VDPAU picture information + * + * Set by libavcodec. + */ + attribute_deprecated + union AVVDPAUPictureInfo info; + + /** + * Allocated size of the bitstream_buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_allocated; + + /** + * Useful bitstream buffers in the bitstream buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_used; + + /** + * Table of bitstream buffers. + * The user is responsible for freeing this buffer using av_freep(). + * + * Set by libavcodec. + */ + attribute_deprecated + VdpBitstreamBuffer *bitstream_buffers; +#endif + AVVDPAU_Render2 render2; +} AVVDPAUContext; + +/** + * @brief allocation function for AVVDPAUContext + * + * Allows extending the struct without breaking API/ABI + */ +AVVDPAUContext *av_alloc_vdpaucontext(void); + +AVVDPAU_Render2 av_vdpau_hwaccel_get_render2(const AVVDPAUContext *); +void av_vdpau_hwaccel_set_render2(AVVDPAUContext *, AVVDPAU_Render2); + +/** + * Associate a VDPAU device with a codec context for hardware acceleration. + * This function is meant to be called from the get_format() codec callback, + * or earlier. It can also be called after avcodec_flush_buffers() to change + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent + * display preemption). + * + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes + * successfully. + * + * @param avctx decoding context whose get_format() callback is invoked + * @param device VDPAU device handle to use for hardware acceleration + * @param get_proc_address VDPAU device driver + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags + * + * @return 0 on success, an AVERROR code on failure. + */ +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc_address, unsigned flags); + +/** + * Gets the parameters to create an adequate VDPAU video surface for the codec + * context using VDPAU hardware decoding acceleration. + * + * @note Behavior is undefined if the context was not successfully bound to a + * VDPAU device using av_vdpau_bind_context(). + * + * @param avctx the codec context being used for decoding the stream + * @param type storage space for the VDPAU video surface chroma type + * (or NULL to ignore) + * @param width storage space for the VDPAU video surface pixel width + * (or NULL to ignore) + * @param height storage space for the VDPAU video surface pixel height + * (or NULL to ignore) + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, + uint32_t *width, uint32_t *height); + +/** + * Allocate an AVVDPAUContext. + * + * @return Newly-allocated AVVDPAUContext or NULL on failure. + */ +AVVDPAUContext *av_vdpau_alloc_context(void); + +#if FF_API_VDPAU_PROFILE +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @deprecated Use av_vdpau_bind_context() instead. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +attribute_deprecated +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); +#endif + +#if FF_API_CAP_VDPAU +/** @brief The videoSurface is used for rendering. */ +#define FF_VDPAU_STATE_USED_FOR_RENDER 1 + +/** + * @brief The videoSurface is needed for reference/prediction. + * The codec manipulates this. + */ +#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 + +/** + * @brief This structure is used as a callback between the FFmpeg + * decoder (vd_) and presentation (vo_) module. + * This is used for defining a video frame containing surface, + * picture parameter, bitstream information etc which are passed + * between the FFmpeg decoder and its clients. + */ +struct vdpau_render_state { + VdpVideoSurface surface; ///< Used as rendered surface, never changed. + + int state; ///< Holds FF_VDPAU_STATE_* values. + + /** picture parameter information for all supported codecs */ + union AVVDPAUPictureInfo info; + + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; +}; +#endif + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/version.h b/ThirdParty/ffmpeg/include/libavcodec/version.h new file mode 100644 index 000000000..37a35e05e --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/version.h @@ -0,0 +1,216 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVCODEC_VERSION_MAJOR 57 +#define LIBAVCODEC_VERSION_MINOR 24 +#define LIBAVCODEC_VERSION_MICRO 102 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + */ + +#ifndef FF_API_VIMA_DECODER +#define FF_API_VIMA_DECODER (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AUDIO_CONVERT +#define FF_API_AUDIO_CONVERT (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AVCODEC_RESAMPLE +#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT +#endif +#ifndef FF_API_GETCHROMA +#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MISSING_SAMPLE +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_LOWRES +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_CAP_VDPAU +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_BUFS_VDPAU +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VOXWARE +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_ALPHA +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ERROR_RATE +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_QSCALE_TYPE +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MB_TYPE +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MAX_BFRAMES +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_NEG_LINESIZES +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_EMU_EDGE +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_SH4 +#define FF_API_ARCH_SH4 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_ARCH_SPARC +#define FF_API_ARCH_SPARC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_UNUSED_MEMBERS +#define FF_API_UNUSED_MEMBERS (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_IDCT_XVIDMMX +#define FF_API_IDCT_XVIDMMX (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_INPUT_PRESERVED +#define FF_API_INPUT_PRESERVED (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_NORMALIZE_AQP +#define FF_API_NORMALIZE_AQP (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_GMC +#define FF_API_GMC (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_MV0 +#define FF_API_MV0 (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_CODEC_NAME +#define FF_API_CODEC_NAME (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AFD +#define FF_API_AFD (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VISMV +/* XXX: don't forget to drop the -vismv documentation */ +#define FF_API_VISMV (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AUDIOENC_DELAY +#define FF_API_AUDIOENC_DELAY (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_VAAPI_CONTEXT +#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_AVCTX_TIMEBASE +#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_MPV_OPT +#define FF_API_MPV_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STREAM_CODEC_TAG +#define FF_API_STREAM_CODEC_TAG (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_QUANT_BIAS +#define FF_API_QUANT_BIAS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RC_STRATEGY +#define FF_API_RC_STRATEGY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODED_FRAME +#define FF_API_CODED_FRAME (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_MOTION_EST +#define FF_API_MOTION_EST (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_WITHOUT_PREFIX +#define FF_API_WITHOUT_PREFIX (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_SIDEDATA_ONLY_PKT +#define FF_API_SIDEDATA_ONLY_PKT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VDPAU_PROFILE +#define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CONVERGENCE_DURATION +#define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPICTURE +#define FF_API_AVPICTURE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_AVPACKET_OLD_API +#define FF_API_AVPACKET_OLD_API (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_RTP_CALLBACK +#define FF_API_RTP_CALLBACK (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_VBV_DELAY +#define FF_API_VBV_DELAY (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_CODER_TYPE +#define FF_API_CODER_TYPE (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_STAT_BITS +#define FF_API_STAT_BITS (LIBAVCODEC_VERSION_MAJOR < 59) +#endif +#ifndef FF_API_PRIVATE_OPT +#define FF_API_PRIVATE_OPT (LIBAVCODEC_VERSION_MAJOR < 59) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/videotoolbox.h b/ThirdParty/ffmpeg/include/libavcodec/videotoolbox.h new file mode 100644 index 000000000..a48638e2b --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/videotoolbox.h @@ -0,0 +1,126 @@ +/* + * Videotoolbox hardware acceleration + * + * copyright (c) 2012 Sebastien Zwickert + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VIDEOTOOLBOX_H +#define AVCODEC_VIDEOTOOLBOX_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_videotoolbox + * Public libavcodec Videotoolbox header. + */ + +#include + +#define Picture QuickdrawPicture +#include +#undef Picture + +#include "libavcodec/avcodec.h" + +/** + * This struct holds all the information that needs to be passed + * between the caller and libavcodec for initializing Videotoolbox decoding. + * Its size is not a part of the public ABI, it must be allocated with + * av_videotoolbox_alloc_context() and freed with av_free(). + */ +typedef struct AVVideotoolboxContext { + /** + * Videotoolbox decompression session object. + * Created and freed the caller. + */ + VTDecompressionSessionRef session; + + /** + * The output callback that must be passed to the session. + * Set by av_videottoolbox_default_init() + */ + VTDecompressionOutputCallback output_callback; + + /** + * CVPixelBuffer Format Type that Videotoolbox will use for decoded frames. + * set by the caller. + */ + OSType cv_pix_fmt_type; + + /** + * CoreMedia Format Description that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + CMVideoFormatDescriptionRef cm_fmt_desc; + + /** + * CoreMedia codec type that Videotoolbox will use to create the decompression session. + * Set by the caller. + */ + int cm_codec_type; +} AVVideotoolboxContext; + +/** + * Allocate and initialize a Videotoolbox context. + * + * This function should be called from the get_format() callback when the caller + * selects the AV_PIX_FMT_VIDETOOLBOX format. The caller must then create + * the decoder object (using the output callback provided by libavcodec) that + * will be used for Videotoolbox-accelerated decoding. + * + * When decoding with Videotoolbox is finished, the caller must destroy the decoder + * object and free the Videotoolbox context using av_free(). + * + * @return the newly allocated context or NULL on failure + */ +AVVideotoolboxContext *av_videotoolbox_alloc_context(void); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init(AVCodecContext *avctx); + +/** + * This is a convenience function that creates and sets up the Videotoolbox context using + * an internal implementation. + * + * @param avctx the corresponding codec context + * @param vtctx the Videotoolbox context to use + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int av_videotoolbox_default_init2(AVCodecContext *avctx, AVVideotoolboxContext *vtctx); + +/** + * This function must be called to free the Videotoolbox context initialized with + * av_videotoolbox_default_init(). + * + * @param avctx the corresponding codec context + */ +void av_videotoolbox_default_free(AVCodecContext *avctx); + +/** + * @} + */ + +#endif /* AVCODEC_VIDEOTOOLBOX_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/vorbis_parser.h b/ThirdParty/ffmpeg/include/libavcodec/vorbis_parser.h new file mode 100644 index 000000000..81fda3b08 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/vorbis_parser.h @@ -0,0 +1,78 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A public API for Vorbis parsing + * + * Determines the duration for each packet. + */ + +#ifndef AVCODEC_VORBIS_PARSER_H +#define AVCODEC_VORBIS_PARSER_H + +#include + +typedef struct AVVorbisParseContext AVVorbisParseContext; + +/** + * Allocate and initialize the Vorbis parser using headers in the extradata. + * + * @param avctx codec context + * @param s Vorbis parser context + */ +AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata, + int extradata_size); + +/** + * Free the parser and everything associated with it. + */ +void av_vorbis_parse_free(AVVorbisParseContext **s); + +#define VORBIS_FLAG_HEADER 0x00000001 +#define VORBIS_FLAG_COMMENT 0x00000002 +#define VORBIS_FLAG_SETUP 0x00000004 + +/** + * Get the duration for a Vorbis packet. + * + * If @p flags is @c NULL, + * special frames are considered invalid. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + * @param flags flags for special frames + */ +int av_vorbis_parse_frame_flags(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size, int *flags); + +/** + * Get the duration for a Vorbis packet. + * + * @param s Vorbis parser context + * @param buf buffer containing a Vorbis frame + * @param buf_size size of the buffer + */ +int av_vorbis_parse_frame(AVVorbisParseContext *s, const uint8_t *buf, + int buf_size); + +void av_vorbis_parse_reset(AVVorbisParseContext *s); + +#endif /* AVCODEC_VORBIS_PARSER_H */ diff --git a/ThirdParty/ffmpeg/include/libavcodec/xvmc.h b/ThirdParty/ffmpeg/include/libavcodec/xvmc.h new file mode 100644 index 000000000..465ee78d6 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavcodec/xvmc.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include + +#include "libavutil/attributes.h" +#include "version.h" +#include "avcodec.h" + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +struct attribute_deprecated xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short* data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock* mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface* p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avformat.h b/ThirdParty/ffmpeg/include/libavformat/avformat.h similarity index 80% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avformat.h rename to ThirdParty/ffmpeg/include/libavformat/avformat.h index 103814ed4..34bad436c 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avformat.h +++ b/ThirdParty/ffmpeg/include/libavformat/avformat.h @@ -67,7 +67,7 @@ * with an AVFMT_NOFILE format). * * @section lavf_options Passing options to (de)muxers - * Lavf allows to configure muxers and demuxers using the @ref avoptions + * It is possible to configure lavf muxers and demuxers using the @ref avoptions * mechanism. Generic (format-independent) libavformat options are provided by * AVFormatContext, they can be examined from a user program by calling * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass @@ -78,6 +78,18 @@ * if its AVClass is non-NULL, and the protocols layer. See the discussion on * nesting in @ref avoptions documentation to learn how to access those. * + * @section urls + * URL strings in libavformat are made of a scheme/protocol, a ':', and a + * scheme specific string. URLs without a scheme and ':' used for local files + * are supported but deprecated. "file:" should be used for local files. + * + * It is important that the scheme string is not taken from untrusted + * sources without checks. + * + * Note that some schemes/protocols are quite powerful, allowing access to + * both local and remote files, parts of them, concatenations of them, local + * audio and video devices and so on. + * * @defgroup lavf_decoding Demuxing * @{ * Demuxers read a media file and split it into chunks of data (@em packets). A @@ -88,10 +100,10 @@ * cleanup. * * @section lavf_decoding_open Opening a media file - * The minimum information required to open a file is its URL or filename, which + * The minimum information required to open a file is its URL, which * is passed to avformat_open_input(), as in the following code: * @code - * const char *url = "in.mp3"; + * const char *url = "file:in.mp3"; * AVFormatContext *s = NULL; * int ret = avformat_open_input(&s, url, NULL, NULL); * if (ret < 0) @@ -165,7 +177,7 @@ * until the next av_read_frame() call or closing the file. If the caller * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy * of it. - * In both cases, the packet must be freed with av_free_packet() when it is no + * In both cases, the packet must be freed with av_packet_unref() when it is no * longer needed. * * @section lavf_decoding_seek Seeking @@ -194,10 +206,14 @@ * the @ref AVStream.codec "stream codec context" information, such as the * codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id * "id" and other parameters (e.g. width / height, the pixel or sample format, - * etc.) as known. The @ref AVCodecContext.time_base "codec timebase" should + * etc.) as known. The @ref AVStream.time_base "stream timebase" should * be set to the timebase that the caller desires to use for this stream (note * that the timebase actually used by the muxer can be different, as will be * described later). + * - It is advised to manually initialize only the relevant fields in + * AVCodecContext, rather than using @ref avcodec_copy_context() during + * remuxing: there is no guarantee that the codec context values remain valid + * for both input and output format contexts. * - The caller may fill in additional information, such as @ref * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" * metadata, @ref AVFormatContext.chapters "chapters", @ref @@ -218,8 +234,8 @@ * a single muxing context, they should not be mixed). Do note that the timing * information on the packets sent to the muxer must be in the corresponding * AVStream's timebase. That timebase is set by the muxer (in the - * avformat_write_header() step) and may be different from the timebase the - * caller set on the codec context. + * avformat_write_header() step) and may be different from the timebase + * requested by the caller. * * Once all the data has been written, the caller must call av_write_trailer() * to flush any buffered packets and finalize the output file, then close the IO @@ -229,6 +245,53 @@ * * @defgroup lavf_io I/O Read/Write * @{ + * @section lavf_io_dirlist Directory listing + * The directory listing API makes it possible to list files on remote servers. + * + * Some of possible use cases: + * - an "open file" dialog to choose files from a remote location, + * - a recursive media finder providing a player with an ability to play all + * files from a given directory. + * + * @subsection lavf_io_dirlist_open Opening a directory + * At first, a directory needs to be opened by calling avio_open_dir() + * supplied with a URL and, optionally, ::AVDictionary containing + * protocol-specific parameters. The function returns zero or positive + * integer and allocates AVIODirContext on success. + * + * @code + * AVIODirContext *ctx = NULL; + * if (avio_open_dir(&ctx, "smb://example.com/some_dir", NULL) < 0) { + * fprintf(stderr, "Cannot open directory.\n"); + * abort(); + * } + * @endcode + * + * This code tries to open a sample directory using smb protocol without + * any additional parameters. + * + * @subsection lavf_io_dirlist_read Reading entries + * Each directory's entry (i.e. file, another directory, anything else + * within ::AVIODirEntryType) is represented by AVIODirEntry. + * Reading consecutive entries from an opened AVIODirContext is done by + * repeatedly calling avio_read_dir() on it. Each call returns zero or + * positive integer if successful. Reading can be stopped right after the + * NULL entry has been read -- it means there are no entries left to be + * read. The following code reads all entries from a directory associated + * with ctx and prints their names to standard output. + * @code + * AVIODirEntry *entry = NULL; + * for (;;) { + * if (avio_read_dir(ctx, &entry) < 0) { + * fprintf(stderr, "Cannot list directory.\n"); + * abort(); + * } + * if (!entry) + * break; + * printf("%s\n", entry->name); + * avio_free_directory_entry(&entry); + * } + * @endcode * @} * * @defgroup lavf_codec Demuxers @@ -252,24 +315,17 @@ #include #include /* FILE */ -#ifdef __FRAMEWORK__ -#include "avcodec.h" -#include "dict.h" -#include "log.h" -#else #include "libavcodec/avcodec.h" #include "libavutil/dict.h" #include "libavutil/log.h" -#endif #include "avio.h" -#ifndef __FRAMEWORK__ #include "libavformat/version.h" -#endif struct AVFormatContext; struct AVDeviceInfoList; +struct AVDeviceCapabilitiesQuery; /** * @defgroup metadata_api Public Metadata API @@ -305,6 +361,11 @@ struct AVDeviceInfoList; * - sorting -- a modified version of a tag that should be used for * sorting will have '-sort' appended. E.g. artist="The Beatles", * artist-sort="Beatles, The". + * - Some protocols and demuxers support metadata updates. After a successful + * call to av_read_packet(), AVFormatContext.event_flags or AVStream.event_flags + * will be updated to indicate if metadata changed. In order to detect metadata + * changes on a stream, you need to loop through all streams in the AVFormatContext + * and check their individual event_flags. * * - Demuxers attempt to export metadata in a generic format, however tags * with no generic equivalents are left as they are stored in the container. @@ -375,6 +436,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); */ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); +#if FF_API_LAVF_FRAC /*************************************************/ /* fractional numbers for exact pts handling */ @@ -385,6 +447,7 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); typedef struct AVFrac { int64_t val, num, den; } AVFrac; +#endif /*************************************************/ /* input/output formats */ @@ -398,12 +461,14 @@ typedef struct AVProbeData { const char *filename; unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ int buf_size; /**< Size of buf except extra allocated bytes */ + const char *mime_type; /**< mime_type, when known. */ } AVProbeData; #define AVPROBE_SCORE_RETRY (AVPROBE_SCORE_MAX/4) #define AVPROBE_SCORE_STREAM_RETRY (AVPROBE_SCORE_MAX/4-1) #define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension +#define AVPROBE_SCORE_MIME 75 ///< score for file mime type #define AVPROBE_SCORE_MAX 100 ///< maximum score #define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer @@ -412,8 +477,10 @@ typedef struct AVProbeData { #define AVFMT_NOFILE 0x0001 #define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ #define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#if FF_API_LAVF_FMT_RAWPICTURE #define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for - raw picture data. */ + raw picture data. @deprecated Not used anymore */ +#endif #define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ #define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ #define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ @@ -425,12 +492,7 @@ typedef struct AVProbeData { #define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ #define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ #define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ -#if LIBAVFORMAT_VERSION_MAJOR <= 54 -#define AVFMT_TS_NONSTRICT 0x8020000 //we try to be compatible to the ABIs of ffmpeg and major forks -#else -#define AVFMT_TS_NONSTRICT 0x20000 -#endif - /**< Format does not require strictly +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly increasing timestamps, but they must still be monotonic */ #define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative @@ -463,7 +525,7 @@ typedef struct AVOutputFormat { enum AVCodecID video_codec; /**< default video codec */ enum AVCodecID subtitle_codec; /**< default subtitle codec */ /** - * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, * AVFMT_TS_NONSTRICT @@ -539,6 +601,40 @@ typedef struct AVOutputFormat { * @see avdevice_list_devices() for more details. */ int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + enum AVCodecID data_codec; /**< default data codec */ + /** + * Initialize format. May allocate data here, and set any AVFormatContext or + * AVStream parameters that need to be set before packets are sent. + * This method must not write output. + * + * Any allocations made here must be freed in deinit(). + */ + int (*init)(struct AVFormatContext *); + /** + * Deinitialize format. If present, this is called whenever the muxer is being + * destroyed, regardless of whether or not the header has been written. + * + * If a trailer is being written, this is called after write_trailer(). + * + * This is called if init() fails as well. + */ + void (*deinit)(struct AVFormatContext *); + /** + * Set up any necessary bitstream filtering and extract any extra data needed + * for the global header. + * Return 0 if more packets from this stream must be checked; 1 if not. + */ + int (*check_bitstream)(struct AVFormatContext *, const AVPacket *pkt); } AVOutputFormat; /** * @} @@ -580,6 +676,13 @@ typedef struct AVInputFormat { const AVClass *priv_class; ///< AVClass for the private context + /** + * Comma-separated list of mime types. + * It is used check for matching mime types while probing. + * @see av_probe_input_format2 + */ + const char *mime_type; + /***************************************************************** * No fields below this line are part of the public API. They * may not be used outside of libavformat and can be changed and @@ -608,8 +711,8 @@ typedef struct AVInputFormat { /** * Read the format header and initialize the AVFormatContext - * structure. Return 0 if OK. Only used in raw format right - * now. 'avformat_new_stream' should be called to create new streams. + * structure. Return 0 if OK. 'avformat_new_stream' should be + * called to create new streams. */ int (*read_header)(struct AVFormatContext *); @@ -673,6 +776,18 @@ typedef struct AVInputFormat { * @see avdevice_list_devices() for more details. */ int (*get_device_list)(struct AVFormatContext *s, struct AVDeviceInfoList *device_list); + + /** + * Initialize device capabilities submodule. + * @see avdevice_capabilities_create() for more details. + */ + int (*create_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); + + /** + * Free device capabilities submodule. + * @see avdevice_capabilities_free() for more details. + */ + int (*free_device_capabilities)(struct AVFormatContext *s, struct AVDeviceCapabilitiesQuery *caps); } AVInputFormat; /** * @} @@ -727,6 +842,8 @@ typedef struct AVIndexEntry { */ #define AV_DISPOSITION_ATTACHED_PIC 0x0400 +typedef struct AVStreamInternal AVStreamInternal; + /** * To specify text track kind (different from subtitles default). */ @@ -770,19 +887,25 @@ typedef struct AVStream { AVCodecContext *codec; void *priv_data; +#if FF_API_LAVF_FRAC /** - * encoding: pts generation when outputting stream + * @deprecated this field is unused */ + attribute_deprecated struct AVFrac pts; +#endif /** * This is the fundamental unit of time (in seconds) in terms * of which frame timestamps are represented. * * decoding: set by libavformat - * encoding: set by libavformat in avformat_write_header. The muxer may use the - * user-provided value of @ref AVCodecContext.time_base "codec->time_base" - * as a hint. + * encoding: May be set by the caller before avformat_write_header() to + * provide a hint to the muxer about the desired timebase. In + * avformat_write_header(), the muxer will overwrite this field + * with the timebase that will actually be used for the timestamps + * written into the file (which may or may not be related to the + * user-provided one, depending on the format). */ AVRational time_base; @@ -820,6 +943,10 @@ typedef struct AVStream { /** * Average framerate + * + * - demuxing: May be set by libavformat when creating the stream or in + * avformat_find_stream_info(). + * - muxing: May be set by the caller before avformat_write_header(). */ AVRational avg_frame_rate; @@ -832,6 +959,38 @@ typedef struct AVStream { */ AVPacket attached_pic; + /** + * An array of side data that applies to the whole stream (i.e. the + * container does not allow it to change between packets). + * + * There may be no overlap between the side data in this array and side data + * in the packets. I.e. a given side data is either exported by the muxer + * (demuxing) / set by the caller (muxing) in this array, then it never + * appears in the packets, or the side data is exported / sent through + * the packets (always in the first packet where the value becomes known or + * changes), then it does not appear in this array. + * + * - demuxing: Set by libavformat when the stream is created. + * - muxing: May be set by the caller before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + * + * @see av_format_inject_global_side_data() + */ + AVPacketSideData *side_data; + /** + * The number of elements in the AVStream.side_data array. + */ + int nb_side_data; + + /** + * Flags for the user to detect events happening on the stream. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVSTREAM_EVENT_FLAG_*. + */ + int event_flags; +#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + /***************************************************************** * All fields below this line are not part of the public API. They * may not be used outside of libavformat and can be changed and @@ -843,7 +1002,7 @@ typedef struct AVStream { /** * Stream information used internally by av_find_stream_info() */ -#define MAX_STD_TIMEBASES (60*12+6) +#define MAX_STD_TIMEBASES (30*12+30+3+6) struct { int64_t last_dts; int64_t duration_gcd; @@ -852,6 +1011,12 @@ typedef struct AVStream { double (*duration_error)[2][MAX_STD_TIMEBASES]; int64_t codec_info_duration; int64_t codec_info_duration_fields; + + /** + * 0 -> decoder has not been searched for yet. + * >0 -> decoder found + * <0 -> decoder with codec_id == -found_decoder has not been found + */ int found_decoder; int64_t last_duration; @@ -868,11 +1033,6 @@ typedef struct AVStream { int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ -#if FF_API_REFERENCE_DTS - /* a hack to keep ABI compatibility for ffmpeg and other applications, which accesses parser even - * though it should not */ - int64_t do_not_use; -#endif // Timestamp generation support: /** * Timestamp corresponding to the last dts sync point. @@ -889,7 +1049,6 @@ typedef struct AVStream { /** * Number of packets to buffer for codec probing */ -#define MAX_PROBE_PACKETS 2500 int probe_packets; /** @@ -956,6 +1115,30 @@ typedef struct AVStream { */ int skip_samples; + /** + * If not 0, the number of samples that should be skipped from the start of + * the stream (the samples are removed from packets with pts==0, which also + * assumes negative timestamps do not happen). + * Intended for use with formats such as mp3 with ad-hoc gapless audio + * support. + */ + int64_t start_skip_samples; + + /** + * If not 0, the first audio sample that should be discarded from the stream. + * This is broken by design (needs global sample count), but can't be + * avoided for broken by design formats such as mp3 with ad-hoc gapless + * audio support. + */ + int64_t first_discard_sample; + + /** + * The sample after last sample that is intended to be discarded after + * first_discard_sample. Works on frame boundaries only. Used to prevent + * early EOF if the gapless info is broken (considered concatenated mp3s). + */ + int64_t last_discard_sample; + /** * Number of internally decoded frames, used internally in libavformat, do not access * its lifetime differs from info which is why it is not in that structure. @@ -1003,10 +1186,46 @@ typedef struct AVStream { uint8_t dts_ordered; uint8_t dts_misordered; + /** + * Internal data to inject global side data + */ + int inject_global_side_data; + + /** + * String containing paris of key and values describing recommended encoder configuration. + * Paris are separated by ','. + * Keys are separated from values by '='. + */ + char *recommended_encoder_configuration; + + /** + * display aspect ratio (0 if unknown) + * - encoding: unused + * - decoding: Set by libavformat to calculate sample_aspect_ratio internally + */ + AVRational display_aspect_ratio; + + struct FFFrac *priv_pts; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVStreamInternal *internal; } AVStream; AVRational av_stream_get_r_frame_rate(const AVStream *s); void av_stream_set_r_frame_rate(AVStream *s, AVRational r); +struct AVCodecParserContext *av_stream_get_parser(const AVStream *s); +char* av_stream_get_recommended_encoder_configuration(const AVStream *s); +void av_stream_set_recommended_encoder_configuration(AVStream *s, char *configuration); + +/** + * Returns the pts of the last muxed packet + its duration + * + * the retuned value is undefined when used with a demuxer. + */ +int64_t av_stream_get_end_pts(const AVStream *st); #define AV_PROGRAM_RUNNING 1 @@ -1059,6 +1278,8 @@ typedef struct AVChapter { typedef int (*av_format_control_message)(struct AVFormatContext *s, int type, void *data, size_t data_size); +typedef int (*AVOpenCallback)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); /** * The duration of a video can be estimated through various ways, and this enum can be used @@ -1125,7 +1346,11 @@ typedef struct AVFormatContext { AVIOContext *pb; /* stream info */ - int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ + /** + * Flags signalling stream properties. A combination of AVFMTCTX_*. + * Set by libavformat. + */ + int ctx_flags; /** * Number of elements in AVFormatContext.streams. @@ -1178,11 +1403,15 @@ typedef struct AVFormatContext { * available. Never set it directly if the file_size and the * duration are known as FFmpeg can compute it automatically. */ - int bit_rate; + int64_t bit_rate; unsigned int packet_size; int max_delay; + /** + * Flags modifying the (de)muxer behaviour. A combination of AVFMT_FLAG_*. + * Set by the user before avformat_open_input() / avformat_write_header(). + */ int flags; #define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. #define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. @@ -1194,24 +1423,33 @@ typedef struct AVFormatContext { #define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. #define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted #define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. +/** + * When muxing, try to avoid writing any random/volatile data to the output. + * This includes any random IDs, real-time timestamps/dates, muxer version, etc. + * + * This flag is mainly intended for testing. + */ +#define AVFMT_FLAG_BITEXACT 0x0400 #define AVFMT_FLAG_MP4A_LATM 0x8000 ///< Enable RTP MP4A-LATM payload #define AVFMT_FLAG_SORT_DTS 0x10000 ///< try to interleave outputted packets by dts (using this flag can slow demuxing down) #define AVFMT_FLAG_PRIV_OPT 0x20000 ///< Enable use of private options by delaying codec open (this could be made default once all code is converted) #define AVFMT_FLAG_KEEP_SIDE_DATA 0x40000 ///< Don't merge side data but keep it separate. +#define AVFMT_FLAG_FAST_SEEK 0x80000 ///< Enable fast, but inaccurate seeks for some formats /** * Maximum size of the data read from input for determining * the input container format. * Demuxing only, set by the caller before avformat_open_input(). */ - unsigned int probesize; + int64_t probesize; /** * Maximum duration (in AV_TIME_BASE units) of the data read * from input in avformat_find_stream_info(). * Demuxing only, set by the caller before avformat_find_stream_info(). + * Can be set to 0 to let avformat choose using a heuristic. */ - int max_analyze_duration; + int64_t max_analyze_duration; const uint8_t *key; int keylen; @@ -1283,7 +1521,12 @@ typedef struct AVFormatContext { * Start time of the stream in real world time, in microseconds * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the * stream was captured at this real world time. - * Muxing only, set by the caller before avformat_write_header(). + * - muxing: Set by the caller before avformat_write_header(). If set to + * either 0 or AV_NOPTS_VALUE, then the current wall-time will + * be used. + * - demuxing: Set by libavformat. AV_NOPTS_VALUE if unknown. Note that + * the value may become known after some number of frames + * have been received. */ int64_t start_time_realtime; @@ -1336,6 +1579,38 @@ typedef struct AVFormatContext { */ int64_t max_interleave_delta; + /** + * Allow non-standard and experimental extension + * @see AVCodecContext.strict_std_compliance + */ + int strict_std_compliance; + + /** + * Flags for the user to detect events happening on the file. Flags must + * be cleared by the user once the event has been handled. + * A combination of AVFMT_EVENT_FLAG_*. + */ + int event_flags; +#define AVFMT_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in updated metadata. + + /** + * Maximum number of packets to read while waiting for the first timestamp. + * Decoding only. + */ + int max_ts_probe; + + /** + * Avoid negative timestamps during muxing. + * Any value of the AVFMT_AVOID_NEG_TS_* constants. + * Note, this only works when using av_interleaved_write_frame. (interleave_packet_per_dts is in use) + * - muxing: Set by user + * - demuxing: unused + */ + int avoid_negative_ts; +#define AVFMT_AVOID_NEG_TS_AUTO -1 ///< Enabled when required by target format +#define AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE 1 ///< Shift timestamps so they are non negative +#define AVFMT_AVOID_NEG_TS_MAKE_ZERO 2 ///< Shift timestamps so that they start at 0 + /** * Transport stream id. * This will be moved into demuxer private options. Thus no API/ABI compatibility @@ -1374,17 +1649,6 @@ typedef struct AVFormatContext { */ int use_wallclock_as_timestamps; - /** - * Avoid negative timestamps during muxing. - * 0 -> allow negative timestamps - * 1 -> avoid negative timestamps - * -1 -> choose automatically (default) - * Note, this only works when interleave_packet_per_dts is in use. - * - encoding: Set by user via AVOptions (NO direct access) - * - decoding: unused - */ - int avoid_negative_ts; - /** * avio flags, used to force AVIO_FLAG_DIRECT. * - encoding: unused @@ -1405,7 +1669,7 @@ typedef struct AVFormatContext { * - encoding: unused * - decoding: Set by user via AVOptions (NO direct access) */ - unsigned int skip_initial_bytes; + int64_t skip_initial_bytes; /** * Correct single timestamp overflows @@ -1437,55 +1701,28 @@ typedef struct AVFormatContext { */ int probe_score; - /***************************************************************** - * All fields below this line are not part of the public API. They - * may not be used outside of libavformat and can be changed and - * removed at will. - * New public fields should be added right above. - ***************************************************************** + /** + * number of bytes to read maximally to identify format. + * - encoding: unused + * - decoding: set by user through AVOPtions (NO direct access) */ + int format_probesize; /** - * This buffer is only needed when packets were already buffered but - * not decoded, for example to get the codec parameters in MPEG - * streams. + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) */ - struct AVPacketList *packet_buffer; - struct AVPacketList *packet_buffer_end; - - /* av_seek_frame() support */ - int64_t data_offset; /**< offset of the first packet */ + char *codec_whitelist; /** - * Raw packets from the demuxer, prior to parsing and decoding. - * This buffer is used for buffering packets until the codec can - * be identified, as parsing cannot be done without knowing the - * codec. + * ',' separated list of allowed demuxers. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) */ - struct AVPacketList *raw_packet_buffer; - struct AVPacketList *raw_packet_buffer_end; - /** - * Packets split by the parser get queued here. - */ - struct AVPacketList *parse_queue; - struct AVPacketList *parse_queue_end; - /** - * Remaining size available for raw_packet_buffer, in bytes. - */ -#define RAW_PACKET_BUFFER_SIZE 2500000 - int raw_packet_buffer_remaining_size; - - /** - * Offset to remap timestamps to be non-negative. - * Expressed in timebase units. - * @see AVStream.mux_ts_offset - */ - int64_t offset; - - /** - * Timebase for the timestamp offset. - */ - AVRational offset_timebase; + char *format_whitelist; /** * An opaque field for libavformat internal usage. @@ -1525,6 +1762,14 @@ typedef struct AVFormatContext { */ AVCodec *subtitle_codec; + /** + * Forced data codec. + * This allows forcing a specific decoder, even when there are multiple with + * the same codec_id. + * Demuxing: Set by user via av_format_set_data_codec (NO direct access). + */ + AVCodec *data_codec; + /** * Number of bytes to be written as padding in a metadata header. * Demuxing: Unused. @@ -1535,7 +1780,6 @@ typedef struct AVFormatContext { /** * User data. * This is a place for some private data of the user. - * Mostly usable with control_message_cb or any future callbacks in device's context. */ void *opaque; @@ -1549,6 +1793,79 @@ typedef struct AVFormatContext { * Muxing: set by user via AVOptions (NO direct access) */ int64_t output_ts_offset; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * Code outside libavformat should access this field using AVOptions + * (NO direct access). + * - muxing: Set by user. + * - demuxing: Set by user. + */ + uint8_t *dump_separator; + + /** + * Forced Data codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID data_codec_id; + +#if FF_API_OLD_OPEN_CALLBACKS + /** + * Called to open further IO contexts when needed for demuxing. + * + * This can be set by the user application to perform security checks on + * the URLs before opening them. + * The function should behave like avio_open2(), AVFormatContext is provided + * as contextual information and to reach AVFormatContext.opaque. + * + * If NULL then some simple checks are used together with avio_open2(). + * + * Must not be accessed directly from outside avformat. + * @See av_format_set_open_cb() + * + * Demuxing: Set by user. + * + * @deprecated Use io_open and io_close. + */ + attribute_deprecated + int (*open_cb)(struct AVFormatContext *s, AVIOContext **p, const char *url, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options); +#endif + + /** + * ',' separated list of allowed protocols. + * - encoding: unused + * - decoding: set by user through AVOptions (NO direct access) + */ + char *protocol_whitelist; + + /* + * A callback for opening new IO streams. + * + * Certain muxers or demuxers (e.g. for various playlist-based formats) need + * to open additional files during muxing or demuxing. This callback allows + * the caller to provide custom IO in such cases. + * + * @param s the format context + * @param pb on success, the newly opened IO context should be returned here + * @param url the url to open + * @param flags a combination of AVIO_FLAG_* + * @param options a dictionary of additional options, with the same + * semantics as in avio_open2() + * @return 0 on success, a negative AVERROR code on failure + * + * @note Certain muxers and demuxers do nesting, i.e. they open one or more + * additional internal format contexts. Thus the AVFormatContext pointer + * passed to this callback may be different from the one facing the caller. + * It will, however, have the same 'opaque' field. + */ + int (*io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, + int flags, AVDictionary **options); + + /** + * A callback for closing the streams opened with AVFormatContext.io_open(). + */ + void (*io_close)(struct AVFormatContext *s, AVIOContext *pb); } AVFormatContext; int av_format_get_probe_score(const AVFormatContext *s); @@ -1558,12 +1875,24 @@ AVCodec * av_format_get_audio_codec(const AVFormatContext *s); void av_format_set_audio_codec(AVFormatContext *s, AVCodec *c); AVCodec * av_format_get_subtitle_codec(const AVFormatContext *s); void av_format_set_subtitle_codec(AVFormatContext *s, AVCodec *c); +AVCodec * av_format_get_data_codec(const AVFormatContext *s); +void av_format_set_data_codec(AVFormatContext *s, AVCodec *c); int av_format_get_metadata_header_padding(const AVFormatContext *s); void av_format_set_metadata_header_padding(AVFormatContext *s, int c); void * av_format_get_opaque(const AVFormatContext *s); void av_format_set_opaque(AVFormatContext *s, void *opaque); av_format_control_message av_format_get_control_message_cb(const AVFormatContext *s); void av_format_set_control_message_cb(AVFormatContext *s, av_format_control_message callback); +#if FF_API_OLD_OPEN_CALLBACKS +attribute_deprecated AVOpenCallback av_format_get_open_cb(const AVFormatContext *s); +attribute_deprecated void av_format_set_open_cb(AVFormatContext *s, AVOpenCallback callback); +#endif + +/** + * This function will cause global side data to be injected in the next packet + * of each stream as well as after any subsequent seek. + */ +void av_format_inject_global_side_data(AVFormatContext *s); /** * Returns the method used to set ctx->duration. @@ -1635,14 +1964,14 @@ int avformat_network_deinit(void); * if f is non-NULL, returns the next registered input format after f * or NULL if f is the last one. */ -AVInputFormat *av_iformat_next(AVInputFormat *f); +AVInputFormat *av_iformat_next(const AVInputFormat *f); /** * If f is NULL, returns the first registered output format, * if f is non-NULL, returns the next registered output format after f * or NULL if f is the last one. */ -AVOutputFormat *av_oformat_next(AVOutputFormat *f); +AVOutputFormat *av_oformat_next(const AVOutputFormat *f); /** * Allocate an AVFormatContext. @@ -1686,6 +2015,27 @@ const AVClass *avformat_get_class(void); */ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c); +/** + * Allocate new information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t *av_stream_new_side_data(AVStream *stream, + enum AVPacketSideDataType type, int size); +/** + * Get side information from stream. + * + * @param stream stream + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t *av_stream_get_side_data(AVStream *stream, + enum AVPacketSideDataType type, int *size); + AVProgram *av_new_program(AVFormatContext *s, int id); /** @@ -1693,16 +2043,6 @@ AVProgram *av_new_program(AVFormatContext *s, int id); */ -#if FF_API_ALLOC_OUTPUT_CONTEXT -/** - * @deprecated deprecated in favor of avformat_alloc_output_context2() - */ -attribute_deprecated -AVFormatContext *avformat_alloc_output_context(const char *format, - AVOutputFormat *oformat, - const char *filename); -#endif - /** * Allocate an AVFormatContext for an output format. * avformat_free_context() can be used to free the context and @@ -1772,7 +2112,7 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * * @param pb the bytestream to probe * @param fmt the input format is put here - * @param filename the filename of the stream + * @param url the url of the stream * @param logctx the log context * @param offset the offset within the bytestream to probe from * @param max_probe_size the maximum probe buffer size (zero for default) @@ -1781,14 +2121,14 @@ AVInputFormat *av_probe_input_format3(AVProbeData *pd, int is_opened, int *score * AVERROR code otherwise */ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, + const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** * Like av_probe_input_buffer2() but returns 0 on success */ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, - const char *filename, void *logctx, + const char *url, void *logctx, unsigned int offset, unsigned int max_probe_size); /** @@ -1799,7 +2139,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * May be a pointer to NULL, in which case an AVFormatContext is allocated by this * function and written into ps. * Note that a user-supplied AVFormatContext will be freed on failure. - * @param filename Name of the stream to open. + * @param url URL of the stream to open. * @param fmt If non-NULL, this parameter forces a specific input format. * Otherwise the format is autodetected. * @param options A dictionary filled with AVFormatContext and demuxer-private options. @@ -1810,31 +2150,11 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, * * @note If you want to use custom IO, preallocate the format context and set its pb field. */ -int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); +int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options); attribute_deprecated int av_demuxer_open(AVFormatContext *ic); -#if FF_API_FORMAT_PARAMETERS -/** - * Read packets of a media file to get stream information. This - * is useful for file formats with no headers such as MPEG. This - * function also computes the real framerate in case of MPEG-2 repeat - * frame mode. - * The logical file position is not changed by this function; - * examined packets may be buffered for later processing. - * - * @param ic media file handle - * @return >=0 if OK, AVERROR_xxx on error - * @todo Let the user decide somehow what information is needed so that - * we do not waste time getting stuff the user does not need. - * - * @deprecated use avformat_find_stream_info. - */ -attribute_deprecated -int av_find_stream_info(AVFormatContext *ic); -#endif - /** * Read packets of a media file to get stream information. This * is useful for file formats with no headers such as MPEG. This @@ -1870,6 +2190,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); */ AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s); +void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx); + /** * Find the "best" stream in the file. * The best stream is determined according to various heuristics as the most @@ -1901,24 +2223,6 @@ int av_find_best_stream(AVFormatContext *ic, AVCodec **decoder_ret, int flags); -#if FF_API_READ_PACKET -/** - * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw - * unprocessed packets - * - * Read a transport packet from a media file. - * - * This function is obsolete and should never be used. - * Use av_read_frame() instead. - * - * @param s media file handle - * @param pkt is filled - * @return 0 if OK, AVERROR_xxx on error - */ -attribute_deprecated -int av_read_packet(AVFormatContext *s, AVPacket *pkt); -#endif - /** * Return the next frame of a stream. * This function returns what is stored in the file, and does not validate @@ -1930,7 +2234,7 @@ int av_read_packet(AVFormatContext *s, AVPacket *pkt); * If pkt->buf is NULL, then the packet is valid until the next * av_read_frame() or until avformat_close_input(). Otherwise the packet * is valid indefinitely. In both cases the packet must be freed with - * av_free_packet when it is no longer needed. For video, the packet contains + * av_packet_unref when it is no longer needed. For video, the packet contains * exactly one frame. For audio, it contains an integer number of frames if each * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames * have a variable size (e.g. MPEG audio), then it contains one frame. @@ -1991,6 +2295,24 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, */ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +/** + * Discard all internally buffered data. This can be useful when dealing with + * discontinuities in the byte stream. Generally works only with formats that + * can resync. This includes headerless formats like MPEG-TS/TS but should also + * work with NUT, Ogg and in a limited way AVI for example. + * + * The set of streams, the detected duration, stream parameters and codecs do + * not change when calling this function. If you want a complete reset, it's + * better to open a new AVFormatContext. + * + * This does not flush the AVIOContext (s->pb). If necessary, call + * avio_flush(s->pb) before calling this function. + * + * @param s media file handle + * @return >=0 on success, error code otherwise + */ +int avformat_flush(AVFormatContext *s); + /** * Start playing a network-based stream (e.g. RTSP stream) at the * current position. @@ -2004,17 +2326,6 @@ int av_read_play(AVFormatContext *s); */ int av_read_pause(AVFormatContext *s); -#if FF_API_CLOSE_INPUT_FILE -/** - * @deprecated use avformat_close_input() - * Close a media file (but not its codecs). - * - * @param s media file handle - */ -attribute_deprecated -void av_close_input_file(AVFormatContext *s); -#endif - /** * Close an opened input AVFormatContext. Free it and all its contents * and set *s to NULL. @@ -2024,30 +2335,6 @@ void avformat_close_input(AVFormatContext **s); * @} */ -#if FF_API_NEW_STREAM -/** - * Add a new stream to a media file. - * - * Can only be called in the read_header() function. If the flag - * AVFMTCTX_NOHEADER is in the format context, then new streams - * can be added in read_packet too. - * - * @param s media file handle - * @param id file-format-dependent stream ID - */ -attribute_deprecated -AVStream *av_new_stream(AVFormatContext *s, int id); -#endif - -#if FF_API_SET_PTS_INFO -/** - * @deprecated this function is not supposed to be called outside of lavf - */ -attribute_deprecated -void av_set_pts_info(AVStream *s, int pts_wrap_bits, - unsigned int pts_num, unsigned int pts_den); -#endif - #define AVSEEK_FLAG_BACKWARD 1 ///< seek backward #define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes #define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes @@ -2072,6 +2359,7 @@ void av_set_pts_info(AVStream *s, int pts_wrap_bits, * * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. */ +av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options); /** @@ -2096,10 +2384,17 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options); *
* Packet's @ref AVPacket.stream_index "stream_index" field must be * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". It is very strongly - * recommended that timing information (@ref AVPacket.pts "pts", @ref - * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to - * correct values. + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets passed to this function must be strictly + * increasing when compared in their respective timebases (unless the + * output format is flagged with the AVFMT_TS_NONSTRICT, then they + * merely have to be nondecreasing). @ref AVPacket.duration + * "duration") should also be set if known. * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush * * @see av_interleaved_write_frame() @@ -2129,10 +2424,16 @@ int av_write_frame(AVFormatContext *s, AVPacket *pkt); *
* Packet's @ref AVPacket.stream_index "stream_index" field must be * set to the index of the corresponding stream in @ref - * AVFormatContext.streams "s->streams". It is very strongly - * recommended that timing information (@ref AVPacket.pts "pts", @ref - * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to - * correct values. + * AVFormatContext.streams "s->streams". + *
+ * The timestamps (@ref AVPacket.pts "pts", @ref AVPacket.dts "dts") + * must be set to correct values in the stream's timebase (unless the + * output format is flagged with the AVFMT_NOTIMESTAMPS flag, then + * they can be set to AV_NOPTS_VALUE). + * The dts for subsequent packets in one stream must be strictly + * increasing (unless the output format is flagged with the + * AVFMT_TS_NONSTRICT, then they merely have to be nondecreasing). + * @ref AVPacket.duration "duration") should also be set if known. * * @return 0 on success, a negative AVERROR on error. Libavformat will always * take care of freeing the packet, even if this function fails. @@ -2155,7 +2456,7 @@ int av_write_uncoded_frame(AVFormatContext *s, int stream_index, /** * Write a uncoded frame to an output media file. * - * If the muxer supports it, this function allows to write an AVFrame + * If the muxer supports it, this function makes it possible to write an AVFrame * structure directly, without encoding it into a packet. * It is mostly useful for devices and similar special muxers that use raw * video or PCM data and will not serialize it into a byte stream. @@ -2279,7 +2580,7 @@ void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); * @param dump_payload True if the payload must be displayed, too. * @param st AVStream that the packet belongs to */ -void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); +void av_pkt_dump2(FILE *f, const AVPacket *pkt, int dump_payload, const AVStream *st); /** @@ -2293,8 +2594,8 @@ void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); * @param dump_payload True if the payload must be displayed, too. * @param st AVStream that the packet belongs to */ -void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, - AVStream *st); +void av_pkt_dump_log2(void *avcl, int level, const AVPacket *pkt, int dump_payload, + const AVStream *st); /** * Get the AVCodecID for the given codec tag tag. @@ -2380,6 +2681,16 @@ void av_url_split(char *proto, int proto_size, const char *url); +/** + * Print detailed information about the input or output format, such as + * duration, bitrate, streams, container, programs, metadata, side data, + * codec and time base. + * + * @param ic the context to analyze + * @param index index of the stream to dump information about + * @param url the URL to print, such as source or destination file + * @param is_output Select whether the specified context is an input(0) or output(1) + */ void av_dump_format(AVFormatContext *ic, int index, const char *url, @@ -2446,7 +2757,8 @@ int av_match_ext(const char *filename, const char *extensions); * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. * A negative number if this information is not available. */ -int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); +int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id, + int std_compliance); /** * @defgroup riff_fourcc RIFF FourCCs @@ -2528,6 +2840,17 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); +/** + * Apply a list of bitstream filters to a packet. + * + * @param codec AVCodecContext, usually from an AVStream + * @param pkt the packet to apply filters to + * @param bsfc a NULL-terminated list of filters to apply + * @return >=0 on success; + * AVERROR code on failure + */ +int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, + AVBitStreamFilterContext *bsfc); /** * @} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.h b/ThirdParty/ffmpeg/include/libavformat/avio.h similarity index 64% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.h rename to ThirdParty/ffmpeg/include/libavformat/avio.h index ee265f905..7fbce32b6 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/avio.h +++ b/ThirdParty/ffmpeg/include/libavformat/avio.h @@ -28,18 +28,11 @@ #include -#ifdef __FRAMEWORK__ -#include "common.h" -#include "dict.h" -#include "log.h" -#else #include "libavutil/common.h" #include "libavutil/dict.h" #include "libavutil/log.h" #include "libavformat/version.h" -#endif - #define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ @@ -59,6 +52,50 @@ typedef struct AVIOInterruptCB { void *opaque; } AVIOInterruptCB; +/** + * Directory entry types. + */ +enum AVIODirEntryType { + AVIO_ENTRY_UNKNOWN, + AVIO_ENTRY_BLOCK_DEVICE, + AVIO_ENTRY_CHARACTER_DEVICE, + AVIO_ENTRY_DIRECTORY, + AVIO_ENTRY_NAMED_PIPE, + AVIO_ENTRY_SYMBOLIC_LINK, + AVIO_ENTRY_SOCKET, + AVIO_ENTRY_FILE, + AVIO_ENTRY_SERVER, + AVIO_ENTRY_SHARE, + AVIO_ENTRY_WORKGROUP, +}; + +/** + * Describes single entry of the directory. + * + * Only name and type fields are guaranteed be set. + * Rest of fields are protocol or/and platform dependent and might be unknown. + */ +typedef struct AVIODirEntry { + char *name; /**< Filename */ + int type; /**< Type of the entry */ + int utf8; /**< Set to 1 when name is encoded with UTF-8, 0 otherwise. + Name can be encoded with UTF-8 even though 0 is set. */ + int64_t size; /**< File size in bytes, -1 if unknown. */ + int64_t modification_timestamp; /**< Time of last modification in microseconds since unix + epoch, -1 if unknown. */ + int64_t access_timestamp; /**< Time of last access in microseconds since unix epoch, + -1 if unknown. */ + int64_t status_change_timestamp; /**< Time of last status change in microseconds since unix + epoch, -1 if unknown. */ + int64_t user_id; /**< User ID of owner, -1 if unknown. */ + int64_t group_id; /**< Group ID of owner, -1 if unknown. */ + int64_t filemode; /**< Unix file mode, -1 if unknown. */ +} AVIODirEntry; + +typedef struct AVIODirContext { + struct URLContext *url_context; +} AVIODirContext; + /** * Bytestream IO Context. * New fields can be added to the end with minor version bumps. @@ -85,6 +122,53 @@ typedef struct AVIOContext { * to any av_opt_* functions in that case. */ const AVClass *av_class; + + /* + * The following shows the relationship between buffer, buf_ptr, buf_end, buf_size, + * and pos, when reading and when writing (since AVIOContext is used for both): + * + ********************************************************************************** + * READING + ********************************************************************************** + * + * | buffer_size | + * |---------------------------------------| + * | | + * + * buffer buf_ptr buf_end + * +---------------+-----------------------+ + * |/ / / / / / / /|/ / / / / / /| | + * read buffer: |/ / consumed / | to be read /| | + * |/ / / / / / / /|/ / / / / / /| | + * +---------------+-----------------------+ + * + * pos + * +-------------------------------------------+-----------------+ + * input file: | | | + * +-------------------------------------------+-----------------+ + * + * + ********************************************************************************** + * WRITING + ********************************************************************************** + * + * | buffer_size | + * |-------------------------------| + * | | + * + * buffer buf_ptr buf_end + * +-------------------+-----------+ + * |/ / / / / / / / / /| | + * write buffer: | / to be flushed / | | + * |/ / / / / / / / / /| | + * +-------------------+-----------+ + * + * pos + * +--------------------------+-----------------------------------+ + * output file: | | | + * +--------------------------+-----------------------------------+ + * + */ unsigned char *buffer; /**< Start of the buffer. */ int buffer_size; /**< Maximum buffer size */ unsigned char *buf_ptr; /**< Current position in the buffer */ @@ -152,6 +236,24 @@ typedef struct AVIOContext { * This field is internal to libavformat and access from outside is not allowed. */ int writeout_count; + + /** + * Original buffer size + * used internally after probing and ensure seekback to reset the buffer size + * This field is internal to libavformat and access from outside is not allowed. + */ + int orig_buffer_size; + + /** + * Threshold to favor readahead over seek. + * This is current internal only, do not use from outside. + */ + int short_seek_threshold; + + /** + * ',' separated list of allowed protocols. + */ + const char *protocol_whitelist; } AVIOContext; /* unbuffered I/O */ @@ -179,12 +281,77 @@ const char *avio_find_protocol_name(const char *url); */ int avio_check(const char *url, int flags); +/** + * Move or rename a resource. + * + * @note url_src and url_dst should share the same protocol and authority. + * + * @param url_src url to resource to be moved + * @param url_dst new url to resource if the operation succeeded + * @return >=0 on success or negative on error. + */ +int avpriv_io_move(const char *url_src, const char *url_dst); + +/** + * Delete a resource. + * + * @param url resource to be deleted. + * @return >=0 on success or negative on error. + */ +int avpriv_io_delete(const char *url); + +/** + * Open directory for reading. + * + * @param s directory read context. Pointer to a NULL pointer must be passed. + * @param url directory to be listed. + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dictionary + * containing options that were not found. May be NULL. + * @return >=0 on success or negative on error. + */ +int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options); + +/** + * Get next directory entry. + * + * Returned entry must be freed with avio_free_directory_entry(). In particular + * it may outlive AVIODirContext. + * + * @param s directory read context. + * @param[out] next next entry or NULL when no more entries. + * @return >=0 on success or negative on error. End of list is not considered an + * error. + */ +int avio_read_dir(AVIODirContext *s, AVIODirEntry **next); + +/** + * Close directory. + * + * @note Entries created using avio_read_dir() are not deleted and must be + * freeded with avio_free_directory_entry(). + * + * @param s directory read context. + * @return >=0 on success or negative on error. + */ +int avio_close_dir(AVIODirContext **s); + +/** + * Free entry allocated by avio_read_dir(). + * + * @param entry entry to be freed. + */ +void avio_free_directory_entry(AVIODirEntry **entry); + /** * Allocate and initialize an AVIOContext for buffered I/O. It must be later * freed with av_free(). * * @param buffer Memory block for input/output operations via AVIOContext. * The buffer must be allocated with av_malloc() and friends. + * It may be freed and replaced with a new buffer by libavformat. + * AVIOContext.buffer holds the buffer currently in use, + * which must be later freed with av_free(). * @param buffer_size The buffer size is very important for performance. * For protocols with fixed blocksize it should be set to this blocksize. * For others a typical size is a cache page, e.g. 4kb. @@ -225,10 +392,22 @@ int avio_put_str(AVIOContext *s, const char *str); /** * Convert an UTF-8 string to UTF-16LE and write it. + * @param s the AVIOContext + * @param str NULL-terminated UTF-8 string + * * @return number of bytes written. */ int avio_put_str16le(AVIOContext *s, const char *str); +/** + * Convert an UTF-8 string to UTF-16BE and write it. + * @param s the AVIOContext + * @param str NULL-terminated UTF-8 string + * + * @return number of bytes written. + */ +int avio_put_str16be(AVIOContext *s, const char *str); + /** * Passing this as the "whence" parameter to a seek function causes it to * return the filesize without seeking anywhere. Supporting this is optional. @@ -275,16 +454,27 @@ int64_t avio_size(AVIOContext *s); * feof() equivalent for AVIOContext. * @return non zero if and only if end of file */ +int avio_feof(AVIOContext *s); +#if FF_API_URL_FEOF +/** + * @deprecated use avio_feof() + */ +attribute_deprecated int url_feof(AVIOContext *s); +#endif -/** @warning currently size is limited */ +/** @warning Writes up to 4 KiB per call */ int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); /** - * Force flushing of buffered data to the output s. + * Force flushing of buffered data. * - * Force the buffered data to be immediately written to the output, + * For write streams, force the buffered data to be immediately written to the output, * without to wait to fill the internal buffer. + * + * For read streams, discard all currently buffered data, and advance the + * reported file position to that of the underlying stream. This does not + * read new data, and does not perform any seeks. */ void avio_flush(AVIOContext *s); @@ -447,7 +637,7 @@ int avio_open_dyn_buf(AVIOContext **s); /** * Return the written size and a pointer to the buffer. The buffer * must be freed with av_free(). - * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * Padding of AV_INPUT_BUFFER_PADDING_SIZE is added to the buffer. * * @param s IO context * @param pbuffer pointer to a byte buffer @@ -499,4 +689,44 @@ int avio_pause(AVIOContext *h, int pause); int64_t avio_seek_time(AVIOContext *h, int stream_index, int64_t timestamp, int flags); +/* Avoid a warning. The header can not be included because it breaks c++. */ +struct AVBPrint; + +/** + * Read contents of h into print buffer, up to max_size bytes, or up to EOF. + * + * @return 0 for success (max_size bytes read or EOF reached), negative error + * code otherwise + */ +int avio_read_to_bprint(AVIOContext *h, struct AVBPrint *pb, size_t max_size); + +/** + * Accept and allocate a client context on a server context. + * @param s the server context + * @param c the client context, must be unallocated + * @return >= 0 on success or a negative value corresponding + * to an AVERROR on failure + */ +int avio_accept(AVIOContext *s, AVIOContext **c); + +/** + * Perform one step of the protocol handshake to accept a new client. + * This function must be called on a client returned by avio_accept() before + * using it as a read/write context. + * It is separate from avio_accept() because it may block. + * A step of the handshake is defined by places where the application may + * decide to change the proceedings. + * For example, on a protocol with a request header and a reply header, each + * one can constitute a step because the application may use the parameters + * from the request to change parameters in the reply; or each individual + * chunk of the request can constitute a step. + * If the handshake is already finished, avio_handshake() does nothing and + * returns 0 immediately. + * + * @param c the client context to perform the handshake on + * @return 0 on a complete and successful handshake + * > 0 if the handshake progressed, but is not complete + * < 0 for an AVERROR code + */ +int avio_handshake(AVIOContext *c); #endif /* AVFORMAT_AVIO_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/version.h b/ThirdParty/ffmpeg/include/libavformat/version.h similarity index 65% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavformat/version.h rename to ThirdParty/ffmpeg/include/libavformat/version.h index f9fc9d830..024ab9152 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavformat/version.h +++ b/ThirdParty/ffmpeg/include/libavformat/version.h @@ -29,8 +29,8 @@ #include "libavutil/version.h" -#define LIBAVFORMAT_VERSION_MAJOR 55 -#define LIBAVFORMAT_VERSION_MINOR 34 +#define LIBAVFORMAT_VERSION_MAJOR 57 +#define LIBAVFORMAT_VERSION_MINOR 25 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ @@ -47,32 +47,34 @@ * FF_API_* defines may be placed below to indicate public API that will be * dropped at a future version bump. The defines themselves are not part of * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * */ -#ifndef FF_API_REFERENCE_DTS -#define FF_API_REFERENCE_DTS (LIBAVFORMAT_VERSION_MAJOR < 56) +#ifndef FF_API_LAVF_BITEXACT +#define FF_API_LAVF_BITEXACT (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_LAVF_FRAC +#define FF_API_LAVF_FRAC (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_LAVF_CODEC_TB +#define FF_API_LAVF_CODEC_TB (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_URL_FEOF +#define FF_API_URL_FEOF (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_LAVF_FMT_RAWPICTURE +#define FF_API_LAVF_FMT_RAWPICTURE (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_COMPUTE_PKT_FIELDS2 +#define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 58) +#endif +#ifndef FF_API_OLD_OPEN_CALLBACKS +#define FF_API_OLD_OPEN_CALLBACKS (LIBAVFORMAT_VERSION_MAJOR < 58) #endif -#ifndef FF_API_ALLOC_OUTPUT_CONTEXT -#define FF_API_ALLOC_OUTPUT_CONTEXT (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_FORMAT_PARAMETERS -#define FF_API_FORMAT_PARAMETERS (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_NEW_STREAM -#define FF_API_NEW_STREAM (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_SET_PTS_INFO -#define FF_API_SET_PTS_INFO (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_CLOSE_INPUT_FILE -#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_READ_PACKET -#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif -#ifndef FF_API_ASS_SSA -#define FF_API_ASS_SSA (LIBAVFORMAT_VERSION_MAJOR < 56) -#endif #ifndef FF_API_R_FRAME_RATE #define FF_API_R_FRAME_RATE 1 #endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.h b/ThirdParty/ffmpeg/include/libavutil/adler32.h similarity index 51% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.h rename to ThirdParty/ffmpeg/include/libavutil/adler32.h index 9709f4dae..0dc69ec0a 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat_readwrite.h +++ b/ThirdParty/ffmpeg/include/libavutil/adler32.h @@ -1,5 +1,5 @@ /* - * copyright (c) 2005 Michael Niedermayer + * copyright (c) 2006 Mans Rullgard * * This file is part of FFmpeg. * @@ -18,23 +18,38 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef AVUTIL_INTFLOAT_READWRITE_H -#define AVUTIL_INTFLOAT_READWRITE_H +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H #include #include "attributes.h" -/* IEEE 80 bits extended float */ -typedef struct AVExtFloat { - uint8_t exponent[2]; - uint8_t mantissa[8]; -} AVExtFloat; +/** + * @file + * Public header for libavutil Adler32 hasher + * + * @defgroup lavu_adler32 Adler32 + * @ingroup lavu_crypto + * @{ + */ -attribute_deprecated double av_int2dbl(int64_t v) av_const; -attribute_deprecated float av_int2flt(int32_t v) av_const; -attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; -attribute_deprecated int64_t av_dbl2int(double d) av_const; -attribute_deprecated int32_t av_flt2int(float d) av_const; -attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; +/** + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; -#endif /* AVUTIL_INTFLOAT_READWRITE_H */ +/** + * @} + */ + +#endif /* AVUTIL_ADLER32_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/aes.h b/ThirdParty/ffmpeg/include/libavutil/aes.h new file mode 100644 index 000000000..09efbda10 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/aes.h @@ -0,0 +1,65 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_aes_size; + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/aes_ctr.h b/ThirdParty/ffmpeg/include/libavutil/aes_ctr.h new file mode 100644 index 000000000..f596fa6a4 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/aes_ctr.h @@ -0,0 +1,83 @@ +/* + * AES-CTR cipher + * Copyright (c) 2015 Eran Kornblau + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_CTR_H +#define AVUTIL_AES_CTR_H + +#include + +#include "attributes.h" +#include "version.h" + +#define AES_CTR_KEY_SIZE (16) +#define AES_CTR_IV_SIZE (8) + +struct AVAESCTR; + +/** + * Allocate an AVAESCTR context. + */ +struct AVAESCTR *av_aes_ctr_alloc(void); + +/** + * Initialize an AVAESCTR context. + * @param key encryption key, must have a length of AES_CTR_KEY_SIZE + */ +int av_aes_ctr_init(struct AVAESCTR *a, const uint8_t *key); + +/** + * Release an AVAESCTR context. + */ +void av_aes_ctr_free(struct AVAESCTR *a); + +/** + * Process a buffer using a previously initialized context. + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param size the size of src and dst + */ +void av_aes_ctr_crypt(struct AVAESCTR *a, uint8_t *dst, const uint8_t *src, int size); + +/** + * Get the current iv + */ +const uint8_t* av_aes_ctr_get_iv(struct AVAESCTR *a); + +/** + * Generate a random iv + */ +void av_aes_ctr_set_random_iv(struct AVAESCTR *a); + +/** + * Forcefully change the iv + */ +void av_aes_ctr_set_iv(struct AVAESCTR *a, const uint8_t* iv); + +/** + * Increment the top 64 bit of the iv (performed after each frame) + */ +void av_aes_ctr_increment_iv(struct AVAESCTR *a); + +/** + * @} + */ + +#endif /* AVUTIL_AES_CTR_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/attributes.h b/ThirdParty/ffmpeg/include/libavutil/attributes.h similarity index 91% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/attributes.h rename to ThirdParty/ffmpeg/include/libavutil/attributes.h index 7d3f4a91c..5c6b9deec 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/attributes.h +++ b/ThirdParty/ffmpeg/include/libavutil/attributes.h @@ -27,9 +27,11 @@ #define AVUTIL_ATTRIBUTES_H #ifdef __GNUC__ -# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) #else # define AV_GCC_VERSION_AT_LEAST(x,y) 0 +# define AV_GCC_VERSION_AT_MOST(x,y) 0 #endif #ifndef av_always_inline @@ -50,6 +52,12 @@ #endif #endif +#if AV_GCC_VERSION_AT_LEAST(3,4) +# define av_warn_unused_result __attribute__((warn_unused_result)) +#else +# define av_warn_unused_result +#endif + #if AV_GCC_VERSION_AT_LEAST(3,1) # define av_noinline __attribute__((noinline)) #elif defined(_MSC_VER) diff --git a/ThirdParty/ffmpeg/include/libavutil/audio_fifo.h b/ThirdParty/ffmpeg/include/libavutil/audio_fifo.h new file mode 100644 index 000000000..24f91dab7 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/audio_fifo.h @@ -0,0 +1,170 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_audiofifo Audio FIFO Buffer + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +av_warn_unused_result +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. If successful, the number of samples + * actually written will always be nb_samples. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Peek data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to peek + * @return number of samples actually peek, or negative AVERROR code + * on failure. The number of samples actually peek will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_peek(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. The number of samples actually read will not + * be greater than nb_samples, and will only be less than + * nb_samples if av_audio_fifo_size is less than nb_samples. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/audioconvert.h b/ThirdParty/ffmpeg/include/libavutil/audioconvert.h new file mode 100644 index 000000000..300a67cd3 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/audioconvert.h @@ -0,0 +1,6 @@ + +#include "version.h" + +#if FF_API_AUDIOCONVERT +#include "channel_layout.h" +#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avassert.h b/ThirdParty/ffmpeg/include/libavutil/avassert.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avassert.h rename to ThirdParty/ffmpeg/include/libavutil/avassert.h diff --git a/ThirdParty/ffmpeg/include/libavutil/avconfig.h b/ThirdParty/ffmpeg/include/libavutil/avconfig.h new file mode 100644 index 000000000..36a8cd14d --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/avconfig.h @@ -0,0 +1,7 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#define AV_HAVE_INCOMPATIBLE_LIBAV_ABI 0 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.h b/ThirdParty/ffmpeg/include/libavutil/avstring.h similarity index 70% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.h rename to ThirdParty/ffmpeg/include/libavutil/avstring.h index 438ef799e..15b04babe 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avstring.h +++ b/ThirdParty/ffmpeg/include/libavutil/avstring.h @@ -22,6 +22,7 @@ #define AVUTIL_AVSTRING_H #include +#include #include "attributes.h" /** @@ -130,6 +131,20 @@ size_t av_strlcat(char *dst, const char *src, size_t size); */ size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); +/** + * Get the count of continuous non zero chars starting from the beginning. + * + * @param len maximum number of characters to check in the string, that + * is the maximum value which is returned by the function + */ +static inline size_t av_strnlen(const char *s, size_t len) +{ + size_t i; + for (i = 0; i < len && s[i]; i++) + ; + return i; +} + /** * Print arguments following specified format into a large enough auto * allocated buffer. It is similar to GNU asprintf(). @@ -188,22 +203,32 @@ char *av_strtok(char *s, const char *delim, char **saveptr); /** * Locale-independent conversion of ASCII isdigit. */ -int av_isdigit(int c); +static inline av_const int av_isdigit(int c) +{ + return c >= '0' && c <= '9'; +} /** * Locale-independent conversion of ASCII isgraph. */ -int av_isgraph(int c); +static inline av_const int av_isgraph(int c) +{ + return c > 32 && c < 127; +} /** * Locale-independent conversion of ASCII isspace. */ -int av_isspace(int c); +static inline av_const int av_isspace(int c) +{ + return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || + c == '\v'; +} /** * Locale-independent conversion of ASCII characters to uppercase. */ -static inline int av_toupper(int c) +static inline av_const int av_toupper(int c) { if (c >= 'a' && c <= 'z') c ^= 0x20; @@ -213,7 +238,7 @@ static inline int av_toupper(int c) /** * Locale-independent conversion of ASCII characters to lowercase. */ -static inline int av_tolower(int c) +static inline av_const int av_tolower(int c) { if (c >= 'A' && c <= 'Z') c ^= 0x20; @@ -223,7 +248,11 @@ static inline int av_tolower(int c) /** * Locale-independent conversion of ASCII isxdigit. */ -int av_isxdigit(int c); +static inline av_const int av_isxdigit(int c) +{ + c = av_tolower(c); + return av_isdigit(c) || (c >= 'a' && c <= 'f'); +} /** * Locale-independent case-insensitive compare. @@ -253,6 +282,29 @@ const char *av_basename(const char *path); */ const char *av_dirname(char *path); +/** + * Match instances of a name in a comma-separated list of names. + * List entries are checked from the start to the end of the names list, + * the first match ends further processing. If an entry prefixed with '-' + * matches, then 0 is returned. The "ALL" list entry is considered to + * match all names. + * + * @param name Name to look for. + * @param names List of names. + * @return 1 on match, 0 otherwise. + */ +int av_match_name(const char *name, const char *names); + +/** + * Append path component to the existing path. + * Path separator '/' is placed between when needed. + * Resulting string have to be freed with av_free(). + * @param path base path + * @param component component to be appended + * @return new path or NULL on error. + */ +char *av_append_path_component(const char *path, const char *component); + enum AVEscapeMode { AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode. AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping. @@ -267,14 +319,14 @@ enum AVEscapeMode { * characters lists, except it is guaranteed to use the exact same list * of whitespace characters as the rest of libavutil. */ -#define AV_ESCAPE_FLAG_WHITESPACE 0x01 +#define AV_ESCAPE_FLAG_WHITESPACE (1 << 0) /** * Escape only specified special characters. * Without this flag, escape also any characters that may be considered * special by av_get_token(), such as the single quote. */ -#define AV_ESCAPE_FLAG_STRICT 0x02 +#define AV_ESCAPE_FLAG_STRICT (1 << 1) /** * Escape string in src, and put the escaped string in an allocated @@ -292,9 +344,57 @@ enum AVEscapeMode { * @return the length of the allocated string, or a negative error code in case of error * @see av_bprint_escape() */ +av_warn_unused_result int av_escape(char **dst, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags); +#define AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES 1 ///< accept codepoints over 0x10FFFF +#define AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS 2 ///< accept non-characters - 0xFFFE and 0xFFFF +#define AV_UTF8_FLAG_ACCEPT_SURROGATES 4 ///< accept UTF-16 surrogates codes +#define AV_UTF8_FLAG_EXCLUDE_XML_INVALID_CONTROL_CODES 8 ///< exclude control codes not accepted by XML + +#define AV_UTF8_FLAG_ACCEPT_ALL \ + AV_UTF8_FLAG_ACCEPT_INVALID_BIG_CODES|AV_UTF8_FLAG_ACCEPT_NON_CHARACTERS|AV_UTF8_FLAG_ACCEPT_SURROGATES + +/** + * Read and decode a single UTF-8 code point (character) from the + * buffer in *buf, and update *buf to point to the next byte to + * decode. + * + * In case of an invalid byte sequence, the pointer will be updated to + * the next byte after the invalid sequence and the function will + * return an error code. + * + * Depending on the specified flags, the function will also fail in + * case the decoded code point does not belong to a valid range. + * + * @note For speed-relevant code a carefully implemented use of + * GET_UTF8() may be preferred. + * + * @param codep pointer used to return the parsed code in case of success. + * The value in *codep is set even in case the range check fails. + * @param bufp pointer to the address the first byte of the sequence + * to decode, updated by the function to point to the + * byte next after the decoded sequence + * @param buf_end pointer to the end of the buffer, points to the next + * byte past the last in the buffer. This is used to + * avoid buffer overreads (in case of an unfinished + * UTF-8 sequence towards the end of the buffer). + * @param flags a collection of AV_UTF8_FLAG_* flags + * @return >= 0 in case a sequence was successfully read, a negative + * value in case of invalid sequence + */ +av_warn_unused_result +int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end, + unsigned int flags); + +/** + * Check if a name is in a list. + * @returns 0 if not found, or the 1 based index where it has been found in the + * list. + */ +int av_match_list(const char *name, const char *list, char separator); + /** * @} */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avutil.h b/ThirdParty/ffmpeg/include/libavutil/avutil.h similarity index 95% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avutil.h rename to ThirdParty/ffmpeg/include/libavutil/avutil.h index d6566c116..9bcf67412 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/avutil.h +++ b/ThirdParty/ffmpeg/include/libavutil/avutil.h @@ -138,15 +138,13 @@ * * @{ * - * @defgroup lavu_internal Internal - * - * Not exported functions, for internal usage only + * @defgroup preproc_misc Preprocessor String Macros * * @{ * * @} * - * @defgroup preproc_misc Preprocessor String Macros + * @defgroup version_utils Library Version Macros * * @{ * @@ -164,6 +162,13 @@ */ unsigned avutil_version(void); +/** + * Return an informative version string. This usually is the actual release + * version number or a git commit description. This string has no fixed format + * and can change any time. It should never be parsed by code. + */ +const char *av_version_info(void); + /** * Return the libavutil build-time configuration. */ @@ -282,10 +287,10 @@ char av_get_picture_type_char(enum AVPictureType pict_type); #include "common.h" #include "error.h" +#include "rational.h" #include "version.h" #include "macros.h" #include "mathematics.h" -#include "rational.h" #include "log.h" #include "pixfmt.h" @@ -325,6 +330,11 @@ unsigned av_int_list_length_for_size(unsigned elsize, */ FILE *av_fopen_utf8(const char *path, const char *mode); +/** + * Return the fractional representation of the internal time base. + */ +AVRational av_get_time_base_q(void); + /** * @} * @} diff --git a/ThirdParty/ffmpeg/include/libavutil/base64.h b/ThirdParty/ffmpeg/include/libavutil/base64.h new file mode 100644 index 000000000..514498eac --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/base64.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2006 Ryan Martell. (rdm4@martellventures.com) + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BASE64_H +#define AVUTIL_BASE64_H + +#include + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the out buffer (including the + * null terminator), must be at least AV_BASE64_SIZE(in_size) + * @param in input buffer containing the data to encode + * @param in_size size in bytes of the in buffer + * @return out or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes to a + * null-terminated string. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/blowfish.h b/ThirdParty/ffmpeg/include/libavutil/blowfish.h new file mode 100644 index 000000000..9e289a40d --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/blowfish.h @@ -0,0 +1,82 @@ +/* + * Blowfish algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Allocate an AVBlowfish context. + */ +AVBlowfish *av_blowfish_alloc(void); + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.h b/ThirdParty/ffmpeg/include/libavutil/bprint.h similarity index 96% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.h rename to ThirdParty/ffmpeg/include/libavutil/bprint.h index 839ec1ec0..c09b1ac1e 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bprint.h +++ b/ThirdParty/ffmpeg/include/libavutil/bprint.h @@ -30,9 +30,13 @@ * Define a structure with extra padding to a fixed size * This helps ensuring binary compatibility with future versions. */ -#define FF_PAD_STRUCTURE(size, ...) \ + +#define FF_PAD_STRUCTURE(name, size, ...) \ +struct ff_pad_helper_##name { __VA_ARGS__ }; \ +typedef struct name { \ __VA_ARGS__ \ - char reserved_padding[size - sizeof(struct { __VA_ARGS__ })]; + char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \ +} name; /** * Buffer to print data progressively @@ -74,15 +78,14 @@ * internal buffer is large enough to hold a reasonable paragraph of text, * such as the current paragraph. */ -typedef struct AVBPrint { - FF_PAD_STRUCTURE(1024, + +FF_PAD_STRUCTURE(AVBPrint, 1024, char *str; /**< string so far */ unsigned len; /**< length so far */ unsigned size; /**< allocated memory */ unsigned size_max; /**< maximum allocated memory */ char reserved_internal_buffer[1]; - ) -} AVBPrint; +) /** * Convenience macros for special values for av_bprint_init() size_max @@ -179,7 +182,7 @@ void av_bprint_clear(AVBPrint *buf); * It may have been truncated due to a memory allocation failure * or the size_max limit (compare size and size_max if necessary). */ -static inline int av_bprint_is_complete(AVBPrint *buf) +static inline int av_bprint_is_complete(const AVBPrint *buf) { return buf->len < buf->size; } diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bswap.h b/ThirdParty/ffmpeg/include/libavutil/bswap.h similarity index 97% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bswap.h rename to ThirdParty/ffmpeg/include/libavutil/bswap.h index 06f654816..91cb79538 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/bswap.h +++ b/ThirdParty/ffmpeg/include/libavutil/bswap.h @@ -34,12 +34,12 @@ #include "config.h" -#if ARCH_ARM +#if ARCH_AARCH64 +# include "aarch64/bswap.h" +#elif ARCH_ARM # include "arm/bswap.h" #elif ARCH_AVR32 # include "avr32/bswap.h" -#elif ARCH_BFIN -# include "bfin/bswap.h" #elif ARCH_SH4 # include "sh4/bswap.h" #elif ARCH_X86 diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer.h b/ThirdParty/ffmpeg/include/libavutil/buffer.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/buffer.h rename to ThirdParty/ffmpeg/include/libavutil/buffer.h diff --git a/ThirdParty/ffmpeg/include/libavutil/camellia.h b/ThirdParty/ffmpeg/include/libavutil/camellia.h new file mode 100644 index 000000000..e674c9b9a --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/camellia.h @@ -0,0 +1,70 @@ +/* + * An implementation of the CAMELLIA algorithm as mentioned in RFC3713 + * Copyright (c) 2014 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CAMELLIA_H +#define AVUTIL_CAMELLIA_H + +#include + + +/** + * @file + * @brief Public header for libavutil CAMELLIA algorithm + * @defgroup lavu_camellia CAMELLIA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_camellia_size; + +struct AVCAMELLIA; + +/** + * Allocate an AVCAMELLIA context + * To free the struct: av_free(ptr) + */ +struct AVCAMELLIA *av_camellia_alloc(void); + +/** + * Initialize an AVCAMELLIA context. + * + * @param ctx an AVCAMELLIA context + * @param key a key of 16, 24, 32 bytes used for encryption/decryption + * @param key_bits number of keybits: possible are 128, 192, 256 + */ +int av_camellia_init(struct AVCAMELLIA *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVCAMELLIA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 16 byte blocks + * @paran iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_camellia_crypt(struct AVCAMELLIA *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); + +/** + * @} + */ +#endif /* AVUTIL_CAMELLIA_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/cast5.h b/ThirdParty/ffmpeg/include/libavutil/cast5.h new file mode 100644 index 000000000..ad5b347e6 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/cast5.h @@ -0,0 +1,80 @@ +/* + * An implementation of the CAST128 algorithm as mentioned in RFC2144 + * Copyright (c) 2014 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CAST5_H +#define AVUTIL_CAST5_H + +#include + + +/** + * @file + * @brief Public header for libavutil CAST5 algorithm + * @defgroup lavu_cast5 CAST5 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_cast5_size; + +struct AVCAST5; + +/** + * Allocate an AVCAST5 context + * To free the struct: av_free(ptr) + */ +struct AVCAST5 *av_cast5_alloc(void); +/** + * Initialize an AVCAST5 context. + * + * @param ctx an AVCAST5 context + * @param key a key of 5,6,...16 bytes used for encryption/decryption + * @param key_bits number of keybits: possible are 40,48,...,128 + * @return 0 on success, less than 0 on failure + */ +int av_cast5_init(struct AVCAST5 *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, ECB mode only + * + * @param ctx an AVCAST5 context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_cast5_crypt(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVCAST5 context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_cast5_crypt2(struct AVCAST5 *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); +/** + * @} + */ +#endif /* AVUTIL_CAST5_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.h b/ThirdParty/ffmpeg/include/libavutil/channel_layout.h similarity index 97% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.h rename to ThirdParty/ffmpeg/include/libavutil/channel_layout.h index bc6befd8e..ec7effead 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/channel_layout.h +++ b/ThirdParty/ffmpeg/include/libavutil/channel_layout.h @@ -79,7 +79,7 @@ /** * @} - * @defgroup channel_mask_c Audio channel convenience macros + * @defgroup channel_mask_c Audio channel layouts * @{ * */ #define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) @@ -108,6 +108,7 @@ #define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) #define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) #define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) enum AVMatrixEncoding { @@ -121,10 +122,6 @@ enum AVMatrixEncoding { AV_MATRIX_ENCODING_NB }; -/** - * @} - */ - /** * Return a channel layout id that matches name, or 0 if no match is found. * @@ -219,6 +216,7 @@ int av_get_standard_channel_layout(unsigned index, uint64_t *layout, const char **name); /** + * @} * @} */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/common.h b/ThirdParty/ffmpeg/include/libavutil/common.h similarity index 85% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/common.h rename to ThirdParty/ffmpeg/include/libavutil/common.h index b2bb670bb..8142b31fd 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/common.h +++ b/ThirdParty/ffmpeg/include/libavutil/common.h @@ -40,12 +40,9 @@ #include #include "attributes.h" +#include "macros.h" #include "version.h" -#ifdef __FRAMEWORK__ -#include "avconfig.h" -#else #include "libavutil/avconfig.h" -#endif #if AV_HAVE_BIGENDIAN # define AV_NE(be, le) (be) @@ -57,14 +54,43 @@ #define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) /* assume b>0 */ #define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) -/* assume a>0 and b>0 */ -#define FF_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ +/* Fast a/(1<=0 and b>=0 */ +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ : ((a) + (1<<(b)) - 1) >> (b)) +/* Backwards compat. */ +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT + #define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) #define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) + +/** + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they + * are not representable as absolute values of their type. This is the same + * as with *abs() + * @see FFNABS() + */ #define FFABS(a) ((a) >= 0 ? (a) : (-(a))) #define FFSIGN(a) ((a) > 0 ? 1 : -1) +/** + * Negative Absolute value. + * this works for all integers of all types. + * As with many macros, this evaluates its argument twice, it thus must not have + * a sideeffect, that is FFNABS(x++) has undefined behavior. + */ +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a))) + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + #define FFMAX(a,b) ((a) > (b) ? (a) : (b)) #define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) #define FFMIN(a,b) ((a) > (b) ? (b) : (a)) @@ -72,17 +98,9 @@ #define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) #define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) -#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) /* misc math functions */ -/** - * Reverse the order of the bits of an 8-bits unsigned integer. - */ -#if FF_API_AV_REVERSE -extern attribute_deprecated const uint8_t av_reverse[256]; -#endif - #ifdef HAVE_AV_CONFIG_H # include "config.h" # include "intmath.h" @@ -151,7 +169,7 @@ static av_always_inline av_const uint8_t av_clip_uint8_c(int a) */ static av_always_inline av_const int8_t av_clip_int8_c(int a) { - if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F; else return a; } @@ -173,7 +191,7 @@ static av_always_inline av_const uint16_t av_clip_uint16_c(int a) */ static av_always_inline av_const int16_t av_clip_int16_c(int a) { - if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF; else return a; } @@ -188,6 +206,20 @@ static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) else return (int32_t)a; } +/** + * Clip a signed integer into the -(2^p),(2^p-1) range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const int av_clip_intp2_c(int a, int p) +{ + if (((unsigned)a + (1 << p)) & ~((2 << p) - 1)) + return (a >> 31) ^ ((1 << p) - 1); + else + return a; +} + /** * Clip a signed integer to an unsigned power of two range. * @param a value to clip @@ -200,6 +232,17 @@ static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) else return a; } +/** + * Clear high bits from an unsigned integer starting with specific bit position + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) +{ + return a & ((1 << p) - 1); +} + /** * Add two signed 32-bit values with saturation. * @@ -291,6 +334,11 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); } +static av_always_inline av_const int av_parity_c(uint32_t v) +{ + return av_popcount(v) & 1; +} + #define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) #define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) @@ -311,13 +359,13 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) * to prevent undefined results. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ - val= GET_BYTE;\ + val= (GET_BYTE);\ {\ uint32_t top = (val & 128) >> 1;\ if ((val & 0xc0) == 0x80 || val >= 0xFE)\ ERROR\ while (val & top) {\ - int tmp= GET_BYTE - 128;\ + int tmp= (GET_BYTE) - 128;\ if(tmp>>6)\ ERROR\ val= (val<<6) + tmp;\ @@ -450,9 +498,15 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_clipl_int32 # define av_clipl_int32 av_clipl_int32_c #endif +#ifndef av_clip_intp2 +# define av_clip_intp2 av_clip_intp2_c +#endif #ifndef av_clip_uintp2 # define av_clip_uintp2 av_clip_uintp2_c #endif +#ifndef av_mod_uintp2 +# define av_mod_uintp2 av_mod_uintp2_c +#endif #ifndef av_sat_add32 # define av_sat_add32 av_sat_add32_c #endif @@ -471,3 +525,6 @@ static av_always_inline av_const int av_popcount64_c(uint64_t x) #ifndef av_popcount64 # define av_popcount64 av_popcount64_c #endif +#ifndef av_parity +# define av_parity av_parity_c +#endif diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.h b/ThirdParty/ffmpeg/include/libavutil/cpu.h similarity index 88% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.h rename to ThirdParty/ffmpeg/include/libavutil/cpu.h index 0ad400fef..cc4e30c4c 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/cpu.h +++ b/ThirdParty/ffmpeg/include/libavutil/cpu.h @@ -42,20 +42,20 @@ #define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions #define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions -// #if LIBAVUTIL_VERSION_MAJOR <52 -#define AV_CPU_FLAG_CMOV 0x1001000 ///< supports cmov instruction -// #else -// #define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction -// #endif +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction #define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions #define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 #define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 #define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 #define AV_CPU_FLAG_ARMV5TE (1 << 0) #define AV_CPU_FLAG_ARMV6 (1 << 1) @@ -63,6 +63,9 @@ #define AV_CPU_FLAG_VFP (1 << 3) #define AV_CPU_FLAG_VFPV3 (1 << 4) #define AV_CPU_FLAG_NEON (1 << 5) +#define AV_CPU_FLAG_ARMV8 (1 << 6) +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations +#define AV_CPU_FLAG_SETEND (1 <<16) /** * Return the flags which specify extensions supported by the CPU. diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.h b/ThirdParty/ffmpeg/include/libavutil/crc.h similarity index 93% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.h rename to ThirdParty/ffmpeg/include/libavutil/crc.h index f4219ca5b..ef8a7137e 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/crc.h +++ b/ThirdParty/ffmpeg/include/libavutil/crc.h @@ -24,6 +24,7 @@ #include #include #include "attributes.h" +#include "version.h" /** * @defgroup lavu_crc32 CRC32 @@ -39,7 +40,12 @@ typedef enum { AV_CRC_16_CCITT, AV_CRC_32_IEEE, AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_16_ANSI_LE, /*< reversed bitorder version of AV_CRC_16_ANSI */ +#if FF_API_CRC_BIG_TABLE AV_CRC_24_IEEE = 12, +#else + AV_CRC_24_IEEE, +#endif /* FF_API_CRC_BIG_TABLE */ AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ }AVCRCId; diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.h b/ThirdParty/ffmpeg/include/libavutil/des.h similarity index 90% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.h rename to ThirdParty/ffmpeg/include/libavutil/des.h index 2feb0468d..4cf11f5bc 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/des.h +++ b/ThirdParty/ffmpeg/include/libavutil/des.h @@ -24,16 +24,28 @@ #include -struct AVDES { +/** + * @defgroup lavu_des DES + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVDES { uint64_t round_keys[3][16]; int triple_des; -}; +} AVDES; + +/** + * Allocate an AVDES context. + */ +AVDES *av_des_alloc(void); /** * @brief Initializes an AVDES context. * * @param key_bits must be 64 or 192 * @param decrypt 0 for encryption/CBC-MAC, 1 for decryption + * @return zero on success, negative value otherwise */ int av_des_init(struct AVDES *d, const uint8_t *key, int key_bits, int decrypt); @@ -58,4 +70,8 @@ void av_des_crypt(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count, */ void av_des_mac(struct AVDES *d, uint8_t *dst, const uint8_t *src, int count); +/** + * @} + */ + #endif /* AVUTIL_DES_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.h b/ThirdParty/ffmpeg/include/libavutil/dict.h similarity index 58% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.h rename to ThirdParty/ffmpeg/include/libavutil/dict.h index 38f03a407..5b8d00339 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/dict.h +++ b/ThirdParty/ffmpeg/include/libavutil/dict.h @@ -31,6 +31,10 @@ #ifndef AVUTIL_DICT_H #define AVUTIL_DICT_H +#include + +#include "version.h" + /** * @addtogroup lavu_dict AVDictionary * @ingroup lavu_data @@ -46,30 +50,31 @@ * entries and finally av_dict_free() to free the dictionary * and all its contents. * - * @code - * AVDictionary *d = NULL; // "create" an empty dictionary - * av_dict_set(&d, "foo", "bar", 0); // add an entry - * - * char *k = av_strdup("key"); // if your strings are already allocated, - * char *v = av_strdup("value"); // you can avoid copying them like this - * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); - * - * AVDictionaryEntry *t = NULL; - * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { - * <....> // iterate over all entries in d - * } - * - * av_dict_free(&d); - * @endcode + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode * */ -#define AV_DICT_MATCH_CASE 1 -#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ #define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been - allocated with av_malloc() and children. */ + allocated with av_malloc() or another memory allocation function. */ #define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been - allocated with av_malloc() and chilren. */ + allocated with av_malloc() or another memory allocation function. */ #define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ @@ -84,13 +89,20 @@ typedef struct AVDictionary AVDictionary; /** * Get a dictionary entry with matching key. * + * The returned entry key or value must not be changed, or it will + * cause undefined behavior. + * + * To iterate through all the dictionary entries, you can set the matching key + * to the null string "" and set the AV_DICT_IGNORE_SUFFIX flag. + * * @param prev Set to the previous matching element to find the next. * If set to NULL the first matching element is returned. - * @param flags Allows case as well as suffix-insensitive comparisons. - * @return Found entry or NULL, changing key or value leads to undefined behavior. + * @param key matching key + * @param flags a collection of AV_DICT_* flags controlling how the entry is retrieved + * @return found entry or NULL in case no matching entry was found in the dictionary */ -AVDictionaryEntry * -av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *prev, int flags); /** * Get number of entries in dictionary. @@ -103,6 +115,9 @@ int av_dict_count(const AVDictionary *m); /** * Set the given entry in *pm, overwriting an existing entry. * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL * a dictionary struct is allocated and put in *pm. * @param key entry key to add to *pm (will be av_strduped depending on flags) @@ -113,7 +128,18 @@ int av_dict_count(const AVDictionary *m); int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); /** - * Parse the key/value pairs list and add to a dictionary. + * Convenience wrapper for av_dict_set that converts the value to a string + * and stores it. + * + * Note: If AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. + */ +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + +/** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * + * In case of failure, all the successfully set entries are stored in + * *pm. You may need to manually free the created dictionary. * * @param key_val_sep a 0-terminated list of characters used to separate * key from value @@ -136,8 +162,10 @@ int av_dict_parse_string(AVDictionary **pm, const char *str, * @param src pointer to source AVDictionary struct * @param flags flags to use when setting entries in *dst * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + * @return 0 on success, negative AVERROR code on failure. If dst was allocated + * by this function, callers should free the associated memory. */ -void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); /** * Free all the memory allocated for an AVDictionary struct @@ -145,6 +173,24 @@ void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); */ void av_dict_free(AVDictionary **m); +/** + * Get dictionary entries as a string. + * + * Create a string containing dictionary's entries. + * Such string may be passed back to av_dict_parse_string(). + * @note String is escaped with backslashes ('\'). + * + * @param[in] m dictionary + * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_dict_get_string(const AVDictionary *m, char **buffer, + const char key_val_sep, const char pairs_sep); + /** * @} */ diff --git a/ThirdParty/ffmpeg/include/libavutil/display.h b/ThirdParty/ffmpeg/include/libavutil/display.h new file mode 100644 index 000000000..c0cfee326 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/display.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2014 Vittorio Giovara + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DISPLAY_H +#define AVUTIL_DISPLAY_H + +#include + +/** + * The display transformation matrix specifies an affine transformation that + * should be applied to video frames for correct presentation. It is compatible + * with the matrices stored in the ISO/IEC 14496-12 container format. + * + * The data is a 3x3 matrix represented as a 9-element array: + * + * | a b u | + * (a, b, u, c, d, v, x, y, w) -> | c d v | + * | x y w | + * + * All numbers are stored in native endianness, as 16.16 fixed-point values, + * except for u, v and w, which are stored as 2.30 fixed-point values. + * + * The transformation maps a point (p, q) in the source (pre-transformation) + * frame to the point (p', q') in the destination (post-transformation) frame as + * follows: + * | a b u | + * (p, q, 1) . | c d v | = z * (p', q', 1) + * | x y w | + * + * The transformation can also be more explicitly written in components as + * follows: + * p' = (a * p + c * q + x) / z; + * q' = (b * p + d * q + y) / z; + * z = u * p + v * q + w + */ + +/** + * Extract the rotation component of the transformation matrix. + * + * @param matrix the transformation matrix + * @return the angle (in degrees) by which the transformation rotates the frame + * counterclockwise. The angle will be in range [-180.0, 180.0], + * or NaN if the matrix is singular. + * + * @note floating point numbers are inherently inexact, so callers are + * recommended to round the return value to nearest integer before use. + */ +double av_display_rotation_get(const int32_t matrix[9]); + +/** + * Initialize a transformation matrix describing a pure counterclockwise + * rotation by the specified angle (in degrees). + * + * @param matrix an allocated transformation matrix (will be fully overwritten + * by this function) + * @param angle rotation angle in degrees. + */ +void av_display_rotation_set(int32_t matrix[9], double angle); + +/** + * Flip the input matrix horizontally and/or vertically. + * + * @param matrix an allocated transformation matrix + * @param hflip whether the matrix should be flipped horizontally + * @param vflip whether the matrix should be flipped vertically + */ +void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip); + +#endif /* AVUTIL_DISPLAY_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.h b/ThirdParty/ffmpeg/include/libavutil/downmix_info.h similarity index 95% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.h rename to ThirdParty/ffmpeg/include/libavutil/downmix_info.h index c369891c0..221cf5bf9 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/downmix_info.h +++ b/ThirdParty/ffmpeg/include/libavutil/downmix_info.h @@ -95,11 +95,12 @@ typedef struct AVDownmixInfo { /** * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. * - * The side data is created and added to the frame if it's absent. + * If the side data is absent, it is created and added to the frame. * - * @param frame the frame for which the side data is to be obtained. + * @param frame the frame for which the side data is to be obtained or created * - * @return the AVDownmixInfo structure to be edited by the caller. + * @return the AVDownmixInfo structure to be edited by the caller, or NULL if + * the structure cannot be allocated. */ AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.h b/ThirdParty/ffmpeg/include/libavutil/error.h similarity index 87% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.h rename to ThirdParty/ffmpeg/include/libavutil/error.h index f3fd7bbff..71df4da35 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/error.h +++ b/ThirdParty/ffmpeg/include/libavutil/error.h @@ -70,6 +70,15 @@ #define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') #define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library #define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) +/* HTTP & RTSP errors */ +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0') +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') #define AV_ERROR_MAX_STRING_SIZE 64 diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.h b/ThirdParty/ffmpeg/include/libavutil/eval.h similarity index 97% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.h rename to ThirdParty/ffmpeg/include/libavutil/eval.h index a1d1fe345..dacd22b96 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/eval.h +++ b/ThirdParty/ffmpeg/include/libavutil/eval.h @@ -45,7 +45,7 @@ typedef struct AVExpr AVExpr; * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 * @param log_ctx parent logging context - * @return 0 in case of success, a negative value corresponding to an + * @return >= 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_expr_parse_and_eval(double *res, const char *s, @@ -68,7 +68,7 @@ int av_expr_parse_and_eval(double *res, const char *s, * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments * @param log_ctx parent logging context - * @return 0 in case of success, a negative value corresponding to an + * @return >= 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_expr_parse(AVExpr **expr, const char *s, @@ -102,7 +102,7 @@ void av_expr_free(AVExpr *e); * @param numstr a string representing a number, may contain one of * the International System number postfixes, for example 'K', 'M', * 'G'. If 'i' is appended after the postfix, powers of 2 are used - * instead of powers of 10. The 'B' postfix multiplies the value for + * instead of powers of 10. The 'B' postfix multiplies the value by * 8, and can be appended after another postfix or used alone. This * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. * @param tail if non-NULL puts here the pointer to the char next diff --git a/ThirdParty/ffmpeg/include/libavutil/ffversion.h b/ThirdParty/ffmpeg/include/libavutil/ffversion.h new file mode 100644 index 000000000..983454d71 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/ffversion.h @@ -0,0 +1,5 @@ +/* Automatically generated by version.sh, do not manually edit! */ +#ifndef AVUTIL_FFVERSION_H +#define AVUTIL_FFVERSION_H +#define FFMPEG_VERSION "n3.0.2" +#endif /* AVUTIL_FFVERSION_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.h b/ThirdParty/ffmpeg/include/libavutil/fifo.h similarity index 77% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.h rename to ThirdParty/ffmpeg/include/libavutil/fifo.h index 849b9a6b8..dc7bc6f0d 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/fifo.h +++ b/ThirdParty/ffmpeg/include/libavutil/fifo.h @@ -41,12 +41,26 @@ typedef struct AVFifoBuffer { */ AVFifoBuffer *av_fifo_alloc(unsigned int size); +/** + * Initialize an AVFifoBuffer. + * @param nmemb number of elements + * @param size size of the single element + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc_array(size_t nmemb, size_t size); + /** * Free an AVFifoBuffer. * @param f AVFifoBuffer to free */ void av_fifo_free(AVFifoBuffer *f); +/** + * Free an AVFifoBuffer and reset pointer to NULL. + * @param f AVFifoBuffer to free + */ +void av_fifo_freep(AVFifoBuffer **f); + /** * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. * @param f AVFifoBuffer to reset @@ -59,7 +73,7 @@ void av_fifo_reset(AVFifoBuffer *f); * @param f AVFifoBuffer to read from * @return size */ -int av_fifo_size(AVFifoBuffer *f); +int av_fifo_size(const AVFifoBuffer *f); /** * Return the amount of space in bytes in the AVFifoBuffer, that is the @@ -67,7 +81,28 @@ int av_fifo_size(AVFifoBuffer *f); * @param f AVFifoBuffer to write into * @return size */ -int av_fifo_space(AVFifoBuffer *f); +int av_fifo_space(const AVFifoBuffer *f); + +/** + * Feed data at specific position from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param offset offset from current read position + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek_at(AVFifoBuffer *f, void *dest, int offset, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * Similar as av_fifo_gereric_read but without discarding data. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_peek(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); /** * Feed data from an AVFifoBuffer to a user-supplied callback. diff --git a/ThirdParty/ffmpeg/include/libavutil/file.h b/ThirdParty/ffmpeg/include/libavutil/file.h new file mode 100644 index 000000000..e931be71e --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/file.h @@ -0,0 +1,68 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +av_warn_unused_result +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +/** + * Wrapper to work around the lack of mkstemp() on mingw. + * Also, tries to create file in /tmp first, if possible. + * *prefix can be a character constant; *filename will be allocated internally. + * @return file descriptor of opened file (or negative value corresponding to an + * AVERROR code on error) + * and opened file name in **filename. + * @note On very old libcs it is necessary to set a secure umask before + * calling this, av_tempfile() can't call umask itself as it is used in + * libraries and could interfere with the calling application. + */ +int av_tempfile(const char *prefix, char **filename, int log_offset, void *log_ctx); + +#endif /* AVUTIL_FILE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.h b/ThirdParty/ffmpeg/include/libavutil/frame.h similarity index 83% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.h rename to ThirdParty/ffmpeg/include/libavutil/frame.h index 9fedba863..8dc404907 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/frame.h +++ b/ThirdParty/ffmpeg/include/libavutil/frame.h @@ -33,32 +33,10 @@ #include "dict.h" #include "rational.h" #include "samplefmt.h" +#include "pixfmt.h" #include "version.h" -enum AVColorSpace{ - AVCOL_SPC_RGB = 0, - AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B - AVCOL_SPC_UNSPECIFIED = 2, - AVCOL_SPC_FCC = 4, - AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 - AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above - AVCOL_SPC_SMPTE240M = 7, - AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 - AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system - AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system - AVCOL_SPC_NB , ///< Not part of ABI -}; -#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG - -enum AVColorRange{ - AVCOL_RANGE_UNSPECIFIED = 0, - AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges - AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges - AVCOL_RANGE_NB , ///< Not part of ABI -}; - - /** * @defgroup lavu_frame AVFrame * @ingroup lavu_data @@ -92,13 +70,83 @@ enum AVFrameSideDataType { * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. */ AV_FRAME_DATA_DOWNMIX_INFO, + /** + * ReplayGain information in the form of the AVReplayGain struct. + */ + AV_FRAME_DATA_REPLAYGAIN, + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_FRAME_DATA_DISPLAYMATRIX, + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + */ + AV_FRAME_DATA_AFD, + /** + * Motion vectors exported by some codecs (on demand through the export_mvs + * flag set in the libavcodec AVCodecContext flags2 option). + * The data is the AVMotionVector struct defined in + * libavutil/motion_vector.h. + */ + AV_FRAME_DATA_MOTION_VECTORS, + /** + * Recommmends skipping the specified number of samples. This is exported + * only if the "skip_manual" AVOption is set in libavcodec. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_FRAME_DATA_SKIP_SAMPLES, + /** + * This side data must be associated with an audio frame and corresponds to + * enum AVAudioServiceType defined in avcodec.h. + */ + AV_FRAME_DATA_AUDIO_SERVICE_TYPE, + /** + * Mastering display metadata associated with a video frame. The payload is + * an AVMasteringDisplayMetadata type and contains information about the + * mastering display color volume. + */ + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, + /** + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. + * This is set on the first frame of a GOP that has a temporal reference of 0. + */ + AV_FRAME_DATA_GOP_TIMECODE }; +enum AVActiveFormatDescription { + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15, +}; + + +/** + * Structure to hold side data for an AVFrame. + * + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ typedef struct AVFrameSideData { enum AVFrameSideDataType type; uint8_t *data; int size; AVDictionary *metadata; + AVBufferRef *buf; } AVFrameSideData; /** @@ -150,7 +198,7 @@ typedef struct AVFrame { * For audio, only linesize[0] may be set. For planar audio, each channel * plane must be the same size. * - * For video the linesizes should be multiplies of the CPUs alignment + * For video the linesizes should be multiples of the CPUs alignment * preference, this is 16 or 32 for modern desktop CPUs. * Some code requires such alignment other code can be slower without * correct alignment, for yet other it makes no difference. @@ -203,11 +251,6 @@ typedef struct AVFrame { */ enum AVPictureType pict_type; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - uint8_t *base[AV_NUM_DATA_POINTERS]; -#endif - /** * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. */ @@ -224,7 +267,7 @@ typedef struct AVFrame { int64_t pkt_pts; /** - * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isnt used) + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) * This is also the Presentation time of this AVFrame calculated from * only AVPacket.dts values without pts values. */ @@ -244,78 +287,17 @@ typedef struct AVFrame { */ int quality; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - int reference; - - /** - * QP table - */ - attribute_deprecated - int8_t *qscale_table; - /** - * QP store stride - */ - attribute_deprecated - int qstride; - - attribute_deprecated - int qscale_type; - - /** - * mbskip_table[mb]>=1 if MB didn't change - * stride= mb_width = (width+15)>>4 - */ - attribute_deprecated - uint8_t *mbskip_table; - - /** - * motion vector table - * @code - * example: - * int mv_sample_log2= 4 - motion_subsample_log2; - * int mb_width= (width+15)>>4; - * int mv_stride= (mb_width << mv_sample_log2) + 1; - * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; - * @endcode - */ - attribute_deprecated - int16_t (*motion_val[2])[2]; - - /** - * macroblock type table - * mb_type_base + mb_width + 2 - */ - attribute_deprecated - uint32_t *mb_type; - - /** - * DCT coefficients - */ - attribute_deprecated - short *dct_coeff; - - /** - * motion reference frame index - * the order in which these are stored can depend on the codec. - */ - attribute_deprecated - int8_t *ref_index[2]; -#endif - /** * for some private data of the user */ void *opaque; +#if FF_API_ERROR_FRAME /** - * error + * @deprecated unused */ - uint64_t error[AV_NUM_DATA_POINTERS]; - -#if FF_API_AVFRAME_LAVC attribute_deprecated - int type; + uint64_t error[AV_NUM_DATA_POINTERS]; #endif /** @@ -339,17 +321,6 @@ typedef struct AVFrame { */ int palette_has_changed; -#if FF_API_AVFRAME_LAVC - attribute_deprecated - int buffer_hints; - - /** - * Pan scan. - */ - attribute_deprecated - struct AVPanScan *pan_scan; -#endif - /** * reordered opaque 64bit (generally an integer or a double precision float * PTS but can be anything). @@ -361,25 +332,6 @@ typedef struct AVFrame { */ int64_t reordered_opaque; -#if FF_API_AVFRAME_LAVC - /** - * @deprecated this field is unused - */ - attribute_deprecated void *hwaccel_picture_private; - - attribute_deprecated - struct AVCodecContext *owner; - attribute_deprecated - void *thread_opaque; - - /** - * log2 of the size of the block which a single vector in motion_val represents: - * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) - */ - attribute_deprecated - uint8_t motion_subsample_log2; -#endif - /** * Sample rate of the audio data. */ @@ -392,7 +344,9 @@ typedef struct AVFrame { /** * AVBuffer references backing the data for this frame. If all elements of - * this array are NULL, then this frame is not reference counted. + * this array are NULL, then this frame is not reference counted. This array + * must be filled contiguously -- if buf[i] is non-NULL then buf[j] must + * also be non-NULL for all j < i. * * There may be at most one AVBuffer per data plane, so for video this array * always contains all the references. For planar audio with more than @@ -443,9 +397,33 @@ typedef struct AVFrame { */ int flags; + /** + * MPEG vs JPEG YUV range. + * It must be accessed using av_frame_get_color_range() and + * av_frame_set_color_range(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + enum AVColorPrimaries color_primaries; + + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * It must be accessed using av_frame_get_colorspace() and + * av_frame_set_colorspace(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + enum AVChromaLocation chroma_location; + /** * frame timestamp estimated using various heuristics, in stream time base - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_best_effort_timestamp(frame) * - encoding: unused * - decoding: set by libavcodec, read by user. @@ -454,7 +432,7 @@ typedef struct AVFrame { /** * reordered pos from the last AVPacket that has been input into the decoder - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_pkt_pos(frame) * - encoding: unused * - decoding: Read by user. @@ -464,7 +442,7 @@ typedef struct AVFrame { /** * duration of the corresponding packet, expressed in * AVStream->time_base units, 0 if unknown. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_pkt_duration(frame) * - encoding: unused * - decoding: Read by user. @@ -473,7 +451,7 @@ typedef struct AVFrame { /** * metadata. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_metadata(frame) * - encoding: Set by user. * - decoding: Set by libavcodec. @@ -484,7 +462,7 @@ typedef struct AVFrame { * decode error flags of the frame, set to a combination of * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there * were errors during the decoding. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_decode_error_flags(frame) * - encoding: unused * - decoding: set by libavcodec, read by user. @@ -495,7 +473,7 @@ typedef struct AVFrame { /** * number of audio channels, only used for audio. - * Code outside libavcodec should access this field using: + * Code outside libavutil should access this field using: * av_frame_get_channels(frame) * - encoding: unused * - decoding: Read by user. @@ -512,35 +490,34 @@ typedef struct AVFrame { */ int pkt_size; +#if FF_API_FRAME_QP /** - * YUV colorspace type. - * It must be accessed using av_frame_get_colorspace() and - * av_frame_set_colorspace(). - * - encoding: Set by user - * - decoding: Set by libavcodec + * QP table + * Not to be accessed directly from outside libavutil */ - enum AVColorSpace colorspace; - + attribute_deprecated + int8_t *qscale_table; /** - * MPEG vs JPEG YUV range. - * It must be accessed using av_frame_get_color_range() and - * av_frame_set_color_range(). - * - encoding: Set by user - * - decoding: Set by libavcodec + * QP store stride + * Not to be accessed directly from outside libavutil */ - enum AVColorRange color_range; + attribute_deprecated + int qstride; + attribute_deprecated + int qscale_type; /** * Not to be accessed directly from outside libavutil */ AVBufferRef *qp_table_buf; +#endif } AVFrame; /** * Accessors for some AVFrame fields. * The position of these field in the structure is not part of the ABI, - * they should not be accessed directly outside libavcodec. + * they should not be accessed directly outside libavutil. */ int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame); void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val); @@ -561,8 +538,10 @@ void av_frame_set_decode_error_flags (AVFrame *frame, int val); int av_frame_get_pkt_size(const AVFrame *frame); void av_frame_set_pkt_size(AVFrame *frame, int val); AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); +#if FF_API_FRAME_QP int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); +#endif enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); enum AVColorRange av_frame_get_color_range(const AVFrame *frame); @@ -623,7 +602,7 @@ AVFrame *av_frame_clone(const AVFrame *src); void av_frame_unref(AVFrame *frame); /** - * Move everythnig contained in src to dst and reset src. + * Move everything contained in src to dst and reset src. */ void av_frame_move_ref(AVFrame *dst, AVFrame *src); @@ -726,6 +705,17 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); +/** + * If side data of the supplied type exists in the frame, free it and remove it + * from the frame. + */ +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); + +/** + * @return a string identifying the side data type + */ +const char *av_frame_side_data_name(enum AVFrameSideDataType type); + /** * @} */ diff --git a/ThirdParty/ffmpeg/include/libavutil/hash.h b/ThirdParty/ffmpeg/include/libavutil/hash.h new file mode 100644 index 000000000..d4bcbf8cc --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/hash.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2013 Reimar Döffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HASH_H +#define AVUTIL_HASH_H + +#include + +struct AVHashContext; + +/** + * Allocate a hash context for the algorithm specified by name. + * + * @return >= 0 for success, a negative error code for failure + * @note The context is not initialized, you must call av_hash_init(). + */ +int av_hash_alloc(struct AVHashContext **ctx, const char *name); + +/** + * Get the names of available hash algorithms. + * + * This function can be used to enumerate the algorithms. + * + * @param i index of the hash algorithm, starting from 0 + * @return a pointer to a static string or NULL if i is out of range + */ +const char *av_hash_names(int i); + +/** + * Get the name of the algorithm corresponding to the given hash context. + */ +const char *av_hash_get_name(const struct AVHashContext *ctx); + +/** + * Maximum value that av_hash_get_size will currently return. + * + * You can use this if you absolutely want or need to use static allocation + * and are fine with not supporting hashes newly added to libavutil without + * recompilation. + * Note that you still need to check against av_hash_get_size, adding new hashes + * with larger sizes will not be considered an ABI change and should not cause + * your code to overflow a buffer. + */ +#define AV_HASH_MAX_SIZE 64 + +/** + * Get the size of the resulting hash value in bytes. + * + * The pointer passed to av_hash_final have space for at least this many bytes. + */ +int av_hash_get_size(const struct AVHashContext *ctx); + +/** + * Initialize or reset a hash context. + */ +void av_hash_init(struct AVHashContext *ctx); + +/** + * Update a hash context with additional data. + */ +void av_hash_update(struct AVHashContext *ctx, const uint8_t *src, int len); + +/** + * Finalize a hash context and compute the actual hash value. + */ +void av_hash_final(struct AVHashContext *ctx, uint8_t *dst); + +/** + * Finalize a hash context and compute the actual hash value. + * If size is smaller than the hash size, the hash is truncated; + * if size is larger, the buffer is padded with 0. + */ +void av_hash_final_bin(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a hex string. + * The string is always 0-terminated. + * If size is smaller than 2 * hash_size + 1, the hex string is truncated. + */ +void av_hash_final_hex(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Finalize a hash context and compute the actual hash value as a base64 string. + * The string is always 0-terminated. + * If size is smaller than AV_BASE64_SIZE(hash_size), the base64 string is + * truncated. + */ +void av_hash_final_b64(struct AVHashContext *ctx, uint8_t *dst, int size); + +/** + * Free hash context. + */ +void av_hash_freep(struct AVHashContext **ctx); + +#endif /* AVUTIL_HASH_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/hmac.h b/ThirdParty/ffmpeg/include/libavutil/hmac.h new file mode 100644 index 000000000..576a0a4fb --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/hmac.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2012 Martin Storsjo + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HMAC_H +#define AVUTIL_HMAC_H + +#include + +#include "version.h" +/** + * @defgroup lavu_hmac HMAC + * @ingroup lavu_crypto + * @{ + */ + +enum AVHMACType { + AV_HMAC_MD5, + AV_HMAC_SHA1, + AV_HMAC_SHA224, + AV_HMAC_SHA256, + AV_HMAC_SHA384 = 12, + AV_HMAC_SHA512, +}; + +typedef struct AVHMAC AVHMAC; + +/** + * Allocate an AVHMAC context. + * @param type The hash function used for the HMAC. + */ +AVHMAC *av_hmac_alloc(enum AVHMACType type); + +/** + * Free an AVHMAC context. + * @param ctx The context to free, may be NULL + */ +void av_hmac_free(AVHMAC *ctx); + +/** + * Initialize an AVHMAC context with an authentication key. + * @param ctx The HMAC context + * @param key The authentication key + * @param keylen The length of the key, in bytes + */ +void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); + +/** + * Hash data with the HMAC. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + */ +void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output the HMAC digest. + * @param ctx The HMAC context + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); + +/** + * Hash an array of data with a key. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + * @param key The authentication key + * @param keylen The length of the key, in bytes + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, + const uint8_t *key, unsigned int keylen, + uint8_t *out, unsigned int outlen); + +/** + * @} + */ + +#endif /* AVUTIL_HMAC_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.h b/ThirdParty/ffmpeg/include/libavutil/imgutils.h similarity index 93% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.h rename to ThirdParty/ffmpeg/include/libavutil/imgutils.h index ab32d667d..23282a38f 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/imgutils.h +++ b/ThirdParty/ffmpeg/include/libavutil/imgutils.h @@ -29,6 +29,7 @@ #include "avutil.h" #include "pixdesc.h" +#include "rational.h" /** * Compute the max pixel step for each plane of an image with a @@ -190,7 +191,19 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size, */ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); -int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); +/** + * Check if the given sample aspect ratio of an image is valid. + * + * It is considered invalid if the denominator is 0 or if applying the ratio + * to the image size would make the smaller dimension less than 1. If the + * sar numerator is 0, it is considered unknown and will return as valid. + * + * @param w width of the image + * @param h height of the image + * @param sar sample aspect ratio of the image + * @return 0 if valid, a negative AVERROR code otherwise + */ +int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar); /** * @} diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat.h b/ThirdParty/ffmpeg/include/libavutil/intfloat.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intfloat.h rename to ThirdParty/ffmpeg/include/libavutil/intfloat.h diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intreadwrite.h b/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h similarity index 98% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intreadwrite.h rename to ThirdParty/ffmpeg/include/libavutil/intreadwrite.h index 7ee697755..51fbe30a2 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/intreadwrite.h +++ b/ThirdParty/ffmpeg/include/libavutil/intreadwrite.h @@ -50,6 +50,14 @@ typedef union { * AV_[RW][BLN](16|24|32|48|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. * Preprocessor symbols must be defined, even if these are implemented * as inline functions. + * + * R/W means read/write, B/L/N means big/little/native endianness. + * The following macros require aligned access, compared to their + * unaligned variants: AV_(COPY|SWAP|ZERO)(64|128), AV_[RW]N[8-64]A. + * Incorrect usage may range from abysmal performance to crash + * depending on the platform. + * + * The unaligned variants are AV_[RW][BLN][8-64] and AV_COPY*U. */ #ifdef HAVE_AV_CONFIG_H diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lfg.h b/ThirdParty/ffmpeg/include/libavutil/lfg.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/lfg.h rename to ThirdParty/ffmpeg/include/libavutil/lfg.h diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.h b/ThirdParty/ffmpeg/include/libavutil/log.h similarity index 87% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.h rename to ThirdParty/ffmpeg/include/libavutil/log.h index f16e38221..321748cd8 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/log.h +++ b/ThirdParty/ffmpeg/include/libavutil/log.h @@ -24,6 +24,7 @@ #include #include "avutil.h" #include "attributes.h" +#include "version.h" typedef enum { AV_CLASS_CATEGORY_NA = 0, @@ -46,6 +47,16 @@ typedef enum { AV_CLASS_CATEGORY_NB, ///< not part of ABI/API }AVClassCategory; +#define AV_IS_INPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) + struct AVOptionRanges; /** @@ -185,12 +196,27 @@ typedef struct AVClass { */ #define AV_LOG_DEBUG 48 -#define AV_LOG_MAX_OFFSET (AV_LOG_DEBUG - AV_LOG_QUIET) +/** + * Extremely verbose debugging, useful for libav* development. + */ +#define AV_LOG_TRACE 56 + +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET) /** * @} */ +/** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + */ +#define AV_LOG_C(x) ((x) << 8) + /** * Send the specified message to the log if the level is less than or equal * to the current av_log_level. By default, all logging messages are sent to @@ -199,7 +225,7 @@ typedef struct AVClass { * @see av_log_set_callback * * @param avcl A pointer to an arbitrary struct of which the first field is a - * pointer to an AVClass struct. + * pointer to an AVClass struct or NULL if general log. * @param level The importance level of the message expressed using a @ref * lavu_log_constants "Logging Constant". * @param fmt The format string (printf-compatible) that specifies how @@ -283,7 +309,7 @@ AVClassCategory av_default_get_category(void *ptr); /** * Format a line of log the same way as the default callback. - * @param line buffer to receive the formated line + * @param line buffer to receive the formatted line * @param line_size size of the buffer * @param print_prefix used to store whether the prefix must be printed; * must point to a persistent integer initially set to 1 @@ -291,8 +317,10 @@ AVClassCategory av_default_get_category(void *ptr); void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix); +#if FF_API_DLOG /** * av_dlog macros + * @deprecated unused * Useful to print debug messages that shouldn't get compiled in normally. */ @@ -301,6 +329,7 @@ void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, #else # define av_dlog(pctx, ...) do { if (0) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0) #endif +#endif /* FF_API_DLOG */ /** * Skip repeated messages, this requires the user app to use av_log() instead of @@ -311,7 +340,17 @@ void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end */ #define AV_LOG_SKIP_REPEATED 1 + +/** + * Include the log severity in messages originating from codecs. + * + * Results in messages such as: + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts + */ +#define AV_LOG_PRINT_LEVEL 2 + void av_log_set_flags(int arg); +int av_log_get_flags(void); /** * @} diff --git a/ThirdParty/ffmpeg/include/libavutil/lzo.h b/ThirdParty/ffmpeg/include/libavutil/lzo.h new file mode 100644 index 000000000..c03403992 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/macros.h b/ThirdParty/ffmpeg/include/libavutil/macros.h similarity index 96% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/macros.h rename to ThirdParty/ffmpeg/include/libavutil/macros.h index 446532377..2007ee561 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/macros.h +++ b/ThirdParty/ffmpeg/include/libavutil/macros.h @@ -45,4 +45,6 @@ #define AV_PRAGMA(s) _Pragma(#s) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + #endif /* AVUTIL_MACROS_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h b/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h new file mode 100644 index 000000000..936533fec --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/mastering_display_metadata.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2016 Neil Birkbeck + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MASTERING_DISPLAY_METADATA_H +#define AVUTIL_MASTERING_DISPLAY_METADATA_H + +#include "frame.h" +#include "rational.h" + + +/** + * Mastering display metadata capable of representing the color volume of + * the display used to master the content (SMPTE 2086:2014). + * + * To be used as payload of a AVFrameSideData or AVPacketSideData with the + * appropriate type. + * + * @note The struct should be allocated with av_mastering_display_metadata_alloc() + * and its size is not a part of the public ABI. + */ +typedef struct AVMasteringDisplayMetadata { + /** + * CIE 1931 xy chromaticity coords of color primaries (r, g, b order). + */ + AVRational display_primaries[3][2]; + + /** + * CIE 1931 xy chromaticity coords of white point. + */ + AVRational white_point[2]; + + /** + * Min luminance of mastering display (cd/m^2). + */ + AVRational min_luminance; + + /** + * Max luminance of mastering display (cd/m^2). + */ + AVRational max_luminance; + + /** + * Flag indicating whether the display primaries (and white point) are set. + */ + int has_primaries; + + /** + * Flag indicating whether the luminance (min_ and max_) have been set. + */ + int has_luminance; + +} AVMasteringDisplayMetadata; + +/** + * Allocate an AVMasteringDisplayMetadata structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVMasteringDisplayMetadata filled with default values or NULL + * on failure. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_alloc(void); + +/** + * Allocate a complete AVMasteringDisplayMetadata and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVMasteringDisplayMetadata structure to be filled by caller. + */ +AVMasteringDisplayMetadata *av_mastering_display_metadata_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_MASTERING_DISPLAY_METADATA_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.h b/ThirdParty/ffmpeg/include/libavutil/mathematics.h similarity index 95% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.h rename to ThirdParty/ffmpeg/include/libavutil/mathematics.h index 88739e80b..57c44f845 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mathematics.h +++ b/ThirdParty/ffmpeg/include/libavutil/mathematics.h @@ -77,9 +77,10 @@ enum AVRounding { }; /** - * Return the greatest common divisor of a and b. - * If both a and b are 0 or either or both are <0 then behavior is - * undefined. + * Compute the greatest common divisor of a and b. + * + * @return gcd of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; + * if a == 0 and b == 0, returns 0. */ int64_t av_const av_gcd(int64_t a, int64_t b); @@ -146,7 +147,7 @@ int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int /** * Add a value to a timestamp. * - * This function gurantees that when the same value is repeatly added that + * This function guarantees that when the same value is repeatly added that * no accumulation of rounding errors occurs. * * @param ts Input timestamp diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/md5.h b/ThirdParty/ffmpeg/include/libavutil/md5.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/md5.h rename to ThirdParty/ffmpeg/include/libavutil/md5.h diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.h b/ThirdParty/ffmpeg/include/libavutil/mem.h similarity index 88% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.h rename to ThirdParty/ffmpeg/include/libavutil/mem.h index 703ce8193..d25b3229b 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/mem.h +++ b/ThirdParty/ffmpeg/include/libavutil/mem.h @@ -144,6 +144,7 @@ void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); * The situation is undefined according to POSIX and may crash with * some libc implementations. */ +av_warn_unused_result int av_reallocp(void *ptr, size_t size); /** @@ -240,6 +241,16 @@ av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t si */ char *av_strdup(const char *s) av_malloc_attrib; +/** + * Duplicate a substring of the string s. + * @param s string to be duplicated + * @param len the maximum length of the resulting string (not counting the + * terminating byte). + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + /** * Duplicate the buffer p. * @param p buffer to be duplicated @@ -253,6 +264,7 @@ void *av_memdup(const void *p, size_t size); * av_realloc() and set the pointer pointing to it to NULL. * @param ptr Pointer to the pointer to the memory block which should * be freed. + * @note passing a pointer to a NULL pointer is safe and leads to no action. * @see av_free() */ void av_freep(void *ptr); @@ -276,10 +288,26 @@ void av_freep(void *ptr); * @param tab_ptr pointer to the array to grow * @param nb_ptr pointer to the number of elements in the array * @param elem element to add - * @see av_dynarray2_add() + * @see av_dynarray_add_nofree(), av_dynarray2_add() */ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); +/** + * Add an element to a dynamic array. + * + * Function has the same functionality as av_dynarray_add(), + * but it doesn't free memory on fails. It returns error code + * instead and leave current buffer untouched. + * + * @param tab_ptr pointer to the array to grow + * @param nb_ptr pointer to the number of elements in the array + * @param elem element to add + * @return >=0 on success, negative otherwise. + * @see av_dynarray_add(), av_dynarray2_add() + */ +av_warn_unused_result +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); + /** * Add an element of size elem_size to a dynamic array. * @@ -299,7 +327,7 @@ void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); * the new added element is not filled. * @return pointer to the data of the element to copy in the new allocated space. * If NULL, the new allocated space is left uninitialized." - * @see av_dynarray_add() + * @see av_dynarray_add(), av_dynarray_add_nofree() */ void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data); @@ -356,6 +384,21 @@ void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); */ void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); +/** + * Allocate a buffer, reusing the given one if large enough. + * + * All newly allocated space is initially cleared + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); + /** * @} */ diff --git a/ThirdParty/ffmpeg/include/libavutil/motion_vector.h b/ThirdParty/ffmpeg/include/libavutil/motion_vector.h new file mode 100644 index 000000000..ec2955638 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/motion_vector.h @@ -0,0 +1,57 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MOTION_VECTOR_H +#define AVUTIL_MOTION_VECTOR_H + +#include + +typedef struct AVMotionVector { + /** + * Where the current macroblock comes from; negative value when it comes + * from the past, positive value when it comes from the future. + * XXX: set exact relative ref frame reference instead of a +/- 1 "direction". + */ + int32_t source; + /** + * Width and height of the block. + */ + uint8_t w, h; + /** + * Absolute source position. Can be outside the frame area. + */ + int16_t src_x, src_y; + /** + * Absolute destination position. Can be outside the frame area. + */ + int16_t dst_x, dst_y; + /** + * Extra flag information. + * Currently unused. + */ + uint64_t flags; + /** + * Motion vector + * src_x = dst_x + motion_x / motion_scale + * src_y = dst_y + motion_y / motion_scale + */ + int32_t motion_x, motion_y; + uint16_t motion_scale; +} AVMotionVector; + +#endif /* AVUTIL_MOTION_VECTOR_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.h b/ThirdParty/ffmpeg/include/libavutil/murmur3.h similarity index 64% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.h rename to ThirdParty/ffmpeg/include/libavutil/murmur3.h index c5ef96dcf..f29ed973e 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavcodec/faandct.h +++ b/ThirdParty/ffmpeg/include/libavutil/murmur3.h @@ -1,6 +1,5 @@ /* - * Floating point AAN DCT - * Copyright (c) 2003 Michael Niedermayer + * Copyright (C) 2013 Reimar Döffinger * * This file is part of FFmpeg. * @@ -19,19 +18,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -/** - * @file - * @brief - * Floating point AAN DCT - * @author Michael Niedermayer - */ - -#ifndef AVCODEC_FAANDCT_H -#define AVCODEC_FAANDCT_H +#ifndef AVUTIL_MURMUR3_H +#define AVUTIL_MURMUR3_H #include -void ff_faandct(int16_t *data); -void ff_faandct248(int16_t *data); +struct AVMurMur3 *av_murmur3_alloc(void); +void av_murmur3_init_seeded(struct AVMurMur3 *c, uint64_t seed); +void av_murmur3_init(struct AVMurMur3 *c); +void av_murmur3_update(struct AVMurMur3 *c, const uint8_t *src, int len); +void av_murmur3_final(struct AVMurMur3 *c, uint8_t dst[16]); -#endif /* AVCODEC_FAANDCT_H */ +#endif /* AVUTIL_MURMUR3_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/old_pix_fmts.h b/ThirdParty/ffmpeg/include/libavutil/old_pix_fmts.h similarity index 99% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/old_pix_fmts.h rename to ThirdParty/ffmpeg/include/libavutil/old_pix_fmts.h index 3ee8aec14..cd1ed7c19 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/old_pix_fmts.h +++ b/ThirdParty/ffmpeg/include/libavutil/old_pix_fmts.h @@ -44,8 +44,10 @@ PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.h b/ThirdParty/ffmpeg/include/libavutil/opt.h similarity index 75% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.h rename to ThirdParty/ffmpeg/include/libavutil/opt.h index cd1b18e4c..753434d62 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/opt.h +++ b/ThirdParty/ffmpeg/include/libavutil/opt.h @@ -33,6 +33,7 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" +#include "version.h" /** * @defgroup avoptions AVOptions @@ -212,7 +213,7 @@ * In some cases it may be more convenient to put all options into an * AVDictionary and call av_opt_set_dict() on it. A specific case of this * are the format/codec open functions in lavf/lavc which take a dictionary - * filled with option as a parameter. This allows to set some options + * filled with option as a parameter. This makes it possible to set some options * that cannot be set otherwise, since e.g. the input file format is not known * before the file is actually opened. */ @@ -226,6 +227,7 @@ enum AVOptionType{ AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL, AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_DICT, AV_OPT_TYPE_CONST = 128, AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'), ///< offset must point to two consecutive integers AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'), @@ -234,17 +236,7 @@ enum AVOptionType{ AV_OPT_TYPE_DURATION = MKBETAG('D','U','R',' '), AV_OPT_TYPE_COLOR = MKBETAG('C','O','L','R'), AV_OPT_TYPE_CHANNEL_LAYOUT = MKBETAG('C','H','L','A'), -#if FF_API_OLD_AVOPTIONS - FF_OPT_TYPE_FLAGS = 0, - FF_OPT_TYPE_INT, - FF_OPT_TYPE_INT64, - FF_OPT_TYPE_DOUBLE, - FF_OPT_TYPE_FLOAT, - FF_OPT_TYPE_STRING, - FF_OPT_TYPE_RATIONAL, - FF_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length - FF_OPT_TYPE_CONST=128, -#endif + AV_OPT_TYPE_BOOL = MKBETAG('B','O','O','L'), }; /** @@ -313,80 +305,69 @@ typedef struct AVOption { */ typedef struct AVOptionRange { const char *str; - double value_min, value_max; ///< For string ranges this represents the min/max length, for dimensions this represents the min/max pixel count - double component_min, component_max; ///< For string this represents the unicode range for chars, 0-127 limits to ASCII - int is_range; ///< if set to 1 the struct encodes a range, if set to 0 a single value + /** + * Value range. + * For string ranges this represents the min/max length. + * For dimensions this represents the min/max pixel count or width/height in multi-component case. + */ + double value_min, value_max; + /** + * Value's component range. + * For string this represents the unicode range for chars, 0-127 limits to ASCII. + */ + double component_min, component_max; + /** + * Range flag. + * If set to 1 the struct encodes a range, if set to 0 a single value. + */ + int is_range; } AVOptionRange; /** - * List of AVOptionRange structs + * List of AVOptionRange structs. */ typedef struct AVOptionRanges { + /** + * Array of option ranges. + * + * Most of option types use just one component. + * Following describes multi-component option types: + * + * AV_OPT_TYPE_IMAGE_SIZE: + * component index 0: range of pixel count (width * height). + * component index 1: range of width. + * component index 2: range of height. + * + * @note To obtain multi-component version of this structure, user must + * provide AV_OPT_MULTI_COMPONENT_RANGE to av_opt_query_ranges or + * av_opt_query_ranges_default function. + * + * Multi-component range can be read as in following example: + * + * @code + * int range_index, component_index; + * AVOptionRanges *ranges; + * AVOptionRange *range[3]; //may require more than 3 in the future. + * av_opt_query_ranges(&ranges, obj, key, AV_OPT_MULTI_COMPONENT_RANGE); + * for (range_index = 0; range_index < ranges->nb_ranges; range_index++) { + * for (component_index = 0; component_index < ranges->nb_components; component_index++) + * range[component_index] = ranges->range[ranges->nb_ranges * component_index + range_index]; + * //do something with range here. + * } + * av_opt_freep_ranges(&ranges); + * @endcode + */ AVOptionRange **range; + /** + * Number of ranges per component. + */ int nb_ranges; + /** + * Number of componentes. + */ + int nb_components; } AVOptionRanges; - -#if FF_API_FIND_OPT -/** - * Look for an option in obj. Look only for the options which - * have the flags set as specified in mask and flags (that is, - * for which it is the case that (opt->flags & mask) == flags). - * - * @param[in] obj a pointer to a struct whose first element is a - * pointer to an AVClass - * @param[in] name the name of the option to look for - * @param[in] unit the unit of the option to look for, or any if NULL - * @return a pointer to the option found, or NULL if no option - * has been found - * - * @deprecated use av_opt_find. - */ -attribute_deprecated -const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int mask, int flags); -#endif - -#if FF_API_OLD_AVOPTIONS -/** - * Set the field of obj with the given name to value. - * - * @param[in] obj A struct whose first element is a pointer to an - * AVClass. - * @param[in] name the name of the field to set - * @param[in] val The value to set. If the field is not of a string - * type, then the given string is parsed. - * SI postfixes and some named scalars are supported. - * If the field is of a numeric type, it has to be a numeric or named - * scalar. Behavior with more than one scalar and +- infix operators - * is undefined. - * If the field is of a flags type, it has to be a sequence of numeric - * scalars or named flags separated by '+' or '-'. Prefixing a flag - * with '+' causes it to be set without affecting the other flags; - * similarly, '-' unsets a flag. - * @param[out] o_out if non-NULL put here a pointer to the AVOption - * found - * @param alloc this parameter is currently ignored - * @return 0 if the value has been set, or an AVERROR code in case of - * error: - * AVERROR_OPTION_NOT_FOUND if no matching option exists - * AVERROR(ERANGE) if the value is out of range - * AVERROR(EINVAL) if the value is not valid - * @deprecated use av_opt_set() - */ -attribute_deprecated -int av_set_string3(void *obj, const char *name, const char *val, int alloc, const AVOption **o_out); - -attribute_deprecated const AVOption *av_set_double(void *obj, const char *name, double n); -attribute_deprecated const AVOption *av_set_q(void *obj, const char *name, AVRational n); -attribute_deprecated const AVOption *av_set_int(void *obj, const char *name, int64_t n); - -double av_get_double(void *obj, const char *name, const AVOption **o_out); -AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); -int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); -attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); -#endif - /** * Show the obj options. * @@ -405,10 +386,16 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); */ void av_opt_set_defaults(void *s); -#if FF_API_OLD_AVOPTIONS -attribute_deprecated +/** + * Set the values of all AVOption fields to their default values. Only these + * AVOption fields for which (opt->flags & mask) == flags will have their + * default applied to s. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + * @param mask combination of AV_OPT_FLAG_* + * @param flags combination of AV_OPT_FLAG_* + */ void av_opt_set_defaults2(void *s, int mask, int flags); -#endif /** * Parse the key/value pairs list in opts. For each key/value pair @@ -424,7 +411,7 @@ void av_opt_set_defaults2(void *s, int mask, int flags); * @return the number of successfully set key/value pairs, or a negative * value corresponding to an AVERROR code in case of error: * AVERROR(EINVAL) if opts cannot be parsed, - * the error code issued by av_set_string3() if a key/value pair + * the error code issued by av_opt_set() if a key/value pair * cannot be set */ int av_set_options_string(void *ctx, const char *opts, @@ -461,7 +448,7 @@ int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep); /** - * Free all string and binary options in obj. + * Free all allocated objects in obj. */ void av_opt_free(void *obj); @@ -491,6 +478,24 @@ int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) */ int av_opt_set_dict(void *obj, struct AVDictionary **options); + +/** + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags); + /** * Extract a key-value pair from the beginning of a string. * @@ -548,15 +553,28 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational * @} */ -#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the - given object first. */ +#define AV_OPT_SEARCH_CHILDREN (1 << 0) /**< Search in possible children of the + given object first. */ /** * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass * instead of a required pointer to a struct containing AVClass. This is * useful for searching for options without needing to allocate the corresponding * object. */ -#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 +#define AV_OPT_SEARCH_FAKE_OBJ (1 << 1) + +/** + * In av_opt_get, return NULL if the option has a pointer type and is set to NULL, + * rather than returning an empty string. + */ +#define AV_OPT_ALLOW_NULL (1 << 2) + +/** + * Allows av_opt_query_ranges and av_opt_query_ranges_default to return more than + * one component for certain option types. + * @see AVOptionRanges for details. + */ +#define AV_OPT_MULTI_COMPONENT_RANGE (1 << 12) /** * Look for an option in an object. Consider only options which @@ -576,7 +594,7 @@ int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational * was found. * * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable - * directly with av_set_string3(). Use special calls which take an options + * directly with av_opt_set(). Use special calls which take an options * AVDictionary (e.g. avformat_open_input()) to set options found with this * flag. */ @@ -616,7 +634,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, * or NULL * @return next AVOption or NULL */ -const AVOption *av_opt_next(void *obj, const AVOption *prev); +const AVOption *av_opt_next(const void *obj, const AVOption *prev); /** * Iterate over AVOptions-enabled children of obj. @@ -660,16 +678,21 @@ const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *pre * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid */ -int av_opt_set (void *obj, const char *name, const char *val, int search_flags); -int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); -int av_opt_set_double(void *obj, const char *name, double val, int search_flags); -int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); -int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double (void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags); int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags); int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags); int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags); int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags); +/** + * @note Any old dictionary present is discarded and replaced with a copy of the new one. The + * caller still owns val is and responsible for freeing it. + */ +int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags); /** * Set a binary option to an integer list. @@ -686,6 +709,7 @@ int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, in AVERROR(EINVAL) : \ av_opt_set_bin(obj, name, (const uint8_t *)(val), \ av_int_list_length(val, term) * sizeof(*(val)), flags)) + /** * @} */ @@ -704,16 +728,25 @@ int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, in */ /** * @note the returned string will be av_malloc()ed and must be av_free()ed by the caller + * + * @note if AV_OPT_ALLOW_NULL is set in search_flags in av_opt_get, and the option has + * AV_OPT_TYPE_STRING or AV_OPT_TYPE_BINARY and is set to NULL, *out_val will be set + * to NULL instead of an allocated empty string. */ -int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); -int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); -int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); -int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out); int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt); int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt); int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val); int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout); +/** + * @param[out] out_val The returned dictionary is a copy of the actual value and must + * be freed with av_dict_free() by the caller + */ +int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val); /** * @} */ @@ -739,13 +772,26 @@ void av_opt_freep_ranges(AVOptionRanges **ranges); * * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges * * The result must be freed with av_opt_freep_ranges. * - * @return >= 0 on success, a negative errro code otherwise + * @return number of compontents returned on success, a negative errro code otherwise */ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); +/** + * Copy options from src object into dest object. + * + * Options that require memory allocation (e.g. string or binary) are malloc'ed in dest object. + * Original memory allocated for such options is freed unless both src and dest options points to the same memory. + * + * @param dest Object to copy from + * @param src Object to copy into + * @return 0 on success, negative on error + */ +int av_opt_copy(void *dest, const void *src); + /** * Get a default list of allowed ranges for the given option. * @@ -754,13 +800,64 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags * * @param flags is a bitmask of flags, undefined flags should not be set and should be ignored * AV_OPT_SEARCH_FAKE_OBJ indicates that the obj is a double pointer to a AVClass instead of a full instance + * AV_OPT_MULTI_COMPONENT_RANGE indicates that function may return more than one component, @see AVOptionRanges * * The result must be freed with av_opt_free_ranges. * - * @return >= 0 on success, a negative errro code otherwise + * @return number of compontents returned on success, a negative errro code otherwise */ int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); +/** + * Check if given option is set to its default value. + * + * Options o must belong to the obj. This function must not be called to check child's options state. + * @see av_opt_is_set_to_default_by_name(). + * + * @param obj AVClass object to check option on + * @param o option to be checked + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default(void *obj, const AVOption *o); + +/** + * Check if given option is set to its default value. + * + * @param obj AVClass object to check option on + * @param name option name + * @param search_flags combination of AV_OPT_SEARCH_* + * @return >0 when option is set to its default, + * 0 when option is not set its default, + * <0 on error + */ +int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags); + + +#define AV_OPT_SERIALIZE_SKIP_DEFAULTS 0x00000001 ///< Serialize options that are not set to default values only. +#define AV_OPT_SERIALIZE_OPT_FLAGS_EXACT 0x00000002 ///< Serialize options that exactly match opt_flags only. + +/** + * Serialize object's options. + * + * Create a string containing object's serialized options. + * Such string may be passed back to av_opt_set_from_string() in order to restore option values. + * A key/value or pairs separator occurring in the serialized value or + * name string are escaped through the av_escape() function. + * + * @param[in] obj AVClass object to serialize + * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) + * @param[in] flags combination of AV_OPT_SERIALIZE_* flags + * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep character used to separate key from value + * @param[in] pairs_sep character used to separate two pairs from each other + * @return >= 0 on success, negative on error + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + */ +int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer, + const char key_val_sep, const char pairs_sep); /** * @} */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.h b/ThirdParty/ffmpeg/include/libavutil/parseutils.h similarity index 84% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.h rename to ThirdParty/ffmpeg/include/libavutil/parseutils.h index 3eb35fc05..e66d24b76 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/parseutils.h +++ b/ThirdParty/ffmpeg/include/libavutil/parseutils.h @@ -98,6 +98,19 @@ int av_parse_video_rate(AVRational *rate, const char *str); int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, void *log_ctx); +/** + * Get the name of a color from the internal table of hard-coded named + * colors. + * + * This function is meant to enumerate the color names recognized by + * av_parse_color(). + * + * @param color_idx index of the requested color, starting from 0 + * @param rgbp if not NULL, will point to a 3-elements array with the color value in RGB + * @return the color name string or NULL if color_idx is not in the array + */ +const char *av_get_known_color_name(int color_idx, const uint8_t **rgb); + /** * Parse timestr and return in *time a corresponding number of * microseconds. @@ -127,37 +140,11 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, * @endcode * @param duration flag which tells how to interpret timestr, if not * zero timestr is interpreted as a duration, otherwise as a date - * @return 0 in case of success, a negative value corresponding to an + * @return >= 0 in case of success, a negative value corresponding to an * AVERROR code otherwise */ int av_parse_time(int64_t *timeval, const char *timestr, int duration); -/** - * Parse the input string p according to the format string fmt and - * store its results in the structure dt. - * This implementation supports only a subset of the formats supported - * by the standard strptime(). - * - * In particular it actually supports the parameters: - * - %H: the hour as a decimal number, using a 24-hour clock, in the - * range '00' through '23' - * - %J: hours as a decimal number, in the range '0' through INT_MAX - * - %M: the minute as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %S: the second as a decimal number, using a 24-hour clock, in the - * range '00' through '59' - * - %Y: the year as a decimal number, using the Gregorian calendar - * - %m: the month as a decimal number, in the range '1' through '12' - * - %d: the day of the month as a decimal number, in the range '1' - * through '31' - * - %%: a literal '%' - * - * @return a pointer to the first character not processed in this - * function call, or NULL in case the function fails to match all of - * the fmt string and therefore an error occurred - */ -char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); - /** * Attempt to find a specific tag in a URL. * @@ -166,6 +153,38 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); */ int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); +/** + * Simplified version of strptime + * + * Parse the input string p according to the format string fmt and + * store its results in the structure dt. + * This implementation supports only a subset of the formats supported + * by the standard strptime(). + * + * The supported input field descriptors are listed below. + * - %H: the hour as a decimal number, using a 24-hour clock, in the + * range '00' through '23' + * - %J: hours as a decimal number, in the range '0' through INT_MAX + * - %M: the minute as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %S: the second as a decimal number, using a 24-hour clock, in the + * range '00' through '59' + * - %Y: the year as a decimal number, using the Gregorian calendar + * - %m: the month as a decimal number, in the range '1' through '12' + * - %d: the day of the month as a decimal number, in the range '1' + * through '31' + * - %T: alias for '%H:%M:%S' + * - %%: a literal '%' + * + * @return a pointer to the first character not processed in this function + * call. In case the input string contains more characters than + * required by the format string the return value points right after + * the last consumed input character. In case the whole input string + * is consumed the return value points to the null byte at the end of + * the string. On failure NULL is returned. + */ +char *av_small_strptime(const char *p, const char *fmt, struct tm *dt); + /** * Convert the decomposed UTC time in tm to a time_t value. */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.h b/ThirdParty/ffmpeg/include/libavutil/pixdesc.h similarity index 54% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.h rename to ThirdParty/ffmpeg/include/libavutil/pixdesc.h index e88bf9b92..b1d218db4 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/pixdesc.h +++ b/ThirdParty/ffmpeg/include/libavutil/pixdesc.h @@ -26,24 +26,48 @@ #include "attributes.h" #include "pixfmt.h" +#include "version.h" -typedef struct AVComponentDescriptor{ - uint16_t plane :2; ///< which of the 4 planes contains the component +typedef struct AVComponentDescriptor { + /** + * Which of the 4 planes contains the component. + */ + int plane; /** - * Number of elements between 2 horizontally consecutive pixels minus 1. + * Number of elements between 2 horizontally consecutive pixels. * Elements are bits for bitstream formats, bytes otherwise. */ - uint16_t step_minus1 :3; + int step; /** - * Number of elements before the component of the first pixel plus 1. + * Number of elements before the component of the first pixel. * Elements are bits for bitstream formats, bytes otherwise. */ - uint16_t offset_plus1 :3; - uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value - uint16_t depth_minus1 :4; ///< number of bits in the component minus 1 -}AVComponentDescriptor; + int offset; + + /** + * Number of least significant bits that must be shifted away + * to get the value. + */ + int shift; + + /** + * Number of bits in the component. + */ + int depth; + +#if FF_API_PLUS1_MINUS1 + /** deprecated, use step instead */ + attribute_deprecated int step_minus1; + + /** deprecated, use depth instead */ + attribute_deprecated int depth_minus1; + + /** deprecated, use offset instead */ + attribute_deprecated int offset_plus1; +#endif +} AVComponentDescriptor; /** * Descriptor that unambiguously describes how the bits of a pixel are @@ -54,9 +78,9 @@ typedef struct AVComponentDescriptor{ * and all the YUV variants) AVPixFmtDescriptor just stores how values * are stored not what these values represent. */ -typedef struct AVPixFmtDescriptor{ +typedef struct AVPixFmtDescriptor { const char *name; - uint8_t nb_components; ///< The number of components each pixel has, (1-4) + uint8_t nb_components; ///< The number of components each pixel has, (1-4) /** * Amount to shift the luma width right to find the chroma width. @@ -65,7 +89,7 @@ typedef struct AVPixFmtDescriptor{ * The note above is needed to ensure rounding up. * This value only refers to the chroma components. */ - uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) + uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) /** * Amount to shift the luma height right to find the chroma height. @@ -75,18 +99,28 @@ typedef struct AVPixFmtDescriptor{ * This value only refers to the chroma components. */ uint8_t log2_chroma_h; - uint8_t flags; + + /** + * Combination of AV_PIX_FMT_FLAG_... flags. + */ + uint64_t flags; /** * Parameters that describe how pixels are packed. - * If the format has 2 or 4 components, then alpha is last. * If the format has 1 or 2 components, then luma is 0. - * If the format has 3 or 4 components, - * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; - * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. + * If the format has 3 or 4 components: + * if the RGB flag is set then 0 is red, 1 is green and 2 is blue; + * otherwise 0 is luma, 1 is chroma-U and 2 is chroma-V. + * + * If present, the Alpha channel is always the last component. */ AVComponentDescriptor comp[4]; -}AVPixFmtDescriptor; + + /** + * Alternative comma-separated names. + */ + const char *alias; +} AVPixFmtDescriptor; /** * Pixel format is big-endian. @@ -112,38 +146,32 @@ typedef struct AVPixFmtDescriptor{ * The pixel format contains RGB-like data (as opposed to YUV/grayscale). */ #define AV_PIX_FMT_FLAG_RGB (1 << 5) + /** - * The pixel format is "pseudo-paletted". This means that FFmpeg treats it as - * paletted internally, but the palette is generated by the decoder and is not - * stored in the file. + * The pixel format is "pseudo-paletted". This means that it contains a + * fixed palette in the 2nd plane but the palette is fixed/constant for each + * PIX_FMT. This allows interpreting the data as if it was PAL8, which can + * in some cases be simpler. Or the data can be interpreted purely based on + * the pixel format without using the palette. + * An example of a pseudo-paletted format is AV_PIX_FMT_GRAY8 */ #define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) + /** - * The pixel format has an alpha channel. + * The pixel format has an alpha channel. This is set on all formats that + * support alpha in some way. The exception is AV_PIX_FMT_PAL8, which can + * carry alpha as part of the palette. Details are explained in the + * AVPixelFormat enum, and are also encoded in the corresponding + * AVPixFmtDescriptor. + * + * The alpha is always straight, never pre-multiplied. + * + * If a codec or a filter does not support alpha, it should set all alpha to + * opaque, or use the equivalent pixel formats without alpha component, e.g. + * AV_PIX_FMT_RGB0 (or AV_PIX_FMT_RGB24 etc.) instead of AV_PIX_FMT_RGBA. */ #define AV_PIX_FMT_FLAG_ALPHA (1 << 7) -#if FF_API_PIX_FMT -/** - * @deprecated use the AV_PIX_FMT_FLAG_* flags - */ -#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE -#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL -#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM -#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL -#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR -#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB -#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL -#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA -#endif - -#if FF_API_PIX_FMT_DESC -/** - * The array of all the pixel format descriptors. - */ -extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; -#endif - /** * Read a line from an image, and write the values of the * pixel format component c to dst. @@ -160,8 +188,9 @@ extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; * component c in data[1] to dst, rather than the palette indexes in * data[0]. The behavior is undefined if the format is not paletted. */ -void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w, int read_pal_component); /** * Write the values from src to the pixel format component c of an @@ -177,8 +206,9 @@ void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesiz * @param w the width of the line to write, that is the number of * values to write to the image line */ -void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], - const AVPixFmtDescriptor *desc, int x, int y, int c, int w); +void av_write_image_line(const uint16_t *src, uint8_t *data[4], + const int linesize[4], const AVPixFmtDescriptor *desc, + int x, int y, int c, int w); /** * Return the pixel format corresponding to name. @@ -211,7 +241,8 @@ const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); * corresponding info string, or a negative value to print the * corresponding header. */ -char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt); +char *av_get_pix_fmt_string(char *buf, int buf_size, + enum AVPixelFormat pix_fmt); /** * Return the number of bits per pixel used by the pixel format @@ -255,14 +286,14 @@ enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); * Utility function to access log2_chroma_w log2_chroma_h from * the pixel format AVPixFmtDescriptor. * - * See avcodec_get_chroma_sub_sample() for a function that asserts a + * See av_get_chroma_sub_sample() for a function that asserts a * valid pixel format instead of returning an error code. - * Its recommanded that you use avcodec_get_chroma_sub_sample unless + * Its recommended that you use avcodec_get_chroma_sub_sample unless * you do check the return code! * * @param[in] pix_fmt the pixel format - * @param[out] h_shift store log2_chroma_w - * @param[out] v_shift store log2_chroma_h + * @param[out] h_shift store log2_chroma_w (horizontal/width shift) + * @param[out] v_shift store log2_chroma_h (vertical/height shift) * * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format */ @@ -275,8 +306,6 @@ int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, */ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); -void ff_check_pixfmt_descriptors(void); - /** * Utility function to swap the endianness of a pixel format. * @@ -287,5 +316,79 @@ void ff_check_pixfmt_descriptors(void); */ enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +int av_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, + enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * av_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur + * (maximum loss for an invalid dst_pix_fmt). + */ +enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, enum AVPixelFormat dst_pix_fmt2, + enum AVPixelFormat src_pix_fmt, int has_alpha, int *loss_ptr); + +/** + * @return the name for provided color range or NULL if unknown. + */ +const char *av_color_range_name(enum AVColorRange range); + +/** + * @return the name for provided color primaries or NULL if unknown. + */ +const char *av_color_primaries_name(enum AVColorPrimaries primaries); + +/** + * @return the name for provided color transfer or NULL if unknown. + */ +const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer); + +/** + * @return the name for provided color space or NULL if unknown. + */ +const char *av_color_space_name(enum AVColorSpace space); + +/** + * @return the name for provided chroma location or NULL if unknown. + */ +const char *av_chroma_location_name(enum AVChromaLocation location); #endif /* AVUTIL_PIXDESC_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/pixelutils.h b/ThirdParty/ffmpeg/include/libavutil/pixelutils.h new file mode 100644 index 000000000..a8dbc157e --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/pixelutils.h @@ -0,0 +1,52 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXELUTILS_H +#define AVUTIL_PIXELUTILS_H + +#include +#include +#include "common.h" + +/** + * Sum of abs(src1[x] - src2[x]) + */ +typedef int (*av_pixelutils_sad_fn)(const uint8_t *src1, ptrdiff_t stride1, + const uint8_t *src2, ptrdiff_t stride2); + +/** + * Get a potentially optimized pointer to a Sum-of-absolute-differences + * function (see the av_pixelutils_sad_fn prototype). + * + * @param w_bits 1< |X X ... |3 4 X ... X are luma samples, + * | |1 2 1-6 are possible chroma positions + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position + */ +enum AVChromaLocation { + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4 4:2:0, h264 default for 4:2:0 + AVCHROMA_LOC_CENTER = 2, ///< mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0 + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB, ///< Not part of ABI +}; #endif /* AVUTIL_PIXFMT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/random_seed.h b/ThirdParty/ffmpeg/include/libavutil/random_seed.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/random_seed.h rename to ThirdParty/ffmpeg/include/libavutil/random_seed.h diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rational.h b/ThirdParty/ffmpeg/include/libavutil/rational.h similarity index 90% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rational.h rename to ThirdParty/ffmpeg/include/libavutil/rational.h index b9800ee36..289746968 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rational.h +++ b/ThirdParty/ffmpeg/include/libavutil/rational.h @@ -45,6 +45,17 @@ typedef struct AVRational{ int den; ///< denominator } AVRational; +/** + * Create a rational. + * Useful for compilers that do not support compound literals. + * @note The return value is not reduced. + */ +static inline AVRational av_make_q(int num, int den) +{ + AVRational r = { num, den }; + return r; +} + /** * Compare two rationals. * @param a first rational @@ -148,6 +159,13 @@ int av_nearer_q(AVRational q, AVRational q1, AVRational q2); */ int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); +/** + * Converts a AVRational to a IEEE 32bit float. + * + * The float is returned in a uint32_t and its value is platform indepenant. + */ +uint32_t av_q2intfloat(AVRational q); + /** * @} */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.h b/ThirdParty/ffmpeg/include/libavutil/rc4.h similarity index 87% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.h rename to ThirdParty/ffmpeg/include/libavutil/rc4.h index 9362fd888..029cd2ad5 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/rc4.h +++ b/ThirdParty/ffmpeg/include/libavutil/rc4.h @@ -23,16 +23,28 @@ #include -struct AVRC4 { +/** + * @defgroup lavu_rc4 RC4 + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVRC4 { uint8_t state[256]; int x, y; -}; +} AVRC4; + +/** + * Allocate an AVRC4 context. + */ +AVRC4 *av_rc4_alloc(void); /** * @brief Initializes an AVRC4 context. * * @param key_bits must be a multiple of 8 * @param decrypt 0 for encryption, 1 for decryption, currently has no effect + * @return zero on success, negative value otherwise */ int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); @@ -47,4 +59,8 @@ int av_rc4_init(struct AVRC4 *d, const uint8_t *key, int key_bits, int decrypt); */ void av_rc4_crypt(struct AVRC4 *d, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); +/** + * @} + */ + #endif /* AVUTIL_RC4_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/replaygain.h b/ThirdParty/ffmpeg/include/libavutil/replaygain.h new file mode 100644 index 000000000..5c03e1993 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/replaygain.h @@ -0,0 +1,51 @@ +/* + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_REPLAYGAIN_H +#define AVUTIL_REPLAYGAIN_H + +#include + +/** + * ReplayGain information (see + * http://wiki.hydrogenaudio.org/index.php?title=ReplayGain_1.0_specification). + * The size of this struct is a part of the public ABI. + */ +typedef struct AVReplayGain { + /** + * Track replay gain in microbels (divide by 100000 to get the value in dB). + * Should be set to INT32_MIN when unknown. + */ + int32_t track_gain; + /** + * Peak track amplitude, with 100000 representing full scale (but values + * may overflow). 0 when unknown. + */ + uint32_t track_peak; + /** + * Same as track_gain, but for the whole album. + */ + int32_t album_gain; + /** + * Same as track_peak, but for the whole album, + */ + uint32_t album_peak; +} AVReplayGain; + +#endif /* AVUTIL_REPLAYGAIN_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/ripemd.h b/ThirdParty/ffmpeg/include/libavutil/ripemd.h new file mode 100644 index 000000000..7b0c8bc89 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/ripemd.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * Copyright (C) 2013 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RIPEMD_H +#define AVUTIL_RIPEMD_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_ripemd RIPEMD + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_ripemd_size; + +struct AVRIPEMD; + +/** + * Allocate an AVRIPEMD context. + */ +struct AVRIPEMD *av_ripemd_alloc(void); + +/** + * Initialize RIPEMD hashing. + * + * @param context pointer to the function context (of size av_ripemd_size) + * @param bits number of bits in digest (128, 160, 256 or 320 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_ripemd_init(struct AVRIPEMD* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_ripemd_update(struct AVRIPEMD* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_ripemd_final(struct AVRIPEMD* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_RIPEMD_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.h b/ThirdParty/ffmpeg/include/libavutil/samplefmt.h similarity index 91% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.h rename to ThirdParty/ffmpeg/include/libavutil/samplefmt.h index db17d43bc..6a8a031c0 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/samplefmt.h +++ b/ThirdParty/ffmpeg/include/libavutil/samplefmt.h @@ -25,26 +25,36 @@ #include "attributes.h" /** - * Audio Sample Formats + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @{ + * + */ + +/** + * Audio sample formats + * + * - The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * - The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: * * @par - * The data described by the sample format is always in native-endian order. - * Sample values can be expressed by native C types, hence the lack of a signed - * 24-bit sample format even though it is a common raw audio data format. - * - * @par - * The floating-point formats are based on full volume being in the range - * [-1.0, 1.0]. Any values outside this range are beyond full volume level. - * - * @par - * The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg - * (such as AVFrame in libavcodec) is as follows: - * * For planar sample formats, each audio channel is in a separate data plane, * and linesize is the buffer size, in bytes, for a single plane. All data * planes must be the same size. For packed sample formats, only the first data * plane is used, and samples for each channel are interleaved. In this case, * linesize is the buffer size, in bytes, for the 1 plane. + * */ enum AVSampleFormat { AV_SAMPLE_FMT_NONE = -1, @@ -119,14 +129,6 @@ enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); */ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); -#if FF_API_GET_BITS_PER_SAMPLE_FMT -/** - * @deprecated Use av_get_bytes_per_sample() instead. - */ -attribute_deprecated -int av_get_bits_per_sample_fmt(enum AVSampleFormat sample_fmt); -#endif - /** * Return number of bytes per sample. * @@ -157,6 +159,15 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align); +/** + * @} + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @{ + */ + /** * Fill plane data pointers and linesize for samples with sample * format sample_fmt. @@ -253,4 +264,8 @@ int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, int nb_channels, enum AVSampleFormat sample_fmt); +/** + * @} + * @} + */ #endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/sha.h b/ThirdParty/ffmpeg/include/libavutil/sha.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/sha.h rename to ThirdParty/ffmpeg/include/libavutil/sha.h diff --git a/ThirdParty/ffmpeg/include/libavutil/sha512.h b/ThirdParty/ffmpeg/include/libavutil/sha512.h new file mode 100644 index 000000000..7b0870147 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/sha512.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * Copyright (C) 2013 James Almer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA512_H +#define AVUTIL_SHA512_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha512 SHA512 + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_sha512_size; + +struct AVSHA512; + +/** + * Allocate an AVSHA512 context. + */ +struct AVSHA512 *av_sha512_alloc(void); + +/** + * Initialize SHA-2 512 hashing. + * + * @param context pointer to the function context (of size av_sha512_size) + * @param bits number of bits in digest (224, 256, 384 or 512 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha512_init(struct AVSHA512* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha512_update(struct AVSHA512* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha512_final(struct AVSHA512* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA512_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/stereo3d.h b/ThirdParty/ffmpeg/include/libavutil/stereo3d.h new file mode 100644 index 000000000..1135dc9dd --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/stereo3d.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2013 Vittorio Giovara + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_STEREO3D_H +#define AVUTIL_STEREO3D_H + +#include + +#include "frame.h" + +/** + * List of possible 3D Types + */ +enum AVStereo3DType { + /** + * Video is not stereoscopic (and metadata has to be there). + */ + AV_STEREO3D_2D, + + /** + * Views are next to each other. + * + * LLLLRRRR + * LLLLRRRR + * LLLLRRRR + * ... + */ + AV_STEREO3D_SIDEBYSIDE, + + /** + * Views are on top of each other. + * + * LLLLLLLL + * LLLLLLLL + * RRRRRRRR + * RRRRRRRR + */ + AV_STEREO3D_TOPBOTTOM, + + /** + * Views are alternated temporally. + * + * frame0 frame1 frame2 ... + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * ... ... ... + */ + AV_STEREO3D_FRAMESEQUENCE, + + /** + * Views are packed in a checkerboard-like structure per pixel. + * + * LRLRLRLR + * RLRLRLRL + * LRLRLRLR + * ... + */ + AV_STEREO3D_CHECKERBOARD, + + /** + * Views are next to each other, but when upscaling + * apply a checkerboard pattern. + * + * LLLLRRRR L L L L R R R R + * LLLLRRRR => L L L L R R R R + * LLLLRRRR L L L L R R R R + * LLLLRRRR L L L L R R R R + */ + AV_STEREO3D_SIDEBYSIDE_QUINCUNX, + + /** + * Views are packed per line, as if interlaced. + * + * LLLLLLLL + * RRRRRRRR + * LLLLLLLL + * ... + */ + AV_STEREO3D_LINES, + + /** + * Views are packed per column. + * + * LRLRLRLR + * LRLRLRLR + * LRLRLRLR + * ... + */ + AV_STEREO3D_COLUMNS, +}; + + +/** + * Inverted views, Right/Bottom represents the left view. + */ +#define AV_STEREO3D_FLAG_INVERT (1 << 0) + +/** + * Stereo 3D type: this structure describes how two videos are packed + * within a single video surface, with additional information as needed. + * + * @note The struct must be allocated with av_stereo3d_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVStereo3D { + /** + * How views are packed within the video. + */ + enum AVStereo3DType type; + + /** + * Additional information about the frame packing. + */ + int flags; +} AVStereo3D; + +/** + * Allocate an AVStereo3D structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVStereo3D filled with default values or NULL on failure. + */ +AVStereo3D *av_stereo3d_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVStereo3D structure to be filled by caller. + */ +AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); + +#endif /* AVUTIL_STEREO3D_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/tea.h b/ThirdParty/ffmpeg/include/libavutil/tea.h new file mode 100644 index 000000000..dd929bdaf --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/tea.h @@ -0,0 +1,71 @@ +/* + * A 32-bit implementation of the TEA algorithm + * Copyright (c) 2015 Vesselin Bontchev + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TEA_H +#define AVUTIL_TEA_H + +#include + +/** + * @file + * @brief Public header for libavutil TEA algorithm + * @defgroup lavu_tea TEA + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_tea_size; + +struct AVTEA; + +/** + * Allocate an AVTEA context + * To free the struct: av_free(ptr) + */ +struct AVTEA *av_tea_alloc(void); + +/** + * Initialize an AVTEA context. + * + * @param ctx an AVTEA context + * @param key a key of 16 bytes used for encryption/decryption + * @param rounds the number of rounds in TEA (64 is the "standard") + */ +void av_tea_init(struct AVTEA *ctx, const uint8_t key[16], int rounds); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_tea_crypt(struct AVTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_TEA_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/threadmessage.h b/ThirdParty/ffmpeg/include/libavutil/threadmessage.h new file mode 100644 index 000000000..e256cae9d --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/threadmessage.h @@ -0,0 +1,107 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with FFmpeg; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_THREADMESSAGE_H +#define AVUTIL_THREADMESSAGE_H + +typedef struct AVThreadMessageQueue AVThreadMessageQueue; + +typedef enum AVThreadMessageFlags { + + /** + * Perform non-blocking operation. + * If this flag is set, send and recv operations are non-blocking and + * return AVERROR(EAGAIN) immediately if they can not proceed. + */ + AV_THREAD_MESSAGE_NONBLOCK = 1, + +} AVThreadMessageFlags; + +/** + * Allocate a new message queue. + * + * @param mq pointer to the message queue + * @param nelem maximum number of elements in the queue + * @param elsize size of each element in the queue + * @return >=0 for success; <0 for error, in particular AVERROR(ENOSYS) if + * lavu was built without thread support + */ +int av_thread_message_queue_alloc(AVThreadMessageQueue **mq, + unsigned nelem, + unsigned elsize); + +/** + * Free a message queue. + * + * The message queue must no longer be in use by another thread. + */ +void av_thread_message_queue_free(AVThreadMessageQueue **mq); + +/** + * Send a message on the queue. + */ +int av_thread_message_queue_send(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Receive a message from the queue. + */ +int av_thread_message_queue_recv(AVThreadMessageQueue *mq, + void *msg, + unsigned flags); + +/** + * Set the sending error code. + * + * If the error code is set to non-zero, av_thread_message_queue_recv() will + * return it immediately when there are no longer available messages. + * Conventional values, such as AVERROR_EOF or AVERROR(EAGAIN), can be used + * to cause the receiving thread to stop or suspend its operation. + */ +void av_thread_message_queue_set_err_send(AVThreadMessageQueue *mq, + int err); + +/** + * Set the receiving error code. + * + * If the error code is set to non-zero, av_thread_message_queue_send() will + * return it immediately. Conventional values, such as AVERROR_EOF or + * AVERROR(EAGAIN), can be used to cause the sending thread to stop or + * suspend its operation. + */ +void av_thread_message_queue_set_err_recv(AVThreadMessageQueue *mq, + int err); + +/** + * Set the optional free message callback function which will be called if an + * operation is removing messages from the queue. + */ +void av_thread_message_queue_set_free_func(AVThreadMessageQueue *mq, + void (*free_func)(void *msg)); + +/** + * Flush the message queue + * + * This function is mostly equivalent to reading and free-ing every message + * except that it will be done in a single operation (no lock/unlock between + * reads). + */ +void av_thread_message_flush(AVThreadMessageQueue *mq); + +#endif /* AVUTIL_THREADMESSAGE_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time_.h b/ThirdParty/ffmpeg/include/libavutil/time.h similarity index 71% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time_.h rename to ThirdParty/ffmpeg/include/libavutil/time.h index 90eb43694..dc169b064 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/time_.h +++ b/ThirdParty/ffmpeg/include/libavutil/time.h @@ -28,6 +28,21 @@ */ int64_t av_gettime(void); +/** + * Get the current time in microseconds since some unspecified starting point. + * On platforms that support it, the time comes from a monotonic clock + * This property makes this time source ideal for measuring relative time. + * The returned values may not be monotonic on platforms where a monotonic + * clock is not available. + */ +int64_t av_gettime_relative(void); + +/** + * Indicates with a boolean result if the av_gettime_relative() time source + * is monotonic. + */ +int av_gettime_relative_is_monotonic(void); + /** * Sleep for a period of time. Although the duration is expressed in * microseconds, the actual delay may be rounded to the precision of the diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timecode.h b/ThirdParty/ffmpeg/include/libavutil/timecode.h similarity index 100% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timecode.h rename to ThirdParty/ffmpeg/include/libavutil/timecode.h diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timestamp.h b/ThirdParty/ffmpeg/include/libavutil/timestamp.h similarity index 94% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timestamp.h rename to ThirdParty/ffmpeg/include/libavutil/timestamp.h index f63a08c57..f010a7ee3 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/timestamp.h +++ b/ThirdParty/ffmpeg/include/libavutil/timestamp.h @@ -26,6 +26,10 @@ #include "common.h" +#if defined(__cplusplus) && !defined(__STDC_FORMAT_MACROS) && !defined(PRId64) +#error missing -D__STDC_FORMAT_MACROS / #define __STDC_FORMAT_MACROS +#endif + #define AV_TS_MAX_STRING_SIZE 32 /** diff --git a/ThirdParty/ffmpeg/include/libavutil/tree.h b/ThirdParty/ffmpeg/include/libavutil/tree.h new file mode 100644 index 000000000..e1aefaa9f --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/tree.h @@ -0,0 +1,138 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * A tree container. + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_TREE_H +#define AVUTIL_TREE_H + +#include "attributes.h" +#include "version.h" + +/** + * @addtogroup lavu_tree AVTree + * @ingroup lavu_data + * + * Low-complexity tree container + * + * Insertion, removal, finding equal, largest which is smaller than and + * smallest which is larger than, all have O(log n) worst-case complexity. + * @{ + */ + + +struct AVTreeNode; +extern const int av_tree_node_size; + +/** + * Allocate an AVTreeNode. + */ +struct AVTreeNode *av_tree_node_alloc(void); + +/** + * Find an element. + * @param root a pointer to the root node of the tree + * @param next If next is not NULL, then next[0] will contain the previous + * element and next[1] the next element. If either does not exist, + * then the corresponding entry in next is unchanged. + * @param cmp compare function used to compare elements in the tree, + * API identical to that of Standard C's qsort + * It is guranteed that the first and only the first argument to cmp() + * will be the key parameter to av_tree_find(), thus it could if the + * user wants, be a different type (like an opaque context). + * @return An element with cmp(key, elem) == 0 or NULL if no such element + * exists in the tree. + */ +void *av_tree_find(const struct AVTreeNode *root, void *key, + int (*cmp)(const void *key, const void *b), void *next[2]); + +/** + * Insert or remove an element. + * + * If *next is NULL, then the supplied element will be removed if it exists. + * If *next is non-NULL, then the supplied element will be inserted, unless + * it already exists in the tree. + * + * @param rootp A pointer to a pointer to the root node of the tree; note that + * the root node can change during insertions, this is required + * to keep the tree balanced. + * @param key pointer to the element key to insert in the tree + * @param next Used to allocate and free AVTreeNodes. For insertion the user + * must set it to an allocated and zeroed object of at least + * av_tree_node_size bytes size. av_tree_insert() will set it to + * NULL if it has been consumed. + * For deleting elements *next is set to NULL by the user and + * av_tree_insert() will set it to the AVTreeNode which was + * used for the removed element. + * This allows the use of flat arrays, which have + * lower overhead compared to many malloced elements. + * You might want to define a function like: + * @code + * void *tree_insert(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b), + * AVTreeNode **next) + * { + * if (!*next) + * *next = av_mallocz(av_tree_node_size); + * return av_tree_insert(rootp, key, cmp, next); + * } + * void *tree_remove(struct AVTreeNode **rootp, void *key, + * int (*cmp)(void *key, const void *b, AVTreeNode **next)) + * { + * av_freep(next); + * return av_tree_insert(rootp, key, cmp, next); + * } + * @endcode + * @param cmp compare function used to compare elements in the tree, API identical + * to that of Standard C's qsort + * @return If no insertion happened, the found element; if an insertion or + * removal happened, then either key or NULL will be returned. + * Which one it is depends on the tree state and the implementation. You + * should make no assumptions that it's one or the other in the code. + */ +void *av_tree_insert(struct AVTreeNode **rootp, void *key, + int (*cmp)(const void *key, const void *b), + struct AVTreeNode **next); + +void av_tree_destroy(struct AVTreeNode *t); + +/** + * Apply enu(opaque, &elem) to all the elements in the tree in a given range. + * + * @param cmp a comparison function that returns < 0 for a element below the + * range, > 0 for a element above the range and == 0 for a + * element inside the range + * + * @note The cmp function should use the same ordering used to construct the + * tree. + */ +void av_tree_enumerate(struct AVTreeNode *t, void *opaque, + int (*cmp)(void *opaque, void *elem), + int (*enu)(void *opaque, void *elem)); + +/** + * @} + */ + +#endif /* AVUTIL_TREE_H */ diff --git a/ThirdParty/ffmpeg/include/libavutil/twofish.h b/ThirdParty/ffmpeg/include/libavutil/twofish.h new file mode 100644 index 000000000..813cfecdf --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/twofish.h @@ -0,0 +1,70 @@ +/* + * An implementation of the TwoFish algorithm + * Copyright (c) 2015 Supraja Meedinti + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TWOFISH_H +#define AVUTIL_TWOFISH_H + +#include + + +/** + * @file + * @brief Public header for libavutil TWOFISH algorithm + * @defgroup lavu_twofish TWOFISH + * @ingroup lavu_crypto + * @{ + */ + +extern const int av_twofish_size; + +struct AVTWOFISH; + +/** + * Allocate an AVTWOFISH context + * To free the struct: av_free(ptr) + */ +struct AVTWOFISH *av_twofish_alloc(void); + +/** + * Initialize an AVTWOFISH context. + * + * @param ctx an AVTWOFISH context + * @param key a key of size ranging from 1 to 32 bytes used for encryption/decryption + * @param key_bits number of keybits: 128, 192, 256 If less than the required, padded with zeroes to nearest valid value; return value is 0 if key_bits is 128/192/256, -1 if less than 0, 1 otherwise + */ +int av_twofish_init(struct AVTWOFISH *ctx, const uint8_t *key, int key_bits); + +/** + * Encrypt or decrypt a buffer using a previously initialized context + * + * @param ctx an AVTWOFISH context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 16 byte blocks + * @paran iv initialization vector for CBC mode, NULL for ECB mode + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_twofish_crypt(struct AVTWOFISH *ctx, uint8_t *dst, const uint8_t *src, int count, uint8_t* iv, int decrypt); + +/** + * @} + */ +#endif /* AVUTIL_TWOFISH_H */ diff --git a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/version.h b/ThirdParty/ffmpeg/include/libavutil/version.h similarity index 57% rename from Frameworks/FFMPEG/ffmpeg-minimal/libavutil/version.h rename to ThirdParty/ffmpeg/include/libavutil/version.h index fc959ebd7..0ea8c7946 100644 --- a/Frameworks/FFMPEG/ffmpeg-minimal/libavutil/version.h +++ b/ThirdParty/ffmpeg/include/libavutil/version.h @@ -24,7 +24,7 @@ #include "macros.h" /** - * @defgroup version_utils Library Version Macros + * @addtogroup version_utils * * Useful to check and match library version in order to maintain * backward compatibility. @@ -32,10 +32,18 @@ * @{ */ -#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) #define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) +/** + * Extract version components from the full ::AV_VERSION_INT int as returned + * by functions like ::avformat_version() and ::avcodec_version() + */ +#define AV_VERSION_MAJOR(a) ((a) >> 16) +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) +#define AV_VERSION_MICRO(a) ((a) & 0xFF) + /** * @} */ @@ -55,9 +63,9 @@ * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 52 -#define LIBAVUTIL_VERSION_MINOR 66 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MAJOR 55 +#define LIBAVUTIL_VERSION_MINOR 17 +#define LIBAVUTIL_VERSION_MICRO 103 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ @@ -77,70 +85,44 @@ * dropped at a future version bump. The defines themselves are not part of * the public API and may change, break or disappear at any time. * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * * @{ */ -#ifndef FF_API_GET_BITS_PER_SAMPLE_FMT -#define FF_API_GET_BITS_PER_SAMPLE_FMT (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_FIND_OPT -#define FF_API_FIND_OPT (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_OLD_AVOPTIONS -#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_PIX_FMT -#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_CONTEXT_SIZE -#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_PIX_FMT_DESC -#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_AV_REVERSE -#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_AUDIOCONVERT -#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_CPU_FLAG_MMX2 -#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_SAMPLES_UTILS_RETURN_ZERO -#define FF_API_SAMPLES_UTILS_RETURN_ZERO (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_LLS_PRIVATE -#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_LLS1 -#define FF_API_LLS1 (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_AVFRAME_LAVC -#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 54) -#endif #ifndef FF_API_VDPAU -#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_GET_CHANNEL_LAYOUT_COMPAT -#define FF_API_GET_CHANNEL_LAYOUT_COMPAT (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_OLD_OPENCL -#define FF_API_OLD_OPENCL (LIBAVUTIL_VERSION_MAJOR < 54) +#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 56) #endif #ifndef FF_API_XVMC -#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 54) -#endif -#ifndef FF_API_INTFLOAT -#define FF_API_INTFLOAT (LIBAVUTIL_VERSION_MAJOR < 54) +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 56) #endif #ifndef FF_API_OPT_TYPE_METADATA -#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 54) +#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 56) #endif +#ifndef FF_API_DLOG +#define FF_API_DLOG (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_VAAPI +#define FF_API_VAAPI (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_FRAME_QP +#define FF_API_FRAME_QP (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_PLUS1_MINUS1 +#define FF_API_PLUS1_MINUS1 (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_ERROR_FRAME +#define FF_API_ERROR_FRAME (LIBAVUTIL_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_CRC_BIG_TABLE +#define FF_API_CRC_BIG_TABLE (LIBAVUTIL_VERSION_MAJOR < 56) +#endif + /** * @} */ #endif /* AVUTIL_VERSION_H */ - diff --git a/ThirdParty/ffmpeg/include/libavutil/xtea.h b/ThirdParty/ffmpeg/include/libavutil/xtea.h new file mode 100644 index 000000000..735427c10 --- /dev/null +++ b/ThirdParty/ffmpeg/include/libavutil/xtea.h @@ -0,0 +1,94 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * Copyright (c) 2012 Samuel Pitoiset + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include + +/** + * @file + * @brief Public header for libavutil XTEA algorithm + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Allocate an AVXTEA context. + */ +AVXTEA *av_xtea_alloc(void); + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as big endian 32 bit numbers + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption, + * interpreted as little endian 32 bit numbers + */ +void av_xtea_le_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in big endian format. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context, + * in little endian format. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_le_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/ThirdParty/ffmpeg/lib/libavcodec.a b/ThirdParty/ffmpeg/lib/libavcodec.a new file mode 100644 index 000000000..66d8d4c16 Binary files /dev/null and b/ThirdParty/ffmpeg/lib/libavcodec.a differ diff --git a/ThirdParty/ffmpeg/lib/libavformat.a b/ThirdParty/ffmpeg/lib/libavformat.a new file mode 100644 index 000000000..c9887b3a4 Binary files /dev/null and b/ThirdParty/ffmpeg/lib/libavformat.a differ diff --git a/ThirdParty/ffmpeg/lib/libavutil.a b/ThirdParty/ffmpeg/lib/libavutil.a new file mode 100644 index 000000000..7f7bda7df Binary files /dev/null and b/ThirdParty/ffmpeg/lib/libavutil.a differ diff --git a/ThirdParty/ffmpeg/lib/pkgconfig/libavcodec.pc b/ThirdParty/ffmpeg/lib/pkgconfig/libavcodec.pc new file mode 100644 index 000000000..6d13066a4 --- /dev/null +++ b/ThirdParty/ffmpeg/lib/pkgconfig/libavcodec.pc @@ -0,0 +1,14 @@ +prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: libavcodec +Description: FFmpeg codec library +Version: 57.24.102 +Requires: libavutil >= 55.17.103 +Requires.private: +Conflicts: +Libs: -L${libdir} -lavcodec -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreVideo -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/usr/local/Cellar/dcadec/0.2.0/lib -ldcadec -lm -lz -pthread -framework CoreServices +Libs.private: +Cflags: -I${includedir} diff --git a/ThirdParty/ffmpeg/lib/pkgconfig/libavformat.pc b/ThirdParty/ffmpeg/lib/pkgconfig/libavformat.pc new file mode 100644 index 000000000..add252287 --- /dev/null +++ b/ThirdParty/ffmpeg/lib/pkgconfig/libavformat.pc @@ -0,0 +1,14 @@ +prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: libavformat +Description: FFmpeg container format library +Version: 57.25.100 +Requires: libavcodec >= 57.24.102, libavutil >= 55.17.103 +Requires.private: +Conflicts: +Libs: -L${libdir} -lavformat -framework CoreFoundation -framework VideoToolbox -framework CoreMedia -framework QuartzCore -framework CoreVideo -framework CoreFoundation -framework VideoDecodeAcceleration -framework QuartzCore -liconv -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa -L/usr/local/Cellar/dcadec/0.2.0/lib -ldcadec -lm -lz -pthread -framework CoreServices +Libs.private: +Cflags: -I${includedir} diff --git a/ThirdParty/ffmpeg/lib/pkgconfig/libavutil.pc b/ThirdParty/ffmpeg/lib/pkgconfig/libavutil.pc new file mode 100644 index 000000000..c4828f41d --- /dev/null +++ b/ThirdParty/ffmpeg/lib/pkgconfig/libavutil.pc @@ -0,0 +1,14 @@ +prefix=/Users/Chris/Source/Repos/cog/ThirdParty/ffmpeg +exec_prefix=${prefix} +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: libavutil +Description: FFmpeg utility library +Version: 55.17.103 +Requires: +Requires.private: +Conflicts: +Libs: -L${libdir} -lavutil -lm +Libs.private: +Cflags: -I${includedir}